@wix/crm 1.0.131 → 1.0.133

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,131 @@
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$5<T, H extends Host$5> = {
2
+ __type: 'host';
3
+ create(host: H): T;
4
+ };
5
+ type HostModuleAPI$5<T extends HostModule$5<any, any>> = T extends HostModule$5<infer U, any> ? U : never;
6
+ type Host$5<Environment = unknown> = {
7
+ channel: {
8
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
+ disconnect: () => void;
10
+ } | Promise<{
11
+ disconnect: () => void;
12
+ }>;
13
+ };
14
+ environment?: Environment;
15
+ /**
16
+ * Optional name of the environment, use for logging
17
+ */
18
+ name?: string;
19
+ /**
20
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
21
+ */
22
+ apiBaseUrl?: string;
23
+ /**
24
+ * Possible data to be provided by every host, for cross cutting concerns
25
+ * like internationalization, billing, etc.
26
+ */
27
+ essentials?: {
28
+ /**
29
+ * The language of the currently viewed session
30
+ */
31
+ language?: string;
32
+ /**
33
+ * The locale of the currently viewed session
34
+ */
35
+ locale?: string;
36
+ /**
37
+ * Any headers that should be passed through to the API requests
38
+ */
39
+ passThroughHeaders?: Record<string, string>;
40
+ };
41
+ };
42
+
43
+ type RESTFunctionDescriptor$5<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$5) => T;
44
+ interface HttpClient$5 {
45
+ request<TResponse, TData = any>(req: RequestOptionsFactory$5<TResponse, TData>): Promise<HttpResponse$5<TResponse>>;
4
46
  fetchWithAuth: typeof fetch;
5
47
  wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
48
+ getActiveToken?: () => string | undefined;
6
49
  }
