@wix/sdk-types 1.7.0 → 1.7.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/browser/index.mjs +4 -3
- package/build/index.d.mts +10 -15
- package/build/index.d.ts +10 -15
- package/build/index.js +4 -3
- package/build/index.mjs +4 -3
- package/package.json +2 -2
package/build/browser/index.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
// src/event-handlers-modules.ts
|
|
2
|
-
function EventDefinition(type, isDomainEvent = false,
|
|
2
|
+
function EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {
|
|
3
3
|
return () => ({
|
|
4
4
|
__type: "event-definition",
|
|
5
5
|
type,
|
|
6
6
|
isDomainEvent,
|
|
7
|
-
transformations
|
|
7
|
+
transformations
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// src/service-plugins.ts
|
|
12
|
-
function ServicePluginDefinition(methods) {
|
|
12
|
+
function ServicePluginDefinition(componentType, methods) {
|
|
13
13
|
return {
|
|
14
14
|
__type: "service-plugin-definition",
|
|
15
|
+
componentType,
|
|
15
16
|
methods
|
|
16
17
|
};
|
|
17
18
|
}
|
package/build/index.d.mts
CHANGED
|
@@ -76,38 +76,33 @@ type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
|
76
76
|
__type: 'event-definition';
|
|
77
77
|
type: Type;
|
|
78
78
|
isDomainEvent?: boolean;
|
|
79
|
-
transformations?: unknown;
|
|
79
|
+
transformations?: (envelope: unknown) => Payload;
|
|
80
80
|
__payload: Payload;
|
|
81
81
|
};
|
|
82
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean,
|
|
82
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
83
83
|
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
84
84
|
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
85
85
|
|
|
86
|
-
type
|
|
86
|
+
type ServicePluginMethodInput = {
|
|
87
87
|
request: any;
|
|
88
88
|
metadata: any;
|
|
89
|
-
}
|
|
89
|
+
};
|
|
90
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
90
91
|
type ServicePluginMethodMetadata = {
|
|
91
92
|
name: string;
|
|
92
93
|
primaryHttpMappingPath: string;
|
|
93
94
|
transformations: {
|
|
94
|
-
fromREST: (...args: unknown[]) =>
|
|
95
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
95
96
|
toREST: (...args: unknown[]) => unknown;
|
|
96
97
|
};
|
|
97
98
|
};
|
|
98
99
|
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
99
100
|
__type: 'service-plugin-definition';
|
|
101
|
+
componentType: string;
|
|
100
102
|
methods: ServicePluginMethodMetadata[];
|
|
101
103
|
__contract: Contract;
|
|
102
104
|
};
|
|
103
|
-
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
104
|
-
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> =
|
|
105
|
-
provide(implementation: T['__contract']): void;
|
|
106
|
-
processRequest(request: Request): Promise<Response>;
|
|
107
|
-
process(request: {
|
|
108
|
-
url: string;
|
|
109
|
-
body: string;
|
|
110
|
-
}): Promise<unknown>;
|
|
111
|
-
};
|
|
105
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
106
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
112
107
|
|
|
113
|
-
export { type APIMetadata, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, type BuildServicePluginDefinition, EventDefinition, type EventHandler, type EventIdentity, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type ServicePluginContract, ServicePluginDefinition, type ServicePluginMethodMetadata };
|
|
108
|
+
export { type APIMetadata, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, type BuildServicePluginDefinition, EventDefinition, type EventHandler, type EventIdentity, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type ServicePluginContract, ServicePluginDefinition, type ServicePluginMethodInput, type ServicePluginMethodMetadata };
|
package/build/index.d.ts
CHANGED
|
@@ -76,38 +76,33 @@ type EventDefinition<Payload = unknown, Type extends string = string> = {
|
|
|
76
76
|
__type: 'event-definition';
|
|
77
77
|
type: Type;
|
|
78
78
|
isDomainEvent?: boolean;
|
|
79
|
-
transformations?: unknown;
|
|
79
|
+
transformations?: (envelope: unknown) => Payload;
|
|
80
80
|
__payload: Payload;
|
|
81
81
|
};
|
|
82
|
-
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean,
|
|
82
|
+
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
|
|
83
83
|
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
|
|
84
84
|
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
|
|
85
85
|
|
|
86
|
-
type
|
|
86
|
+
type ServicePluginMethodInput = {
|
|
87
87
|
request: any;
|
|
88
88
|
metadata: any;
|
|
89
|
-
}
|
|
89
|
+
};
|
|
90
|
+
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
|
|
90
91
|
type ServicePluginMethodMetadata = {
|
|
91
92
|
name: string;
|
|
92
93
|
primaryHttpMappingPath: string;
|
|
93
94
|
transformations: {
|
|
94
|
-
fromREST: (...args: unknown[]) =>
|
|
95
|
+
fromREST: (...args: unknown[]) => ServicePluginMethodInput;
|
|
95
96
|
toREST: (...args: unknown[]) => unknown;
|
|
96
97
|
};
|
|
97
98
|
};
|
|
98
99
|
type ServicePluginDefinition<Contract extends ServicePluginContract> = {
|
|
99
100
|
__type: 'service-plugin-definition';
|
|
101
|
+
componentType: string;
|
|
100
102
|
methods: ServicePluginMethodMetadata[];
|
|
101
103
|
__contract: Contract;
|
|
102
104
|
};
|
|
103
|
-
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
104
|
-
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> =
|
|
105
|
-
provide(implementation: T['__contract']): void;
|
|
106
|
-
processRequest(request: Request): Promise<Response>;
|
|
107
|
-
process(request: {
|
|
108
|
-
url: string;
|
|
109
|
-
body: string;
|
|
110
|
-
}): Promise<unknown>;
|
|
111
|
-
};
|
|
105
|
+
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
|
|
106
|
+
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
|
|
112
107
|
|
|
113
|
-
export { type APIMetadata, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, type BuildServicePluginDefinition, EventDefinition, type EventHandler, type EventIdentity, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type ServicePluginContract, ServicePluginDefinition, type ServicePluginMethodMetadata };
|
|
108
|
+
export { type APIMetadata, type AuthenticationStrategy, type BaseEventMetadata, type BoundAuthenticationStrategy, type BuildEventDefinition, type BuildRESTFunction, type BuildServicePluginDefinition, EventDefinition, type EventHandler, type EventIdentity, type Host, type HostModule, type HostModuleAPI, type HttpClient, type HttpResponse, type RESTFunctionDescriptor, type RequestOptions, type RequestOptionsFactory, type ServicePluginContract, ServicePluginDefinition, type ServicePluginMethodInput, type ServicePluginMethodMetadata };
|
package/build/index.js
CHANGED
|
@@ -26,19 +26,20 @@ __export(src_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(src_exports);
|
|
27
27
|
|
|
28
28
|
// src/event-handlers-modules.ts
|
|
29
|
-
function EventDefinition(type, isDomainEvent = false,
|
|
29
|
+
function EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {
|
|
30
30
|
return () => ({
|
|
31
31
|
__type: "event-definition",
|
|
32
32
|
type,
|
|
33
33
|
isDomainEvent,
|
|
34
|
-
transformations
|
|
34
|
+
transformations
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// src/service-plugins.ts
|
|
39
|
-
function ServicePluginDefinition(methods) {
|
|
39
|
+
function ServicePluginDefinition(componentType, methods) {
|
|
40
40
|
return {
|
|
41
41
|
__type: "service-plugin-definition",
|
|
42
|
+
componentType,
|
|
42
43
|
methods
|
|
43
44
|
};
|
|
44
45
|
}
|
package/build/index.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
// src/event-handlers-modules.ts
|
|
2
|
-
function EventDefinition(type, isDomainEvent = false,
|
|
2
|
+
function EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {
|
|
3
3
|
return () => ({
|
|
4
4
|
__type: "event-definition",
|
|
5
5
|
type,
|
|
6
6
|
isDomainEvent,
|
|
7
|
-
transformations
|
|
7
|
+
transformations
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// src/service-plugins.ts
|
|
12
|
-
function ServicePluginDefinition(methods) {
|
|
12
|
+
function ServicePluginDefinition(componentType, methods) {
|
|
13
13
|
return {
|
|
14
14
|
__type: "service-plugin-definition",
|
|
15
|
+
componentType,
|
|
15
16
|
methods
|
|
16
17
|
};
|
|
17
18
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/sdk-types",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.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": "
|
|
60
|
+
"falconPackageHash": "090d1e823bbdc07dcb40409533d801ef3e87d89a7b97e8f1fd422674"
|
|
61
61
|
}
|