webflow-api 3.2.1 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mock/definition/__package__.yml +20 -20
- package/.mock/definition/accessGroups.yml +12 -5
- package/.mock/definition/assets.yml +7 -4
- package/.mock/definition/collections/items.yml +14 -16
- package/.mock/definition/collections.yml +3 -0
- package/.mock/definition/comments.yml +1 -0
- package/.mock/definition/components.yml +16 -12
- package/.mock/definition/forms.yml +15 -88
- package/.mock/definition/items.yml +1 -0
- package/.mock/definition/orders.yml +82 -4
- package/.mock/definition/pages.yml +17 -8
- package/.mock/definition/products.yml +4 -4
- package/.mock/definition/scripts.yml +5 -1
- package/.mock/definition/sites/activityLogs.yml +8 -4
- package/.mock/definition/sites/comments.yml +14 -12
- package/.mock/definition/sites/forms.yml +316 -0
- package/.mock/definition/sites/scripts.yml +5 -4
- package/.mock/definition/sites.yml +24 -0
- package/.mock/definition/users.yml +66 -14
- package/.mock/definition/webhooks.yml +4 -0
- package/.mock/definition/workspaces/auditLogs.yml +4 -4
- package/.mock/fern.config.json +1 -1
- package/Client.js +2 -2
- package/LICENSE +21 -0
- package/api/resources/accessGroups/client/Client.d.ts +4 -2
- package/api/resources/accessGroups/client/Client.js +4 -2
- package/api/resources/accessGroups/client/requests/AccessGroupsListRequest.d.ts +2 -2
- package/api/resources/assets/client/Client.d.ts +2 -2
- package/api/resources/assets/client/Client.js +2 -2
- package/api/resources/assets/client/requests/AssetsListRequest.d.ts +2 -2
- package/api/resources/collections/resources/items/client/Client.d.ts +10 -12
- package/api/resources/collections/resources/items/client/Client.js +10 -12
- package/api/resources/collections/resources/items/client/requests/ItemsListItemsLiveRequest.d.ts +2 -2
- package/api/resources/collections/resources/items/client/requests/ItemsListItemsRequest.d.ts +2 -2
- package/api/resources/components/client/Client.d.ts +6 -6
- package/api/resources/components/client/Client.js +6 -6
- package/api/resources/components/client/requests/ComponentsGetContentRequest.d.ts +2 -2
- package/api/resources/components/client/requests/ComponentsGetPropertiesRequest.d.ts +2 -2
- package/api/resources/components/client/requests/ComponentsListRequest.d.ts +2 -2
- package/api/resources/forms/client/Client.d.ts +4 -31
- package/api/resources/forms/client/Client.js +4 -131
- package/api/resources/forms/client/requests/FormsListRequest.d.ts +2 -2
- package/api/resources/forms/client/requests/FormsListSubmissionsRequest.d.ts +2 -2
- package/api/resources/forms/client/requests/index.d.ts +0 -1
- package/api/resources/orders/client/Client.d.ts +2 -2
- package/api/resources/orders/client/Client.js +2 -2
- package/api/resources/orders/client/requests/OrdersListRequest.d.ts +2 -2
- package/api/resources/pages/client/Client.d.ts +4 -4
- package/api/resources/pages/client/Client.js +4 -4
- package/api/resources/pages/client/requests/PagesGetContentRequest.d.ts +2 -2
- package/api/resources/pages/client/requests/PagesListRequest.d.ts +2 -2
- package/api/resources/products/client/Client.d.ts +2 -2
- package/api/resources/products/client/Client.js +2 -2
- package/api/resources/products/client/requests/ProductsListRequest.d.ts +2 -2
- package/api/resources/sites/client/Client.d.ts +3 -0
- package/api/resources/sites/client/Client.js +5 -0
- package/api/resources/sites/resources/activityLogs/client/Client.d.ts +2 -2
- package/api/resources/sites/resources/activityLogs/client/Client.js +2 -2
- package/api/resources/sites/resources/activityLogs/client/requests/ActivityLogsListRequest.d.ts +2 -2
- package/api/resources/sites/resources/comments/client/Client.d.ts +6 -6
- package/api/resources/sites/resources/comments/client/Client.js +6 -6
- package/api/resources/sites/resources/comments/client/requests/CommentsGetCommentThreadRequest.d.ts +2 -2
- package/api/resources/sites/resources/comments/client/requests/CommentsListCommentRepliesRequest.d.ts +2 -2
- package/api/resources/sites/resources/comments/client/requests/CommentsListCommentThreadsRequest.d.ts +2 -2
- package/api/resources/sites/resources/forms/client/Client.d.ts +157 -0
- package/api/resources/sites/resources/forms/client/Client.js +662 -0
- package/api/resources/sites/resources/forms/client/index.d.ts +2 -0
- package/api/resources/sites/resources/forms/client/index.js +17 -0
- package/api/resources/{forms → sites/resources/forms}/client/requests/FormsListSubmissionsBySiteRequest.d.ts +2 -2
- package/api/resources/sites/resources/forms/client/requests/FormsListSubmissionsRequest.d.ts +20 -0
- package/api/resources/sites/resources/forms/client/requests/FormsUpdateSubmissionRequest.d.ts +11 -0
- package/api/resources/sites/resources/forms/client/requests/FormsUpdateSubmissionRequest.js +5 -0
- package/api/resources/sites/resources/forms/client/requests/index.d.ts +3 -0
- package/api/resources/sites/resources/forms/client/requests/index.js +2 -0
- package/api/resources/sites/resources/forms/index.d.ts +1 -0
- package/api/resources/sites/resources/forms/index.js +17 -0
- package/api/resources/sites/resources/index.d.ts +2 -0
- package/api/resources/sites/resources/index.js +3 -1
- package/api/resources/sites/resources/scripts/client/Client.d.ts +2 -2
- package/api/resources/sites/resources/scripts/client/Client.js +2 -2
- package/api/resources/sites/resources/scripts/client/requests/ScriptsListCustomCodeBlocksRequest.d.ts +2 -2
- package/api/resources/users/client/Client.d.ts +12 -2
- package/api/resources/users/client/Client.js +12 -2
- package/api/resources/users/client/requests/UsersListRequest.d.ts +2 -2
- package/api/resources/workspaces/resources/auditLogs/client/Client.d.ts +2 -2
- package/api/resources/workspaces/resources/auditLogs/client/Client.js +2 -2
- package/api/resources/workspaces/resources/auditLogs/client/requests/AuditLogsGetWorkspaceAuditLogsRequest.d.ts +2 -2
- package/dist/Client.js +2 -2
- package/dist/api/resources/accessGroups/client/Client.d.ts +4 -2
- package/dist/api/resources/accessGroups/client/Client.js +4 -2
- package/dist/api/resources/accessGroups/client/requests/AccessGroupsListRequest.d.ts +2 -2
- package/dist/api/resources/assets/client/Client.d.ts +2 -2
- package/dist/api/resources/assets/client/Client.js +2 -2
- package/dist/api/resources/assets/client/requests/AssetsListRequest.d.ts +2 -2
- package/dist/api/resources/collections/resources/items/client/Client.d.ts +10 -12
- package/dist/api/resources/collections/resources/items/client/Client.js +10 -12
- package/dist/api/resources/collections/resources/items/client/requests/ItemsListItemsLiveRequest.d.ts +2 -2
- package/dist/api/resources/collections/resources/items/client/requests/ItemsListItemsRequest.d.ts +2 -2
- package/dist/api/resources/components/client/Client.d.ts +6 -6
- package/dist/api/resources/components/client/Client.js +6 -6
- package/dist/api/resources/components/client/requests/ComponentsGetContentRequest.d.ts +2 -2
- package/dist/api/resources/components/client/requests/ComponentsGetPropertiesRequest.d.ts +2 -2
- package/dist/api/resources/components/client/requests/ComponentsListRequest.d.ts +2 -2
- package/dist/api/resources/forms/client/Client.d.ts +4 -31
- package/dist/api/resources/forms/client/Client.js +4 -131
- package/dist/api/resources/forms/client/requests/FormsListRequest.d.ts +2 -2
- package/dist/api/resources/forms/client/requests/FormsListSubmissionsRequest.d.ts +2 -2
- package/dist/api/resources/forms/client/requests/index.d.ts +0 -1
- package/dist/api/resources/orders/client/Client.d.ts +2 -2
- package/dist/api/resources/orders/client/Client.js +2 -2
- package/dist/api/resources/orders/client/requests/OrdersListRequest.d.ts +2 -2
- package/dist/api/resources/pages/client/Client.d.ts +4 -4
- package/dist/api/resources/pages/client/Client.js +4 -4
- package/dist/api/resources/pages/client/requests/PagesGetContentRequest.d.ts +2 -2
- package/dist/api/resources/pages/client/requests/PagesListRequest.d.ts +2 -2
- package/dist/api/resources/products/client/Client.d.ts +2 -2
- package/dist/api/resources/products/client/Client.js +2 -2
- package/dist/api/resources/products/client/requests/ProductsListRequest.d.ts +2 -2
- package/dist/api/resources/sites/client/Client.d.ts +3 -0
- package/dist/api/resources/sites/client/Client.js +5 -0
- package/dist/api/resources/sites/resources/activityLogs/client/Client.d.ts +2 -2
- package/dist/api/resources/sites/resources/activityLogs/client/Client.js +2 -2
- package/dist/api/resources/sites/resources/activityLogs/client/requests/ActivityLogsListRequest.d.ts +2 -2
- package/dist/api/resources/sites/resources/comments/client/Client.d.ts +6 -6
- package/dist/api/resources/sites/resources/comments/client/Client.js +6 -6
- package/dist/api/resources/sites/resources/comments/client/requests/CommentsGetCommentThreadRequest.d.ts +2 -2
- package/dist/api/resources/sites/resources/comments/client/requests/CommentsListCommentRepliesRequest.d.ts +2 -2
- package/dist/api/resources/sites/resources/comments/client/requests/CommentsListCommentThreadsRequest.d.ts +2 -2
- package/dist/api/resources/sites/resources/forms/client/Client.d.ts +157 -0
- package/dist/api/resources/sites/resources/forms/client/Client.js +662 -0
- package/dist/api/resources/sites/resources/forms/client/index.d.ts +2 -0
- package/dist/api/resources/sites/resources/forms/client/index.js +17 -0
- package/dist/api/resources/{forms → sites/resources/forms}/client/requests/FormsListSubmissionsBySiteRequest.d.ts +2 -2
- package/dist/api/resources/sites/resources/forms/client/requests/FormsListSubmissionsBySiteRequest.js +5 -0
- package/dist/api/resources/sites/resources/forms/client/requests/FormsListSubmissionsRequest.d.ts +20 -0
- package/dist/api/resources/sites/resources/forms/client/requests/FormsListSubmissionsRequest.js +5 -0
- package/dist/api/resources/sites/resources/forms/client/requests/FormsUpdateSubmissionRequest.d.ts +11 -0
- package/dist/api/resources/sites/resources/forms/client/requests/FormsUpdateSubmissionRequest.js +5 -0
- package/dist/api/resources/sites/resources/forms/client/requests/index.d.ts +3 -0
- package/dist/api/resources/sites/resources/forms/client/requests/index.js +2 -0
- package/dist/api/resources/sites/resources/forms/index.d.ts +1 -0
- package/dist/api/resources/sites/resources/forms/index.js +17 -0
- package/dist/api/resources/sites/resources/index.d.ts +2 -0
- package/dist/api/resources/sites/resources/index.js +3 -1
- package/dist/api/resources/sites/resources/scripts/client/Client.d.ts +2 -2
- package/dist/api/resources/sites/resources/scripts/client/Client.js +2 -2
- package/dist/api/resources/sites/resources/scripts/client/requests/ScriptsListCustomCodeBlocksRequest.d.ts +2 -2
- package/dist/api/resources/users/client/Client.d.ts +12 -2
- package/dist/api/resources/users/client/Client.js +12 -2
- package/dist/api/resources/users/client/requests/UsersListRequest.d.ts +2 -2
- package/dist/api/resources/workspaces/resources/auditLogs/client/Client.d.ts +2 -2
- package/dist/api/resources/workspaces/resources/auditLogs/client/Client.js +2 -2
- package/dist/api/resources/workspaces/resources/auditLogs/client/requests/AuditLogsGetWorkspaceAuditLogsRequest.d.ts +2 -2
- package/dist/serialization/resources/sites/resources/forms/client/index.d.ts +1 -0
- package/dist/serialization/resources/sites/resources/forms/client/index.js +17 -0
- package/dist/serialization/resources/sites/resources/forms/client/requests/FormsUpdateSubmissionRequest.d.ts +12 -0
- package/dist/serialization/resources/sites/resources/forms/client/requests/FormsUpdateSubmissionRequest.js +43 -0
- package/dist/serialization/resources/sites/resources/forms/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/sites/resources/forms/client/requests/index.js +5 -0
- package/dist/serialization/resources/sites/resources/forms/index.d.ts +1 -0
- package/dist/serialization/resources/sites/resources/forms/index.js +17 -0
- package/dist/serialization/resources/sites/resources/index.d.ts +2 -0
- package/dist/serialization/resources/sites/resources/index.js +3 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/FormsClient.d.ts +37 -0
- package/dist/wrapper/FormsClient.js +193 -0
- package/dist/wrapper/ItemsClient.js +18 -14
- package/dist/wrapper/PagesClient.js +6 -5
- package/dist/wrapper/WebflowClient.d.ts +3 -0
- package/dist/wrapper/WebflowClient.js +6 -5
- package/jest.config.mjs +26 -5
- package/package.json +3 -2
- package/reference.md +458 -125
- package/serialization/resources/sites/resources/forms/client/index.d.ts +1 -0
- package/serialization/resources/sites/resources/forms/client/index.js +17 -0
- package/serialization/resources/sites/resources/forms/client/requests/FormsUpdateSubmissionRequest.d.ts +12 -0
- package/serialization/resources/sites/resources/forms/client/requests/FormsUpdateSubmissionRequest.js +43 -0
- package/serialization/resources/sites/resources/forms/client/requests/index.d.ts +1 -0
- package/serialization/resources/sites/resources/forms/client/requests/index.js +5 -0
- package/serialization/resources/sites/resources/forms/index.d.ts +1 -0
- package/serialization/resources/sites/resources/forms/index.js +17 -0
- package/serialization/resources/sites/resources/index.d.ts +2 -0
- package/serialization/resources/sites/resources/index.js +3 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/FormsClient.d.ts +37 -0
- package/wrapper/FormsClient.js +193 -0
- package/wrapper/ItemsClient.js +18 -14
- package/wrapper/PagesClient.js +6 -5
- package/wrapper/WebflowClient.d.ts +3 -0
- package/wrapper/WebflowClient.js +6 -5
- /package/api/resources/{forms → sites/resources/forms}/client/requests/FormsListSubmissionsBySiteRequest.js +0 -0
- /package/{dist/api/resources/forms/client/requests/FormsListSubmissionsBySiteRequest.js → api/resources/sites/resources/forms/client/requests/FormsListSubmissionsRequest.js} +0 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.Client = void 0;
|
|
49
|
+
const Client_1 = require("../api/resources/forms/client/Client");
|
|
50
|
+
const core = __importStar(require("../core"));
|
|
51
|
+
const Webflow = __importStar(require("../api"));
|
|
52
|
+
const environments = __importStar(require("../environments"));
|
|
53
|
+
const errors = __importStar(require("../errors"));
|
|
54
|
+
const serializers = __importStar(require("../serialization"));
|
|
55
|
+
const headers_1 = require("../core/headers");
|
|
56
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
57
|
+
// Client adapts the base client to persist a deprecated `listSubmissionsBySite` method.
|
|
58
|
+
// Overriding to preserve function and prevent breaking changes.
|
|
59
|
+
class Client extends Client_1.Forms {
|
|
60
|
+
constructor(_options) {
|
|
61
|
+
super(_options);
|
|
62
|
+
this._options = _options;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Use `client.sites.forms.listSubmissionsBySite` instead.
|
|
66
|
+
*
|
|
67
|
+
* List form submissions for a given site. This endpoint differs from the existing [List Form Submissions endpoint](/data/reference/forms/form-submissions/list-submissions) by accepting `siteId` as a path parameter and `elementId` as a query parameter. You can get the `elementId` from the [List forms endpoint](/data/reference/forms/forms/list).
|
|
68
|
+
*
|
|
69
|
+
* Required scope | `forms:read`
|
|
70
|
+
*
|
|
71
|
+
* @param {string} siteId - Unique identifier for a Site
|
|
72
|
+
* @param {Webflow.FormsListSubmissionsBySiteRequest} request
|
|
73
|
+
* @param {Forms.RequestOptions} requestOptions - Request-specific configuration.
|
|
74
|
+
*
|
|
75
|
+
* @throws {@link Webflow.BadRequestError}
|
|
76
|
+
* @throws {@link Webflow.UnauthorizedError}
|
|
77
|
+
* @throws {@link Webflow.ForbiddenError}
|
|
78
|
+
* @throws {@link Webflow.NotFoundError}
|
|
79
|
+
* @throws {@link Webflow.TooManyRequestsError}
|
|
80
|
+
* @throws {@link Webflow.InternalServerError}
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* await client.forms.listSubmissionsBySite("580e63e98c9a982ac9b8b741", {
|
|
84
|
+
* elementId: "18259716-3e5a-646a-5f41-5dc4b9405aa0",
|
|
85
|
+
* offset: 1.1,
|
|
86
|
+
* limit: 1.1
|
|
87
|
+
* })
|
|
88
|
+
*/
|
|
89
|
+
listSubmissionsBySite(siteId, request = {}, requestOptions) {
|
|
90
|
+
return core.HttpResponsePromise.fromPromise(this.__listSubmissionsBySite(siteId, request, requestOptions));
|
|
91
|
+
}
|
|
92
|
+
__listSubmissionsBySite(siteId_1) {
|
|
93
|
+
return __awaiter(this, arguments, void 0, function* (siteId, request = {}, requestOptions) {
|
|
94
|
+
var _a, _b, _c;
|
|
95
|
+
const { elementId, offset, limit } = request;
|
|
96
|
+
const _queryParams = {};
|
|
97
|
+
if (elementId != null) {
|
|
98
|
+
_queryParams.elementId = elementId;
|
|
99
|
+
}
|
|
100
|
+
if (offset != null) {
|
|
101
|
+
_queryParams.offset = offset.toString();
|
|
102
|
+
}
|
|
103
|
+
if (limit != null) {
|
|
104
|
+
_queryParams.limit = limit.toString();
|
|
105
|
+
}
|
|
106
|
+
const _headers = (0, headers_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
107
|
+
const _response = yield core.fetcher({
|
|
108
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.WebflowEnvironment.DataApi)
|
|
109
|
+
.base, `sites/${encodeURIComponent(siteId)}/form_submissions`),
|
|
110
|
+
method: "GET",
|
|
111
|
+
headers: _headers,
|
|
112
|
+
queryParameters: _queryParams,
|
|
113
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
114
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
115
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
116
|
+
});
|
|
117
|
+
if (_response.ok) {
|
|
118
|
+
return {
|
|
119
|
+
data: serializers.FormSubmissionList.parseOrThrow(_response.body, {
|
|
120
|
+
unrecognizedObjectKeys: "passthrough",
|
|
121
|
+
allowUnrecognizedUnionMembers: true,
|
|
122
|
+
allowUnrecognizedEnumValues: true,
|
|
123
|
+
skipValidation: true,
|
|
124
|
+
breadcrumbsPrefix: ["response"],
|
|
125
|
+
}),
|
|
126
|
+
rawResponse: _response.rawResponse,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
if (_response.error.reason === "status-code") {
|
|
130
|
+
switch (_response.error.statusCode) {
|
|
131
|
+
case 400:
|
|
132
|
+
throw new Webflow.BadRequestError(_response.error.body, _response.rawResponse);
|
|
133
|
+
case 401:
|
|
134
|
+
throw new Webflow.UnauthorizedError(serializers.Error_.parseOrThrow(_response.error.body, {
|
|
135
|
+
unrecognizedObjectKeys: "passthrough",
|
|
136
|
+
allowUnrecognizedUnionMembers: true,
|
|
137
|
+
allowUnrecognizedEnumValues: true,
|
|
138
|
+
skipValidation: true,
|
|
139
|
+
breadcrumbsPrefix: ["response"],
|
|
140
|
+
}), _response.rawResponse);
|
|
141
|
+
case 403:
|
|
142
|
+
throw new Webflow.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
143
|
+
case 404:
|
|
144
|
+
throw new Webflow.NotFoundError(serializers.Error_.parseOrThrow(_response.error.body, {
|
|
145
|
+
unrecognizedObjectKeys: "passthrough",
|
|
146
|
+
allowUnrecognizedUnionMembers: true,
|
|
147
|
+
allowUnrecognizedEnumValues: true,
|
|
148
|
+
skipValidation: true,
|
|
149
|
+
breadcrumbsPrefix: ["response"],
|
|
150
|
+
}), _response.rawResponse);
|
|
151
|
+
case 429:
|
|
152
|
+
throw new Webflow.TooManyRequestsError(serializers.Error_.parseOrThrow(_response.error.body, {
|
|
153
|
+
unrecognizedObjectKeys: "passthrough",
|
|
154
|
+
allowUnrecognizedUnionMembers: true,
|
|
155
|
+
allowUnrecognizedEnumValues: true,
|
|
156
|
+
skipValidation: true,
|
|
157
|
+
breadcrumbsPrefix: ["response"],
|
|
158
|
+
}), _response.rawResponse);
|
|
159
|
+
case 500:
|
|
160
|
+
throw new Webflow.InternalServerError(serializers.Error_.parseOrThrow(_response.error.body, {
|
|
161
|
+
unrecognizedObjectKeys: "passthrough",
|
|
162
|
+
allowUnrecognizedUnionMembers: true,
|
|
163
|
+
allowUnrecognizedEnumValues: true,
|
|
164
|
+
skipValidation: true,
|
|
165
|
+
breadcrumbsPrefix: ["response"],
|
|
166
|
+
}), _response.rawResponse);
|
|
167
|
+
default:
|
|
168
|
+
throw new errors.WebflowError({
|
|
169
|
+
statusCode: _response.error.statusCode,
|
|
170
|
+
body: _response.error.body,
|
|
171
|
+
rawResponse: _response.rawResponse,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
switch (_response.error.reason) {
|
|
176
|
+
case "non-json":
|
|
177
|
+
throw new errors.WebflowError({
|
|
178
|
+
statusCode: _response.error.statusCode,
|
|
179
|
+
body: _response.error.rawBody,
|
|
180
|
+
rawResponse: _response.rawResponse,
|
|
181
|
+
});
|
|
182
|
+
case "timeout":
|
|
183
|
+
throw new errors.WebflowTimeoutError("Timeout exceeded when calling GET /sites/{site_id}/form_submissions.");
|
|
184
|
+
case "unknown":
|
|
185
|
+
throw new errors.WebflowError({
|
|
186
|
+
message: _response.error.errorMessage,
|
|
187
|
+
rawResponse: _response.rawResponse,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.Client = Client;
|
|
@@ -57,14 +57,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
57
57
|
};
|
|
58
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
59
|
exports.Client = void 0;
|
|
60
|
-
const url_join_1 = __importDefault(require("url-join"));
|
|
61
60
|
const Webflow = __importStar(require("../api"));
|
|
62
61
|
const Client_1 = require("../api/resources/collections/resources/items/client/Client");
|
|
63
62
|
const core = __importStar(require("../core"));
|
|
64
63
|
const environments = __importStar(require("../environments"));
|
|
65
64
|
const errors = __importStar(require("../errors"));
|
|
66
65
|
const serializers = __importStar(require("../serialization"));
|
|
67
|
-
const
|
|
66
|
+
const headers_1 = require("../core/headers");
|
|
67
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
68
68
|
// Temporary wrapper for backwards compatibility keeping the createItemForMultipleLocales method
|
|
69
69
|
// a mirror of the createItems API
|
|
70
70
|
class Client extends Client_1.Items {
|
|
@@ -128,13 +128,14 @@ class Client extends Client_1.Items {
|
|
|
128
128
|
const { skipInvalidFiles } = request, _body = __rest(request, ["skipInvalidFiles"]);
|
|
129
129
|
const _queryParams = {};
|
|
130
130
|
if (skipInvalidFiles != null) {
|
|
131
|
-
_queryParams
|
|
131
|
+
_queryParams.skipInvalidFiles = skipInvalidFiles.toString();
|
|
132
132
|
}
|
|
133
|
+
const _headers = (0, headers_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
133
134
|
const _response = yield core.fetcher({
|
|
134
|
-
url: (0, url_join_1.default)((
|
|
135
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.WebflowEnvironment.DataApi)
|
|
135
136
|
.base, `collections/${encodeURIComponent(collectionId)}/items`),
|
|
136
137
|
method: "POST",
|
|
137
|
-
headers:
|
|
138
|
+
headers: _headers,
|
|
138
139
|
contentType: "application/json",
|
|
139
140
|
queryParameters: _queryParams,
|
|
140
141
|
requestType: "json",
|
|
@@ -255,13 +256,14 @@ class Client extends Client_1.Items {
|
|
|
255
256
|
const { skipInvalidFiles } = request, _body = __rest(request, ["skipInvalidFiles"]);
|
|
256
257
|
const _queryParams = {};
|
|
257
258
|
if (skipInvalidFiles != null) {
|
|
258
|
-
_queryParams
|
|
259
|
+
_queryParams.skipInvalidFiles = skipInvalidFiles.toString();
|
|
259
260
|
}
|
|
261
|
+
const _headers = (0, headers_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
260
262
|
const _response = yield core.fetcher({
|
|
261
|
-
url: (0, url_join_1.default)((
|
|
263
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.WebflowEnvironment.DataApi)
|
|
262
264
|
.base, `collections/${encodeURIComponent(collectionId)}/items/${encodeURIComponent(itemId)}`),
|
|
263
265
|
method: "PATCH",
|
|
264
|
-
headers:
|
|
266
|
+
headers: _headers,
|
|
265
267
|
contentType: "application/json",
|
|
266
268
|
queryParameters: _queryParams,
|
|
267
269
|
requestType: "json",
|
|
@@ -404,13 +406,14 @@ class Client extends Client_1.Items {
|
|
|
404
406
|
const { skipInvalidFiles } = request, _body = __rest(request, ["skipInvalidFiles"]);
|
|
405
407
|
const _queryParams = {};
|
|
406
408
|
if (skipInvalidFiles != null) {
|
|
407
|
-
_queryParams
|
|
409
|
+
_queryParams.skipInvalidFiles = skipInvalidFiles.toString();
|
|
408
410
|
}
|
|
411
|
+
const _headers = (0, headers_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
409
412
|
const _response = yield core.fetcher({
|
|
410
|
-
url: (0, url_join_1.default)((
|
|
413
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.WebflowEnvironment.DataApi)
|
|
411
414
|
.base, `collections/${encodeURIComponent(collectionId)}/items/live`),
|
|
412
415
|
method: "POST",
|
|
413
|
-
headers:
|
|
416
|
+
headers: _headers,
|
|
414
417
|
contentType: "application/json",
|
|
415
418
|
queryParameters: _queryParams,
|
|
416
419
|
requestType: "json",
|
|
@@ -532,13 +535,14 @@ class Client extends Client_1.Items {
|
|
|
532
535
|
const { skipInvalidFiles } = request, _body = __rest(request, ["skipInvalidFiles"]);
|
|
533
536
|
const _queryParams = {};
|
|
534
537
|
if (skipInvalidFiles != null) {
|
|
535
|
-
_queryParams
|
|
538
|
+
_queryParams.skipInvalidFiles = skipInvalidFiles.toString();
|
|
536
539
|
}
|
|
540
|
+
const _headers = (0, headers_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
537
541
|
const _response = yield core.fetcher({
|
|
538
|
-
url: (0, url_join_1.default)((
|
|
542
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.WebflowEnvironment.DataApi)
|
|
539
543
|
.base, `collections/${encodeURIComponent(collectionId)}/items/${encodeURIComponent(itemId)}/live`),
|
|
540
544
|
method: "PATCH",
|
|
541
|
-
headers:
|
|
545
|
+
headers: _headers,
|
|
542
546
|
contentType: "application/json",
|
|
543
547
|
queryParameters: _queryParams,
|
|
544
548
|
requestType: "json",
|
|
@@ -57,14 +57,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
57
57
|
};
|
|
58
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
59
|
exports.Client = void 0;
|
|
60
|
-
const url_join_1 = __importDefault(require("url-join"));
|
|
61
60
|
const Client_1 = require("../api/resources/pages/client/Client");
|
|
62
61
|
const core = __importStar(require("../core"));
|
|
63
62
|
const Webflow = __importStar(require("../api"));
|
|
64
63
|
const environments = __importStar(require("../environments"));
|
|
65
64
|
const errors = __importStar(require("../errors"));
|
|
66
65
|
const serializers = __importStar(require("../serialization"));
|
|
67
|
-
const
|
|
66
|
+
const headers_1 = require("../core/headers");
|
|
67
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
68
68
|
// Client adapts the base client to override extra properties in
|
|
69
69
|
// the client.pages.updatePageSettings request.
|
|
70
70
|
// Overriding to preserve ability to use `body` in request to prevent breaking change
|
|
@@ -118,13 +118,14 @@ class Client extends Client_1.Pages {
|
|
|
118
118
|
const { localeId } = request, _body = __rest(request, ["localeId"]);
|
|
119
119
|
const _queryParams = {};
|
|
120
120
|
if (localeId != null) {
|
|
121
|
-
_queryParams
|
|
121
|
+
_queryParams.localeId = localeId;
|
|
122
122
|
}
|
|
123
|
+
const _headers = (0, headers_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
123
124
|
const _response = yield core.fetcher({
|
|
124
|
-
url: (0, url_join_1.default)((
|
|
125
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.WebflowEnvironment.DataApi)
|
|
125
126
|
.base, `pages/${encodeURIComponent(pageId)}`),
|
|
126
127
|
method: "PUT",
|
|
127
|
-
headers:
|
|
128
|
+
headers: _headers,
|
|
128
129
|
contentType: "application/json",
|
|
129
130
|
queryParameters: _queryParams,
|
|
130
131
|
requestType: "json",
|
|
@@ -4,6 +4,7 @@ import { Client as Webhooks } from "./WebhooksClient";
|
|
|
4
4
|
import { Client as Assets } from "./AssetsClient";
|
|
5
5
|
import { Client as Collections } from "./CollectionsClient";
|
|
6
6
|
import { Client as Pages } from "./PagesClient";
|
|
7
|
+
import { Client as Forms } from "./FormsClient";
|
|
7
8
|
export declare class WebflowClient extends FernClient {
|
|
8
9
|
protected readonly _options: FernClient.Options;
|
|
9
10
|
constructor(_options: FernClient.Options);
|
|
@@ -11,10 +12,12 @@ export declare class WebflowClient extends FernClient {
|
|
|
11
12
|
protected _assets: Assets | undefined;
|
|
12
13
|
protected _collections: Collections | undefined;
|
|
13
14
|
protected _pages: Pages | undefined;
|
|
15
|
+
protected _forms: Forms | undefined;
|
|
14
16
|
get webhooks(): Webhooks;
|
|
15
17
|
get assets(): Assets;
|
|
16
18
|
get collections(): Collections;
|
|
17
19
|
get pages(): Pages;
|
|
20
|
+
get forms(): Forms;
|
|
18
21
|
/**
|
|
19
22
|
* @param clientId The OAuth client ID
|
|
20
23
|
* @param state The state
|
|
@@ -41,12 +41,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
41
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
-
};
|
|
47
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
45
|
exports.WebflowClient = void 0;
|
|
49
|
-
const qs_1 = __importDefault(require("qs"));
|
|
50
46
|
const Client_1 = require("../Client");
|
|
51
47
|
const core = __importStar(require("../core"));
|
|
52
48
|
const errors = __importStar(require("../errors"));
|
|
@@ -55,6 +51,7 @@ const WebhooksClient_1 = require("./WebhooksClient");
|
|
|
55
51
|
const AssetsClient_1 = require("./AssetsClient");
|
|
56
52
|
const CollectionsClient_1 = require("./CollectionsClient");
|
|
57
53
|
const PagesClient_1 = require("./PagesClient");
|
|
54
|
+
const FormsClient_1 = require("./FormsClient");
|
|
58
55
|
class WebflowClient extends Client_1.WebflowClient {
|
|
59
56
|
constructor(_options) {
|
|
60
57
|
super(_options);
|
|
@@ -76,6 +73,10 @@ class WebflowClient extends Client_1.WebflowClient {
|
|
|
76
73
|
var _a;
|
|
77
74
|
return ((_a = this._pages) !== null && _a !== void 0 ? _a : (this._pages = new PagesClient_1.Client(this._options)));
|
|
78
75
|
}
|
|
76
|
+
get forms() {
|
|
77
|
+
var _a;
|
|
78
|
+
return ((_a = this._forms) !== null && _a !== void 0 ? _a : (this._forms = new FormsClient_1.Client(this._options)));
|
|
79
|
+
}
|
|
79
80
|
/**
|
|
80
81
|
* @param clientId The OAuth client ID
|
|
81
82
|
* @param state The state
|
|
@@ -97,7 +98,7 @@ class WebflowClient extends Client_1.WebflowClient {
|
|
|
97
98
|
else {
|
|
98
99
|
params["scope"] = scope.join(" ");
|
|
99
100
|
}
|
|
100
|
-
return `https://webflow.com/oauth/authorize?${
|
|
101
|
+
return `https://webflow.com/oauth/authorize?${new URLSearchParams(params).toString()}`;
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
104
|
* @param clientId The OAuth client ID
|
package/jest.config.mjs
CHANGED
|
@@ -2,8 +2,29 @@
|
|
|
2
2
|
export default {
|
|
3
3
|
preset: "ts-jest",
|
|
4
4
|
testEnvironment: "node",
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
projects: [
|
|
6
|
+
{
|
|
7
|
+
displayName: "unit",
|
|
8
|
+
preset: "ts-jest",
|
|
9
|
+
testEnvironment: "node",
|
|
10
|
+
moduleNameMapper: {
|
|
11
|
+
"^(\.{1,2}/.*)\.js$": "$1",
|
|
12
|
+
},
|
|
13
|
+
roots: ["<rootDir>/tests"],
|
|
14
|
+
testPathIgnorePatterns: ["/tests/wire/"],
|
|
15
|
+
setupFilesAfterEnv: [],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
displayName: "wire",
|
|
19
|
+
preset: "ts-jest",
|
|
20
|
+
testEnvironment: "node",
|
|
21
|
+
moduleNameMapper: {
|
|
22
|
+
"^(\.{1,2}/.*)\.js$": "$1",
|
|
23
|
+
},
|
|
24
|
+
roots: ["<rootDir>/tests/wire"],
|
|
25
|
+
setupFilesAfterEnv: ["<rootDir>/tests/mock-server/setup.ts"],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
workerThreads: false,
|
|
29
|
+
passWithNoTests: true,
|
|
30
|
+
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webflow-api",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": "https://github.com/webflow/js-webflow-api",
|
|
6
|
+
"license": "MIT",
|
|
6
7
|
"main": "./index.js",
|
|
7
8
|
"types": "./index.d.ts",
|
|
8
9
|
"scripts": {
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
"@types/jest": "^29.5.14",
|
|
36
37
|
"ts-jest": "^29.3.4",
|
|
37
38
|
"jest-environment-jsdom": "^29.7.0",
|
|
38
|
-
"msw": "2.
|
|
39
|
+
"msw": "^2.8.4",
|
|
39
40
|
"@types/node": "^18.19.70",
|
|
40
41
|
"prettier": "^3.4.2",
|
|
41
42
|
"typescript": "~5.7.2",
|