7
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
8
- type HttpResponse<T = any> = {
50
+ type RequestOptionsFactory$5<TResponse = any, TData = any> = (context: any) => RequestOptions$5<TResponse, TData>;
51
+ type HttpResponse$5<T = any> = {
9
52
  data: T;
10
53
  status: number;
11
54
  statusText: string;
12
55
  headers: any;
13
56
  request?: any;
14
57
  };
15
- type RequestOptions<_TResponse = any, Data = any> = {
58
+ type RequestOptions$5<_TResponse = any, Data = any> = {
16
59
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
17
60
  url: string;
18
61
  data?: Data;
19
62
  params?: URLSearchParams;
20
- } & APIMetadata;
21
- type APIMetadata = {
63
+ } & APIMetadata$5;
64
+ type APIMetadata$5 = {
22
65
  methodFqn?: string;
23
66
  entityFqdn?: string;
24
67
  packageName?: string;
25
68
  };
26
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
27
- type EventDefinition<Payload = unknown, Type extends string = string> = {
69
+ type BuildRESTFunction$5<T extends RESTFunctionDescriptor$5> = T extends RESTFunctionDescriptor$5<infer U> ? U : never;
70
+ type EventDefinition$5<Payload = unknown, Type extends string = string> = {
28
71
  __type: 'event-definition';
29
72
  type: Type;
30
73
  isDomainEvent?: boolean;
31
74
  transformations?: (envelope: unknown) => Payload;
32
75
  __payload: Payload;
33
76
  };
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;
77
+ declare function EventDefinition$5<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$5<Payload, Type>;
78
+ type EventHandler$5<T extends EventDefinition$5> = (payload: T['__payload']) => void | Promise<void>;
79
+ type BuildEventDefinition$5<T extends EventDefinition$5<any, string>> = (handler: EventHandler$5<T>) => void;
80
+
81
+ type ServicePluginMethodInput$5 = {
82
+ request: any;
83
+ metadata: any;
84
+ };
85
+ type ServicePluginContract$5 = Record<string, (payload: ServicePluginMethodInput$5) => unknown | Promise<unknown>>;
86
+ type ServicePluginMethodMetadata$5 = {
87
+ name: string;
88
+ primaryHttpMappingPath: string;
89
+ transformations: {
90
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$5;
91
+ toREST: (...args: unknown[]) => unknown;
92
+ };
93
+ };
94
+ type ServicePluginDefinition$5<Contract extends ServicePluginContract$5> = {
95
+ __type: 'service-plugin-definition';
96
+ componentType: string;
97
+ methods: ServicePluginMethodMetadata$5[];
98
+ __contract: Contract;
99
+ };
100
+ declare function ServicePluginDefinition$5<Contract extends ServicePluginContract$5>(componentType: string, methods: ServicePluginMethodMetadata$5[]): ServicePluginDefinition$5<Contract>;
101
+ type BuildServicePluginDefinition$5<T extends ServicePluginDefinition$5<any>> = (implementation: T['__contract']) => void;
102
+ declare const SERVICE_PLUGIN_ERROR_TYPE$5 = "wix_spi_error";
103
+
104
+ type RequestContext$5 = {
105
+ isSSR: boolean;
106
+ host: string;
107
+ protocol?: string;
108
+ };
109
+ type ResponseTransformer$5 = (data: any, headers?: any) => any;
110
+ /**
111
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
112
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
113
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
114
+ */
115
+ type Method$5 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
116
+ type AmbassadorRequestOptions$5<T = any> = {
117
+ _?: T;
118
+ url?: string;
119
+ method?: Method$5;
120
+ params?: any;
121
+ data?: any;
122
+ transformResponse?: ResponseTransformer$5 | ResponseTransformer$5[];
123
+ };
124
+ type AmbassadorFactory$5<Request, Response> = (payload: Request) => ((context: RequestContext$5) => AmbassadorRequestOptions$5<Response>) & {
125
+ __isAmbassador: boolean;
126
+ };
127
+ type AmbassadorFunctionDescriptor$5<Request = any, Response = any> = AmbassadorFactory$5<Request, Response>;
128
+ type BuildAmbassadorFunction$5<T extends AmbassadorFunctionDescriptor$5> = T extends AmbassadorFunctionDescriptor$5<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
37
129
 
38
130
  declare global {
39
131
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -42,6 +134,348 @@ declare global {
42
134
  }
43
135
  }
44
136
 
137
+ declare const emptyObjectSymbol$5: unique symbol;
138
+
139
+ /**
140
+ Represents a strictly empty plain object, the `{}` value.
141
+
142
+ When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
143
+
144
+ @example
145
+ ```
146
+ import type {EmptyObject} from 'type-fest';
147
+
148
+ // The following illustrates the problem with `{}`.
149
+ const foo1: {} = {}; // Pass
150
+ const foo2: {} = []; // Pass
151
+ const foo3: {} = 42; // Pass
152
+ const foo4: {} = {a: 1}; // Pass
153
+
154
+ // With `EmptyObject` only the first case is valid.
155
+ const bar1: EmptyObject = {}; // Pass
156
+ const bar2: EmptyObject = 42; // Fail
157
+ const bar3: EmptyObject = []; // Fail
158
+ const bar4: EmptyObject = {a: 1}; // Fail
159
+ ```
160
+
161
+ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
162
+
163
+ @category Object
164
+ */
165
+ type EmptyObject$5 = {[emptyObjectSymbol$5]?: never};
166
+
167
+ /**
168
+ Returns a boolean for whether the two given types are equal.
169
+
170
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
171
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
172
+
173
+ Use-cases:
174
+ - If you want to make a conditional branch based on the result of a comparison of two types.
175
+
176
+ @example
177
+ ```
178
+ import type {IsEqual} from 'type-fest';
179
+
180
+ // This type returns a boolean for whether the given array includes the given item.
181
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
182
+ type Includes<Value extends readonly any[], Item> =
183
+ Value extends readonly [Value[0], ...infer rest]
184
+ ? IsEqual<Value[0], Item> extends true
185
+ ? true
186
+ : Includes<rest, Item>
187
+ : false;
188
+ ```
189
+
190
+ @category Type Guard
191
+ @category Utilities
192
+ */
193
+ type IsEqual$5<A, B> =
194
+ (<G>() => G extends A ? 1 : 2) extends
195
+ (<G>() => G extends B ? 1 : 2)
196
+ ? true
197
+ : false;
198
+
199
+ /**
200
+ Filter out keys from an object.
201
+
202
+ Returns `never` if `Exclude` is strictly equal to `Key`.
203
+ Returns `never` if `Key` extends `Exclude`.
204
+ Returns `Key` otherwise.
205
+
206
+ @example
207
+ ```
208
+ type Filtered = Filter<'foo', 'foo'>;
209
+ //=> never
210
+ ```
211
+
212
+ @example
213
+ ```
214
+ type Filtered = Filter<'bar', string>;
215
+ //=> never
216
+ ```
217
+
218
+ @example
219
+ ```
220
+ type Filtered = Filter<'bar', 'foo'>;
221
+ //=> 'bar'
222
+ ```
223
+
224
+ @see {Except}
225
+ */
226
+ type Filter$5<KeyType, ExcludeType> = IsEqual$5<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
227
+
228
+ type ExceptOptions$5 = {
229
+ /**
230
+ Disallow assigning non-specified properties.
231
+
232
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
233
+
234
+ @default false
235
+ */
236
+ requireExactProps?: boolean;
237
+ };
238
+
239
+ /**
240
+ Create a type from an object type without certain keys.
241
+
242
+ We recommend setting the `requireExactProps` option to `true`.
243
+
244
+ This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
245
+
246
+ This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
247
+
248
+ @example
249
+ ```
250
+ import type {Except} from 'type-fest';
251
+
252
+ type Foo = {
253
+ a: number;
254
+ b: string;
255
+ };
256
+
257
+ type FooWithoutA = Except<Foo, 'a'>;
258
+ //=> {b: string}
259
+
260
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
261
+ //=> errors: 'a' does not exist in type '{ b: string; }'
262
+
263
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
264
+ //=> {a: number} & Partial<Record<"b", never>>
265
+
266
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
267
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
268
+ ```
269
+
270
+ @category Object
271
+ */
272
+ type Except$5<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$5 = {requireExactProps: false}> = {
273
+ [KeyType in keyof ObjectType as Filter$5<KeyType, KeysType>]: ObjectType[KeyType];
274
+ } & (Options['requireExactProps'] extends true
275
+ ? Partial<Record<KeysType, never>>
276
+ : {});
277
+
278
+ /**
279
+ Returns a boolean for whether the given type is `never`.
280
+
281
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
282
+ @link https://stackoverflow.com/a/53984913/10292952
283
+ @link https://www.zhenghao.io/posts/ts-never
284
+
285
+ Useful in type utilities, such as checking if something does not occur.
286
+
287
+ @example
288
+ ```
289
+ import type {IsNever, And} from 'type-fest';
290
+
291
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
292
+ type AreStringsEqual<A extends string, B extends string> =
293
+ And<
294
+ IsNever<Exclude<A, B>> extends true ? true : false,
295
+ IsNever<Exclude<B, A>> extends true ? true : false
296
+ >;
297
+
298
+ type EndIfEqual<I extends string, O extends string> =
299
+ AreStringsEqual<I, O> extends true
300
+ ? never
301
+ : void;
302
+
303
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
304
+ if (input === output) {
305
+ process.exit(0);
306
+ }
307
+ }
308
+
309
+ endIfEqual('abc', 'abc');
310
+ //=> never
311
+
312
+ endIfEqual('abc', '123');
313
+ //=> void
314
+ ```
315
+
316
+ @category Type Guard
317
+ @category Utilities
318
+ */
319
+ type IsNever$5<T> = [T] extends [never] ? true : false;
320
+
321
+ /**
322
+ An if-else-like type that resolves depending on whether the given type is `never`.
323
+
324
+ @see {@link IsNever}
325
+
326
+ @example
327
+ ```
328
+ import type {IfNever} from 'type-fest';
329
+
330
+ type ShouldBeTrue = IfNever<never>;
331
+ //=> true
332
+
333
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
334
+ //=> 'bar'
335
+ ```
336
+
337
+ @category Type Guard
338
+ @category Utilities
339
+ */
340
+ type IfNever$5<T, TypeIfNever = true, TypeIfNotNever = false> = (
341
+ IsNever$5<T> extends true ? TypeIfNever : TypeIfNotNever
342
+ );
343
+
344
+ /**
345
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
346
+
347
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
348
+
349
+ @example
350
+ ```
351
+ import type {ConditionalKeys} from 'type-fest';
352
+
353
+ interface Example {
354
+ a: string;
355
+ b: string | number;
356
+ c?: string;
357
+ d: {};
358
+ }
359
+
360
+ type StringKeysOnly = ConditionalKeys<Example, string>;
361
+ //=> 'a'
362
+ ```
363
+
364
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
365
+
366
+ @example
367
+ ```
368
+ import type {ConditionalKeys} from 'type-fest';
369
+
370
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
371
+ //=> 'a' | 'c'
372
+ ```
373
+
374
+ @category Object
375
+ */
376
+ type ConditionalKeys$5<Base, Condition> =
377
+ {
378
+ // Map through all the keys of the given base type.
379
+ [Key in keyof Base]-?:
380
+ // Pick only keys with types extending the given `Condition` type.
381
+ Base[Key] extends Condition
382
+ // Retain this key
383
+ // If the value for the key extends never, only include it if `Condition` also extends never
384
+ ? IfNever$5<Base[Key], IfNever$5<Condition, Key, never>, Key>
385
+ // Discard this key since the condition fails.
386
+ : never;
387
+ // Convert the produced object into a union type of the keys which passed the conditional test.
388
+ }[keyof Base];
389
+
390
+ /**
391
+ Exclude keys from a shape that matches the given `Condition`.
392
+
393
+ This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
394
+
395
+ @example
396
+ ```
397
+ import type {Primitive, ConditionalExcept} from 'type-fest';
398
+
399
+ class Awesome {
400
+ name: string;
401
+ successes: number;
402
+ failures: bigint;
403
+
404
+ run() {}
405
+ }
406
+
407
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
408
+ //=> {run: () => void}
409
+ ```
410
+
411
+ @example
412
+ ```
413
+ import type {ConditionalExcept} from 'type-fest';
414
+
415
+ interface Example {
416
+ a: string;
417
+ b: string | number;
418
+ c: () => void;
419
+ d: {};
420
+ }
421
+
422
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
423
+ //=> {b: string | number; c: () => void; d: {}}
424
+ ```
425
+
426
+ @category Object
427
+ */
428
+ type ConditionalExcept$5<Base, Condition> = Except$5<
429
+ Base,
430
+ ConditionalKeys$5<Base, Condition>
431
+ >;
432
+
433
+ /**
434
+ * Descriptors are objects that describe the API of a module, and the module
435
+ * can either be a REST module or a host module.
436
+ * This type is recursive, so it can describe nested modules.
437
+ */
438
+ type Descriptors$5 = RESTFunctionDescriptor$5 | AmbassadorFunctionDescriptor$5 | HostModule$5<any, any> | EventDefinition$5<any> | ServicePluginDefinition$5<any> | {
439
+ [key: string]: Descriptors$5 | PublicMetadata$5 | any;
440
+ };
441
+ /**
442
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
443
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
444
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
445
+ * do not match the given host (as they will not work with the given host).
446
+ */
447
+ type BuildDescriptors$5<T extends Descriptors$5, H extends Host$5<any> | undefined, Depth extends number = 5> = {
448
+ done: T;
449
+ recurse: T extends {
450
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$5;
451
+ } ? never : T extends AmbassadorFunctionDescriptor$5 ? BuildAmbassadorFunction$5<T> : T extends RESTFunctionDescriptor$5 ? BuildRESTFunction$5<T> : T extends EventDefinition$5<any> ? BuildEventDefinition$5<T> : T extends ServicePluginDefinition$5<any> ? BuildServicePluginDefinition$5<T> : T extends HostModule$5<any, any> ? HostModuleAPI$5<T> : ConditionalExcept$5<{
452
+ [Key in keyof T]: T[Key] extends Descriptors$5 ? BuildDescriptors$5<T[Key], H, [
453
+ -1,
454
+ 0,
455
+ 1,
456
+ 2,
457
+ 3,
458
+ 4,
459
+ 5
460
+ ][Depth]> : never;
461
+ }, EmptyObject$5>;
462
+ }[Depth extends -1 ? 'done' : 'recurse'];
463
+ type PublicMetadata$5 = {
464
+ PACKAGE_NAME?: string;
465
+ };
466
+
467
+ declare global {
468
+ interface ContextualClient {
469
+ }
470
+ }
471
+ /**
472
+ * A type used to create concerete types from SDK descriptors in
473
+ * case a contextual client is available.
474
+ */
475
+ type MaybeContext$5<T extends Descriptors$5> = globalThis.ContextualClient extends {
476
+ host: Host$5;
477
+ } ? BuildDescriptors$5<T, globalThis.ContextualClient['host']> : T;
478
+
45
479
  interface ContactAttachment extends ContactAttachmentMediaOneOf {
46
480
  /** The attachment's image (if the attachment is of type IMAGE) */
47
481
  image?: string;
@@ -420,7 +854,7 @@ interface GetAttachmentIdentifiers {
420
854
  attachmentId: string;
421
855
  }
422
856
 
423
- declare function generateAttachmentUploadUrl$1(httpClient: HttpClient): GenerateAttachmentUploadUrlSignature;
857
+ declare function generateAttachmentUploadUrl$1(httpClient: HttpClient$5): GenerateAttachmentUploadUrlSignature;
424
858
  interface GenerateAttachmentUploadUrlSignature {
425
859
  /**
426
860
  * Generates an upload URL to allow external clients to upload a file as an attachment to a given contact.
@@ -432,7 +866,7 @@ interface GenerateAttachmentUploadUrlSignature {
432
866
  */
433
867
  (contactId: string, fileName: string, options: GenerateAttachmentUploadUrlOptions): Promise<GenerateAttachmentUploadUrlResponse & GenerateAttachmentUploadUrlResponseNonNullableFields>;
434
868
  }
435
- declare function listAttachments$1(httpClient: HttpClient): ListAttachmentsSignature;
869
+ declare function listAttachments$1(httpClient: HttpClient$5): ListAttachmentsSignature;
436
870
  interface ListAttachmentsSignature {
437
871
  /**
438
872
  * List Attachments.
@@ -440,14 +874,14 @@ interface ListAttachmentsSignature {
440
874
  */
441
875
  (contactId: string, options?: ListAttachmentsOptions | undefined): Promise<ListAttachmentsResponse & ListAttachmentsResponseNonNullableFields>;
442
876
  }
443
- declare function deleteAttachment$1(httpClient: HttpClient): DeleteAttachmentSignature;
877
+ declare function deleteAttachment$1(httpClient: HttpClient$5): DeleteAttachmentSignature;
444
878
  interface DeleteAttachmentSignature {
445
879
  /**
446
880
  * Deletes an attachment from contact
447
881
  */
448
882
  (identifiers: DeleteAttachmentIdentifiers): Promise<void>;
449
883
  }
450
- declare function getAttachment$1(httpClient: HttpClient): GetAttachmentSignature;
884
+ declare function getAttachment$1(httpClient: HttpClient$5): GetAttachmentSignature;
451
885
  interface GetAttachmentSignature {
452
886
  /**
453
887
  * Retrieves an attachment.
@@ -455,15 +889,15 @@ interface GetAttachmentSignature {
455
889
  */
456
890
  (identifiers: GetAttachmentIdentifiers): Promise<ContactAttachment & ContactAttachmentNonNullableFields>;
457
891
  }
458
- declare const onAttachmentCreated$1: EventDefinition<AttachmentCreatedEnvelope, "wix.contacts.v4.attachment_created">;
459
- declare const onAttachmentDeleted$1: EventDefinition<AttachmentDeletedEnvelope, "wix.contacts.v4.attachment_deleted">;
892
+ declare const onAttachmentCreated$1: EventDefinition$5<AttachmentCreatedEnvelope, "wix.contacts.v4.attachment_created">;
893
+ declare const onAttachmentDeleted$1: EventDefinition$5<AttachmentDeletedEnvelope, "wix.contacts.v4.attachment_deleted">;
460
894
 
461
- declare function createEventModule$4<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
895
+ declare function createEventModule$4<T extends EventDefinition$5<any, string>>(eventDefinition: T): BuildEventDefinition$5<T> & T;
462
896
 
463
- declare const generateAttachmentUploadUrl: BuildRESTFunction<typeof generateAttachmentUploadUrl$1> & typeof generateAttachmentUploadUrl$1;
464
- declare const listAttachments: BuildRESTFunction<typeof listAttachments$1> & typeof listAttachments$1;
465
- declare const deleteAttachment: BuildRESTFunction<typeof deleteAttachment$1> & typeof deleteAttachment$1;
466
- declare const getAttachment: BuildRESTFunction<typeof getAttachment$1> & typeof getAttachment$1;
897
+ declare const generateAttachmentUploadUrl: MaybeContext$5<BuildRESTFunction$5<typeof generateAttachmentUploadUrl$1> & typeof generateAttachmentUploadUrl$1>;
898
+ declare const listAttachments: MaybeContext$5<BuildRESTFunction$5<typeof listAttachments$1> & typeof listAttachments$1>;
899
+ declare const deleteAttachment: MaybeContext$5<BuildRESTFunction$5<typeof deleteAttachment$1> & typeof deleteAttachment$1>;
900
+ declare const getAttachment: MaybeContext$5<BuildRESTFunction$5<typeof getAttachment$1> & typeof getAttachment$1>;
467
901
 
468
902
  type _publicOnAttachmentCreatedType = typeof onAttachmentCreated$1;
469
903
  /**
@@ -524,6 +958,484 @@ declare namespace context$5 {
524
958
  export { type ActionEvent$4 as ActionEvent, type context$5_AttachmentCreatedEnvelope as AttachmentCreatedEnvelope, type context$5_AttachmentDeletedEnvelope as AttachmentDeletedEnvelope, type context$5_AttachmentMedia as AttachmentMedia, type context$5_AttachmentMediaMediaOneOf as AttachmentMediaMediaOneOf, type context$5_AttachmentMetadata as AttachmentMetadata, type context$5_AttachmentSource as AttachmentSource, context$5_AttachmentType as AttachmentType, type BaseEventMetadata$4 as BaseEventMetadata, type context$5_ContactAttachment as ContactAttachment, type context$5_ContactAttachmentMediaOneOf as ContactAttachmentMediaOneOf, type context$5_ContactAttachmentNonNullableFields as ContactAttachmentNonNullableFields, type context$5_CreateDemoAttachmentRequest as CreateDemoAttachmentRequest, type context$5_CreateDemoAttachmentResponse as CreateDemoAttachmentResponse, type context$5_CrmAttachment as CrmAttachment, context$5_CrmAttachmentAttachmentType as CrmAttachmentAttachmentType, type context$5_CrmAttachmentUploadedEvent as CrmAttachmentUploadedEvent, type context$5_DeleteAttachmentIdentifiers as DeleteAttachmentIdentifiers, type context$5_DeleteAttachmentRequest as DeleteAttachmentRequest, type context$5_DeleteAttachmentResponse as DeleteAttachmentResponse, context$5_DemoContactType as DemoContactType, type DomainEvent$4 as DomainEvent, type DomainEventBodyOneOf$4 as DomainEventBodyOneOf, type Empty$1 as Empty, type EntityCreatedEvent$4 as EntityCreatedEvent, type EntityDeletedEvent$4 as EntityDeletedEvent, type EntityUpdatedEvent$4 as EntityUpdatedEvent, type EventMetadata$4 as EventMetadata, type context$5_GenerateAttachmentUploadUrlOptions as GenerateAttachmentUploadUrlOptions, type context$5_GenerateAttachmentUploadUrlRequest as GenerateAttachmentUploadUrlRequest, type context$5_GenerateAttachmentUploadUrlResponse as GenerateAttachmentUploadUrlResponse, type context$5_GenerateAttachmentUploadUrlResponseNonNullableFields as GenerateAttachmentUploadUrlResponseNonNullableFields, type context$5_GetAttachmentIdentifiers as GetAttachmentIdentifiers, type context$5_GetAttachmentRequest as GetAttachmentRequest, type context$5_GetAttachmentResponse as GetAttachmentResponse, type context$5_GetAttachmentResponseNonNullableFields as GetAttachmentResponseNonNullableFields, type IdentificationData$5 as IdentificationData, type IdentificationDataIdOneOf$5 as IdentificationDataIdOneOf, type context$5_ListAttachmentsOptions as ListAttachmentsOptions, type context$5_ListAttachmentsRequest as ListAttachmentsRequest, type context$5_ListAttachmentsResponse as ListAttachmentsResponse, type context$5_ListAttachmentsResponseNonNullableFields as ListAttachmentsResponseNonNullableFields, type context$5_MediaFileUploadedEvent as MediaFileUploadedEvent, type MessageEnvelope$5 as MessageEnvelope, type Paging$4 as Paging, type PagingMetadata$3 as PagingMetadata, WebhookIdentityType$5 as WebhookIdentityType, type context$5__publicOnAttachmentCreatedType as _publicOnAttachmentCreatedType, type context$5__publicOnAttachmentDeletedType as _publicOnAttachmentDeletedType, context$5_deleteAttachment as deleteAttachment, context$5_generateAttachmentUploadUrl as generateAttachmentUploadUrl, context$5_getAttachment as getAttachment, context$5_listAttachments as listAttachments, context$5_onAttachmentCreated as onAttachmentCreated, context$5_onAttachmentDeleted as onAttachmentDeleted, onAttachmentCreated$1 as publicOnAttachmentCreated, onAttachmentDeleted$1 as publicOnAttachmentDeleted };
525
959
  }
526
960
 
961
+ type HostModule$4<T, H extends Host$4> = {
962
+ __type: 'host';
963
+ create(host: H): T;
964
+ };
965
+ type HostModuleAPI$4<T extends HostModule$4<any, any>> = T extends HostModule$4<infer U, any> ? U : never;
966
+ type Host$4<Environment = unknown> = {
967
+ channel: {
968
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
969
+ disconnect: () => void;
970
+ } | Promise<{
971
+ disconnect: () => void;
972
+ }>;
973
+ };
974
+ environment?: Environment;
975
+ /**
976
+ * Optional name of the environment, use for logging
977
+ */
978
+ name?: string;
979
+ /**
980
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
981
+ */
982
+ apiBaseUrl?: string;
983
+ /**
984
+ * Possible data to be provided by every host, for cross cutting concerns
985
+ * like internationalization, billing, etc.
986
+ */
987
+ essentials?: {
988
+ /**
989
+ * The language of the currently viewed session
990
+ */
991
+ language?: string;
992
+ /**
993
+ * The locale of the currently viewed session
994
+ */
995
+ locale?: string;
996
+ /**
997
+ * Any headers that should be passed through to the API requests
998
+ */
999
+ passThroughHeaders?: Record<string, string>;
1000
+ };
1001
+ };
1002
+
1003
+ type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
1004
+ interface HttpClient$4 {
1005
+ request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
1006
+ fetchWithAuth: typeof fetch;
1007
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
1008
+ getActiveToken?: () => string | undefined;
1009
+ }
1010
+ type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
1011
+ type HttpResponse$4<T = any> = {
1012
+ data: T;
1013
+ status: number;
1014
+ statusText: string;
1015
+ headers: any;
1016
+ request?: any;
1017
+ };
1018
+ type RequestOptions$4<_TResponse = any, Data = any> = {
1019
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1020
+ url: string;
1021
+ data?: Data;
1022
+ params?: URLSearchParams;
1023
+ } & APIMetadata$4;
1024
+ type APIMetadata$4 = {
1025
+ methodFqn?: string;
1026
+ entityFqdn?: string;
1027
+ packageName?: string;
1028
+ };
1029
+ type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
1030
+ type EventDefinition$4<Payload = unknown, Type extends string = string> = {
1031
+ __type: 'event-definition';
1032
+ type: Type;
1033
+ isDomainEvent?: boolean;
1034
+ transformations?: (envelope: unknown) => Payload;
1035
+ __payload: Payload;
1036
+ };
1037
+ declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
1038
+ type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
1039
+ type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
1040
+
1041
+ type ServicePluginMethodInput$4 = {
1042
+ request: any;
1043
+ metadata: any;
1044
+ };
1045
+ type ServicePluginContract$4 = Record<string, (payload: ServicePluginMethodInput$4) => unknown | Promise<unknown>>;
1046
+ type ServicePluginMethodMetadata$4 = {
1047
+ name: string;
1048
+ primaryHttpMappingPath: string;
1049
+ transformations: {
1050
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$4;
1051
+ toREST: (...args: unknown[]) => unknown;
1052
+ };
1053
+ };
1054
+ type ServicePluginDefinition$4<Contract extends ServicePluginContract$4> = {
1055
+ __type: 'service-plugin-definition';
1056
+ componentType: string;
1057
+ methods: ServicePluginMethodMetadata$4[];
1058
+ __contract: Contract;
1059
+ };
1060
+ declare function ServicePluginDefinition$4<Contract extends ServicePluginContract$4>(componentType: string, methods: ServicePluginMethodMetadata$4[]): ServicePluginDefinition$4<Contract>;
1061
+ type BuildServicePluginDefinition$4<T extends ServicePluginDefinition$4<any>> = (implementation: T['__contract']) => void;
1062
+ declare const SERVICE_PLUGIN_ERROR_TYPE$4 = "wix_spi_error";
1063
+
1064
+ type RequestContext$4 = {
1065
+ isSSR: boolean;
1066
+ host: string;
1067
+ protocol?: string;
1068
+ };
1069
+ type ResponseTransformer$4 = (data: any, headers?: any) => any;
1070
+ /**
1071
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
1072
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
1073
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
1074
+ */
1075
+ type Method$4 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
1076
+ type AmbassadorRequestOptions$4<T = any> = {
1077
+ _?: T;
1078
+ url?: string;
1079
+ method?: Method$4;
1080
+ params?: any;
1081
+ data?: any;
1082
+ transformResponse?: ResponseTransformer$4 | ResponseTransformer$4[];
1083
+ };
1084
+ type AmbassadorFactory$4<Request, Response> = (payload: Request) => ((context: RequestContext$4) => AmbassadorRequestOptions$4<Response>) & {
1085
+ __isAmbassador: boolean;
1086
+ };
1087
+ type AmbassadorFunctionDescriptor$4<Request = any, Response = any> = AmbassadorFactory$4<Request, Response>;
1088
+ type BuildAmbassadorFunction$4<T extends AmbassadorFunctionDescriptor$4> = T extends AmbassadorFunctionDescriptor$4<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
1089
+
1090
+ declare global {
1091
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1092
+ interface SymbolConstructor {
1093
+ readonly observable: symbol;
1094
+ }
1095
+ }
1096
+
1097
+ declare const emptyObjectSymbol$4: unique symbol;
1098
+
1099
+ /**
1100
+ Represents a strictly empty plain object, the `{}` value.
1101
+
1102
+ 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)).
1103
+
1104
+ @example
1105
+ ```
1106
+ import type {EmptyObject} from 'type-fest';
1107
+
1108
+ // The following illustrates the problem with `{}`.
1109
+ const foo1: {} = {}; // Pass
1110
+ const foo2: {} = []; // Pass
1111
+ const foo3: {} = 42; // Pass
1112
+ const foo4: {} = {a: 1}; // Pass
1113
+
1114
+ // With `EmptyObject` only the first case is valid.
1115
+ const bar1: EmptyObject = {}; // Pass
1116
+ const bar2: EmptyObject = 42; // Fail
1117
+ const bar3: EmptyObject = []; // Fail
1118
+ const bar4: EmptyObject = {a: 1}; // Fail
1119
+ ```
1120
+
1121
+ 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}.
1122
+
1123
+ @category Object
1124
+ */
1125
+ type EmptyObject$4 = {[emptyObjectSymbol$4]?: never};
1126
+
1127
+ /**
1128
+ Returns a boolean for whether the two given types are equal.
1129
+
1130
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
1131
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
1132
+
1133
+ Use-cases:
1134
+ - If you want to make a conditional branch based on the result of a comparison of two types.
1135
+
1136
+ @example
1137
+ ```
1138
+ import type {IsEqual} from 'type-fest';
1139
+
1140
+ // This type returns a boolean for whether the given array includes the given item.
1141
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
1142
+ type Includes<Value extends readonly any[], Item> =
1143
+ Value extends readonly [Value[0], ...infer rest]
1144
+ ? IsEqual<Value[0], Item> extends true
1145
+ ? true
1146
+ : Includes<rest, Item>
1147
+ : false;
1148
+ ```
1149
+
1150
+ @category Type Guard
1151
+ @category Utilities
1152
+ */
1153
+ type IsEqual$4<A, B> =
1154
+ (<G>() => G extends A ? 1 : 2) extends
1155
+ (<G>() => G extends B ? 1 : 2)
1156
+ ? true
1157
+ : false;
1158
+
1159
+ /**
1160
+ Filter out keys from an object.
1161
+
1162
+ Returns `never` if `Exclude` is strictly equal to `Key`.
1163
+ Returns `never` if `Key` extends `Exclude`.
1164
+ Returns `Key` otherwise.
1165
+
1166
+ @example
1167
+ ```
1168
+ type Filtered = Filter<'foo', 'foo'>;
1169
+ //=> never
1170
+ ```
1171
+
1172
+ @example
1173
+ ```
1174
+ type Filtered = Filter<'bar', string>;
1175
+ //=> never
1176
+ ```
1177
+
1178
+ @example
1179
+ ```
1180
+ type Filtered = Filter<'bar', 'foo'>;
1181
+ //=> 'bar'
1182
+ ```
1183
+
1184
+ @see {Except}
1185
+ */
1186
+ type Filter$4<KeyType, ExcludeType> = IsEqual$4<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
1187
+
1188
+ type ExceptOptions$4 = {
1189
+ /**
1190
+ Disallow assigning non-specified properties.
1191
+
1192
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
1193
+
1194
+ @default false
1195
+ */
1196
+ requireExactProps?: boolean;
1197
+ };
1198
+
1199
+ /**
1200
+ Create a type from an object type without certain keys.
1201
+
1202
+ We recommend setting the `requireExactProps` option to `true`.
1203
+
1204
+ 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.
1205
+
1206
+ 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)).
1207
+
1208
+ @example
1209
+ ```
1210
+ import type {Except} from 'type-fest';
1211
+
1212
+ type Foo = {
1213
+ a: number;
1214
+ b: string;
1215
+ };
1216
+
1217
+ type FooWithoutA = Except<Foo, 'a'>;
1218
+ //=> {b: string}
1219
+
1220
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
1221
+ //=> errors: 'a' does not exist in type '{ b: string; }'
1222
+
1223
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
1224
+ //=> {a: number} & Partial<Record<"b", never>>
1225
+
1226
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
1227
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
1228
+ ```
1229
+
1230
+ @category Object
1231
+ */
1232
+ type Except$4<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$4 = {requireExactProps: false}> = {
1233
+ [KeyType in keyof ObjectType as Filter$4<KeyType, KeysType>]: ObjectType[KeyType];
1234
+ } & (Options['requireExactProps'] extends true
1235
+ ? Partial<Record<KeysType, never>>
1236
+ : {});
1237
+
1238
+ /**
1239
+ Returns a boolean for whether the given type is `never`.
1240
+
1241
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
1242
+ @link https://stackoverflow.com/a/53984913/10292952
1243
+ @link https://www.zhenghao.io/posts/ts-never
1244
+
1245
+ Useful in type utilities, such as checking if something does not occur.
1246
+
1247
+ @example
1248
+ ```
1249
+ import type {IsNever, And} from 'type-fest';
1250
+
1251
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
1252
+ type AreStringsEqual<A extends string, B extends string> =
1253
+ And<
1254
+ IsNever<Exclude<A, B>> extends true ? true : false,
1255
+ IsNever<Exclude<B, A>> extends true ? true : false
1256
+ >;
1257
+
1258
+ type EndIfEqual<I extends string, O extends string> =
1259
+ AreStringsEqual<I, O> extends true
1260
+ ? never
1261
+ : void;
1262
+
1263
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
1264
+ if (input === output) {
1265
+ process.exit(0);
1266
+ }
1267
+ }
1268
+
1269
+ endIfEqual('abc', 'abc');
1270
+ //=> never
1271
+
1272
+ endIfEqual('abc', '123');
1273
+ //=> void
1274
+ ```
1275
+
1276
+ @category Type Guard
1277
+ @category Utilities
1278
+ */
1279
+ type IsNever$4<T> = [T] extends [never] ? true : false;
1280
+
1281
+ /**
1282
+ An if-else-like type that resolves depending on whether the given type is `never`.
1283
+
1284
+ @see {@link IsNever}
1285
+
1286
+ @example
1287
+ ```
1288
+ import type {IfNever} from 'type-fest';
1289
+
1290
+ type ShouldBeTrue = IfNever<never>;
1291
+ //=> true
1292
+
1293
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
1294
+ //=> 'bar'
1295
+ ```
1296
+
1297
+ @category Type Guard
1298
+ @category Utilities
1299
+ */
1300
+ type IfNever$4<T, TypeIfNever = true, TypeIfNotNever = false> = (
1301
+ IsNever$4<T> extends true ? TypeIfNever : TypeIfNotNever
1302
+ );
1303
+
1304
+ /**
1305
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
1306
+
1307
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
1308
+
1309
+ @example
1310
+ ```
1311
+ import type {ConditionalKeys} from 'type-fest';
1312
+
1313
+ interface Example {
1314
+ a: string;
1315
+ b: string | number;
1316
+ c?: string;
1317
+ d: {};
1318
+ }
1319
+
1320
+ type StringKeysOnly = ConditionalKeys<Example, string>;
1321
+ //=> 'a'
1322
+ ```
1323
+
1324
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
1325
+
1326
+ @example
1327
+ ```
1328
+ import type {ConditionalKeys} from 'type-fest';
1329
+
1330
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
1331
+ //=> 'a' | 'c'
1332
+ ```
1333
+
1334
+ @category Object
1335
+ */
1336
+ type ConditionalKeys$4<Base, Condition> =
1337
+ {
1338
+ // Map through all the keys of the given base type.
1339
+ [Key in keyof Base]-?:
1340
+ // Pick only keys with types extending the given `Condition` type.
1341
+ Base[Key] extends Condition
1342
+ // Retain this key
1343
+ // If the value for the key extends never, only include it if `Condition` also extends never
1344
+ ? IfNever$4<Base[Key], IfNever$4<Condition, Key, never>, Key>
1345
+ // Discard this key since the condition fails.
1346
+ : never;
1347
+ // Convert the produced object into a union type of the keys which passed the conditional test.
1348
+ }[keyof Base];
1349
+
1350
+ /**
1351
+ Exclude keys from a shape that matches the given `Condition`.
1352
+
1353
+ 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.
1354
+
1355
+ @example
1356
+ ```
1357
+ import type {Primitive, ConditionalExcept} from 'type-fest';
1358
+
1359
+ class Awesome {
1360
+ name: string;
1361
+ successes: number;
1362
+ failures: bigint;
1363
+
1364
+ run() {}
1365
+ }
1366
+
1367
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
1368
+ //=> {run: () => void}
1369
+ ```
1370
+
1371
+ @example
1372
+ ```
1373
+ import type {ConditionalExcept} from 'type-fest';
1374
+
1375
+ interface Example {
1376
+ a: string;
1377
+ b: string | number;
1378
+ c: () => void;
1379
+ d: {};
1380
+ }
1381
+
1382
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
1383
+ //=> {b: string | number; c: () => void; d: {}}
1384
+ ```
1385
+
1386
+ @category Object
1387
+ */
1388
+ type ConditionalExcept$4<Base, Condition> = Except$4<
1389
+ Base,
1390
+ ConditionalKeys$4<Base, Condition>
1391
+ >;
1392
+
1393
+ /**
1394
+ * Descriptors are objects that describe the API of a module, and the module
1395
+ * can either be a REST module or a host module.
1396
+ * This type is recursive, so it can describe nested modules.
1397
+ */
1398
+ type Descriptors$4 = RESTFunctionDescriptor$4 | AmbassadorFunctionDescriptor$4 | HostModule$4<any, any> | EventDefinition$4<any> | ServicePluginDefinition$4<any> | {
1399
+ [key: string]: Descriptors$4 | PublicMetadata$4 | any;
1400
+ };
1401
+ /**
1402
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
1403
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
1404
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
1405
+ * do not match the given host (as they will not work with the given host).
1406
+ */
1407
+ type BuildDescriptors$4<T extends Descriptors$4, H extends Host$4<any> | undefined, Depth extends number = 5> = {
1408
+ done: T;
1409
+ recurse: T extends {
1410
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$4;
1411
+ } ? never : T extends AmbassadorFunctionDescriptor$4 ? BuildAmbassadorFunction$4<T> : T extends RESTFunctionDescriptor$4 ? BuildRESTFunction$4<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition$4<any> ? BuildServicePluginDefinition$4<T> : T extends HostModule$4<any, any> ? HostModuleAPI$4<T> : ConditionalExcept$4<{
1412
+ [Key in keyof T]: T[Key] extends Descriptors$4 ? BuildDescriptors$4<T[Key], H, [
1413
+ -1,
1414
+ 0,
1415
+ 1,
1416
+ 2,
1417
+ 3,
1418
+ 4,
1419
+ 5
1420
+ ][Depth]> : never;
1421
+ }, EmptyObject$4>;
1422
+ }[Depth extends -1 ? 'done' : 'recurse'];
1423
+ type PublicMetadata$4 = {
1424
+ PACKAGE_NAME?: string;
1425
+ };
1426
+
1427
+ declare global {
1428
+ interface ContextualClient {
1429
+ }
1430
+ }
1431
+ /**
1432
+ * A type used to create concerete types from SDK descriptors in
1433
+ * case a contextual client is available.
1434
+ */
1435
+ type MaybeContext$4<T extends Descriptors$4> = globalThis.ContextualClient extends {
1436
+ host: Host$4;
1437
+ } ? BuildDescriptors$4<T, globalThis.ContextualClient['host']> : T;
1438
+
527
1439
  interface Contact {
528
1440
  /**
529
1441
  * Contact ID.
@@ -2439,7 +3351,7 @@ interface GetContactOptions {
2439
3351
  fieldsets?: ContactFieldSet[];
2440
3352
  }
2441
3353
 
2442
- declare function createContact$1(httpClient: HttpClient): CreateContactSignature;
3354
+ declare function createContact$1(httpClient: HttpClient$4): CreateContactSignature;
2443
3355
  interface CreateContactSignature {
2444
3356
  /**
2445
3357
  * Creates a new contact.
@@ -2460,7 +3372,7 @@ interface CreateContactSignature {
2460
3372
  */
2461
3373
  (info: ContactInfo$2, options?: CreateContactOptions | undefined): Promise<CreateContactResponse & CreateContactResponseNonNullableFields>;
2462
3374
  }
2463
- declare function updateContact$1(httpClient: HttpClient): UpdateContactSignature;
3375
+ declare function updateContact$1(httpClient: HttpClient$4): UpdateContactSignature;
2464
3376
  interface UpdateContactSignature {
2465
3377
  /**
2466
3378
  * Updates a contact's properties.
@@ -2480,7 +3392,7 @@ interface UpdateContactSignature {
2480
3392
  */
2481
3393
  (contactId: string, info: ContactInfo$2, revision: number | null, options?: UpdateContactOptions | undefined): Promise<UpdateContactResponse & UpdateContactResponseNonNullableFields>;
2482
3394
  }
2483
- declare function mergeContacts$1(httpClient: HttpClient): MergeContactsSignature;
3395
+ declare function mergeContacts$1(httpClient: HttpClient$4): MergeContactsSignature;
2484
3396
  interface MergeContactsSignature {
2485
3397
  /**
2486
3398
  * Merges source contacts into a target contact.
@@ -2506,7 +3418,7 @@ interface MergeContactsSignature {
2506
3418
  */
2507
3419
  (targetContactId: string, targetContactRevision: number | null, options?: MergeContactsOptions | undefined): Promise<MergeContactsResponse & MergeContactsResponseNonNullableFields>;
2508
3420
  }
2509
- declare function deleteContact$1(httpClient: HttpClient): DeleteContactSignature;
3421
+ declare function deleteContact$1(httpClient: HttpClient$4): DeleteContactSignature;
2510
3422
  interface DeleteContactSignature {
2511
3423
  /**
2512
3424
  * Deletes a contact who is not a site member or contributor.
@@ -2524,7 +3436,7 @@ interface DeleteContactSignature {
2524
3436
  */
2525
3437
  (contactId: string): Promise<void>;
2526
3438
  }
2527
- declare function labelContact$1(httpClient: HttpClient): LabelContactSignature;
3439
+ declare function labelContact$1(httpClient: HttpClient$4): LabelContactSignature;
2528
3440
  interface LabelContactSignature {
2529
3441
  /**
2530
3442
  * Adds labels to a contact.
@@ -2546,7 +3458,7 @@ interface LabelContactSignature {
2546
3458
  */
2547
3459
  (contactId: string, labelKeys: string[]): Promise<LabelContactResponse & LabelContactResponseNonNullableFields>;
2548
3460
  }
2549
- declare function unlabelContact$1(httpClient: HttpClient): UnlabelContactSignature;
3461
+ declare function unlabelContact$1(httpClient: HttpClient$4): UnlabelContactSignature;
2550
3462
  interface UnlabelContactSignature {
2551
3463
  /**
2552
3464
  * Removes labels from a contact.
@@ -2562,7 +3474,7 @@ interface UnlabelContactSignature {
2562
3474
  */
2563
3475
  (contactId: string, labelKeys: string[]): Promise<UnlabelContactResponse & UnlabelContactResponseNonNullableFields>;
2564
3476
  }
2565
- declare function queryContacts$1(httpClient: HttpClient): QueryContactsSignature;
3477
+ declare function queryContacts$1(httpClient: HttpClient$4): QueryContactsSignature;
2566
3478
  interface QueryContactsSignature {
2567
3479
  /**
2568
3480
  * Creates a query to retrieve a list of contacts.
@@ -2584,7 +3496,7 @@ interface QueryContactsSignature {
2584
3496
  */
2585
3497
  (options?: QueryContactsOptions | undefined): ContactsQueryBuilder;
2586
3498
  }
2587
- declare function getContact$1(httpClient: HttpClient): GetContactSignature;
3499
+ declare function getContact$1(httpClient: HttpClient$4): GetContactSignature;
2588
3500
  interface GetContactSignature {
2589
3501
  /**
2590
3502
  * Retrieves a contact.
@@ -2605,21 +3517,21 @@ interface GetContactSignature {
2605
3517
  */
2606
3518
  (_id: string, options?: GetContactOptions | undefined): Promise<Contact & ContactNonNullableFields>;
2607
3519
  }
2608
- declare const onContactCreated$1: EventDefinition<ContactCreatedEnvelope, "wix.contacts.v4.contact_created">;
2609
- declare const onContactUpdated$1: EventDefinition<ContactUpdatedEnvelope, "wix.contacts.v4.contact_updated">;
2610
- declare const onContactMerged$1: EventDefinition<ContactMergedEnvelope, "wix.contacts.v4.contact_merged">;
2611
- declare const onContactDeleted$1: EventDefinition<ContactDeletedEnvelope, "wix.contacts.v4.contact_deleted">;
3520
+ declare const onContactCreated$1: EventDefinition$4<ContactCreatedEnvelope, "wix.contacts.v4.contact_created">;
3521
+ declare const onContactUpdated$1: EventDefinition$4<ContactUpdatedEnvelope, "wix.contacts.v4.contact_updated">;
3522
+ declare const onContactMerged$1: EventDefinition$4<ContactMergedEnvelope, "wix.contacts.v4.contact_merged">;
3523
+ declare const onContactDeleted$1: EventDefinition$4<ContactDeletedEnvelope, "wix.contacts.v4.contact_deleted">;
2612
3524
 
2613
- declare function createEventModule$3<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
3525
+ declare function createEventModule$3<T extends EventDefinition$4<any, string>>(eventDefinition: T): BuildEventDefinition$4<T> & T;
2614
3526
 
2615
- declare const createContact: BuildRESTFunction<typeof createContact$1> & typeof createContact$1;
2616
- declare const updateContact: BuildRESTFunction<typeof updateContact$1> & typeof updateContact$1;
2617
- declare const mergeContacts: BuildRESTFunction<typeof mergeContacts$1> & typeof mergeContacts$1;
2618
- declare const deleteContact: BuildRESTFunction<typeof deleteContact$1> & typeof deleteContact$1;
2619
- declare const labelContact: BuildRESTFunction<typeof labelContact$1> & typeof labelContact$1;
2620
- declare const unlabelContact: BuildRESTFunction<typeof unlabelContact$1> & typeof unlabelContact$1;
2621
- declare const queryContacts: BuildRESTFunction<typeof queryContacts$1> & typeof queryContacts$1;
2622
- declare const getContact: BuildRESTFunction<typeof getContact$1> & typeof getContact$1;
3527
+ declare const createContact: MaybeContext$4<BuildRESTFunction$4<typeof createContact$1> & typeof createContact$1>;
3528
+ declare const updateContact: MaybeContext$4<BuildRESTFunction$4<typeof updateContact$1> & typeof updateContact$1>;
3529
+ declare const mergeContacts: MaybeContext$4<BuildRESTFunction$4<typeof mergeContacts$1> & typeof mergeContacts$1>;
3530
+ declare const deleteContact: MaybeContext$4<BuildRESTFunction$4<typeof deleteContact$1> & typeof deleteContact$1>;
3531
+ declare const labelContact: MaybeContext$4<BuildRESTFunction$4<typeof labelContact$1> & typeof labelContact$1>;
3532
+ declare const unlabelContact: MaybeContext$4<BuildRESTFunction$4<typeof unlabelContact$1> & typeof unlabelContact$1>;
3533
+ declare const queryContacts: MaybeContext$4<BuildRESTFunction$4<typeof queryContacts$1> & typeof queryContacts$1>;
3534
+ declare const getContact: MaybeContext$4<BuildRESTFunction$4<typeof getContact$1> & typeof getContact$1>;
2623
3535
 
2624
3536
  type _publicOnContactCreatedType = typeof onContactCreated$1;
2625
3537
  /**
@@ -2806,6 +3718,484 @@ declare namespace context$4 {
2806
3718
  export { context$4_Action as Action, type ActionEvent$3 as ActionEvent, type ActivityIcon$1 as ActivityIcon, type Address$1 as Address, type AddressLocation$1 as AddressLocation, type AddressStreetOneOf$1 as AddressStreetOneOf, AddressTag$1 as AddressTag, type context$4_ApplicationError as ApplicationError, type AssigneesWrapper$1 as AssigneesWrapper, type BaseEventMetadata$3 as BaseEventMetadata, type context$4_BulkActionMetadata as BulkActionMetadata, type context$4_BulkAddSegmentToContactsRequest as BulkAddSegmentToContactsRequest, type context$4_BulkAddSegmentToContactsResponse as BulkAddSegmentToContactsResponse, type context$4_BulkDeleteContactsRequest as BulkDeleteContactsRequest, type context$4_BulkDeleteContactsResponse as BulkDeleteContactsResponse, type context$4_BulkLabelAndUnlabelContactsRequest as BulkLabelAndUnlabelContactsRequest, type context$4_BulkLabelAndUnlabelContactsResponse as BulkLabelAndUnlabelContactsResponse, type context$4_BulkRemoveSegmentFromContactsRequest as BulkRemoveSegmentFromContactsRequest, type context$4_BulkRemoveSegmentFromContactsResponse as BulkRemoveSegmentFromContactsResponse, type context$4_BulkUpdateContactsRequest as BulkUpdateContactsRequest, type context$4_BulkUpdateContactsResponse as BulkUpdateContactsResponse, type context$4_BulkUpsertContactsRequest as BulkUpsertContactsRequest, type context$4_BulkUpsertContactsResponse as BulkUpsertContactsResponse, type context$4_BulkUpsertContactsResponseMetadata as BulkUpsertContactsResponseMetadata, type context$4_Contact as Contact, type ContactActivity$1 as ContactActivity, ContactActivityType$1 as ContactActivityType, type context$4_ContactAddedToSegment as ContactAddedToSegment, type ContactAddress$1 as ContactAddress, type ContactAddressesWrapper$1 as ContactAddressesWrapper, type context$4_ContactChanged as ContactChanged, type context$4_ContactCreatedEnvelope as ContactCreatedEnvelope, type context$4_ContactDeletedEnvelope as ContactDeletedEnvelope, type ContactEmail$1 as ContactEmail, type context$4_ContactEmailSubscriptionUpdated as ContactEmailSubscriptionUpdated, type ContactEmailsWrapper$1 as ContactEmailsWrapper, context$4_ContactFieldSet as ContactFieldSet, type ContactInfo$2 as ContactInfo, type context$4_ContactMerged as ContactMerged, type context$4_ContactMergedEnvelope as ContactMergedEnvelope, type ContactName$1 as ContactName, type context$4_ContactNonNullableFields as ContactNonNullableFields, type ContactPhone$1 as ContactPhone, type context$4_ContactPhoneSubscriptionUpdated as ContactPhoneSubscriptionUpdated, type ContactPhonesWrapper$1 as ContactPhonesWrapper, type ContactPicture$1 as ContactPicture, type context$4_ContactPrimaryInfoUpdated as ContactPrimaryInfoUpdated, type context$4_ContactRemovedFromSegment as ContactRemovedFromSegment, type context$4_ContactSource as ContactSource, ContactSourceType$1 as ContactSourceType, type context$4_ContactSubmitted as ContactSubmitted, type context$4_ContactUpdatedEnvelope as ContactUpdatedEnvelope, type context$4_ContactsFacet as ContactsFacet, context$4_ContactsFacetType as ContactsFacetType, type context$4_ContactsQueryBuilder as ContactsQueryBuilder, type context$4_ContactsQueryResult as ContactsQueryResult, type context$4_CountContactsRequest as CountContactsRequest, type context$4_CountContactsResponse as CountContactsResponse, type context$4_CreateContactOptions as CreateContactOptions, type context$4_CreateContactRequest as CreateContactRequest, type context$4_CreateContactResponse as CreateContactResponse, type context$4_CreateContactResponseNonNullableFields as CreateContactResponseNonNullableFields, type CursorPaging$1 as CursorPaging, type CursorPagingMetadata$1 as CursorPagingMetadata, type Cursors$1 as Cursors, type context$4_DeleteContactRequest as DeleteContactRequest, type context$4_DeleteContactResponse as DeleteContactResponse, type DomainEvent$3 as DomainEvent, type DomainEventBodyOneOf$3 as DomainEventBodyOneOf, type context$4_DuplicateContactExists as DuplicateContactExists, context$4_EmailDeliverabilityStatus as EmailDeliverabilityStatus, EmailTag$1 as EmailTag, type EntityCreatedEvent$3 as EntityCreatedEvent, type EntityDeletedEvent$3 as EntityDeletedEvent, type EntityUpdatedEvent$3 as EntityUpdatedEvent, type context$4_Error as Error, type EventMetadata$3 as EventMetadata, type ExtendedFieldsWrapper$1 as ExtendedFieldsWrapper, type context$4_GeneratePictureUploadUrlRequest as GeneratePictureUploadUrlRequest, type context$4_GeneratePictureUploadUrlResponse as GeneratePictureUploadUrlResponse, type context$4_GetContactOptions as GetContactOptions, type context$4_GetContactRequest as GetContactRequest, type context$4_GetContactResponse as GetContactResponse, type context$4_GetContactResponseNonNullableFields as GetContactResponseNonNullableFields, context$4_GetContactResponseType as GetContactResponseType, type context$4_GroupInfo as GroupInfo, type IdentificationData$4 as IdentificationData, type IdentificationDataIdOneOf$4 as IdentificationDataIdOneOf, ImageProvider$1 as ImageProvider, type context$4_Item as Item, type context$4_ItemMetadata as ItemMetadata, type context$4_LabelAndUnlabelContactRequest as LabelAndUnlabelContactRequest, type context$4_LabelAndUnlabelContactResponse as LabelAndUnlabelContactResponse, type context$4_LabelContactRequest as LabelContactRequest, type context$4_LabelContactResponse as LabelContactResponse, type context$4_LabelContactResponseNonNullableFields as LabelContactResponseNonNullableFields, type LabelsWrapper$1 as LabelsWrapper, type context$4_LastActivityUpdate as LastActivityUpdate, type context$4_ListContactIdsBySegmentRequest as ListContactIdsBySegmentRequest, type context$4_ListContactIdsBySegmentResponse as ListContactIdsBySegmentResponse, type context$4_ListContactsRequest as ListContactsRequest, type context$4_ListContactsResponse as ListContactsResponse, type context$4_ListFacetsRequest as ListFacetsRequest, type context$4_ListFacetsResponse as ListFacetsResponse, type LocationsWrapper$1 as LocationsWrapper, type context$4_MemberInfo as MemberInfo, context$4_MemberStatus as MemberStatus, type context$4_MergeContactsOptions as MergeContactsOptions, type context$4_MergeContactsRequest as MergeContactsRequest, type context$4_MergeContactsResponse as MergeContactsResponse, type context$4_MergeContactsResponseNonNullableFields as MergeContactsResponseNonNullableFields, type MessageEnvelope$4 as MessageEnvelope, type context$4_Metadata as Metadata, context$4_Mode as Mode, type Paging$3 as Paging, type PagingMetadata$2 as PagingMetadata, context$4_PhoneDeliverabilityStatus as PhoneDeliverabilityStatus, PhoneTag$1 as PhoneTag, type context$4_PreviewMergeContactsRequest as PreviewMergeContactsRequest, type context$4_PreviewMergeContactsResponse as PreviewMergeContactsResponse, type context$4_PrimaryContactInfo as PrimaryContactInfo, type context$4_PrimaryEmail as PrimaryEmail, type context$4_PrimaryPhone as PrimaryPhone, type context$4_PrimarySubscriptionStatus as PrimarySubscriptionStatus, context$4_PrivacyStatus as PrivacyStatus, type context$4_ProfileInfo as ProfileInfo, type Query$2 as Query, type context$4_QueryContactsOptions as QueryContactsOptions, type context$4_QueryContactsRequest as QueryContactsRequest, type context$4_QueryContactsResponse as QueryContactsResponse, type context$4_QueryContactsResponseNonNullableFields as QueryContactsResponseNonNullableFields, type context$4_QueryFacetsRequest as QueryFacetsRequest, type context$4_QueryFacetsResponse as QueryFacetsResponse, type RestoreInfo$2 as RestoreInfo, context$4_Role as Role, type context$4_Search as Search, type context$4_SearchContactsRequest as SearchContactsRequest, type context$4_SearchContactsResponse as SearchContactsResponse, type context$4_SearchDetails as SearchDetails, type context$4_SearchPagingMethodOneOf as SearchPagingMethodOneOf, type context$4_SegmentsWrapper as SegmentsWrapper, type context$4_SessionInfo as SessionInfo, SortOrder$3 as SortOrder, type Sorting$3 as Sorting, type StreetAddress$1 as StreetAddress, type Subdivision$1 as Subdivision, SubdivisionType$1 as SubdivisionType, SubmitOperation$1 as SubmitOperation, context$4_SubscriptionStatus as SubscriptionStatus, type context$4_SyncSubmitContactRequest as SyncSubmitContactRequest, type context$4_SyncSubmitContactResponse as SyncSubmitContactResponse, type context$4_UnlabelContactRequest as UnlabelContactRequest, type context$4_UnlabelContactResponse as UnlabelContactResponse, type context$4_UnlabelContactResponseNonNullableFields as UnlabelContactResponseNonNullableFields, type context$4_UpdateContactOptions as UpdateContactOptions, type context$4_UpdateContactRequest as UpdateContactRequest, type context$4_UpdateContactResponse as UpdateContactResponse, type context$4_UpdateContactResponseNonNullableFields as UpdateContactResponseNonNullableFields, type context$4_UpsertContactRequest as UpsertContactRequest, type context$4_UpsertContactResponse as UpsertContactResponse, context$4_UpsertContactResponseAction as UpsertContactResponseAction, type context$4_UserInfo as UserInfo, WebhookIdentityType$4 as WebhookIdentityType, type context$4__publicOnContactCreatedType as _publicOnContactCreatedType, type context$4__publicOnContactDeletedType as _publicOnContactDeletedType, type context$4__publicOnContactMergedType as _publicOnContactMergedType, type context$4__publicOnContactUpdatedType as _publicOnContactUpdatedType, context$4_createContact as createContact, context$4_deleteContact as deleteContact, context$4_getContact as getContact, context$4_labelContact as labelContact, context$4_mergeContacts as mergeContacts, context$4_onContactCreated as onContactCreated, context$4_onContactDeleted as onContactDeleted, context$4_onContactMerged as onContactMerged, context$4_onContactUpdated as onContactUpdated, onContactCreated$1 as publicOnContactCreated, onContactDeleted$1 as publicOnContactDeleted, onContactMerged$1 as publicOnContactMerged, onContactUpdated$1 as publicOnContactUpdated, context$4_queryContacts as queryContacts, context$4_unlabelContact as unlabelContact, context$4_updateContact as updateContact };
2807
3719
  }
2808
3720
 
3721
+ type HostModule$3<T, H extends Host$3> = {
3722
+ __type: 'host';
3723
+ create(host: H): T;
3724
+ };
3725
+ type HostModuleAPI$3<T extends HostModule$3<any, any>> = T extends HostModule$3<infer U, any> ? U : never;
3726
+ type Host$3<Environment = unknown> = {
3727
+ channel: {
3728
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
3729
+ disconnect: () => void;
3730
+ } | Promise<{
3731
+ disconnect: () => void;
3732
+ }>;
3733
+ };
3734
+ environment?: Environment;
3735
+ /**
3736
+ * Optional name of the environment, use for logging
3737
+ */
3738
+ name?: string;
3739
+ /**
3740
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
3741
+ */
3742
+ apiBaseUrl?: string;
3743
+ /**
3744
+ * Possible data to be provided by every host, for cross cutting concerns
3745
+ * like internationalization, billing, etc.
3746
+ */
3747
+ essentials?: {
3748
+ /**
3749
+ * The language of the currently viewed session
3750
+ */
3751
+ language?: string;
3752
+ /**
3753
+ * The locale of the currently viewed session
3754
+ */
3755
+ locale?: string;
3756
+ /**
3757
+ * Any headers that should be passed through to the API requests
3758
+ */
3759
+ passThroughHeaders?: Record<string, string>;
3760
+ };
3761
+ };
3762
+
3763
+ type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
3764
+ interface HttpClient$3 {
3765
+ request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
3766
+ fetchWithAuth: typeof fetch;
3767
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
3768
+ getActiveToken?: () => string | undefined;
3769
+ }
3770
+ type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
3771
+ type HttpResponse$3<T = any> = {
3772
+ data: T;
3773
+ status: number;
3774
+ statusText: string;
3775
+ headers: any;
3776
+ request?: any;
3777
+ };
3778
+ type RequestOptions$3<_TResponse = any, Data = any> = {
3779
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
3780
+ url: string;
3781
+ data?: Data;
3782
+ params?: URLSearchParams;
3783
+ } & APIMetadata$3;
3784
+ type APIMetadata$3 = {
3785
+ methodFqn?: string;
3786
+ entityFqdn?: string;
3787
+ packageName?: string;
3788
+ };
3789
+ type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
3790
+ type EventDefinition$3<Payload = unknown, Type extends string = string> = {
3791
+ __type: 'event-definition';
3792
+ type: Type;
3793
+ isDomainEvent?: boolean;
3794
+ transformations?: (envelope: unknown) => Payload;
3795
+ __payload: Payload;
3796
+ };
3797
+ declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
3798
+ type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
3799
+ type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
3800
+
3801
+ type ServicePluginMethodInput$3 = {
3802
+ request: any;
3803
+ metadata: any;
3804
+ };
3805
+ type ServicePluginContract$3 = Record<string, (payload: ServicePluginMethodInput$3) => unknown | Promise<unknown>>;
3806
+ type ServicePluginMethodMetadata$3 = {
3807
+ name: string;
3808
+ primaryHttpMappingPath: string;
3809
+ transformations: {
3810
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$3;
3811
+ toREST: (...args: unknown[]) => unknown;
3812
+ };
3813
+ };
3814
+ type ServicePluginDefinition$3<Contract extends ServicePluginContract$3> = {
3815
+ __type: 'service-plugin-definition';
3816
+ componentType: string;
3817
+ methods: ServicePluginMethodMetadata$3[];
3818
+ __contract: Contract;
3819
+ };
3820
+ declare function ServicePluginDefinition$3<Contract extends ServicePluginContract$3>(componentType: string, methods: ServicePluginMethodMetadata$3[]): ServicePluginDefinition$3<Contract>;
3821
+ type BuildServicePluginDefinition$3<T extends ServicePluginDefinition$3<any>> = (implementation: T['__contract']) => void;
3822
+ declare const SERVICE_PLUGIN_ERROR_TYPE$3 = "wix_spi_error";
3823
+
3824
+ type RequestContext$3 = {
3825
+ isSSR: boolean;
3826
+ host: string;
3827
+ protocol?: string;
3828
+ };
3829
+ type ResponseTransformer$3 = (data: any, headers?: any) => any;
3830
+ /**
3831
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
3832
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
3833
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
3834
+ */
3835
+ type Method$3 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
3836
+ type AmbassadorRequestOptions$3<T = any> = {
3837
+ _?: T;
3838
+ url?: string;
3839
+ method?: Method$3;
3840
+ params?: any;
3841
+ data?: any;
3842
+ transformResponse?: ResponseTransformer$3 | ResponseTransformer$3[];
3843
+ };
3844
+ type AmbassadorFactory$3<Request, Response> = (payload: Request) => ((context: RequestContext$3) => AmbassadorRequestOptions$3<Response>) & {
3845
+ __isAmbassador: boolean;
3846
+ };
3847
+ type AmbassadorFunctionDescriptor$3<Request = any, Response = any> = AmbassadorFactory$3<Request, Response>;
3848
+ type BuildAmbassadorFunction$3<T extends AmbassadorFunctionDescriptor$3> = T extends AmbassadorFunctionDescriptor$3<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
3849
+
3850
+ declare global {
3851
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
3852
+ interface SymbolConstructor {
3853
+ readonly observable: symbol;
3854
+ }
3855
+ }
3856
+
3857
+ declare const emptyObjectSymbol$3: unique symbol;
3858
+
3859
+ /**
3860
+ Represents a strictly empty plain object, the `{}` value.
3861
+
3862
+ 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)).
3863
+
3864
+ @example
3865
+ ```
3866
+ import type {EmptyObject} from 'type-fest';
3867
+
3868
+ // The following illustrates the problem with `{}`.
3869
+ const foo1: {} = {}; // Pass
3870
+ const foo2: {} = []; // Pass
3871
+ const foo3: {} = 42; // Pass
3872
+ const foo4: {} = {a: 1}; // Pass
3873
+
3874
+ // With `EmptyObject` only the first case is valid.
3875
+ const bar1: EmptyObject = {}; // Pass
3876
+ const bar2: EmptyObject = 42; // Fail
3877
+ const bar3: EmptyObject = []; // Fail
3878
+ const bar4: EmptyObject = {a: 1}; // Fail
3879
+ ```
3880
+
3881
+ 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}.
3882
+
3883
+ @category Object
3884
+ */
3885
+ type EmptyObject$3 = {[emptyObjectSymbol$3]?: never};
3886
+
3887
+ /**
3888
+ Returns a boolean for whether the two given types are equal.
3889
+
3890
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
3891
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
3892
+
3893
+ Use-cases:
3894
+ - If you want to make a conditional branch based on the result of a comparison of two types.
3895
+
3896
+ @example
3897
+ ```
3898
+ import type {IsEqual} from 'type-fest';
3899
+
3900
+ // This type returns a boolean for whether the given array includes the given item.
3901
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
3902
+ type Includes<Value extends readonly any[], Item> =
3903
+ Value extends readonly [Value[0], ...infer rest]
3904
+ ? IsEqual<Value[0], Item> extends true
3905
+ ? true
3906
+ : Includes<rest, Item>
3907
+ : false;
3908
+ ```
3909
+
3910
+ @category Type Guard
3911
+ @category Utilities
3912
+ */
3913
+ type IsEqual$3<A, B> =
3914
+ (<G>() => G extends A ? 1 : 2) extends
3915
+ (<G>() => G extends B ? 1 : 2)
3916
+ ? true
3917
+ : false;
3918
+
3919
+ /**
3920
+ Filter out keys from an object.
3921
+
3922
+ Returns `never` if `Exclude` is strictly equal to `Key`.
3923
+ Returns `never` if `Key` extends `Exclude`.
3924
+ Returns `Key` otherwise.
3925
+
3926
+ @example
3927
+ ```
3928
+ type Filtered = Filter<'foo', 'foo'>;
3929
+ //=> never
3930
+ ```
3931
+
3932
+ @example
3933
+ ```
3934
+ type Filtered = Filter<'bar', string>;
3935
+ //=> never
3936
+ ```
3937
+
3938
+ @example
3939
+ ```
3940
+ type Filtered = Filter<'bar', 'foo'>;
3941
+ //=> 'bar'
3942
+ ```
3943
+
3944
+ @see {Except}
3945
+ */
3946
+ type Filter$3<KeyType, ExcludeType> = IsEqual$3<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
3947
+
3948
+ type ExceptOptions$3 = {
3949
+ /**
3950
+ Disallow assigning non-specified properties.
3951
+
3952
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
3953
+
3954
+ @default false
3955
+ */
3956
+ requireExactProps?: boolean;
3957
+ };
3958
+
3959
+ /**
3960
+ Create a type from an object type without certain keys.
3961
+
3962
+ We recommend setting the `requireExactProps` option to `true`.
3963
+
3964
+ 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.
3965
+
3966
+ 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)).
3967
+
3968
+ @example
3969
+ ```
3970
+ import type {Except} from 'type-fest';
3971
+
3972
+ type Foo = {
3973
+ a: number;
3974
+ b: string;
3975
+ };
3976
+
3977
+ type FooWithoutA = Except<Foo, 'a'>;
3978
+ //=> {b: string}
3979
+
3980
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
3981
+ //=> errors: 'a' does not exist in type '{ b: string; }'
3982
+
3983
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
3984
+ //=> {a: number} & Partial<Record<"b", never>>
3985
+
3986
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
3987
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
3988
+ ```
3989
+
3990
+ @category Object
3991
+ */
3992
+ type Except$3<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$3 = {requireExactProps: false}> = {
3993
+ [KeyType in keyof ObjectType as Filter$3<KeyType, KeysType>]: ObjectType[KeyType];
3994
+ } & (Options['requireExactProps'] extends true
3995
+ ? Partial<Record<KeysType, never>>
3996
+ : {});
3997
+
3998
+ /**
3999
+ Returns a boolean for whether the given type is `never`.
4000
+
4001
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
4002
+ @link https://stackoverflow.com/a/53984913/10292952
4003
+ @link https://www.zhenghao.io/posts/ts-never
4004
+
4005
+ Useful in type utilities, such as checking if something does not occur.
4006
+
4007
+ @example
4008
+ ```
4009
+ import type {IsNever, And} from 'type-fest';
4010
+
4011
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
4012
+ type AreStringsEqual<A extends string, B extends string> =
4013
+ And<
4014
+ IsNever<Exclude<A, B>> extends true ? true : false,
4015
+ IsNever<Exclude<B, A>> extends true ? true : false
4016
+ >;
4017
+
4018
+ type EndIfEqual<I extends string, O extends string> =
4019
+ AreStringsEqual<I, O> extends true
4020
+ ? never
4021
+ : void;
4022
+
4023
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
4024
+ if (input === output) {
4025
+ process.exit(0);
4026
+ }
4027
+ }
4028
+
4029
+ endIfEqual('abc', 'abc');
4030
+ //=> never
4031
+
4032
+ endIfEqual('abc', '123');
4033
+ //=> void
4034
+ ```
4035
+
4036
+ @category Type Guard
4037
+ @category Utilities
4038
+ */
4039
+ type IsNever$3<T> = [T] extends [never] ? true : false;
4040
+
4041
+ /**
4042
+ An if-else-like type that resolves depending on whether the given type is `never`.
4043
+
4044
+ @see {@link IsNever}
4045
+
4046
+ @example
4047
+ ```
4048
+ import type {IfNever} from 'type-fest';
4049
+
4050
+ type ShouldBeTrue = IfNever<never>;
4051
+ //=> true
4052
+
4053
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
4054
+ //=> 'bar'
4055
+ ```
4056
+
4057
+ @category Type Guard
4058
+ @category Utilities
4059
+ */
4060
+ type IfNever$3<T, TypeIfNever = true, TypeIfNotNever = false> = (
4061
+ IsNever$3<T> extends true ? TypeIfNever : TypeIfNotNever
4062
+ );
4063
+
4064
+ /**
4065
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
4066
+
4067
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
4068
+
4069
+ @example
4070
+ ```
4071
+ import type {ConditionalKeys} from 'type-fest';
4072
+
4073
+ interface Example {
4074
+ a: string;
4075
+ b: string | number;
4076
+ c?: string;
4077
+ d: {};
4078
+ }
4079
+
4080
+ type StringKeysOnly = ConditionalKeys<Example, string>;
4081
+ //=> 'a'
4082
+ ```
4083
+
4084
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
4085
+
4086
+ @example
4087
+ ```
4088
+ import type {ConditionalKeys} from 'type-fest';
4089
+
4090
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
4091
+ //=> 'a' | 'c'
4092
+ ```
4093
+
4094
+ @category Object
4095
+ */
4096
+ type ConditionalKeys$3<Base, Condition> =
4097
+ {
4098
+ // Map through all the keys of the given base type.
4099
+ [Key in keyof Base]-?:
4100
+ // Pick only keys with types extending the given `Condition` type.
4101
+ Base[Key] extends Condition
4102
+ // Retain this key
4103
+ // If the value for the key extends never, only include it if `Condition` also extends never
4104
+ ? IfNever$3<Base[Key], IfNever$3<Condition, Key, never>, Key>
4105
+ // Discard this key since the condition fails.
4106
+ : never;
4107
+ // Convert the produced object into a union type of the keys which passed the conditional test.
4108
+ }[keyof Base];
4109
+
4110
+ /**
4111
+ Exclude keys from a shape that matches the given `Condition`.
4112
+
4113
+ 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.
4114
+
4115
+ @example
4116
+ ```
4117
+ import type {Primitive, ConditionalExcept} from 'type-fest';
4118
+
4119
+ class Awesome {
4120
+ name: string;
4121
+ successes: number;
4122
+ failures: bigint;
4123
+
4124
+ run() {}
4125
+ }
4126
+
4127
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
4128
+ //=> {run: () => void}
4129
+ ```
4130
+
4131
+ @example
4132
+ ```
4133
+ import type {ConditionalExcept} from 'type-fest';
4134
+
4135
+ interface Example {
4136
+ a: string;
4137
+ b: string | number;
4138
+ c: () => void;
4139
+ d: {};
4140
+ }
4141
+
4142
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
4143
+ //=> {b: string | number; c: () => void; d: {}}
4144
+ ```
4145
+
4146
+ @category Object
4147
+ */
4148
+ type ConditionalExcept$3<Base, Condition> = Except$3<
4149
+ Base,
4150
+ ConditionalKeys$3<Base, Condition>
4151
+ >;
4152
+
4153
+ /**
4154
+ * Descriptors are objects that describe the API of a module, and the module
4155
+ * can either be a REST module or a host module.
4156
+ * This type is recursive, so it can describe nested modules.
4157
+ */
4158
+ type Descriptors$3 = RESTFunctionDescriptor$3 | AmbassadorFunctionDescriptor$3 | HostModule$3<any, any> | EventDefinition$3<any> | ServicePluginDefinition$3<any> | {
4159
+ [key: string]: Descriptors$3 | PublicMetadata$3 | any;
4160
+ };
4161
+ /**
4162
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
4163
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
4164
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
4165
+ * do not match the given host (as they will not work with the given host).
4166
+ */
4167
+ type BuildDescriptors$3<T extends Descriptors$3, H extends Host$3<any> | undefined, Depth extends number = 5> = {
4168
+ done: T;
4169
+ recurse: T extends {
4170
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$3;
4171
+ } ? never : T extends AmbassadorFunctionDescriptor$3 ? BuildAmbassadorFunction$3<T> : T extends RESTFunctionDescriptor$3 ? BuildRESTFunction$3<T> : T extends EventDefinition$3<any> ? BuildEventDefinition$3<T> : T extends ServicePluginDefinition$3<any> ? BuildServicePluginDefinition$3<T> : T extends HostModule$3<any, any> ? HostModuleAPI$3<T> : ConditionalExcept$3<{
4172
+ [Key in keyof T]: T[Key] extends Descriptors$3 ? BuildDescriptors$3<T[Key], H, [
4173
+ -1,
4174
+ 0,
4175
+ 1,
4176
+ 2,
4177
+ 3,
4178
+ 4,
4179
+ 5
4180
+ ][Depth]> : never;
4181
+ }, EmptyObject$3>;
4182
+ }[Depth extends -1 ? 'done' : 'recurse'];
4183
+ type PublicMetadata$3 = {
4184
+ PACKAGE_NAME?: string;
4185
+ };
4186
+
4187
+ declare global {
4188
+ interface ContextualClient {
4189
+ }
4190
+ }
4191
+ /**
4192
+ * A type used to create concerete types from SDK descriptors in
4193
+ * case a contextual client is available.
4194
+ */
4195
+ type MaybeContext$3<T extends Descriptors$3> = globalThis.ContextualClient extends {
4196
+ host: Host$3;
4197
+ } ? BuildDescriptors$3<T, globalThis.ContextualClient['host']> : T;
4198
+
2809
4199
  /** Extended field that was found or created. */
2810
4200
  interface ExtendedField {
2811
4201
  /**
@@ -3377,7 +4767,7 @@ interface FieldsQueryBuilder {
3377
4767
  find: () => Promise<FieldsQueryResult>;
3378
4768
  }
3379
4769
 
3380
- declare function findOrCreateExtendedField$1(httpClient: HttpClient): FindOrCreateExtendedFieldSignature;
4770
+ declare function findOrCreateExtendedField$1(httpClient: HttpClient$3): FindOrCreateExtendedFieldSignature;
3381
4771
  interface FindOrCreateExtendedFieldSignature {
3382
4772
  /**
3383
4773
  * Retrieves a custom field with a given name, or creates one if it doesn't exist.
@@ -3406,7 +4796,7 @@ interface FindOrCreateExtendedFieldSignature {
3406
4796
  */
3407
4797
  (displayName: string, dataType: FieldDataType): Promise<FindOrCreateExtendedFieldResponse & FindOrCreateExtendedFieldResponseNonNullableFields>;
3408
4798
  }
3409
- declare function getExtendedField$1(httpClient: HttpClient): GetExtendedFieldSignature;
4799
+ declare function getExtendedField$1(httpClient: HttpClient$3): GetExtendedFieldSignature;
3410
4800
  interface GetExtendedFieldSignature {
3411
4801
  /**
3412
4802
  * Retrieves an extended field.
@@ -3425,7 +4815,7 @@ interface GetExtendedFieldSignature {
3425
4815
  */
3426
4816
  (key: string): Promise<ExtendedField & ExtendedFieldNonNullableFields>;
3427
4817
  }
3428
- declare function renameExtendedField$1(httpClient: HttpClient): RenameExtendedFieldSignature;
4818
+ declare function renameExtendedField$1(httpClient: HttpClient$3): RenameExtendedFieldSignature;
3429
4819
  interface RenameExtendedFieldSignature {
3430
4820
  /**
3431
4821
  * Renames an extended field.
@@ -3445,7 +4835,7 @@ interface RenameExtendedFieldSignature {
3445
4835
  */
3446
4836
  (key: string, field: RenameExtendedField): Promise<ExtendedField & ExtendedFieldNonNullableFields>;
3447
4837
  }
3448
- declare function deleteExtendedField$1(httpClient: HttpClient): DeleteExtendedFieldSignature;
4838
+ declare function deleteExtendedField$1(httpClient: HttpClient$3): DeleteExtendedFieldSignature;
3449
4839
  interface DeleteExtendedFieldSignature {
3450
4840
  /**
3451
4841
  * Deletes an extended field.
@@ -3458,7 +4848,7 @@ interface DeleteExtendedFieldSignature {
3458
4848
  */
3459
4849
  (key: string): Promise<void>;
3460
4850
  }
3461
- declare function queryExtendedFields$1(httpClient: HttpClient): QueryExtendedFieldsSignature;
4851
+ declare function queryExtendedFields$1(httpClient: HttpClient$3): QueryExtendedFieldsSignature;
3462
4852
  interface QueryExtendedFieldsSignature {
3463
4853
  /**
3464
4854
  * Creates a query to retrieve a list of extended fields.
@@ -3478,80 +4868,558 @@ interface QueryExtendedFieldsSignature {
3478
4868
  */
3479
4869
  (): FieldsQueryBuilder;
3480
4870
  }
3481
- declare const onExtendedFieldCreated$1: EventDefinition<ExtendedFieldCreatedEnvelope, "wix.contacts.v4.extended-field_created">;
3482
- declare const onExtendedFieldUpdated$1: EventDefinition<ExtendedFieldUpdatedEnvelope, "wix.contacts.v4.extended-field_updated">;
3483
- declare const onExtendedFieldDeleted$1: EventDefinition<ExtendedFieldDeletedEnvelope, "wix.contacts.v4.extended-field_deleted">;
4871
+ declare const onExtendedFieldCreated$1: EventDefinition$3<ExtendedFieldCreatedEnvelope, "wix.contacts.v4.extended-field_created">;
4872
+ declare const onExtendedFieldUpdated$1: EventDefinition$3<ExtendedFieldUpdatedEnvelope, "wix.contacts.v4.extended-field_updated">;
4873
+ declare const onExtendedFieldDeleted$1: EventDefinition$3<ExtendedFieldDeletedEnvelope, "wix.contacts.v4.extended-field_deleted">;
4874
+
4875
+ declare function createEventModule$2<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
4876
+
4877
+ declare const findOrCreateExtendedField: MaybeContext$3<BuildRESTFunction$3<typeof findOrCreateExtendedField$1> & typeof findOrCreateExtendedField$1>;
4878
+ declare const getExtendedField: MaybeContext$3<BuildRESTFunction$3<typeof getExtendedField$1> & typeof getExtendedField$1>;
4879
+ declare const renameExtendedField: MaybeContext$3<BuildRESTFunction$3<typeof renameExtendedField$1> & typeof renameExtendedField$1>;
4880
+ declare const deleteExtendedField: MaybeContext$3<BuildRESTFunction$3<typeof deleteExtendedField$1> & typeof deleteExtendedField$1>;
4881
+ declare const queryExtendedFields: MaybeContext$3<BuildRESTFunction$3<typeof queryExtendedFields$1> & typeof queryExtendedFields$1>;
4882
+
4883
+ type _publicOnExtendedFieldCreatedType = typeof onExtendedFieldCreated$1;
4884
+ /**
4885
+ * Triggered when an extended field is created.
4886
+ */
4887
+ declare const onExtendedFieldCreated: ReturnType<typeof createEventModule$2<_publicOnExtendedFieldCreatedType>>;
4888
+
4889
+ type _publicOnExtendedFieldUpdatedType = typeof onExtendedFieldUpdated$1;
4890
+ /**
4891
+ * Triggered when an extended field is updated.
4892
+ */
4893
+ declare const onExtendedFieldUpdated: ReturnType<typeof createEventModule$2<_publicOnExtendedFieldUpdatedType>>;
4894
+
4895
+ type _publicOnExtendedFieldDeletedType = typeof onExtendedFieldDeleted$1;
4896
+ /**
4897
+ * Triggered when an extended field is deleted.
4898
+ */
4899
+ declare const onExtendedFieldDeleted: ReturnType<typeof createEventModule$2<_publicOnExtendedFieldDeletedType>>;
4900
+
4901
+ type context$3_DeleteExtendedFieldRequest = DeleteExtendedFieldRequest;
4902
+ type context$3_DeleteExtendedFieldResponse = DeleteExtendedFieldResponse;
4903
+ type context$3_ExtendedField = ExtendedField;
4904
+ type context$3_ExtendedFieldCreatedEnvelope = ExtendedFieldCreatedEnvelope;
4905
+ type context$3_ExtendedFieldDeletedEnvelope = ExtendedFieldDeletedEnvelope;
4906
+ type context$3_ExtendedFieldNonNullableFields = ExtendedFieldNonNullableFields;
4907
+ type context$3_ExtendedFieldUpdatedEnvelope = ExtendedFieldUpdatedEnvelope;
4908
+ type context$3_FieldDataType = FieldDataType;
4909
+ declare const context$3_FieldDataType: typeof FieldDataType;
4910
+ type context$3_FieldType = FieldType;
4911
+ declare const context$3_FieldType: typeof FieldType;
4912
+ type context$3_FieldsQueryBuilder = FieldsQueryBuilder;
4913
+ type context$3_FieldsQueryResult = FieldsQueryResult;
4914
+ type context$3_FindOrCreateExtendedFieldRequest = FindOrCreateExtendedFieldRequest;
4915
+ type context$3_FindOrCreateExtendedFieldResponse = FindOrCreateExtendedFieldResponse;
4916
+ type context$3_FindOrCreateExtendedFieldResponseNonNullableFields = FindOrCreateExtendedFieldResponseNonNullableFields;
4917
+ type context$3_GetExtendedFieldByLegacyIdRequest = GetExtendedFieldByLegacyIdRequest;
4918
+ type context$3_GetExtendedFieldByLegacyIdResponse = GetExtendedFieldByLegacyIdResponse;
4919
+ type context$3_GetExtendedFieldRequest = GetExtendedFieldRequest;
4920
+ type context$3_GetExtendedFieldResponse = GetExtendedFieldResponse;
4921
+ type context$3_GetExtendedFieldResponseNonNullableFields = GetExtendedFieldResponseNonNullableFields;
4922
+ type context$3_ListExtendedFieldsRequest = ListExtendedFieldsRequest;
4923
+ type context$3_ListExtendedFieldsResponse = ListExtendedFieldsResponse;
4924
+ type context$3_QueryExtendedFieldsRequest = QueryExtendedFieldsRequest;
4925
+ type context$3_QueryExtendedFieldsResponse = QueryExtendedFieldsResponse;
4926
+ type context$3_QueryExtendedFieldsResponseNonNullableFields = QueryExtendedFieldsResponseNonNullableFields;
4927
+ type context$3_RenameExtendedField = RenameExtendedField;
4928
+ type context$3_UpdateExtendedFieldRequest = UpdateExtendedFieldRequest;
4929
+ type context$3_UpdateExtendedFieldResponse = UpdateExtendedFieldResponse;
4930
+ type context$3_UpdateExtendedFieldResponseNonNullableFields = UpdateExtendedFieldResponseNonNullableFields;
4931
+ type context$3__publicOnExtendedFieldCreatedType = _publicOnExtendedFieldCreatedType;
4932
+ type context$3__publicOnExtendedFieldDeletedType = _publicOnExtendedFieldDeletedType;
4933
+ type context$3__publicOnExtendedFieldUpdatedType = _publicOnExtendedFieldUpdatedType;
4934
+ declare const context$3_deleteExtendedField: typeof deleteExtendedField;
4935
+ declare const context$3_findOrCreateExtendedField: typeof findOrCreateExtendedField;
4936
+ declare const context$3_getExtendedField: typeof getExtendedField;
4937
+ declare const context$3_onExtendedFieldCreated: typeof onExtendedFieldCreated;
4938
+ declare const context$3_onExtendedFieldDeleted: typeof onExtendedFieldDeleted;
4939
+ declare const context$3_onExtendedFieldUpdated: typeof onExtendedFieldUpdated;
4940
+ declare const context$3_queryExtendedFields: typeof queryExtendedFields;
4941
+ declare const context$3_renameExtendedField: typeof renameExtendedField;
4942
+ declare namespace context$3 {
4943
+ export { type ActionEvent$2 as ActionEvent, type BaseEventMetadata$2 as BaseEventMetadata, type context$3_DeleteExtendedFieldRequest as DeleteExtendedFieldRequest, type context$3_DeleteExtendedFieldResponse as DeleteExtendedFieldResponse, 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 context$3_ExtendedField as ExtendedField, type context$3_ExtendedFieldCreatedEnvelope as ExtendedFieldCreatedEnvelope, type context$3_ExtendedFieldDeletedEnvelope as ExtendedFieldDeletedEnvelope, type context$3_ExtendedFieldNonNullableFields as ExtendedFieldNonNullableFields, type context$3_ExtendedFieldUpdatedEnvelope as ExtendedFieldUpdatedEnvelope, context$3_FieldDataType as FieldDataType, context$3_FieldType as FieldType, type context$3_FieldsQueryBuilder as FieldsQueryBuilder, type context$3_FieldsQueryResult as FieldsQueryResult, type context$3_FindOrCreateExtendedFieldRequest as FindOrCreateExtendedFieldRequest, type context$3_FindOrCreateExtendedFieldResponse as FindOrCreateExtendedFieldResponse, type context$3_FindOrCreateExtendedFieldResponseNonNullableFields as FindOrCreateExtendedFieldResponseNonNullableFields, type GdprListRequest$1 as GdprListRequest, type GdprListResponse$1 as GdprListResponse, type context$3_GetExtendedFieldByLegacyIdRequest as GetExtendedFieldByLegacyIdRequest, type context$3_GetExtendedFieldByLegacyIdResponse as GetExtendedFieldByLegacyIdResponse, type context$3_GetExtendedFieldRequest as GetExtendedFieldRequest, type context$3_GetExtendedFieldResponse as GetExtendedFieldResponse, type context$3_GetExtendedFieldResponseNonNullableFields as GetExtendedFieldResponseNonNullableFields, type IdentificationData$3 as IdentificationData, type IdentificationDataIdOneOf$3 as IdentificationDataIdOneOf, type context$3_ListExtendedFieldsRequest as ListExtendedFieldsRequest, type context$3_ListExtendedFieldsResponse as ListExtendedFieldsResponse, type MessageEnvelope$3 as MessageEnvelope, type Paging$2 as Paging, type PagingMetadata$1 as PagingMetadata, type PurgeRequest$1 as PurgeRequest, type PurgeResponse$1 as PurgeResponse, type Query$1 as Query, type context$3_QueryExtendedFieldsRequest as QueryExtendedFieldsRequest, type context$3_QueryExtendedFieldsResponse as QueryExtendedFieldsResponse, type context$3_QueryExtendedFieldsResponseNonNullableFields as QueryExtendedFieldsResponseNonNullableFields, type context$3_RenameExtendedField as RenameExtendedField, type RestoreInfo$1 as RestoreInfo, SortOrder$2 as SortOrder, type Sorting$2 as Sorting, type context$3_UpdateExtendedFieldRequest as UpdateExtendedFieldRequest, type context$3_UpdateExtendedFieldResponse as UpdateExtendedFieldResponse, type context$3_UpdateExtendedFieldResponseNonNullableFields as UpdateExtendedFieldResponseNonNullableFields, WebhookIdentityType$3 as WebhookIdentityType, type context$3__publicOnExtendedFieldCreatedType as _publicOnExtendedFieldCreatedType, type context$3__publicOnExtendedFieldDeletedType as _publicOnExtendedFieldDeletedType, type context$3__publicOnExtendedFieldUpdatedType as _publicOnExtendedFieldUpdatedType, context$3_deleteExtendedField as deleteExtendedField, context$3_findOrCreateExtendedField as findOrCreateExtendedField, context$3_getExtendedField as getExtendedField, context$3_onExtendedFieldCreated as onExtendedFieldCreated, context$3_onExtendedFieldDeleted as onExtendedFieldDeleted, context$3_onExtendedFieldUpdated as onExtendedFieldUpdated, onExtendedFieldCreated$1 as publicOnExtendedFieldCreated, onExtendedFieldDeleted$1 as publicOnExtendedFieldDeleted, onExtendedFieldUpdated$1 as publicOnExtendedFieldUpdated, context$3_queryExtendedFields as queryExtendedFields, context$3_renameExtendedField as renameExtendedField };
4944
+ }
4945
+
4946
+ type HostModule$2<T, H extends Host$2> = {
4947
+ __type: 'host';
4948
+ create(host: H): T;
4949
+ };
4950
+ type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
4951
+ type Host$2<Environment = unknown> = {
4952
+ channel: {
4953
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
4954
+ disconnect: () => void;
4955
+ } | Promise<{
4956
+ disconnect: () => void;
4957
+ }>;
4958
+ };
4959
+ environment?: Environment;
4960
+ /**
4961
+ * Optional name of the environment, use for logging
4962
+ */
4963
+ name?: string;
4964
+ /**
4965
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
4966
+ */
4967
+ apiBaseUrl?: string;
4968
+ /**
4969
+ * Possible data to be provided by every host, for cross cutting concerns
4970
+ * like internationalization, billing, etc.
4971
+ */
4972
+ essentials?: {
4973
+ /**
4974
+ * The language of the currently viewed session
4975
+ */
4976
+ language?: string;
4977
+ /**
4978
+ * The locale of the currently viewed session
4979
+ */
4980
+ locale?: string;
4981
+ /**
4982
+ * Any headers that should be passed through to the API requests
4983
+ */
4984
+ passThroughHeaders?: Record<string, string>;
4985
+ };
4986
+ };
4987
+
4988
+ type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
4989
+ interface HttpClient$2 {
4990
+ request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
4991
+ fetchWithAuth: typeof fetch;
4992
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
4993
+ getActiveToken?: () => string | undefined;
4994
+ }
4995
+ type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
4996
+ type HttpResponse$2<T = any> = {
4997
+ data: T;
4998
+ status: number;
4999
+ statusText: string;
5000
+ headers: any;
5001
+ request?: any;
5002
+ };
5003
+ type RequestOptions$2<_TResponse = any, Data = any> = {
5004
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
5005
+ url: string;
5006
+ data?: Data;
5007
+ params?: URLSearchParams;
5008
+ } & APIMetadata$2;
5009
+ type APIMetadata$2 = {
5010
+ methodFqn?: string;
5011
+ entityFqdn?: string;
5012
+ packageName?: string;
5013
+ };
5014
+ type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
5015
+ type EventDefinition$2<Payload = unknown, Type extends string = string> = {
5016
+ __type: 'event-definition';
5017
+ type: Type;
5018
+ isDomainEvent?: boolean;
5019
+ transformations?: (envelope: unknown) => Payload;
5020
+ __payload: Payload;
5021
+ };
5022
+ declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
5023
+ type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
5024
+ type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
5025
+
5026
+ type ServicePluginMethodInput$2 = {
5027
+ request: any;
5028
+ metadata: any;
5029
+ };
5030
+ type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
5031
+ type ServicePluginMethodMetadata$2 = {
5032
+ name: string;
5033
+ primaryHttpMappingPath: string;
5034
+ transformations: {
5035
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
5036
+ toREST: (...args: unknown[]) => unknown;
5037
+ };
5038
+ };
5039
+ type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
5040
+ __type: 'service-plugin-definition';
5041
+ componentType: string;
5042
+ methods: ServicePluginMethodMetadata$2[];
5043
+ __contract: Contract;
5044
+ };
5045
+ declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
5046
+ type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
5047
+ declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
5048
+
5049
+ type RequestContext$2 = {
5050
+ isSSR: boolean;
5051
+ host: string;
5052
+ protocol?: string;
5053
+ };
5054
+ type ResponseTransformer$2 = (data: any, headers?: any) => any;
5055
+ /**
5056
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
5057
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
5058
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
5059
+ */
5060
+ type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
5061
+ type AmbassadorRequestOptions$2<T = any> = {
5062
+ _?: T;
5063
+ url?: string;
5064
+ method?: Method$2;
5065
+ params?: any;
5066
+ data?: any;
5067
+ transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
5068
+ };
5069
+ type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
5070
+ __isAmbassador: boolean;
5071
+ };
5072
+ type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
5073
+ type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
5074
+
5075
+ declare global {
5076
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
5077
+ interface SymbolConstructor {
5078
+ readonly observable: symbol;
5079
+ }
5080
+ }
5081
+
5082
+ declare const emptyObjectSymbol$2: unique symbol;
5083
+
5084
+ /**
5085
+ Represents a strictly empty plain object, the `{}` value.
5086
+
5087
+ 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)).
5088
+
5089
+ @example
5090
+ ```
5091
+ import type {EmptyObject} from 'type-fest';
5092
+
5093
+ // The following illustrates the problem with `{}`.
5094
+ const foo1: {} = {}; // Pass
5095
+ const foo2: {} = []; // Pass
5096
+ const foo3: {} = 42; // Pass
5097
+ const foo4: {} = {a: 1}; // Pass
5098
+
5099
+ // With `EmptyObject` only the first case is valid.
5100
+ const bar1: EmptyObject = {}; // Pass
5101
+ const bar2: EmptyObject = 42; // Fail
5102
+ const bar3: EmptyObject = []; // Fail
5103
+ const bar4: EmptyObject = {a: 1}; // Fail
5104
+ ```
5105
+
5106
+ 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}.
5107
+
5108
+ @category Object
5109
+ */
5110
+ type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
5111
+
5112
+ /**
5113
+ Returns a boolean for whether the two given types are equal.
5114
+
5115
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
5116
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
5117
+
5118
+ Use-cases:
5119
+ - If you want to make a conditional branch based on the result of a comparison of two types.
5120
+
5121
+ @example
5122
+ ```
5123
+ import type {IsEqual} from 'type-fest';
5124
+
5125
+ // This type returns a boolean for whether the given array includes the given item.
5126
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
5127
+ type Includes<Value extends readonly any[], Item> =
5128
+ Value extends readonly [Value[0], ...infer rest]
5129
+ ? IsEqual<Value[0], Item> extends true
5130
+ ? true
5131
+ : Includes<rest, Item>
5132
+ : false;
5133
+ ```
5134
+
5135
+ @category Type Guard
5136
+ @category Utilities
5137
+ */
5138
+ type IsEqual$2<A, B> =
5139
+ (<G>() => G extends A ? 1 : 2) extends
5140
+ (<G>() => G extends B ? 1 : 2)
5141
+ ? true
5142
+ : false;
5143
+
5144
+ /**
5145
+ Filter out keys from an object.
5146
+
5147
+ Returns `never` if `Exclude` is strictly equal to `Key`.
5148
+ Returns `never` if `Key` extends `Exclude`.
5149
+ Returns `Key` otherwise.
5150
+
5151
+ @example
5152
+ ```
5153
+ type Filtered = Filter<'foo', 'foo'>;
5154
+ //=> never
5155
+ ```
5156
+
5157
+ @example
5158
+ ```
5159
+ type Filtered = Filter<'bar', string>;
5160
+ //=> never
5161
+ ```
5162
+
5163
+ @example
5164
+ ```
5165
+ type Filtered = Filter<'bar', 'foo'>;
5166
+ //=> 'bar'
5167
+ ```
5168
+
5169
+ @see {Except}
5170
+ */
5171
+ type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
5172
+
5173
+ type ExceptOptions$2 = {
5174
+ /**
5175
+ Disallow assigning non-specified properties.
5176
+
5177
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
5178
+
5179
+ @default false
5180
+ */
5181
+ requireExactProps?: boolean;
5182
+ };
5183
+
5184
+ /**
5185
+ Create a type from an object type without certain keys.
5186
+
5187
+ We recommend setting the `requireExactProps` option to `true`.
5188
+
5189
+ 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.
5190
+
5191
+ 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)).
5192
+
5193
+ @example
5194
+ ```
5195
+ import type {Except} from 'type-fest';
5196
+
5197
+ type Foo = {
5198
+ a: number;
5199
+ b: string;
5200
+ };
5201
+
5202
+ type FooWithoutA = Except<Foo, 'a'>;
5203
+ //=> {b: string}
5204
+
5205
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
5206
+ //=> errors: 'a' does not exist in type '{ b: string; }'
5207
+
5208
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
5209
+ //=> {a: number} & Partial<Record<"b", never>>
5210
+
5211
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
5212
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
5213
+ ```
5214
+
5215
+ @category Object
5216
+ */
5217
+ type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
5218
+ [KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
5219
+ } & (Options['requireExactProps'] extends true
5220
+ ? Partial<Record<KeysType, never>>
5221
+ : {});
5222
+
5223
+ /**
5224
+ Returns a boolean for whether the given type is `never`.
5225
+
5226
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
5227
+ @link https://stackoverflow.com/a/53984913/10292952
5228
+ @link https://www.zhenghao.io/posts/ts-never
5229
+
5230
+ Useful in type utilities, such as checking if something does not occur.
5231
+
5232
+ @example
5233
+ ```
5234
+ import type {IsNever, And} from 'type-fest';
5235
+
5236
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
5237
+ type AreStringsEqual<A extends string, B extends string> =
5238
+ And<
5239
+ IsNever<Exclude<A, B>> extends true ? true : false,
5240
+ IsNever<Exclude<B, A>> extends true ? true : false
5241
+ >;
5242
+
5243
+ type EndIfEqual<I extends string, O extends string> =
5244
+ AreStringsEqual<I, O> extends true
5245
+ ? never
5246
+ : void;
5247
+
5248
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
5249
+ if (input === output) {
5250
+ process.exit(0);
5251
+ }
5252
+ }
5253
+
5254
+ endIfEqual('abc', 'abc');
5255
+ //=> never
5256
+
5257
+ endIfEqual('abc', '123');
5258
+ //=> void
5259
+ ```
5260
+
5261
+ @category Type Guard
5262
+ @category Utilities
5263
+ */
5264
+ type IsNever$2<T> = [T] extends [never] ? true : false;
5265
+
5266
+ /**
5267
+ An if-else-like type that resolves depending on whether the given type is `never`.
5268
+
5269
+ @see {@link IsNever}
5270
+
5271
+ @example
5272
+ ```
5273
+ import type {IfNever} from 'type-fest';
5274
+
5275
+ type ShouldBeTrue = IfNever<never>;
5276
+ //=> true
5277
+
5278
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
5279
+ //=> 'bar'
5280
+ ```
5281
+
5282
+ @category Type Guard
5283
+ @category Utilities
5284
+ */
5285
+ type IfNever$2<T, TypeIfNever = true, TypeIfNotNever = false> = (
5286
+ IsNever$2<T> extends true ? TypeIfNever : TypeIfNotNever
5287
+ );
5288
+
5289
+ /**
5290
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
5291
+
5292
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
5293
+
5294
+ @example
5295
+ ```
5296
+ import type {ConditionalKeys} from 'type-fest';
5297
+
5298
+ interface Example {
5299
+ a: string;
5300
+ b: string | number;
5301
+ c?: string;
5302
+ d: {};
5303
+ }
3484
5304
 
3485
- declare function createEventModule$2<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
5305
+ type StringKeysOnly = ConditionalKeys<Example, string>;
5306
+ //=> 'a'
5307
+ ```
3486
5308
 
3487
- declare const findOrCreateExtendedField: BuildRESTFunction<typeof findOrCreateExtendedField$1> & typeof findOrCreateExtendedField$1;
3488
- declare const getExtendedField: BuildRESTFunction<typeof getExtendedField$1> & typeof getExtendedField$1;
3489
- declare const renameExtendedField: BuildRESTFunction<typeof renameExtendedField$1> & typeof renameExtendedField$1;
3490
- declare const deleteExtendedField: BuildRESTFunction<typeof deleteExtendedField$1> & typeof deleteExtendedField$1;
3491
- declare const queryExtendedFields: BuildRESTFunction<typeof queryExtendedFields$1> & typeof queryExtendedFields$1;
5309
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
5310
+
5311
+ @example
5312
+ ```
5313
+ import type {ConditionalKeys} from 'type-fest';
5314
+
5315
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
5316
+ //=> 'a' | 'c'
5317
+ ```
5318
+
5319
+ @category Object
5320
+ */
5321
+ type ConditionalKeys$2<Base, Condition> =
5322
+ {
5323
+ // Map through all the keys of the given base type.
5324
+ [Key in keyof Base]-?:
5325
+ // Pick only keys with types extending the given `Condition` type.
5326
+ Base[Key] extends Condition
5327
+ // Retain this key
5328
+ // If the value for the key extends never, only include it if `Condition` also extends never
5329
+ ? IfNever$2<Base[Key], IfNever$2<Condition, Key, never>, Key>
5330
+ // Discard this key since the condition fails.
5331
+ : never;
5332
+ // Convert the produced object into a union type of the keys which passed the conditional test.
5333
+ }[keyof Base];
3492
5334
 
