arky-sdk 0.3.151 → 0.3.152
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 +27 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -15
- package/dist/index.d.ts +9 -15
- package/dist/index.js +27 -67
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +13 -59
- package/dist/types.d.ts +13 -59
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -46,7 +46,7 @@ function buildQueryString(params) {
|
|
|
46
46
|
|
|
47
47
|
// src/services/createHttpClient.ts
|
|
48
48
|
function createHttpClient(cfg) {
|
|
49
|
-
const refreshEndpoint = `${cfg.baseUrl}/v1/
|
|
49
|
+
const refreshEndpoint = `${cfg.baseUrl}/v1/accounts/refresh-access-token`;
|
|
50
50
|
let refreshPromise = null;
|
|
51
51
|
async function ensureFreshToken() {
|
|
52
52
|
if (refreshPromise) {
|
|
@@ -212,32 +212,31 @@ function createHttpClient(cfg) {
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
// src/api/
|
|
216
|
-
var
|
|
215
|
+
// src/api/account.ts
|
|
216
|
+
var createAccountApi = (apiConfig) => {
|
|
217
217
|
return {
|
|
218
|
-
// =====
|
|
219
|
-
async
|
|
218
|
+
// ===== ACCOUNT PROFILE =====
|
|
219
|
+
async updateAccount(params, options) {
|
|
220
220
|
const payload = {};
|
|
221
|
-
if (params.name !== void 0) payload.name = params.name;
|
|
222
221
|
if (params.phoneNumbers !== void 0) payload.phoneNumbers = params.phoneNumbers;
|
|
223
222
|
if (params.addresses !== void 0) payload.addresses = params.addresses;
|
|
224
223
|
if (params.apiTokens !== void 0) payload.apiTokens = params.apiTokens;
|
|
225
|
-
return apiConfig.httpClient.put("/v1/
|
|
224
|
+
return apiConfig.httpClient.put("/v1/accounts", payload, options);
|
|
226
225
|
},
|
|
227
|
-
async
|
|
228
|
-
return apiConfig.httpClient.delete("/v1/
|
|
226
|
+
async deleteAccount(params, options) {
|
|
227
|
+
return apiConfig.httpClient.delete("/v1/accounts", options);
|
|
229
228
|
},
|
|
230
229
|
async addPhoneNumber(params, options) {
|
|
231
|
-
return apiConfig.httpClient.post("/v1/
|
|
230
|
+
return apiConfig.httpClient.post("/v1/accounts/phone-number", params, options);
|
|
232
231
|
},
|
|
233
232
|
async phoneNumberConfirm(params, options) {
|
|
234
|
-
return apiConfig.httpClient.post("/v1/
|
|
233
|
+
return apiConfig.httpClient.post("/v1/accounts/phone-number/confirm", params, options);
|
|
235
234
|
},
|
|
236
235
|
async getMe(params, options) {
|
|
237
|
-
return apiConfig.httpClient.get("/v1/
|
|
236
|
+
return apiConfig.httpClient.get("/v1/accounts/me", options);
|
|
238
237
|
},
|
|
239
|
-
async
|
|
240
|
-
return apiConfig.httpClient.get("/v1/
|
|
238
|
+
async searchAccounts(params, options) {
|
|
239
|
+
return apiConfig.httpClient.get("/v1/accounts/search", {
|
|
241
240
|
...options,
|
|
242
241
|
params: {
|
|
243
242
|
...params,
|
|
@@ -246,39 +245,25 @@ var createUserApi = (apiConfig) => {
|
|
|
246
245
|
});
|
|
247
246
|
},
|
|
248
247
|
async setRole(params, options) {
|
|
249
|
-
return apiConfig.httpClient.put("/v1/
|
|
248
|
+
return apiConfig.httpClient.put("/v1/accounts/set-role", params, options);
|
|
250
249
|
},
|
|
251
250
|
// ===== AUTHENTICATION =====
|
|
252
|
-
async
|
|
253
|
-
return apiConfig.httpClient.post("/v1/
|
|
254
|
-
},
|
|
255
|
-
async registerUser(params, options) {
|
|
256
|
-
return apiConfig.httpClient.post("/v1/users/register", params, options);
|
|
251
|
+
async login(params, options) {
|
|
252
|
+
return apiConfig.httpClient.post("/v1/accounts/login", params, options);
|
|
257
253
|
},
|
|
258
254
|
async logout(params, options) {
|
|
259
|
-
return apiConfig.httpClient.post("/v1/
|
|
260
|
-
},
|
|
261
|
-
async confirmUser(params, options) {
|
|
262
|
-
return apiConfig.httpClient.put("/v1/users/confirm", params, options);
|
|
263
|
-
},
|
|
264
|
-
async getLoginUrl(params, options) {
|
|
265
|
-
return apiConfig.httpClient.get("/v1/users/login/url", {
|
|
266
|
-
...options,
|
|
267
|
-
params
|
|
268
|
-
});
|
|
255
|
+
return apiConfig.httpClient.post("/v1/accounts/logout", {}, options);
|
|
269
256
|
},
|
|
270
|
-
// =====
|
|
271
|
-
async
|
|
272
|
-
return apiConfig.httpClient.post("/v1/
|
|
257
|
+
// ===== MAGIC LINK =====
|
|
258
|
+
async requestMagicLink(params, options) {
|
|
259
|
+
return apiConfig.httpClient.post("/v1/accounts/magic-link/request", params, options);
|
|
273
260
|
},
|
|
274
|
-
async
|
|
275
|
-
return apiConfig.httpClient.post("/v1/
|
|
276
|
-
},
|
|
277
|
-
async resetPassword(params, options) {
|
|
278
|
-
return apiConfig.httpClient.post("/v1/users/reset-password", params, options);
|
|
261
|
+
async verifyMagicLink(params, options) {
|
|
262
|
+
return apiConfig.httpClient.post("/v1/accounts/magic-link/verify", params, options);
|
|
279
263
|
},
|
|
264
|
+
// ===== SUBSCRIPTION =====
|
|
280
265
|
async subscribe(params, options) {
|
|
281
|
-
return apiConfig.httpClient.post("/v1/
|
|
266
|
+
return apiConfig.httpClient.post("/v1/accounts/subscribe", params, options);
|
|
282
267
|
}
|
|
283
268
|
};
|
|
284
269
|
};
|
|
@@ -1524,31 +1509,6 @@ var createWorkflowApi = (apiConfig) => {
|
|
|
1524
1509
|
async triggerWorkflow(params, options) {
|
|
1525
1510
|
const { secret, ...input } = params;
|
|
1526
1511
|
return apiConfig.httpClient.post(`/v1/workflows/trigger/${secret}`, input, options);
|
|
1527
|
-
},
|
|
1528
|
-
/**
|
|
1529
|
-
* Get executions for a workflow
|
|
1530
|
-
*/
|
|
1531
|
-
async getWorkflowExecutions(params, options) {
|
|
1532
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1533
|
-
const { workflowId, limit, cursor } = params;
|
|
1534
|
-
return apiConfig.httpClient.get(
|
|
1535
|
-
`/v1/businesses/${businessId}/workflows/${workflowId}/executions`,
|
|
1536
|
-
{
|
|
1537
|
-
...options,
|
|
1538
|
-
params: { limit, cursor }
|
|
1539
|
-
}
|
|
1540
|
-
);
|
|
1541
|
-
},
|
|
1542
|
-
/**
|
|
1543
|
-
* Get a specific workflow execution
|
|
1544
|
-
*/
|
|
1545
|
-
async getWorkflowExecution(params, options) {
|
|
1546
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1547
|
-
const { workflowId, executionId } = params;
|
|
1548
|
-
return apiConfig.httpClient.get(
|
|
1549
|
-
`/v1/businesses/${businessId}/workflows/${workflowId}/executions/${executionId}`,
|
|
1550
|
-
options
|
|
1551
|
-
);
|
|
1552
1512
|
}
|
|
1553
1513
|
};
|
|
1554
1514
|
};
|
|
@@ -1959,13 +1919,13 @@ async function createArkySDK(config) {
|
|
|
1959
1919
|
setToken: config.setToken,
|
|
1960
1920
|
getToken: config.getToken
|
|
1961
1921
|
};
|
|
1962
|
-
const
|
|
1922
|
+
const accountApi = createAccountApi(apiConfig);
|
|
1963
1923
|
const autoGuest = config.autoGuest !== void 0 ? config.autoGuest : true;
|
|
1964
1924
|
if (autoGuest) {
|
|
1965
1925
|
try {
|
|
1966
1926
|
const tokens = await config.getToken();
|
|
1967
1927
|
if (!tokens.accessToken && !tokens.refreshToken) {
|
|
1968
|
-
const result = await httpClient.post("/v1/
|
|
1928
|
+
const result = await httpClient.post("/v1/accounts/login", {
|
|
1969
1929
|
provider: "GUEST"
|
|
1970
1930
|
});
|
|
1971
1931
|
const token = result.accessToken || result.token || "";
|
|
@@ -1977,7 +1937,7 @@ async function createArkySDK(config) {
|
|
|
1977
1937
|
}
|
|
1978
1938
|
}
|
|
1979
1939
|
const sdk = {
|
|
1980
|
-
|
|
1940
|
+
account: accountApi,
|
|
1981
1941
|
business: createBusinessApi(apiConfig),
|
|
1982
1942
|
media: createMediaApi(apiConfig),
|
|
1983
1943
|
role: createRoleApi(apiConfig),
|