@unito/integration-sdk 0.1.2 → 0.1.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.
@@ -28,7 +28,7 @@ export interface RequestOptions {
28
28
  };
29
29
  }
30
30
  export interface Response<T> {
31
- data: T | undefined;
31
+ data: T;
32
32
  status: number;
33
33
  headers: Headers;
34
34
  }
@@ -54,6 +54,6 @@ export declare class Provider {
54
54
  post<T>(endpoint: string, body: Record<string, unknown>, options: RequestOptions): Promise<Response<T>>;
55
55
  put<T>(endpoint: string, body: Record<string, unknown>, options: RequestOptions): Promise<Response<T>>;
56
56
  patch<T>(endpoint: string, body: Record<string, unknown>, options: RequestOptions): Promise<Response<T>>;
57
- delete<T>(endpoint: string, options: RequestOptions): Promise<Response<T>>;
57
+ delete<T = undefined>(endpoint: string, options: RequestOptions): Promise<Response<T>>;
58
58
  private fetchWrapper;
59
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Integration SDK",
5
5
  "type": "module",
6
6
  "types": "dist/src/index.d.ts",
@@ -29,7 +29,7 @@ export interface RequestOptions {
29
29
  }
30
30
 
31
31
  export interface Response<T> {
32
- data: T | undefined;
32
+ data: T;
33
33
  status: number;
34
34
  headers: Headers;
35
35
  }
@@ -100,7 +100,7 @@ export class Provider {
100
100
  });
101
101
  }
102
102
 
103
- public async delete<T>(endpoint: string, options: RequestOptions): Promise<Response<T>> {
103
+ public async delete<T = undefined>(endpoint: string, options: RequestOptions): Promise<Response<T>> {
104
104
  return this.fetchWrapper<T>(endpoint, null, {
105
105
  ...options,
106
106
  method: 'DELETE',
@@ -149,8 +149,7 @@ export class Provider {
149
149
  }
150
150
 
151
151
  try {
152
- const data: T | undefined = response.body ? await response.json() : undefined;
153
-
152
+ const data: T = response.body ? await response.json() : undefined;
154
153
  return { status: response.status, headers: response.headers, data };
155
154
  } catch {
156
155
  throw buildHttpError(400, 'Invalid JSON response');