supaapps-api-kit-client 0.7.0 → 0.8.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.
@@ -8,6 +8,9 @@ on:
8
8
  jobs:
9
9
  build:
10
10
  runs-on: ubuntu-latest
11
+ permissions:
12
+ id-token: write
13
+ contents: read
11
14
  steps:
12
15
  - name: Checkout code
13
16
  uses: actions/checkout@v2
@@ -28,6 +31,4 @@ jobs:
28
31
  run: npm run build
29
32
 
30
33
  - name: Publish to npm
31
- run: npm publish
32
- env:
33
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34
+ run: npm publish --provenance --access public
@@ -22,16 +22,16 @@ export declare class ApiKitClient {
22
22
  getOne<T>(endpoint: string, params?: URLSearchParams): Promise<AxiosResponse<T>>;
23
23
  getPaginated<T>(endpoint: string, params?: URLSearchParams): Promise<AxiosResponse<PaginatedResponse<T>>>;
24
24
  post<T>(endpoint: string, data?: T, options?: Omit<AxiosRequestConfig, 'url' | 'method'>): Promise<AxiosResponse<T>>;
25
- put<T>(endpoint: string, data: Partial<T>): Promise<AxiosResponse<T>>;
26
- patch<T>(endpoint: string, data: Partial<T>): Promise<AxiosResponse<T>>;
25
+ put<T>(endpoint: string, data: Partial<T>, options?: Omit<AxiosRequestConfig, 'url' | 'method'>): Promise<AxiosResponse<T>>;
26
+ patch<T>(endpoint: string, data: Partial<T>, options?: Omit<AxiosRequestConfig, 'url' | 'method'>): Promise<AxiosResponse<T>>;
27
27
  delete<T>(endpoint: string): Promise<AxiosResponse<T>>;
28
28
  static initialize(baseURL: string, authTokenCallback?: AuthTokenCallback, unauthorizedCallback?: UnAuthorizedCallback, useAuth?: boolean): void;
29
29
  static get<T>(endpoint: string, params?: URLSearchParams): Promise<AxiosResponse<T>>;
30
30
  static getOne<T>(endpoint: string, params?: URLSearchParams): Promise<AxiosResponse<T>>;
31
31
  static getPaginated<T>(endpoint: string, params?: URLSearchParams): Promise<AxiosResponse<PaginatedResponse<T>>>;
32
32
  static post<T>(endpoint: string, data?: T, options?: Omit<AxiosRequestConfig, 'url' | 'method'>): Promise<AxiosResponse<T>>;
33
- static put<T>(endpoint: string, data: Partial<T>): Promise<AxiosResponse<T>>;
34
- static patch<T>(endpoint: string, data: Partial<T>): Promise<AxiosResponse<T>>;
33
+ static put<T>(endpoint: string, data: Partial<T>, options?: Omit<AxiosRequestConfig, 'url' | 'method'>): Promise<AxiosResponse<T>>;
34
+ static patch<T>(endpoint: string, data: Partial<T>, options?: Omit<AxiosRequestConfig, 'url' | 'method'>): Promise<AxiosResponse<T>>;
35
35
  static delete<T>(endpoint: string): Promise<AxiosResponse<T>>;
36
36
  }
37
37
  export {};
@@ -87,18 +87,20 @@ class ApiKitClient {
87
87
  return axiosInstance.post(endpoint, data, options);
88
88
  });
89
89
  }
