@wix/data 1.0.154 → 1.0.155

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,39 +1,127 @@
1
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
2
- interface HttpClient {
3
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
1
+ type HostModule$3<T, H extends Host$3> = {
2
+ __type: 'host';
3
+ create(host: H): T;
4
+ };
5
+ type HostModuleAPI$3<T extends HostModule$3<any, any>> = T extends HostModule$3<infer U, any> ? U : never;
6
+ type Host$3<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 bast url to use for API requests, for example `www.wixapis.com`
17
+ */
18
+ apiBaseUrl?: string;
19
+ /**
20
+ * Possible data to be provided by every host, for cross cutting concerns
21
+ * like internationalization, billing, etc.
22
+ */
23
+ essentials?: {
24
+ /**
25
+ * The language of the currently viewed session
26
+ */
27
+ language?: string;
28
+ /**
29
+ * The locale of the currently viewed session
30
+ */
31
+ locale?: string;
32
+ /**
33
+ * Any headers that should be passed through to the API requests
34
+ */
35
+ passThroughHeaders?: Record<string, string>;
36
+ };
37
+ };
38
+
39
+ type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
40
+ interface HttpClient$3 {
41
+ request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
4
42
  fetchWithAuth: typeof fetch;
5
43
  wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
44
+ getActiveToken?: () => string | undefined;
6
45
  }
