@wix/sdk-types
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -64,3 +64,14 @@ type HostModule<T, H extends Host> = { | ||
type EventDefinition<Payload = unknown, Type extends string = string> = { | ||
type EventIdentity = { | ||
identityType: 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP'; | ||
anonymousVisitorId: string; | ||
memberId: string; | ||
wixUserId: string; | ||
appId: string; | ||
}; | ||
type BaseEventMetadata = { | ||
instanceId: string; | ||
identity: EventIdentity; | ||
}; | ||
type EventDefinition<Payload = unknown, Type extends string = string, Metadata = BaseEventMetadata> = { | ||
__type: 'event-definition'; | ||
@@ -71,4 +82,5 @@ type: Type; | ||
__payload: Payload; | ||
__metadata: Metadata; | ||
}; | ||
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>; | ||
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown, Metadata = BaseEventMetadata>() => EventDefinition<Payload, Type, Metadata>; | ||
type DomainEvent<ActionType extends 'create' | 'update' | 'delete' | 'action', Payload> = { | ||
@@ -97,4 +109,5 @@ id: string; | ||
} : never); | ||
type PayloadOfEventDefinition<T extends EventDefinition<any, any>> = T extends EventDefinition<infer P, any> ? P : never; | ||
type EventHandler<T extends EventDefinition> = (payload: PayloadOfEventDefinition<T>, metadata: unknown) => void | Promise<void>; | ||
type PayloadOfEventDefinition<T extends EventDefinition<any, any, any>> = T extends EventDefinition<infer P, any, any> ? P : never; | ||
type MetadataOfEventDefinition<T extends EventDefinition<any, any, any>> = T extends EventDefinition<any, any, infer M> ? M : never; | ||
type EventHandler<T extends EventDefinition> = (payload: PayloadOfEventDefinition<T>, metadata: MetadataOfEventDefinition<T>) => void | Promise<void>; | ||
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void; | ||
@@ -107,2 +120,2 @@ | ||
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 }; | ||
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 }; |
{ | ||
"name": "@wix/sdk-types", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"license": "UNLICENSED", | ||
@@ -60,3 +60,3 @@ "author": { | ||
}, | ||
"falconPackageHash": "dfd4b7c02207e404e4c5aef688534e4416df961e3a6b42271666041b" | ||
"falconPackageHash": "3f500110266751683931624a48ec5ccf57781bd46b01deaffd4e4b81" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12018
174