@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,1067 +0,0 @@
1
- // src/papyrus-v1-document-documents.public.ts
2
- import { renameKeysFromRESTResponseToSDKResponse as renameKeysFromRESTResponseToSDKResponse2 } from "@wix/sdk-runtime/rename-all-nested-keys";
3
- import { transformRESTTimestampToSDKTimestamp as transformRESTTimestampToSDKTimestamp2 } from "@wix/sdk-runtime/transformations/timestamp";
4
- import { transformPaths as transformPaths3 } from "@wix/sdk-runtime/transformations/transform-paths";
5
- import { EventDefinition } from "@wix/sdk-types";
6
-
7
- // src/papyrus-v1-document-documents.universal.ts
8
- import { transformError as sdkTransformError } from "@wix/sdk-runtime/transform-error";
9
- import { queryBuilder } from "@wix/sdk-runtime/query-builder";
10
- import {
11
- renameKeysFromSDKRequestToRESTRequest,
12
- renameKeysFromRESTResponseToSDKResponse
13
- } from "@wix/sdk-runtime/rename-all-nested-keys";
14
-
15
- // src/papyrus-v1-document-documents.http.ts
16
- import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
17
- import { transformSDKFloatToRESTFloat } from "@wix/sdk-runtime/transformations/float";
18
- import { transformRESTBytesToSDKBytes } from "@wix/sdk-runtime/transformations/bytes";
19
- import { transformSDKTimestampToRESTTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
20
- import { transformRESTTimestampToSDKTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
21
- import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
22
- import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
23
- function resolveWixPapyrusV1DownloadPageControllerUrl(opts) {
24
- const domainToMappings = {
25
- "api._base_domain_": [
26
- {
27
- srcPath: "/papyrus-document",
28
- destPath: ""
29
- }
30
- ],
31
- "www.wixapis.com": [
32
- {
33
- srcPath: "/papyrus-document/v1/documents",
34
- destPath: "/v1/documents"
35
- }
36
- ],
37
- "papyrus.wixapps.net": [
38
- {
39
- srcPath: "/download",
40
- destPath: "/download"
41
- },
42
- {
43
- srcPath: "/papyrus-document",
44
- destPath: ""
45
- },
46
- {
47
- srcPath: "/view",
48
- destPath: "/view"
49
- }
50
- ],
51
- "manage._base_domain_": [
52
- {
53
- srcPath: "/papyrus-document",
54
- destPath: ""
55
- }
56
- ],
57
- "api._api_base_domain_": [
58
- {
59
- srcPath: "/papyrus-document",
60
- destPath: ""
61
- }
62
- ]
63
- };
64
- return resolveUrl(Object.assign(opts, { domainToMappings }));
65
- }
66
- function resolveWixPapyrusV1DocumentServiceUrl(opts) {
67
- const domainToMappings = {
68
- "api._base_domain_": [
69
- {
70
- srcPath: "/papyrus-document",
71
- destPath: ""
72
- }
73
- ],
74
- "www.wixapis.com": [
75
- {
76
- srcPath: "/papyrus-document/v1/documents",
77
- destPath: "/v1/documents"
78
- }
79
- ],
80
- "papyrus.wixapps.net": [
81
- {
82
- srcPath: "/download",
83
- destPath: "/download"
84
- },
85
- {
86
- srcPath: "/papyrus-document",
87
- destPath: ""
88
- },
89
- {
90
- srcPath: "/view",
91
- destPath: "/view"
92
- }
93
- ],
94
- "manage._base_domain_": [
95
- {
96
- srcPath: "/papyrus-document",
97
- destPath: ""
98
- }
99
- ],
100
- "api._api_base_domain_": [
101
- {
102
- srcPath: "/papyrus-document",
103
- destPath: ""
104
- }
105
- ]
106
- };
107
- return resolveUrl(Object.assign(opts, { domainToMappings }));
108
- }
109
- var PACKAGE_NAME = "@wix/auto_sdk_papyrus_documents";
110
- function createDocument(payload) {
111
- function __createDocument({ host }) {
112
- const serializedData = transformPaths(payload, [
113
- {
114
- transformFn: transformSDKTimestampToRESTTimestamp,
115
- paths: [
116
- { path: "document.createdDate" },
117
- { path: "document.updatedDate" },
118
- { path: "document.expirationDate" }
119
- ]
120
- }
121
- ]);
122
- const metadata = {
123
- entityFqdn: "wix.papyrus.v1.document",
124
- method: "POST",
125
- methodFqn: "wix.papyrus.v1.DocumentService.CreateDocument",
126
- packageName: PACKAGE_NAME,
127
- migrationOptions: {
128
- optInTransformResponse: true
129
- },
130
- url: resolveWixPapyrusV1DocumentServiceUrl({
131
- protoPath: "/v1/documents",
132
- data: serializedData,
133
- host
134
- }),
135
- data: serializedData,
136
- transformResponse: (payload2) => transformPaths(payload2, [
137
- {
138
- transformFn: transformRESTTimestampToSDKTimestamp,
139
- paths: [
140
- { path: "document.createdDate" },
141
- { path: "document.updatedDate" },
142
- { path: "document.expirationDate" }
143
- ]
144
- }
145
- ])
146
- };
147
- return metadata;
148
- }
149
- return __createDocument;
150
- }
151
- function getDocument(payload) {
152
- function __getDocument({ host }) {
153
- const metadata = {
154
- entityFqdn: "wix.papyrus.v1.document",
155
- method: "GET",
156
- methodFqn: "wix.papyrus.v1.DocumentService.GetDocument",
157
- packageName: PACKAGE_NAME,
158
- migrationOptions: {
159
- optInTransformResponse: true
160
- },
161
- url: resolveWixPapyrusV1DocumentServiceUrl({
162
- protoPath: "/v1/documents/{documentId}",
163
- data: payload,
164
- host
165
- }),
166
- params: toURLSearchParams(payload),
167
- transformResponse: (payload2) => transformPaths(payload2, [
168
- {
169
- transformFn: transformRESTTimestampToSDKTimestamp,
170
- paths: [
171
- { path: "document.createdDate" },
172
- { path: "document.updatedDate" },
173
- { path: "document.expirationDate" }
174
- ]
175
- }
176
- ])
177
- };
178
- return metadata;
179
- }
180
- return __getDocument;
181
- }
182
- function deleteDocument(payload) {
183
- function __deleteDocument({ host }) {
184
- const metadata = {
185
- entityFqdn: "wix.papyrus.v1.document",
186
- method: "DELETE",
187
- methodFqn: "wix.papyrus.v1.DocumentService.DeleteDocument",
188
- packageName: PACKAGE_NAME,
189
- migrationOptions: {
190
- optInTransformResponse: true
191
- },
192
- url: resolveWixPapyrusV1DocumentServiceUrl({
193
- protoPath: "/v1/documents/{documentId}",
194
- data: payload,
195
- host
196
- }),
197
- params: toURLSearchParams(payload),
198
- transformResponse: (payload2) => transformPaths(payload2, [
199
- {
200
- transformFn: transformRESTTimestampToSDKTimestamp,
201
- paths: [
202
- { path: "document.createdDate" },
203
- { path: "document.updatedDate" },
204
- { path: "document.expirationDate" }
205
- ]
206
- }
207
- ])
208
- };
209
- return metadata;
210
- }
211
- return __deleteDocument;
212
- }
213
- function queryDocument(payload) {
214
- function __queryDocument({ host }) {
215
- const serializedData = transformPaths(payload, [
216
- {
217
- transformFn: transformSDKFloatToRESTFloat,
218
- paths: [
219
- { path: "query.sort.origin.latitude" },
220
- { path: "query.sort.origin.longitude" }
221
- ]
222
- }
223
- ]);
224
- const metadata = {
225
- entityFqdn: "wix.papyrus.v1.document",
226
- method: "POST",
227
- methodFqn: "wix.papyrus.v1.DocumentService.QueryDocument",
228
- packageName: PACKAGE_NAME,
229
- migrationOptions: {
230
- optInTransformResponse: true
231
- },
232
- url: resolveWixPapyrusV1DocumentServiceUrl({
233
- protoPath: "/v1/documents/query",
234
- data: serializedData,
235
- host
236
- }),
237
- data: serializedData,
238
- transformResponse: (payload2) => transformPaths(payload2, [
239
- {
240
- transformFn: transformRESTTimestampToSDKTimestamp,
241
- paths: [
242
- { path: "documents.createdDate" },
243
- { path: "documents.updatedDate" },
244
- { path: "documents.expirationDate" }
245
- ]
246
- }
247
- ])
248
- };
249
- return metadata;
250
- }
251
- return __queryDocument;
252
- }
253
- function updateDocument(payload) {
254
- function __updateDocument({ host }) {
255
- const metadata = {
256
- entityFqdn: "wix.papyrus.v1.document",
257
- method: "PATCH",
258
- methodFqn: "wix.papyrus.v1.DocumentService.UpdateDocument",
259
- packageName: PACKAGE_NAME,
260
- migrationOptions: {
261
- optInTransformResponse: true
262
- },
263
- url: resolveWixPapyrusV1DocumentServiceUrl({
264
- protoPath: "/v1/documents/{id}",
265
- data: payload,
266
- host
267
- }),
268
- data: payload,
269
- transformResponse: (payload2) => transformPaths(payload2, [
270
- {
271
- transformFn: transformRESTTimestampToSDKTimestamp,
272
- paths: [
273
- { path: "document.createdDate" },
274
- { path: "document.updatedDate" },
275
- { path: "document.expirationDate" }
276
- ]
277
- }
278
- ])
279
- };
280
- return metadata;
281
- }
282
- return __updateDocument;
283
- }
284
- function downloadDocument(payload) {
285
- function __downloadDocument({ host }) {
286
- const metadata = {
287
- entityFqdn: "wix.papyrus.v1.document",
288
- method: "GET",
289
- methodFqn: "wix.papyrus.v1.DocumentService.DownloadDocument",
290
- packageName: PACKAGE_NAME,
291
- migrationOptions: {
292
- optInTransformResponse: true
293
- },
294
- url: resolveWixPapyrusV1DocumentServiceUrl({
295
- protoPath: "/v1/documents/download/{documentId}",
296
- data: payload,
297
- host
298
- }),
299
- params: toURLSearchParams(payload),
300
- transformResponse: (payload2) => transformPaths(payload2, [
301
- {
302
- transformFn: transformRESTTimestampToSDKTimestamp,
303
- paths: [{ path: "expirationDate" }]
304
- }
305
- ])
306
- };
307
- return metadata;
308
- }
309
- return __downloadDocument;
310
- }
311
- function getDownloadUrl(payload) {
312
- function __getDownloadUrl({ host }) {
313
- const metadata = {
314
- entityFqdn: "wix.papyrus.v1.document",
315
- method: "GET",
316
- methodFqn: "wix.papyrus.v1.DocumentService.GetDownloadUrl",
317
- packageName: PACKAGE_NAME,
318
- migrationOptions: {
319
- optInTransformResponse: true
320
- },
321
- url: resolveWixPapyrusV1DocumentServiceUrl({
322
- protoPath: "/v1/documents/download-url",
323
- data: payload,
324
- host
325
- }),
326
- params: toURLSearchParams(payload),
327
- transformResponse: (payload2) => transformPaths(payload2, [
328
- {
329
- transformFn: transformRESTTimestampToSDKTimestamp,
330
- paths: [{ path: "expirationDate" }]
331
- }
332
- ])
333
- };
334
- return metadata;
335
- }
336
- return __getDownloadUrl;
337
- }
338
- function downloadDocumentSource(payload) {
339
- function __downloadDocumentSource({ host }) {
340
- const metadata = {
341
- entityFqdn: "wix.papyrus.v1.document",
342
- method: "GET",
343
- methodFqn: "wix.papyrus.v1.DocumentService.DownloadDocumentSource",
344
- packageName: PACKAGE_NAME,
345
- migrationOptions: {
346
- optInTransformResponse: true
347
- },
348
- url: resolveWixPapyrusV1DocumentServiceUrl({
349
- protoPath: "/v1/documents/download/{documentId}/source",
350
- data: payload,
351
- host
352
- }),
353
- params: toURLSearchParams(payload)
354
- };
355
- return metadata;
356
- }
357
- return __downloadDocumentSource;
358
- }
359
- function getDownloadPage(payload) {
360
- function __getDownloadPage({ host }) {
361
- const metadata = {
362
- entityFqdn: "wix.papyrus.v1.document",
363
- method: "GET",
364
- methodFqn: "wix.papyrus.v1.DownloadPageController.GetDownloadPage",
365
- packageName: PACKAGE_NAME,
366
- migrationOptions: {
367
- optInTransformResponse: true
368
- },
369
- url: resolveWixPapyrusV1DownloadPageControllerUrl({
370
- protoPath: "/download",
371
- data: payload,
372
- host
373
- }),
374
- params: toURLSearchParams(payload),
375
- transformResponse: (payload2) => transformPaths(payload2, [
376
- {
377
- transformFn: transformRESTBytesToSDKBytes,
378
- paths: [{ path: "body" }]
379
- }
380
- ])
381
- };
382
- return metadata;
383
- }
384
- return __getDownloadPage;
385
- }
386
- function redirectToDocument(payload) {
387
- function __redirectToDocument({ host }) {
388
- const metadata = {
389
- entityFqdn: "wix.papyrus.v1.document",
390
- method: "GET",
391
- methodFqn: "wix.papyrus.v1.DownloadPageController.RedirectToDocument",
392
- packageName: PACKAGE_NAME,
393
- migrationOptions: {
394
- optInTransformResponse: true
395
- },
396
- url: resolveWixPapyrusV1DownloadPageControllerUrl({
397
- protoPath: "/view",
398
- data: payload,
399
- host
400
- }),
401
- params: toURLSearchParams(payload),
402
- transformResponse: (payload2) => transformPaths(payload2, [
403
- {
404
- transformFn: transformRESTBytesToSDKBytes,
405
- paths: [{ path: "body" }]
406
- }
407
- ])
408
- };
409
- return metadata;
410
- }
411
- return __redirectToDocument;
412
- }
413
-
414
- // src/papyrus-v1-document-documents.universal.ts
415
- import { transformPaths as transformPaths2 } from "@wix/sdk-runtime/transformations/transform-paths";
416
- import { createQueryUtils } from "@wix/sdk-runtime/query-builder-utils";
417
- var RenderStatus = /* @__PURE__ */ ((RenderStatus2) => {
418
- RenderStatus2["UNKNOWN"] = "UNKNOWN";
419
- RenderStatus2["ACCEPTED"] = "ACCEPTED";
420
- RenderStatus2["RENDERING"] = "RENDERING";
421
- RenderStatus2["READY"] = "READY";
422
- RenderStatus2["FAILED"] = "FAILED";
423
- RenderStatus2["EXPIRED"] = "EXPIRED";
424
- return RenderStatus2;
425
- })(RenderStatus || {});
426
- var Format = /* @__PURE__ */ ((Format2) => {
427
- Format2["UNKNOWN"] = "UNKNOWN";
428
- Format2["PDF"] = "PDF";
429
- return Format2;
430
- })(Format || {});
431
- var WixMpClientVersion = /* @__PURE__ */ ((WixMpClientVersion2) => {
432
- WixMpClientVersion2["UNKNOWN"] = "UNKNOWN";
433
- WixMpClientVersion2["MP_V1"] = "MP_V1";
434
- WixMpClientVersion2["MP_V2"] = "MP_V2";
435
- return WixMpClientVersion2;
436
- })(WixMpClientVersion || {});
437
- var RequestedFields = /* @__PURE__ */ ((RequestedFields2) => {
438
- RequestedFields2["DOCUMENT_CONTENT"] = "DOCUMENT_CONTENT";
439
- return RequestedFields2;
440
- })(RequestedFields || {});
441
- var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
442
- SortOrder2["ASC"] = "ASC";
443
- SortOrder2["DESC"] = "DESC";
444
- return SortOrder2;
445
- })(SortOrder || {});
446
- var ContentDisposition = /* @__PURE__ */ ((ContentDisposition2) => {
447
- ContentDisposition2["UNKNOWN_CONTENT_DISPOSITION"] = "UNKNOWN_CONTENT_DISPOSITION";
448
- ContentDisposition2["ATTACHMENT"] = "ATTACHMENT";
449
- ContentDisposition2["INLINE"] = "INLINE";
450
- return ContentDisposition2;
451
- })(ContentDisposition || {});
452
- var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
453
- WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
454
- WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
455
- WebhookIdentityType2["MEMBER"] = "MEMBER";
456
- WebhookIdentityType2["WIX_USER"] = "WIX_USER";
457
- WebhookIdentityType2["APP"] = "APP";
458
- return WebhookIdentityType2;
459
- })(WebhookIdentityType || {});
460
- var ResizeOption = /* @__PURE__ */ ((ResizeOption2) => {
461
- ResizeOption2["FIT"] = "FIT";
462
- ResizeOption2["CROP"] = "CROP";
463
- return ResizeOption2;
464
- })(ResizeOption || {});
465
- var PaperSize = /* @__PURE__ */ ((PaperSize2) => {
466
- PaperSize2["A4_PORTRAIT"] = "A4_PORTRAIT";
467
- PaperSize2["A4_LANDSCAPE"] = "A4_LANDSCAPE";
468
- return PaperSize2;
469
- })(PaperSize || {});
470
- var PageOverflow = /* @__PURE__ */ ((PageOverflow2) => {
471
- PageOverflow2["CONTENT_HIDDEN"] = "CONTENT_HIDDEN";
472
- PageOverflow2["CONTENT_BREAK"] = "CONTENT_BREAK";
473
- return PageOverflow2;
474
- })(PageOverflow || {});
475
- var RenderFormat = /* @__PURE__ */ ((RenderFormat2) => {
476
- RenderFormat2["PDF"] = "PDF";
477
- RenderFormat2["HTML"] = "HTML";
478
- return RenderFormat2;
479
- })(RenderFormat || {});
480
- async function createDocument2(options) {
481
- const { httpClient, sideEffects } = arguments[1];
482
- const payload = renameKeysFromSDKRequestToRESTRequest({
483
- document: options?.document
484
- });
485
- const reqOpts = createDocument(payload);
486
- sideEffects?.onSiteCall?.();
487
- try {
488
- const result = await httpClient.request(reqOpts);
489
- sideEffects?.onSuccess?.(result);
490
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.document;
491
- } catch (err) {
492
- const transformedError = sdkTransformError(
493
- err,
494
- {
495
- spreadPathsToArguments: {},
496
- explicitPathsToArguments: { document: "$[0].document" },
497
- singleArgumentUnchanged: false
498
- },
499
- ["options"]
500
- );
501
- sideEffects?.onError?.(err);
502
- throw transformedError;
503
- }
504
- }
505
- async function getDocument2(documentId, options) {
506
- const { httpClient, sideEffects } = arguments[2];
507
- const payload = renameKeysFromSDKRequestToRESTRequest({
508
- documentId,
509
- fields: options?.fields
510
- });
511
- const reqOpts = getDocument(payload);
512
- sideEffects?.onSiteCall?.();
513
- try {
514
- const result = await httpClient.request(reqOpts);
515
- sideEffects?.onSuccess?.(result);
516
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.document;
517
- } catch (err) {
518
- const transformedError = sdkTransformError(
519
- err,
520
- {
521
- spreadPathsToArguments: {},
522
- explicitPathsToArguments: { documentId: "$[0]", fields: "$[1].fields" },
523
- singleArgumentUnchanged: false
524
- },
525
- ["documentId", "options"]
526
- );
527
- sideEffects?.onError?.(err);
528
- throw transformedError;
529
- }
530
- }
531
- async function deleteDocument2(documentId) {
532
- const { httpClient, sideEffects } = arguments[1];
533
- const payload = renameKeysFromSDKRequestToRESTRequest({
534
- documentId
535
- });
536
- const reqOpts = deleteDocument(payload);
537
- sideEffects?.onSiteCall?.();
538
- try {
539
- const result = await httpClient.request(reqOpts);
540
- sideEffects?.onSuccess?.(result);
541
- return renameKeysFromRESTResponseToSDKResponse(result.data);
542
- } catch (err) {
543
- const transformedError = sdkTransformError(
544
- err,
545
- {
546
- spreadPathsToArguments: {},
547
- explicitPathsToArguments: { documentId: "$[0]" },
548
- singleArgumentUnchanged: false
549
- },
550
- ["documentId"]
551
- );
552
- sideEffects?.onError?.(err);
553
- throw transformedError;
554
- }
555
- }
556
- function queryDocument2(options) {
557
- const { httpClient, sideEffects } = arguments[1];
558
- return queryBuilder({
559
- func: async (payload) => {
560
- const reqOpts = queryDocument({
561
- ...payload,
562
- ...options ?? {}
563
- });
564
- sideEffects?.onSiteCall?.();
565
- try {
566
- const result = await httpClient.request(reqOpts);
567
- sideEffects?.onSuccess?.(result);
568
- return result;
569
- } catch (err) {
570
- sideEffects?.onError?.(err);
571
- throw err;
572
- }
573
- },
574
- requestTransformer: (query) => {
575
- const args = [query, options];
576
- return renameKeysFromSDKRequestToRESTRequest({
577
- ...args?.[1],
578
- query: args?.[0]
579
- });
580
- },
581
- responseTransformer: ({ data }) => {
582
- const transformedData = renameKeysFromRESTResponseToSDKResponse(
583
- transformPaths2(data, [])
584
- );
585
- return {
586
- items: transformedData?.documents,
587
- pagingMetadata: transformedData?.metadata
588
- };
589
- },
590
- errorTransformer: (err) => {
591
- const transformedError = sdkTransformError(err, {
592
- spreadPathsToArguments: {},
593
- explicitPathsToArguments: { query: "$[0]" },
594
- singleArgumentUnchanged: false
595
- });
596
- throw transformedError;
597
- },
598
- pagingMethod: "CURSOR",
599
- transformationPaths: {}
600
- });
601
- }
602
- async function typedQueryDocument(query, options) {
603
- const { httpClient, sideEffects } = arguments[2];
604
- const payload = renameKeysFromSDKRequestToRESTRequest({
605
- query,
606
- ...options
607
- });
608
- const reqOpts = queryDocument(payload);
609
- sideEffects?.onSiteCall?.();
610
- try {
611
- const result = await httpClient.request(reqOpts);
612
- sideEffects?.onSuccess?.(result);
613
- return renameKeysFromRESTResponseToSDKResponse(result.data);
614
- } catch (err) {
615
- const transformedError = sdkTransformError(
616
- err,
617
- {
618
- spreadPathsToArguments: {},
619
- explicitPathsToArguments: { query: "$[0]" },
620
- singleArgumentUnchanged: false
621
- },
622
- ["query", "options"]
623
- );
624
- sideEffects?.onError?.(err);
625
- throw transformedError;
626
- }
627
- }
628
- var utils = {
629
- query: /* @__PURE__ */ createQueryUtils()
630
- };
631
- async function updateDocument2(_id, options) {
632
- const { httpClient, sideEffects } = arguments[2];
633
- const payload = renameKeysFromSDKRequestToRESTRequest({
634
- id: _id,
635
- renderStatus: options?.renderStatus,
636
- file: options?.file,
637
- sourceFile: options?.sourceFile
638
- });
639
- const reqOpts = updateDocument(payload);
640
- sideEffects?.onSiteCall?.();
641
- try {
642
- const result = await httpClient.request(reqOpts);
643
- sideEffects?.onSuccess?.(result);
644
- return renameKeysFromRESTResponseToSDKResponse(result.data);
645
- } catch (err) {
646
- const transformedError = sdkTransformError(
647
- err,
648
- {
649
- spreadPathsToArguments: {},
650
- explicitPathsToArguments: {
651
- id: "$[0]",
652
- renderStatus: "$[1].renderStatus",
653
- file: "$[1].file",
654
- sourceFile: "$[1].sourceFile"
655
- },
656
- singleArgumentUnchanged: false
657
- },
658
- ["_id", "options"]
659
- );
660
- sideEffects?.onError?.(err);
661
- throw transformedError;
662
- }
663
- }
664
- async function downloadDocument2(documentId, options) {
665
- const { httpClient, sideEffects } = arguments[2];
666
- const payload = renameKeysFromSDKRequestToRESTRequest({
667
- documentId,
668
- urlExpirationInSeconds: options?.urlExpirationInSeconds,
669
- contentDisposition: options?.contentDisposition
670
- });
671
- const reqOpts = downloadDocument(payload);
672
- sideEffects?.onSiteCall?.();
673
- try {
674
- const result = await httpClient.request(reqOpts);
675
- sideEffects?.onSuccess?.(result);
676
- return renameKeysFromRESTResponseToSDKResponse(result.data);
677
- } catch (err) {
678
- const transformedError = sdkTransformError(
679
- err,
680
- {
681
- spreadPathsToArguments: {},
682
- explicitPathsToArguments: {
683
- documentId: "$[0]",
684
- urlExpirationInSeconds: "$[1].urlExpirationInSeconds",
685
- contentDisposition: "$[1].contentDisposition"
686
- },
687
- singleArgumentUnchanged: false
688
- },
689
- ["documentId", "options"]
690
- );
691
- sideEffects?.onError?.(err);
692
- throw transformedError;
693
- }
694
- }
695
- async function getDownloadUrl2(options) {
696
- const { httpClient, sideEffects } = arguments[1];
697
- const payload = renameKeysFromSDKRequestToRESTRequest({
698
- documentId: options?.documentId,
699
- externalId: options?.externalId,
700
- fileToken: options?.fileToken,
701
- urlExpirationInSeconds: options?.urlExpirationInSeconds,
702
- downloadButtonText: options?.downloadButtonText,
703
- contentDisposition: options?.contentDisposition
704
- });
705
- const reqOpts = getDownloadUrl(payload);
706
- sideEffects?.onSiteCall?.();
707
- try {
708
- const result = await httpClient.request(reqOpts);
709
- sideEffects?.onSuccess?.(result);
710
- return renameKeysFromRESTResponseToSDKResponse(result.data);
711
- } catch (err) {
712
- const transformedError = sdkTransformError(
713
- err,
714
- {
715
- spreadPathsToArguments: {},
716
- explicitPathsToArguments: {
717
- documentId: "$[0].documentId",
718
- externalId: "$[0].externalId",
719
- fileToken: "$[0].fileToken",
720
- urlExpirationInSeconds: "$[0].urlExpirationInSeconds",
721
- downloadButtonText: "$[0].downloadButtonText",
722
- contentDisposition: "$[0].contentDisposition"
723
- },
724
- singleArgumentUnchanged: false
725
- },
726
- ["options"]
727
- );
728
- sideEffects?.onError?.(err);
729
- throw transformedError;
730
- }
731
- }
732
- async function downloadDocumentSource2(documentId, options) {
733
- const { httpClient, sideEffects } = arguments[2];
734
- const payload = renameKeysFromSDKRequestToRESTRequest({
735
- documentId,
736
- contentDisposition: options?.contentDisposition
737
- });
738
- const reqOpts = downloadDocumentSource(payload);
739
- sideEffects?.onSiteCall?.();
740
- try {
741
- const result = await httpClient.request(reqOpts);
742
- sideEffects?.onSuccess?.(result);
743
- return renameKeysFromRESTResponseToSDKResponse(result.data);
744
- } catch (err) {
745
- const transformedError = sdkTransformError(
746
- err,
747
- {
748
- spreadPathsToArguments: {},
749
- explicitPathsToArguments: {
750
- documentId: "$[0]",
751
- contentDisposition: "$[1].contentDisposition"
752
- },
753
- singleArgumentUnchanged: false
754
- },
755
- ["documentId", "options"]
756
- );
757
- sideEffects?.onError?.(err);
758
- throw transformedError;
759
- }
760
- }
761
- async function getDownloadPage2(file) {
762
- const { httpClient, sideEffects } = arguments[1];
763
- const payload = renameKeysFromSDKRequestToRESTRequest({ file });
764
- const reqOpts = getDownloadPage(payload);
765
- sideEffects?.onSiteCall?.();
766
- try {
767
- const result = await httpClient.request(reqOpts);
768
- sideEffects?.onSuccess?.(result);
769
- return renameKeysFromRESTResponseToSDKResponse(result.data);
770
- } catch (err) {
771
- const transformedError = sdkTransformError(
772
- err,
773
- {
774
- spreadPathsToArguments: {},
775
- explicitPathsToArguments: { file: "$[0]" },
776
- singleArgumentUnchanged: false
777
- },
778
- ["file"]
779
- );
780
- sideEffects?.onError?.(err);
781
- throw transformedError;
782
- }
783
- }
784
- async function redirectToDocument2(file) {
785
- const { httpClient, sideEffects } = arguments[1];
786
- const payload = renameKeysFromSDKRequestToRESTRequest({ file });
787
- const reqOpts = redirectToDocument(payload);
788
- sideEffects?.onSiteCall?.();
789
- try {
790
- const result = await httpClient.request(reqOpts);
791
- sideEffects?.onSuccess?.(result);
792
- return renameKeysFromRESTResponseToSDKResponse(result.data);
793
- } catch (err) {
794
- const transformedError = sdkTransformError(
795
- err,
796
- {
797
- spreadPathsToArguments: {},
798
- explicitPathsToArguments: { file: "$[0]" },
799
- singleArgumentUnchanged: false
800
- },
801
- ["file"]
802
- );
803
- sideEffects?.onError?.(err);
804
- throw transformedError;
805
- }
806
- }
807
-
808
- // src/papyrus-v1-document-documents.public.ts
809
- function createDocument3(httpClient) {
810
- return (options) => createDocument2(
811
- options,
812
- // @ts-ignore
813
- { httpClient }
814
- );
815
- }
816
- function getDocument3(httpClient) {
817
- return (documentId, options) => getDocument2(
818
- documentId,
819
- options,
820
- // @ts-ignore
821
- { httpClient }
822
- );
823
- }
824
- function deleteDocument3(httpClient) {
825
- return (documentId) => deleteDocument2(
826
- documentId,
827
- // @ts-ignore
828
- { httpClient }
829
- );
830
- }
831
- function queryDocument3(httpClient) {
832
- return (options) => queryDocument2(
833
- options,
834
- // @ts-ignore
835
- { httpClient }
836
- );
837
- }
838
- function typedQueryDocument2(httpClient) {
839
- return (query, options) => typedQueryDocument(
840
- query,
841
- options,
842
- // @ts-ignore
843
- { httpClient }
844
- );
845
- }
846
- function updateDocument3(httpClient) {
847
- return (_id, options) => updateDocument2(
848
- _id,
849
- options,
850
- // @ts-ignore
851
- { httpClient }
852
- );
853
- }
854
- function downloadDocument3(httpClient) {
855
- return (documentId, options) => downloadDocument2(
856
- documentId,
857
- options,
858
- // @ts-ignore
859
- { httpClient }
860
- );
861
- }
862
- function getDownloadUrl3(httpClient) {
863
- return (options) => getDownloadUrl2(
864
- options,
865
- // @ts-ignore
866
- { httpClient }
867
- );
868
- }
869
- function downloadDocumentSource3(httpClient) {
870
- return (documentId, options) => downloadDocumentSource2(
871
- documentId,
872
- options,
873
- // @ts-ignore
874
- { httpClient }
875
- );
876
- }
877
- function getDownloadPage3(httpClient) {
878
- return (file) => getDownloadPage2(
879
- file,
880
- // @ts-ignore
881
- { httpClient }
882
- );
883
- }
884
- function redirectToDocument3(httpClient) {
885
- return (file) => redirectToDocument2(
886
- file,
887
- // @ts-ignore
888
- { httpClient }
889
- );
890
- }
891
- var onDocumentCreated = /* @__PURE__ */ EventDefinition(
892
- "wix.papyrus.v1.document_created",
893
- true,
894
- (event) => renameKeysFromRESTResponseToSDKResponse2(
895
- transformPaths3(event, [
896
- {
897
- transformFn: transformRESTTimestampToSDKTimestamp2,
898
- paths: [
899
- { path: "entity.createdDate" },
900
- { path: "entity.updatedDate" },
901
- { path: "entity.expirationDate" },
902
- { path: "metadata.eventTime" }
903
- ]
904
- }
905
- ])
906
- )
907
- )();
908
- var onDocumentDeleted = /* @__PURE__ */ EventDefinition(
909
- "wix.papyrus.v1.document_deleted",
910
- true,
911
- (event) => renameKeysFromRESTResponseToSDKResponse2(
912
- transformPaths3(event, [
913
- {
914
- transformFn: transformRESTTimestampToSDKTimestamp2,
915
- paths: [
916
- { path: "undefined.createdDate" },
917
- { path: "undefined.updatedDate" },
918
- { path: "undefined.expirationDate" },
919
- { path: "metadata.eventTime" }
920
- ]
921
- }
922
- ])
923
- )
924
- )();
925
- var onDocumentRenderDelayed = /* @__PURE__ */ EventDefinition(
926
- "wix.papyrus.v1.document_document_render_delayed",
927
- true,
928
- (event) => renameKeysFromRESTResponseToSDKResponse2(
929
- transformPaths3(event, [
930
- {
931
- transformFn: transformRESTTimestampToSDKTimestamp2,
932
- paths: [
933
- { path: "data.document.createdDate" },
934
- { path: "data.document.updatedDate" },
935
- { path: "data.document.expirationDate" },
936
- { path: "metadata.eventTime" }
937
- ]
938
- }
939
- ])
940
- )
941
- )();
942
- var onDocumentRenderFailed = /* @__PURE__ */ EventDefinition(
943
- "wix.papyrus.v1.document_document_render_failed",
944
- true,
945
- (event) => renameKeysFromRESTResponseToSDKResponse2(
946
- transformPaths3(event, [
947
- {
948
- transformFn: transformRESTTimestampToSDKTimestamp2,
949
- paths: [
950
- { path: "data.document.createdDate" },
951
- { path: "data.document.updatedDate" },
952
- { path: "data.document.expirationDate" },
953
- { path: "metadata.eventTime" }
954
- ]
955
- }
956
- ])
957
- )
958
- )();
959
- var onDocumentRendered = /* @__PURE__ */ EventDefinition(
960
- "wix.papyrus.v1.document_document_rendered",
961
- true,
962
- (event) => renameKeysFromRESTResponseToSDKResponse2(
963
- transformPaths3(event, [
964
- {
965
- transformFn: transformRESTTimestampToSDKTimestamp2,
966
- paths: [
967
- { path: "data.document.createdDate" },
968
- { path: "data.document.updatedDate" },
969
- { path: "data.document.expirationDate" },
970
- { path: "metadata.eventTime" }
971
- ]
972
- }
973
- ])
974
- )
975
- )();
976
- var onDocumentUpdated = /* @__PURE__ */ EventDefinition(
977
- "wix.papyrus.v1.document_updated",
978
- true,
979
- (event) => renameKeysFromRESTResponseToSDKResponse2(
980
- transformPaths3(event, [
981
- {
982
- transformFn: transformRESTTimestampToSDKTimestamp2,
983
- paths: [
984
- { path: "entity.createdDate" },
985
- { path: "entity.updatedDate" },
986
- { path: "entity.expirationDate" },
987
- { path: "metadata.eventTime" }
988
- ]
989
- }
990
- ])
991
- )
992
- )();
993
-
994
- // src/papyrus-v1-document-documents.context.ts
995
- import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
996
- import { createEventModule } from "@wix/sdk-runtime/event-definition-modules";
997
- import { createQueryOverloadRouter } from "@wix/sdk-runtime/query-method-router";
998
- function customQueryDocument(httpClient) {
999
- const router = /* @__PURE__ */ createQueryOverloadRouter({
1000
- builderQueryFunction: (options) => queryDocument3(httpClient)(options),
1001
- typedQueryFunction: (query, options) => typedQueryDocument2(httpClient)(query, options),
1002
- hasOptionsParameter: true
1003
- });
1004
- function overloadedQuery(queryOrOptions, options) {
1005
- return router(...arguments);
1006
- }
1007
- return overloadedQuery;
1008
- }
1009
- var createDocument4 = /* @__PURE__ */ createRESTModule(createDocument3);
1010
- var getDocument4 = /* @__PURE__ */ createRESTModule(getDocument3);
1011
- var deleteDocument4 = /* @__PURE__ */ createRESTModule(deleteDocument3);
1012
- var updateDocument4 = /* @__PURE__ */ createRESTModule(updateDocument3);
1013
- var downloadDocument4 = /* @__PURE__ */ createRESTModule(downloadDocument3);
1014
- var getDownloadUrl4 = /* @__PURE__ */ createRESTModule(getDownloadUrl3);
1015
- var downloadDocumentSource4 = /* @__PURE__ */ createRESTModule(downloadDocumentSource3);
1016
- var getDownloadPage4 = /* @__PURE__ */ createRESTModule(getDownloadPage3);
1017
- var redirectToDocument4 = /* @__PURE__ */ createRESTModule(redirectToDocument3);
1018
- var queryDocument4 = /* @__PURE__ */ createRESTModule(customQueryDocument);
1019
- var onDocumentCreated2 = /* @__PURE__ */ createEventModule(
1020
- onDocumentCreated
1021
- );
1022
- var onDocumentDeleted2 = /* @__PURE__ */ createEventModule(
1023
- onDocumentDeleted
1024
- );
1025
- var onDocumentRenderDelayed2 = /* @__PURE__ */ createEventModule(
1026
- onDocumentRenderDelayed
1027
- );
1028
- var onDocumentRenderFailed2 = /* @__PURE__ */ createEventModule(
1029
- onDocumentRenderFailed
1030
- );
1031
- var onDocumentRendered2 = /* @__PURE__ */ createEventModule(
1032
- onDocumentRendered
1033
- );
1034
- var onDocumentUpdated2 = /* @__PURE__ */ createEventModule(
1035
- onDocumentUpdated
1036
- );
1037
- export {
1038
- ContentDisposition,
1039
- Format,
1040
- PageOverflow,
1041
- PaperSize,
1042
- RenderFormat,
1043
- RenderStatus,
1044
- RequestedFields,
1045
- ResizeOption,
1046
- SortOrder,
1047
- WebhookIdentityType,
1048
- WixMpClientVersion,
1049
- createDocument4 as createDocument,
1050
- deleteDocument4 as deleteDocument,
1051
- downloadDocument4 as downloadDocument,
1052
- downloadDocumentSource4 as downloadDocumentSource,
1053
- getDocument4 as getDocument,
1054
- getDownloadPage4 as getDownloadPage,
1055
- getDownloadUrl4 as getDownloadUrl,
1056
- onDocumentCreated2 as onDocumentCreated,
1057
- onDocumentDeleted2 as onDocumentDeleted,
1058
- onDocumentRenderDelayed2 as onDocumentRenderDelayed,
1059
- onDocumentRenderFailed2 as onDocumentRenderFailed,
1060
- onDocumentRendered2 as onDocumentRendered,
1061
- onDocumentUpdated2 as onDocumentUpdated,
1062
- queryDocument4 as queryDocument,
1063
- redirectToDocument4 as redirectToDocument,
1064
- updateDocument4 as updateDocument,
1065
- utils
1066
- };
1067
- //# sourceMappingURL=index.mjs.map