7
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
8
- type HttpResponse<T = any> = {
46
+ type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
47
+ type HttpResponse$3<T = any> = {
9
48
  data: T;
10
49
  status: number;
11
50
  statusText: string;
12
51
  headers: any;
13
52
  request?: any;
14
53
  };
15
- type RequestOptions<_TResponse = any, Data = any> = {
54
+ type RequestOptions$3<_TResponse = any, Data = any> = {
16
55
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
17
56
  url: string;
18
57
  data?: Data;
19
58
  params?: URLSearchParams;
20
- } & APIMetadata;
21
- type APIMetadata = {
59
+ } & APIMetadata$3;
60
+ type APIMetadata$3 = {
22
61
  methodFqn?: string;
23
62
  entityFqdn?: string;
24
63
  packageName?: string;
25
64
  };
26
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
27
- type EventDefinition<Payload = unknown, Type extends string = string> = {
65
+ type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
66
+ type EventDefinition$6<Payload = unknown, Type extends string = string> = {
28
67
  __type: 'event-definition';
29
68
  type: Type;
30
69
  isDomainEvent?: boolean;
31
70
  transformations?: (envelope: unknown) => Payload;
32
71
  __payload: Payload;
33
72
  };
34
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
35
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
36
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
73
+ declare function EventDefinition$6<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$6<Payload, Type>;
74
+ type EventHandler$6<T extends EventDefinition$6> = (payload: T['__payload']) => void | Promise<void>;
75
+ type BuildEventDefinition$6<T extends EventDefinition$6<any, string>> = (handler: EventHandler$6<T>) => void;
76
+
77
+ type ServicePluginMethodInput$3 = {
78
+ request: any;
79
+ metadata: any;
80
+ };
81
+ type ServicePluginContract$3 = Record<string, (payload: ServicePluginMethodInput$3) => unknown | Promise<unknown>>;
82
+ type ServicePluginMethodMetadata$3 = {
83
+ name: string;
84
+ primaryHttpMappingPath: string;
85
+ transformations: {
86
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$3;
87
+ toREST: (...args: unknown[]) => unknown;
88
+ };
89
+ };
90
+ type ServicePluginDefinition$3<Contract extends ServicePluginContract$3> = {
91
+ __type: 'service-plugin-definition';
92
+ componentType: string;
93
+ methods: ServicePluginMethodMetadata$3[];
94
+ __contract: Contract;
95
+ };
96
+ declare function ServicePluginDefinition$3<Contract extends ServicePluginContract$3>(componentType: string, methods: ServicePluginMethodMetadata$3[]): ServicePluginDefinition$3<Contract>;
97
+ type BuildServicePluginDefinition$3<T extends ServicePluginDefinition$3<any>> = (implementation: T['__contract']) => void;
98
+ declare const SERVICE_PLUGIN_ERROR_TYPE$3 = "wix_spi_error";
99
+
100
+ type RequestContext$3 = {
101
+ isSSR: boolean;
102
+ host: string;
103
+ protocol?: string;
104
+ };
105
+ type ResponseTransformer$3 = (data: any, headers?: any) => any;
106
+ /**
107
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
108
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
109
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
110
+ */
111
+ type Method$3 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
112
+ type AmbassadorRequestOptions$3<T = any> = {
113
+ _?: T;
114
+ url?: string;
115
+ method?: Method$3;
116
+ params?: any;
117
+ data?: any;
118
+ transformResponse?: ResponseTransformer$3 | ResponseTransformer$3[];
119
+ };
120
+ type AmbassadorFactory$3<Request, Response> = (payload: Request) => ((context: RequestContext$3) => AmbassadorRequestOptions$3<Response>) & {
121
+ __isAmbassador: boolean;
122
+ };
123
+ type AmbassadorFunctionDescriptor$3<Request = any, Response = any> = AmbassadorFactory$3<Request, Response>;
124
+ type BuildAmbassadorFunction$3<T extends AmbassadorFunctionDescriptor$3> = T extends AmbassadorFunctionDescriptor$3<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
37
125
 
38
126
  declare global {
39
127
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -42,6 +130,284 @@ declare global {
42
130
  }
43
131
  }
44
132
 
133
+ declare const emptyObjectSymbol$3: unique symbol;
134
+
135
+ /**
136
+ Represents a strictly empty plain object, the `{}` value.
137
+
138
+ 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)).
139
+
140
+ @example
141
+ ```
142
+ import type {EmptyObject} from 'type-fest';
143
+
144
+ // The following illustrates the problem with `{}`.
145
+ const foo1: {} = {}; // Pass
146
+ const foo2: {} = []; // Pass
147
+ const foo3: {} = 42; // Pass
148
+ const foo4: {} = {a: 1}; // Pass
149
+
150
+ // With `EmptyObject` only the first case is valid.
151
+ const bar1: EmptyObject = {}; // Pass
152
+ const bar2: EmptyObject = 42; // Fail
153
+ const bar3: EmptyObject = []; // Fail
154
+ const bar4: EmptyObject = {a: 1}; // Fail
155
+ ```
156
+
157
+ 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}.
158
+
159
+ @category Object
160
+ */
161
+ type EmptyObject$3 = {[emptyObjectSymbol$3]?: never};
162
+
163
+ /**
164
+ Returns a boolean for whether the two given types are equal.
165
+
166
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
167
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
168
+
169
+ Use-cases:
170
+ - If you want to make a conditional branch based on the result of a comparison of two types.
171
+
172
+ @example
173
+ ```
174
+ import type {IsEqual} from 'type-fest';
175
+
176
+ // This type returns a boolean for whether the given array includes the given item.
177
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
178
+ type Includes<Value extends readonly any[], Item> =
179
+ Value extends readonly [Value[0], ...infer rest]
180
+ ? IsEqual<Value[0], Item> extends true
181
+ ? true
182
+ : Includes<rest, Item>
183
+ : false;
184
+ ```
185
+
186
+ @category Type Guard
187
+ @category Utilities
188
+ */
189
+ type IsEqual$3<A, B> =
190
+ (<G>() => G extends A ? 1 : 2) extends
191
+ (<G>() => G extends B ? 1 : 2)
192
+ ? true
193
+ : false;
194
+
195
+ /**
196
+ Filter out keys from an object.
197
+
198
+ Returns `never` if `Exclude` is strictly equal to `Key`.
199
+ Returns `never` if `Key` extends `Exclude`.
200
+ Returns `Key` otherwise.
201
+
202
+ @example
203
+ ```
204
+ type Filtered = Filter<'foo', 'foo'>;
205
+ //=> never
206
+ ```
207
+
208
+ @example
209
+ ```
210
+ type Filtered = Filter<'bar', string>;
211
+ //=> never
212
+ ```
213
+
214
+ @example
215
+ ```
216
+ type Filtered = Filter<'bar', 'foo'>;
217
+ //=> 'bar'
218
+ ```
219
+
220
+ @see {Except}
221
+ */
222
+ type Filter$3<KeyType, ExcludeType> = IsEqual$3<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
223
+
224
+ type ExceptOptions$3 = {
225
+ /**
226
+ Disallow assigning non-specified properties.
227
+
228
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
229
+
230
+ @default false
231
+ */
232
+ requireExactProps?: boolean;
233
+ };
234
+
235
+ /**
236
+ Create a type from an object type without certain keys.
237
+
238
+ We recommend setting the `requireExactProps` option to `true`.
239
+
240
+ 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.
241
+
242
+ 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)).
243
+
244
+ @example
245
+ ```
246
+ import type {Except} from 'type-fest';
247
+
248
+ type Foo = {
249
+ a: number;
250
+ b: string;
251
+ };
252
+
253
+ type FooWithoutA = Except<Foo, 'a'>;
254
+ //=> {b: string}
255
+
256
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
257
+ //=> errors: 'a' does not exist in type '{ b: string; }'
258
+
259
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
260
+ //=> {a: number} & Partial<Record<"b", never>>
261
+
262
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
263
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
264
+ ```
265
+
266
+ @category Object
267
+ */
268
+ type Except$3<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$3 = {requireExactProps: false}> = {
269
+ [KeyType in keyof ObjectType as Filter$3<KeyType, KeysType>]: ObjectType[KeyType];
270
+ } & (Options['requireExactProps'] extends true
271
+ ? Partial<Record<KeysType, never>>
272
+ : {});
273
+
274
+ /**
275
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
276
+
277
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
278
+
279
+ @example
280
+ ```
281
+ import type {ConditionalKeys} from 'type-fest';
282
+
283
+ interface Example {
284
+ a: string;
285
+ b: string | number;
286
+ c?: string;
287
+ d: {};
288
+ }
289
+
290
+ type StringKeysOnly = ConditionalKeys<Example, string>;
291
+ //=> 'a'
292
+ ```
293
+
294
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
295
+
296
+ @example
297
+ ```
298
+ import type {ConditionalKeys} from 'type-fest';
299
+
300
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
301
+ //=> 'a' | 'c'
302
+ ```
303
+
304
+ @category Object
305
+ */
306
+ type ConditionalKeys$3<Base, Condition> = NonNullable<
307
+ // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
308
+ {
309
+ // Map through all the keys of the given base type.
310
+ [Key in keyof Base]:
311
+ // Pick only keys with types extending the given `Condition` type.
312
+ Base[Key] extends Condition
313
+ // Retain this key since the condition passes.
314
+ ? Key
315
+ // Discard this key since the condition fails.
316
+ : never;
317
+
318
+ // Convert the produced object into a union type of the keys which passed the conditional test.
319
+ }[keyof Base]
320
+ >;
321
+
322
+ /**
323
+ Exclude keys from a shape that matches the given `Condition`.
324
+
325
+ 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.
326
+
327
+ @example
328
+ ```
329
+ import type {Primitive, ConditionalExcept} from 'type-fest';
330
+
331
+ class Awesome {
332
+ name: string;
333
+ successes: number;
334
+ failures: bigint;
335
+
336
+ run() {}
337
+ }
338
+
339
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
340
+ //=> {run: () => void}
341
+ ```
342
+
343
+ @example
344
+ ```
345
+ import type {ConditionalExcept} from 'type-fest';
346
+
347
+ interface Example {
348
+ a: string;
349
+ b: string | number;
350
+ c: () => void;
351
+ d: {};
352
+ }
353
+
354
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
355
+ //=> {b: string | number; c: () => void; d: {}}
356
+ ```
357
+
358
+ @category Object
359
+ */
360
+ type ConditionalExcept$3<Base, Condition> = Except$3<
361
+ Base,
362
+ ConditionalKeys$3<Base, Condition>
363
+ >;
364
+
365
+ /**
366
+ * Descriptors are objects that describe the API of a module, and the module
367
+ * can either be a REST module or a host module.
368
+ * This type is recursive, so it can describe nested modules.
369
+ */
370
+ type Descriptors$3 = RESTFunctionDescriptor$3 | AmbassadorFunctionDescriptor$3 | HostModule$3<any, any> | EventDefinition$6<any> | ServicePluginDefinition$3<any> | {
371
+ [key: string]: Descriptors$3 | PublicMetadata$3 | any;
372
+ };
373
+ /**
374
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
375
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
376
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
377
+ * do not match the given host (as they will not work with the given host).
378
+ */
379
+ type BuildDescriptors$3<T extends Descriptors$3, H extends Host$3<any> | undefined, Depth extends number = 5> = {
380
+ done: T;
381
+ recurse: T extends {
382
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$3;
383
+ } ? never : T extends AmbassadorFunctionDescriptor$3 ? BuildAmbassadorFunction$3<T> : T extends RESTFunctionDescriptor$3 ? BuildRESTFunction$3<T> : T extends EventDefinition$6<any> ? BuildEventDefinition$6<T> : T extends ServicePluginDefinition$3<any> ? BuildServicePluginDefinition$3<T> : T extends HostModule$3<any, any> ? HostModuleAPI$3<T> : ConditionalExcept$3<{
384
+ [Key in keyof T]: T[Key] extends Descriptors$3 ? BuildDescriptors$3<T[Key], H, [
385
+ -1,
386
+ 0,
387
+ 1,
388
+ 2,
389
+ 3,
390
+ 4,
391
+ 5
392
+ ][Depth]> : never;
393
+ }, EmptyObject$3>;
394
+ }[Depth extends -1 ? 'done' : 'recurse'];
395
+ type PublicMetadata$3 = {
396
+ PACKAGE_NAME?: string;
397
+ };
398
+
399
+ declare global {
400
+ interface ContextualClient {
401
+ }
402
+ }
403
+ /**
404
+ * A type used to create concerete types from SDK descriptors in
405
+ * case a contextual client is available.
406
+ */
407
+ type MaybeContext$3<T extends Descriptors$3> = globalThis.ContextualClient extends {
408
+ host: Host$3;
409
+ } ? BuildDescriptors$3<T, globalThis.ContextualClient['host']> : T;
410
+
45
411
  /** An external database connection defines a connection between an external database and a Wix site or project. */
46
412
  interface ExternalDatabaseConnection {
47
413
  /**
@@ -459,7 +825,7 @@ interface UpdateExternalDatabaseConnection {
459
825
  capabilities?: Capabilities;
460
826
  }
461
827
 
462
- declare function getExternalDatabaseConnection$1(httpClient: HttpClient): GetExternalDatabaseConnectionSignature;
828
+ declare function getExternalDatabaseConnection$1(httpClient: HttpClient$3): GetExternalDatabaseConnectionSignature;
463
829
  interface GetExternalDatabaseConnectionSignature {
464
830
  /**
465
831
  * Retrieves an external database connection by name.
@@ -468,14 +834,14 @@ interface GetExternalDatabaseConnectionSignature {
468
834
  */
469
835
  (name: string): Promise<ExternalDatabaseConnection & ExternalDatabaseConnectionNonNullableFields>;
470
836
  }
471
- declare function listExternalDatabaseConnections$1(httpClient: HttpClient): ListExternalDatabaseConnectionsSignature;
837
+ declare function listExternalDatabaseConnections$1(httpClient: HttpClient$3): ListExternalDatabaseConnectionsSignature;
472
838
  interface ListExternalDatabaseConnectionsSignature {
473
839
  /**
474
840
  * Retrieves a list of all external database collections associated with the site or project.
475
841
  */
476
842
  (options?: ListExternalDatabaseConnectionsOptions | undefined): Promise<ListExternalDatabaseConnectionsResponse & ListExternalDatabaseConnectionsResponseNonNullableFields>;
477
843
  }
478
- declare function createExternalDatabaseConnection$1(httpClient: HttpClient): CreateExternalDatabaseConnectionSignature;
844
+ declare function createExternalDatabaseConnection$1(httpClient: HttpClient$3): CreateExternalDatabaseConnectionSignature;
479
845
  interface CreateExternalDatabaseConnectionSignature {
480
846
  /**
481
847
  * Creates a new external database connection.
@@ -488,7 +854,7 @@ interface CreateExternalDatabaseConnectionSignature {
488
854
  */
489
855
  (externalDatabaseConnection: ExternalDatabaseConnection, options: CreateExternalDatabaseConnectionOptions): Promise<ExternalDatabaseConnection & ExternalDatabaseConnectionNonNullableFields>;
490
856
  }
491
- declare function updateExternalDatabaseConnection$1(httpClient: HttpClient): UpdateExternalDatabaseConnectionSignature;
857
+ declare function updateExternalDatabaseConnection$1(httpClient: HttpClient$3): UpdateExternalDatabaseConnectionSignature;
492
858
  interface UpdateExternalDatabaseConnectionSignature {
493
859
  /**
494
860
  * Updates an external database connection.
@@ -507,7 +873,7 @@ interface UpdateExternalDatabaseConnectionSignature {
507
873
  */
508
874
  (name: string, externalDatabaseConnection: UpdateExternalDatabaseConnection): Promise<ExternalDatabaseConnection & ExternalDatabaseConnectionNonNullableFields>;
509
875
  }
510
- declare function deleteExternalDatabaseConnection$1(httpClient: HttpClient): DeleteExternalDatabaseConnectionSignature;
876
+ declare function deleteExternalDatabaseConnection$1(httpClient: HttpClient$3): DeleteExternalDatabaseConnectionSignature;
511
877
  interface DeleteExternalDatabaseConnectionSignature {
512
878
  /**
513
879
  * Deletes an external database connection.
@@ -517,17 +883,35 @@ interface DeleteExternalDatabaseConnectionSignature {
517
883
  */
518
884
  (name: string): Promise<void>;
519
885
  }
520
- declare const onExternalDatabaseConnectionCreated$1: EventDefinition<ExternalDatabaseConnectionCreatedEnvelope, "wix.data.v1.external_database_connection_created">;
521
- declare const onExternalDatabaseConnectionUpdated$1: EventDefinition<ExternalDatabaseConnectionUpdatedEnvelope, "wix.data.v1.external_database_connection_updated">;
522
- declare const onExternalDatabaseConnectionDeleted$1: EventDefinition<ExternalDatabaseConnectionDeletedEnvelope, "wix.data.v1.external_database_connection_deleted">;
886
+ declare const onExternalDatabaseConnectionCreated$1: EventDefinition$6<ExternalDatabaseConnectionCreatedEnvelope, "wix.data.v1.external_database_connection_created">;
887
+ declare const onExternalDatabaseConnectionUpdated$1: EventDefinition$6<ExternalDatabaseConnectionUpdatedEnvelope, "wix.data.v1.external_database_connection_updated">;
888
+ declare const onExternalDatabaseConnectionDeleted$1: EventDefinition$6<ExternalDatabaseConnectionDeletedEnvelope, "wix.data.v1.external_database_connection_deleted">;
523
889
 
524
- declare function createEventModule$2<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
890
+ type EventDefinition$5<Payload = unknown, Type extends string = string> = {
891
+ __type: 'event-definition';
892
+ type: Type;
893
+ isDomainEvent?: boolean;
894
+ transformations?: (envelope: unknown) => Payload;
895
+ __payload: Payload;
896
+ };
897
+ declare function EventDefinition$5<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$5<Payload, Type>;
898
+ type EventHandler$5<T extends EventDefinition$5> = (payload: T['__payload']) => void | Promise<void>;
899
+ type BuildEventDefinition$5<T extends EventDefinition$5<any, string>> = (handler: EventHandler$5<T>) => void;
900
+
901
+ declare global {
902
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
903
+ interface SymbolConstructor {
904
+ readonly observable: symbol;
905
+ }
906
+ }
525
907
 
526
- declare const getExternalDatabaseConnection: BuildRESTFunction<typeof getExternalDatabaseConnection$1> & typeof getExternalDatabaseConnection$1;
527
- declare const listExternalDatabaseConnections: BuildRESTFunction<typeof listExternalDatabaseConnections$1> & typeof listExternalDatabaseConnections$1;
528
- declare const createExternalDatabaseConnection: BuildRESTFunction<typeof createExternalDatabaseConnection$1> & typeof createExternalDatabaseConnection$1;
529
- declare const updateExternalDatabaseConnection: BuildRESTFunction<typeof updateExternalDatabaseConnection$1> & typeof updateExternalDatabaseConnection$1;
530
- declare const deleteExternalDatabaseConnection: BuildRESTFunction<typeof deleteExternalDatabaseConnection$1> & typeof deleteExternalDatabaseConnection$1;
908
+ declare function createEventModule$2<T extends EventDefinition$5<any, string>>(eventDefinition: T): BuildEventDefinition$5<T> & T;
909
+
910
+ declare const getExternalDatabaseConnection: MaybeContext$3<BuildRESTFunction$3<typeof getExternalDatabaseConnection$1> & typeof getExternalDatabaseConnection$1>;
911
+ declare const listExternalDatabaseConnections: MaybeContext$3<BuildRESTFunction$3<typeof listExternalDatabaseConnections$1> & typeof listExternalDatabaseConnections$1>;
912
+ declare const createExternalDatabaseConnection: MaybeContext$3<BuildRESTFunction$3<typeof createExternalDatabaseConnection$1> & typeof createExternalDatabaseConnection$1>;
913
+ declare const updateExternalDatabaseConnection: MaybeContext$3<BuildRESTFunction$3<typeof updateExternalDatabaseConnection$1> & typeof updateExternalDatabaseConnection$1>;
914
+ declare const deleteExternalDatabaseConnection: MaybeContext$3<BuildRESTFunction$3<typeof deleteExternalDatabaseConnection$1> & typeof deleteExternalDatabaseConnection$1>;
531
915
 
532
916
  type _publicOnExternalDatabaseConnectionCreatedType = typeof onExternalDatabaseConnectionCreated$1;
533
917
  /**
@@ -596,6 +980,416 @@ declare namespace index_d$3 {
596
980
  export { type ActionEvent$2 as ActionEvent, type BaseEventMetadata$2 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$2 as DomainEvent, type DomainEventBodyOneOf$2 as DomainEventBodyOneOf, type EntityCreatedEvent$2 as EntityCreatedEvent, type EntityDeletedEvent$2 as EntityDeletedEvent, type EntityUpdatedEvent$2 as EntityUpdatedEvent, type EventMetadata$2 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$2 as IdentificationData, type IdentificationDataIdOneOf$2 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$2 as MessageEnvelope, type Paging$3 as Paging, type PagingMetadata$1 as PagingMetadata, index_d$3_ProtocolVersion as ProtocolVersion, type RestoreInfo$2 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$2 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 };
597
981
  }
598
982
 
983
+ type HostModule$2<T, H extends Host$2> = {
984
+ __type: 'host';
985
+ create(host: H): T;
986
+ };
987
+ type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
988
+ type Host$2<Environment = unknown> = {
989
+ channel: {
990
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
991
+ disconnect: () => void;
992
+ } | Promise<{
993
+ disconnect: () => void;
994
+ }>;
995
+ };
996
+ environment?: Environment;
997
+ /**
998
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
999
+ */
1000
+ apiBaseUrl?: string;
1001
+ /**
1002
+ * Possible data to be provided by every host, for cross cutting concerns
1003
+ * like internationalization, billing, etc.
1004
+ */
1005
+ essentials?: {
1006
+ /**
1007
+ * The language of the currently viewed session
1008
+ */
1009
+ language?: string;
1010
+ /**
1011
+ * The locale of the currently viewed session
1012
+ */
1013
+ locale?: string;
1014
+ /**
1015
+ * Any headers that should be passed through to the API requests
1016
+ */
1017
+ passThroughHeaders?: Record<string, string>;
1018
+ };
1019
+ };
1020
+
1021
+ type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
1022
+ interface HttpClient$2 {
1023
+ request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
1024
+ fetchWithAuth: typeof fetch;
1025
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
1026
+ getActiveToken?: () => string | undefined;
1027
+ }
1028
+ type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
1029
+ type HttpResponse$2<T = any> = {
1030
+ data: T;
1031
+ status: number;
1032
+ statusText: string;
1033
+ headers: any;
1034
+ request?: any;
1035
+ };
1036
+ type RequestOptions$2<_TResponse = any, Data = any> = {
1037
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1038
+ url: string;
1039
+ data?: Data;
1040
+ params?: URLSearchParams;
1041
+ } & APIMetadata$2;
1042
+ type APIMetadata$2 = {
1043
+ methodFqn?: string;
1044
+ entityFqdn?: string;
1045
+ packageName?: string;
1046
+ };
1047
+ type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
1048
+ type EventDefinition$4<Payload = unknown, Type extends string = string> = {
1049
+ __type: 'event-definition';
1050
+ type: Type;
1051
+ isDomainEvent?: boolean;
1052
+ transformations?: (envelope: unknown) => Payload;
1053
+ __payload: Payload;
1054
+ };
1055
+ declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
1056
+ type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
1057
+ type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
1058
+
1059
+ type ServicePluginMethodInput$2 = {
1060
+ request: any;
1061
+ metadata: any;
1062
+ };
1063
+ type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
1064
+ type ServicePluginMethodMetadata$2 = {
1065
+ name: string;
1066
+ primaryHttpMappingPath: string;
1067
+ transformations: {
1068
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
1069
+ toREST: (...args: unknown[]) => unknown;
1070
+ };
1071
+ };
1072
+ type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
1073
+ __type: 'service-plugin-definition';
1074
+ componentType: string;
1075
+ methods: ServicePluginMethodMetadata$2[];
1076
+ __contract: Contract;
1077
+ };
1078
+ declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
1079
+ type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
1080
+ declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
1081
+
1082
+ type RequestContext$2 = {
1083
+ isSSR: boolean;
1084
+ host: string;
1085
+ protocol?: string;
1086
+ };
1087
+ type ResponseTransformer$2 = (data: any, headers?: any) => any;
1088
+ /**
1089
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
1090
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
1091
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
1092
+ */
1093
+ type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
1094
+ type AmbassadorRequestOptions$2<T = any> = {
1095
+ _?: T;
1096
+ url?: string;
1097
+ method?: Method$2;
1098
+ params?: any;
1099
+ data?: any;
1100
+ transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
1101
+ };
1102
+ type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
1103
+ __isAmbassador: boolean;
1104
+ };
1105
+ type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
1106
+ type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
1107
+
1108
+ declare global {
1109
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1110
+ interface SymbolConstructor {
1111
+ readonly observable: symbol;
1112
+ }
1113
+ }
1114
+
1115
+ declare const emptyObjectSymbol$2: unique symbol;
1116
+
1117
+ /**
1118
+ Represents a strictly empty plain object, the `{}` value.
1119
+
1120
+ 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)).
1121
+
1122
+ @example
1123
+ ```
1124
+ import type {EmptyObject} from 'type-fest';
1125
+
1126
+ // The following illustrates the problem with `{}`.
1127
+ const foo1: {} = {}; // Pass
1128
+ const foo2: {} = []; // Pass
1129
+ const foo3: {} = 42; // Pass
1130
+ const foo4: {} = {a: 1}; // Pass
1131
+
1132
+ // With `EmptyObject` only the first case is valid.
1133
+ const bar1: EmptyObject = {}; // Pass
1134
+ const bar2: EmptyObject = 42; // Fail
1135
+ const bar3: EmptyObject = []; // Fail
1136
+ const bar4: EmptyObject = {a: 1}; // Fail
1137
+ ```
1138
+
1139
+ 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}.
1140
+
1141
+ @category Object
1142
+ */
1143
+ type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
1144
+
1145
+ /**
1146
+ Returns a boolean for whether the two given types are equal.
1147
+
1148
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
1149
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
1150
+
1151
+ Use-cases:
1152
+ - If you want to make a conditional branch based on the result of a comparison of two types.
1153
+
1154
+ @example
1155
+ ```
1156
+ import type {IsEqual} from 'type-fest';
1157
+
1158
+ // This type returns a boolean for whether the given array includes the given item.
1159
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
1160
+ type Includes<Value extends readonly any[], Item> =
1161
+ Value extends readonly [Value[0], ...infer rest]
1162
+ ? IsEqual<Value[0], Item> extends true
1163
+ ? true
1164
+ : Includes<rest, Item>
1165
+ : false;
1166
+ ```
1167
+
1168
+ @category Type Guard
1169
+ @category Utilities
1170
+ */
1171
+ type IsEqual$2<A, B> =
1172
+ (<G>() => G extends A ? 1 : 2) extends
1173
+ (<G>() => G extends B ? 1 : 2)
1174
+ ? true
1175
+ : false;
1176
+
1177
+ /**
1178
+ Filter out keys from an object.
1179
+
1180
+ Returns `never` if `Exclude` is strictly equal to `Key`.
1181
+ Returns `never` if `Key` extends `Exclude`.
1182
+ Returns `Key` otherwise.
1183
+
1184
+ @example
1185
+ ```
1186
+ type Filtered = Filter<'foo', 'foo'>;
1187
+ //=> never
1188
+ ```
1189
+
1190
+ @example
1191
+ ```
1192
+ type Filtered = Filter<'bar', string>;
1193
+ //=> never
1194
+ ```
1195
+
1196
+ @example
1197
+ ```
1198
+ type Filtered = Filter<'bar', 'foo'>;
1199
+ //=> 'bar'
1200
+ ```
1201
+
1202
+ @see {Except}
1203
+ */
1204
+ type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
1205
+
1206
+ type ExceptOptions$2 = {
1207
+ /**
1208
+ Disallow assigning non-specified properties.
1209
+
1210
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
1211
+
1212
+ @default false
1213
+ */
1214
+ requireExactProps?: boolean;
1215
+ };
1216
+
1217
+ /**
1218
+ Create a type from an object type without certain keys.
1219
+
1220
+ We recommend setting the `requireExactProps` option to `true`.
1221
+
1222
+ 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.
1223
+
1224
+ 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)).
1225
+
1226
+ @example
1227
+ ```
1228
+ import type {Except} from 'type-fest';
1229
+
1230
+ type Foo = {
1231
+ a: number;
1232
+ b: string;
1233
+ };
1234
+
1235
+ type FooWithoutA = Except<Foo, 'a'>;
1236
+ //=> {b: string}
1237
+
1238
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
1239
+ //=> errors: 'a' does not exist in type '{ b: string; }'
1240
+
1241
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
1242
+ //=> {a: number} & Partial<Record<"b", never>>
1243
+
1244
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
1245
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
1246
+ ```
1247
+
1248
+ @category Object
1249
+ */
1250
+ type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
1251
+ [KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
1252
+ } & (Options['requireExactProps'] extends true
1253
+ ? Partial<Record<KeysType, never>>
1254
+ : {});
1255
+
1256
+ /**
1257
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
1258
+
1259
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
1260
+
1261
+ @example
1262
+ ```
1263
+ import type {ConditionalKeys} from 'type-fest';
1264
+
1265
+ interface Example {
1266
+ a: string;
1267
+ b: string | number;
1268
+ c?: string;
1269
+ d: {};
1270
+ }
1271
+
1272
+ type StringKeysOnly = ConditionalKeys<Example, string>;
1273
+ //=> 'a'
1274
+ ```
1275
+
1276
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
1277
+
1278
+ @example
1279
+ ```
1280
+ import type {ConditionalKeys} from 'type-fest';
1281
+
1282
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
1283
+ //=> 'a' | 'c'
1284
+ ```
1285
+
1286
+ @category Object
1287
+ */
1288
+ type ConditionalKeys$2<Base, Condition> = NonNullable<
1289
+ // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
1290
+ {
1291
+ // Map through all the keys of the given base type.
1292
+ [Key in keyof Base]:
1293
+ // Pick only keys with types extending the given `Condition` type.
1294
+ Base[Key] extends Condition
1295
+ // Retain this key since the condition passes.
1296
+ ? Key
1297
+ // Discard this key since the condition fails.
1298
+ : never;
1299
+
1300
+ // Convert the produced object into a union type of the keys which passed the conditional test.
1301
+ }[keyof Base]
1302
+ >;
1303
+
1304
+ /**
1305
+ Exclude keys from a shape that matches the given `Condition`.
1306
+
1307
+ 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.
1308
+
1309
+ @example
1310
+ ```
1311
+ import type {Primitive, ConditionalExcept} from 'type-fest';
1312
+
1313
+ class Awesome {
1314
+ name: string;
1315
+ successes: number;
1316
+ failures: bigint;
1317
+
1318
+ run() {}
1319
+ }
1320
+
1321
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
1322
+ //=> {run: () => void}
1323
+ ```
1324
+
1325
+ @example
1326
+ ```
1327
+ import type {ConditionalExcept} from 'type-fest';
1328
+
1329
+ interface Example {
1330
+ a: string;
1331
+ b: string | number;
1332
+ c: () => void;
1333
+ d: {};
1334
+ }
1335
+
1336
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
1337
+ //=> {b: string | number; c: () => void; d: {}}
1338
+ ```
1339
+
1340
+ @category Object
1341
+ */
1342
+ type ConditionalExcept$2<Base, Condition> = Except$2<
1343
+ Base,
1344
+ ConditionalKeys$2<Base, Condition>
1345
+ >;
1346
+
1347
+ /**
1348
+ * Descriptors are objects that describe the API of a module, and the module
1349
+ * can either be a REST module or a host module.
1350
+ * This type is recursive, so it can describe nested modules.
1351
+ */
1352
+ type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$4<any> | ServicePluginDefinition$2<any> | {
1353
+ [key: string]: Descriptors$2 | PublicMetadata$2 | any;
1354
+ };
1355
+ /**
1356
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
1357
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
1358
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
1359
+ * do not match the given host (as they will not work with the given host).
1360
+ */
1361
+ type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
1362
+ done: T;
1363
+ recurse: T extends {
1364
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
1365
+ } ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
1366
+ [Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
1367
+ -1,
1368
+ 0,
1369
+ 1,
1370
+ 2,
1371
+ 3,
1372
+ 4,
1373
+ 5
1374
+ ][Depth]> : never;
1375
+ }, EmptyObject$2>;
1376
+ }[Depth extends -1 ? 'done' : 'recurse'];
1377
+ type PublicMetadata$2 = {
1378
+ PACKAGE_NAME?: string;
1379
+ };
1380
+
1381
+ declare global {
1382
+ interface ContextualClient {
1383
+ }
1384
+ }
1385
+ /**
1386
+ * A type used to create concerete types from SDK descriptors in
1387
+ * case a contextual client is available.
1388
+ */
1389
+ type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
1390
+ host: Host$2;
1391
+ } ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
1392
+
599
1393
  /** A data collection determines the structure of data to be stored in a database. */
