@wix/sdk-types 1.5.11 → 1.6.1
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/browser/index.mjs +1 -1
- package/build/index.d.mts +19 -3
- package/build/index.d.ts +19 -3
- package/build/index.js +1 -1
- package/build/index.mjs +1 -1
- package/package.json +2 -2
package/build/browser/index.mjs
CHANGED
package/build/index.d.mts
CHANGED
|
@@ -61,14 +61,26 @@ type BoundAuthenticationStrategy = {
|
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
type
|
|
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
|
+
};
|
|
75
|
+
type EventDefinition<Payload = unknown, Type extends string = string, Metadata = BaseEventMetadata> = {
|
|
65
76
|
__type: 'event-definition';
|
|
66
77
|
type: Type;
|
|
67
78
|
isDomainEvent?: boolean;
|
|
68
79
|
transformations?: unknown;
|
|
69
80
|
__payload: Payload;
|
|
81
|
+
__metadata: Metadata;
|
|
70
82
|
};
|
|
71
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
83
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown, Metadata = BaseEventMetadata>() => EventDefinition<Payload, Type, Metadata>;
|
|
72
84
|
type DomainEvent<ActionType extends 'create' | 'update' | 'delete' | 'action', Payload> = {
|
|
73
85
|
id: string;
|
|
74
86
|
entityFqdn: string;
|
|
@@ -92,10 +104,14 @@ type DomainEvent<ActionType extends 'create' | 'update' | 'delete' | 'action', P
|
|
|
92
104
|
} : ActionType extends 'delete' ? {
|
|
93
105
|
deletedEvent: Payload;
|
|
94
106
|
} : never);
|
|
107
|
+
type PayloadOfEventDefinition<T extends EventDefinition<any, any, any>> = T extends EventDefinition<infer P, any, any> ? P : never;
|
|
108
|
+
type MetadataOfEventDefinition<T extends EventDefinition<any, any, any>> = T extends EventDefinition<any, any, infer M> ? M : never;
|
|
109
|
+
type EventHandler<T extends EventDefinition> = (payload: PayloadOfEventDefinition<T>, metadata: MetadataOfEventDefinition<T>) => void | Promise<void>;
|
|
110
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
95
111
|
|
|
96
112
|
type SPIDefinition<TInput, TResult> = {
|
|
97
113
|
__input: TInput;
|
|
98
114
|
__result: TResult;
|
|
99
115
|
};
|
|
100
116
|
|
|
101
|
-
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 };
|
|
117
|
+
export { type APIMetadata, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, type DomainEvent, 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,14 +61,26 @@ type BoundAuthenticationStrategy = {
|
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
type
|
|
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
|
+
};
|
|
75
|
+
type EventDefinition<Payload = unknown, Type extends string = string, Metadata = BaseEventMetadata> = {
|
|
65
76
|
__type: 'event-definition';
|
|
66
77
|
type: Type;
|
|
67
78
|
isDomainEvent?: boolean;
|
|
68
79
|
transformations?: unknown;
|
|
69
80
|
__payload: Payload;
|
|
81
|
+
__metadata: Metadata;
|
|
70
82
|
};
|
|
71
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
83
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown, Metadata = BaseEventMetadata>() => EventDefinition<Payload, Type, Metadata>;
|
|
72
84
|
type DomainEvent<ActionType extends 'create' | 'update' | 'delete' | 'action', Payload> = {
|
|
73
85
|
id: string;
|
|
74
86
|
entityFqdn: string;
|
|
@@ -92,10 +104,14 @@ type DomainEvent<ActionType extends 'create' | 'update' | 'delete' | 'action', P
|
|
|
92
104
|
} : ActionType extends 'delete' ? {
|
|
93
105
|
deletedEvent: Payload;
|
|
94
106
|
} : never);
|
|
107
|
+
type PayloadOfEventDefinition<T extends EventDefinition<any, any, any>> = T extends EventDefinition<infer P, any, any> ? P : never;
|
|
108
|
+
type MetadataOfEventDefinition<T extends EventDefinition<any, any, any>> = T extends EventDefinition<any, any, infer M> ? M : never;
|
|
109
|
+
type EventHandler<T extends EventDefinition> = (payload: PayloadOfEventDefinition<T>, metadata: MetadataOfEventDefinition<T>) => void | Promise<void>;
|
|
110
|
+
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
95
111
|
|
|
96
112
|
type SPIDefinition<TInput, TResult> = {
|
|
97
113
|
__input: TInput;
|
|
98
114
|
__result: TResult;
|
|
99
115
|
};
|
|
100
116
|
|
|
101
|
-
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 };
|
|
117
|
+
export { type APIMetadata, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, type DomainEvent, 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.js
CHANGED
|
@@ -24,7 +24,7 @@ __export(src_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(src_exports);
|
|
26
26
|
|
|
27
|
-
// src/
|
|
27
|
+
// src/event-handlers-modules.ts
|
|
28
28
|
function EventDefinition(type, isDomainEvent = false, _transformations = {}) {
|
|
29
29
|
return () => ({
|
|
30
30
|
__type: "event-definition",
|
package/build/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/sdk-types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
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": "
|
|
60
|
+
"falconPackageHash": "3f500110266751683931624a48ec5ccf57781bd46b01deaffd4e4b81"
|
|
61
61
|
}
|