3493
- type _publicOnExtendedFieldCreatedType = typeof onExtendedFieldCreated$1;
3494
5335
  /**
3495
- * Triggered when an extended field is created.
3496
- */
3497
- declare const onExtendedFieldCreated: ReturnType<typeof createEventModule$2<_publicOnExtendedFieldCreatedType>>;
5336
+ Exclude keys from a shape that matches the given `Condition`.
5337
+
5338
+ 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.
5339
+
5340
+ @example
5341
+ ```
5342
+ import type {Primitive, ConditionalExcept} from 'type-fest';
5343
+
5344
+ class Awesome {
5345
+ name: string;
5346
+ successes: number;
5347
+ failures: bigint;
5348
+
5349
+ run() {}
5350
+ }
5351
+
5352
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
5353
+ //=> {run: () => void}
5354
+ ```
5355
+
5356
+ @example
5357
+ ```
5358
+ import type {ConditionalExcept} from 'type-fest';
5359
+
5360
+ interface Example {
5361
+ a: string;
5362
+ b: string | number;
5363
+ c: () => void;
5364
+ d: {};
5365
+ }
5366
+
5367
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
5368
+ //=> {b: string | number; c: () => void; d: {}}
5369
+ ```
5370
+
5371
+ @category Object
5372
+ */
5373
+ type ConditionalExcept$2<Base, Condition> = Except$2<
5374
+ Base,
5375
+ ConditionalKeys$2<Base, Condition>
5376
+ >;
3498
5377
 
