Skip to content

Commit ccd8dcd

Browse files
author
John Agan
authored
V1.2.3 - Fixed Typos and Tests (#77)
* bumped version to v1.2.3 * corrected: types on types and comments * fixed: tests that checked for functions
1 parent f131e9a commit ccd8dcd

File tree

12 files changed

+37
-44
lines changed

12 files changed

+37
-44
lines changed

package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "webflow-api",
33
"description": "Webflow's official Node.js SDK for Data APIs",
4-
"version": "1.2.2",
4+
"version": "1.2.3",
55
"types": "dist/index.d.ts",
66
"main": "dist/index.js",
77
"contributors": [
@@ -12,12 +12,6 @@
1212
"type": "git"
1313
},
1414
"license": "MIT",
15-
"files": [
16-
"dist",
17-
"src",
18-
"LICENSE",
19-
"yarn.lock"
20-
],
2115
"scripts": {
2216
"test": "yarn build && jest",
2317
"build": "yarn clean && tsc",

src/api/collection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export type CollectionField = {
3232
required: boolean;
3333
editable: boolean;
3434
// TODO: add a better type
35-
validations?: Record<string, string | number | boolean | object>;
35+
validations?: Record<string, any>;
3636
};
3737

3838
/**************************************************************

src/api/item.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface IDeletedItems {
3636
/**************************************************************
3737
* Types
3838
**************************************************************/
39-
export type PageinatedItems = PaginatedData & {
39+
export type PaginatedItems = PaginatedData & {
4040
items: IItem[];
4141
};
4242

@@ -77,7 +77,7 @@ export class Item extends WebflowRecord<IItem> implements IItem {
7777
requireArgs({ collectionId, itemId });
7878
const path = `/collections/${collectionId}/items/${itemId}`;
7979
// The API returns a paginated list with one record :(
80-
return client.get<PageinatedItems>(path);
80+
return client.get<PaginatedItems>(path);
8181
}
8282

8383
/**
@@ -96,7 +96,7 @@ export class Item extends WebflowRecord<IItem> implements IItem {
9696
requireArgs({ collectionId });
9797
const params = { limit, offset };
9898
const path = `/collections/${collectionId}/items`;
99-
return client.get<PageinatedItems>(path, { params });
99+
return client.get<PaginatedItems>(path, { params });
100100
}
101101

102102
/**
@@ -192,7 +192,7 @@ export class Item extends WebflowRecord<IItem> implements IItem {
192192
}
193193

194194
/**
195-
* Unpublishes a list of Items
195+
* Unpublish a list of Items
196196
* @param params The params for the request
197197
* @param params.collectionId The Collection ID
198198
* @param params.live Unpublish from the live site

src/api/meta.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface IAuthenticatedUser {
2424
};
2525
}
2626

27-
export interface IAuthentiationInfo {
27+
export interface IAuthenticationInfo {
2828
application: InfoApplication;
2929
workspaces: string[];
3030
rateLimit: number;
@@ -48,7 +48,7 @@ export class Meta {
4848
* @returns The authentication info
4949
*/
5050
static info(client: AxiosInstance) {
51-
return client.get<IAuthentiationInfo>("/info");
51+
return client.get<IAuthenticationInfo>("/info");
5252
}
5353

5454
/**

src/core/error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class RequestError extends Error implements IRequestError {
1616
err: string;
1717

1818
constructor(error: IRequestError) {
19-
super(error.err ? error.err : "Unknown error occured");
19+
super(error.err ? error.err : "Unknown error occurred");
2020
Object.assign(this, error);
2121
}
2222
}

src/core/webflow.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ export class Webflow {
328328
return res.data;
329329
}
330330
/**
331-
* Upublish a Collection Item
331+
* Unpublish a Collection Item
332332
* @param params The Item information
333333
* @param params.collectionId The Collection ID
334334
* @param params.itemId The Item ID
@@ -503,7 +503,7 @@ export class Webflow {
503503
* @param params.siteId The Site Id
504504
* @param params.url The Url the Webhook should call on events
505505
* @param params.triggerType The type of event that should trigger the Webhook
506-
* @param params.filter The filter to apply to the Webhook (form_submssion only)
506+
* @param params.filter The filter to apply to the Webhook (form_submission only)
507507
* @returns The created webhook
508508
*/
509509
async createWebhook({

tests/api/collection.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ describe("Collection", () => {
5757
expect(result[0]._id).toBe(response.items[0]._id);
5858

5959
// item wrapper functions
60-
expect(result[0].update).toBeDefined();
61-
expect(result[0].remove).toBeDefined();
60+
expect(typeof result[0].update).toBe("function");
61+
expect(typeof result[0].remove).toBe("function");
6262
});
6363

6464
it("should respond with a single item", async () => {
@@ -78,8 +78,8 @@ describe("Collection", () => {
7878
expect(result._id).toBe(response.items[0]._id);
7979

8080
// item wrapper functions
81-
expect(result.update).toBeDefined();
82-
expect(result.remove).toBeDefined();
81+
expect(typeof result.update).toBe("function");
82+
expect(typeof result.remove).toBe("function");
8383
});
8484

8585
it("should create an item", async () => {
@@ -99,8 +99,8 @@ describe("Collection", () => {
9999
expect(result._id).toBe(response._id);
100100

101101
// item wrapper functions
102-
expect(result.update).toBeDefined();
103-
expect(result.remove).toBeDefined();
102+
expect(typeof result.update).toBe("function");
103+
expect(typeof result.remove).toBe("function");
104104
});
105105

106106
it("should update an item", async () => {
@@ -123,8 +123,8 @@ describe("Collection", () => {
123123
expect(result._id).toBe(response._id);
124124

125125
// item wrapper functions
126-
expect(result.update).toBeDefined();
127-
expect(result.remove).toBeDefined();
126+
expect(typeof result.update).toBe("function");
127+
expect(typeof result.remove).toBe("function");
128128
});
129129

130130
it("should remove an item", async () => {

tests/api/item.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ describe("Items", () => {
156156
expect(result._id).toBe(response._id);
157157

158158
// item wrapper functions
159-
expect(result.update).toBeDefined();
160-
expect(result.remove).toBeDefined();
159+
expect(typeof result.update).toBe("function");
160+
expect(typeof result.remove).toBe("function");
161161
});
162162

163163
it("should remove an item", async () => {

tests/api/oauth.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe("OAuth", () => {
1717
const query = new URLSearchParams({ response_type, client_id, state });
1818

1919
expect(url).toBeDefined();
20-
expect(url).toBe(`${baseURL.replace("api.", "")}/oauth/authorize?${query}`);
20+
expect(url).toBe(`${baseURL.replace("api.", "")}/oauth/authorize?${query.toString()}`);
2121
});
2222

2323
it("should generate an access token", async () => {

tests/api/site.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ describe("Sites", () => {
8080
expect(first._id).toBe(response[0]._id);
8181

8282
// collection wrapper functions
83-
expect(first.item).toBeDefined();
84-
expect(first.items).toBeDefined();
85-
expect(first.removeItem).toBeDefined();
86-
expect(first.createItem).toBeDefined();
87-
expect(first.updateItem).toBeDefined();
83+
expect(typeof first.item).toBe("function");
84+
expect(typeof first.items).toBe("function");
85+
expect(typeof first.removeItem).toBe("function");
86+
expect(typeof first.createItem).toBe("function");
87+
expect(typeof first.updateItem).toBe("function");
8888
});
8989

9090
it("should respond with a list of webhooks", async () => {
@@ -106,7 +106,7 @@ describe("Sites", () => {
106106
expect(first._id).toBe(response[0]._id);
107107

108108
// webhook wrapper functions
109-
expect(first.remove).toBeDefined();
109+
expect(typeof first.remove).toBe("function");
110110
});
111111

112112
it("should respond with a single webhook", async () => {
@@ -125,7 +125,7 @@ describe("Sites", () => {
125125
expect(result._id).toBe(response._id);
126126

127127
// webhook wrapper functions
128-
expect(result.remove).toBeDefined();
128+
expect(typeof result.remove).toBe("function");
129129
});
130130

131131
it("should create a webhook", async () => {
@@ -144,7 +144,7 @@ describe("Sites", () => {
144144
expect(result._id).toBe(response._id);
145145

146146
// webhook wrapper functions
147-
expect(result.remove).toBeDefined();
147+
expect(typeof result.remove).toBe("function");
148148
});
149149

150150
it("should remove a webhook", async () => {

0 commit comments

Comments
 (0)