@medusajs/js-sdk 1.0.0-rc-20241018141633 → 1.0.0-rc-20241022152047

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. package/dist/admin/api-key.d.ts +144 -1
  2. package/dist/admin/api-key.d.ts.map +1 -1
  3. package/dist/admin/api-key.js +143 -0
  4. package/dist/admin/api-key.js.map +1 -1
  5. package/dist/admin/campaign.d.ts +135 -0
  6. package/dist/admin/campaign.d.ts.map +1 -1
  7. package/dist/admin/campaign.js +135 -0
  8. package/dist/admin/campaign.js.map +1 -1
  9. package/dist/admin/claim.d.ts +542 -20
  10. package/dist/admin/claim.d.ts.map +1 -1
  11. package/dist/admin/claim.js +523 -7
  12. package/dist/admin/claim.js.map +1 -1
  13. package/dist/admin/currency.d.ts +80 -1
  14. package/dist/admin/currency.d.ts.map +1 -1
  15. package/dist/admin/currency.js +81 -2
  16. package/dist/admin/currency.js.map +1 -1
  17. package/dist/admin/customer-group.d.ts +152 -2
  18. package/dist/admin/customer-group.d.ts.map +1 -1
  19. package/dist/admin/customer-group.js +150 -0
  20. package/dist/admin/customer-group.js.map +1 -1
  21. package/dist/admin/customer.d.ts +135 -13
  22. package/dist/admin/customer.d.ts.map +1 -1
  23. package/dist/admin/customer.js +130 -0
  24. package/dist/admin/customer.js.map +1 -1
  25. package/dist/admin/exchange.d.ts +471 -20
  26. package/dist/admin/exchange.d.ts.map +1 -1
  27. package/dist/admin/exchange.js +455 -30
  28. package/dist/admin/exchange.js.map +1 -1
  29. package/dist/admin/fulfillment-provider.d.ts +47 -0
  30. package/dist/admin/fulfillment-provider.d.ts.map +1 -1
  31. package/dist/admin/fulfillment-provider.js +47 -0
  32. package/dist/admin/fulfillment-provider.js.map +1 -1
  33. package/dist/admin/fulfillment-set.d.ts +122 -0
  34. package/dist/admin/fulfillment-set.d.ts.map +1 -1
  35. package/dist/admin/fulfillment-set.js +122 -0
  36. package/dist/admin/fulfillment-set.js.map +1 -1
  37. package/dist/admin/fulfillment.d.ts +74 -0
  38. package/dist/admin/fulfillment.d.ts.map +1 -1
  39. package/dist/admin/fulfillment.js +75 -0
  40. package/dist/admin/fulfillment.js.map +1 -1
  41. package/dist/admin/inventory-item.d.ts +252 -1
  42. package/dist/admin/inventory-item.d.ts.map +1 -1
  43. package/dist/admin/inventory-item.js +251 -0
  44. package/dist/admin/inventory-item.js.map +1 -1
  45. package/dist/admin/invite.d.ts +170 -15
  46. package/dist/admin/invite.d.ts.map +1 -1
  47. package/dist/admin/invite.js +162 -0
  48. package/dist/admin/invite.js.map +1 -1
  49. package/dist/admin/order.d.ts +1 -0
  50. package/dist/admin/order.d.ts.map +1 -1
  51. package/dist/admin/order.js +6 -0
  52. package/dist/admin/order.js.map +1 -1
  53. package/dist/auth/index.d.ts +156 -0
  54. package/dist/auth/index.d.ts.map +1 -1
  55. package/dist/auth/index.js +152 -1
  56. package/dist/auth/index.js.map +1 -1
  57. package/dist/client.d.ts +1 -1
  58. package/dist/client.d.ts.map +1 -1
  59. package/dist/client.js +2 -1
  60. package/dist/client.js.map +1 -1
  61. package/dist/esm/admin/api-key.d.ts +144 -1
  62. package/dist/esm/admin/api-key.d.ts.map +1 -1
  63. package/dist/esm/admin/api-key.js +143 -0
  64. package/dist/esm/admin/api-key.js.map +1 -1
  65. package/dist/esm/admin/campaign.d.ts +135 -0
  66. package/dist/esm/admin/campaign.d.ts.map +1 -1
  67. package/dist/esm/admin/campaign.js +135 -0
  68. package/dist/esm/admin/campaign.js.map +1 -1
  69. package/dist/esm/admin/claim.d.ts +542 -20
  70. package/dist/esm/admin/claim.d.ts.map +1 -1
  71. package/dist/esm/admin/claim.js +523 -9
  72. package/dist/esm/admin/claim.js.map +1 -1
  73. package/dist/esm/admin/currency.d.ts +80 -1
  74. package/dist/esm/admin/currency.d.ts.map +1 -1
  75. package/dist/esm/admin/currency.js +81 -2
  76. package/dist/esm/admin/currency.js.map +1 -1
  77. package/dist/esm/admin/customer-group.d.ts +152 -2
  78. package/dist/esm/admin/customer-group.d.ts.map +1 -1
  79. package/dist/esm/admin/customer-group.js +150 -0
  80. package/dist/esm/admin/customer-group.js.map +1 -1
  81. package/dist/esm/admin/customer.d.ts +135 -13
  82. package/dist/esm/admin/customer.d.ts.map +1 -1
  83. package/dist/esm/admin/customer.js +130 -0
  84. package/dist/esm/admin/customer.js.map +1 -1
  85. package/dist/esm/admin/exchange.d.ts +471 -20
  86. package/dist/esm/admin/exchange.d.ts.map +1 -1
  87. package/dist/esm/admin/exchange.js +455 -38
  88. package/dist/esm/admin/exchange.js.map +1 -1
  89. package/dist/esm/admin/fulfillment-provider.d.ts +47 -0
  90. package/dist/esm/admin/fulfillment-provider.d.ts.map +1 -1
  91. package/dist/esm/admin/fulfillment-provider.js +47 -0
  92. package/dist/esm/admin/fulfillment-provider.js.map +1 -1
  93. package/dist/esm/admin/fulfillment-set.d.ts +122 -0
  94. package/dist/esm/admin/fulfillment-set.d.ts.map +1 -1
  95. package/dist/esm/admin/fulfillment-set.js +122 -0
  96. package/dist/esm/admin/fulfillment-set.js.map +1 -1
  97. package/dist/esm/admin/fulfillment.d.ts +74 -0
  98. package/dist/esm/admin/fulfillment.d.ts.map +1 -1
  99. package/dist/esm/admin/fulfillment.js +75 -0
  100. package/dist/esm/admin/fulfillment.js.map +1 -1
  101. package/dist/esm/admin/inventory-item.d.ts +252 -1
  102. package/dist/esm/admin/inventory-item.d.ts.map +1 -1
  103. package/dist/esm/admin/inventory-item.js +251 -0
  104. package/dist/esm/admin/inventory-item.js.map +1 -1
  105. package/dist/esm/admin/invite.d.ts +170 -15
  106. package/dist/esm/admin/invite.d.ts.map +1 -1
  107. package/dist/esm/admin/invite.js +162 -0
  108. package/dist/esm/admin/invite.js.map +1 -1
  109. package/dist/esm/admin/order.d.ts +1 -0
  110. package/dist/esm/admin/order.d.ts.map +1 -1
  111. package/dist/esm/admin/order.js +8 -0
  112. package/dist/esm/admin/order.js.map +1 -1
  113. package/dist/esm/auth/index.d.ts +156 -0
  114. package/dist/esm/auth/index.d.ts.map +1 -1
  115. package/dist/esm/auth/index.js +152 -1
  116. package/dist/esm/auth/index.js.map +1 -1
  117. package/dist/esm/client.d.ts +1 -1
  118. package/dist/esm/client.d.ts.map +1 -1
  119. package/dist/esm/client.js +2 -1
  120. package/dist/esm/client.js.map +1 -1
  121. package/dist/esm/store/index.d.ts +973 -83
  122. package/dist/esm/store/index.d.ts.map +1 -1
  123. package/dist/esm/store/index.js +946 -0
  124. package/dist/esm/store/index.js.map +1 -1
  125. package/dist/esm/types.d.ts +6 -1
  126. package/dist/esm/types.d.ts.map +1 -1
  127. package/dist/store/index.d.ts +973 -83
  128. package/dist/store/index.d.ts.map +1 -1
  129. package/dist/store/index.js +946 -0
  130. package/dist/store/index.js.map +1 -1
  131. package/dist/types.d.ts +6 -1
  132. package/dist/types.d.ts.map +1 -1
  133. package/package.json +2 -2
