@acmekit/js-sdk 2.13.36 → 2.13.38
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/admin/index.d.ts +34 -6
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +42 -3
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/workflow-execution.d.ts +0 -23
- package/dist/admin/workflow-execution.d.ts.map +1 -1
- package/dist/admin/workflow-execution.js +0 -35
- package/dist/admin/workflow-execution.js.map +1 -1
- package/dist/auth/index.d.ts +21 -38
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +24 -38
- package/dist/auth/index.js.map +1 -1
- package/dist/base/typed-api-namespace.d.ts +34 -0
- package/dist/base/typed-api-namespace.d.ts.map +1 -0
- package/dist/base/typed-api-namespace.js +47 -0
- package/dist/base/typed-api-namespace.js.map +1 -0
- package/dist/client-api/index.d.ts +31 -0
- package/dist/client-api/index.d.ts.map +1 -0
- package/dist/client-api/index.js +43 -0
- package/dist/client-api/index.js.map +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +32 -10
- package/dist/client.js.map +1 -1
- package/dist/esm/admin/index.d.ts +34 -6
- package/dist/esm/admin/index.d.ts.map +1 -1
- package/dist/esm/admin/index.js +42 -3
- package/dist/esm/admin/index.js.map +1 -1
- package/dist/esm/admin/workflow-execution.d.ts +0 -23
- package/dist/esm/admin/workflow-execution.d.ts.map +1 -1
- package/dist/esm/admin/workflow-execution.js +0 -45
- package/dist/esm/admin/workflow-execution.js.map +1 -1
- package/dist/esm/auth/index.d.ts +21 -38
- package/dist/esm/auth/index.d.ts.map +1 -1
- package/dist/esm/auth/index.js +24 -38
- package/dist/esm/auth/index.js.map +1 -1
- package/dist/esm/base/typed-api-namespace.d.ts +34 -0
- package/dist/esm/base/typed-api-namespace.d.ts.map +1 -0
- package/dist/esm/base/typed-api-namespace.js +43 -0
- package/dist/esm/base/typed-api-namespace.js.map +1 -0
- package/dist/esm/client-api/index.d.ts +31 -0
- package/dist/esm/client-api/index.d.ts.map +1 -0
- package/dist/esm/client-api/index.js +39 -0
- package/dist/esm/client-api/index.js.map +1 -0
- package/dist/esm/client.d.ts +1 -1
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +43 -11
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/index.d.ts +18 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +9 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/route-registry.d.ts +108 -0
- package/dist/esm/types/route-registry.d.ts.map +1 -0
- package/dist/esm/types/route-registry.js +2 -0
- package/dist/esm/types/route-registry.js.map +1 -0
- package/dist/esm/types.d.ts +6 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/types/route-registry.d.ts +108 -0
- package/dist/types/route-registry.d.ts.map +1 -0
- package/dist/types/route-registry.js +3 -0
- package/dist/types/route-registry.js.map +1 -0
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -4
- package/dist/admin/workflow-definition.d.ts +0 -39
- package/dist/admin/workflow-definition.d.ts.map +0 -1
- package/dist/admin/workflow-definition.js +0 -24
- package/dist/admin/workflow-definition.js.map +0 -1
- package/dist/esm/admin/workflow-definition.d.ts +0 -39
- package/dist/esm/admin/workflow-definition.d.ts.map +0 -1
- package/dist/esm/admin/workflow-definition.js +0 -33
- package/dist/esm/admin/workflow-definition.js.map +0 -1
package/dist/admin/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Client } from "../client";
|
|
2
|
+
import { TypedApiNamespace } from "../base/typed-api-namespace";
|
|
3
|
+
import type { AdminPaths } from "../index";
|
|
4
|
+
import type { TypedFetchOptions, FetchResponseOf } from "../types/route-registry";
|
|
2
5
|
import { ApiKey } from "./api-key";
|
|
3
6
|
import { Invite } from "./invite";
|
|
4
7
|
import { Locale } from "./locale";
|
|
@@ -8,9 +11,8 @@ import { Translation } from "./translation";
|
|
|
8
11
|
import { Upload } from "./upload";
|
|
9
12
|
import { User } from "./user";
|
|
10
13
|
import { Views } from "./views";
|
|
11
|
-
import { WorkflowDefinition } from "./workflow-definition";
|
|
12
14
|
import { WorkflowExecution } from "./workflow-execution";
|
|
13
|
-
export declare class Admin {
|
|
15
|
+
export declare class Admin extends TypedApiNamespace<"/admin"> {
|
|
14
16
|
/**
|
|
15
17
|
* @tags user
|
|
16
18
|
*/
|
|
@@ -40,10 +42,6 @@ export declare class Admin {
|
|
|
40
42
|
* @tags workflow
|
|
41
43
|
*/
|
|
42
44
|
workflowExecution: WorkflowExecution;
|
|
43
|
-
/**
|
|
44
|
-
* @tags workflow
|
|
45
|
-
*/
|
|
46
|
-
workflowDefinition: WorkflowDefinition;
|
|
47
45
|
/**
|
|
48
46
|
* @tags translations
|
|
49
47
|
*/
|
|
@@ -58,5 +56,35 @@ export declare class Admin {
|
|
|
58
56
|
*/
|
|
59
57
|
views: Views;
|
|
60
58
|
constructor(client: Client);
|
|
59
|
+
/**
|
|
60
|
+
* Send a typed request to an admin API route.
|
|
61
|
+
*
|
|
62
|
+
* The `method` field is constrained to only the HTTP verbs that the route
|
|
63
|
+
* actually declares — passing a method the route doesn't support is a
|
|
64
|
+
* compile-time error. Body, query params, and path params are all typed
|
|
65
|
+
* based on the path + method combination.
|
|
66
|
+
*
|
|
67
|
+
* ```ts
|
|
68
|
+
* // GET /admin/custom/documents?limit=10
|
|
69
|
+
* const { documents } = await sdk.admin.fetch("/custom/documents", {
|
|
70
|
+
* method: "GET",
|
|
71
|
+
* query: { limit: 10 },
|
|
72
|
+
* })
|
|
73
|
+
*
|
|
74
|
+
* // POST /admin/custom/documents
|
|
75
|
+
* const { document } = await sdk.admin.fetch("/custom/documents", {
|
|
76
|
+
* method: "POST",
|
|
77
|
+
* body: { title: "Hello" },
|
|
78
|
+
* })
|
|
79
|
+
*
|
|
80
|
+
* // PATCH /admin/custom/documents/:id
|
|
81
|
+
* const { document: updated } = await sdk.admin.fetch("/custom/documents/:id", {
|
|
82
|
+
* method: "PATCH",
|
|
83
|
+
* body: { title: "Updated" },
|
|
84
|
+
* params: { id: "doc_123" },
|
|
85
|
+
* })
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
fetch<P extends (keyof AdminPaths & string) | (string & {}), O extends TypedFetchOptions<AdminPaths, P>>(path: P, options: O): Promise<FetchResponseOf<AdminPaths, P, O>>;
|
|
61
89
|
}
|
|
62
90
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAA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AAG,CAAC,MAAM,GAAG,EAAE,CAAC,EACrD,CAAC,SAAS,iBAAiB,CAAC,UAAU,EAAE,CAAC,CAAC,EAC1C,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CAgBnE"}
|
package/dist/admin/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Admin = void 0;
|
|
4
|
+
const typed_api_namespace_1 = require("../base/typed-api-namespace");
|
|
4
5
|
const api_key_1 = require("./api-key");
|
|
5
6
|
const invite_1 = require("./invite");
|
|
6
7
|
const locale_1 = require("./locale");
|
|
@@ -10,10 +11,10 @@ const translation_1 = require("./translation");
|
|
|
10
11
|
const upload_1 = require("./upload");
|
|
11
12
|
const user_1 = require("./user");
|
|
12
13
|
const views_1 = require("./views");
|
|
13
|
-
const workflow_definition_1 = require("./workflow-definition");
|
|
14
14
|
const workflow_execution_1 = require("./workflow-execution");
|
|
15
|
-
class Admin {
|
|
15
|
+
class Admin extends typed_api_namespace_1.TypedApiNamespace {
|
|
16
16
|
constructor(client) {
|
|
17
|
+
super(client, "/admin");
|
|
17
18
|
this.invite = new invite_1.Invite(client);
|
|
18
19
|
this.upload = new upload_1.Upload(client);
|
|
19
20
|
this.notification = new notification_1.Notification(client);
|
|
@@ -21,11 +22,49 @@ class Admin {
|
|
|
21
22
|
this.locale = new locale_1.Locale(client);
|
|
22
23
|
this.apiKey = new api_key_1.ApiKey(client);
|
|
23
24
|
this.workflowExecution = new workflow_execution_1.WorkflowExecution(client);
|
|
24
|
-
this.workflowDefinition = new workflow_definition_1.WorkflowDefinition(client);
|
|
25
25
|
this.translation = new translation_1.Translation(client);
|
|
26
26
|
this.plugin = new plugin_1.Plugin(client);
|
|
27
27
|
this.views = new views_1.Views(client);
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Send a typed request to an admin API route.
|
|
31
|
+
*
|
|
32
|
+
* The `method` field is constrained to only the HTTP verbs that the route
|
|
33
|
+
* actually declares — passing a method the route doesn't support is a
|
|
34
|
+
* compile-time error. Body, query params, and path params are all typed
|
|
35
|
+
* based on the path + method combination.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* // GET /admin/custom/documents?limit=10
|
|
39
|
+
* const { documents } = await sdk.admin.fetch("/custom/documents", {
|
|
40
|
+
* method: "GET",
|
|
41
|
+
* query: { limit: 10 },
|
|
42
|
+
* })
|
|
43
|
+
*
|
|
44
|
+
* // POST /admin/custom/documents
|
|
45
|
+
* const { document } = await sdk.admin.fetch("/custom/documents", {
|
|
46
|
+
* method: "POST",
|
|
47
|
+
* body: { title: "Hello" },
|
|
48
|
+
* })
|
|
49
|
+
*
|
|
50
|
+
* // PATCH /admin/custom/documents/:id
|
|
51
|
+
* const { document: updated } = await sdk.admin.fetch("/custom/documents/:id", {
|
|
52
|
+
* method: "PATCH",
|
|
53
|
+
* body: { title: "Updated" },
|
|
54
|
+
* params: { id: "doc_123" },
|
|
55
|
+
* })
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
fetch(path, options) {
|
|
59
|
+
const opts = options;
|
|
60
|
+
const resolvedPath = this.resolvePath(path, opts.params);
|
|
61
|
+
return this.httpClient.fetch(`${this.prefix}${resolvedPath}`, {
|
|
62
|
+
method: opts.method,
|
|
63
|
+
body: opts.body,
|
|
64
|
+
query: opts.query,
|
|
65
|
+
headers: opts.headers,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
29
68
|
}
|
|
30
69
|
exports.Admin = Admin;
|
|
31
70
|
//# sourceMappingURL=index.js.map
|
package/dist/admin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":";;;AACA,uCAAkC;AAClC,qCAA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AM,IAAI,GAAG,OAMZ,CAAA;QACD,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QACxD,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,YAAY,EAAE,EAAE;YAC5D,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAA2B;YACtC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAA+C,CAAA;IAClD,CAAC;CACF;AA1GD,sBA0GC"}
|
|
@@ -74,28 +74,5 @@ export declare class WorkflowExecution {
|
|
|
74
74
|
* })
|
|
75
75
|
*/
|
|
76
76
|
retrieve(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminWorkflowExecutionResponse>;
|
|
77
|
-
run(workflowId: string, body: {
|
|
78
|
-
input?: Record<string, unknown>;
|
|
79
|
-
transaction_id?: string;
|
|
80
|
-
}, headers?: ClientHeaders): Promise<Record<string, unknown>>;
|
|
81
|
-
cancel(workflowId: string, transactionId: string, body?: {
|
|
82
|
-
reason?: string;
|
|
83
|
-
}, headers?: ClientHeaders): Promise<Record<string, unknown>>;
|
|
84
|
-
retryStep(workflowId: string, transactionId: string, body: {
|
|
85
|
-
step_id: string;
|
|
86
|
-
action?: string;
|
|
87
|
-
}, headers?: ClientHeaders): Promise<Record<string, unknown>>;
|
|
88
|
-
setStepSuccess(workflowId: string, body: {
|
|
89
|
-
transaction_id: string;
|
|
90
|
-
step_id: string;
|
|
91
|
-
response?: Record<string, unknown>;
|
|
92
|
-
action?: string;
|
|
93
|
-
}, headers?: ClientHeaders): Promise<Record<string, unknown>>;
|
|
94
|
-
setStepFailure(workflowId: string, body: {
|
|
95
|
-
transaction_id: string;
|
|
96
|
-
step_id: string;
|
|
97
|
-
response?: Record<string, unknown>;
|
|
98
|
-
action?: string;
|
|
99
|
-
}, headers?: ClientHeaders): Promise<Record<string, unknown>>;
|
|
100
77
|
}
|
|
101
78
|
//# sourceMappingURL=workflow-execution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-execution.d.ts","sourceRoot":"","sources":["../../src/admin/workflow-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,iBAAiB;IAC5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,WAAW,CAAC,EAAE,SAAS,CAAC,gCAAgC,EACxD,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;OAcG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"workflow-execution.d.ts","sourceRoot":"","sources":["../../src/admin/workflow-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,iBAAiB;IAC5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,WAAW,CAAC,EAAE,SAAS,CAAC,gCAAgC,EACxD,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;OAcG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;CAQnD"}
|
|
@@ -81,41 +81,6 @@ class WorkflowExecution {
|
|
|
81
81
|
headers,
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
async run(workflowId, body, headers) {
|
|
85
|
-
return await this.client.fetch(`/admin/workflows-executions/${workflowId}/run`, {
|
|
86
|
-
method: "POST",
|
|
87
|
-
headers,
|
|
88
|
-
body,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
async cancel(workflowId, transactionId, body, headers) {
|
|
92
|
-
return await this.client.fetch(`/admin/workflows-executions/${workflowId}/${transactionId}/cancel`, {
|
|
93
|
-
method: "POST",
|
|
94
|
-
headers,
|
|
95
|
-
body: body || {},
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
async retryStep(workflowId, transactionId, body, headers) {
|
|
99
|
-
return await this.client.fetch(`/admin/workflows-executions/${workflowId}/${transactionId}/retry-step`, {
|
|
100
|
-
method: "POST",
|
|
101
|
-
headers,
|
|
102
|
-
body,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
async setStepSuccess(workflowId, body, headers) {
|
|
106
|
-
return await this.client.fetch(`/admin/workflows-executions/${workflowId}/steps/success`, {
|
|
107
|
-
method: "POST",
|
|
108
|
-
headers,
|
|
109
|
-
body,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
async setStepFailure(workflowId, body, headers) {
|
|
113
|
-
return await this.client.fetch(`/admin/workflows-executions/${workflowId}/steps/failure`, {
|
|
114
|
-
method: "POST",
|
|
115
|
-
headers,
|
|
116
|
-
body,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
84
|
}
|
|
120
85
|
exports.WorkflowExecution = WorkflowExecution;
|
|
121
86
|
//# sourceMappingURL=workflow-execution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-execution.js","sourceRoot":"","sources":["../../src/admin/workflow-execution.ts"],"names":[],"mappings":";;;AAIA,MAAa,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACH,KAAK,CAAC,IAAI,CACR,WAAwD,EACxD,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,6BAA6B,EAC7B;YACE,KAAK,EAAE,WAAW;YAClB,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,OAAuB;QAChD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,+BAA+B,EAAE,EAAE,EACnC;YACE,OAAO;SACR,CACF,CAAA;IACH,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-execution.js","sourceRoot":"","sources":["../../src/admin/workflow-execution.ts"],"names":[],"mappings":";;;AAIA,MAAa,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACH,KAAK,CAAC,IAAI,CACR,WAAwD,EACxD,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,6BAA6B,EAC7B;YACE,KAAK,EAAE,WAAW;YAClB,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,OAAuB;QAChD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,+BAA+B,EAAE,EAAE,EACnC;YACE,OAAO;SACR,CACF,CAAA;IACH,CAAC;CACF;AA/FD,8CA+FC"}
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -9,13 +9,11 @@ export declare class Auth {
|
|
|
9
9
|
* This method is used to retrieve a registration JWT token for a user, customer, or custom actor type. It sends a request to the
|
|
10
10
|
* [Retrieve Registration Token API route](https://docs.acmekit.com/api/store#auth_postactor_typeauth_provider_register).
|
|
11
11
|
*
|
|
12
|
-
* Then, it stores the returned token and passes it in the header of subsequent requests.
|
|
13
|
-
* [store.customer.create](https://docs.acmekit.com/resources/references/js-sdk/store/customer#create) method,
|
|
14
|
-
* for example, after calling this method.
|
|
12
|
+
* Then, it stores the returned token and passes it in the header of subsequent requests.
|
|
15
13
|
*
|
|
16
14
|
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
17
15
|
*
|
|
18
|
-
* @param actor - The actor type. For example, `user` for admin user, or `customer` for
|
|
16
|
+
* @param actor - The actor type. For example, `user` for admin user, or `customer` for custom actor types.
|
|
19
17
|
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
|
20
18
|
* @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
|
|
21
19
|
* you pass the email and password.
|
|
@@ -25,19 +23,15 @@ export declare class Auth {
|
|
|
25
23
|
*
|
|
26
24
|
* @example
|
|
27
25
|
* await sdk.auth.register(
|
|
28
|
-
* "
|
|
26
|
+
* "user",
|
|
29
27
|
* "emailpass",
|
|
30
28
|
* {
|
|
31
|
-
* email: "
|
|
29
|
+
* email: "user@example.com",
|
|
32
30
|
* password: "supersecret"
|
|
33
31
|
* }
|
|
34
32
|
* )
|
|
35
33
|
*
|
|
36
34
|
* // all subsequent requests will use the token in the header
|
|
37
|
-
* const { customer } = await sdk.store.customer.create({
|
|
38
|
-
* email: "customer@gmail.com",
|
|
39
|
-
* password: "supersecret"
|
|
40
|
-
* })
|
|
41
35
|
*/
|
|
42
36
|
register: (actor: string, method: string, payload: HttpTypes.AdminSignUpWithEmailPassword | Record<string, unknown>) => Promise<string>;
|
|
43
37
|
/**
|
|
@@ -53,7 +47,7 @@ export declare class Auth {
|
|
|
53
47
|
* :::note
|
|
54
48
|
*
|
|
55
49
|
* For an example of implementing third-party authentication, refer to the
|
|
56
|
-
* [
|
|
50
|
+
* [Custom Admin Authentication](https://docs.acmekit.com/resources/how-to-tutorials/how-to/admin/auth) guide.
|
|
57
51
|
*
|
|
58
52
|
* :::
|
|
59
53
|
*
|
|
@@ -71,7 +65,7 @@ export declare class Auth {
|
|
|
71
65
|
*
|
|
72
66
|
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
73
67
|
*
|
|
74
|
-
* @param actor - The actor type. For example, `user` for admin user, or
|
|
68
|
+
* @param actor - The actor type. For example, `user` for admin user, or custom actor types.
|
|
75
69
|
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
|
76
70
|
* @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
|
|
77
71
|
* you pass the email and password.
|
|
@@ -81,10 +75,10 @@ export declare class Auth {
|
|
|
81
75
|
*
|
|
82
76
|
* @example
|
|
83
77
|
* const result = await sdk.auth.login(
|
|
84
|
-
* "
|
|
78
|
+
* "user",
|
|
85
79
|
* "emailpass",
|
|
86
80
|
* {
|
|
87
|
-
* email: "
|
|
81
|
+
* email: "user@example.com",
|
|
88
82
|
* password: "supersecret"
|
|
89
83
|
* }
|
|
90
84
|
* )
|
|
@@ -96,24 +90,22 @@ export declare class Auth {
|
|
|
96
90
|
* return
|
|
97
91
|
* }
|
|
98
92
|
*
|
|
99
|
-
* //
|
|
93
|
+
* // user is now authenticated
|
|
100
94
|
* // all subsequent requests will use the token in the header
|
|
101
|
-
* const { customer } = await sdk.store.customer.retrieve()
|
|
102
95
|
*/
|
|
103
96
|
login: (actor: string, method: string, payload: HttpTypes.AdminSignInWithEmailPassword | Record<string, unknown>) => Promise<string | {
|
|
104
97
|
location: string;
|
|
105
98
|
}>;
|
|
106
99
|
/**
|
|
107
|
-
* This method is used to validate an Oauth callback from a third-party service, such as Google, for an admin user
|
|
100
|
+
* This method is used to validate an Oauth callback from a third-party service, such as Google, for an admin user or custom actor types.
|
|
108
101
|
* It sends a request to the [Validate Authentication Callback](https://docs.acmekit.com/api/admin#auth_postactor_typeauth_providercallback).
|
|
109
102
|
*
|
|
110
103
|
* The method stores the returned token and passes it in the header of subsequent requests. So, you can call the
|
|
111
|
-
*
|
|
112
|
-
* for example, after calling this method.
|
|
104
|
+
* {@link refresh} method, for example, after calling this method.
|
|
113
105
|
*
|
|
114
106
|
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
115
107
|
*
|
|
116
|
-
* @param actor - The actor type. For example, `user` for admin user, or
|
|
108
|
+
* @param actor - The actor type. For example, `user` for admin user, or custom actor types.
|
|
117
109
|
* @param method - The authentication provider to use. For example, `google`.
|
|
118
110
|
* @param query - The query parameters from the Oauth callback, which should be passed to the API route. This includes query parameters like
|
|
119
111
|
* `code` and `state`.
|
|
@@ -123,7 +115,7 @@ export declare class Auth {
|
|
|
123
115
|
*
|
|
124
116
|
* @example
|
|
125
117
|
* await sdk.auth.callback(
|
|
126
|
-
* "
|
|
118
|
+
* "user",
|
|
127
119
|
* "google",
|
|
128
120
|
* {
|
|
129
121
|
* code: "123",
|
|
@@ -132,10 +124,6 @@ export declare class Auth {
|
|
|
132
124
|
* )
|
|
133
125
|
*
|
|
134
126
|
* // all subsequent requests will use the token in the header
|
|
135
|
-
* const { customer } = await sdk.store.customer.create({
|
|
136
|
-
* email: "customer@gmail.com",
|
|
137
|
-
* password: "supersecret"
|
|
138
|
-
* })
|
|
139
127
|
*
|
|
140
128
|
* @privateRemarks
|
|
141
129
|
* The callback expects all query parameters from the Oauth callback to be passed to
|
|
@@ -152,7 +140,7 @@ export declare class Auth {
|
|
|
152
140
|
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
153
141
|
*
|
|
154
142
|
* For an example of implementing third-party authentication, refer to the
|
|
155
|
-
* [
|
|
143
|
+
* [Custom Admin Authentication](https://docs.acmekit.com/resources/how-to-tutorials/how-to/admin/auth) guide.
|
|
156
144
|
*
|
|
157
145
|
* @param headers - Headers to pass in the request
|
|
158
146
|
*
|
|
@@ -164,7 +152,6 @@ export declare class Auth {
|
|
|
164
152
|
* const token = await sdk.auth.refresh()
|
|
165
153
|
*
|
|
166
154
|
* // all subsequent requests will use the token in the header
|
|
167
|
-
* const { customer } = await sdk.store.customer.retrieve()
|
|
168
155
|
*/
|
|
169
156
|
refresh: (headers?: ClientHeaders) => Promise<string>;
|
|
170
157
|
/**
|
|
@@ -187,14 +174,12 @@ export declare class Auth {
|
|
|
187
174
|
*/
|
|
188
175
|
logout: () => Promise<void>;
|
|
189
176
|
/**
|
|
190
|
-
* This method requests a reset password token for an admin user
|
|
177
|
+
* This method requests a reset password token for an admin user or custom actor type.
|
|
191
178
|
* It sends a request to the [Generate Reset Password Token API route](https://docs.acmekit.com/api/admin#auth_postactor_typeauth_providerresetpassword).
|
|
192
179
|
*
|
|
193
180
|
* To reset the password later using the token delivered to the user, use the {@link updateProvider} method.
|
|
194
181
|
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
|
182
|
+
* @param actor - The actor type. For example, `user` for admin user, or custom actor types.
|
|
198
183
|
* @param provider - The authentication provider to use. For example, `emailpass`.
|
|
199
184
|
* @param body - The data required to identify the user.
|
|
200
185
|
*
|
|
@@ -202,10 +187,10 @@ export declare class Auth {
|
|
|
202
187
|
*
|
|
203
188
|
* @example
|
|
204
189
|
* sdk.auth.resetPassword(
|
|
205
|
-
* "
|
|
190
|
+
* "user",
|
|
206
191
|
* "emailpass",
|
|
207
192
|
* {
|
|
208
|
-
* identifier: "
|
|
193
|
+
* identifier: "user@example.com"
|
|
209
194
|
* }
|
|
210
195
|
* )
|
|
211
196
|
* .then(() => {
|
|
@@ -228,14 +213,12 @@ export declare class Auth {
|
|
|
228
213
|
/**
|
|
229
214
|
* This method is used to update user-related data authentication data.
|
|
230
215
|
*
|
|
231
|
-
* More specifically, use this method when updating the password of an admin user
|
|
216
|
+
* More specifically, use this method when updating the password of an admin user or
|
|
232
217
|
* custom actor type after requesting to reset their password with {@link resetPassword}.
|
|
233
218
|
*
|
|
234
219
|
* This method sends a request to [this API route](https://docs.acmekit.com/api/admin#auth_postactor_typeauth_providerupdate).
|
|
235
220
|
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
|
221
|
+
* @param actor - The actor type. For example, `user` for admin user, or custom actor types.
|
|
239
222
|
* @param provider - The authentication provider to use. For example, `emailpass`.
|
|
240
223
|
* @param body - The data necessary to update the user's authentication data. When resetting the user's password,
|
|
241
224
|
* send the `password` property.
|
|
@@ -244,7 +227,7 @@ export declare class Auth {
|
|
|
244
227
|
*
|
|
245
228
|
* @example
|
|
246
229
|
* sdk.auth.updateProvider(
|
|
247
|
-
* "
|
|
230
|
+
* "user",
|
|
248
231
|
* "emailpass",
|
|
249
232
|
* {
|
|
250
233
|
* password: "supersecret"
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEhD,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CAAQ;gBAEV,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK1C
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OA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;;;;;;OA2BG;IACH,cAAc,GACZ,OAAO,MAAM,EACb,UAAU,MAAM,EAChB,MAAM,SAAS,CAAC,mBAAmB,EACnC,OAAO,MAAM,KACZ,OAAO,CAAC,IAAI,CAAC,CAMf;IAED;;OAEG;IACH,OAAO,CAAC,SAAS,CAUhB;CACF"}
|
package/dist/auth/index.js
CHANGED
|
@@ -7,13 +7,11 @@ class Auth {
|
|
|
7
7
|
* This method is used to retrieve a registration JWT token for a user, customer, or custom actor type. It sends a request to the
|
|
8
8
|
* [Retrieve Registration Token API route](https://docs.acmekit.com/api/store#auth_postactor_typeauth_provider_register).
|
|
9
9
|
*
|
|
10
|
-
* Then, it stores the returned token and passes it in the header of subsequent requests.
|
|
11
|
-
* [store.customer.create](https://docs.acmekit.com/resources/references/js-sdk/store/customer#create) method,
|
|
12
|
-
* for example, after calling this method.
|
|
10
|
+
* Then, it stores the returned token and passes it in the header of subsequent requests.
|
|
13
11
|
*
|
|
14
12
|
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
15
13
|
*
|
|
16
|
-
* @param actor - The actor type. For example, `user` for admin user, or `customer` for
|
|
14
|
+
* @param actor - The actor type. For example, `user` for admin user, or `customer` for custom actor types.
|
|
17
15
|
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
|
18
16
|
* @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
|
|
19
17
|
* you pass the email and password.
|
|
@@ -23,19 +21,15 @@ class Auth {
|
|
|
23
21
|
*
|
|
24
22
|
* @example
|
|
25
23
|
* await sdk.auth.register(
|
|
26
|
-
* "
|
|
24
|
+
* "user",
|
|
27
25
|
* "emailpass",
|
|
28
26
|
* {
|
|
29
|
-
* email: "
|
|
27
|
+
* email: "user@example.com",
|
|
30
28
|
* password: "supersecret"
|
|
31
29
|
* }
|
|
32
30
|
* )
|
|
33
31
|
*
|
|
34
32
|
* // all subsequent requests will use the token in the header
|
|
35
|
-
* const { customer } = await sdk.store.customer.create({
|
|
36
|
-
* email: "customer@gmail.com",
|
|
37
|
-
* password: "supersecret"
|
|
38
|
-
* })
|
|
39
33
|
*/
|
|
40
34
|
this.register = async (actor, method, payload) => {
|
|
41
35
|
const { token } = await this.client.fetch(`/auth/${actor}/${method}/register`, {
|
|
@@ -58,7 +52,7 @@ class Auth {
|
|
|
58
52
|
* :::note
|
|
59
53
|
*
|
|
60
54
|
* For an example of implementing third-party authentication, refer to the
|
|
61
|
-
* [
|
|
55
|
+
* [Custom Admin Authentication](https://docs.acmekit.com/resources/how-to-tutorials/how-to/admin/auth) guide.
|
|
62
56
|
*
|
|
63
57
|
* :::
|
|
64
58
|
*
|
|
@@ -76,7 +70,7 @@ class Auth {
|
|
|
76
70
|
*
|
|
77
71
|
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
78
72
|
*
|
|
79
|
-
* @param actor - The actor type. For example, `user` for admin user, or
|
|
73
|
+
* @param actor - The actor type. For example, `user` for admin user, or custom actor types.
|
|
80
74
|
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
|
81
75
|
* @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
|
|
82
76
|
* you pass the email and password.
|
|
@@ -86,10 +80,10 @@ class Auth {
|
|
|
86
80
|
*
|
|
87
81
|
* @example
|
|
88
82
|
* const result = await sdk.auth.login(
|
|
89
|
-
* "
|
|
83
|
+
* "user",
|
|
90
84
|
* "emailpass",
|
|
91
85
|
* {
|
|
92
|
-
* email: "
|
|
86
|
+
* email: "user@example.com",
|
|
93
87
|
* password: "supersecret"
|
|
94
88
|
* }
|
|
95
89
|
* )
|
|
@@ -101,9 +95,8 @@ class Auth {
|
|
|
101
95
|
* return
|
|
102
96
|
* }
|
|
103
97
|
*
|
|
104
|
-
* //
|
|
98
|
+
* // user is now authenticated
|
|
105
99
|
* // all subsequent requests will use the token in the header
|
|
106
|
-
* const { customer } = await sdk.store.customer.retrieve()
|
|
107
100
|
*/
|
|
108
101
|
this.login = async (actor, method, payload) => {
|
|
109
102
|
// There will either be token or location returned from the backend.
|
|
@@ -116,20 +109,22 @@ class Auth {
|
|
|
116
109
|
if (location) {
|
|
117
110
|
return { location };
|
|
118
111
|
}
|
|
112
|
+
if (!token) {
|
|
113
|
+
throw new Error("Unexpected auth response: server returned neither a token nor a redirect location.");
|
|
114
|
+
}
|
|
119
115
|
await this.setToken_(token);
|
|
120
116
|
return token;
|
|
121
117
|
};
|
|
122
118
|
/**
|
|
123
|
-
* This method is used to validate an Oauth callback from a third-party service, such as Google, for an admin user
|
|
119
|
+
* This method is used to validate an Oauth callback from a third-party service, such as Google, for an admin user or custom actor types.
|
|
124
120
|
* It sends a request to the [Validate Authentication Callback](https://docs.acmekit.com/api/admin#auth_postactor_typeauth_providercallback).
|
|
125
121
|
*
|
|
126
122
|
* The method stores the returned token and passes it in the header of subsequent requests. So, you can call the
|
|
127
|
-
*
|
|
128
|
-
* for example, after calling this method.
|
|
123
|
+
* {@link refresh} method, for example, after calling this method.
|
|
129
124
|
*
|
|
130
125
|
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
131
126
|
*
|
|
132
|
-
* @param actor - The actor type. For example, `user` for admin user, or
|
|
127
|
+
* @param actor - The actor type. For example, `user` for admin user, or custom actor types.
|
|
133
128
|
* @param method - The authentication provider to use. For example, `google`.
|
|
134
129
|
* @param query - The query parameters from the Oauth callback, which should be passed to the API route. This includes query parameters like
|
|
135
130
|
* `code` and `state`.
|
|
@@ -139,7 +134,7 @@ class Auth {
|
|
|
139
134
|
*
|
|
140
135
|
* @example
|
|
141
136
|
* await sdk.auth.callback(
|
|
142
|
-
* "
|
|
137
|
+
* "user",
|
|
143
138
|
* "google",
|
|
144
139
|
* {
|
|
145
140
|
* code: "123",
|
|
@@ -148,10 +143,6 @@ class Auth {
|
|
|
148
143
|
* )
|
|
149
144
|
*
|
|
150
145
|
* // all subsequent requests will use the token in the header
|
|
151
|
-
* const { customer } = await sdk.store.customer.create({
|
|
152
|
-
* email: "customer@gmail.com",
|
|
153
|
-
* password: "supersecret"
|
|
154
|
-
* })
|
|
155
146
|
*
|
|
156
147
|
* @privateRemarks
|
|
157
148
|
* The callback expects all query parameters from the Oauth callback to be passed to
|
|
@@ -175,7 +166,7 @@ class Auth {
|
|
|
175
166
|
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
176
167
|
*
|
|
177
168
|
* For an example of implementing third-party authentication, refer to the
|
|
178
|
-
* [
|
|
169
|
+
* [Custom Admin Authentication](https://docs.acmekit.com/resources/how-to-tutorials/how-to/admin/auth) guide.
|
|
179
170
|
*
|
|
180
171
|
* @param headers - Headers to pass in the request
|
|
181
172
|
*
|
|
@@ -187,7 +178,6 @@ class Auth {
|
|
|
187
178
|
* const token = await sdk.auth.refresh()
|
|
188
179
|
*
|
|
189
180
|
* // all subsequent requests will use the token in the header
|
|
190
|
-
* const { customer } = await sdk.store.customer.retrieve()
|
|
191
181
|
*/
|
|
192
182
|
this.refresh = async (headers) => {
|
|
193
183
|
const { token } = await this.client.fetch("/auth/token/refresh", {
|
|
@@ -226,14 +216,12 @@ class Auth {
|
|
|
226
216
|
this.client.clearToken();
|
|
227
217
|
};
|
|
228
218
|
/**
|
|
229
|
-
* This method requests a reset password token for an admin user
|
|
219
|
+
* This method requests a reset password token for an admin user or custom actor type.
|
|
230
220
|
* It sends a request to the [Generate Reset Password Token API route](https://docs.acmekit.com/api/admin#auth_postactor_typeauth_providerresetpassword).
|
|
231
221
|
*
|
|
232
222
|
* To reset the password later using the token delivered to the user, use the {@link updateProvider} method.
|
|
233
223
|
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
|
224
|
+
* @param actor - The actor type. For example, `user` for admin user, or custom actor types.
|
|
237
225
|
* @param provider - The authentication provider to use. For example, `emailpass`.
|
|
238
226
|
* @param body - The data required to identify the user.
|
|
239
227
|
*
|
|
@@ -241,10 +229,10 @@ class Auth {
|
|
|
241
229
|
*
|
|
242
230
|
* @example
|
|
243
231
|
* sdk.auth.resetPassword(
|
|
244
|
-
* "
|
|
232
|
+
* "user",
|
|
245
233
|
* "emailpass",
|
|
246
234
|
* {
|
|
247
|
-
* identifier: "
|
|
235
|
+
* identifier: "user@example.com"
|
|
248
236
|
* }
|
|
249
237
|
* )
|
|
250
238
|
* .then(() => {
|
|
@@ -261,14 +249,12 @@ class Auth {
|
|
|
261
249
|
/**
|
|
262
250
|
* This method is used to update user-related data authentication data.
|
|
263
251
|
*
|
|
264
|
-
* More specifically, use this method when updating the password of an admin user
|
|
252
|
+
* More specifically, use this method when updating the password of an admin user or
|
|
265
253
|
* custom actor type after requesting to reset their password with {@link resetPassword}.
|
|
266
254
|
*
|
|
267
255
|
* This method sends a request to [this API route](https://docs.acmekit.com/api/admin#auth_postactor_typeauth_providerupdate).
|
|
268
256
|
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
|
257
|
+
* @param actor - The actor type. For example, `user` for admin user, or custom actor types.
|
|
272
258
|
* @param provider - The authentication provider to use. For example, `emailpass`.
|
|
273
259
|
* @param body - The data necessary to update the user's authentication data. When resetting the user's password,
|
|
274
260
|
* send the `password` property.
|
|
@@ -277,7 +263,7 @@ class Auth {
|
|
|
277
263
|
*
|
|
278
264
|
* @example
|
|
279
265
|
* sdk.auth.updateProvider(
|
|
280
|
-
* "
|
|
266
|
+
* "user",
|
|
281
267
|
* "emailpass",
|
|
282
268
|
* {
|
|
283
269
|
* password: "supersecret"
|