@wix/sdk-types 1.5.7 → 1.5.8

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,6 +1,6 @@
1
1
  // src/webhooks.ts
2
- function EventDefinition(type) {
3
- return () => ({ type });
2
+ function EventDefinition(type, isDomainEvent = false) {
3
+ return () => ({ type, isDomainEvent });
4
4
  }
5
5
  export {
6
6
  EventDefinition
package/build/index.d.mts CHANGED
@@ -58,13 +58,37 @@ type BoundAuthenticationStrategy = {
58
58
 
59
59
  type EventDefinition<Payload = unknown, Type extends string = string> = {
60
60
  type: Type;
61
+ isDomainEvent?: boolean;
61
62
  __payload: Payload;
62
63
  };
63
- declare function EventDefinition<Type extends string>(type: Type): <Payload = unknown>() => EventDefinition<Payload, Type>;
64
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean): <Payload = unknown>() => EventDefinition<Payload, Type>;
65
+ type DomainEvent<ActionType extends 'create' | 'update' | 'delete' | 'action', Payload> = {
66
+ id: string;
67
+ entityFqdn: string;
68
+ slug: string;
69
+ entityId: string;
70
+ eventTime: Date;
71
+ triggeredByAnonymizeRequest: boolean;
72
+ originatedFrom: string;
73
+ } & (ActionType extends 'action' ? {
74
+ actionEvent: {
75
+ body: Payload;
76
+ };
77
+ } : ActionType extends 'create' ? {
78
+ createdEvent: {
79
+ entity: Payload;
80
+ };
81
+ } : ActionType extends 'update' ? {
82
+ updatedEvent: {
83
+ currentEntity: Payload;
84
+ };
85
+ } : ActionType extends 'delete' ? {
86
+ deletedEvent: Payload;
87
+ } : never);
64
88
 
65
89
  type SPIDefinition<TInput, TResult> = {
66
90
  __input: TInput;
67
91
  __result: TResult;
68
92
  };
69
93
 
70
- export { type APIMetadata, type AuthenticationStrategy, type BoundAuthenticationStrategy, type BuildRESTFunction, EventDefinition, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type SPIDefinition };
94
+ export { type APIMetadata, type AuthenticationStrategy, type BoundAuthenticationStrategy, type BuildRESTFunction, type DomainEvent, EventDefinition, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type SPIDefinition };
package/build/index.d.ts CHANGED
@@ -58,13 +58,37 @@ type BoundAuthenticationStrategy = {
58
58
 
59
59
  type EventDefinition<Payload = unknown, Type extends string = string> = {
60
60
  type: Type;
61
+ isDomainEvent?: boolean;
61
62
  __payload: Payload;
62
63
  };
63
- declare function EventDefinition<Type extends string>(type: Type): <Payload = unknown>() => EventDefinition<Payload, Type>;
64
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean): <Payload = unknown>() => EventDefinition<Payload, Type>;
65
+ type DomainEvent<ActionType extends 'create' | 'update' | 'delete' | 'action', Payload> = {
66
+ id: string;
67
+ entityFqdn: string;
68
+ slug: string;
69
+ entityId: string;
70
+ eventTime: Date;
71
+ triggeredByAnonymizeRequest: boolean;
72
+ originatedFrom: string;
73
+ } & (ActionType extends 'action' ? {
74
+ actionEvent: {
75
+ body: Payload;
76
+ };
77
+ } : ActionType extends 'create' ? {
78
+ createdEvent: {
79
+ entity: Payload;
80
+ };
81
+ } : ActionType extends 'update' ? {
82
+ updatedEvent: {
83
+ currentEntity: Payload;
84
+ };
85
+ } : ActionType extends 'delete' ? {
86
+ deletedEvent: Payload;
87
+ } : never);
64
88
 
65
89
  type SPIDefinition<TInput, TResult> = {
66
90
  __input: TInput;
67
91
  __result: TResult;
68
92
  };
69
93
 
70
- export { type APIMetadata, type AuthenticationStrategy, type BoundAuthenticationStrategy, type BuildRESTFunction, EventDefinition, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type SPIDefinition };
94
+ export { type APIMetadata, type AuthenticationStrategy, type BoundAuthenticationStrategy, type BuildRESTFunction, type DomainEvent, EventDefinition, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type SPIDefinition };
package/build/index.js CHANGED
@@ -25,8 +25,8 @@ __export(src_exports, {
25
25
  module.exports = __toCommonJS(src_exports);
26
26
 
27
27
  // src/webhooks.ts
28
- function EventDefinition(type) {
29
- return () => ({ type });
28
+ function EventDefinition(type, isDomainEvent = false) {
29
+ return () => ({ type, isDomainEvent });
30
30
  }
31
31
  // Annotate the CommonJS export names for ESM import in node:
32
32
  0 && (module.exports = {
package/build/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/webhooks.ts
2
- function EventDefinition(type) {
3
- return () => ({ type });
2
+ function EventDefinition(type, isDomainEvent = false) {
3
+ return () => ({ type, isDomainEvent });
4
4
  }
5
5
  export {
6
6
  EventDefinition
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/sdk-types",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
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": "11cd2184d696f61c8d1abb447f1f9be0194458f59c8e3b52a4a42c54"
60
+ "falconPackageHash": "c863e1912299e6c0a29e751a05c4ca155ec801e710e0515a5c94fc31"
61
61
  }