90
- put(endpoint, data) {
90
+ put(endpoint, data, options // Exclude 'url' and 'method' since they are handled separately
91
+ ) {
91
92
  return __awaiter(this, void 0, void 0, function* () {
92
93
  this.checkInitialization();
93
94
  const axiosInstance = ApiKitClient.apiClients[this.apiClientKey].axiosInstance;
94
- return axiosInstance.put(endpoint, data);
95
+ return axiosInstance.put(endpoint, data, options);
95
96
  });
96
97
  }
97
- patch(endpoint, data) {
98
+ patch(endpoint, data, options // Exclude 'url' and 'method' since they are handled separately
99
+ ) {
98
100
  return __awaiter(this, void 0, void 0, function* () {
99
101
  this.checkInitialization();
100
102
  const axiosInstance = ApiKitClient.apiClients[this.apiClientKey].axiosInstance;
101
- return axiosInstance.patch(endpoint, data);
103
+ return axiosInstance.patch(endpoint, data, options);
102
104
  });
103
105
  }
104
106
  delete(endpoint) {
@@ -133,14 +135,16 @@ class ApiKitClient {
133
135
  return (new ApiKitClient('default')).post(endpoint, data, options);
134
136
  });
135
137
  }
136
- static put(endpoint, data) {
138
+ static put(endpoint, data, options // Exclude 'url' and 'method' since they are handled separately
139
+ ) {
137
140
  return __awaiter(this, void 0, void 0, function* () {
138
- return (new ApiKitClient('default')).put(endpoint, data);
141
+ return (new ApiKitClient('default')).put(endpoint, data, options);
139
142
  });
140
143
  }
141
- static patch(endpoint, data) {
144
+ static patch(endpoint, data, options // Exclude 'url' and 'method' since they are handled separately
145
+ ) {
142
146
  return __awaiter(this, void 0, void 0, function* () {
143
- return (new ApiKitClient('default')).patch(endpoint, data);
147
+ return (new ApiKitClient('default')).patch(endpoint, data, options);
144
148
  });
145
149
  }
146
150
  static delete(endpoint) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supaapps-api-kit-client",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "A versatile, type-safe API kit client designed for TypeScript applications.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,6 +8,10 @@
8
8
  "test": "jest",
9
9
  "build": "tsc"
10
10
  },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/supaapps/supaapps-api-kit-client.git"
14
+ },
11
15
  "author": "Supaapps GmbH",
12
16
  "license": "MIT",
13
17
  "dependencies": {
@@ -102,16 +102,24 @@ export class ApiKitClient {
102
102
  return axiosInstance!.post<T>(endpoint, data, options);
103
103
  }
104
104
 
105
- public async put<T>(endpoint: string, data: Partial<T>): Promise<AxiosResponse<T>> {
105
+ public async put<T>(
106
+ endpoint: string,
107
+ data: Partial<T>,
108
+ options?: Omit<AxiosRequestConfig, 'url' | 'method'> // Exclude 'url' and 'method' since they are handled separately
109
+ ): Promise<AxiosResponse<T>> {
106
110
  this.checkInitialization();
107
111
  const axiosInstance = ApiKitClient.apiClients[this.apiClientKey].axiosInstance;
108
- return axiosInstance!.put<T>(endpoint, data);
112
+ return axiosInstance!.put<T>(endpoint, data, options);
109
113
  }
110
114
 
111
- public async patch<T>(endpoint: string, data: Partial<T>): Promise<AxiosResponse<T>> {
115
+ public async patch<T>(
116
+ endpoint: string,
117
+ data: Partial<T>,
118
+ options?: Omit<AxiosRequestConfig, 'url' | 'method'> // Exclude 'url' and 'method' since they are handled separately
119
+ ): Promise<AxiosResponse<T>> {
112
120
  this.checkInitialization();
113
121
  const axiosInstance = ApiKitClient.apiClients[this.apiClientKey].axiosInstance;
114
- return axiosInstance!.patch<T>(endpoint, data);
122
+ return axiosInstance!.patch<T>(endpoint, data, options);
115
123
  }
116
124
 
117
125
  public async delete<T>(endpoint: string): Promise<AxiosResponse<T>> {
@@ -147,12 +155,20 @@ export class ApiKitClient {
147
155
  return (new ApiKitClient('default')).post<T>(endpoint, data, options);
148
156
  }
149
157
 
150
- public static async put<T>(endpoint: string, data: Partial<T>): Promise<AxiosResponse<T>> {
151
- return (new ApiKitClient('default')).put<T>(endpoint, data);
158
+ public static async put<T>(
159
+ endpoint: string,
160
+ data: Partial<T>,
161
+ options?: Omit<AxiosRequestConfig, 'url' | 'method'> // Exclude 'url' and 'method' since they are handled separately
162
+ ): Promise<AxiosResponse<T>> {
163
+ return (new ApiKitClient('default')).put<T>(endpoint, data, options);
152
164
  }
153
165
 
154
- public static async patch<T>(endpoint: string, data: Partial<T>): Promise<AxiosResponse<T>> {
155
- return (new ApiKitClient('default')).patch<T>(endpoint, data);
166
+ public static async patch<T>(
167
+ endpoint: string,
168
+ data: Partial<T>,
169
+ options?: Omit<AxiosRequestConfig, 'url' | 'method'> // Exclude 'url' and 'method' since they are handled separately
170
+ ): Promise<AxiosResponse<T>> {
171
+ return (new ApiKitClient('default')).patch<T>(endpoint, data, options);
156
172
  }
157
173
 
158
174
  public static async delete<T>(endpoint: string): Promise<AxiosResponse<T>> {