@wix/data 1.0.180 → 1.0.182

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 (44) hide show
  1. package/build/es/context.d.ts +1 -0
  2. package/build/es/context.js +1 -0
  3. package/build/es/context.js.map +1 -1
  4. package/build/es/index.d.ts +2 -2
  5. package/build/es/index.js +2 -2
  6. package/build/es/index.js.map +1 -1
  7. package/build/es/meta.d.ts +1 -1
  8. package/build/es/meta.js +1 -1
  9. package/build/es/meta.js.map +1 -1
  10. package/{build/cjs/context.d.ts → context.d.ts} +1 -0
  11. package/{build/cjs/context.js → context.js} +2 -1
  12. package/context.js.map +1 -0
  13. package/context.ts +4 -0
  14. package/{build/cjs/index.d.ts → index.d.ts} +2 -2
  15. package/{build/cjs/index.js → index.js} +3 -3
  16. package/index.js.map +1 -0
  17. package/index.ts +6 -0
  18. package/{build/cjs/meta.d.ts → meta.d.ts} +1 -1
  19. package/{build/cjs/meta.js → meta.js} +2 -2
  20. package/meta.js.map +1 -0
  21. package/meta.ts +4 -0
  22. package/package.json +35 -23
  23. package/service-plugins-context.js.map +1 -0
  24. package/service-plugins-context.ts +1 -0
  25. package/service-plugins.js.map +1 -0
  26. package/service-plugins.ts +1 -0
  27. package/build/cjs/context.js.map +0 -1
  28. package/build/cjs/index.js.map +0 -1
  29. package/build/cjs/meta.js.map +0 -1
  30. package/build/cjs/service-plugins-context.js.map +0 -1
  31. package/build/cjs/service-plugins.js.map +0 -1
  32. package/context/package.json +0 -7
  33. package/meta/package.json +0 -7
  34. package/service-plugins/context/package.json +0 -7
  35. package/service-plugins/package.json +0 -7
  36. package/type-bundles/context.bundle.d.ts +0 -2766
  37. package/type-bundles/index.bundle.d.ts +0 -4625
  38. package/type-bundles/meta.bundle.d.ts +0 -3346
  39. package/type-bundles/service-plugins-context.bundle.d.ts +0 -1330
  40. package/type-bundles/service-plugins.bundle.d.ts +0 -1330
  41. /package/{build/cjs/service-plugins-context.d.ts → service-plugins-context.d.ts} +0 -0
  42. /package/{build/cjs/service-plugins-context.js → service-plugins-context.js} +0 -0
  43. /package/{build/cjs/service-plugins.d.ts → service-plugins.d.ts} +0 -0
  44. /package/{build/cjs/service-plugins.js → service-plugins.js} +0 -0