600
1394
  interface DataCollection {
601
1395
  /** Collection ID. For example, `my-first-collection`. May include a namespace. */
@@ -1903,7 +2697,7 @@ interface ListDataCollectionsOptions {
1903
2697
  consistentRead?: boolean;
1904
2698
  }
1905
2699
 
1906
- declare function createDataCollection$1(httpClient: HttpClient): CreateDataCollectionSignature;
2700
+ declare function createDataCollection$1(httpClient: HttpClient$2): CreateDataCollectionSignature;
1907
2701
  interface CreateDataCollectionSignature {
1908
2702
  /**
1909
2703
  * Creates a new data collection.
@@ -1915,7 +2709,7 @@ interface CreateDataCollectionSignature {
1915
2709
  */
1916
2710
  (collection: DataCollection): Promise<DataCollection & DataCollectionNonNullableFields>;
1917
2711
  }
1918
- declare function getDataCollection$1(httpClient: HttpClient): GetDataCollectionSignature;
2712
+ declare function getDataCollection$1(httpClient: HttpClient$2): GetDataCollectionSignature;
1919
2713
  interface GetDataCollectionSignature {
1920
2714
  /**
1921
2715
  * Retrieves a data collection by ID.
@@ -1925,7 +2719,7 @@ interface GetDataCollectionSignature {
1925
2719
  */
1926
2720
  (dataCollectionId: string, options?: GetDataCollectionOptions | undefined): Promise<DataCollection & DataCollectionNonNullableFields>;
1927
2721
  }
1928
- declare function listDataCollections$1(httpClient: HttpClient): ListDataCollectionsSignature;
2722
+ declare function listDataCollections$1(httpClient: HttpClient$2): ListDataCollectionsSignature;
1929
2723
  interface ListDataCollectionsSignature {
1930
2724
  /**
1931
2725
  * Retrieves a list of all data collections associated with the site or project.
@@ -1935,7 +2729,7 @@ interface ListDataCollectionsSignature {
1935
2729
  */
1936
2730
  (options?: ListDataCollectionsOptions | undefined): Promise<ListDataCollectionsResponse & ListDataCollectionsResponseNonNullableFields>;
1937
2731
  }
1938
- declare function updateDataCollection$1(httpClient: HttpClient): UpdateDataCollectionSignature;
2732
+ declare function updateDataCollection$1(httpClient: HttpClient$2): UpdateDataCollectionSignature;
1939
2733
  interface UpdateDataCollectionSignature {
1940
2734
  /**
1941
2735
  * Updates a data collection.
@@ -1955,7 +2749,7 @@ interface UpdateDataCollectionSignature {
1955
2749
  */
1956
2750
  (collection: DataCollection): Promise<DataCollection & DataCollectionNonNullableFields>;
1957
2751
  }
1958
- declare function deleteDataCollection$1(httpClient: HttpClient): DeleteDataCollectionSignature;
2752
+ declare function deleteDataCollection$1(httpClient: HttpClient$2): DeleteDataCollectionSignature;
1959
2753
  interface DeleteDataCollectionSignature {
1960
2754
  /**
1961
2755
  * Deletes a data collection.
@@ -1966,19 +2760,37 @@ interface DeleteDataCollectionSignature {
1966
2760
  */
1967
2761
  (dataCollectionId: string): Promise<void>;
1968
2762
  }
1969
- declare const onDataCollectionClonedEvent$1: EventDefinition<DataCollectionClonedEnvelope, "wix.data.v2.data_collection_data_collection_cloned_event">;
1970
- declare const onDataCollectionChangedEvent$1: EventDefinition<DataCollectionChangedEnvelope, "wix.data.v2.data_collection_data_collection_changed_event">;
1971
- declare const onDataCollectionCreated$1: EventDefinition<DataCollectionCreatedEnvelope, "wix.data.v2.data_collection_created">;
1972
- declare const onDataCollectionUpdated$1: EventDefinition<DataCollectionUpdatedEnvelope, "wix.data.v2.data_collection_updated">;
1973
- declare const onDataCollectionDeleted$1: EventDefinition<DataCollectionDeletedEnvelope, "wix.data.v2.data_collection_deleted">;
2763
+ declare const onDataCollectionClonedEvent$1: EventDefinition$4<DataCollectionClonedEnvelope, "wix.data.v2.data_collection_data_collection_cloned_event">;
2764
+ declare const onDataCollectionChangedEvent$1: EventDefinition$4<DataCollectionChangedEnvelope, "wix.data.v2.data_collection_data_collection_changed_event">;
2765
+ declare const onDataCollectionCreated$1: EventDefinition$4<DataCollectionCreatedEnvelope, "wix.data.v2.data_collection_created">;
2766
+ declare const onDataCollectionUpdated$1: EventDefinition$4<DataCollectionUpdatedEnvelope, "wix.data.v2.data_collection_updated">;
2767
+ declare const onDataCollectionDeleted$1: EventDefinition$4<DataCollectionDeletedEnvelope, "wix.data.v2.data_collection_deleted">;
2768
+
2769
+ type EventDefinition$3<Payload = unknown, Type extends string = string> = {
2770
+ __type: 'event-definition';
2771
+ type: Type;
2772
+ isDomainEvent?: boolean;
2773
+ transformations?: (envelope: unknown) => Payload;
2774
+ __payload: Payload;
2775
+ };
2776
+ declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
2777
+ type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
2778
+ type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
2779
+
2780
+ declare global {
2781
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
2782
+ interface SymbolConstructor {
2783
+ readonly observable: symbol;
2784
+ }
2785
+ }
1974
2786
 
1975
- declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
2787
+ declare function createEventModule$1<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
1976
2788
 
1977
- declare const createDataCollection: BuildRESTFunction<typeof createDataCollection$1> & typeof createDataCollection$1;
1978
- declare const getDataCollection: BuildRESTFunction<typeof getDataCollection$1> & typeof getDataCollection$1;
1979
- declare const listDataCollections: BuildRESTFunction<typeof listDataCollections$1> & typeof listDataCollections$1;
1980
- declare const updateDataCollection: BuildRESTFunction<typeof updateDataCollection$1> & typeof updateDataCollection$1;
1981
- declare const deleteDataCollection: BuildRESTFunction<typeof deleteDataCollection$1> & typeof deleteDataCollection$1;
2789
+ declare const createDataCollection: MaybeContext$2<BuildRESTFunction$2<typeof createDataCollection$1> & typeof createDataCollection$1>;
2790
+ declare const getDataCollection: MaybeContext$2<BuildRESTFunction$2<typeof getDataCollection$1> & typeof getDataCollection$1>;
2791
+ declare const listDataCollections: MaybeContext$2<BuildRESTFunction$2<typeof listDataCollections$1> & typeof listDataCollections$1>;
2792
+ declare const updateDataCollection: MaybeContext$2<BuildRESTFunction$2<typeof updateDataCollection$1> & typeof updateDataCollection$1>;
2793
+ declare const deleteDataCollection: MaybeContext$2<BuildRESTFunction$2<typeof deleteDataCollection$1> & typeof deleteDataCollection$1>;
1982
2794
 
1983
2795
  type _publicOnDataCollectionClonedEventType = typeof onDataCollectionClonedEvent$1;
1984
2796
  /**
@@ -2133,6 +2945,416 @@ declare namespace index_d$2 {
2133
2945
  export { index_d$2_AccessLevel as AccessLevel, type ActionEvent$1 as ActionEvent, type index_d$2_AllowedDataPermissions as AllowedDataPermissions, type index_d$2_ArraySizeRange as ArraySizeRange, type BaseEventMetadata$1 as BaseEventMetadata, 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_DataCollectionChangedEnvelope as DataCollectionChangedEnvelope, type index_d$2_DataCollectionChangedEvent as DataCollectionChangedEvent, type index_d$2_DataCollectionClonedEnvelope as DataCollectionClonedEnvelope, type index_d$2_DataCollectionClonedEvent as DataCollectionClonedEvent, type index_d$2_DataCollectionCreatedEnvelope as DataCollectionCreatedEnvelope, type index_d$2_DataCollectionDeletedEnvelope as DataCollectionDeletedEnvelope, type index_d$2_DataCollectionNonNullableFields as DataCollectionNonNullableFields, type index_d$2_DataCollectionUpdatedEnvelope as DataCollectionUpdatedEnvelope, 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, index_d$2_Direction as Direction, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type EventMetadata$1 as EventMetadata, type 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 IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 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 MessageEnvelope$1 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$2 as Paging, type PagingMetadataV2$1 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 PublishPluginOptions$1 as PublishPluginOptions, index_d$2_QueryOperator as QueryOperator, type index_d$2_Reference as Reference, type index_d$2_RestoreDataCollectionsFromSnapshotRequest as RestoreDataCollectionsFromSnapshotRequest, type index_d$2_RestoreDataCollectionsFromSnapshotResponse as RestoreDataCollectionsFromSnapshotResponse, type RestoreInfo$1 as RestoreInfo, index_d$2_Role as Role, 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, SortOrder$1 as SortOrder, type Sorting$1 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, WebhookIdentityType$1 as WebhookIdentityType, type index_d$2__Array as _Array, type index_d$2__Object as _Object, type index_d$2__publicOnDataCollectionChangedEventType as _publicOnDataCollectionChangedEventType, type index_d$2__publicOnDataCollectionClonedEventType as _publicOnDataCollectionClonedEventType, type index_d$2__publicOnDataCollectionCreatedType as _publicOnDataCollectionCreatedType, type index_d$2__publicOnDataCollectionDeletedType as _publicOnDataCollectionDeletedType, type index_d$2__publicOnDataCollectionUpdatedType as _publicOnDataCollectionUpdatedType, 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_onDataCollectionChangedEvent as onDataCollectionChangedEvent, index_d$2_onDataCollectionClonedEvent as onDataCollectionClonedEvent, index_d$2_onDataCollectionCreated as onDataCollectionCreated, index_d$2_onDataCollectionDeleted as onDataCollectionDeleted, index_d$2_onDataCollectionUpdated as onDataCollectionUpdated, onDataCollectionChangedEvent$1 as publicOnDataCollectionChangedEvent, onDataCollectionClonedEvent$1 as publicOnDataCollectionClonedEvent, onDataCollectionCreated$1 as publicOnDataCollectionCreated, onDataCollectionDeleted$1 as publicOnDataCollectionDeleted, onDataCollectionUpdated$1 as publicOnDataCollectionUpdated, index_d$2_updateDataCollection as updateDataCollection };
2134
2946
  }
2135
2947
 
2948
+ type HostModule$1<T, H extends Host$1> = {
2949
+ __type: 'host';
2950
+ create(host: H): T;
2951
+ };
2952
+ type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
2953
+ type Host$1<Environment = unknown> = {
2954
+ channel: {
2955
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
2956
+ disconnect: () => void;
2957
+ } | Promise<{
2958
+ disconnect: () => void;
2959
+ }>;
2960
+ };
2961
+ environment?: Environment;
2962
+ /**
2963
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
2964
+ */
2965
+ apiBaseUrl?: string;
2966
+ /**
2967
+ * Possible data to be provided by every host, for cross cutting concerns
2968
+ * like internationalization, billing, etc.
2969
+ */
2970
+ essentials?: {
2971
+ /**
2972
+ * The language of the currently viewed session
2973
+ */
2974
+ language?: string;
2975
+ /**
2976
+ * The locale of the currently viewed session
2977
+ */
2978
+ locale?: string;
2979
+ /**
2980
+ * Any headers that should be passed through to the API requests
2981
+ */
2982
+ passThroughHeaders?: Record<string, string>;
2983
+ };
2984
+ };
2985
+
2986
+ type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
2987
+ interface HttpClient$1 {
2988
+ request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
2989
+ fetchWithAuth: typeof fetch;
2990
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
2991
+ getActiveToken?: () => string | undefined;
2992
+ }
2993
+ type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
2994
+ type HttpResponse$1<T = any> = {
2995
+ data: T;
2996
+ status: number;
2997
+ statusText: string;
2998
+ headers: any;
2999
+ request?: any;
3000
+ };
3001
+ type RequestOptions$1<_TResponse = any, Data = any> = {
3002
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
3003
+ url: string;
3004
+ data?: Data;
3005
+ params?: URLSearchParams;
3006
+ } & APIMetadata$1;
3007
+ type APIMetadata$1 = {
3008
+ methodFqn?: string;
3009
+ entityFqdn?: string;
3010
+ packageName?: string;
3011
+ };
3012
+ type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
3013
+ type EventDefinition$2<Payload = unknown, Type extends string = string> = {
3014
+ __type: 'event-definition';
3015
+ type: Type;
3016
+ isDomainEvent?: boolean;
3017
+ transformations?: (envelope: unknown) => Payload;
3018
+ __payload: Payload;
3019
+ };
3020
+ declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
3021
+ type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
3022
+ type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
3023
+
3024
+ type ServicePluginMethodInput$1 = {
3025
+ request: any;
3026
+ metadata: any;
3027
+ };
3028
+ type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
3029
+ type ServicePluginMethodMetadata$1 = {
3030
+ name: string;
3031
+ primaryHttpMappingPath: string;
3032
+ transformations: {
3033
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
3034
+ toREST: (...args: unknown[]) => unknown;
3035
+ };
3036
+ };
3037
+ type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
3038
+ __type: 'service-plugin-definition';
3039
+ componentType: string;
3040
+ methods: ServicePluginMethodMetadata$1[];
3041
+ __contract: Contract;
3042
+ };
3043
+ declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
3044
+ type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
3045
+ declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
3046
+
3047
+ type RequestContext$1 = {
3048
+ isSSR: boolean;
3049
+ host: string;
3050
+ protocol?: string;
3051
+ };
3052
+ type ResponseTransformer$1 = (data: any, headers?: any) => any;
3053
+ /**
3054
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
3055
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
3056
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
3057
+ */
3058
+ type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
3059
+ type AmbassadorRequestOptions$1<T = any> = {
3060
+ _?: T;
3061
+ url?: string;
3062
+ method?: Method$1;
3063
+ params?: any;
3064
+ data?: any;
3065
+ transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
3066
+ };
3067
+ type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
3068
+ __isAmbassador: boolean;
3069
+ };
3070
+ type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
3071
+ type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
3072
+
3073
+ declare global {
3074
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
3075
+ interface SymbolConstructor {
3076
+ readonly observable: symbol;
3077
+ }
3078
+ }
3079
+
3080
+ declare const emptyObjectSymbol$1: unique symbol;
3081
+
3082
+ /**
3083
+ Represents a strictly empty plain object, the `{}` value.
3084
+
3085
+ 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)).
3086
+
3087
+ @example
3088
+ ```
3089
+ import type {EmptyObject} from 'type-fest';
3090
+
3091
+ // The following illustrates the problem with `{}`.
3092
+ const foo1: {} = {}; // Pass
3093
+ const foo2: {} = []; // Pass
3094
+ const foo3: {} = 42; // Pass
3095
+ const foo4: {} = {a: 1}; // Pass
3096
+
3097
+ // With `EmptyObject` only the first case is valid.
3098
+ const bar1: EmptyObject = {}; // Pass
3099
+ const bar2: EmptyObject = 42; // Fail
3100
+ const bar3: EmptyObject = []; // Fail
3101
+ const bar4: EmptyObject = {a: 1}; // Fail
3102
+ ```
3103
+
3104
+ 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}.
3105
+
3106
+ @category Object
3107
+ */
3108
+ type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
3109
+
3110
+ /**
3111
+ Returns a boolean for whether the two given types are equal.
3112
+
3113
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
3114
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
3115
+
3116
+ Use-cases:
3117
+ - If you want to make a conditional branch based on the result of a comparison of two types.
3118
+
3119
+ @example
3120
+ ```
3121
+ import type {IsEqual} from 'type-fest';
3122
+
3123
+ // This type returns a boolean for whether the given array includes the given item.
3124
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
3125
+ type Includes<Value extends readonly any[], Item> =
3126
+ Value extends readonly [Value[0], ...infer rest]
3127
+ ? IsEqual<Value[0], Item> extends true
3128
+ ? true
3129
+ : Includes<rest, Item>
3130
+ : false;
3131
+ ```
3132
+
3133
+ @category Type Guard
3134
+ @category Utilities
3135
+ */
3136
+ type IsEqual$1<A, B> =
3137
+ (<G>() => G extends A ? 1 : 2) extends
3138
+ (<G>() => G extends B ? 1 : 2)
3139
+ ? true
3140
+ : false;
3141
+
3142
+ /**
3143
+ Filter out keys from an object.
3144
+
3145
+ Returns `never` if `Exclude` is strictly equal to `Key`.
3146
+ Returns `never` if `Key` extends `Exclude`.
3147
+ Returns `Key` otherwise.
3148
+
3149
+ @example
3150
+ ```
3151
+ type Filtered = Filter<'foo', 'foo'>;
3152
+ //=> never
3153
+ ```
3154
+
3155
+ @example
3156
+ ```
3157
+ type Filtered = Filter<'bar', string>;
3158
+ //=> never
3159
+ ```
3160
+
3161
+ @example
3162
+ ```
3163
+ type Filtered = Filter<'bar', 'foo'>;
3164
+ //=> 'bar'
3165
+ ```
3166
+
3167
+ @see {Except}
3168
+ */
3169
+ type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
3170
+
3171
+ type ExceptOptions$1 = {
3172
+ /**
3173
+ Disallow assigning non-specified properties.
3174
+
3175
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
3176
+
3177
+ @default false
3178
+ */
3179
+ requireExactProps?: boolean;
3180
+ };
3181
+
3182
+ /**
3183
+ Create a type from an object type without certain keys.
3184
+
3185
+ We recommend setting the `requireExactProps` option to `true`.
3186
+
3187
+ 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.
3188
+
3189
+ 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)).
3190
+
3191
+ @example
3192
+ ```
3193
+ import type {Except} from 'type-fest';
3194
+
3195
+ type Foo = {
3196
+ a: number;
3197
+ b: string;
3198
+ };
3199
+
3200
+ type FooWithoutA = Except<Foo, 'a'>;
3201
+ //=> {b: string}
3202
+
3203
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
3204
+ //=> errors: 'a' does not exist in type '{ b: string; }'
3205
+
3206
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
3207
+ //=> {a: number} & Partial<Record<"b", never>>
3208
+
3209
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
3210
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
3211
+ ```
3212
+
3213
+ @category Object
3214
+ */
3215
+ type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
3216
+ [KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
3217
+ } & (Options['requireExactProps'] extends true
3218
+ ? Partial<Record<KeysType, never>>
3219
+ : {});
3220
+
3221
+ /**
3222
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
3223
+
3224
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
3225
+
3226
+ @example
3227
+ ```
3228
+ import type {ConditionalKeys} from 'type-fest';
3229
+
3230
+ interface Example {
3231
+ a: string;
3232
+ b: string | number;
3233
+ c?: string;
3234
+ d: {};
3235
+ }
3236
+
3237
+ type StringKeysOnly = ConditionalKeys<Example, string>;
3238
+ //=> 'a'
3239
+ ```
3240
+
3241
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
3242
+
3243
+ @example
3244
+ ```
3245
+ import type {ConditionalKeys} from 'type-fest';
3246
+
3247
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
3248
+ //=> 'a' | 'c'
3249
+ ```
3250
+
3251
+ @category Object
3252
+ */
3253
+ type ConditionalKeys$1<Base, Condition> = NonNullable<
3254
+ // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
3255
+ {
3256
+ // Map through all the keys of the given base type.
3257
+ [Key in keyof Base]:
3258
+ // Pick only keys with types extending the given `Condition` type.
3259
+ Base[Key] extends Condition
3260
+ // Retain this key since the condition passes.
3261
+ ? Key
3262
+ // Discard this key since the condition fails.
3263
+ : never;
3264
+
3265
+ // Convert the produced object into a union type of the keys which passed the conditional test.
3266
+ }[keyof Base]
3267
+ >;
3268
+
3269
+ /**
3270
+ Exclude keys from a shape that matches the given `Condition`.
3271
+
3272
+ 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.
3273
+
3274
+ @example
3275
+ ```
3276
+ import type {Primitive, ConditionalExcept} from 'type-fest';
3277
+
3278
+ class Awesome {
3279
+ name: string;
3280
+ successes: number;
3281
+ failures: bigint;
3282
+
3283
+ run() {}
3284
+ }
3285
+
3286
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
3287
+ //=> {run: () => void}
3288
+ ```
3289
+
3290
+ @example
3291
+ ```
3292
+ import type {ConditionalExcept} from 'type-fest';
3293
+
3294
+ interface Example {
3295
+ a: string;
3296
+ b: string | number;
3297
+ c: () => void;
3298
+ d: {};
3299
+ }
3300
+
3301
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
3302
+ //=> {b: string | number; c: () => void; d: {}}
3303
+ ```
3304
+
3305
+ @category Object
3306
+ */
3307
+ type ConditionalExcept$1<Base, Condition> = Except$1<
3308
+ Base,
3309
+ ConditionalKeys$1<Base, Condition>
3310
+ >;
3311
+
3312
+ /**
3313
+ * Descriptors are objects that describe the API of a module, and the module
3314
+ * can either be a REST module or a host module.
3315
+ * This type is recursive, so it can describe nested modules.
3316
+ */
3317
+ type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$2<any> | ServicePluginDefinition$1<any> | {
3318
+ [key: string]: Descriptors$1 | PublicMetadata$1 | any;
3319
+ };
3320
+ /**
3321
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
3322
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
3323
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
3324
+ * do not match the given host (as they will not work with the given host).
3325
+ */
3326
+ type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
3327
+ done: T;
3328
+ recurse: T extends {
3329
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
3330
+ } ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$2<any> ? BuildEventDefinition$2<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
3331
+ [Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
3332
+ -1,
3333
+ 0,
3334
+ 1,
3335
+ 2,
3336
+ 3,
3337
+ 4,
3338
+ 5
3339
+ ][Depth]> : never;
3340
+ }, EmptyObject$1>;
3341
+ }[Depth extends -1 ? 'done' : 'recurse'];
3342
+ type PublicMetadata$1 = {
3343
+ PACKAGE_NAME?: string;
3344
+ };
3345
+
3346
+ declare global {
3347
+ interface ContextualClient {
3348
+ }
3349
+ }
3350
+ /**
3351
+ * A type used to create concerete types from SDK descriptors in
3352
+ * case a contextual client is available.
3353
+ */
3354
+ type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
3355
+ host: Host$1;
3356
+ } ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
3357
+
2136
3358
  interface DataItem {
2137
3359
  /** Data item ID. */
2138
3360
  _id?: string;
@@ -4067,7 +5289,7 @@ interface ReplaceDataItemReferencesOptions {
4067
5289
  newReferencedItemIds?: string[];
4068
5290
  }
4069
5291
 
4070
- declare function insertDataItem$1(httpClient: HttpClient): InsertDataItemSignature;
5292
+ declare function insertDataItem$1(httpClient: HttpClient$1): InsertDataItemSignature;
4071
5293
  interface InsertDataItemSignature {
4072
5294
  /**
4073
5295
  * Adds an item to a collection.
@@ -4085,7 +5307,7 @@ interface InsertDataItemSignature {
4085
5307
  */
4086
5308
  (options?: InsertDataItemOptions | undefined): Promise<InsertDataItemResponse & InsertDataItemResponseNonNullableFields>;
4087
5309
  }
4088
- declare function updateDataItem$1(httpClient: HttpClient): UpdateDataItemSignature;
5310
+ declare function updateDataItem$1(httpClient: HttpClient$1): UpdateDataItemSignature;
4089
5311
  interface UpdateDataItemSignature {
4090
5312
  /**
4091
5313
  * Updates an item in a collection.
@@ -4107,7 +5329,7 @@ interface UpdateDataItemSignature {
4107
5329
  */
4108
5330
  (_id: string, options?: UpdateDataItemOptions | undefined): Promise<UpdateDataItemResponse & UpdateDataItemResponseNonNullableFields>;
4109
5331
  }
4110
- declare function saveDataItem$1(httpClient: HttpClient): SaveDataItemSignature;
5332
+ declare function saveDataItem$1(httpClient: HttpClient$1): SaveDataItemSignature;
4111
5333
  interface SaveDataItemSignature {
4112
5334
  /**
4113
5335
  * Inserts or updates an item in a collection.
@@ -4127,7 +5349,7 @@ interface SaveDataItemSignature {
4127
5349
  */
4128
5350
  (options?: SaveDataItemOptions | undefined): Promise<SaveDataItemResponse & SaveDataItemResponseNonNullableFields>;
4129
5351
  }
4130
- declare function getDataItem$1(httpClient: HttpClient): GetDataItemSignature;
5352
+ declare function getDataItem$1(httpClient: HttpClient$1): GetDataItemSignature;
4131
5353
  interface GetDataItemSignature {
4132
5354
  /**
4133
5355
  * Retrieves an item from a collection.
@@ -4140,7 +5362,7 @@ interface GetDataItemSignature {
4140
5362
  */
4141
5363
  (dataItemId: string, options?: GetDataItemOptions | undefined): Promise<DataItem & DataItemNonNullableFields>;
4142
5364
  }
4143
- declare function removeDataItem$1(httpClient: HttpClient): RemoveDataItemSignature;
5365
+ declare function removeDataItem$1(httpClient: HttpClient$1): RemoveDataItemSignature;
4144
5366
  interface RemoveDataItemSignature {
4145
5367
  /**
4146
5368
  * Removes an item from a collection.
@@ -4155,7 +5377,7 @@ interface RemoveDataItemSignature {
4155
5377
  */
4156
5378
  (dataItemId: string, options?: RemoveDataItemOptions | undefined): Promise<RemoveDataItemResponse & RemoveDataItemResponseNonNullableFields>;
4157
5379
  }
4158
- declare function truncateDataItems$1(httpClient: HttpClient): TruncateDataItemsSignature;
5380
+ declare function truncateDataItems$1(httpClient: HttpClient$1): TruncateDataItemsSignature;
4159
5381
  interface TruncateDataItemsSignature {
4160
5382
  /**
4161
5383
  * Removes all items from a collection.
@@ -4169,7 +5391,7 @@ interface TruncateDataItemsSignature {
4169
5391
  */
4170
5392
  (options: TruncateDataItemsOptions): Promise<void>;
4171
5393
  }
4172
- declare function queryDataItems$1(httpClient: HttpClient): QueryDataItemsSignature;
5394
+ declare function queryDataItems$1(httpClient: HttpClient$1): QueryDataItemsSignature;
4173
5395
  interface QueryDataItemsSignature {
4174
5396
  /**
4175
5397
  * Creates a query to retrieve items from a database collection.
@@ -4197,7 +5419,7 @@ interface QueryDataItemsSignature {
4197
5419
  */
4198
5420
  (options: QueryDataItemsOptions): DataItemsQueryBuilder;
4199
5421
  }
4200
- declare function aggregateDataItems$1(httpClient: HttpClient): AggregateDataItemsSignature;
5422
+ declare function aggregateDataItems$1(httpClient: HttpClient$1): AggregateDataItemsSignature;
4201
5423
  interface AggregateDataItemsSignature {
4202
5424
  /**
4203
5425
  * Runs an aggregation on a data collection and returns the resulting list of items.
@@ -4209,7 +5431,7 @@ interface AggregateDataItemsSignature {
4209
5431
  */
4210
5432
  (options?: AggregateDataItemsOptions | undefined): Promise<AggregateDataItemsResponse>;
4211
5433
  }
4212
- declare function countDataItems$1(httpClient: HttpClient): CountDataItemsSignature;
5434
+ declare function countDataItems$1(httpClient: HttpClient$1): CountDataItemsSignature;
4213
5435
  interface CountDataItemsSignature {
4214
5436
  /**
4215
5437
  * Counts the number of items in a data collection that match the provided filtering preferences.
@@ -4219,7 +5441,7 @@ interface CountDataItemsSignature {
4219
5441
  */
4220
5442
  (options?: CountDataItemsOptions | undefined): Promise<CountDataItemsResponse & CountDataItemsResponseNonNullableFields>;
4221
5443
  }
4222
- declare function queryDistinctValues$1(httpClient: HttpClient): QueryDistinctValuesSignature;
5444
+ declare function queryDistinctValues$1(httpClient: HttpClient$1): QueryDistinctValuesSignature;
4223
5445
  interface QueryDistinctValuesSignature {
4224
5446
  /**
4225
5447
  * Retrieves a list of distinct values for a given field in all items that match a query, without duplicates.
@@ -4237,7 +5459,7 @@ interface QueryDistinctValuesSignature {
4237
5459
  */
4238
5460
  (options?: QueryDistinctValuesOptions | undefined): Promise<QueryDistinctValuesResponse>;
4239
5461
  }
4240
- declare function bulkInsertDataItems$1(httpClient: HttpClient): BulkInsertDataItemsSignature;
5462
+ declare function bulkInsertDataItems$1(httpClient: HttpClient$1): BulkInsertDataItemsSignature;
4241
5463
  interface BulkInsertDataItemsSignature {
4242
5464
  /**
4243
5465
  * Adds multiple items to a collection.
@@ -4249,7 +5471,7 @@ interface BulkInsertDataItemsSignature {
4249
5471
  */
4250
5472
  (options?: BulkInsertDataItemsOptions | undefined): Promise<BulkInsertDataItemsResponse & BulkInsertDataItemsResponseNonNullableFields>;
4251
5473
  }
4252
- declare function bulkUpdateDataItems$1(httpClient: HttpClient): BulkUpdateDataItemsSignature;
5474
+ declare function bulkUpdateDataItems$1(httpClient: HttpClient$1): BulkUpdateDataItemsSignature;
4253
5475
  interface BulkUpdateDataItemsSignature {
4254
5476
  /**
4255
5477
  * Updates multiple items in a collection.
@@ -4269,7 +5491,7 @@ interface BulkUpdateDataItemsSignature {
4269
5491
  */
4270
5492
  (options?: BulkUpdateDataItemsOptions | undefined): Promise<BulkUpdateDataItemsResponse & BulkUpdateDataItemsResponseNonNullableFields>;
4271
5493
  }
4272
- declare function bulkSaveDataItems$1(httpClient: HttpClient): BulkSaveDataItemsSignature;
5494
+ declare function bulkSaveDataItems$1(httpClient: HttpClient$1): BulkSaveDataItemsSignature;
4273
5495
  interface BulkSaveDataItemsSignature {
4274
5496
  /**
4275
5497
  * Inserts or updates multiple items in a collection.
@@ -4289,7 +5511,7 @@ interface BulkSaveDataItemsSignature {
4289
5511
  */
4290
5512
  (options?: BulkSaveDataItemsOptions | undefined): Promise<BulkSaveDataItemsResponse & BulkSaveDataItemsResponseNonNullableFields>;
4291
5513
  }
4292
- declare function bulkRemoveDataItems$1(httpClient: HttpClient): BulkRemoveDataItemsSignature;
5514
+ declare function bulkRemoveDataItems$1(httpClient: HttpClient$1): BulkRemoveDataItemsSignature;
4293
5515
  interface BulkRemoveDataItemsSignature {
4294
5516
  /**
4295
5517
  * Removes multiple items from a collection.
@@ -4302,7 +5524,7 @@ interface BulkRemoveDataItemsSignature {
4302
5524
  */
4303
5525
  (options?: BulkRemoveDataItemsOptions | undefined): Promise<BulkRemoveDataItemsResponse & BulkRemoveDataItemsResponseNonNullableFields>;
4304
5526
  }
4305
- declare function queryReferencedDataItems$1(httpClient: HttpClient): QueryReferencedDataItemsSignature;
5527
+ declare function queryReferencedDataItems$1(httpClient: HttpClient$1): QueryReferencedDataItemsSignature;
4306
5528
  interface QueryReferencedDataItemsSignature {
4307
5529
  /**
4308
5530
  * Retrieves the full items referenced in the specified field of an item.
@@ -4320,7 +5542,7 @@ interface QueryReferencedDataItemsSignature {
4320
5542
  */
4321
5543
  (options?: QueryReferencedDataItemsOptions | undefined): Promise<QueryReferencedDataItemsResponse & QueryReferencedDataItemsResponseNonNullableFields>;
4322
5544
  }
4323
- declare function isReferencedDataItem$1(httpClient: HttpClient): IsReferencedDataItemSignature;
5545
+ declare function isReferencedDataItem$1(httpClient: HttpClient$1): IsReferencedDataItemSignature;
4324
5546
  interface IsReferencedDataItemSignature {
4325
5547
  /**
4326
5548
  * Checks whether a field in a referring item contains a reference to a specified item.
@@ -4330,7 +5552,7 @@ interface IsReferencedDataItemSignature {
4330
5552
  */
4331
5553
  (options?: IsReferencedDataItemOptions | undefined): Promise<IsReferencedDataItemResponse & IsReferencedDataItemResponseNonNullableFields>;
4332
5554
  }
4333
- declare function insertDataItemReference$1(httpClient: HttpClient): InsertDataItemReferenceSignature;
5555
+ declare function insertDataItemReference$1(httpClient: HttpClient$1): InsertDataItemReferenceSignature;
4334
5556
  interface InsertDataItemReferenceSignature {
4335
5557
  /**
4336
5558
  * Inserts a reference in the specified field in an item in a collection.
@@ -4341,7 +5563,7 @@ interface InsertDataItemReferenceSignature {
4341
5563
  */
4342
5564
  (options?: InsertDataItemReferenceOptions | undefined): Promise<InsertDataItemReferenceResponse & InsertDataItemReferenceResponseNonNullableFields>;
4343
5565
  }
4344
- declare function removeDataItemReference$1(httpClient: HttpClient): RemoveDataItemReferenceSignature;
5566
+ declare function removeDataItemReference$1(httpClient: HttpClient$1): RemoveDataItemReferenceSignature;
4345
5567
  interface RemoveDataItemReferenceSignature {
4346
5568
  /**
4347
5569
  * Removes the specified reference from the specified field.
@@ -4349,7 +5571,7 @@ interface RemoveDataItemReferenceSignature {
4349
5571
  */
4350
5572
  (options: RemoveDataItemReferenceOptions): Promise<RemoveDataItemReferenceResponse & RemoveDataItemReferenceResponseNonNullableFields>;
4351
5573
  }
4352
- declare function bulkInsertDataItemReferences$1(httpClient: HttpClient): BulkInsertDataItemReferencesSignature;
5574
+ declare function bulkInsertDataItemReferences$1(httpClient: HttpClient$1): BulkInsertDataItemReferencesSignature;
4353
5575
  interface BulkInsertDataItemReferencesSignature {
4354
5576
  /**
4355
5577
  * Inserts one or more references in the specified fields of items in a collection.
@@ -4361,7 +5583,7 @@ interface BulkInsertDataItemReferencesSignature {
4361
5583
  */
4362
5584
  (options?: BulkInsertDataItemReferencesOptions | undefined): Promise<BulkInsertDataItemReferencesResponse & BulkInsertDataItemReferencesResponseNonNullableFields>;
4363
5585
  }
4364
- declare function bulkRemoveDataItemReferences$1(httpClient: HttpClient): BulkRemoveDataItemReferencesSignature;
5586
+ declare function bulkRemoveDataItemReferences$1(httpClient: HttpClient$1): BulkRemoveDataItemReferencesSignature;
4365
5587
  interface BulkRemoveDataItemReferencesSignature {
4366
5588
  /**
4367
5589
  * Removes one or more references.
@@ -4369,7 +5591,7 @@ interface BulkRemoveDataItemReferencesSignature {
4369
5591
  */
4370
5592
  (options: BulkRemoveDataItemReferencesOptions): Promise<BulkRemoveDataItemReferencesResponse & BulkRemoveDataItemReferencesResponseNonNullableFields>;
4371
5593
  }
4372
- declare function replaceDataItemReferences$1(httpClient: HttpClient): ReplaceDataItemReferencesSignature;
5594
+ declare function replaceDataItemReferences$1(httpClient: HttpClient$1): ReplaceDataItemReferencesSignature;
4373
5595
  interface ReplaceDataItemReferencesSignature {
4374
5596
  /**
4375
5597
  * Replaces references in a specified field of a specified data item.
@@ -4383,33 +5605,51 @@ interface ReplaceDataItemReferencesSignature {
4383
5605
  */
4384
5606
  (options?: ReplaceDataItemReferencesOptions | undefined): Promise<ReplaceDataItemReferencesResponse & ReplaceDataItemReferencesResponseNonNullableFields>;
4385
5607
  }
4386
- declare const onDataItemCreated$1: EventDefinition<DataItemCreatedEnvelope, "wix.data.v2.data_item_created">;
4387
- declare const onDataItemUpdated$1: EventDefinition<DataItemUpdatedEnvelope, "wix.data.v2.data_item_updated">;
4388
- declare const onDataItemDeleted$1: EventDefinition<DataItemDeletedEnvelope, "wix.data.v2.data_item_deleted">;
4389
-
4390
- declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
4391
-
4392
- declare const insertDataItem: BuildRESTFunction<typeof insertDataItem$1> & typeof insertDataItem$1;
4393
- declare const updateDataItem: BuildRESTFunction<typeof updateDataItem$1> & typeof updateDataItem$1;
4394
- declare const saveDataItem: BuildRESTFunction<typeof saveDataItem$1> & typeof saveDataItem$1;
4395
- declare const getDataItem: BuildRESTFunction<typeof getDataItem$1> & typeof getDataItem$1;
4396
- declare const removeDataItem: BuildRESTFunction<typeof removeDataItem$1> & typeof removeDataItem$1;
4397
- declare const truncateDataItems: BuildRESTFunction<typeof truncateDataItems$1> & typeof truncateDataItems$1;
4398
- declare const queryDataItems: BuildRESTFunction<typeof queryDataItems$1> & typeof queryDataItems$1;
4399
- declare const aggregateDataItems: BuildRESTFunction<typeof aggregateDataItems$1> & typeof aggregateDataItems$1;
4400
- declare const countDataItems: BuildRESTFunction<typeof countDataItems$1> & typeof countDataItems$1;
4401
- declare const queryDistinctValues: BuildRESTFunction<typeof queryDistinctValues$1> & typeof queryDistinctValues$1;
4402
- declare const bulkInsertDataItems: BuildRESTFunction<typeof bulkInsertDataItems$1> & typeof bulkInsertDataItems$1;
4403
- declare const bulkUpdateDataItems: BuildRESTFunction<typeof bulkUpdateDataItems$1> & typeof bulkUpdateDataItems$1;
4404
- declare const bulkSaveDataItems: BuildRESTFunction<typeof bulkSaveDataItems$1> & typeof bulkSaveDataItems$1;
4405
- declare const bulkRemoveDataItems: BuildRESTFunction<typeof bulkRemoveDataItems$1> & typeof bulkRemoveDataItems$1;
4406
- declare const queryReferencedDataItems: BuildRESTFunction<typeof queryReferencedDataItems$1> & typeof queryReferencedDataItems$1;
4407
- declare const isReferencedDataItem: BuildRESTFunction<typeof isReferencedDataItem$1> & typeof isReferencedDataItem$1;
4408
- declare const insertDataItemReference: BuildRESTFunction<typeof insertDataItemReference$1> & typeof insertDataItemReference$1;
4409
- declare const removeDataItemReference: BuildRESTFunction<typeof removeDataItemReference$1> & typeof removeDataItemReference$1;
4410
- declare const bulkInsertDataItemReferences: BuildRESTFunction<typeof bulkInsertDataItemReferences$1> & typeof bulkInsertDataItemReferences$1;
4411
- declare const bulkRemoveDataItemReferences: BuildRESTFunction<typeof bulkRemoveDataItemReferences$1> & typeof bulkRemoveDataItemReferences$1;
4412
- declare const replaceDataItemReferences: BuildRESTFunction<typeof replaceDataItemReferences$1> & typeof replaceDataItemReferences$1;
5608
+ declare const onDataItemCreated$1: EventDefinition$2<DataItemCreatedEnvelope, "wix.data.v2.data_item_created">;
5609
+ declare const onDataItemUpdated$1: EventDefinition$2<DataItemUpdatedEnvelope, "wix.data.v2.data_item_updated">;
5610
+ declare const onDataItemDeleted$1: EventDefinition$2<DataItemDeletedEnvelope, "wix.data.v2.data_item_deleted">;
5611
+
5612
+ type EventDefinition$1<Payload = unknown, Type extends string = string> = {
5613
+ __type: 'event-definition';
5614
+ type: Type;
5615
+ isDomainEvent?: boolean;
5616
+ transformations?: (envelope: unknown) => Payload;
5617
+ __payload: Payload;
5618
+ };
5619
+ declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
5620
+ type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
5621
+ type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
5622
+
5623
+ declare global {
5624
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
5625
+ interface SymbolConstructor {
5626
+ readonly observable: symbol;
5627
+ }
5628
+ }
5629
+
5630
+ declare function createEventModule<T extends EventDefinition$1<any, string>>(eventDefinition: T): BuildEventDefinition$1<T> & T;
5631
+
5632
+ declare const insertDataItem: MaybeContext$1<BuildRESTFunction$1<typeof insertDataItem$1> & typeof insertDataItem$1>;
5633
+ declare const updateDataItem: MaybeContext$1<BuildRESTFunction$1<typeof updateDataItem$1> & typeof updateDataItem$1>;
5634
+ declare const saveDataItem: MaybeContext$1<BuildRESTFunction$1<typeof saveDataItem$1> & typeof saveDataItem$1>;
5635
+ declare const getDataItem: MaybeContext$1<BuildRESTFunction$1<typeof getDataItem$1> & typeof getDataItem$1>;
5636
+ declare const removeDataItem: MaybeContext$1<BuildRESTFunction$1<typeof removeDataItem$1> & typeof removeDataItem$1>;
5637
+ declare const truncateDataItems: MaybeContext$1<BuildRESTFunction$1<typeof truncateDataItems$1> & typeof truncateDataItems$1>;
5638
+ declare const queryDataItems: MaybeContext$1<BuildRESTFunction$1<typeof queryDataItems$1> & typeof queryDataItems$1>;
5639
+ declare const aggregateDataItems: MaybeContext$1<BuildRESTFunction$1<typeof aggregateDataItems$1> & typeof aggregateDataItems$1>;
5640
+ declare const countDataItems: MaybeContext$1<BuildRESTFunction$1<typeof countDataItems$1> & typeof countDataItems$1>;
5641
+ declare const queryDistinctValues: MaybeContext$1<BuildRESTFunction$1<typeof queryDistinctValues$1> & typeof queryDistinctValues$1>;
5642
+ declare const bulkInsertDataItems: MaybeContext$1<BuildRESTFunction$1<typeof bulkInsertDataItems$1> & typeof bulkInsertDataItems$1>;
5643
+ declare const bulkUpdateDataItems: MaybeContext$1<BuildRESTFunction$1<typeof bulkUpdateDataItems$1> & typeof bulkUpdateDataItems$1>;
5644
+ declare const bulkSaveDataItems: MaybeContext$1<BuildRESTFunction$1<typeof bulkSaveDataItems$1> & typeof bulkSaveDataItems$1>;
5645
+ declare const bulkRemoveDataItems: MaybeContext$1<BuildRESTFunction$1<typeof bulkRemoveDataItems$1> & typeof bulkRemoveDataItems$1>;
5646
+ declare const queryReferencedDataItems: MaybeContext$1<BuildRESTFunction$1<typeof queryReferencedDataItems$1> & typeof queryReferencedDataItems$1>;
5647
+ declare const isReferencedDataItem: MaybeContext$1<BuildRESTFunction$1<typeof isReferencedDataItem$1> & typeof isReferencedDataItem$1>;
5648
+ declare const insertDataItemReference: MaybeContext$1<BuildRESTFunction$1<typeof insertDataItemReference$1> & typeof insertDataItemReference$1>;
5649
+ declare const removeDataItemReference: MaybeContext$1<BuildRESTFunction$1<typeof removeDataItemReference$1> & typeof removeDataItemReference$1>;
5650
+ declare const bulkInsertDataItemReferences: MaybeContext$1<BuildRESTFunction$1<typeof bulkInsertDataItemReferences$1> & typeof bulkInsertDataItemReferences$1>;
5651
+ declare const bulkRemoveDataItemReferences: MaybeContext$1<BuildRESTFunction$1<typeof bulkRemoveDataItemReferences$1> & typeof bulkRemoveDataItemReferences$1>;
5652
+ declare const replaceDataItemReferences: MaybeContext$1<BuildRESTFunction$1<typeof replaceDataItemReferences$1> & typeof replaceDataItemReferences$1>;
4413
5653
 
4414
5654
  type _publicOnDataItemCreatedType = typeof onDataItemCreated$1;
4415
5655
  /**
@@ -4420,6 +5660,8 @@ declare const onDataItemCreated: ReturnType<typeof createEventModule<_publicOnDa
4420
5660
  type _publicOnDataItemUpdatedType = typeof onDataItemUpdated$1;
4421
5661
  /**
4422
5662
  * Triggered when a data item is updated.
5663
+ *
5664
+ * **Note**: When [scheduling an item's visibility change](https://support.wix.com/en/article/cms-controlling-live-site-item-visibility-from-your-collection#scheduling-changes-to-item-visibility), the event is triggered when the scheduled change is set up, not when it goes into effect.
4423
5665
  */
4424
5666
  declare const onDataItemUpdated: ReturnType<typeof createEventModule<_publicOnDataItemUpdatedType>>;
4425
5667
 
@@ -4612,6 +5854,416 @@ declare namespace index_d$1 {
4612
5854
  export { index_d$1_ACTION as ACTION, index_d$1_Action as Action, type index_d$1_ActionEvent as ActionEvent, type index_d$1_AggregateDataItemsOptions as AggregateDataItemsOptions, type index_d$1_AggregateDataItemsRequest as AggregateDataItemsRequest, type index_d$1_AggregateDataItemsRequestPagingMethodOneOf as AggregateDataItemsRequestPagingMethodOneOf, type index_d$1_AggregateDataItemsResponse as AggregateDataItemsResponse, type index_d$1_Aggregation as Aggregation, type index_d$1_AppendToArray as AppendToArray, type index_d$1_ApplicationError as ApplicationError, type index_d$1_Average as Average, type index_d$1_BaseEventMetadata as BaseEventMetadata, type index_d$1_BulkActionMetadata as BulkActionMetadata, index_d$1_BulkActionType as BulkActionType, type index_d$1_BulkDataItemReferenceResult as BulkDataItemReferenceResult, type index_d$1_BulkDataItemResult as BulkDataItemResult, type index_d$1_BulkInsertDataItemReferencesOptions as BulkInsertDataItemReferencesOptions, type index_d$1_BulkInsertDataItemReferencesRequest as BulkInsertDataItemReferencesRequest, type index_d$1_BulkInsertDataItemReferencesResponse as BulkInsertDataItemReferencesResponse, type index_d$1_BulkInsertDataItemReferencesResponseNonNullableFields as BulkInsertDataItemReferencesResponseNonNullableFields, type index_d$1_BulkInsertDataItemsOptions as BulkInsertDataItemsOptions, type index_d$1_BulkInsertDataItemsRequest as BulkInsertDataItemsRequest, type index_d$1_BulkInsertDataItemsResponse as BulkInsertDataItemsResponse, type index_d$1_BulkInsertDataItemsResponseNonNullableFields as BulkInsertDataItemsResponseNonNullableFields, type index_d$1_BulkPatchDataItemsRequest as BulkPatchDataItemsRequest, type index_d$1_BulkPatchDataItemsResponse as BulkPatchDataItemsResponse, type index_d$1_BulkRemoveDataItemReferencesOptions as BulkRemoveDataItemReferencesOptions, type index_d$1_BulkRemoveDataItemReferencesRequest as BulkRemoveDataItemReferencesRequest, type index_d$1_BulkRemoveDataItemReferencesResponse as BulkRemoveDataItemReferencesResponse, type index_d$1_BulkRemoveDataItemReferencesResponseNonNullableFields as BulkRemoveDataItemReferencesResponseNonNullableFields, type index_d$1_BulkRemoveDataItemsOptions as BulkRemoveDataItemsOptions, type index_d$1_BulkRemoveDataItemsRequest as BulkRemoveDataItemsRequest, type index_d$1_BulkRemoveDataItemsResponse as BulkRemoveDataItemsResponse, type index_d$1_BulkRemoveDataItemsResponseNonNullableFields as BulkRemoveDataItemsResponseNonNullableFields, type index_d$1_BulkSaveDataItemsOptions as BulkSaveDataItemsOptions, type index_d$1_BulkSaveDataItemsRequest as BulkSaveDataItemsRequest, type index_d$1_BulkSaveDataItemsResponse as BulkSaveDataItemsResponse, type index_d$1_BulkSaveDataItemsResponseNonNullableFields as BulkSaveDataItemsResponseNonNullableFields, type index_d$1_BulkUpdateDataItemsOptions as BulkUpdateDataItemsOptions, type index_d$1_BulkUpdateDataItemsRequest as BulkUpdateDataItemsRequest, type index_d$1_BulkUpdateDataItemsResponse as BulkUpdateDataItemsResponse, type index_d$1_BulkUpdateDataItemsResponseNonNullableFields as BulkUpdateDataItemsResponseNonNullableFields, type index_d$1_CachingInfo as CachingInfo, type index_d$1_Count as Count, type index_d$1_CountDataItemsOptions as CountDataItemsOptions, type index_d$1_CountDataItemsRequest as CountDataItemsRequest, type index_d$1_CountDataItemsResponse as CountDataItemsResponse, type index_d$1_CountDataItemsResponseNonNullableFields as CountDataItemsResponseNonNullableFields, type index_d$1_CursorPaging as CursorPaging, type index_d$1_Cursors as Cursors, type index_d$1_DataItem as DataItem, type index_d$1_DataItemCreatedEnvelope as DataItemCreatedEnvelope, type index_d$1_DataItemDeletedEnvelope as DataItemDeletedEnvelope, type index_d$1_DataItemNonNullableFields as DataItemNonNullableFields, type index_d$1_DataItemReference as DataItemReference, type index_d$1_DataItemUpdatedEnvelope as DataItemUpdatedEnvelope, type index_d$1_DataItemsQueryBuilder as DataItemsQueryBuilder, type index_d$1_DataItemsQueryResult as DataItemsQueryResult, type index_d$1_DataPublishPluginOptions as DataPublishPluginOptions, type index_d$1_DomainEvent as DomainEvent, type index_d$1_DomainEventBodyOneOf as DomainEventBodyOneOf, type index_d$1_EntityCreatedEvent as EntityCreatedEvent, type index_d$1_EntityDeletedEvent as EntityDeletedEvent, type index_d$1_EntityUpdatedEvent as EntityUpdatedEvent, Environment$1 as Environment, type index_d$1_EventMetadata as EventMetadata, type index_d$1_FieldUpdate as FieldUpdate, type index_d$1_FieldUpdateActionOptionsOneOf as FieldUpdateActionOptionsOneOf, type index_d$1_GetDataItemOptions as GetDataItemOptions, type index_d$1_GetDataItemRequest as GetDataItemRequest, type index_d$1_GetDataItemResponse as GetDataItemResponse, type index_d$1_GetDataItemResponseNonNullableFields as GetDataItemResponseNonNullableFields, type index_d$1_IdentificationData as IdentificationData, type index_d$1_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type index_d$1_IncrementField as IncrementField, type index_d$1_InsertDataItemOptions as InsertDataItemOptions, type index_d$1_InsertDataItemReferenceOptions as InsertDataItemReferenceOptions, type index_d$1_InsertDataItemReferenceRequest as InsertDataItemReferenceRequest, type index_d$1_InsertDataItemReferenceResponse as InsertDataItemReferenceResponse, type index_d$1_InsertDataItemReferenceResponseNonNullableFields as InsertDataItemReferenceResponseNonNullableFields, type index_d$1_InsertDataItemRequest as InsertDataItemRequest, type index_d$1_InsertDataItemResponse as InsertDataItemResponse, type index_d$1_InsertDataItemResponseNonNullableFields as InsertDataItemResponseNonNullableFields, type index_d$1_IsReferencedDataItemOptions as IsReferencedDataItemOptions, type index_d$1_IsReferencedDataItemRequest as IsReferencedDataItemRequest, type index_d$1_IsReferencedDataItemResponse as IsReferencedDataItemResponse, type index_d$1_IsReferencedDataItemResponseNonNullableFields as IsReferencedDataItemResponseNonNullableFields, type index_d$1_ItemMetadata as ItemMetadata, type index_d$1_Max as Max, type index_d$1_MessageEnvelope as MessageEnvelope, type index_d$1_Min as Min, type index_d$1_Operation as Operation, type index_d$1_OperationCalculateOneOf as OperationCalculateOneOf, type index_d$1_Options as Options, type Paging$1 as Paging, type index_d$1_PagingMetadataV2 as PagingMetadataV2, type index_d$1_PatchDataItemRequest as PatchDataItemRequest, type index_d$1_PatchDataItemResponse as PatchDataItemResponse, type index_d$1_PatchSet as PatchSet, type index_d$1_PublishPluginOptions as PublishPluginOptions, type index_d$1_QueryDataItemsOptions as QueryDataItemsOptions, type index_d$1_QueryDataItemsRequest as QueryDataItemsRequest, type index_d$1_QueryDataItemsResponse as QueryDataItemsResponse, type index_d$1_QueryDataItemsResponseNonNullableFields as QueryDataItemsResponseNonNullableFields, type index_d$1_QueryDistinctValuesOptions as QueryDistinctValuesOptions, type index_d$1_QueryDistinctValuesRequest as QueryDistinctValuesRequest, type index_d$1_QueryDistinctValuesRequestPagingMethodOneOf as QueryDistinctValuesRequestPagingMethodOneOf, type index_d$1_QueryDistinctValuesResponse as QueryDistinctValuesResponse, type index_d$1_QueryReferencedDataItemsOptions as QueryReferencedDataItemsOptions, type index_d$1_QueryReferencedDataItemsRequest as QueryReferencedDataItemsRequest, type index_d$1_QueryReferencedDataItemsRequestPagingMethodOneOf as QueryReferencedDataItemsRequestPagingMethodOneOf, type index_d$1_QueryReferencedDataItemsResponse as QueryReferencedDataItemsResponse, type index_d$1_QueryReferencedDataItemsResponseNonNullableFields as QueryReferencedDataItemsResponseNonNullableFields, type index_d$1_QueryV2 as QueryV2, type index_d$1_QueryV2PagingMethodOneOf as QueryV2PagingMethodOneOf, type index_d$1_ReferencedItemOptions as ReferencedItemOptions, type index_d$1_ReferencedResult as ReferencedResult, type index_d$1_ReferencedResultEntityOneOf as ReferencedResultEntityOneOf, type index_d$1_RemoveDataItemOptions as RemoveDataItemOptions, type index_d$1_RemoveDataItemReferenceOptions as RemoveDataItemReferenceOptions, type index_d$1_RemoveDataItemReferenceRequest as RemoveDataItemReferenceRequest, type index_d$1_RemoveDataItemReferenceResponse as RemoveDataItemReferenceResponse, type index_d$1_RemoveDataItemReferenceResponseNonNullableFields as RemoveDataItemReferenceResponseNonNullableFields, type index_d$1_RemoveDataItemRequest as RemoveDataItemRequest, type index_d$1_RemoveDataItemResponse as RemoveDataItemResponse, type index_d$1_RemoveDataItemResponseNonNullableFields as RemoveDataItemResponseNonNullableFields, type index_d$1_RemoveFromArray as RemoveFromArray, type index_d$1_ReplaceDataItemReferencesOptions as ReplaceDataItemReferencesOptions, type index_d$1_ReplaceDataItemReferencesRequest as ReplaceDataItemReferencesRequest, type index_d$1_ReplaceDataItemReferencesResponse as ReplaceDataItemReferencesResponse, type index_d$1_ReplaceDataItemReferencesResponseNonNullableFields as ReplaceDataItemReferencesResponseNonNullableFields, type index_d$1_RestoreInfo as RestoreInfo, type index_d$1_SaveDataItemOptions as SaveDataItemOptions, type index_d$1_SaveDataItemRequest as SaveDataItemRequest, type index_d$1_SaveDataItemResponse as SaveDataItemResponse, type index_d$1_SaveDataItemResponseNonNullableFields as SaveDataItemResponseNonNullableFields, type index_d$1_SetField as SetField, index_d$1_SortOrder as SortOrder, type index_d$1_Sorting as Sorting, type index_d$1_Sum as Sum, type index_d$1_TruncateDataItemsOptions as TruncateDataItemsOptions, type index_d$1_TruncateDataItemsRequest as TruncateDataItemsRequest, type index_d$1_TruncateDataItemsResponse as TruncateDataItemsResponse, type index_d$1_UnresolvedReference as UnresolvedReference, type index_d$1_UpdateDataItemOptions as UpdateDataItemOptions, type index_d$1_UpdateDataItemRequest as UpdateDataItemRequest, type index_d$1_UpdateDataItemResponse as UpdateDataItemResponse, type index_d$1_UpdateDataItemResponseNonNullableFields as UpdateDataItemResponseNonNullableFields, index_d$1_WebhookIdentityType as WebhookIdentityType, type index_d$1__publicOnDataItemCreatedType as _publicOnDataItemCreatedType, type index_d$1__publicOnDataItemDeletedType as _publicOnDataItemDeletedType, type index_d$1__publicOnDataItemUpdatedType as _publicOnDataItemUpdatedType, index_d$1_aggregateDataItems as aggregateDataItems, index_d$1_bulkInsertDataItemReferences as bulkInsertDataItemReferences, index_d$1_bulkInsertDataItems as bulkInsertDataItems, index_d$1_bulkRemoveDataItemReferences as bulkRemoveDataItemReferences, index_d$1_bulkRemoveDataItems as bulkRemoveDataItems, index_d$1_bulkSaveDataItems as bulkSaveDataItems, index_d$1_bulkUpdateDataItems as bulkUpdateDataItems, index_d$1_countDataItems as countDataItems, index_d$1_getDataItem as getDataItem, index_d$1_insertDataItem as insertDataItem, index_d$1_insertDataItemReference as insertDataItemReference, index_d$1_isReferencedDataItem as isReferencedDataItem, index_d$1_onDataItemCreated as onDataItemCreated, index_d$1_onDataItemDeleted as onDataItemDeleted, index_d$1_onDataItemUpdated as onDataItemUpdated, onDataItemCreated$1 as publicOnDataItemCreated, onDataItemDeleted$1 as publicOnDataItemDeleted, onDataItemUpdated$1 as publicOnDataItemUpdated, index_d$1_queryDataItems as queryDataItems, index_d$1_queryDistinctValues as queryDistinctValues, index_d$1_queryReferencedDataItems as queryReferencedDataItems, index_d$1_removeDataItem as removeDataItem, index_d$1_removeDataItemReference as removeDataItemReference, index_d$1_replaceDataItemReferences as replaceDataItemReferences, index_d$1_saveDataItem as saveDataItem, index_d$1_truncateDataItems as truncateDataItems, index_d$1_updateDataItem as updateDataItem };
4613
5855
  }
4614
5856
 
5857
+ type HostModule<T, H extends Host> = {
5858
+ __type: 'host';
5859
+ create(host: H): T;
5860
+ };
5861
+ type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
5862
+ type Host<Environment = unknown> = {
5863
+ channel: {
5864
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
5865
+ disconnect: () => void;
5866
+ } | Promise<{
5867
+ disconnect: () => void;
5868
+ }>;
5869
+ };
5870
+ environment?: Environment;
5871
+ /**
5872
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
5873
+ */
5874
+ apiBaseUrl?: string;
5875
+ /**
5876
+ * Possible data to be provided by every host, for cross cutting concerns
5877
+ * like internationalization, billing, etc.
5878
+ */
5879
+ essentials?: {
5880
+ /**
5881
+ * The language of the currently viewed session
5882
+ */
5883
+ language?: string;
5884
+ /**
5885
+ * The locale of the currently viewed session
5886
+ */
5887
+ locale?: string;
5888
+ /**
5889
+ * Any headers that should be passed through to the API requests
5890
+ */
5891
+ passThroughHeaders?: Record<string, string>;
5892
+ };
5893
+ };
5894
+
5895
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
5896
+ interface HttpClient {
5897
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
5898
+ fetchWithAuth: typeof fetch;
5899
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
5900
+ getActiveToken?: () => string | undefined;
5901
+ }
5902
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
5903
+ type HttpResponse<T = any> = {
5904
+ data: T;
5905
+ status: number;
5906
+ statusText: string;
5907
+ headers: any;
5908
+ request?: any;
5909
+ };
5910
+ type RequestOptions<_TResponse = any, Data = any> = {
5911
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
5912
+ url: string;
5913
+ data?: Data;
5914
+ params?: URLSearchParams;
5915
+ } & APIMetadata;
5916
+ type APIMetadata = {
5917
+ methodFqn?: string;
5918
+ entityFqdn?: string;
5919
+ packageName?: string;
5920
+ };
5921
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
5922
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
5923
+ __type: 'event-definition';
5924
+ type: Type;
5925
+ isDomainEvent?: boolean;
5926
+ transformations?: (envelope: unknown) => Payload;
5927
+ __payload: Payload;
5928
+ };
5929
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
5930
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
5931
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
5932
+
5933
+ type ServicePluginMethodInput = {
5934
+ request: any;
5935
+ metadata: any;
5936
+ };
5937
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
5938
+ type ServicePluginMethodMetadata = {
5939
+ name: string;
5940
+ primaryHttpMappingPath: string;
5941
+ transformations: {
5942
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
5943
+ toREST: (...args: unknown[]) => unknown;
5944
+ };
5945
+ };
5946
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
5947
+ __type: 'service-plugin-definition';
5948
+ componentType: string;
5949
+ methods: ServicePluginMethodMetadata[];
5950
+ __contract: Contract;
5951
+ };
5952
+ declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
5953
+ type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
5954
+ declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
5955
+
5956
+ type RequestContext = {
5957
+ isSSR: boolean;
5958
+ host: string;
5959
+ protocol?: string;
5960
+ };
5961
+ type ResponseTransformer = (data: any, headers?: any) => any;
5962
+ /**
5963
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
5964
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
5965
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
5966
+ */
5967
+ type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
5968
+ type AmbassadorRequestOptions<T = any> = {
5969
+ _?: T;
5970
+ url?: string;
5971
+ method?: Method;
5972
+ params?: any;
5973
+ data?: any;
5974
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
5975
+ };
5976
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
5977
+ __isAmbassador: boolean;
5978
+ };
5979
+ type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
5980
+ type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
5981
+
5982
+ declare global {
5983
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
5984
+ interface SymbolConstructor {
5985
+ readonly observable: symbol;
5986
+ }
5987
+ }
5988
+
5989
+ declare const emptyObjectSymbol: unique symbol;
5990
+
5991
+ /**
5992
+ Represents a strictly empty plain object, the `{}` value.
5993
+
5994
+ 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)).
5995
+
5996
+ @example
5997
+ ```
5998
+ import type {EmptyObject} from 'type-fest';
5999
+
6000
+ // The following illustrates the problem with `{}`.
6001
+ const foo1: {} = {}; // Pass
6002
+ const foo2: {} = []; // Pass
6003
+ const foo3: {} = 42; // Pass
6004
+ const foo4: {} = {a: 1}; // Pass
6005
+
6006
+ // With `EmptyObject` only the first case is valid.
6007
+ const bar1: EmptyObject = {}; // Pass
6008
+ const bar2: EmptyObject = 42; // Fail
6009
+ const bar3: EmptyObject = []; // Fail
6010
+ const bar4: EmptyObject = {a: 1}; // Fail
6011
+ ```
6012
+
6013
+ 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}.
6014
+
6015
+ @category Object
6016
+ */
6017
+ type EmptyObject = {[emptyObjectSymbol]?: never};
6018
+
6019
+ /**
6020
+ Returns a boolean for whether the two given types are equal.
6021
+
6022
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
6023
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
6024
+
6025
+ Use-cases:
6026
+ - If you want to make a conditional branch based on the result of a comparison of two types.
6027
+
6028
+ @example
6029
+ ```
6030
+ import type {IsEqual} from 'type-fest';
6031
+
6032
+ // This type returns a boolean for whether the given array includes the given item.
6033
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
6034
+ type Includes<Value extends readonly any[], Item> =
6035
+ Value extends readonly [Value[0], ...infer rest]
6036
+ ? IsEqual<Value[0], Item> extends true
6037
+ ? true
6038
+ : Includes<rest, Item>
6039
+ : false;
6040
+ ```
6041
+
6042
+ @category Type Guard
6043
+ @category Utilities
6044
+ */
6045
+ type IsEqual<A, B> =
6046
+ (<G>() => G extends A ? 1 : 2) extends
6047
+ (<G>() => G extends B ? 1 : 2)
6048
+ ? true
6049
+ : false;
6050
+
6051
+ /**
6052
+ Filter out keys from an object.
6053
+
6054
+ Returns `never` if `Exclude` is strictly equal to `Key`.
6055
+ Returns `never` if `Key` extends `Exclude`.
6056
+ Returns `Key` otherwise.
6057
+
6058
+ @example
6059
+ ```
6060
+ type Filtered = Filter<'foo', 'foo'>;
6061
+ //=> never
6062
+ ```
6063
+
6064
+ @example
6065
+ ```
6066
+ type Filtered = Filter<'bar', string>;
6067
+ //=> never
6068
+ ```
6069
+
6070
+ @example
6071
+ ```
6072
+ type Filtered = Filter<'bar', 'foo'>;
6073
+ //=> 'bar'
6074
+ ```
6075
+
6076
+ @see {Except}
6077
+ */
6078
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
6079
+
6080
+ type ExceptOptions = {
6081
+ /**
6082
+ Disallow assigning non-specified properties.
6083
+
6084
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
6085
+
6086
+ @default false
6087
+ */
6088
+ requireExactProps?: boolean;
6089
+ };
6090
+
6091
+ /**
6092
+ Create a type from an object type without certain keys.
6093
+
6094
+ We recommend setting the `requireExactProps` option to `true`.
6095
+
6096
+ 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.
6097
+
6098
+ 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)).
6099
+
6100
+ @example
6101
+ ```
6102
+ import type {Except} from 'type-fest';
6103
+
6104
+ type Foo = {
6105
+ a: number;
6106
+ b: string;
6107
+ };
6108
+
6109
+ type FooWithoutA = Except<Foo, 'a'>;
6110
+ //=> {b: string}
6111
+
6112
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
6113
+ //=> errors: 'a' does not exist in type '{ b: string; }'
6114
+
6115
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
6116
+ //=> {a: number} & Partial<Record<"b", never>>
6117
+
6118
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
6119
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
6120
+ ```
6121
+
6122
+ @category Object
6123
+ */
6124
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
6125
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
6126
+ } & (Options['requireExactProps'] extends true
6127
+ ? Partial<Record<KeysType, never>>
6128
+ : {});
6129
+
6130
+ /**
6131
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
6132
+
6133
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
6134
+
6135
+ @example
6136
+ ```
6137
+ import type {ConditionalKeys} from 'type-fest';
6138
+
6139
+ interface Example {
6140
+ a: string;
6141
+ b: string | number;
6142
+ c?: string;
6143
+ d: {};
6144
+ }
6145
+
6146
+ type StringKeysOnly = ConditionalKeys<Example, string>;
6147
+ //=> 'a'
6148
+ ```
6149
+
6150
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
6151
+
6152
+ @example
6153
+ ```
6154
+ import type {ConditionalKeys} from 'type-fest';
6155
+
6156
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
6157
+ //=> 'a' | 'c'
6158
+ ```
6159
+
6160
+ @category Object
6161
+ */
6162
+ type ConditionalKeys<Base, Condition> = NonNullable<
6163
+ // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
6164
+ {
6165
+ // Map through all the keys of the given base type.
6166
+ [Key in keyof Base]:
6167
+ // Pick only keys with types extending the given `Condition` type.
6168
+ Base[Key] extends Condition
6169
+ // Retain this key since the condition passes.
6170
+ ? Key
6171
+ // Discard this key since the condition fails.
6172
+ : never;
6173
+
6174
+ // Convert the produced object into a union type of the keys which passed the conditional test.
6175
+ }[keyof Base]
6176
+ >;
6177
+
6178
+ /**
6179
+ Exclude keys from a shape that matches the given `Condition`.
6180
+
6181
+ 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.
6182
+
6183
+ @example
6184
+ ```
6185
+ import type {Primitive, ConditionalExcept} from 'type-fest';
6186
+
6187
+ class Awesome {
6188
+ name: string;
6189
+ successes: number;
6190
+ failures: bigint;
6191
+
6192
+ run() {}
6193
+ }
6194
+
6195
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
6196
+ //=> {run: () => void}
6197
+ ```
6198
+
6199
+ @example
6200
+ ```
6201
+ import type {ConditionalExcept} from 'type-fest';
6202
+
6203
+ interface Example {
6204
+ a: string;
6205
+ b: string | number;
6206
+ c: () => void;
6207
+ d: {};
6208
+ }
6209
+
6210
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
6211
+ //=> {b: string | number; c: () => void; d: {}}
6212
+ ```
6213
+
6214
+ @category Object
6215
+ */
6216
+ type ConditionalExcept<Base, Condition> = Except<
6217
+ Base,
6218
+ ConditionalKeys<Base, Condition>
6219
+ >;
6220
+
6221
+ /**
6222
+ * Descriptors are objects that describe the API of a module, and the module
6223
+ * can either be a REST module or a host module.
6224
+ * This type is recursive, so it can describe nested modules.
6225
+ */
6226
+ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
6227
+ [key: string]: Descriptors | PublicMetadata | any;
6228
+ };
6229
+ /**
6230
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
6231
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
6232
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
6233
+ * do not match the given host (as they will not work with the given host).
6234
+ */
6235
+ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
6236
+ done: T;
6237
+ recurse: T extends {
6238
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
6239
+ } ? 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<{
6240
+ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
6241
+ -1,
6242
+ 0,
6243
+ 1,
6244
+ 2,
6245
+ 3,
6246
+ 4,
6247
+ 5
6248
+ ][Depth]> : never;
6249
+ }, EmptyObject>;
6250
+ }[Depth extends -1 ? 'done' : 'recurse'];
6251
+ type PublicMetadata = {
6252
+ PACKAGE_NAME?: string;
6253
+ };
6254
+
6255
+ declare global {
6256
+ interface ContextualClient {
6257
+ }
6258
+ }
6259
+ /**
6260
+ * A type used to create concerete types from SDK descriptors in
6261
+ * case a contextual client is available.
6262
+ */
6263
+ type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
6264
+ host: Host;
6265
+ } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
6266
+
4615
6267
  /** An index is a map of a collection's data, organized according to specific fields to increase query speed. */