3499
- type _publicOnExtendedFieldUpdatedType = typeof onExtendedFieldUpdated$1;
3500
5378
  /**
3501
- * Triggered when an extended field is updated.
5379
+ * Descriptors are objects that describe the API of a module, and the module
5380
+ * can either be a REST module or a host module.
5381
+ * This type is recursive, so it can describe nested modules.
3502
5382
  */
3503
- declare const onExtendedFieldUpdated: ReturnType<typeof createEventModule$2<_publicOnExtendedFieldUpdatedType>>;
3504
-
3505
- type _publicOnExtendedFieldDeletedType = typeof onExtendedFieldDeleted$1;
5383
+ type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$2<any> | ServicePluginDefinition$2<any> | {
5384
+ [key: string]: Descriptors$2 | PublicMetadata$2 | any;
5385
+ };
3506
5386
  /**
3507
- * Triggered when an extended field is deleted.
5387
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
5388
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
5389
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
5390
+ * do not match the given host (as they will not work with the given host).
3508
5391
  */
3509
- declare const onExtendedFieldDeleted: ReturnType<typeof createEventModule$2<_publicOnExtendedFieldDeletedType>>;
5392
+ type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
5393
+ done: T;
5394
+ recurse: T extends {
5395
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
5396
+ } ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$2<any> ? BuildEventDefinition$2<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
5397
+ [Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
5398
+ -1,
5399
+ 0,
5400
+ 1,
5401
+ 2,
5402
+ 3,
5403
+ 4,
5404
+ 5
5405
+ ][Depth]> : never;
5406
+ }, EmptyObject$2>;
5407
+ }[Depth extends -1 ? 'done' : 'recurse'];
5408
+ type PublicMetadata$2 = {
5409
+ PACKAGE_NAME?: string;
5410
+ };
3510
5411
 
