@medusajs/js-sdk 3.0.0-preview-20250211091350 → 3.0.0-preview-20250406164537
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/campaign.d.ts +9 -0
- package/dist/admin/campaign.d.ts.map +1 -1
- package/dist/admin/campaign.js +9 -0
- package/dist/admin/campaign.js.map +1 -1
- package/dist/admin/customer.d.ts +95 -0
- package/dist/admin/customer.d.ts.map +1 -1
- package/dist/admin/customer.js +120 -0
- package/dist/admin/customer.js.map +1 -1
- package/dist/admin/draft-order.d.ts +427 -0
- package/dist/admin/draft-order.d.ts.map +1 -0
- package/dist/admin/draft-order.js +534 -0
- package/dist/admin/draft-order.js.map +1 -0
- package/dist/admin/fulfillment-provider.d.ts +7 -1
- package/dist/admin/fulfillment-provider.d.ts.map +1 -1
- package/dist/admin/fulfillment-provider.js +7 -1
- package/dist/admin/fulfillment-provider.js.map +1 -1
- package/dist/admin/fulfillment.js +1 -1
- package/dist/admin/fulfillment.js.map +1 -1
- package/dist/admin/index.d.ts +10 -0
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +4 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/order.d.ts +2 -1
- package/dist/admin/order.d.ts.map +1 -1
- package/dist/admin/order.js +8 -0
- package/dist/admin/order.js.map +1 -1
- package/dist/admin/plugin.d.ts +9 -0
- package/dist/admin/plugin.d.ts.map +1 -0
- package/dist/admin/plugin.js +16 -0
- package/dist/admin/plugin.js.map +1 -0
- package/dist/admin/product-collection.d.ts +1 -1
- package/dist/admin/product-collection.js +1 -1
- package/dist/admin/product.d.ts +3 -2
- package/dist/admin/product.d.ts.map +1 -1
- package/dist/admin/product.js +3 -2
- package/dist/admin/product.js.map +1 -1
- package/dist/admin/promotion.d.ts +285 -1
- package/dist/admin/promotion.d.ts.map +1 -1
- package/dist/admin/promotion.js +284 -0
- package/dist/admin/promotion.js.map +1 -1
- package/dist/admin/refund-reasons.d.ts +48 -0
- package/dist/admin/refund-reasons.d.ts.map +1 -1
- package/dist/admin/refund-reasons.js +48 -0
- package/dist/admin/refund-reasons.js.map +1 -1
- package/dist/admin/region.d.ts +137 -12
- package/dist/admin/region.d.ts.map +1 -1
- package/dist/admin/region.js +133 -0
- package/dist/admin/region.js.map +1 -1
- package/dist/admin/reservation.d.ts +134 -0
- package/dist/admin/reservation.d.ts.map +1 -1
- package/dist/admin/reservation.js +134 -0
- package/dist/admin/reservation.js.map +1 -1
- package/dist/admin/return-reason.d.ts +135 -0
- package/dist/admin/return-reason.d.ts.map +1 -1
- package/dist/admin/return-reason.js +135 -0
- package/dist/admin/return-reason.js.map +1 -1
- package/dist/admin/return.d.ts +523 -1
- package/dist/admin/return.d.ts.map +1 -1
- package/dist/admin/return.js +522 -0
- package/dist/admin/return.js.map +1 -1
- package/dist/admin/sales-channel.d.ts +176 -1
- package/dist/admin/sales-channel.d.ts.map +1 -1
- package/dist/admin/sales-channel.js +175 -0
- package/dist/admin/sales-channel.js.map +1 -1
- package/dist/admin/shipping-option.d.ts +151 -0
- package/dist/admin/shipping-option.d.ts.map +1 -1
- package/dist/admin/shipping-option.js +151 -0
- package/dist/admin/shipping-option.js.map +1 -1
- package/dist/admin/shipping-profile.d.ts +132 -0
- package/dist/admin/shipping-profile.d.ts.map +1 -1
- package/dist/admin/shipping-profile.js +132 -0
- package/dist/admin/shipping-profile.js.map +1 -1
- package/dist/admin/stock-location.d.ts +190 -0
- package/dist/admin/stock-location.d.ts.map +1 -1
- package/dist/admin/stock-location.js +190 -0
- package/dist/admin/stock-location.js.map +1 -1
- package/dist/admin/store.d.ts +99 -0
- package/dist/admin/store.d.ts.map +1 -1
- package/dist/admin/store.js +99 -0
- package/dist/admin/store.js.map +1 -1
- package/dist/admin/tax-rate.d.ts +136 -0
- package/dist/admin/tax-rate.d.ts.map +1 -1
- package/dist/admin/tax-rate.js +136 -0
- package/dist/admin/tax-rate.js.map +1 -1
- package/dist/admin/tax-region.d.ts +125 -0
- package/dist/admin/tax-region.d.ts.map +1 -1
- package/dist/admin/tax-region.js +125 -1
- package/dist/admin/tax-region.js.map +1 -1
- package/dist/admin/upload.d.ts +65 -6
- package/dist/admin/upload.d.ts.map +1 -1
- package/dist/admin/upload.js +63 -1
- package/dist/admin/upload.js.map +1 -1
- package/dist/admin/user.d.ts +147 -0
- package/dist/admin/user.d.ts.map +1 -1
- package/dist/admin/user.js +147 -0
- package/dist/admin/user.js.map +1 -1
- package/dist/admin/workflow-execution.d.ts +62 -0
- package/dist/admin/workflow-execution.d.ts.map +1 -1
- package/dist/admin/workflow-execution.js +62 -0
- package/dist/admin/workflow-execution.js.map +1 -1
- package/dist/auth/index.d.ts +88 -24
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +89 -24
- package/dist/auth/index.js.map +1 -1
- package/dist/client.d.ts +9 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +67 -48
- package/dist/client.js.map +1 -1
- package/dist/esm/admin/campaign.d.ts +9 -0
- package/dist/esm/admin/campaign.d.ts.map +1 -1
- package/dist/esm/admin/campaign.js +9 -0
- package/dist/esm/admin/campaign.js.map +1 -1
- package/dist/esm/admin/customer.d.ts +95 -0
- package/dist/esm/admin/customer.d.ts.map +1 -1
- package/dist/esm/admin/customer.js +130 -0
- package/dist/esm/admin/customer.js.map +1 -1
- package/dist/esm/admin/draft-order.d.ts +427 -0
- package/dist/esm/admin/draft-order.d.ts.map +1 -0
- package/dist/esm/admin/draft-order.js +577 -0
- package/dist/esm/admin/draft-order.js.map +1 -0
- package/dist/esm/admin/fulfillment-provider.d.ts +7 -1
- package/dist/esm/admin/fulfillment-provider.d.ts.map +1 -1
- package/dist/esm/admin/fulfillment-provider.js +7 -1
- package/dist/esm/admin/fulfillment-provider.js.map +1 -1
- package/dist/esm/admin/fulfillment.js +1 -1
- package/dist/esm/admin/fulfillment.js.map +1 -1
- package/dist/esm/admin/index.d.ts +10 -0
- package/dist/esm/admin/index.d.ts.map +1 -1
- package/dist/esm/admin/index.js +4 -0
- package/dist/esm/admin/index.js.map +1 -1
- package/dist/esm/admin/order.d.ts +2 -1
- package/dist/esm/admin/order.d.ts.map +1 -1
- package/dist/esm/admin/order.js +10 -0
- package/dist/esm/admin/order.js.map +1 -1
- package/dist/esm/admin/plugin.d.ts +9 -0
- package/dist/esm/admin/plugin.d.ts.map +1 -0
- package/dist/esm/admin/plugin.js +23 -0
- package/dist/esm/admin/plugin.js.map +1 -0
- package/dist/esm/admin/product-collection.d.ts +1 -1
- package/dist/esm/admin/product-collection.js +1 -1
- package/dist/esm/admin/product.d.ts +3 -2
- package/dist/esm/admin/product.d.ts.map +1 -1
- package/dist/esm/admin/product.js +3 -2
- package/dist/esm/admin/product.js.map +1 -1
- package/dist/esm/admin/promotion.d.ts +285 -1
- package/dist/esm/admin/promotion.d.ts.map +1 -1
- package/dist/esm/admin/promotion.js +284 -0
- package/dist/esm/admin/promotion.js.map +1 -1
- package/dist/esm/admin/refund-reasons.d.ts +48 -0
- package/dist/esm/admin/refund-reasons.d.ts.map +1 -1
- package/dist/esm/admin/refund-reasons.js +48 -0
- package/dist/esm/admin/refund-reasons.js.map +1 -1
- package/dist/esm/admin/region.d.ts +137 -12
- package/dist/esm/admin/region.d.ts.map +1 -1
- package/dist/esm/admin/region.js +133 -0
- package/dist/esm/admin/region.js.map +1 -1
- package/dist/esm/admin/reservation.d.ts +134 -0
- package/dist/esm/admin/reservation.d.ts.map +1 -1
- package/dist/esm/admin/reservation.js +134 -0
- package/dist/esm/admin/reservation.js.map +1 -1
- package/dist/esm/admin/return-reason.d.ts +135 -0
- package/dist/esm/admin/return-reason.d.ts.map +1 -1
- package/dist/esm/admin/return-reason.js +135 -0
- package/dist/esm/admin/return-reason.js.map +1 -1
- package/dist/esm/admin/return.d.ts +523 -1
- package/dist/esm/admin/return.d.ts.map +1 -1
- package/dist/esm/admin/return.js +522 -0
- package/dist/esm/admin/return.js.map +1 -1
- package/dist/esm/admin/sales-channel.d.ts +176 -1
- package/dist/esm/admin/sales-channel.d.ts.map +1 -1
- package/dist/esm/admin/sales-channel.js +175 -0
- package/dist/esm/admin/sales-channel.js.map +1 -1
- package/dist/esm/admin/shipping-option.d.ts +151 -0
- package/dist/esm/admin/shipping-option.d.ts.map +1 -1
- package/dist/esm/admin/shipping-option.js +151 -0
- package/dist/esm/admin/shipping-option.js.map +1 -1
- package/dist/esm/admin/shipping-profile.d.ts +132 -0
- package/dist/esm/admin/shipping-profile.d.ts.map +1 -1
- package/dist/esm/admin/shipping-profile.js +132 -0
- package/dist/esm/admin/shipping-profile.js.map +1 -1
- package/dist/esm/admin/stock-location.d.ts +190 -0
- package/dist/esm/admin/stock-location.d.ts.map +1 -1
- package/dist/esm/admin/stock-location.js +190 -0
- package/dist/esm/admin/stock-location.js.map +1 -1
- package/dist/esm/admin/store.d.ts +99 -0
- package/dist/esm/admin/store.d.ts.map +1 -1
- package/dist/esm/admin/store.js +99 -0
- package/dist/esm/admin/store.js.map +1 -1
- package/dist/esm/admin/tax-rate.d.ts +136 -0
- package/dist/esm/admin/tax-rate.d.ts.map +1 -1
- package/dist/esm/admin/tax-rate.js +136 -0
- package/dist/esm/admin/tax-rate.js.map +1 -1
- package/dist/esm/admin/tax-region.d.ts +125 -0
- package/dist/esm/admin/tax-region.d.ts.map +1 -1
- package/dist/esm/admin/tax-region.js +125 -1
- package/dist/esm/admin/tax-region.js.map +1 -1
- package/dist/esm/admin/upload.d.ts +65 -6
- package/dist/esm/admin/upload.d.ts.map +1 -1
- package/dist/esm/admin/upload.js +63 -1
- package/dist/esm/admin/upload.js.map +1 -1
- package/dist/esm/admin/user.d.ts +147 -0
- package/dist/esm/admin/user.d.ts.map +1 -1
- package/dist/esm/admin/user.js +147 -0
- package/dist/esm/admin/user.js.map +1 -1
- package/dist/esm/admin/workflow-execution.d.ts +62 -0
- package/dist/esm/admin/workflow-execution.d.ts.map +1 -1
- package/dist/esm/admin/workflow-execution.js +62 -0
- package/dist/esm/admin/workflow-execution.js.map +1 -1
- package/dist/esm/auth/index.d.ts +88 -24
- package/dist/esm/auth/index.d.ts.map +1 -1
- package/dist/esm/auth/index.js +89 -24
- package/dist/esm/auth/index.js.map +1 -1
- package/dist/esm/client.d.ts +9 -8
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +97 -63
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/store/index.d.ts +19 -0
- package/dist/esm/store/index.d.ts.map +1 -1
- package/dist/esm/store/index.js +19 -0
- package/dist/esm/store/index.js.map +1 -1
- package/dist/esm/types.d.ts +8 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/store/index.d.ts +19 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +19 -0
- package/dist/store/index.js.map +1 -1
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../../src/admin/user.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,IAAI;IAKf;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../../src/admin/user.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,IAAI;IAKf;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CACV,EAAU,EACV,IAA+B,EAC/B,KAAiC,EACjC,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,gBAAgB,EAAE,EAAE,EACpB;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,WAA2C,EAC3C,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAkC,cAAc,EAAE;gBACxE,OAAO;gBACP,KAAK,EAAE,WAAW;aACnB,CAAC,CAAA;QACJ,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAU,EACV,KAAiC,EACjC,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,gBAAgB,EAAE,EAAE,EACpB;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAU,EAAE,OAAuB;;YAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,gBAAgB,EAAE,EAAE,EACpB;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,EAAE,CAAC,KAAiC,EAAE,OAAuB;;YACjE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAA8B,iBAAiB,EAAE;gBACvE,KAAK;gBACL,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;KAAA;CACF"}
|
@@ -10,7 +10,69 @@ export declare class WorkflowExecution {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
+
/**
|
14
|
+
* This method retrieves a list of workflow executions. It sends a request to the
|
15
|
+
* [List Workflow Executions](https://docs.medusajs.com/api/admin#workflows-executions_getworkflowsexecutions)
|
16
|
+
* API route.
|
17
|
+
*
|
18
|
+
* @param queryParams - Filters and pagination configurations.
|
19
|
+
* @param headers - Headers to pass in the request.
|
20
|
+
* @returns The list of workflow executions.
|
21
|
+
*
|
22
|
+
* @example
|
23
|
+
* To retrieve the list of workflow executions:
|
24
|
+
*
|
25
|
+
* ```ts
|
26
|
+
* sdk.admin.workflowExecution.list()
|
27
|
+
* .then(({ workflow_executions, count, limit, offset }) => {
|
28
|
+
* console.log(workflow_executions)
|
29
|
+
* })
|
30
|
+
* ```
|
31
|
+
*
|
32
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
33
|
+
*
|
34
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
35
|
+
*
|
36
|
+
* ```ts
|
37
|
+
* sdk.admin.workflowExecution.list({
|
38
|
+
* limit: 10,
|
39
|
+
* offset: 10
|
40
|
+
* })
|
41
|
+
* .then(({ workflow_executions, count, limit, offset }) => {
|
42
|
+
* console.log(workflow_executions)
|
43
|
+
* })
|
44
|
+
* ```
|
45
|
+
*
|
46
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
47
|
+
* in each workflow execution:
|
48
|
+
*
|
49
|
+
* ```ts
|
50
|
+
* sdk.admin.workflowExecution.list({
|
51
|
+
* fields: "id,name"
|
52
|
+
* })
|
53
|
+
* .then(({ workflow_executions, count, limit, offset }) => {
|
54
|
+
* console.log(workflow_executions)
|
55
|
+
* })
|
56
|
+
* ```
|
57
|
+
*
|
58
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
|
59
|
+
*/
|
13
60
|
list(queryParams?: HttpTypes.AdminGetWorkflowExecutionsParams, headers?: ClientHeaders): Promise<HttpTypes.AdminWorkflowExecutionListResponse>;
|
61
|
+
/**
|
62
|
+
* This method retrieves a workflow execution by its ID. It sends a request to the
|
63
|
+
* [Get Workflow Execution](https://docs.medusajs.com/api/admin#workflows-executions_getworkflowsexecutionsworkflow_idtransaction_id)
|
64
|
+
* API route.
|
65
|
+
*
|
66
|
+
* @param id - The ID of the workflow execution to retrieve.
|
67
|
+
* @param headers - Headers to pass in the request.
|
68
|
+
* @returns The workflow execution's details.
|
69
|
+
*
|
70
|
+
* @example
|
71
|
+
* sdk.admin.workflowExecution.retrieve("wrk_123")
|
72
|
+
* .then(({ workflow_execution }) => {
|
73
|
+
* console.log(workflow_execution)
|
74
|
+
* })
|
75
|
+
*/
|
14
76
|
retrieve(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminWorkflowExecutionResponse>;
|
15
77
|
}
|
16
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,iBAAiB,CAAA;AAC3C,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;
|
1
|
+
{"version":3,"file":"workflow-execution.d.ts","sourceRoot":"","sources":["../../../src/admin/workflow-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,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"}
|
@@ -14,6 +14,53 @@ export class WorkflowExecution {
|
|
14
14
|
constructor(client) {
|
15
15
|
this.client = client;
|
16
16
|
}
|
17
|
+
/**
|
18
|
+
* This method retrieves a list of workflow executions. It sends a request to the
|
19
|
+
* [List Workflow Executions](https://docs.medusajs.com/api/admin#workflows-executions_getworkflowsexecutions)
|
20
|
+
* API route.
|
21
|
+
*
|
22
|
+
* @param queryParams - Filters and pagination configurations.
|
23
|
+
* @param headers - Headers to pass in the request.
|
24
|
+
* @returns The list of workflow executions.
|
25
|
+
*
|
26
|
+
* @example
|
27
|
+
* To retrieve the list of workflow executions:
|
28
|
+
*
|
29
|
+
* ```ts
|
30
|
+
* sdk.admin.workflowExecution.list()
|
31
|
+
* .then(({ workflow_executions, count, limit, offset }) => {
|
32
|
+
* console.log(workflow_executions)
|
33
|
+
* })
|
34
|
+
* ```
|
35
|
+
*
|
36
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
37
|
+
*
|
38
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
39
|
+
*
|
40
|
+
* ```ts
|
41
|
+
* sdk.admin.workflowExecution.list({
|
42
|
+
* limit: 10,
|
43
|
+
* offset: 10
|
44
|
+
* })
|
45
|
+
* .then(({ workflow_executions, count, limit, offset }) => {
|
46
|
+
* console.log(workflow_executions)
|
47
|
+
* })
|
48
|
+
* ```
|
49
|
+
*
|
50
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
51
|
+
* in each workflow execution:
|
52
|
+
*
|
53
|
+
* ```ts
|
54
|
+
* sdk.admin.workflowExecution.list({
|
55
|
+
* fields: "id,name"
|
56
|
+
* })
|
57
|
+
* .then(({ workflow_executions, count, limit, offset }) => {
|
58
|
+
* console.log(workflow_executions)
|
59
|
+
* })
|
60
|
+
* ```
|
61
|
+
*
|
62
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/admin#select-fields-and-relations).
|
63
|
+
*/
|
17
64
|
list(queryParams, headers) {
|
18
65
|
return __awaiter(this, void 0, void 0, function* () {
|
19
66
|
return yield this.client.fetch(`/admin/workflows-executions`, {
|
@@ -22,6 +69,21 @@ export class WorkflowExecution {
|
|
22
69
|
});
|
23
70
|
});
|
24
71
|
}
|
72
|
+
/**
|
73
|
+
* This method retrieves a workflow execution by its ID. It sends a request to the
|
74
|
+
* [Get Workflow Execution](https://docs.medusajs.com/api/admin#workflows-executions_getworkflowsexecutionsworkflow_idtransaction_id)
|
75
|
+
* API route.
|
76
|
+
*
|
77
|
+
* @param id - The ID of the workflow execution to retrieve.
|
78
|
+
* @param headers - Headers to pass in the request.
|
79
|
+
* @returns The workflow execution's details.
|
80
|
+
*
|
81
|
+
* @example
|
82
|
+
* sdk.admin.workflowExecution.retrieve("wrk_123")
|
83
|
+
* .then(({ workflow_execution }) => {
|
84
|
+
* console.log(workflow_execution)
|
85
|
+
* })
|
86
|
+
*/
|
25
87
|
retrieve(id, headers) {
|
26
88
|
return __awaiter(this, void 0, void 0, function* () {
|
27
89
|
return yield this.client.fetch(`/admin/workflows-executions/${id}`, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"workflow-execution.js","sourceRoot":"","sources":["../../../src/admin/workflow-execution.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;
|
1
|
+
{"version":3,"file":"workflow-execution.js","sourceRoot":"","sources":["../../../src/admin/workflow-execution.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,iBAAiB;IAK5B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,WAAwD,EACxD,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,6BAA6B,EAC7B;gBACE,KAAK,EAAE,WAAW;gBAClB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;OAcG;IACG,QAAQ,CAAC,EAAU,EAAE,OAAuB;;YAChD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,+BAA+B,EAAE,EAAE,EACnC;gBACE,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
|
package/dist/esm/auth/index.d.ts
CHANGED
@@ -9,6 +9,12 @@ 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.medusajs.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. So, you can call the
|
13
|
+
* [store.customer.create](https://docs.medusajs.com/resources/references/js-sdk/store/customer#create) method,
|
14
|
+
* for example, after calling this method.
|
15
|
+
*
|
16
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
17
|
+
*
|
12
18
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
13
19
|
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
14
20
|
* @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
|
@@ -18,15 +24,19 @@ export declare class Auth {
|
|
18
24
|
* @tags auth
|
19
25
|
*
|
20
26
|
* @example
|
21
|
-
* sdk.auth.register(
|
27
|
+
* await sdk.auth.register(
|
22
28
|
* "customer",
|
23
29
|
* "emailpass",
|
24
30
|
* {
|
25
31
|
* email: "customer@gmail.com",
|
26
32
|
* password: "supersecret"
|
27
33
|
* }
|
28
|
-
* )
|
29
|
-
*
|
34
|
+
* )
|
35
|
+
*
|
36
|
+
* // 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"
|
30
40
|
* })
|
31
41
|
*/
|
32
42
|
register: (actor: string, method: string, payload: HttpTypes.AdminSignUpWithEmailPassword) => Promise<string>;
|
@@ -34,11 +44,32 @@ export declare class Auth {
|
|
34
44
|
* This method retrieves the JWT authenticated token for an admin user, customer, or custom
|
35
45
|
* actor type. It sends a request to the [Authenticate API Route](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_provider).
|
36
46
|
*
|
47
|
+
* ### Third-Party Authentication
|
48
|
+
*
|
49
|
+
* If the API route returns a `location` property, it means that the authentication requires additional steps,
|
50
|
+
* typically in a third-party service. The `location` property is returned so that you
|
51
|
+
* can redirect the user to the appropriate page.
|
52
|
+
*
|
53
|
+
* :::note
|
54
|
+
*
|
55
|
+
* For an example of implementing third-party authentication, refer to the
|
56
|
+
* [Third-Party Login in Storefront](https://docs.medusajs.com/resources/storefront-development/customers/third-party-login) guide.
|
57
|
+
*
|
58
|
+
* :::
|
59
|
+
*
|
60
|
+
* ### Session Authentication
|
61
|
+
*
|
37
62
|
* If the `auth.type` of the SDK is set to `session`, this method will also send a request to the
|
38
63
|
* [Set Authentication Session API route](https://docs.medusajs.com/api/admin#auth_postsession).
|
39
64
|
*
|
40
|
-
*
|
41
|
-
*
|
65
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
66
|
+
*
|
67
|
+
* ### Automatic Authentication
|
68
|
+
*
|
69
|
+
* If the authentication was successful, subsequent requests using the SDK will automatically have the necessary authentication headers / session
|
70
|
+
* set, based on your JS SDK authentication configurations.
|
71
|
+
*
|
72
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
42
73
|
*
|
43
74
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
44
75
|
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
@@ -49,16 +80,25 @@ export declare class Auth {
|
|
49
80
|
* @tags auth
|
50
81
|
*
|
51
82
|
* @example
|
52
|
-
* sdk.auth.login(
|
83
|
+
* const result = await sdk.auth.login(
|
53
84
|
* "customer",
|
54
85
|
* "emailpass",
|
55
86
|
* {
|
56
87
|
* email: "customer@gmail.com",
|
57
88
|
* password: "supersecret"
|
58
89
|
* }
|
59
|
-
* )
|
60
|
-
*
|
61
|
-
*
|
90
|
+
* )
|
91
|
+
*
|
92
|
+
* if (typeof result !== "string") {
|
93
|
+
* alert("Authentication requires additional steps")
|
94
|
+
* // replace with the redirect logic of your application
|
95
|
+
* window.location.href = result.location
|
96
|
+
* return
|
97
|
+
* }
|
98
|
+
*
|
99
|
+
* // customer is now authenticated
|
100
|
+
* // all subsequent requests will use the token in the header
|
101
|
+
* const { customer } = await sdk.store.customer.retrieve()
|
62
102
|
*/
|
63
103
|
login: (actor: string, method: string, payload: HttpTypes.AdminSignInWithEmailPassword | Record<string, unknown>) => Promise<string | {
|
64
104
|
location: string;
|
@@ -67,6 +107,12 @@ export declare class Auth {
|
|
67
107
|
* This method is used to validate an Oauth callback from a third-party service, such as Google, for an admin user, customer, or custom actor types.
|
68
108
|
* It sends a request to the [Validate Authentication Callback](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_providercallback).
|
69
109
|
*
|
110
|
+
* The method stores the returned token and passes it in the header of subsequent requests. So, you can call the
|
111
|
+
* [store.customer.create](https://docs.medusajs.com/resources/references/js-sdk/store/customer#create) or {@link refresh} methods,
|
112
|
+
* for example, after calling this method.
|
113
|
+
*
|
114
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
115
|
+
*
|
70
116
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
71
117
|
* @param method - The authentication provider to use. For example, `google`.
|
72
118
|
* @param query - The query parameters from the Oauth callback, which should be passed to the API route. This includes query parameters like
|
@@ -76,17 +122,20 @@ export declare class Auth {
|
|
76
122
|
* @tags auth
|
77
123
|
*
|
78
124
|
* @example
|
79
|
-
* sdk.auth.callback(
|
125
|
+
* await sdk.auth.callback(
|
80
126
|
* "customer",
|
81
127
|
* "google",
|
82
128
|
* {
|
83
129
|
* code: "123",
|
84
130
|
* state: "456"
|
85
131
|
* }
|
86
|
-
* )
|
87
|
-
* console.log(token)
|
88
|
-
* })
|
132
|
+
* )
|
89
133
|
*
|
134
|
+
* // 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
|
+
* })
|
90
139
|
*
|
91
140
|
* @privateRemarks
|
92
141
|
* The callback expects all query parameters from the Oauth callback to be passed to
|
@@ -97,28 +146,43 @@ export declare class Auth {
|
|
97
146
|
* This method refreshes a JWT authentication token, which is useful after validating the Oauth callback
|
98
147
|
* with {@link callback}. It sends a request to the [Refresh Authentication Token API route](https://docs.medusajs.com/api/admin#auth_postadminauthtokenrefresh).
|
99
148
|
*
|
149
|
+
* The method stores the returned token and passes it in the header of subsequent requests. So, you can call other
|
150
|
+
* methods that require authentication after calling this method.
|
151
|
+
*
|
152
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
153
|
+
*
|
154
|
+
* For an example of implementing third-party authentication, refer to the
|
155
|
+
* [Third-Party Login in Storefront](https://docs.medusajs.com/resources/storefront-development/customers/third-party-login) guide.
|
156
|
+
*
|
157
|
+
*
|
100
158
|
* @returns The refreshed JWT authentication token.
|
101
159
|
*
|
102
160
|
* @tags auth
|
103
161
|
*
|
104
162
|
* @example
|
105
|
-
* sdk.auth.refresh()
|
106
|
-
*
|
107
|
-
*
|
108
|
-
* })
|
163
|
+
* const token = await sdk.auth.refresh()
|
164
|
+
*
|
165
|
+
* // all subsequent requests will use the token in the header
|
166
|
+
* const { customer } = await sdk.store.customer.retrieve()
|
109
167
|
*/
|
110
168
|
refresh: () => Promise<string>;
|
111
169
|
/**
|
112
|
-
* This method
|
113
|
-
*
|
170
|
+
* This method logs out the currently authenticated user based on your JS SDK authentication configurations.
|
171
|
+
*
|
172
|
+
* If the `auth.type` of the SDK is set to `session`, this method will also send a request to the
|
173
|
+
* [Delete Authentication Session API route](https://docs.medusajs.com/api/admin#auth_deletesession).
|
174
|
+
*
|
175
|
+
* The method also clears any stored tokens or sessions, based on your JS SDK authentication configurations.
|
176
|
+
*
|
177
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
114
178
|
*
|
115
179
|
* @tags auth
|
116
180
|
*
|
117
181
|
* @example
|
118
|
-
* sdk.auth.logout()
|
119
|
-
*
|
120
|
-
*
|
121
|
-
*
|
182
|
+
* await sdk.auth.logout()
|
183
|
+
*
|
184
|
+
* // user is now logged out
|
185
|
+
* // you can't send any requests that require authentication
|
122
186
|
*/
|
123
187
|
logout: () => Promise<void>;
|
124
188
|
/**
|
@@ -184,7 +248,7 @@ export declare class Auth {
|
|
184
248
|
* // password updated
|
185
249
|
* })
|
186
250
|
*/
|
187
|
-
updateProvider: (actor: string, provider: string, body:
|
251
|
+
updateProvider: (actor: string, provider: string, body: HttpTypes.AdminUpdateProvider, token: string) => Promise<void>;
|
188
252
|
/**
|
189
253
|
* @ignore
|
190
254
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,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,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CAAQ;gBAEV,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,QAAQ,UACC,MAAM,UACL,MAAM,WACL,SAAS,CAAC,4BAA4B,qBAahD;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2DG;IACH,KAAK,UACI,MAAM,UACL,MAAM,WACL,SAAS,CAAC,4BAA4B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;OAmB1E;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,QAAQ,UACC,MAAM,UACL,MAAM,UACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,qBAYhC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,wBAYN;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,sBAQL;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,aAAa,UACJ,MAAM,YACH,MAAM,QACV;QACJ;;;WAGG;QACH,UAAU,EAAE,MAAM,CAAA;KACnB,mBAOF;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,cAAc,UACL,MAAM,YACH,MAAM,QACV,SAAS,CAAC,mBAAmB,SAC5B,MAAM,mBAOd;IAED;;OAEG;IACH,OAAO,CAAC,SAAS,CAUhB;CACF"}
|
package/dist/esm/auth/index.js
CHANGED
@@ -13,6 +13,12 @@ export class Auth {
|
|
13
13
|
* This method is used to retrieve a registration JWT token for a user, customer, or custom actor type. It sends a request to the
|
14
14
|
* [Retrieve Registration Token API route](https://docs.medusajs.com/api/store#auth_postactor_typeauth_provider_register).
|
15
15
|
*
|
16
|
+
* Then, it stores the returned token and passes it in the header of subsequent requests. So, you can call the
|
17
|
+
* [store.customer.create](https://docs.medusajs.com/resources/references/js-sdk/store/customer#create) method,
|
18
|
+
* for example, after calling this method.
|
19
|
+
*
|
20
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
21
|
+
*
|
16
22
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
17
23
|
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
18
24
|
* @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
|
@@ -22,15 +28,19 @@ export class Auth {
|
|
22
28
|
* @tags auth
|
23
29
|
*
|
24
30
|
* @example
|
25
|
-
* sdk.auth.register(
|
31
|
+
* await sdk.auth.register(
|
26
32
|
* "customer",
|
27
33
|
* "emailpass",
|
28
34
|
* {
|
29
35
|
* email: "customer@gmail.com",
|
30
36
|
* password: "supersecret"
|
31
37
|
* }
|
32
|
-
* )
|
33
|
-
*
|
38
|
+
* )
|
39
|
+
*
|
40
|
+
* // all subsequent requests will use the token in the header
|
41
|
+
* const { customer } = await sdk.store.customer.create({
|
42
|
+
* email: "customer@gmail.com",
|
43
|
+
* password: "supersecret"
|
34
44
|
* })
|
35
45
|
*/
|
36
46
|
this.register = (actor, method, payload) => __awaiter(this, void 0, void 0, function* () {
|
@@ -45,11 +55,32 @@ export class Auth {
|
|
45
55
|
* This method retrieves the JWT authenticated token for an admin user, customer, or custom
|
46
56
|
* actor type. It sends a request to the [Authenticate API Route](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_provider).
|
47
57
|
*
|
58
|
+
* ### Third-Party Authentication
|
59
|
+
*
|
60
|
+
* If the API route returns a `location` property, it means that the authentication requires additional steps,
|
61
|
+
* typically in a third-party service. The `location` property is returned so that you
|
62
|
+
* can redirect the user to the appropriate page.
|
63
|
+
*
|
64
|
+
* :::note
|
65
|
+
*
|
66
|
+
* For an example of implementing third-party authentication, refer to the
|
67
|
+
* [Third-Party Login in Storefront](https://docs.medusajs.com/resources/storefront-development/customers/third-party-login) guide.
|
68
|
+
*
|
69
|
+
* :::
|
70
|
+
*
|
71
|
+
* ### Session Authentication
|
72
|
+
*
|
48
73
|
* If the `auth.type` of the SDK is set to `session`, this method will also send a request to the
|
49
74
|
* [Set Authentication Session API route](https://docs.medusajs.com/api/admin#auth_postsession).
|
50
75
|
*
|
51
|
-
*
|
52
|
-
*
|
76
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
77
|
+
*
|
78
|
+
* ### Automatic Authentication
|
79
|
+
*
|
80
|
+
* If the authentication was successful, subsequent requests using the SDK will automatically have the necessary authentication headers / session
|
81
|
+
* set, based on your JS SDK authentication configurations.
|
82
|
+
*
|
83
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
53
84
|
*
|
54
85
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
55
86
|
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
@@ -60,16 +91,25 @@ export class Auth {
|
|
60
91
|
* @tags auth
|
61
92
|
*
|
62
93
|
* @example
|
63
|
-
* sdk.auth.login(
|
94
|
+
* const result = await sdk.auth.login(
|
64
95
|
* "customer",
|
65
96
|
* "emailpass",
|
66
97
|
* {
|
67
98
|
* email: "customer@gmail.com",
|
68
99
|
* password: "supersecret"
|
69
100
|
* }
|
70
|
-
* )
|
71
|
-
*
|
72
|
-
*
|
101
|
+
* )
|
102
|
+
*
|
103
|
+
* if (typeof result !== "string") {
|
104
|
+
* alert("Authentication requires additional steps")
|
105
|
+
* // replace with the redirect logic of your application
|
106
|
+
* window.location.href = result.location
|
107
|
+
* return
|
108
|
+
* }
|
109
|
+
*
|
110
|
+
* // customer is now authenticated
|
111
|
+
* // all subsequent requests will use the token in the header
|
112
|
+
* const { customer } = await sdk.store.customer.retrieve()
|
73
113
|
*/
|
74
114
|
this.login = (actor, method, payload) => __awaiter(this, void 0, void 0, function* () {
|
75
115
|
// There will either be token or location returned from the backend.
|
@@ -89,6 +129,12 @@ export class Auth {
|
|
89
129
|
* This method is used to validate an Oauth callback from a third-party service, such as Google, for an admin user, customer, or custom actor types.
|
90
130
|
* It sends a request to the [Validate Authentication Callback](https://docs.medusajs.com/api/admin#auth_postactor_typeauth_providercallback).
|
91
131
|
*
|
132
|
+
* The method stores the returned token and passes it in the header of subsequent requests. So, you can call the
|
133
|
+
* [store.customer.create](https://docs.medusajs.com/resources/references/js-sdk/store/customer#create) or {@link refresh} methods,
|
134
|
+
* for example, after calling this method.
|
135
|
+
*
|
136
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
137
|
+
*
|
92
138
|
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
93
139
|
* @param method - The authentication provider to use. For example, `google`.
|
94
140
|
* @param query - The query parameters from the Oauth callback, which should be passed to the API route. This includes query parameters like
|
@@ -98,17 +144,20 @@ export class Auth {
|
|
98
144
|
* @tags auth
|
99
145
|
*
|
100
146
|
* @example
|
101
|
-
* sdk.auth.callback(
|
147
|
+
* await sdk.auth.callback(
|
102
148
|
* "customer",
|
103
149
|
* "google",
|
104
150
|
* {
|
105
151
|
* code: "123",
|
106
152
|
* state: "456"
|
107
153
|
* }
|
108
|
-
* )
|
109
|
-
* console.log(token)
|
110
|
-
* })
|
154
|
+
* )
|
111
155
|
*
|
156
|
+
* // all subsequent requests will use the token in the header
|
157
|
+
* const { customer } = await sdk.store.customer.create({
|
158
|
+
* email: "customer@gmail.com",
|
159
|
+
* password: "supersecret"
|
160
|
+
* })
|
112
161
|
*
|
113
162
|
* @privateRemarks
|
114
163
|
* The callback expects all query parameters from the Oauth callback to be passed to
|
@@ -126,15 +175,24 @@ export class Auth {
|
|
126
175
|
* This method refreshes a JWT authentication token, which is useful after validating the Oauth callback
|
127
176
|
* with {@link callback}. It sends a request to the [Refresh Authentication Token API route](https://docs.medusajs.com/api/admin#auth_postadminauthtokenrefresh).
|
128
177
|
*
|
178
|
+
* The method stores the returned token and passes it in the header of subsequent requests. So, you can call other
|
179
|
+
* methods that require authentication after calling this method.
|
180
|
+
*
|
181
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
182
|
+
*
|
183
|
+
* For an example of implementing third-party authentication, refer to the
|
184
|
+
* [Third-Party Login in Storefront](https://docs.medusajs.com/resources/storefront-development/customers/third-party-login) guide.
|
185
|
+
*
|
186
|
+
*
|
129
187
|
* @returns The refreshed JWT authentication token.
|
130
188
|
*
|
131
189
|
* @tags auth
|
132
190
|
*
|
133
191
|
* @example
|
134
|
-
* sdk.auth.refresh()
|
135
|
-
*
|
136
|
-
*
|
137
|
-
* })
|
192
|
+
* const token = await sdk.auth.refresh()
|
193
|
+
*
|
194
|
+
* // all subsequent requests will use the token in the header
|
195
|
+
* const { customer } = await sdk.store.customer.retrieve()
|
138
196
|
*/
|
139
197
|
this.refresh = () => __awaiter(this, void 0, void 0, function* () {
|
140
198
|
const { token } = yield this.client.fetch("/auth/token/refresh", {
|
@@ -146,16 +204,22 @@ export class Auth {
|
|
146
204
|
return token;
|
147
205
|
});
|
148
206
|
/**
|
149
|
-
* This method
|
150
|
-
*
|
207
|
+
* This method logs out the currently authenticated user based on your JS SDK authentication configurations.
|
208
|
+
*
|
209
|
+
* If the `auth.type` of the SDK is set to `session`, this method will also send a request to the
|
210
|
+
* [Delete Authentication Session API route](https://docs.medusajs.com/api/admin#auth_deletesession).
|
211
|
+
*
|
212
|
+
* The method also clears any stored tokens or sessions, based on your JS SDK authentication configurations.
|
213
|
+
*
|
214
|
+
* Learn more in the [JS SDK Authentication](https://docs.medusajs.com/resources/js-sdk/auth/overview) guide.
|
151
215
|
*
|
152
216
|
* @tags auth
|
153
217
|
*
|
154
218
|
* @example
|
155
|
-
* sdk.auth.logout()
|
156
|
-
*
|
157
|
-
*
|
158
|
-
*
|
219
|
+
* await sdk.auth.logout()
|
220
|
+
*
|
221
|
+
* // user is now logged out
|
222
|
+
* // you can't send any requests that require authentication
|
159
223
|
*/
|
160
224
|
this.logout = () => __awaiter(this, void 0, void 0, function* () {
|
161
225
|
var _a, _b;
|
@@ -230,9 +294,10 @@ export class Auth {
|
|
230
294
|
* })
|
231
295
|
*/
|
232
296
|
this.updateProvider = (actor, provider, body, token) => __awaiter(this, void 0, void 0, function* () {
|
233
|
-
yield this.client.fetch(`/auth/${actor}/${provider}/update
|
297
|
+
yield this.client.fetch(`/auth/${actor}/${provider}/update`, {
|
234
298
|
method: "POST",
|
235
299
|
body,
|
300
|
+
headers: { Authorization: `Bearer ${token}` },
|
236
301
|
});
|
237
302
|
});
|
238
303
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,IAAI;IAIf,YAAY,MAAc,EAAE,MAAc;QAK1C
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,IAAI;IAIf,YAAY,MAAc,EAAE,MAAc;QAK1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAiCG;QACH,aAAQ,GAAG,CACT,KAAa,EACb,MAAc,EACd,OAA+C,EAC/C,EAAE;YACF,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACvC,SAAS,KAAK,IAAI,MAAM,WAAW,EACnC;gBACE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,OAAO;aACd,CACF,CAAA;YAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;YAE3B,OAAO,KAAK,CAAA;QACd,CAAC,CAAA,CA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AI,MAAK,SAAS,EAAE,CAAC;gBAC1C,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE;oBACvC,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE;iBAC9C,CAAC,CAAA;YACJ,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;YAC7B,CAAC;QACH,CAAC,CAAA,CAAA;QAxWC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CAuWF"}
|
package/dist/esm/client.d.ts
CHANGED
@@ -36,9 +36,9 @@ export declare class Client {
|
|
36
36
|
* @returns FetchStreamResponse
|
37
37
|
*/
|
38
38
|
fetchStream(input: FetchInput, init?: FetchArgs): Promise<FetchStreamResponse>;
|
39
|
-
setToken(token: string): void
|
40
|
-
clearToken(): void
|
41
|
-
protected clearToken_(): void
|
39
|
+
setToken(token: string): Promise<void>;
|
40
|
+
clearToken(): Promise<void>;
|
41
|
+
protected clearToken_(): Promise<void>;
|
42
42
|
protected initClient(): ClientFetch;
|
43
43
|
protected getApiKeyHeader_: () => {
|
44
44
|
Authorization: string;
|
@@ -46,14 +46,15 @@ export declare class Client {
|
|
46
46
|
protected getPublishableKeyHeader_: () => {
|
47
47
|
[PUBLISHABLE_KEY_HEADER]: string;
|
48
48
|
} | {};
|
49
|
-
protected getJwtHeader_
|
49
|
+
protected getJwtHeader_(): Promise<{
|
50
50
|
Authorization: string;
|
51
|
-
} | {}
|
52
|
-
protected setToken_
|
53
|
-
protected getToken_
|
51
|
+
} | {}>;
|
52
|
+
protected setToken_(token: string): Promise<void>;
|
53
|
+
protected getToken_(): Promise<string | null | undefined>;
|
54
54
|
protected getTokenStorageInfo_: () => {
|
55
|
-
storageMethod: "session" | "local" | "memory" | "nostore";
|
55
|
+
storageMethod: "session" | "local" | "memory" | "custom" | "nostore";
|
56
56
|
storageKey: string;
|
57
57
|
};
|
58
|
+
protected throwError_(message: string): void;
|
58
59
|
}
|
59
60
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/esm/client.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,UAAU,EACV,mBAAmB,EAEpB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,sBAAsB,0BAA0B,CAAA;AAoF7D,qBAAa,UAAW,SAAQ,KAAK;IACnC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;gBAElB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAKlE;AAED,qBAAa,MAAM;IACV,MAAM,EAAE,WAAW,CAAA;IAC1B,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,MAAM,CAAQ;IAEtB,OAAO,CAAC,uBAAuB,CAAsB;IACrD,OAAO,CAAC,KAAK,CAAK;gBAEN,MAAM,EAAE,MAAM;IAiB1B;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,CAAC,SAAS,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC;IAIrE;;;;;;;;;OASG;IACG,WAAW,CACf,KAAK,EAAE,UAAU,EACjB,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,UAAU,EACV,mBAAmB,EAEpB,MAAM,SAAS,CAAA;AAEhB,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