@wix/papyrus 1.0.19 → 1.0.21

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 (46) hide show
  1. package/build/cjs/index.d.ts +8 -3
  2. package/build/cjs/index.js +41 -27
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/meta.d.ts +4 -2
  5. package/build/cjs/meta.js +41 -26
  6. package/build/cjs/meta.js.map +1 -1
  7. package/build/cjs/schemas.d.ts +4 -1
  8. package/build/cjs/schemas.js +41 -25
  9. package/build/cjs/schemas.js.map +1 -1
  10. package/build/es/index.d.mts +8 -0
  11. package/build/es/index.mjs +8 -0
  12. package/build/es/index.mjs.map +1 -0
  13. package/build/es/meta.d.mts +4 -0
  14. package/build/es/meta.mjs +8 -0
  15. package/build/es/meta.mjs.map +1 -0
  16. package/build/es/package.json +3 -0
  17. package/build/es/schemas.d.mts +4 -0
  18. package/build/es/schemas.mjs +8 -0
  19. package/build/es/schemas.mjs.map +1 -0
  20. package/build/internal/cjs/index.d.ts +8 -0
  21. package/build/internal/cjs/meta.d.ts +4 -0
  22. package/build/internal/cjs/schemas.d.ts +4 -0
  23. package/build/internal/es/index.d.mts +8 -0
  24. package/build/internal/es/meta.d.mts +4 -0
  25. package/build/internal/es/schemas.d.mts +4 -0
  26. package/package.json +31 -24
  27. package/build/cjs/context.d.ts +0 -1
  28. package/build/cjs/context.js +0 -28
  29. package/build/cjs/context.js.map +0 -1
  30. package/build/es/context.d.ts +0 -1
  31. package/build/es/context.js +0 -2
  32. package/build/es/context.js.map +0 -1
  33. package/build/es/index.d.ts +0 -3
  34. package/build/es/index.js +0 -4
  35. package/build/es/index.js.map +0 -1
  36. package/build/es/meta.d.ts +0 -2
  37. package/build/es/meta.js +0 -3
  38. package/build/es/meta.js.map +0 -1
  39. package/build/es/schemas.d.ts +0 -1
  40. package/build/es/schemas.js +0 -2
  41. package/build/es/schemas.js.map +0 -1
  42. package/context/package.json +0 -7
  43. package/type-bundles/context.bundle.d.ts +0 -986
  44. package/type-bundles/index.bundle.d.ts +0 -3694
  45. package/type-bundles/meta.bundle.d.ts +0 -2057
  46. package/type-bundles/schemas.bundle.d.ts +0 -2460