3511
- type context$3_DeleteExtendedFieldRequest = DeleteExtendedFieldRequest;
3512
- type context$3_DeleteExtendedFieldResponse = DeleteExtendedFieldResponse;
3513
- type context$3_ExtendedField = ExtendedField;
3514
- type context$3_ExtendedFieldCreatedEnvelope = ExtendedFieldCreatedEnvelope;
3515
- type context$3_ExtendedFieldDeletedEnvelope = ExtendedFieldDeletedEnvelope;
3516
- type context$3_ExtendedFieldNonNullableFields = ExtendedFieldNonNullableFields;
3517
- type context$3_ExtendedFieldUpdatedEnvelope = ExtendedFieldUpdatedEnvelope;
3518
- type context$3_FieldDataType = FieldDataType;
3519
- declare const context$3_FieldDataType: typeof FieldDataType;
3520
- type context$3_FieldType = FieldType;
3521
- declare const context$3_FieldType: typeof FieldType;
3522
- type context$3_FieldsQueryBuilder = FieldsQueryBuilder;
3523
- type context$3_FieldsQueryResult = FieldsQueryResult;
3524
- type context$3_FindOrCreateExtendedFieldRequest = FindOrCreateExtendedFieldRequest;
3525
- type context$3_FindOrCreateExtendedFieldResponse = FindOrCreateExtendedFieldResponse;
3526
- type context$3_FindOrCreateExtendedFieldResponseNonNullableFields = FindOrCreateExtendedFieldResponseNonNullableFields;
3527
- type context$3_GetExtendedFieldByLegacyIdRequest = GetExtendedFieldByLegacyIdRequest;
3528
- type context$3_GetExtendedFieldByLegacyIdResponse = GetExtendedFieldByLegacyIdResponse;
3529
- type context$3_GetExtendedFieldRequest = GetExtendedFieldRequest;
3530
- type context$3_GetExtendedFieldResponse = GetExtendedFieldResponse;
3531
- type context$3_GetExtendedFieldResponseNonNullableFields = GetExtendedFieldResponseNonNullableFields;
3532
- type context$3_ListExtendedFieldsRequest = ListExtendedFieldsRequest;
3533
- type context$3_ListExtendedFieldsResponse = ListExtendedFieldsResponse;
3534
- type context$3_QueryExtendedFieldsRequest = QueryExtendedFieldsRequest;
3535
- type context$3_QueryExtendedFieldsResponse = QueryExtendedFieldsResponse;
3536
- type context$3_QueryExtendedFieldsResponseNonNullableFields = QueryExtendedFieldsResponseNonNullableFields;
3537
- type context$3_RenameExtendedField = RenameExtendedField;
3538
- type context$3_UpdateExtendedFieldRequest = UpdateExtendedFieldRequest;
3539
- type context$3_UpdateExtendedFieldResponse = UpdateExtendedFieldResponse;
3540
- type context$3_UpdateExtendedFieldResponseNonNullableFields = UpdateExtendedFieldResponseNonNullableFields;
3541
- type context$3__publicOnExtendedFieldCreatedType = _publicOnExtendedFieldCreatedType;
3542
- type context$3__publicOnExtendedFieldDeletedType = _publicOnExtendedFieldDeletedType;
3543
- type context$3__publicOnExtendedFieldUpdatedType = _publicOnExtendedFieldUpdatedType;
3544
- declare const context$3_deleteExtendedField: typeof deleteExtendedField;
3545
- declare const context$3_findOrCreateExtendedField: typeof findOrCreateExtendedField;
3546
- declare const context$3_getExtendedField: typeof getExtendedField;
3547
- declare const context$3_onExtendedFieldCreated: typeof onExtendedFieldCreated;
3548
- declare const context$3_onExtendedFieldDeleted: typeof onExtendedFieldDeleted;
3549
- declare const context$3_onExtendedFieldUpdated: typeof onExtendedFieldUpdated;
3550
- declare const context$3_queryExtendedFields: typeof queryExtendedFields;
3551
- declare const context$3_renameExtendedField: typeof renameExtendedField;
3552
- declare namespace context$3 {
3553
- export { type ActionEvent$2 as ActionEvent, type BaseEventMetadata$2 as BaseEventMetadata, type context$3_DeleteExtendedFieldRequest as DeleteExtendedFieldRequest, type context$3_DeleteExtendedFieldResponse as DeleteExtendedFieldResponse, 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 context$3_ExtendedField as ExtendedField, type context$3_ExtendedFieldCreatedEnvelope as ExtendedFieldCreatedEnvelope, type context$3_ExtendedFieldDeletedEnvelope as ExtendedFieldDeletedEnvelope, type context$3_ExtendedFieldNonNullableFields as ExtendedFieldNonNullableFields, type context$3_ExtendedFieldUpdatedEnvelope as ExtendedFieldUpdatedEnvelope, context$3_FieldDataType as FieldDataType, context$3_FieldType as FieldType, type context$3_FieldsQueryBuilder as FieldsQueryBuilder, type context$3_FieldsQueryResult as FieldsQueryResult, type context$3_FindOrCreateExtendedFieldRequest as FindOrCreateExtendedFieldRequest, type context$3_FindOrCreateExtendedFieldResponse as FindOrCreateExtendedFieldResponse, type context$3_FindOrCreateExtendedFieldResponseNonNullableFields as FindOrCreateExtendedFieldResponseNonNullableFields, type GdprListRequest$1 as GdprListRequest, type GdprListResponse$1 as GdprListResponse, type context$3_GetExtendedFieldByLegacyIdRequest as GetExtendedFieldByLegacyIdRequest, type context$3_GetExtendedFieldByLegacyIdResponse as GetExtendedFieldByLegacyIdResponse, type context$3_GetExtendedFieldRequest as GetExtendedFieldRequest, type context$3_GetExtendedFieldResponse as GetExtendedFieldResponse, type context$3_GetExtendedFieldResponseNonNullableFields as GetExtendedFieldResponseNonNullableFields, type IdentificationData$3 as IdentificationData, type IdentificationDataIdOneOf$3 as IdentificationDataIdOneOf, type context$3_ListExtendedFieldsRequest as ListExtendedFieldsRequest, type context$3_ListExtendedFieldsResponse as ListExtendedFieldsResponse, type MessageEnvelope$3 as MessageEnvelope, type Paging$2 as Paging, type PagingMetadata$1 as PagingMetadata, type PurgeRequest$1 as PurgeRequest, type PurgeResponse$1 as PurgeResponse, type Query$1 as Query, type context$3_QueryExtendedFieldsRequest as QueryExtendedFieldsRequest, type context$3_QueryExtendedFieldsResponse as QueryExtendedFieldsResponse, type context$3_QueryExtendedFieldsResponseNonNullableFields as QueryExtendedFieldsResponseNonNullableFields, type context$3_RenameExtendedField as RenameExtendedField, type RestoreInfo$1 as RestoreInfo, SortOrder$2 as SortOrder, type Sorting$2 as Sorting, type context$3_UpdateExtendedFieldRequest as UpdateExtendedFieldRequest, type context$3_UpdateExtendedFieldResponse as UpdateExtendedFieldResponse, type context$3_UpdateExtendedFieldResponseNonNullableFields as UpdateExtendedFieldResponseNonNullableFields, WebhookIdentityType$3 as WebhookIdentityType, type context$3__publicOnExtendedFieldCreatedType as _publicOnExtendedFieldCreatedType, type context$3__publicOnExtendedFieldDeletedType as _publicOnExtendedFieldDeletedType, type context$3__publicOnExtendedFieldUpdatedType as _publicOnExtendedFieldUpdatedType, context$3_deleteExtendedField as deleteExtendedField, context$3_findOrCreateExtendedField as findOrCreateExtendedField, context$3_getExtendedField as getExtendedField, context$3_onExtendedFieldCreated as onExtendedFieldCreated, context$3_onExtendedFieldDeleted as onExtendedFieldDeleted, context$3_onExtendedFieldUpdated as onExtendedFieldUpdated, onExtendedFieldCreated$1 as publicOnExtendedFieldCreated, onExtendedFieldDeleted$1 as publicOnExtendedFieldDeleted, onExtendedFieldUpdated$1 as publicOnExtendedFieldUpdated, context$3_queryExtendedFields as queryExtendedFields, context$3_renameExtendedField as renameExtendedField };
5412
+ declare global {
5413
+ interface ContextualClient {
5414
+ }
3554
5415
  }
5416
+ /**
5417
+ * A type used to create concerete types from SDK descriptors in
5418
+ * case a contextual client is available.
5419
+ */
5420
+ type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
5421
+ host: Host$2;
5422
+ } ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
3555
5423
 
