@wix/auto_sdk_connectors_connectors 1.0.0

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.
@@ -0,0 +1,544 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.typings.ts
21
+ var index_typings_exports = {};
22
+ __export(index_typings_exports, {
23
+ CredentialState: () => CredentialState,
24
+ Exposure: () => Exposure,
25
+ RegistrationType: () => RegistrationType,
26
+ ScopeReportingState: () => ScopeReportingState,
27
+ SortOrder: () => SortOrder,
28
+ StartConnectRequestRegistrationType: () => StartConnectRequestRegistrationType,
29
+ WebhookIdentityType: () => WebhookIdentityType,
30
+ deleteConnector: () => deleteConnector2,
31
+ dispatcherDispatch: () => dispatcherDispatch2,
32
+ getConnector: () => getConnector2,
33
+ listMcpTools: () => listMcpTools2,
34
+ queryConnectors: () => queryConnectors2,
35
+ startConnect: () => startConnect2,
36
+ typedQueryConnectors: () => typedQueryConnectors,
37
+ utils: () => utils
38
+ });
39
+ module.exports = __toCommonJS(index_typings_exports);
40
+
41
+ // src/connectors-v1-connector-connectors.universal.ts
42
+ var import_transform_error = require("@wix/sdk-runtime/transform-error");
43
+ var import_query_builder = require("@wix/sdk-runtime/query-builder");
44
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
45
+
46
+ // src/connectors-v1-connector-connectors.http.ts
47
+ var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
48
+ var import_bytes = require("@wix/sdk-runtime/transformations/bytes");
49
+ var import_bytes2 = require("@wix/sdk-runtime/transformations/bytes");
50
+ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
51
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
52
+ var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
53
+ function resolveWixConnectorsV1ConnectorsDispatcherServiceUrl(opts) {
54
+ const domainToMappings = {};
55
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
56
+ }
57
+ function resolveWixConnectorsV1ConnectorsServiceUrl(opts) {
58
+ const domainToMappings = {
59
+ "manage._base_domain_": [
60
+ {
61
+ srcPath: "/_api/connectors-service",
62
+ destPath: ""
63
+ },
64
+ {
65
+ srcPath: "/connectors-service",
66
+ destPath: ""
67
+ }
68
+ ],
69
+ "editor._base_domain_": [
70
+ {
71
+ srcPath: "/_api/connectors-service",
72
+ destPath: ""
73
+ }
74
+ ],
75
+ "blocks._base_domain_": [
76
+ {
77
+ srcPath: "/_api/connectors-service",
78
+ destPath: ""
79
+ }
80
+ ],
81
+ "create.editorx": [
82
+ {
83
+ srcPath: "/_api/connectors-service",
84
+ destPath: ""
85
+ }
86
+ ],
87
+ "api._api_base_domain_": [
88
+ {
89
+ srcPath: "/connectors-service",
90
+ destPath: ""
91
+ }
92
+ ],
93
+ "www.wixapis.com": [
94
+ {
95
+ srcPath: "/connectors/v1/connectors",
96
+ destPath: "/v1/connectors"
97
+ }
98
+ ],
99
+ "*.dev.wix-code.com": [
100
+ {
101
+ srcPath: "/connectors/v1/connectors",
102
+ destPath: "/v1/connectors"
103
+ }
104
+ ],
105
+ _: [
106
+ {
107
+ srcPath: "/connectors/v1/connectors",
108
+ destPath: "/v1/connectors"
109
+ }
110
+ ]
111
+ };
112
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
113
+ }
114
+ var PACKAGE_NAME = "@wix/auto_sdk_connectors_connectors";
115
+ function getConnector(payload) {
116
+ function __getConnector({ host }) {
117
+ const metadata = {
118
+ entityFqdn: "wix.connectors.v1.connector",
119
+ method: "GET",
120
+ methodFqn: "wix.connectors.v1.ConnectorsService.GetConnector",
121
+ packageName: PACKAGE_NAME,
122
+ migrationOptions: {
123
+ optInTransformResponse: true
124
+ },
125
+ url: resolveWixConnectorsV1ConnectorsServiceUrl({
126
+ protoPath: "/v1/connectors/{connectorId}",
127
+ data: payload,
128
+ host
129
+ }),
130
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
131
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
132
+ {
133
+ transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
134
+ paths: [
135
+ { path: "connector.createdDate" },
136
+ { path: "connector.updatedDate" }
137
+ ]
138
+ }
139
+ ])
140
+ };
141
+ return metadata;
142
+ }
143
+ return __getConnector;
144
+ }
145
+ function deleteConnector(payload) {
146
+ function __deleteConnector({ host }) {
147
+ const metadata = {
148
+ entityFqdn: "wix.connectors.v1.connector",
149
+ method: "DELETE",
150
+ methodFqn: "wix.connectors.v1.ConnectorsService.DeleteConnector",
151
+ packageName: PACKAGE_NAME,
152
+ migrationOptions: {
153
+ optInTransformResponse: true
154
+ },
155
+ url: resolveWixConnectorsV1ConnectorsServiceUrl({
156
+ protoPath: "/v1/connectors/{connectorId}",
157
+ data: payload,
158
+ host
159
+ }),
160
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
161
+ };
162
+ return metadata;
163
+ }
164
+ return __deleteConnector;
165
+ }
166
+ function queryConnectors(payload) {
167
+ function __queryConnectors({ host }) {
168
+ const metadata = {
169
+ entityFqdn: "wix.connectors.v1.connector",
170
+ method: "POST",
171
+ methodFqn: "wix.connectors.v1.ConnectorsService.QueryConnectors",
172
+ packageName: PACKAGE_NAME,
173
+ migrationOptions: {
174
+ optInTransformResponse: true
175
+ },
176
+ url: resolveWixConnectorsV1ConnectorsServiceUrl({
177
+ protoPath: "/v1/connectors/query",
178
+ data: payload,
179
+ host
180
+ }),
181
+ data: payload,
182
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
183
+ {
184
+ transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
185
+ paths: [
186
+ { path: "connectors.createdDate" },
187
+ { path: "connectors.updatedDate" }
188
+ ]
189
+ }
190
+ ])
191
+ };
192
+ return metadata;
193
+ }
194
+ return __queryConnectors;
195
+ }
196
+ function startConnect(payload) {
197
+ function __startConnect({ host }) {
198
+ const metadata = {
199
+ entityFqdn: "wix.connectors.v1.connector",
200
+ method: "POST",
201
+ methodFqn: "wix.connectors.v1.ConnectorsService.StartConnect",
202
+ packageName: PACKAGE_NAME,
203
+ migrationOptions: {
204
+ optInTransformResponse: true
205
+ },
206
+ url: resolveWixConnectorsV1ConnectorsServiceUrl({
207
+ protoPath: "/v1/connectors/start-connect",
208
+ data: payload,
209
+ host
210
+ }),
211
+ data: payload
212
+ };
213
+ return metadata;
214
+ }
215
+ return __startConnect;
216
+ }
217
+ function dispatcherDispatch(payload) {
218
+ function __dispatcherDispatch({ host }) {
219
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
220
+ {
221
+ transformFn: import_bytes.transformSDKBytesToRESTBytes,
222
+ paths: [{ path: "providerRequest.body" }]
223
+ }
224
+ ]);
225
+ const metadata = {
226
+ entityFqdn: "wix.connectors.v1.connector",
227
+ method: "POST",
228
+ methodFqn: "wix.connectors.v1.ConnectorsDispatcherService.Dispatch",
229
+ packageName: PACKAGE_NAME,
230
+ migrationOptions: {
231
+ optInTransformResponse: true
232
+ },
233
+ url: resolveWixConnectorsV1ConnectorsDispatcherServiceUrl({
234
+ protoPath: "/v1/connectors/{connectorId}/dispatch",
235
+ data: serializedData,
236
+ host
237
+ }),
238
+ data: serializedData,
239
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
240
+ {
241
+ transformFn: import_bytes2.transformRESTBytesToSDKBytes,
242
+ paths: [{ path: "body" }]
243
+ }
244
+ ])
245
+ };
246
+ return metadata;
247
+ }
248
+ return __dispatcherDispatch;
249
+ }
250
+ function listMcpTools(payload) {
251
+ function __listMcpTools({ host }) {
252
+ const metadata = {
253
+ entityFqdn: "wix.connectors.v1.connector",
254
+ method: "GET",
255
+ methodFqn: "wix.connectors.v1.ConnectorsDispatcherService.ListMcpTools",
256
+ packageName: PACKAGE_NAME,
257
+ migrationOptions: {
258
+ optInTransformResponse: true
259
+ },
260
+ url: resolveWixConnectorsV1ConnectorsDispatcherServiceUrl({
261
+ protoPath: "/v1/connectors/{connectorId}/mcp/tools",
262
+ data: payload,
263
+ host
264
+ }),
265
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
266
+ };
267
+ return metadata;
268
+ }
269
+ return __listMcpTools;
270
+ }
271
+
272
+ // src/connectors-v1-connector-connectors.universal.ts
273
+ var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
274
+ var import_query_builder_utils = require("@wix/sdk-runtime/query-builder-utils");
275
+ var Exposure = /* @__PURE__ */ ((Exposure2) => {
276
+ Exposure2["ACCOUNT"] = "ACCOUNT";
277
+ Exposure2["USER"] = "USER";
278
+ return Exposure2;
279
+ })(Exposure || {});
280
+ var ScopeReportingState = /* @__PURE__ */ ((ScopeReportingState2) => {
281
+ ScopeReportingState2["NOT_REPORTED"] = "NOT_REPORTED";
282
+ ScopeReportingState2["REPORTED"] = "REPORTED";
283
+ return ScopeReportingState2;
284
+ })(ScopeReportingState || {});
285
+ var CredentialState = /* @__PURE__ */ ((CredentialState2) => {
286
+ CredentialState2["ACTIVE"] = "ACTIVE";
287
+ CredentialState2["REVOKED"] = "REVOKED";
288
+ return CredentialState2;
289
+ })(CredentialState || {});
290
+ var RegistrationType = /* @__PURE__ */ ((RegistrationType2) => {
291
+ RegistrationType2["PREDEFINED"] = "PREDEFINED";
292
+ RegistrationType2["DYNAMIC"] = "DYNAMIC";
293
+ return RegistrationType2;
294
+ })(RegistrationType || {});
295
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
296
+ SortOrder2["ASC"] = "ASC";
297
+ SortOrder2["DESC"] = "DESC";
298
+ return SortOrder2;
299
+ })(SortOrder || {});
300
+ var StartConnectRequestRegistrationType = /* @__PURE__ */ ((StartConnectRequestRegistrationType2) => {
301
+ StartConnectRequestRegistrationType2["PREDEFINED"] = "PREDEFINED";
302
+ StartConnectRequestRegistrationType2["DYNAMIC"] = "DYNAMIC";
303
+ return StartConnectRequestRegistrationType2;
304
+ })(StartConnectRequestRegistrationType || {});
305
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
306
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
307
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
308
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
309
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
310
+ WebhookIdentityType2["APP"] = "APP";
311
+ return WebhookIdentityType2;
312
+ })(WebhookIdentityType || {});
313
+ async function getConnector2(connectorId) {
314
+ const { httpClient, sideEffects } = arguments[1];
315
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
316
+ connectorId
317
+ });
318
+ const reqOpts = getConnector(payload);
319
+ sideEffects?.onSiteCall?.();
320
+ try {
321
+ const result = await httpClient.request(reqOpts);
322
+ sideEffects?.onSuccess?.(result);
323
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.connector;
324
+ } catch (err) {
325
+ const transformedError = (0, import_transform_error.transformError)(
326
+ err,
327
+ {
328
+ spreadPathsToArguments: {},
329
+ explicitPathsToArguments: { connectorId: "$[0]" },
330
+ singleArgumentUnchanged: false
331
+ },
332
+ ["connectorId"]
333
+ );
334
+ sideEffects?.onError?.(err);
335
+ throw transformedError;
336
+ }
337
+ }
338
+ async function deleteConnector2(connectorId) {
339
+ const { httpClient, sideEffects } = arguments[1];
340
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
341
+ connectorId
342
+ });
343
+ const reqOpts = deleteConnector(payload);
344
+ sideEffects?.onSiteCall?.();
345
+ try {
346
+ const result = await httpClient.request(reqOpts);
347
+ sideEffects?.onSuccess?.(result);
348
+ } catch (err) {
349
+ const transformedError = (0, import_transform_error.transformError)(
350
+ err,
351
+ {
352
+ spreadPathsToArguments: {},
353
+ explicitPathsToArguments: { connectorId: "$[0]" },
354
+ singleArgumentUnchanged: false
355
+ },
356
+ ["connectorId"]
357
+ );
358
+ sideEffects?.onError?.(err);
359
+ throw transformedError;
360
+ }
361
+ }
362
+ function queryConnectors2() {
363
+ const { httpClient, sideEffects } = arguments[0];
364
+ return (0, import_query_builder.queryBuilder)({
365
+ func: async (payload) => {
366
+ const reqOpts = queryConnectors(payload);
367
+ sideEffects?.onSiteCall?.();
368
+ try {
369
+ const result = await httpClient.request(reqOpts);
370
+ sideEffects?.onSuccess?.(result);
371
+ return result;
372
+ } catch (err) {
373
+ sideEffects?.onError?.(err);
374
+ throw err;
375
+ }
376
+ },
377
+ requestTransformer: (query) => {
378
+ const args = [query, {}];
379
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
380
+ ...args?.[1],
381
+ query: args?.[0]
382
+ });
383
+ },
384
+ responseTransformer: ({ data }) => {
385
+ const transformedData = (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
386
+ (0, import_transform_paths2.transformPaths)(data, [])
387
+ );
388
+ return {
389
+ items: transformedData?.connectors,
390
+ pagingMetadata: transformedData?.pagingMetadata
391
+ };
392
+ },
393
+ errorTransformer: (err) => {
394
+ const transformedError = (0, import_transform_error.transformError)(err, {
395
+ spreadPathsToArguments: {},
396
+ explicitPathsToArguments: { query: "$[0]" },
397
+ singleArgumentUnchanged: false
398
+ });
399
+ throw transformedError;
400
+ },
401
+ pagingMethod: "CURSOR",
402
+ transformationPaths: {}
403
+ });
404
+ }
405
+ async function typedQueryConnectors(query) {
406
+ const { httpClient, sideEffects } = arguments[1];
407
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ query });
408
+ const reqOpts = queryConnectors(payload);
409
+ sideEffects?.onSiteCall?.();
410
+ try {
411
+ const result = await httpClient.request(reqOpts);
412
+ sideEffects?.onSuccess?.(result);
413
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
414
+ } catch (err) {
415
+ const transformedError = (0, import_transform_error.transformError)(
416
+ err,
417
+ {
418
+ spreadPathsToArguments: {},
419
+ explicitPathsToArguments: { query: "$[0]" },
420
+ singleArgumentUnchanged: false
421
+ },
422
+ ["query"]
423
+ );
424
+ sideEffects?.onError?.(err);
425
+ throw transformedError;
426
+ }
427
+ }
428
+ var utils = {
429
+ query: /* @__PURE__ */ (0, import_query_builder_utils.createQueryUtils)()
430
+ };
431
+ async function startConnect2(options) {
432
+ const { httpClient, sideEffects } = arguments[1];
433
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
434
+ predefinedRegistration: options?.predefinedRegistration,
435
+ dynamicRegistration: options?.dynamicRegistration,
436
+ registrationType: options?.registrationType,
437
+ appId: options?.appId,
438
+ componentId: options?.componentId,
439
+ exposure: options?.exposure,
440
+ returnUrl: options?.returnUrl
441
+ });
442
+ const reqOpts = startConnect(payload);
443
+ sideEffects?.onSiteCall?.();
444
+ try {
445
+ const result = await httpClient.request(reqOpts);
446
+ sideEffects?.onSuccess?.(result);
447
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
448
+ } catch (err) {
449
+ const transformedError = (0, import_transform_error.transformError)(
450
+ err,
451
+ {
452
+ spreadPathsToArguments: {},
453
+ explicitPathsToArguments: {
454
+ predefinedRegistration: "$[0].predefinedRegistration",
455
+ dynamicRegistration: "$[0].dynamicRegistration",
456
+ registrationType: "$[0].registrationType",
457
+ appId: "$[0].appId",
458
+ componentId: "$[0].componentId",
459
+ exposure: "$[0].exposure",
460
+ returnUrl: "$[0].returnUrl"
461
+ },
462
+ singleArgumentUnchanged: false
463
+ },
464
+ ["options"]
465
+ );
466
+ sideEffects?.onError?.(err);
467
+ throw transformedError;
468
+ }
469
+ }
470
+ async function dispatcherDispatch2(connectorId, providerRequest, options) {
471
+ const { httpClient, sideEffects } = arguments[3];
472
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
473
+ connectorId,
474
+ providerRequest,
475
+ idempotencyKey: options?.idempotencyKey
476
+ });
477
+ const reqOpts = dispatcherDispatch(payload);
478
+ sideEffects?.onSiteCall?.();
479
+ try {
480
+ const result = await httpClient.request(reqOpts);
481
+ sideEffects?.onSuccess?.(result);
482
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
483
+ } catch (err) {
484
+ const transformedError = (0, import_transform_error.transformError)(
485
+ err,
486
+ {
487
+ spreadPathsToArguments: {},
488
+ explicitPathsToArguments: {
489
+ connectorId: "$[0]",
490
+ providerRequest: "$[1]",
491
+ idempotencyKey: "$[2].idempotencyKey"
492
+ },
493
+ singleArgumentUnchanged: false
494
+ },
495
+ ["connectorId", "providerRequest", "options"]
496
+ );
497
+ sideEffects?.onError?.(err);
498
+ throw transformedError;
499
+ }
500
+ }
501
+ async function listMcpTools2(connectorId) {
502
+ const { httpClient, sideEffects } = arguments[1];
503
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
504
+ connectorId
505
+ });
506
+ const reqOpts = listMcpTools(payload);
507
+ sideEffects?.onSiteCall?.();
508
+ try {
509
+ const result = await httpClient.request(reqOpts);
510
+ sideEffects?.onSuccess?.(result);
511
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
512
+ } catch (err) {
513
+ const transformedError = (0, import_transform_error.transformError)(
514
+ err,
515
+ {
516
+ spreadPathsToArguments: {},
517
+ explicitPathsToArguments: { connectorId: "$[0]" },
518
+ singleArgumentUnchanged: false
519
+ },
520
+ ["connectorId"]
521
+ );
522
+ sideEffects?.onError?.(err);
523
+ throw transformedError;
524
+ }
525
+ }
526
+ // Annotate the CommonJS export names for ESM import in node:
527
+ 0 && (module.exports = {
528
+ CredentialState,
529
+ Exposure,
530
+ RegistrationType,
531
+ ScopeReportingState,
532
+ SortOrder,
533
+ StartConnectRequestRegistrationType,
534
+ WebhookIdentityType,
535
+ deleteConnector,
536
+ dispatcherDispatch,
537
+ getConnector,
538
+ listMcpTools,
539
+ queryConnectors,
540
+ startConnect,
541
+ typedQueryConnectors,
542
+ utils
543
+ });
544
+ //# sourceMappingURL=index.typings.js.map