@@ -1,4625 +0,0 @@
1
- type HostModule<T, H extends Host> = {
2
- __type: 'host';
3
- create(host: H): T;
4
- };
5
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
6
- type Host<Environment = unknown> = {
7
- channel: {
8
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
- disconnect: () => void;
10
- } | Promise<{
11
- disconnect: () => void;
12
- }>;
13
- };
14
- environment?: Environment;
15
- /**
16
- * Optional name of the environment, use for logging
17
- */
18
- name?: string;
19
- /**
20
- * Optional bast url to use for API requests, for example `www.wixapis.com`
21
- */
22
- apiBaseUrl?: string;
23
- /**
24
- * Possible data to be provided by every host, for cross cutting concerns
25
- * like internationalization, billing, etc.
26
- */
27
- essentials?: {
28
- /**
29
- * The language of the currently viewed session
30
- */
31
- language?: string;
32
- /**
33
- * The locale of the currently viewed session
34
- */
35
- locale?: string;
36
- /**
37
- * Any headers that should be passed through to the API requests
38
- */
39
- passThroughHeaders?: Record<string, string>;
40
- };
41
- };
42
-
43
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
44
- interface HttpClient$1 {
45
- request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
46
- fetchWithAuth: typeof fetch;
47
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
48
- getActiveToken?: () => string | undefined;
49
- }
50
- type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
51
- type HttpResponse$1<T = any> = {
52
- data: T;
53
- status: number;
54
- statusText: string;
55
- headers: any;
56
- request?: any;
57
- };
58
- type RequestOptions$1<_TResponse = any, Data = any> = {
59
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
60
- url: string;
61
- data?: Data;
62
- params?: URLSearchParams;
63
- } & APIMetadata$1;
64
- type APIMetadata$1 = {
65
- methodFqn?: string;
66
- entityFqdn?: string;
67
- packageName?: string;
68
- };
69
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
70
- type EventDefinition<Payload = unknown, Type extends string = string> = {
71
- __type: 'event-definition';
72
- type: Type;
73
- isDomainEvent?: boolean;
74
- transformations?: (envelope: unknown) => Payload;
75
- __payload: Payload;
76
- };
77
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
78
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
79
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
80
-
81
- type ServicePluginMethodInput = {
82
- request: any;
83
- metadata: any;
84
- };
85
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
86
- type ServicePluginMethodMetadata = {
87
- name: string;
88
- primaryHttpMappingPath: string;
89
- transformations: {
90
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
91
- toREST: (...args: unknown[]) => unknown;
92
- };
93
- };
94
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
95
- __type: 'service-plugin-definition';
96
- componentType: string;
97
- methods: ServicePluginMethodMetadata[];
98
- __contract: Contract;
99
- };
100
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
101
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
102
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
103
-
104
- type RequestContext = {
105
- isSSR: boolean;
106
- host: string;
107
- protocol?: string;
108
- };
109
- type ResponseTransformer = (data: any, headers?: any) => any;
110
- /**
111
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
112
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
113
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
114
- */
115
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
116
- type AmbassadorRequestOptions<T = any> = {
117
- _?: T;
118
- url?: string;
119
- method?: Method;
120
- params?: any;
121
- data?: any;
122
- transformResponse?: ResponseTransformer | ResponseTransformer[];
123
- };
124
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
125
- __isAmbassador: boolean;
126
- };
127
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
128
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
129
-
130
- declare global {
131
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
132
- interface SymbolConstructor {
133
- readonly observable: symbol;
134
- }
135
- }
136
-
137
- declare const emptyObjectSymbol: unique symbol;
138
-
139
- /**
140
- Represents a strictly empty plain object, the `{}` value.
141
-
142
- 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)).
143
-
144
- @example
145
- ```
146
- import type {EmptyObject} from 'type-fest';
147
-
148
- // The following illustrates the problem with `{}`.
149
- const foo1: {} = {}; // Pass
150
- const foo2: {} = []; // Pass
151
- const foo3: {} = 42; // Pass
152
- const foo4: {} = {a: 1}; // Pass
153
-
154
- // With `EmptyObject` only the first case is valid.
155
- const bar1: EmptyObject = {}; // Pass
156
- const bar2: EmptyObject = 42; // Fail
157
- const bar3: EmptyObject = []; // Fail
158
- const bar4: EmptyObject = {a: 1}; // Fail
159
- ```
160
-
161
- 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}.
162
-
163
- @category Object
164
- */
165
- type EmptyObject = {[emptyObjectSymbol]?: never};
166
-
167
- /**
168
- Returns a boolean for whether the two given types are equal.
169
-
170
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
171
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
172
-
173
- Use-cases:
174
- - If you want to make a conditional branch based on the result of a comparison of two types.
175
-
176
- @example
177
- ```
178
- import type {IsEqual} from 'type-fest';
179
-
180
- // This type returns a boolean for whether the given array includes the given item.
181
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
182
- type Includes<Value extends readonly any[], Item> =
183
- Value extends readonly [Value[0], ...infer rest]
184
- ? IsEqual<Value[0], Item> extends true
185
- ? true
186
- : Includes<rest, Item>
187
- : false;
188
- ```
189
-
190
- @category Type Guard
191
- @category Utilities
192
- */
193
- type IsEqual<A, B> =
194
- (<G>() => G extends A ? 1 : 2) extends
195
- (<G>() => G extends B ? 1 : 2)
196
- ? true
197
- : false;
198
-
199
- /**
200
- Filter out keys from an object.
201
-
202
- Returns `never` if `Exclude` is strictly equal to `Key`.
203
- Returns `never` if `Key` extends `Exclude`.
204
- Returns `Key` otherwise.
205
-
206
- @example
207
- ```
208
- type Filtered = Filter<'foo', 'foo'>;
209
- //=> never
210
- ```
211
-
212
- @example
213
- ```
214
- type Filtered = Filter<'bar', string>;
215
- //=> never
216
- ```
217
-
218
- @example
219
- ```
220
- type Filtered = Filter<'bar', 'foo'>;
221
- //=> 'bar'
222
- ```
223
-
224
- @see {Except}
225
- */
226
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
227
-
228
- type ExceptOptions = {
229
- /**
230
- Disallow assigning non-specified properties.
231
-
232
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
233
-
234
- @default false
235
- */
236
- requireExactProps?: boolean;
237
- };
238
-
239
- /**
240
- Create a type from an object type without certain keys.
241
-
242
- We recommend setting the `requireExactProps` option to `true`.
243
-
244
- 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.
245
-
246
- 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)).
247
-
248
- @example
249
- ```
250
- import type {Except} from 'type-fest';
251
-
252
- type Foo = {
253
- a: number;
254
- b: string;
255
- };
256
-
257
- type FooWithoutA = Except<Foo, 'a'>;
258
- //=> {b: string}
259
-
260
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
261
- //=> errors: 'a' does not exist in type '{ b: string; }'
262
-
263
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
264
- //=> {a: number} & Partial<Record<"b", never>>
265
-
266
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
267
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
268
- ```
269
-
270
- @category Object
271
- */
272
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
273
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
274
- } & (Options['requireExactProps'] extends true
275
- ? Partial<Record<KeysType, never>>
276
- : {});
277
-
278
- /**
279
- Returns a boolean for whether the given type is `never`.
280
-
281
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
282
- @link https://stackoverflow.com/a/53984913/10292952
283
- @link https://www.zhenghao.io/posts/ts-never
284
-
285
- Useful in type utilities, such as checking if something does not occur.
286
-
287
- @example
288
- ```
289
- import type {IsNever, And} from 'type-fest';
290
-
291
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
292
- type AreStringsEqual<A extends string, B extends string> =
293
- And<
294
- IsNever<Exclude<A, B>> extends true ? true : false,
295
- IsNever<Exclude<B, A>> extends true ? true : false
296
- >;
297
-
298
- type EndIfEqual<I extends string, O extends string> =
299
- AreStringsEqual<I, O> extends true
300
- ? never
301
- : void;
302
-
303
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
304
- if (input === output) {
305
- process.exit(0);
306
- }
307
- }
308
-
309
- endIfEqual('abc', 'abc');
310
- //=> never
311
-
312
- endIfEqual('abc', '123');
313
- //=> void
314
- ```
315
-
316
- @category Type Guard
317
- @category Utilities
318
- */
319
- type IsNever<T> = [T] extends [never] ? true : false;
320
-
321
- /**
322
- An if-else-like type that resolves depending on whether the given type is `never`.
323
-
324
- @see {@link IsNever}
325
-
326
- @example
327
- ```
328
- import type {IfNever} from 'type-fest';
329
-
330
- type ShouldBeTrue = IfNever<never>;
331
- //=> true
332
-
333
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
334
- //=> 'bar'
335
- ```
336
-
337
- @category Type Guard
338
- @category Utilities
339
- */
340
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
341
- IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
342
- );
343
-
344
- /**
345
- Extract the keys from a type where the value type of the key extends the given `Condition`.
346
-
347
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
348
-
349
- @example
350
- ```
351
- import type {ConditionalKeys} from 'type-fest';
352
-
353
- interface Example {
354
- a: string;
355
- b: string | number;
356
- c?: string;
357
- d: {};
358
- }
359
-
360
- type StringKeysOnly = ConditionalKeys<Example, string>;
361
- //=> 'a'
362
- ```
363
-
364
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
365
-
366
- @example
367
- ```
368
- import type {ConditionalKeys} from 'type-fest';
369
-
370
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
371
- //=> 'a' | 'c'
372
- ```
373
-
374
- @category Object
375
- */
376
- type ConditionalKeys<Base, Condition> =
377
- {
378
- // Map through all the keys of the given base type.
379
- [Key in keyof Base]-?:
380
- // Pick only keys with types extending the given `Condition` type.
381
- Base[Key] extends Condition
382
- // Retain this key
383
- // If the value for the key extends never, only include it if `Condition` also extends never
384
- ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
385
- // Discard this key since the condition fails.
386
- : never;
387
- // Convert the produced object into a union type of the keys which passed the conditional test.
388
- }[keyof Base];
389
-
390
- /**
391
- Exclude keys from a shape that matches the given `Condition`.
392
-
393
- 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.
394
-
395
- @example
396
- ```
397
- import type {Primitive, ConditionalExcept} from 'type-fest';
398
-
399
- class Awesome {
400
- name: string;
401
- successes: number;
402
- failures: bigint;
403
-
404
- run() {}
405
- }
406
-
407
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
408
- //=> {run: () => void}
409
- ```
410
-
411
- @example
412
- ```
413
- import type {ConditionalExcept} from 'type-fest';
414
-
415
- interface Example {
416
- a: string;
417
- b: string | number;
418
- c: () => void;
419
- d: {};
420
- }
421
-
422
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
423
- //=> {b: string | number; c: () => void; d: {}}
424
- ```
425
-
426
- @category Object
427
- */
428
- type ConditionalExcept<Base, Condition> = Except<
429
- Base,
430
- ConditionalKeys<Base, Condition>
431
- >;
432
-
433
- /**
434
- * Descriptors are objects that describe the API of a module, and the module
435
- * can either be a REST module or a host module.
436
- * This type is recursive, so it can describe nested modules.
437
- */
438
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
439
- [key: string]: Descriptors | PublicMetadata | any;
440
- };
441
- /**
442
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
443
- * and returns an object with the same structure, but with all descriptors replaced with their API.
444
- * Any non-descriptor properties are removed from the returned object, including descriptors that
445
- * do not match the given host (as they will not work with the given host).
446
- */
447
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
448
- done: T;
449
- recurse: T extends {
450
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
451
- } ? 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<{
452
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
453
- -1,
454
- 0,
455
- 1,
456
- 2,
457
- 3,
458
- 4,
459
- 5
460
- ][Depth]> : never;
461
- }, EmptyObject>;
462
- }[Depth extends -1 ? 'done' : 'recurse'];
463
- type PublicMetadata = {
464
- PACKAGE_NAME?: string;
465
- };
466
-
467
- declare global {
468
- interface ContextualClient {
469
- }
470
- }
471
- /**
472
- * A type used to create concerete types from SDK descriptors in
473
- * case a contextual client is available.
474
- */
475
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
476
- host: Host;
477
- } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
478
-
479
- /** An external database connection defines a connection between an external database and a Wix site or project. */
480
- interface ExternalDatabaseConnection {
481
- /**
482
- * Name of the external database connection.
483
- * An external database connection may connect to one or more external data collections or tables.
484
- * These are represented as `connectionName/dataCollectionId`.
485
- */
486
- name?: string;
487
- /** Base URL for provisioning and managing data in the external database. For example: `https://example.com/my-external-database`. */
488
- endpoint?: string | null;
489
- /**
490
- * Settings passed to the external database connection as part of each request.
491
- * These settings can relate to authentication, tenancy, or provide any other information needed for processing a request.
492
- * Their content and structure depend on the specific requirements of the external database's API.
493
- */
494
- configuration?: Record<string, any> | null;
495
- /**
496
- * Status of the external database connection. Includes whether the connection was established successfully, and if not, the reason for the failure.
497
- * @readonly
498
- */
499
- connectionStatus?: ConnectionStatus;
500
- /**
501
- * The external database's capabilities.
502
- * @readonly
503
- */
504
- capabilities?: Capabilities;
505
- }
506
- declare enum CauseOfFailure {
507
- /** No connection failure. */
508
- NONE = "NONE",
509
- /** General communication failure. */
510
- COMMUNICATION_FAILURE = "COMMUNICATION_FAILURE",
511
- /** External database host is unreachable. */
512
- DESTINATION_HOST_UNREACHABLE = "DESTINATION_HOST_UNREACHABLE",
513
- /** Unauthorized to access the external database. */
514
- UNAUTHORIZED = "UNAUTHORIZED",
515
- /** `endpoint` is not set. */
516
- DESTINATION_ENDPOINT_NOT_DEFINED = "DESTINATION_ENDPOINT_NOT_DEFINED"
517
- }
518
- declare enum CollectionsFound {
519
- /** Attempt to connect to the external database failed, so status is unknown. */
520
- UNKNOWN = "UNKNOWN",
521
- /** External database has existing collections. */
522
- YES = "YES",
523
- /** External database does not have any existing collections. */
524
- NO = "NO"
525
- }
526
- declare enum FieldType {
527
- UNKNOWN_FIELD_TYPE = "UNKNOWN_FIELD_TYPE",
528
- TEXT = "TEXT",
529
- NUMBER = "NUMBER",
530
- DATE = "DATE",
531
- DATETIME = "DATETIME",
532
- IMAGE = "IMAGE",
533
- BOOLEAN = "BOOLEAN",
534
- DOCUMENT = "DOCUMENT",
535
- URL = "URL",
536
- RICH_TEXT = "RICH_TEXT",
537
- VIDEO = "VIDEO",
538
- ANY = "ANY",
539
- ARRAY_STRING = "ARRAY_STRING",
540
- ARRAY_DOCUMENT = "ARRAY_DOCUMENT",
541
- AUDIO = "AUDIO",
542
- TIME = "TIME",
543
- LANGUAGE = "LANGUAGE",
544
- RICH_CONTENT = "RICH_CONTENT",
545
- MEDIA_GALLERY = "MEDIA_GALLERY",
546
- ADDRESS = "ADDRESS",
547
- PAGE_LINK = "PAGE_LINK",
548
- REFERENCE = "REFERENCE",
549
- MULTI_REFERENCE = "MULTI_REFERENCE",
550
- OBJECT = "OBJECT",
551
- ARRAY = "ARRAY",
552
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
553
- LEGACY_TIME = "LEGACY_TIME",
554
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
555
- LEGACY_BOOK = "LEGACY_BOOK",
556
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
557
- LEGACY_EXTERNAL_URL = "LEGACY_EXTERNAL_URL",
558
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
559
- LEGACY_BROKEN_REFERENCE = "LEGACY_BROKEN_REFERENCE",
560
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
561
- LEGACY_IMAGE = "LEGACY_IMAGE",
562
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
563
- LEGACY_COLOR = "LEGACY_COLOR",
564
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
565
- LEGACY_EXTERNAL_VIDEO = "LEGACY_EXTERNAL_VIDEO"
566
- }
567
- interface ConnectionStatus {
568
- /** Whether the connection was established successfully. */
569
- successful?: boolean;
570
- /** Whether and why a connection attempt failed. */
571
- causeOfFailure?: CauseOfFailure;
572
- /**
573
- * Whether the external database has existing collections.
574
- * @readonly
575
- */
576
- hasCollections?: CollectionsFound;
577
- }
578
- declare enum ProtocolVersion {
579
- UNKNOWN_PROTOCOL_VERSION = "UNKNOWN_PROTOCOL_VERSION",
580
- V1 = "V1",
581
- V2 = "V2",
582
- V3 = "V3"
583
- }
584
- interface Capabilities {
585
- /** Whether the external database supports creating new collections, updating the structure of existing collections, or deleting them. */
586
- collectionModificationsSupported?: boolean;
587
- /**
588
- * Field types the external database supports.
589
- * This field only applies when `collectionModificationsSupported` is `true`.
590
- */
591
- fieldTypes?: FieldType[];
592
- }
593
- interface GetExternalDatabaseConnectionRequest {
594
- /** Name of the external database connection to retrieve. */
595
- name: string;
596
- }
597
- interface GetExternalDatabaseConnectionResponse {
598
- /** Details of the external database connection requested. */
599
- externalDatabaseConnection?: ExternalDatabaseConnection;
600
- }
601
- interface ListExternalDatabaseConnectionsRequest {
602
- /** Paging */
603
- paging?: Paging$2;
604
- }
605
- interface Paging$2 {
606
- /** Number of items to load. */
607
- limit?: number | null;
608
- /** Number of items to skip in the current sort order. */
609
- offset?: number | null;
610
- }
611
- interface ListExternalDatabaseConnectionsResponse {
612
- /** List of external database connections. */
613
- externalDatabaseConnections?: ExternalDatabaseConnection[];
614
- /** Paging metadata */
615
- pagingMetadata?: PagingMetadata$1;
616
- }
617
- interface PagingMetadata$1 {
618
- /** Number of items returned in the response. */
619
- count?: number | null;
620
- /** Offset that was requested. */
621
- offset?: number | null;
622
- /** Total number of items that match the query. */
623
- total?: number | null;
624
- /** Flag that indicates the server failed to calculate the `total` field. */
625
- tooManyToCount?: boolean | null;
626
- }
627
- interface CreateExternalDatabaseConnectionRequest {
628
- /** External database connection details. */
629
- externalDatabaseConnection: ExternalDatabaseConnection;
630
- /** Connection type. */
631
- connectionType: ConnectionType;
632
- }
633
- declare enum ConnectionType {
634
- /** Unknown connection type. */
635
- UNKNOWN_CONNECTION_TYPE = "UNKNOWN_CONNECTION_TYPE",
636
- /**
637
- * Connection to database adapter that implements legacy External Database Collections SPI (protocol version 1 or 2)
638
- * https://www.wix.com/velo/reference/spis/external-database-collections/introduction
639
- */
640
- STANDALONE = "STANDALONE",
641
- /**
642
- * Connection to database adapter that implements External Database SPI (protocol version 3)
643
- * https://dev.wix.com/docs/rest/internal-only/wix-data/external-database-spi/introduction
644
- * https://dev.wix.com/docs/rest/articles/getting-started/service-provider-interface
645
- */
646
- WIX_SPI = "WIX_SPI"
647
- }
648
- interface CreateExternalDatabaseConnectionResponse {
649
- /** Details of external database connection created. */
650
- externalDatabaseConnection?: ExternalDatabaseConnection;
651
- }
652
- interface UpdateExternalDatabaseConnectionRequest {
653
- /** Updated external database connection details. The existing connection is replaced with this version. */
654
- externalDatabaseConnection: ExternalDatabaseConnection;
655
- }
656
- interface UpdateExternalDatabaseConnectionResponse {
657
- /** Updated external database connection details. */
658
- externalDatabaseConnection?: ExternalDatabaseConnection;
659
- }
660
- interface DeleteExternalDatabaseConnectionRequest {
661
- /** Name of the external database connection to delete. */
662
- name: string;
663
- }
664
- interface DeleteExternalDatabaseConnectionResponse {
665
- }
666
- interface DomainEvent$1 extends DomainEventBodyOneOf$1 {
667
- createdEvent?: EntityCreatedEvent$1;
668
- updatedEvent?: EntityUpdatedEvent$1;
669
- deletedEvent?: EntityDeletedEvent$1;
670
- actionEvent?: ActionEvent$1;
671
- /**
672
- * Unique event ID.
673
- * Allows clients to ignore duplicate webhooks.
674
- */
675
- _id?: string;
676
- /**
677
- * Assumes actions are also always typed to an entity_type
678
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
679
- */
680
- entityFqdn?: string;
681
- /**
682
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
683
- * This is although the created/updated/deleted notion is duplication of the oneof types
684
- * Example: created/updated/deleted/started/completed/email_opened
685
- */
686
- slug?: string;
687
- /** ID of the entity associated with the event. */
688
- entityId?: string;
689
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
690
- eventTime?: Date | null;
691
- /**
692
- * Whether the event was triggered as a result of a privacy regulation application
693
- * (for example, GDPR).
694
- */
695
- triggeredByAnonymizeRequest?: boolean | null;
696
- /** If present, indicates the action that triggered the event. */
697
- originatedFrom?: string | null;
698
- /**
699
- * A sequence number defining the order of updates to the underlying entity.
700
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
701
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
702
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
703
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
704
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
705
- */
706
- entityEventSequence?: string | null;
707
- }
708
- /** @oneof */
709
- interface DomainEventBodyOneOf$1 {
710
- createdEvent?: EntityCreatedEvent$1;
711
- updatedEvent?: EntityUpdatedEvent$1;
712
- deletedEvent?: EntityDeletedEvent$1;
713
- actionEvent?: ActionEvent$1;
714
- }
715
- interface EntityCreatedEvent$1 {
716
- entity?: string;
717
- }
718
- interface RestoreInfo$1 {
719
- deletedDate?: Date | null;
720
- }
721
- interface EntityUpdatedEvent$1 {
722
- /**
723
- * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
724
- * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
725
- * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
726
- */
727
- currentEntity?: string;
728
- }
729
- interface EntityDeletedEvent$1 {
730
- /** Entity that was deleted */
731
- deletedEntity?: string | null;
732
- }
733
- interface ActionEvent$1 {
734
- body?: string;
735
- }
736
- interface MessageEnvelope$1 {
737
- /** App instance ID. */
738
- instanceId?: string | null;
739
- /** Event type. */
740
- eventType?: string;
741
- /** The identification type and identity data. */
742
- identity?: IdentificationData$1;
743
- /** Stringify payload. */
744
- data?: string;
745
- }
746
- interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
747
- /** ID of a site visitor that has not logged in to the site. */
748
- anonymousVisitorId?: string;
749
- /** ID of a site visitor that has logged in to the site. */
750
- memberId?: string;
751
- /** ID of a Wix user (site owner, contributor, etc.). */
752
- wixUserId?: string;
753
- /** ID of an app. */
754
- appId?: string;
755
- /** @readonly */
756
- identityType?: WebhookIdentityType$1;
757
- }
758
- /** @oneof */
759
- interface IdentificationDataIdOneOf$1 {
760
- /** ID of a site visitor that has not logged in to the site. */
761
- anonymousVisitorId?: string;
762
- /** ID of a site visitor that has logged in to the site. */
763
- memberId?: string;
764
- /** ID of a Wix user (site owner, contributor, etc.). */
765
- wixUserId?: string;
766
- /** ID of an app. */
767
- appId?: string;
768
- }
769
- declare enum WebhookIdentityType$1 {
770
- UNKNOWN = "UNKNOWN",
771
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
772
- MEMBER = "MEMBER",
773
- WIX_USER = "WIX_USER",
774
- APP = "APP"
775
- }
776
- interface ConnectionStatusNonNullableFields {
777
- successful: boolean;
778
- causeOfFailure: CauseOfFailure;
779
- hasCollections: CollectionsFound;
780
- }
781
- interface CapabilitiesNonNullableFields {
782
- collectionModificationsSupported: boolean;
783
- fieldTypes: FieldType[];
784
- }
785
- interface ExternalDatabaseConnectionNonNullableFields {
786
- name: string;
787
- connectionStatus?: ConnectionStatusNonNullableFields;
788
- protocolVersion: ProtocolVersion;
789
- capabilities?: CapabilitiesNonNullableFields;
790
- }
791
- interface GetExternalDatabaseConnectionResponseNonNullableFields {
792
- externalDatabaseConnection?: ExternalDatabaseConnectionNonNullableFields;
793
- }
794
- interface ListExternalDatabaseConnectionsResponseNonNullableFields {
795
- externalDatabaseConnections: ExternalDatabaseConnectionNonNullableFields[];
796
- }
797
- interface CreateExternalDatabaseConnectionResponseNonNullableFields {
798
- externalDatabaseConnection?: ExternalDatabaseConnectionNonNullableFields;
799
- }
800
- interface UpdateExternalDatabaseConnectionResponseNonNullableFields {
801
- externalDatabaseConnection?: ExternalDatabaseConnectionNonNullableFields;
802
- }
803
- interface BaseEventMetadata {
804
- /** App instance ID. */
805
- instanceId?: string | null;
806
- /** Event type. */
807
- eventType?: string;
808
- /** The identification type and identity data. */
809
- identity?: IdentificationData$1;
810
- }
811
- interface EventMetadata extends BaseEventMetadata {
812
- /**
813
- * Unique event ID.
814
- * Allows clients to ignore duplicate webhooks.
815
- */
816
- _id?: string;
817
- /**
818
- * Assumes actions are also always typed to an entity_type
819
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
820
- */
821
- entityFqdn?: string;
822
- /**
823
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
824
- * This is although the created/updated/deleted notion is duplication of the oneof types
825
- * Example: created/updated/deleted/started/completed/email_opened
826
- */
827
- slug?: string;
828
- /** ID of the entity associated with the event. */
829
- entityId?: string;
830
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
831
- eventTime?: Date | null;
832
- /**
833
- * Whether the event was triggered as a result of a privacy regulation application
834
- * (for example, GDPR).
835
- */
836
- triggeredByAnonymizeRequest?: boolean | null;
837
- /** If present, indicates the action that triggered the event. */
838
- originatedFrom?: string | null;
839
- /**
840
- * A sequence number defining the order of updates to the underlying entity.
841
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
842
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
843
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
844
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
845
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
846
- */
847
- entityEventSequence?: string | null;
848
- }
849
- interface ExternalDatabaseConnectionCreatedEnvelope {
850
- entity: ExternalDatabaseConnection;
851
- metadata: EventMetadata;
852
- }
853
- interface ExternalDatabaseConnectionDeletedEnvelope {
854
- metadata: EventMetadata;
855
- }
856
- interface ExternalDatabaseConnectionUpdatedEnvelope {
857
- entity: ExternalDatabaseConnection;
858
- metadata: EventMetadata;
859
- }
860
- interface ListExternalDatabaseConnectionsOptions {
861
- /** Paging */
862
- paging?: Paging$2;
863
- }
864
- interface CreateExternalDatabaseConnectionOptions {
865
- /** Connection type. */
866
- connectionType: ConnectionType;
867
- }
868
- interface UpdateExternalDatabaseConnection {
869
- /** Base URL for provisioning and managing data in the external database. For example: `https://example.com/my-external-database`. */
870
- endpoint?: string | null;
871
- /**
872
- * Settings passed to the external database connection as part of each request.
873
- * These settings can relate to authentication, tenancy, or provide any other information needed for processing a request.
874
- * Their content and structure depend on the specific requirements of the external database's API.
875
- */
876
- configuration?: Record<string, any> | null;
877
- /**
878
- * Status of the external database connection. Includes whether the connection was established successfully, and if not, the reason for the failure.
879
- * @readonly
880
- */
881
- connectionStatus?: ConnectionStatus;
882
- /**
883
- * The external database's capabilities.
884
- * @readonly
885
- */
886
- capabilities?: Capabilities;
887
- }
888
-
889
- declare function getExternalDatabaseConnection$1(httpClient: HttpClient$1): GetExternalDatabaseConnectionSignature;
890
- interface GetExternalDatabaseConnectionSignature {
891
- /**
892
- * Retrieves an external database connection by name.
893
- * @param - Name of the external database connection to retrieve.
894
- * @returns Details of the external database connection requested.
895
- */
896
- (name: string): Promise<ExternalDatabaseConnection & ExternalDatabaseConnectionNonNullableFields>;
897
- }
898
- declare function listExternalDatabaseConnections$1(httpClient: HttpClient$1): ListExternalDatabaseConnectionsSignature;
899
- interface ListExternalDatabaseConnectionsSignature {
900
- /**
901
- * Retrieves a list of all external database collections associated with the site or project.
902
- */
903
- (options?: ListExternalDatabaseConnectionsOptions | undefined): Promise<ListExternalDatabaseConnectionsResponse & ListExternalDatabaseConnectionsResponseNonNullableFields>;
904
- }
905
- declare function createExternalDatabaseConnection$1(httpClient: HttpClient$1): CreateExternalDatabaseConnectionSignature;
906
- interface CreateExternalDatabaseConnectionSignature {
907
- /**
908
- * Creates a new external database connection.
909
- *
910
- * The `externalDatabaseConnection` parameter must include a `name`, `endpoint`, and `configuration` details for the external database.
911
- * If any of these are missing, the external database connection isn't created.
912
- * @param - External database connection details.
913
- * @param - Options for creating an external database connection.
914
- * @returns Details of external database connection created.
915
- */
916
- (externalDatabaseConnection: ExternalDatabaseConnection, options: CreateExternalDatabaseConnectionOptions): Promise<ExternalDatabaseConnection & ExternalDatabaseConnectionNonNullableFields>;
917
- }
918
- declare function updateExternalDatabaseConnection$1(httpClient: HttpClient$1): UpdateExternalDatabaseConnectionSignature;
919
- interface UpdateExternalDatabaseConnectionSignature {
920
- /**
921
- * Updates an external database connection.
922
- *
923
- * An external database collection name must be provided in `name`.
924
- * If an existing external database connection is found with the same name, that connection's details are updated.
925
- * If no external database connection has that name, the request fails.
926
- *
927
- * > **Note:** After an external database connection is updated, it only contains the values provided in the request. All previous values are lost.
928
- * @param - Name of the external database connection.
929
- * An external database connection may connect to one or more external data collections or tables.
930
- * These are represented as `connectionName/dataCollectionId`.
931
- * @param - Options for updating an external database connection.
932
- * @param - Updated external database connection details. The existing connection is replaced with this version.
933
- * @returns Updated external database connection details.
934
- */
935
- (name: string, externalDatabaseConnection: UpdateExternalDatabaseConnection): Promise<ExternalDatabaseConnection & ExternalDatabaseConnectionNonNullableFields>;
936
- }
937
- declare function deleteExternalDatabaseConnection$1(httpClient: HttpClient$1): DeleteExternalDatabaseConnectionSignature;
938
- interface DeleteExternalDatabaseConnectionSignature {
939
- /**
940
- * Deletes an external database connection.
941
- *
942
- * > **Note:** Once an external database connection is deleted, it can't be restored. To reconnect the database you need to create a new external database connection.
943
- * @param - Name of the external database connection to delete.
944
- */
945
- (name: string): Promise<void>;
946
- }
947
- declare const onExternalDatabaseConnectionCreated$1: EventDefinition<ExternalDatabaseConnectionCreatedEnvelope, "wix.data.v1.external_database_connection_created">;
948
- declare const onExternalDatabaseConnectionDeleted$1: EventDefinition<ExternalDatabaseConnectionDeletedEnvelope, "wix.data.v1.external_database_connection_deleted">;
949
- declare const onExternalDatabaseConnectionUpdated$1: EventDefinition<ExternalDatabaseConnectionUpdatedEnvelope, "wix.data.v1.external_database_connection_updated">;
950
-
951
- declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
952
-
953
- declare const getExternalDatabaseConnection: MaybeContext<BuildRESTFunction<typeof getExternalDatabaseConnection$1> & typeof getExternalDatabaseConnection$1>;
954
- declare const listExternalDatabaseConnections: MaybeContext<BuildRESTFunction<typeof listExternalDatabaseConnections$1> & typeof listExternalDatabaseConnections$1>;
955
- declare const createExternalDatabaseConnection: MaybeContext<BuildRESTFunction<typeof createExternalDatabaseConnection$1> & typeof createExternalDatabaseConnection$1>;
956
- declare const updateExternalDatabaseConnection: MaybeContext<BuildRESTFunction<typeof updateExternalDatabaseConnection$1> & typeof updateExternalDatabaseConnection$1>;
957
- declare const deleteExternalDatabaseConnection: MaybeContext<BuildRESTFunction<typeof deleteExternalDatabaseConnection$1> & typeof deleteExternalDatabaseConnection$1>;
958
-
959
- type _publicOnExternalDatabaseConnectionCreatedType = typeof onExternalDatabaseConnectionCreated$1;
960
- /**
961
- * Triggered when an external database connection is created.
962
- */
963
- declare const onExternalDatabaseConnectionCreated: ReturnType<typeof createEventModule<_publicOnExternalDatabaseConnectionCreatedType>>;
964
-
965
- type _publicOnExternalDatabaseConnectionDeletedType = typeof onExternalDatabaseConnectionDeleted$1;
966
- /**
967
- * Triggered when an external database connection is deleted.
968
- */
969
- declare const onExternalDatabaseConnectionDeleted: ReturnType<typeof createEventModule<_publicOnExternalDatabaseConnectionDeletedType>>;
970
-
971
- type _publicOnExternalDatabaseConnectionUpdatedType = typeof onExternalDatabaseConnectionUpdated$1;
972
- /**
973
- * Triggered when an external database connection is updated.
974
- */
975
- declare const onExternalDatabaseConnectionUpdated: ReturnType<typeof createEventModule<_publicOnExternalDatabaseConnectionUpdatedType>>;
976
-
977
- type index_d$3_BaseEventMetadata = BaseEventMetadata;
978
- type index_d$3_Capabilities = Capabilities;
979
- type index_d$3_CauseOfFailure = CauseOfFailure;
980
- declare const index_d$3_CauseOfFailure: typeof CauseOfFailure;
981
- type index_d$3_CollectionsFound = CollectionsFound;
982
- declare const index_d$3_CollectionsFound: typeof CollectionsFound;
983
- type index_d$3_ConnectionStatus = ConnectionStatus;
984
- type index_d$3_ConnectionType = ConnectionType;
985
- declare const index_d$3_ConnectionType: typeof ConnectionType;
986
- type index_d$3_CreateExternalDatabaseConnectionOptions = CreateExternalDatabaseConnectionOptions;
987
- type index_d$3_CreateExternalDatabaseConnectionRequest = CreateExternalDatabaseConnectionRequest;
988
- type index_d$3_CreateExternalDatabaseConnectionResponse = CreateExternalDatabaseConnectionResponse;
989
- type index_d$3_CreateExternalDatabaseConnectionResponseNonNullableFields = CreateExternalDatabaseConnectionResponseNonNullableFields;
990
- type index_d$3_DeleteExternalDatabaseConnectionRequest = DeleteExternalDatabaseConnectionRequest;
991
- type index_d$3_DeleteExternalDatabaseConnectionResponse = DeleteExternalDatabaseConnectionResponse;
992
- type index_d$3_EventMetadata = EventMetadata;
993
- type index_d$3_ExternalDatabaseConnection = ExternalDatabaseConnection;
994
- type index_d$3_ExternalDatabaseConnectionCreatedEnvelope = ExternalDatabaseConnectionCreatedEnvelope;
995
- type index_d$3_ExternalDatabaseConnectionDeletedEnvelope = ExternalDatabaseConnectionDeletedEnvelope;
996
- type index_d$3_ExternalDatabaseConnectionNonNullableFields = ExternalDatabaseConnectionNonNullableFields;
997
- type index_d$3_ExternalDatabaseConnectionUpdatedEnvelope = ExternalDatabaseConnectionUpdatedEnvelope;
998
- type index_d$3_FieldType = FieldType;
999
- declare const index_d$3_FieldType: typeof FieldType;
1000
- type index_d$3_GetExternalDatabaseConnectionRequest = GetExternalDatabaseConnectionRequest;
1001
- type index_d$3_GetExternalDatabaseConnectionResponse = GetExternalDatabaseConnectionResponse;
1002
- type index_d$3_GetExternalDatabaseConnectionResponseNonNullableFields = GetExternalDatabaseConnectionResponseNonNullableFields;
1003
- type index_d$3_ListExternalDatabaseConnectionsOptions = ListExternalDatabaseConnectionsOptions;
1004
- type index_d$3_ListExternalDatabaseConnectionsRequest = ListExternalDatabaseConnectionsRequest;
1005
- type index_d$3_ListExternalDatabaseConnectionsResponse = ListExternalDatabaseConnectionsResponse;
1006
- type index_d$3_ListExternalDatabaseConnectionsResponseNonNullableFields = ListExternalDatabaseConnectionsResponseNonNullableFields;
1007
- type index_d$3_ProtocolVersion = ProtocolVersion;
1008
- declare const index_d$3_ProtocolVersion: typeof ProtocolVersion;
1009
- type index_d$3_UpdateExternalDatabaseConnection = UpdateExternalDatabaseConnection;
1010
- type index_d$3_UpdateExternalDatabaseConnectionRequest = UpdateExternalDatabaseConnectionRequest;
1011
- type index_d$3_UpdateExternalDatabaseConnectionResponse = UpdateExternalDatabaseConnectionResponse;
1012
- type index_d$3_UpdateExternalDatabaseConnectionResponseNonNullableFields = UpdateExternalDatabaseConnectionResponseNonNullableFields;
1013
- type index_d$3__publicOnExternalDatabaseConnectionCreatedType = _publicOnExternalDatabaseConnectionCreatedType;
1014
- type index_d$3__publicOnExternalDatabaseConnectionDeletedType = _publicOnExternalDatabaseConnectionDeletedType;
1015
- type index_d$3__publicOnExternalDatabaseConnectionUpdatedType = _publicOnExternalDatabaseConnectionUpdatedType;
1016
- declare const index_d$3_createExternalDatabaseConnection: typeof createExternalDatabaseConnection;
1017
- declare const index_d$3_deleteExternalDatabaseConnection: typeof deleteExternalDatabaseConnection;
1018
- declare const index_d$3_getExternalDatabaseConnection: typeof getExternalDatabaseConnection;
1019
- declare const index_d$3_listExternalDatabaseConnections: typeof listExternalDatabaseConnections;
1020
- declare const index_d$3_onExternalDatabaseConnectionCreated: typeof onExternalDatabaseConnectionCreated;
1021
- declare const index_d$3_onExternalDatabaseConnectionDeleted: typeof onExternalDatabaseConnectionDeleted;
1022
- declare const index_d$3_onExternalDatabaseConnectionUpdated: typeof onExternalDatabaseConnectionUpdated;
1023
- declare const index_d$3_updateExternalDatabaseConnection: typeof updateExternalDatabaseConnection;
1024
- declare namespace index_d$3 {
1025
- export { type ActionEvent$1 as ActionEvent, type index_d$3_BaseEventMetadata as BaseEventMetadata, type index_d$3_Capabilities as Capabilities, index_d$3_CauseOfFailure as CauseOfFailure, index_d$3_CollectionsFound as CollectionsFound, type index_d$3_ConnectionStatus as ConnectionStatus, index_d$3_ConnectionType as ConnectionType, type index_d$3_CreateExternalDatabaseConnectionOptions as CreateExternalDatabaseConnectionOptions, type index_d$3_CreateExternalDatabaseConnectionRequest as CreateExternalDatabaseConnectionRequest, type index_d$3_CreateExternalDatabaseConnectionResponse as CreateExternalDatabaseConnectionResponse, type index_d$3_CreateExternalDatabaseConnectionResponseNonNullableFields as CreateExternalDatabaseConnectionResponseNonNullableFields, type index_d$3_DeleteExternalDatabaseConnectionRequest as DeleteExternalDatabaseConnectionRequest, type index_d$3_DeleteExternalDatabaseConnectionResponse as DeleteExternalDatabaseConnectionResponse, 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 index_d$3_EventMetadata as EventMetadata, type index_d$3_ExternalDatabaseConnection as ExternalDatabaseConnection, type index_d$3_ExternalDatabaseConnectionCreatedEnvelope as ExternalDatabaseConnectionCreatedEnvelope, type index_d$3_ExternalDatabaseConnectionDeletedEnvelope as ExternalDatabaseConnectionDeletedEnvelope, type index_d$3_ExternalDatabaseConnectionNonNullableFields as ExternalDatabaseConnectionNonNullableFields, type index_d$3_ExternalDatabaseConnectionUpdatedEnvelope as ExternalDatabaseConnectionUpdatedEnvelope, index_d$3_FieldType as FieldType, type index_d$3_GetExternalDatabaseConnectionRequest as GetExternalDatabaseConnectionRequest, type index_d$3_GetExternalDatabaseConnectionResponse as GetExternalDatabaseConnectionResponse, type index_d$3_GetExternalDatabaseConnectionResponseNonNullableFields as GetExternalDatabaseConnectionResponseNonNullableFields, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type index_d$3_ListExternalDatabaseConnectionsOptions as ListExternalDatabaseConnectionsOptions, type index_d$3_ListExternalDatabaseConnectionsRequest as ListExternalDatabaseConnectionsRequest, type index_d$3_ListExternalDatabaseConnectionsResponse as ListExternalDatabaseConnectionsResponse, type index_d$3_ListExternalDatabaseConnectionsResponseNonNullableFields as ListExternalDatabaseConnectionsResponseNonNullableFields, type MessageEnvelope$1 as MessageEnvelope, type Paging$2 as Paging, type PagingMetadata$1 as PagingMetadata, index_d$3_ProtocolVersion as ProtocolVersion, type RestoreInfo$1 as RestoreInfo, type index_d$3_UpdateExternalDatabaseConnection as UpdateExternalDatabaseConnection, type index_d$3_UpdateExternalDatabaseConnectionRequest as UpdateExternalDatabaseConnectionRequest, type index_d$3_UpdateExternalDatabaseConnectionResponse as UpdateExternalDatabaseConnectionResponse, type index_d$3_UpdateExternalDatabaseConnectionResponseNonNullableFields as UpdateExternalDatabaseConnectionResponseNonNullableFields, WebhookIdentityType$1 as WebhookIdentityType, type index_d$3__publicOnExternalDatabaseConnectionCreatedType as _publicOnExternalDatabaseConnectionCreatedType, type index_d$3__publicOnExternalDatabaseConnectionDeletedType as _publicOnExternalDatabaseConnectionDeletedType, type index_d$3__publicOnExternalDatabaseConnectionUpdatedType as _publicOnExternalDatabaseConnectionUpdatedType, index_d$3_createExternalDatabaseConnection as createExternalDatabaseConnection, index_d$3_deleteExternalDatabaseConnection as deleteExternalDatabaseConnection, index_d$3_getExternalDatabaseConnection as getExternalDatabaseConnection, index_d$3_listExternalDatabaseConnections as listExternalDatabaseConnections, index_d$3_onExternalDatabaseConnectionCreated as onExternalDatabaseConnectionCreated, index_d$3_onExternalDatabaseConnectionDeleted as onExternalDatabaseConnectionDeleted, index_d$3_onExternalDatabaseConnectionUpdated as onExternalDatabaseConnectionUpdated, onExternalDatabaseConnectionCreated$1 as publicOnExternalDatabaseConnectionCreated, onExternalDatabaseConnectionDeleted$1 as publicOnExternalDatabaseConnectionDeleted, onExternalDatabaseConnectionUpdated$1 as publicOnExternalDatabaseConnectionUpdated, index_d$3_updateExternalDatabaseConnection as updateExternalDatabaseConnection };
1026
- }
1027
-
1028
- /** A data collection determines the structure of data to be stored in a database. */
1029
- interface DataCollection {
1030
- /** Collection ID. For example, `my-first-collection`. May include a namespace. */
1031
- _id?: string;
1032
- /**
1033
- * Collection type. Indicates how the collection was created and how it is stored.
1034
- * @readonly
1035
- */
1036
- collectionType?: CollectionType;
1037
- /**
1038
- * ID of the app that defined this collection. For collections defined by Wix users, this value is null.
1039
- * @readonly
1040
- */
1041
- ownerAppId?: string | null;
1042
- /**
1043
- * Maximum number of items returned in a single query, based on the underlying storage.
1044
- * Native collections have a maximum page size of 1000 for offset-based queries or 100 for cursor-based queries.
1045
- * External collections' maximum page size defaults to 50, but an external provider can set any maximum value up to 1000.
1046
- * @readonly
1047
- */
1048
- maxPageSize?: number | null;
1049
- /** Collection's display name as shown in the CMS. For example, `My First Collection`. */
1050
- displayName?: string | null;
1051
- /**
1052
- * Default item sorting order when a query doesn't specify one.
1053
- * @readonly
1054
- */
1055
- defaultDisplayOrder?: Sort;
1056
- /**
1057
- * UI-friendly namespace of the Wix app with which the data collection is associated, such as Stores or Bookings.
1058
- * Empty for all data collections not owned by Wix apps.
1059
- * @readonly
1060
- */
1061
- displayNamespace?: string | null;
1062
- /** Field whose value the CMS displays to represent the collection item when referenced in a different collection. */
1063
- displayField?: string | null;
1064
- /**
1065
- * Capabilities the collection supports.
1066
- * @readonly
1067
- */
1068
- capabilities?: CollectionCapabilities;
1069
- /** Collection's field structure. */
1070
- fields?: Field$1[];
1071
- /** Levels of permission for accessing and modifying data, defined by lowest role needed to perform each action. */
1072
- permissions?: Permissions;
1073
- /**
1074
- * Collection's current revision number, which increments each time the collection is updated. For an update operation to succeed, you must specify the latest revision number.
1075
- * @readonly
1076
- */
1077
- revision?: string | null;
1078
- /** Plugins the collection uses. Plugins apply additional capabilities to the collection or extend its functionality. */
1079
- plugins?: Plugin[];
1080
- /**
1081
- * Paging modes the collection supports. In native collections, offset-based paging is supported by default.
1082
- * @readonly
1083
- */
1084
- pagingModes?: PagingMode[];
1085
- /**
1086
- * Date the collection was created.
1087
- * @readonly
1088
- */
1089
- _createdDate?: Date | null;
1090
- /**
1091
- * Date the collection was last updated.
1092
- * @readonly
1093
- */
1094
- _updatedDate?: Date | null;
1095
- }
1096
- declare enum CollectionType {
1097
- /** User-created collection. */
1098
- NATIVE = "NATIVE",
1099
- /** [Collection](https://support.wix.com/en/article/velo-working-with-wix-app-collections-and-code#what-are-wix-app-collections) created by a Wix app when it is installed. This type of collection can be modified dynamically by that app (for example, Wix Forms). */
1100
- WIX_APP = "WIX_APP",
1101
- /** Collection created by a Wix Blocks app. */
1102
- BLOCKS_APP = "BLOCKS_APP",
1103
- /** Collection located in externally connected storage. */
1104
- EXTERNAL = "EXTERNAL"
1105
- }
1106
- interface Sort {
1107
- /** Field to sort by. */
1108
- fieldKey?: string;
1109
- /**
1110
- * Sort order. Use `ASC` for ascending order or `DESC` for descending order.
1111
- *
1112
- * Default: `ASC`
1113
- */
1114
- direction?: Direction;
1115
- }
1116
- declare enum Direction {
1117
- ASC = "ASC",
1118
- DESC = "DESC"
1119
- }
1120
- interface CollectionCapabilities {
1121
- /**
1122
- * Data operations the collection supports. The listed operations can be performed on data the collection contains.
1123
- *
1124
- * > **Note**: The `PATCH` and `BULK_PATCH` oeprations aren't currently supported.
1125
- */
1126
- dataOperations?: DataOperation[];
1127
- /** Collection operations supported. The listed operations can be performed on the collection itself. */
1128
- collectionOperations?: CollectionOperation[];
1129
- /** Maximum number of indexes for the collection. */
1130
- indexLimits?: IndexLimits;
1131
- }
1132
- declare enum DataOperation {
1133
- AGGREGATE = "AGGREGATE",
1134
- BULK_INSERT = "BULK_INSERT",
1135
- BULK_REMOVE = "BULK_REMOVE",
1136
- BULK_SAVE = "BULK_SAVE",
1137
- BULK_UPDATE = "BULK_UPDATE",
1138
- COUNT = "COUNT",
1139
- DISTINCT = "DISTINCT",
1140
- FIND = "FIND",
1141
- GET = "GET",
1142
- INSERT = "INSERT",
1143
- INSERT_REFERENCE = "INSERT_REFERENCE",
1144
- IS_REFERENCED = "IS_REFERENCED",
1145
- QUERY_REFERENCED = "QUERY_REFERENCED",
1146
- REMOVE = "REMOVE",
1147
- REMOVE_REFERENCE = "REMOVE_REFERENCE",
1148
- REPLACE_REFERENCES = "REPLACE_REFERENCES",
1149
- SAVE = "SAVE",
1150
- TRUNCATE = "TRUNCATE",
1151
- UPDATE = "UPDATE",
1152
- PATCH = "PATCH",
1153
- BULK_PATCH = "BULK_PATCH"
1154
- }
1155
- declare enum CollectionOperation {
1156
- /** Allows updating the collection's structure, for example adding, updating, or deleting fields. If not included, the collection's structure can't be changed. */
1157
- UPDATE = "UPDATE",
1158
- /** Allows deleting the entire collection. If not included, the collection can't be deleted. */
1159
- REMOVE = "REMOVE"
1160
- }
1161
- interface IndexLimits {
1162
- /** Maximum number of regular (non-unique) indexes allowed for this collection. */
1163
- regular?: number;
1164
- /** Maximum number of unique indexes allowed for this collection. */
1165
- unique?: number;
1166
- /** Maximum number of regular and unique indexes allowed for this collection. */
1167
- total?: number;
1168
- }
1169
- interface Field$1 extends FieldRangeValidationsOneOf {
1170
- /** Range of possible values for a numerical field. */
1171
- numberRange?: NumberRange;
1172
- /** Length range permitted for a text field. Relevant for fields that hold strings, such as those of type `TEXT` or `RICH_TEXT`. */
1173
- stringLengthRange?: StringLengthRange;
1174
- /** Array size range permitted. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. */
1175
- arraySizeRange?: ArraySizeRange;
1176
- /** Unique identifier for the field. For example, `firstName`. */
1177
- key?: string;
1178
- /** Field's display name when displayed in the CMS. For example, `First Name`. */
1179
- displayName?: string | null;
1180
- /** Field's data type. */
1181
- type?: Type;
1182
- /** Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. */
1183
- typeMetadata?: TypeMetadata;
1184
- /**
1185
- * Whether the field is a system field.
1186
- * @readonly
1187
- */
1188
- systemField?: boolean;
1189
- /**
1190
- * Capabilities the field supports.
1191
- * @readonly
1192
- */
1193
- capabilities?: FieldCapabilities;
1194
- /** Whether the field is encrypted. */
1195
- encrypted?: boolean;
1196
- /** Field description. */
1197
- description?: string | null;
1198
- /**
1199
- * Whether the field is read-only. A read-only field can't be changed.
1200
- *
1201
- * Default: `false`
1202
- */
1203
- readOnly?: boolean | null;
1204
- /**
1205
- * Whether the field is immutable. An immutable field can be set once, but then cannot be updated.
1206
- *
1207
- * Default: `false`
1208
- */
1209
- immutable?: boolean | null;
1210
- /**
1211
- * Whether the field is required.
1212
- *
1213
- * Default: `false`
1214
- */
1215
- required?: boolean | null;
1216
- /** Additional optional plugins for the field. */
1217
- plugins?: FieldPlugin[];
1218
- }
1219
- /** @oneof */
1220
- interface FieldRangeValidationsOneOf {
1221
- /** Range of possible values for a numerical field. */
1222
- numberRange?: NumberRange;
1223
- /** Length range permitted for a text field. Relevant for fields that hold strings, such as those of type `TEXT` or `RICH_TEXT`. */
1224
- stringLengthRange?: StringLengthRange;
1225
- /** Array size range permitted. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. */
1226
- arraySizeRange?: ArraySizeRange;
1227
- }
1228
- declare enum Type {
1229
- UNKNOWN_FIELD_TYPE = "UNKNOWN_FIELD_TYPE",
1230
- TEXT = "TEXT",
1231
- NUMBER = "NUMBER",
1232
- DATE = "DATE",
1233
- DATETIME = "DATETIME",
1234
- IMAGE = "IMAGE",
1235
- BOOLEAN = "BOOLEAN",
1236
- DOCUMENT = "DOCUMENT",
1237
- URL = "URL",
1238
- RICH_TEXT = "RICH_TEXT",
1239
- VIDEO = "VIDEO",
1240
- ANY = "ANY",
1241
- ARRAY_STRING = "ARRAY_STRING",
1242
- ARRAY_DOCUMENT = "ARRAY_DOCUMENT",
1243
- AUDIO = "AUDIO",
1244
- TIME = "TIME",
1245
- LANGUAGE = "LANGUAGE",
1246
- RICH_CONTENT = "RICH_CONTENT",
1247
- MEDIA_GALLERY = "MEDIA_GALLERY",
1248
- ADDRESS = "ADDRESS",
1249
- PAGE_LINK = "PAGE_LINK",
1250
- REFERENCE = "REFERENCE",
1251
- MULTI_REFERENCE = "MULTI_REFERENCE",
1252
- OBJECT = "OBJECT",
1253
- ARRAY = "ARRAY",
1254
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
1255
- LEGACY_TIME = "LEGACY_TIME",
1256
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
1257
- LEGACY_BOOK = "LEGACY_BOOK",
1258
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
1259
- LEGACY_EXTERNAL_URL = "LEGACY_EXTERNAL_URL",
1260
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
1261
- LEGACY_BROKEN_REFERENCE = "LEGACY_BROKEN_REFERENCE",
1262
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
1263
- LEGACY_IMAGE = "LEGACY_IMAGE",
1264
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
1265
- LEGACY_COLOR = "LEGACY_COLOR",
1266
- /** Deprecated - can’t be added to collections. Can only appear in older collections. */
1267
- LEGACY_EXTERNAL_VIDEO = "LEGACY_EXTERNAL_VIDEO"
1268
- }
1269
- interface TypeMetadata extends TypeMetadataMetadataOneOf {
1270
- /** Metadata for a reference field. */
1271
- reference?: Reference;
1272
- /** Metadata for a multi-reference field. */
1273
- multiReference?: MultiReference;
1274
- /** Metadata for an object field. */
1275
- object?: _Object;
1276
- /** Metadata for an array field. */
1277
- array?: _Array;
1278
- /** Metadata for a page link field. */
1279
- pageLink?: PageLink;
1280
- }
1281
- /** @oneof */
1282
- interface TypeMetadataMetadataOneOf {
1283
- /** Metadata for a reference field. */
1284
- reference?: Reference;
1285
- /** Metadata for a multi-reference field. */
1286
- multiReference?: MultiReference;
1287
- /** Metadata for an object field. */
1288
- object?: _Object;
1289
- /** Metadata for an array field. */
1290
- array?: _Array;
1291
- /** Metadata for a page link field. */
1292
- pageLink?: PageLink;
1293
- }
1294
- interface FieldCapabilities {
1295
- /**
1296
- * Whether the collection can be sorted by this field.
1297
- *
1298
- * Default: `false`
1299
- */
1300
- sortable?: boolean;
1301
- /** Query operators that can be used for this field. */
1302
- queryOperators?: QueryOperator[];
1303
- }
1304
- declare enum QueryOperator {
1305
- EQ = "EQ",
1306
- LT = "LT",
1307
- GT = "GT",
1308
- NE = "NE",
1309
- LTE = "LTE",
1310
- GTE = "GTE",
1311
- STARTS_WITH = "STARTS_WITH",
1312
- ENDS_WITH = "ENDS_WITH",
1313
- CONTAINS = "CONTAINS",
1314
- HAS_SOME = "HAS_SOME",
1315
- HAS_ALL = "HAS_ALL",
1316
- EXISTS = "EXISTS",
1317
- URLIZED = "URLIZED"
1318
- }
1319
- interface ObjectField {
1320
- /** Field ID. */
1321
- key?: string;
1322
- /** Display name for the field. */
1323
- displayName?: string | null;
1324
- /** Field type. */
1325
- type?: Type;
1326
- /** Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. */
1327
- typeMetadata?: TypeMetadata;
1328
- /**
1329
- * Capabilities the object field supports.
1330
- * @readonly
1331
- */
1332
- capabilities?: FieldCapabilities;
1333
- }
1334
- interface FieldsPattern {
1335
- pattern?: string;
1336
- lowercase?: boolean;
1337
- }
1338
- interface UrlizedOnlyPattern {
1339
- pattern?: string;
1340
- }
1341
- interface Calculator extends CalculatorPatternOneOf {
1342
- /** Value is calculated according to pattern, whitespaces are replaced with dash [-]. */
1343
- fieldsPattern?: FieldsPattern;
1344
- /** Value is only URL encoded. */
1345
- urlizedOnlyPattern?: UrlizedOnlyPattern;
1346
- }
1347
- /** @oneof */
1348
- interface CalculatorPatternOneOf {
1349
- /** Value is calculated according to pattern, whitespaces are replaced with dash [-]. */
1350
- fieldsPattern?: FieldsPattern;
1351
- /** Value is only URL encoded. */
1352
- urlizedOnlyPattern?: UrlizedOnlyPattern;
1353
- }
1354
- interface Reference {
1355
- /** Referenced collection ID. */
1356
- referencedCollectionId?: string;
1357
- }
1358
- interface MultiReference {
1359
- /** Referenced collection ID. */
1360
- referencedCollectionId?: string;
1361
- /** Referencing field ID. */
1362
- referencingFieldKey?: string;
1363
- /** Display name in the CMS for the referenced data. */
1364
- referencingDisplayName?: string;
1365
- }
1366
- interface _Object {
1367
- /** Fields within the object. */
1368
- fields?: ObjectField[];
1369
- }
1370
- interface _Array {
1371
- /** Element's data type. */
1372
- elementType?: Type;
1373
- /** Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. */
1374
- typeMetadata?: TypeMetadata;
1375
- }
1376
- interface PageLink {
1377
- calculator?: Calculator;
1378
- /** Defines reference to router pattern in the site document. */
1379
- linkedRouterPage?: string | null;
1380
- }
1381
- interface NumberRange {
1382
- /**
1383
- * Minimum permitted value for a numerical field.
1384
- *
1385
- * Default: No validation
1386
- */
1387
- min?: number | null;
1388
- /**
1389
- * Maximum permitted value for a numerical field.
1390
- *
1391
- * Default: No validation
1392
- */
1393
- max?: number | null;
1394
- }
1395
- interface StringLengthRange {
1396
- /**
1397
- * Minimum permitted length for a text field.
1398
- *
1399
- * Default: No validation
1400
- */
1401
- minLength?: number | null;
1402
- /**
1403
- * Maximum permitted length for a text field.
1404
- *
1405
- * Default: No validation
1406
- */
1407
- maxLength?: number | null;
1408
- }
1409
- interface ArraySizeRange {
1410
- /**
1411
- * Minimum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`.
1412
- *
1413
- * Default: No validation
1414
- */
1415
- minSize?: number | null;
1416
- /**
1417
- * Maximum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`.
1418
- *
1419
- * Default: No validation
1420
- */
1421
- maxSize?: number | null;
1422
- }
1423
- /** Optional plug-in aspects for fields */
1424
- interface FieldPlugin extends FieldPluginOptionsOneOf {
1425
- /** Options for the CMS plugin. */
1426
- cmsOptions?: CmsOptions;
1427
- type?: FieldPluginType;
1428
- }
1429
- /** @oneof */
1430
- interface FieldPluginOptionsOneOf {
1431
- /** Options for the CMS plugin. */
1432
- cmsOptions?: CmsOptions;
1433
- }
1434
- declare enum FieldPluginType {
1435
- /** Uknown plugin type. */
1436
- UNKNOWN = "UNKNOWN",
1437
- /** CMS-related field attributes */
1438
- CMS = "CMS"
1439
- }
1440
- /** Options for the CMS plugin. */
1441
- interface CmsOptions {
1442
- /**
1443
- * Indicates an internal CMS field. The CMS does not display internal fields.
1444
- *
1445
- * Default: `false`
1446
- */
1447
- internal?: boolean;
1448
- }
1449
- /** Permissions defined by the lowest role needed to perform each action. */
1450
- interface Permissions {
1451
- /** Lowest role needed to add a collection. */
1452
- insert?: Role;
1453
- /** Lowest role needed to update a collection. */
1454
- update?: Role;
1455
- /** Lowest role needed to remove a collection. */
1456
- remove?: Role;
1457
- /** Lowest role needed to read a collection. */
1458
- read?: Role;
1459
- }
1460
- declare enum Role {
1461
- /** Unknown role. */
1462
- UNKNOWN_ROLE = "UNKNOWN_ROLE",
1463
- /** Site administrator. */
1464
- ADMIN = "ADMIN",
1465
- /** Signed-in user who added content to this collection. */
1466
- SITE_MEMBER_AUTHOR = "SITE_MEMBER_AUTHOR",
1467
- /** Any signed-in user. */
1468
- SITE_MEMBER = "SITE_MEMBER",
1469
- /** Any site visitor. */
1470
- ANYONE = "ANYONE"
1471
- }
1472
- interface Plugin extends PluginOptionsOneOf {
1473
- /**
1474
- * Options for the Publish plugin.
1475
- * This plugin allows items in a [data collection](https://dev.wix.com/docs/rest/business-solutions/cms/data-collections/data-collection-object) to be marked as draft or published. Published items are visible to site visitors, while draft items are not.
1476
- */
1477
- publishOptions?: PublishPluginOptions;
1478
- /** Options for the Single Item plugin. */
1479
- singleItemOptions?: SingleItemPluginOptions;
1480
- /** Options for the Urlized plugin. */
1481
- urlizedOptions?: UrlizedPluginOptions;
1482
- /** Options for the Multilingual plugin. */
1483
- multilingualOptions?: MultilingualOptions;
1484
- /** Options for the PageLink plugin. */
1485
- editablePageLinkOptions?: PageLinkPluginOptions;
1486
- /** Options for the CMS plugin. */
1487
- cmsOptions?: PluginCmsOptions;
1488
- /** Plugin types. */
1489
- type?: PluginType;
1490
- }
1491
- /** @oneof */
1492
- interface PluginOptionsOneOf {
1493
- /**
1494
- * Options for the Publish plugin.
1495
- * This plugin allows items in a [data collection](https://dev.wix.com/docs/rest/business-solutions/cms/data-collections/data-collection-object) to be marked as draft or published. Published items are visible to site visitors, while draft items are not.
1496
- */
1497
- publishOptions?: PublishPluginOptions;
1498
- /** Options for the Single Item plugin. */
1499
- singleItemOptions?: SingleItemPluginOptions;
1500
- /** Options for the Urlized plugin. */
1501
- urlizedOptions?: UrlizedPluginOptions;
1502
- /** Options for the Multilingual plugin. */
1503
- multilingualOptions?: MultilingualOptions;
1504
- /** Options for the PageLink plugin. */
1505
- editablePageLinkOptions?: PageLinkPluginOptions;
1506
- /** Options for the CMS plugin. */
1507
- cmsOptions?: PluginCmsOptions;
1508
- }
1509
- declare enum Status$1 {
1510
- UNKNOWN_PUBLISH_PLUGIN_STATUS = "UNKNOWN_PUBLISH_PLUGIN_STATUS",
1511
- PUBLISHED = "PUBLISHED",
1512
- DRAFT = "DRAFT"
1513
- }
1514
- declare enum Format {
1515
- UNKNOWN_URLIZED_PLUGIN_FORMAT = "UNKNOWN_URLIZED_PLUGIN_FORMAT",
1516
- /** Letters are converted to lower case and spaces are replaced with dashes before generating the encoded URL. */
1517
- ORIGINAL = "ORIGINAL",
1518
- /** No changes are made before generating the encoded URL. */
1519
- PLAIN = "PLAIN"
1520
- }
1521
- /** if CMS-defined sort is enabled and should be used in site */
1522
- interface SiteSort {
1523
- /** Field and order for the site sort. */
1524
- sort?: Sort[];
1525
- }
1526
- declare enum PluginType {
1527
- /** Unknown plugin type. */
1528
- UNKNOWN_PLUGIN_TYPE = "UNKNOWN_PLUGIN_TYPE",
1529
- /** Allows items to be marked as either draft or published. For each item you can set a publishing time when the item will become visible to site visitors. */
1530
- PUBLISH = "PUBLISH",
1531
- /** Ensures the collection can have one item at most. Can only be applied to a new collection. */
1532
- SINGLE_ITEM = "SINGLE_ITEM",
1533
- /** Generates item URLs for collections used by dynamic pages. */
1534
- URLIZED = "URLIZED",
1535
- /** Deprecated. Will be removed in the future. */
1536
- GRIDAPPLESS = "GRIDAPPLESS",
1537
- /** Indicates that the collection is translatable. This allows you to manage translation for selected fields using [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual). */
1538
- MULTILINGUAL = "MULTILINGUAL",
1539
- /** Indicates that collection is shared with current site. */
1540
- SHARED = "SHARED",
1541
- /** Indicates that page link fields are persisted and can be updated. */
1542
- EDITABLE_PAGE_LINK = "EDITABLE_PAGE_LINK",
1543
- /** CMS-specific collection properties. */
1544
- CMS = "CMS"
1545
- }
1546
- interface PublishPluginOptions {
1547
- /** Default status. */
1548
- defaultStatus?: Status$1;
1549
- }
1550
- interface SingleItemPluginOptions {
1551
- /** ID of the single item in this collection. If you insert or update an item, its ID value is always changed to this. */
1552
- singleItemId?: string;
1553
- }
1554
- interface UrlizedPluginOptions {
1555
- /** Encoding method for generating a URL in ASCII characters. */
1556
- format?: Format;
1557
- }
1558
- interface MultilingualOptions {
1559
- /** IDs of fields to allow translation. */
1560
- translatableFieldKeys?: string[];
1561
- }
1562
- interface PageLinkPluginOptions {
1563
- isPersisted?: boolean;
1564
- isMutable?: boolean;
1565
- }
1566
- interface PluginCmsOptions {
1567
- /** CMS sort, applied when a collection is displayed on a site. */
1568
- siteSort?: SiteSort;
1569
- }
1570
- declare enum PagingMode {
1571
- /** Offset-based paging. */
1572
- OFFSET = "OFFSET",
1573
- /** Cursor-based paging. */
1574
- CURSOR = "CURSOR"
1575
- }
1576
- /** Data permissions defined by access level for each action. */
1577
- interface DataPermissions {
1578
- /** Access level for data items read */
1579
- itemRead?: AccessLevel;
1580
- /** Access level for data items insert */
1581
- itemInsert?: AccessLevel;
1582
- /** Access level for data items update */
1583
- itemUpdate?: AccessLevel;
1584
- /** Access level for data items removal */
1585
- itemRemove?: AccessLevel;
1586
- }
1587
- /**
1588
- * Describes who can perform certain action.
1589
- * Each level includes all levels below it (except UNDEFINED).
1590
- */
1591
- declare enum AccessLevel {
1592
- /** Not set. */
1593
- UNDEFINED = "UNDEFINED",
1594
- /** Any subject, including visitors. */
1595
- ANYONE = "ANYONE",
1596
- /** Any signed-in user (both site members and collaborators). */
1597
- SITE_MEMBER = "SITE_MEMBER",
1598
- /** Any signed-in user, but site members only have access to own items. */
1599
- SITE_MEMBER_AUTHOR = "SITE_MEMBER_AUTHOR",
1600
- /** Site collaborator that has a role with CMS Access permission. */
1601
- CMS_EDITOR = "CMS_EDITOR",
1602
- /** CMS administrators and users or roles granted with special access. */
1603
- PRIVILEGED = "PRIVILEGED"
1604
- }
1605
- interface AllowedDataPermissions {
1606
- /** If data items read permitted */
1607
- itemRead?: boolean;
1608
- /** If for data items insert permitted */
1609
- itemInsert?: boolean;
1610
- /** If data items update permitted */
1611
- itemUpdate?: boolean;
1612
- /** If data items removal permitted */
1613
- itemRemove?: boolean;
1614
- }
1615
- interface DataCollectionClonedEvent {
1616
- /** Instance ID of the collection from which the data is cloned. */
1617
- originInstanceId?: string;
1618
- /** ID of the collection from which the data is cloned. */
1619
- originId?: string;
1620
- }
1621
- interface DataCollectionChangedEvent {
1622
- /** list of new fields */
1623
- fieldsAdded?: Field$1[];
1624
- /** list of changed fields */
1625
- fieldsUpdated?: FieldUpdate$1[];
1626
- /** list of removed fields */
1627
- fieldsRemoved?: Field$1[];
1628
- /** list of new plugins */
1629
- pluginsAdded?: Plugin[];
1630
- /** list of changed plugins */
1631
- pluginsUpdated?: PluginUpdate[];
1632
- /** list of removed plugins */
1633
- pluginsRemoved?: Plugin[];
1634
- }
1635
- interface FieldUpdate$1 {
1636
- /** previous state of the field */
1637
- previous?: Field$1;
1638
- /** current state of the field */
1639
- current?: Field$1;
1640
- }
1641
- interface PluginUpdate {
1642
- /** previous state of the plugin */
1643
- previous?: Plugin;
1644
- /** current state of the plugin */
1645
- current?: Plugin;
1646
- }
1647
- interface CreateDataCollectionRequest {
1648
- /** Collection details. */
1649
- collection: DataCollection;
1650
- }
1651
- interface CreateDataCollectionResponse {
1652
- /** Details of collection created. */
1653
- collection?: DataCollection;
1654
- }
1655
- interface GetDataCollectionRequest {
1656
- /** ID of the collection to retrieve. */
1657
- dataCollectionId: string;
1658
- /**
1659
- * Whether to retrieve data from the primary database instance.
1660
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1661
- * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
1662
- *
1663
- * Default: `false`
1664
- */
1665
- consistentRead?: boolean;
1666
- /**
1667
- * List of specific field names to return, if empty all fields are returned.
1668
- * Affects all returned collections
1669
- */
1670
- fields?: string[];
1671
- }
1672
- declare enum Segment {
1673
- UNKNOWN_SEGMENT = "UNKNOWN_SEGMENT",
1674
- PUBLIC = "PUBLIC",
1675
- DEV = "DEV"
1676
- }
1677
- interface GetDataCollectionResponse {
1678
- /** Details of the collection requested. */
1679
- collection?: DataCollection;
1680
- /**
1681
- * Details of collections referenced by the collection requested.
1682
- * Only populated when `includeReferencedCollections` is `true` in the request.
1683
- */
1684
- referencedCollections?: DataCollection[];
1685
- }
1686
- interface ListDataCollectionsRequest {
1687
- /**
1688
- * Defines how collections in the response are sorted.
1689
- *
1690
- * Default: Ordered by ID in ascending order.
1691
- */
1692
- sort?: Sorting;
1693
- /** Pagination information. */
1694
- paging?: Paging$1;
1695
- /**
1696
- * Whether to retrieve data from the primary database instance.
1697
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1698
- * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
1699
- *
1700
- * Default: `false`
1701
- */
1702
- consistentRead?: boolean;
1703
- /**
1704
- * List of specific field names to return, if empty all fields are returned.
1705
- * Affects all returned collections
1706
- */
1707
- fields?: string[];
1708
- }
1709
- interface Sorting {
1710
- /** Name of the field to sort by. */
1711
- fieldName?: string;
1712
- /** Sort order. */
1713
- order?: SortOrder;
1714
- }
1715
- declare enum SortOrder {
1716
- ASC = "ASC",
1717
- DESC = "DESC"
1718
- }
1719
- interface Paging$1 {
1720
- /** Number of items to load. */
1721
- limit?: number | null;
1722
- /** Number of items to skip in the current sort order. */
1723
- offset?: number | null;
1724
- }
1725
- interface ListDataCollectionsResponse {
1726
- /** List of collections. */
1727
- collections?: DataCollection[];
1728
- /** Paging information. */
1729
- pagingMetadata?: PagingMetadataV2;
1730
- }
1731
- interface PagingMetadataV2 {
1732
- /** Number of items returned in the response. */
1733
- count?: number | null;
1734
- /** Offset that was requested. */
1735
- offset?: number | null;
1736
- /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
1737
- total?: number | null;
1738
- /** Flag that indicates the server failed to calculate the `total` field. */
1739
- tooManyToCount?: boolean | null;
1740
- }
1741
- interface BulkGetDataCollectionsRequest {
1742
- /** IDs of the collections to retrieve. */
1743
- dataCollectionIds?: string[];
1744
- /**
1745
- * Whether to include deleted collections.
1746
- *
1747
- * Default: `false`
1748
- */
1749
- showDeletedCollections?: boolean;
1750
- /**
1751
- * Whether the returned collection list should include referenced collections.
1752
- *
1753
- * Default: `false`
1754
- */
1755
- includeReferencedCollections?: boolean;
1756
- /** Sorting preferences. */
1757
- sort?: Sorting;
1758
- /**
1759
- * Whether to retrieve data from the primary database instance.
1760
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
1761
- * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
1762
- *
1763
- * Default: `false`
1764
- */
1765
- consistentRead?: boolean;
1766
- /**
1767
- * List of specific field names to return, if empty all fields are returned.
1768
- * Affects all returned collections
1769
- */
1770
- fields?: string[];
1771
- }
1772
- interface BulkGetDataCollectionsResponse {
1773
- /**
1774
- * List of requested collections.
1775
- * When `include_referenced_collections` is `true` in the request, referenced collections are included here.
1776
- */
1777
- activeCollections?: DataCollection[];
1778
- /** List of requested deleted collections. Only populated when `showDeletedCollections` is true in the request. */
1779
- deletedCollections?: DataCollection[];
1780
- }
1781
- interface UpdateDataCollectionRequest {
1782
- /** Updated collection details. The existing collection is replaced with this version. */
1783
- collection: DataCollection;
1784
- }
1785
- interface UpdateDataCollectionResponse {
1786
- /** Updated collection details. */
1787
- collection?: DataCollection;
1788
- }
1789
- interface DeleteDataCollectionRequest {
1790
- /** ID of the collection to delete. */
1791
- dataCollectionId: string;
1792
- }
1793
- interface DeleteDataCollectionResponse {
1794
- }
1795
- interface RestoreDataCollectionRequest {
1796
- /** Data Collection ID to restore */
1797
- dataCollectionId?: string;
1798
- }
1799
- interface RestoreDataCollectionResponse {
1800
- /** Restored data collection */
1801
- dataCollection?: DataCollection;
1802
- }
1803
- interface CreateDataCollectionFieldRequest {
1804
- /** ID of data collection to update */
1805
- dataCollectionId?: string;
1806
- /** field to create */
1807
- field?: Field$1;
1808
- }
1809
- interface CreateDataCollectionFieldResponse {
1810
- /** updated data collection */
1811
- dataCollection?: DataCollection;
1812
- }
1813
- interface UpdateDataCollectionFieldRequest {
1814
- /** ID of data collection to update */
1815
- dataCollectionId?: string;
1816
- /** Field to update */
1817
- field?: Field$1;
1818
- }
1819
- interface UpdateDataCollectionFieldResponse {
1820
- /** updated data collection */
1821
- dataCollection?: DataCollection;
1822
- }
1823
- interface DeleteDataCollectionFieldRequest {
1824
- /** ID of data collection to update */
1825
- dataCollectionId?: string;
1826
- /** Field ID to delete */
1827
- fieldKey?: string;
1828
- }
1829
- interface DeleteDataCollectionFieldResponse {
1830
- /** updated data collection */
1831
- dataCollection?: DataCollection;
1832
- }
1833
- interface UpdateDataPermissionsRequest {
1834
- /** ID of data collections to update */
1835
- dataCollectionId?: string;
1836
- /** Data permissions to set */
1837
- dataPermissions?: DataPermissions;
1838
- }
1839
- interface UpdateDataPermissionsResponse {
1840
- /** Updated data collection */
1841
- dataCollection?: DataCollection;
1842
- }
1843
- interface BulkGetDataCollectionsPageBySnapshotsRequest {
1844
- /** Ids of schema snapshot */
1845
- snapshotIds?: string[];
1846
- /** Pagination information. */
1847
- paging?: Paging$1;
1848
- }
1849
- interface BulkGetDataCollectionsPageBySnapshotsResponse {
1850
- /** List of snapshot collection map */
1851
- snapshotCollections?: SnapshotCollection[];
1852
- /** Paging information. */
1853
- pagingMetadata?: PagingMetadataV2;
1854
- }
1855
- interface SnapshotCollection {
1856
- /** snapshot to which collection belongs */
1857
- snapshotId?: string;
1858
- /** snapshot collection */
1859
- collection?: DataCollection;
1860
- /** snapshot of collection indexes */
1861
- indexes?: Index$1[];
1862
- }
1863
- /** An index is a map of a collection's data, organized according to specific fields to increase query speed. */
1864
- interface Index$1 {
1865
- /** Name of the index. */
1866
- name?: string;
1867
- /**
1868
- * Fields for which the index is defined.
1869
- *
1870
- * Max: 3 fields (for a unique index: 1 field)
1871
- */
1872
- fields?: IndexField[];
1873
- /**
1874
- * Current status of the index.
1875
- * @readonly
1876
- */
1877
- status?: IndexStatus;
1878
- /**
1879
- * Contains details about the reasons for failure when `status` is `FAILED`.
1880
- * @readonly
1881
- */
1882
- failure?: Failure$1;
1883
- /**
1884
- * Whether the index enforces uniqueness of values in the field for which it is defined.
1885
- * If `true`, the index can have only one field.
1886
- *
1887
- * Default: `false`
1888
- */
1889
- unique?: boolean;
1890
- /**
1891
- * Whether the index ignores case.
1892
- *
1893
- * Default: `false`
1894
- */
1895
- caseInsensitive?: boolean;
1896
- }
1897
- /**
1898
- * Order determines how values are ordered in the index. This is important when
1899
- * ordering and/or range querying by indexed fields.
1900
- */
1901
- declare enum Order$1 {
1902
- ASC = "ASC",
1903
- DESC = "DESC"
1904
- }
1905
- interface IndexField {
1906
- /** Path of the field to index. For example: `title` or `options.price`. */
1907
- path?: string;
1908
- /**
1909
- * Sort order for the index. Base on how the data is regularly queried.
1910
- *
1911
- * Default: `ASC`
1912
- */
1913
- order?: Order$1;
1914
- }
1915
- declare enum IndexStatus {
1916
- /** Place holder. Never returned by the service. */
1917
- UNKNOWN = "UNKNOWN",
1918
- /** Index creation is in progress. */
1919
- BUILDING = "BUILDING",
1920
- /** Index has been successfully created and can be used in queries. */
1921
- ACTIVE = "ACTIVE",
1922
- /** Index is in the process of being dropped. */
1923
- DROPPING = "DROPPING",
1924
- /** Index has been dropped successfully. */
1925
- DROPPED = "DROPPED",
1926
- /** Index creation has failed. */
1927
- FAILED = "FAILED",
1928
- /** Index contains incorrectly indexed data. */
1929
- INVALID = "INVALID"
1930
- }
1931
- interface Failure$1 {
1932
- /**
1933
- * Error code.
1934
- * - `WDE0112`: Unknown error while building collection index.
1935
- * - `WDE0113`: Duplicate key error while building collection index.
1936
- * - `WDE0114`: Document too large while building collection index.
1937
- */
1938
- code?: string;
1939
- /** Description of the failure. */
1940
- description?: string;
1941
- /**
1942
- * ID of the data item that caused the failure.
1943
- * For example, if `unique` is `true`, the ID of an item containing a duplicate value.
1944
- */
1945
- itemId?: string | null;
1946
- }
1947
- interface CreateDataCollectionsSnapshotRequest {
1948
- }
1949
- interface CreateDataCollectionsSnapshotResponse {
1950
- /** created snapshot ID */
1951
- snapshotId?: string;
1952
- /** data collections in snapshot */
1953
- snapshotCollections?: DataCollection[];
1954
- }
1955
- interface RestoreDataCollectionsFromSnapshotRequest {
1956
- /** snapshot ID to restore */
1957
- snapshotId?: string;
1958
- /**
1959
- * collection IDs to restore, if empty – all collections would be restored
1960
- * @deprecated
1961
- * @replacedBy restoration_collections
1962
- * @targetRemovalDate 2025-12-31
1963
- */
1964
- dataCollectionIds?: string[];
1965
- /** collection to restore, if empty – all collections would be restored */
1966
- restorationCollections?: RestorationCollection[];
1967
- }
1968
- interface Destination {
1969
- /** Collection id. */
1970
- dataCollectionId?: string;
1971
- /** Display name. When not specified value is taken from the snapshot. */
1972
- displayName?: string | null;
1973
- }
1974
- interface RestorationCollection {
1975
- /** Collection ID to restore */
1976
- dataCollectionId?: string;
1977
- /**
1978
- * Destination where to restore the collection.
1979
- * When not specified destination is taken from snapshot.
1980
- */
1981
- destination?: Destination;
1982
- }
1983
- interface RestoreDataCollectionsFromSnapshotResponse {
1984
- /** restored collections */
1985
- restoredCollections?: DataCollection[];
1986
- }
1987
- interface DeleteDataCollectionsSnapshotRequest {
1988
- /** snapshot ID to delete */
1989
- snapshotId?: string;
1990
- }
1991
- interface DeleteDataCollectionsSnapshotResponse {
1992
- }
1993
- interface CreateMigratedCollectionsSnapshotRequest {
1994
- existingSnapshotId?: string;
1995
- newNamespace?: string;
1996
- existingNamespace?: string;
1997
- }
1998
- interface CreateMigratedCollectionsSnapshotResponse {
1999
- snapshotId?: string;
2000
- }
2001
- interface DomainEvent extends DomainEventBodyOneOf {
2002
- createdEvent?: EntityCreatedEvent;
2003
- updatedEvent?: EntityUpdatedEvent;
2004
- deletedEvent?: EntityDeletedEvent;
2005
- actionEvent?: ActionEvent;
2006
- /**
2007
- * Unique event ID.
2008
- * Allows clients to ignore duplicate webhooks.
2009
- */
2010
- _id?: string;
2011
- /**
2012
- * Assumes actions are also always typed to an entity_type
2013
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
2014
- */
2015
- entityFqdn?: string;
2016
- /**
2017
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
2018
- * This is although the created/updated/deleted notion is duplication of the oneof types
2019
- * Example: created/updated/deleted/started/completed/email_opened
2020
- */
2021
- slug?: string;
2022
- /** ID of the entity associated with the event. */
2023
- entityId?: string;
2024
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
2025
- eventTime?: Date | null;
2026
- /**
2027
- * Whether the event was triggered as a result of a privacy regulation application
2028
- * (for example, GDPR).
2029
- */
2030
- triggeredByAnonymizeRequest?: boolean | null;
2031
- /** If present, indicates the action that triggered the event. */
2032
- originatedFrom?: string | null;
2033
- /**
2034
- * A sequence number defining the order of updates to the underlying entity.
2035
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
2036
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
2037
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
2038
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
2039
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
2040
- */
2041
- entityEventSequence?: string | null;
2042
- }
2043
- /** @oneof */
2044
- interface DomainEventBodyOneOf {
2045
- createdEvent?: EntityCreatedEvent;
2046
- updatedEvent?: EntityUpdatedEvent;
2047
- deletedEvent?: EntityDeletedEvent;
2048
- actionEvent?: ActionEvent;
2049
- }
2050
- interface EntityCreatedEvent {
2051
- entity?: string;
2052
- }
2053
- interface RestoreInfo {
2054
- deletedDate?: Date | null;
2055
- }
2056
- interface EntityUpdatedEvent {
2057
- /**
2058
- * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
2059
- * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
2060
- * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
2061
- */
2062
- currentEntity?: string;
2063
- }
2064
- interface EntityDeletedEvent {
2065
- /** Entity that was deleted */
2066
- deletedEntity?: string | null;
2067
- }
2068
- interface ActionEvent {
2069
- body?: string;
2070
- }
2071
- interface MessageEnvelope {
2072
- /** App instance ID. */
2073
- instanceId?: string | null;
2074
- /** Event type. */
2075
- eventType?: string;
2076
- /** The identification type and identity data. */
2077
- identity?: IdentificationData;
2078
- /** Stringify payload. */
2079
- data?: string;
2080
- }
2081
- interface IdentificationData extends IdentificationDataIdOneOf {
2082
- /** ID of a site visitor that has not logged in to the site. */
2083
- anonymousVisitorId?: string;
2084
- /** ID of a site visitor that has logged in to the site. */
2085
- memberId?: string;
2086
- /** ID of a Wix user (site owner, contributor, etc.). */
2087
- wixUserId?: string;
2088
- /** ID of an app. */
2089
- appId?: string;
2090
- /** @readonly */
2091
- identityType?: WebhookIdentityType;
2092
- }
2093
- /** @oneof */
2094
- interface IdentificationDataIdOneOf {
2095
- /** ID of a site visitor that has not logged in to the site. */
2096
- anonymousVisitorId?: string;
2097
- /** ID of a site visitor that has logged in to the site. */
2098
- memberId?: string;
2099
- /** ID of a Wix user (site owner, contributor, etc.). */
2100
- wixUserId?: string;
2101
- /** ID of an app. */
2102
- appId?: string;
2103
- }
2104
- declare enum WebhookIdentityType {
2105
- UNKNOWN = "UNKNOWN",
2106
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
2107
- MEMBER = "MEMBER",
2108
- WIX_USER = "WIX_USER",
2109
- APP = "APP"
2110
- }
2111
- interface SortNonNullableFields {
2112
- fieldKey: string;
2113
- direction: Direction;
2114
- }
2115
- interface IndexLimitsNonNullableFields {
2116
- regular: number;
2117
- unique: number;
2118
- total: number;
2119
- }
2120
- interface CollectionCapabilitiesNonNullableFields {
2121
- dataOperations: DataOperation[];
2122
- collectionOperations: CollectionOperation[];
2123
- indexLimits?: IndexLimitsNonNullableFields;
2124
- }
2125
- interface ReferenceNonNullableFields {
2126
- referencedCollectionId: string;
2127
- }
2128
- interface MultiReferenceNonNullableFields {
2129
- referencedCollectionId: string;
2130
- referencingFieldKey: string;
2131
- referencingDisplayName: string;
2132
- }
2133
- interface FieldCapabilitiesNonNullableFields {
2134
- sortable: boolean;
2135
- queryOperators: QueryOperator[];
2136
- }
2137
- interface ObjectFieldNonNullableFields {
2138
- key: string;
2139
- type: Type;
2140
- typeMetadata?: TypeMetadataNonNullableFields;
2141
- capabilities?: FieldCapabilitiesNonNullableFields;
2142
- }
2143
- interface _ObjectNonNullableFields {
2144
- fields: ObjectFieldNonNullableFields[];
2145
- }
2146
- interface _ArrayNonNullableFields {
2147
- elementType: Type;
2148
- typeMetadata?: TypeMetadataNonNullableFields;
2149
- }
2150
- interface FieldsPatternNonNullableFields {
2151
- pattern: string;
2152
- lowercase: boolean;
2153
- }
2154
- interface UrlizedOnlyPatternNonNullableFields {
2155
- pattern: string;
2156
- }
2157
- interface CalculatorNonNullableFields {
2158
- fieldsPattern?: FieldsPatternNonNullableFields;
2159
- urlizedOnlyPattern?: UrlizedOnlyPatternNonNullableFields;
2160
- }
2161
- interface PageLinkNonNullableFields {
2162
- calculator?: CalculatorNonNullableFields;
2163
- }
2164
- interface TypeMetadataNonNullableFields {
2165
- reference?: ReferenceNonNullableFields;
2166
- multiReference?: MultiReferenceNonNullableFields;
2167
- object?: _ObjectNonNullableFields;
2168
- array?: _ArrayNonNullableFields;
2169
- pageLink?: PageLinkNonNullableFields;
2170
- }
2171
- interface CmsOptionsNonNullableFields {
2172
- internal: boolean;
2173
- }
2174
- interface FieldPluginNonNullableFields {
2175
- cmsOptions?: CmsOptionsNonNullableFields;
2176
- type: FieldPluginType;
2177
- }
2178
- interface FieldNonNullableFields$1 {
2179
- key: string;
2180
- type: Type;
2181
- typeMetadata?: TypeMetadataNonNullableFields;
2182
- systemField: boolean;
2183
- capabilities?: FieldCapabilitiesNonNullableFields;
2184
- encrypted: boolean;
2185
- plugins: FieldPluginNonNullableFields[];
2186
- }
2187
- interface PermissionsNonNullableFields {
2188
- insert: Role;
2189
- update: Role;
2190
- remove: Role;
2191
- read: Role;
2192
- }
2193
- interface PublishPluginOptionsNonNullableFields {
2194
- defaultStatus: Status$1;
2195
- }
2196
- interface SingleItemPluginOptionsNonNullableFields {
2197
- singleItemId: string;
2198
- }
2199
- interface UrlizedPluginOptionsNonNullableFields {
2200
- format: Format;
2201
- }
2202
- interface MultilingualOptionsNonNullableFields {
2203
- translatableFieldKeys: string[];
2204
- }
2205
- interface PageLinkPluginOptionsNonNullableFields {
2206
- isPersisted: boolean;
2207
- isMutable: boolean;
2208
- }
2209
- interface SiteSortNonNullableFields {
2210
- sort: SortNonNullableFields[];
2211
- }
2212
- interface PluginCmsOptionsNonNullableFields {
2213
- siteSort?: SiteSortNonNullableFields;
2214
- }
2215
- interface PluginNonNullableFields {
2216
- publishOptions?: PublishPluginOptionsNonNullableFields;
2217
- singleItemOptions?: SingleItemPluginOptionsNonNullableFields;
2218
- urlizedOptions?: UrlizedPluginOptionsNonNullableFields;
2219
- multilingualOptions?: MultilingualOptionsNonNullableFields;
2220
- editablePageLinkOptions?: PageLinkPluginOptionsNonNullableFields;
2221
- cmsOptions?: PluginCmsOptionsNonNullableFields;
2222
- type: PluginType;
2223
- }
2224
- interface DataPermissionsNonNullableFields {
2225
- itemRead: AccessLevel;
2226
- itemInsert: AccessLevel;
2227
- itemUpdate: AccessLevel;
2228
- itemRemove: AccessLevel;
2229
- }
2230
- interface AllowedDataPermissionsNonNullableFields {
2231
- itemRead: boolean;
2232
- itemInsert: boolean;
2233
- itemUpdate: boolean;
2234
- itemRemove: boolean;
2235
- }
2236
- interface DataCollectionNonNullableFields {
2237
- _id: string;
2238
- collectionType: CollectionType;
2239
- defaultDisplayOrder?: SortNonNullableFields;
2240
- capabilities?: CollectionCapabilitiesNonNullableFields;
2241
- fields: FieldNonNullableFields$1[];
2242
- permissions?: PermissionsNonNullableFields;
2243
- plugins: PluginNonNullableFields[];
2244
- pagingModes: PagingMode[];
2245
- dataPermissions?: DataPermissionsNonNullableFields;
2246
- allowedDataPermissions?: AllowedDataPermissionsNonNullableFields;
2247
- }
2248
- interface CreateDataCollectionResponseNonNullableFields {
2249
- collection?: DataCollectionNonNullableFields;
2250
- }
2251
- interface GetDataCollectionResponseNonNullableFields {
2252
- collection?: DataCollectionNonNullableFields;
2253
- referencedCollections: DataCollectionNonNullableFields[];
2254
- }
2255
- interface ListDataCollectionsResponseNonNullableFields {
2256
- collections: DataCollectionNonNullableFields[];
2257
- }
2258
- interface UpdateDataCollectionResponseNonNullableFields {
2259
- collection?: DataCollectionNonNullableFields;
2260
- }
2261
- interface GetDataCollectionOptions {
2262
- /**
2263
- * Whether to retrieve data from the primary database instance.
2264
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
2265
- * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
2266
- *
2267
- * Default: `false`
2268
- */
2269
- consistentRead?: boolean;
2270
- /**
2271
- * List of specific field names to return, if empty all fields are returned.
2272
- * Affects all returned collections
2273
- */
2274
- fields?: string[];
2275
- }
2276
- interface ListDataCollectionsOptions {
2277
- /**
2278
- * Defines how collections in the response are sorted.
2279
- *
2280
- * Default: Ordered by ID in ascending order.
2281
- */
2282
- sort?: Sorting;
2283
- /** Pagination information. */
2284
- paging?: Paging$1;
2285
- /**
2286
- * Whether to retrieve data from the primary database instance.
2287
- * This decreases performance but ensures data retrieved is up to date even immediately after an update.
2288
- * Learn more about [Wix Data and eventual consistency](https://dev.wix.com/api/rest/wix-data/wix-data/eventual-consistency).
2289
- *
2290
- * Default: `false`
2291
- */
2292
- consistentRead?: boolean;
2293
- /**
2294
- * List of specific field names to return, if empty all fields are returned.
2295
- * Affects all returned collections
2296
- */
2297
- fields?: string[];
2298
- }
2299
-
2300
- declare function createDataCollection$1(httpClient: HttpClient$1): CreateDataCollectionSignature;
2301
- interface CreateDataCollectionSignature {
2302
- /**
2303
- * Creates a new data collection.
2304
- *
2305
- * The request body must include an ID, details for at least 1 field, and a permissions object. If any of these are missing, the collection isn't created.
2306
- * @param - Collection details.
2307
- * @param - Options for creating a data collection.
2308
- * @returns Details of collection created.
2309
- */
2310
- (collection: DataCollection): Promise<DataCollection & DataCollectionNonNullableFields>;
2311
- }
2312
- declare function getDataCollection$1(httpClient: HttpClient$1): GetDataCollectionSignature;
2313
- interface GetDataCollectionSignature {
2314
- /**
2315
- * Retrieves a data collection by ID.
2316
- * @param - ID of the collection to retrieve.
2317
- * @param - Options for retrieving a data collection.
2318
- * @returns Details of the collection requested.
2319
- */
2320
- (dataCollectionId: string, options?: GetDataCollectionOptions | undefined): Promise<DataCollection & DataCollectionNonNullableFields>;
2321
- }
2322
- declare function listDataCollections$1(httpClient: HttpClient$1): ListDataCollectionsSignature;
2323
- interface ListDataCollectionsSignature {
2324
- /**
2325
- * Retrieves a list of all data collections associated with the site or project.
2326
- *
2327
- * By default, the list is ordered by ID in ascending order.
2328
- * @param - Options for retrieving a list of data collections.
2329
- */
2330
- (options?: ListDataCollectionsOptions | undefined): Promise<ListDataCollectionsResponse & ListDataCollectionsResponseNonNullableFields>;
2331
- }
2332
- declare function updateDataCollection$1(httpClient: HttpClient$1): UpdateDataCollectionSignature;
2333
- interface UpdateDataCollectionSignature {
2334
- /**
2335
- * Updates a data collection.
2336
- *
2337
- * A collection ID, revision number, permissions, and at least 1 field must be provided within the `collection` body parameter.
2338
- * If a collection with that ID exists, and if its current `revision` number matches the one provided, it is updated.
2339
- * Otherwise, the request fails.
2340
- *
2341
- * When a collection is updated, its `updatedDate` property is changed to the current date and its `revision` property is incremented.
2342
- *
2343
- * > **Note:**
2344
- * > After a collection is updated, it only contains the properties included in the Update Data Collection request. If the existing collection has properties with values and those properties
2345
- * > aren't included in the updated collection details, their values are lost.
2346
- * @param - Updated collection details. The existing collection is replaced with this version.
2347
- * @param - Options for updating a data collection.
2348
- * @returns Updated collection details.
2349
- */
2350
- (collection: DataCollection): Promise<DataCollection & DataCollectionNonNullableFields>;
2351
- }
2352
- declare function deleteDataCollection$1(httpClient: HttpClient$1): DeleteDataCollectionSignature;
2353
- interface DeleteDataCollectionSignature {
2354
- /**
2355
- * Deletes a data collection.
2356
- *
2357
- * > **Note:**
2358
- * > Once a collection is deleted, it can only be restored for limited amount of time.
2359
- * @param - ID of the collection to delete.
2360
- */
2361
- (dataCollectionId: string): Promise<void>;
2362
- }
2363
-
2364
- declare const createDataCollection: MaybeContext<BuildRESTFunction<typeof createDataCollection$1> & typeof createDataCollection$1>;
2365
- declare const getDataCollection: MaybeContext<BuildRESTFunction<typeof getDataCollection$1> & typeof getDataCollection$1>;
2366
- declare const listDataCollections: MaybeContext<BuildRESTFunction<typeof listDataCollections$1> & typeof listDataCollections$1>;
2367
- declare const updateDataCollection: MaybeContext<BuildRESTFunction<typeof updateDataCollection$1> & typeof updateDataCollection$1>;
2368
- declare const deleteDataCollection: MaybeContext<BuildRESTFunction<typeof deleteDataCollection$1> & typeof deleteDataCollection$1>;
2369
-
2370
- type index_d$2_AccessLevel = AccessLevel;
2371
- declare const index_d$2_AccessLevel: typeof AccessLevel;
2372
- type index_d$2_ActionEvent = ActionEvent;
2373
- type index_d$2_AllowedDataPermissions = AllowedDataPermissions;
2374
- type index_d$2_ArraySizeRange = ArraySizeRange;
2375
- type index_d$2_BulkGetDataCollectionsPageBySnapshotsRequest = BulkGetDataCollectionsPageBySnapshotsRequest;
2376
- type index_d$2_BulkGetDataCollectionsPageBySnapshotsResponse = BulkGetDataCollectionsPageBySnapshotsResponse;
2377
- type index_d$2_BulkGetDataCollectionsRequest = BulkGetDataCollectionsRequest;
2378
- type index_d$2_BulkGetDataCollectionsResponse = BulkGetDataCollectionsResponse;
2379
- type index_d$2_Calculator = Calculator;
2380
- type index_d$2_CalculatorPatternOneOf = CalculatorPatternOneOf;
2381
- type index_d$2_CmsOptions = CmsOptions;
2382
- type index_d$2_CollectionCapabilities = CollectionCapabilities;
2383
- type index_d$2_CollectionOperation = CollectionOperation;
2384
- declare const index_d$2_CollectionOperation: typeof CollectionOperation;
2385
- type index_d$2_CollectionType = CollectionType;
2386
- declare const index_d$2_CollectionType: typeof CollectionType;
2387
- type index_d$2_CreateDataCollectionFieldRequest = CreateDataCollectionFieldRequest;
2388
- type index_d$2_CreateDataCollectionFieldResponse = CreateDataCollectionFieldResponse;
2389
- type index_d$2_CreateDataCollectionRequest = CreateDataCollectionRequest;
2390
- type index_d$2_CreateDataCollectionResponse = CreateDataCollectionResponse;
2391
- type index_d$2_CreateDataCollectionResponseNonNullableFields = CreateDataCollectionResponseNonNullableFields;
2392
- type index_d$2_CreateDataCollectionsSnapshotRequest = CreateDataCollectionsSnapshotRequest;
2393
- type index_d$2_CreateDataCollectionsSnapshotResponse = CreateDataCollectionsSnapshotResponse;
2394
- type index_d$2_CreateMigratedCollectionsSnapshotRequest = CreateMigratedCollectionsSnapshotRequest;
2395
- type index_d$2_CreateMigratedCollectionsSnapshotResponse = CreateMigratedCollectionsSnapshotResponse;
2396
- type index_d$2_DataCollection = DataCollection;
2397
- type index_d$2_DataCollectionChangedEvent = DataCollectionChangedEvent;
2398
- type index_d$2_DataCollectionClonedEvent = DataCollectionClonedEvent;
2399
- type index_d$2_DataCollectionNonNullableFields = DataCollectionNonNullableFields;
2400
- type index_d$2_DataOperation = DataOperation;
2401
- declare const index_d$2_DataOperation: typeof DataOperation;
2402
- type index_d$2_DataPermissions = DataPermissions;
2403
- type index_d$2_DeleteDataCollectionFieldRequest = DeleteDataCollectionFieldRequest;
2404
- type index_d$2_DeleteDataCollectionFieldResponse = DeleteDataCollectionFieldResponse;
2405
- type index_d$2_DeleteDataCollectionRequest = DeleteDataCollectionRequest;
2406
- type index_d$2_DeleteDataCollectionResponse = DeleteDataCollectionResponse;
2407
- type index_d$2_DeleteDataCollectionsSnapshotRequest = DeleteDataCollectionsSnapshotRequest;
2408
- type index_d$2_DeleteDataCollectionsSnapshotResponse = DeleteDataCollectionsSnapshotResponse;
2409
- type index_d$2_Destination = Destination;
2410
- type index_d$2_Direction = Direction;
2411
- declare const index_d$2_Direction: typeof Direction;
2412
- type index_d$2_DomainEvent = DomainEvent;
2413
- type index_d$2_DomainEventBodyOneOf = DomainEventBodyOneOf;
2414
- type index_d$2_EntityCreatedEvent = EntityCreatedEvent;
2415
- type index_d$2_EntityDeletedEvent = EntityDeletedEvent;
2416
- type index_d$2_EntityUpdatedEvent = EntityUpdatedEvent;
2417
- type index_d$2_FieldCapabilities = FieldCapabilities;
2418
- type index_d$2_FieldPlugin = FieldPlugin;
2419
- type index_d$2_FieldPluginOptionsOneOf = FieldPluginOptionsOneOf;
2420
- type index_d$2_FieldPluginType = FieldPluginType;
2421
- declare const index_d$2_FieldPluginType: typeof FieldPluginType;
2422
- type index_d$2_FieldRangeValidationsOneOf = FieldRangeValidationsOneOf;
2423
- type index_d$2_FieldsPattern = FieldsPattern;
2424
- type index_d$2_Format = Format;
2425
- declare const index_d$2_Format: typeof Format;
2426
- type index_d$2_GetDataCollectionOptions = GetDataCollectionOptions;
2427
- type index_d$2_GetDataCollectionRequest = GetDataCollectionRequest;
2428
- type index_d$2_GetDataCollectionResponse = GetDataCollectionResponse;
2429
- type index_d$2_GetDataCollectionResponseNonNullableFields = GetDataCollectionResponseNonNullableFields;
2430
- type index_d$2_IdentificationData = IdentificationData;
2431
- type index_d$2_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
2432
- type index_d$2_IndexField = IndexField;
2433
- type index_d$2_IndexLimits = IndexLimits;
2434
- type index_d$2_IndexStatus = IndexStatus;
2435
- declare const index_d$2_IndexStatus: typeof IndexStatus;
2436
- type index_d$2_ListDataCollectionsOptions = ListDataCollectionsOptions;
2437
- type index_d$2_ListDataCollectionsRequest = ListDataCollectionsRequest;
2438
- type index_d$2_ListDataCollectionsResponse = ListDataCollectionsResponse;
2439
- type index_d$2_ListDataCollectionsResponseNonNullableFields = ListDataCollectionsResponseNonNullableFields;
2440
- type index_d$2_MessageEnvelope = MessageEnvelope;
2441
- type index_d$2_MultiReference = MultiReference;
2442
- type index_d$2_MultilingualOptions = MultilingualOptions;
2443
- type index_d$2_NumberRange = NumberRange;
2444
- type index_d$2_ObjectField = ObjectField;
2445
- type index_d$2_PageLink = PageLink;
2446
- type index_d$2_PageLinkPluginOptions = PageLinkPluginOptions;
2447
- type index_d$2_PagingMetadataV2 = PagingMetadataV2;
2448
- type index_d$2_PagingMode = PagingMode;
2449
- declare const index_d$2_PagingMode: typeof PagingMode;
2450
- type index_d$2_Permissions = Permissions;
2451
- type index_d$2_Plugin = Plugin;
2452
- type index_d$2_PluginCmsOptions = PluginCmsOptions;
2453
- type index_d$2_PluginOptionsOneOf = PluginOptionsOneOf;
2454
- type index_d$2_PluginType = PluginType;
2455
- declare const index_d$2_PluginType: typeof PluginType;
2456
- type index_d$2_PluginUpdate = PluginUpdate;
2457
- type index_d$2_PublishPluginOptions = PublishPluginOptions;
2458
- type index_d$2_QueryOperator = QueryOperator;
2459
- declare const index_d$2_QueryOperator: typeof QueryOperator;
2460
- type index_d$2_Reference = Reference;
2461
- type index_d$2_RestorationCollection = RestorationCollection;
2462
- type index_d$2_RestoreDataCollectionRequest = RestoreDataCollectionRequest;
2463
- type index_d$2_RestoreDataCollectionResponse = RestoreDataCollectionResponse;
2464
- type index_d$2_RestoreDataCollectionsFromSnapshotRequest = RestoreDataCollectionsFromSnapshotRequest;
2465
- type index_d$2_RestoreDataCollectionsFromSnapshotResponse = RestoreDataCollectionsFromSnapshotResponse;
2466
- type index_d$2_RestoreInfo = RestoreInfo;
2467
- type index_d$2_Role = Role;
2468
- declare const index_d$2_Role: typeof Role;
2469
- type index_d$2_Segment = Segment;
2470
- declare const index_d$2_Segment: typeof Segment;
2471
- type index_d$2_SingleItemPluginOptions = SingleItemPluginOptions;
2472
- type index_d$2_SiteSort = SiteSort;
2473
- type index_d$2_SnapshotCollection = SnapshotCollection;
2474
- type index_d$2_Sort = Sort;
2475
- type index_d$2_SortOrder = SortOrder;
2476
- declare const index_d$2_SortOrder: typeof SortOrder;
2477
- type index_d$2_Sorting = Sorting;
2478
- type index_d$2_StringLengthRange = StringLengthRange;
2479
- type index_d$2_Type = Type;
2480
- declare const index_d$2_Type: typeof Type;
2481
- type index_d$2_TypeMetadata = TypeMetadata;
2482
- type index_d$2_TypeMetadataMetadataOneOf = TypeMetadataMetadataOneOf;
2483
- type index_d$2_UpdateDataCollectionFieldRequest = UpdateDataCollectionFieldRequest;
2484
- type index_d$2_UpdateDataCollectionFieldResponse = UpdateDataCollectionFieldResponse;
2485
- type index_d$2_UpdateDataCollectionRequest = UpdateDataCollectionRequest;
2486
- type index_d$2_UpdateDataCollectionResponse = UpdateDataCollectionResponse;
2487
- type index_d$2_UpdateDataCollectionResponseNonNullableFields = UpdateDataCollectionResponseNonNullableFields;
2488
- type index_d$2_UpdateDataPermissionsRequest = UpdateDataPermissionsRequest;
2489
- type index_d$2_UpdateDataPermissionsResponse = UpdateDataPermissionsResponse;
2490
- type index_d$2_UrlizedOnlyPattern = UrlizedOnlyPattern;
2491
- type index_d$2_UrlizedPluginOptions = UrlizedPluginOptions;
2492
- type index_d$2_WebhookIdentityType = WebhookIdentityType;
2493
- declare const index_d$2_WebhookIdentityType: typeof WebhookIdentityType;
2494
- type index_d$2__Array = _Array;
2495
- type index_d$2__Object = _Object;
2496
- declare const index_d$2_createDataCollection: typeof createDataCollection;
2497
- declare const index_d$2_deleteDataCollection: typeof deleteDataCollection;
2498
- declare const index_d$2_getDataCollection: typeof getDataCollection;
2499
- declare const index_d$2_listDataCollections: typeof listDataCollections;
2500
- declare const index_d$2_updateDataCollection: typeof updateDataCollection;
2501
- declare namespace index_d$2 {
2502
- export { index_d$2_AccessLevel as AccessLevel, type index_d$2_ActionEvent as ActionEvent, type index_d$2_AllowedDataPermissions as AllowedDataPermissions, type index_d$2_ArraySizeRange as ArraySizeRange, type index_d$2_BulkGetDataCollectionsPageBySnapshotsRequest as BulkGetDataCollectionsPageBySnapshotsRequest, type index_d$2_BulkGetDataCollectionsPageBySnapshotsResponse as BulkGetDataCollectionsPageBySnapshotsResponse, type index_d$2_BulkGetDataCollectionsRequest as BulkGetDataCollectionsRequest, type index_d$2_BulkGetDataCollectionsResponse as BulkGetDataCollectionsResponse, type index_d$2_Calculator as Calculator, type index_d$2_CalculatorPatternOneOf as CalculatorPatternOneOf, type index_d$2_CmsOptions as CmsOptions, type index_d$2_CollectionCapabilities as CollectionCapabilities, index_d$2_CollectionOperation as CollectionOperation, index_d$2_CollectionType as CollectionType, type index_d$2_CreateDataCollectionFieldRequest as CreateDataCollectionFieldRequest, type index_d$2_CreateDataCollectionFieldResponse as CreateDataCollectionFieldResponse, type index_d$2_CreateDataCollectionRequest as CreateDataCollectionRequest, type index_d$2_CreateDataCollectionResponse as CreateDataCollectionResponse, type index_d$2_CreateDataCollectionResponseNonNullableFields as CreateDataCollectionResponseNonNullableFields, type index_d$2_CreateDataCollectionsSnapshotRequest as CreateDataCollectionsSnapshotRequest, type index_d$2_CreateDataCollectionsSnapshotResponse as CreateDataCollectionsSnapshotResponse, type index_d$2_CreateMigratedCollectionsSnapshotRequest as CreateMigratedCollectionsSnapshotRequest, type index_d$2_CreateMigratedCollectionsSnapshotResponse as CreateMigratedCollectionsSnapshotResponse, type index_d$2_DataCollection as DataCollection, type index_d$2_DataCollectionChangedEvent as DataCollectionChangedEvent, type index_d$2_DataCollectionClonedEvent as DataCollectionClonedEvent, type index_d$2_DataCollectionNonNullableFields as DataCollectionNonNullableFields, index_d$2_DataOperation as DataOperation, type index_d$2_DataPermissions as DataPermissions, type index_d$2_DeleteDataCollectionFieldRequest as DeleteDataCollectionFieldRequest, type index_d$2_DeleteDataCollectionFieldResponse as DeleteDataCollectionFieldResponse, type index_d$2_DeleteDataCollectionRequest as DeleteDataCollectionRequest, type index_d$2_DeleteDataCollectionResponse as DeleteDataCollectionResponse, type index_d$2_DeleteDataCollectionsSnapshotRequest as DeleteDataCollectionsSnapshotRequest, type index_d$2_DeleteDataCollectionsSnapshotResponse as DeleteDataCollectionsSnapshotResponse, type index_d$2_Destination as Destination, index_d$2_Direction as Direction, type index_d$2_DomainEvent as DomainEvent, type index_d$2_DomainEventBodyOneOf as DomainEventBodyOneOf, type index_d$2_EntityCreatedEvent as EntityCreatedEvent, type index_d$2_EntityDeletedEvent as EntityDeletedEvent, type index_d$2_EntityUpdatedEvent as EntityUpdatedEvent, type Failure$1 as Failure, type Field$1 as Field, type index_d$2_FieldCapabilities as FieldCapabilities, type index_d$2_FieldPlugin as FieldPlugin, type index_d$2_FieldPluginOptionsOneOf as FieldPluginOptionsOneOf, index_d$2_FieldPluginType as FieldPluginType, type index_d$2_FieldRangeValidationsOneOf as FieldRangeValidationsOneOf, type FieldUpdate$1 as FieldUpdate, type index_d$2_FieldsPattern as FieldsPattern, index_d$2_Format as Format, type index_d$2_GetDataCollectionOptions as GetDataCollectionOptions, type index_d$2_GetDataCollectionRequest as GetDataCollectionRequest, type index_d$2_GetDataCollectionResponse as GetDataCollectionResponse, type index_d$2_GetDataCollectionResponseNonNullableFields as GetDataCollectionResponseNonNullableFields, type index_d$2_IdentificationData as IdentificationData, type index_d$2_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type Index$1 as Index, type index_d$2_IndexField as IndexField, type index_d$2_IndexLimits as IndexLimits, index_d$2_IndexStatus as IndexStatus, type index_d$2_ListDataCollectionsOptions as ListDataCollectionsOptions, type index_d$2_ListDataCollectionsRequest as ListDataCollectionsRequest, type index_d$2_ListDataCollectionsResponse as ListDataCollectionsResponse, type index_d$2_ListDataCollectionsResponseNonNullableFields as ListDataCollectionsResponseNonNullableFields, type index_d$2_MessageEnvelope as MessageEnvelope, type index_d$2_MultiReference as MultiReference, type index_d$2_MultilingualOptions as MultilingualOptions, type index_d$2_NumberRange as NumberRange, type index_d$2_ObjectField as ObjectField, Order$1 as Order, type index_d$2_PageLink as PageLink, type index_d$2_PageLinkPluginOptions as PageLinkPluginOptions, type Paging$1 as Paging, type index_d$2_PagingMetadataV2 as PagingMetadataV2, index_d$2_PagingMode as PagingMode, type index_d$2_Permissions as Permissions, type index_d$2_Plugin as Plugin, type index_d$2_PluginCmsOptions as PluginCmsOptions, type index_d$2_PluginOptionsOneOf as PluginOptionsOneOf, index_d$2_PluginType as PluginType, type index_d$2_PluginUpdate as PluginUpdate, type index_d$2_PublishPluginOptions as PublishPluginOptions, index_d$2_QueryOperator as QueryOperator, type index_d$2_Reference as Reference, type index_d$2_RestorationCollection as RestorationCollection, type index_d$2_RestoreDataCollectionRequest as RestoreDataCollectionRequest, type index_d$2_RestoreDataCollectionResponse as RestoreDataCollectionResponse, type index_d$2_RestoreDataCollectionsFromSnapshotRequest as RestoreDataCollectionsFromSnapshotRequest, type index_d$2_RestoreDataCollectionsFromSnapshotResponse as RestoreDataCollectionsFromSnapshotResponse, type index_d$2_RestoreInfo as RestoreInfo, index_d$2_Role as Role, index_d$2_Segment as Segment, type index_d$2_SingleItemPluginOptions as SingleItemPluginOptions, type index_d$2_SiteSort as SiteSort, type index_d$2_SnapshotCollection as SnapshotCollection, type index_d$2_Sort as Sort, index_d$2_SortOrder as SortOrder, type index_d$2_Sorting as Sorting, Status$1 as Status, type index_d$2_StringLengthRange as StringLengthRange, index_d$2_Type as Type, type index_d$2_TypeMetadata as TypeMetadata, type index_d$2_TypeMetadataMetadataOneOf as TypeMetadataMetadataOneOf, type index_d$2_UpdateDataCollectionFieldRequest as UpdateDataCollectionFieldRequest, type index_d$2_UpdateDataCollectionFieldResponse as UpdateDataCollectionFieldResponse, type index_d$2_UpdateDataCollectionRequest as UpdateDataCollectionRequest, type index_d$2_UpdateDataCollectionResponse as UpdateDataCollectionResponse, type index_d$2_UpdateDataCollectionResponseNonNullableFields as UpdateDataCollectionResponseNonNullableFields, type index_d$2_UpdateDataPermissionsRequest as UpdateDataPermissionsRequest, type index_d$2_UpdateDataPermissionsResponse as UpdateDataPermissionsResponse, type index_d$2_UrlizedOnlyPattern as UrlizedOnlyPattern, type index_d$2_UrlizedPluginOptions as UrlizedPluginOptions, index_d$2_WebhookIdentityType as WebhookIdentityType, type index_d$2__Array as _Array, type index_d$2__Object as _Object, index_d$2_createDataCollection as createDataCollection, index_d$2_deleteDataCollection as deleteDataCollection, index_d$2_getDataCollection as getDataCollection, index_d$2_listDataCollections as listDataCollections, index_d$2_updateDataCollection as updateDataCollection };
2503
- }
2504
-
2505
- /** An index is a map of a collection's data, organized according to specific fields to increase query speed. */
2506
- interface Index {
2507
- /** Name of the index. */
2508
- name?: string;
2509
- /**
2510
- * Fields for which the index is defined.
2511
- *
2512
- * Max: 3 fields (for a unique index: 1 field)
2513
- */
2514
- fields?: Field[];
2515
- /**
2516
- * Current status of the index.
2517
- * @readonly
2518
- */
2519
- status?: Status;
2520
- /**
2521
- * Contains details about the reasons for failure when `status` is `FAILED`.
2522
- * @readonly
2523
- */
2524
- failure?: Failure;
2525
- /**
2526
- * Whether the index enforces uniqueness of values in the field for which it is defined.
2527
- * If `true`, the index can have only one field.
2528
- *
2529
- * Default: `false`
2530
- */
2531
- unique?: boolean;
2532
- /**
2533
- * Whether the index ignores case.
2534
- *
2535
- * Default: `false`
2536
- */
2537
- caseInsensitive?: boolean;
2538
- }
2539
- /**
2540
- * Order determines how values are ordered in the index. This is important when
2541
- * ordering and/or range querying by indexed fields.
2542
- */
2543
- declare enum Order {
2544
- ASC = "ASC",
2545
- DESC = "DESC"
2546
- }
2547
- interface Field {
2548
- /** Path of the field to index. For example: `title` or `options.price`. */
2549
- path?: string;
2550
- /**
2551
- * Sort order for the index. Base on how the data is regularly queried.
2552
- *
2553
- * Default: `ASC`
2554
- */
2555
- order?: Order;
2556
- }
2557
- declare enum Status {
2558
- /** Place holder. Never returned by the service. */
2559
- UNKNOWN = "UNKNOWN",
2560
- /** Index creation is in progress. */
2561
- BUILDING = "BUILDING",
2562
- /** Index has been successfully created and can be used in queries. */
2563
- ACTIVE = "ACTIVE",
2564
- /** Index is in the process of being dropped. */
2565
- DROPPING = "DROPPING",
2566
- /** Index has been dropped successfully. */
2567
- DROPPED = "DROPPED",
2568
- /** Index creation has failed. */
2569
- FAILED = "FAILED",
2570
- /** Index contains incorrectly indexed data. */
2571
- INVALID = "INVALID"
2572
- }
2573
- interface Failure {
2574
- /**
2575
- * Error code.
2576
- * - `WDE0112`: Unknown error while building collection index.
2577
- * - `WDE0113`: Duplicate key error while building collection index.
2578
- * - `WDE0114`: Document too large while building collection index.
2579
- */
2580
- code?: string;
2581
- /** Description of the failure. */
2582
- description?: string;
2583
- /**
2584
- * ID of the data item that caused the failure.
2585
- * For example, if `unique` is `true`, the ID of an item containing a duplicate value.
2586
- */
2587
- itemId?: string | null;
2588
- }
2589
- interface CreateIndexRequest {
2590
- /** Details of the index to be created. */
2591
- index: Index;
2592
- /** ID of the data collection for which to generate the index. */
2593
- dataCollectionId: string;
2594
- }
2595
- declare enum Environment {
2596
- LIVE = "LIVE",
2597
- SANDBOX = "SANDBOX",
2598
- SANDBOX_PREFERRED = "SANDBOX_PREFERRED"
2599
- }
2600
- interface CreateIndexResponse {
2601
- /** Details of the index being generated. */
2602
- index?: Index;
2603
- }
2604
- interface DropIndexRequest {
2605
- /** Name of the index to drop. */
2606
- indexName: string;
2607
- /** ID of the data collection for which the index to be dropped is defined. */
2608
- dataCollectionId: string;
2609
- }
2610
- interface DropIndexResponse {
2611
- }
2612
- interface ListIndexesRequest {
2613
- /** ID of the data collection for which to list indexes. */
2614
- dataCollectionId: string;
2615
- /** Paging options to limit and skip the number of items. */
2616
- paging?: Paging;
2617
- }
2618
- interface Paging {
2619
- /** Number of items to load. */
2620
- limit?: number | null;
2621
- /** Number of items to skip in the current sort order. */
2622
- offset?: number | null;
2623
- }
2624
- interface ListIndexesResponse {
2625
- /** List of all indexes for the requested data collection. */
2626
- indexes?: Index[];
2627
- /** Paging metadata. */
2628
- pagingMetadata?: PagingMetadata;
2629
- }
2630
- interface PagingMetadata {
2631
- /** Number of items returned in the response. */
2632
- count?: number | null;
2633
- /** Offset that was requested. */
2634
- offset?: number | null;
2635
- /** Total number of items that match the query. */
2636
- total?: number | null;
2637
- /** Flag that indicates the server failed to calculate the `total` field. */
2638
- tooManyToCount?: boolean | null;
2639
- }
2640
- interface ListAvailableIndexesRequest {
2641
- /** Data collection to show available indexes for */
2642
- dataCollectionId?: string;
2643
- }
2644
- interface ListAvailableIndexesResponse {
2645
- /**
2646
- * limit of regular single-field indexes, even if 0 1-field indices may be created using
2647
- * 3-field quota (if available)
2648
- */
2649
- regular1Field?: number;
2650
- /** limit of regular indexes up to 3-fields (in addition to 1-field indexes quota) */
2651
- regular3Field?: number;
2652
- /** limit of unique indexes */
2653
- unique1Field?: number;
2654
- /** Overall index limit, missing value means there's no overall limit */
2655
- total?: number | null;
2656
- }
2657
- interface FieldNonNullableFields {
2658
- path: string;
2659
- order: Order;
2660
- }
2661
- interface FailureNonNullableFields {
2662
- code: string;
2663
- broadCode: string;
2664
- description: string;
2665
- }
2666
- interface IndexNonNullableFields {
2667
- name: string;
2668
- fields: FieldNonNullableFields[];
2669
- status: Status;
2670
- failure?: FailureNonNullableFields;
2671
- unique: boolean;
2672
- caseInsensitive: boolean;
2673
- }
2674
- interface CreateIndexResponseNonNullableFields {
2675
- index?: IndexNonNullableFields;
2676
- }
2677
- interface ListIndexesResponseNonNullableFields {
2678
- indexes: IndexNonNullableFields[];
2679
- }
2680
- interface ListIndexesOptions {
2681
- /** Paging options to limit and skip the number of items. */
2682
- paging?: Paging;
2683
- }
2684
-
2685
- declare function createIndex$1(httpClient: HttpClient$1): CreateIndexSignature;
2686
- interface CreateIndexSignature {
2687
- /**
2688
- * Creates an index for a data collection.
2689
- *
2690
- * The index can't be used immediately, as the process of generating the index takes time.
2691
- * You can check whether an index is ready by calling List Indexes.
2692
- *
2693
- * Note that when an index fails to create, the failed index still occupies a slot.
2694
- * To remove the failed index and free up the slot for a new index, call Drop Index.
2695
- * @param - ID of the data collection for which to generate the index.
2696
- * @param - Details of the index to be created.
2697
- * @param - Options for creating an index.
2698
- * @returns Details of the index being generated.
2699
- */
2700
- (dataCollectionId: string, index: Index): Promise<Index & IndexNonNullableFields>;
2701
- }
2702
- declare function dropIndex$1(httpClient: HttpClient$1): DropIndexSignature;
2703
- interface DropIndexSignature {
2704
- /**
2705
- * Removes an index from a data collection.
2706
- *
2707
- * The process of dropping an index from a collection takes time.
2708
- * You can check whether an index has been dropped by calling List Indexes.
2709
- * @param - ID of the data collection for which the index to be dropped is defined.
2710
- * @param - Name of the index to drop.
2711
- * @param - Options for dropping an index.
2712
- */
2713
- (dataCollectionId: string, indexName: string): Promise<void>;
2714
- }
2715
- declare function listIndexes$1(httpClient: HttpClient$1): ListIndexesSignature;
2716
- interface ListIndexesSignature {
2717
- /**
2718
- * Lists all indexes defined for a data collection.
2719
- *
2720
- * When an index's status is `ACTIVE`, it is ready to use.
2721
- * While it is still being created, its status is `BUILDING`.
2722
- *
2723
- * When an index's status is `DROPPED`, it has been dropped successfully.
2724
- * While it is still in the process of being removed, its status is `DROPPING`.
2725
- * @param - ID of the data collection for which to list indexes.
2726
- * @param - Options for retrieving a list of indexes.
2727
- */
2728
- (dataCollectionId: string, options?: ListIndexesOptions | undefined): Promise<ListIndexesResponse & ListIndexesResponseNonNullableFields>;
2729
- }
2730
-
2731
- declare const createIndex: MaybeContext<BuildRESTFunction<typeof createIndex$1> & typeof createIndex$1>;
2732
- declare const dropIndex: MaybeContext<BuildRESTFunction<typeof dropIndex$1> & typeof dropIndex$1>;
2733
- declare const listIndexes: MaybeContext<BuildRESTFunction<typeof listIndexes$1> & typeof listIndexes$1>;
2734
-
2735
- type index_d$1_CreateIndexRequest = CreateIndexRequest;
2736
- type index_d$1_CreateIndexResponse = CreateIndexResponse;
2737
- type index_d$1_CreateIndexResponseNonNullableFields = CreateIndexResponseNonNullableFields;
2738
- type index_d$1_DropIndexRequest = DropIndexRequest;
2739
- type index_d$1_DropIndexResponse = DropIndexResponse;
2740
- type index_d$1_Environment = Environment;
2741
- declare const index_d$1_Environment: typeof Environment;
2742
- type index_d$1_Failure = Failure;
2743
- type index_d$1_Field = Field;
2744
- type index_d$1_Index = Index;
2745
- type index_d$1_IndexNonNullableFields = IndexNonNullableFields;
2746
- type index_d$1_ListAvailableIndexesRequest = ListAvailableIndexesRequest;
2747
- type index_d$1_ListAvailableIndexesResponse = ListAvailableIndexesResponse;
2748
- type index_d$1_ListIndexesOptions = ListIndexesOptions;
2749
- type index_d$1_ListIndexesRequest = ListIndexesRequest;
2750
- type index_d$1_ListIndexesResponse = ListIndexesResponse;
2751
- type index_d$1_ListIndexesResponseNonNullableFields = ListIndexesResponseNonNullableFields;
2752
- type index_d$1_Order = Order;
2753
- declare const index_d$1_Order: typeof Order;
2754
- type index_d$1_Paging = Paging;
2755
- type index_d$1_PagingMetadata = PagingMetadata;
2756
- type index_d$1_Status = Status;
2757
- declare const index_d$1_Status: typeof Status;
2758
- declare const index_d$1_createIndex: typeof createIndex;
2759
- declare const index_d$1_dropIndex: typeof dropIndex;
2760
- declare const index_d$1_listIndexes: typeof listIndexes;
2761
- declare namespace index_d$1 {
2762
- export { type index_d$1_CreateIndexRequest as CreateIndexRequest, type index_d$1_CreateIndexResponse as CreateIndexResponse, type index_d$1_CreateIndexResponseNonNullableFields as CreateIndexResponseNonNullableFields, type index_d$1_DropIndexRequest as DropIndexRequest, type index_d$1_DropIndexResponse as DropIndexResponse, index_d$1_Environment as Environment, type index_d$1_Failure as Failure, type index_d$1_Field as Field, type index_d$1_Index as Index, type index_d$1_IndexNonNullableFields as IndexNonNullableFields, type index_d$1_ListAvailableIndexesRequest as ListAvailableIndexesRequest, type index_d$1_ListAvailableIndexesResponse as ListAvailableIndexesResponse, type index_d$1_ListIndexesOptions as ListIndexesOptions, type index_d$1_ListIndexesRequest as ListIndexesRequest, type index_d$1_ListIndexesResponse as ListIndexesResponse, type index_d$1_ListIndexesResponseNonNullableFields as ListIndexesResponseNonNullableFields, index_d$1_Order as Order, type index_d$1_Paging as Paging, type index_d$1_PagingMetadata as PagingMetadata, index_d$1_Status as Status, index_d$1_createIndex as createIndex, index_d$1_dropIndex as dropIndex, index_d$1_listIndexes as listIndexes };
2763
- }
2764
-
2765
- interface WixDataOptions {
2766
- /**
2767
- * Prevents hooks from running for the operation. Can only be used in the backend code of a Wix site.
2768
- */
2769
- suppressHooks?: boolean;
2770
- /**
2771
- * When `true`, operations include draft items. Read operations include draft items in their response, and write operations modify draft items.
2772
- */
2773
- showDrafts?: boolean;
2774
- /**
2775
- * Optional instructions for [querying Wix app collections](https://dev.wix.com/docs/develop-websites/articles/wix-apps/wix-app-collections/querying-wix-app-collections).
2776
- */
2777
- appOptions?: Record<string, any>;
2778
- }
2779
- interface WixDataReadOptions extends WixDataOptions {
2780
- /**
2781
- * Language to translate result text into, in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
2782
- * If provided, the result text is returned in the specified language. If not provided, the result text is not translated.
2783
- *
2784
- * > **Note:** Translation for the specified language must be enabled for the collection in [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual).
2785
- *
2786
- */
2787
- language?: string;
2788
- /**
2789
- * When true, reads data from the primary database instance. This decreases performance but ensures data retrieved is
2790
- * up-to-date even immediately after an update. Learn more about [Wix Data and Eventual Consistency](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency).
2791
- */
2792
- consistentRead?: boolean;
2793
- }
2794
- interface WixDataReadWithProjectionOptions extends WixDataReadOptions, ProjectionOptions {
2795
- }
2796
- interface WixDataUpdateOptions extends WixDataOptions {
2797
- /**
2798
- * If true, referenced items will be included.
2799
- * @internal
2800
- */
2801
- includeReferences?: boolean;
2802
- }
2803
- interface WixDataQueryOptions extends WixDataReadOptions {
2804
- /**
2805
- * When `true`, the query result include a `totalCount` and `totalPages` properties containing the totals of items
2806
- * matching query. Requesting total count slows down the query.
2807
- *
2808
- * Default: `false`
2809
- */
2810
- returnTotalCount?: boolean;
2811
- }
2812
- interface ProjectionOptions {
2813
- /**
2814
- * Lists of fields to return in a result.
2815
- */
2816
- fields?: string[];
2817
- }
2818
- interface WixDataItem {
2819
- /**
2820
- * Data item ID.
2821
- */
2822
- _id: string;
2823
- /**
2824
- * Date and time the item was added to the collection.
2825
- */
2826
- _createdDate?: Date;
2827
- /**
2828
- * Date and time the item was last modified. When the item is first inserted, `_createdDate` and `_updatedDate` have
2829
- * the same value.
2830
- */
2831
- _updatedDate?: Date;
2832
- /**
2833
- * ID of the user who created the item. Can be modified with site owner permissions.
2834
- */
2835
- _owner?: string;
2836
- /**
2837
- * Data item contents.
2838
- */
2839
- [key: string]: any;
2840
- }
2841
- interface WixDataBulkError extends Error {
2842
- /**
2843
- * Description of the error.
2844
- */
2845
- message: string;
2846
- /**
2847
- * Error code.
2848
- */
2849
- code: string;
2850
- /**
2851
- * Index of the item within the request array. Allows for correlation between request and response items.
2852
- */
2853
- originalIndex: number;
2854
- /**
2855
- * Failed item (or ID in case of `bulkRemove()`).
2856
- */
2857
- item: WixDataItem | string;
2858
- }
2859
- interface WixDataBulkResult {
2860
- /**
2861
- * Number of inserted items.
2862
- */
2863
- inserted: number;
2864
- /**
2865
- * Number of updated items.
2866
- */
2867
- updated: number;
2868
- /**
2869
- * Number of removed items.
2870
- */
2871
- removed: number;
2872
- /**
2873
- * Number of skipped items.
2874
- */
2875
- skipped: number;
2876
- /**
2877
- * List of errors.
2878
- */
2879
- errors: WixDataBulkError[];
2880
- /**
2881
- * List of IDs of inserted items.
2882
- */
2883
- insertedItemIds: string[];
2884
- /**
2885
- * List of IDs of updated items.
2886
- */
2887
- updatedItemIds: string[];
2888
- /**
2889
- * List of IDs of removed items.
2890
- */
2891
- removedItemIds: string[];
2892
- }
2893
-
2894
- /**
2895
- * @builder
2896
- */
2897
- interface WixDataResult<Item = WixDataItem> {
2898
- /**
2899
- * Returns the items that match the query.
2900
- *
2901
- * The current page of items retrieved by the query.
2902
- *
2903
- * The page size is defined by the `limit()`
2904
- * method, can be retrieved using the `pageSize` property, and
2905
- * navigating through pages is done with the `prev()` and
2906
- * `next()` methods.
2907
- *
2908
- * When no items match the query, the `items` array is empty.
2909
- * @public
2910
- * @documentationMaturity preview
2911
- * @readonly
2912
- */
2913
- readonly items: Item[];
2914
- /**
2915
- * Returns the total number of items that match the query.
2916
- *
2917
- * The `totalCount` returns the total number of items that match the query,
2918
- * not just the number of items in the current page.
2919
- *
2920
- * > **Note:** This property is only available when the query's `options.returnTotalCount` parameter is set to `true`.
2921
- * @public
2922
- * @documentationMaturity preview
2923
- * @readonly
2924
- */
2925
- readonly totalCount: number | undefined;
2926
- /**
2927
- * Returns the query page size.
2928
- *
2929
- * The page size is defined by the `limit()`
2930
- * method, can be retrieved using the `pageSize` property, and
2931
- * navigating through pages is done with the `prev()` and
2932
- * `next()` methods.
2933
- * @public
2934
- * @documentationMaturity preview
2935
- * @readonly
2936
- */
2937
- readonly pageSize: number | undefined;
2938
- /**
2939
- * Returns the index of the current results page number.
2940
- *
2941
- * The `currentPage` is a zero-based index of the current page of results.
2942
- *
2943
- * The page size is defined by the `limit()`
2944
- * method, can be retrieved using the `pageSize` property, and
2945
- * navigating through pages is done with the `prev()` and
2946
- * `next()` methods.
2947
- *
2948
- * The `currentPage` property returns `undefined` if the query returned no results.
2949
- * @public
2950
- * @documentationMaturity preview
2951
- * @readonly
2952
- */
2953
- readonly currentPage: number | undefined;
2954
- /**
2955
- * Returns the number of items in the current results page.
2956
- *
2957
- * The page size is defined by the `limit()`
2958
- * method, can be retrieved using the `pageSize` property, and
2959
- * navigating through pages is done with the `prev()` and
2960
- * `next()` methods.
2961
- * @public
2962
- * @documentationMaturity preview
2963
- * @readonly
2964
- */
2965
- readonly length: number;
2966
- /**
2967
- * Returns the total number of pages the query produced.
2968
- *
2969
- * The page size is defined by the `limit()`
2970
- * method, can be retrieved using the `pageSize` property, and
2971
- * navigating through pages is done with the `prev()` and
2972
- * `next()` methods.
2973
- *
2974
- * > **Note:** This property is only available when the query's `options.returnTotalCount` parameter is set to `true`.
2975
- * @public
2976
- * @documentationMaturity preview
2977
- * @readonly
2978
- */
2979
- readonly totalPages: number | undefined;
2980
- /**
2981
- * Retrieves the next page of query results.
2982
- *
2983
- * The `next()` method retrieves the next page of query results.
2984
- *
2985
- * The page size is defined by the `limit()`
2986
- * method, can be retrieved using the `pageSize` property, and
2987
- * navigating through pages is done with the `prev()` and
2988
- * `next()` methods.
2989
- *
2990
- * If items are added or removed between calls to `next()` the values returned may change.
2991
- *
2992
- * >**Note:** The `next()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).
2993
- *
2994
- * @public
2995
- * @documentationMaturity preview
2996
- * @returns A query result object with the next page of query results.
2997
- */
2998
- next(): Promise<WixDataResult<Item>>;
2999
- /**
3000
- * Retrieves the previous page of query results.
3001
- *
3002
- * The `prev()` method retrieves the previous page of query results.
3003
- *
3004
- * The page size is defined by the `limit()`
3005
- * method, can be retrieved using the `pageSize` property, and
3006
- * navigating through pages is done with the `prev()` and
3007
- * `next()` methods.
3008
- *
3009
- * If items are added or removed between calls to `prev()` the values returned
3010
- * may change.
3011
- *
3012
- * >**Note:** The `prev()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).
3013
- *
3014
- * @public
3015
- * @documentationMaturity preview
3016
- * @returns A query result object with the previous page of query results.
3017
- */
3018
- prev(): Promise<WixDataResult<Item>>;
3019
- /**
3020
- * Indicates if the query has more results.
3021
- *
3022
- * @public
3023
- * @documentationMaturity preview
3024
- * @returns `true` if there are more results.
3025
- */
3026
- hasNext(): boolean;
3027
- /**
3028
- * Indicates the query has previous results.
3029
- *
3030
- * @public
3031
- * @documentationMaturity preview
3032
- * @returns `true` if there are previous results.
3033
- */
3034
- hasPrev(): boolean;
3035
- }
3036
-
3037
- /**
3038
- * @builder
3039
- */
3040
- interface WixDataFilter {
3041
- /**
3042
- * Refines a filter to match items whose specified field value equals the specified value.
3043
- *
3044
- * The `eq()` method refines this filter to only
3045
- * match items where the value of the specified field equals the specified `value`.
3046
- *
3047
- * It only matches values of the same type. For example, a number value stored
3048
- * as a String type does not match the same number stored as a Number type.
3049
- *
3050
- * Matching strings with `eq()` is case sensitive, so `"text"` is not equal to `"Text"`.
3051
- *
3052
- * If `field` points to a collection field of type array, `eq()` includes the item as long as at least one array element matches the specified `value`.
3053
- * @public
3054
- * @documentationMaturity preview
3055
- * @param field - Field whose value is compared with `value`.
3056
- * @requiredField field
3057
- * @param value - Value to compare with.
3058
- * @requiredField value
3059
- * @returns Refined filter.
3060
- */
3061
- eq(field: string, value: any): WixDataFilter;
3062
- /**
3063
- * Refines a filter to match items whose specified field value does not equal the specified value.
3064
- *
3065
- * The `ne()` method refines this filter to only
3066
- * match items where the value of the specified field does not equal the specified `value`.
3067
- *
3068
- * It only matches values of the same type. For example, a number value stored
3069
- * as a String type is considered not equal to the same number stored as a Number type.
3070
- *
3071
- * Matching strings with `ne()` is case sensitive, so `"text"` is not equal to `"Text"`.
3072
- *
3073
- * If the value of `field` is an array, `ne()` includes items
3074
- * in which none of the elements of the array match the specified `value`.
3075
- * @public
3076
- * @documentationMaturity preview
3077
- * @param field - Field whose value is compared with `value`.
3078
- * @requiredField field
3079
- * @param value - Value to match.
3080
- * @requiredField value
3081
- * @returns Refined filter.
3082
- */
3083
- ne(field: string, value: any): WixDataFilter;
3084
- /**
3085
- * Refines a filter to match items whose specified field value is greater than or equal to the specified
3086
- * value.
3087
- *
3088
- * The `ge()` method refines this filter to only
3089
- * match items where the value of the specified field is greater than or
3090
- * equal to the specified `value`.
3091
- *
3092
- * It only matches values of the same type. For example, a number value stored
3093
- * as a String type does not match the same number stored as a Number type.
3094
- *
3095
- * If a field contains a number as a String, that value is compared
3096
- * alphabetically and not numerically. Items that do not have a value for the
3097
- * specified field are ranked lowest.
3098
- *
3099
- * The following field types can be compared:
3100
- * - Number: Compares numerically.
3101
- * - Date: Compares JavaScript Date objects.
3102
- * - String: Compares lexicographically,
3103
- * so `"abc"` is greater than or equal to `"ABC"` (because of the greater than),
3104
- * but `"ABC"` is not greater than or equal to `"abc"`.
3105
- * - Reference: Compares by the ID of the referenced item as a String.
3106
- * @public
3107
- * @documentationMaturity preview
3108
- * @param field - Field whose value is compared with `value`.
3109
- * @requiredField field
3110
- * @param value - Value to match.
3111
- * @requiredField value
3112
- * @returns Refined filter.
3113
- */
3114
- ge(field: string, value: string | number | Date): WixDataFilter;
3115
- /**
3116
- * Refines a filter to match items whose specified field value is greater than the specified value.
3117
- *
3118
- * The `gt()` method refines this filter to only match
3119
- * items where the value of the specified field is greater than the specified `value`.
3120
- *
3121
- * It only matches values of the same type. For example, a number value stored
3122
- * as a String type does not match the same number stored as a Number type.
3123
- *
3124
- * If a field contains a number as a String, that value is compared
3125
- * alphabetically and not numerically. Items that do not have a value for the
3126
- * specified field are ranked lowest.
3127
- *
3128
- * The following field types can be compared:
3129
- * - Number: Compares numerically.
3130
- * - Date: Compares JavaScript Date objects.
3131
- * - String: Compares lexicographically, so `"text"` is greater than `"Text"`.
3132
- * - Reference: Compares by the ID of the referenced item as a String.
3133
- * @public
3134
- * @documentationMaturity preview
3135
- * @param field - Field whose value is compared with `value`.
3136
- * @requiredField field
3137
- * @param value - Value to match.
3138
- * @requiredField value
3139
- * @returns An object with the filter definition, based on the supplied parameters.
3140
- */
3141
- gt(field: string, value: string | number | Date): WixDataFilter;
3142
- /**
3143
- * Refines a filter to match items whose specified field value is less than or equal to the specified
3144
- * value.
3145
- *
3146
- * The `le()` method refines this filter to only match
3147
- * items where the value of the specified field is less than or equal to the
3148
- * specified `value`.
3149
- *
3150
- * It only matches values of the same type. For example, a number value stored
3151
- * as a String type does not match the same number stored as a Number type.
3152
- *
3153
- * If a field contains a number as a String, that value is compared
3154
- * alphabetically and not numerically. Items that do not have a value for the
3155
- * specified field are ranked lowest.
3156
- *
3157
- * The following field types can be compared:
3158
- * - Number: Compares numerically.
3159
- * - Date: Compares JavaScript Date objects.
3160
- * - String: Compares lexicographically,
3161
- * so `"ABC"` is less than or equal to `"abc"` (because of the less than),
3162
- * but `"abc"` is not less than or equal to `"ABC"`.
3163
- * - Reference: Compares by the ID of the referenced item as a String.
3164
- * @public
3165
- * @documentationMaturity preview
3166
- * @param field - Field whose value is compared with `value`.
3167
- * @requiredField field
3168
- * @param value - Value to match.
3169
- * @requiredField value
3170
- * @returns Refined filter.
3171
- */
3172
- le(field: string, value: string | number | Date): WixDataFilter;
3173
- /**
3174
- * Refines a filter to match items whose specified field value is less than the specified value.
3175
- *
3176
- * The `lt()` method refines this filter to only match
3177
- * items where the value of the specified field is less than the specified `value`.
3178
- *
3179
- * It only matches values of the same type. For example, a number value stored
3180
- * as a String type does not match the same number stored as a Number type.
3181
- *
3182
- * If a field contains a number as a String, that value is compared
3183
- * alphabetically and not numerically. Items that do not have a value for the
3184
- * specified field are ranked lowest.
3185
- *
3186
- * The following field types can be compared:
3187
- * - Number: Compares numerically.
3188
- * - Date: Compares JavaScript Date objects.
3189
- * - String: Compares lexicographically, so `"Text"` is less than `"text"`.
3190
- * - Reference: Compares by the ID of the referenced item as a String.
3191
- * @public
3192
- * @documentationMaturity preview
3193
- * @param field - Field whose value is compared with `value`.
3194
- * @requiredField field
3195
- * @param value - Value to match.
3196
- * @requiredField value
3197
- * @returns An object with the filter definition, based on the supplied parameters.
3198
- */
3199
- lt(field: string, value: string | number | Date): WixDataFilter;
3200
- /**
3201
- * Refines a filter to match items whose specified field has any value.
3202
- *
3203
- * The `isNotEmpty()` method refines this filter to only match items where the
3204
- * value of the specified field is not `null` or `undefined`.
3205
- *
3206
- * If the field contains any value at all for a given item, including the
3207
- * empty string or an invalid value, that item will match the filter.
3208
- * @public
3209
- * @documentationMaturity preview
3210
- * @param field - Field in which to check for a value.
3211
- * @requiredField field
3212
- * @returns Refined filter.
3213
- */
3214
- isNotEmpty(field: string): WixDataFilter;
3215
- /**
3216
- * Refines a filter to match items whose specified field does not exist or does not have any value.
3217
- *
3218
- * The `isEmpty()` method refines this filter to only match items where the
3219
- * value of the specified field is `null` or `undefined` or the field does
3220
- * not exist.
3221
- *
3222
- * If the field contains any value at all for a given item, including the
3223
- * empty string or an invalid value, that item will match the filter.
3224
- * @public
3225
- * @documentationMaturity preview
3226
- * @param field - Field in which to check for a value.
3227
- * @requiredField field
3228
- * @returns An object representing the refined filter.
3229
- */
3230
- isEmpty(field: string): WixDataFilter;
3231
- /**
3232
- * Refines a filter to match items whose specified field value starts with a specified string.
3233
- *
3234
- * The `startsWith()` method refines this filter to
3235
- * only match items where the value of the specified field starts with the
3236
- * defined `string`. Matching with `startsWith()` is not case sensitive, so `"TEXT"` starts
3237
- * with `"tex"`.
3238
- *
3239
- * You can only use `startsWith()` with a field whose value is a String or Reference.
3240
- * When using a Reference, `startsWith()` matches by the ID of the referenced item as Strings.
3241
- * @public
3242
- * @documentationMaturity preview
3243
- * @param field - Field whose value is compared with the `value` parameter.
3244
- * @requiredField field
3245
- * @param value - Value to look for at the beginning of the specified field value.
3246
- * @requiredField value
3247
- * @returns Refined filter.
3248
- */
3249
- startsWith(field: string, value: string): WixDataFilter;
3250
- /**
3251
- * Refines a filter to match items whose specified field value ends with a specified string.
3252
- *
3253
- * The `endsWith()` method refines this filter to only
3254
- * match items where the value of the specified field ends with the specified
3255
- * `string`. Matching with `endsWith()` is not case sensitive, so `"TEXT"` ends
3256
- * with `"ext"`.
3257
- *
3258
- * You can only use `endsWith()` with a field whose value is a String or Reference.
3259
- * When using a Reference, `endsWith()` matches by the ID of the referenced item as Strings.
3260
- * @public
3261
- * @documentationMaturity preview
3262
- * @param field - Field whose value is compared with the string.
3263
- * @requiredField field
3264
- * @param value - Value to look for at the end of the specified field value.
3265
- * @requiredField value
3266
- * @returns Refined filter.
3267
- */
3268
- endsWith(field: string, value: string): WixDataFilter;
3269
- /**
3270
- * Refines a filter to match items whose specified field value contains the specified value.
3271
- *
3272
- * The `contains()` method refines the filter to only match items for which the value of the specified field contains the specified value. `contains()` is not case-sensitive, so the value `sunday` is considered to contain the value `Sun`.
3273
- *
3274
- * You can use `contains()` with a field whose type is a string or a reference. However, for fields whose type is reference, `contains()` matches by the ID of the referenced item as a string. Instead, use the [`eq()`](https://dev.wix.com/docs/sdk/backend-modules/data/wix-data-items-sdk-1-0-0/wix-data-filter/eq) method.
3275
- * @public
3276
- * @documentationMaturity preview
3277
- * @param field - Field whose value is compared with the provided value.
3278
- * @requiredField field
3279
- * @param value - Value to locate in the specified field value.
3280
- * @requiredField value
3281
- * @returns Refined filter.
3282
- */
3283
- contains(field: string, value: string): WixDataFilter;
3284
- /**
3285
- * Refines a filter to match items whose specified field value equals any of the specified `values`
3286
- * parameters.
3287
- *
3288
- * The `hasSome()` method refines this filter to
3289
- * only match items where the value of the specified field equals any of
3290
- * the specified values.
3291
- *
3292
- * Matching strings with `hasSome()` is case sensitive, so `"text"` is not equal to `"Text"`.
3293
- *
3294
- * If the value of the specified field is an array, `hasSome()` will match
3295
- * if any of the elements of that array match any of the specified values.
3296
- *
3297
- * If the specified field contains multiple references, pass item IDs in the
3298
- * `value` field. In such a case, `hasSome()` will match if any of the
3299
- * multiple references match any of the specified ID values.
3300
- *
3301
- * You can specify a list of values to match by providing an array of
3302
- * String, Number, or Date types as the `value` parameters.
3303
- * @public
3304
- * @documentationMaturity preview
3305
- * @param field - Field whose value is compared with `value`.
3306
- * @requiredField field
3307
- * @param values - Values to match.
3308
- * @requiredField values
3309
- * @returns An object representing the refined filter.
3310
- */
3311
- hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataFilter;
3312
- /**
3313
- * Overload for `hasSome()`
3314
- * @public
3315
- * @documentationMaturity preview
3316
- */
3317
- hasSome(field: string, values: string[] | number[] | Date[]): WixDataFilter;
3318
- /**
3319
- * Refines a filter to match items whose specified field values equals all of the specified `value`
3320
- * parameters.
3321
- *
3322
- * The `hasAll()` method refines this filter to
3323
- * only match items where the value of the specified field equals all of
3324
- * the specified values.
3325
- *
3326
- * Matching strings with `hasAll()` is case sensitive, so `"text"` is not equal to `"Text"`.
3327
- *
3328
- * If the value of the specified field is an array, `hasAll()` will match
3329
- * if there is a match in the elements of that array for all of the specified
3330
- * values.
3331
- *
3332
- * You can specify a list of values to match by providing an array of
3333
- * String, Number, or Date types as the `value` parameters.
3334
- * @public
3335
- * @documentationMaturity preview
3336
- * @param field - Field whose value is compared with `values`.
3337
- * @requiredField field
3338
- * @param values - Values to match.
3339
- * @requiredField values
3340
- * @returns An object representing the refined filter.
3341
- */
3342
- hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataFilter;
3343
- /**
3344
- * Overload for `hasAll()`
3345
- * @public
3346
- * @documentationMaturity preview
3347
- */
3348
- hasAll(field: string, values: string[] | number[] | Date[]): WixDataFilter;
3349
- /**
3350
- * Adds an `or` condition to the filter.
3351
- *
3352
- * The `or()` method adds an inclusive `or` condition to this filter. A filter
3353
- * with an `or` returns all the items that match the filter as defined up to
3354
- * the `or` method, the items that match the filter passed to the `or`
3355
- * method, and the items that match both.
3356
- *
3357
- * The `or()` method is designed to work with 2 or more queries or filters.
3358
- * If you use it on its own, it will return all the items in a collection.
3359
- * @public
3360
- * @documentationMaturity preview
3361
- * @param filter - Filter to add to the initial filter as an `or` condition.
3362
- * @requiredField filter
3363
- * @returns Object representing the refined filter.
3364
- */
3365
- or(filter: WixDataFilter): WixDataFilter;
3366
- /**
3367
- * Adds an `and` condition to the filter.
3368
- *
3369
- * A filter with an `and` condition returns all items that meet the conditions defined on both sides of the condition.
3370
- *
3371
- * Use the `and()` method when performing compound queries. For example, the final filter in this set of
3372
- * queries returns results where status is either pending or rejected **and** age is either less than 25 or greater
3373
- * than 65.
3374
- *
3375
- * ```js
3376
- * let statusFilter = items.filter()
3377
- * .eq("status", "pending")
3378
- * .or(items.filter().eq("status", "rejected"));
3379
- *
3380
- * let ageFilter = items.filter()
3381
- * .lt("age", 25)
3382
- * .or(items.filter().gt("age", 65));
3383
- *
3384
- * let statusAndAgeFilter = statusFilter.and(ageFilter);
3385
- * ```
3386
- *
3387
- * > **Notes**:
3388
- * > - The `and()` method is designed to work with 2 or more queries or filters. If used with a single query or filter, it returns all items in a collection.
3389
- * > - When chaining multiple `WixDataFilter` methods to a filter, an `and` condition is implied. In such cases, you do not need to call the `and()` method explicitly. For example, this filter returns results where an item `status` is `active` and `age` is greater than 25:
3390
- *
3391
- * ```js
3392
- * items.filter().eq("status", "active").gt("age", 25);
3393
- * ```
3394
- *
3395
- * @public
3396
- * @documentationMaturity preview
3397
- * @param filter - `WixDataFilter` used with an `and` condition.
3398
- * @requiredField filter
3399
- * @returns The compound filter.
3400
- */
3401
- and(filter: WixDataFilter): WixDataFilter;
3402
- /**
3403
- * Adds a `not` condition to the filter.
3404
- *
3405
- * The `not()` method adds a `not` condition to this filter. A filter with a `not`
3406
- * returns all the items that match the filter as defined up to the `not`
3407
- * method, but don't match the filter passed to the `not` method.
3408
- *
3409
- * If the filter only contains a `not()` method, it returns all the items
3410
- * that don't match the filter defined by the `not` method.
3411
- *
3412
- * @public
3413
- * @documentationMaturity preview
3414
- * @param filter - Filter to add to the initial filter as a `not` condition.
3415
- * @requiredField filter
3416
- * @returns Object representing the refined filter.
3417
- */
3418
- not(filter: WixDataFilter): WixDataFilter;
3419
- /**
3420
- * Refines a filter to match items whose specified field value is within the defined range.
3421
- *
3422
- * The `between()` method refines this filter to match items for which the value of the specified field is greater than or equal to `rangeStart` and less than `rangeEnd`. The method only matches values of [the same type](https://support.wix.com/en/article/cms-formerly-content-manager-about-your-collection-fields#field-type).
3423
- *
3424
- * The following types can be compared:
3425
- * - Number: Compared numerically.
3426
- * - Date: Compared as JavaScript Date objects.
3427
- * - String: Compared lexicographically:
3428
- * - `"A"` and `"M"` are considered between `"A"` and `"Z"`, but `"a"`, `"m"`, `"z"` and `"Z"` are not.
3429
- * - `"A"`, `"M"`, `"Z"`, and `"a"` are considered between `"A"` and `"z"`, but `"z"` is not.
3430
- *
3431
- * > **Note**: Items that do not have a value for the specified field are considered as the lowest comparable value and are ranked last.
3432
- *
3433
- * @public
3434
- * @documentationMaturity preview
3435
- * @param field - Field to compare with `rangeStart` and `rangeEnd`.
3436
- * @requiredField field
3437
- * @param rangeStart - Starting value of the range to match.
3438
- * @requiredField rangeStart
3439
- * @param rangeEnd - Ending value of the range to match.
3440
- * @requiredField rangeEnd
3441
- * @returns Refined filter.
3442
- */
3443
- between(field: string, rangeStart: string | number | Date, rangeEnd: string | number | Date): WixDataFilter;
3444
- }
3445
-
3446
- /**
3447
- * @builder
3448
- */
3449
- interface WixDataQuery {
3450
- /**
3451
- * Adds a sort to a query or sort, sorting by the specified properties in descending order.
3452
- *
3453
- * The `descending()` method refines this query to sort in descending order of the specified properties. If you
3454
- * specify more than one property, descending() sorts the results in descending order by each property in the order
3455
- * they are listed.
3456
- *
3457
- * You can sort the following types:
3458
- *
3459
- * Number: Sorts numerically.
3460
- * - Date: Sorts by date and time.
3461
- * - String: Sorts lexicographically, so `"abc"` comes before `"XYZ"`.
3462
- * - Reference: Compares by the ID of the referenced item as a String.
3463
- *
3464
- * If a property contains a number as a String, that value is sorted alphabetically and not numerically. Items
3465
- * that do not have a value for the specified sort property are ranked lowest.
3466
- * @public
3467
- * @documentationMaturity preview
3468
- * @param fields - Fields used in the sort.
3469
- * @requiredField fields
3470
- * @returns Refined query.
3471
- */
3472
- descending(...fields: string[]): WixDataQuery;
3473
- descending(fields: string[]): WixDataQuery;
3474
- descending(...fields: any): WixDataQuery;
3475
- /**
3476
- * Adds a sort to a query or sort, sorting by the specified properties in ascending order.
3477
- *
3478
- * The `ascending()` method refines this query in ascending order of the specified properties. If you specify more
3479
- * than one property, `ascending()` sorts the results in ascending order by each property in the order they are listed.
3480
- *
3481
- * You can sort the following types:
3482
- * - Number: Sorts numerically.
3483
- * - Date: Sorts by date and time.
3484
- * - String: Sorts lexicographically, so `"abc"` comes after `"XYZ"`.
3485
- * - Reference: Compares by the ID of the referenced item as a String.
3486
- *
3487
- * If a property contains a number as a String, that value is sorted alphabetically and not numerically.
3488
- * Items that do not have a value for the specified sort property are ranked lowest.
3489
- * @public
3490
- * @documentationMaturity preview
3491
- * @param fields - Fields used in the sort.
3492
- * @requiredField fields
3493
- * @returns Refined query.
3494
- */
3495
- ascending(...fields: string[]): WixDataQuery;
3496
- ascending(fields: string[]): WixDataQuery;
3497
- ascending(...fields: any): WixDataQuery;
3498
- /**
3499
- * Refines a query to match items whose specified property value equals the specified value.
3500
- *
3501
- * The `eq()` method refines this query to only
3502
- * match items where Value of the specified property equals the specified `value`.
3503
- *
3504
- * It only matches values of the same type. For example, a number value stored
3505
- * as a String type does not match the same number stored as a Number type.
3506
- *
3507
- * Matching strings with `eq()` is case sensitive, so `"text"` is not equal to `"Text"`.
3508
- *
3509
- * If `field` points to a collection field of type array, `eq()` includes the item
3510
- * as long as at least one array element matches the specified `value`.
3511
- * @public
3512
- * @documentationMaturity preview
3513
- * @param field - Field whose value is compared with `value`.
3514
- * @requiredField field
3515
- * @param value - Value to match.
3516
- * @requiredField value
3517
- * @returns Refined query.
3518
- */
3519
- eq(field: string, value: any): WixDataQuery;
3520
- /**
3521
- * Refines a query to match items whose specified property value does not equal the specified value.
3522
- *
3523
- * The `ne()` method refines this query to only
3524
- * match items where the value of the specified property does not equal the specified `value`.
3525
- *
3526
- * It only matches values of the same type. For example, a number value stored
3527
- * as a String type is considered not equal to the same number stored as a Number type.
3528
- *
3529
- * Matching strings with `ne()` is case sensitive, so `"text"` is not equal to `"Text"`.
3530
- *
3531
- * If the value of the `field` property is an array, `ne()` includes items
3532
- * in which none of the elements of the array match the specified `value`.
3533
- * @public
3534
- * @documentationMaturity preview
3535
- * @param field - Field whose value is compared with `value`.
3536
- * @requiredField field
3537
- * @param value - Value to match.
3538
- * @requiredField value
3539
- * @returns Refined query.
3540
- */
3541
- ne(field: string, value: any): WixDataQuery;
3542
- /**
3543
- * Refines a query to match items whose specified property value is greater than or equal to the specified
3544
- * value.
3545
- *
3546
- * The `ge()` method refines this query to only
3547
- * match items where the value of the specified property is greater than or
3548
- * equal to the specified `value`.
3549
- *
3550
- * It only matches values of the same type. For example, a number value stored
3551
- * as a String type does not match the same number stored as a Number type.
3552
- *
3553
- * If a property contains a number as a String, that value is compared
3554
- * alphabetically and not numerically. Items that do not have a value for the
3555
- * specified property are ranked lowest.
3556
- *
3557
- * The following types of properties can be compared:
3558
- * - Number: Compares numerically.
3559
- * - Date: Compares JavaScript Date objects.
3560
- * - String: Compares lexicographically,
3561
- * so `"abc"` is greater than or equal to `"ABC"` (because of the greater than),
3562
- * but `"ABC"` is not greater than or equal to `"abc"`.
3563
- * - Reference: Compares by the ID of the referenced item as a String.
3564
- * @public
3565
- * @documentationMaturity preview
3566
- * @param field - Field whose value is compared with `value`.
3567
- * @requiredField field
3568
- * @param value - Value to match.
3569
- * @requiredField value
3570
- * @returns Refined query.
3571
- */
3572
- ge(field: string, value: string | number | Date): WixDataQuery;
3573
- /**
3574
- * Refines a query to match items whose specified property value is greater than the specified value.
3575
- *
3576
- * The `gt()` method refines this query to only match
3577
- * items where the value of the specified property is greater than the specified `value`.
3578
- *
3579
- * It only matches values of the same type. For example, a number value stored
3580
- * as a String type does not match the same number stored as a Number type.
3581
- *
3582
- * If a property contains a number as a String, that value is compared
3583
- * alphabetically and not numerically. Items that do not have a value for the
3584
- * specified property are ranked lowest.
3585
- *
3586
- * The following types of properties can be compared:
3587
- * - Number: Compares numerically.
3588
- * - Date: Compares JavaScript Date objects.
3589
- * - String: Compares lexicographically, so `"text"` is greater than `"Text"`.
3590
- * - Reference: Compares by the ID of the referenced item as a String.
3591
- * @public
3592
- * @documentationMaturity preview
3593
- * @param field - Field whose value is compared with `value`.
3594
- * @requiredField field
3595
- * @param value - Value to match.
3596
- * @requiredField value
3597
- * @returns An object with the query definition, based on the supplied parameters.
3598
- */
3599
- gt(field: string, value: string | number | Date): WixDataQuery;
3600
- /**
3601
- * Refines a query to match items whose specified property value is less than or equal to the specified
3602
- * value.
3603
- *
3604
- * The `le()` method refines this query to only match
3605
- * items where the value of the specified property is less than or equal to the
3606
- * specified `value`.
3607
- *
3608
- * It only matches values of the same type. For example, a number value stored
3609
- * as a String type does not match the same number stored as a Number type.
3610
- *
3611
- * If a property contains a number as a String, that value is compared
3612
- * alphabetically and not numerically. Items that do not have a value for the
3613
- * specified property are ranked lowest.
3614
- *
3615
- * The following types of properties can be compared:
3616
- * - Number: Compares numerically.
3617
- * - Date: Compares JavaScript Date objects.
3618
- * - String: Compares lexicographically,
3619
- * so `"ABC"` is less than or equal to `"abc"` (because of the less than),
3620
- * but `"abc"` is not less than or equal to `"ABC"`.
3621
- * - Reference: Compares by the ID of the referenced item as a String.
3622
- * @public
3623
- * @documentationMaturity preview
3624
- * @param field - Field whose value is compared with `value`.
3625
- * @requiredField field
3626
- * @param value - Value to match.
3627
- * @requiredField value
3628
- * @returns Refined query.
3629
- */
3630
- le(field: string, value: string | number | Date): WixDataQuery;
3631
- /**
3632
- * Refines a query to match items whose specified property value is less than the specified value.
3633
- *
3634
- * The `lt()` method refines this query to only match
3635
- * items where the value of the specified property is less than the specified `value`.
3636
- *
3637
- * It only matches values of the same type. For example, a number value stored
3638
- * as a String type does not match the same number stored as a Number type.
3639
- *
3640
- * If a property contains a number as a String, that value is compared
3641
- * alphabetically and not numerically. Items that do not have a value for the
3642
- * specified property are ranked lowest.
3643
- *
3644
- * The following types of properties can be compared:
3645
- * - Number: Compares numerically.
3646
- * - Date: Compares JavaScript Date objects.
3647
- * - String: Compares lexicographically, so `"Text"` is less than `"text"`.
3648
- * - Reference: Compares by the ID of the referenced item as a String.
3649
- * @public
3650
- * @documentationMaturity preview
3651
- * @param field - Field whose value is compared with `value`.
3652
- * @requiredField field
3653
- * @param value - Value to match.
3654
- * @requiredField value
3655
- * @returns An object with the query definition, based on the supplied parameters.
3656
- */
3657
- lt(field: string, value: string | number | Date): WixDataQuery;
3658
- /**
3659
- * Refines a query to match items whose specified property has any value.
3660
- *
3661
- * The `isNotEmpty()` method refines this query to only match items where the
3662
- * value of the specified property is not `null` or `undefined`.
3663
- *
3664
- * If the property contains any value at all for a given item, including the
3665
- * empty string or an invalid value, that item will match the query.
3666
- * @public
3667
- * @documentationMaturity preview
3668
- * @param field - Field in which to check for a value.
3669
- * @requiredField field
3670
- * @returns Refined query.
3671
- */
3672
- isNotEmpty(field: string): WixDataQuery;
3673
- /**
3674
- * Refines a query to match items whose specified property does not exist or does not have any value.
3675
- *
3676
- * The `isEmpty()` method refines this query to only match items where the
3677
- * value of the specified property is `null` or `undefined` or the property does
3678
- * not exist.
3679
- *
3680
- * If the property contains any value at all for a given item, including the
3681
- * empty string or an invalid value, that item will match the query.
3682
- * @public
3683
- * @documentationMaturity preview
3684
- * @param field - Field in which to check for a value.
3685
- * @requiredField field
3686
- * @returns Refined query.
3687
- */
3688
- isEmpty(field: string): WixDataQuery;
3689
- /**
3690
- * Refines a query to match items whose specified property value starts with a specified string.
3691
- *
3692
- * The `startsWith()` method refines this query to
3693
- * only match items where the value of the specified property starts with the
3694
- * defined `string`. Matching with `startsWith()` is not case sensitive, so `"TEXT"` starts
3695
- * with `"tex"`.
3696
- *
3697
- * You can only use `startsWith()` with a property whose value is a String or Reference.
3698
- * When using a Reference, `startsWith()` matches by the ID of the referenced item as Strings.
3699
- * @public
3700
- * @documentationMaturity preview
3701
- * @param field - Field whose value is compared with the `value` parameter.
3702
- * @requiredField field
3703
- * @param value - String to look for at the beginning of the specified property value.
3704
- * @requiredField value
3705
- * @returns `WixDataQuery` object representing the refined query.
3706
- */
3707
- startsWith(field: string, value: string): WixDataQuery;
3708
- /**
3709
- * Refines a query to match items whose specified property value ends with a specified string.
3710
- *
3711
- * The `endsWith()` method refines this query to only
3712
- * match items where the value of the specified property ends with the specified
3713
- * `string`. Matching with `endsWith()` is not case sensitive, so `"TEXT"` ends
3714
- * with `"ext"`.
3715
- *
3716
- * You can only use `endsWith()` with a property whose value is a String or Reference.
3717
- * When using a Reference, `endsWith()` matches by the ID of the referenced item as Strings.
3718
- * @public
3719
- * @documentationMaturity preview
3720
- * @param field - Field whose value is compared with the string.
3721
- * @requiredField field
3722
- * @param value - String to look for at the end of the specified property value.
3723
- * @requiredField value
3724
- * @returns `WixDataQuery` object representing the refined query.
3725
- */
3726
- endsWith(field: string, value: string): WixDataQuery;
3727
- /**
3728
- * Refines a query to match items whose specified property value contains a specified string.
3729
- *
3730
- * The `contains()` method refines this query to
3731
- * only match items where the value of the specified property contains the
3732
- * specified `string`. Matching with `contains()` is not case sensitive, so
3733
- * `"text"` does contain `"Tex"`.
3734
- *
3735
- * You can use `contains()` with a property whose value is a String or a Reference.
3736
- * For properties of type reference it is recommended that you use the [`eq()`](#eq)
3737
- * method instead of `contains()`. With properties that are References, `contains()`
3738
- * matches by the ID of the referenced item as a String.
3739
- * @public
3740
- * @documentationMaturity preview
3741
- * @param field - Field whose value is compared with the string.
3742
- * @requiredField field
3743
- * @param value - The string to look for inside the specified property value.
3744
- * @requiredField value
3745
- * @returns Refined query.
3746
- */
3747
- contains(field: string, value: string): WixDataQuery;
3748
- /**
3749
- * Refines a query to match items whose specified property value equals any of the specified `values`
3750
- * parameters.
3751
- *
3752
- * The `hasSome()` method refines this query to
3753
- * only match items where the value of the specified property equals any of
3754
- * the specified values.
3755
- *
3756
- * Matching strings with `hasSome()` is case sensitive, so `"text"` is not equal to `"Text"`.
3757
- *
3758
- * If the value of the specified property is an array, `hasSome()` will match
3759
- * if any of the elements of that array match any of the specified values.
3760
- *
3761
- * If the specified property contains multiple references, pass item IDs in the
3762
- * `value` property. In such a case, `hasSome()` will match if any of the
3763
- * multiple references match any of the specified ID values.
3764
- *
3765
- * You can specify a list of values to match by providing an array of
3766
- * String, Number, or Date types as the `value` parameters.
3767
- * @public
3768
- * @documentationMaturity preview
3769
- * @param field - Field whose value is compared with `value`.
3770
- * @requiredField field
3771
- * @param values - Values to match.
3772
- * @requiredField values
3773
- * @returns Refined query.
3774
- */
3775
- hasSome(field: string, ...values: string[] | number[] | Date[]): WixDataQuery;
3776
- /**
3777
- * Overload for `hasSome()`
3778
- * @public
3779
- * @documentationMaturity preview
3780
- */
3781
- hasSome(field: string, values: string[] | number[] | Date[]): WixDataQuery;
3782
- /**
3783
- * Refines a query to match items whose specified property values equals all of the specified `value`
3784
- * parameters.
3785
- *
3786
- * The `hasAll()` method refines this query to
3787
- * only match items where the value of the specified property equals all of
3788
- * the specified values.
3789
- *
3790
- * Matching strings with `hasAll()` is case sensitive, so `"text"` is not equal to `"Text"`.
3791
- *
3792
- * If the value of the specified property is an array, `hasAll()` will match
3793
- * if there is a match in the elements of that array for all of the specified
3794
- * values.
3795
- *
3796
- * You can specify a list of values to match by providing an array of
3797
- * String, Number, or Date types as the `value` parameters.
3798
- * @public
3799
- * @documentationMaturity preview
3800
- * @param field - Field whose value is compared with `value`.
3801
- * @requiredField field
3802
- * @param values - Values to match.
3803
- * @requiredField values
3804
- * @returns Refined query.
3805
- */
3806
- hasAll(field: string, ...values: string[] | number[] | Date[]): WixDataQuery;
3807
- /**
3808
- * Overload for `hasAll()`
3809
- * @public
3810
- * @documentationMaturity preview
3811
- */
3812
- hasAll(field: string, values: string[] | number[] | Date[]): WixDataQuery;
3813
- /**
3814
- * Adds an `or` condition to the query or filter.
3815
- *
3816
- * The `or()` method adds an inclusive `or` condition to this filter. A query or filter
3817
- * with an `or` returns all the items that match the query or filter as defined up to
3818
- * the `or` method, the items that match the query or filter passed to the `or`
3819
- * method, and the items that match both.
3820
- *
3821
- * The `or()` method is designed to work with 2 or more queries or filters. Used on its own, it returns all the items in a collection.
3822
- * @public
3823
- * @documentationMaturity preview
3824
- * @param filter - Filter to add to the initial filter as an `or` condition.
3825
- * @requiredField filter
3826
- * @returns Refined query.
3827
- */
3828
- or(filter: WixDataFilter): WixDataQuery;
3829
- /**
3830
- * Adds an `and` condition to the query or filter.
3831
- *
3832
- * The `and()` method adds an and condition to this query. A query or filter with an `and` returns all the items
3833
- * that match the query or filter as defined up to the `and` method and also match the query or filter passed to
3834
- * the `and` method.
3835
- *
3836
- * Note that when chaining multiple `WixDataFilter` methods to a query an and condition is assumed. In such cases,
3837
- * you do not need to add a call to the `and()` method. For example, this query returns results where status is
3838
- * active **and** age is greater than 25.
3839
- * ```js
3840
- * items.query("myCollection").eq("status", "active").gt("age", 25);
3841
- * ```
3842
- *
3843
- * The `and()` method is needed when performing compound queries. For example, the final query in this set of
3844
- * queries returns results where status is either pending or rejected **and** age is either less than 25 or greater
3845
- * than 65.
3846
- * ```js
3847
- * let statusQuery = items
3848
- * .query("myCollection")
3849
- * .eq("status", "pending")
3850
- * .or(items.filter().eq("status", "rejected"));
3851
- *
3852
- * let ageQuery = items
3853
- * .filter()
3854
- * .lt("age", 25)
3855
- * .or(items.filter().gt("age", 65));
3856
- *
3857
- * let statusAndAgeQuery = statusQuery.and(ageQuery);
3858
- * ```
3859
- *
3860
- * The `and()` method is designed to work with 2 or more queries or filters. When used on its own, it returns all the items in a collection.
3861
- * @public
3862
- * @documentationMaturity preview
3863
- * @param filter - Filter to add to the initial query as an `and` condition.
3864
- * @requiredField filter
3865
- * @returns Refined query.
3866
- */
3867
- and(filter: WixDataFilter): WixDataQuery;
3868
- /**
3869
- * Adds a `not` condition to the query or filter.
3870
- *
3871
- * The `not()` method adds a `not` condition to this query. A query with a `not`
3872
- * returns all the items that match the query as defined up to the `not`
3873
- * method, but don't match the filter passed to the `not` method.
3874
- *
3875
- * If the query only contains a `not()` method, it returns all the items
3876
- * that don't match the filter defined by the `not` method.
3877
- *
3878
- * @public
3879
- * @documentationMaturity preview
3880
- * @param filter - Filter to add to the initial filter as a `not` condition.
3881
- * @requiredField filter
3882
- * @returns Refined query.
3883
- */
3884
- not(filter: WixDataFilter): WixDataQuery;
3885
- /**
3886
- * Refines a query to match items whose specified property value is within a specified range.
3887
- *
3888
- * The `between()` method refines this query to only match items where the value of the specified property is
3889
- * greater than or equal to `rangeStart` and less than `rangeEnd`.
3890
- *
3891
- * It only matches values of the same type. For example, a number value stored as a String type does not match the
3892
- * same number stored as a Number type.
3893
- *
3894
- * If a property contains a number as a String, that value is compared alphabetically and not numerically. Items
3895
- * that do not have a value for the specified property are ranked lowest.
3896
- *
3897
- * The following types of properties can be compared:
3898
- * - Number: Compares numerically.
3899
- * - Date: Compares JavaScript Date objects.
3900
- * - String: Compares lexicographically, so
3901
- * - `"A"` and `"M"` are between `"A"` and `"Z"`, but `"a"`, `"m"`, `"z"` and `"Z"` are not.
3902
- * - `"A"`, `"M"`, `"Z"`, and `"a"` are between `"A"` and `"z"`, but `"z"` is not.
3903
- * @public
3904
- * @documentationMaturity preview
3905
- * @param field - Field whose value is compared with rangeStart and rangeEnd.
3906
- * @requiredField field
3907
- * @param rangeStart - Starting value of the range to match.
3908
- * @requiredField rangeStart
3909
- * @param rangeEnd - Ending value of the range to match.
3910
- * @requiredField rangeEnd
3911
- * @returns Refined query.
3912
- */
3913
- between(field: string, rangeStart: string | number | Date, rangeEnd: string | number | Date): WixDataQuery;
3914
- /**
3915
- * Returns the number of items that match the query.
3916
- *
3917
- * The `count()` method returns a Promise that resolves to the number of
3918
- * items that match the query. The Promise is rejected if `count()` is called
3919
- * with incorrect permissions or if any of the methods used to refine the
3920
- * query is invalid.
3921
- *
3922
- * Calling the `count()` method triggers the [`beforeCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-count) and [`afterCount()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-count) hooks if they have been defined.
3923
- *
3924
- * Use the `options` parameter to run `count()` without checking for permissions
3925
- * or without its registered hooks.
3926
- *
3927
- * Any method that does not filter query results (e.g., [`ascending()`](#ascending))
3928
- * does not affect the result of `count()`.
3929
- *
3930
- * If you build a query and don't refine it with any `WixDataQuery` methods,
3931
- * `count()` returns the total number of items in the collection.
3932
- *
3933
- * > **Note**: You can also retrieve the number of query results by calling `find()` and setting the `options.returnTotalCount` property to `true`.
3934
- *
3935
- * @public
3936
- * @documentationMaturity preview
3937
- * @param options - Options to use when processing this operation.
3938
- * @returns Number of items that match the query.
3939
- */
3940
- count(options?: WixDataReadOptions): Promise<number>;
3941
- /**
3942
- * Returns the distinct values that match the query, without duplicates.
3943
- *
3944
- * The `distinct()` method returns a Promise that resolves to:
3945
- * - The distinct values found in the specified field when running the query.
3946
- * - Additional information about the results, such as the number of values that match the query.
3947
- *
3948
- * Unlike `find()`, which returns all item objects that match the query, `distinct()` returns matching field values,
3949
- * and eliminates duplicate field values from the query result. You cannot use `find()` and `distinct()` together.
3950
- *
3951
- * For an item to be resolved as distinct, only the specified field must be distinct. Other fields for that item in
3952
- * the collection are not evaluated when resolving the promise.
3953
- *
3954
- * The Promise is rejected if `distinct()` is called with incorrect permissions or if any of the
3955
- * methods used to refine the query is invalid.
3956
- *
3957
- * >**Note:** Only site visitors with [Data Read](https://support.wix.com/en/article/collection-permissions-an-overview#permissions) permissions can retrieve and view data. You can override the permissions by calling this method with [elevated permissions](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-elevated-permissions).
3958
- * @public
3959
- * @documentationMaturity preview
3960
- * @param field - Field whose value is compared for distinct values.
3961
- * @requiredField field
3962
- * @param options - Configuration options for building the query.
3963
- * @returns Promise that resolves to the results of the query.
3964
- */
3965
- distinct(field: string, options?: WixDataQueryOptions): Promise<WixDataResult<any>>;
3966
- /**
3967
- * Returns the items that match the query.
3968
- *
3969
- * The `find()` method returns a Promise that resolves to the results found
3970
- * by the query and some information about the results. The Promise is
3971
- * rejected if `find()` is called with incorrect permissions or if any of the
3972
- * methods used to refine the query is invalid.
3973
- *
3974
- * Calling the `find()` method triggers the [`beforeQuery()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/before-query) and [`afterQuery()`](https://dev.wix.com/docs/velo/api-reference/wix-data/hooks/after-query) hooks if they have been defined.
3975
- *
3976
- * > **Note:**
3977
- * > Calling `find()` triggers hooks for the specified collection only. It doesn't trigger hooks for referenced collections.
3978
- *
3979
- * Use the `options` parameter to override default preferences:
3980
- * - Ensure the most up-to-date data is retrieved with `consistentRead`.
3981
- * - Prevent hooks from running with `suppressHooks`.
3982
- * - Get a count of all the items that match the query by setting `returnTotalCount` to `true`.
3983
- *
3984
- * If you build a query and don't refine it with any `wixDataQuery` methods,
3985
- * `find()` returns the entire collection.
3986
- * @public
3987
- * @documentationMaturity preview
3988
- * @param options - Configuration options for building the query.
3989
- * @returns Promise that resolves to the results of the query.
3990
- */
3991
- find(options?: WixDataQueryOptions): Promise<WixDataResult>;
3992
- /**
3993
- * Lists the fields to return in a query's results.
3994
- *
3995
- * The `fields()` method returns only the specified fields in the query's results.
3996
- *
3997
- * You can use `include()` in conjunction with `fields()` to get referenced items.
3998
- *
3999
- * When `fields()` receives an empty or invalid property, the query behaves as follows:
4000
- * - When no fields are specified, the query returns all fields.
4001
- * - When multiple fields are specified but some are invalid, invalid fields are ignored and valid fields are returned.
4002
- * - When only invalid fields are specified, only the default `_id` field is returned.
4003
- * @public
4004
- * @documentationMaturity preview
4005
- * @param fields - Properties to return.
4006
- * @requiredField fields
4007
- * @returns A `WixDataQuery` object representing the query.
4008
- */
4009
- fields(...fields: string[]): WixDataQuery;
4010
- /**
4011
- * Limits the number of items the query returns.
4012
- *
4013
- * The `limit()` method defines the number of results a query returns in each
4014
- * page. Only one page of results is retrieved at a time. The `next()`
4015
- * and `prev()` methods are used to
4016
- * navigate the pages of a query result.
4017
- *
4018
- * By default, `limit` is set to `50`.
4019
- *
4020
- * The maximum value that `limit()` can accept is `1000`.
4021
- *
4022
- * Note that for some [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code), the maximum value `limit()` can accept is
4023
- * less than `1000`. For example, the maximum limit for the Wix `Stores/Product` collection is 100.
4024
- * @public
4025
- * @documentationMaturity preview
4026
- * @param limitNumber - Number of items to return, which is also the `pageSize` of the results object.
4027
- * @requiredField limitNumber
4028
- * @returns `WixDataQuery` object representing the refined query.
4029
- */
4030
- limit(limitNumber: number): WixDataQuery;
4031
- /**
4032
- * Sets the number of items to skip before returning query results.
4033
- *
4034
- * The `skip()` method defines the number of results to skip in the query
4035
- * results before returning new query results.
4036
- *
4037
- * For example, if you query a collection and 50 items match your query, but
4038
- * you set `skip` to 10, the results returned will skip the first 10 items
4039
- * that match and return the 11th through 50th items.
4040
- *
4041
- * By default, `skip` is set to 0.
4042
- * @public
4043
- * @documentationMaturity preview
4044
- * @param skipCount - Number of items to skip in the query results before returning the results.
4045
- * @requiredField skipCount
4046
- * @returns `WixDataQuery` object representing the refined query.
4047
- */
4048
- skip(skipCount: number): WixDataQuery;
4049
- /**
4050
- * Includes referenced items for the specified properties in a query's results.
4051
- *
4052
- * The `include()` method refines a query so that the items returned in the
4053
- * query's results include the full referenced items for the specified properties.
4054
- *
4055
- * For example, suppose you have a **books** collection with an **author**
4056
- * field that references an **authors** collection. Querying the **books**
4057
- * collection with an `include("author")` returns the relevant book items
4058
- * and each item will include the full referenced author item in the book's
4059
- * `author` property.
4060
- *
4061
- * When querying a collection that contains a reference field without using the
4062
- * `include()` method:
4063
- * - Single reference field: returned items contain only the ID of the
4064
- * referenced item, and not the full referenced items.
4065
- * - Multiple reference field: returned items do not contain the multiple
4066
- * reference field at all.
4067
- *
4068
- * When including a property with multiple references, the following limitations
4069
- * apply:
4070
- * - Only one property with multiple references can be included.
4071
- * - The query will return an error if more than 50 items are returned, regardless
4072
- * of any query limit set using the `limit()` method.
4073
- * - Each returned item can include up to 50 referenced items. If there are more
4074
- * than 50 referenced items, only 50 are returned when the query is run
4075
- * and the `partialIncludes`
4076
- * property of the returned `WixDataQueryResult`
4077
- * is `true`. To retrieve more than 50 referenced items, use the
4078
- * `queryReferenced()` method.
4079
- *
4080
- * For a discussion of when to use the similar `queryReferenced()`
4081
- * method and when to use `include()`, see [Querying Items that Reference Other Items](https://support.wix.com/en/article/including-referenced-data-when-filtering).
4082
- *
4083
- * > **Note:** The `include()` method is not supported for [single-item collections](https://support.wix.com/en/article/cms-adding-and-setting-up-a-single-item-collection).
4084
- *
4085
- * @public
4086
- * @documentationMaturity preview
4087
- * @param fields - Fields for which to include referenced items.
4088
- * @requiredField fields
4089
- * @returns A `WixDataQuery` object representing the query.
4090
- */
4091
- include(...fields: string[]): WixDataQuery;
4092
- /**
4093
- * Overload for `include()`
4094
- * @public
4095
- * @documentationMaturity preview
4096
- */
4097
- include(field: string, limit?: number): WixDataQuery;
4098
- /**
4099
- * Overload for `include()`
4100
- * @public
4101
- * @documentationMaturity preview
4102
- */
4103
- include(field1: string, field2: string, limit?: number): WixDataQuery;
4104
- /**
4105
- * Overload for `include()`
4106
- * @public
4107
- * @documentationMaturity preview
4108
- */
4109
- include(field1: string, field2: string, field3: string, limit?: number): WixDataQuery;
4110
- /**
4111
- * Overload for `include()`
4112
- * @public
4113
- * @documentationMaturity preview
4114
- */
4115
- include(field1: string, field2: string, field3: string, field4: string, limit?: number): WixDataQuery;
4116
- /**
4117
- * Overload for `include()`
4118
- * @public
4119
- * @documentationMaturity preview
4120
- */
4121
- include(field1: string, field2: string, field3: string, field4: string, field5: string, limit?: number): WixDataQuery;
4122
- /**
4123
- * Overload for `include()`
4124
- * @public
4125
- * @documentationMaturity preview
4126
- */
4127
- include(...fieldNamesAndLimit: [...string[], number]): WixDataQuery;
4128
- /**
4129
- * Overload for `include()`
4130
- * @public
4131
- * @documentationMaturity preview
4132
- */
4133
- include(...args: unknown[]): WixDataQuery;
4134
- }
4135
-
4136
- interface FieldUpdate {
4137
- fieldPath: string;
4138
- action: 'SET_FIELD' | 'REMOVE_FIELD' | 'INCREMENT_FIELD' | 'APPEND_TO_ARRAY' | 'REMOVE_FROM_ARRAY';
4139
- actionOptions?: any;
4140
- }
4141
- interface BulkPatchParams {
4142
- collectionName: string;
4143
- itemIds: string[];
4144
- invalidArguments: string[];
4145
- fieldUpdates: FieldUpdate[];
4146
- }
4147
- interface PatchParams {
4148
- collectionName: string;
4149
- itemId: string;
4150
- invalidArguments: string[];
4151
- fieldUpdates: FieldUpdate[];
4152
- }
4153
- type OnRun = (args: IArguments, params: PatchParams, options?: WixDataOptions) => Promise<WixDataItem | null>;
4154
- type OnBulkRun = (args: IArguments, params: BulkPatchParams, options?: WixDataOptions) => Promise<WixDataBulkResult>;
4155
- declare abstract class WixDataPatchBase<Self> {
4156
- protected readonly fieldUpdates: FieldUpdate[];
4157
- protected readonly collectionName: string;
4158
- protected readonly ownInvalidArguments: string[];
4159
- constructor(origin: {
4160
- collectionName: string;
4161
- invalidArguments?: string[];
4162
- fieldUpdates?: FieldUpdate[];
4163
- });
4164
- protected abstract copy(params: {
4165
- invalidArguments?: string[];
4166
- addFieldUpdate: FieldUpdate;
4167
- }): Self;
4168
- incrementField(fieldName: string, by: number): Self;
4169
- setField(fieldName: string, value: any): Self;
4170
- appendToArray(fieldName: string, value: any): Self;
4171
- removeFromArray(fieldName: string, value: any): Self;
4172
- removeField(fieldName: string): Self;
4173
- private patchValidator;
4174
- }
4175
- declare class WixDataBulkPatch extends WixDataPatchBase<WixDataBulkPatch> {
4176
- private readonly onRun;
4177
- readonly itemIds: string[];
4178
- constructor(origin: {
4179
- collectionName: string;
4180
- itemIds: string[];
4181
- invalidArguments?: string[];
4182
- fieldUpdates?: FieldUpdate[];
4183
- onRun: OnBulkRun;
4184
- });
4185
- protected copy(params: {
4186
- invalidArguments?: string[];
4187
- addFieldUpdate: FieldUpdate;
4188
- }): WixDataBulkPatch;
4189
- run(options?: WixDataOptions): Promise<WixDataBulkResult>;
4190
- }
4191
- declare class WixDataPatch extends WixDataPatchBase<WixDataPatch> {
4192
- private readonly onRun;
4193
- readonly itemId: string;
4194
- constructor(origin: {
4195
- collectionName: string;
4196
- itemId: string;
4197
- invalidArguments?: string[];
4198
- fieldUpdates?: FieldUpdate[];
4199
- onRun: OnRun;
4200
- });
4201
- protected copy(params: {
4202
- invalidArguments?: string[];
4203
- addFieldUpdate: FieldUpdate;
4204
- }): WixDataPatch;
4205
- run(options?: WixDataOptions): Promise<WixDataItem | null>;
4206
- }
4207
-
4208
- /**
4209
- * @builder
4210
- */
4211
- interface WixDataAggregate {
4212
- /**
4213
- * Refines a `WixDataAggregate` to contain the sum from each aggregation group.
4214
- *
4215
- * The `sum()` method refines a `WixDataAggregate` to contain the sum of the
4216
- * values from the specified field for each aggregated group or from the
4217
- * whole collection if no group is defined.
4218
- *
4219
- * When the aggregation is `run()`, the returned `WixDataAggregateResult`
4220
- * object contains an item for each group with the following key:value pairs:
4221
- * - If a value was passed for the optional `projectedField`, the key is named
4222
- * using that value. Otherwise, the key is named using the following format:
4223
- * `"fieldSum"`, where `field` is the name of the specified field.
4224
- * - The value is the sum of the values found in the specified field.
4225
- *
4226
- * Sums can only be calculated on fields of type Number.
4227
- *
4228
- * > **Note:** Aggregations can only be used on collections you have created. They cannot be
4229
- * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).
4230
- * @public
4231
- * @documentationMaturity preview
4232
- * @param field - Field in which to find the sum.
4233
- * @requiredField field
4234
- * @param projectedField - Name of the field in the aggregation results containing the sum.
4235
- * @returns `WixDataAggregate` object representing the refined aggregation.
4236
- */
4237
- sum(field: string, projectedField?: string): WixDataAggregate;
4238
- /**
4239
- * Refines a `WixDataAggregate` to only contain the average value from each aggregation group.
4240
- *
4241
- * The `avg()` method refines a `WixDataAggregate` to contain the average
4242
- * value from the specified field for each aggregated group or from the
4243
- * whole collection if no group is defined.
4244
- *
4245
- * When the aggregation is `run()`, the returned `WixDataAggregateResult`
4246
- * object contains an item for each group with the following key:value pairs:
4247
- * - If a value was passed for the optional `projectedField`, the key is named
4248
- * using that value. Otherwise, the key is named using the following format:
4249
- * `"fieldAvg"`, where `field` is the name of the specified field.
4250
- * - The value is the average of the values found in the specified field.
4251
- *
4252
- * Averages can only be calculated on fields of type Number.
4253
- *
4254
- * > **Note:** Aggregations can only be used on collections you have created. They cannot be
4255
- * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).
4256
- * @public
4257
- * @documentationMaturity preview
4258
- * @param field - Field in which to find the average value.
4259
- * @requiredField field
4260
- * @param projectedField - Field in the aggregation results containing the average value.
4261
- * @returns `WixDataAggregate` object representing the refined aggregation.
4262
- */
4263
- avg(field: string, projectedField?: string): WixDataAggregate;
4264
- /**
4265
- * Refines a `WixDataAggregate` to only contain the minimum value from each aggregation group.
4266
- *
4267
- * The `min()` method refines a `WixDataAggregate` to contain the minimum
4268
- * value from the specified field for each aggregated group or from the
4269
- * whole collection if no group is defined.
4270
- *
4271
- * When the aggregation is `run()`, the returned `WixDataAggregateResult`
4272
- * object contains an item for each group with the following key:value pairs:
4273
- * - If a value was passed for the optional `projectedField`, the key is named
4274
- * using that value. Otherwise, the key is named using the following format:
4275
- * `"fieldMin"`, where `field` is the name of the specified field.
4276
- * - The value is the minimum value found in the specified field.
4277
- *
4278
- * The following types of fields can be compared to determine a minimum value:
4279
- * - Number: Compares numerically.
4280
- * - Date and Time: Compares JavaScript Date objects.
4281
- * - Text: Compares lexicographically, so `"text"` is greater than `"Text"`.
4282
- * - Rich Text: Compares HTML source as text.
4283
- * - URL: Compares as text.
4284
- * - Image: Compares image source as text.
4285
- * - Video: Compares video source as text.
4286
- * - Document: Compares document source as text.
4287
- * - Reference: Compares by the ID of the referenced item as a String.
4288
- *
4289
- * > **Note:** Aggregations can only be used on collections you have created. They cannot be
4290
- * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).
4291
- * @public
4292
- * @documentationMaturity preview
4293
- * @param field - Field in which to find the minimum value.
4294
- * @requiredField field
4295
- * @param projectedField - Name of the field in the aggregation results containing the minimum value.
4296
- * @returns `WixDataAggregate` object representing the refined aggregation.
4297
- */
4298
- min(field: string, projectedField?: string): WixDataAggregate;
4299
- /**
4300
- * Refines a `WixDataAggregate` to only contain the maximum value from each aggregation group.
4301
- *
4302
- * The `max()` method refines a `WixDataAggregate` to contain the maximum
4303
- * value from the specified field for each aggregated group or from the
4304
- * whole collection if no group is defined.
4305
- *
4306
- * When the aggregation is `run()`, the returned `WixDataAggregateResult`
4307
- * object contains an item for each group with the following key:value pairs:
4308
- * - If a value was passed for the optional `projectedField`, the key is named
4309
- * using that value. Otherwise, the key is named using the following format:
4310
- * `"fieldMax"`, where `field` is the name of the specified field.
4311
- * - The value is the maximum value found in the specified field.
4312
- *
4313
- * The following types of fields can be compared to determine a maximum value:
4314
- * - Number: Compares numerically.
4315
- * - Date and Time: Compares JavaScript Date objects.
4316
- * - Text: Compares lexicographically, so `"text"` is greater than `"Text"`.
4317
- * - Rich Text: Compares HTML source as text.
4318
- * - URL: Compares as text.
4319
- * - Image: Compares image source as text.
4320
- * - Video: Compares video source as text.
4321
- * - Document: Compares document source as text.
4322
- * - Reference: Compares by the ID of the referenced item as a String.
4323
- *
4324
- * > **Note:** Aggregations can only be used on collections you have created. They cannot be
4325
- * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).
4326
- * @public
4327
- * @documentationMaturity preview
4328
- * @param field - Field in which to find the maximum value.
4329
- * @requiredField field
4330
- * @param projectedField - Field in the aggregation results that contains the maximum value.
4331
- * @returns `WixDataAggregate` object representing the refined aggregation.
4332
- */
4333
- max(field: string, projectedField?: string): WixDataAggregate;
4334
- /**
4335
- * Refines a `WixDataAggregate` to contain the item count of each group in the aggregation.
4336
- *
4337
- * The `count()` method refines a `WixDataAggregate` contains the item count in each of the aggregate's groups.
4338
- *
4339
- * When the aggregation is `run()`, the returned `WixDataAggregateResult`
4340
- * object contains items with the following additional key:value pair:
4341
- * - The key is named `count`. You can set a custom key using the `projectedField` parameter.
4342
- * - The value is the count of items aggregated in the group.
4343
- *
4344
- * > **Note:** Aggregations can only be used on collections you have created. They cannot be
4345
- * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).
4346
- * @public
4347
- * @documentationMaturity preview
4348
- * @param projectedField - Field in the aggregation results that contains the count value. Default: `count`.
4349
- * @returns `WixDataAggregate` object representing the refined aggregation.
4350
- */
4351
- count(projectedField?: string): WixDataAggregate;
4352
- /**
4353
- * Filters out items from being used in an aggregation.
4354
- *
4355
- * The `filter()` method refines a `WixDataAggregate` so that it only
4356
- * includes items from the aggregate's collection which match the specified
4357
- * filter criteria.
4358
- *
4359
- * To create a filter, use the wix-data `filter()` method.
4360
- *
4361
- * Filtering using `filter()` takes place before grouping is performed on the
4362
- * aggregation. To filter grouped results, use the `having()` method.
4363
- *
4364
- * > **Note:** Aggregations can only be used on collections you have created. They cannot be
4365
- * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).
4366
- * @public
4367
- * @documentationMaturity preview
4368
- * @param filter - Filter to use to filter out items from being used in the aggregation.
4369
- * @requiredField filter
4370
- * @returns `WixDataAggregate` object representing the refined aggregation.
4371
- */
4372
- filter(filter: WixDataFilter): WixDataAggregate;
4373
- /**
4374
- * Groups items together in an aggregation.
4375
- *
4376
- * The `group()` method refines a `WixDataAggregate` so that its items are
4377
- * grouped by the specified field or fields.
4378
- *
4379
- * You can perform aggregations on the groups using the following methods:
4380
- * - `avg()`
4381
- * - `count()`
4382
- * - `max()`
4383
- * - `min()`
4384
- * - `sum()`
4385
- *
4386
- * To filter grouped results, use the `having()` method.
4387
- *
4388
- * > **Notes:**
4389
- * > - Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).
4390
- * > - You can only call the `group()` method once per aggregate query.
4391
- * @public
4392
- * @documentationMaturity preview
4393
- * @param field - Field or fields to group on.
4394
- * @requiredField field
4395
- * @returns `WixDataAggregate` object representing the refined aggregation.
4396
- */
4397
- group(...field: string[]): WixDataAggregate;
4398
- /**
4399
- * Filters out groups from being returned from an aggregation.
4400
- *
4401
- * The `having()` method refines a `WixDataAggregate` so that it only
4402
- * includes groups from the aggregate's grouping which match the specified
4403
- * filter criteria.
4404
- *
4405
- * To create a filter, use the wix-data `filter()` method.
4406
- *
4407
- * Filtering using `having()` takes place after grouping is performed on the
4408
- * aggregation. To filter items before grouping, use the `filter()` method.
4409
- *
4410
- * > **Note:** Aggregations can only be used on collections you have created. They cannot be used in [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).
4411
- * @public
4412
- * @documentationMaturity preview
4413
- * @param filter - Filter to use to filter out groups from being returned from the aggregation.
4414
- * @requiredField filter
4415
- * @returns `WixDataAggregate` object representing the refined aggregation.
4416
- */
4417
- having(filter: WixDataFilter): WixDataAggregate;
4418
- /**
4419
- * Limits the number of items or groups the aggregation returns.
4420
- *
4421
- * The `limit()` method defines the number of results an aggregation returns in each
4422
- * page. Only one page of results is retrieved at a time. The `next()`
4423
- * method is used to navigate the pages of a query result.
4424
- *
4425
- * By default, `limit` is set to `50`.
4426
- *
4427
- * The maximum value that `limit()` can accept is `1000`.
4428
- *
4429
- * > **Note:** Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).
4430
- * @public
4431
- * @documentationMaturity preview
4432
- * @param limit - Number of items or groups to return.
4433
- * @requiredField limit
4434
- * @returns `WixDataAggregate` object representing the refined aggregation.
4435
- */
4436
- limit(limit: number): WixDataAggregate;
4437
- /**
4438
- * Sets the number of items or groups to skip before returning aggregation results.
4439
- *
4440
- * The `skip()` method defines the number of results to skip in the aggregation
4441
- * results before returning new aggregation results.
4442
- *
4443
- * For example, if you perform an aggregation on a collection and 10 groups match
4444
- * your aggregation, but you set `skip` to 3, the results returned will skip
4445
- * the first 3 groups that match and return the 4th through 10th items.
4446
- *
4447
- * By default, `skip` is set to 0.
4448
- *
4449
- * > **Note:** Aggregations can only be used on collections you have created. They cannot be
4450
- * > used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
4451
- * @public
4452
- * @documentationMaturity preview
4453
- * @param skip - Number of items or groups to skip in the aggregation results before returning the results.
4454
- * @requiredField skip
4455
- * @returns `WixDataAggregate` object representing the refined aggregation.
4456
- */
4457
- skip(skip: number): WixDataAggregate;
4458
- /**
4459
- * Adds a sort to a query or sort, sorting by the specified fields in descending order.
4460
- *
4461
- * The `descending()` method refines this query to sort in descending order of the specified fields. If you
4462
- * specify more than one field, descending() sorts the results in descending order by each field in the order
4463
- * they are listed.
4464
- *
4465
- * You can sort the following types:
4466
- *
4467
- * Number: Sorts numerically.
4468
- * - Date: Sorts by date and time.
4469
- * - String: Sorts lexicographically, so `"abc"` comes before `"XYZ"`.
4470
- * - Reference: Compares by the ID of the referenced item as a String.
4471
- *
4472
- * If a field contains a number as a String, that value is sorted alphabetically and not numerically. Items
4473
- * that do not have a value for the specified sort field are ranked lowest.
4474
- *
4475
- * > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
4476
- * @public
4477
- * @documentationMaturity preview
4478
- * @param fields - Fields used in the sort.
4479
- * @requiredField fields
4480
- * @returns Refined query.
4481
- */
4482
- descending(...fields: string[]): WixDataAggregate;
4483
- descending(fields: string[]): WixDataAggregate;
4484
- descending(...fields: any): WixDataAggregate;
4485
- /**
4486
- * Adds a sort to a query or sort, sorting by the specified fields in ascending order.
4487
- *
4488
- * The `ascending()` method refines this query in ascending order of the specified fields. If you specify more
4489
- * than one field, `ascending()` sorts the results in ascending order by each field in the order they are listed.
4490
- *
4491
- * You can sort the following types:
4492
- * - Number: Sorts numerically.
4493
- * - Date: Sorts by date and time.
4494
- * - String: Sorts lexicographically, so `"abc"` comes after `"XYZ"`.
4495
- * - Reference: Compares by the ID of the referenced item as a String.
4496
- *
4497
- * If a field contains a number as a String, that value is sorted alphabetically and not numerically.
4498
- * Items that do not have a value for the specified sort field are ranked lowest.
4499
- *
4500
- * > **Note**: Aggregations can only be used on collections you have created. They cannot be used on [Wix app collections](https://support.wix.com/en/article/cms-formerly-content-manager-working-with-wix-app-collections).
4501
- * @public
4502
- * @documentationMaturity preview
4503
- * @param fields - Fields used in the sort.
4504
- * @requiredField fields
4505
- * @returns Refined query.
4506
- */
4507
- ascending(...fields: string[]): WixDataAggregate;
4508
- ascending(fields: string[]): WixDataAggregate;
4509
- ascending(...fields: any): WixDataAggregate;
4510
- /**
4511
- * Runs the aggregation and returns the results.
4512
- *
4513
- * The `run()` method returns a Promise that resolves to the results found
4514
- * by the aggregation and some information about the results.
4515
- *
4516
- * > **Note:** Aggregations can only be used on collections you have created. They cannot be
4517
- * > used on [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code).
4518
- * @public
4519
- * @documentationMaturity preview
4520
- * @param options - Options to use when running an aggregation.
4521
- * @returns Promise that resolves to the results of the aggregation.
4522
- */
4523
- run(options?: WixDataReadOptions): Promise<WixDataResult<Record<string, any>>>;
4524
- }
4525
-
4526
- type HTTPMethod = 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
4527
- interface HttpClient {
4528
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
4529
- fetchWithAuth: typeof fetch;
4530
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
4531
- getActiveToken?: () => string | undefined;
4532
- }
4533
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
4534
- type HttpResponse<T = any> = {
4535
- data: T;
4536
- status: number;
4537
- statusText: string;
4538
- headers: any;
4539
- request?: any;
4540
- };
4541
- type RequestOptions<_TResponse = any, Data = any> = {
4542
- method: HTTPMethod;
4543
- url: string;
4544
- data?: Data;
4545
- params?: URLSearchParams;
4546
- } & APIMetadata;
4547
- type APIMetadata = {
4548
- methodFqn?: string;
4549
- entityFqdn?: string;
4550
- packageName?: string;
4551
- };
4552
-
4553
- declare global {
4554
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
4555
- interface SymbolConstructor {
4556
- readonly observable: symbol;
4557
- }
4558
- }
4559
-
4560
- declare global {
4561
- interface ContextualClient {
4562
- }
4563
- }
4564
-
4565
- declare const __metadata: {
4566
- PACKAGE_NAME: string;
4567
- };
4568
- declare function insert(httpClient: HttpClient): (dataCollectionId: string, dataItem: Partial<WixDataItem>, options?: WixDataUpdateOptions) => Promise<WixDataItem>;
4569
- declare function update(httpClient: HttpClient): (dataCollectionId: string, data: WixDataItem, options?: WixDataUpdateOptions) => Promise<WixDataItem>;
4570
- declare function save(httpClient: HttpClient): (dataCollectionId: string, data: Partial<WixDataItem>, options?: WixDataUpdateOptions) => Promise<WixDataItem>;
4571
- declare function get(httpClient: HttpClient): (dataCollectionId: string, dataItemId: string, options?: WixDataReadWithProjectionOptions) => Promise<WixDataItem | null>;
4572
- declare function remove(httpClient: HttpClient): (dataCollectionId: string, dataItemId: string, options?: WixDataOptions) => Promise<WixDataItem | null>;
4573
- declare function truncate(httpClient: HttpClient): (dataCollectionId: string) => Promise<void>;
4574
- declare function bulkInsert(httpClient: HttpClient): (dataCollectionId: string, items: Partial<WixDataItem>[], options?: WixDataOptions) => Promise<WixDataBulkResult>;
4575
- declare function bulkUpdate(httpClient: HttpClient): (dataCollectionId: string, items: WixDataItem[], options?: WixDataOptions) => Promise<WixDataBulkResult>;
4576
- declare function bulkSave(httpClient: HttpClient): (dataCollectionId: string, items: Partial<WixDataItem>[], options?: WixDataOptions) => Promise<WixDataBulkResult>;
4577
- declare function bulkRemove(httpClient: HttpClient): (dataCollectionId: string, itemIds: string[], options?: WixDataOptions) => Promise<WixDataBulkResult>;
4578
- declare function isReferenced(httpClient: HttpClient): (dataCollectionId: string, propertyName: string, referringItem: WixDataItem | string, referencedItem: WixDataItem | string, options?: WixDataReadOptions) => Promise<boolean>;
4579
- declare function insertReference(httpClient: HttpClient): (dataCollectionId: string, propertyName: string, referringItem: WixDataItem | string, referencedItem: WixDataItem | string | WixDataItem[] | string[]) => Promise<void>;
4580
- declare function removeReference(httpClient: HttpClient): (dataCollectionId: string, propertyName: string, referringItem: WixDataItem | string, referencedItem: WixDataItem | string | WixDataItem[] | string[]) => Promise<void>;
4581
- declare function replaceReferences(httpClient: HttpClient): (dataCollectionId: string, propertyName: string, referringItem: WixDataItem | string, referencedItem: WixDataItem | string | WixDataItem[] | string[]) => Promise<void>;
4582
- declare function query(httpClient: HttpClient): (dataCollectionId: string) => WixDataQuery;
4583
- declare function patch(httpClient: HttpClient): (dataCollectionId: string, itemId: string) => WixDataPatch;
4584
- declare function bulkPatch(httpClient: HttpClient): (dataCollectionId: string, itemIds: string[]) => WixDataBulkPatch;
4585
- declare function aggregate(httpClient: HttpClient): (dataCollectionId: string) => WixDataAggregate;
4586
- declare function queryReferenced(httpClient: HttpClient): (dataCollectionId: string, holdingItem: WixDataItem | string, relationshipAttribute: string, options?: WixDataReadWithProjectionOptions & {
4587
- order?: "asc" | "desc";
4588
- skip?: number;
4589
- limit?: number;
4590
- }) => Promise<WixDataResult<WixDataItem>>;
4591
- declare function filter(httpClient: HttpClient): () => WixDataFilter;
4592
-
4593
- type index_d_WixDataBulkError = WixDataBulkError;
4594
- type index_d_WixDataBulkResult = WixDataBulkResult;
4595
- type index_d_WixDataItem = WixDataItem;
4596
- type index_d_WixDataOptions = WixDataOptions;
4597
- type index_d_WixDataReadOptions = WixDataReadOptions;
4598
- type index_d_WixDataReadWithProjectionOptions = WixDataReadWithProjectionOptions;
4599
- type index_d_WixDataUpdateOptions = WixDataUpdateOptions;
4600
- declare const index_d___metadata: typeof __metadata;
4601
- declare const index_d_aggregate: typeof aggregate;
4602
- declare const index_d_bulkInsert: typeof bulkInsert;
4603
- declare const index_d_bulkPatch: typeof bulkPatch;
4604
- declare const index_d_bulkRemove: typeof bulkRemove;
4605
- declare const index_d_bulkSave: typeof bulkSave;
4606
- declare const index_d_bulkUpdate: typeof bulkUpdate;
4607
- declare const index_d_filter: typeof filter;
4608
- declare const index_d_get: typeof get;
4609
- declare const index_d_insert: typeof insert;
4610
- declare const index_d_insertReference: typeof insertReference;
4611
- declare const index_d_isReferenced: typeof isReferenced;
4612
- declare const index_d_patch: typeof patch;
4613
- declare const index_d_query: typeof query;
4614
- declare const index_d_queryReferenced: typeof queryReferenced;
4615
- declare const index_d_remove: typeof remove;
4616
- declare const index_d_removeReference: typeof removeReference;
4617
- declare const index_d_replaceReferences: typeof replaceReferences;
4618
- declare const index_d_save: typeof save;
4619
- declare const index_d_truncate: typeof truncate;
4620
- declare const index_d_update: typeof update;
4621
- declare namespace index_d {
4622
- export { type index_d_WixDataBulkError as WixDataBulkError, type index_d_WixDataBulkResult as WixDataBulkResult, type index_d_WixDataItem as WixDataItem, type index_d_WixDataOptions as WixDataOptions, type index_d_WixDataReadOptions as WixDataReadOptions, type index_d_WixDataReadWithProjectionOptions as WixDataReadWithProjectionOptions, type index_d_WixDataUpdateOptions as WixDataUpdateOptions, index_d___metadata as __metadata, index_d_aggregate as aggregate, index_d_bulkInsert as bulkInsert, index_d_bulkPatch as bulkPatch, index_d_bulkRemove as bulkRemove, index_d_bulkSave as bulkSave, index_d_bulkUpdate as bulkUpdate, index_d_filter as filter, index_d_get as get, index_d_insert as insert, index_d_insertReference as insertReference, index_d_isReferenced as isReferenced, index_d_patch as patch, index_d_query as query, index_d_queryReferenced as queryReferenced, index_d_remove as remove, index_d_removeReference as removeReference, index_d_replaceReferences as replaceReferences, index_d_save as save, index_d_truncate as truncate, index_d_update as update };
4623
- }
4624
-
4625
- export { index_d$2 as collections, index_d$3 as externalDatabaseConnections, index_d$1 as indexes, index_d as items };