3556
5424
  /** Label that was found or created. */
3557
5425
  interface ContactLabel {
@@ -4147,7 +6015,7 @@ interface LabelsQueryBuilder {
4147
6015
  find: () => Promise<LabelsQueryResult>;
4148
6016
  }
4149
6017
 
4150
- declare function findOrCreateLabel$1(httpClient: HttpClient): FindOrCreateLabelSignature;
6018
+ declare function findOrCreateLabel$1(httpClient: HttpClient$2): FindOrCreateLabelSignature;
4151
6019
  interface FindOrCreateLabelSignature {
4152
6020
  /**
4153
6021
  * Retrieves a label with a given name, or creates one if it doesn't exist.
@@ -4170,7 +6038,7 @@ interface FindOrCreateLabelSignature {
4170
6038
  */
4171
6039
  (displayName: string, options?: FindOrCreateLabelOptions | undefined): Promise<FindOrCreateLabelResponse & FindOrCreateLabelResponseNonNullableFields>;
4172
6040
  }
4173
- declare function getLabel$1(httpClient: HttpClient): GetLabelSignature;
6041
+ declare function getLabel$1(httpClient: HttpClient$2): GetLabelSignature;
4174
6042
  interface GetLabelSignature {
4175
6043
  /**
4176
6044
  * Retrieves a label by the specified label key.
@@ -4185,7 +6053,7 @@ interface GetLabelSignature {
4185
6053
  */
4186
6054
  (key: string, options?: GetLabelOptions | undefined): Promise<ContactLabel & ContactLabelNonNullableFields>;
4187
6055
  }
4188
- declare function renameLabel$1(httpClient: HttpClient): RenameLabelSignature;
6056
+ declare function renameLabel$1(httpClient: HttpClient$2): RenameLabelSignature;
4189
6057
  interface RenameLabelSignature {
4190
6058
  /**
4191
6059
  * Renames a label.
@@ -4202,7 +6070,7 @@ interface RenameLabelSignature {
4202
6070
  */
4203
6071
  (key: string, label: RenameLabel, options?: RenameLabelOptions | undefined): Promise<ContactLabel & ContactLabelNonNullableFields>;
4204
6072
  }
4205
- declare function deleteLabel$1(httpClient: HttpClient): DeleteLabelSignature;
6073
+ declare function deleteLabel$1(httpClient: HttpClient$2): DeleteLabelSignature;
4206
6074
  interface DeleteLabelSignature {
4207
6075
  /**
4208
6076
  * Deletes a label from the site and removes it from contacts it applies to.
@@ -4214,7 +6082,7 @@ interface DeleteLabelSignature {
4214
6082
  */
4215
6083
  (key: string): Promise<void>;
4216
6084
  }
4217
- declare function queryLabels$1(httpClient: HttpClient): QueryLabelsSignature;
6085
+ declare function queryLabels$1(httpClient: HttpClient$2): QueryLabelsSignature;
4218
6086
  interface QueryLabelsSignature {
4219
6087
  /**
4220
6088
  * Creates a query to retrieve a list of labels.
@@ -4237,93 +6105,571 @@ interface QueryLabelsSignature {
4237
6105
  */
4238
6106
  (options?: QueryLabelsOptions | undefined): LabelsQueryBuilder;
4239
6107
  }
4240
- declare const onLabelCreated$1: EventDefinition<LabelCreatedEnvelope, "wix.contacts.v4.label_created">;
4241
- declare const onLabelUpdated$1: EventDefinition<LabelUpdatedEnvelope, "wix.contacts.v4.label_updated">;
4242
- declare const onLabelDeleted$1: EventDefinition<LabelDeletedEnvelope, "wix.contacts.v4.label_deleted">;
6108
+ declare const onLabelCreated$1: EventDefinition$2<LabelCreatedEnvelope, "wix.contacts.v4.label_created">;
6109
+ declare const onLabelUpdated$1: EventDefinition$2<LabelUpdatedEnvelope, "wix.contacts.v4.label_updated">;
6110
+ declare const onLabelDeleted$1: EventDefinition$2<LabelDeletedEnvelope, "wix.contacts.v4.label_deleted">;
6111
+
6112
+ declare function createEventModule$1<T extends EventDefinition$2<any, string>>(eventDefinition: T): BuildEventDefinition$2<T> & T;
6113
+
6114
+ declare const findOrCreateLabel: MaybeContext$2<BuildRESTFunction$2<typeof findOrCreateLabel$1> & typeof findOrCreateLabel$1>;
6115
+ declare const getLabel: MaybeContext$2<BuildRESTFunction$2<typeof getLabel$1> & typeof getLabel$1>;
6116
+ declare const renameLabel: MaybeContext$2<BuildRESTFunction$2<typeof renameLabel$1> & typeof renameLabel$1>;
6117
+ declare const deleteLabel: MaybeContext$2<BuildRESTFunction$2<typeof deleteLabel$1> & typeof deleteLabel$1>;
6118
+ declare const queryLabels: MaybeContext$2<BuildRESTFunction$2<typeof queryLabels$1> & typeof queryLabels$1>;
6119
+
6120
+ type _publicOnLabelCreatedType = typeof onLabelCreated$1;
6121
+ /**
6122
+ * Triggered when a label is created.
6123
+ */
6124
+ declare const onLabelCreated: ReturnType<typeof createEventModule$1<_publicOnLabelCreatedType>>;
6125
+
6126
+ type _publicOnLabelUpdatedType = typeof onLabelUpdated$1;
6127
+ /**
6128
+ * Triggered when a label is updated.
6129
+ */
6130
+ declare const onLabelUpdated: ReturnType<typeof createEventModule$1<_publicOnLabelUpdatedType>>;
6131
+
6132
+ type _publicOnLabelDeletedType = typeof onLabelDeleted$1;
6133
+ /**
6134
+ * Triggered when a label is deleted.
6135
+ */
6136
+ declare const onLabelDeleted: ReturnType<typeof createEventModule$1<_publicOnLabelDeletedType>>;
6137
+
6138
+ type context$2_ContactLabel = ContactLabel;
6139
+ type context$2_ContactLabelNamespace = ContactLabelNamespace;
6140
+ type context$2_ContactLabelNonNullableFields = ContactLabelNonNullableFields;
6141
+ type context$2_DeleteLabelRequest = DeleteLabelRequest;
6142
+ type context$2_DeleteLabelResponse = DeleteLabelResponse;
6143
+ type context$2_FindOrCreateLabelOptions = FindOrCreateLabelOptions;
6144
+ type context$2_FindOrCreateLabelRequest = FindOrCreateLabelRequest;
6145
+ type context$2_FindOrCreateLabelResponse = FindOrCreateLabelResponse;
6146
+ type context$2_FindOrCreateLabelResponseNonNullableFields = FindOrCreateLabelResponseNonNullableFields;
6147
+ type context$2_GdprListRequest = GdprListRequest;
6148
+ type context$2_GdprListResponse = GdprListResponse;
6149
+ type context$2_GetLabelByLegacyIdRequest = GetLabelByLegacyIdRequest;
6150
+ type context$2_GetLabelByLegacyIdResponse = GetLabelByLegacyIdResponse;
6151
+ type context$2_GetLabelOptions = GetLabelOptions;
6152
+ type context$2_GetLabelRequest = GetLabelRequest;
6153
+ type context$2_GetLabelResponse = GetLabelResponse;
6154
+ type context$2_GetLabelResponseNonNullableFields = GetLabelResponseNonNullableFields;
6155
+ type context$2_LabelCreatedEnvelope = LabelCreatedEnvelope;
6156
+ type context$2_LabelDeletedEnvelope = LabelDeletedEnvelope;
6157
+ type context$2_LabelType = LabelType;
6158
+ declare const context$2_LabelType: typeof LabelType;
6159
+ type context$2_LabelUpdatedEnvelope = LabelUpdatedEnvelope;
6160
+ type context$2_LabelsQueryBuilder = LabelsQueryBuilder;
6161
+ type context$2_LabelsQueryResult = LabelsQueryResult;
6162
+ type context$2_LabelsQuotaReached = LabelsQuotaReached;
6163
+ type context$2_ListLabelNamespacesRequest = ListLabelNamespacesRequest;
6164
+ type context$2_ListLabelNamespacesResponse = ListLabelNamespacesResponse;
6165
+ type context$2_ListLabelsRequest = ListLabelsRequest;
6166
+ type context$2_ListLabelsResponse = ListLabelsResponse;
6167
+ type context$2_PagingMetadata = PagingMetadata;
6168
+ type context$2_PurgeRequest = PurgeRequest;
6169
+ type context$2_PurgeResponse = PurgeResponse;
6170
+ type context$2_Query = Query;
6171
+ type context$2_QueryLabelsOptions = QueryLabelsOptions;
6172
+ type context$2_QueryLabelsRequest = QueryLabelsRequest;
6173
+ type context$2_QueryLabelsResponse = QueryLabelsResponse;
6174
+ type context$2_QueryLabelsResponseNonNullableFields = QueryLabelsResponseNonNullableFields;
6175
+ type context$2_RenameLabel = RenameLabel;
6176
+ type context$2_RenameLabelOptions = RenameLabelOptions;
6177
+ type context$2_RestoreInfo = RestoreInfo;
6178
+ type context$2_UpdateLabelRequest = UpdateLabelRequest;
6179
+ type context$2_UpdateLabelResponse = UpdateLabelResponse;
6180
+ type context$2_UpdateLabelResponseNonNullableFields = UpdateLabelResponseNonNullableFields;
6181
+ type context$2__publicOnLabelCreatedType = _publicOnLabelCreatedType;
6182
+ type context$2__publicOnLabelDeletedType = _publicOnLabelDeletedType;
6183
+ type context$2__publicOnLabelUpdatedType = _publicOnLabelUpdatedType;
6184
+ declare const context$2_deleteLabel: typeof deleteLabel;
6185
+ declare const context$2_findOrCreateLabel: typeof findOrCreateLabel;
6186
+ declare const context$2_getLabel: typeof getLabel;
6187
+ declare const context$2_onLabelCreated: typeof onLabelCreated;
6188
+ declare const context$2_onLabelDeleted: typeof onLabelDeleted;
6189
+ declare const context$2_onLabelUpdated: typeof onLabelUpdated;
6190
+ declare const context$2_queryLabels: typeof queryLabels;
6191
+ declare const context$2_renameLabel: typeof renameLabel;
6192
+ declare namespace context$2 {
6193
+ export { type ActionEvent$1 as ActionEvent, type BaseEventMetadata$1 as BaseEventMetadata, type context$2_ContactLabel as ContactLabel, type context$2_ContactLabelNamespace as ContactLabelNamespace, type context$2_ContactLabelNonNullableFields as ContactLabelNonNullableFields, type context$2_DeleteLabelRequest as DeleteLabelRequest, type context$2_DeleteLabelResponse as DeleteLabelResponse, 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 context$2_FindOrCreateLabelOptions as FindOrCreateLabelOptions, type context$2_FindOrCreateLabelRequest as FindOrCreateLabelRequest, type context$2_FindOrCreateLabelResponse as FindOrCreateLabelResponse, type context$2_FindOrCreateLabelResponseNonNullableFields as FindOrCreateLabelResponseNonNullableFields, type context$2_GdprListRequest as GdprListRequest, type context$2_GdprListResponse as GdprListResponse, type context$2_GetLabelByLegacyIdRequest as GetLabelByLegacyIdRequest, type context$2_GetLabelByLegacyIdResponse as GetLabelByLegacyIdResponse, type context$2_GetLabelOptions as GetLabelOptions, type context$2_GetLabelRequest as GetLabelRequest, type context$2_GetLabelResponse as GetLabelResponse, type context$2_GetLabelResponseNonNullableFields as GetLabelResponseNonNullableFields, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type context$2_LabelCreatedEnvelope as LabelCreatedEnvelope, type context$2_LabelDeletedEnvelope as LabelDeletedEnvelope, context$2_LabelType as LabelType, type context$2_LabelUpdatedEnvelope as LabelUpdatedEnvelope, type context$2_LabelsQueryBuilder as LabelsQueryBuilder, type context$2_LabelsQueryResult as LabelsQueryResult, type context$2_LabelsQuotaReached as LabelsQuotaReached, type context$2_ListLabelNamespacesRequest as ListLabelNamespacesRequest, type context$2_ListLabelNamespacesResponse as ListLabelNamespacesResponse, type context$2_ListLabelsRequest as ListLabelsRequest, type context$2_ListLabelsResponse as ListLabelsResponse, type MessageEnvelope$2 as MessageEnvelope, type Paging$1 as Paging, type context$2_PagingMetadata as PagingMetadata, type context$2_PurgeRequest as PurgeRequest, type context$2_PurgeResponse as PurgeResponse, type context$2_Query as Query, type context$2_QueryLabelsOptions as QueryLabelsOptions, type context$2_QueryLabelsRequest as QueryLabelsRequest, type context$2_QueryLabelsResponse as QueryLabelsResponse, type context$2_QueryLabelsResponseNonNullableFields as QueryLabelsResponseNonNullableFields, type context$2_RenameLabel as RenameLabel, type context$2_RenameLabelOptions as RenameLabelOptions, type context$2_RestoreInfo as RestoreInfo, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, type context$2_UpdateLabelRequest as UpdateLabelRequest, type context$2_UpdateLabelResponse as UpdateLabelResponse, type context$2_UpdateLabelResponseNonNullableFields as UpdateLabelResponseNonNullableFields, WebhookIdentityType$2 as WebhookIdentityType, type context$2__publicOnLabelCreatedType as _publicOnLabelCreatedType, type context$2__publicOnLabelDeletedType as _publicOnLabelDeletedType, type context$2__publicOnLabelUpdatedType as _publicOnLabelUpdatedType, context$2_deleteLabel as deleteLabel, context$2_findOrCreateLabel as findOrCreateLabel, context$2_getLabel as getLabel, context$2_onLabelCreated as onLabelCreated, context$2_onLabelDeleted as onLabelDeleted, context$2_onLabelUpdated as onLabelUpdated, onLabelCreated$1 as publicOnLabelCreated, onLabelDeleted$1 as publicOnLabelDeleted, onLabelUpdated$1 as publicOnLabelUpdated, context$2_queryLabels as queryLabels, context$2_renameLabel as renameLabel };
6194
+ }
6195
+
6196
+ type HostModule$1<T, H extends Host$1> = {
6197
+ __type: 'host';
6198
+ create(host: H): T;
6199
+ };
6200
+ type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
6201
+ type Host$1<Environment = unknown> = {
6202
+ channel: {
6203
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
6204
+ disconnect: () => void;
6205
+ } | Promise<{
6206
+ disconnect: () => void;
6207
+ }>;
6208
+ };
6209
+ environment?: Environment;
6210
+ /**
6211
+ * Optional name of the environment, use for logging
6212
+ */
6213
+ name?: string;
6214
+ /**
6215
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
6216
+ */
6217
+ apiBaseUrl?: string;
6218
+ /**
6219
+ * Possible data to be provided by every host, for cross cutting concerns
6220
+ * like internationalization, billing, etc.
6221
+ */
6222
+ essentials?: {
6223
+ /**
6224
+ * The language of the currently viewed session
6225
+ */
6226
+ language?: string;
6227
+ /**
6228
+ * The locale of the currently viewed session
6229
+ */
6230
+ locale?: string;
6231
+ /**
6232
+ * Any headers that should be passed through to the API requests
6233
+ */
6234
+ passThroughHeaders?: Record<string, string>;
6235
+ };
6236
+ };
6237
+
6238
+ type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
6239
+ interface HttpClient$1 {
6240
+ request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
6241
+ fetchWithAuth: typeof fetch;
6242
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
6243
+ getActiveToken?: () => string | undefined;
6244
+ }
6245
+ type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
6246
+ type HttpResponse$1<T = any> = {
6247
+ data: T;
6248
+ status: number;
6249
+ statusText: string;
6250
+ headers: any;
6251
+ request?: any;
6252
+ };
6253
+ type RequestOptions$1<_TResponse = any, Data = any> = {
6254
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
6255
+ url: string;
6256
+ data?: Data;
6257
+ params?: URLSearchParams;
6258
+ } & APIMetadata$1;
6259
+ type APIMetadata$1 = {
6260
+ methodFqn?: string;
6261
+ entityFqdn?: string;
6262
+ packageName?: string;
6263
+ };
6264
+ type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
6265
+ type EventDefinition$1<Payload = unknown, Type extends string = string> = {
6266
+ __type: 'event-definition';
6267
+ type: Type;
6268
+ isDomainEvent?: boolean;
6269
+ transformations?: (envelope: unknown) => Payload;
6270
+ __payload: Payload;
6271
+ };
6272
+ declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
6273
+ type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
6274
+ type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
6275
+
6276
+ type ServicePluginMethodInput$1 = {
6277
+ request: any;
6278
+ metadata: any;
6279
+ };
6280
+ type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
6281
+ type ServicePluginMethodMetadata$1 = {
6282
+ name: string;
6283
+ primaryHttpMappingPath: string;
6284
+ transformations: {
6285
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
6286
+ toREST: (...args: unknown[]) => unknown;
6287
+ };
6288
+ };
6289
+ type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
6290
+ __type: 'service-plugin-definition';
6291
+ componentType: string;
6292
+ methods: ServicePluginMethodMetadata$1[];
6293
+ __contract: Contract;
6294
+ };
6295
+ declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
6296
+ type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
6297
+ declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
6298
+
6299
+ type RequestContext$1 = {
6300
+ isSSR: boolean;
6301
+ host: string;
6302
+ protocol?: string;
6303
+ };
6304
+ type ResponseTransformer$1 = (data: any, headers?: any) => any;
6305
+ /**
6306
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
6307
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
6308
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
6309
+ */
6310
+ type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
6311
+ type AmbassadorRequestOptions$1<T = any> = {
6312
+ _?: T;
6313
+ url?: string;
6314
+ method?: Method$1;
6315
+ params?: any;
6316
+ data?: any;
6317
+ transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
6318
+ };
6319
+ type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
6320
+ __isAmbassador: boolean;
6321
+ };
6322
+ type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
6323
+ type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
6324
+
6325
+ declare global {
6326
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
6327
+ interface SymbolConstructor {
6328
+ readonly observable: symbol;
6329
+ }
6330
+ }
6331
+
6332
+ declare const emptyObjectSymbol$1: unique symbol;
6333
+
6334
+ /**
6335
+ Represents a strictly empty plain object, the `{}` value.
6336
+
6337
+ 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)).
6338
+
6339
+ @example
6340
+ ```
6341
+ import type {EmptyObject} from 'type-fest';
6342
+
6343
+ // The following illustrates the problem with `{}`.
6344
+ const foo1: {} = {}; // Pass
6345
+ const foo2: {} = []; // Pass
6346
+ const foo3: {} = 42; // Pass
6347
+ const foo4: {} = {a: 1}; // Pass
6348
+
6349
+ // With `EmptyObject` only the first case is valid.
6350
+ const bar1: EmptyObject = {}; // Pass
6351
+ const bar2: EmptyObject = 42; // Fail
6352
+ const bar3: EmptyObject = []; // Fail
6353
+ const bar4: EmptyObject = {a: 1}; // Fail
6354
+ ```
6355
+
6356
+ 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}.
6357
+
6358
+ @category Object
6359
+ */
6360
+ type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
6361
+
6362
+ /**
6363
+ Returns a boolean for whether the two given types are equal.
6364
+
6365
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
6366
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
6367
+
6368
+ Use-cases:
6369
+ - If you want to make a conditional branch based on the result of a comparison of two types.
6370
+
6371
+ @example
6372
+ ```
6373
+ import type {IsEqual} from 'type-fest';
6374
+
6375
+ // This type returns a boolean for whether the given array includes the given item.
6376
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
6377
+ type Includes<Value extends readonly any[], Item> =
6378
+ Value extends readonly [Value[0], ...infer rest]
6379
+ ? IsEqual<Value[0], Item> extends true
6380
+ ? true
6381
+ : Includes<rest, Item>
6382
+ : false;
6383
+ ```
6384
+
6385
+ @category Type Guard
6386
+ @category Utilities
6387
+ */
6388
+ type IsEqual$1<A, B> =
6389
+ (<G>() => G extends A ? 1 : 2) extends
6390
+ (<G>() => G extends B ? 1 : 2)
6391
+ ? true
6392
+ : false;
6393
+
6394
+ /**
6395
+ Filter out keys from an object.
6396
+
6397
+ Returns `never` if `Exclude` is strictly equal to `Key`.
6398
+ Returns `never` if `Key` extends `Exclude`.
6399
+ Returns `Key` otherwise.
6400
+
6401
+ @example
6402
+ ```
6403
+ type Filtered = Filter<'foo', 'foo'>;
6404
+ //=> never
6405
+ ```
6406
+
6407
+ @example
6408
+ ```
6409
+ type Filtered = Filter<'bar', string>;
6410
+ //=> never
6411
+ ```
6412
+
6413
+ @example
6414
+ ```
6415
+ type Filtered = Filter<'bar', 'foo'>;
6416
+ //=> 'bar'
6417
+ ```
6418
+
6419
+ @see {Except}
6420
+ */
6421
+ type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
6422
+
6423
+ type ExceptOptions$1 = {
6424
+ /**
6425
+ Disallow assigning non-specified properties.
6426
+
6427
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
6428
+
6429
+ @default false
6430
+ */
6431
+ requireExactProps?: boolean;
6432
+ };
6433
+
6434
+ /**
6435
+ Create a type from an object type without certain keys.
6436
+
6437
+ We recommend setting the `requireExactProps` option to `true`.
6438
+
6439
+ 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.
6440
+
6441
+ 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)).
6442
+
6443
+ @example
6444
+ ```
6445
+ import type {Except} from 'type-fest';
6446
+
6447
+ type Foo = {
6448
+ a: number;
6449
+ b: string;
6450
+ };
6451
+
6452
+ type FooWithoutA = Except<Foo, 'a'>;
6453
+ //=> {b: string}
6454
+
6455
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
6456
+ //=> errors: 'a' does not exist in type '{ b: string; }'
6457
+
6458
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
6459
+ //=> {a: number} & Partial<Record<"b", never>>
6460
+
6461
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
6462
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
6463
+ ```
6464
+
6465
+ @category Object
6466
+ */
6467
+ type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
6468
+ [KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
6469
+ } & (Options['requireExactProps'] extends true
6470
+ ? Partial<Record<KeysType, never>>
6471
+ : {});
6472
+
6473
+ /**
6474
+ Returns a boolean for whether the given type is `never`.
6475
+
6476
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
6477
+ @link https://stackoverflow.com/a/53984913/10292952
6478
+ @link https://www.zhenghao.io/posts/ts-never
6479
+
6480
+ Useful in type utilities, such as checking if something does not occur.
6481
+
6482
+ @example
6483
+ ```
6484
+ import type {IsNever, And} from 'type-fest';
6485
+
6486
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
6487
+ type AreStringsEqual<A extends string, B extends string> =
6488
+ And<
6489
+ IsNever<Exclude<A, B>> extends true ? true : false,
6490
+ IsNever<Exclude<B, A>> extends true ? true : false
6491
+ >;
6492
+
6493
+ type EndIfEqual<I extends string, O extends string> =
6494
+ AreStringsEqual<I, O> extends true
6495
+ ? never
6496
+ : void;
6497
+
6498
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
6499
+ if (input === output) {
6500
+ process.exit(0);
6501
+ }
6502
+ }
6503
+
6504
+ endIfEqual('abc', 'abc');
6505
+ //=> never
6506
+
6507
+ endIfEqual('abc', '123');
6508
+ //=> void
6509
+ ```
6510
+
6511
+ @category Type Guard
6512
+ @category Utilities
6513
+ */
6514
+ type IsNever$1<T> = [T] extends [never] ? true : false;
6515
+
6516
+ /**
6517
+ An if-else-like type that resolves depending on whether the given type is `never`.
6518
+
6519
+ @see {@link IsNever}
6520
+
6521
+ @example
6522
+ ```
6523
+ import type {IfNever} from 'type-fest';
6524
+
6525
+ type ShouldBeTrue = IfNever<never>;
6526
+ //=> true
6527
+
6528
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
6529
+ //=> 'bar'
6530
+ ```
6531
+
6532
+ @category Type Guard
6533
+ @category Utilities
6534
+ */
6535
+ type IfNever$1<T, TypeIfNever = true, TypeIfNotNever = false> = (
6536
+ IsNever$1<T> extends true ? TypeIfNever : TypeIfNotNever
6537
+ );
6538
+
6539
+ /**
6540
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
6541
+
6542
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
6543
+
6544
+ @example
6545
+ ```
6546
+ import type {ConditionalKeys} from 'type-fest';
6547
+
6548
+ interface Example {
6549
+ a: string;
6550
+ b: string | number;
6551
+ c?: string;
6552
+ d: {};
6553
+ }
4243
6554
 
4244
- declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
6555
+ type StringKeysOnly = ConditionalKeys<Example, string>;
6556
+ //=> 'a'
6557
+ ```
4245
6558
 
4246
- declare const findOrCreateLabel: BuildRESTFunction<typeof findOrCreateLabel$1> & typeof findOrCreateLabel$1;
4247
- declare const getLabel: BuildRESTFunction<typeof getLabel$1> & typeof getLabel$1;
4248
- declare const renameLabel: BuildRESTFunction<typeof renameLabel$1> & typeof renameLabel$1;
4249
- declare const deleteLabel: BuildRESTFunction<typeof deleteLabel$1> & typeof deleteLabel$1;
4250
- declare const queryLabels: BuildRESTFunction<typeof queryLabels$1> & typeof queryLabels$1;
6559
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
6560
+
6561
+ @example
6562
+ ```
6563
+ import type {ConditionalKeys} from 'type-fest';
6564
+
6565
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
6566
+ //=> 'a' | 'c'
6567
+ ```
6568
+
6569
+ @category Object
6570
+ */
6571
+ type ConditionalKeys$1<Base, Condition> =
6572
+ {
6573
+ // Map through all the keys of the given base type.
6574
+ [Key in keyof Base]-?:
6575
+ // Pick only keys with types extending the given `Condition` type.
6576
+ Base[Key] extends Condition
6577
+ // Retain this key
6578
+ // If the value for the key extends never, only include it if `Condition` also extends never
6579
+ ? IfNever$1<Base[Key], IfNever$1<Condition, Key, never>, Key>
6580
+ // Discard this key since the condition fails.
6581
+ : never;
6582
+ // Convert the produced object into a union type of the keys which passed the conditional test.
6583
+ }[keyof Base];
4251
6584
 
