@productcraft/auth 0.5.2 → 0.6.0
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/README.md +26 -2
- package/dist/index.cjs +66 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +66 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1702,6 +1702,18 @@ type ConsumerRequestPasswordResetDto = {
|
|
|
1702
1702
|
phone?: string;
|
|
1703
1703
|
};
|
|
1704
1704
|
|
|
1705
|
+
/**
|
|
1706
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
1707
|
+
* Do not edit manually.
|
|
1708
|
+
*/
|
|
1709
|
+
type ConsumerSendPasswordResetEmailDto = {
|
|
1710
|
+
/**
|
|
1711
|
+
* @description Email contact value to send the password-reset code to.
|
|
1712
|
+
* @type string
|
|
1713
|
+
*/
|
|
1714
|
+
email: string;
|
|
1715
|
+
};
|
|
1716
|
+
|
|
1705
1717
|
/**
|
|
1706
1718
|
* Generated by Kubb (https://kubb.dev/).
|
|
1707
1719
|
* Do not edit manually.
|
|
@@ -2241,12 +2253,40 @@ declare class ConsumerScope {
|
|
|
2241
2253
|
refresh: (data: ConsumerRefreshDto) => Promise<ConsumerTokenResponseDto>;
|
|
2242
2254
|
logout: (data: ConsumerLogoutDto) => Promise<any>;
|
|
2243
2255
|
/**
|
|
2244
|
-
*
|
|
2256
|
+
* Mint a 6-digit password-reset code. **Sends no email.** Returns
|
|
2257
|
+
* `{ code, expires_at }` for delivery via your own channel — or
|
|
2258
|
+
* `{}` when the contact doesn't match a verified account (uniform
|
|
2259
|
+
* shape — no account enumeration).
|
|
2260
|
+
*
|
|
2261
|
+
* If you want Mail to deliver the code for you, call
|
|
2262
|
+
* {@link sendPasswordResetEmail} instead. Calling this one and
|
|
2263
|
+
* discarding the `code` means the user never hears anything.
|
|
2264
|
+
*
|
|
2265
|
+
* PAK-required with `auth.user.password-reset.create`: caller must
|
|
2266
|
+
* instantiate `Auth` with
|
|
2245
2267
|
* `auth: { type: "apiKey", key: "pcft_live_..." }`. The
|
|
2246
2268
|
* kubb-generated `headers.authorization` slot is a stub — the
|
|
2247
2269
|
* HTTP client's auth middleware overrides whatever's passed.
|
|
2248
2270
|
*/
|
|
2249
2271
|
requestReset: (data: ConsumerRequestPasswordResetDto) => Promise<ConsumerCodeIssueResponseDto>;
|
|
2272
|
+
/**
|
|
2273
|
+
* Mint + dispatch a password-reset email via Mail in one call.
|
|
2274
|
+
* Returns `{ expires_at }` on success; the plaintext code is NOT
|
|
2275
|
+
* returned. Returns `{}` when the contact is missing or unverified
|
|
2276
|
+
* (same enumeration defence as {@link requestReset}).
|
|
2277
|
+
*
|
|
2278
|
+
* This is the counterpart to {@link sendVerificationEmail} for the
|
|
2279
|
+
* reset slot, and the method you want for a plain "forgot
|
|
2280
|
+
* password" flow — {@link requestReset} only mints, it does not
|
|
2281
|
+
* email.
|
|
2282
|
+
*
|
|
2283
|
+
* PAK-required with `auth.user.password-reset.send-email` —
|
|
2284
|
+
* distinct permission from the bare mint so customers can enable
|
|
2285
|
+
* mint without enabling outbound Mail traffic. Surfaces typed 412
|
|
2286
|
+
* precondition errors (e.g. `ENVOI_NOT_ENABLED`,
|
|
2287
|
+
* `ENVOI_TEMPLATE_NOT_CONFIGURED`) rather than failing silently.
|
|
2288
|
+
*/
|
|
2289
|
+
sendPasswordResetEmail: (data: ConsumerSendPasswordResetEmailDto) => Promise<ConsumerCodeDispatchResponseDto>;
|
|
2250
2290
|
resetPassword: (data: ConsumerResetPasswordDto) => Promise<any>;
|
|
2251
2291
|
/**
|
|
2252
2292
|
* Mint a 6-digit contact-verification code bound to the email or
|
package/dist/index.d.ts
CHANGED
|
@@ -1702,6 +1702,18 @@ type ConsumerRequestPasswordResetDto = {
|
|
|
1702
1702
|
phone?: string;
|
|
1703
1703
|
};
|
|
1704
1704
|
|
|
1705
|
+
/**
|
|
1706
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
1707
|
+
* Do not edit manually.
|
|
1708
|
+
*/
|
|
1709
|
+
type ConsumerSendPasswordResetEmailDto = {
|
|
1710
|
+
/**
|
|
1711
|
+
* @description Email contact value to send the password-reset code to.
|
|
1712
|
+
* @type string
|
|
1713
|
+
*/
|
|
1714
|
+
email: string;
|
|
1715
|
+
};
|
|
1716
|
+
|
|
1705
1717
|
/**
|
|
1706
1718
|
* Generated by Kubb (https://kubb.dev/).
|
|
1707
1719
|
* Do not edit manually.
|
|
@@ -2241,12 +2253,40 @@ declare class ConsumerScope {
|
|
|
2241
2253
|
refresh: (data: ConsumerRefreshDto) => Promise<ConsumerTokenResponseDto>;
|
|
2242
2254
|
logout: (data: ConsumerLogoutDto) => Promise<any>;
|
|
2243
2255
|
/**
|
|
2244
|
-
*
|
|
2256
|
+
* Mint a 6-digit password-reset code. **Sends no email.** Returns
|
|
2257
|
+
* `{ code, expires_at }` for delivery via your own channel — or
|
|
2258
|
+
* `{}` when the contact doesn't match a verified account (uniform
|
|
2259
|
+
* shape — no account enumeration).
|
|
2260
|
+
*
|
|
2261
|
+
* If you want Mail to deliver the code for you, call
|
|
2262
|
+
* {@link sendPasswordResetEmail} instead. Calling this one and
|
|
2263
|
+
* discarding the `code` means the user never hears anything.
|
|
2264
|
+
*
|
|
2265
|
+
* PAK-required with `auth.user.password-reset.create`: caller must
|
|
2266
|
+
* instantiate `Auth` with
|
|
2245
2267
|
* `auth: { type: "apiKey", key: "pcft_live_..." }`. The
|
|
2246
2268
|
* kubb-generated `headers.authorization` slot is a stub — the
|
|
2247
2269
|
* HTTP client's auth middleware overrides whatever's passed.
|
|
2248
2270
|
*/
|
|
2249
2271
|
requestReset: (data: ConsumerRequestPasswordResetDto) => Promise<ConsumerCodeIssueResponseDto>;
|
|
2272
|
+
/**
|
|
2273
|
+
* Mint + dispatch a password-reset email via Mail in one call.
|
|
2274
|
+
* Returns `{ expires_at }` on success; the plaintext code is NOT
|
|
2275
|
+
* returned. Returns `{}` when the contact is missing or unverified
|
|
2276
|
+
* (same enumeration defence as {@link requestReset}).
|
|
2277
|
+
*
|
|
2278
|
+
* This is the counterpart to {@link sendVerificationEmail} for the
|
|
2279
|
+
* reset slot, and the method you want for a plain "forgot
|
|
2280
|
+
* password" flow — {@link requestReset} only mints, it does not
|
|
2281
|
+
* email.
|
|
2282
|
+
*
|
|
2283
|
+
* PAK-required with `auth.user.password-reset.send-email` —
|
|
2284
|
+
* distinct permission from the bare mint so customers can enable
|
|
2285
|
+
* mint without enabling outbound Mail traffic. Surfaces typed 412
|
|
2286
|
+
* precondition errors (e.g. `ENVOI_NOT_ENABLED`,
|
|
2287
|
+
* `ENVOI_TEMPLATE_NOT_CONFIGURED`) rather than failing silently.
|
|
2288
|
+
*/
|
|
2289
|
+
sendPasswordResetEmail: (data: ConsumerSendPasswordResetEmailDto) => Promise<ConsumerCodeDispatchResponseDto>;
|
|
2250
2290
|
resetPassword: (data: ConsumerResetPasswordDto) => Promise<any>;
|
|
2251
2291
|
/**
|
|
2252
2292
|
* Mint a 6-digit contact-verification code bound to the email or
|
package/dist/index.js
CHANGED
|
@@ -1359,6 +1359,36 @@ async function consumerAuthControllerRequestPasswordReset({
|
|
|
1359
1359
|
return res.data;
|
|
1360
1360
|
}
|
|
1361
1361
|
|
|
1362
|
+
// src/_generated/clients/consumerAuth/consumerAuthControllerSendPasswordResetEmail.ts
|
|
1363
|
+
function getConsumerAuthControllerSendPasswordResetEmailUrl({
|
|
1364
|
+
appSlug
|
|
1365
|
+
}) {
|
|
1366
|
+
const app_slug = appSlug;
|
|
1367
|
+
const res = {
|
|
1368
|
+
method: "POST",
|
|
1369
|
+
url: `/${app_slug}/v1/auth/send-password-reset-email`
|
|
1370
|
+
};
|
|
1371
|
+
return res;
|
|
1372
|
+
}
|
|
1373
|
+
async function consumerAuthControllerSendPasswordResetEmail({
|
|
1374
|
+
appSlug,
|
|
1375
|
+
data,
|
|
1376
|
+
headers
|
|
1377
|
+
}, config = {}) {
|
|
1378
|
+
const { client: request = client, ...requestConfig } = config;
|
|
1379
|
+
const requestData = data;
|
|
1380
|
+
const res = await request({
|
|
1381
|
+
method: "POST",
|
|
1382
|
+
url: getConsumerAuthControllerSendPasswordResetEmailUrl({
|
|
1383
|
+
appSlug
|
|
1384
|
+
}).url.toString(),
|
|
1385
|
+
data: requestData,
|
|
1386
|
+
...requestConfig,
|
|
1387
|
+
headers: { ...headers, ...requestConfig.headers }
|
|
1388
|
+
});
|
|
1389
|
+
return res.data;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1362
1392
|
// src/_generated/clients/consumerAuth/consumerAuthControllerResetPassword.ts
|
|
1363
1393
|
function getConsumerAuthControllerResetPasswordUrl({
|
|
1364
1394
|
appSlug
|
|
@@ -1885,7 +1915,17 @@ var ConsumerScope = class {
|
|
|
1885
1915
|
{ client: this.client }
|
|
1886
1916
|
),
|
|
1887
1917
|
/**
|
|
1888
|
-
*
|
|
1918
|
+
* Mint a 6-digit password-reset code. **Sends no email.** Returns
|
|
1919
|
+
* `{ code, expires_at }` for delivery via your own channel — or
|
|
1920
|
+
* `{}` when the contact doesn't match a verified account (uniform
|
|
1921
|
+
* shape — no account enumeration).
|
|
1922
|
+
*
|
|
1923
|
+
* If you want Mail to deliver the code for you, call
|
|
1924
|
+
* {@link sendPasswordResetEmail} instead. Calling this one and
|
|
1925
|
+
* discarding the `code` means the user never hears anything.
|
|
1926
|
+
*
|
|
1927
|
+
* PAK-required with `auth.user.password-reset.create`: caller must
|
|
1928
|
+
* instantiate `Auth` with
|
|
1889
1929
|
* `auth: { type: "apiKey", key: "pcft_live_..." }`. The
|
|
1890
1930
|
* kubb-generated `headers.authorization` slot is a stub — the
|
|
1891
1931
|
* HTTP client's auth middleware overrides whatever's passed.
|
|
@@ -1894,6 +1934,31 @@ var ConsumerScope = class {
|
|
|
1894
1934
|
{ appSlug: this.appSlug, data, headers: { authorization: "" } },
|
|
1895
1935
|
{ client: this.client }
|
|
1896
1936
|
),
|
|
1937
|
+
/**
|
|
1938
|
+
* Mint + dispatch a password-reset email via Mail in one call.
|
|
1939
|
+
* Returns `{ expires_at }` on success; the plaintext code is NOT
|
|
1940
|
+
* returned. Returns `{}` when the contact is missing or unverified
|
|
1941
|
+
* (same enumeration defence as {@link requestReset}).
|
|
1942
|
+
*
|
|
1943
|
+
* This is the counterpart to {@link sendVerificationEmail} for the
|
|
1944
|
+
* reset slot, and the method you want for a plain "forgot
|
|
1945
|
+
* password" flow — {@link requestReset} only mints, it does not
|
|
1946
|
+
* email.
|
|
1947
|
+
*
|
|
1948
|
+
* PAK-required with `auth.user.password-reset.send-email` —
|
|
1949
|
+
* distinct permission from the bare mint so customers can enable
|
|
1950
|
+
* mint without enabling outbound Mail traffic. Surfaces typed 412
|
|
1951
|
+
* precondition errors (e.g. `ENVOI_NOT_ENABLED`,
|
|
1952
|
+
* `ENVOI_TEMPLATE_NOT_CONFIGURED`) rather than failing silently.
|
|
1953
|
+
*/
|
|
1954
|
+
sendPasswordResetEmail: (data) => consumerAuthControllerSendPasswordResetEmail(
|
|
1955
|
+
{
|
|
1956
|
+
appSlug: this.appSlug,
|
|
1957
|
+
data,
|
|
1958
|
+
headers: { authorization: "" }
|
|
1959
|
+
},
|
|
1960
|
+
{ client: this.client }
|
|
1961
|
+
),
|
|
1897
1962
|
resetPassword: (data) => consumerAuthControllerResetPassword(
|
|
1898
1963
|
{ appSlug: this.appSlug, data },
|
|
1899
1964
|
{ client: this.client }
|