@wix/sdk-types 1.5.2 → 1.5.4

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/index.d.mts CHANGED
@@ -16,9 +16,9 @@ type Host<Environment = unknown> = {
16
16
 
17
17
  type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
18
18
  interface HttpClient {
19
- request<T>(req: RequestOptionsFactory<T>): Promise<HttpResponse<T>>;
19
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
20
20
  }
21
- type RequestOptionsFactory<T = any> = (context: any) => RequestOptions<T>;
21
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
22
22
  type HttpResponse<T = any> = {
23
23
  data: T;
24
24
  status: number;
@@ -26,7 +26,7 @@ type HttpResponse<T = any> = {
26
26
  headers: any;
27
27
  request?: any;
28
28
  };
29
- type RequestOptions<Data = any> = {
29
+ type RequestOptions<_TResponse = any, Data = any> = {
30
30
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
31
31
  url: string;
32
32
  data?: Data;
@@ -43,6 +43,12 @@ type AuthenticationStrategy<Host = unknown> = {
43
43
  getAuthHeaders: (host: Host) => Promise<{
44
44
  headers: Record<string, string>;
45
45
  }>;
46
+ decodeJWT?: (token: string) => {
47
+ decoded: {
48
+ data: string;
49
+ };
50
+ valid: boolean;
51
+ };
46
52
  };
47
53
  type BoundAuthenticationStrategy = {
48
54
  getAuthHeaders: () => Promise<{
@@ -50,4 +56,9 @@ type BoundAuthenticationStrategy = {
50
56
  }>;
51
57
  };
52
58
 
53
- export type { APIMetadata, AuthenticationStrategy, BoundAuthenticationStrategy, BuildRESTFunction, Host, HostModule, HostModuleAPI, HttpClient, HttpResponse, RESTFunctionDescriptor, RequestOptions, RequestOptionsFactory };
59
+ type EventDefinition = {
60
+ type: string;
61
+ __payload: any;
62
+ };
63
+
64
+ export type { APIMetadata, AuthenticationStrategy, BoundAuthenticationStrategy, BuildRESTFunction, EventDefinition, Host, HostModule, HostModuleAPI, HttpClient, HttpResponse, RESTFunctionDescriptor, RequestOptions, RequestOptionsFactory };
package/build/index.d.ts CHANGED
@@ -16,9 +16,9 @@ type Host<Environment = unknown> = {
16
16
 
17
17
  type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
18
18
  interface HttpClient {
19
- request<T>(req: RequestOptionsFactory<T>): Promise<HttpResponse<T>>;
19
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
20
20
  }
21
- type RequestOptionsFactory<T = any> = (context: any) => RequestOptions<T>;
21
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
22
22
  type HttpResponse<T = any> = {
23
23
  data: T;
24
24
  status: number;
@@ -26,7 +26,7 @@ type HttpResponse<T = any> = {
26
26
  headers: any;
27
27
  request?: any;
28
28
  };
29
- type RequestOptions<Data = any> = {
29
+ type RequestOptions<_TResponse = any, Data = any> = {
30
30
  method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
31
31
  url: string;
32
32
  data?: Data;
@@ -43,6 +43,12 @@ type AuthenticationStrategy<Host = unknown> = {
43
43
  getAuthHeaders: (host: Host) => Promise<{
44
44
  headers: Record<string, string>;
45
45
  }>;
46
+ decodeJWT?: (token: string) => {
47
+ decoded: {
48
+ data: string;
49
+ };
50
+ valid: boolean;
51
+ };
46
52
  };
47
53
  type BoundAuthenticationStrategy = {
48
54
  getAuthHeaders: () => Promise<{
@@ -50,4 +56,9 @@ type BoundAuthenticationStrategy = {
50
56
  }>;
51
57
  };
52
58
 
53
- export type { APIMetadata, AuthenticationStrategy, BoundAuthenticationStrategy, BuildRESTFunction, Host, HostModule, HostModuleAPI, HttpClient, HttpResponse, RESTFunctionDescriptor, RequestOptions, RequestOptionsFactory };
59
+ type EventDefinition = {
60
+ type: string;
61
+ __payload: any;
62
+ };
63
+
64
+ export type { APIMetadata, AuthenticationStrategy, BoundAuthenticationStrategy, BuildRESTFunction, EventDefinition, Host, HostModule, HostModuleAPI, HttpClient, HttpResponse, RESTFunctionDescriptor, RequestOptions, RequestOptionsFactory };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/sdk-types",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "Ronny Ringel",
@@ -28,11 +28,11 @@
28
28
  "*.{js,ts}": "yarn lint"
29
29
  },
30
30
  "devDependencies": {
31
- "@types/node": "^20.10.0",
32
- "eslint": "^7.32.0",
31
+ "@types/node": "^20.10.6",
32
+ "eslint": "^8.56.0",
33
33
  "eslint-config-sdk": "0.0.0",
34
34
  "tsup": "^7.3.0",
35
- "typescript": "^5.3.2"
35
+ "typescript": "^5.3.3"
36
36
  },
37
37
  "yoshiFlowLibrary": {
38
38
  "buildEsmWithBabel": true
@@ -57,5 +57,5 @@
57
57
  "wallaby": {
58
58
  "autoDetect": true
59
59
  },
60
- "falconPackageHash": "dc7a23cf9438bfbbcb58bb7f92eaf9275a78f18498ecc02ef185f002"
60
+ "falconPackageHash": "2fdfbda514e398da08ace8183f4e326ea59ed4d3663150e03d6ef31a"
61
61
  }