@@ -1,3694 +0,0 @@
1
- type Primitive = number | string | boolean | bigint | symbol | null | undefined;
2
- type Tags = Record<string, Primitive>;
3
- type Context = Record<string, unknown>;
4
- type Contexts = Record<string, Context | undefined>;
5
-
6
- interface SpanContextData {
7
- traceId: string;
8
- spanId: string;
9
- }
10
- interface Span {
11
- spanContext(): SpanContextData;
12
- end(): void;
13
- }
14
- interface ManualSpan {
15
- end(): void;
16
- fail(error: unknown): void;
17
- }
18
- interface SpanOptions {
19
- name: string;
20
- tags?: Tags;
21
- }
22
- interface EndSpanOptions {
23
- name: string;
24
- }
25
- interface Breadcrumb {
26
- type?: string;
27
- category?: string;
28
- message: string;
29
- level?: 'info' | 'warning' | 'error';
30
- data?: Record<string, unknown>;
31
- }
32
- interface CaptureContext {
33
- level?: 'info' | 'warning' | 'error';
34
- tags?: Tags;
35
- contexts?: Contexts;
36
- }
37
- interface MonitoringClient {
38
- /**
39
- * Captures an exception event and sends it to Sentry.
40
- * @param error The error to capture
41
- * @param captureContext Optional additional data to attach to the Sentry e vent.
42
- */
43
- captureException(error: unknown, captureContext?: CaptureContext): void;
44
- /**
45
- * Captures a message event and sends it to Sentry.
46
- * @param message The message to capture
47
- * @param captureContext Define the level of the message or pass in additional data to attach to the message.
48
- */
49
- captureMessage(message: string, captureContext?: CaptureContext): void;
50
- /**
51
- * Wraps a function with a span and finishes the span after the function is done. The created span is the active span and will be used as parent by other spans created inside the function, as long as the function is executed while the scope is active.
52
- * @param spanOptions The options for the span
53
- * @param callback The function to wrap with a span
54
- * @returns The return value of the callback
55
- */
56
- startSpan<T>(spanOptions: SpanOptions, callback: (span: Span | undefined) => T): T;
57
- /**
58
- * Starts a manual span. The span needs to be finished manually by either calling end() or fail() using the returned span object or by calling endSpanManual().
59
- * @param spanOptions The options for the span
60
- * @returns A span object that allows to end the span successfully or fail it.
61
- */
62
- startSpanManual(spanOptions: SpanOptions): ManualSpan;
63
- /**
64
- * Ends a manual span and sends it to Sentry. Spans can be ended using a MonitoringClient instance which wasn't necessarily used to start the span.
65
- * Calling this method will end the last span with the same name that was started using startSpanManual() and will ignore the others.
66
- * @param spanOptions The options for the span
67
- */
68
- endSpanManual(spanOptions: EndSpanOptions): void;
69
- /**
70
- * Records a new breadcrumb which will be attached to future events.
71
- * Breadcrumbs will be added to subsequent events to provide more context on user's actions prior to an error or crash.
72
- * @param breadcrumb The breadcrumb to record.
73
- */
74
- addBreadcrumb(breadcrumb: Breadcrumb): void;
75
- }
76
-
77
- interface PlatformShowErrorProps {
78
- message?: string;
79
- action?: {
80
- text: string;
81
- onClick: () => void;
82
- };
83
- requestId?: string | null;
84
- }
85
- type PlatformShowError = (props: PlatformShowErrorProps) => void;
86
-
87
- /**
88
- Matches a JSON object.
89
-
90
- This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
91
-
92
- @category JSON
93
- */
94
- type JsonObject = {[Key in string]: JsonValue} & {[Key in string]?: JsonValue | undefined};
95
-
96
- /**
97
- Matches a JSON array.
98
-
99
- @category JSON
100
- */
101
- type JsonArray = JsonValue[] | readonly JsonValue[];
102
-
103
- /**
104
- Matches any valid JSON primitive value.
105
-
106
- @category JSON
107
- */
108
- type JsonPrimitive = string | number | boolean | null;
109
-
110
- /**
111
- Matches any valid JSON value.
112
-
113
- @see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`.
114
-
115
- @category JSON
116
- */
117
- type JsonValue = JsonPrimitive | JsonObject | JsonArray;
118
-
119
- declare global {
120
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
121
- interface SymbolConstructor {
122
- readonly observable: symbol;
123
- }
124
- }
125
-
126
- declare const emptyObjectSymbol: unique symbol;
127
-
128
- /**
129
- Represents a strictly empty plain object, the `{}` value.
130
-
131
- When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
132
-
133
- @example
134
- ```
135
- import type {EmptyObject} from 'type-fest';
136
-
137
- // The following illustrates the problem with `{}`.
138
- const foo1: {} = {}; // Pass
139
- const foo2: {} = []; // Pass
140
- const foo3: {} = 42; // Pass
141
- const foo4: {} = {a: 1}; // Pass
142
-
143
- // With `EmptyObject` only the first case is valid.
144
- const bar1: EmptyObject = {}; // Pass
145
- const bar2: EmptyObject = 42; // Fail
146
- const bar3: EmptyObject = []; // Fail
147
- const bar4: EmptyObject = {a: 1}; // Fail
148
- ```
149
-
150
- Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
151
-
152
- @category Object
153
- */
154
- type EmptyObject = {[emptyObjectSymbol]?: never};
155
-
156
- /**
157
- Extract all optional keys from the given type.
158
-
159
- This is useful when you want to create a new type that contains different type values for the optional keys only.
160
-
161
- @example
162
- ```
163
- import type {OptionalKeysOf, Except} from 'type-fest';
164
-
165
- interface User {
166
- name: string;
167
- surname: string;
168
-
169
- luckyNumber?: number;
170
- }
171
-
172
- const REMOVE_FIELD = Symbol('remove field symbol');
173
- type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
174
- [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
175
- };
176
-
177
- const update1: UpdateOperation<User> = {
178
- name: 'Alice'
179
- };
180
-
181
- const update2: UpdateOperation<User> = {
182
- name: 'Bob',
183
- luckyNumber: REMOVE_FIELD
184
- };
185
- ```
186
-
187
- @category Utilities
188
- */
189
- type OptionalKeysOf<BaseType extends object> =
190
- BaseType extends unknown // For distributing `BaseType`
191
- ? (keyof {
192
- [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never
193
- }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
194
- : never; // Should never happen
195
-
196
- /**
197
- Extract all required keys from the given type.
198
-
199
- This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
200
-
201
- @example
202
- ```
203
- import type {RequiredKeysOf} from 'type-fest';
204
-
205
- declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
206
-
207
- interface User {
208
- name: string;
209
- surname: string;
210
-
211
- luckyNumber?: number;
212
- }
213
-
214
- const validator1 = createValidation<User>('name', value => value.length < 25);
215
- const validator2 = createValidation<User>('surname', value => value.length < 25);
216
- ```
217
-
218
- @category Utilities
219
- */
220
- type RequiredKeysOf<BaseType extends object> =
221
- BaseType extends unknown // For distributing `BaseType`
222
- ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>>
223
- : never; // Should never happen
224
-
225
- /**
226
- Returns a boolean for whether the given type is `never`.
227
-
228
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
229
- @link https://stackoverflow.com/a/53984913/10292952
230
- @link https://www.zhenghao.io/posts/ts-never
231
-
232
- Useful in type utilities, such as checking if something does not occur.
233
-
234
- @example
235
- ```
236
- import type {IsNever, And} from 'type-fest';
237
-
238
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
239
- type AreStringsEqual<A extends string, B extends string> =
240
- And<
241
- IsNever<Exclude<A, B>> extends true ? true : false,
242
- IsNever<Exclude<B, A>> extends true ? true : false
243
- >;
244
-
245
- type EndIfEqual<I extends string, O extends string> =
246
- AreStringsEqual<I, O> extends true
247
- ? never
248
- : void;
249
-
250
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
251
- if (input === output) {
252
- process.exit(0);
253
- }
254
- }
255
-
256
- endIfEqual('abc', 'abc');
257
- //=> never
258
-
259
- endIfEqual('abc', '123');
260
- //=> void
261
- ```
262
-
263
- @category Type Guard
264
- @category Utilities
265
- */
266
- type IsNever<T> = [T] extends [never] ? true : false;
267
-
268
- /**
269
- An if-else-like type that resolves depending on whether the given type is `never`.
270
-
271
- @see {@link IsNever}
272
-
273
- @example
274
- ```
275
- import type {IfNever} from 'type-fest';
276
-
277
- type ShouldBeTrue = IfNever<never>;
278
- //=> true
279
-
280
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
281
- //=> 'bar'
282
- ```
283
-
284
- @category Type Guard
285
- @category Utilities
286
- */
287
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
288
- IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
289
- );
290
-
291
- // Can eventually be replaced with the built-in once this library supports
292
- // TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
293
- type NoInfer<T> = T extends infer U ? U : never;
294
-
295
- /**
296
- Returns a boolean for whether the given type is `any`.
297
-
298
- @link https://stackoverflow.com/a/49928360/1490091
299
-
300
- Useful in type utilities, such as disallowing `any`s to be passed to a function.
301
-
302
- @example
303
- ```
304
- import type {IsAny} from 'type-fest';
305
-
306
- const typedObject = {a: 1, b: 2} as const;
307
- const anyObject: any = {a: 1, b: 2};
308
-
309
- function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
310
- return obj[key];
311
- }
312
-
313
- const typedA = get(typedObject, 'a');
314
- //=> 1
315
-
316
- const anyA = get(anyObject, 'a');
317
- //=> any
318
- ```
319
-
320
- @category Type Guard
321
- @category Utilities
322
- */
323
- type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
324
-
325
- /**
326
- Returns a boolean for whether the two given types are equal.
327
-
328
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
329
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
330
-
331
- Use-cases:
332
- - If you want to make a conditional branch based on the result of a comparison of two types.
333
-
334
- @example
335
- ```
336
- import type {IsEqual} from 'type-fest';
337
-
338
- // This type returns a boolean for whether the given array includes the given item.
339
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
340
- type Includes<Value extends readonly any[], Item> =
341
- Value extends readonly [Value[0], ...infer rest]
342
- ? IsEqual<Value[0], Item> extends true
343
- ? true
344
- : Includes<rest, Item>
345
- : false;
346
- ```
347
-
348
- @category Type Guard
349
- @category Utilities
350
- */
351
- type IsEqual<A, B> =
352
- (<G>() => G extends A & G | G ? 1 : 2) extends
353
- (<G>() => G extends B & G | G ? 1 : 2)
354
- ? true
355
- : false;
356
-
357
- /**
358
- Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
359
-
360
- @example
361
- ```
362
- import type {Simplify} from 'type-fest';
363
-
364
- type PositionProps = {
365
- top: number;
366
- left: number;
367
- };
368
-
369
- type SizeProps = {
370
- width: number;
371
- height: number;
372
- };
373
-
374
- // In your editor, hovering over `Props` will show a flattened object with all the properties.
375
- type Props = Simplify<PositionProps & SizeProps>;
376
- ```
377
-
378
- Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
379
-
380
- If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
381
-
382
- @example
383
- ```
384
- import type {Simplify} from 'type-fest';
385
-
386
- interface SomeInterface {
387
- foo: number;
388
- bar?: string;
389
- baz: number | undefined;
390
- }
391
-
392
- type SomeType = {
393
- foo: number;
394
- bar?: string;
395
- baz: number | undefined;
396
- };
397
-
398
- const literal = {foo: 123, bar: 'hello', baz: 456};
399
- const someType: SomeType = literal;
400
- const someInterface: SomeInterface = literal;
401
-
402
- function fn(object: Record<string, unknown>): void {}
403
-
404
- fn(literal); // Good: literal object type is sealed
405
- fn(someType); // Good: type is sealed
406
- fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
407
- fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
408
- ```
409
-
410
- @link https://github.com/microsoft/TypeScript/issues/15300
411
- @see SimplifyDeep
412
- @category Object
413
- */
414
- type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
415
-
416
- /**
417
- Omit any index signatures from the given object type, leaving only explicitly defined properties.
418
-
419
- This is the counterpart of `PickIndexSignature`.
420
-
421
- Use-cases:
422
- - Remove overly permissive signatures from third-party types.
423
-
424
- This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
425
-
426
- It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
427
-
428
- (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
429
-
430
- ```
431
- const indexed: Record<string, unknown> = {}; // Allowed
432
-
433
- const keyed: Record<'foo', unknown> = {}; // Error
434
- // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
435
- ```
436
-
437
- Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
438
-
439
- ```
440
- type Indexed = {} extends Record<string, unknown>
441
- ? '✅ `{}` is assignable to `Record<string, unknown>`'
442
- : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
443
- // => '✅ `{}` is assignable to `Record<string, unknown>`'
444
-
445
- type Keyed = {} extends Record<'foo' | 'bar', unknown>
446
- ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
447
- : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
448
- // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
449
- ```
450
-
451
- Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
452
-
453
- ```
454
- import type {OmitIndexSignature} from 'type-fest';
455
-
456
- type OmitIndexSignature<ObjectType> = {
457
- [KeyType in keyof ObjectType // Map each key of `ObjectType`...
458
- ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
459
- };
460
- ```
461
-
462
- ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
463
-
464
- ```
465
- import type {OmitIndexSignature} from 'type-fest';
466
-
467
- type OmitIndexSignature<ObjectType> = {
468
- [KeyType in keyof ObjectType
469
- // Is `{}` assignable to `Record<KeyType, unknown>`?
470
- as {} extends Record<KeyType, unknown>
471
- ? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
472
- : ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
473
- ]: ObjectType[KeyType];
474
- };
475
- ```
476
-
477
- If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
478
-
479
- @example
480
- ```
481
- import type {OmitIndexSignature} from 'type-fest';
482
-
483
- interface Example {
484
- // These index signatures will be removed.
485
- [x: string]: any
486
- [x: number]: any
487
- [x: symbol]: any
488
- [x: `head-${string}`]: string
489
- [x: `${string}-tail`]: string
490
- [x: `head-${string}-tail`]: string
491
- [x: `${bigint}`]: string
492
- [x: `embedded-${number}`]: string
493
-
494
- // These explicitly defined keys will remain.
495
- foo: 'bar';
496
- qux?: 'baz';
497
- }
498
-
499
- type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
500
- // => { foo: 'bar'; qux?: 'baz' | undefined; }
501
- ```
502
-
503
- @see PickIndexSignature
504
- @category Object
505
- */
506
- type OmitIndexSignature<ObjectType> = {
507
- [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
508
- ? never
509
- : KeyType]: ObjectType[KeyType];
510
- };
511
-
512
- /**
513
- Pick only index signatures from the given object type, leaving out all explicitly defined properties.
514
-
515
- This is the counterpart of `OmitIndexSignature`.
516
-
517
- @example
518
- ```
519
- import type {PickIndexSignature} from 'type-fest';
520
-
521
- declare const symbolKey: unique symbol;
522
-
523
- type Example = {
524
- // These index signatures will remain.
525
- [x: string]: unknown;
526
- [x: number]: unknown;
527
- [x: symbol]: unknown;
528
- [x: `head-${string}`]: string;
529
- [x: `${string}-tail`]: string;
530
- [x: `head-${string}-tail`]: string;
531
- [x: `${bigint}`]: string;
532
- [x: `embedded-${number}`]: string;
533
-
534
- // These explicitly defined keys will be removed.
535
- ['kebab-case-key']: string;
536
- [symbolKey]: string;
537
- foo: 'bar';
538
- qux?: 'baz';
539
- };
540
-
541
- type ExampleIndexSignature = PickIndexSignature<Example>;
542
- // {
543
- // [x: string]: unknown;
544
- // [x: number]: unknown;
545
- // [x: symbol]: unknown;
546
- // [x: `head-${string}`]: string;
547
- // [x: `${string}-tail`]: string;
548
- // [x: `head-${string}-tail`]: string;
549
- // [x: `${bigint}`]: string;
550
- // [x: `embedded-${number}`]: string;
551
- // }
552
- ```
553
-
554
- @see OmitIndexSignature
555
- @category Object
556
- */
557
- type PickIndexSignature<ObjectType> = {
558
- [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
559
- ? KeyType
560
- : never]: ObjectType[KeyType];
561
- };
562
-
563
- // Merges two objects without worrying about index signatures.
564
- type SimpleMerge<Destination, Source> = {
565
- [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
566
- } & Source;
567
-
568
- /**
569
- Merge two types into a new type. Keys of the second type overrides keys of the first type.
570
-
571
- @example
572
- ```
573
- import type {Merge} from 'type-fest';
574
-
575
- interface Foo {
576
- [x: string]: unknown;
577
- [x: number]: unknown;
578
- foo: string;
579
- bar: symbol;
580
- }
581
-
582
- type Bar = {
583
- [x: number]: number;
584
- [x: symbol]: unknown;
585
- bar: Date;
586
- baz: boolean;
587
- };
588
-
589
- export type FooBar = Merge<Foo, Bar>;
590
- // => {
591
- // [x: string]: unknown;
592
- // [x: number]: number;
593
- // [x: symbol]: unknown;
594
- // foo: string;
595
- // bar: Date;
596
- // baz: boolean;
597
- // }
598
- ```
599
-
600
- @category Object
601
- */
602
- type Merge<Destination, Source> =
603
- Simplify<
604
- SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>>
605
- & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>
606
- >;
607
-
608
- /**
609
- An if-else-like type that resolves depending on whether the given type is `any`.
610
-
611
- @see {@link IsAny}
612
-
613
- @example
614
- ```
615
- import type {IfAny} from 'type-fest';
616
-
617
- type ShouldBeTrue = IfAny<any>;
618
- //=> true
619
-
620
- type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
621
- //=> 'bar'
622
- ```
623
-
624
- @category Type Guard
625
- @category Utilities
626
- */
627
- type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (
628
- IsAny<T> extends true ? TypeIfAny : TypeIfNotAny
629
- );
630
-
631
- /**
632
- Merges user specified options with default options.
633
-
634
- @example
635
- ```
636
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
637
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
638
- type SpecifiedOptions = {leavesOnly: true};
639
-
640
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
641
- //=> {maxRecursionDepth: 10; leavesOnly: true}
642
- ```
643
-
644
- @example
645
- ```
646
- // Complains if default values are not provided for optional options
647
-
648
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
649
- type DefaultPathsOptions = {maxRecursionDepth: 10};
650
- type SpecifiedOptions = {};
651
-
652
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
653
- // ~~~~~~~~~~~~~~~~~~~
654
- // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
655
- ```
656
-
657
- @example
658
- ```
659
- // Complains if an option's default type does not conform to the expected type
660
-
661
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
662
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
663
- type SpecifiedOptions = {};
664
-
665
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
666
- // ~~~~~~~~~~~~~~~~~~~
667
- // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
668
- ```
669
-
670
- @example
671
- ```
672
- // Complains if an option's specified type does not conform to the expected type
673
-
674
- type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
675
- type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
676
- type SpecifiedOptions = {leavesOnly: 'yes'};
677
-
678
- type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
679
- // ~~~~~~~~~~~~~~~~
680
- // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
681
- ```
682
- */
683
- type ApplyDefaultOptions<
684
- Options extends object,
685
- Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>,
686
- SpecifiedOptions extends Options,
687
- > =
688
- IfAny<SpecifiedOptions, Defaults,
689
- IfNever<SpecifiedOptions, Defaults,
690
- Simplify<Merge<Defaults, {
691
- [Key in keyof SpecifiedOptions
692
- as Key extends OptionalKeysOf<Options>
693
- ? Extract<SpecifiedOptions[Key], undefined> extends never
694
- ? Key
695
- : never
696
- : Key
697
- ]: SpecifiedOptions[Key]
698
- }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
699
- >>;
700
-
701
- /**
702
- Filter out keys from an object.
703
-
704
- Returns `never` if `Exclude` is strictly equal to `Key`.
705
- Returns `never` if `Key` extends `Exclude`.
706
- Returns `Key` otherwise.
707
-
708
- @example
709
- ```
710
- type Filtered = Filter<'foo', 'foo'>;
711
- //=> never
712
- ```
713
-
714
- @example
715
- ```
716
- type Filtered = Filter<'bar', string>;
717
- //=> never
718
- ```
719
-
720
- @example
721
- ```
722
- type Filtered = Filter<'bar', 'foo'>;
723
- //=> 'bar'
724
- ```
725
-
726
- @see {Except}
727
- */
728
- type Filter$1<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
729
-
730
- type ExceptOptions = {
731
- /**
732
- Disallow assigning non-specified properties.
733
-
734
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
735
-
736
- @default false
737
- */
738
- requireExactProps?: boolean;
739
- };
740
-
741
- type DefaultExceptOptions = {
742
- requireExactProps: false;
743
- };
744
-
745
- /**
746
- Create a type from an object type without certain keys.
747
-
748
- We recommend setting the `requireExactProps` option to `true`.
749
-
750
- This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
751
-
752
- This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
753
-
754
- @example
755
- ```
756
- import type {Except} from 'type-fest';
757
-
758
- type Foo = {
759
- a: number;
760
- b: string;
761
- };
762
-
763
- type FooWithoutA = Except<Foo, 'a'>;
764
- //=> {b: string}
765
-
766
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
767
- //=> errors: 'a' does not exist in type '{ b: string; }'
768
-
769
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
770
- //=> {a: number} & Partial<Record<"b", never>>
771
-
772
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
773
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
774
-
775
- // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
776
-
777
- // Consider the following example:
778
-
779
- type UserData = {
780
- [metadata: string]: string;
781
- email: string;
782
- name: string;
783
- role: 'admin' | 'user';
784
- };
785
-
786
- // `Omit` clearly doesn't behave as expected in this case:
787
- type PostPayload = Omit<UserData, 'email'>;
788
- //=> type PostPayload = { [x: string]: string; [x: number]: string; }
789
-
790
- // In situations like this, `Except` works better.
791
- // It simply removes the `email` key while preserving all the other keys.
792
- type PostPayload = Except<UserData, 'email'>;
793
- //=> type PostPayload = { [x: string]: string; name: string; role: 'admin' | 'user'; }
794
- ```
795
-
796
- @category Object
797
- */
798
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> =
799
- _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
800
-
801
- type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = {
802
- [KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
803
- } & (Options['requireExactProps'] extends true
804
- ? Partial<Record<KeysType, never>>
805
- : {});
806
-
807
- /**
808
- Extract the keys from a type where the value type of the key extends the given `Condition`.
809
-
810
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
811
-
812
- @example
813
- ```
814
- import type {ConditionalKeys} from 'type-fest';
815
-
816
- interface Example {
817
- a: string;
818
- b: string | number;
819
- c?: string;
820
- d: {};
821
- }
822
-
823
- type StringKeysOnly = ConditionalKeys<Example, string>;
824
- //=> 'a'
825
- ```
826
-
827
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
828
-
829
- @example
830
- ```
831
- import type {ConditionalKeys} from 'type-fest';
832
-
833
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
834
- //=> 'a' | 'c'
835
- ```
836
-
837
- @category Object
838
- */
839
- type ConditionalKeys<Base, Condition> =
840
- {
841
- // Map through all the keys of the given base type.
842
- [Key in keyof Base]-?:
843
- // Pick only keys with types extending the given `Condition` type.
844
- Base[Key] extends Condition
845
- // Retain this key
846
- // If the value for the key extends never, only include it if `Condition` also extends never
847
- ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
848
- // Discard this key since the condition fails.
849
- : never;
850
- // Convert the produced object into a union type of the keys which passed the conditional test.
851
- }[keyof Base];
852
-
853
- /**
854
- Exclude keys from a shape that matches the given `Condition`.
855
-
856
- This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
857
-
858
- @example
859
- ```
860
- import type {Primitive, ConditionalExcept} from 'type-fest';
861
-
862
- class Awesome {
863
- name: string;
864
- successes: number;
865
- failures: bigint;
866
-
867
- run() {}
868
- }
869
-
870
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
871
- //=> {run: () => void}
872
- ```
873
-
874
- @example
875
- ```
876
- import type {ConditionalExcept} from 'type-fest';
877
-
878
- interface Example {
879
- a: string;
880
- b: string | number;
881
- c: () => void;
882
- d: {};
883
- }
884
-
885
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
886
- //=> {b: string | number; c: () => void; d: {}}
887
- ```
888
-
889
- @category Object
890
- */
891
- type ConditionalExcept<Base, Condition> = Except<
892
- Base,
893
- ConditionalKeys<Base, Condition>
894
- >;
895
-
896
- type HostModule<T, H extends Host> = {
897
- __type: 'host';
898
- create(host: H): T;
899
- };
900
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
901
- type Host<Environment = unknown> = {
902
- channel?: {
903
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
904
- disconnect: () => void;
905
- } | Promise<{
906
- disconnect: () => void;
907
- }>;
908
- };
909
- environment?: Environment;
910
- /**
911
- * Optional name of the environment, use for logging
912
- */
913
- name?: string;
914
- /**
915
- * Optional bast url to use for API requests, for example `www.wixapis.com`
916
- */
917
- apiBaseUrl?: string;
918
- /**
919
- * Optional function to get a monitoring client
920
- */
921
- getMonitoringClient?: () => MonitoringClient;
922
- /**
923
- * Optional function to display an error notification to the user.
924
- * Can be used to show a toast, modal, or any other UI element
925
- * that informs the user about an error that occurred.
926
- */
927
- showError?: PlatformShowError;
928
- /**
929
- * Possible data to be provided by every host, for cross cutting concerns
930
- * like internationalization, billing, etc.
931
- */
932
- essentials?: {
933
- /**
934
- * The language of the currently viewed session
935
- */
936
- language?: string;
937
- /**
938
- * The locale of the currently viewed session
939
- */
940
- locale?: string;
941
- /**
942
- * The timezone of the currently viewed session
943
- */
944
- timezone?: string;
945
- /**
946
- * Any headers that should be passed through to the API requests
947
- */
948
- passThroughHeaders?: Record<string, string>;
949
- };
950
- translations?: () => {
951
- [language: string]: {
952
- [namespace: string]: {
953
- [key: string]: string;
954
- };
955
- };
956
- } | undefined;
957
- };
958
-
959
- type HTTPMethod = 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
960
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient, options?: {
961
- validateRequestSchema?: boolean;
962
- }) => T;
963
- interface HttpClient {
964
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
965
- fetchWithAuth: typeof fetch;
966
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
967
- /** Returns the current access token synchronously, if available. */
968
- getActiveToken?: () => string | undefined;
969
- /** Returns auth headers (may trigger token refresh). Prefer this over getActiveToken when making authenticated requests. */
970
- getAuthHeaders?: () => Promise<{
971
- headers: Record<string, string>;
972
- }>;
973
- }
974
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
975
- type HttpResponse<T = any> = {
976
- data: T;
977
- status: number;
978
- statusText: string;
979
- headers: any;
980
- request?: any;
981
- };
982
- type ResponseTransformer$1 = (data: any) => any;
983
- type RequestOptions<_TResponse = any, Data = any> = {
984
- method: HTTPMethod;
985
- url: string;
986
- data?: Data;
987
- params?: URLSearchParams;
988
- fallback?: RequestOptions<any, any>[];
989
- /**
990
- * The array option is for interoperability, defacto only the first function is used
991
- * if an array is provided
992
- */
993
- transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
994
- } & APIMetadata;
995
- type APIMetadata = {
996
- methodFqn?: string;
997
- entityFqdn?: string;
998
- packageName?: string;
999
- migrationOptions?: MigrationOptions;
1000
- };
1001
- type MigrationOptions = {
1002
- optInTransformResponse?: boolean;
1003
- };
1004
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
1005
- type EventDefinition<Payload = unknown, Type extends string = string> = {
1006
- __type: 'event-definition';
1007
- type: Type;
1008
- isDomainEvent?: boolean;
1009
- transformations?: (envelope: unknown) => Payload;
1010
- __payload: Payload;
1011
- };
1012
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
1013
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
1014
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
1015
-
1016
- type ServicePluginMethodInput = {
1017
- request: any;
1018
- metadata: any;
1019
- };
1020
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
1021
- type ServicePluginMethodMetadata = {
1022
- name: string;
1023
- primaryHttpMappingPath: string;
1024
- transformations: {
1025
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
1026
- toREST: (...args: unknown[]) => unknown;
1027
- };
1028
- };
1029
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
1030
- __type: 'service-plugin-definition';
1031
- componentType: string;
1032
- methods: ServicePluginMethodMetadata[];
1033
- __contract: Contract;
1034
- };
1035
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
1036
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
1037
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
1038
-
1039
- type RequestContext = {
1040
- isSSR: boolean;
1041
- host: string;
1042
- protocol?: string;
1043
- };
1044
- type ResponseTransformer = (data: any, headers?: any) => any;
1045
- /**
1046
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
1047
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
1048
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
1049
- */
1050
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
1051
- type AmbassadorRequestOptions<T = any> = {
1052
- _?: T;
1053
- url?: string;
1054
- method?: Method;
1055
- params?: any;
1056
- data?: any;
1057
- transformResponse?: ResponseTransformer | ResponseTransformer[];
1058
- };
1059
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
1060
- __isAmbassador: boolean;
1061
- };
1062
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
1063
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
1064
-
1065
- /**
1066
- * Descriptors are objects that describe the API of a module, and the module
1067
- * can either be a REST module or a host module.
1068
- * This type is recursive, so it can describe nested modules.
1069
- */
1070
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
1071
- [key: string]: Descriptors | PublicMetadata | any;
1072
- };
1073
- /**
1074
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
1075
- * and returns an object with the same structure, but with all descriptors replaced with their API.
1076
- * Any non-descriptor properties are removed from the returned object, including descriptors that
1077
- * do not match the given host (as they will not work with the given host).
1078
- */
1079
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
1080
- done: T;
1081
- recurse: T extends {
1082
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
1083
- } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
1084
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
1085
- -1,
1086
- 0,
1087
- 1,
1088
- 2,
1089
- 3,
1090
- 4,
1091
- 5
1092
- ][Depth]> : never;
1093
- }, EmptyObject>;
1094
- }[Depth extends -1 ? 'done' : 'recurse'];
1095
- type PublicMetadata = {
1096
- PACKAGE_NAME?: string;
1097
- };
1098
-
1099
- declare global {
1100
- interface ContextualClient {
1101
- }
1102
- }
1103
- /**
1104
- * Creates concrete types from SDK descriptors when a contextual client is
1105
- * available.
1106
- *
1107
- * For a REST descriptor the built (bound) API is intersected with the original
1108
- * descriptor, matching what `contextualizeRESTModuleV2` returns at runtime — a
1109
- * value callable as the bound API and still usable as a descriptor. Keeping the
1110
- * descriptor half lets contextual modules be passed to descriptor-constrained
1111
- * helpers such as `elevate` from `@wix/sdk/context` (FEDINF-14092).
1112
- *
1113
- * The `& T` is scoped to REST descriptors — the only shape codegen wraps in
1114
- * `MaybeContext` — so `BuildDescriptors` (used by `createClient().use`) is left
1115
- * unchanged and stays bound-only. The fix lives here rather than in `elevate`,
1116
- * which is kept strict on purpose (see #941) so it still rejects bound-only
1117
- * functions that are unsafe through `createRESTModule`.
1118
- */
1119
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
1120
- host: Host;
1121
- } ? T extends RESTFunctionDescriptor ? BuildDescriptors<T, globalThis.ContextualClient['host']> & T : BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
1122
- declare global {
1123
- /**
1124
- * A global interface to set the exposure toggle for the SDK.
1125
- * @example
1126
- * ```ts
1127
- * declare global {
1128
- * interface SDKExposureToggle {
1129
- * alpha: true;
1130
- * }
1131
- * }
1132
- */
1133
- interface SDKExposureToggle {
1134
- }
1135
- }
1136
-
1137
- declare global {
1138
- /**
1139
- * A global interface to set the type mode for the SDK.
1140
- * @example
1141
- * ```ts
1142
- * declare global {
1143
- * interface SDKTypeMode {
1144
- * strict: true;
1145
- * }
1146
- * }
1147
- */
1148
- interface SDKTypeMode {
1149
- }
1150
- }
1151
-
1152
- /**
1153
- * Constant used to indicate all applicable operators for a field type
1154
- */
1155
- declare const ALL_APPLICABLE_OPERATORS: "*";
1156
- /**
1157
- * Operators available for string fields
1158
- */
1159
- type StringOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$isEmpty' | '$exists' | '$in' | '$nin' | '$startsWith';
1160
- /**
1161
- * Operators available for number fields
1162
- */
1163
- type NumberOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exists' | '$in' | '$nin';
1164
- /**
1165
- * Operators available for boolean fields
1166
- */
1167
- type BooleanOperators = '$eq' | '$ne' | '$exists' | '$in' | '$nin';
1168
- /**
1169
- * Operators available for enum fields
1170
- */
1171
- type EnumOperators = '$eq' | '$ne' | '$in' | '$nin' | '$exists';
1172
- /**
1173
- * Operators available for date fields
1174
- */
1175
- type DateOperators = '$eq' | '$ne' | '$gt' | '$lt' | '$gte' | '$lte' | '$exists' | '$in' | '$nin';
1176
- /**
1177
- * Operators available for object fields
1178
- */
1179
- type ObjectOperators = '$exists';
1180
- /**
1181
- * Base operators available for all array types
1182
- */
1183
- type ArrayBaseOperators = '$isEmpty' | '$exists';
1184
- /**
1185
- * Operators available for arrays of primitive values
1186
- */
1187
- type ArrayOfPrimitivesOperators = '$hasAll' | '$hasSome' | ArrayBaseOperators;
1188
- /**
1189
- * Operators available for arrays of objects
1190
- */
1191
- type ArrayOfObjectsOperators = ArrayBaseOperators | '$matchItems';
1192
- type OperatorsWithBooleanValues = '$isEmpty' | '$exists';
1193
- type OperatorsWithArrayValues = '$in' | '$nin' | '$hasAll' | '$hasSome';
1194
- type OperatorForArrayFiltering = '$matchItems';
1195
-
1196
- /**
1197
- * Sort direction type for requests
1198
- */
1199
- type SortOrder$2 = 'ASC' | 'DESC';
1200
- /**
1201
- * Sort capability type for defining field sort options in SearchSpec
1202
- */
1203
- type SortCapability = SortOrder$2 | 'BOTH' | 'NONE';
1204
- /**
1205
- * Constants for sort directions
1206
- */
1207
- declare const SORT_DIRECTIONS: {
1208
- readonly ASC: "ASC";
1209
- readonly DESC: "DESC";
1210
- };
1211
- /**
1212
- * Constants for sort capabilities
1213
- */
1214
- declare const SORT_CAPABILITIES: {
1215
- readonly BOTH: "BOTH";
1216
- readonly NONE: "NONE";
1217
- readonly ASC: "ASC";
1218
- readonly DESC: "DESC";
1219
- };
1220
- /**
1221
- * Origin point for geo-distance sorting on a GEO field.
1222
- * Results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).
1223
- */
1224
- type SortingOrigin = {
1225
- latitude?: number | null;
1226
- longitude?: number | null;
1227
- };
1228
- /**
1229
- * Helper type to get the fields from a WQL group
1230
- * @template WQLGroup The WQL group type
1231
- */
1232
- type WQLFields<WQLGroup> = WQLGroup extends {
1233
- fields: readonly string[];
1234
- } ? WQLGroup['fields'][number] : never;
1235
- /**
1236
- * Sorting configuration for search/query results
1237
- * @template Spec The WQL specification type
1238
- */
1239
- type Sorting$2<Spec extends WQLSpec> = Spec['wql'] extends {
1240
- length: 0;
1241
- } | [] ? {
1242
- fieldName?: string;
1243
- order?: SortOrder$2;
1244
- selectItemsBy?: Record<string, any>[] | null;
1245
- origin?: SortingOrigin | null;
1246
- } : {
1247
- [WQLGroupIndex in keyof Spec['wql']]: Spec['wql'][WQLGroupIndex] extends {
1248
- fields: readonly string[];
1249
- sort: infer GroupSortCapability;
1250
- } ? GroupSortCapability extends typeof SORT_DIRECTIONS.ASC ? {
1251
- fieldName: WQLFields<Spec['wql'][WQLGroupIndex]>;
1252
- order: typeof SORT_DIRECTIONS.ASC;
1253
- selectItemsBy?: Record<string, any>[] | null;
1254
- origin?: SortingOrigin | null;
1255
- } : GroupSortCapability extends typeof SORT_DIRECTIONS.DESC ? {
1256
- fieldName: WQLFields<Spec['wql'][WQLGroupIndex]>;
1257
- order: typeof SORT_DIRECTIONS.DESC;
1258
- selectItemsBy?: Record<string, any>[] | null;
1259
- origin?: SortingOrigin | null;
1260
- } : GroupSortCapability extends typeof SORT_CAPABILITIES.BOTH ? {
1261
- fieldName: WQLFields<Spec['wql'][WQLGroupIndex]>;
1262
- order: SortOrder$2;
1263
- selectItemsBy?: Record<string, any>[] | null;
1264
- origin?: SortingOrigin | null;
1265
- } : GroupSortCapability extends typeof SORT_CAPABILITIES.NONE ? {
1266
- fieldName?: never;
1267
- order?: never;
1268
- selectItemsBy?: Record<string, any>[] | null;
1269
- origin?: SortingOrigin | null;
1270
- } : never : never;
1271
- }[keyof Spec['wql']];
1272
-
1273
- /**
1274
- * Defines a group of fields that share the same operator and sorting capabilities
1275
- * This is part of the Wix Query Language (WQL) specification
1276
- * @example
1277
- * const wql: WQL = {
1278
- * operators: ['$eq', '$ne', '$startsWith'],
1279
- * fields: ['name', 'description'],
1280
- * sort: 'BOTH'
1281
- * };
1282
- */
1283
- interface WQL {
1284
- /**
1285
- * List of operators that can be used with these fields
1286
- * If not specified, uses ALL_APPLICABLE_OPERATORS
1287
- */
1288
- operators?: typeof ALL_APPLICABLE_OPERATORS | readonly string[];
1289
- /**
1290
- * List of fields that share these operator capabilities
1291
- * These fields can be used in filters and sorting
1292
- */
1293
- fields: readonly string[];
1294
- /**
1295
- * Sort capabilities for fields in this group
1296
- * If omitted, sorting is not allowed for these fields
1297
- */
1298
- sort?: SortCapability;
1299
- }
1300
-
1301
- /**
1302
- * Base specification interface for APIs that support WQL (Wix Query Language)
1303
- */
1304
- interface WQLSpec {
1305
- /**
1306
- * Groups of fields with shared operator and sorting capabilities
1307
- * Each group defines what operations can be performed on its fields
1308
- */
1309
- wql: readonly WQL[];
1310
- }
1311
-
1312
- /**
1313
- * Gets the type of a field at a nested path
1314
- */
1315
- type GetNestedType<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends (infer ArrayElement)[] | null | undefined ? ArrayElement : Exclude<Entity[Path], null | undefined> : Path extends `${infer FirstPathPart}.${infer RemainingPath}` ? FirstPathPart extends keyof Entity ? Entity[FirstPathPart] extends (infer ArrayElement)[] | null | undefined ? GetNestedType<NonNullable<ArrayElement>, RemainingPath> : Entity[FirstPathPart] extends object | null | undefined ? GetNestedType<NonNullable<Entity[FirstPathPart]>, RemainingPath> : never : never : never;
1316
- /**
1317
- * Extracts all filterable field paths from a spec
1318
- * @template Spec The WQL specification type
1319
- * // Results in a union type of all field paths that can be filtered
1320
- */
1321
- type FilterableFields<Spec extends WQLSpec> = Spec['wql'][number]['fields'][number];
1322
-
1323
- /**
1324
- * Helper type to detect if a type is an enum-like union of string literals
1325
- * This checks if the type is a union of specific string literals (not a generic string)
1326
- * It handles both simple enums and complex enum + literal unions like EnumWithTypeAlias
1327
- */
1328
- type IsEnumLike<T> = T extends string | null | undefined ? string extends NonNullable<T> ? false : NonNullable<T> extends string ? true : false : false;
1329
- /**
1330
- * Determines operators applicable to a field based on its type
1331
- * @template Entity The entity type
1332
- * @template Path The field path to check
1333
- */
1334
- type ApplicableOperators<Entity, Path extends string> = Path extends keyof Entity ? Entity[Path] extends string | null | undefined ? IsEnumLike<Entity[Path]> extends true ? EnumOperators : StringOperators : Entity[Path] extends number | null | undefined ? NumberOperators : Entity[Path] extends boolean | null | undefined ? BooleanOperators : Entity[Path] extends Date | null | undefined ? DateOperators : Entity[Path] extends (infer E)[] | null | undefined ? E extends object ? ArrayOfObjectsOperators : ArrayOfPrimitivesOperators : Entity[Path] extends object | null | undefined ? ObjectOperators : never : Path extends `${infer K}.${infer R}` ? K extends keyof Entity ? Entity[K] extends (infer U)[] | null | undefined ? ApplicableOperators<NonNullable<U>, R> : Entity[K] extends object | null | undefined ? ApplicableOperators<NonNullable<Entity[K]>, R> : never : never : never;
1335
- /**
1336
- * Determines allowed operators for a field based on the spec
1337
- * @template Entity The entity type
1338
- * @template Spec The WQL specification type
1339
- * @template Field The field to check
1340
- */
1341
- type AllowedOperators<Entity, Spec extends WQLSpec, Field extends FilterableFields<Spec>> = Spec['wql'][number] extends infer WQLGroup ? WQLGroup extends WQL ? Field extends WQLGroup['fields'][number] ? WQLGroup['operators'] extends typeof ALL_APPLICABLE_OPERATORS ? ApplicableOperators<Entity, Field & string> : WQLGroup['operators'] extends readonly string[] ? WQLGroup['operators'][number] : never : never : never : never;
1342
- /**
1343
- * Filter operations type for individual field conditions
1344
- * @template Entity The entity type
1345
- * @template Spec The WQL specification type
1346
- * @template Field The field to filter on
1347
- */
1348
- type FilterOps<Entity, Spec extends WQLSpec, Field extends FilterableFields<Spec>> = Simplify<{
1349
- [Op in AllowedOperators<Entity, Spec, Field>]?: Op extends OperatorsWithBooleanValues ? boolean : Op extends OperatorForArrayFiltering ? JsonObject[] : Op extends OperatorsWithArrayValues ? GetNestedType<Entity, Field & string>[] : GetNestedType<Entity, Field & string>;
1350
- }>;
1351
- /**
1352
- * Filter type for building type-safe query filters
1353
- * @template Entity The entity type
1354
- * @template Spec The WQL specification type
1355
- * @example
1356
- * // Simple filter
1357
- * const filter: Filter<Product, ProductSpec> = {
1358
- * name: { $eq: 'iPhone' },
1359
- * price: { $gte: 100 }
1360
- * };
1361
- *
1362
- * // Complex filter with logical operators
1363
- * const filter: Filter<Product, ProductSpec> = {
1364
- * $and: [
1365
- * { name: { $startsWith: 'i' } },
1366
- * { $or: [
1367
- * { price: { $lt: 1000 } },
1368
- * { onSale: { $eq: true } }
1369
- * ]}
1370
- * ]
1371
- * };
1372
- */
1373
- type Filter<Entity, Spec extends WQLSpec> = Simplify<{
1374
- [Field in FilterableFields<Spec>]?: AllowedOperators<Entity, Spec, Field> extends infer AllowedOps ? AllowedOps extends '$eq' ? GetNestedType<Entity, Field & string> | FilterOps<Entity, Spec, Field> : FilterOps<Entity, Spec, Field> : never;
1375
- } | {
1376
- $and?: Filter<Entity, Spec>[];
1377
- $or?: Filter<Entity, Spec>[];
1378
- $not?: Filter<Entity, Spec>;
1379
- }>;
1380
-
1381
- /**
1382
- * Cursor-based paging configuration
1383
- */
1384
- interface CursorPaging$1$1 {
1385
- /** Maximum number of items to return in the results. */
1386
- limit?: number | null;
1387
- /**
1388
- * Pointer to the next or previous page in the list of results.
1389
- *
1390
- * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
1391
- * Not relevant for the first request.
1392
- */
1393
- cursor?: string | null;
1394
- }
1395
- /**
1396
- * Offset-based paging configuration
1397
- */
1398
- interface OffsetPaging$1 {
1399
- /** Number of items to load */
1400
- limit?: number | null;
1401
- /** Number of items to skip in the current sort order */
1402
- offset?: number | null;
1403
- }
1404
- /**
1405
- * Supported paging types for search APIs
1406
- */
1407
- type PagingType = 'cursor' | 'offset';
1408
- /**
1409
- * Paging type based on the SearchSpec's paging type
1410
- */
1411
- type Paging$2<Spec extends {
1412
- paging?: PagingType;
1413
- }> = Spec['paging'] extends 'cursor' ? {
1414
- cursorPaging: CursorPaging$1$1;
1415
- } : Spec['paging'] extends 'offset' ? {
1416
- paging: OffsetPaging$1;
1417
- } : {};
1418
-
1419
- interface PagingSpec {
1420
- paging: PagingType;
1421
- }
1422
- interface CursorPaging$2 {
1423
- limit: number;
1424
- cursor?: string;
1425
- }
1426
- interface OffsetPaging {
1427
- limit: number;
1428
- offset?: number;
1429
- }
1430
- type PagingFor<S extends PagingSpec> = S['paging'] extends 'cursor' ? CursorPaging$2 : OffsetPaging;
1431
- /**
1432
- * Represents a filter expression that can be combined with other filters
1433
- */
1434
- interface FilterExpression<T, S extends WQLSpec> {
1435
- readonly filter: Filter<T, S>;
1436
- }
1437
- /**
1438
- * Represents a sort expression
1439
- */
1440
- interface SortExpression<S extends WQLSpec> {
1441
- readonly sort: Sorting$2<S>;
1442
- }
1443
- /**
1444
- * Extract fields that support a specific operator from the spec
1445
- */
1446
- type FieldsWithOperator<S extends WQLSpec, Op extends string> = S['wql'][number] extends infer Group ? Group extends WQL ? Group['operators'] extends readonly string[] ? Op extends Group['operators'][number] ? Group['fields'][number] : never : Group['fields'][number] : never : never;
1447
- /**
1448
- * Check if a specific field supports a specific operator
1449
- */
1450
- type HasOperator<S extends WQLSpec, Field extends string, Op extends string> = Field extends FieldsWithOperator<S, Op> ? true : false;
1451
- /**
1452
- * Extract sortable fields from the spec
1453
- */
1454
- type SortableFields<S extends WQLSpec> = S['wql'][number] extends infer Group ? Group extends {
1455
- fields: readonly string[];
1456
- sort: 'ASC' | 'DESC' | 'BOTH';
1457
- } ? Group['fields'][number] : never : never;
1458
- /**
1459
- * Chainable field filter - extends FilterExpression so it can be used directly,
1460
- * but also allows chaining multiple operators on the same field.
1461
- * @example
1462
- * // Single operator - returns ChainableFieldFilter which is also FilterExpression
1463
- * Filter('price').gt(50)
1464
- *
1465
- * // Chained operators - combines into single field filter
1466
- * Filter('price').gt(50).lt(100)
1467
- * // Produces: { price: { $gt: 50, $lt: 100 } }
1468
- */
1469
- type ChainableFieldFilter<T, S extends WQLSpec, Field extends FilterableFields<S>> = FilterExpression<T, S> & (HasOperator<S, Field & string, '$eq'> extends true ? {
1470
- eq(value: GetNestedType<T, Field & string>): ChainableFieldFilter<T, S, Field>;
1471
- } : {}) & (HasOperator<S, Field & string, '$ne'> extends true ? {
1472
- ne(value: GetNestedType<T, Field & string>): ChainableFieldFilter<T, S, Field>;
1473
- } : {}) & (HasOperator<S, Field & string, '$gt'> extends true ? {
1474
- gt(value: GetNestedType<T, Field & string>): ChainableFieldFilter<T, S, Field>;
1475
- } : {}) & (HasOperator<S, Field & string, '$gte'> extends true ? {
1476
- gte(value: GetNestedType<T, Field & string>): ChainableFieldFilter<T, S, Field>;
1477
- } : {}) & (HasOperator<S, Field & string, '$lt'> extends true ? {
1478
- lt(value: GetNestedType<T, Field & string>): ChainableFieldFilter<T, S, Field>;
1479
- } : {}) & (HasOperator<S, Field & string, '$lte'> extends true ? {
1480
- lte(value: GetNestedType<T, Field & string>): ChainableFieldFilter<T, S, Field>;
1481
- } : {}) & (HasOperator<S, Field & string, '$startsWith'> extends true ? {
1482
- startsWith(value: string): ChainableFieldFilter<T, S, Field>;
1483
- } : {}) & (HasOperator<S, Field & string, '$endsWith'> extends true ? {
1484
- endsWith(value: string): ChainableFieldFilter<T, S, Field>;
1485
- } : {}) & (HasOperator<S, Field & string, '$contains'> extends true ? {
1486
- contains(value: string): ChainableFieldFilter<T, S, Field>;
1487
- } : {}) & (HasOperator<S, Field & string, '$in'> extends true ? {
1488
- in(values: GetNestedType<T, Field & string>[]): ChainableFieldFilter<T, S, Field>;
1489
- } : {}) & (HasOperator<S, Field & string, '$nin'> extends true ? {
1490
- nin(values: GetNestedType<T, Field & string>[]): ChainableFieldFilter<T, S, Field>;
1491
- } : {}) & (HasOperator<S, Field & string, '$hasSome'> extends true ? {
1492
- hasSome(values: GetNestedType<T, Field & string>[]): ChainableFieldFilter<T, S, Field>;
1493
- } : {}) & (HasOperator<S, Field & string, '$hasAll'> extends true ? {
1494
- hasAll(values: GetNestedType<T, Field & string>[]): ChainableFieldFilter<T, S, Field>;
1495
- } : {}) & (HasOperator<S, Field & string, '$exists'> extends true ? {
1496
- exists(value?: boolean): ChainableFieldFilter<T, S, Field>;
1497
- } : {}) & (HasOperator<S, Field & string, '$isEmpty'> extends true ? {
1498
- isEmpty(value?: boolean): ChainableFieldFilter<T, S, Field>;
1499
- } : {}) & (HasOperator<S, Field & string, '$ne'> extends true ? {
1500
- isNotEmpty(): ChainableFieldFilter<T, S, Field>;
1501
- } : {});
1502
- /**
1503
- * Filter methods for a specific field (alias for ChainableFieldFilter)
1504
- * Only shows methods for operators that the field supports
1505
- */
1506
- type FieldFilter<T, S extends WQLSpec, Field extends FilterableFields<S>> = ChainableFieldFilter<T, S, Field>;
1507
- /**
1508
- * Sort methods for a specific field
1509
- */
1510
- interface FieldSort<S extends WQLSpec> {
1511
- asc(): SortExpression<S>;
1512
- desc(): SortExpression<S>;
1513
- }
1514
- /**
1515
- * Filter factory interface - creates filter expressions
1516
- * @example
1517
- * Filter('price').gt(50)
1518
- * Filter.and(Filter('title').eq('Product'), Filter('price').gt(50))
1519
- */
1520
- interface FilterFactory<T, S extends WQLSpec> {
1521
- /** Create a field-specific filter */
1522
- <Field extends FilterableFields<S>>(field: Field): FieldFilter<T, S, Field>;
1523
- /** Combine filters with AND logic */
1524
- and(...filters: FilterExpression<T, S>[]): FilterExpression<T, S>;
1525
- /** Combine filters with OR logic */
1526
- or(...filters: FilterExpression<T, S>[]): FilterExpression<T, S>;
1527
- /** Negate a filter */
1528
- not(filter: FilterExpression<T, S>): FilterExpression<T, S>;
1529
- }
1530
- /**
1531
- * Sort factory - creates sort expressions
1532
- * @example
1533
- * Sort('price').desc()
1534
- */
1535
- type SortFactory<S extends WQLSpec> = <Field extends SortableFields<S>>(field: Field) => FieldSort<S>;
1536
-
1537
- /**
1538
- * Specification for a query API
1539
- * Defines what fields can be filtered and sorted
1540
- * @example
1541
- * interface MyQuerySpec extends QuerySpec {
1542
- * wql: [{
1543
- * operators: ['$eq', '$ne'],
1544
- * fields: ['id', 'title'],
1545
- * sort: 'BOTH'
1546
- * }],
1547
- * paging: 'offset', // or 'cursor' for cursor-based pagination
1548
- * };
1549
- */
1550
- interface QuerySpec extends WQLSpec {
1551
- /**
1552
- * Supported paging type for this query API
1553
- * - 'cursor': Uses cursor-based pagination
1554
- * - 'offset': Uses offset-based pagination
1555
- */
1556
- paging: PagingType;
1557
- }
1558
-
1559
- /**
1560
- * Complete query request for an entity type
1561
- * @template Entity The entity type being queried
1562
- * @template Spec The query specification type
1563
- * @example
1564
- * // Define a query type for products
1565
- * type QueryProducts = Query<Product, ProductQuerySpec>;
1566
- *
1567
- * // Create a query request with offset paging
1568
- * const query: QueryProducts = {
1569
- * filter: { price: { $gte: 10 } },
1570
- * sort: [{ fieldName: 'price', order: 'ASC' }],
1571
- * paging: { limit: 20, offset: 0 }
1572
- * };
1573
- *
1574
- * // Or with cursor paging (if spec.paging = 'cursor')
1575
- * const query: QueryProducts = {
1576
- * filter: { price: { $gte: 10 } },
1577
- * sort: [{ fieldName: 'price', order: 'ASC' }],
1578
- * cursorPaging: { limit: 20, cursor: "..." }
1579
- * };
1580
- */
1581
- type Query<Entity, Spec extends QuerySpec> = {
1582
- /**
1583
- * Filter object.
1584
- * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).
1585
- */
1586
- filter?: Filter<Entity, Spec>;
1587
- /**
1588
- * List of sort objects.
1589
- * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).
1590
- */
1591
- sort?: Sorting$2<Spec>[];
1592
- } & Partial<Paging$2<Spec>>;
1593
-
1594
- /**
1595
- * The output type from QueryBuilder.build()
1596
- * This is a plain object ready to be sent to an API
1597
- */
1598
- interface QueryRequest<T, S extends QuerySpec> {
1599
- filter?: Filter<T, S>;
1600
- sort?: Sorting$2<S>[];
1601
- paging?: PagingFor<S>;
1602
- /** Field projection - return only specified fields */
1603
- fields?: string[];
1604
- }
1605
- /**
1606
- * Query builder interface
1607
- * @template T - Entity type
1608
- * @template S - Query spec defining filterable/sortable fields
1609
- * @template R - Output type from build() (defaults to QueryRequest<T, S>)
1610
- * @example
1611
- * QueryBuilder()
1612
- * .withFilter(Filter.and(
1613
- * Filter('title').eq('Product'),
1614
- * Filter('price').gt(50)
1615
- * ))
1616
- * .withFields('title', 'price')
1617
- * .withSorting(Sort('price').desc())
1618
- * .withPaging({ limit: 20, offset: 0 })
1619
- * .build()
1620
- */
1621
- interface QueryBuilder<T, S extends QuerySpec, R = QueryRequest<T, S>> {
1622
- /** Add a filter to the query */
1623
- withFilter(filter: FilterExpression<T, S>): QueryBuilder<T, S, R>;
1624
- /** Add field projection - return only specified fields */
1625
- withFields(...fields: (keyof T & string)[]): QueryBuilder<T, S, R>;
1626
- /** Add sorting to the query */
1627
- withSorting(...sorts: SortExpression<S>[]): QueryBuilder<T, S, R>;
1628
- /** Add paging to the query */
1629
- withPaging(paging: PagingFor<S>): QueryBuilder<T, S, R>;
1630
- /** Build the final query request object */
1631
- build(): R;
1632
- }
1633
- /**
1634
- * Complete set of query helpers for an entity
1635
- * This is what gets spread into module namespaces
1636
- * @template T - Entity type
1637
- * @template S - Query spec defining filterable/sortable fields
1638
- * @template R - Output type from QueryBuilder.build() (defaults to QueryRequest<T, S>)
1639
- */
1640
- interface QueryHelpers<T, S extends QuerySpec, R = QueryRequest<T, S>> {
1641
- /** QueryBuilder factory */
1642
- QueryBuilder: () => QueryBuilder<T, S, R>;
1643
- /** Filter factory - creates filter expressions */
1644
- Filter: FilterFactory<T, S>;
1645
- /** Sort factory - creates sort expressions */
1646
- Sort: SortFactory<S>;
1647
- }
1648
-
1649
- interface TemplateSettings$1 {
1650
- /**
1651
- * Auto generated ID.
1652
- * @format GUID
1653
- * @readonly
1654
- */
1655
- _id?: string | null;
1656
- /**
1657
- * Wix app definition ID.
1658
- * @minLength 1
1659
- * @maxLength 20
1660
- */
1661
- appSlug?: string | null;
1662
- /**
1663
- * The type of the template.
1664
- * @minLength 1
1665
- * @maxLength 20
1666
- */
1667
- templateType?: string | null;
1668
- /**
1669
- * The id of the template.
1670
- * @minLength 1
1671
- * @maxLength 20
1672
- */
1673
- templateId?: string | null;
1674
- /**
1675
- * Template settings external ID. For example ticket definition ID.
1676
- * Must be unique per tenant where tenant is taken from authorization (wix_app_id + meta_site_id)
1677
- * @minLength 1
1678
- * @maxLength 100
1679
- */
1680
- externalId?: string | null;
1681
- /**
1682
- * Date settings were created.
1683
- * @readonly
1684
- */
1685
- _createdDate?: Date | null;
1686
- /**
1687
- * Date settings were updated.
1688
- * @readonly
1689
- */
1690
- _updatedDate?: Date | null;
1691
- /** @maxSize 10 */
1692
- settingGroups?: SettingsGroup$1[];
1693
- /** Paper size */
1694
- paperSize?: PaperSizeWithLiterals;
1695
- pageOverflow?: PageOverflowWithLiterals;
1696
- }
1697
- interface TextSetting$1 {
1698
- /**
1699
- * Font family class name
1700
- * @maxLength 20
1701
- */
1702
- fontFamily?: string | null;
1703
- /**
1704
- * Font style class names
1705
- * @maxSize 10
1706
- * @maxLength 20
1707
- */
1708
- fontStyle?: string[];
1709
- /**
1710
- * Text alignment class name
1711
- * @maxLength 20
1712
- */
1713
- textAlignment?: string | null;
1714
- /**
1715
- * Text color hex code
1716
- * @minLength 7
1717
- * @maxLength 7
1718
- */
1719
- textColor?: string | null;
1720
- /**
1721
- * Font size
1722
- * @min 1
1723
- */
1724
- fontSize?: number | null;
1725
- /** Text content setting */
1726
- textContent?: TextContent$1[];
1727
- }
1728
- interface TextContent$1 {
1729
- /**
1730
- * @minLength 3
1731
- * @maxLength 50
1732
- */
1733
- _id?: string;
1734
- /** @maxLength 500 */
1735
- value?: string | null;
1736
- visible?: boolean;
1737
- }
1738
- interface ImageSetting$1 {
1739
- /** Wix media Image */
1740
- image?: string;
1741
- /** Image resizing mode */
1742
- resize?: ResizeOptionWithLiterals;
1743
- }
1744
- interface FocalPoint {
1745
- /** X-coordinate of the focal point. */
1746
- x?: number;
1747
- /** Y-coordinate of the focal point. */
1748
- y?: number;
1749
- /** crop by height */
1750
- height?: number | null;
1751
- /** crop by width */
1752
- width?: number | null;
1753
- }
1754
- declare enum ResizeOption$1 {
1755
- /** Automatically resizes full image to fit image field */
1756
- FIT = "FIT",
1757
- /** Enables user to manually crop image to fit image field */
1758
- CROP = "CROP"
1759
- }
1760
- /** @enumType */
1761
- type ResizeOptionWithLiterals = ResizeOption$1 | 'FIT' | 'CROP';
1762
- interface SelectSetting$1 {
1763
- /** Selected value */
1764
- value?: string | null;
1765
- /**
1766
- * Color hex code
1767
- * @minLength 7
1768
- * @maxLength 7
1769
- */
1770
- primaryColor?: string | null;
1771
- /**
1772
- * Color hex code
1773
- * @minLength 7
1774
- * @maxLength 7
1775
- */
1776
- secondaryColor?: string | null;
1777
- /** Size */
1778
- size?: number | null;
1779
- }
1780
- interface BackgroundSetting$1 {
1781
- /**
1782
- * Color of the background hex code
1783
- * @minLength 7
1784
- * @maxLength 9
1785
- */
1786
- color?: string | null;
1787
- /** Wix media Image */
1788
- image?: string;
1789
- }
1790
- interface SettingsGroup$1 {
1791
- /**
1792
- * Id of the control group
1793
- * @minLength 5
1794
- * @maxLength 50
1795
- */
1796
- groupId?: string;
1797
- /**
1798
- * Display settings.
1799
- * @maxSize 20
1800
- */
1801
- display?: Record<string, boolean>;
1802
- /**
1803
- * Texts settings.
1804
- * @maxSize 20
1805
- */
1806
- texts?: Record<string, TextSetting$1>;
1807
- /**
1808
- * Images settings.
1809
- * @maxSize 10
1810
- */
1811
- images?: Record<string, ImageSetting$1>;
1812
- /**
1813
- * Select option settings.
1814
- * @maxSize 20
1815
- */
1816
- selects?: Record<string, SelectSetting$1>;
1817
- /**
1818
- * Backgrounds settings.
1819
- * @maxSize 20
1820
- */
1821
- backgrounds?: Record<string, BackgroundSetting$1>;
1822
- }
1823
- declare enum PaperSize$1 {
1824
- A4_PORTRAIT = "A4_PORTRAIT",
1825
- A4_LANDSCAPE = "A4_LANDSCAPE"
1826
- }
1827
- /** @enumType */
1828
- type PaperSizeWithLiterals = PaperSize$1 | 'A4_PORTRAIT' | 'A4_LANDSCAPE';
1829
- declare enum PageOverflow {
1830
- CONTENT_HIDDEN = "CONTENT_HIDDEN",
1831
- CONTENT_BREAK = "CONTENT_BREAK"
1832
- }
1833
- /** @enumType */
1834
- type PageOverflowWithLiterals = PageOverflow | 'CONTENT_HIDDEN' | 'CONTENT_BREAK';
1835
- interface CreateTemplateSettingsRequest {
1836
- /** Settings to be created. */
1837
- settings?: TemplateSettings$1;
1838
- }
1839
- interface CreateTemplateSettingsResponse {
1840
- /** Created settings. */
1841
- settings?: TemplateSettings$1;
1842
- }
1843
- interface BulkCreateTemplateSettingsRequest {
1844
- /**
1845
- * Settings to be created.
1846
- * @minSize 1
1847
- * @maxSize 100
1848
- */
1849
- settings?: TemplateSettings$1[];
1850
- }
1851
- interface BulkCreateTemplateSettingsResponse {
1852
- /** Created settings */
1853
- settings?: TemplateSettings$1[];
1854
- }
1855
- interface UpsertTemplateSettingsRequest {
1856
- /** Settings to be upserted. */
1857
- settings?: TemplateSettings$1;
1858
- }
1859
- interface UpsertTemplateSettingsResponse {
1860
- /** Upserted settings. */
1861
- settings?: TemplateSettings$1;
1862
- }
1863
- interface GetTemplateSettingsRequest {
1864
- /**
1865
- * Settings ID.
1866
- * @format GUID
1867
- */
1868
- templateSettingsId?: string;
1869
- }
1870
- interface GetTemplateSettingsResponse {
1871
- /** Retrieved settings. */
1872
- settings?: TemplateSettings$1;
1873
- }
1874
- interface UpdateTemplateSettingsRequest {
1875
- /** Template Settings to be updated. */
1876
- settings?: TemplateSettings$1;
1877
- }
1878
- interface UpdateTemplateSettingsResponse {
1879
- /** Updated settings. */
1880
- settings?: TemplateSettings$1;
1881
- }
1882
- interface DeleteTemplateSettingsRequest {
1883
- /**
1884
- * Settings ID.
1885
- * @format GUID
1886
- */
1887
- templateSettingsId?: string;
1888
- }
1889
- interface DeleteTemplateSettingsResponse {
1890
- /** Deleted settings. */
1891
- settings?: TemplateSettings$1;
1892
- }
1893
- interface QueryTemplateSettingsRequest {
1894
- /** Generic query object. */
1895
- query: QueryV2$1;
1896
- }
1897
- interface QueryV2$1 extends QueryV2PagingMethodOneOf$1 {
1898
- /** Paging options to limit and offset the number of items. */
1899
- paging?: Paging$1;
1900
- /** 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`. */
1901
- cursorPaging?: CursorPaging$1;
1902
- /**
1903
- * Filter object.
1904
- *
1905
- * Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters).
1906
- */
1907
- filter?: Record<string, any> | null;
1908
- /**
1909
- * Sort object.
1910
- *
1911
- * Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting).
1912
- */
1913
- sort?: Sorting$1[];
1914
- /** 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. */
1915
- fields?: string[];
1916
- /** 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. */
1917
- fieldsets?: string[];
1918
- }
1919
- /** @oneof */
1920
- interface QueryV2PagingMethodOneOf$1 {
1921
- /** Paging options to limit and offset the number of items. */
1922
- paging?: Paging$1;
1923
- /** 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`. */
1924
- cursorPaging?: CursorPaging$1;
1925
- }
1926
- interface Sorting$1 {
1927
- /**
1928
- * Name of the field to sort by.
1929
- * @maxLength 512
1930
- */
1931
- fieldName?: string;
1932
- /** Sort order. */
1933
- order?: SortOrderWithLiterals;
1934
- /**
1935
- * Origin point for geo-distance sorting on a GEO field
1936
- * results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).
1937
- */
1938
- origin?: AddressLocation;
1939
- }
1940
- declare enum SortOrder$1 {
1941
- ASC = "ASC",
1942
- DESC = "DESC"
1943
- }
1944
- /** @enumType */
1945
- type SortOrderWithLiterals = SortOrder$1 | 'ASC' | 'DESC';
1946
- interface AddressLocation {
1947
- /** Address latitude. */
1948
- latitude?: number | null;
1949
- /** Address longitude. */
1950
- longitude?: number | null;
1951
- }
1952
- interface Paging$1 {
1953
- /** Number of items to load. */
1954
- limit?: number | null;
1955
- /** Number of items to skip in the current sort order. */
1956
- offset?: number | null;
1957
- }
1958
- interface CursorPaging$1 {
1959
- /**
1960
- * Maximum number of items to return in the results.
1961
- * @max 100
1962
- */
1963
- limit?: number | null;
1964
- /**
1965
- * Pointer to the next or previous page in the list of results.
1966
- *
1967
- * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
1968
- * Not relevant for the first request.
1969
- * @maxLength 16000
1970
- */
1971
- cursor?: string | null;
1972
- }
1973
- interface QueryTemplateSettingsResponse {
1974
- /** Template settings results. */
1975
- settings?: TemplateSettings$1[];
1976
- /** Query result's metadata. */
1977
- metadata?: PagingMetadataV2$1;
1978
- }
1979
- interface PagingMetadataV2$1 {
1980
- /** Number of items returned in the response. */
1981
- count?: number | null;
1982
- /** Offset that was requested. */
1983
- offset?: number | null;
1984
- /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
1985
- total?: number | null;
1986
- /** Flag that indicates the server failed to calculate the `total` field. */
1987
- tooManyToCount?: boolean | null;
1988
- /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
1989
- cursors?: Cursors$1;
1990
- }
1991
- interface Cursors$1 {
1992
- /**
1993
- * Cursor string pointing to the next page in the list of results.
1994
- * @maxLength 16000
1995
- */
1996
- next?: string | null;
1997
- /**
1998
- * Cursor pointing to the previous page in the list of results.
1999
- * @maxLength 16000
2000
- */
2001
- prev?: string | null;
2002
- }
2003
- interface ResolveTemplateSettingsRequest {
2004
- /**
2005
- * The id of the settings.
2006
- * @format GUID
2007
- */
2008
- templateSettingsId?: string | null;
2009
- /**
2010
- * External ID.
2011
- * @maxLength 100
2012
- */
2013
- templateSettingsExternalId?: string | null;
2014
- /**
2015
- * The type of the template. Used to resolve default settings.
2016
- * @minLength 1
2017
- * @maxLength 20
2018
- */
2019
- templateType: string | null;
2020
- /**
2021
- * Wix app slug.
2022
- * @minLength 1
2023
- * @maxLength 20
2024
- */
2025
- appSlug: string | null;
2026
- /**
2027
- * The id of template.
2028
- * @minLength 1
2029
- * @maxLength 20
2030
- */
2031
- templateId?: string | null;
2032
- }
2033
- interface ResolveTemplateSettingsResponse {
2034
- /** Retrieved settings. */
2035
- settings?: TemplateSettings$1;
2036
- }
2037
- interface GetTemplateControlsRequest {
2038
- }
2039
- interface GetTemplateControlsResponse {
2040
- templateControls?: TemplateControls;
2041
- }
2042
- interface TemplateControls {
2043
- /**
2044
- * The name of the template
2045
- * @maxLength 50
2046
- */
2047
- templateName?: string;
2048
- /**
2049
- * The controls groups configuration
2050
- * @minSize 1
2051
- * @maxSize 10
2052
- */
2053
- controlGroups?: ControlGroup[];
2054
- }
2055
- /** Represents control groups on the left side of the UI */
2056
- interface ControlGroup {
2057
- /**
2058
- * @minLength 3
2059
- * @maxLength 50
2060
- */
2061
- groupId?: string;
2062
- /**
2063
- * @minLength 3
2064
- * @maxLength 50
2065
- */
2066
- icon?: string;
2067
- /**
2068
- * @minLength 3
2069
- * @maxLength 100
2070
- */
2071
- labelKey?: string;
2072
- /**
2073
- * @minLength 3
2074
- * @maxLength 100
2075
- */
2076
- titleKey?: string;
2077
- /**
2078
- * @minLength 3
2079
- * @maxLength 100
2080
- */
2081
- descriptionKey?: string;
2082
- /** @maxLength 100 */
2083
- linkKey?: string | null;
2084
- /** @maxLength 50 */
2085
- linkUrl?: string | null;
2086
- /** @maxLength 100 */
2087
- tooltipKey?: string | null;
2088
- /**
2089
- * Display controls
2090
- * @maxSize 20
2091
- */
2092
- display?: DisplayControl[];
2093
- /**
2094
- * Text controls
2095
- * @maxSize 20
2096
- */
2097
- texts?: TextControl[];
2098
- /**
2099
- * Image controls
2100
- * @maxSize 10
2101
- */
2102
- images?: ImageControl[];
2103
- /**
2104
- * Select controls
2105
- * @maxSize 20
2106
- */
2107
- selects?: SelectControl[];
2108
- /**
2109
- * Background controls
2110
- * @maxSize 20
2111
- */
2112
- backgrounds?: BackgroundControl[];
2113
- }
2114
- interface DisplayControl {
2115
- /**
2116
- * The id of the setting
2117
- * @maxLength 50
2118
- */
2119
- _id?: string;
2120
- /**
2121
- * Optional label key for translations
2122
- * @maxLength 100
2123
- */
2124
- labelKey?: string | null;
2125
- /** Default setting for this control */
2126
- default?: boolean;
2127
- }
2128
- interface TextControl {
2129
- /**
2130
- * The id of the setting
2131
- * @maxLength 50
2132
- */
2133
- _id?: string;
2134
- /**
2135
- * Optional label key for translations
2136
- * @maxLength 100
2137
- */
2138
- labelKey?: string | null;
2139
- /** Default setting for this control */
2140
- default?: TextSetting$1;
2141
- /**
2142
- * Text properties
2143
- * @maxSize 5
2144
- */
2145
- textProperties?: TextPropertyControl[];
2146
- /** @maxSize 10 */
2147
- textContent?: TextContentControl[];
2148
- }
2149
- interface TextPropertyControl {
2150
- /**
2151
- * One of "fontFamily", "fontStyle", "fontSize", "textAlignment"
2152
- * @maxLength 15
2153
- */
2154
- type?: string;
2155
- /**
2156
- * Optional label key for translations
2157
- * @maxLength 100
2158
- */
2159
- labelKey?: string | null;
2160
- /**
2161
- * List of possible options. Used for "fontFamily", "fontStyle", "textAlignment"
2162
- * @maxSize 50
2163
- */
2164
- options?: ValueOption[];
2165
- /** Optional range of the value. Used for "fontSize" */
2166
- range?: Range;
2167
- }
2168
- interface ValueOption {
2169
- /**
2170
- * The label key for translations
2171
- * @maxLength 100
2172
- */
2173
- labelKey?: string;
2174
- /**
2175
- * The value
2176
- * @maxLength 20
2177
- */
2178
- value?: string;
2179
- }
2180
- interface Range {
2181
- /** Minimum value. */
2182
- min?: number | null;
2183
- /** Maximum value. */
2184
- max?: number | null;
2185
- }
2186
- interface TextContentControl {
2187
- /**
2188
- * @minLength 3
2189
- * @maxLength 50
2190
- */
2191
- _id?: string;
2192
- /**
2193
- * @minLength 3
2194
- * @maxLength 100
2195
- */
2196
- labelKey?: string | null;
2197
- /** @max 1000 */
2198
- maxLength?: number | null;
2199
- }
2200
- interface ImageControl {
2201
- /**
2202
- * The id of the setting
2203
- * @maxLength 50
2204
- */
2205
- _id?: string;
2206
- /**
2207
- * Optional label key for translations
2208
- * @maxLength 100
2209
- */
2210
- labelKey?: string | null;
2211
- /** Default setting for this control */
2212
- default?: ImageSetting$1;
2213
- /**
2214
- * Optional description key for translations
2215
- * @maxLength 100
2216
- */
2217
- descriptionKey?: string | null;
2218
- /** Enable logo builder support */
2219
- showLogoBuilder?: boolean;
2220
- }
2221
- interface SelectControl {
2222
- /**
2223
- * The id of the setting
2224
- * @maxLength 50
2225
- */
2226
- _id?: string;
2227
- /**
2228
- * Optional label key for translations
2229
- * @maxLength 100
2230
- */
2231
- labelKey?: string | null;
2232
- /** Default setting for this control */
2233
- default?: SelectSetting$1;
2234
- /**
2235
- * List of possible options
2236
- * @minSize 1
2237
- * @maxSize 20
2238
- */
2239
- options?: ValueOption[];
2240
- /** Allows to use primary colour setting from template designer */
2241
- showPrimaryColorPicker?: boolean;
2242
- /** Allows to use secondary colour setting from template designer */
2243
- showSecondaryColorPicker?: boolean;
2244
- /** Allows to use size setting from template designer. */
2245
- showSize?: boolean;
2246
- /** Optional range of the size value. */
2247
- sizeRange?: Range;
2248
- }
2249
- interface BackgroundControl {
2250
- /**
2251
- * The id of the setting
2252
- * @maxLength 50
2253
- */
2254
- _id?: string;
2255
- /**
2256
- * Optional label key for translations
2257
- * @maxLength 100
2258
- */
2259
- labelKey?: string | null;
2260
- /** Default setting for this control */
2261
- default?: BackgroundSetting$1;
2262
- /** Allows to use colour setting from template designer */
2263
- showColorPicker?: boolean;
2264
- /** Allows to use image setting from template designer */
2265
- showImagePicker?: boolean;
2266
- /** Enables background opacity control */
2267
- opacityEnabled?: boolean | null;
2268
- /** Enables background image opacity control */
2269
- imageOpacityEnabled?: boolean | null;
2270
- /**
2271
- * Default media manager folder with background images
2272
- * @maxLength 256
2273
- */
2274
- mediaRootFolder?: string | null;
2275
- }
2276
- interface GetTemplateRegistryRequest {
2277
- }
2278
- interface GetTemplateRegistryResponse {
2279
- templateRegistry?: TemplateRegistry;
2280
- }
2281
- interface TemplateRegistry {
2282
- /**
2283
- * Templates.
2284
- * @minSize 1
2285
- * @maxSize 1000
2286
- */
2287
- templates?: WixAppTemplate[];
2288
- }
2289
- /** Defines a template and it's styles. */
2290
- interface WixAppTemplate {
2291
- /** Wix App Id */
2292
- wixAppId?: string;
2293
- /** App Slug */
2294
- appSlug?: string;
2295
- /**
2296
- * Template type.
2297
- * @minLength 1
2298
- * @maxLength 20
2299
- */
2300
- templateType?: string;
2301
- /**
2302
- * Templates
2303
- * @minSize 1
2304
- * @maxSize 1000
2305
- */
2306
- templates?: TemplateStyle[];
2307
- /**
2308
- * Short artifact name (key from template-statics-config.json.erb)
2309
- * @minLength 3
2310
- * @maxLength 64
2311
- * @format SYSTEM_SLUG
2312
- */
2313
- templateArtifactName?: string | null;
2314
- /**
2315
- * Local path
2316
- * @minLength 1
2317
- * @maxLength 200
2318
- * @readonly
2319
- */
2320
- localPath?: string | null;
2321
- /**
2322
- * Statics URL
2323
- * @minLength 1
2324
- * @maxLength 200
2325
- * @readonly
2326
- */
2327
- staticsUrl?: string | null;
2328
- }
2329
- /**
2330
- * Defines a template style.
2331
- *
2332
- * Path to TemplateControls json file:
2333
- * papyrus-templates-lib/
2334
- * src/
2335
- * templates/
2336
- * {app_slug}/
2337
- * {template_type}/
2338
- * {id}/
2339
- * controls.json
2340
- */
2341
- interface TemplateStyle {
2342
- /**
2343
- * The id of the template.
2344
- * @minLength 1
2345
- * @maxLength 20
2346
- */
2347
- _id?: string;
2348
- /**
2349
- * Determines which template should be used if user did not choose it yet.
2350
- * Only single template per wix_app_id can be default.
2351
- */
2352
- default?: boolean;
2353
- /** Determines if template cannot be selected for a new entity. */
2354
- inactive?: boolean;
2355
- /** Paper size */
2356
- paperSize?: PaperSizeWithLiterals;
2357
- pageOverflow?: PageOverflowWithLiterals;
2358
- }
2359
- interface DomainEvent$1 extends DomainEventBodyOneOf$1 {
2360
- createdEvent?: EntityCreatedEvent$1;
2361
- updatedEvent?: EntityUpdatedEvent$1;
2362
- deletedEvent?: EntityDeletedEvent$1;
2363
- actionEvent?: ActionEvent$1;
2364
- /** Event ID. With this ID you can easily spot duplicated events and ignore them. */
2365
- _id?: string;
2366
- /**
2367
- * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.
2368
- * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
2369
- */
2370
- entityFqdn?: string;
2371
- /**
2372
- * Event action name, placed at the top level to make it easier for users to dispatch messages.
2373
- * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
2374
- */
2375
- slug?: string;
2376
- /** ID of the entity associated with the event. */
2377
- entityId?: string;
2378
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */
2379
- eventTime?: Date | null;
2380
- /**
2381
- * Whether the event was triggered as a result of a privacy regulation application
2382
- * (for example, GDPR).
2383
- */
2384
- triggeredByAnonymizeRequest?: boolean | null;
2385
- /** If present, indicates the action that triggered the event. */
2386
- originatedFrom?: string | null;
2387
- /**
2388
- * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number.
2389
- * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.
2390
- */
2391
- entityEventSequence?: string | null;
2392
- }
2393
- /** @oneof */
2394
- interface DomainEventBodyOneOf$1 {
2395
- createdEvent?: EntityCreatedEvent$1;
2396
- updatedEvent?: EntityUpdatedEvent$1;
2397
- deletedEvent?: EntityDeletedEvent$1;
2398
- actionEvent?: ActionEvent$1;
2399
- }
2400
- interface EntityCreatedEvent$1 {
2401
- entity?: string;
2402
- }
2403
- interface RestoreInfo$1 {
2404
- deletedDate?: Date | null;
2405
- }
2406
- interface EntityUpdatedEvent$1 {
2407
- /**
2408
- * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
2409
- * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
2410
- * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
2411
- */
2412
- currentEntity?: string;
2413
- }
2414
- interface EntityDeletedEvent$1 {
2415
- /** Entity that was deleted. */
2416
- deletedEntity?: string | null;
2417
- }
2418
- interface ActionEvent$1 {
2419
- body?: string;
2420
- }
2421
- interface MessageEnvelope$1 {
2422
- /**
2423
- * App instance ID.
2424
- * @format GUID
2425
- */
2426
- instanceId?: string | null;
2427
- /**
2428
- * Event type.
2429
- * @maxLength 150
2430
- */
2431
- eventType?: string;
2432
- /** The identification type and identity data. */
2433
- identity?: IdentificationData$1;
2434
- /** Stringify payload. */
2435
- data?: string;
2436
- /** Details related to the account */
2437
- accountInfo?: AccountInfo;
2438
- }
2439
- interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
2440
- /**
2441
- * ID of a site visitor that has not logged in to the site.
2442
- * @format GUID
2443
- */
2444
- anonymousVisitorId?: string;
2445
- /**
2446
- * ID of a site visitor that has logged in to the site.
2447
- * @format GUID
2448
- */
2449
- memberId?: string;
2450
- /**
2451
- * ID of a Wix user (site owner, contributor, etc.).
2452
- * @format GUID
2453
- */
2454
- wixUserId?: string;
2455
- /**
2456
- * ID of an app.
2457
- * @format GUID
2458
- */
2459
- appId?: string;
2460
- /** @readonly */
2461
- identityType?: WebhookIdentityTypeWithLiterals;
2462
- }
2463
- /** @oneof */
2464
- interface IdentificationDataIdOneOf$1 {
2465
- /**
2466
- * ID of a site visitor that has not logged in to the site.
2467
- * @format GUID
2468
- */
2469
- anonymousVisitorId?: string;
2470
- /**
2471
- * ID of a site visitor that has logged in to the site.
2472
- * @format GUID
2473
- */
2474
- memberId?: string;
2475
- /**
2476
- * ID of a Wix user (site owner, contributor, etc.).
2477
- * @format GUID
2478
- */
2479
- wixUserId?: string;
2480
- /**
2481
- * ID of an app.
2482
- * @format GUID
2483
- */
2484
- appId?: string;
2485
- }
2486
- declare enum WebhookIdentityType$1 {
2487
- UNKNOWN = "UNKNOWN",
2488
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
2489
- MEMBER = "MEMBER",
2490
- WIX_USER = "WIX_USER",
2491
- APP = "APP"
2492
- }
2493
- /** @enumType */
2494
- type WebhookIdentityTypeWithLiterals = WebhookIdentityType$1 | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
2495
- interface AccountInfo {
2496
- /**
2497
- * ID of the Wix account associated with the event.
2498
- * @format GUID
2499
- */
2500
- accountId?: string | null;
2501
- /**
2502
- * ID of the parent Wix account. Only included when accountId belongs to a child account.
2503
- * @format GUID
2504
- */
2505
- parentAccountId?: string | null;
2506
- /**
2507
- * ID of the Wix site associated with the event. Only included when the event is tied to a specific site.
2508
- * @format GUID
2509
- */
2510
- siteId?: string | null;
2511
- }
2512
- /** @docsIgnore */
2513
- type UpsertTemplateSettingsApplicationErrors = {
2514
- code?: 'INVALID_TEMPLATE_SETTINGS';
2515
- description?: string;
2516
- data?: Record<string, any>;
2517
- };
2518
- /** @docsIgnore */
2519
- type ResolveTemplateSettingsApplicationErrors = {
2520
- code?: 'TEMPLATE_NOT_FOUND';
2521
- description?: string;
2522
- data?: Record<string, any>;
2523
- };
2524
- interface BaseEventMetadata$1 {
2525
- /**
2526
- * App instance ID.
2527
- * @format GUID
2528
- */
2529
- instanceId?: string | null;
2530
- /**
2531
- * Event type.
2532
- * @maxLength 150
2533
- */
2534
- eventType?: string;
2535
- /** The identification type and identity data. */
2536
- identity?: IdentificationData$1;
2537
- /** Details related to the account */
2538
- accountInfo?: AccountInfo;
2539
- }
2540
- interface EventMetadata$1 extends BaseEventMetadata$1 {
2541
- /** Event ID. With this ID you can easily spot duplicated events and ignore them. */
2542
- _id?: string;
2543
- /**
2544
- * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.
2545
- * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
2546
- */
2547
- entityFqdn?: string;
2548
- /**
2549
- * Event action name, placed at the top level to make it easier for users to dispatch messages.
2550
- * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
2551
- */
2552
- slug?: string;
2553
- /** ID of the entity associated with the event. */
2554
- entityId?: string;
2555
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */
2556
- eventTime?: Date | null;
2557
- /**
2558
- * Whether the event was triggered as a result of a privacy regulation application
2559
- * (for example, GDPR).
2560
- */
2561
- triggeredByAnonymizeRequest?: boolean | null;
2562
- /** If present, indicates the action that triggered the event. */
2563
- originatedFrom?: string | null;
2564
- /**
2565
- * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number.
2566
- * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.
2567
- */
2568
- entityEventSequence?: string | null;
2569
- accountInfo?: AccountInfoMetadata;
2570
- }
2571
- interface AccountInfoMetadata {
2572
- /** ID of the Wix account associated with the event */
2573
- accountId: string;
2574
- /** ID of the Wix site associated with the event. Only included when the event is tied to a specific site. */
2575
- siteId?: string;
2576
- /** ID of the parent Wix account. Only included when 'accountId' belongs to a child account. */
2577
- parentAccountId?: string;
2578
- }
2579
- interface TemplateSettingsCreatedEnvelope {
2580
- entity: TemplateSettings$1;
2581
- metadata: EventMetadata$1;
2582
- }
2583
- interface TemplateSettingsUpdatedEnvelope {
2584
- entity: TemplateSettings$1;
2585
- metadata: EventMetadata$1;
2586
- }
2587
- interface UpsertTemplateSettingsOptions {
2588
- /** Settings to be upserted. */
2589
- settings?: TemplateSettings$1;
2590
- }
2591
- interface QueryCursorResult$1 {
2592
- cursors: Cursors$1;
2593
- hasNext: () => boolean;
2594
- hasPrev: () => boolean;
2595
- length: number;
2596
- pageSize: number;
2597
- }
2598
- interface SettingsQueryResult extends QueryCursorResult$1 {
2599
- items: TemplateSettings$1[];
2600
- query: SettingsQueryBuilder;
2601
- next: () => Promise<SettingsQueryResult>;
2602
- prev: () => Promise<SettingsQueryResult>;
2603
- }
2604
- interface SettingsQueryBuilder {
2605
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
2606
- * @documentationMaturity preview
2607
- */
2608
- limit: (limit: number) => SettingsQueryBuilder;
2609
- /** @param cursor - A pointer to specific record
2610
- * @documentationMaturity preview
2611
- */
2612
- skipTo: (cursor: string) => SettingsQueryBuilder;
2613
- /** @documentationMaturity preview */
2614
- find: () => Promise<SettingsQueryResult>;
2615
- }
2616
- /**
2617
- * @hidden
2618
- * @fqn wix.papyrus.v1.TemplateSettingsService.QueryTemplateSettings
2619
- * @requiredField query
2620
- */
2621
- declare function typedQueryTemplateSettings(query: TemplateSettingsQuery): Promise<QueryTemplateSettingsResponse>;
2622
- interface TemplateSettingsQuerySpec extends QuerySpec {
2623
- paging: 'cursor';
2624
- wql: [];
2625
- }
2626
- type CommonQueryWithEntityContext = Query<TemplateSettings$1, TemplateSettingsQuerySpec>;
2627
- type TemplateSettingsQuery = {
2628
- /**
2629
- 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`.
2630
- */
2631
- cursorPaging?: {
2632
- /**
2633
- Maximum number of items to return in the results.
2634
- @max: 100
2635
- */
2636
- limit?: NonNullable<CommonQueryWithEntityContext['cursorPaging']>['limit'] | null;
2637
- /**
2638
- Pointer to the next or previous page in the list of results.
2639
-
2640
- Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
2641
- Not relevant for the first request.
2642
- @maxLength: 16000
2643
- */
2644
- cursor?: NonNullable<CommonQueryWithEntityContext['cursorPaging']>['cursor'] | null;
2645
- };
2646
- /**
2647
- Filter object.
2648
-
2649
- Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters).
2650
- */
2651
- filter?: CommonQueryWithEntityContext['filter'] | null;
2652
- /**
2653
- Sort object.
2654
-
2655
- Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting).
2656
- */
2657
- sort?: {
2658
- /**
2659
- Name of the field to sort by.
2660
- @maxLength: 512
2661
- */
2662
- fieldName?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['fieldName'];
2663
- /**
2664
- Sort order.
2665
- */
2666
- order?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['order'];
2667
- /**
2668
- Origin point for geo-distance sorting on a GEO field
2669
- results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).
2670
- */
2671
- origin?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['origin'];
2672
- }[];
2673
- };
2674
- declare const utils: {
2675
- query: QueryHelpers<TemplateSettings$1, TemplateSettingsQuerySpec, TemplateSettingsQuery>;
2676
- };
2677
- interface ResolveTemplateSettingsOptions {
2678
- /**
2679
- * The id of the settings.
2680
- * @format GUID
2681
- */
2682
- templateSettingsId?: string | null;
2683
- /**
2684
- * External ID.
2685
- * @maxLength 100
2686
- */
2687
- templateSettingsExternalId?: string | null;
2688
- /**
2689
- * The type of the template. Used to resolve default settings.
2690
- * @minLength 1
2691
- * @maxLength 20
2692
- */
2693
- templateType: string | null;
2694
- /**
2695
- * Wix app slug.
2696
- * @minLength 1
2697
- * @maxLength 20
2698
- */
2699
- appSlug: string | null;
2700
- /**
2701
- * The id of template.
2702
- * @minLength 1
2703
- * @maxLength 20
2704
- */
2705
- templateId?: string | null;
2706
- }
2707
-
2708
- declare function upsertTemplateSettings$1(httpClient: HttpClient): UpsertTemplateSettingsSignature;
2709
- interface UpsertTemplateSettingsSignature {
2710
- /**
2711
- * Upsert Template Settings.
2712
- */
2713
- (options?: UpsertTemplateSettingsOptions): Promise<UpsertTemplateSettingsResponse & {
2714
- __applicationErrorsType?: UpsertTemplateSettingsApplicationErrors;
2715
- }>;
2716
- }
2717
- declare function resolveTemplateSettings$1(httpClient: HttpClient): ResolveTemplateSettingsSignature;
2718
- interface ResolveTemplateSettingsSignature {
2719
- /**
2720
- * Resolve Template Settings. Returns default Template Settings if it does not exist.
2721
- */
2722
- (options?: ResolveTemplateSettingsOptions): Promise<ResolveTemplateSettingsResponse & {
2723
- __applicationErrorsType?: ResolveTemplateSettingsApplicationErrors;
2724
- }>;
2725
- }
2726
- declare const onTemplateSettingsCreated$1: EventDefinition<TemplateSettingsCreatedEnvelope, "wix.papyrus.v1.template_settings_created">;
2727
- declare const onTemplateSettingsUpdated$1: EventDefinition<TemplateSettingsUpdatedEnvelope, "wix.papyrus.v1.template_settings_updated">;
2728
-
2729
- declare function customQueryTemplateSettings(httpClient: HttpClient): {
2730
- (): SettingsQueryBuilder;
2731
- (query: TemplateSettingsQuery): ReturnType<typeof typedQueryTemplateSettings>;
2732
- };
2733
- declare const upsertTemplateSettings: MaybeContext<BuildRESTFunction<typeof upsertTemplateSettings$1> & typeof upsertTemplateSettings$1>;
2734
- declare const resolveTemplateSettings: MaybeContext<BuildRESTFunction<typeof resolveTemplateSettings$1> & typeof resolveTemplateSettings$1>;
2735
- declare const queryTemplateSettings: MaybeContext<BuildRESTFunction<typeof customQueryTemplateSettings> & typeof customQueryTemplateSettings>;
2736
- /** */
2737
- declare const onTemplateSettingsCreated: BuildEventDefinition<typeof onTemplateSettingsCreated$1> & typeof onTemplateSettingsCreated$1;
2738
- /** */
2739
- declare const onTemplateSettingsUpdated: BuildEventDefinition<typeof onTemplateSettingsUpdated$1> & typeof onTemplateSettingsUpdated$1;
2740
-
2741
- type index_d$1_AccountInfo = AccountInfo;
2742
- type index_d$1_AccountInfoMetadata = AccountInfoMetadata;
2743
- type index_d$1_AddressLocation = AddressLocation;
2744
- type index_d$1_BackgroundControl = BackgroundControl;
2745
- type index_d$1_BulkCreateTemplateSettingsRequest = BulkCreateTemplateSettingsRequest;
2746
- type index_d$1_BulkCreateTemplateSettingsResponse = BulkCreateTemplateSettingsResponse;
2747
- type index_d$1_CommonQueryWithEntityContext = CommonQueryWithEntityContext;
2748
- type index_d$1_ControlGroup = ControlGroup;
2749
- type index_d$1_CreateTemplateSettingsRequest = CreateTemplateSettingsRequest;
2750
- type index_d$1_CreateTemplateSettingsResponse = CreateTemplateSettingsResponse;
2751
- type index_d$1_DeleteTemplateSettingsRequest = DeleteTemplateSettingsRequest;
2752
- type index_d$1_DeleteTemplateSettingsResponse = DeleteTemplateSettingsResponse;
2753
- type index_d$1_DisplayControl = DisplayControl;
2754
- type index_d$1_FocalPoint = FocalPoint;
2755
- type index_d$1_GetTemplateControlsRequest = GetTemplateControlsRequest;
2756
- type index_d$1_GetTemplateControlsResponse = GetTemplateControlsResponse;
2757
- type index_d$1_GetTemplateRegistryRequest = GetTemplateRegistryRequest;
2758
- type index_d$1_GetTemplateRegistryResponse = GetTemplateRegistryResponse;
2759
- type index_d$1_GetTemplateSettingsRequest = GetTemplateSettingsRequest;
2760
- type index_d$1_GetTemplateSettingsResponse = GetTemplateSettingsResponse;
2761
- type index_d$1_ImageControl = ImageControl;
2762
- type index_d$1_PageOverflow = PageOverflow;
2763
- declare const index_d$1_PageOverflow: typeof PageOverflow;
2764
- type index_d$1_PageOverflowWithLiterals = PageOverflowWithLiterals;
2765
- type index_d$1_PaperSizeWithLiterals = PaperSizeWithLiterals;
2766
- type index_d$1_QueryTemplateSettingsRequest = QueryTemplateSettingsRequest;
2767
- type index_d$1_QueryTemplateSettingsResponse = QueryTemplateSettingsResponse;
2768
- type index_d$1_Range = Range;
2769
- type index_d$1_ResizeOptionWithLiterals = ResizeOptionWithLiterals;
2770
- type index_d$1_ResolveTemplateSettingsApplicationErrors = ResolveTemplateSettingsApplicationErrors;
2771
- type index_d$1_ResolveTemplateSettingsOptions = ResolveTemplateSettingsOptions;
2772
- type index_d$1_ResolveTemplateSettingsRequest = ResolveTemplateSettingsRequest;
2773
- type index_d$1_ResolveTemplateSettingsResponse = ResolveTemplateSettingsResponse;
2774
- type index_d$1_SelectControl = SelectControl;
2775
- type index_d$1_SettingsQueryBuilder = SettingsQueryBuilder;
2776
- type index_d$1_SettingsQueryResult = SettingsQueryResult;
2777
- type index_d$1_SortOrderWithLiterals = SortOrderWithLiterals;
2778
- type index_d$1_TemplateControls = TemplateControls;
2779
- type index_d$1_TemplateRegistry = TemplateRegistry;
2780
- type index_d$1_TemplateSettingsCreatedEnvelope = TemplateSettingsCreatedEnvelope;
2781
- type index_d$1_TemplateSettingsQuery = TemplateSettingsQuery;
2782
- type index_d$1_TemplateSettingsQuerySpec = TemplateSettingsQuerySpec;
2783
- type index_d$1_TemplateSettingsUpdatedEnvelope = TemplateSettingsUpdatedEnvelope;
2784
- type index_d$1_TemplateStyle = TemplateStyle;
2785
- type index_d$1_TextContentControl = TextContentControl;
2786
- type index_d$1_TextControl = TextControl;
2787
- type index_d$1_TextPropertyControl = TextPropertyControl;
2788
- type index_d$1_UpdateTemplateSettingsRequest = UpdateTemplateSettingsRequest;
2789
- type index_d$1_UpdateTemplateSettingsResponse = UpdateTemplateSettingsResponse;
2790
- type index_d$1_UpsertTemplateSettingsApplicationErrors = UpsertTemplateSettingsApplicationErrors;
2791
- type index_d$1_UpsertTemplateSettingsOptions = UpsertTemplateSettingsOptions;
2792
- type index_d$1_UpsertTemplateSettingsRequest = UpsertTemplateSettingsRequest;
2793
- type index_d$1_UpsertTemplateSettingsResponse = UpsertTemplateSettingsResponse;
2794
- type index_d$1_ValueOption = ValueOption;
2795
- type index_d$1_WebhookIdentityTypeWithLiterals = WebhookIdentityTypeWithLiterals;
2796
- type index_d$1_WixAppTemplate = WixAppTemplate;
2797
- declare const index_d$1_onTemplateSettingsCreated: typeof onTemplateSettingsCreated;
2798
- declare const index_d$1_onTemplateSettingsUpdated: typeof onTemplateSettingsUpdated;
2799
- declare const index_d$1_queryTemplateSettings: typeof queryTemplateSettings;
2800
- declare const index_d$1_resolveTemplateSettings: typeof resolveTemplateSettings;
2801
- declare const index_d$1_upsertTemplateSettings: typeof upsertTemplateSettings;
2802
- declare const index_d$1_utils: typeof utils;
2803
- declare namespace index_d$1 {
2804
- export { type index_d$1_AccountInfo as AccountInfo, type index_d$1_AccountInfoMetadata as AccountInfoMetadata, type ActionEvent$1 as ActionEvent, type index_d$1_AddressLocation as AddressLocation, type index_d$1_BackgroundControl as BackgroundControl, type BackgroundSetting$1 as BackgroundSetting, type BaseEventMetadata$1 as BaseEventMetadata, type index_d$1_BulkCreateTemplateSettingsRequest as BulkCreateTemplateSettingsRequest, type index_d$1_BulkCreateTemplateSettingsResponse as BulkCreateTemplateSettingsResponse, type index_d$1_CommonQueryWithEntityContext as CommonQueryWithEntityContext, type index_d$1_ControlGroup as ControlGroup, type index_d$1_CreateTemplateSettingsRequest as CreateTemplateSettingsRequest, type index_d$1_CreateTemplateSettingsResponse as CreateTemplateSettingsResponse, type CursorPaging$1 as CursorPaging, type Cursors$1 as Cursors, type index_d$1_DeleteTemplateSettingsRequest as DeleteTemplateSettingsRequest, type index_d$1_DeleteTemplateSettingsResponse as DeleteTemplateSettingsResponse, type index_d$1_DisplayControl as DisplayControl, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type EventMetadata$1 as EventMetadata, type index_d$1_FocalPoint as FocalPoint, type index_d$1_GetTemplateControlsRequest as GetTemplateControlsRequest, type index_d$1_GetTemplateControlsResponse as GetTemplateControlsResponse, type index_d$1_GetTemplateRegistryRequest as GetTemplateRegistryRequest, type index_d$1_GetTemplateRegistryResponse as GetTemplateRegistryResponse, type index_d$1_GetTemplateSettingsRequest as GetTemplateSettingsRequest, type index_d$1_GetTemplateSettingsResponse as GetTemplateSettingsResponse, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type index_d$1_ImageControl as ImageControl, type ImageSetting$1 as ImageSetting, type MessageEnvelope$1 as MessageEnvelope, index_d$1_PageOverflow as PageOverflow, type index_d$1_PageOverflowWithLiterals as PageOverflowWithLiterals, type Paging$1 as Paging, type PagingMetadataV2$1 as PagingMetadataV2, PaperSize$1 as PaperSize, type index_d$1_PaperSizeWithLiterals as PaperSizeWithLiterals, type index_d$1_QueryTemplateSettingsRequest as QueryTemplateSettingsRequest, type index_d$1_QueryTemplateSettingsResponse as QueryTemplateSettingsResponse, type QueryV2$1 as QueryV2, type QueryV2PagingMethodOneOf$1 as QueryV2PagingMethodOneOf, type index_d$1_Range as Range, ResizeOption$1 as ResizeOption, type index_d$1_ResizeOptionWithLiterals as ResizeOptionWithLiterals, type index_d$1_ResolveTemplateSettingsApplicationErrors as ResolveTemplateSettingsApplicationErrors, type index_d$1_ResolveTemplateSettingsOptions as ResolveTemplateSettingsOptions, type index_d$1_ResolveTemplateSettingsRequest as ResolveTemplateSettingsRequest, type index_d$1_ResolveTemplateSettingsResponse as ResolveTemplateSettingsResponse, type RestoreInfo$1 as RestoreInfo, type index_d$1_SelectControl as SelectControl, type SelectSetting$1 as SelectSetting, type SettingsGroup$1 as SettingsGroup, type index_d$1_SettingsQueryBuilder as SettingsQueryBuilder, type index_d$1_SettingsQueryResult as SettingsQueryResult, SortOrder$1 as SortOrder, type index_d$1_SortOrderWithLiterals as SortOrderWithLiterals, type Sorting$1 as Sorting, type index_d$1_TemplateControls as TemplateControls, type index_d$1_TemplateRegistry as TemplateRegistry, type TemplateSettings$1 as TemplateSettings, type index_d$1_TemplateSettingsCreatedEnvelope as TemplateSettingsCreatedEnvelope, type index_d$1_TemplateSettingsQuery as TemplateSettingsQuery, type index_d$1_TemplateSettingsQuerySpec as TemplateSettingsQuerySpec, type index_d$1_TemplateSettingsUpdatedEnvelope as TemplateSettingsUpdatedEnvelope, type index_d$1_TemplateStyle as TemplateStyle, type TextContent$1 as TextContent, type index_d$1_TextContentControl as TextContentControl, type index_d$1_TextControl as TextControl, type index_d$1_TextPropertyControl as TextPropertyControl, type TextSetting$1 as TextSetting, type index_d$1_UpdateTemplateSettingsRequest as UpdateTemplateSettingsRequest, type index_d$1_UpdateTemplateSettingsResponse as UpdateTemplateSettingsResponse, type index_d$1_UpsertTemplateSettingsApplicationErrors as UpsertTemplateSettingsApplicationErrors, type index_d$1_UpsertTemplateSettingsOptions as UpsertTemplateSettingsOptions, type index_d$1_UpsertTemplateSettingsRequest as UpsertTemplateSettingsRequest, type index_d$1_UpsertTemplateSettingsResponse as UpsertTemplateSettingsResponse, type index_d$1_ValueOption as ValueOption, WebhookIdentityType$1 as WebhookIdentityType, type index_d$1_WebhookIdentityTypeWithLiterals as WebhookIdentityTypeWithLiterals, type index_d$1_WixAppTemplate as WixAppTemplate, index_d$1_onTemplateSettingsCreated as onTemplateSettingsCreated, index_d$1_onTemplateSettingsUpdated as onTemplateSettingsUpdated, index_d$1_queryTemplateSettings as queryTemplateSettings, index_d$1_resolveTemplateSettings as resolveTemplateSettings, index_d$1_upsertTemplateSettings as upsertTemplateSettings, index_d$1_utils as utils };
2805
- }
2806
-
2807
- /** Document is the main entity of DocumentService. */
2808
- interface Document {
2809
- /**
2810
- * Document ID.
2811
- * @readonly
2812
- */
2813
- _id?: string | null;
2814
- /**
2815
- * Represents the time this Document was created.
2816
- * @readonly
2817
- */
2818
- _createdDate?: Date;
2819
- /**
2820
- * Represents the time this Document was last updated.
2821
- * @readonly
2822
- */
2823
- _updatedDate?: Date;
2824
- /**
2825
- * Document render status.
2826
- * @readonly
2827
- */
2828
- renderStatus?: RenderStatus;
2829
- /**
2830
- * URL to download document. Returned only when Document is in `READY` state.
2831
- * @readonly
2832
- */
2833
- downloadUrl?: string | null;
2834
- /** Template ID. When this parameter used the document will be rendered with this template default settings */
2835
- templateId?: string | null;
2836
- /** Unique per tenant external ID, for example order number. Used to retrieve Document later. */
2837
- externalId?: string | null;
2838
- /** Unique per tenant template external ID, for example ticket definition ID. Used to lookup corresponding template & template settings. */
2839
- templateSettingsExternalId?: string | null;
2840
- /** Template settings ID. */
2841
- templateSettingsId?: string | null;
2842
- /** The app slug of the template */
2843
- appSlug?: string | null;
2844
- /** The type of the template. */
2845
- templateType?: string | null;
2846
- /** Document content that is injected into template. */
2847
- content?: DocumentContent;
2848
- /** Number of hours after which document will be eventually expired and its content erased. */
2849
- expiresInHours?: number;
2850
- /**
2851
- * Represents the time this document becomes expired.
2852
- * @readonly
2853
- */
2854
- expirationDate?: Date;
2855
- /** Document format. Defaults to `PDF`. */
2856
- format?: Format;
2857
- /**
2858
- * Whether the link to the uploaded document is public or private.
2859
- * For public document static URL will be returned.
2860
- * For private document temporary URL will be generated by DocumentService.DownloadDocument.
2861
- */
2862
- public?: boolean | null;
2863
- /** Optional filename (without extension) to be used for the downloadable document. */
2864
- fileName?: string | null;
2865
- /** Client defined content checksum. Can be used for content comparison. */
2866
- contentChecksum?: string | null;
2867
- /** Rendering notification config. */
2868
- renderDelayedEventConfig?: RenderDelayedEventConfig;
2869
- }
2870
- declare enum RenderStatus {
2871
- UNKNOWN = "UNKNOWN",
2872
- /** Document was accepted and is waiting to be rendered. */
2873
- ACCEPTED = "ACCEPTED",
2874
- /** Rendering is in progress. */
2875
- RENDERING = "RENDERING",
2876
- /** Rendering finished successfully and document is ready to download. */
2877
- READY = "READY",
2878
- /** Rendering failed. */
2879
- FAILED = "FAILED",
2880
- /** Rendered document expired and is no longer available for download. */
2881
- EXPIRED = "EXPIRED"
2882
- }
2883
- interface DocumentContent {
2884
- /** Document pages. Each page is reference as $page. */
2885
- pages?: Record<string, any>[] | null;
2886
- /** Other document content referenced by $content variable */
2887
- content?: Record<string, any> | null;
2888
- /** ISO 639-1 language code of content (used in translations). */
2889
- language?: string;
2890
- /** IETF BCP 47 language tag (e.g. en-US). */
2891
- locale?: string | null;
2892
- }
2893
- declare enum Format {
2894
- UNKNOWN = "UNKNOWN",
2895
- PDF = "PDF"
2896
- }
2897
- interface TemplateSettingsOverride {
2898
- /** Indices (0-based) of pages with template settings override. */
2899
- pageIndices?: number[];
2900
- /** Template settings ID. */
2901
- templateSettingsId?: string | null;
2902
- /** Unique per tenant template external ID, for example ticket definition ID. Used to lookup corresponding template & template settings. */
2903
- templateSettingsExternalId?: string | null;
2904
- /** Template ID. When this parameter used the page will be rendered with this template default settings */
2905
- templateId?: string | null;
2906
- }
2907
- interface PageSettings {
2908
- /** Indices (0-based) of pages with template settings override. */
2909
- pageIndices?: number[];
2910
- /** Template settings ID. */
2911
- templateSettingsId?: string | null;
2912
- /** Unique per tenant template external ID, for example ticket definition ID. Used to lookup corresponding template & template settings. */
2913
- templateSettingsExternalId?: string | null;
2914
- /** Template ID. When this parameter used the page will be rendered with this template default settings */
2915
- templateId?: string | null;
2916
- }
2917
- declare enum WixMpClientVersion {
2918
- UNKNOWN = "UNKNOWN",
2919
- MP_V1 = "MP_V1",
2920
- MP_V2 = "MP_V2"
2921
- }
2922
- interface RenderDelayedEventConfig {
2923
- /**
2924
- * Controls DocumentRenderDelayed action event sending.
2925
- * Event will be sent after time_in_queue_minutes if document render status is ACCEPTED/RENDERING.
2926
- */
2927
- timeInQueueMinutes?: number;
2928
- }
2929
- interface GetDownloadPageRequest {
2930
- file: string | null;
2931
- }
2932
- interface RawHttpResponse {
2933
- body?: Uint8Array;
2934
- statusCode?: number | null;
2935
- headers?: HeadersEntry[];
2936
- }
2937
- interface HeadersEntry {
2938
- key?: string;
2939
- value?: string;
2940
- }
2941
- interface RenderDocumentRequestV2 {
2942
- /** Template settings. */
2943
- templateSettings?: TemplateSettings;
2944
- /** Document content. */
2945
- content?: DocumentContent;
2946
- /** Output format, defaults to PDF. */
2947
- outputFormat?: RenderFormat;
2948
- /** Overrides papyrusTemplatesStaticsUrl: "//static.parastorage.com/services/papyrus-templates-statics/${version_override}/" */
2949
- versionOverride?: string | null;
2950
- }
2951
- interface TemplateSettings {
2952
- /**
2953
- * Auto generated ID.
2954
- * @readonly
2955
- */
2956
- _id?: string | null;
2957
- /** Wix app definition ID. */
2958
- appSlug?: string | null;
2959
- /** The type of the template. */
2960
- templateType?: string | null;
2961
- /** The id of the template. */
2962
- templateId?: string | null;
2963
- /**
2964
- * Template settings external ID. For example ticket definition ID.
2965
- * Must be unique per tenant where tenant is taken from authorization (wix_app_id + meta_site_id)
2966
- */
2967
- externalId?: string | null;
2968
- /**
2969
- * Date settings were created.
2970
- * @readonly
2971
- */
2972
- _createdDate?: Date;
2973
- /**
2974
- * Date settings were updated.
2975
- * @readonly
2976
- */
2977
- _updatedDate?: Date;
2978
- settingGroups?: SettingsGroup[];
2979
- /** Paper size */
2980
- paperSize?: PaperSize;
2981
- }
2982
- interface TextSetting {
2983
- /** Font family class name */
2984
- fontFamily?: string | null;
2985
- /** Font style class names */
2986
- fontStyle?: string[];
2987
- /** Text alignment class name */
2988
- textAlignment?: string | null;
2989
- /** Text color hex code */
2990
- textColor?: string | null;
2991
- /** Font size */
2992
- fontSize?: number | null;
2993
- /** Text content setting */
2994
- textContent?: TextContent[];
2995
- }
2996
- interface TextContent {
2997
- _id?: string;
2998
- value?: string | null;
2999
- visible?: boolean;
3000
- }
3001
- interface ImageSetting {
3002
- /** Wix media Image */
3003
- image?: string;
3004
- /** Image resizing mode */
3005
- resize?: ResizeOption;
3006
- }
3007
- declare enum ResizeOption {
3008
- /** Automatically resizes full image to fit image field */
3009
- FIT = "FIT",
3010
- /** Enables user to manually crop image to fit image field */
3011
- CROP = "CROP"
3012
- }
3013
- interface SelectSetting {
3014
- /** Selected value */
3015
- value?: string | null;
3016
- /** Color hex code */
3017
- primaryColor?: string | null;
3018
- /** Color hex code */
3019
- secondaryColor?: string | null;
3020
- /** Size */
3021
- size?: number | null;
3022
- }
3023
- interface BackgroundSetting {
3024
- /** Color of the background hex code */
3025
- color?: string | null;
3026
- /** Wix media Image */
3027
- image?: string;
3028
- }
3029
- interface SettingsGroup {
3030
- /** Id of the control group */
3031
- groupId?: string;
3032
- /** Display settings. */
3033
- display?: Record<string, boolean>;
3034
- /** Texts settings. */
3035
- texts?: Record<string, TextSetting>;
3036
- /** Images settings. */
3037
- images?: Record<string, ImageSetting>;
3038
- /** Select option settings. */
3039
- selects?: Record<string, SelectSetting>;
3040
- /** Backgrounds settings. */
3041
- backgrounds?: Record<string, BackgroundSetting>;
3042
- }
3043
- declare enum PaperSize {
3044
- A4_PORTRAIT = "A4_PORTRAIT",
3045
- A4_LANDSCAPE = "A4_LANDSCAPE"
3046
- }
3047
- declare enum RenderFormat {
3048
- /** content-type: application/pdf */
3049
- PDF = "PDF",
3050
- /** content-type: text/html */
3051
- HTML = "HTML"
3052
- }
3053
- interface RenderDocumentByIdRequest {
3054
- /** Document ID. */
3055
- documentId?: string | null;
3056
- /** Output format, defaults to PDF. */
3057
- outputFormat?: RenderFormat;
3058
- }
3059
- interface DomainEvent extends DomainEventBodyOneOf {
3060
- createdEvent?: EntityCreatedEvent;
3061
- updatedEvent?: EntityUpdatedEvent;
3062
- deletedEvent?: EntityDeletedEvent;
3063
- actionEvent?: ActionEvent;
3064
- /**
3065
- * Unique event ID.
3066
- * Allows clients to ignore duplicate webhooks.
3067
- */
3068
- _id?: string;
3069
- /**
3070
- * Assumes actions are also always typed to an entity_type
3071
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
3072
- */
3073
- entityFqdn?: string;
3074
- /**
3075
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
3076
- * This is although the created/updated/deleted notion is duplication of the oneof types
3077
- * Example: created/updated/deleted/started/completed/email_opened
3078
- */
3079
- slug?: string;
3080
- /** ID of the entity associated with the event. */
3081
- entityId?: string;
3082
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
3083
- eventTime?: Date;
3084
- /**
3085
- * Whether the event was triggered as a result of a privacy regulation application
3086
- * (for example, GDPR).
3087
- */
3088
- triggeredByAnonymizeRequest?: boolean | null;
3089
- /** If present, indicates the action that triggered the event. */
3090
- originatedFrom?: string | null;
3091
- /**
3092
- * A sequence number defining the order of updates to the underlying entity.
3093
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
3094
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
3095
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
3096
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
3097
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
3098
- */
3099
- entityEventSequence?: string | null;
3100
- }
3101
- /** @oneof */
3102
- interface DomainEventBodyOneOf {
3103
- createdEvent?: EntityCreatedEvent;
3104
- updatedEvent?: EntityUpdatedEvent;
3105
- deletedEvent?: EntityDeletedEvent;
3106
- actionEvent?: ActionEvent;
3107
- }
3108
- interface EntityCreatedEvent {
3109
- entity?: string;
3110
- }
3111
- interface RestoreInfo {
3112
- deletedDate?: Date;
3113
- }
3114
- interface EntityUpdatedEvent {
3115
- /**
3116
- * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
3117
- * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
3118
- * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
3119
- */
3120
- currentEntity?: string;
3121
- }
3122
- interface EntityDeletedEvent {
3123
- /** Entity that was deleted */
3124
- deletedEntity?: string | null;
3125
- }
3126
- interface ActionEvent {
3127
- body?: string;
3128
- }
3129
- interface Empty {
3130
- }
3131
- interface DocumentRenderDelayed {
3132
- /** Document that is being rendered. */
3133
- document?: Document;
3134
- }
3135
- interface CreateDocumentRequest {
3136
- /** Document to be created */
3137
- document?: Document;
3138
- }
3139
- interface CreateDocumentResponse {
3140
- /** The created Document */
3141
- document?: Document;
3142
- }
3143
- interface GetDocumentRequest {
3144
- /** ID of the Document to retrieve */
3145
- documentId: string;
3146
- fields?: RequestedFields[];
3147
- }
3148
- declare enum RequestedFields {
3149
- UNKNOWN_REQUESTED_FIELD = "UNKNOWN_REQUESTED_FIELD",
3150
- /** Include `documentContent` in the response. */
3151
- DOCUMENT_CONTENT = "DOCUMENT_CONTENT"
3152
- }
3153
- interface GetDocumentResponse {
3154
- /** The retrieved Document */
3155
- document?: Document;
3156
- }
3157
- interface DeleteDocumentRequest {
3158
- /** ID of the Document to delete */
3159
- documentId: string;
3160
- }
3161
- interface DeleteDocumentResponse {
3162
- /** Deleted document. */
3163
- document?: Document;
3164
- }
3165
- interface QueryDocumentRequest {
3166
- /** WQL expression */
3167
- query: QueryV2;
3168
- fields?: RequestedFields[];
3169
- }
3170
- interface QueryV2 extends QueryV2PagingMethodOneOf {
3171
- /** Paging options to limit and skip the number of items. */
3172
- paging?: Paging;
3173
- /** 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`. */
3174
- cursorPaging?: CursorPaging;
3175
- /**
3176
- * Filter object.
3177
- *
3178
- * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).
3179
- */
3180
- filter?: Record<string, any> | null;
3181
- /**
3182
- * Sort object.
3183
- *
3184
- * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).
3185
- */
3186
- sort?: Sorting[];
3187
- /** 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. */
3188
- fields?: string[];
3189
- /** 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. */
3190
- fieldsets?: string[];
3191
- }
3192
- /** @oneof */
3193
- interface QueryV2PagingMethodOneOf {
3194
- /** Paging options to limit and skip the number of items. */
3195
- paging?: Paging;
3196
- /** 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`. */
3197
- cursorPaging?: CursorPaging;
3198
- }
3199
- interface Sorting {
3200
- /** Name of the field to sort by. */
3201
- fieldName?: string;
3202
- /** Sort order. */
3203
- order?: SortOrder;
3204
- }
3205
- declare enum SortOrder {
3206
- ASC = "ASC",
3207
- DESC = "DESC"
3208
- }
3209
- interface Paging {
3210
- /** Number of items to load. */
3211
- limit?: number | null;
3212
- /** Number of items to skip in the current sort order. */
3213
- offset?: number | null;
3214
- }
3215
- interface CursorPaging {
3216
- /** Maximum number of items to return in the results. */
3217
- limit?: number | null;
3218
- /**
3219
- * Pointer to the next or previous page in the list of results.
3220
- *
3221
- * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
3222
- * Not relevant for the first request.
3223
- */
3224
- cursor?: string | null;
3225
- }
3226
- interface QueryDocumentResponse {
3227
- /** The retrieved Documents */
3228
- documents?: Document[];
3229
- /** Query results' metadata */
3230
- metadata?: PagingMetadataV2;
3231
- }
3232
- interface PagingMetadataV2 {
3233
- /** Number of items returned in the response. */
3234
- count?: number | null;
3235
- /** Offset that was requested. */
3236
- offset?: number | null;
3237
- /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
3238
- total?: number | null;
3239
- /** Flag that indicates the server failed to calculate the `total` field. */
3240
- tooManyToCount?: boolean | null;
3241
- /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
3242
- cursors?: Cursors;
3243
- }
3244
- interface Cursors {
3245
- /** Cursor string pointing to the next page in the list of results. */
3246
- next?: string | null;
3247
- /** Cursor pointing to the previous page in the list of results. */
3248
- prev?: string | null;
3249
- }
3250
- interface UpdateDocumentRequest {
3251
- /**
3252
- * Document ID.
3253
- * @readonly
3254
- */
3255
- _id: string | null;
3256
- /** Document render status. */
3257
- renderStatus?: RenderStatus;
3258
- /** Rendered document file. */
3259
- file?: DocumentFile;
3260
- /** Rendered document source HTML file. */
3261
- sourceFile?: DocumentFile;
3262
- }
3263
- interface DocumentFile {
3264
- /** File ID. */
3265
- fileId?: string | null;
3266
- /** File URL. Defined only for public documents. */
3267
- staticUrl?: string | null;
3268
- /** File path. */
3269
- filePath?: string | null;
3270
- }
3271
- interface UpdateDocumentResponse {
3272
- /** The created Document */
3273
- document?: Document;
3274
- }
3275
- interface DocumentRendered {
3276
- /** Rendered document */
3277
- document?: Document;
3278
- }
3279
- interface DocumentRenderFailed {
3280
- /** Document that failed to render */
3281
- document?: Document;
3282
- }
3283
- interface DownloadDocumentRequest {
3284
- /** ID of the Document to retrieve */
3285
- documentId: string;
3286
- /** URL expiration time. Only relevant for private documents. */
3287
- urlExpirationInSeconds?: number | null;
3288
- }
3289
- interface DownloadDocumentResponse {
3290
- /** Download URL. */
3291
- downloadUrl?: string;
3292
- /** URL expiration timestamp. Not provided for public documents because their links do not expire. */
3293
- expirationDate?: Date;
3294
- }
3295
- interface GetDownloadUrlRequest extends GetDownloadUrlRequestDocumentOneOf {
3296
- /** ID of the Document to retrieve */
3297
- documentId?: string | null;
3298
- /** ID of the Document to retrieve */
3299
- externalId?: string | null;
3300
- /** Signed file token */
3301
- fileToken?: string | null;
3302
- /** URL expiration time. Only relevant for private documents. */
3303
- urlExpirationInSeconds?: number | null;
3304
- }
3305
- /** @oneof */
3306
- interface GetDownloadUrlRequestDocumentOneOf {
3307
- /** ID of the Document to retrieve */
3308
- documentId?: string | null;
3309
- /** ID of the Document to retrieve */
3310
- externalId?: string | null;
3311
- /** Signed file token */
3312
- fileToken?: string | null;
3313
- }
3314
- interface GetDownloadUrlResponse {
3315
- /** Download URL. */
3316
- downloadUrl?: string | null;
3317
- /** URL expiration timestamp. Not provided for public documents because their links do not expire. */
3318
- expirationDate?: Date;
3319
- /** Document ID. */
3320
- documentId?: string | null;
3321
- /** Document render status. */
3322
- renderStatus?: RenderStatus;
3323
- /** Download URL. */
3324
- downloadPageUrl?: string | null;
3325
- }
3326
- interface DownloadDocumentSourceRequest {
3327
- /** ID of the Document to retrieve */
3328
- documentId: string;
3329
- }
3330
- interface DownloadDocumentSourceResponse {
3331
- /** Download URL. Expires after 10 minutes. */
3332
- downloadUrl?: string;
3333
- }
3334
- interface MessageEnvelope {
3335
- /** App instance ID. */
3336
- instanceId?: string | null;
3337
- /** Event type. */
3338
- eventType?: string;
3339
- /** The identification type and identity data. */
3340
- identity?: IdentificationData;
3341
- /** Stringify payload. */
3342
- data?: string;
3343
- }
3344
- interface IdentificationData extends IdentificationDataIdOneOf {
3345
- /** ID of a site visitor that has not logged in to the site. */
3346
- anonymousVisitorId?: string;
3347
- /** ID of a site visitor that has logged in to the site. */
3348
- memberId?: string;
3349
- /** ID of a Wix user (site owner, contributor, etc.). */
3350
- wixUserId?: string;
3351
- /** ID of an app. */
3352
- appId?: string;
3353
- /** @readonly */
3354
- identityType?: WebhookIdentityType;
3355
- }
3356
- /** @oneof */
3357
- interface IdentificationDataIdOneOf {
3358
- /** ID of a site visitor that has not logged in to the site. */
3359
- anonymousVisitorId?: string;
3360
- /** ID of a site visitor that has logged in to the site. */
3361
- memberId?: string;
3362
- /** ID of a Wix user (site owner, contributor, etc.). */
3363
- wixUserId?: string;
3364
- /** ID of an app. */
3365
- appId?: string;
3366
- }
3367
- declare enum WebhookIdentityType {
3368
- UNKNOWN = "UNKNOWN",
3369
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
3370
- MEMBER = "MEMBER",
3371
- WIX_USER = "WIX_USER",
3372
- APP = "APP"
3373
- }
3374
- interface HeadersEntryNonNullableFields {
3375
- key: string;
3376
- value: string;
3377
- }
3378
- interface RawHttpResponseNonNullableFields {
3379
- body: Uint8Array;
3380
- headers: HeadersEntryNonNullableFields[];
3381
- }
3382
- interface DocumentContentNonNullableFields {
3383
- language: string;
3384
- }
3385
- interface TemplateSettingsOverrideNonNullableFields {
3386
- pageIndices: number[];
3387
- }
3388
- interface PageSettingsNonNullableFields {
3389
- pageIndices: number[];
3390
- }
3391
- interface RenderDelayedEventConfigNonNullableFields {
3392
- timeInQueueMinutes: number;
3393
- }
3394
- interface DocumentNonNullableFields {
3395
- renderStatus: RenderStatus;
3396
- content?: DocumentContentNonNullableFields;
3397
- expiresInHours: number;
3398
- format: Format;
3399
- templateSettings: TemplateSettingsOverrideNonNullableFields[];
3400
- pageSettings: PageSettingsNonNullableFields[];
3401
- wixMpClientVersion: WixMpClientVersion;
3402
- renderDelayedEventConfig?: RenderDelayedEventConfigNonNullableFields;
3403
- }
3404
- interface CreateDocumentResponseNonNullableFields {
3405
- document?: DocumentNonNullableFields;
3406
- }
3407
- interface GetDocumentResponseNonNullableFields {
3408
- document?: DocumentNonNullableFields;
3409
- }
3410
- interface DeleteDocumentResponseNonNullableFields {
3411
- document?: DocumentNonNullableFields;
3412
- }
3413
- interface QueryDocumentResponseNonNullableFields {
3414
- documents: DocumentNonNullableFields[];
3415
- }
3416
- interface UpdateDocumentResponseNonNullableFields {
3417
- document?: DocumentNonNullableFields;
3418
- }
3419
- interface DownloadDocumentResponseNonNullableFields {
3420
- downloadUrl: string;
3421
- }
3422
- interface GetDownloadUrlResponseNonNullableFields {
3423
- renderStatus: RenderStatus;
3424
- }
3425
- interface DownloadDocumentSourceResponseNonNullableFields {
3426
- downloadUrl: string;
3427
- }
3428
- interface BaseEventMetadata {
3429
- /** App instance ID. */
3430
- instanceId?: string | null;
3431
- /** Event type. */
3432
- eventType?: string;
3433
- /** The identification type and identity data. */
3434
- identity?: IdentificationData;
3435
- }
3436
- interface EventMetadata extends BaseEventMetadata {
3437
- /**
3438
- * Unique event ID.
3439
- * Allows clients to ignore duplicate webhooks.
3440
- */
3441
- _id?: string;
3442
- /**
3443
- * Assumes actions are also always typed to an entity_type
3444
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
3445
- */
3446
- entityFqdn?: string;
3447
- /**
3448
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
3449
- * This is although the created/updated/deleted notion is duplication of the oneof types
3450
- * Example: created/updated/deleted/started/completed/email_opened
3451
- */
3452
- slug?: string;
3453
- /** ID of the entity associated with the event. */
3454
- entityId?: string;
3455
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
3456
- eventTime?: Date;
3457
- /**
3458
- * Whether the event was triggered as a result of a privacy regulation application
3459
- * (for example, GDPR).
3460
- */
3461
- triggeredByAnonymizeRequest?: boolean | null;
3462
- /** If present, indicates the action that triggered the event. */
3463
- originatedFrom?: string | null;
3464
- /**
3465
- * A sequence number defining the order of updates to the underlying entity.
3466
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
3467
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
3468
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
3469
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
3470
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
3471
- */
3472
- entityEventSequence?: string | null;
3473
- }
3474
- interface DocumentRenderDelayedEnvelope {
3475
- data: DocumentRenderDelayed;
3476
- metadata: EventMetadata;
3477
- }
3478
- interface DocumentCreatedEnvelope {
3479
- entity: Document;
3480
- metadata: EventMetadata;
3481
- }
3482
- interface DocumentDeletedEnvelope {
3483
- metadata: EventMetadata;
3484
- }
3485
- interface DocumentUpdatedEnvelope {
3486
- entity: Document;
3487
- metadata: EventMetadata;
3488
- }
3489
- interface DocumentRenderedEnvelope {
3490
- data: DocumentRendered;
3491
- metadata: EventMetadata;
3492
- }
3493
- interface DocumentRenderFailedEnvelope {
3494
- data: DocumentRenderFailed;
3495
- metadata: EventMetadata;
3496
- }
3497
- interface CreateDocumentOptions {
3498
- /** Document to be created */
3499
- document?: Document;
3500
- }
3501
- interface GetDocumentOptions {
3502
- fields?: RequestedFields[];
3503
- }
3504
- interface QueryDocumentOptions {
3505
- fields?: RequestedFields[] | undefined;
3506
- }
3507
- interface QueryCursorResult {
3508
- cursors: Cursors;
3509
- hasNext: () => boolean;
3510
- hasPrev: () => boolean;
3511
- length: number;
3512
- pageSize: number;
3513
- }
3514
- interface DocumentsQueryResult extends QueryCursorResult {
3515
- items: Document[];
3516
- query: DocumentsQueryBuilder;
3517
- next: () => Promise<DocumentsQueryResult>;
3518
- prev: () => Promise<DocumentsQueryResult>;
3519
- }
3520
- interface DocumentsQueryBuilder {
3521
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
3522
- * @documentationMaturity preview
3523
- */
3524
- limit: (limit: number) => DocumentsQueryBuilder;
3525
- /** @param cursor - A pointer to specific record
3526
- * @documentationMaturity preview
3527
- */
3528
- skipTo: (cursor: string) => DocumentsQueryBuilder;
3529
- /** @documentationMaturity preview */
3530
- find: () => Promise<DocumentsQueryResult>;
3531
- }
3532
- interface UpdateDocumentOptions {
3533
- /** Document render status. */
3534
- renderStatus?: RenderStatus;
3535
- /** Rendered document file. */
3536
- file?: DocumentFile;
3537
- /** Rendered document source HTML file. */
3538
- sourceFile?: DocumentFile;
3539
- }
3540
- interface DownloadDocumentOptions {
3541
- /** URL expiration time. Only relevant for private documents. */
3542
- urlExpirationInSeconds?: number | null;
3543
- }
3544
- interface GetDownloadUrlOptions extends GetDownloadUrlRequestDocumentOneOf {
3545
- /** ID of the Document to retrieve */
3546
- documentId?: string | null;
3547
- /** ID of the Document to retrieve */
3548
- externalId?: string | null;
3549
- /** Signed file token */
3550
- fileToken?: string | null;
3551
- /** URL expiration time. Only relevant for private documents. */
3552
- urlExpirationInSeconds?: number | null;
3553
- }
3554
-
3555
- declare function createRESTModule<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
3556
-
3557
- declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
3558
-
3559
- declare const getDownloadPage: ReturnType<typeof createRESTModule<typeof publicGetDownloadPage>>;
3560
- declare const createDocument: ReturnType<typeof createRESTModule<typeof publicCreateDocument>>;
3561
- declare const getDocument: ReturnType<typeof createRESTModule<typeof publicGetDocument>>;
3562
- declare const deleteDocument: ReturnType<typeof createRESTModule<typeof publicDeleteDocument>>;
3563
- declare const queryDocument: ReturnType<typeof createRESTModule<typeof publicQueryDocument>>;
3564
- declare const updateDocument: ReturnType<typeof createRESTModule<typeof publicUpdateDocument>>;
3565
- declare const downloadDocument: ReturnType<typeof createRESTModule<typeof publicDownloadDocument>>;
3566
- declare const getDownloadUrl: ReturnType<typeof createRESTModule<typeof publicGetDownloadUrl>>;
3567
- declare const downloadDocumentSource: ReturnType<typeof createRESTModule<typeof publicDownloadDocumentSource>>;
3568
- declare const onDocumentRenderDelayed: ReturnType<typeof createEventModule<typeof publicOnDocumentRenderDelayed>>;
3569
- declare const onDocumentCreated: ReturnType<typeof createEventModule<typeof publicOnDocumentCreated>>;
3570
- declare const onDocumentDeleted: ReturnType<typeof createEventModule<typeof publicOnDocumentDeleted>>;
3571
- declare const onDocumentUpdated: ReturnType<typeof createEventModule<typeof publicOnDocumentUpdated>>;
3572
- declare const onDocumentRendered: ReturnType<typeof createEventModule<typeof publicOnDocumentRendered>>;
3573
- declare const onDocumentRenderFailed: ReturnType<typeof createEventModule<typeof publicOnDocumentRenderFailed>>;
3574
-
3575
- type index_d_ActionEvent = ActionEvent;
3576
- type index_d_BackgroundSetting = BackgroundSetting;
3577
- type index_d_BaseEventMetadata = BaseEventMetadata;
3578
- type index_d_CreateDocumentOptions = CreateDocumentOptions;
3579
- type index_d_CreateDocumentRequest = CreateDocumentRequest;
3580
- type index_d_CreateDocumentResponse = CreateDocumentResponse;
3581
- type index_d_CreateDocumentResponseNonNullableFields = CreateDocumentResponseNonNullableFields;
3582
- type index_d_CursorPaging = CursorPaging;
3583
- type index_d_Cursors = Cursors;
3584
- type index_d_DeleteDocumentRequest = DeleteDocumentRequest;
3585
- type index_d_DeleteDocumentResponse = DeleteDocumentResponse;
3586
- type index_d_DeleteDocumentResponseNonNullableFields = DeleteDocumentResponseNonNullableFields;
3587
- type index_d_Document = Document;
3588
- type index_d_DocumentContent = DocumentContent;
3589
- type index_d_DocumentCreatedEnvelope = DocumentCreatedEnvelope;
3590
- type index_d_DocumentDeletedEnvelope = DocumentDeletedEnvelope;
3591
- type index_d_DocumentFile = DocumentFile;
3592
- type index_d_DocumentNonNullableFields = DocumentNonNullableFields;
3593
- type index_d_DocumentRenderDelayed = DocumentRenderDelayed;
3594
- type index_d_DocumentRenderDelayedEnvelope = DocumentRenderDelayedEnvelope;
3595
- type index_d_DocumentRenderFailed = DocumentRenderFailed;
3596
- type index_d_DocumentRenderFailedEnvelope = DocumentRenderFailedEnvelope;
3597
- type index_d_DocumentRendered = DocumentRendered;
3598
- type index_d_DocumentRenderedEnvelope = DocumentRenderedEnvelope;
3599
- type index_d_DocumentUpdatedEnvelope = DocumentUpdatedEnvelope;
3600
- type index_d_DocumentsQueryBuilder = DocumentsQueryBuilder;
3601
- type index_d_DocumentsQueryResult = DocumentsQueryResult;
3602
- type index_d_DomainEvent = DomainEvent;
3603
- type index_d_DomainEventBodyOneOf = DomainEventBodyOneOf;
3604
- type index_d_DownloadDocumentOptions = DownloadDocumentOptions;
3605
- type index_d_DownloadDocumentRequest = DownloadDocumentRequest;
3606
- type index_d_DownloadDocumentResponse = DownloadDocumentResponse;
3607
- type index_d_DownloadDocumentResponseNonNullableFields = DownloadDocumentResponseNonNullableFields;
3608
- type index_d_DownloadDocumentSourceRequest = DownloadDocumentSourceRequest;
3609
- type index_d_DownloadDocumentSourceResponse = DownloadDocumentSourceResponse;
3610
- type index_d_DownloadDocumentSourceResponseNonNullableFields = DownloadDocumentSourceResponseNonNullableFields;
3611
- type index_d_Empty = Empty;
3612
- type index_d_EntityCreatedEvent = EntityCreatedEvent;
3613
- type index_d_EntityDeletedEvent = EntityDeletedEvent;
3614
- type index_d_EntityUpdatedEvent = EntityUpdatedEvent;
3615
- type index_d_EventMetadata = EventMetadata;
3616
- type index_d_Format = Format;
3617
- declare const index_d_Format: typeof Format;
3618
- type index_d_GetDocumentOptions = GetDocumentOptions;
3619
- type index_d_GetDocumentRequest = GetDocumentRequest;
3620
- type index_d_GetDocumentResponse = GetDocumentResponse;
3621
- type index_d_GetDocumentResponseNonNullableFields = GetDocumentResponseNonNullableFields;
3622
- type index_d_GetDownloadPageRequest = GetDownloadPageRequest;
3623
- type index_d_GetDownloadUrlOptions = GetDownloadUrlOptions;
3624
- type index_d_GetDownloadUrlRequest = GetDownloadUrlRequest;
3625
- type index_d_GetDownloadUrlRequestDocumentOneOf = GetDownloadUrlRequestDocumentOneOf;
3626
- type index_d_GetDownloadUrlResponse = GetDownloadUrlResponse;
3627
- type index_d_GetDownloadUrlResponseNonNullableFields = GetDownloadUrlResponseNonNullableFields;
3628
- type index_d_HeadersEntry = HeadersEntry;
3629
- type index_d_IdentificationData = IdentificationData;
3630
- type index_d_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
3631
- type index_d_ImageSetting = ImageSetting;
3632
- type index_d_MessageEnvelope = MessageEnvelope;
3633
- type index_d_PageSettings = PageSettings;
3634
- type index_d_Paging = Paging;
3635
- type index_d_PagingMetadataV2 = PagingMetadataV2;
3636
- type index_d_PaperSize = PaperSize;
3637
- declare const index_d_PaperSize: typeof PaperSize;
3638
- type index_d_QueryDocumentOptions = QueryDocumentOptions;
3639
- type index_d_QueryDocumentRequest = QueryDocumentRequest;
3640
- type index_d_QueryDocumentResponse = QueryDocumentResponse;
3641
- type index_d_QueryDocumentResponseNonNullableFields = QueryDocumentResponseNonNullableFields;
3642
- type index_d_QueryV2 = QueryV2;
3643
- type index_d_QueryV2PagingMethodOneOf = QueryV2PagingMethodOneOf;
3644
- type index_d_RawHttpResponse = RawHttpResponse;
3645
- type index_d_RawHttpResponseNonNullableFields = RawHttpResponseNonNullableFields;
3646
- type index_d_RenderDelayedEventConfig = RenderDelayedEventConfig;
3647
- type index_d_RenderDocumentByIdRequest = RenderDocumentByIdRequest;
3648
- type index_d_RenderDocumentRequestV2 = RenderDocumentRequestV2;
3649
- type index_d_RenderFormat = RenderFormat;
3650
- declare const index_d_RenderFormat: typeof RenderFormat;
3651
- type index_d_RenderStatus = RenderStatus;
3652
- declare const index_d_RenderStatus: typeof RenderStatus;
3653
- type index_d_RequestedFields = RequestedFields;
3654
- declare const index_d_RequestedFields: typeof RequestedFields;
3655
- type index_d_ResizeOption = ResizeOption;
3656
- declare const index_d_ResizeOption: typeof ResizeOption;
3657
- type index_d_RestoreInfo = RestoreInfo;
3658
- type index_d_SelectSetting = SelectSetting;
3659
- type index_d_SettingsGroup = SettingsGroup;
3660
- type index_d_SortOrder = SortOrder;
3661
- declare const index_d_SortOrder: typeof SortOrder;
3662
- type index_d_Sorting = Sorting;
3663
- type index_d_TemplateSettings = TemplateSettings;
3664
- type index_d_TemplateSettingsOverride = TemplateSettingsOverride;
3665
- type index_d_TextContent = TextContent;
3666
- type index_d_TextSetting = TextSetting;
3667
- type index_d_UpdateDocumentOptions = UpdateDocumentOptions;
3668
- type index_d_UpdateDocumentRequest = UpdateDocumentRequest;
3669
- type index_d_UpdateDocumentResponse = UpdateDocumentResponse;
3670
- type index_d_UpdateDocumentResponseNonNullableFields = UpdateDocumentResponseNonNullableFields;
3671
- type index_d_WebhookIdentityType = WebhookIdentityType;
3672
- declare const index_d_WebhookIdentityType: typeof WebhookIdentityType;
3673
- type index_d_WixMpClientVersion = WixMpClientVersion;
3674
- declare const index_d_WixMpClientVersion: typeof WixMpClientVersion;
3675
- declare const index_d_createDocument: typeof createDocument;
3676
- declare const index_d_deleteDocument: typeof deleteDocument;
3677
- declare const index_d_downloadDocument: typeof downloadDocument;
3678
- declare const index_d_downloadDocumentSource: typeof downloadDocumentSource;
3679
- declare const index_d_getDocument: typeof getDocument;
3680
- declare const index_d_getDownloadPage: typeof getDownloadPage;
3681
- declare const index_d_getDownloadUrl: typeof getDownloadUrl;
3682
- declare const index_d_onDocumentCreated: typeof onDocumentCreated;
3683
- declare const index_d_onDocumentDeleted: typeof onDocumentDeleted;
3684
- declare const index_d_onDocumentRenderDelayed: typeof onDocumentRenderDelayed;
3685
- declare const index_d_onDocumentRenderFailed: typeof onDocumentRenderFailed;
3686
- declare const index_d_onDocumentRendered: typeof onDocumentRendered;
3687
- declare const index_d_onDocumentUpdated: typeof onDocumentUpdated;
3688
- declare const index_d_queryDocument: typeof queryDocument;
3689
- declare const index_d_updateDocument: typeof updateDocument;
3690
- declare namespace index_d {
3691
- export { type index_d_ActionEvent as ActionEvent, type index_d_BackgroundSetting as BackgroundSetting, type index_d_BaseEventMetadata as BaseEventMetadata, type index_d_CreateDocumentOptions as CreateDocumentOptions, type index_d_CreateDocumentRequest as CreateDocumentRequest, type index_d_CreateDocumentResponse as CreateDocumentResponse, type index_d_CreateDocumentResponseNonNullableFields as CreateDocumentResponseNonNullableFields, type index_d_CursorPaging as CursorPaging, type index_d_Cursors as Cursors, type index_d_DeleteDocumentRequest as DeleteDocumentRequest, type index_d_DeleteDocumentResponse as DeleteDocumentResponse, type index_d_DeleteDocumentResponseNonNullableFields as DeleteDocumentResponseNonNullableFields, type index_d_Document as Document, type index_d_DocumentContent as DocumentContent, type index_d_DocumentCreatedEnvelope as DocumentCreatedEnvelope, type index_d_DocumentDeletedEnvelope as DocumentDeletedEnvelope, type index_d_DocumentFile as DocumentFile, type index_d_DocumentNonNullableFields as DocumentNonNullableFields, type index_d_DocumentRenderDelayed as DocumentRenderDelayed, type index_d_DocumentRenderDelayedEnvelope as DocumentRenderDelayedEnvelope, type index_d_DocumentRenderFailed as DocumentRenderFailed, type index_d_DocumentRenderFailedEnvelope as DocumentRenderFailedEnvelope, type index_d_DocumentRendered as DocumentRendered, type index_d_DocumentRenderedEnvelope as DocumentRenderedEnvelope, type index_d_DocumentUpdatedEnvelope as DocumentUpdatedEnvelope, type index_d_DocumentsQueryBuilder as DocumentsQueryBuilder, type index_d_DocumentsQueryResult as DocumentsQueryResult, type index_d_DomainEvent as DomainEvent, type index_d_DomainEventBodyOneOf as DomainEventBodyOneOf, type index_d_DownloadDocumentOptions as DownloadDocumentOptions, type index_d_DownloadDocumentRequest as DownloadDocumentRequest, type index_d_DownloadDocumentResponse as DownloadDocumentResponse, type index_d_DownloadDocumentResponseNonNullableFields as DownloadDocumentResponseNonNullableFields, type index_d_DownloadDocumentSourceRequest as DownloadDocumentSourceRequest, type index_d_DownloadDocumentSourceResponse as DownloadDocumentSourceResponse, type index_d_DownloadDocumentSourceResponseNonNullableFields as DownloadDocumentSourceResponseNonNullableFields, type index_d_Empty as Empty, type index_d_EntityCreatedEvent as EntityCreatedEvent, type index_d_EntityDeletedEvent as EntityDeletedEvent, type index_d_EntityUpdatedEvent as EntityUpdatedEvent, type index_d_EventMetadata as EventMetadata, index_d_Format as Format, type index_d_GetDocumentOptions as GetDocumentOptions, type index_d_GetDocumentRequest as GetDocumentRequest, type index_d_GetDocumentResponse as GetDocumentResponse, type index_d_GetDocumentResponseNonNullableFields as GetDocumentResponseNonNullableFields, type index_d_GetDownloadPageRequest as GetDownloadPageRequest, type index_d_GetDownloadUrlOptions as GetDownloadUrlOptions, type index_d_GetDownloadUrlRequest as GetDownloadUrlRequest, type index_d_GetDownloadUrlRequestDocumentOneOf as GetDownloadUrlRequestDocumentOneOf, type index_d_GetDownloadUrlResponse as GetDownloadUrlResponse, type index_d_GetDownloadUrlResponseNonNullableFields as GetDownloadUrlResponseNonNullableFields, type index_d_HeadersEntry as HeadersEntry, type index_d_IdentificationData as IdentificationData, type index_d_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type index_d_ImageSetting as ImageSetting, type index_d_MessageEnvelope as MessageEnvelope, type index_d_PageSettings as PageSettings, type index_d_Paging as Paging, type index_d_PagingMetadataV2 as PagingMetadataV2, index_d_PaperSize as PaperSize, type index_d_QueryDocumentOptions as QueryDocumentOptions, type index_d_QueryDocumentRequest as QueryDocumentRequest, type index_d_QueryDocumentResponse as QueryDocumentResponse, type index_d_QueryDocumentResponseNonNullableFields as QueryDocumentResponseNonNullableFields, type index_d_QueryV2 as QueryV2, type index_d_QueryV2PagingMethodOneOf as QueryV2PagingMethodOneOf, type index_d_RawHttpResponse as RawHttpResponse, type index_d_RawHttpResponseNonNullableFields as RawHttpResponseNonNullableFields, type index_d_RenderDelayedEventConfig as RenderDelayedEventConfig, type index_d_RenderDocumentByIdRequest as RenderDocumentByIdRequest, type index_d_RenderDocumentRequestV2 as RenderDocumentRequestV2, index_d_RenderFormat as RenderFormat, index_d_RenderStatus as RenderStatus, index_d_RequestedFields as RequestedFields, index_d_ResizeOption as ResizeOption, type index_d_RestoreInfo as RestoreInfo, type index_d_SelectSetting as SelectSetting, type index_d_SettingsGroup as SettingsGroup, index_d_SortOrder as SortOrder, type index_d_Sorting as Sorting, type index_d_TemplateSettings as TemplateSettings, type index_d_TemplateSettingsOverride as TemplateSettingsOverride, type index_d_TextContent as TextContent, type index_d_TextSetting as TextSetting, type index_d_UpdateDocumentOptions as UpdateDocumentOptions, type index_d_UpdateDocumentRequest as UpdateDocumentRequest, type index_d_UpdateDocumentResponse as UpdateDocumentResponse, type index_d_UpdateDocumentResponseNonNullableFields as UpdateDocumentResponseNonNullableFields, index_d_WebhookIdentityType as WebhookIdentityType, index_d_WixMpClientVersion as WixMpClientVersion, index_d_createDocument as createDocument, index_d_deleteDocument as deleteDocument, index_d_downloadDocument as downloadDocument, index_d_downloadDocumentSource as downloadDocumentSource, index_d_getDocument as getDocument, index_d_getDownloadPage as getDownloadPage, index_d_getDownloadUrl as getDownloadUrl, index_d_onDocumentCreated as onDocumentCreated, index_d_onDocumentDeleted as onDocumentDeleted, index_d_onDocumentRenderDelayed as onDocumentRenderDelayed, index_d_onDocumentRenderFailed as onDocumentRenderFailed, index_d_onDocumentRendered as onDocumentRendered, index_d_onDocumentUpdated as onDocumentUpdated, index_d_queryDocument as queryDocument, index_d_updateDocument as updateDocument };
3692
- }
3693
-
3694
- export { index_d as documents, index_d$1 as templates };