@wix/sdk-types 1.6.3 → 1.7.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.
@@ -7,6 +7,16 @@ function EventDefinition(type, isDomainEvent = false, _transformations = {}) {
7
7
  transformations: _transformations
8
8
  });
9
9
  }
10
+
11
+ // src/service-plugins.ts
12
+ function ServicePluginDefinition(componentType, methods) {
13
+ return {
14
+ __type: "service-plugin-definition",
15
+ componentType,
16
+ methods
17
+ };
18
+ }
10
19
  export {
11
- EventDefinition
20
+ EventDefinition,
21
+ ServicePluginDefinition
12
22
  };
package/build/index.d.mts CHANGED
@@ -83,9 +83,26 @@ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?
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 SPIDefinition<TInput, TResult> = {
87
- __input: TInput;
88
- __result: TResult;
86
+ type ServicePluginMethodInput = {
87
+ request: any;
88
+ metadata: any;
89
89
  };
90
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
91
+ type ServicePluginMethodMetadata = {
92
+ name: string;
93
+ primaryHttpMappingPath: string;
94
+ transformations: {
95
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
96
+ toREST: (...args: unknown[]) => unknown;
97
+ };
98
+ };
99
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
100
+ __type: 'service-plugin-definition';
101
+ componentType: string;
102
+ methods: ServicePluginMethodMetadata[];
103
+ __contract: Contract;
104
+ };
105
+ declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
106
+ type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
90
107
 
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 };
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
@@ -83,9 +83,26 @@ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?
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 SPIDefinition<TInput, TResult> = {
87
- __input: TInput;
88
- __result: TResult;
86
+ type ServicePluginMethodInput = {
87
+ request: any;
88
+ metadata: any;
89
89
  };
90
+ type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
91
+ type ServicePluginMethodMetadata = {
92
+ name: string;
93
+ primaryHttpMappingPath: string;
94
+ transformations: {
95
+ fromREST: (...args: unknown[]) => ServicePluginMethodInput;
96
+ toREST: (...args: unknown[]) => unknown;
97
+ };
98
+ };
99
+ type ServicePluginDefinition<Contract extends ServicePluginContract> = {
100
+ __type: 'service-plugin-definition';
101
+ componentType: string;
102
+ methods: ServicePluginMethodMetadata[];
103
+ __contract: Contract;
104
+ };
105
+ declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
106
+ type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
90
107
 
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 };
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
@@ -20,7 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
- EventDefinition: () => EventDefinition
23
+ EventDefinition: () => EventDefinition,
24
+ ServicePluginDefinition: () => ServicePluginDefinition
24
25
  });
25
26
  module.exports = __toCommonJS(src_exports);
26
27
 
@@ -33,7 +34,17 @@ function EventDefinition(type, isDomainEvent = false, _transformations = {}) {
33
34
  transformations: _transformations
34
35
  });
35
36
  }
37
+
38
+ // src/service-plugins.ts
39
+ function ServicePluginDefinition(componentType, methods) {
40
+ return {
41
+ __type: "service-plugin-definition",
42
+ componentType,
43
+ methods
44
+ };
45
+ }
36
46
  // Annotate the CommonJS export names for ESM import in node:
37
47
  0 && (module.exports = {
38
- EventDefinition
48
+ EventDefinition,
49
+ ServicePluginDefinition
39
50
  });
package/build/index.mjs CHANGED
@@ -7,6 +7,16 @@ function EventDefinition(type, isDomainEvent = false, _transformations = {}) {
7
7
  transformations: _transformations
8
8
  });
9
9
  }
10
+
11
+ // src/service-plugins.ts
12
+ function ServicePluginDefinition(componentType, methods) {
13
+ return {
14
+ __type: "service-plugin-definition",
15
+ componentType,
16
+ methods
17
+ };
18
+ }
10
19
  export {
11
- EventDefinition
20
+ EventDefinition,
21
+ ServicePluginDefinition
12
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/sdk-types",
3
- "version": "1.6.3",
3
+ "version": "1.7.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": "8fdfc66b563a15771a4ebaa9dd3c1e09cf1e6434727a208e0c123165"
60
+ "falconPackageHash": "1625d05bd31b4f3c4d050efc021096c2680fe38d4b6c6c0da9f479f1"
61
61
  }