arky-sdk 0.3.154 → 0.3.156
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/dist/index.cjs +31 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +31 -13
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +3 -1
- package/dist/types.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -90,20 +90,15 @@ function createHttpClient(cfg) {
|
|
|
90
90
|
"Content-Type": "application/json",
|
|
91
91
|
...options?.headers || {}
|
|
92
92
|
};
|
|
93
|
-
let { accessToken, expiresAt
|
|
93
|
+
let { accessToken, expiresAt } = await cfg.getToken();
|
|
94
94
|
const nowSec = Date.now() / 1e3;
|
|
95
95
|
if (expiresAt && nowSec > expiresAt) {
|
|
96
96
|
await ensureFreshToken();
|
|
97
97
|
const tokens = await cfg.getToken();
|
|
98
98
|
accessToken = tokens.accessToken;
|
|
99
|
-
provider = tokens.provider;
|
|
100
99
|
}
|
|
101
100
|
if (accessToken) {
|
|
102
|
-
|
|
103
|
-
headers["X-API-Key"] = accessToken;
|
|
104
|
-
} else {
|
|
105
|
-
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
106
|
-
}
|
|
101
|
+
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
107
102
|
}
|
|
108
103
|
const finalPath = options?.params ? path + buildQueryString(options.params) : path;
|
|
109
104
|
const fetchOpts = { method, headers };
|
|
@@ -265,15 +260,16 @@ var createAuthApi = (apiConfig) => {
|
|
|
265
260
|
async session(options) {
|
|
266
261
|
return apiConfig.httpClient.post("/v1/auth/session", {}, options);
|
|
267
262
|
},
|
|
263
|
+
// ==================== PLATFORM AUTH (Admin) ====================
|
|
268
264
|
/**
|
|
269
|
-
* Request
|
|
270
|
-
* POST /auth/
|
|
265
|
+
* Request platform auth code (Arky admin)
|
|
266
|
+
* POST /auth/code
|
|
271
267
|
*/
|
|
272
|
-
async
|
|
273
|
-
return apiConfig.httpClient.post("/v1/auth/
|
|
268
|
+
async code(params, options) {
|
|
269
|
+
return apiConfig.httpClient.post("/v1/auth/code", params, options);
|
|
274
270
|
},
|
|
275
271
|
/**
|
|
276
|
-
* Verify
|
|
272
|
+
* Verify platform auth code
|
|
277
273
|
* POST /auth/verify
|
|
278
274
|
*/
|
|
279
275
|
async verify(params, options) {
|
|
@@ -285,6 +281,28 @@ var createAuthApi = (apiConfig) => {
|
|
|
285
281
|
*/
|
|
286
282
|
async refresh(params, options) {
|
|
287
283
|
return apiConfig.httpClient.post("/v1/auth/refresh", params, options);
|
|
284
|
+
},
|
|
285
|
+
// ==================== BUSINESS AUTH (arky.io, delfin, korvus) ====================
|
|
286
|
+
/**
|
|
287
|
+
* Request business auth code
|
|
288
|
+
* POST /businesses/{businessId}/auth/code
|
|
289
|
+
*/
|
|
290
|
+
async businessCode(businessId, params, options) {
|
|
291
|
+
return apiConfig.httpClient.post(`/v1/businesses/${businessId}/auth/code`, params, options);
|
|
292
|
+
},
|
|
293
|
+
/**
|
|
294
|
+
* Verify business auth code
|
|
295
|
+
* POST /businesses/{businessId}/auth/verify
|
|
296
|
+
*/
|
|
297
|
+
async businessVerify(businessId, params, options) {
|
|
298
|
+
return apiConfig.httpClient.post(`/v1/businesses/${businessId}/auth/verify`, params, options);
|
|
299
|
+
},
|
|
300
|
+
// ==================== DEPRECATED (for backwards compatibility) ====================
|
|
301
|
+
/**
|
|
302
|
+
* @deprecated Use code() instead
|
|
303
|
+
*/
|
|
304
|
+
async magicLink(params, options) {
|
|
305
|
+
return apiConfig.httpClient.post("/v1/auth/code", params, options);
|
|
288
306
|
}
|
|
289
307
|
};
|
|
290
308
|
};
|
|
@@ -1920,7 +1938,7 @@ function nameToKey(name) {
|
|
|
1920
1938
|
}
|
|
1921
1939
|
|
|
1922
1940
|
// src/index.ts
|
|
1923
|
-
var SDK_VERSION = "0.3.
|
|
1941
|
+
var SDK_VERSION = "0.3.156";
|
|
1924
1942
|
var SUPPORTED_FRAMEWORKS = [
|
|
1925
1943
|
"astro",
|
|
1926
1944
|
"react",
|