@wix/papyrus 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,932 @@
1
+ /** Document is the main entity of DocumentService. */
2
+ interface Document {
3
+ /**
4
+ * Document ID.
5
+ * @readonly
6
+ */
7
+ _id?: string | null;
8
+ /**
9
+ * Represents the time this Document was created.
10
+ * @readonly
11
+ */
12
+ _createdDate?: Date;
13
+ /**
14
+ * Represents the time this Document was last updated.
15
+ * @readonly
16
+ */
17
+ _updatedDate?: Date;
18
+ /**
19
+ * Document render status.
20
+ * @readonly
21
+ */
22
+ renderStatus?: RenderStatus;
23
+ /**
24
+ * URL to download document. Returned only when Document is in `READY` state.
25
+ * @readonly
26
+ */
27
+ downloadUrl?: string | null;
28
+ /** Template ID. When this parameter used the document will be rendered with this template default settings */
29
+ templateId?: string | null;
30
+ /** Unique per tenant external ID, for example order number. Used to retrieve Document later. */
31
+ externalId?: string | null;
32
+ /** Unique per tenant template external ID, for example ticket definition ID. Used to lookup corresponding template & template settings. */
33
+ templateSettingsExternalId?: string | null;
34
+ /** Template settings ID. */
35
+ templateSettingsId?: string | null;
36
+ /** The app slug of the template */
37
+ appSlug?: string | null;
38
+ /** The type of the template. */
39
+ templateType?: string | null;
40
+ /** Document content that is injected into template. */
41
+ content?: DocumentContent;
42
+ /** Number of hours after which document will be eventually expired and its content erased. */
43
+ expiresInHours?: number;
44
+ /**
45
+ * Represents the time this document becomes expired.
46
+ * @readonly
47
+ */
48
+ expirationDate?: Date;
49
+ /** Document format. Defaults to `PDF`. */
50
+ format?: Format;
51
+ /**
52
+ * Whether the link to the uploaded document is public or private.
53
+ * For public document static URL will be returned.
54
+ * For private document temporary URL will be generated by DocumentService.DownloadDocument.
55
+ */
56
+ public?: boolean | null;
57
+ /** Optional filename (without extension) to be used for the downloadable document. */
58
+ fileName?: string | null;
59
+ /** Client defined content checksum. Can be used for content comparison. */
60
+ contentChecksum?: string | null;
61
+ /** Rendering notification config. */
62
+ renderDelayedEventConfig?: RenderDelayedEventConfig;
63
+ }
64
+ declare enum RenderStatus {
65
+ UNKNOWN = "UNKNOWN",
66
+ /** Document was accepted and is waiting to be rendered. */
67
+ ACCEPTED = "ACCEPTED",
68
+ /** Rendering is in progress. */
69
+ RENDERING = "RENDERING",
70
+ /** Rendering finished successfully and document is ready to download. */
71
+ READY = "READY",
72
+ /** Rendering failed. */
73
+ FAILED = "FAILED",
74
+ /** Rendered document expired and is no longer available for download. */
75
+ EXPIRED = "EXPIRED"
76
+ }
77
+ interface DocumentContent {
78
+ /** Document pages. Each page is reference as $page. */
79
+ pages?: Record<string, any>[] | null;
80
+ /** Other document content referenced by $content variable */
81
+ content?: Record<string, any> | null;
82
+ /** ISO 639-1 language code of content (used in translations). */
83
+ language?: string;
84
+ /** IETF BCP 47 language tag (e.g. en-US). */
85
+ locale?: string | null;
86
+ }
87
+ declare enum Format {
88
+ UNKNOWN = "UNKNOWN",
89
+ PDF = "PDF"
90
+ }
91
+ interface TemplateSettingsOverride {
92
+ /** Indices (0-based) of pages with template settings override. */
93
+ pageIndices?: number[];
94
+ /** Template settings ID. */
95
+ templateSettingsId?: string | null;
96
+ /** Unique per tenant template external ID, for example ticket definition ID. Used to lookup corresponding template & template settings. */
97
+ templateSettingsExternalId?: string | null;
98
+ /** Template ID. When this parameter used the page will be rendered with this template default settings */
99
+ templateId?: string | null;
100
+ }
101
+ interface PageSettings {
102
+ /** Indices (0-based) of pages with template settings override. */
103
+ pageIndices?: number[];
104
+ /** Template settings ID. */
105
+ templateSettingsId?: string | null;
106
+ /** Unique per tenant template external ID, for example ticket definition ID. Used to lookup corresponding template & template settings. */
107
+ templateSettingsExternalId?: string | null;
108
+ /** Template ID. When this parameter used the page will be rendered with this template default settings */
109
+ templateId?: string | null;
110
+ }
111
+ declare enum WixMpClientVersion {
112
+ UNKNOWN = "UNKNOWN",
113
+ MP_V1 = "MP_V1",
114
+ MP_V2 = "MP_V2"
115
+ }
116
+ interface RenderDelayedEventConfig {
117
+ /**
118
+ * Controls DocumentRenderDelayed action event sending.
119
+ * Event will be sent after time_in_queue_minutes if document render status is ACCEPTED/RENDERING.
120
+ */
121
+ timeInQueueMinutes?: number;
122
+ }
123
+ interface GetDownloadPageRequest {
124
+ file: string | null;
125
+ }
126
+ interface RawHttpResponse {
127
+ body?: Uint8Array;
128
+ statusCode?: number | null;
129
+ headers?: HeadersEntry[];
130
+ }
131
+ interface HeadersEntry {
132
+ key?: string;
133
+ value?: string;
134
+ }
135
+ interface RenderDocumentRequestV2 {
136
+ /** Template settings. */
137
+ templateSettings?: TemplateSettings;
138
+ /** Document content. */
139
+ content?: DocumentContent;
140
+ /** Output format, defaults to PDF. */
141
+ outputFormat?: RenderFormat;
142
+ /** Overrides papyrusTemplatesStaticsUrl: "//static.parastorage.com/services/papyrus-templates-statics/${version_override}/" */
143
+ versionOverride?: string | null;
144
+ }
145
+ interface TemplateSettings {
146
+ /**
147
+ * Auto generated ID.
148
+ * @readonly
149
+ */
150
+ _id?: string | null;
151
+ /** Wix app definition ID. */
152
+ appSlug?: string | null;
153
+ /** The type of the template. */
154
+ templateType?: string | null;
155
+ /** The id of the template. */
156
+ templateId?: string | null;
157
+ /**
158
+ * Template settings external ID. For example ticket definition ID.
159
+ * Must be unique per tenant where tenant is taken from authorization (wix_app_id + meta_site_id)
160
+ */
161
+ externalId?: string | null;
162
+ /**
163
+ * Date settings were created.
164
+ * @readonly
165
+ */
166
+ _createdDate?: Date;
167
+ /**
168
+ * Date settings were updated.
169
+ * @readonly
170
+ */
171
+ _updatedDate?: Date;
172
+ settingGroups?: SettingsGroup[];
173
+ /** Paper size */
174
+ paperSize?: PaperSize;
175
+ }
176
+ interface TextSetting {
177
+ /** Font family class name */
178
+ fontFamily?: string | null;
179
+ /** Font style class names */
180
+ fontStyle?: string[];
181
+ /** Text alignment class name */
182
+ textAlignment?: string | null;
183
+ /** Text color hex code */
184
+ textColor?: string | null;
185
+ /** Font size */
186
+ fontSize?: number | null;
187
+ /** Text content setting */
188
+ textContent?: TextContent[];
189
+ }
190
+ interface TextContent {
191
+ _id?: string;
192
+ value?: string | null;
193
+ visible?: boolean;
194
+ }
195
+ interface ImageSetting {
196
+ /** Wix media Image */
197
+ image?: string;
198
+ /** Image resizing mode */
199
+ resize?: ResizeOption;
200
+ }
201
+ declare enum ResizeOption {
202
+ /** Automatically resizes full image to fit image field */
203
+ FIT = "FIT",
204
+ /** Enables user to manually crop image to fit image field */
205
+ CROP = "CROP"
206
+ }
207
+ interface SelectSetting {
208
+ /** Selected value */
209
+ value?: string | null;
210
+ /** Color hex code */
211
+ primaryColor?: string | null;
212
+ /** Color hex code */
213
+ secondaryColor?: string | null;
214
+ /** Size */
215
+ size?: number | null;
216
+ }
217
+ interface BackgroundSetting {
218
+ /** Color of the background hex code */
219
+ color?: string | null;
220
+ /** Wix media Image */
221
+ image?: string;
222
+ }
223
+ interface SettingsGroup {
224
+ /** Id of the control group */
225
+ groupId?: string;
226
+ /** Display settings. */
227
+ display?: Record<string, boolean>;
228
+ /** Texts settings. */
229
+ texts?: Record<string, TextSetting>;
230
+ /** Images settings. */
231
+ images?: Record<string, ImageSetting>;
232
+ /** Select option settings. */
233
+ selects?: Record<string, SelectSetting>;
234
+ /** Backgrounds settings. */
235
+ backgrounds?: Record<string, BackgroundSetting>;
236
+ }
237
+ declare enum PaperSize {
238
+ A4_PORTRAIT = "A4_PORTRAIT",
239
+ A4_LANDSCAPE = "A4_LANDSCAPE"
240
+ }
241
+ declare enum RenderFormat {
242
+ /** content-type: application/pdf */
243
+ PDF = "PDF",
244
+ /** content-type: text/html */
245
+ HTML = "HTML"
246
+ }
247
+ interface RenderDocumentByIdRequest {
248
+ /** Document ID. */
249
+ documentId?: string | null;
250
+ /** Output format, defaults to PDF. */
251
+ outputFormat?: RenderFormat;
252
+ }
253
+ interface DomainEvent extends DomainEventBodyOneOf {
254
+ createdEvent?: EntityCreatedEvent;
255
+ updatedEvent?: EntityUpdatedEvent;
256
+ deletedEvent?: EntityDeletedEvent;
257
+ actionEvent?: ActionEvent;
258
+ /**
259
+ * Unique event ID.
260
+ * Allows clients to ignore duplicate webhooks.
261
+ */
262
+ _id?: string;
263
+ /**
264
+ * Assumes actions are also always typed to an entity_type
265
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
266
+ */
267
+ entityFqdn?: string;
268
+ /**
269
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
270
+ * This is although the created/updated/deleted notion is duplication of the oneof types
271
+ * Example: created/updated/deleted/started/completed/email_opened
272
+ */
273
+ slug?: string;
274
+ /** ID of the entity associated with the event. */
275
+ entityId?: string;
276
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
277
+ eventTime?: Date;
278
+ /**
279
+ * Whether the event was triggered as a result of a privacy regulation application
280
+ * (for example, GDPR).
281
+ */
282
+ triggeredByAnonymizeRequest?: boolean | null;
283
+ /** If present, indicates the action that triggered the event. */
284
+ originatedFrom?: string | null;
285
+ /**
286
+ * A sequence number defining the order of updates to the underlying entity.
287
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
288
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
289
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
290
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
291
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
292
+ */
293
+ entityEventSequence?: string | null;
294
+ }
295
+ /** @oneof */
296
+ interface DomainEventBodyOneOf {
297
+ createdEvent?: EntityCreatedEvent;
298
+ updatedEvent?: EntityUpdatedEvent;
299
+ deletedEvent?: EntityDeletedEvent;
300
+ actionEvent?: ActionEvent;
301
+ }
302
+ interface EntityCreatedEvent {
303
+ entity?: string;
304
+ }
305
+ interface RestoreInfo {
306
+ deletedDate?: Date;
307
+ }
308
+ interface EntityUpdatedEvent {
309
+ /**
310
+ * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
311
+ * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
312
+ * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
313
+ */
314
+ currentEntity?: string;
315
+ }
316
+ interface EntityDeletedEvent {
317
+ /** Entity that was deleted */
318
+ deletedEntity?: string | null;
319
+ }
320
+ interface ActionEvent {
321
+ body?: string;
322
+ }
323
+ interface Empty {
324
+ }
325
+ interface DocumentRenderDelayed {
326
+ /** Document that is being rendered. */
327
+ document?: Document;
328
+ }
329
+ interface CreateDocumentRequest {
330
+ /** Document to be created */
331
+ document?: Document;
332
+ }
333
+ interface CreateDocumentResponse {
334
+ /** The created Document */
335
+ document?: Document;
336
+ }
337
+ interface GetDocumentRequest {
338
+ /** ID of the Document to retrieve */
339
+ documentId: string;
340
+ fields?: RequestedFields[];
341
+ }
342
+ declare enum RequestedFields {
343
+ UNKNOWN_REQUESTED_FIELD = "UNKNOWN_REQUESTED_FIELD",
344
+ /** Include `documentContent` in the response. */
345
+ DOCUMENT_CONTENT = "DOCUMENT_CONTENT"
346
+ }
347
+ interface GetDocumentResponse {
348
+ /** The retrieved Document */
349
+ document?: Document;
350
+ }
351
+ interface DeleteDocumentRequest {
352
+ /** ID of the Document to delete */
353
+ documentId: string;
354
+ }
355
+ interface DeleteDocumentResponse {
356
+ /** Deleted document. */
357
+ document?: Document;
358
+ }
359
+ interface QueryDocumentRequest {
360
+ /** WQL expression */
361
+ query: QueryV2;
362
+ fields?: RequestedFields[];
363
+ }
364
+ interface QueryV2 extends QueryV2PagingMethodOneOf {
365
+ /** Paging options to limit and skip the number of items. */
366
+ paging?: Paging;
367
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
368
+ cursorPaging?: CursorPaging;
369
+ /**
370
+ * Filter object.
371
+ *
372
+ * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).
373
+ */
374
+ filter?: Record<string, any> | null;
375
+ /**
376
+ * Sort object.
377
+ *
378
+ * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).
379
+ */
380
+ sort?: Sorting[];
381
+ /** Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned. */
382
+ fields?: string[];
383
+ /** Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned. */
384
+ fieldsets?: string[];
385
+ }
386
+ /** @oneof */
387
+ interface QueryV2PagingMethodOneOf {
388
+ /** Paging options to limit and skip the number of items. */
389
+ paging?: Paging;
390
+ /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
391
+ cursorPaging?: CursorPaging;
392
+ }
393
+ interface Sorting {
394
+ /** Name of the field to sort by. */
395
+ fieldName?: string;
396
+ /** Sort order. */
397
+ order?: SortOrder;
398
+ }
399
+ declare enum SortOrder {
400
+ ASC = "ASC",
401
+ DESC = "DESC"
402
+ }
403
+ interface Paging {
404
+ /** Number of items to load. */
405
+ limit?: number | null;
406
+ /** Number of items to skip in the current sort order. */
407
+ offset?: number | null;
408
+ }
409
+ interface CursorPaging {
410
+ /** Maximum number of items to return in the results. */
411
+ limit?: number | null;
412
+ /**
413
+ * Pointer to the next or previous page in the list of results.
414
+ *
415
+ * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
416
+ * Not relevant for the first request.
417
+ */
418
+ cursor?: string | null;
419
+ }
420
+ interface QueryDocumentResponse {
421
+ /** The retrieved Documents */
422
+ documents?: Document[];
423
+ /** Query results' metadata */
424
+ metadata?: PagingMetadataV2;
425
+ }
426
+ interface PagingMetadataV2 {
427
+ /** Number of items returned in the response. */
428
+ count?: number | null;
429
+ /** Offset that was requested. */
430
+ offset?: number | null;
431
+ /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
432
+ total?: number | null;
433
+ /** Flag that indicates the server failed to calculate the `total` field. */
434
+ tooManyToCount?: boolean | null;
435
+ /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
436
+ cursors?: Cursors;
437
+ }
438
+ interface Cursors {
439
+ /** Cursor string pointing to the next page in the list of results. */
440
+ next?: string | null;
441
+ /** Cursor pointing to the previous page in the list of results. */
442
+ prev?: string | null;
443
+ }
444
+ interface UpdateDocumentRequest {
445
+ /**
446
+ * Document ID.
447
+ * @readonly
448
+ */
449
+ _id: string | null;
450
+ /** Document render status. */
451
+ renderStatus?: RenderStatus;
452
+ /** Rendered document file. */
453
+ file?: DocumentFile;
454
+ /** Rendered document source HTML file. */
455
+ sourceFile?: DocumentFile;
456
+ }
457
+ interface DocumentFile {
458
+ /** File ID. */
459
+ fileId?: string | null;
460
+ /** File URL. Defined only for public documents. */
461
+ staticUrl?: string | null;
462
+ /** File path. */
463
+ filePath?: string | null;
464
+ }
465
+ interface UpdateDocumentResponse {
466
+ /** The created Document */
467
+ document?: Document;
468
+ }
469
+ interface DocumentRendered {
470
+ /** Rendered document */
471
+ document?: Document;
472
+ }
473
+ interface DocumentRenderFailed {
474
+ /** Document that failed to render */
475
+ document?: Document;
476
+ }
477
+ interface DownloadDocumentRequest {
478
+ /** ID of the Document to retrieve */
479
+ documentId: string;
480
+ /** URL expiration time. Only relevant for private documents. */
481
+ urlExpirationInSeconds?: number | null;
482
+ }
483
+ interface DownloadDocumentResponse {
484
+ /** Download URL. */
485
+ downloadUrl?: string;
486
+ /** URL expiration timestamp. Not provided for public documents because their links do not expire. */
487
+ expirationDate?: Date;
488
+ }
489
+ interface GetDownloadUrlRequest extends GetDownloadUrlRequestDocumentOneOf {
490
+ /** ID of the Document to retrieve */
491
+ documentId?: string | null;
492
+ /** ID of the Document to retrieve */
493
+ externalId?: string | null;
494
+ /** Signed file token */
495
+ fileToken?: string | null;
496
+ /** URL expiration time. Only relevant for private documents. */
497
+ urlExpirationInSeconds?: number | null;
498
+ }
499
+ /** @oneof */
500
+ interface GetDownloadUrlRequestDocumentOneOf {
501
+ /** ID of the Document to retrieve */
502
+ documentId?: string | null;
503
+ /** ID of the Document to retrieve */
504
+ externalId?: string | null;
505
+ /** Signed file token */
506
+ fileToken?: string | null;
507
+ }
508
+ interface GetDownloadUrlResponse {
509
+ /** Download URL. */
510
+ downloadUrl?: string | null;
511
+ /** URL expiration timestamp. Not provided for public documents because their links do not expire. */
512
+ expirationDate?: Date;
513
+ /** Document ID. */
514
+ documentId?: string | null;
515
+ /** Document render status. */
516
+ renderStatus?: RenderStatus;
517
+ /** Download URL. */
518
+ downloadPageUrl?: string | null;
519
+ }
520
+ interface DownloadDocumentSourceRequest {
521
+ /** ID of the Document to retrieve */
522
+ documentId: string;
523
+ }
524
+ interface DownloadDocumentSourceResponse {
525
+ /** Download URL. Expires after 10 minutes. */
526
+ downloadUrl?: string;
527
+ }
528
+ interface MessageEnvelope {
529
+ /** App instance ID. */
530
+ instanceId?: string | null;
531
+ /** Event type. */
532
+ eventType?: string;
533
+ /** The identification type and identity data. */
534
+ identity?: IdentificationData;
535
+ /** Stringify payload. */
536
+ data?: string;
537
+ }
538
+ interface IdentificationData extends IdentificationDataIdOneOf {
539
+ /** ID of a site visitor that has not logged in to the site. */
540
+ anonymousVisitorId?: string;
541
+ /** ID of a site visitor that has logged in to the site. */
542
+ memberId?: string;
543
+ /** ID of a Wix user (site owner, contributor, etc.). */
544
+ wixUserId?: string;
545
+ /** ID of an app. */
546
+ appId?: string;
547
+ /** @readonly */
548
+ identityType?: WebhookIdentityType;
549
+ }
550
+ /** @oneof */
551
+ interface IdentificationDataIdOneOf {
552
+ /** ID of a site visitor that has not logged in to the site. */
553
+ anonymousVisitorId?: string;
554
+ /** ID of a site visitor that has logged in to the site. */
555
+ memberId?: string;
556
+ /** ID of a Wix user (site owner, contributor, etc.). */
557
+ wixUserId?: string;
558
+ /** ID of an app. */
559
+ appId?: string;
560
+ }
561
+ declare enum WebhookIdentityType {
562
+ UNKNOWN = "UNKNOWN",
563
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
564
+ MEMBER = "MEMBER",
565
+ WIX_USER = "WIX_USER",
566
+ APP = "APP"
567
+ }
568
+ interface HeadersEntryNonNullableFields {
569
+ key: string;
570
+ value: string;
571
+ }
572
+ interface RawHttpResponseNonNullableFields {
573
+ body: Uint8Array;
574
+ headers: HeadersEntryNonNullableFields[];
575
+ }
576
+ interface DocumentContentNonNullableFields {
577
+ language: string;
578
+ }
579
+ interface TemplateSettingsOverrideNonNullableFields {
580
+ pageIndices: number[];
581
+ }
582
+ interface PageSettingsNonNullableFields {
583
+ pageIndices: number[];
584
+ }
585
+ interface RenderDelayedEventConfigNonNullableFields {
586
+ timeInQueueMinutes: number;
587
+ }
588
+ interface DocumentNonNullableFields {
589
+ renderStatus: RenderStatus;
590
+ content?: DocumentContentNonNullableFields;
591
+ expiresInHours: number;
592
+ format: Format;
593
+ templateSettings: TemplateSettingsOverrideNonNullableFields[];
594
+ pageSettings: PageSettingsNonNullableFields[];
595
+ wixMpClientVersion: WixMpClientVersion;
596
+ renderDelayedEventConfig?: RenderDelayedEventConfigNonNullableFields;
597
+ }
598
+ interface CreateDocumentResponseNonNullableFields {
599
+ document?: DocumentNonNullableFields;
600
+ }
601
+ interface GetDocumentResponseNonNullableFields {
602
+ document?: DocumentNonNullableFields;
603
+ }
604
+ interface DeleteDocumentResponseNonNullableFields {
605
+ document?: DocumentNonNullableFields;
606
+ }
607
+ interface QueryDocumentResponseNonNullableFields {
608
+ documents: DocumentNonNullableFields[];
609
+ }
610
+ interface UpdateDocumentResponseNonNullableFields {
611
+ document?: DocumentNonNullableFields;
612
+ }
613
+ interface DownloadDocumentResponseNonNullableFields {
614
+ downloadUrl: string;
615
+ }
616
+ interface GetDownloadUrlResponseNonNullableFields {
617
+ renderStatus: RenderStatus;
618
+ }
619
+ interface DownloadDocumentSourceResponseNonNullableFields {
620
+ downloadUrl: string;
621
+ }
622
+ interface BaseEventMetadata {
623
+ /** App instance ID. */
624
+ instanceId?: string | null;
625
+ /** Event type. */
626
+ eventType?: string;
627
+ /** The identification type and identity data. */
628
+ identity?: IdentificationData;
629
+ }
630
+ interface EventMetadata extends BaseEventMetadata {
631
+ /**
632
+ * Unique event ID.
633
+ * Allows clients to ignore duplicate webhooks.
634
+ */
635
+ _id?: string;
636
+ /**
637
+ * Assumes actions are also always typed to an entity_type
638
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
639
+ */
640
+ entityFqdn?: string;
641
+ /**
642
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
643
+ * This is although the created/updated/deleted notion is duplication of the oneof types
644
+ * Example: created/updated/deleted/started/completed/email_opened
645
+ */
646
+ slug?: string;
647
+ /** ID of the entity associated with the event. */
648
+ entityId?: string;
649
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
650
+ eventTime?: Date;
651
+ /**
652
+ * Whether the event was triggered as a result of a privacy regulation application
653
+ * (for example, GDPR).
654
+ */
655
+ triggeredByAnonymizeRequest?: boolean | null;
656
+ /** If present, indicates the action that triggered the event. */
657
+ originatedFrom?: string | null;
658
+ /**
659
+ * A sequence number defining the order of updates to the underlying entity.
660
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
661
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
662
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
663
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
664
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
665
+ */
666
+ entityEventSequence?: string | null;
667
+ }
668
+ interface DocumentRenderDelayedEnvelope {
669
+ data: DocumentRenderDelayed;
670
+ metadata: EventMetadata;
671
+ }
672
+ interface DocumentCreatedEnvelope {
673
+ entity: Document;
674
+ metadata: EventMetadata;
675
+ }
676
+ interface DocumentDeletedEnvelope {
677
+ metadata: EventMetadata;
678
+ }
679
+ interface DocumentUpdatedEnvelope {
680
+ entity: Document;
681
+ metadata: EventMetadata;
682
+ }
683
+ interface DocumentRenderedEnvelope {
684
+ data: DocumentRendered;
685
+ metadata: EventMetadata;
686
+ }
687
+ interface DocumentRenderFailedEnvelope {
688
+ data: DocumentRenderFailed;
689
+ metadata: EventMetadata;
690
+ }
691
+ interface CreateDocumentOptions {
692
+ /** Document to be created */
693
+ document?: Document;
694
+ }
695
+ interface GetDocumentOptions {
696
+ fields?: RequestedFields[];
697
+ }
698
+ interface QueryDocumentOptions {
699
+ fields?: RequestedFields[] | undefined;
700
+ }
701
+ interface QueryCursorResult {
702
+ cursors: Cursors;
703
+ hasNext: () => boolean;
704
+ hasPrev: () => boolean;
705
+ length: number;
706
+ pageSize: number;
707
+ }
708
+ interface DocumentsQueryResult extends QueryCursorResult {
709
+ items: Document[];
710
+ query: DocumentsQueryBuilder;
711
+ next: () => Promise<DocumentsQueryResult>;
712
+ prev: () => Promise<DocumentsQueryResult>;
713
+ }
714
+ interface DocumentsQueryBuilder {
715
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
716
+ * @documentationMaturity preview
717
+ */
718
+ limit: (limit: number) => DocumentsQueryBuilder;
719
+ /** @param cursor - A pointer to specific record
720
+ * @documentationMaturity preview
721
+ */
722
+ skipTo: (cursor: string) => DocumentsQueryBuilder;
723
+ /** @documentationMaturity preview */
724
+ find: () => Promise<DocumentsQueryResult>;
725
+ }
726
+ interface UpdateDocumentOptions {
727
+ /** Document render status. */
728
+ renderStatus?: RenderStatus;
729
+ /** Rendered document file. */
730
+ file?: DocumentFile;
731
+ /** Rendered document source HTML file. */
732
+ sourceFile?: DocumentFile;
733
+ }
734
+ interface DownloadDocumentOptions {
735
+ /** URL expiration time. Only relevant for private documents. */
736
+ urlExpirationInSeconds?: number | null;
737
+ }
738
+ interface GetDownloadUrlOptions extends GetDownloadUrlRequestDocumentOneOf {
739
+ /** ID of the Document to retrieve */
740
+ documentId?: string | null;
741
+ /** ID of the Document to retrieve */
742
+ externalId?: string | null;
743
+ /** Signed file token */
744
+ fileToken?: string | null;
745
+ /** URL expiration time. Only relevant for private documents. */
746
+ urlExpirationInSeconds?: number | null;
747
+ }
748
+
749
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
750
+ interface HttpClient {
751
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
752
+ fetchWithAuth: typeof fetch;
753
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
754
+ }
755
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
756
+ type HttpResponse<T = any> = {
757
+ data: T;
758
+ status: number;
759
+ statusText: string;
760
+ headers: any;
761
+ request?: any;
762
+ };
763
+ type RequestOptions<_TResponse = any, Data = any> = {
764
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
765
+ url: string;
766
+ data?: Data;
767
+ params?: URLSearchParams;
768
+ } & APIMetadata;
769
+ type APIMetadata = {
770
+ methodFqn?: string;
771
+ entityFqdn?: string;
772
+ packageName?: string;
773
+ };
774
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
775
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
776
+ __type: 'event-definition';
777
+ type: Type;
778
+ isDomainEvent?: boolean;
779
+ transformations?: (envelope: unknown) => Payload;
780
+ __payload: Payload;
781
+ };
782
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
783
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
784
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
785
+
786
+ declare global {
787
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
788
+ interface SymbolConstructor {
789
+ readonly observable: symbol;
790
+ }
791
+ }
792
+
793
+ declare function createRESTModule<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
794
+
795
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
796
+
797
+ declare const getDownloadPage: ReturnType<typeof createRESTModule<typeof publicGetDownloadPage>>;
798
+ declare const createDocument: ReturnType<typeof createRESTModule<typeof publicCreateDocument>>;
799
+ declare const getDocument: ReturnType<typeof createRESTModule<typeof publicGetDocument>>;
800
+ declare const deleteDocument: ReturnType<typeof createRESTModule<typeof publicDeleteDocument>>;
801
+ declare const queryDocument: ReturnType<typeof createRESTModule<typeof publicQueryDocument>>;
802
+ declare const updateDocument: ReturnType<typeof createRESTModule<typeof publicUpdateDocument>>;
803
+ declare const downloadDocument: ReturnType<typeof createRESTModule<typeof publicDownloadDocument>>;
804
+ declare const getDownloadUrl: ReturnType<typeof createRESTModule<typeof publicGetDownloadUrl>>;
805
+ declare const downloadDocumentSource: ReturnType<typeof createRESTModule<typeof publicDownloadDocumentSource>>;
806
+ declare const onDocumentRenderDelayed: ReturnType<typeof createEventModule<typeof publicOnDocumentRenderDelayed>>;
807
+ declare const onDocumentCreated: ReturnType<typeof createEventModule<typeof publicOnDocumentCreated>>;
808
+ declare const onDocumentDeleted: ReturnType<typeof createEventModule<typeof publicOnDocumentDeleted>>;
809
+ declare const onDocumentUpdated: ReturnType<typeof createEventModule<typeof publicOnDocumentUpdated>>;
810
+ declare const onDocumentRendered: ReturnType<typeof createEventModule<typeof publicOnDocumentRendered>>;
811
+ declare const onDocumentRenderFailed: ReturnType<typeof createEventModule<typeof publicOnDocumentRenderFailed>>;
812
+
813
+ type context_ActionEvent = ActionEvent;
814
+ type context_BackgroundSetting = BackgroundSetting;
815
+ type context_BaseEventMetadata = BaseEventMetadata;
816
+ type context_CreateDocumentOptions = CreateDocumentOptions;
817
+ type context_CreateDocumentRequest = CreateDocumentRequest;
818
+ type context_CreateDocumentResponse = CreateDocumentResponse;
819
+ type context_CreateDocumentResponseNonNullableFields = CreateDocumentResponseNonNullableFields;
820
+ type context_CursorPaging = CursorPaging;
821
+ type context_Cursors = Cursors;
822
+ type context_DeleteDocumentRequest = DeleteDocumentRequest;
823
+ type context_DeleteDocumentResponse = DeleteDocumentResponse;
824
+ type context_DeleteDocumentResponseNonNullableFields = DeleteDocumentResponseNonNullableFields;
825
+ type context_Document = Document;
826
+ type context_DocumentContent = DocumentContent;
827
+ type context_DocumentCreatedEnvelope = DocumentCreatedEnvelope;
828
+ type context_DocumentDeletedEnvelope = DocumentDeletedEnvelope;
829
+ type context_DocumentFile = DocumentFile;
830
+ type context_DocumentNonNullableFields = DocumentNonNullableFields;
831
+ type context_DocumentRenderDelayed = DocumentRenderDelayed;
832
+ type context_DocumentRenderDelayedEnvelope = DocumentRenderDelayedEnvelope;
833
+ type context_DocumentRenderFailed = DocumentRenderFailed;
834
+ type context_DocumentRenderFailedEnvelope = DocumentRenderFailedEnvelope;
835
+ type context_DocumentRendered = DocumentRendered;
836
+ type context_DocumentRenderedEnvelope = DocumentRenderedEnvelope;
837
+ type context_DocumentUpdatedEnvelope = DocumentUpdatedEnvelope;
838
+ type context_DocumentsQueryBuilder = DocumentsQueryBuilder;
839
+ type context_DocumentsQueryResult = DocumentsQueryResult;
840
+ type context_DomainEvent = DomainEvent;
841
+ type context_DomainEventBodyOneOf = DomainEventBodyOneOf;
842
+ type context_DownloadDocumentOptions = DownloadDocumentOptions;
843
+ type context_DownloadDocumentRequest = DownloadDocumentRequest;
844
+ type context_DownloadDocumentResponse = DownloadDocumentResponse;
845
+ type context_DownloadDocumentResponseNonNullableFields = DownloadDocumentResponseNonNullableFields;
846
+ type context_DownloadDocumentSourceRequest = DownloadDocumentSourceRequest;
847
+ type context_DownloadDocumentSourceResponse = DownloadDocumentSourceResponse;
848
+ type context_DownloadDocumentSourceResponseNonNullableFields = DownloadDocumentSourceResponseNonNullableFields;
849
+ type context_Empty = Empty;
850
+ type context_EntityCreatedEvent = EntityCreatedEvent;
851
+ type context_EntityDeletedEvent = EntityDeletedEvent;
852
+ type context_EntityUpdatedEvent = EntityUpdatedEvent;
853
+ type context_EventMetadata = EventMetadata;
854
+ type context_Format = Format;
855
+ declare const context_Format: typeof Format;
856
+ type context_GetDocumentOptions = GetDocumentOptions;
857
+ type context_GetDocumentRequest = GetDocumentRequest;
858
+ type context_GetDocumentResponse = GetDocumentResponse;
859
+ type context_GetDocumentResponseNonNullableFields = GetDocumentResponseNonNullableFields;
860
+ type context_GetDownloadPageRequest = GetDownloadPageRequest;
861
+ type context_GetDownloadUrlOptions = GetDownloadUrlOptions;
862
+ type context_GetDownloadUrlRequest = GetDownloadUrlRequest;
863
+ type context_GetDownloadUrlRequestDocumentOneOf = GetDownloadUrlRequestDocumentOneOf;
864
+ type context_GetDownloadUrlResponse = GetDownloadUrlResponse;
865
+ type context_GetDownloadUrlResponseNonNullableFields = GetDownloadUrlResponseNonNullableFields;
866
+ type context_HeadersEntry = HeadersEntry;
867
+ type context_IdentificationData = IdentificationData;
868
+ type context_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
869
+ type context_ImageSetting = ImageSetting;
870
+ type context_MessageEnvelope = MessageEnvelope;
871
+ type context_PageSettings = PageSettings;
872
+ type context_Paging = Paging;
873
+ type context_PagingMetadataV2 = PagingMetadataV2;
874
+ type context_PaperSize = PaperSize;
875
+ declare const context_PaperSize: typeof PaperSize;
876
+ type context_QueryDocumentOptions = QueryDocumentOptions;
877
+ type context_QueryDocumentRequest = QueryDocumentRequest;
878
+ type context_QueryDocumentResponse = QueryDocumentResponse;
879
+ type context_QueryDocumentResponseNonNullableFields = QueryDocumentResponseNonNullableFields;
880
+ type context_QueryV2 = QueryV2;
881
+ type context_QueryV2PagingMethodOneOf = QueryV2PagingMethodOneOf;
882
+ type context_RawHttpResponse = RawHttpResponse;
883
+ type context_RawHttpResponseNonNullableFields = RawHttpResponseNonNullableFields;
884
+ type context_RenderDelayedEventConfig = RenderDelayedEventConfig;
885
+ type context_RenderDocumentByIdRequest = RenderDocumentByIdRequest;
886
+ type context_RenderDocumentRequestV2 = RenderDocumentRequestV2;
887
+ type context_RenderFormat = RenderFormat;
888
+ declare const context_RenderFormat: typeof RenderFormat;
889
+ type context_RenderStatus = RenderStatus;
890
+ declare const context_RenderStatus: typeof RenderStatus;
891
+ type context_RequestedFields = RequestedFields;
892
+ declare const context_RequestedFields: typeof RequestedFields;
893
+ type context_ResizeOption = ResizeOption;
894
+ declare const context_ResizeOption: typeof ResizeOption;
895
+ type context_RestoreInfo = RestoreInfo;
896
+ type context_SelectSetting = SelectSetting;
897
+ type context_SettingsGroup = SettingsGroup;
898
+ type context_SortOrder = SortOrder;
899
+ declare const context_SortOrder: typeof SortOrder;
900
+ type context_Sorting = Sorting;
901
+ type context_TemplateSettings = TemplateSettings;
902
+ type context_TemplateSettingsOverride = TemplateSettingsOverride;
903
+ type context_TextContent = TextContent;
904
+ type context_TextSetting = TextSetting;
905
+ type context_UpdateDocumentOptions = UpdateDocumentOptions;
906
+ type context_UpdateDocumentRequest = UpdateDocumentRequest;
907
+ type context_UpdateDocumentResponse = UpdateDocumentResponse;
908
+ type context_UpdateDocumentResponseNonNullableFields = UpdateDocumentResponseNonNullableFields;
909
+ type context_WebhookIdentityType = WebhookIdentityType;
910
+ declare const context_WebhookIdentityType: typeof WebhookIdentityType;
911
+ type context_WixMpClientVersion = WixMpClientVersion;
912
+ declare const context_WixMpClientVersion: typeof WixMpClientVersion;
913
+ declare const context_createDocument: typeof createDocument;
914
+ declare const context_deleteDocument: typeof deleteDocument;
915
+ declare const context_downloadDocument: typeof downloadDocument;
916
+ declare const context_downloadDocumentSource: typeof downloadDocumentSource;
917
+ declare const context_getDocument: typeof getDocument;
918
+ declare const context_getDownloadPage: typeof getDownloadPage;
919
+ declare const context_getDownloadUrl: typeof getDownloadUrl;
920
+ declare const context_onDocumentCreated: typeof onDocumentCreated;
921
+ declare const context_onDocumentDeleted: typeof onDocumentDeleted;
922
+ declare const context_onDocumentRenderDelayed: typeof onDocumentRenderDelayed;
923
+ declare const context_onDocumentRenderFailed: typeof onDocumentRenderFailed;
924
+ declare const context_onDocumentRendered: typeof onDocumentRendered;
925
+ declare const context_onDocumentUpdated: typeof onDocumentUpdated;
926
+ declare const context_queryDocument: typeof queryDocument;
927
+ declare const context_updateDocument: typeof updateDocument;
928
+ declare namespace context {
929
+ export { type context_ActionEvent as ActionEvent, type context_BackgroundSetting as BackgroundSetting, type context_BaseEventMetadata as BaseEventMetadata, type context_CreateDocumentOptions as CreateDocumentOptions, type context_CreateDocumentRequest as CreateDocumentRequest, type context_CreateDocumentResponse as CreateDocumentResponse, type context_CreateDocumentResponseNonNullableFields as CreateDocumentResponseNonNullableFields, type context_CursorPaging as CursorPaging, type context_Cursors as Cursors, type context_DeleteDocumentRequest as DeleteDocumentRequest, type context_DeleteDocumentResponse as DeleteDocumentResponse, type context_DeleteDocumentResponseNonNullableFields as DeleteDocumentResponseNonNullableFields, type context_Document as Document, type context_DocumentContent as DocumentContent, type context_DocumentCreatedEnvelope as DocumentCreatedEnvelope, type context_DocumentDeletedEnvelope as DocumentDeletedEnvelope, type context_DocumentFile as DocumentFile, type context_DocumentNonNullableFields as DocumentNonNullableFields, type context_DocumentRenderDelayed as DocumentRenderDelayed, type context_DocumentRenderDelayedEnvelope as DocumentRenderDelayedEnvelope, type context_DocumentRenderFailed as DocumentRenderFailed, type context_DocumentRenderFailedEnvelope as DocumentRenderFailedEnvelope, type context_DocumentRendered as DocumentRendered, type context_DocumentRenderedEnvelope as DocumentRenderedEnvelope, type context_DocumentUpdatedEnvelope as DocumentUpdatedEnvelope, type context_DocumentsQueryBuilder as DocumentsQueryBuilder, type context_DocumentsQueryResult as DocumentsQueryResult, type context_DomainEvent as DomainEvent, type context_DomainEventBodyOneOf as DomainEventBodyOneOf, type context_DownloadDocumentOptions as DownloadDocumentOptions, type context_DownloadDocumentRequest as DownloadDocumentRequest, type context_DownloadDocumentResponse as DownloadDocumentResponse, type context_DownloadDocumentResponseNonNullableFields as DownloadDocumentResponseNonNullableFields, type context_DownloadDocumentSourceRequest as DownloadDocumentSourceRequest, type context_DownloadDocumentSourceResponse as DownloadDocumentSourceResponse, type context_DownloadDocumentSourceResponseNonNullableFields as DownloadDocumentSourceResponseNonNullableFields, type context_Empty as Empty, type context_EntityCreatedEvent as EntityCreatedEvent, type context_EntityDeletedEvent as EntityDeletedEvent, type context_EntityUpdatedEvent as EntityUpdatedEvent, type context_EventMetadata as EventMetadata, context_Format as Format, type context_GetDocumentOptions as GetDocumentOptions, type context_GetDocumentRequest as GetDocumentRequest, type context_GetDocumentResponse as GetDocumentResponse, type context_GetDocumentResponseNonNullableFields as GetDocumentResponseNonNullableFields, type context_GetDownloadPageRequest as GetDownloadPageRequest, type context_GetDownloadUrlOptions as GetDownloadUrlOptions, type context_GetDownloadUrlRequest as GetDownloadUrlRequest, type context_GetDownloadUrlRequestDocumentOneOf as GetDownloadUrlRequestDocumentOneOf, type context_GetDownloadUrlResponse as GetDownloadUrlResponse, type context_GetDownloadUrlResponseNonNullableFields as GetDownloadUrlResponseNonNullableFields, type context_HeadersEntry as HeadersEntry, type context_IdentificationData as IdentificationData, type context_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type context_ImageSetting as ImageSetting, type context_MessageEnvelope as MessageEnvelope, type context_PageSettings as PageSettings, type context_Paging as Paging, type context_PagingMetadataV2 as PagingMetadataV2, context_PaperSize as PaperSize, type context_QueryDocumentOptions as QueryDocumentOptions, type context_QueryDocumentRequest as QueryDocumentRequest, type context_QueryDocumentResponse as QueryDocumentResponse, type context_QueryDocumentResponseNonNullableFields as QueryDocumentResponseNonNullableFields, type context_QueryV2 as QueryV2, type context_QueryV2PagingMethodOneOf as QueryV2PagingMethodOneOf, type context_RawHttpResponse as RawHttpResponse, type context_RawHttpResponseNonNullableFields as RawHttpResponseNonNullableFields, type context_RenderDelayedEventConfig as RenderDelayedEventConfig, type context_RenderDocumentByIdRequest as RenderDocumentByIdRequest, type context_RenderDocumentRequestV2 as RenderDocumentRequestV2, context_RenderFormat as RenderFormat, context_RenderStatus as RenderStatus, context_RequestedFields as RequestedFields, context_ResizeOption as ResizeOption, type context_RestoreInfo as RestoreInfo, type context_SelectSetting as SelectSetting, type context_SettingsGroup as SettingsGroup, context_SortOrder as SortOrder, type context_Sorting as Sorting, type context_TemplateSettings as TemplateSettings, type context_TemplateSettingsOverride as TemplateSettingsOverride, type context_TextContent as TextContent, type context_TextSetting as TextSetting, type context_UpdateDocumentOptions as UpdateDocumentOptions, type context_UpdateDocumentRequest as UpdateDocumentRequest, type context_UpdateDocumentResponse as UpdateDocumentResponse, type context_UpdateDocumentResponseNonNullableFields as UpdateDocumentResponseNonNullableFields, context_WebhookIdentityType as WebhookIdentityType, context_WixMpClientVersion as WixMpClientVersion, context_createDocument as createDocument, context_deleteDocument as deleteDocument, context_downloadDocument as downloadDocument, context_downloadDocumentSource as downloadDocumentSource, context_getDocument as getDocument, context_getDownloadPage as getDownloadPage, context_getDownloadUrl as getDownloadUrl, context_onDocumentCreated as onDocumentCreated, context_onDocumentDeleted as onDocumentDeleted, context_onDocumentRenderDelayed as onDocumentRenderDelayed, context_onDocumentRenderFailed as onDocumentRenderFailed, context_onDocumentRendered as onDocumentRendered, context_onDocumentUpdated as onDocumentUpdated, context_queryDocument as queryDocument, context_updateDocument as updateDocument };
930
+ }
931
+
932
+ export { context as documents };