@wix/motion 1.0.52 → 1.0.53

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,9 +1,9 @@
1
- type HostModule$2<T, H extends Host$2> = {
1
+ type HostModule<T, H extends Host> = {
2
2
  __type: 'host';
3
3
  create(host: H): T;
4
4
  };
5
- type HostModuleAPI$2<T extends HostModule$2<any, any>> = T extends HostModule$2<infer U, any> ? U : never;
6
- type Host$2<Environment = unknown> = {
5
+ type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
6
+ type Host<Environment = unknown> = {
7
7
  channel: {
8
8
  observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
9
  disconnect: () => void;
@@ -12,6 +12,10 @@ type Host$2<Environment = unknown> = {
12
12
  }>;
13
13
  };
14
14
  environment?: Environment;
15
+ /**
16
+ * Optional name of the environment, use for logging
17
+ */
18
+ name?: string;
15
19
  /**
16
20
  * Optional bast url to use for API requests, for example `www.wixapis.com`
17
21
  */
@@ -36,92 +40,92 @@ type Host$2<Environment = unknown> = {
36
40
  };
37
41
  };
38
42
 
39
- type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
40
- interface HttpClient$2 {
41
- request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
43
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
44
+ interface HttpClient {
45
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
42
46
  fetchWithAuth: typeof fetch;
43
47
  wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
44
48
  getActiveToken?: () => string | undefined;
45
49
  }
46
- type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
47
- type HttpResponse$2<T = any> = {
50
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
51
+ type HttpResponse<T = any> = {
48
52
  data: T;
49
53
  status: number;
50
54
  statusText: string;
51
55
  headers: any;
52
56
  request?: any;
53
57
  };
54
- type RequestOptions$2<_TResponse = any, Data = any> = {
58
+ type RequestOptions<_TResponse = any, Data = any> = {
55
59
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
56
60
  url: string;
57
61
  data?: Data;
58
62
  params?: URLSearchParams;
59
- } & APIMetadata$2;
60
- type APIMetadata$2 = {
63
+ } & APIMetadata;
64
+ type APIMetadata = {
61
65
  methodFqn?: string;
62
66
  entityFqdn?: string;
63
67
  packageName?: string;
64
68
  };
65
- type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
66
- type EventDefinition$4<Payload = unknown, Type extends string = string> = {
69
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
70
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
67
71
  __type: 'event-definition';
68
72
  type: Type;
69
73
  isDomainEvent?: boolean;
70
74
  transformations?: (envelope: unknown) => Payload;
71
75
  __payload: Payload;
72
76
  };
73
- declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
74
- type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
75
- type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
77
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
78
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
79
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
76
80
 
77
- type ServicePluginMethodInput$2 = {
81
+ type ServicePluginMethodInput = {
78
82
  request: any;
79
83
  metadata: any;
80
84
  };
81
- type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
82
- type ServicePluginMethodMetadata$2 = {
85
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
86
+ type ServicePluginMethodMetadata = {
83
87
  name: string;
84
88
  primaryHttpMappingPath: string;
85
89
  transformations: {
86
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
90
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
87
91
  toREST: (...args: unknown[]) => unknown;
88
92
  };
89
93
  };
90
- type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
94
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
91
95
  __type: 'service-plugin-definition';
92
96
  componentType: string;
93
- methods: ServicePluginMethodMetadata$2[];
97
+ methods: ServicePluginMethodMetadata[];
94
98
  __contract: Contract;
95
99
  };
96
- declare function ServicePluginDefinition$2<Contract extends ServicePluginContract$2>(componentType: string, methods: ServicePluginMethodMetadata$2[]): ServicePluginDefinition$2<Contract>;
97
- type BuildServicePluginDefinition$2<T extends ServicePluginDefinition$2<any>> = (implementation: T['__contract']) => void;
98
- declare const SERVICE_PLUGIN_ERROR_TYPE$2 = "wix_spi_error";
100
+ declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
101
+ type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
102
+ declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
99
103
 
100
- type RequestContext$2 = {
104
+ type RequestContext = {
101
105
  isSSR: boolean;
102
106
  host: string;
103
107
  protocol?: string;
104
108
  };
105
- type ResponseTransformer$2 = (data: any, headers?: any) => any;
109
+ type ResponseTransformer = (data: any, headers?: any) => any;
106
110
  /**
107
111
  * Ambassador request options types are copied mostly from AxiosRequestConfig.
108
112
  * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
109
113
  * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
110
114
  */
111
- type Method$2 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
112
- type AmbassadorRequestOptions$2<T = any> = {
115
+ type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
116
+ type AmbassadorRequestOptions<T = any> = {
113
117
  _?: T;
114
118
  url?: string;
115
- method?: Method$2;
119
+ method?: Method;
116
120
  params?: any;
117
121
  data?: any;
118
- transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
122
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
119
123
  };
120
- type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
124
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
121
125
  __isAmbassador: boolean;
122
126
  };
123
- type AmbassadorFunctionDescriptor$2<Request = any, Response = any> = AmbassadorFactory$2<Request, Response>;
124
- type BuildAmbassadorFunction$2<T extends AmbassadorFunctionDescriptor$2> = T extends AmbassadorFunctionDescriptor$2<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
127
+ type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
128
+ type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
125
129
 
126
130
  declare global {
127
131
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -130,7 +134,7 @@ declare global {
130
134
  }
131
135
  }
132
136
 
133
- declare const emptyObjectSymbol$2: unique symbol;
137
+ declare const emptyObjectSymbol: unique symbol;
134
138
 
135
139
  /**
136
140
  Represents a strictly empty plain object, the `{}` value.
@@ -158,7 +162,7 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
158
162
 
159
163
  @category Object
160
164
  */
161
- type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
165
+ type EmptyObject = {[emptyObjectSymbol]?: never};
162
166
 
163
167
  /**
164
168
  Returns a boolean for whether the two given types are equal.
@@ -186,7 +190,7 @@ type Includes<Value extends readonly any[], Item> =
186
190
  @category Type Guard
187
191
  @category Utilities
188
192
  */
189
- type IsEqual$2<A, B> =
193
+ type IsEqual<A, B> =
190
194
  (<G>() => G extends A ? 1 : 2) extends
191
195
  (<G>() => G extends B ? 1 : 2)
192
196
  ? true
@@ -219,9 +223,9 @@ type Filtered = Filter<'bar', 'foo'>;
219
223
 
220
224
  @see {Except}
221
225
  */
222
- type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
226
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
223
227
 
224
- type ExceptOptions$2 = {
228
+ type ExceptOptions = {
225
229
  /**
226
230
  Disallow assigning non-specified properties.
227
231
 
@@ -265,12 +269,78 @@ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
265
269
 
266
270
  @category Object
267
271
  */
268
- type Except$2<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$2 = {requireExactProps: false}> = {
269
- [KeyType in keyof ObjectType as Filter$2<KeyType, KeysType>]: ObjectType[KeyType];
272
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
273
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
270
274
  } & (Options['requireExactProps'] extends true
271
275
  ? Partial<Record<KeysType, never>>
272
276
  : {});
273
277
 
278
+ /**
279
+ Returns a boolean for whether the given type is `never`.
280
+
281
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
282
+ @link https://stackoverflow.com/a/53984913/10292952
283
+ @link https://www.zhenghao.io/posts/ts-never
284
+
285
+ Useful in type utilities, such as checking if something does not occur.
286
+
287
+ @example
288
+ ```
289
+ import type {IsNever, And} from 'type-fest';
290
+
291
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
292
+ type AreStringsEqual<A extends string, B extends string> =
293
+ And<
294
+ IsNever<Exclude<A, B>> extends true ? true : false,
295
+ IsNever<Exclude<B, A>> extends true ? true : false
296
+ >;
297
+
298
+ type EndIfEqual<I extends string, O extends string> =
299
+ AreStringsEqual<I, O> extends true
300
+ ? never
301
+ : void;
302
+
303
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
304
+ if (input === output) {
305
+ process.exit(0);
306
+ }
307
+ }
308
+
309
+ endIfEqual('abc', 'abc');
310
+ //=> never
311
+
312
+ endIfEqual('abc', '123');
313
+ //=> void
314
+ ```
315
+
316
+ @category Type Guard
317
+ @category Utilities
318
+ */
319
+ type IsNever<T> = [T] extends [never] ? true : false;
320
+
321
+ /**
322
+ An if-else-like type that resolves depending on whether the given type is `never`.
323
+
324
+ @see {@link IsNever}
325
+
326
+ @example
327
+ ```
328
+ import type {IfNever} from 'type-fest';
329
+
330
+ type ShouldBeTrue = IfNever<never>;
331
+ //=> true
332
+
333
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
334
+ //=> 'bar'
335
+ ```
336
+
337
+ @category Type Guard
338
+ @category Utilities
339
+ */
340
+ type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
341
+ IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
342
+ );
343
+
274
344
  /**
275
345
  Extract the keys from a type where the value type of the key extends the given `Condition`.
276
346
 
@@ -303,21 +373,19 @@ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
303
373
 
304
374
  @category Object
305
375
  */
306
- type ConditionalKeys$2<Base, Condition> = NonNullable<
307
- // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
376
+ type ConditionalKeys<Base, Condition> =
308
377
  {
309
378
  // Map through all the keys of the given base type.
310
- [Key in keyof Base]:
379
+ [Key in keyof Base]-?:
311
380
  // Pick only keys with types extending the given `Condition` type.
312
381
  Base[Key] extends Condition
313
- // Retain this key since the condition passes.
314
- ? Key
382
+ // Retain this key
383
+ // If the value for the key extends never, only include it if `Condition` also extends never
384
+ ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
315
385
  // Discard this key since the condition fails.
316
386
  : never;
317
-
318
387
  // Convert the produced object into a union type of the keys which passed the conditional test.
319
- }[keyof Base]
320
- >;
388
+ }[keyof Base];
321
389
 
322
390
  /**
323
391
  Exclude keys from a shape that matches the given `Condition`.
@@ -357,9 +425,9 @@ type NonStringKeysOnly = ConditionalExcept<Example, string>;
357
425
 
358
426
  @category Object
359
427
  */
360
- type ConditionalExcept$2<Base, Condition> = Except$2<
428
+ type ConditionalExcept<Base, Condition> = Except<
361
429
  Base,
362
- ConditionalKeys$2<Base, Condition>
430
+ ConditionalKeys<Base, Condition>
363
431
  >;
364
432
 
365
433
  /**
@@ -367,8 +435,8 @@ ConditionalKeys$2<Base, Condition>
367
435
  * can either be a REST module or a host module.
368
436
  * This type is recursive, so it can describe nested modules.
369
437
  */
370
- type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 | HostModule$2<any, any> | EventDefinition$4<any> | ServicePluginDefinition$2<any> | {
371
- [key: string]: Descriptors$2 | PublicMetadata$2 | any;
438
+ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
439
+ [key: string]: Descriptors | PublicMetadata | any;
372
440
  };
373
441
  /**
374
442
  * This type takes in a descriptors object of a certain Host (including an `unknown` host)
@@ -376,12 +444,12 @@ type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 |
376
444
  * Any non-descriptor properties are removed from the returned object, including descriptors that
377
445
  * do not match the given host (as they will not work with the given host).
378
446
  */
379
- type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
447
+ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
380
448
  done: T;
381
449
  recurse: T extends {
382
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE$2;
383
- } ? never : T extends AmbassadorFunctionDescriptor$2 ? BuildAmbassadorFunction$2<T> : T extends RESTFunctionDescriptor$2 ? BuildRESTFunction$2<T> : T extends EventDefinition$4<any> ? BuildEventDefinition$4<T> : T extends ServicePluginDefinition$2<any> ? BuildServicePluginDefinition$2<T> : T extends HostModule$2<any, any> ? HostModuleAPI$2<T> : ConditionalExcept$2<{
384
- [Key in keyof T]: T[Key] extends Descriptors$2 ? BuildDescriptors$2<T[Key], H, [
450
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
451
+ } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
452
+ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
385
453
  -1,
386
454
  0,
387
455
  1,
@@ -390,9 +458,9 @@ type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefin
390
458
  4,
391
459
  5
392
460
  ][Depth]> : never;
393
- }, EmptyObject$2>;
461
+ }, EmptyObject>;
394
462
  }[Depth extends -1 ? 'done' : 'recurse'];
395
- type PublicMetadata$2 = {
463
+ type PublicMetadata = {
396
464
  PACKAGE_NAME?: string;
397
465
  };
398
466
 
@@ -404,14 +472,29 @@ declare global {
404
472
  * A type used to create concerete types from SDK descriptors in
405
473
  * case a contextual client is available.
406
474
  */
407
- type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
408
- host: Host$2;
409
- } ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
475
+ type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
476
+ host: Host;
477
+ } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
410
478
 
411
479
  interface AlarmMessage {
412
480
  _id?: string;
413
481
  seconds?: number;
414
482
  }
483
+ interface Dispatched$1 {
484
+ /** the message someone says */
485
+ echo?: EchoMessage$1;
486
+ }
487
+ interface EchoMessage$1 {
488
+ /** message comment from EchoMessage proto def, with special comment */
489
+ message?: string;
490
+ /** messages_list comment from EchoMessage proto def */
491
+ messagesList?: MessageItem$1[];
492
+ _id?: string;
493
+ }
494
+ interface MessageItem$1 {
495
+ /** inner_message comment from EchoMessage proto def */
496
+ innerMessage?: string;
497
+ }
415
498
  interface AlarmRequest {
416
499
  seconds: number;
417
500
  someString?: string;
@@ -419,7 +502,7 @@ interface AlarmRequest {
419
502
  someOtherField?: string;
420
503
  }
421
504
  interface AlarmResponse {
422
- time?: Date;
505
+ time?: Date | null;
423
506
  }
424
507
  interface AlarmTriggered {
425
508
  }
@@ -433,11 +516,11 @@ interface UpdateAlarmRequest {
433
516
  interface UpdateAlarmResponse {
434
517
  alarm?: AlarmMessage;
435
518
  }
436
- interface DomainEvent$2 extends DomainEventBodyOneOf$2 {
437
- createdEvent?: EntityCreatedEvent$2;
438
- updatedEvent?: EntityUpdatedEvent$2;
439
- deletedEvent?: EntityDeletedEvent$2;
440
- actionEvent?: ActionEvent$2;
519
+ interface DomainEvent$1 extends DomainEventBodyOneOf$1 {
520
+ createdEvent?: EntityCreatedEvent$1;
521
+ updatedEvent?: EntityUpdatedEvent$1;
522
+ deletedEvent?: EntityDeletedEvent$1;
523
+ actionEvent?: ActionEvent$1;
441
524
  /**
442
525
  * Unique event ID.
443
526
  * Allows clients to ignore duplicate webhooks.
@@ -457,7 +540,7 @@ interface DomainEvent$2 extends DomainEventBodyOneOf$2 {
457
540
  /** ID of the entity associated with the event. */
458
541
  entityId?: string;
459
542
  /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
460
- eventTime?: Date;
543
+ eventTime?: Date | null;
461
544
  /**
462
545
  * Whether the event was triggered as a result of a privacy regulation application
463
546
  * (for example, GDPR).
@@ -476,19 +559,19 @@ interface DomainEvent$2 extends DomainEventBodyOneOf$2 {
476
559
  entityEventSequence?: string | null;
477
560
  }
478
561
  /** @oneof */
479
- interface DomainEventBodyOneOf$2 {
480
- createdEvent?: EntityCreatedEvent$2;
481
- updatedEvent?: EntityUpdatedEvent$2;
482
- deletedEvent?: EntityDeletedEvent$2;
483
- actionEvent?: ActionEvent$2;
562
+ interface DomainEventBodyOneOf$1 {
563
+ createdEvent?: EntityCreatedEvent$1;
564
+ updatedEvent?: EntityUpdatedEvent$1;
565
+ deletedEvent?: EntityDeletedEvent$1;
566
+ actionEvent?: ActionEvent$1;
484
567
  }
485
- interface EntityCreatedEvent$2 {
568
+ interface EntityCreatedEvent$1 {
486
569
  entity?: string;
487
570
  }
488
- interface RestoreInfo$2 {
489
- deletedDate?: Date;
571
+ interface RestoreInfo$1 {
572
+ deletedDate?: Date | null;
490
573
  }
491
- interface EntityUpdatedEvent$2 {
574
+ interface EntityUpdatedEvent$1 {
492
575
  /**
493
576
  * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
494
577
  * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
@@ -496,24 +579,24 @@ interface EntityUpdatedEvent$2 {
496
579
  */
497
580
  currentEntity?: string;
498
581
  }
499
- interface EntityDeletedEvent$2 {
582
+ interface EntityDeletedEvent$1 {
500
583
  /** Entity that was deleted */
501
584
  deletedEntity?: string | null;
502
585
  }
503
- interface ActionEvent$2 {
586
+ interface ActionEvent$1 {
504
587
  body?: string;
505
588
  }
506
- interface MessageEnvelope$2 {
589
+ interface MessageEnvelope$1 {
507
590
  /** App instance ID. */
508
591
  instanceId?: string | null;
509
592
  /** Event type. */
510
593
  eventType?: string;
511
594
  /** The identification type and identity data. */
512
- identity?: IdentificationData$2;
595
+ identity?: IdentificationData$1;
513
596
  /** Stringify payload. */
514
597
  data?: string;
515
598
  }
516
- interface IdentificationData$2 extends IdentificationDataIdOneOf$2 {
599
+ interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
517
600
  /** ID of a site visitor that has not logged in to the site. */
518
601
  anonymousVisitorId?: string;
519
602
  /** ID of a site visitor that has logged in to the site. */
@@ -523,10 +606,10 @@ interface IdentificationData$2 extends IdentificationDataIdOneOf$2 {
523
606
  /** ID of an app. */
524
607
  appId?: string;
525
608
  /** @readonly */
526
- identityType?: WebhookIdentityType$2;
609
+ identityType?: WebhookIdentityType$1;
527
610
  }
528
611
  /** @oneof */
529
- interface IdentificationDataIdOneOf$2 {
612
+ interface IdentificationDataIdOneOf$1 {
530
613
  /** ID of a site visitor that has not logged in to the site. */
531
614
  anonymousVisitorId?: string;
532
615
  /** ID of a site visitor that has logged in to the site. */
@@ -536,7 +619,7 @@ interface IdentificationDataIdOneOf$2 {
536
619
  /** ID of an app. */
537
620
  appId?: string;
538
621
  }
539
- declare enum WebhookIdentityType$2 {
622
+ declare enum WebhookIdentityType$1 {
540
623
  UNKNOWN = "UNKNOWN",
541
624
  ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
542
625
  MEMBER = "MEMBER",
@@ -564,7 +647,7 @@ interface BaseEventMetadata$1 {
564
647
  /** Event type. */
565
648
  eventType?: string;
566
649
  /** The identification type and identity data. */
567
- identity?: IdentificationData$2;
650
+ identity?: IdentificationData$1;
568
651
  }
569
652
  interface EventMetadata$1 extends BaseEventMetadata$1 {
570
653
  /**
@@ -586,7 +669,7 @@ interface EventMetadata$1 extends BaseEventMetadata$1 {
586
669
  /** ID of the entity associated with the event. */
587
670
  entityId?: string;
588
671
  /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
589
- eventTime?: Date;
672
+ eventTime?: Date | null;
590
673
  /**
591
674
  * Whether the event was triggered as a result of a privacy regulation application
592
675
  * (for example, GDPR).
@@ -626,46 +709,28 @@ interface UpdateAlarm {
626
709
  seconds?: number;
627
710
  }
628
711
 
629
- declare function alarm$1(httpClient: HttpClient$2): AlarmSignature;
712
+ declare function alarm$1(httpClient: HttpClient): AlarmSignature;
630
713
  interface AlarmSignature {
631
714
  /**
632
715
  * sets up an alarm after {seconds}
633
716
  */
634
717
  (seconds: number, options?: AlarmOptions | undefined): Promise<AlarmResponse>;
635
718
  }
636
- declare function updateAlarm$1(httpClient: HttpClient$2): UpdateAlarmSignature;
719
+ declare function updateAlarm$1(httpClient: HttpClient): UpdateAlarmSignature;
637
720
  interface UpdateAlarmSignature {
638
721
  /**
639
722
  * sets up an existing alarm with id {id}
640
723
  */
641
724
  (_id: string, alarm: UpdateAlarm): Promise<UpdateAlarmResponse & UpdateAlarmResponseNonNullableFields>;
642
725
  }
643
- declare const onAlarmTriggered$1: EventDefinition$4<AlarmTriggeredEnvelope, "wix.alarm.v1.alarm_alarm_triggered">;
644
- declare const onAlarmSnoozed$1: EventDefinition$4<AlarmSnoozedEnvelope, "wix.alarm.v1.alarm_alarm_snoozed">;
645
- declare const onAlarmDeleted$1: EventDefinition$4<AlarmDeletedEnvelope, "wix.alarm.v1.alarm_alarm_deleted">;
646
-
647
- type EventDefinition$3<Payload = unknown, Type extends string = string> = {
648
- __type: 'event-definition';
649
- type: Type;
650
- isDomainEvent?: boolean;
651
- transformations?: (envelope: unknown) => Payload;
652
- __payload: Payload;
653
- };
654
- declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
655
- type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
656
- type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
657
-
658
- declare global {
659
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
660
- interface SymbolConstructor {
661
- readonly observable: symbol;
662
- }
663
- }
726
+ declare const onAlarmTriggered$1: EventDefinition<AlarmTriggeredEnvelope, "wix.alarm.v1.alarm_alarm_triggered">;
727
+ declare const onAlarmSnoozed$1: EventDefinition<AlarmSnoozedEnvelope, "wix.alarm.v1.alarm_alarm_snoozed">;
728
+ declare const onAlarmDeleted$1: EventDefinition<AlarmDeletedEnvelope, "wix.alarm.v1.alarm_alarm_deleted">;
664
729
 
665
- declare function createEventModule$1<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
730
+ declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
666
731
 
667
- declare const alarm: MaybeContext$2<BuildRESTFunction$2<typeof alarm$1> & typeof alarm$1>;
668
- declare const updateAlarm: MaybeContext$2<BuildRESTFunction$2<typeof updateAlarm$1> & typeof updateAlarm$1>;
732
+ declare const alarm: MaybeContext<BuildRESTFunction<typeof alarm$1> & typeof alarm$1>;
733
+ declare const updateAlarm: MaybeContext<BuildRESTFunction<typeof updateAlarm$1> & typeof updateAlarm$1>;
669
734
 
670
735
  type _publicOnAlarmTriggeredType = typeof onAlarmTriggered$1;
671
736
  /**
@@ -710,499 +775,89 @@ declare const context$2_onAlarmSnoozed: typeof onAlarmSnoozed;
710
775
  declare const context$2_onAlarmTriggered: typeof onAlarmTriggered;
711
776
  declare const context$2_updateAlarm: typeof updateAlarm;
712
777
  declare namespace context$2 {
713
- export { type ActionEvent$2 as ActionEvent, type context$2_AlarmDeleted as AlarmDeleted, type context$2_AlarmDeletedEnvelope as AlarmDeletedEnvelope, type context$2_AlarmMessage as AlarmMessage, type context$2_AlarmOptions as AlarmOptions, type context$2_AlarmRequest as AlarmRequest, type context$2_AlarmRequestRequiredFields as AlarmRequestRequiredFields, type context$2_AlarmResponse as AlarmResponse, type context$2_AlarmSnoozed as AlarmSnoozed, type context$2_AlarmSnoozedEnvelope as AlarmSnoozedEnvelope, type context$2_AlarmTriggered as AlarmTriggered, type context$2_AlarmTriggeredEnvelope as AlarmTriggeredEnvelope, type BaseEventMetadata$1 as BaseEventMetadata, 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$1 as EventMetadata, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type MessageEnvelope$2 as MessageEnvelope, type RestoreInfo$2 as RestoreInfo, type context$2_UpdateAlarm as UpdateAlarm, type context$2_UpdateAlarmRequest as UpdateAlarmRequest, type context$2_UpdateAlarmRequestRequiredFields as UpdateAlarmRequestRequiredFields, type context$2_UpdateAlarmResponse as UpdateAlarmResponse, type context$2_UpdateAlarmResponseNonNullableFields as UpdateAlarmResponseNonNullableFields, WebhookIdentityType$2 as WebhookIdentityType, type context$2__publicOnAlarmDeletedType as _publicOnAlarmDeletedType, type context$2__publicOnAlarmSnoozedType as _publicOnAlarmSnoozedType, type context$2__publicOnAlarmTriggeredType as _publicOnAlarmTriggeredType, context$2_alarm as alarm, context$2_onAlarmDeleted as onAlarmDeleted, context$2_onAlarmSnoozed as onAlarmSnoozed, context$2_onAlarmTriggered as onAlarmTriggered, onAlarmDeleted$1 as publicOnAlarmDeleted, onAlarmSnoozed$1 as publicOnAlarmSnoozed, onAlarmTriggered$1 as publicOnAlarmTriggered, context$2_updateAlarm as updateAlarm };
778
+ export { type ActionEvent$1 as ActionEvent, type context$2_AlarmDeleted as AlarmDeleted, type context$2_AlarmDeletedEnvelope as AlarmDeletedEnvelope, type context$2_AlarmMessage as AlarmMessage, type context$2_AlarmOptions as AlarmOptions, type context$2_AlarmRequest as AlarmRequest, type context$2_AlarmRequestRequiredFields as AlarmRequestRequiredFields, type context$2_AlarmResponse as AlarmResponse, type context$2_AlarmSnoozed as AlarmSnoozed, type context$2_AlarmSnoozedEnvelope as AlarmSnoozedEnvelope, type context$2_AlarmTriggered as AlarmTriggered, type context$2_AlarmTriggeredEnvelope as AlarmTriggeredEnvelope, type BaseEventMetadata$1 as BaseEventMetadata, type Dispatched$1 as Dispatched, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type EchoMessage$1 as EchoMessage, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type EventMetadata$1 as EventMetadata, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type MessageEnvelope$1 as MessageEnvelope, type MessageItem$1 as MessageItem, type RestoreInfo$1 as RestoreInfo, type context$2_UpdateAlarm as UpdateAlarm, type context$2_UpdateAlarmRequest as UpdateAlarmRequest, type context$2_UpdateAlarmRequestRequiredFields as UpdateAlarmRequestRequiredFields, type context$2_UpdateAlarmResponse as UpdateAlarmResponse, type context$2_UpdateAlarmResponseNonNullableFields as UpdateAlarmResponseNonNullableFields, WebhookIdentityType$1 as WebhookIdentityType, type context$2__publicOnAlarmDeletedType as _publicOnAlarmDeletedType, type context$2__publicOnAlarmSnoozedType as _publicOnAlarmSnoozedType, type context$2__publicOnAlarmTriggeredType as _publicOnAlarmTriggeredType, context$2_alarm as alarm, context$2_onAlarmDeleted as onAlarmDeleted, context$2_onAlarmSnoozed as onAlarmSnoozed, context$2_onAlarmTriggered as onAlarmTriggered, onAlarmDeleted$1 as publicOnAlarmDeleted, onAlarmSnoozed$1 as publicOnAlarmSnoozed, onAlarmTriggered$1 as publicOnAlarmTriggered, context$2_updateAlarm as updateAlarm };
714
779
  }
715
780
 
716
- type HostModule$1<T, H extends Host$1> = {
717
- __type: 'host';
718
- create(host: H): T;
719
- };
720
- type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
721
- type Host$1<Environment = unknown> = {
722
- channel: {
723
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
724
- disconnect: () => void;
725
- } | Promise<{
726
- disconnect: () => void;
727
- }>;
728
- };
729
- environment?: Environment;
781
+ interface MessageItem {
782
+ /** inner_message comment from EchoMessage proto def */
783
+ innerMessage?: string;
784
+ }
785
+ interface EchoRequest {
786
+ /** 1st part of the message */
787
+ arg1: string;
788
+ /** 2nd part of the message */
789
+ arg2?: string;
790
+ /** this field test translatable annotation */
791
+ titleField?: string;
792
+ someInt32?: number;
793
+ someDate?: Date | null;
794
+ }
795
+ interface EchoResponse {
796
+ /** message result as EchoMessage */
797
+ echoMessage?: EchoMessage;
798
+ /** messge reseult as string */
799
+ message?: string;
800
+ }
801
+ interface Dispatched {
802
+ /** the message someone says */
803
+ echo?: EchoMessage;
804
+ }
805
+ interface DomainEvent extends DomainEventBodyOneOf {
806
+ createdEvent?: EntityCreatedEvent;
807
+ updatedEvent?: EntityUpdatedEvent;
808
+ deletedEvent?: EntityDeletedEvent;
809
+ actionEvent?: ActionEvent;
730
810
  /**
731
- * Optional bast url to use for API requests, for example `www.wixapis.com`
811
+ * Unique event ID.
812
+ * Allows clients to ignore duplicate webhooks.
732
813
  */
733
- apiBaseUrl?: string;
814
+ _id?: string;
734
815
  /**
735
- * Possible data to be provided by every host, for cross cutting concerns
736
- * like internationalization, billing, etc.
816
+ * Assumes actions are also always typed to an entity_type
817
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
737
818
  */
738
- essentials?: {
739
- /**
740
- * The language of the currently viewed session
741
- */
742
- language?: string;
743
- /**
744
- * The locale of the currently viewed session
745
- */
746
- locale?: string;
747
- /**
748
- * Any headers that should be passed through to the API requests
749
- */
750
- passThroughHeaders?: Record<string, string>;
751
- };
752
- };
753
-
754
- type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
755
- interface HttpClient$1 {
756
- request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
757
- fetchWithAuth: typeof fetch;
758
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
759
- getActiveToken?: () => string | undefined;
760
- }
761
- type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
762
- type HttpResponse$1<T = any> = {
763
- data: T;
764
- status: number;
765
- statusText: string;
766
- headers: any;
767
- request?: any;
768
- };
769
- type RequestOptions$1<_TResponse = any, Data = any> = {
770
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
771
- url: string;
772
- data?: Data;
773
- params?: URLSearchParams;
774
- } & APIMetadata$1;
775
- type APIMetadata$1 = {
776
- methodFqn?: string;
777
819
  entityFqdn?: string;
778
- packageName?: string;
779
- };
780
- type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
781
- type EventDefinition$2<Payload = unknown, Type extends string = string> = {
782
- __type: 'event-definition';
783
- type: Type;
784
- isDomainEvent?: boolean;
785
- transformations?: (envelope: unknown) => Payload;
786
- __payload: Payload;
787
- };
788
- declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
789
- type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
790
- type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
791
-
792
- type ServicePluginMethodInput$1 = {
793
- request: any;
794
- metadata: any;
795
- };
796
- type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
797
- type ServicePluginMethodMetadata$1 = {
798
- name: string;
799
- primaryHttpMappingPath: string;
800
- transformations: {
801
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
802
- toREST: (...args: unknown[]) => unknown;
803
- };
804
- };
805
- type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
806
- __type: 'service-plugin-definition';
807
- componentType: string;
808
- methods: ServicePluginMethodMetadata$1[];
809
- __contract: Contract;
810
- };
811
- declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
812
- type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
813
- declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
814
-
815
- type RequestContext$1 = {
816
- isSSR: boolean;
817
- host: string;
818
- protocol?: string;
819
- };
820
- type ResponseTransformer$1 = (data: any, headers?: any) => any;
821
- /**
822
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
823
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
824
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
825
- */
826
- type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
827
- type AmbassadorRequestOptions$1<T = any> = {
828
- _?: T;
829
- url?: string;
830
- method?: Method$1;
831
- params?: any;
832
- data?: any;
833
- transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
834
- };
835
- type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
836
- __isAmbassador: boolean;
837
- };
838
- type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
839
- type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
840
-
841
- declare global {
842
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
843
- interface SymbolConstructor {
844
- readonly observable: symbol;
845
- }
820
+ /**
821
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
822
+ * This is although the created/updated/deleted notion is duplication of the oneof types
823
+ * Example: created/updated/deleted/started/completed/email_opened
824
+ */
825
+ slug?: string;
826
+ /** ID of the entity associated with the event. */
827
+ entityId?: string;
828
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
829
+ eventTime?: Date | null;
830
+ /**
831
+ * Whether the event was triggered as a result of a privacy regulation application
832
+ * (for example, GDPR).
833
+ */
834
+ triggeredByAnonymizeRequest?: boolean | null;
835
+ /** If present, indicates the action that triggered the event. */
836
+ originatedFrom?: string | null;
837
+ /**
838
+ * A sequence number defining the order of updates to the underlying entity.
839
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
840
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
841
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
842
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
843
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
844
+ */
845
+ entityEventSequence?: string | null;
846
846
  }
847
-
848
- declare const emptyObjectSymbol$1: unique symbol;
849
-
850
- /**
851
- Represents a strictly empty plain object, the `{}` value.
852
-
853
- 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)).
854
-
855
- @example
856
- ```
857
- import type {EmptyObject} from 'type-fest';
858
-
859
- // The following illustrates the problem with `{}`.
860
- const foo1: {} = {}; // Pass
861
- const foo2: {} = []; // Pass
862
- const foo3: {} = 42; // Pass
863
- const foo4: {} = {a: 1}; // Pass
864
-
865
- // With `EmptyObject` only the first case is valid.
866
- const bar1: EmptyObject = {}; // Pass
867
- const bar2: EmptyObject = 42; // Fail
868
- const bar3: EmptyObject = []; // Fail
869
- const bar4: EmptyObject = {a: 1}; // Fail
870
- ```
871
-
872
- 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}.
873
-
874
- @category Object
875
- */
876
- type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
877
-
878
- /**
879
- Returns a boolean for whether the two given types are equal.
880
-
881
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
882
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
883
-
884
- Use-cases:
885
- - If you want to make a conditional branch based on the result of a comparison of two types.
886
-
887
- @example
888
- ```
889
- import type {IsEqual} from 'type-fest';
890
-
891
- // This type returns a boolean for whether the given array includes the given item.
892
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
893
- type Includes<Value extends readonly any[], Item> =
894
- Value extends readonly [Value[0], ...infer rest]
895
- ? IsEqual<Value[0], Item> extends true
896
- ? true
897
- : Includes<rest, Item>
898
- : false;
899
- ```
900
-
901
- @category Type Guard
902
- @category Utilities
903
- */
904
- type IsEqual$1<A, B> =
905
- (<G>() => G extends A ? 1 : 2) extends
906
- (<G>() => G extends B ? 1 : 2)
907
- ? true
908
- : false;
909
-
910
- /**
911
- Filter out keys from an object.
912
-
913
- Returns `never` if `Exclude` is strictly equal to `Key`.
914
- Returns `never` if `Key` extends `Exclude`.
915
- Returns `Key` otherwise.
916
-
917
- @example
918
- ```
919
- type Filtered = Filter<'foo', 'foo'>;
920
- //=> never
921
- ```
922
-
923
- @example
924
- ```
925
- type Filtered = Filter<'bar', string>;
926
- //=> never
927
- ```
928
-
929
- @example
930
- ```
931
- type Filtered = Filter<'bar', 'foo'>;
932
- //=> 'bar'
933
- ```
934
-
935
- @see {Except}
936
- */
937
- type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
938
-
939
- type ExceptOptions$1 = {
940
- /**
941
- Disallow assigning non-specified properties.
942
-
943
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
944
-
945
- @default false
946
- */
947
- requireExactProps?: boolean;
948
- };
949
-
950
- /**
951
- Create a type from an object type without certain keys.
952
-
953
- We recommend setting the `requireExactProps` option to `true`.
954
-
955
- 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.
956
-
957
- 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)).
958
-
959
- @example
960
- ```
961
- import type {Except} from 'type-fest';
962
-
963
- type Foo = {
964
- a: number;
965
- b: string;
966
- };
967
-
968
- type FooWithoutA = Except<Foo, 'a'>;
969
- //=> {b: string}
970
-
971
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
972
- //=> errors: 'a' does not exist in type '{ b: string; }'
973
-
974
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
975
- //=> {a: number} & Partial<Record<"b", never>>
976
-
977
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
978
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
979
- ```
980
-
981
- @category Object
982
- */
983
- type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
984
- [KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
985
- } & (Options['requireExactProps'] extends true
986
- ? Partial<Record<KeysType, never>>
987
- : {});
988
-
989
- /**
990
- Extract the keys from a type where the value type of the key extends the given `Condition`.
991
-
992
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
993
-
994
- @example
995
- ```
996
- import type {ConditionalKeys} from 'type-fest';
997
-
998
- interface Example {
999
- a: string;
1000
- b: string | number;
1001
- c?: string;
1002
- d: {};
847
+ /** @oneof */
848
+ interface DomainEventBodyOneOf {
849
+ createdEvent?: EntityCreatedEvent;
850
+ updatedEvent?: EntityUpdatedEvent;
851
+ deletedEvent?: EntityDeletedEvent;
852
+ actionEvent?: ActionEvent;
1003
853
  }
1004
-
1005
- type StringKeysOnly = ConditionalKeys<Example, string>;
1006
- //=> 'a'
1007
- ```
1008
-
1009
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
1010
-
1011
- @example
1012
- ```
1013
- import type {ConditionalKeys} from 'type-fest';
1014
-
1015
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
1016
- //=> 'a' | 'c'
1017
- ```
1018
-
1019
- @category Object
1020
- */
1021
- type ConditionalKeys$1<Base, Condition> = NonNullable<
1022
- // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
1023
- {
1024
- // Map through all the keys of the given base type.
1025
- [Key in keyof Base]:
1026
- // Pick only keys with types extending the given `Condition` type.
1027
- Base[Key] extends Condition
1028
- // Retain this key since the condition passes.
1029
- ? Key
1030
- // Discard this key since the condition fails.
1031
- : never;
1032
-
1033
- // Convert the produced object into a union type of the keys which passed the conditional test.
1034
- }[keyof Base]
1035
- >;
1036
-
1037
- /**
1038
- Exclude keys from a shape that matches the given `Condition`.
1039
-
1040
- 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.
1041
-
1042
- @example
1043
- ```
1044
- import type {Primitive, ConditionalExcept} from 'type-fest';
1045
-
1046
- class Awesome {
1047
- name: string;
1048
- successes: number;
1049
- failures: bigint;
1050
-
1051
- run() {}
854
+ interface EntityCreatedEvent {
855
+ entity?: string;
1052
856
  }
1053
-
1054
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
1055
- //=> {run: () => void}
1056
- ```
1057
-
1058
- @example
1059
- ```
1060
- import type {ConditionalExcept} from 'type-fest';
1061
-
1062
- interface Example {
1063
- a: string;
1064
- b: string | number;
1065
- c: () => void;
1066
- d: {};
857
+ interface RestoreInfo {
858
+ deletedDate?: Date | null;
1067
859
  }
1068
-
1069
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
1070
- //=> {b: string | number; c: () => void; d: {}}
1071
- ```
1072
-
1073
- @category Object
1074
- */
1075
- type ConditionalExcept$1<Base, Condition> = Except$1<
1076
- Base,
1077
- ConditionalKeys$1<Base, Condition>
1078
- >;
1079
-
1080
- /**
1081
- * Descriptors are objects that describe the API of a module, and the module
1082
- * can either be a REST module or a host module.
1083
- * This type is recursive, so it can describe nested modules.
1084
- */
1085
- type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$2<any> | ServicePluginDefinition$1<any> | {
1086
- [key: string]: Descriptors$1 | PublicMetadata$1 | any;
1087
- };
1088
- /**
1089
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
1090
- * and returns an object with the same structure, but with all descriptors replaced with their API.
1091
- * Any non-descriptor properties are removed from the returned object, including descriptors that
1092
- * do not match the given host (as they will not work with the given host).
1093
- */
1094
- type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
1095
- done: T;
1096
- recurse: T extends {
1097
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
1098
- } ? never : T extends AmbassadorFunctionDescriptor$1 ? BuildAmbassadorFunction$1<T> : T extends RESTFunctionDescriptor$1 ? BuildRESTFunction$1<T> : T extends EventDefinition$2<any> ? BuildEventDefinition$2<T> : T extends ServicePluginDefinition$1<any> ? BuildServicePluginDefinition$1<T> : T extends HostModule$1<any, any> ? HostModuleAPI$1<T> : ConditionalExcept$1<{
1099
- [Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
1100
- -1,
1101
- 0,
1102
- 1,
1103
- 2,
1104
- 3,
1105
- 4,
1106
- 5
1107
- ][Depth]> : never;
1108
- }, EmptyObject$1>;
1109
- }[Depth extends -1 ? 'done' : 'recurse'];
1110
- type PublicMetadata$1 = {
1111
- PACKAGE_NAME?: string;
1112
- };
1113
-
1114
- declare global {
1115
- interface ContextualClient {
1116
- }
1117
- }
1118
- /**
1119
- * A type used to create concerete types from SDK descriptors in
1120
- * case a contextual client is available.
1121
- */
1122
- type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
1123
- host: Host$1;
1124
- } ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
1125
-
1126
- interface MessageItem {
1127
- /** inner_message comment from EchoMessage proto def */
1128
- innerMessage?: string;
1129
- }
1130
- interface EchoRequest {
1131
- /** 1st part of the message */
1132
- arg1: string;
1133
- /** 2nd part of the message */
1134
- arg2?: string;
1135
- /** this field test translatable annotation */
1136
- titleField?: string;
1137
- someInt32?: number;
1138
- someDate?: Date;
1139
- }
1140
- interface EchoResponse {
1141
- /** message result as EchoMessage */
1142
- echoMessage?: EchoMessage;
1143
- /** messge reseult as string */
1144
- message?: string;
1145
- }
1146
- interface Dispatched {
1147
- /** the message someone says */
1148
- echo?: EchoMessage;
1149
- }
1150
- interface DomainEvent$1 extends DomainEventBodyOneOf$1 {
1151
- createdEvent?: EntityCreatedEvent$1;
1152
- updatedEvent?: EntityUpdatedEvent$1;
1153
- deletedEvent?: EntityDeletedEvent$1;
1154
- actionEvent?: ActionEvent$1;
1155
- /**
1156
- * Unique event ID.
1157
- * Allows clients to ignore duplicate webhooks.
1158
- */
1159
- _id?: string;
1160
- /**
1161
- * Assumes actions are also always typed to an entity_type
1162
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
1163
- */
1164
- entityFqdn?: string;
1165
- /**
1166
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
1167
- * This is although the created/updated/deleted notion is duplication of the oneof types
1168
- * Example: created/updated/deleted/started/completed/email_opened
1169
- */
1170
- slug?: string;
1171
- /** ID of the entity associated with the event. */
1172
- entityId?: string;
1173
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
1174
- eventTime?: Date;
1175
- /**
1176
- * Whether the event was triggered as a result of a privacy regulation application
1177
- * (for example, GDPR).
1178
- */
1179
- triggeredByAnonymizeRequest?: boolean | null;
1180
- /** If present, indicates the action that triggered the event. */
1181
- originatedFrom?: string | null;
1182
- /**
1183
- * A sequence number defining the order of updates to the underlying entity.
1184
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
1185
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
1186
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
1187
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
1188
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
1189
- */
1190
- entityEventSequence?: string | null;
1191
- }
1192
- /** @oneof */
1193
- interface DomainEventBodyOneOf$1 {
1194
- createdEvent?: EntityCreatedEvent$1;
1195
- updatedEvent?: EntityUpdatedEvent$1;
1196
- deletedEvent?: EntityDeletedEvent$1;
1197
- actionEvent?: ActionEvent$1;
1198
- }
1199
- interface EntityCreatedEvent$1 {
1200
- entity?: string;
1201
- }
1202
- interface RestoreInfo$1 {
1203
- deletedDate?: Date;
1204
- }
1205
- interface EntityUpdatedEvent$1 {
860
+ interface EntityUpdatedEvent {
1206
861
  /**
1207
862
  * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
1208
863
  * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
@@ -1210,24 +865,24 @@ interface EntityUpdatedEvent$1 {
1210
865
  */
1211
866
  currentEntity?: string;
1212
867
  }
1213
- interface EntityDeletedEvent$1 {
868
+ interface EntityDeletedEvent {
1214
869
  /** Entity that was deleted */
1215
870
  deletedEntity?: string | null;
1216
871
  }
1217
- interface ActionEvent$1 {
872
+ interface ActionEvent {
1218
873
  body?: string;
1219
874
  }
1220
- interface MessageEnvelope$1 {
875
+ interface MessageEnvelope {
1221
876
  /** App instance ID. */
1222
877
  instanceId?: string | null;
1223
878
  /** Event type. */
1224
879
  eventType?: string;
1225
880
  /** The identification type and identity data. */
1226
- identity?: IdentificationData$1;
881
+ identity?: IdentificationData;
1227
882
  /** Stringify payload. */
1228
883
  data?: string;
1229
884
  }
1230
- interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
885
+ interface IdentificationData extends IdentificationDataIdOneOf {
1231
886
  /** ID of a site visitor that has not logged in to the site. */
1232
887
  anonymousVisitorId?: string;
1233
888
  /** ID of a site visitor that has logged in to the site. */
@@ -1237,10 +892,10 @@ interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
1237
892
  /** ID of an app. */
1238
893
  appId?: string;
1239
894
  /** @readonly */
1240
- identityType?: WebhookIdentityType$1;
895
+ identityType?: WebhookIdentityType;
1241
896
  }
1242
897
  /** @oneof */
1243
- interface IdentificationDataIdOneOf$1 {
898
+ interface IdentificationDataIdOneOf {
1244
899
  /** ID of a site visitor that has not logged in to the site. */
1245
900
  anonymousVisitorId?: string;
1246
901
  /** ID of a site visitor that has logged in to the site. */
@@ -1250,7 +905,7 @@ interface IdentificationDataIdOneOf$1 {
1250
905
  /** ID of an app. */
1251
906
  appId?: string;
1252
907
  }
1253
- declare enum WebhookIdentityType$1 {
908
+ declare enum WebhookIdentityType {
1254
909
  UNKNOWN = "UNKNOWN",
1255
910
  ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1256
911
  MEMBER = "MEMBER",
@@ -1282,7 +937,7 @@ interface BaseEventMetadata {
1282
937
  /** Event type. */
1283
938
  eventType?: string;
1284
939
  /** The identification type and identity data. */
1285
- identity?: IdentificationData$1;
940
+ identity?: IdentificationData;
1286
941
  }
1287
942
  interface EventMetadata extends BaseEventMetadata {
1288
943
  /**
@@ -1304,7 +959,7 @@ interface EventMetadata extends BaseEventMetadata {
1304
959
  /** ID of the entity associated with the event. */
1305
960
  entityId?: string;
1306
961
  /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
1307
- eventTime?: Date;
962
+ eventTime?: Date | null;
1308
963
  /**
1309
964
  * Whether the event was triggered as a result of a privacy regulation application
1310
965
  * (for example, GDPR).
@@ -1316,492 +971,76 @@ interface EventMetadata extends BaseEventMetadata {
1316
971
  * A sequence number defining the order of updates to the underlying entity.
1317
972
  * For example, given that some entity was updated at 16:00 and than again at 16:01,
1318
973
  * it is guaranteed that the sequence number of the second update is strictly higher than the first.
1319
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
1320
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
1321
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
1322
- */
1323
- entityEventSequence?: string | null;
1324
- }
1325
- interface EchoDispatchedEnvelope {
1326
- data: Dispatched;
1327
- metadata: EventMetadata;
1328
- }
1329
- interface EchoOptions {
1330
- /** 2nd part of the message */
1331
- arg2?: string;
1332
- /** this field test translatable annotation */
1333
- titleField?: string;
1334
- someInt32?: number;
1335
- someDate?: Date;
1336
- }
1337
-
1338
- declare function echo$1(httpClient: HttpClient$1): EchoSignature;
1339
- interface EchoSignature {
1340
- /**
1341
- * echo given arg1 and arg2
1342
- * @param - 1st part of the message
1343
- * @param - modified comment for arg2 el hovav
1344
- * @returns messge reseult as string
1345
- */
1346
- (arg1: string, options?: EchoOptions | undefined): Promise<string>;
1347
- }
1348
- declare const onEchoDispatched$1: EventDefinition$2<EchoDispatchedEnvelope, "wix.metroinspector.v1.echo_dispatched">;
1349
-
1350
- type EventDefinition$1<Payload = unknown, Type extends string = string> = {
1351
- __type: 'event-definition';
1352
- type: Type;
1353
- isDomainEvent?: boolean;
1354
- transformations?: (envelope: unknown) => Payload;
1355
- __payload: Payload;
1356
- };
1357
- declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
1358
- type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
1359
- type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
1360
-
1361
- declare global {
1362
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1363
- interface SymbolConstructor {
1364
- readonly observable: symbol;
1365
- }
1366
- }
1367
-
1368
- declare function createEventModule<T extends EventDefinition$1<any, string>>(eventDefinition: T): BuildEventDefinition$1<T> & T;
1369
-
1370
- declare const echo: MaybeContext$1<BuildRESTFunction$1<typeof echo$1> & typeof echo$1>;
1371
-
1372
- type _publicOnEchoDispatchedType = typeof onEchoDispatched$1;
1373
- /**
1374
- * echo event that might be consumed when somone says something!
1375
- */
1376
- declare const onEchoDispatched: ReturnType<typeof createEventModule<_publicOnEchoDispatchedType>>;
1377
-
1378
- type context$1_BaseEventMetadata = BaseEventMetadata;
1379
- type context$1_Dispatched = Dispatched;
1380
- type context$1_EchoDispatchedEnvelope = EchoDispatchedEnvelope;
1381
- type context$1_EchoMessage = EchoMessage;
1382
- type context$1_EchoOptions = EchoOptions;
1383
- type context$1_EchoRequest = EchoRequest;
1384
- type context$1_EchoRequestRequiredFields = EchoRequestRequiredFields;
1385
- type context$1_EchoResponse = EchoResponse;
1386
- type context$1_EchoResponseNonNullableFields = EchoResponseNonNullableFields;
1387
- type context$1_EventMetadata = EventMetadata;
1388
- type context$1_MessageItem = MessageItem;
1389
- type context$1__publicOnEchoDispatchedType = _publicOnEchoDispatchedType;
1390
- declare const context$1_echo: typeof echo;
1391
- declare const context$1_onEchoDispatched: typeof onEchoDispatched;
1392
- declare namespace context$1 {
1393
- export { type ActionEvent$1 as ActionEvent, type context$1_BaseEventMetadata as BaseEventMetadata, type context$1_Dispatched as Dispatched, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type context$1_EchoDispatchedEnvelope as EchoDispatchedEnvelope, type context$1_EchoMessage as EchoMessage, type context$1_EchoOptions as EchoOptions, type context$1_EchoRequest as EchoRequest, type context$1_EchoRequestRequiredFields as EchoRequestRequiredFields, type context$1_EchoResponse as EchoResponse, type context$1_EchoResponseNonNullableFields as EchoResponseNonNullableFields, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type context$1_EventMetadata as EventMetadata, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type MessageEnvelope$1 as MessageEnvelope, type context$1_MessageItem as MessageItem, type RestoreInfo$1 as RestoreInfo, WebhookIdentityType$1 as WebhookIdentityType, type context$1__publicOnEchoDispatchedType as _publicOnEchoDispatchedType, context$1_echo as echo, context$1_onEchoDispatched as onEchoDispatched, onEchoDispatched$1 as publicOnEchoDispatched };
1394
- }
1395
-
1396
- type HostModule<T, H extends Host> = {
1397
- __type: 'host';
1398
- create(host: H): T;
1399
- };
1400
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
1401
- type Host<Environment = unknown> = {
1402
- channel: {
1403
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
1404
- disconnect: () => void;
1405
- } | Promise<{
1406
- disconnect: () => void;
1407
- }>;
1408
- };
1409
- environment?: Environment;
1410
- /**
1411
- * Optional bast url to use for API requests, for example `www.wixapis.com`
1412
- */
1413
- apiBaseUrl?: string;
1414
- /**
1415
- * Possible data to be provided by every host, for cross cutting concerns
1416
- * like internationalization, billing, etc.
1417
- */
1418
- essentials?: {
1419
- /**
1420
- * The language of the currently viewed session
1421
- */
1422
- language?: string;
1423
- /**
1424
- * The locale of the currently viewed session
1425
- */
1426
- locale?: string;
1427
- /**
1428
- * Any headers that should be passed through to the API requests
1429
- */
1430
- passThroughHeaders?: Record<string, string>;
1431
- };
1432
- };
1433
-
1434
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
1435
- interface HttpClient {
1436
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
1437
- fetchWithAuth: typeof fetch;
1438
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
1439
- getActiveToken?: () => string | undefined;
1440
- }
1441
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
1442
- type HttpResponse<T = any> = {
1443
- data: T;
1444
- status: number;
1445
- statusText: string;
1446
- headers: any;
1447
- request?: any;
1448
- };
1449
- type RequestOptions<_TResponse = any, Data = any> = {
1450
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1451
- url: string;
1452
- data?: Data;
1453
- params?: URLSearchParams;
1454
- } & APIMetadata;
1455
- type APIMetadata = {
1456
- methodFqn?: string;
1457
- entityFqdn?: string;
1458
- packageName?: string;
1459
- };
1460
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
1461
- type EventDefinition<Payload = unknown, Type extends string = string> = {
1462
- __type: 'event-definition';
1463
- type: Type;
1464
- isDomainEvent?: boolean;
1465
- transformations?: (envelope: unknown) => Payload;
1466
- __payload: Payload;
1467
- };
1468
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
1469
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
1470
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
1471
-
1472
- type ServicePluginMethodInput = {
1473
- request: any;
1474
- metadata: any;
1475
- };
1476
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
1477
- type ServicePluginMethodMetadata = {
1478
- name: string;
1479
- primaryHttpMappingPath: string;
1480
- transformations: {
1481
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
1482
- toREST: (...args: unknown[]) => unknown;
1483
- };
1484
- };
1485
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
1486
- __type: 'service-plugin-definition';
1487
- componentType: string;
1488
- methods: ServicePluginMethodMetadata[];
1489
- __contract: Contract;
1490
- };
1491
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
1492
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
1493
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
1494
-
1495
- type RequestContext = {
1496
- isSSR: boolean;
1497
- host: string;
1498
- protocol?: string;
1499
- };
1500
- type ResponseTransformer = (data: any, headers?: any) => any;
1501
- /**
1502
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
1503
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
1504
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
1505
- */
1506
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
1507
- type AmbassadorRequestOptions<T = any> = {
1508
- _?: T;
1509
- url?: string;
1510
- method?: Method;
1511
- params?: any;
1512
- data?: any;
1513
- transformResponse?: ResponseTransformer | ResponseTransformer[];
1514
- };
1515
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
1516
- __isAmbassador: boolean;
1517
- };
1518
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
1519
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
1520
-
1521
- declare global {
1522
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1523
- interface SymbolConstructor {
1524
- readonly observable: symbol;
1525
- }
1526
- }
1527
-
1528
- declare const emptyObjectSymbol: unique symbol;
1529
-
1530
- /**
1531
- Represents a strictly empty plain object, the `{}` value.
1532
-
1533
- 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)).
1534
-
1535
- @example
1536
- ```
1537
- import type {EmptyObject} from 'type-fest';
1538
-
1539
- // The following illustrates the problem with `{}`.
1540
- const foo1: {} = {}; // Pass
1541
- const foo2: {} = []; // Pass
1542
- const foo3: {} = 42; // Pass
1543
- const foo4: {} = {a: 1}; // Pass
1544
-
1545
- // With `EmptyObject` only the first case is valid.
1546
- const bar1: EmptyObject = {}; // Pass
1547
- const bar2: EmptyObject = 42; // Fail
1548
- const bar3: EmptyObject = []; // Fail
1549
- const bar4: EmptyObject = {a: 1}; // Fail
1550
- ```
1551
-
1552
- 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}.
1553
-
1554
- @category Object
1555
- */
1556
- type EmptyObject = {[emptyObjectSymbol]?: never};
1557
-
1558
- /**
1559
- Returns a boolean for whether the two given types are equal.
1560
-
1561
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
1562
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
1563
-
1564
- Use-cases:
1565
- - If you want to make a conditional branch based on the result of a comparison of two types.
1566
-
1567
- @example
1568
- ```
1569
- import type {IsEqual} from 'type-fest';
1570
-
1571
- // This type returns a boolean for whether the given array includes the given item.
1572
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
1573
- type Includes<Value extends readonly any[], Item> =
1574
- Value extends readonly [Value[0], ...infer rest]
1575
- ? IsEqual<Value[0], Item> extends true
1576
- ? true
1577
- : Includes<rest, Item>
1578
- : false;
1579
- ```
1580
-
1581
- @category Type Guard
1582
- @category Utilities
1583
- */
1584
- type IsEqual<A, B> =
1585
- (<G>() => G extends A ? 1 : 2) extends
1586
- (<G>() => G extends B ? 1 : 2)
1587
- ? true
1588
- : false;
1589
-
1590
- /**
1591
- Filter out keys from an object.
1592
-
1593
- Returns `never` if `Exclude` is strictly equal to `Key`.
1594
- Returns `never` if `Key` extends `Exclude`.
1595
- Returns `Key` otherwise.
1596
-
1597
- @example
1598
- ```
1599
- type Filtered = Filter<'foo', 'foo'>;
1600
- //=> never
1601
- ```
1602
-
1603
- @example
1604
- ```
1605
- type Filtered = Filter<'bar', string>;
1606
- //=> never
1607
- ```
1608
-
1609
- @example
1610
- ```
1611
- type Filtered = Filter<'bar', 'foo'>;
1612
- //=> 'bar'
1613
- ```
1614
-
1615
- @see {Except}
1616
- */
1617
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
1618
-
1619
- type ExceptOptions = {
1620
- /**
1621
- Disallow assigning non-specified properties.
1622
-
1623
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
1624
-
1625
- @default false
1626
- */
1627
- requireExactProps?: boolean;
1628
- };
1629
-
1630
- /**
1631
- Create a type from an object type without certain keys.
1632
-
1633
- We recommend setting the `requireExactProps` option to `true`.
1634
-
1635
- 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.
1636
-
1637
- 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)).
1638
-
1639
- @example
1640
- ```
1641
- import type {Except} from 'type-fest';
1642
-
1643
- type Foo = {
1644
- a: number;
1645
- b: string;
1646
- };
1647
-
1648
- type FooWithoutA = Except<Foo, 'a'>;
1649
- //=> {b: string}
1650
-
1651
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
1652
- //=> errors: 'a' does not exist in type '{ b: string; }'
1653
-
1654
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
1655
- //=> {a: number} & Partial<Record<"b", never>>
1656
-
1657
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
1658
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
1659
- ```
1660
-
1661
- @category Object
1662
- */
1663
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
1664
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
1665
- } & (Options['requireExactProps'] extends true
1666
- ? Partial<Record<KeysType, never>>
1667
- : {});
1668
-
1669
- /**
1670
- Extract the keys from a type where the value type of the key extends the given `Condition`.
1671
-
1672
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
1673
-
1674
- @example
1675
- ```
1676
- import type {ConditionalKeys} from 'type-fest';
1677
-
1678
- interface Example {
1679
- a: string;
1680
- b: string | number;
1681
- c?: string;
1682
- d: {};
974
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
975
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
976
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
977
+ */
978
+ entityEventSequence?: string | null;
1683
979
  }
1684
-
1685
- type StringKeysOnly = ConditionalKeys<Example, string>;
1686
- //=> 'a'
1687
- ```
1688
-
1689
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
1690
-
1691
- @example
1692
- ```
1693
- import type {ConditionalKeys} from 'type-fest';
1694
-
1695
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
1696
- //=> 'a' | 'c'
1697
- ```
1698
-
1699
- @category Object
1700
- */
1701
- type ConditionalKeys<Base, Condition> = NonNullable<
1702
- // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
1703
- {
1704
- // Map through all the keys of the given base type.
1705
- [Key in keyof Base]:
1706
- // Pick only keys with types extending the given `Condition` type.
1707
- Base[Key] extends Condition
1708
- // Retain this key since the condition passes.
1709
- ? Key
1710
- // Discard this key since the condition fails.
1711
- : never;
1712
-
1713
- // Convert the produced object into a union type of the keys which passed the conditional test.
1714
- }[keyof Base]
1715
- >;
1716
-
1717
- /**
1718
- Exclude keys from a shape that matches the given `Condition`.
1719
-
1720
- 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.
1721
-
1722
- @example
1723
- ```
1724
- import type {Primitive, ConditionalExcept} from 'type-fest';
1725
-
1726
- class Awesome {
1727
- name: string;
1728
- successes: number;
1729
- failures: bigint;
1730
-
1731
- run() {}
980
+ interface EchoDispatchedEnvelope {
981
+ data: Dispatched;
982
+ metadata: EventMetadata;
983
+ }
984
+ interface EchoOptions {
985
+ /** 2nd part of the message */
986
+ arg2?: string;
987
+ /** this field test translatable annotation */
988
+ titleField?: string;
989
+ someInt32?: number;
990
+ someDate?: Date | null;
1732
991
  }
1733
992
 
1734
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
1735
- //=> {run: () => void}
1736
- ```
1737
-
1738
- @example
1739
- ```
1740
- import type {ConditionalExcept} from 'type-fest';
1741
-
1742
- interface Example {
1743
- a: string;
1744
- b: string | number;
1745
- c: () => void;
1746
- d: {};
993
+ declare function echo$1(httpClient: HttpClient): EchoSignature;
994
+ interface EchoSignature {
995
+ /**
996
+ * echo given arg1 and arg2
997
+ * @param - 1st part of the message
998
+ * @param - modified comment for arg2 el hovav
999
+ * @returns messge reseult as string
1000
+ */
1001
+ (arg1: string, options?: EchoOptions | undefined): Promise<string>;
1747
1002
  }
1003
+ declare const onEchoDispatched$1: EventDefinition<EchoDispatchedEnvelope, "wix.metroinspector.v1.echo_dispatched">;
1748
1004
 
1749
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
1750
- //=> {b: string | number; c: () => void; d: {}}
1751
- ```
1005
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
1752
1006
 
1753
- @category Object
1754
- */
1755
- type ConditionalExcept<Base, Condition> = Except<
1756
- Base,
1757
- ConditionalKeys<Base, Condition>
1758
- >;
1007
+ declare const echo: MaybeContext<BuildRESTFunction<typeof echo$1> & typeof echo$1>;
1759
1008
 
1009
+ type _publicOnEchoDispatchedType = typeof onEchoDispatched$1;
1760
1010
  /**
1761
- * Descriptors are objects that describe the API of a module, and the module
1762
- * can either be a REST module or a host module.
1763
- * This type is recursive, so it can describe nested modules.
1764
- */
1765
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
1766
- [key: string]: Descriptors | PublicMetadata | any;
1767
- };
1768
- /**
1769
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
1770
- * and returns an object with the same structure, but with all descriptors replaced with their API.
1771
- * Any non-descriptor properties are removed from the returned object, including descriptors that
1772
- * do not match the given host (as they will not work with the given host).
1011
+ * echo event that might be consumed when somone says something!
1773
1012
  */
1774
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
1775
- done: T;
1776
- recurse: T extends {
1777
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
1778
- } ? 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<{
1779
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
1780
- -1,
1781
- 0,
1782
- 1,
1783
- 2,
1784
- 3,
1785
- 4,
1786
- 5
1787
- ][Depth]> : never;
1788
- }, EmptyObject>;
1789
- }[Depth extends -1 ? 'done' : 'recurse'];
1790
- type PublicMetadata = {
1791
- PACKAGE_NAME?: string;
1792
- };
1013
+ declare const onEchoDispatched: ReturnType<typeof createEventModule<_publicOnEchoDispatchedType>>;
1793
1014
 
1794
- declare global {
1795
- interface ContextualClient {
1796
- }
1015
+ type context$1_ActionEvent = ActionEvent;
1016
+ type context$1_BaseEventMetadata = BaseEventMetadata;
1017
+ type context$1_Dispatched = Dispatched;
1018
+ type context$1_DomainEvent = DomainEvent;
1019
+ type context$1_DomainEventBodyOneOf = DomainEventBodyOneOf;
1020
+ type context$1_EchoDispatchedEnvelope = EchoDispatchedEnvelope;
1021
+ type context$1_EchoMessage = EchoMessage;
1022
+ type context$1_EchoOptions = EchoOptions;
1023
+ type context$1_EchoRequest = EchoRequest;
1024
+ type context$1_EchoRequestRequiredFields = EchoRequestRequiredFields;
1025
+ type context$1_EchoResponse = EchoResponse;
1026
+ type context$1_EchoResponseNonNullableFields = EchoResponseNonNullableFields;
1027
+ type context$1_EntityCreatedEvent = EntityCreatedEvent;
1028
+ type context$1_EntityDeletedEvent = EntityDeletedEvent;
1029
+ type context$1_EntityUpdatedEvent = EntityUpdatedEvent;
1030
+ type context$1_EventMetadata = EventMetadata;
1031
+ type context$1_IdentificationData = IdentificationData;
1032
+ type context$1_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
1033
+ type context$1_MessageEnvelope = MessageEnvelope;
1034
+ type context$1_MessageItem = MessageItem;
1035
+ type context$1_RestoreInfo = RestoreInfo;
1036
+ type context$1_WebhookIdentityType = WebhookIdentityType;
1037
+ declare const context$1_WebhookIdentityType: typeof WebhookIdentityType;
1038
+ type context$1__publicOnEchoDispatchedType = _publicOnEchoDispatchedType;
1039
+ declare const context$1_echo: typeof echo;
1040
+ declare const context$1_onEchoDispatched: typeof onEchoDispatched;
1041
+ declare namespace context$1 {
1042
+ export { type context$1_ActionEvent as ActionEvent, type context$1_BaseEventMetadata as BaseEventMetadata, type context$1_Dispatched as Dispatched, type context$1_DomainEvent as DomainEvent, type context$1_DomainEventBodyOneOf as DomainEventBodyOneOf, type context$1_EchoDispatchedEnvelope as EchoDispatchedEnvelope, type context$1_EchoMessage as EchoMessage, type context$1_EchoOptions as EchoOptions, type context$1_EchoRequest as EchoRequest, type context$1_EchoRequestRequiredFields as EchoRequestRequiredFields, type context$1_EchoResponse as EchoResponse, type context$1_EchoResponseNonNullableFields as EchoResponseNonNullableFields, type context$1_EntityCreatedEvent as EntityCreatedEvent, type context$1_EntityDeletedEvent as EntityDeletedEvent, type context$1_EntityUpdatedEvent as EntityUpdatedEvent, type context$1_EventMetadata as EventMetadata, type context$1_IdentificationData as IdentificationData, type context$1_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type context$1_MessageEnvelope as MessageEnvelope, type context$1_MessageItem as MessageItem, type context$1_RestoreInfo as RestoreInfo, context$1_WebhookIdentityType as WebhookIdentityType, type context$1__publicOnEchoDispatchedType as _publicOnEchoDispatchedType, context$1_echo as echo, context$1_onEchoDispatched as onEchoDispatched, onEchoDispatched$1 as publicOnEchoDispatched };
1797
1043
  }
1798
- /**
1799
- * A type used to create concerete types from SDK descriptors in
1800
- * case a contextual client is available.
1801
- */
1802
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
1803
- host: Host;
1804
- } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
1805
1044
 
1806
1045
  /** Physical address */
1807
1046
  interface Address extends AddressStreetOneOf {
@@ -1958,17 +1197,15 @@ interface QueryV2 extends QueryV2PagingMethodOneOf {
1958
1197
  /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */
1959
1198
  cursorPaging?: CursorPaging;
1960
1199
  /**
1961
- * Filter object in the following format:
1962
- * `"filter" : {
1963
- * "fieldName1": "value1",
1964
- * "fieldName2":{"$operator":"value2"}
1965
- * }`
1966
- * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains`
1200
+ * Filter object.
1201
+ *
1202
+ * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).
1967
1203
  */
1968
1204
  filter?: Record<string, any> | null;
1969
1205
  /**
1970
- * Sort object in the following format:
1971
- * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
1206
+ * Sort object.
1207
+ *
1208
+ * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).
1972
1209
  */
1973
1210
  sort?: Sorting[];
1974
1211
  /** Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned. */
@@ -2105,116 +1342,6 @@ interface ResetProductsDbRequest {
2105
1342
  }
2106
1343
  interface ResetProductsDbResponse {
2107
1344
  }
2108
- interface DomainEvent extends DomainEventBodyOneOf {
2109
- createdEvent?: EntityCreatedEvent;
2110
- updatedEvent?: EntityUpdatedEvent;
2111
- deletedEvent?: EntityDeletedEvent;
2112
- actionEvent?: ActionEvent;
2113
- /**
2114
- * Unique event ID.
2115
- * Allows clients to ignore duplicate webhooks.
2116
- */
2117
- _id?: string;
2118
- /**
2119
- * Assumes actions are also always typed to an entity_type
2120
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
2121
- */
2122
- entityFqdn?: string;
2123
- /**
2124
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
2125
- * This is although the created/updated/deleted notion is duplication of the oneof types
2126
- * Example: created/updated/deleted/started/completed/email_opened
2127
- */
2128
- slug?: string;
2129
- /** ID of the entity associated with the event. */
2130
- entityId?: string;
2131
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
2132
- eventTime?: Date;
2133
- /**
2134
- * Whether the event was triggered as a result of a privacy regulation application
2135
- * (for example, GDPR).
2136
- */
2137
- triggeredByAnonymizeRequest?: boolean | null;
2138
- /** If present, indicates the action that triggered the event. */
2139
- originatedFrom?: string | null;
2140
- /**
2141
- * A sequence number defining the order of updates to the underlying entity.
2142
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
2143
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
2144
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
2145
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
2146
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
2147
- */
2148
- entityEventSequence?: string | null;
2149
- }
2150
- /** @oneof */
2151
- interface DomainEventBodyOneOf {
2152
- createdEvent?: EntityCreatedEvent;
2153
- updatedEvent?: EntityUpdatedEvent;
2154
- deletedEvent?: EntityDeletedEvent;
2155
- actionEvent?: ActionEvent;
2156
- }
2157
- interface EntityCreatedEvent {
2158
- entity?: string;
2159
- }
2160
- interface RestoreInfo {
2161
- deletedDate?: Date;
2162
- }
2163
- interface EntityUpdatedEvent {
2164
- /**
2165
- * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
2166
- * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
2167
- * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
2168
- */
2169
- currentEntity?: string;
2170
- }
2171
- interface EntityDeletedEvent {
2172
- /** Entity that was deleted */
2173
- deletedEntity?: string | null;
2174
- }
2175
- interface ActionEvent {
2176
- body?: string;
2177
- }
2178
- interface MessageEnvelope {
2179
- /** App instance ID. */
2180
- instanceId?: string | null;
2181
- /** Event type. */
2182
- eventType?: string;
2183
- /** The identification type and identity data. */
2184
- identity?: IdentificationData;
2185
- /** Stringify payload. */
2186
- data?: string;
2187
- }
2188
- interface IdentificationData extends IdentificationDataIdOneOf {
2189
- /** ID of a site visitor that has not logged in to the site. */
2190
- anonymousVisitorId?: string;
2191
- /** ID of a site visitor that has logged in to the site. */
2192
- memberId?: string;
2193
- /** ID of a Wix user (site owner, contributor, etc.). */
2194
- wixUserId?: string;
2195
- /** ID of an app. */
2196
- appId?: string;
2197
- /** @readonly */
2198
- identityType?: WebhookIdentityType;
2199
- }
2200
- /** @oneof */
2201
- interface IdentificationDataIdOneOf {
2202
- /** ID of a site visitor that has not logged in to the site. */
2203
- anonymousVisitorId?: string;
2204
- /** ID of a site visitor that has logged in to the site. */
2205
- memberId?: string;
2206
- /** ID of a Wix user (site owner, contributor, etc.). */
2207
- wixUserId?: string;
2208
- /** ID of an app. */
2209
- appId?: string;
2210
- }
2211
- declare enum WebhookIdentityType {
2212
- UNKNOWN = "UNKNOWN",
2213
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
2214
- MEMBER = "MEMBER",
2215
- WIX_USER = "WIX_USER",
2216
- APP = "APP"
2217
- }
2218
1345
  interface CreateProductRequestRequiredFields {
2219
1346
  product?: {
2220
1347
  title: string;
@@ -2334,8 +1461,8 @@ interface Product {
2334
1461
  _id: string;
2335
1462
  name: string | null;
2336
1463
  collectionId: string;
2337
- _createdDate: Date;
2338
- modifiedDate: Date;
1464
+ _createdDate: Date | null;
1465
+ modifiedDate: Date | null;
2339
1466
  image: string;
2340
1467
  address: Address;
2341
1468
  document: string;
@@ -2508,7 +1635,6 @@ declare const bulkCreateProducts: MaybeContext<BuildRESTFunction<typeof bulkCrea
2508
1635
  declare const bulkUpdateProducts: MaybeContext<BuildRESTFunction<typeof bulkUpdateProducts$1> & typeof bulkUpdateProducts$1>;
2509
1636
  declare const bulkDeleteProducts: MaybeContext<BuildRESTFunction<typeof bulkDeleteProducts$1> & typeof bulkDeleteProducts$1>;
2510
1637
 
2511
- type context_ActionEvent = ActionEvent;
2512
1638
  type context_Address = Address;
2513
1639
  type context_AddressLocation = AddressLocation;
2514
1640
  type context_AddressStreetOneOf = AddressStreetOneOf;
@@ -2542,11 +1668,6 @@ type context_Cursors = Cursors;
2542
1668
  type context_DeleteProductRequest = DeleteProductRequest;
2543
1669
  type context_DeleteProductRequestRequiredFields = DeleteProductRequestRequiredFields;
2544
1670
  type context_DeleteProductResponse = DeleteProductResponse;
2545
- type context_DomainEvent = DomainEvent;
2546
- type context_DomainEventBodyOneOf = DomainEventBodyOneOf;
2547
- type context_EntityCreatedEvent = EntityCreatedEvent;
2548
- type context_EntityDeletedEvent = EntityDeletedEvent;
2549
- type context_EntityUpdatedEvent = EntityUpdatedEvent;
2550
1671
  type context_GetProductRequest = GetProductRequest;
2551
1672
  type context_GetProductRequestRequiredFields = GetProductRequestRequiredFields;
2552
1673
  type context_GetProductResponse = GetProductResponse;
@@ -2556,13 +1677,10 @@ type context_GetProductsStartWithRequest = GetProductsStartWithRequest;
2556
1677
  type context_GetProductsStartWithRequestRequiredFields = GetProductsStartWithRequestRequiredFields;
2557
1678
  type context_GetProductsStartWithResponse = GetProductsStartWithResponse;
2558
1679
  type context_GetProductsStartWithResponseNonNullableFields = GetProductsStartWithResponseNonNullableFields;
2559
- type context_IdentificationData = IdentificationData;
2560
- type context_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
2561
1680
  type context_ItemMetadata = ItemMetadata;
2562
1681
  type context_LinkRel = LinkRel;
2563
1682
  declare const context_LinkRel: typeof LinkRel;
2564
1683
  type context_MaskedProduct = MaskedProduct;
2565
- type context_MessageEnvelope = MessageEnvelope;
2566
1684
  type context_MyAddress = MyAddress;
2567
1685
  type context_PageLink = PageLink;
2568
1686
  type context_Paging = Paging;
@@ -2579,7 +1697,6 @@ type context_QueryV2 = QueryV2;
2579
1697
  type context_QueryV2PagingMethodOneOf = QueryV2PagingMethodOneOf;
2580
1698
  type context_ResetProductsDbRequest = ResetProductsDbRequest;
2581
1699
  type context_ResetProductsDbResponse = ResetProductsDbResponse;
2582
- type context_RestoreInfo = RestoreInfo;
2583
1700
  type context_SortOrder = SortOrder;
2584
1701
  declare const context_SortOrder: typeof SortOrder;
2585
1702
  type context_Sorting = Sorting;
@@ -2596,8 +1713,6 @@ type context_UpdateProductResponse = UpdateProductResponse;
2596
1713
  type context_UpdateProductResponseNonNullableFields = UpdateProductResponseNonNullableFields;
2597
1714
  type context_Variant = Variant;
2598
1715
  type context_VideoResolution = VideoResolution;
2599
- type context_WebhookIdentityType = WebhookIdentityType;
2600
- declare const context_WebhookIdentityType: typeof WebhookIdentityType;
2601
1716
  declare const context_bulkCreateProducts: typeof bulkCreateProducts;
2602
1717
  declare const context_bulkDeleteProducts: typeof bulkDeleteProducts;
2603
1718
  declare const context_bulkUpdateProducts: typeof bulkUpdateProducts;
@@ -2608,7 +1723,7 @@ declare const context_getProductsStartWith: typeof getProductsStartWith;
2608
1723
  declare const context_queryProducts: typeof queryProducts;
2609
1724
  declare const context_updateProduct: typeof updateProduct;
2610
1725
  declare namespace context {
2611
- export { type context_ActionEvent as ActionEvent, type context_Address as Address, type context_AddressLocation as AddressLocation, type context_AddressStreetOneOf as AddressStreetOneOf, type context_ApplicationError as ApplicationError, type context_BulkActionMetadata as BulkActionMetadata, type context_BulkCreateProductsOptions as BulkCreateProductsOptions, type context_BulkCreateProductsRequest as BulkCreateProductsRequest, type context_BulkCreateProductsRequestRequiredFields as BulkCreateProductsRequestRequiredFields, type context_BulkCreateProductsResponse as BulkCreateProductsResponse, type context_BulkCreateProductsResponseNonNullableFields as BulkCreateProductsResponseNonNullableFields, type context_BulkDeleteProductsRequest as BulkDeleteProductsRequest, type context_BulkDeleteProductsRequestRequiredFields as BulkDeleteProductsRequestRequiredFields, type context_BulkDeleteProductsResponse as BulkDeleteProductsResponse, type context_BulkDeleteProductsResponseBulkProductResult as BulkDeleteProductsResponseBulkProductResult, type context_BulkDeleteProductsResponseNonNullableFields as BulkDeleteProductsResponseNonNullableFields, type context_BulkProductResult as BulkProductResult, type context_BulkUpdateProductsOptions as BulkUpdateProductsOptions, type context_BulkUpdateProductsRequest as BulkUpdateProductsRequest, type context_BulkUpdateProductsRequestRequiredFields as BulkUpdateProductsRequestRequiredFields, type context_BulkUpdateProductsResponse as BulkUpdateProductsResponse, type context_BulkUpdateProductsResponseBulkProductResult as BulkUpdateProductsResponseBulkProductResult, type context_BulkUpdateProductsResponseNonNullableFields as BulkUpdateProductsResponseNonNullableFields, type context_CreateProductOptions as CreateProductOptions, type context_CreateProductOptionsRequiredFields as CreateProductOptionsRequiredFields, type context_CreateProductRequest as CreateProductRequest, type context_CreateProductRequestRequiredFields as CreateProductRequestRequiredFields, type context_CreateProductResponse as CreateProductResponse, type context_CreateProductResponseNonNullableFields as CreateProductResponseNonNullableFields, type context_CursorPaging as CursorPaging, type context_Cursors as Cursors, type context_DeleteProductRequest as DeleteProductRequest, type context_DeleteProductRequestRequiredFields as DeleteProductRequestRequiredFields, type context_DeleteProductResponse as DeleteProductResponse, type context_DomainEvent as DomainEvent, type context_DomainEventBodyOneOf as DomainEventBodyOneOf, type context_EntityCreatedEvent as EntityCreatedEvent, type context_EntityDeletedEvent as EntityDeletedEvent, type context_EntityUpdatedEvent as EntityUpdatedEvent, type context_GetProductRequest as GetProductRequest, type context_GetProductRequestRequiredFields as GetProductRequestRequiredFields, type context_GetProductResponse as GetProductResponse, type context_GetProductResponseNonNullableFields as GetProductResponseNonNullableFields, type context_GetProductsStartWithOptions as GetProductsStartWithOptions, type context_GetProductsStartWithRequest as GetProductsStartWithRequest, type context_GetProductsStartWithRequestRequiredFields as GetProductsStartWithRequestRequiredFields, type context_GetProductsStartWithResponse as GetProductsStartWithResponse, type context_GetProductsStartWithResponseNonNullableFields as GetProductsStartWithResponseNonNullableFields, type context_IdentificationData as IdentificationData, type context_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type context_ItemMetadata as ItemMetadata, context_LinkRel as LinkRel, type context_MaskedProduct as MaskedProduct, type context_MessageEnvelope as MessageEnvelope, type context_MyAddress as MyAddress, type context_PageLink as PageLink, type context_Paging as Paging, type context_PagingMetadataV2 as PagingMetadataV2, type context_Product as Product, type context_ProductNonNullableFields as ProductNonNullableFields, type context_ProductsQueryBuilder as ProductsQueryBuilder, type context_ProductsQueryResult as ProductsQueryResult, type context_QueryProductsOptions as QueryProductsOptions, type context_QueryProductsRequest as QueryProductsRequest, type context_QueryProductsResponse as QueryProductsResponse, type context_QueryProductsResponseNonNullableFields as QueryProductsResponseNonNullableFields, type context_QueryV2 as QueryV2, type context_QueryV2PagingMethodOneOf as QueryV2PagingMethodOneOf, type context_ResetProductsDbRequest as ResetProductsDbRequest, type context_ResetProductsDbResponse as ResetProductsDbResponse, type context_RestoreInfo as RestoreInfo, context_SortOrder as SortOrder, type context_Sorting as Sorting, type context_StandardDetails as StandardDetails, type context_StreetAddress as StreetAddress, type context_Subdivision as Subdivision, context_SubdivisionType as SubdivisionType, type context_UpdateProductOptions as UpdateProductOptions, type context_UpdateProductOptionsRequiredFields as UpdateProductOptionsRequiredFields, type context_UpdateProductRequest as UpdateProductRequest, type context_UpdateProductRequestRequiredFields as UpdateProductRequestRequiredFields, type context_UpdateProductResponse as UpdateProductResponse, type context_UpdateProductResponseNonNullableFields as UpdateProductResponseNonNullableFields, type context_Variant as Variant, type context_VideoResolution as VideoResolution, context_WebhookIdentityType as WebhookIdentityType, context_bulkCreateProducts as bulkCreateProducts, context_bulkDeleteProducts as bulkDeleteProducts, context_bulkUpdateProducts as bulkUpdateProducts, context_createProduct as createProduct, context_deleteProduct as deleteProduct, context_getProduct as getProduct, context_getProductsStartWith as getProductsStartWith, context_queryProducts as queryProducts, context_updateProduct as updateProduct };
1726
+ export { type context_Address as Address, type context_AddressLocation as AddressLocation, type context_AddressStreetOneOf as AddressStreetOneOf, type context_ApplicationError as ApplicationError, type context_BulkActionMetadata as BulkActionMetadata, type context_BulkCreateProductsOptions as BulkCreateProductsOptions, type context_BulkCreateProductsRequest as BulkCreateProductsRequest, type context_BulkCreateProductsRequestRequiredFields as BulkCreateProductsRequestRequiredFields, type context_BulkCreateProductsResponse as BulkCreateProductsResponse, type context_BulkCreateProductsResponseNonNullableFields as BulkCreateProductsResponseNonNullableFields, type context_BulkDeleteProductsRequest as BulkDeleteProductsRequest, type context_BulkDeleteProductsRequestRequiredFields as BulkDeleteProductsRequestRequiredFields, type context_BulkDeleteProductsResponse as BulkDeleteProductsResponse, type context_BulkDeleteProductsResponseBulkProductResult as BulkDeleteProductsResponseBulkProductResult, type context_BulkDeleteProductsResponseNonNullableFields as BulkDeleteProductsResponseNonNullableFields, type context_BulkProductResult as BulkProductResult, type context_BulkUpdateProductsOptions as BulkUpdateProductsOptions, type context_BulkUpdateProductsRequest as BulkUpdateProductsRequest, type context_BulkUpdateProductsRequestRequiredFields as BulkUpdateProductsRequestRequiredFields, type context_BulkUpdateProductsResponse as BulkUpdateProductsResponse, type context_BulkUpdateProductsResponseBulkProductResult as BulkUpdateProductsResponseBulkProductResult, type context_BulkUpdateProductsResponseNonNullableFields as BulkUpdateProductsResponseNonNullableFields, type context_CreateProductOptions as CreateProductOptions, type context_CreateProductOptionsRequiredFields as CreateProductOptionsRequiredFields, type context_CreateProductRequest as CreateProductRequest, type context_CreateProductRequestRequiredFields as CreateProductRequestRequiredFields, type context_CreateProductResponse as CreateProductResponse, type context_CreateProductResponseNonNullableFields as CreateProductResponseNonNullableFields, type context_CursorPaging as CursorPaging, type context_Cursors as Cursors, type context_DeleteProductRequest as DeleteProductRequest, type context_DeleteProductRequestRequiredFields as DeleteProductRequestRequiredFields, type context_DeleteProductResponse as DeleteProductResponse, type context_GetProductRequest as GetProductRequest, type context_GetProductRequestRequiredFields as GetProductRequestRequiredFields, type context_GetProductResponse as GetProductResponse, type context_GetProductResponseNonNullableFields as GetProductResponseNonNullableFields, type context_GetProductsStartWithOptions as GetProductsStartWithOptions, type context_GetProductsStartWithRequest as GetProductsStartWithRequest, type context_GetProductsStartWithRequestRequiredFields as GetProductsStartWithRequestRequiredFields, type context_GetProductsStartWithResponse as GetProductsStartWithResponse, type context_GetProductsStartWithResponseNonNullableFields as GetProductsStartWithResponseNonNullableFields, type context_ItemMetadata as ItemMetadata, context_LinkRel as LinkRel, type context_MaskedProduct as MaskedProduct, type context_MyAddress as MyAddress, type context_PageLink as PageLink, type context_Paging as Paging, type context_PagingMetadataV2 as PagingMetadataV2, type context_Product as Product, type context_ProductNonNullableFields as ProductNonNullableFields, type context_ProductsQueryBuilder as ProductsQueryBuilder, type context_ProductsQueryResult as ProductsQueryResult, type context_QueryProductsOptions as QueryProductsOptions, type context_QueryProductsRequest as QueryProductsRequest, type context_QueryProductsResponse as QueryProductsResponse, type context_QueryProductsResponseNonNullableFields as QueryProductsResponseNonNullableFields, type context_QueryV2 as QueryV2, type context_QueryV2PagingMethodOneOf as QueryV2PagingMethodOneOf, type context_ResetProductsDbRequest as ResetProductsDbRequest, type context_ResetProductsDbResponse as ResetProductsDbResponse, context_SortOrder as SortOrder, type context_Sorting as Sorting, type context_StandardDetails as StandardDetails, type context_StreetAddress as StreetAddress, type context_Subdivision as Subdivision, context_SubdivisionType as SubdivisionType, type context_UpdateProductOptions as UpdateProductOptions, type context_UpdateProductOptionsRequiredFields as UpdateProductOptionsRequiredFields, type context_UpdateProductRequest as UpdateProductRequest, type context_UpdateProductRequestRequiredFields as UpdateProductRequestRequiredFields, type context_UpdateProductResponse as UpdateProductResponse, type context_UpdateProductResponseNonNullableFields as UpdateProductResponseNonNullableFields, type context_Variant as Variant, type context_VideoResolution as VideoResolution, context_bulkCreateProducts as bulkCreateProducts, context_bulkDeleteProducts as bulkDeleteProducts, context_bulkUpdateProducts as bulkUpdateProducts, context_createProduct as createProduct, context_deleteProduct as deleteProduct, context_getProduct as getProduct, context_getProductsStartWith as getProductsStartWith, context_queryProducts as queryProducts, context_updateProduct as updateProduct };
2612
1727
  }
2613
1728
 
2614
1729
  export { context$2 as alarms, context$1 as metroinspector, context as products };