4616
6268
  interface Index {
4617
6269
  /** Name of the index. */
@@ -4830,9 +6482,9 @@ interface ListIndexesSignature {
4830
6482
  (dataCollectionId: string, options?: ListIndexesOptions | undefined): Promise<ListIndexesResponse & ListIndexesResponseNonNullableFields>;
4831
6483
  }
4832
6484
 
4833
- declare const createIndex: BuildRESTFunction<typeof createIndex$1> & typeof createIndex$1;
4834
- declare const dropIndex: BuildRESTFunction<typeof dropIndex$1> & typeof dropIndex$1;
4835
- declare const listIndexes: BuildRESTFunction<typeof listIndexes$1> & typeof listIndexes$1;
6485
+ declare const createIndex: MaybeContext<BuildRESTFunction<typeof createIndex$1> & typeof createIndex$1>;
6486
+ declare const dropIndex: MaybeContext<BuildRESTFunction<typeof dropIndex$1> & typeof dropIndex$1>;
6487
+ declare const listIndexes: MaybeContext<BuildRESTFunction<typeof listIndexes$1> & typeof listIndexes$1>;
4836
6488
 
4837
6489
  type index_d_CreateIndexRequest = CreateIndexRequest;
4838
6490
  type index_d_CreateIndexResponse = CreateIndexResponse;