4252
- type _publicOnLabelCreatedType = typeof onLabelCreated$1;
4253
6585
  /**
4254
- * Triggered when a label is created.
4255
- */
4256
- declare const onLabelCreated: ReturnType<typeof createEventModule$1<_publicOnLabelCreatedType>>;
6586
+ Exclude keys from a shape that matches the given `Condition`.
6587
+
6588
+ 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.
6589
+
6590
+ @example
6591
+ ```
6592
+ import type {Primitive, ConditionalExcept} from 'type-fest';
6593
+
6594
+ class Awesome {
6595
+ name: string;
6596
+ successes: number;
6597
+ failures: bigint;
6598
+
6599
+ run() {}
6600
+ }
6601
+
6602
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
6603
+ //=> {run: () => void}
6604
+ ```
6605
+
6606
+ @example
6607
+ ```
6608
+ import type {ConditionalExcept} from 'type-fest';
6609
+
6610
+ interface Example {
6611
+ a: string;
6612
+ b: string | number;
6613
+ c: () => void;
6614
+ d: {};
6615
+ }
6616
+
6617
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
6618
+ //=> {b: string | number; c: () => void; d: {}}
6619
+ ```
6620
+
6621
+ @category Object
6622
+ */
6623
+ type ConditionalExcept$1<Base, Condition> = Except$1<
6624
+ Base,
6625
+ ConditionalKeys$1<Base, Condition>
6626
+ >;
4257
6627
 
4258
- type _publicOnLabelUpdatedType = typeof onLabelUpdated$1;
4259
6628
  /**
4260
- * Triggered when a label is updated.
6629
+ * Descriptors are objects that describe the API of a module, and the module
6630
+ * can either be a REST module or a host module.
6631
+ * This type is recursive, so it can describe nested modules.
4261
6632
  */
4262
- declare const onLabelUpdated: ReturnType<typeof createEventModule$1<_publicOnLabelUpdatedType>>;
4263
-
4264
- type _publicOnLabelDeletedType = typeof onLabelDeleted$1;
6633
+ type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$1<any> | ServicePluginDefinition$1<any> | {
6634
+ [key: string]: Descriptors$1 | PublicMetadata$1 | any;
6635
+ };
4265
6636
  /**
4266
- * Triggered when a label is deleted.
6637
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
6638
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
6639
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
6640
+ * do not match the given host (as they will not work with the given host).
4267
6641
  */
4268
- declare const onLabelDeleted: ReturnType<typeof createEventModule$1<_publicOnLabelDeletedType>>;
6642
+ type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
6643
+ done: T;
6644
+ recurse: T extends {
6645
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
6646
+ } ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$1<any> ? BuildEventDefinition$1<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
6647
+ [Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
6648
+ -1,
6649
+ 0,
6650
+ 1,
6651
+ 2,
6652
+ 3,
6653
+ 4,
6654
+ 5
6655
+ ][Depth]> : never;
6656
+ }, EmptyObject$1>;
6657
+ }[Depth extends -1 ? 'done' : 'recurse'];
6658
+ type PublicMetadata$1 = {
6659
+ PACKAGE_NAME?: string;
6660
+ };
4269
6661
 
4270
- type context$2_ContactLabel = ContactLabel;
4271
- type context$2_ContactLabelNamespace = ContactLabelNamespace;
4272
- type context$2_ContactLabelNonNullableFields = ContactLabelNonNullableFields;
4273
- type context$2_DeleteLabelRequest = DeleteLabelRequest;
4274
- type context$2_DeleteLabelResponse = DeleteLabelResponse;
4275
- type context$2_FindOrCreateLabelOptions = FindOrCreateLabelOptions;
4276
- type context$2_FindOrCreateLabelRequest = FindOrCreateLabelRequest;
4277
- type context$2_FindOrCreateLabelResponse = FindOrCreateLabelResponse;
4278
- type context$2_FindOrCreateLabelResponseNonNullableFields = FindOrCreateLabelResponseNonNullableFields;
4279
- type context$2_GdprListRequest = GdprListRequest;
4280
- type context$2_GdprListResponse = GdprListResponse;
4281
- type context$2_GetLabelByLegacyIdRequest = GetLabelByLegacyIdRequest;
4282
- type context$2_GetLabelByLegacyIdResponse = GetLabelByLegacyIdResponse;
4283
- type context$2_GetLabelOptions = GetLabelOptions;
4284
- type context$2_GetLabelRequest = GetLabelRequest;
4285
- type context$2_GetLabelResponse = GetLabelResponse;
4286
- type context$2_GetLabelResponseNonNullableFields = GetLabelResponseNonNullableFields;
4287
- type context$2_LabelCreatedEnvelope = LabelCreatedEnvelope;
4288
- type context$2_LabelDeletedEnvelope = LabelDeletedEnvelope;
4289
- type context$2_LabelType = LabelType;
4290
- declare const context$2_LabelType: typeof LabelType;
4291
- type context$2_LabelUpdatedEnvelope = LabelUpdatedEnvelope;
4292
- type context$2_LabelsQueryBuilder = LabelsQueryBuilder;
4293
- type context$2_LabelsQueryResult = LabelsQueryResult;
4294
- type context$2_LabelsQuotaReached = LabelsQuotaReached;
4295
- type context$2_ListLabelNamespacesRequest = ListLabelNamespacesRequest;
4296
- type context$2_ListLabelNamespacesResponse = ListLabelNamespacesResponse;
4297
- type context$2_ListLabelsRequest = ListLabelsRequest;
4298
- type context$2_ListLabelsResponse = ListLabelsResponse;
4299
- type context$2_PagingMetadata = PagingMetadata;
4300
- type context$2_PurgeRequest = PurgeRequest;
4301
- type context$2_PurgeResponse = PurgeResponse;
4302
- type context$2_Query = Query;
4303
- type context$2_QueryLabelsOptions = QueryLabelsOptions;
4304
- type context$2_QueryLabelsRequest = QueryLabelsRequest;
4305
- type context$2_QueryLabelsResponse = QueryLabelsResponse;
4306
- type context$2_QueryLabelsResponseNonNullableFields = QueryLabelsResponseNonNullableFields;
4307
- type context$2_RenameLabel = RenameLabel;
4308
- type context$2_RenameLabelOptions = RenameLabelOptions;
4309
- type context$2_RestoreInfo = RestoreInfo;
4310
- type context$2_UpdateLabelRequest = UpdateLabelRequest;
4311
- type context$2_UpdateLabelResponse = UpdateLabelResponse;
4312
- type context$2_UpdateLabelResponseNonNullableFields = UpdateLabelResponseNonNullableFields;
4313
- type context$2__publicOnLabelCreatedType = _publicOnLabelCreatedType;
4314
- type context$2__publicOnLabelDeletedType = _publicOnLabelDeletedType;
4315
- type context$2__publicOnLabelUpdatedType = _publicOnLabelUpdatedType;
4316
- declare const context$2_deleteLabel: typeof deleteLabel;
4317
- declare const context$2_findOrCreateLabel: typeof findOrCreateLabel;
4318
- declare const context$2_getLabel: typeof getLabel;
4319
- declare const context$2_onLabelCreated: typeof onLabelCreated;
4320
- declare const context$2_onLabelDeleted: typeof onLabelDeleted;
4321
- declare const context$2_onLabelUpdated: typeof onLabelUpdated;
4322
- declare const context$2_queryLabels: typeof queryLabels;
4323
- declare const context$2_renameLabel: typeof renameLabel;
4324
- declare namespace context$2 {
4325
- export { type ActionEvent$1 as ActionEvent, type BaseEventMetadata$1 as BaseEventMetadata, type context$2_ContactLabel as ContactLabel, type context$2_ContactLabelNamespace as ContactLabelNamespace, type context$2_ContactLabelNonNullableFields as ContactLabelNonNullableFields, type context$2_DeleteLabelRequest as DeleteLabelRequest, type context$2_DeleteLabelResponse as DeleteLabelResponse, 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 context$2_FindOrCreateLabelOptions as FindOrCreateLabelOptions, type context$2_FindOrCreateLabelRequest as FindOrCreateLabelRequest, type context$2_FindOrCreateLabelResponse as FindOrCreateLabelResponse, type context$2_FindOrCreateLabelResponseNonNullableFields as FindOrCreateLabelResponseNonNullableFields, type context$2_GdprListRequest as GdprListRequest, type context$2_GdprListResponse as GdprListResponse, type context$2_GetLabelByLegacyIdRequest as GetLabelByLegacyIdRequest, type context$2_GetLabelByLegacyIdResponse as GetLabelByLegacyIdResponse, type context$2_GetLabelOptions as GetLabelOptions, type context$2_GetLabelRequest as GetLabelRequest, type context$2_GetLabelResponse as GetLabelResponse, type context$2_GetLabelResponseNonNullableFields as GetLabelResponseNonNullableFields, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type context$2_LabelCreatedEnvelope as LabelCreatedEnvelope, type context$2_LabelDeletedEnvelope as LabelDeletedEnvelope, context$2_LabelType as LabelType, type context$2_LabelUpdatedEnvelope as LabelUpdatedEnvelope, type context$2_LabelsQueryBuilder as LabelsQueryBuilder, type context$2_LabelsQueryResult as LabelsQueryResult, type context$2_LabelsQuotaReached as LabelsQuotaReached, type context$2_ListLabelNamespacesRequest as ListLabelNamespacesRequest, type context$2_ListLabelNamespacesResponse as ListLabelNamespacesResponse, type context$2_ListLabelsRequest as ListLabelsRequest, type context$2_ListLabelsResponse as ListLabelsResponse, type MessageEnvelope$2 as MessageEnvelope, type Paging$1 as Paging, type context$2_PagingMetadata as PagingMetadata, type context$2_PurgeRequest as PurgeRequest, type context$2_PurgeResponse as PurgeResponse, type context$2_Query as Query, type context$2_QueryLabelsOptions as QueryLabelsOptions, type context$2_QueryLabelsRequest as QueryLabelsRequest, type context$2_QueryLabelsResponse as QueryLabelsResponse, type context$2_QueryLabelsResponseNonNullableFields as QueryLabelsResponseNonNullableFields, type context$2_RenameLabel as RenameLabel, type context$2_RenameLabelOptions as RenameLabelOptions, type context$2_RestoreInfo as RestoreInfo, SortOrder$1 as SortOrder, type Sorting$1 as Sorting, type context$2_UpdateLabelRequest as UpdateLabelRequest, type context$2_UpdateLabelResponse as UpdateLabelResponse, type context$2_UpdateLabelResponseNonNullableFields as UpdateLabelResponseNonNullableFields, WebhookIdentityType$2 as WebhookIdentityType, type context$2__publicOnLabelCreatedType as _publicOnLabelCreatedType, type context$2__publicOnLabelDeletedType as _publicOnLabelDeletedType, type context$2__publicOnLabelUpdatedType as _publicOnLabelUpdatedType, context$2_deleteLabel as deleteLabel, context$2_findOrCreateLabel as findOrCreateLabel, context$2_getLabel as getLabel, context$2_onLabelCreated as onLabelCreated, context$2_onLabelDeleted as onLabelDeleted, context$2_onLabelUpdated as onLabelUpdated, onLabelCreated$1 as publicOnLabelCreated, onLabelDeleted$1 as publicOnLabelDeleted, onLabelUpdated$1 as publicOnLabelUpdated, context$2_queryLabels as queryLabels, context$2_renameLabel as renameLabel };
6662
+ declare global {
6663
+ interface ContextualClient {
6664
+ }
4326
6665
  }
6666
+ /**
6667
+ * A type used to create concerete types from SDK descriptors in
6668
+ * case a contextual client is available.
6669
+ */
6670
+ type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
6671
+ host: Host$1;
6672
+ } ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
4327
6673
 