@@ -10,23 +10,178 @@ export declare class Invite {
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
+ /**
14
+ * This method accepts an invite. It requires sending a previous request to
15
+ * the {@link Auth.register}.
16
+ *
17
+ * This method sends a request to the [Accept Invite]
18
+ * (https://docs.medusajs.com/v2/api/admin#invites_postinvitesaccept)
19
+ * API route.
20
+ *
21
+ * @param input - The details of the user to create.
22
+ * @param query - Configure the fields to retrieve in the user.
23
+ * @param headers - Headers to pass in the request
24
+ * @returns The user's details.
25
+ *
26
+ * @example
27
+ * const token = await sdk.auth.register("user", "emailpass", {
28
+ * email: "user@gmail.com",
29
+ * password: "supersecret"
30
+ * })
31
+ *
32
+ * sdk.admin.invite.accept(
33
+ * {
34
+ * email: "user@gmail.com",
35
+ * first_name: "John",
36
+ * last_name: "Smith",
37
+ * invite_token: "12345..."
38
+ * },
39
+ * {
40
+ * Authorization: `Bearer ${token}`
41
+ * }
42
+ * )
43
+ * .then(({ user }) => {
44
+ * console.log(user)
45
+ * })
46
+ */
13
47
  accept(input: HttpTypes.AdminAcceptInvite & {
48
+ /**
49
+ * The invite's token.
50
+ */
14
51
  invite_token: string;
15
- }, query?: SelectParams, headers?: ClientHeaders): Promise<{
16
- user: HttpTypes.AdminUserResponse;
17
- }>;
18
- create(body: HttpTypes.AdminCreateInvite, query?: SelectParams, headers?: ClientHeaders): Promise<{
19
- invite: HttpTypes.AdminInviteResponse;
20
- }>;
21
- retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<{
22
- invite: HttpTypes.AdminInviteResponse;
23
- }>;
24
- list(queryParams?: FindParams, headers?: ClientHeaders): Promise<HttpTypes.PaginatedResponse<{
25
- invites: HttpTypes.AdminInviteResponse[];
26
- }>>;
27
- resend(id: string, headers?: ClientHeaders): Promise<{
28
- invite: HttpTypes.AdminInviteResponse;
29
- }>;
52
+ }, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminAcceptInviteResponse>;
53
+ /**
54
+ * This method creates an invite. It sends a request to the
55
+ * [Create Invite](https://docs.medusajs.com/v2/api/admin#invites_postinvites)
56
+ * API route.
57
+ *
58
+ * @param body - The invite's details.
59
+ * @param query - Configure the fields to retrieve in the invite.
60
+ * @param headers - Headers to pass in the request
61
+ * @returns The invite's details.
62
+ *
63
+ * @example
64
+ * sdk.admin.invite.create({
65
+ * email: "user@gmail.com",
66
+ * })
67
+ * .then(({ invite }) => {
68
+ * console.log(invite)
69
+ * })
70
+ */
71
+ create(body: HttpTypes.AdminCreateInvite, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInviteResponse>;
72
+ /**
73
+ * This method retrieves an invite by its ID. It sends a request to the
74
+ * [Get Invite](https://docs.medusajs.com/v2/api/admin#invites_getinvitesid)
75
+ * API route.
76
+ *
77
+ * @param id - The invite's ID.
78
+ * @param query - Configure the fields to retrieve in the invite.
79
+ * @param headers - Headers to pass in the request
80
+ * @returns The invite's details.
81
+ *
82
+ * @example
83
+ * To retrieve an invite its ID:
84
+ *
85
+ * ```ts
86
+ * sdk.admin.invite.retrieve("invite_123")
87
+ * .then(({ invite }) => {
88
+ * console.log(invite)
89
+ * })
90
+ * ```
91
+ *
92
+ * To specify the fields and relations to retrieve:
93
+ *
94
+ * ```ts
95
+ * sdk.admin.invite.retrieve("invite_123", {
96
+ * fields: "id,email"
97
+ * })
98
+ * .then(({ invite }) => {
99
+ * console.log(invite)
100
+ * })
101
+ * ```
102
+ *
103
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
104
+ */
105
+ retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInviteResponse>;
106
+ /**
107
+ * This method retrieves a paginated list of invites. It sends a request to the
108
+ * [List Invites](https://docs.medusajs.com/v2/api/admin#invites_getinvites)
109
+ * API route.
110
+ *
111
+ * @param queryParams - Filters and pagination configurations.
112
+ * @param headers - Headers to pass in the request.
113
+ * @returns The paginated list of invites.
114
+ *
115
+ * @example
116
+ * To retrieve the list of invites:
117
+ *
118
+ * ```ts
119
+ * sdk.admin.invite.list()
120
+ * .then(({ invites, count, limit, offset }) => {
121
+ * console.log(invites)
122
+ * })
123
+ * ```
124
+ *
125
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
126
+ *
127
+ * For example, to retrieve only 10 items and skip 10 items:
128
+ *
129
+ * ```ts
130
+ * sdk.admin.invite.list({
131
+ * limit: 10,
132
+ * offset: 10
133
+ * })
134
+ * .then(({ invites, count, limit, offset }) => {
135
+ * console.log(invites)
136
+ * })
137
+ * ```
138
+ *
139
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
140
+ * in each invite:
141
+ *
142
+ * ```ts
143
+ * sdk.admin.invite.list({
144
+ * fields: "id,email"
145
+ * })
146
+ * .then(({ invites, count, limit, offset }) => {
147
+ * console.log(invites)
148
+ * })
149
+ * ```
150
+ *
151
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
152
+ */
153
+ list(queryParams?: FindParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInviteListResponse>;
154
+ /**
155
+ * This method refreshes the token of an invite. It sends a request to the
156
+ * [Refresh Invite Token](https://docs.medusajs.com/v2/api/admin#invites_postinvitesidresend)
157
+ * API route.
158
+ *
159
+ * @param id - The invite's ID.
160
+ * @param headers - Headers to pass in the request.
161
+ * @returns The invite's details.
162
+ *
163
+ * @example
164
+ * sdk.admin.invite.resend("invite_123")
165
+ * .then(({ invite }) => {
166
+ * console.log(invite)
167
+ * })
168
+ */
169
+ resend(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminInviteResponse>;
170
+ /**
171
+ * This method deletes an invite. It sends a request to the
172
+ * [Delete Invite](https://docs.medusajs.com/v2/api/admin#invites_deleteinvitesid)
173
+ * API route.
174
+ *
175
+ * @param id - The invite's ID.
176
+ * @param headers - Headers to pass in the request.
177
+ * @returns The deletion's details.
178
+ *
179
+ * @example
180
+ * sdk.admin.invite.delete("invite_123")
181
+ * .then(({ deleted }) => {
182
+ * console.log(deleted)
183
+ * })
184
+ */
30
185
  delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminInviteDeleteResponse>;
31
186
  }
32
187
  //# sourceMappingURL=invite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invite.d.ts","sourceRoot":"","sources":["../../src/admin/invite.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAET,YAAY,EACb,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,MAAM;IACjB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAIpB,MAAM,CACV,KAAK,EAAE,SAAS,CAAC,iBAAiB,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,EAC7D,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;cAGgB,SAAS,CAAC,iBAAiB;;IAW9D,MAAM,CACV,IAAI,EAAE,S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;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,aAAa;IAUxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,aAAa;IAS5D;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAUhD;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;CASjD"}
@@ -8,6 +8,40 @@ class Invite {
8
8
  constructor(client) {
9
9
  this.client = client;
10
10
  }
11
+ /**
12
+ * This method accepts an invite. It requires sending a previous request to
13
+ * the {@link Auth.register}.
14
+ *
15
+ * This method sends a request to the [Accept Invite]
16
+ * (https://docs.medusajs.com/v2/api/admin#invites_postinvitesaccept)
17
+ * API route.
18
+ *
19
+ * @param input - The details of the user to create.
20
+ * @param query - Configure the fields to retrieve in the user.
21
+ * @param headers - Headers to pass in the request
22
+ * @returns The user's details.
23
+ *
24
+ * @example
25
+ * const token = await sdk.auth.register("user", "emailpass", {
26
+ * email: "user@gmail.com",
27
+ * password: "supersecret"
28
+ * })
29
+ *
30
+ * sdk.admin.invite.accept(
31
+ * {
32
+ * email: "user@gmail.com",
33
+ * first_name: "John",
34
+ * last_name: "Smith",
35
+ * invite_token: "12345..."
36
+ * },
37
+ * {
38
+ * Authorization: `Bearer ${token}`
39
+ * }
40
+ * )
41
+ * .then(({ user }) => {
42
+ * console.log(user)
43
+ * })
44
+ */
11
45
  async accept(input, query, headers) {
12
46
  const { invite_token, ...rest } = input;
13
47
  return await this.client.fetch(`/admin/invites/accept?token=${input.invite_token}`, {
@@ -17,6 +51,24 @@ class Invite {
17
51
  query,
18
52
  });
19
53
  }
54
+ /**
55
+ * This method creates an invite. It sends a request to the
56
+ * [Create Invite](https://docs.medusajs.com/v2/api/admin#invites_postinvites)
57
+ * API route.
58
+ *
59
+ * @param body - The invite's details.
60
+ * @param query - Configure the fields to retrieve in the invite.
61
+ * @param headers - Headers to pass in the request
62
+ * @returns The invite's details.
63
+ *
64
+ * @example
65
+ * sdk.admin.invite.create({
66
+ * email: "user@gmail.com",
67
+ * })
68
+ * .then(({ invite }) => {
69
+ * console.log(invite)
70
+ * })
71
+ */
20
72
  async create(body, query, headers) {
21
73
  return await this.client.fetch(`/admin/invites`, {
22
74
  method: "POST",
@@ -25,24 +77,134 @@ class Invite {
25
77
  query,
26
78
  });
27
79
  }
80
+ /**
81
+ * This method retrieves an invite by its ID. It sends a request to the
82
+ * [Get Invite](https://docs.medusajs.com/v2/api/admin#invites_getinvitesid)
83
+ * API route.
84
+ *
85
+ * @param id - The invite's ID.
86
+ * @param query - Configure the fields to retrieve in the invite.
87
+ * @param headers - Headers to pass in the request
88
+ * @returns The invite's details.
89
+ *
90
+ * @example
91
+ * To retrieve an invite its ID:
92
+ *
93
+ * ```ts
94
+ * sdk.admin.invite.retrieve("invite_123")
95
+ * .then(({ invite }) => {
96
+ * console.log(invite)
97
+ * })
98
+ * ```
99
+ *
100
+ * To specify the fields and relations to retrieve:
101
+ *
102
+ * ```ts
103
+ * sdk.admin.invite.retrieve("invite_123", {
104
+ * fields: "id,email"
105
+ * })
106
+ * .then(({ invite }) => {
107
+ * console.log(invite)
108
+ * })
109
+ * ```
110
+ *
111
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
112
+ */
28
113
  async retrieve(id, query, headers) {
29
114
  return await this.client.fetch(`/admin/invites/${id}`, {
30
115
  headers,
31
116
  query,
32
117
  });
33
118
  }
119
+ /**
120
+ * This method retrieves a paginated list of invites. It sends a request to the
121
+ * [List Invites](https://docs.medusajs.com/v2/api/admin#invites_getinvites)
122
+ * API route.
123
+ *
124
+ * @param queryParams - Filters and pagination configurations.
125
+ * @param headers - Headers to pass in the request.
126
+ * @returns The paginated list of invites.
127
+ *
128
+ * @example
129
+ * To retrieve the list of invites:
130
+ *
131
+ * ```ts
132
+ * sdk.admin.invite.list()
133
+ * .then(({ invites, count, limit, offset }) => {
134
+ * console.log(invites)
135
+ * })
136
+ * ```
137
+ *
138
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
139
+ *
140
+ * For example, to retrieve only 10 items and skip 10 items:
141
+ *
142
+ * ```ts
143
+ * sdk.admin.invite.list({
144
+ * limit: 10,
145
+ * offset: 10
146
+ * })
147
+ * .then(({ invites, count, limit, offset }) => {
148
+ * console.log(invites)
149
+ * })
150
+ * ```
151
+ *
152
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
153
+ * in each invite:
154
+ *
155
+ * ```ts
156
+ * sdk.admin.invite.list({
157
+ * fields: "id,email"
158
+ * })
159
+ * .then(({ invites, count, limit, offset }) => {
160
+ * console.log(invites)
161
+ * })
162
+ * ```
163
+ *
164
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
165
+ */
34
166
  async list(queryParams, headers) {
35
167
  return await this.client.fetch(`/admin/invites`, {
36
168
  headers,
37
169
  query: queryParams,
38
170
  });
39
171
  }
172
+ /**
173
+ * This method refreshes the token of an invite. It sends a request to the
174
+ * [Refresh Invite Token](https://docs.medusajs.com/v2/api/admin#invites_postinvitesidresend)
175
+ * API route.
176
+ *
177
+ * @param id - The invite's ID.
178
+ * @param headers - Headers to pass in the request.
179
+ * @returns The invite's details.
180
+ *
181
+ * @example
182
+ * sdk.admin.invite.resend("invite_123")
183
+ * .then(({ invite }) => {
184
+ * console.log(invite)
185
+ * })
186
+ */
40
187
  async resend(id, headers) {
41
188
  return await this.client.fetch(`/admin/invites/${id}/resend`, {
42
189
  method: "POST",
43
190
  headers,
44
191
  });
45
192
  }
193
+ /**
194
+ * This method deletes an invite. It sends a request to the
195
+ * [Delete Invite](https://docs.medusajs.com/v2/api/admin#invites_deleteinvitesid)
196
+ * API route.
197
+ *
198
+ * @param id - The invite's ID.
199
+ * @param headers - Headers to pass in the request.
200
+ * @returns The deletion's details.
201
+ *
202
+ * @example
203
+ * sdk.admin.invite.delete("invite_123")
204
+ * .then(({ deleted }) => {
205
+ * console.log(deleted)
206
+ * })
207
+ */
46
208
  async delete(id, headers) {
47
209
  return await this.client.fetch(`/admin/invites/${id}`, {
48
210
  method: "DELETE",
@@ -1 +1 @@
1
- {"version":3,"file":"invite.js","sourceRoot":"","sources":["../../src/admin/invite.ts"],"names":[],"mappings":";;;AASA,MAAa,MAAM;IAKjB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,MAAM,CACV,KAA6D,EAC7D,KAAoB,EACpB,OAAuB;QAEvB,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAA;QACvC,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,+BAA+B,KAAK,CAAC,YAAY,EAAE,EACnD;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI,EAAE,IAAI;YACV,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAAiC,EACjC,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,gBAAgB,EAChB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,KAAoB,EAAE,OAAuB;QACtE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,kBAAkB,EAAE,EAAE,EACtB;YACE,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,I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,CAAC,MAAM,CAAC,KAAK,CAC5B,gBAAgB,EAChB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,KAAoB,EAAE,OAAuB;QACtE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,kBAAkB,EAAE,EAAE,EACtB;YACE,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACH,KAAK,CAAC,IAAI,CAAC,WAAwB,EAAE,OAAuB;QAC1D,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,gBAAgB,EAAE;YAClB,OAAO;YACP,KAAK,EAAE,WAAW;SACnB,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,kBAAkB,EAAE,SAAS,EAC7B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,kBAAkB,EAAE,EAAE,EACtB;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;CACF;AA1PD,wBA0PC"}
@@ -33,5 +33,6 @@ export declare class Order {
33
33
  order: HttpTypes.AdminOrder;
34
34
  }>;
35
35
  listChanges(id: string, queryParams?: FindParams & HttpTypes.AdminOrderChangesFilters, headers?: ClientHeaders): Promise<HttpTypes.PaginatedResponse<HttpTypes.AdminOrderChangesResponse>>;
36
+ listLineItems(id: string, queryParams?: FindParams & HttpTypes.AdminOrderItemsFilters, headers?: ClientHeaders): Promise<HttpTypes.PaginatedResponse<HttpTypes.AdminOrderLineItemsListResponse>>;
36
37
  }
37
38
  //# sourceMappingURL=order.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../src/admin/order.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAET,YAAY,EACb,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,KAAK;IAChB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAIpB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,aAAa;eAC9B,SAAS,CAAC,UAAU;;IASxD,eAAe,CACnB,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,iBAAiB,EACnC,OAAO,CAAC,EAAE,aAAa;IAWnB,IAAI,CACR,WAAW,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,iBAAiB,EACtD,OAAO,CAAC,EAAE,aAAa;gBAGO,SAAS,CAAC,UAAU,EAAE;;IAOhD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;eACN,SAAS,CAAC,UAAU;;IASxD,iBAAiB,CACrB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,2BAA2B,EAC3C,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;eAEiB,SAAS,CAAC,UAAU;;IAWxD,iBAAiB,CACrB,EAAE,EAAE,MAAM,EACV,aAAa,EAAE,MA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C,iBAAiB,EACtD,OAAO,CAAC,EAAE,aAAa;gBAGO,SAAS,CAAC,UAAU,EAAE;;IAOhD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;eACN,SAAS,CAAC,UAAU;;IASxD,iBAAiB,CACrB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,2BAA2B,EAC3C,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;eAEiB,SAAS,CAAC,UAAU;;IAWxD,iBAAiB,CACrB,EAAE,EAAE,MAAM,EACV,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,SAAS,CAAC,2BAA2B,EAC3C,OAAO,CAAC,EAAE,aAAa;eAEiB,SAAS,CAAC,UAAU;;IAUxD,cAAc,CAClB,EAAE,EAAE,MAAM,EACV,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,SAAS,CAAC,wBAAwB,EACxC,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;eAEiB,SAAS,CAAC,UAAU;;IAWxD,eAAe,CACnB,EAAE,EAAE,MAAM,EACV,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,SAAS,CAAC,oCAAoC,EACpD,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;eAEiB,SAAS,CAAC,UAAU;;IAWxD,WAAW,CACf,EAAE,EAAE,MAAM,EACV,WAAW,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,wBAAwB,EAC7D,OAAO,CAAC,EAAE,aAAa;IAUnB,aAAa,CACjB,EAAE,EAAE,MAAM,EACV,WAAW,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC,sBAAsB,EAC3D,OAAO,CAAC,EAAE,aAAa;CAS1B"}
@@ -69,6 +69,12 @@ class Order {
69
69
  headers,
70
70
  });
71
71
  }
72
+ async listLineItems(id, queryParams, headers) {
73
+ return await this.client.fetch(`/admin/orders/${id}/line-items`, {
74
+ query: queryParams,
75
+ headers,
76
+ });
77
+ }
72
78
  }
73
79
  exports.Order = Order;
74
80
  //# sourceMappingURL=order.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"order.js","sourceRoot":"","sources":["../../src/admin/order.ts"],"names":[],"mappings":";;;AAWA,MAAa,KAAK;IAKhB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,KAAoB,EAAE,OAAuB;QACtE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,EAAE,EACrB;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,EAAU,EACV,KAAmC,EACnC,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,UAAU,EAC7B;YACE,KAAK;YACL,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CACR,WAAsD,EACtD,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,eAAe,EAAE;YACjB,KAAK,EAAE,WAAW;YAClB,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,SAAS,EAC5B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,EAAU,EACV,IAA2C,EAC3C,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,eAAe,EAClC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,iBAAiB,CACrB,EAAU,EACV,aAAqB,EACrB,IAA2C,EAC3C,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,iBAAiB,aAAa,SAAS,EAC1D;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;SACL,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,EAAU,EACV,aAAqB,EACrB,IAAwC,EACxC,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,iBAAiB,aAAa,YAAY,EAC7D;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,EAAU,EACV,aAAqB,EACrB,IAAoD,EACpD,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,iBAAiB,aAAa,oBAAoB,EACrE;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CACf,EAAU,EACV,WAA6D,EAC7D,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,iBAAiB,EAAE,UAAU,EAAE;YAC/B,KAAK,EAAE,WAAW;YAClB,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;CACF;AA3ID,sBA2IC"}
1
+ {"version":3,"file":"order.js","sourceRoot":"","sources":["../../src/admin/order.ts"],"names":[],"mappings":";;;AAWA,MAAa,KAAK;IAKhB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,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,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,EAAU,EACV,aAAqB,EACrB,IAAwC,EACxC,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,iBAAiB,aAAa,YAAY,EAC7D;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,EAAU,EACV,aAAqB,EACrB,IAAoD,EACpD,KAAoB,EACpB,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EAAE,iBAAiB,aAAa,oBAAoB,EACrE;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CACf,EAAU,EACV,WAA6D,EAC7D,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,iBAAiB,EAAE,UAAU,EAAE;YAC/B,KAAK,EAAE,WAAW;YAClB,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,EAAU,EACV,WAA2D,EAC3D,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAE5B,iBAAiB,EAAE,aAAa,EAAE;YAClC,KAAK,EAAE,WAAW;YAClB,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;CACF;AAxJD,sBAwJC"}
@@ -5,17 +5,173 @@ export declare class Auth {
5
5
  private client;
6
6
  private config;
7
7
  constructor(client: Client, config: Config);
8
+ /**
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
+ * [Retrieve Registration Token API route](https://docs.medusajs.com/v2/api/store#auth_postactor_typeauth_provider_register).
11
+ *
12
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
13
+ * @param method - The authentication provider to use. For example, `emailpass` or `google`.
14
+ * @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
15
+ * you pass the email and password.
16
+ * @returns The JWT token used for registration later.
17
+ *
18
+ * @example
19
+ * sdk.auth.register(
20
+ * "customer",
21
+ * "emailpass",
22
+ * {
23
+ * email: "customer@gmail.com",
24
+ * password: "supersecret"
25
+ * }
26
+ * ).then((token) => {
27
+ * console.log(token)
28
+ * })
29
+ */
8
30
  register: (actor: string, method: string, payload: HttpTypes.AdminSignUpWithEmailPassword) => Promise<string>;
31
+ /**
32
+ * This method retrieves the JWT authenticated token for an admin user, customer, or custom
33
+ * actor type. It sends a request to the [Authenticate API Route](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_provider).
34
+ *
35
+ * If the `auth.type` of the SDK is set to `session`, this method will also send a request to the
36
+ * [Set Authentication Session API route](https://docs.medusajs.com/v2/api/admin#auth_postsession).
37
+ *
38
+ * Subsequent requests using the SDK will automatically have the necessary authentication headers / session
39
+ * set.
40
+ *
41
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
42
+ * @param method - The authentication provider to use. For example, `emailpass` or `google`.
43
+ * @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
44
+ * you pass the email and password.
45
+ * @returns The authentication JWT token
46
+ *
47
+ * @example
48
+ * sdk.auth.login(
49
+ * "customer",
50
+ * "emailpass",
51
+ * {
52
+ * email: "customer@gmail.com",
53
+ * password: "supersecret"
54
+ * }
55
+ * ).then((token) => {
56
+ * console.log(token)
57
+ * })
58
+ */
9
59
  login: (actor: string, method: string, payload: HttpTypes.AdminSignInWithEmailPassword | Record<string, unknown>) => Promise<string | {
10
60
  location: string;
11
61
  }>;
62
+ /**
63
+ * 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.
64
+ * It sends a request to the [Validate Authentication Callback](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_providercallback).
65
+ *
66
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
67
+ * @param method - The authentication provider to use. For example, `google`.
68
+ * @param query - The query parameters from the Oauth callback, which should be passed to the API route.
69
+ * @returns The authentication JWT token
70
+ *
71
+ * @example
72
+ * sdk.auth.callback(
73
+ * "customer",
74
+ * "google",
75
+ * {
76
+ * code: "123",
77
+ * }
78
+ * ).then((token) => {
79
+ * console.log(token)
80
+ * })
81
+ *
82
+ *
83
+ * @privateRemarks
84
+ * The callback expects all query parameters from the Oauth callback to be passed to
85
+ * the backend, and the provider is in charge of parsing and validating them
86
+ */
12
87
  callback: (actor: string, method: string, query?: Record<string, unknown>) => Promise<string>;
88
+ /**
89
+ * This method refreshes a JWT authentication token, which is useful after validating the Oauth callback
90
+ * with {@link callback}. It sends a request to the [Refresh Authentication Token API route](https://docs.medusajs.com/v2/api/admin#auth_postadminauthtokenrefresh).
91
+ *
92
+ * @returns The refreshed JWT authentication token.
93
+ *
94
+ * @example
95
+ * sdk.auth.refresh()
96
+ * .then((token) => {
97
+ * console.log(token)
98
+ * })
99
+ */
13
100
  refresh: () => Promise<string>;
101
+ /**
102
+ * This method deletes the authentication session of the currently logged-in user to log them out.
103
+ * It sends a request to the [Delete Authentication Session API route](https://docs.medusajs.com/v2/api/admin#auth_deletesession).
104
+ *
105
+ * @example
106
+ * sdk.auth.logout()
107
+ * .then(() => {
108
+ * // user is logged out
109
+ * })
110
+ */
14
111
  logout: () => Promise<void>;
112
+ /**
113
+ * This method requests a reset password token for an admin user, customer, or custom actor type.
114
+ * It sends a request to the [Generate Reset Password Token API route](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_providerresetpassword).
115
+ *
116
+ * To reset the password later using the token delivered to the user, use the {@link updateProvider} method.
117
+ *
118
+ * Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/v2/resources/storefront-development/customers/reset-password).
119
+ *
120
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
121
+ * @param provider - The authentication provider to use. For example, `emailpass`.
122
+ * @param body - The data required to identify the user.
123
+ *
124
+ * @example
125
+ * sdk.auth.resetPassword(
126
+ * "customer",
127
+ * "emailpass",
128
+ * {
129
+ * identifier: "customer@gmail.com"
130
+ * }
131
+ * )
132
+ * .then(() => {
133
+ * // user receives token
134
+ * })
135
+ */
15
136
  resetPassword: (actor: string, provider: string, body: {
137
+ /**
138
+ * The user's identifier. For example, when using the `emailpass` provider,
139
+ * this would be the user's email.
140
+ */
16
141
  identifier: string;
17
142
  }) => Promise<void>;
143
+ /**
144
+ * This method is used to update user-related data authentication data.
145
+ *
146
+ * More specifically, use this method when updating the password of an admin user, customer, or
147
+ * custom actor type after requesting to reset their password with {@link resetPassword}.
148
+ *
149
+ * This method sends a request to [this API route](https://docs.medusajs.com/v2/api/admin#auth_postactor_typeauth_providerupdate).
150
+ *
151
+ * Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.medusajs.com/v2/resources/storefront-development/customers/reset-password).
152
+ *
153
+ * @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
154
+ * @param provider - The authentication provider to use. For example, `emailpass`.
155
+ * @param body - The data necessary to update the user's authentication data. When resetting the user's password,
156
+ * send the `email` and `password` properties.
157
+ *
158
+ * @example
159
+ * sdk.auth.updateProvider(
160
+ * "customer",
161
+ * "emailpass",
162
+ * {
163
+ * email: "customer@gmail.com",
164
+ * password: "supersecret"
165
+ * }
166
+ * )
167
+ * .then(() => {
168
+ * // password updated
169
+ * })
170
+ */
18
171
  updateProvider: (actor: string, provider: string, body: Record<string, unknown>) => Promise<void>;
172
+ /**
173
+ * @ignore
174
+ */
19
175
  private setToken_;
20
176
  }
21
177
  //# sourceMappingURL=index.d.ts.map
@@ -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,MAA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