@wix/motion 1.0.47 → 1.0.49

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;
@@ -36,92 +36,92 @@ type Host$2<Environment = unknown> = {
36
36
  };
37
37
  };
38
38
 
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>>;
39
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
40
+ interface HttpClient {
41
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
42
42
  fetchWithAuth: typeof fetch;
43
43
  wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
44
44
  getActiveToken?: () => string | undefined;
45
45
  }
46
- type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
47
- type HttpResponse$2<T = any> = {
46
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
47
+ type HttpResponse<T = any> = {
48
48
  data: T;
49
49
  status: number;
50
50
  statusText: string;
51
51
  headers: any;
52
52
  request?: any;
53
53
  };
54
- type RequestOptions$2<_TResponse = any, Data = any> = {
54
+ type RequestOptions<_TResponse = any, Data = any> = {
55
55
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
56
56
  url: string;
57
57
  data?: Data;
58
58
  params?: URLSearchParams;
59
- } & APIMetadata$2;
60
- type APIMetadata$2 = {
59
+ } & APIMetadata;
60
+ type APIMetadata = {
61
61
  methodFqn?: string;
62
62
  entityFqdn?: string;
63
63
  packageName?: string;
64
64
  };
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> = {
65
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
66
+ type EventDefinition$2<Payload = unknown, Type extends string = string> = {
67
67
  __type: 'event-definition';
68
68
  type: Type;
69
69
  isDomainEvent?: boolean;
70
70
  transformations?: (envelope: unknown) => Payload;
71
71
  __payload: Payload;
72
72
  };
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;
73
+ declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
74
+ type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
75
+ type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
76
76
 
77
- type ServicePluginMethodInput$2 = {
77
+ type ServicePluginMethodInput = {
78
78
  request: any;
79
79
  metadata: any;
80
80
  };
81
- type ServicePluginContract$2 = Record<string, (payload: ServicePluginMethodInput$2) => unknown | Promise<unknown>>;
82
- type ServicePluginMethodMetadata$2 = {
81
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
82
+ type ServicePluginMethodMetadata = {
83
83
  name: string;
84
84
  primaryHttpMappingPath: string;
85
85
  transformations: {
86
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$2;
86
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
87
87
  toREST: (...args: unknown[]) => unknown;
88
88
  };
89
89
  };
90
- type ServicePluginDefinition$2<Contract extends ServicePluginContract$2> = {
90
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
91
91
  __type: 'service-plugin-definition';
92
92
  componentType: string;
93
- methods: ServicePluginMethodMetadata$2[];
93
+ methods: ServicePluginMethodMetadata[];
94
94
  __contract: Contract;
95
95
  };
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";
96
+ declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
97
+ type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
98
+ declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
99
99
 
100
- type RequestContext$2 = {
100
+ type RequestContext = {
101
101
  isSSR: boolean;
102
102
  host: string;
103
103
  protocol?: string;
104
104
  };
105
- type ResponseTransformer$2 = (data: any, headers?: any) => any;
105
+ type ResponseTransformer = (data: any, headers?: any) => any;
106
106
  /**
107
107
  * Ambassador request options types are copied mostly from AxiosRequestConfig.
108
108
  * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
109
109
  * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
110
110
  */
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> = {
111
+ type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
112
+ type AmbassadorRequestOptions<T = any> = {
113
113
  _?: T;
114
114
  url?: string;
115
- method?: Method$2;
115
+ method?: Method;
116
116
  params?: any;
117
117
  data?: any;
118
- transformResponse?: ResponseTransformer$2 | ResponseTransformer$2[];
118
+ transformResponse?: ResponseTransformer | ResponseTransformer[];
119
119
  };
120
- type AmbassadorFactory$2<Request, Response> = (payload: Request) => ((context: RequestContext$2) => AmbassadorRequestOptions$2<Response>) & {
120
+ type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
121
121
  __isAmbassador: boolean;
122
122
  };
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;
123
+ type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
124
+ type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
125
125
 
126
126
  declare global {
127
127
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -130,7 +130,7 @@ declare global {
130
130
  }
131
131
  }
132
132
 
133
- declare const emptyObjectSymbol$2: unique symbol;
133
+ declare const emptyObjectSymbol: unique symbol;
134
134
 
135
135
  /**
136
136
  Represents a strictly empty plain object, the `{}` value.
@@ -158,7 +158,7 @@ Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<n
158
158
 
159
159
  @category Object
160
160
  */
161
- type EmptyObject$2 = {[emptyObjectSymbol$2]?: never};
161
+ type EmptyObject = {[emptyObjectSymbol]?: never};
162
162
 
163
163
  /**
164
164
  Returns a boolean for whether the two given types are equal.
@@ -186,7 +186,7 @@ type Includes<Value extends readonly any[], Item> =
186
186
  @category Type Guard
187
187
  @category Utilities
188
188
  */
189
- type IsEqual$2<A, B> =
189
+ type IsEqual<A, B> =
190
190
  (<G>() => G extends A ? 1 : 2) extends
191
191
  (<G>() => G extends B ? 1 : 2)
192
192
  ? true
@@ -219,9 +219,9 @@ type Filtered = Filter<'bar', 'foo'>;
219
219
 
220
220
  @see {Except}
221
221
  */
222
- type Filter$2<KeyType, ExcludeType> = IsEqual$2<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
222
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
223
223
 
224
- type ExceptOptions$2 = {
224
+ type ExceptOptions = {
225
225
  /**
226
226
  Disallow assigning non-specified properties.
227
227
 
@@ -265,8 +265,8 @@ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
265
265
 
266
266
  @category Object
267
267
  */
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];
268
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
269
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
270
270
  } & (Options['requireExactProps'] extends true
271
271
  ? Partial<Record<KeysType, never>>
272
272
  : {});
@@ -303,7 +303,7 @@ type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
303
303
 
304
304
  @category Object
305
305
  */
306
- type ConditionalKeys$2<Base, Condition> = NonNullable<
306
+ type ConditionalKeys<Base, Condition> = NonNullable<
307
307
  // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
308
308
  {
309
309
  // Map through all the keys of the given base type.
@@ -357,9 +357,9 @@ type NonStringKeysOnly = ConditionalExcept<Example, string>;
357
357
 
358
358
  @category Object
359
359
  */
360
- type ConditionalExcept$2<Base, Condition> = Except$2<
360
+ type ConditionalExcept<Base, Condition> = Except<
361
361
  Base,
362
- ConditionalKeys$2<Base, Condition>
362
+ ConditionalKeys<Base, Condition>
363
363
  >;
364
364
 
365
365
  /**
@@ -367,8 +367,8 @@ ConditionalKeys$2<Base, Condition>
367
367
  * can either be a REST module or a host module.
368
368
  * This type is recursive, so it can describe nested modules.
369
369
  */
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;
370
+ type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition$2<any> | ServicePluginDefinition<any> | {
371
+ [key: string]: Descriptors | PublicMetadata | any;
372
372
  };
373
373
  /**
374
374
  * This type takes in a descriptors object of a certain Host (including an `unknown` host)
@@ -376,12 +376,12 @@ type Descriptors$2 = RESTFunctionDescriptor$2 | AmbassadorFunctionDescriptor$2 |
376
376
  * Any non-descriptor properties are removed from the returned object, including descriptors that
377
377
  * do not match the given host (as they will not work with the given host).
378
378
  */
379
- type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefined, Depth extends number = 5> = {
379
+ type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
380
380
  done: T;
381
381
  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, [
382
+ __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
383
+ } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition$2<any> ? BuildEventDefinition$2<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
384
+ [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
385
385
  -1,
386
386
  0,
387
387
  1,
@@ -390,9 +390,9 @@ type BuildDescriptors$2<T extends Descriptors$2, H extends Host$2<any> | undefin
390
390
  4,
391
391
  5
392
392
  ][Depth]> : never;
393
- }, EmptyObject$2>;
393
+ }, EmptyObject>;
394
394
  }[Depth extends -1 ? 'done' : 'recurse'];
395
- type PublicMetadata$2 = {
395
+ type PublicMetadata = {
396
396
  PACKAGE_NAME?: string;
397
397
  };
398
398
 
@@ -404,29 +404,14 @@ declare global {
404
404
  * A type used to create concerete types from SDK descriptors in
405
405
  * case a contextual client is available.
406
406
  */
407
- type MaybeContext$2<T extends Descriptors$2> = globalThis.ContextualClient extends {
408
- host: Host$2;
409
- } ? BuildDescriptors$2<T, globalThis.ContextualClient['host']> : T;
407
+ type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
408
+ host: Host;
409
+ } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
410
410
 
411
411
  interface AlarmMessage {
412
412
  _id?: string;
413
413
  seconds?: number;
414
414
  }
415
- interface Dispatched$1 {
416
- /** the message someone says */
417
- echo?: EchoMessage$1;
418
- }
419
- interface EchoMessage$1 {
420
- /** message comment from EchoMessage proto def, with special comment */
421
- message?: string;
422
- /** messages_list comment from EchoMessage proto def */
423
- messagesList?: MessageItem$1[];
424
- _id?: string;
425
- }
426
- interface MessageItem$1 {
427
- /** inner_message comment from EchoMessage proto def */
428
- innerMessage?: string;
429
- }
430
415
  interface AlarmRequest {
431
416
  seconds: number;
432
417
  someString?: string;
@@ -641,34 +626,34 @@ interface UpdateAlarm {
641
626
  seconds?: number;
642
627
  }
643
628
 
644
- declare function alarm$1(httpClient: HttpClient$2): AlarmSignature;
629
+ declare function alarm$1(httpClient: HttpClient): AlarmSignature;
645
630
  interface AlarmSignature {
646
631
  /**
647
632
  * sets up an alarm after {seconds}
648
633
  */
649
634
  (seconds: number, options?: AlarmOptions | undefined): Promise<AlarmResponse>;
650
635
  }
651
- declare function updateAlarm$1(httpClient: HttpClient$2): UpdateAlarmSignature;
636
+ declare function updateAlarm$1(httpClient: HttpClient): UpdateAlarmSignature;
652
637
  interface UpdateAlarmSignature {
653
638
  /**
654
639
  * sets up an existing alarm with id {id}
655
640
  */
656
641
  (_id: string, alarm: UpdateAlarm): Promise<UpdateAlarmResponse & UpdateAlarmResponseNonNullableFields>;
657
642
  }
658
- declare const onAlarmTriggered$1: EventDefinition$4<AlarmTriggeredEnvelope, "wix.alarm.v1.alarm_alarm_triggered">;
659
- declare const onAlarmSnoozed$1: EventDefinition$4<AlarmSnoozedEnvelope, "wix.alarm.v1.alarm_alarm_snoozed">;
660
- declare const onAlarmDeleted$1: EventDefinition$4<AlarmDeletedEnvelope, "wix.alarm.v1.alarm_alarm_deleted">;
643
+ declare const onAlarmTriggered$1: EventDefinition$2<AlarmTriggeredEnvelope, "wix.alarm.v1.alarm_alarm_triggered">;
644
+ declare const onAlarmSnoozed$1: EventDefinition$2<AlarmSnoozedEnvelope, "wix.alarm.v1.alarm_alarm_snoozed">;
645
+ declare const onAlarmDeleted$1: EventDefinition$2<AlarmDeletedEnvelope, "wix.alarm.v1.alarm_alarm_deleted">;
661
646
 
662
- type EventDefinition$3<Payload = unknown, Type extends string = string> = {
647
+ type EventDefinition$1<Payload = unknown, Type extends string = string> = {
663
648
  __type: 'event-definition';
664
649
  type: Type;
665
650
  isDomainEvent?: boolean;
666
651
  transformations?: (envelope: unknown) => Payload;
667
652
  __payload: Payload;
668
653
  };
669
- declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
670
- type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
671
- type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
654
+ declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
655
+ type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
656
+ type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
672
657
 
673
658
  declare global {
674
659
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
@@ -677,10 +662,10 @@ declare global {
677
662
  }
678
663
  }
679
664
 
680
- declare function createEventModule$1<T extends EventDefinition$3<any, string>>(eventDefinition: T): BuildEventDefinition$3<T> & T;
665
+ declare function createEventModule$1<T extends EventDefinition$1<any, string>>(eventDefinition: T): BuildEventDefinition$1<T> & T;
681
666
 
682
- declare const alarm: MaybeContext$2<BuildRESTFunction$2<typeof alarm$1> & typeof alarm$1>;
683
- declare const updateAlarm: MaybeContext$2<BuildRESTFunction$2<typeof updateAlarm$1> & typeof updateAlarm$1>;
667
+ declare const alarm: MaybeContext<BuildRESTFunction<typeof alarm$1> & typeof alarm$1>;
668
+ declare const updateAlarm: MaybeContext<BuildRESTFunction<typeof updateAlarm$1> & typeof updateAlarm$1>;
684
669
 
685
670
  type _publicOnAlarmTriggeredType = typeof onAlarmTriggered$1;
686
671
  /**
@@ -725,512 +710,102 @@ declare const context$2_onAlarmSnoozed: typeof onAlarmSnoozed;
725
710
  declare const context$2_onAlarmTriggered: typeof onAlarmTriggered;
726
711
  declare const context$2_updateAlarm: typeof updateAlarm;
727
712
  declare namespace context$2 {
728
- export { type ActionEvent$2 as ActionEvent, type context$2_AlarmDeleted as AlarmDeleted, type context$2_AlarmDeletedEnvelope as AlarmDeletedEnvelope, type context$2_AlarmMessage as AlarmMessage, type context$2_AlarmOptions as AlarmOptions, type context$2_AlarmRequest as AlarmRequest, type context$2_AlarmRequestRequiredFields as AlarmRequestRequiredFields, type context$2_AlarmResponse as AlarmResponse, type context$2_AlarmSnoozed as AlarmSnoozed, type context$2_AlarmSnoozedEnvelope as AlarmSnoozedEnvelope, type context$2_AlarmTriggered as AlarmTriggered, type context$2_AlarmTriggeredEnvelope as AlarmTriggeredEnvelope, type BaseEventMetadata$1 as BaseEventMetadata, type Dispatched$1 as Dispatched, type DomainEvent$2 as DomainEvent, type DomainEventBodyOneOf$2 as DomainEventBodyOneOf, type EchoMessage$1 as EchoMessage, 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 MessageItem$1 as MessageItem, type RestoreInfo$2 as RestoreInfo, type context$2_UpdateAlarm as UpdateAlarm, type context$2_UpdateAlarmRequest as UpdateAlarmRequest, type context$2_UpdateAlarmRequestRequiredFields as UpdateAlarmRequestRequiredFields, type context$2_UpdateAlarmResponse as UpdateAlarmResponse, type context$2_UpdateAlarmResponseNonNullableFields as UpdateAlarmResponseNonNullableFields, WebhookIdentityType$2 as WebhookIdentityType, type context$2__publicOnAlarmDeletedType as _publicOnAlarmDeletedType, type context$2__publicOnAlarmSnoozedType as _publicOnAlarmSnoozedType, type context$2__publicOnAlarmTriggeredType as _publicOnAlarmTriggeredType, context$2_alarm as alarm, context$2_onAlarmDeleted as onAlarmDeleted, context$2_onAlarmSnoozed as onAlarmSnoozed, context$2_onAlarmTriggered as onAlarmTriggered, onAlarmDeleted$1 as publicOnAlarmDeleted, onAlarmSnoozed$1 as publicOnAlarmSnoozed, onAlarmTriggered$1 as publicOnAlarmTriggered, context$2_updateAlarm as updateAlarm };
713
+ export { type ActionEvent$2 as ActionEvent, type context$2_AlarmDeleted as AlarmDeleted, type context$2_AlarmDeletedEnvelope as AlarmDeletedEnvelope, type context$2_AlarmMessage as AlarmMessage, type context$2_AlarmOptions as AlarmOptions, type context$2_AlarmRequest as AlarmRequest, type context$2_AlarmRequestRequiredFields as AlarmRequestRequiredFields, type context$2_AlarmResponse as AlarmResponse, type context$2_AlarmSnoozed as AlarmSnoozed, type context$2_AlarmSnoozedEnvelope as AlarmSnoozedEnvelope, type context$2_AlarmTriggered as AlarmTriggered, type context$2_AlarmTriggeredEnvelope as AlarmTriggeredEnvelope, type BaseEventMetadata$1 as BaseEventMetadata, type DomainEvent$2 as DomainEvent, type DomainEventBodyOneOf$2 as DomainEventBodyOneOf, type EntityCreatedEvent$2 as EntityCreatedEvent, type EntityDeletedEvent$2 as EntityDeletedEvent, type EntityUpdatedEvent$2 as EntityUpdatedEvent, type EventMetadata$1 as EventMetadata, type IdentificationData$2 as IdentificationData, type IdentificationDataIdOneOf$2 as IdentificationDataIdOneOf, type MessageEnvelope$2 as MessageEnvelope, type RestoreInfo$2 as RestoreInfo, type context$2_UpdateAlarm as UpdateAlarm, type context$2_UpdateAlarmRequest as UpdateAlarmRequest, type context$2_UpdateAlarmRequestRequiredFields as UpdateAlarmRequestRequiredFields, type context$2_UpdateAlarmResponse as UpdateAlarmResponse, type context$2_UpdateAlarmResponseNonNullableFields as UpdateAlarmResponseNonNullableFields, WebhookIdentityType$2 as WebhookIdentityType, type context$2__publicOnAlarmDeletedType as _publicOnAlarmDeletedType, type context$2__publicOnAlarmSnoozedType as _publicOnAlarmSnoozedType, type context$2__publicOnAlarmTriggeredType as _publicOnAlarmTriggeredType, context$2_alarm as alarm, context$2_onAlarmDeleted as onAlarmDeleted, context$2_onAlarmSnoozed as onAlarmSnoozed, context$2_onAlarmTriggered as onAlarmTriggered, onAlarmDeleted$1 as publicOnAlarmDeleted, onAlarmSnoozed$1 as publicOnAlarmSnoozed, onAlarmTriggered$1 as publicOnAlarmTriggered, context$2_updateAlarm as updateAlarm };
729
714
  }
730
715
 
731
- type HostModule$1<T, H extends Host$1> = {
732
- __type: 'host';
733
- create(host: H): T;
734
- };
735
- type HostModuleAPI$1<T extends HostModule$1<any, any>> = T extends HostModule$1<infer U, any> ? U : never;
736
- type Host$1<Environment = unknown> = {
737
- channel: {
738
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
739
- disconnect: () => void;
740
- } | Promise<{
741
- disconnect: () => void;
742
- }>;
743
- };
744
- environment?: Environment;
716
+ interface MessageItem {
717
+ /** inner_message comment from EchoMessage proto def */
718
+ innerMessage?: string;
719
+ }
720
+ interface EchoRequest {
721
+ /** 1st part of the message */
722
+ arg1: string;
723
+ /** 2nd part of the message */
724
+ arg2?: string;
725
+ /** this field test translatable annotation */
726
+ titleField?: string;
727
+ someInt32?: number;
728
+ someDate?: Date;
729
+ }
730
+ interface EchoResponse {
731
+ /** message result as EchoMessage */
732
+ echoMessage?: EchoMessage;
733
+ /** messge reseult as string */
734
+ message?: string;
735
+ }
736
+ interface Dispatched {
737
+ /** the message someone says */
738
+ echo?: EchoMessage;
739
+ }
740
+ interface DomainEvent$1 extends DomainEventBodyOneOf$1 {
741
+ createdEvent?: EntityCreatedEvent$1;
742
+ updatedEvent?: EntityUpdatedEvent$1;
743
+ deletedEvent?: EntityDeletedEvent$1;
744
+ actionEvent?: ActionEvent$1;
745
745
  /**
746
- * Optional bast url to use for API requests, for example `www.wixapis.com`
746
+ * Unique event ID.
747
+ * Allows clients to ignore duplicate webhooks.
747
748
  */
748
- apiBaseUrl?: string;
749
+ _id?: string;
749
750
  /**
750
- * Possible data to be provided by every host, for cross cutting concerns
751
- * like internationalization, billing, etc.
751
+ * Assumes actions are also always typed to an entity_type
752
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
752
753
  */
753
- essentials?: {
754
- /**
755
- * The language of the currently viewed session
756
- */
757
- language?: string;
758
- /**
759
- * The locale of the currently viewed session
760
- */
761
- locale?: string;
762
- /**
763
- * Any headers that should be passed through to the API requests
764
- */
765
- passThroughHeaders?: Record<string, string>;
766
- };
767
- };
768
-
769
- type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
770
- interface HttpClient$1 {
771
- request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
772
- fetchWithAuth: typeof fetch;
773
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
774
- getActiveToken?: () => string | undefined;
775
- }
776
- type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
777
- type HttpResponse$1<T = any> = {
778
- data: T;
779
- status: number;
780
- statusText: string;
781
- headers: any;
782
- request?: any;
783
- };
784
- type RequestOptions$1<_TResponse = any, Data = any> = {
785
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
786
- url: string;
787
- data?: Data;
788
- params?: URLSearchParams;
789
- } & APIMetadata$1;
790
- type APIMetadata$1 = {
791
- methodFqn?: string;
792
754
  entityFqdn?: string;
793
- packageName?: string;
794
- };
795
- type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
796
- type EventDefinition$2<Payload = unknown, Type extends string = string> = {
797
- __type: 'event-definition';
798
- type: Type;
799
- isDomainEvent?: boolean;
800
- transformations?: (envelope: unknown) => Payload;
801
- __payload: Payload;
802
- };
803
- declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
804
- type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
805
- type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
806
-
807
- type ServicePluginMethodInput$1 = {
808
- request: any;
809
- metadata: any;
810
- };
811
- type ServicePluginContract$1 = Record<string, (payload: ServicePluginMethodInput$1) => unknown | Promise<unknown>>;
812
- type ServicePluginMethodMetadata$1 = {
813
- name: string;
814
- primaryHttpMappingPath: string;
815
- transformations: {
816
- fromREST: (...args: unknown[]) => ServicePluginMethodInput$1;
817
- toREST: (...args: unknown[]) => unknown;
818
- };
819
- };
820
- type ServicePluginDefinition$1<Contract extends ServicePluginContract$1> = {
821
- __type: 'service-plugin-definition';
822
- componentType: string;
823
- methods: ServicePluginMethodMetadata$1[];
824
- __contract: Contract;
825
- };
826
- declare function ServicePluginDefinition$1<Contract extends ServicePluginContract$1>(componentType: string, methods: ServicePluginMethodMetadata$1[]): ServicePluginDefinition$1<Contract>;
827
- type BuildServicePluginDefinition$1<T extends ServicePluginDefinition$1<any>> = (implementation: T['__contract']) => void;
828
- declare const SERVICE_PLUGIN_ERROR_TYPE$1 = "wix_spi_error";
829
-
830
- type RequestContext$1 = {
831
- isSSR: boolean;
832
- host: string;
833
- protocol?: string;
834
- };
835
- type ResponseTransformer$1 = (data: any, headers?: any) => any;
836
- /**
837
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
838
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
839
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
840
- */
841
- type Method$1 = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
842
- type AmbassadorRequestOptions$1<T = any> = {
843
- _?: T;
844
- url?: string;
845
- method?: Method$1;
846
- params?: any;
847
- data?: any;
848
- transformResponse?: ResponseTransformer$1 | ResponseTransformer$1[];
849
- };
850
- type AmbassadorFactory$1<Request, Response> = (payload: Request) => ((context: RequestContext$1) => AmbassadorRequestOptions$1<Response>) & {
851
- __isAmbassador: boolean;
852
- };
853
- type AmbassadorFunctionDescriptor$1<Request = any, Response = any> = AmbassadorFactory$1<Request, Response>;
854
- type BuildAmbassadorFunction$1<T extends AmbassadorFunctionDescriptor$1> = T extends AmbassadorFunctionDescriptor$1<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
855
-
856
- declare global {
857
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
858
- interface SymbolConstructor {
859
- readonly observable: symbol;
860
- }
755
+ /**
756
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
757
+ * This is although the created/updated/deleted notion is duplication of the oneof types
758
+ * Example: created/updated/deleted/started/completed/email_opened
759
+ */
760
+ slug?: string;
761
+ /** ID of the entity associated with the event. */
762
+ entityId?: string;
763
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
764
+ eventTime?: Date;
765
+ /**
766
+ * Whether the event was triggered as a result of a privacy regulation application
767
+ * (for example, GDPR).
768
+ */
769
+ triggeredByAnonymizeRequest?: boolean | null;
770
+ /** If present, indicates the action that triggered the event. */
771
+ originatedFrom?: string | null;
772
+ /**
773
+ * A sequence number defining the order of updates to the underlying entity.
774
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
775
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
776
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
777
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
778
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
779
+ */
780
+ entityEventSequence?: string | null;
861
781
  }
862
-
863
- declare const emptyObjectSymbol$1: unique symbol;
864
-
865
- /**
866
- Represents a strictly empty plain object, the `{}` value.
867
-
868
- 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)).
869
-
870
- @example
871
- ```
872
- import type {EmptyObject} from 'type-fest';
873
-
874
- // The following illustrates the problem with `{}`.
875
- const foo1: {} = {}; // Pass
876
- const foo2: {} = []; // Pass
877
- const foo3: {} = 42; // Pass
878
- const foo4: {} = {a: 1}; // Pass
879
-
880
- // With `EmptyObject` only the first case is valid.
881
- const bar1: EmptyObject = {}; // Pass
882
- const bar2: EmptyObject = 42; // Fail
883
- const bar3: EmptyObject = []; // Fail
884
- const bar4: EmptyObject = {a: 1}; // Fail
885
- ```
886
-
887
- 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}.
888
-
889
- @category Object
890
- */
891
- type EmptyObject$1 = {[emptyObjectSymbol$1]?: never};
892
-
893
- /**
894
- Returns a boolean for whether the two given types are equal.
895
-
896
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
897
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
898
-
899
- Use-cases:
900
- - If you want to make a conditional branch based on the result of a comparison of two types.
901
-
902
- @example
903
- ```
904
- import type {IsEqual} from 'type-fest';
905
-
906
- // This type returns a boolean for whether the given array includes the given item.
907
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
908
- type Includes<Value extends readonly any[], Item> =
909
- Value extends readonly [Value[0], ...infer rest]
910
- ? IsEqual<Value[0], Item> extends true
911
- ? true
912
- : Includes<rest, Item>
913
- : false;
914
- ```
915
-
916
- @category Type Guard
917
- @category Utilities
918
- */
919
- type IsEqual$1<A, B> =
920
- (<G>() => G extends A ? 1 : 2) extends
921
- (<G>() => G extends B ? 1 : 2)
922
- ? true
923
- : false;
924
-
925
- /**
926
- Filter out keys from an object.
927
-
928
- Returns `never` if `Exclude` is strictly equal to `Key`.
929
- Returns `never` if `Key` extends `Exclude`.
930
- Returns `Key` otherwise.
931
-
932
- @example
933
- ```
934
- type Filtered = Filter<'foo', 'foo'>;
935
- //=> never
936
- ```
937
-
938
- @example
939
- ```
940
- type Filtered = Filter<'bar', string>;
941
- //=> never
942
- ```
943
-
944
- @example
945
- ```
946
- type Filtered = Filter<'bar', 'foo'>;
947
- //=> 'bar'
948
- ```
949
-
950
- @see {Except}
951
- */
952
- type Filter$1<KeyType, ExcludeType> = IsEqual$1<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
953
-
954
- type ExceptOptions$1 = {
955
- /**
956
- Disallow assigning non-specified properties.
957
-
958
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
959
-
960
- @default false
961
- */
962
- requireExactProps?: boolean;
963
- };
964
-
965
- /**
966
- Create a type from an object type without certain keys.
967
-
968
- We recommend setting the `requireExactProps` option to `true`.
969
-
970
- 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.
971
-
972
- 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)).
973
-
974
- @example
975
- ```
976
- import type {Except} from 'type-fest';
977
-
978
- type Foo = {
979
- a: number;
980
- b: string;
981
- };
982
-
983
- type FooWithoutA = Except<Foo, 'a'>;
984
- //=> {b: string}
985
-
986
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
987
- //=> errors: 'a' does not exist in type '{ b: string; }'
988
-
989
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
990
- //=> {a: number} & Partial<Record<"b", never>>
991
-
992
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
993
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
994
- ```
995
-
996
- @category Object
997
- */
998
- type Except$1<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions$1 = {requireExactProps: false}> = {
999
- [KeyType in keyof ObjectType as Filter$1<KeyType, KeysType>]: ObjectType[KeyType];
1000
- } & (Options['requireExactProps'] extends true
1001
- ? Partial<Record<KeysType, never>>
1002
- : {});
1003
-
1004
- /**
1005
- Extract the keys from a type where the value type of the key extends the given `Condition`.
1006
-
1007
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
1008
-
1009
- @example
1010
- ```
1011
- import type {ConditionalKeys} from 'type-fest';
1012
-
1013
- interface Example {
1014
- a: string;
1015
- b: string | number;
1016
- c?: string;
1017
- d: {};
782
+ /** @oneof */
783
+ interface DomainEventBodyOneOf$1 {
784
+ createdEvent?: EntityCreatedEvent$1;
785
+ updatedEvent?: EntityUpdatedEvent$1;
786
+ deletedEvent?: EntityDeletedEvent$1;
787
+ actionEvent?: ActionEvent$1;
1018
788
  }
1019
-
1020
- type StringKeysOnly = ConditionalKeys<Example, string>;
1021
- //=> 'a'
1022
- ```
1023
-
1024
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
1025
-
1026
- @example
1027
- ```
1028
- import type {ConditionalKeys} from 'type-fest';
1029
-
1030
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
1031
- //=> 'a' | 'c'
1032
- ```
1033
-
1034
- @category Object
1035
- */
1036
- type ConditionalKeys$1<Base, Condition> = NonNullable<
1037
- // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
1038
- {
1039
- // Map through all the keys of the given base type.
1040
- [Key in keyof Base]:
1041
- // Pick only keys with types extending the given `Condition` type.
1042
- Base[Key] extends Condition
1043
- // Retain this key since the condition passes.
1044
- ? Key
1045
- // Discard this key since the condition fails.
1046
- : never;
1047
-
1048
- // Convert the produced object into a union type of the keys which passed the conditional test.
1049
- }[keyof Base]
1050
- >;
1051
-
1052
- /**
1053
- Exclude keys from a shape that matches the given `Condition`.
1054
-
1055
- 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.
1056
-
1057
- @example
1058
- ```
1059
- import type {Primitive, ConditionalExcept} from 'type-fest';
1060
-
1061
- class Awesome {
1062
- name: string;
1063
- successes: number;
1064
- failures: bigint;
1065
-
1066
- run() {}
789
+ interface EntityCreatedEvent$1 {
790
+ entity?: string;
1067
791
  }
1068
-
1069
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
1070
- //=> {run: () => void}
1071
- ```
1072
-
1073
- @example
1074
- ```
1075
- import type {ConditionalExcept} from 'type-fest';
1076
-
1077
- interface Example {
1078
- a: string;
1079
- b: string | number;
1080
- c: () => void;
1081
- d: {};
792
+ interface RestoreInfo$1 {
793
+ deletedDate?: Date;
1082
794
  }
1083
-
1084
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
1085
- //=> {b: string | number; c: () => void; d: {}}
1086
- ```
1087
-
1088
- @category Object
1089
- */
1090
- type ConditionalExcept$1<Base, Condition> = Except$1<
1091
- Base,
1092
- ConditionalKeys$1<Base, Condition>
1093
- >;
1094
-
1095
- /**
1096
- * Descriptors are objects that describe the API of a module, and the module
1097
- * can either be a REST module or a host module.
1098
- * This type is recursive, so it can describe nested modules.
1099
- */
1100
- type Descriptors$1 = RESTFunctionDescriptor$1 | AmbassadorFunctionDescriptor$1 | HostModule$1<any, any> | EventDefinition$2<any> | ServicePluginDefinition$1<any> | {
1101
- [key: string]: Descriptors$1 | PublicMetadata$1 | any;
1102
- };
1103
- /**
1104
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
1105
- * and returns an object with the same structure, but with all descriptors replaced with their API.
1106
- * Any non-descriptor properties are removed from the returned object, including descriptors that
1107
- * do not match the given host (as they will not work with the given host).
1108
- */
1109
- type BuildDescriptors$1<T extends Descriptors$1, H extends Host$1<any> | undefined, Depth extends number = 5> = {
1110
- done: T;
1111
- recurse: T extends {
1112
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE$1;
1113
- } ? 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<{
1114
- [Key in keyof T]: T[Key] extends Descriptors$1 ? BuildDescriptors$1<T[Key], H, [
1115
- -1,
1116
- 0,
1117
- 1,
1118
- 2,
1119
- 3,
1120
- 4,
1121
- 5
1122
- ][Depth]> : never;
1123
- }, EmptyObject$1>;
1124
- }[Depth extends -1 ? 'done' : 'recurse'];
1125
- type PublicMetadata$1 = {
1126
- PACKAGE_NAME?: string;
1127
- };
1128
-
1129
- declare global {
1130
- interface ContextualClient {
1131
- }
795
+ interface EntityUpdatedEvent$1 {
796
+ /**
797
+ * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
798
+ * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
799
+ * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
800
+ */
801
+ currentEntity?: string;
1132
802
  }
1133
- /**
1134
- * A type used to create concerete types from SDK descriptors in
1135
- * case a contextual client is available.
1136
- */
1137
- type MaybeContext$1<T extends Descriptors$1> = globalThis.ContextualClient extends {
1138
- host: Host$1;
1139
- } ? BuildDescriptors$1<T, globalThis.ContextualClient['host']> : T;
1140
-
1141
- interface MessageItem {
1142
- /** inner_message comment from EchoMessage proto def */
1143
- innerMessage?: string;
803
+ interface EntityDeletedEvent$1 {
804
+ /** Entity that was deleted */
805
+ deletedEntity?: string | null;
1144
806
  }
1145
- interface EchoRequest {
1146
- /** 1st part of the message */
1147
- arg1: string;
1148
- /** 2nd part of the message */
1149
- arg2?: string;
1150
- /** this field test translatable annotation */
1151
- titleField?: string;
1152
- someInt32?: number;
1153
- someDate?: Date;
1154
- }
1155
- interface EchoResponse {
1156
- /** message result as EchoMessage */
1157
- echoMessage?: EchoMessage;
1158
- /** messge reseult as string */
1159
- message?: string;
1160
- }
1161
- interface Dispatched {
1162
- /** the message someone says */
1163
- echo?: EchoMessage;
1164
- }
1165
- interface DomainEvent$1 extends DomainEventBodyOneOf$1 {
1166
- createdEvent?: EntityCreatedEvent$1;
1167
- updatedEvent?: EntityUpdatedEvent$1;
1168
- deletedEvent?: EntityDeletedEvent$1;
1169
- actionEvent?: ActionEvent$1;
1170
- /**
1171
- * Unique event ID.
1172
- * Allows clients to ignore duplicate webhooks.
1173
- */
1174
- _id?: string;
1175
- /**
1176
- * Assumes actions are also always typed to an entity_type
1177
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
1178
- */
1179
- entityFqdn?: string;
1180
- /**
1181
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
1182
- * This is although the created/updated/deleted notion is duplication of the oneof types
1183
- * Example: created/updated/deleted/started/completed/email_opened
1184
- */
1185
- slug?: string;
1186
- /** ID of the entity associated with the event. */
1187
- entityId?: string;
1188
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
1189
- eventTime?: Date;
1190
- /**
1191
- * Whether the event was triggered as a result of a privacy regulation application
1192
- * (for example, GDPR).
1193
- */
1194
- triggeredByAnonymizeRequest?: boolean | null;
1195
- /** If present, indicates the action that triggered the event. */
1196
- originatedFrom?: string | null;
1197
- /**
1198
- * A sequence number defining the order of updates to the underlying entity.
1199
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
1200
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
1201
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
1202
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
1203
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
1204
- */
1205
- entityEventSequence?: string | null;
1206
- }
1207
- /** @oneof */
1208
- interface DomainEventBodyOneOf$1 {
1209
- createdEvent?: EntityCreatedEvent$1;
1210
- updatedEvent?: EntityUpdatedEvent$1;
1211
- deletedEvent?: EntityDeletedEvent$1;
1212
- actionEvent?: ActionEvent$1;
1213
- }
1214
- interface EntityCreatedEvent$1 {
1215
- entity?: string;
1216
- }
1217
- interface RestoreInfo$1 {
1218
- deletedDate?: Date;
1219
- }
1220
- interface EntityUpdatedEvent$1 {
1221
- /**
1222
- * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
1223
- * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
1224
- * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
1225
- */
1226
- currentEntity?: string;
1227
- }
1228
- interface EntityDeletedEvent$1 {
1229
- /** Entity that was deleted */
1230
- deletedEntity?: string | null;
1231
- }
1232
- interface ActionEvent$1 {
1233
- body?: string;
807
+ interface ActionEvent$1 {
808
+ body?: string;
1234
809
  }
1235
810
  interface MessageEnvelope$1 {
1236
811
  /** App instance ID. */
@@ -1242,581 +817,171 @@ interface MessageEnvelope$1 {
1242
817
  /** Stringify payload. */
1243
818
  data?: string;
1244
819
  }
1245
- interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
1246
- /** ID of a site visitor that has not logged in to the site. */
1247
- anonymousVisitorId?: string;
1248
- /** ID of a site visitor that has logged in to the site. */
1249
- memberId?: string;
1250
- /** ID of a Wix user (site owner, contributor, etc.). */
1251
- wixUserId?: string;
1252
- /** ID of an app. */
1253
- appId?: string;
1254
- /** @readonly */
1255
- identityType?: WebhookIdentityType$1;
1256
- }
1257
- /** @oneof */
1258
- interface IdentificationDataIdOneOf$1 {
1259
- /** ID of a site visitor that has not logged in to the site. */
1260
- anonymousVisitorId?: string;
1261
- /** ID of a site visitor that has logged in to the site. */
1262
- memberId?: string;
1263
- /** ID of a Wix user (site owner, contributor, etc.). */
1264
- wixUserId?: string;
1265
- /** ID of an app. */
1266
- appId?: string;
1267
- }
1268
- declare enum WebhookIdentityType$1 {
1269
- UNKNOWN = "UNKNOWN",
1270
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1271
- MEMBER = "MEMBER",
1272
- WIX_USER = "WIX_USER",
1273
- APP = "APP"
1274
- }
1275
- interface EchoRequestRequiredFields {
1276
- arg1: string;
1277
- }
1278
- interface MessageItemNonNullableFields {
1279
- innerMessage: string;
1280
- }
1281
- interface EchoMessageNonNullableFields {
1282
- message: string;
1283
- messagesList: MessageItemNonNullableFields[];
1284
- _id: string;
1285
- }
1286
- interface EchoResponseNonNullableFields {
1287
- echoMessage?: EchoMessageNonNullableFields;
1288
- message: string;
1289
- }
1290
- interface EchoMessage {
1291
- veloMessage: string;
1292
- id: string;
1293
- }
1294
- interface BaseEventMetadata {
1295
- /** App instance ID. */
1296
- instanceId?: string | null;
1297
- /** Event type. */
1298
- eventType?: string;
1299
- /** The identification type and identity data. */
1300
- identity?: IdentificationData$1;
1301
- }
1302
- interface EventMetadata extends BaseEventMetadata {
1303
- /**
1304
- * Unique event ID.
1305
- * Allows clients to ignore duplicate webhooks.
1306
- */
1307
- _id?: string;
1308
- /**
1309
- * Assumes actions are also always typed to an entity_type
1310
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
1311
- */
1312
- entityFqdn?: string;
1313
- /**
1314
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
1315
- * This is although the created/updated/deleted notion is duplication of the oneof types
1316
- * Example: created/updated/deleted/started/completed/email_opened
1317
- */
1318
- slug?: string;
1319
- /** ID of the entity associated with the event. */
1320
- entityId?: string;
1321
- /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
1322
- eventTime?: Date;
1323
- /**
1324
- * Whether the event was triggered as a result of a privacy regulation application
1325
- * (for example, GDPR).
1326
- */
1327
- triggeredByAnonymizeRequest?: boolean | null;
1328
- /** If present, indicates the action that triggered the event. */
1329
- originatedFrom?: string | null;
1330
- /**
1331
- * A sequence number defining the order of updates to the underlying entity.
1332
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
1333
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
1334
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
1335
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
1336
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
1337
- */
1338
- entityEventSequence?: string | null;
1339
- }
1340
- interface EchoDispatchedEnvelope {
1341
- data: Dispatched;
1342
- metadata: EventMetadata;
1343
- }
1344
- interface EchoOptions {
1345
- /** 2nd part of the message */
1346
- arg2?: string;
1347
- /** this field test translatable annotation */
1348
- titleField?: string;
1349
- someInt32?: number;
1350
- someDate?: Date;
1351
- }
1352
-
1353
- declare function echo$1(httpClient: HttpClient$1): EchoSignature;
1354
- interface EchoSignature {
1355
- /**
1356
- * echo given arg1 and arg2
1357
- * @param - 1st part of the message
1358
- * @param - modified comment for arg2 el hovav
1359
- * @returns messge reseult as string
1360
- */
1361
- (arg1: string, options?: EchoOptions | undefined): Promise<string>;
1362
- }
1363
- declare const onEchoDispatched$1: EventDefinition$2<EchoDispatchedEnvelope, "wix.metroinspector.v1.echo_dispatched">;
1364
-
1365
- type EventDefinition$1<Payload = unknown, Type extends string = string> = {
1366
- __type: 'event-definition';
1367
- type: Type;
1368
- isDomainEvent?: boolean;
1369
- transformations?: (envelope: unknown) => Payload;
1370
- __payload: Payload;
1371
- };
1372
- declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
1373
- type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
1374
- type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
1375
-
1376
- declare global {
1377
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1378
- interface SymbolConstructor {
1379
- readonly observable: symbol;
1380
- }
1381
- }
1382
-
1383
- declare function createEventModule<T extends EventDefinition$1<any, string>>(eventDefinition: T): BuildEventDefinition$1<T> & T;
1384
-
1385
- declare const echo: MaybeContext$1<BuildRESTFunction$1<typeof echo$1> & typeof echo$1>;
1386
-
1387
- type _publicOnEchoDispatchedType = typeof onEchoDispatched$1;
1388
- /**
1389
- * echo event that might be consumed when somone says something!
1390
- */
1391
- declare const onEchoDispatched: ReturnType<typeof createEventModule<_publicOnEchoDispatchedType>>;
1392
-
1393
- type context$1_BaseEventMetadata = BaseEventMetadata;
1394
- type context$1_Dispatched = Dispatched;
1395
- type context$1_EchoDispatchedEnvelope = EchoDispatchedEnvelope;
1396
- type context$1_EchoMessage = EchoMessage;
1397
- type context$1_EchoOptions = EchoOptions;
1398
- type context$1_EchoRequest = EchoRequest;
1399
- type context$1_EchoRequestRequiredFields = EchoRequestRequiredFields;
1400
- type context$1_EchoResponse = EchoResponse;
1401
- type context$1_EchoResponseNonNullableFields = EchoResponseNonNullableFields;
1402
- type context$1_EventMetadata = EventMetadata;
1403
- type context$1_MessageItem = MessageItem;
1404
- type context$1__publicOnEchoDispatchedType = _publicOnEchoDispatchedType;
1405
- declare const context$1_echo: typeof echo;
1406
- declare const context$1_onEchoDispatched: typeof onEchoDispatched;
1407
- declare namespace context$1 {
1408
- export { type ActionEvent$1 as ActionEvent, type context$1_BaseEventMetadata as BaseEventMetadata, type context$1_Dispatched as Dispatched, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type context$1_EchoDispatchedEnvelope as EchoDispatchedEnvelope, type context$1_EchoMessage as EchoMessage, type context$1_EchoOptions as EchoOptions, type context$1_EchoRequest as EchoRequest, type context$1_EchoRequestRequiredFields as EchoRequestRequiredFields, type context$1_EchoResponse as EchoResponse, type context$1_EchoResponseNonNullableFields as EchoResponseNonNullableFields, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type context$1_EventMetadata as EventMetadata, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type MessageEnvelope$1 as MessageEnvelope, type context$1_MessageItem as MessageItem, type RestoreInfo$1 as RestoreInfo, WebhookIdentityType$1 as WebhookIdentityType, type context$1__publicOnEchoDispatchedType as _publicOnEchoDispatchedType, context$1_echo as echo, context$1_onEchoDispatched as onEchoDispatched, onEchoDispatched$1 as publicOnEchoDispatched };
1409
- }
1410
-
1411
- type HostModule<T, H extends Host> = {
1412
- __type: 'host';
1413
- create(host: H): T;
1414
- };
1415
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
1416
- type Host<Environment = unknown> = {
1417
- channel: {
1418
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
1419
- disconnect: () => void;
1420
- } | Promise<{
1421
- disconnect: () => void;
1422
- }>;
1423
- };
1424
- environment?: Environment;
1425
- /**
1426
- * Optional bast url to use for API requests, for example `www.wixapis.com`
1427
- */
1428
- apiBaseUrl?: string;
1429
- /**
1430
- * Possible data to be provided by every host, for cross cutting concerns
1431
- * like internationalization, billing, etc.
1432
- */
1433
- essentials?: {
1434
- /**
1435
- * The language of the currently viewed session
1436
- */
1437
- language?: string;
1438
- /**
1439
- * The locale of the currently viewed session
1440
- */
1441
- locale?: string;
1442
- /**
1443
- * Any headers that should be passed through to the API requests
1444
- */
1445
- passThroughHeaders?: Record<string, string>;
1446
- };
1447
- };
1448
-
1449
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
1450
- interface HttpClient {
1451
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
1452
- fetchWithAuth: typeof fetch;
1453
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
1454
- getActiveToken?: () => string | undefined;
1455
- }
1456
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
1457
- type HttpResponse<T = any> = {
1458
- data: T;
1459
- status: number;
1460
- statusText: string;
1461
- headers: any;
1462
- request?: any;
1463
- };
1464
- type RequestOptions<_TResponse = any, Data = any> = {
1465
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
1466
- url: string;
1467
- data?: Data;
1468
- params?: URLSearchParams;
1469
- } & APIMetadata;
1470
- type APIMetadata = {
1471
- methodFqn?: string;
1472
- entityFqdn?: string;
1473
- packageName?: string;
1474
- };
1475
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
1476
- type EventDefinition<Payload = unknown, Type extends string = string> = {
1477
- __type: 'event-definition';
1478
- type: Type;
1479
- isDomainEvent?: boolean;
1480
- transformations?: (envelope: unknown) => Payload;
1481
- __payload: Payload;
1482
- };
1483
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
1484
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
1485
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
1486
-
1487
- type ServicePluginMethodInput = {
1488
- request: any;
1489
- metadata: any;
1490
- };
1491
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
1492
- type ServicePluginMethodMetadata = {
1493
- name: string;
1494
- primaryHttpMappingPath: string;
1495
- transformations: {
1496
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
1497
- toREST: (...args: unknown[]) => unknown;
1498
- };
1499
- };
1500
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
1501
- __type: 'service-plugin-definition';
1502
- componentType: string;
1503
- methods: ServicePluginMethodMetadata[];
1504
- __contract: Contract;
1505
- };
1506
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
1507
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
1508
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
1509
-
1510
- type RequestContext = {
1511
- isSSR: boolean;
1512
- host: string;
1513
- protocol?: string;
1514
- };
1515
- type ResponseTransformer = (data: any, headers?: any) => any;
1516
- /**
1517
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
1518
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
1519
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
1520
- */
1521
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
1522
- type AmbassadorRequestOptions<T = any> = {
1523
- _?: T;
1524
- url?: string;
1525
- method?: Method;
1526
- params?: any;
1527
- data?: any;
1528
- transformResponse?: ResponseTransformer | ResponseTransformer[];
1529
- };
1530
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
1531
- __isAmbassador: boolean;
1532
- };
1533
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
1534
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
1535
-
1536
- declare global {
1537
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
1538
- interface SymbolConstructor {
1539
- readonly observable: symbol;
1540
- }
1541
- }
1542
-
1543
- declare const emptyObjectSymbol: unique symbol;
1544
-
1545
- /**
1546
- Represents a strictly empty plain object, the `{}` value.
1547
-
1548
- 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)).
1549
-
1550
- @example
1551
- ```
1552
- import type {EmptyObject} from 'type-fest';
1553
-
1554
- // The following illustrates the problem with `{}`.
1555
- const foo1: {} = {}; // Pass
1556
- const foo2: {} = []; // Pass
1557
- const foo3: {} = 42; // Pass
1558
- const foo4: {} = {a: 1}; // Pass
1559
-
1560
- // With `EmptyObject` only the first case is valid.
1561
- const bar1: EmptyObject = {}; // Pass
1562
- const bar2: EmptyObject = 42; // Fail
1563
- const bar3: EmptyObject = []; // Fail
1564
- const bar4: EmptyObject = {a: 1}; // Fail
1565
- ```
1566
-
1567
- 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}.
1568
-
1569
- @category Object
1570
- */
1571
- type EmptyObject = {[emptyObjectSymbol]?: never};
1572
-
1573
- /**
1574
- Returns a boolean for whether the two given types are equal.
1575
-
1576
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
1577
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
1578
-
1579
- Use-cases:
1580
- - If you want to make a conditional branch based on the result of a comparison of two types.
1581
-
1582
- @example
1583
- ```
1584
- import type {IsEqual} from 'type-fest';
1585
-
1586
- // This type returns a boolean for whether the given array includes the given item.
1587
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
1588
- type Includes<Value extends readonly any[], Item> =
1589
- Value extends readonly [Value[0], ...infer rest]
1590
- ? IsEqual<Value[0], Item> extends true
1591
- ? true
1592
- : Includes<rest, Item>
1593
- : false;
1594
- ```
1595
-
1596
- @category Type Guard
1597
- @category Utilities
1598
- */
1599
- type IsEqual<A, B> =
1600
- (<G>() => G extends A ? 1 : 2) extends
1601
- (<G>() => G extends B ? 1 : 2)
1602
- ? true
1603
- : false;
1604
-
1605
- /**
1606
- Filter out keys from an object.
1607
-
1608
- Returns `never` if `Exclude` is strictly equal to `Key`.
1609
- Returns `never` if `Key` extends `Exclude`.
1610
- Returns `Key` otherwise.
1611
-
1612
- @example
1613
- ```
1614
- type Filtered = Filter<'foo', 'foo'>;
1615
- //=> never
1616
- ```
1617
-
1618
- @example
1619
- ```
1620
- type Filtered = Filter<'bar', string>;
1621
- //=> never
1622
- ```
1623
-
1624
- @example
1625
- ```
1626
- type Filtered = Filter<'bar', 'foo'>;
1627
- //=> 'bar'
1628
- ```
1629
-
1630
- @see {Except}
1631
- */
1632
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
1633
-
1634
- type ExceptOptions = {
1635
- /**
1636
- Disallow assigning non-specified properties.
1637
-
1638
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
1639
-
1640
- @default false
1641
- */
1642
- requireExactProps?: boolean;
1643
- };
1644
-
1645
- /**
1646
- Create a type from an object type without certain keys.
1647
-
1648
- We recommend setting the `requireExactProps` option to `true`.
1649
-
1650
- 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.
1651
-
1652
- 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)).
1653
-
1654
- @example
1655
- ```
1656
- import type {Except} from 'type-fest';
1657
-
1658
- type Foo = {
1659
- a: number;
1660
- b: string;
1661
- };
1662
-
1663
- type FooWithoutA = Except<Foo, 'a'>;
1664
- //=> {b: string}
1665
-
1666
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
1667
- //=> errors: 'a' does not exist in type '{ b: string; }'
1668
-
1669
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
1670
- //=> {a: number} & Partial<Record<"b", never>>
1671
-
1672
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
1673
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
1674
- ```
1675
-
1676
- @category Object
1677
- */
1678
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
1679
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
1680
- } & (Options['requireExactProps'] extends true
1681
- ? Partial<Record<KeysType, never>>
1682
- : {});
1683
-
1684
- /**
1685
- Extract the keys from a type where the value type of the key extends the given `Condition`.
1686
-
1687
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
1688
-
1689
- @example
1690
- ```
1691
- import type {ConditionalKeys} from 'type-fest';
1692
-
1693
- interface Example {
1694
- a: string;
1695
- b: string | number;
1696
- c?: string;
1697
- d: {};
820
+ interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
821
+ /** ID of a site visitor that has not logged in to the site. */
822
+ anonymousVisitorId?: string;
823
+ /** ID of a site visitor that has logged in to the site. */
824
+ memberId?: string;
825
+ /** ID of a Wix user (site owner, contributor, etc.). */
826
+ wixUserId?: string;
827
+ /** ID of an app. */
828
+ appId?: string;
829
+ /** @readonly */
830
+ identityType?: WebhookIdentityType$1;
1698
831
  }
1699
-
1700
- type StringKeysOnly = ConditionalKeys<Example, string>;
1701
- //=> 'a'
1702
- ```
1703
-
1704
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
1705
-
1706
- @example
1707
- ```
1708
- import type {ConditionalKeys} from 'type-fest';
1709
-
1710
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
1711
- //=> 'a' | 'c'
1712
- ```
1713
-
1714
- @category Object
1715
- */
1716
- type ConditionalKeys<Base, Condition> = NonNullable<
1717
- // Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
1718
- {
1719
- // Map through all the keys of the given base type.
1720
- [Key in keyof Base]:
1721
- // Pick only keys with types extending the given `Condition` type.
1722
- Base[Key] extends Condition
1723
- // Retain this key since the condition passes.
1724
- ? Key
1725
- // Discard this key since the condition fails.
1726
- : never;
1727
-
1728
- // Convert the produced object into a union type of the keys which passed the conditional test.
1729
- }[keyof Base]
1730
- >;
1731
-
1732
- /**
1733
- Exclude keys from a shape that matches the given `Condition`.
1734
-
1735
- 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.
1736
-
1737
- @example
1738
- ```
1739
- import type {Primitive, ConditionalExcept} from 'type-fest';
1740
-
1741
- class Awesome {
1742
- name: string;
1743
- successes: number;
1744
- failures: bigint;
1745
-
1746
- run() {}
832
+ /** @oneof */
833
+ interface IdentificationDataIdOneOf$1 {
834
+ /** ID of a site visitor that has not logged in to the site. */
835
+ anonymousVisitorId?: string;
836
+ /** ID of a site visitor that has logged in to the site. */
837
+ memberId?: string;
838
+ /** ID of a Wix user (site owner, contributor, etc.). */
839
+ wixUserId?: string;
840
+ /** ID of an app. */
841
+ appId?: string;
842
+ }
843
+ declare enum WebhookIdentityType$1 {
844
+ UNKNOWN = "UNKNOWN",
845
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
846
+ MEMBER = "MEMBER",
847
+ WIX_USER = "WIX_USER",
848
+ APP = "APP"
849
+ }
850
+ interface EchoRequestRequiredFields {
851
+ arg1: string;
852
+ }
853
+ interface MessageItemNonNullableFields {
854
+ innerMessage: string;
855
+ }
856
+ interface EchoMessageNonNullableFields {
857
+ message: string;
858
+ messagesList: MessageItemNonNullableFields[];
859
+ _id: string;
860
+ }
861
+ interface EchoResponseNonNullableFields {
862
+ echoMessage?: EchoMessageNonNullableFields;
863
+ message: string;
864
+ }
865
+ interface EchoMessage {
866
+ veloMessage: string;
867
+ id: string;
868
+ }
869
+ interface BaseEventMetadata {
870
+ /** App instance ID. */
871
+ instanceId?: string | null;
872
+ /** Event type. */
873
+ eventType?: string;
874
+ /** The identification type and identity data. */
875
+ identity?: IdentificationData$1;
876
+ }
877
+ interface EventMetadata extends BaseEventMetadata {
878
+ /**
879
+ * Unique event ID.
880
+ * Allows clients to ignore duplicate webhooks.
881
+ */
882
+ _id?: string;
883
+ /**
884
+ * Assumes actions are also always typed to an entity_type
885
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
886
+ */
887
+ entityFqdn?: string;
888
+ /**
889
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
890
+ * This is although the created/updated/deleted notion is duplication of the oneof types
891
+ * Example: created/updated/deleted/started/completed/email_opened
892
+ */
893
+ slug?: string;
894
+ /** ID of the entity associated with the event. */
895
+ entityId?: string;
896
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
897
+ eventTime?: Date;
898
+ /**
899
+ * Whether the event was triggered as a result of a privacy regulation application
900
+ * (for example, GDPR).
901
+ */
902
+ triggeredByAnonymizeRequest?: boolean | null;
903
+ /** If present, indicates the action that triggered the event. */
904
+ originatedFrom?: string | null;
905
+ /**
906
+ * A sequence number defining the order of updates to the underlying entity.
907
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
908
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
909
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
910
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
911
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
912
+ */
913
+ entityEventSequence?: string | null;
914
+ }
915
+ interface EchoDispatchedEnvelope {
916
+ data: Dispatched;
917
+ metadata: EventMetadata;
918
+ }
919
+ interface EchoOptions {
920
+ /** 2nd part of the message */
921
+ arg2?: string;
922
+ /** this field test translatable annotation */
923
+ titleField?: string;
924
+ someInt32?: number;
925
+ someDate?: Date;
1747
926
  }
1748
927
 
1749
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
1750
- //=> {run: () => void}
1751
- ```
928
+ declare function echo$1(httpClient: HttpClient): EchoSignature;
929
+ interface EchoSignature {
930
+ /**
931
+ * echo given arg1 and arg2
932
+ * @param - 1st part of the message
933
+ * @param - modified comment for arg2 el hovav
934
+ * @returns messge reseult as string
935
+ */
936
+ (arg1: string, options?: EchoOptions | undefined): Promise<string>;
937
+ }
938
+ declare const onEchoDispatched$1: EventDefinition$2<EchoDispatchedEnvelope, "wix.metroinspector.v1.echo_dispatched">;
1752
939
 
1753
- @example
1754
- ```
1755
- import type {ConditionalExcept} from 'type-fest';
940
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
941
+ __type: 'event-definition';
942
+ type: Type;
943
+ isDomainEvent?: boolean;
944
+ transformations?: (envelope: unknown) => Payload;
945
+ __payload: Payload;
946
+ };
947
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
948
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
949
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
1756
950
 
1757
- interface Example {
1758
- a: string;
1759
- b: string | number;
1760
- c: () => void;
1761
- d: {};
951
+ declare global {
952
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
953
+ interface SymbolConstructor {
954
+ readonly observable: symbol;
955
+ }
1762
956
  }
1763
957
 
1764
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
1765
- //=> {b: string | number; c: () => void; d: {}}
1766
- ```
958
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
1767
959
 
1768
- @category Object
1769
- */
1770
- type ConditionalExcept<Base, Condition> = Except<
1771
- Base,
1772
- ConditionalKeys<Base, Condition>
1773
- >;
960
+ declare const echo: MaybeContext<BuildRESTFunction<typeof echo$1> & typeof echo$1>;
1774
961
 
962
+ type _publicOnEchoDispatchedType = typeof onEchoDispatched$1;
1775
963
  /**
1776
- * Descriptors are objects that describe the API of a module, and the module
1777
- * can either be a REST module or a host module.
1778
- * This type is recursive, so it can describe nested modules.
1779
- */
1780
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
1781
- [key: string]: Descriptors | PublicMetadata | any;
1782
- };
1783
- /**
1784
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
1785
- * and returns an object with the same structure, but with all descriptors replaced with their API.
1786
- * Any non-descriptor properties are removed from the returned object, including descriptors that
1787
- * do not match the given host (as they will not work with the given host).
964
+ * echo event that might be consumed when somone says something!
1788
965
  */
1789
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
1790
- done: T;
1791
- recurse: T extends {
1792
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
1793
- } ? 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<{
1794
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
1795
- -1,
1796
- 0,
1797
- 1,
1798
- 2,
1799
- 3,
1800
- 4,
1801
- 5
1802
- ][Depth]> : never;
1803
- }, EmptyObject>;
1804
- }[Depth extends -1 ? 'done' : 'recurse'];
1805
- type PublicMetadata = {
1806
- PACKAGE_NAME?: string;
1807
- };
966
+ declare const onEchoDispatched: ReturnType<typeof createEventModule<_publicOnEchoDispatchedType>>;
1808
967
 
1809
- declare global {
1810
- interface ContextualClient {
1811
- }
968
+ type context$1_BaseEventMetadata = BaseEventMetadata;
969
+ type context$1_Dispatched = Dispatched;
970
+ type context$1_EchoDispatchedEnvelope = EchoDispatchedEnvelope;
971
+ type context$1_EchoMessage = EchoMessage;
972
+ type context$1_EchoOptions = EchoOptions;
973
+ type context$1_EchoRequest = EchoRequest;
974
+ type context$1_EchoRequestRequiredFields = EchoRequestRequiredFields;
975
+ type context$1_EchoResponse = EchoResponse;
976
+ type context$1_EchoResponseNonNullableFields = EchoResponseNonNullableFields;
977
+ type context$1_EventMetadata = EventMetadata;
978
+ type context$1_MessageItem = MessageItem;
979
+ type context$1__publicOnEchoDispatchedType = _publicOnEchoDispatchedType;
980
+ declare const context$1_echo: typeof echo;
981
+ declare const context$1_onEchoDispatched: typeof onEchoDispatched;
982
+ declare namespace context$1 {
983
+ export { type ActionEvent$1 as ActionEvent, type context$1_BaseEventMetadata as BaseEventMetadata, type context$1_Dispatched as Dispatched, type DomainEvent$1 as DomainEvent, type DomainEventBodyOneOf$1 as DomainEventBodyOneOf, type context$1_EchoDispatchedEnvelope as EchoDispatchedEnvelope, type context$1_EchoMessage as EchoMessage, type context$1_EchoOptions as EchoOptions, type context$1_EchoRequest as EchoRequest, type context$1_EchoRequestRequiredFields as EchoRequestRequiredFields, type context$1_EchoResponse as EchoResponse, type context$1_EchoResponseNonNullableFields as EchoResponseNonNullableFields, type EntityCreatedEvent$1 as EntityCreatedEvent, type EntityDeletedEvent$1 as EntityDeletedEvent, type EntityUpdatedEvent$1 as EntityUpdatedEvent, type context$1_EventMetadata as EventMetadata, type IdentificationData$1 as IdentificationData, type IdentificationDataIdOneOf$1 as IdentificationDataIdOneOf, type MessageEnvelope$1 as MessageEnvelope, type context$1_MessageItem as MessageItem, type RestoreInfo$1 as RestoreInfo, WebhookIdentityType$1 as WebhookIdentityType, type context$1__publicOnEchoDispatchedType as _publicOnEchoDispatchedType, context$1_echo as echo, context$1_onEchoDispatched as onEchoDispatched, onEchoDispatched$1 as publicOnEchoDispatched };
1812
984
  }
1813
- /**
1814
- * A type used to create concerete types from SDK descriptors in
1815
- * case a contextual client is available.
1816
- */
1817
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
1818
- host: Host;
1819
- } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
1820
985
 
1821
986
  /** Physical address */
1822
987
  interface Address extends AddressStreetOneOf {