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