@wix/sdk-types 1.6.0 → 1.6.2

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.
package/build/index.d.mts CHANGED
@@ -61,6 +61,17 @@ type BoundAuthenticationStrategy = {
61
61
  };
62
62
  };
63
63
 
64
+ type EventIdentity = {
65
+ identityType: 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
66
+ anonymousVisitorId: string;
67
+ memberId: string;
68
+ wixUserId: string;
69
+ appId: string;
70
+ };
71
+ type BaseEventMetadata = {
72
+ instanceId: string;
73
+ identity: EventIdentity;
74
+ };
64
75
  type EventDefinition<Payload = unknown, Type extends string = string> = {
65
76
  __type: 'event-definition';
66
77
  type: Type;
@@ -69,31 +80,7 @@ type EventDefinition<Payload = unknown, Type extends string = string> = {
69
80
  __payload: Payload;
70
81
  };
71
82
  declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
72
- type DomainEvent<ActionType extends 'create' | 'update' | 'delete' | 'action', Payload> = {
73
- id: string;
74
- entityFqdn: string;
75
- slug: string;
76
- entityId: string;
77
- eventTime: Date;
78
- triggeredByAnonymizeRequest: boolean;
79
- originatedFrom: string;
80
- } & (ActionType extends 'action' ? {
81
- actionEvent: {
82
- body: Payload;
83
- };
84
- } : ActionType extends 'create' ? {
85
- createdEvent: {
86
- entity: Payload;
87
- };
88
- } : ActionType extends 'update' ? {
89
- updatedEvent: {
90
- currentEntity: Payload;
91
- };
92
- } : ActionType extends 'delete' ? {
93
- deletedEvent: Payload;
94
- } : never);
95
- type PayloadOfEventDefinition<T extends EventDefinition<any, any>> = T extends EventDefinition<infer P, any> ? P : never;
96
- type EventHandler<T extends EventDefinition> = (payload: PayloadOfEventDefinition<T>, metadata: unknown) => void | Promise<void>;
83
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
97
84
  type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
98
85
 
99
86
  type SPIDefinition<TInput, TResult> = {
@@ -101,4 +88,4 @@ type SPIDefinition<TInput, TResult> = {
101
88
  __result: TResult;
102
89
  };
103
90
 
104
- export { type APIMetadata, type AuthenticationStrategy, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, type DomainEvent, EventDefinition, type EventHandler, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type SPIDefinition };
91
+ export { type APIMetadata, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, EventDefinition, type EventHandler, type EventIdentity, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type SPIDefinition };
package/build/index.d.ts CHANGED
@@ -61,6 +61,17 @@ type BoundAuthenticationStrategy = {
61
61
  };
62
62
  };
63
63
 
64
+ type EventIdentity = {
65
+ identityType: 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
66
+ anonymousVisitorId: string;
67
+ memberId: string;
68
+ wixUserId: string;
69
+ appId: string;
70
+ };
71
+ type BaseEventMetadata = {
72
+ instanceId: string;
73
+ identity: EventIdentity;
74
+ };
64
75
  type EventDefinition<Payload = unknown, Type extends string = string> = {
65
76
  __type: 'event-definition';
66
77
  type: Type;
@@ -69,31 +80,7 @@ type EventDefinition<Payload = unknown, Type extends string = string> = {
69
80
  __payload: Payload;
70
81
  };
71
82
  declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
72
- type DomainEvent<ActionType extends 'create' | 'update' | 'delete' | 'action', Payload> = {
73
- id: string;
74
- entityFqdn: string;
75
- slug: string;
76
- entityId: string;
77
- eventTime: Date;
78
- triggeredByAnonymizeRequest: boolean;
79
- originatedFrom: string;
80
- } & (ActionType extends 'action' ? {
81
- actionEvent: {
82
- body: Payload;
83
- };
84
- } : ActionType extends 'create' ? {
85
- createdEvent: {
86
- entity: Payload;
87
- };
88
- } : ActionType extends 'update' ? {
89
- updatedEvent: {
90
- currentEntity: Payload;
91
- };
92
- } : ActionType extends 'delete' ? {
93
- deletedEvent: Payload;
94
- } : never);
95
- type PayloadOfEventDefinition<T extends EventDefinition<any, any>> = T extends EventDefinition<infer P, any> ? P : never;
96
- type EventHandler<T extends EventDefinition> = (payload: PayloadOfEventDefinition<T>, metadata: unknown) => void | Promise<void>;
83
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
97
84
  type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
98
85
 
99
86
  type SPIDefinition<TInput, TResult> = {
@@ -101,4 +88,4 @@ type SPIDefinition<TInput, TResult> = {
101
88
  __result: TResult;
102
89
  };
103
90
 
104
- export { type APIMetadata, type AuthenticationStrategy, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, type DomainEvent, EventDefinition, type EventHandler, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type SPIDefinition };
91
+ export { type APIMetadata, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, EventDefinition, type EventHandler, type EventIdentity, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type SPIDefinition };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/sdk-types",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "Ronny Ringel",
@@ -57,5 +57,5 @@
57
57
  "wallaby": {
58
58
  "autoDetect": true
59
59
  },
60
- "falconPackageHash": "dfd4b7c02207e404e4c5aef688534e4416df961e3a6b42271666041b"
60
+ "falconPackageHash": "8bdee3bf0efc29f94318cd08f133a2fce89a11e0eee7723cefc8437e"
61
61
  }