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