@wix/motion 1.0.52 → 1.0.54

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,33 @@ 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
+ }
498
+ interface AlarmTestRequest {
499
+ }
500
+ interface AlarmTestResponse {
501
+ }
415
502
  interface AlarmRequest {
416
503
  seconds: number;
417
504
  someString?: string;
@@ -419,7 +506,7 @@ interface AlarmRequest {
419
506
  someOtherField?: string;
420
507
  }
421
508
  interface AlarmResponse {
422
- time?: Date;
509
+ time?: Date | null;
423
510
  }
424
511
  interface AlarmTriggered {
425
512
  }
@@ -433,11 +520,11 @@ interface UpdateAlarmRequest {
433
520
  interface UpdateAlarmResponse {
434
521
  alarm?: AlarmMessage;
435
522
  }
436
- interface DomainEvent$2 extends DomainEventBodyOneOf$2 {
437
- createdEvent?: EntityCreatedEvent$2;
438
- updatedEvent?: EntityUpdatedEvent$2;
439
- deletedEvent?: EntityDeletedEvent$2;
440
- actionEvent?: ActionEvent$2;
523
+ interface DomainEvent$1 extends DomainEventBodyOneOf$1 {
524
+ createdEvent?: EntityCreatedEvent$1;
525
+ updatedEvent?: EntityUpdatedEvent$1;
526
+ deletedEvent?: EntityDeletedEvent$1;
527
+ actionEvent?: ActionEvent$1;
441
528
  /**
442
529
  * Unique event ID.
443
530
  * Allows clients to ignore duplicate webhooks.
@@ -457,7 +544,7 @@ interface DomainEvent$2 extends DomainEventBodyOneOf$2 {
457
544
  /** ID of the entity associated with the event. */
458
545
  entityId?: string;
459
546
  /** 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;
547
+ eventTime?: Date | null;
461
548
  /**
462
549
  * Whether the event was triggered as a result of a privacy regulation application
463
550
  * (for example, GDPR).
@@ -476,19 +563,19 @@ interface DomainEvent$2 extends DomainEventBodyOneOf$2 {
476
563
  entityEventSequence?: string | null;
477
564
  }
478
565
  /** @oneof */
479
- interface DomainEventBodyOneOf$2 {
480
- createdEvent?: EntityCreatedEvent$2;
481
- updatedEvent?: EntityUpdatedEvent$2;
482
- deletedEvent?: EntityDeletedEvent$2;
483
- actionEvent?: ActionEvent$2;
566
+ interface DomainEventBodyOneOf$1 {
567
+ createdEvent?: EntityCreatedEvent$1;
568
+ updatedEvent?: EntityUpdatedEvent$1;
569
+ deletedEvent?: EntityDeletedEvent$1;
570
+ actionEvent?: ActionEvent$1;
484
571
  }
485
- interface EntityCreatedEvent$2 {
572
+ interface EntityCreatedEvent$1 {
486
573
  entity?: string;
487
574
  }
488
- interface RestoreInfo$2 {
489
- deletedDate?: Date;
575
+ interface RestoreInfo$1 {
576
+ deletedDate?: Date | null;
490
577
  }
491
- interface EntityUpdatedEvent$2 {
578
+ interface EntityUpdatedEvent$1 {
492
579
  /**
493
580
  * 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
581
  * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
@@ -496,24 +583,24 @@ interface EntityUpdatedEvent$2 {
496
583
  */
497
584
  currentEntity?: string;
498
585
  }
499
- interface EntityDeletedEvent$2 {
586
+ interface EntityDeletedEvent$1 {
500
587
  /** Entity that was deleted */
501
588
  deletedEntity?: string | null;
502
589
  }
503
- interface ActionEvent$2 {
590
+ interface ActionEvent$1 {
504
591
  body?: string;
505
592
  }
506
- interface MessageEnvelope$2 {
593
+ interface MessageEnvelope$1 {
507
594
  /** App instance ID. */
508
595
  instanceId?: string | null;
509
596
  /** Event type. */
510
597
  eventType?: string;
511
598
  /** The identification type and identity data. */
512
- identity?: IdentificationData$2;
599
+ identity?: IdentificationData$1;
513
600
  /** Stringify payload. */
514
601
  data?: string;
515
602
  }
516
- interface IdentificationData$2 extends IdentificationDataIdOneOf$2 {
603
+ interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
517
604
  /** ID of a site visitor that has not logged in to the site. */
518
605
  anonymousVisitorId?: string;
519
606
  /** ID of a site visitor that has logged in to the site. */
@@ -523,10 +610,10 @@ interface IdentificationData$2 extends IdentificationDataIdOneOf$2 {
523
610
  /** ID of an app. */
524
611
  appId?: string;
525
612
  /** @readonly */
526
- identityType?: WebhookIdentityType$2;
613
+ identityType?: WebhookIdentityType$1;
527
614
  }
528
615
  /** @oneof */
529
- interface IdentificationDataIdOneOf$2 {
616
+ interface IdentificationDataIdOneOf$1 {
530
617
  /** ID of a site visitor that has not logged in to the site. */
531
618
  anonymousVisitorId?: string;
532
619
  /** ID of a site visitor that has logged in to the site. */
@@ -536,7 +623,7 @@ interface IdentificationDataIdOneOf$2 {
536
623
  /** ID of an app. */
537
624
  appId?: string;
538
625
  }
539
- declare enum WebhookIdentityType$2 {
626
+ declare enum WebhookIdentityType$1 {
540
627
  UNKNOWN = "UNKNOWN",
541
628
  ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
542
629
  MEMBER = "MEMBER",
@@ -564,7 +651,7 @@ interface BaseEventMetadata$1 {
564
651
  /** Event type. */
565
652
  eventType?: string;
566
653
  /** The identification type and identity data. */
567
- identity?: IdentificationData$2;
654
+ identity?: IdentificationData$1;
568
655
  }
569
656
  interface EventMetadata$1 extends BaseEventMetadata$1 {
570
657
  /**
@@ -586,7 +673,7 @@ interface EventMetadata$1 extends BaseEventMetadata$1 {
586
673
  /** ID of the entity associated with the event. */
587
674
  entityId?: string;
588
675
  /** 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;
676
+ eventTime?: Date | null;
590
677
  /**
591
678
  * Whether the event was triggered as a result of a privacy regulation application
592
679
  * (for example, GDPR).
@@ -626,46 +713,28 @@ interface UpdateAlarm {
626
713
  seconds?: number;
627
714
  }
628
715
 
629
- declare function alarm$1(httpClient: HttpClient$2): AlarmSignature;
716
+ declare function alarm$1(httpClient: HttpClient): AlarmSignature;
630
717
  interface AlarmSignature {
631
718
  /**
632
719
  * sets up an alarm after {seconds}
633
720
  */
634
721
  (seconds: number, options?: AlarmOptions | undefined): Promise<AlarmResponse>;
635
722
  }
636
- declare function updateAlarm$1(httpClient: HttpClient$2): UpdateAlarmSignature;
723
+ declare function updateAlarm$1(httpClient: HttpClient): UpdateAlarmSignature;
637
724
  interface UpdateAlarmSignature {
638
725
  /**
639
726
  * sets up an existing alarm with id {id}
640
727
  */
641
728
  (_id: string, alarm: UpdateAlarm): Promise<UpdateAlarmResponse & UpdateAlarmResponseNonNullableFields>;
642
729
  }
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
- }
730
+ declare const onAlarmTriggered$1: EventDefinition<AlarmTriggeredEnvelope, "wix.alarm.v1.alarm_alarm_triggered">;
731
+ declare const onAlarmSnoozed$1: EventDefinition<AlarmSnoozedEnvelope, "wix.alarm.v1.alarm_alarm_snoozed">;
732
+ declare const onAlarmDeleted$1: EventDefinition<AlarmDeletedEnvelope, "wix.alarm.v1.alarm_alarm_deleted">;
664
733
 
665
- declare function createEventModule$1<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
734
+ declare function createEventModule$1<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
666
735
 
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>;
736
+ declare const alarm: MaybeContext<BuildRESTFunction<typeof alarm$1> & typeof alarm$1>;
737
+ declare const updateAlarm: MaybeContext<BuildRESTFunction<typeof updateAlarm$1> & typeof updateAlarm$1>;
669
738
 
670
739
  type _publicOnAlarmTriggeredType = typeof onAlarmTriggered$1;
671
740
  /**
@@ -694,6 +763,8 @@ type index_d$2_AlarmRequestRequiredFields = AlarmRequestRequiredFields;
694
763
  type index_d$2_AlarmResponse = AlarmResponse;
695
764
  type index_d$2_AlarmSnoozed = AlarmSnoozed;
696
765
  type index_d$2_AlarmSnoozedEnvelope = AlarmSnoozedEnvelope;
766
+ type index_d$2_AlarmTestRequest = AlarmTestRequest;
767
+ type index_d$2_AlarmTestResponse = AlarmTestResponse;
697
768
  type index_d$2_AlarmTriggered = AlarmTriggered;
698
769
  type index_d$2_AlarmTriggeredEnvelope = AlarmTriggeredEnvelope;
699
770
  type index_d$2_UpdateAlarm = UpdateAlarm;
@@ -710,499 +781,89 @@ declare const index_d$2_onAlarmSnoozed: typeof onAlarmSnoozed;
710
781
  declare const index_d$2_onAlarmTriggered: typeof onAlarmTriggered;
711
782
  declare const index_d$2_updateAlarm: typeof updateAlarm;
712
783
  declare namespace index_d$2 {
713
- export { type ActionEvent$2 as ActionEvent, type index_d$2_AlarmDeleted as AlarmDeleted, type index_d$2_AlarmDeletedEnvelope as AlarmDeletedEnvelope, type index_d$2_AlarmMessage as AlarmMessage, type index_d$2_AlarmOptions as AlarmOptions, type index_d$2_AlarmRequest as AlarmRequest, type index_d$2_AlarmRequestRequiredFields as AlarmRequestRequiredFields, type index_d$2_AlarmResponse as AlarmResponse, type index_d$2_AlarmSnoozed as AlarmSnoozed, type index_d$2_AlarmSnoozedEnvelope as AlarmSnoozedEnvelope, type index_d$2_AlarmTriggered as AlarmTriggered, type index_d$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 index_d$2_UpdateAlarm as UpdateAlarm, type index_d$2_UpdateAlarmRequest as UpdateAlarmRequest, type index_d$2_UpdateAlarmRequestRequiredFields as UpdateAlarmRequestRequiredFields, type index_d$2_UpdateAlarmResponse as UpdateAlarmResponse, type index_d$2_UpdateAlarmResponseNonNullableFields as UpdateAlarmResponseNonNullableFields, WebhookIdentityType$2 as WebhookIdentityType, type index_d$2__publicOnAlarmDeletedType as _publicOnAlarmDeletedType, type index_d$2__publicOnAlarmSnoozedType as _publicOnAlarmSnoozedType, type index_d$2__publicOnAlarmTriggeredType as _publicOnAlarmTriggeredType, index_d$2_alarm as alarm, index_d$2_onAlarmDeleted as onAlarmDeleted, index_d$2_onAlarmSnoozed as onAlarmSnoozed, index_d$2_onAlarmTriggered as onAlarmTriggered, onAlarmDeleted$1 as publicOnAlarmDeleted, onAlarmSnoozed$1 as publicOnAlarmSnoozed, onAlarmTriggered$1 as publicOnAlarmTriggered, index_d$2_updateAlarm as updateAlarm };
784
+ export { type ActionEvent$1 as ActionEvent, type index_d$2_AlarmDeleted as AlarmDeleted, type index_d$2_AlarmDeletedEnvelope as AlarmDeletedEnvelope, type index_d$2_AlarmMessage as AlarmMessage, type index_d$2_AlarmOptions as AlarmOptions, type index_d$2_AlarmRequest as AlarmRequest, type index_d$2_AlarmRequestRequiredFields as AlarmRequestRequiredFields, type index_d$2_AlarmResponse as AlarmResponse, type index_d$2_AlarmSnoozed as AlarmSnoozed, type index_d$2_AlarmSnoozedEnvelope as AlarmSnoozedEnvelope, type index_d$2_AlarmTestRequest as AlarmTestRequest, type index_d$2_AlarmTestResponse as AlarmTestResponse, type index_d$2_AlarmTriggered as AlarmTriggered, type index_d$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 index_d$2_UpdateAlarm as UpdateAlarm, type index_d$2_UpdateAlarmRequest as UpdateAlarmRequest, type index_d$2_UpdateAlarmRequestRequiredFields as UpdateAlarmRequestRequiredFields, type index_d$2_UpdateAlarmResponse as UpdateAlarmResponse, type index_d$2_UpdateAlarmResponseNonNullableFields as UpdateAlarmResponseNonNullableFields, WebhookIdentityType$1 as WebhookIdentityType, type index_d$2__publicOnAlarmDeletedType as _publicOnAlarmDeletedType, type index_d$2__publicOnAlarmSnoozedType as _publicOnAlarmSnoozedType, type index_d$2__publicOnAlarmTriggeredType as _publicOnAlarmTriggeredType, index_d$2_alarm as alarm, index_d$2_onAlarmDeleted as onAlarmDeleted, index_d$2_onAlarmSnoozed as onAlarmSnoozed, index_d$2_onAlarmTriggered as onAlarmTriggered, onAlarmDeleted$1 as publicOnAlarmDeleted, onAlarmSnoozed$1 as publicOnAlarmSnoozed, onAlarmTriggered$1 as publicOnAlarmTriggered, index_d$2_updateAlarm as updateAlarm };
714
785
  }
715
786
 
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;
787
+ interface MessageItem {
788
+ /** inner_message comment from EchoMessage proto def */
789
+ innerMessage?: string;
790
+ }
791
+ interface EchoRequest {
792
+ /** 1st part of the message */
793
+ arg1: string;
794
+ /** 2nd part of the message */
795
+ arg2?: string;
796
+ /** this field test translatable annotation */
797
+ titleField?: string;
798
+ someInt32?: number;
799
+ someDate?: Date | null;
800
+ }
801
+ interface EchoResponse {
802
+ /** message result as EchoMessage */
803
+ echoMessage?: EchoMessage;
804
+ /** messge reseult as string */
805
+ message?: string;
806
+ }
807
+ interface Dispatched {
808
+ /** the message someone says */
809
+ echo?: EchoMessage;
810
+ }
811
+ interface DomainEvent extends DomainEventBodyOneOf {
812
+ createdEvent?: EntityCreatedEvent;
813
+ updatedEvent?: EntityUpdatedEvent;
814
+ deletedEvent?: EntityDeletedEvent;
815
+ actionEvent?: ActionEvent;
730
816
  /**
731
- * Optional bast url to use for API requests, for example `www.wixapis.com`
817
+ * Unique event ID.
818
+ * Allows clients to ignore duplicate webhooks.
732
819
  */
733
- apiBaseUrl?: string;
820
+ _id?: string;
734
821
  /**
735
- * Possible data to be provided by every host, for cross cutting concerns
736
- * like internationalization, billing, etc.
822
+ * Assumes actions are also always typed to an entity_type
823
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
737
824
  */
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
825
  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
- }
826
+ /**
827
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
828
+ * This is although the created/updated/deleted notion is duplication of the oneof types
829
+ * Example: created/updated/deleted/started/completed/email_opened
830
+ */
831
+ slug?: string;
832
+ /** ID of the entity associated with the event. */
833
+ entityId?: string;
834
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
835
+ eventTime?: Date | null;
836
+ /**
837
+ * Whether the event was triggered as a result of a privacy regulation application
838
+ * (for example, GDPR).
839
+ */
840
+ triggeredByAnonymizeRequest?: boolean | null;
841
+ /** If present, indicates the action that triggered the event. */
842
+ originatedFrom?: string | null;
843
+ /**
844
+ * A sequence number defining the order of updates to the underlying entity.
845
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
846
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
847
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
848
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
849
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
850
+ */
851
+ entityEventSequence?: string | null;
846
852
  }
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: {};
853
+ /** @oneof */
854
+ interface DomainEventBodyOneOf {
855
+ createdEvent?: EntityCreatedEvent;
856
+ updatedEvent?: EntityUpdatedEvent;
857
+ deletedEvent?: EntityDeletedEvent;
858
+ actionEvent?: ActionEvent;
1003
859
  }
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() {}
860
+ interface EntityCreatedEvent {
861
+ entity?: string;
1052
862
  }
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: {};
863
+ interface RestoreInfo {
864
+ deletedDate?: Date | null;
1067
865
  }
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 {
866
+ interface EntityUpdatedEvent {
1206
867
  /**
1207
868
  * 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
869
  * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
@@ -1210,24 +871,24 @@ interface EntityUpdatedEvent$1 {
1210
871
  */
1211
872
  currentEntity?: string;
1212
873
  }
1213
- interface EntityDeletedEvent$1 {
874
+ interface EntityDeletedEvent {
1214
875
  /** Entity that was deleted */
1215
876
  deletedEntity?: string | null;
1216
877
  }
1217
- interface ActionEvent$1 {
878
+ interface ActionEvent {
1218
879
  body?: string;
1219
880
  }
1220
- interface MessageEnvelope$1 {
881
+ interface MessageEnvelope {
1221
882
  /** App instance ID. */
1222
883
  instanceId?: string | null;
1223
884
  /** Event type. */
1224
885
  eventType?: string;
1225
886
  /** The identification type and identity data. */
1226
- identity?: IdentificationData$1;
887
+ identity?: IdentificationData;
1227
888
  /** Stringify payload. */
1228
889
  data?: string;
1229
890
  }
1230
- interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
891
+ interface IdentificationData extends IdentificationDataIdOneOf {
1231
892
  /** ID of a site visitor that has not logged in to the site. */
1232
893
  anonymousVisitorId?: string;
1233
894
  /** ID of a site visitor that has logged in to the site. */
@@ -1237,10 +898,10 @@ interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
1237
898
  /** ID of an app. */
1238
899
  appId?: string;
1239
900
  /** @readonly */
1240
- identityType?: WebhookIdentityType$1;
901
+ identityType?: WebhookIdentityType;
1241
902
  }
1242
903
  /** @oneof */
1243
- interface IdentificationDataIdOneOf$1 {
904
+ interface IdentificationDataIdOneOf {
1244
905
  /** ID of a site visitor that has not logged in to the site. */
1245
906
  anonymousVisitorId?: string;
1246
907
  /** ID of a site visitor that has logged in to the site. */
@@ -1250,7 +911,7 @@ interface IdentificationDataIdOneOf$1 {
1250
911
  /** ID of an app. */
1251
912
  appId?: string;
1252
913
  }
1253
- declare enum WebhookIdentityType$1 {
914
+ declare enum WebhookIdentityType {
1254
915
  UNKNOWN = "UNKNOWN",
1255
916
  ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1256
917
  MEMBER = "MEMBER",
@@ -1282,7 +943,7 @@ interface BaseEventMetadata {
1282
943
  /** Event type. */
1283
944
  eventType?: string;
1284
945
  /** The identification type and identity data. */
1285
- identity?: IdentificationData$1;
946
+ identity?: IdentificationData;
1286
947
  }
1287
948
  interface EventMetadata extends BaseEventMetadata {
1288
949
  /**
@@ -1304,7 +965,7 @@ interface EventMetadata extends BaseEventMetadata {
1304
965
  /** ID of the entity associated with the event. */
1305
966
  entityId?: string;
1306
967
  /** 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;
968
+ eventTime?: Date | null;
1308
969
  /**
1309
970
  * Whether the event was triggered as a result of a privacy regulation application
1310
971
  * (for example, GDPR).
@@ -1316,492 +977,76 @@ interface EventMetadata extends BaseEventMetadata {
1316
977
  * A sequence number defining the order of updates to the underlying entity.
1317
978
  * For example, given that some entity was updated at 16:00 and than again at 16:01,
1318
979
  * 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 index_d$1_BaseEventMetadata = BaseEventMetadata;
1379
- type index_d$1_Dispatched = Dispatched;
1380
- type index_d$1_EchoDispatchedEnvelope = EchoDispatchedEnvelope;
1381
- type index_d$1_EchoMessage = EchoMessage;
1382
- type index_d$1_EchoOptions = EchoOptions;
1383
- type index_d$1_EchoRequest = EchoRequest;
1384
- type index_d$1_EchoRequestRequiredFields = EchoRequestRequiredFields;
1385
- type index_d$1_EchoResponse = EchoResponse;
1386
- type index_d$1_EchoResponseNonNullableFields = EchoResponseNonNullableFields;
1387
- type index_d$1_EventMetadata = EventMetadata;
1388
- type index_d$1_MessageItem = MessageItem;
1389
- type index_d$1__publicOnEchoDispatchedType = _publicOnEchoDispatchedType;
1390
- declare const index_d$1_echo: typeof echo;
1391
- declare const index_d$1_onEchoDispatched: typeof onEchoDispatched;
1392
- declare namespace index_d$1 {
1393
- export { type ActionEvent$1 as ActionEvent, type index_d$1_BaseEventMetadata as BaseEventMetadata, type index_d$1_Dispatched as Dispatched, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type index_d$1_EchoDispatchedEnvelope as EchoDispatchedEnvelope, type index_d$1_EchoMessage as EchoMessage, type index_d$1_EchoOptions as EchoOptions, type index_d$1_EchoRequest as EchoRequest, type index_d$1_EchoRequestRequiredFields as EchoRequestRequiredFields, type index_d$1_EchoResponse as EchoResponse, type index_d$1_EchoResponseNonNullableFields as EchoResponseNonNullableFields, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type index_d$1_EventMetadata as EventMetadata, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type MessageEnvelope$1 as MessageEnvelope, type index_d$1_MessageItem as MessageItem, type RestoreInfo$1 as RestoreInfo, WebhookIdentityType$1 as WebhookIdentityType, type index_d$1__publicOnEchoDispatchedType as _publicOnEchoDispatchedType, index_d$1_echo as echo, index_d$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: {};
980
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
981
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
982
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
983
+ */
984
+ entityEventSequence?: string | null;
1683
985
  }
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() {}
986
+ interface EchoDispatchedEnvelope {
987
+ data: Dispatched;
988
+ metadata: EventMetadata;
989
+ }
990
+ interface EchoOptions {
991
+ /** 2nd part of the message */
992
+ arg2?: string;
993
+ /** this field test translatable annotation */
994
+ titleField?: string;
995
+ someInt32?: number;
996
+ someDate?: Date | null;
1732
997
  }
1733
998
 
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: {};
999
+ declare function echo$1(httpClient: HttpClient): EchoSignature;
1000
+ interface EchoSignature {
1001
+ /**
1002
+ * echo given arg1 and arg2
1003
+ * @param - 1st part of the message
1004
+ * @param - modified comment for arg2 el hovav
1005
+ * @returns messge reseult as string
1006
+ */
1007
+ (arg1: string, options?: EchoOptions | undefined): Promise<string>;
1747
1008
  }
1009
+ declare const onEchoDispatched$1: EventDefinition<EchoDispatchedEnvelope, "wix.metroinspector.v1.echo_dispatched">;
1748
1010
 
1749
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
1750
- //=> {b: string | number; c: () => void; d: {}}
1751
- ```
1011
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
1752
1012
 
1753
- @category Object
1754
- */
1755
- type ConditionalExcept<Base, Condition> = Except<
1756
- Base,
1757
- ConditionalKeys<Base, Condition>
1758
- >;
1013
+ declare const echo: MaybeContext<BuildRESTFunction<typeof echo$1> & typeof echo$1>;
1759
1014
 
1015
+ type _publicOnEchoDispatchedType = typeof onEchoDispatched$1;
1760
1016
  /**
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).
1017
+ * echo event that might be consumed when somone says something!
1773
1018
  */
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
- };
1019
+ declare const onEchoDispatched: ReturnType<typeof createEventModule<_publicOnEchoDispatchedType>>;
1793
1020
 
1794
- declare global {
1795
- interface ContextualClient {
1796
- }
1021
+ type index_d$1_ActionEvent = ActionEvent;
1022
+ type index_d$1_BaseEventMetadata = BaseEventMetadata;
1023
+ type index_d$1_Dispatched = Dispatched;
1024
+ type index_d$1_DomainEvent = DomainEvent;
1025
+ type index_d$1_DomainEventBodyOneOf = DomainEventBodyOneOf;
1026
+ type index_d$1_EchoDispatchedEnvelope = EchoDispatchedEnvelope;
1027
+ type index_d$1_EchoMessage = EchoMessage;
1028
+ type index_d$1_EchoOptions = EchoOptions;
1029
+ type index_d$1_EchoRequest = EchoRequest;
1030
+ type index_d$1_EchoRequestRequiredFields = EchoRequestRequiredFields;
1031
+ type index_d$1_EchoResponse = EchoResponse;
1032
+ type index_d$1_EchoResponseNonNullableFields = EchoResponseNonNullableFields;
1033
+ type index_d$1_EntityCreatedEvent = EntityCreatedEvent;
1034
+ type index_d$1_EntityDeletedEvent = EntityDeletedEvent;
1035
+ type index_d$1_EntityUpdatedEvent = EntityUpdatedEvent;
1036
+ type index_d$1_EventMetadata = EventMetadata;
1037
+ type index_d$1_IdentificationData = IdentificationData;
1038
+ type index_d$1_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
1039
+ type index_d$1_MessageEnvelope = MessageEnvelope;
1040
+ type index_d$1_MessageItem = MessageItem;
1041
+ type index_d$1_RestoreInfo = RestoreInfo;
1042
+ type index_d$1_WebhookIdentityType = WebhookIdentityType;
1043
+ declare const index_d$1_WebhookIdentityType: typeof WebhookIdentityType;
1044
+ type index_d$1__publicOnEchoDispatchedType = _publicOnEchoDispatchedType;
1045
+ declare const index_d$1_echo: typeof echo;
1046
+ declare const index_d$1_onEchoDispatched: typeof onEchoDispatched;
1047
+ declare namespace index_d$1 {
1048
+ export { type index_d$1_ActionEvent as ActionEvent, type index_d$1_BaseEventMetadata as BaseEventMetadata, type index_d$1_Dispatched as Dispatched, type index_d$1_DomainEvent as DomainEvent, type index_d$1_DomainEventBodyOneOf as DomainEventBodyOneOf, type index_d$1_EchoDispatchedEnvelope as EchoDispatchedEnvelope, type index_d$1_EchoMessage as EchoMessage, type index_d$1_EchoOptions as EchoOptions, type index_d$1_EchoRequest as EchoRequest, type index_d$1_EchoRequestRequiredFields as EchoRequestRequiredFields, type index_d$1_EchoResponse as EchoResponse, type index_d$1_EchoResponseNonNullableFields as EchoResponseNonNullableFields, type index_d$1_EntityCreatedEvent as EntityCreatedEvent, type index_d$1_EntityDeletedEvent as EntityDeletedEvent, type index_d$1_EntityUpdatedEvent as EntityUpdatedEvent, type index_d$1_EventMetadata as EventMetadata, type index_d$1_IdentificationData as IdentificationData, type index_d$1_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type index_d$1_MessageEnvelope as MessageEnvelope, type index_d$1_MessageItem as MessageItem, type index_d$1_RestoreInfo as RestoreInfo, index_d$1_WebhookIdentityType as WebhookIdentityType, type index_d$1__publicOnEchoDispatchedType as _publicOnEchoDispatchedType, index_d$1_echo as echo, index_d$1_onEchoDispatched as onEchoDispatched, onEchoDispatched$1 as publicOnEchoDispatched };
1797
1049
  }
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
1050
 
1806
1051
  /** Physical address */
1807
1052
  interface Address extends AddressStreetOneOf {
@@ -1958,17 +1203,15 @@ interface QueryV2 extends QueryV2PagingMethodOneOf {
1958
1203
  /** 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
1204
  cursorPaging?: CursorPaging;
1960
1205
  /**
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`
1206
+ * Filter object.
1207
+ *
1208
+ * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section).
1967
1209
  */
1968
1210
  filter?: Record<string, any> | null;
1969
1211
  /**
1970
- * Sort object in the following format:
1971
- * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]`
1212
+ * Sort object.
1213
+ *
1214
+ * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section).
1972
1215
  */
1973
1216
  sort?: Sorting[];
1974
1217
  /** 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 +1348,6 @@ interface ResetProductsDbRequest {
2105
1348
  }
2106
1349
  interface ResetProductsDbResponse {
2107
1350
  }
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
1351
  interface CreateProductRequestRequiredFields {
2219
1352
  product?: {
2220
1353
  title: string;
@@ -2334,8 +1467,8 @@ interface Product {
2334
1467
  _id: string;
2335
1468
  name: string | null;
2336
1469
  collectionId: string;
2337
- _createdDate: Date;
2338
- modifiedDate: Date;
1470
+ _createdDate: Date | null;
1471
+ modifiedDate: Date | null;
2339
1472
  image: string;
2340
1473
  address: Address;
2341
1474
  document: string;
@@ -2508,7 +1641,6 @@ declare const bulkCreateProducts: MaybeContext<BuildRESTFunction<typeof bulkCrea
2508
1641
  declare const bulkUpdateProducts: MaybeContext<BuildRESTFunction<typeof bulkUpdateProducts$1> & typeof bulkUpdateProducts$1>;
2509
1642
  declare const bulkDeleteProducts: MaybeContext<BuildRESTFunction<typeof bulkDeleteProducts$1> & typeof bulkDeleteProducts$1>;
2510
1643
 
2511
- type index_d_ActionEvent = ActionEvent;
2512
1644
  type index_d_Address = Address;
2513
1645
  type index_d_AddressLocation = AddressLocation;
2514
1646
  type index_d_AddressStreetOneOf = AddressStreetOneOf;
@@ -2542,11 +1674,6 @@ type index_d_Cursors = Cursors;
2542
1674
  type index_d_DeleteProductRequest = DeleteProductRequest;
2543
1675
  type index_d_DeleteProductRequestRequiredFields = DeleteProductRequestRequiredFields;
2544
1676
  type index_d_DeleteProductResponse = DeleteProductResponse;
2545
- type index_d_DomainEvent = DomainEvent;
2546
- type index_d_DomainEventBodyOneOf = DomainEventBodyOneOf;
2547
- type index_d_EntityCreatedEvent = EntityCreatedEvent;
2548
- type index_d_EntityDeletedEvent = EntityDeletedEvent;
2549
- type index_d_EntityUpdatedEvent = EntityUpdatedEvent;
2550
1677
  type index_d_GetProductRequest = GetProductRequest;
2551
1678
  type index_d_GetProductRequestRequiredFields = GetProductRequestRequiredFields;
2552
1679
  type index_d_GetProductResponse = GetProductResponse;
@@ -2556,13 +1683,10 @@ type index_d_GetProductsStartWithRequest = GetProductsStartWithRequest;
2556
1683
  type index_d_GetProductsStartWithRequestRequiredFields = GetProductsStartWithRequestRequiredFields;
2557
1684
  type index_d_GetProductsStartWithResponse = GetProductsStartWithResponse;
2558
1685
  type index_d_GetProductsStartWithResponseNonNullableFields = GetProductsStartWithResponseNonNullableFields;
2559
- type index_d_IdentificationData = IdentificationData;
2560
- type index_d_IdentificationDataIdOneOf = IdentificationDataIdOneOf;
2561
1686
  type index_d_ItemMetadata = ItemMetadata;
2562
1687
  type index_d_LinkRel = LinkRel;
2563
1688
  declare const index_d_LinkRel: typeof LinkRel;
2564
1689
  type index_d_MaskedProduct = MaskedProduct;
2565
- type index_d_MessageEnvelope = MessageEnvelope;
2566
1690
  type index_d_MyAddress = MyAddress;
2567
1691
  type index_d_PageLink = PageLink;
2568
1692
  type index_d_Paging = Paging;
@@ -2579,7 +1703,6 @@ type index_d_QueryV2 = QueryV2;
2579
1703
  type index_d_QueryV2PagingMethodOneOf = QueryV2PagingMethodOneOf;
2580
1704
  type index_d_ResetProductsDbRequest = ResetProductsDbRequest;
2581
1705
  type index_d_ResetProductsDbResponse = ResetProductsDbResponse;
2582
- type index_d_RestoreInfo = RestoreInfo;
2583
1706
  type index_d_SortOrder = SortOrder;
2584
1707
  declare const index_d_SortOrder: typeof SortOrder;
2585
1708
  type index_d_Sorting = Sorting;
@@ -2596,8 +1719,6 @@ type index_d_UpdateProductResponse = UpdateProductResponse;
2596
1719
  type index_d_UpdateProductResponseNonNullableFields = UpdateProductResponseNonNullableFields;
2597
1720
  type index_d_Variant = Variant;
2598
1721
  type index_d_VideoResolution = VideoResolution;
2599
- type index_d_WebhookIdentityType = WebhookIdentityType;
2600
- declare const index_d_WebhookIdentityType: typeof WebhookIdentityType;
2601
1722
  declare const index_d_bulkCreateProducts: typeof bulkCreateProducts;
2602
1723
  declare const index_d_bulkDeleteProducts: typeof bulkDeleteProducts;
2603
1724
  declare const index_d_bulkUpdateProducts: typeof bulkUpdateProducts;
@@ -2608,7 +1729,7 @@ declare const index_d_getProductsStartWith: typeof getProductsStartWith;
2608
1729
  declare const index_d_queryProducts: typeof queryProducts;
2609
1730
  declare const index_d_updateProduct: typeof updateProduct;
2610
1731
  declare namespace index_d {
2611
- export { type index_d_ActionEvent as ActionEvent, type index_d_Address as Address, type index_d_AddressLocation as AddressLocation, type index_d_AddressStreetOneOf as AddressStreetOneOf, type index_d_ApplicationError as ApplicationError, type index_d_BulkActionMetadata as BulkActionMetadata, type index_d_BulkCreateProductsOptions as BulkCreateProductsOptions, type index_d_BulkCreateProductsRequest as BulkCreateProductsRequest, type index_d_BulkCreateProductsRequestRequiredFields as BulkCreateProductsRequestRequiredFields, type index_d_BulkCreateProductsResponse as BulkCreateProductsResponse, type index_d_BulkCreateProductsResponseNonNullableFields as BulkCreateProductsResponseNonNullableFields, type index_d_BulkDeleteProductsRequest as BulkDeleteProductsRequest, type index_d_BulkDeleteProductsRequestRequiredFields as BulkDeleteProductsRequestRequiredFields, type index_d_BulkDeleteProductsResponse as BulkDeleteProductsResponse, type index_d_BulkDeleteProductsResponseBulkProductResult as BulkDeleteProductsResponseBulkProductResult, type index_d_BulkDeleteProductsResponseNonNullableFields as BulkDeleteProductsResponseNonNullableFields, type index_d_BulkProductResult as BulkProductResult, type index_d_BulkUpdateProductsOptions as BulkUpdateProductsOptions, type index_d_BulkUpdateProductsRequest as BulkUpdateProductsRequest, type index_d_BulkUpdateProductsRequestRequiredFields as BulkUpdateProductsRequestRequiredFields, type index_d_BulkUpdateProductsResponse as BulkUpdateProductsResponse, type index_d_BulkUpdateProductsResponseBulkProductResult as BulkUpdateProductsResponseBulkProductResult, type index_d_BulkUpdateProductsResponseNonNullableFields as BulkUpdateProductsResponseNonNullableFields, type index_d_CreateProductOptions as CreateProductOptions, type index_d_CreateProductOptionsRequiredFields as CreateProductOptionsRequiredFields, type index_d_CreateProductRequest as CreateProductRequest, type index_d_CreateProductRequestRequiredFields as CreateProductRequestRequiredFields, type index_d_CreateProductResponse as CreateProductResponse, type index_d_CreateProductResponseNonNullableFields as CreateProductResponseNonNullableFields, type index_d_CursorPaging as CursorPaging, type index_d_Cursors as Cursors, type index_d_DeleteProductRequest as DeleteProductRequest, type index_d_DeleteProductRequestRequiredFields as DeleteProductRequestRequiredFields, type index_d_DeleteProductResponse as DeleteProductResponse, type index_d_DomainEvent as DomainEvent, type index_d_DomainEventBodyOneOf as DomainEventBodyOneOf, type index_d_EntityCreatedEvent as EntityCreatedEvent, type index_d_EntityDeletedEvent as EntityDeletedEvent, type index_d_EntityUpdatedEvent as EntityUpdatedEvent, type index_d_GetProductRequest as GetProductRequest, type index_d_GetProductRequestRequiredFields as GetProductRequestRequiredFields, type index_d_GetProductResponse as GetProductResponse, type index_d_GetProductResponseNonNullableFields as GetProductResponseNonNullableFields, type index_d_GetProductsStartWithOptions as GetProductsStartWithOptions, type index_d_GetProductsStartWithRequest as GetProductsStartWithRequest, type index_d_GetProductsStartWithRequestRequiredFields as GetProductsStartWithRequestRequiredFields, type index_d_GetProductsStartWithResponse as GetProductsStartWithResponse, type index_d_GetProductsStartWithResponseNonNullableFields as GetProductsStartWithResponseNonNullableFields, type index_d_IdentificationData as IdentificationData, type index_d_IdentificationDataIdOneOf as IdentificationDataIdOneOf, type index_d_ItemMetadata as ItemMetadata, index_d_LinkRel as LinkRel, type index_d_MaskedProduct as MaskedProduct, type index_d_MessageEnvelope as MessageEnvelope, type index_d_MyAddress as MyAddress, type index_d_PageLink as PageLink, type index_d_Paging as Paging, type index_d_PagingMetadataV2 as PagingMetadataV2, type index_d_Product as Product, type index_d_ProductNonNullableFields as ProductNonNullableFields, type index_d_ProductsQueryBuilder as ProductsQueryBuilder, type index_d_ProductsQueryResult as ProductsQueryResult, type index_d_QueryProductsOptions as QueryProductsOptions, type index_d_QueryProductsRequest as QueryProductsRequest, type index_d_QueryProductsResponse as QueryProductsResponse, type index_d_QueryProductsResponseNonNullableFields as QueryProductsResponseNonNullableFields, type index_d_QueryV2 as QueryV2, type index_d_QueryV2PagingMethodOneOf as QueryV2PagingMethodOneOf, type index_d_ResetProductsDbRequest as ResetProductsDbRequest, type index_d_ResetProductsDbResponse as ResetProductsDbResponse, type index_d_RestoreInfo as RestoreInfo, index_d_SortOrder as SortOrder, type index_d_Sorting as Sorting, type index_d_StandardDetails as StandardDetails, type index_d_StreetAddress as StreetAddress, type index_d_Subdivision as Subdivision, index_d_SubdivisionType as SubdivisionType, type index_d_UpdateProductOptions as UpdateProductOptions, type index_d_UpdateProductOptionsRequiredFields as UpdateProductOptionsRequiredFields, type index_d_UpdateProductRequest as UpdateProductRequest, type index_d_UpdateProductRequestRequiredFields as UpdateProductRequestRequiredFields, type index_d_UpdateProductResponse as UpdateProductResponse, type index_d_UpdateProductResponseNonNullableFields as UpdateProductResponseNonNullableFields, type index_d_Variant as Variant, type index_d_VideoResolution as VideoResolution, index_d_WebhookIdentityType as WebhookIdentityType, index_d_bulkCreateProducts as bulkCreateProducts, index_d_bulkDeleteProducts as bulkDeleteProducts, index_d_bulkUpdateProducts as bulkUpdateProducts, index_d_createProduct as createProduct, index_d_deleteProduct as deleteProduct, index_d_getProduct as getProduct, index_d_getProductsStartWith as getProductsStartWith, index_d_queryProducts as queryProducts, index_d_updateProduct as updateProduct };
1732
+ export { type index_d_Address as Address, type index_d_AddressLocation as AddressLocation, type index_d_AddressStreetOneOf as AddressStreetOneOf, type index_d_ApplicationError as ApplicationError, type index_d_BulkActionMetadata as BulkActionMetadata, type index_d_BulkCreateProductsOptions as BulkCreateProductsOptions, type index_d_BulkCreateProductsRequest as BulkCreateProductsRequest, type index_d_BulkCreateProductsRequestRequiredFields as BulkCreateProductsRequestRequiredFields, type index_d_BulkCreateProductsResponse as BulkCreateProductsResponse, type index_d_BulkCreateProductsResponseNonNullableFields as BulkCreateProductsResponseNonNullableFields, type index_d_BulkDeleteProductsRequest as BulkDeleteProductsRequest, type index_d_BulkDeleteProductsRequestRequiredFields as BulkDeleteProductsRequestRequiredFields, type index_d_BulkDeleteProductsResponse as BulkDeleteProductsResponse, type index_d_BulkDeleteProductsResponseBulkProductResult as BulkDeleteProductsResponseBulkProductResult, type index_d_BulkDeleteProductsResponseNonNullableFields as BulkDeleteProductsResponseNonNullableFields, type index_d_BulkProductResult as BulkProductResult, type index_d_BulkUpdateProductsOptions as BulkUpdateProductsOptions, type index_d_BulkUpdateProductsRequest as BulkUpdateProductsRequest, type index_d_BulkUpdateProductsRequestRequiredFields as BulkUpdateProductsRequestRequiredFields, type index_d_BulkUpdateProductsResponse as BulkUpdateProductsResponse, type index_d_BulkUpdateProductsResponseBulkProductResult as BulkUpdateProductsResponseBulkProductResult, type index_d_BulkUpdateProductsResponseNonNullableFields as BulkUpdateProductsResponseNonNullableFields, type index_d_CreateProductOptions as CreateProductOptions, type index_d_CreateProductOptionsRequiredFields as CreateProductOptionsRequiredFields, type index_d_CreateProductRequest as CreateProductRequest, type index_d_CreateProductRequestRequiredFields as CreateProductRequestRequiredFields, type index_d_CreateProductResponse as CreateProductResponse, type index_d_CreateProductResponseNonNullableFields as CreateProductResponseNonNullableFields, type index_d_CursorPaging as CursorPaging, type index_d_Cursors as Cursors, type index_d_DeleteProductRequest as DeleteProductRequest, type index_d_DeleteProductRequestRequiredFields as DeleteProductRequestRequiredFields, type index_d_DeleteProductResponse as DeleteProductResponse, type index_d_GetProductRequest as GetProductRequest, type index_d_GetProductRequestRequiredFields as GetProductRequestRequiredFields, type index_d_GetProductResponse as GetProductResponse, type index_d_GetProductResponseNonNullableFields as GetProductResponseNonNullableFields, type index_d_GetProductsStartWithOptions as GetProductsStartWithOptions, type index_d_GetProductsStartWithRequest as GetProductsStartWithRequest, type index_d_GetProductsStartWithRequestRequiredFields as GetProductsStartWithRequestRequiredFields, type index_d_GetProductsStartWithResponse as GetProductsStartWithResponse, type index_d_GetProductsStartWithResponseNonNullableFields as GetProductsStartWithResponseNonNullableFields, type index_d_ItemMetadata as ItemMetadata, index_d_LinkRel as LinkRel, type index_d_MaskedProduct as MaskedProduct, type index_d_MyAddress as MyAddress, type index_d_PageLink as PageLink, type index_d_Paging as Paging, type index_d_PagingMetadataV2 as PagingMetadataV2, type index_d_Product as Product, type index_d_ProductNonNullableFields as ProductNonNullableFields, type index_d_ProductsQueryBuilder as ProductsQueryBuilder, type index_d_ProductsQueryResult as ProductsQueryResult, type index_d_QueryProductsOptions as QueryProductsOptions, type index_d_QueryProductsRequest as QueryProductsRequest, type index_d_QueryProductsResponse as QueryProductsResponse, type index_d_QueryProductsResponseNonNullableFields as QueryProductsResponseNonNullableFields, type index_d_QueryV2 as QueryV2, type index_d_QueryV2PagingMethodOneOf as QueryV2PagingMethodOneOf, type index_d_ResetProductsDbRequest as ResetProductsDbRequest, type index_d_ResetProductsDbResponse as ResetProductsDbResponse, index_d_SortOrder as SortOrder, type index_d_Sorting as Sorting, type index_d_StandardDetails as StandardDetails, type index_d_StreetAddress as StreetAddress, type index_d_Subdivision as Subdivision, index_d_SubdivisionType as SubdivisionType, type index_d_UpdateProductOptions as UpdateProductOptions, type index_d_UpdateProductOptionsRequiredFields as UpdateProductOptionsRequiredFields, type index_d_UpdateProductRequest as UpdateProductRequest, type index_d_UpdateProductRequestRequiredFields as UpdateProductRequestRequiredFields, type index_d_UpdateProductResponse as UpdateProductResponse, type index_d_UpdateProductResponseNonNullableFields as UpdateProductResponseNonNullableFields, type index_d_Variant as Variant, type index_d_VideoResolution as VideoResolution, index_d_bulkCreateProducts as bulkCreateProducts, index_d_bulkDeleteProducts as bulkDeleteProducts, index_d_bulkUpdateProducts as bulkUpdateProducts, index_d_createProduct as createProduct, index_d_deleteProduct as deleteProduct, index_d_getProduct as getProduct, index_d_getProductsStartWith as getProductsStartWith, index_d_queryProducts as queryProducts, index_d_updateProduct as updateProduct };
2612
1733
  }
2613
1734
 
2614
1735
  export { index_d$2 as alarms, index_d$1 as metroinspector, index_d as products };