4328
6674
  /** Dummy message for fqdn validation */
4329
6675
  interface SubmitContact {
@@ -4913,7 +7259,7 @@ interface AppendOrCreateContactOptions {
4913
7259
  contactId?: string | null;
4914
7260
  }
4915
7261
 
4916
- declare function appendOrCreateContact$1(httpClient: HttpClient): AppendOrCreateContactSignature;
7262
+ declare function appendOrCreateContact$1(httpClient: HttpClient$1): AppendOrCreateContactSignature;
4917
7263
  interface AppendOrCreateContactSignature {
4918
7264
  /**
4919
7265
  * Appends an existing contact or creates a contact if it doesn't exist.
@@ -4924,7 +7270,7 @@ interface AppendOrCreateContactSignature {
4924
7270
  (options?: AppendOrCreateContactOptions | undefined): Promise<SubmitContactResponse & SubmitContactResponseNonNullableFields>;
4925
7271
  }
4926
7272
 
4927
- declare const appendOrCreateContact: BuildRESTFunction<typeof appendOrCreateContact$1> & typeof appendOrCreateContact$1;
7273
+ declare const appendOrCreateContact: MaybeContext$1<BuildRESTFunction$1<typeof appendOrCreateContact$1> & typeof appendOrCreateContact$1>;
4928
7274
 
4929
7275
  type context$1_ActivityIcon = ActivityIcon;
4930
7276
  type context$1_Address = Address;
@@ -4977,6 +7323,484 @@ declare namespace context$1 {
4977
7323
  export { type context$1_ActivityIcon as ActivityIcon, type context$1_Address as Address, type context$1_AddressLocation as AddressLocation, type context$1_AddressStreetOneOf as AddressStreetOneOf, context$1_AddressTag as AddressTag, type context$1_AppendOrCreateContactOptions as AppendOrCreateContactOptions, type context$1_AssigneesWrapper as AssigneesWrapper, type context$1_ContactActivity as ContactActivity, context$1_ContactActivityType as ContactActivityType, type context$1_ContactAddress as ContactAddress, type context$1_ContactAddressesWrapper as ContactAddressesWrapper, type context$1_ContactEmail as ContactEmail, type context$1_ContactEmailsWrapper as ContactEmailsWrapper, type ContactInfo$1 as ContactInfo, type context$1_ContactName as ContactName, type context$1_ContactPhone as ContactPhone, type context$1_ContactPhonesWrapper as ContactPhonesWrapper, type context$1_ContactPicture as ContactPicture, context$1_ContactSourceType as ContactSourceType, type context$1_ContactToSubmit as ContactToSubmit, context$1_EmailTag as EmailTag, type context$1_ExtendedFieldsWrapper as ExtendedFieldsWrapper, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, context$1_IdentityType as IdentityType, context$1_ImageProvider as ImageProvider, type context$1_LabelsWrapper as LabelsWrapper, type context$1_LocationsWrapper as LocationsWrapper, type MessageEnvelope$1 as MessageEnvelope, context$1_PhoneTag as PhoneTag, type context$1_StreetAddress as StreetAddress, type context$1_Subdivision as Subdivision, context$1_SubdivisionType as SubdivisionType, type context$1_SubmitContact as SubmitContact, type context$1_SubmitContactOptions as SubmitContactOptions, type context$1_SubmitContactRequest as SubmitContactRequest, type context$1_SubmitContactResponse as SubmitContactResponse, type context$1_SubmitContactResponseNonNullableFields as SubmitContactResponseNonNullableFields, context$1_SubmitOperation as SubmitOperation, type context$1_SubmitVisitorIdRequest as SubmitVisitorIdRequest, type context$1_SubmitVisitorIdResponse as SubmitVisitorIdResponse, WebhookIdentityType$1 as WebhookIdentityType, context$1_appendOrCreateContact as appendOrCreateContact };
4978
7324
  }
4979
7325
 
7326
+ type HostModule<T, H extends Host> = {
7327
+ __type: 'host';
7328
+ create(host: H): T;
7329
+ };
7330
+ type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
7331
+ type Host<Environment = unknown> = {
7332
+ channel: {
7333
+ observeState(callback: (props: unknown, environment: Environment) => unknown): {
7334
+ disconnect: () => void;
7335
+ } | Promise<{
7336
+ disconnect: () => void;
7337
+ }>;
7338
+ };
7339
+ environment?: Environment;
7340
+ /**
7341
+ * Optional name of the environment, use for logging
7342
+ */
7343
+ name?: string;
7344
+ /**
7345
+ * Optional bast url to use for API requests, for example `www.wixapis.com`
7346
+ */
7347
+ apiBaseUrl?: string;
7348
+ /**
7349
+ * Possible data to be provided by every host, for cross cutting concerns
7350
+ * like internationalization, billing, etc.
7351
+ */
7352
+ essentials?: {
7353
+ /**
7354
+ * The language of the currently viewed session
7355
+ */
7356
+ language?: string;
7357
+ /**
7358
+ * The locale of the currently viewed session
7359
+ */
7360
+ locale?: string;
7361
+ /**
7362
+ * Any headers that should be passed through to the API requests
7363
+ */
7364
+ passThroughHeaders?: Record<string, string>;
7365
+ };
7366
+ };
7367
+
7368
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
7369
+ interface HttpClient {
7370
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
7371
+ fetchWithAuth: typeof fetch;
7372
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
7373
+ getActiveToken?: () => string | undefined;
7374
+ }
7375
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
7376
+ type HttpResponse<T = any> = {
7377
+ data: T;
7378
+ status: number;
7379
+ statusText: string;
7380
+ headers: any;
7381
+ request?: any;
7382
+ };
7383
+ type RequestOptions<_TResponse = any, Data = any> = {
7384
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
7385
+ url: string;
7386
+ data?: Data;
7387
+ params?: URLSearchParams;
7388
+ } & APIMetadata;
7389
+ type APIMetadata = {
7390
+ methodFqn?: string;
7391
+ entityFqdn?: string;
7392
+ packageName?: string;
7393
+ };
7394
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
7395
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
7396
+ __type: 'event-definition';
7397
+ type: Type;
7398
+ isDomainEvent?: boolean;
7399
+ transformations?: (envelope: unknown) => Payload;
7400
+ __payload: Payload;
7401
+ };
7402
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
7403
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
7404
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
7405
+
7406
+ type ServicePluginMethodInput = {
7407
+ request: any;
7408
+ metadata: any;
7409
+ };
7410
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
7411
+ type ServicePluginMethodMetadata = {
7412
+ name: string;
7413
+ primaryHttpMappingPath: string;
7414
+ transformations: {
7415
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
7416
+ toREST: (...args: unknown[]) => unknown;
7417
+ };
7418
+ };
7419
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
7420
+ __type: 'service-plugin-definition';
7421
+ componentType: string;
7422
+ methods: ServicePluginMethodMetadata[];
7423
+ __contract: Contract;
7424
+ };
7425
+ declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
7426
+ type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
7427
+ declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
7428
+
7429
+ type RequestContext = {
7430
+ isSSR: boolean;
7431
+ host: string;
7432
+ protocol?: string;
7433
+ };
7434
+ type ResponseTransformer = (data: any, headers?: any) => any;
7435
+ /**
7436
+ * Ambassador request options types are copied mostly from AxiosRequestConfig.
7437
+ * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
7438
+ * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
7439
+ */
7440
+ type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
7441
+ type AmbassadorRequestOptions<T = any> = {
7442
+ _?: T;
7443
+ url?: string;
7444
+ method?: Method;
7445
+ params?: any;
7446
+ data?: any;
7447
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
7448
+ };
7449
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
7450
+ __isAmbassador: boolean;
7451
+ };
7452
+ type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
7453
+ type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
7454
+
7455
+ declare global {
7456
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
7457
+ interface SymbolConstructor {
7458
+ readonly observable: symbol;
7459
+ }
7460
+ }
7461
+
7462
+ declare const emptyObjectSymbol: unique symbol;
7463
+
7464
+ /**
7465
+ Represents a strictly empty plain object, the `{}` value.
7466
+
7467
+ 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)).
7468
+
7469
+ @example
7470
+ ```
7471
+ import type {EmptyObject} from 'type-fest';
7472
+
7473
+ // The following illustrates the problem with `{}`.
7474
+ const foo1: {} = {}; // Pass
7475
+ const foo2: {} = []; // Pass
7476
+ const foo3: {} = 42; // Pass
7477
+ const foo4: {} = {a: 1}; // Pass
7478
+
7479
+ // With `EmptyObject` only the first case is valid.
7480
+ const bar1: EmptyObject = {}; // Pass
7481
+ const bar2: EmptyObject = 42; // Fail
7482
+ const bar3: EmptyObject = []; // Fail
7483
+ const bar4: EmptyObject = {a: 1}; // Fail
7484
+ ```
7485
+
7486
+ 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}.
7487
+
7488
+ @category Object
7489
+ */
7490
+ type EmptyObject = {[emptyObjectSymbol]?: never};
7491
+
7492
+ /**
7493
+ Returns a boolean for whether the two given types are equal.
7494
+
7495
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
7496
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
7497
+
7498
+ Use-cases:
7499
+ - If you want to make a conditional branch based on the result of a comparison of two types.
7500
+
7501
+ @example
7502
+ ```
7503
+ import type {IsEqual} from 'type-fest';
7504
+
7505
+ // This type returns a boolean for whether the given array includes the given item.
7506
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
7507
+ type Includes<Value extends readonly any[], Item> =
7508
+ Value extends readonly [Value[0], ...infer rest]
7509
+ ? IsEqual<Value[0], Item> extends true
7510
+ ? true
7511
+ : Includes<rest, Item>
7512
+ : false;
7513
+ ```
7514
+
7515
+ @category Type Guard
7516
+ @category Utilities
7517
+ */
7518
+ type IsEqual<A, B> =
7519
+ (<G>() => G extends A ? 1 : 2) extends
7520
+ (<G>() => G extends B ? 1 : 2)
7521
+ ? true
7522
+ : false;
7523
+
7524
+ /**
7525
+ Filter out keys from an object.
7526
+
7527
+ Returns `never` if `Exclude` is strictly equal to `Key`.
7528
+ Returns `never` if `Key` extends `Exclude`.
7529
+ Returns `Key` otherwise.
7530
+
7531
+ @example
7532
+ ```
7533
+ type Filtered = Filter<'foo', 'foo'>;
7534
+ //=> never
7535
+ ```
7536
+
7537
+ @example
7538
+ ```
7539
+ type Filtered = Filter<'bar', string>;
7540
+ //=> never
7541
+ ```
7542
+
7543
+ @example
7544
+ ```
7545
+ type Filtered = Filter<'bar', 'foo'>;
7546
+ //=> 'bar'
7547
+ ```
7548
+
7549
+ @see {Except}
7550
+ */
7551
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
7552
+
7553
+ type ExceptOptions = {
7554
+ /**
7555
+ Disallow assigning non-specified properties.
7556
+
7557
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
7558
+
7559
+ @default false
7560
+ */
7561
+ requireExactProps?: boolean;
7562
+ };
7563
+
7564
+ /**
7565
+ Create a type from an object type without certain keys.
7566
+
7567
+ We recommend setting the `requireExactProps` option to `true`.
7568
+
7569
+ 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.
7570
+
7571
+ 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)).
7572
+
7573
+ @example
7574
+ ```
7575
+ import type {Except} from 'type-fest';
7576
+
7577
+ type Foo = {
7578
+ a: number;
7579
+ b: string;
7580
+ };
7581
+
7582
+ type FooWithoutA = Except<Foo, 'a'>;
7583
+ //=> {b: string}
7584
+
7585
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
7586
+ //=> errors: 'a' does not exist in type '{ b: string; }'
7587
+
7588
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
7589
+ //=> {a: number} & Partial<Record<"b", never>>
7590
+
7591
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
7592
+ //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
7593
+ ```
7594
+
7595
+ @category Object
7596
+ */
7597
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
7598
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
7599
+ } & (Options['requireExactProps'] extends true
7600
+ ? Partial<Record<KeysType, never>>
7601
+ : {});
7602
+
7603
+ /**
7604
+ Returns a boolean for whether the given type is `never`.
7605
+
7606
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
7607
+ @link https://stackoverflow.com/a/53984913/10292952
7608
+ @link https://www.zhenghao.io/posts/ts-never
7609
+
7610
+ Useful in type utilities, such as checking if something does not occur.
7611
+
7612
+ @example
7613
+ ```
7614
+ import type {IsNever, And} from 'type-fest';
7615
+
7616
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
7617
+ type AreStringsEqual<A extends string, B extends string> =
7618
+ And<
7619
+ IsNever<Exclude<A, B>> extends true ? true : false,
7620
+ IsNever<Exclude<B, A>> extends true ? true : false
7621
+ >;
7622
+
7623
+ type EndIfEqual<I extends string, O extends string> =
7624
+ AreStringsEqual<I, O> extends true
7625
+ ? never
7626
+ : void;
7627
+
7628
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
7629
+ if (input === output) {
7630
+ process.exit(0);
7631
+ }
7632
+ }
7633
+
7634
+ endIfEqual('abc', 'abc');
7635
+ //=> never
7636
+
7637
+ endIfEqual('abc', '123');
7638
+ //=> void
7639
+ ```
7640
+
7641
+ @category Type Guard
7642
+ @category Utilities
7643
+ */
7644
+ type IsNever<T> = [T] extends [never] ? true : false;
7645
+
7646
+ /**
7647
+ An if-else-like type that resolves depending on whether the given type is `never`.
7648
+
7649
+ @see {@link IsNever}
7650
+
7651
+ @example
7652
+ ```
7653
+ import type {IfNever} from 'type-fest';
7654
+
7655
+ type ShouldBeTrue = IfNever<never>;
7656
+ //=> true
7657
+
7658
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
7659
+ //=> 'bar'
7660
+ ```
7661
+
7662
+ @category Type Guard
7663
+ @category Utilities
7664
+ */
7665
+ type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
7666
+ IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
7667
+ );
7668
+
7669
+ /**
7670
+ Extract the keys from a type where the value type of the key extends the given `Condition`.
7671
+
7672
+ Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
7673
+
7674
+ @example
7675
+ ```
7676
+ import type {ConditionalKeys} from 'type-fest';
7677
+
7678
+ interface Example {
7679
+ a: string;
7680
+ b: string | number;
7681
+ c?: string;
7682
+ d: {};
7683
+ }
7684
+
7685
+ type StringKeysOnly = ConditionalKeys<Example, string>;
7686
+ //=> 'a'
7687
+ ```
7688
+
7689
+ To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
7690
+
7691
+ @example
7692
+ ```
7693
+ import type {ConditionalKeys} from 'type-fest';
7694
+
7695
+ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
7696
+ //=> 'a' | 'c'
7697
+ ```
7698
+
7699
+ @category Object
7700
+ */
7701
+ type ConditionalKeys<Base, Condition> =
7702
+ {
7703
+ // Map through all the keys of the given base type.
7704
+ [Key in keyof Base]-?:
7705
+ // Pick only keys with types extending the given `Condition` type.
7706
+ Base[Key] extends Condition
7707
+ // Retain this key
7708
+ // If the value for the key extends never, only include it if `Condition` also extends never
7709
+ ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
7710
+ // Discard this key since the condition fails.
7711
+ : never;
7712
+ // Convert the produced object into a union type of the keys which passed the conditional test.
7713
+ }[keyof Base];
7714
+
7715
+ /**
7716
+ Exclude keys from a shape that matches the given `Condition`.
7717
+
7718
+ 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.
7719
+
7720
+ @example
7721
+ ```
7722
+ import type {Primitive, ConditionalExcept} from 'type-fest';
7723
+
7724
+ class Awesome {
7725
+ name: string;
7726
+ successes: number;
7727
+ failures: bigint;
7728
+
7729
+ run() {}
7730
+ }
7731
+
7732
+ type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
7733
+ //=> {run: () => void}
7734
+ ```
7735
+
7736
+ @example
7737
+ ```
7738
+ import type {ConditionalExcept} from 'type-fest';
7739
+
7740
+ interface Example {
7741
+ a: string;
7742
+ b: string | number;
7743
+ c: () => void;
7744
+ d: {};
7745
+ }
7746
+
7747
+ type NonStringKeysOnly = ConditionalExcept<Example, string>;
7748
+ //=> {b: string | number; c: () => void; d: {}}
7749
+ ```
7750
+
7751
+ @category Object
7752
+ */
7753
+ type ConditionalExcept<Base, Condition> = Except<
7754
+ Base,
7755
+ ConditionalKeys<Base, Condition>
7756
+ >;
7757
+
7758
+ /**
7759
+ * Descriptors are objects that describe the API of a module, and the module
7760
+ * can either be a REST module or a host module.
7761
+ * This type is recursive, so it can describe nested modules.
7762
+ */
7763
+ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
7764
+ [key: string]: Descriptors | PublicMetadata | any;
7765
+ };
7766
+ /**
7767
+ * This type takes in a descriptors object of a certain Host (including an `unknown` host)
7768
+ * and returns an object with the same structure, but with all descriptors replaced with their API.
7769
+ * Any non-descriptor properties are removed from the returned object, including descriptors that
7770
+ * do not match the given host (as they will not work with the given host).
7771
+ */
7772
+ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
7773
+ done: T;
7774
+ recurse: T extends {
7775
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
7776
+ } ? 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<{
7777
+ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
7778
+ -1,
7779
+ 0,
7780
+ 1,
7781
+ 2,
7782
+ 3,
7783
+ 4,
7784
+ 5
7785
+ ][Depth]> : never;
7786
+ }, EmptyObject>;
7787
+ }[Depth extends -1 ? 'done' : 'recurse'];
7788
+ type PublicMetadata = {
7789
+ PACKAGE_NAME?: string;
7790
+ };
7791
+
7792
+ declare global {
7793
+ interface ContextualClient {
7794
+ }
7795
+ }
7796
+ /**
7797
+ * A type used to create concerete types from SDK descriptors in
7798
+ * case a contextual client is available.
7799
+ */
7800
+ type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
7801
+ host: Host;
7802
+ } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
7803
+
4980
7804
  interface Task {
4981
7805
  /**
4982
7806
  * Task ID.
@@ -5711,13 +8535,13 @@ declare const onTaskDeleted$1: EventDefinition<TaskDeletedEnvelope, "wix.crm.tas
5711
8535
 
5712
8536
  declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
5713
8537
 
5714
- declare const createTask: BuildRESTFunction<typeof createTask$1> & typeof createTask$1;
5715
- declare const getTask: BuildRESTFunction<typeof getTask$1> & typeof getTask$1;
5716
- declare const updateTask: BuildRESTFunction<typeof updateTask$1> & typeof updateTask$1;
5717
- declare const deleteTask: BuildRESTFunction<typeof deleteTask$1> & typeof deleteTask$1;
5718
- declare const queryTasks: BuildRESTFunction<typeof queryTasks$1> & typeof queryTasks$1;
5719
- declare const countTasks: BuildRESTFunction<typeof countTasks$1> & typeof countTasks$1;
5720
- declare const moveTaskAfter: BuildRESTFunction<typeof moveTaskAfter$1> & typeof moveTaskAfter$1;
8538
+ declare const createTask: MaybeContext<BuildRESTFunction<typeof createTask$1> & typeof createTask$1>;
8539
+ declare const getTask: MaybeContext<BuildRESTFunction<typeof getTask$1> & typeof getTask$1>;
8540
+ declare const updateTask: MaybeContext<BuildRESTFunction<typeof updateTask$1> & typeof updateTask$1>;
8541
+ declare const deleteTask: MaybeContext<BuildRESTFunction<typeof deleteTask$1> & typeof deleteTask$1>;
8542
+ declare const queryTasks: MaybeContext<BuildRESTFunction<typeof queryTasks$1> & typeof queryTasks$1>;
8543
+ declare const countTasks: MaybeContext<BuildRESTFunction<typeof countTasks$1> & typeof countTasks$1>;
8544
+ declare const moveTaskAfter: MaybeContext<BuildRESTFunction<typeof moveTaskAfter$1> & typeof moveTaskAfter$1>;
5721
8545
 
5722
8546
  type _publicOnTaskOverdueType = typeof onTaskOverdue$1;
5723
8547
  /**