@wix/auto_sdk_papyrus_documents 1.0.1 → 1.0.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.
@@ -1,872 +0,0 @@
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
- ContentDisposition: () => ContentDisposition,
24
- Format: () => Format,
25
- PageOverflow: () => PageOverflow,
26
- PaperSize: () => PaperSize,
27
- RenderFormat: () => RenderFormat,
28
- RenderStatus: () => RenderStatus,
29
- RequestedFields: () => RequestedFields,
30
- ResizeOption: () => ResizeOption,
31
- SortOrder: () => SortOrder,
32
- WebhookIdentityType: () => WebhookIdentityType,
33
- WixMpClientVersion: () => WixMpClientVersion,
34
- createDocument: () => createDocument2,
35
- deleteDocument: () => deleteDocument2,
36
- downloadDocument: () => downloadDocument2,
37
- downloadDocumentSource: () => downloadDocumentSource2,
38
- getDocument: () => getDocument2,
39
- getDownloadPage: () => getDownloadPage2,
40
- getDownloadUrl: () => getDownloadUrl2,
41
- queryDocument: () => queryDocument2,
42
- redirectToDocument: () => redirectToDocument2,
43
- typedQueryDocument: () => typedQueryDocument,
44
- updateDocument: () => updateDocument2,
45
- utils: () => utils
46
- });
47
- module.exports = __toCommonJS(index_typings_exports);
48
-
49
- // src/papyrus-v1-document-documents.universal.ts
50
- var import_transform_error = require("@wix/sdk-runtime/transform-error");
51
- var import_query_builder = require("@wix/sdk-runtime/query-builder");
52
- var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
53
-
54
- // src/papyrus-v1-document-documents.http.ts
55
- var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
56
- var import_float = require("@wix/sdk-runtime/transformations/float");
57
- var import_bytes = require("@wix/sdk-runtime/transformations/bytes");
58
- var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
59
- var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
60
- var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
61
- var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
62
- function resolveWixPapyrusV1DownloadPageControllerUrl(opts) {
63
- const domainToMappings = {
64
- "api._base_domain_": [
65
- {
66
- srcPath: "/papyrus-document",
67
- destPath: ""
68
- }
69
- ],
70
- "www.wixapis.com": [
71
- {
72
- srcPath: "/papyrus-document/v1/documents",
73
- destPath: "/v1/documents"
74
- }
75
- ],
76
- "papyrus.wixapps.net": [
77
- {
78
- srcPath: "/download",
79
- destPath: "/download"
80
- },
81
- {
82
- srcPath: "/papyrus-document",
83
- destPath: ""
84
- },
85
- {
86
- srcPath: "/view",
87
- destPath: "/view"
88
- }
89
- ],
90
- "manage._base_domain_": [
91
- {
92
- srcPath: "/papyrus-document",
93
- destPath: ""
94
- }
95
- ],
96
- "api._api_base_domain_": [
97
- {
98
- srcPath: "/papyrus-document",
99
- destPath: ""
100
- }
101
- ]
102
- };
103
- return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
104
- }
105
- function resolveWixPapyrusV1DocumentServiceUrl(opts) {
106
- const domainToMappings = {
107
- "api._base_domain_": [
108
- {
109
- srcPath: "/papyrus-document",
110
- destPath: ""
111
- }
112
- ],
113
- "www.wixapis.com": [
114
- {
115
- srcPath: "/papyrus-document/v1/documents",
116
- destPath: "/v1/documents"
117
- }
118
- ],
119
- "papyrus.wixapps.net": [
120
- {
121
- srcPath: "/download",
122
- destPath: "/download"
123
- },
124
- {
125
- srcPath: "/papyrus-document",
126
- destPath: ""
127
- },
128
- {
129
- srcPath: "/view",
130
- destPath: "/view"
131
- }
132
- ],
133
- "manage._base_domain_": [
134
- {
135
- srcPath: "/papyrus-document",
136
- destPath: ""
137
- }
138
- ],
139
- "api._api_base_domain_": [
140
- {
141
- srcPath: "/papyrus-document",
142
- destPath: ""
143
- }
144
- ]
145
- };
146
- return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
147
- }
148
- var PACKAGE_NAME = "@wix/auto_sdk_papyrus_documents";
149
- function createDocument(payload) {
150
- function __createDocument({ host }) {
151
- const serializedData = (0, import_transform_paths.transformPaths)(payload, [
152
- {
153
- transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
154
- paths: [
155
- { path: "document.createdDate" },
156
- { path: "document.updatedDate" },
157
- { path: "document.expirationDate" }
158
- ]
159
- }
160
- ]);
161
- const metadata = {
162
- entityFqdn: "wix.papyrus.v1.document",
163
- method: "POST",
164
- methodFqn: "wix.papyrus.v1.DocumentService.CreateDocument",
165
- packageName: PACKAGE_NAME,
166
- migrationOptions: {
167
- optInTransformResponse: true
168
- },
169
- url: resolveWixPapyrusV1DocumentServiceUrl({
170
- protoPath: "/v1/documents",
171
- data: serializedData,
172
- host
173
- }),
174
- data: serializedData,
175
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
176
- {
177
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
178
- paths: [
179
- { path: "document.createdDate" },
180
- { path: "document.updatedDate" },
181
- { path: "document.expirationDate" }
182
- ]
183
- }
184
- ])
185
- };
186
- return metadata;
187
- }
188
- return __createDocument;
189
- }
190
- function getDocument(payload) {
191
- function __getDocument({ host }) {
192
- const metadata = {
193
- entityFqdn: "wix.papyrus.v1.document",
194
- method: "GET",
195
- methodFqn: "wix.papyrus.v1.DocumentService.GetDocument",
196
- packageName: PACKAGE_NAME,
197
- migrationOptions: {
198
- optInTransformResponse: true
199
- },
200
- url: resolveWixPapyrusV1DocumentServiceUrl({
201
- protoPath: "/v1/documents/{documentId}",
202
- data: payload,
203
- host
204
- }),
205
- params: (0, import_rest_modules.toURLSearchParams)(payload),
206
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
207
- {
208
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
209
- paths: [
210
- { path: "document.createdDate" },
211
- { path: "document.updatedDate" },
212
- { path: "document.expirationDate" }
213
- ]
214
- }
215
- ])
216
- };
217
- return metadata;
218
- }
219
- return __getDocument;
220
- }
221
- function deleteDocument(payload) {
222
- function __deleteDocument({ host }) {
223
- const metadata = {
224
- entityFqdn: "wix.papyrus.v1.document",
225
- method: "DELETE",
226
- methodFqn: "wix.papyrus.v1.DocumentService.DeleteDocument",
227
- packageName: PACKAGE_NAME,
228
- migrationOptions: {
229
- optInTransformResponse: true
230
- },
231
- url: resolveWixPapyrusV1DocumentServiceUrl({
232
- protoPath: "/v1/documents/{documentId}",
233
- data: payload,
234
- host
235
- }),
236
- params: (0, import_rest_modules.toURLSearchParams)(payload),
237
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
238
- {
239
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
240
- paths: [
241
- { path: "document.createdDate" },
242
- { path: "document.updatedDate" },
243
- { path: "document.expirationDate" }
244
- ]
245
- }
246
- ])
247
- };
248
- return metadata;
249
- }
250
- return __deleteDocument;
251
- }
252
- function queryDocument(payload) {
253
- function __queryDocument({ host }) {
254
- const serializedData = (0, import_transform_paths.transformPaths)(payload, [
255
- {
256
- transformFn: import_float.transformSDKFloatToRESTFloat,
257
- paths: [
258
- { path: "query.sort.origin.latitude" },
259
- { path: "query.sort.origin.longitude" }
260
- ]
261
- }
262
- ]);
263
- const metadata = {
264
- entityFqdn: "wix.papyrus.v1.document",
265
- method: "POST",
266
- methodFqn: "wix.papyrus.v1.DocumentService.QueryDocument",
267
- packageName: PACKAGE_NAME,
268
- migrationOptions: {
269
- optInTransformResponse: true
270
- },
271
- url: resolveWixPapyrusV1DocumentServiceUrl({
272
- protoPath: "/v1/documents/query",
273
- data: serializedData,
274
- host
275
- }),
276
- data: serializedData,
277
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
278
- {
279
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
280
- paths: [
281
- { path: "documents.createdDate" },
282
- { path: "documents.updatedDate" },
283
- { path: "documents.expirationDate" }
284
- ]
285
- }
286
- ])
287
- };
288
- return metadata;
289
- }
290
- return __queryDocument;
291
- }
292
- function updateDocument(payload) {
293
- function __updateDocument({ host }) {
294
- const metadata = {
295
- entityFqdn: "wix.papyrus.v1.document",
296
- method: "PATCH",
297
- methodFqn: "wix.papyrus.v1.DocumentService.UpdateDocument",
298
- packageName: PACKAGE_NAME,
299
- migrationOptions: {
300
- optInTransformResponse: true
301
- },
302
- url: resolveWixPapyrusV1DocumentServiceUrl({
303
- protoPath: "/v1/documents/{id}",
304
- data: payload,
305
- host
306
- }),
307
- data: payload,
308
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
309
- {
310
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
311
- paths: [
312
- { path: "document.createdDate" },
313
- { path: "document.updatedDate" },
314
- { path: "document.expirationDate" }
315
- ]
316
- }
317
- ])
318
- };
319
- return metadata;
320
- }
321
- return __updateDocument;
322
- }
323
- function downloadDocument(payload) {
324
- function __downloadDocument({ host }) {
325
- const metadata = {
326
- entityFqdn: "wix.papyrus.v1.document",
327
- method: "GET",
328
- methodFqn: "wix.papyrus.v1.DocumentService.DownloadDocument",
329
- packageName: PACKAGE_NAME,
330
- migrationOptions: {
331
- optInTransformResponse: true
332
- },
333
- url: resolveWixPapyrusV1DocumentServiceUrl({
334
- protoPath: "/v1/documents/download/{documentId}",
335
- data: payload,
336
- host
337
- }),
338
- params: (0, import_rest_modules.toURLSearchParams)(payload),
339
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
340
- {
341
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
342
- paths: [{ path: "expirationDate" }]
343
- }
344
- ])
345
- };
346
- return metadata;
347
- }
348
- return __downloadDocument;
349
- }
350
- function getDownloadUrl(payload) {
351
- function __getDownloadUrl({ host }) {
352
- const metadata = {
353
- entityFqdn: "wix.papyrus.v1.document",
354
- method: "GET",
355
- methodFqn: "wix.papyrus.v1.DocumentService.GetDownloadUrl",
356
- packageName: PACKAGE_NAME,
357
- migrationOptions: {
358
- optInTransformResponse: true
359
- },
360
- url: resolveWixPapyrusV1DocumentServiceUrl({
361
- protoPath: "/v1/documents/download-url",
362
- data: payload,
363
- host
364
- }),
365
- params: (0, import_rest_modules.toURLSearchParams)(payload),
366
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
367
- {
368
- transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
369
- paths: [{ path: "expirationDate" }]
370
- }
371
- ])
372
- };
373
- return metadata;
374
- }
375
- return __getDownloadUrl;
376
- }
377
- function downloadDocumentSource(payload) {
378
- function __downloadDocumentSource({ host }) {
379
- const metadata = {
380
- entityFqdn: "wix.papyrus.v1.document",
381
- method: "GET",
382
- methodFqn: "wix.papyrus.v1.DocumentService.DownloadDocumentSource",
383
- packageName: PACKAGE_NAME,
384
- migrationOptions: {
385
- optInTransformResponse: true
386
- },
387
- url: resolveWixPapyrusV1DocumentServiceUrl({
388
- protoPath: "/v1/documents/download/{documentId}/source",
389
- data: payload,
390
- host
391
- }),
392
- params: (0, import_rest_modules.toURLSearchParams)(payload)
393
- };
394
- return metadata;
395
- }
396
- return __downloadDocumentSource;
397
- }
398
- function getDownloadPage(payload) {
399
- function __getDownloadPage({ host }) {
400
- const metadata = {
401
- entityFqdn: "wix.papyrus.v1.document",
402
- method: "GET",
403
- methodFqn: "wix.papyrus.v1.DownloadPageController.GetDownloadPage",
404
- packageName: PACKAGE_NAME,
405
- migrationOptions: {
406
- optInTransformResponse: true
407
- },
408
- url: resolveWixPapyrusV1DownloadPageControllerUrl({
409
- protoPath: "/download",
410
- data: payload,
411
- host
412
- }),
413
- params: (0, import_rest_modules.toURLSearchParams)(payload),
414
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
415
- {
416
- transformFn: import_bytes.transformRESTBytesToSDKBytes,
417
- paths: [{ path: "body" }]
418
- }
419
- ])
420
- };
421
- return metadata;
422
- }
423
- return __getDownloadPage;
424
- }
425
- function redirectToDocument(payload) {
426
- function __redirectToDocument({ host }) {
427
- const metadata = {
428
- entityFqdn: "wix.papyrus.v1.document",
429
- method: "GET",
430
- methodFqn: "wix.papyrus.v1.DownloadPageController.RedirectToDocument",
431
- packageName: PACKAGE_NAME,
432
- migrationOptions: {
433
- optInTransformResponse: true
434
- },
435
- url: resolveWixPapyrusV1DownloadPageControllerUrl({
436
- protoPath: "/view",
437
- data: payload,
438
- host
439
- }),
440
- params: (0, import_rest_modules.toURLSearchParams)(payload),
441
- transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
442
- {
443
- transformFn: import_bytes.transformRESTBytesToSDKBytes,
444
- paths: [{ path: "body" }]
445
- }
446
- ])
447
- };
448
- return metadata;
449
- }
450
- return __redirectToDocument;
451
- }
452
-
453
- // src/papyrus-v1-document-documents.universal.ts
454
- var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
455
- var import_query_builder_utils = require("@wix/sdk-runtime/query-builder-utils");
456
- var RenderStatus = /* @__PURE__ */ ((RenderStatus2) => {
457
- RenderStatus2["UNKNOWN"] = "UNKNOWN";
458
- RenderStatus2["ACCEPTED"] = "ACCEPTED";
459
- RenderStatus2["RENDERING"] = "RENDERING";
460
- RenderStatus2["READY"] = "READY";
461
- RenderStatus2["FAILED"] = "FAILED";
462
- RenderStatus2["EXPIRED"] = "EXPIRED";
463
- return RenderStatus2;
464
- })(RenderStatus || {});
465
- var Format = /* @__PURE__ */ ((Format2) => {
466
- Format2["UNKNOWN"] = "UNKNOWN";
467
- Format2["PDF"] = "PDF";
468
- return Format2;
469
- })(Format || {});
470
- var WixMpClientVersion = /* @__PURE__ */ ((WixMpClientVersion2) => {
471
- WixMpClientVersion2["UNKNOWN"] = "UNKNOWN";
472
- WixMpClientVersion2["MP_V1"] = "MP_V1";
473
- WixMpClientVersion2["MP_V2"] = "MP_V2";
474
- return WixMpClientVersion2;
475
- })(WixMpClientVersion || {});
476
- var RequestedFields = /* @__PURE__ */ ((RequestedFields2) => {
477
- RequestedFields2["DOCUMENT_CONTENT"] = "DOCUMENT_CONTENT";
478
- return RequestedFields2;
479
- })(RequestedFields || {});
480
- var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
481
- SortOrder2["ASC"] = "ASC";
482
- SortOrder2["DESC"] = "DESC";
483
- return SortOrder2;
484
- })(SortOrder || {});
485
- var ContentDisposition = /* @__PURE__ */ ((ContentDisposition2) => {
486
- ContentDisposition2["UNKNOWN_CONTENT_DISPOSITION"] = "UNKNOWN_CONTENT_DISPOSITION";
487
- ContentDisposition2["ATTACHMENT"] = "ATTACHMENT";
488
- ContentDisposition2["INLINE"] = "INLINE";
489
- return ContentDisposition2;
490
- })(ContentDisposition || {});
491
- var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
492
- WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
493
- WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
494
- WebhookIdentityType2["MEMBER"] = "MEMBER";
495
- WebhookIdentityType2["WIX_USER"] = "WIX_USER";
496
- WebhookIdentityType2["APP"] = "APP";
497
- return WebhookIdentityType2;
498
- })(WebhookIdentityType || {});
499
- var ResizeOption = /* @__PURE__ */ ((ResizeOption2) => {
500
- ResizeOption2["FIT"] = "FIT";
501
- ResizeOption2["CROP"] = "CROP";
502
- return ResizeOption2;
503
- })(ResizeOption || {});
504
- var PaperSize = /* @__PURE__ */ ((PaperSize2) => {
505
- PaperSize2["A4_PORTRAIT"] = "A4_PORTRAIT";
506
- PaperSize2["A4_LANDSCAPE"] = "A4_LANDSCAPE";
507
- return PaperSize2;
508
- })(PaperSize || {});
509
- var PageOverflow = /* @__PURE__ */ ((PageOverflow2) => {
510
- PageOverflow2["CONTENT_HIDDEN"] = "CONTENT_HIDDEN";
511
- PageOverflow2["CONTENT_BREAK"] = "CONTENT_BREAK";
512
- return PageOverflow2;
513
- })(PageOverflow || {});
514
- var RenderFormat = /* @__PURE__ */ ((RenderFormat2) => {
515
- RenderFormat2["PDF"] = "PDF";
516
- RenderFormat2["HTML"] = "HTML";
517
- return RenderFormat2;
518
- })(RenderFormat || {});
519
- async function createDocument2(options) {
520
- const { httpClient, sideEffects } = arguments[1];
521
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
522
- document: options?.document
523
- });
524
- const reqOpts = createDocument(payload);
525
- sideEffects?.onSiteCall?.();
526
- try {
527
- const result = await httpClient.request(reqOpts);
528
- sideEffects?.onSuccess?.(result);
529
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.document;
530
- } catch (err) {
531
- const transformedError = (0, import_transform_error.transformError)(
532
- err,
533
- {
534
- spreadPathsToArguments: {},
535
- explicitPathsToArguments: { document: "$[0].document" },
536
- singleArgumentUnchanged: false
537
- },
538
- ["options"]
539
- );
540
- sideEffects?.onError?.(err);
541
- throw transformedError;
542
- }
543
- }
544
- async function getDocument2(documentId, options) {
545
- const { httpClient, sideEffects } = arguments[2];
546
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
547
- documentId,
548
- fields: options?.fields
549
- });
550
- const reqOpts = getDocument(payload);
551
- sideEffects?.onSiteCall?.();
552
- try {
553
- const result = await httpClient.request(reqOpts);
554
- sideEffects?.onSuccess?.(result);
555
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.document;
556
- } catch (err) {
557
- const transformedError = (0, import_transform_error.transformError)(
558
- err,
559
- {
560
- spreadPathsToArguments: {},
561
- explicitPathsToArguments: { documentId: "$[0]", fields: "$[1].fields" },
562
- singleArgumentUnchanged: false
563
- },
564
- ["documentId", "options"]
565
- );
566
- sideEffects?.onError?.(err);
567
- throw transformedError;
568
- }
569
- }
570
- async function deleteDocument2(documentId) {
571
- const { httpClient, sideEffects } = arguments[1];
572
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
573
- documentId
574
- });
575
- const reqOpts = deleteDocument(payload);
576
- sideEffects?.onSiteCall?.();
577
- try {
578
- const result = await httpClient.request(reqOpts);
579
- sideEffects?.onSuccess?.(result);
580
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
581
- } catch (err) {
582
- const transformedError = (0, import_transform_error.transformError)(
583
- err,
584
- {
585
- spreadPathsToArguments: {},
586
- explicitPathsToArguments: { documentId: "$[0]" },
587
- singleArgumentUnchanged: false
588
- },
589
- ["documentId"]
590
- );
591
- sideEffects?.onError?.(err);
592
- throw transformedError;
593
- }
594
- }
595
- function queryDocument2(options) {
596
- const { httpClient, sideEffects } = arguments[1];
597
- return (0, import_query_builder.queryBuilder)({
598
- func: async (payload) => {
599
- const reqOpts = queryDocument({
600
- ...payload,
601
- ...options ?? {}
602
- });
603
- sideEffects?.onSiteCall?.();
604
- try {
605
- const result = await httpClient.request(reqOpts);
606
- sideEffects?.onSuccess?.(result);
607
- return result;
608
- } catch (err) {
609
- sideEffects?.onError?.(err);
610
- throw err;
611
- }
612
- },
613
- requestTransformer: (query) => {
614
- const args = [query, options];
615
- return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
616
- ...args?.[1],
617
- query: args?.[0]
618
- });
619
- },
620
- responseTransformer: ({ data }) => {
621
- const transformedData = (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
622
- (0, import_transform_paths2.transformPaths)(data, [])
623
- );
624
- return {
625
- items: transformedData?.documents,
626
- pagingMetadata: transformedData?.metadata
627
- };
628
- },
629
- errorTransformer: (err) => {
630
- const transformedError = (0, import_transform_error.transformError)(err, {
631
- spreadPathsToArguments: {},
632
- explicitPathsToArguments: { query: "$[0]" },
633
- singleArgumentUnchanged: false
634
- });
635
- throw transformedError;
636
- },
637
- pagingMethod: "CURSOR",
638
- transformationPaths: {}
639
- });
640
- }
641
- async function typedQueryDocument(query, options) {
642
- const { httpClient, sideEffects } = arguments[2];
643
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
644
- query,
645
- ...options
646
- });
647
- const reqOpts = queryDocument(payload);
648
- sideEffects?.onSiteCall?.();
649
- try {
650
- const result = await httpClient.request(reqOpts);
651
- sideEffects?.onSuccess?.(result);
652
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
653
- } catch (err) {
654
- const transformedError = (0, import_transform_error.transformError)(
655
- err,
656
- {
657
- spreadPathsToArguments: {},
658
- explicitPathsToArguments: { query: "$[0]" },
659
- singleArgumentUnchanged: false
660
- },
661
- ["query", "options"]
662
- );
663
- sideEffects?.onError?.(err);
664
- throw transformedError;
665
- }
666
- }
667
- var utils = {
668
- query: /* @__PURE__ */ (0, import_query_builder_utils.createQueryUtils)()
669
- };
670
- async function updateDocument2(_id, options) {
671
- const { httpClient, sideEffects } = arguments[2];
672
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
673
- id: _id,
674
- renderStatus: options?.renderStatus,
675
- file: options?.file,
676
- sourceFile: options?.sourceFile
677
- });
678
- const reqOpts = updateDocument(payload);
679
- sideEffects?.onSiteCall?.();
680
- try {
681
- const result = await httpClient.request(reqOpts);
682
- sideEffects?.onSuccess?.(result);
683
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
684
- } catch (err) {
685
- const transformedError = (0, import_transform_error.transformError)(
686
- err,
687
- {
688
- spreadPathsToArguments: {},
689
- explicitPathsToArguments: {
690
- id: "$[0]",
691
- renderStatus: "$[1].renderStatus",
692
- file: "$[1].file",
693
- sourceFile: "$[1].sourceFile"
694
- },
695
- singleArgumentUnchanged: false
696
- },
697
- ["_id", "options"]
698
- );
699
- sideEffects?.onError?.(err);
700
- throw transformedError;
701
- }
702
- }
703
- async function downloadDocument2(documentId, options) {
704
- const { httpClient, sideEffects } = arguments[2];
705
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
706
- documentId,
707
- urlExpirationInSeconds: options?.urlExpirationInSeconds,
708
- contentDisposition: options?.contentDisposition
709
- });
710
- const reqOpts = downloadDocument(payload);
711
- sideEffects?.onSiteCall?.();
712
- try {
713
- const result = await httpClient.request(reqOpts);
714
- sideEffects?.onSuccess?.(result);
715
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
716
- } catch (err) {
717
- const transformedError = (0, import_transform_error.transformError)(
718
- err,
719
- {
720
- spreadPathsToArguments: {},
721
- explicitPathsToArguments: {
722
- documentId: "$[0]",
723
- urlExpirationInSeconds: "$[1].urlExpirationInSeconds",
724
- contentDisposition: "$[1].contentDisposition"
725
- },
726
- singleArgumentUnchanged: false
727
- },
728
- ["documentId", "options"]
729
- );
730
- sideEffects?.onError?.(err);
731
- throw transformedError;
732
- }
733
- }
734
- async function getDownloadUrl2(options) {
735
- const { httpClient, sideEffects } = arguments[1];
736
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
737
- documentId: options?.documentId,
738
- externalId: options?.externalId,
739
- fileToken: options?.fileToken,
740
- urlExpirationInSeconds: options?.urlExpirationInSeconds,
741
- downloadButtonText: options?.downloadButtonText,
742
- contentDisposition: options?.contentDisposition
743
- });
744
- const reqOpts = getDownloadUrl(payload);
745
- sideEffects?.onSiteCall?.();
746
- try {
747
- const result = await httpClient.request(reqOpts);
748
- sideEffects?.onSuccess?.(result);
749
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
750
- } catch (err) {
751
- const transformedError = (0, import_transform_error.transformError)(
752
- err,
753
- {
754
- spreadPathsToArguments: {},
755
- explicitPathsToArguments: {
756
- documentId: "$[0].documentId",
757
- externalId: "$[0].externalId",
758
- fileToken: "$[0].fileToken",
759
- urlExpirationInSeconds: "$[0].urlExpirationInSeconds",
760
- downloadButtonText: "$[0].downloadButtonText",
761
- contentDisposition: "$[0].contentDisposition"
762
- },
763
- singleArgumentUnchanged: false
764
- },
765
- ["options"]
766
- );
767
- sideEffects?.onError?.(err);
768
- throw transformedError;
769
- }
770
- }
771
- async function downloadDocumentSource2(documentId, options) {
772
- const { httpClient, sideEffects } = arguments[2];
773
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
774
- documentId,
775
- contentDisposition: options?.contentDisposition
776
- });
777
- const reqOpts = downloadDocumentSource(payload);
778
- sideEffects?.onSiteCall?.();
779
- try {
780
- const result = await httpClient.request(reqOpts);
781
- sideEffects?.onSuccess?.(result);
782
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
783
- } catch (err) {
784
- const transformedError = (0, import_transform_error.transformError)(
785
- err,
786
- {
787
- spreadPathsToArguments: {},
788
- explicitPathsToArguments: {
789
- documentId: "$[0]",
790
- contentDisposition: "$[1].contentDisposition"
791
- },
792
- singleArgumentUnchanged: false
793
- },
794
- ["documentId", "options"]
795
- );
796
- sideEffects?.onError?.(err);
797
- throw transformedError;
798
- }
799
- }
800
- async function getDownloadPage2(file) {
801
- const { httpClient, sideEffects } = arguments[1];
802
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ file });
803
- const reqOpts = getDownloadPage(payload);
804
- sideEffects?.onSiteCall?.();
805
- try {
806
- const result = await httpClient.request(reqOpts);
807
- sideEffects?.onSuccess?.(result);
808
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
809
- } catch (err) {
810
- const transformedError = (0, import_transform_error.transformError)(
811
- err,
812
- {
813
- spreadPathsToArguments: {},
814
- explicitPathsToArguments: { file: "$[0]" },
815
- singleArgumentUnchanged: false
816
- },
817
- ["file"]
818
- );
819
- sideEffects?.onError?.(err);
820
- throw transformedError;
821
- }
822
- }
823
- async function redirectToDocument2(file) {
824
- const { httpClient, sideEffects } = arguments[1];
825
- const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ file });
826
- const reqOpts = redirectToDocument(payload);
827
- sideEffects?.onSiteCall?.();
828
- try {
829
- const result = await httpClient.request(reqOpts);
830
- sideEffects?.onSuccess?.(result);
831
- return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
832
- } catch (err) {
833
- const transformedError = (0, import_transform_error.transformError)(
834
- err,
835
- {
836
- spreadPathsToArguments: {},
837
- explicitPathsToArguments: { file: "$[0]" },
838
- singleArgumentUnchanged: false
839
- },
840
- ["file"]
841
- );
842
- sideEffects?.onError?.(err);
843
- throw transformedError;
844
- }
845
- }
846
- // Annotate the CommonJS export names for ESM import in node:
847
- 0 && (module.exports = {
848
- ContentDisposition,
849
- Format,
850
- PageOverflow,
851
- PaperSize,
852
- RenderFormat,
853
- RenderStatus,
854
- RequestedFields,
855
- ResizeOption,
856
- SortOrder,
857
- WebhookIdentityType,
858
- WixMpClientVersion,
859
- createDocument,
860
- deleteDocument,
861
- downloadDocument,
862
- downloadDocumentSource,
863
- getDocument,
864
- getDownloadPage,
865
- getDownloadUrl,
866
- queryDocument,
867
- redirectToDocument,
868
- typedQueryDocument,
869
- updateDocument,
870
- utils
871
- });
872
- //# sourceMappingURL=index.typings.js.map