@poly-x/core 0.1.0-alpha.3 → 0.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +25 -1
- package/dist/index.d.cts +19 -1
- package/dist/index.d.mts +19 -1
- package/dist/index.mjs +25 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -709,7 +709,13 @@ const ENDPOINTS = {
|
|
|
709
709
|
token: "/v1/idp/token",
|
|
710
710
|
refresh: "/v1/auth/refresh-token",
|
|
711
711
|
logout: "/v1/idp/logout",
|
|
712
|
-
orgResolve: "/v1/idp/org-resolve"
|
|
712
|
+
orgResolve: "/v1/idp/org-resolve",
|
|
713
|
+
/**
|
|
714
|
+
* Completes the admin temp-password flow: the user signed in with a temporary
|
|
715
|
+
* password, poly-auth answered `403 {userPasswordSet, userId}`, and this sets
|
|
716
|
+
* the real one. Only succeeds while the account is flagged `mustChangePassword`.
|
|
717
|
+
*/
|
|
718
|
+
setPassword: "/v1/auth/set-password"
|
|
713
719
|
};
|
|
714
720
|
//#endregion
|
|
715
721
|
//#region src/auth/outcomes.ts
|
|
@@ -908,6 +914,24 @@ var AuthClient = class {
|
|
|
908
914
|
if (response.status >= 500) throw this.toError(response);
|
|
909
915
|
return parsePasswordOutcome(response.status, response.body);
|
|
910
916
|
}
|
|
917
|
+
/**
|
|
918
|
+
* Set the real password for a user the platform has flagged `mustChangePassword`
|
|
919
|
+
* (the admin temp-password flow). Call this only after `authorizeWithPassword`
|
|
920
|
+
* has returned `password_change_required` for that same user — that response IS
|
|
921
|
+
* the proof the caller knows the temporary password.
|
|
922
|
+
*/
|
|
923
|
+
async setPassword(params) {
|
|
924
|
+
const response = await this.transport.request({
|
|
925
|
+
method: "PATCH",
|
|
926
|
+
url: this.config.baseUrl + ENDPOINTS.setPassword,
|
|
927
|
+
body: {
|
|
928
|
+
userId: params.userId,
|
|
929
|
+
newPassword: params.newPassword,
|
|
930
|
+
confirmPassword: params.confirmPassword
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
if (response.status !== 200) throw this.toError(response);
|
|
934
|
+
}
|
|
911
935
|
async exchangeCode(params) {
|
|
912
936
|
const response = await this.transport.request({
|
|
913
937
|
method: "POST",
|
package/dist/index.d.cts
CHANGED
|
@@ -392,6 +392,12 @@ declare const ENDPOINTS: {
|
|
|
392
392
|
readonly refresh: "/v1/auth/refresh-token";
|
|
393
393
|
readonly logout: "/v1/idp/logout";
|
|
394
394
|
readonly orgResolve: "/v1/idp/org-resolve";
|
|
395
|
+
/**
|
|
396
|
+
* Completes the admin temp-password flow: the user signed in with a temporary
|
|
397
|
+
* password, poly-auth answered `403 {userPasswordSet, userId}`, and this sets
|
|
398
|
+
* the real one. Only succeeds while the account is flagged `mustChangePassword`.
|
|
399
|
+
*/
|
|
400
|
+
readonly setPassword: "/v1/auth/set-password";
|
|
395
401
|
};
|
|
396
402
|
//#endregion
|
|
397
403
|
//#region src/auth/outcomes.d.ts
|
|
@@ -496,6 +502,11 @@ interface ExchangeCodeParams {
|
|
|
496
502
|
codeVerifier: string;
|
|
497
503
|
redirectUri: string;
|
|
498
504
|
}
|
|
505
|
+
interface SetPasswordParams {
|
|
506
|
+
userId: string;
|
|
507
|
+
newPassword: string;
|
|
508
|
+
confirmPassword: string;
|
|
509
|
+
}
|
|
499
510
|
interface AuthorizeWithPasswordParams {
|
|
500
511
|
email: string;
|
|
501
512
|
password: string;
|
|
@@ -532,6 +543,13 @@ declare class AuthClient {
|
|
|
532
543
|
* outcome the UI branches on.
|
|
533
544
|
*/
|
|
534
545
|
authorizeWithPassword(params: AuthorizeWithPasswordParams): Promise<PasswordAuthOutcome>;
|
|
546
|
+
/**
|
|
547
|
+
* Set the real password for a user the platform has flagged `mustChangePassword`
|
|
548
|
+
* (the admin temp-password flow). Call this only after `authorizeWithPassword`
|
|
549
|
+
* has returned `password_change_required` for that same user — that response IS
|
|
550
|
+
* the proof the caller knows the temporary password.
|
|
551
|
+
*/
|
|
552
|
+
setPassword(params: SetPasswordParams): Promise<void>;
|
|
535
553
|
exchangeCode(params: ExchangeCodeParams): Promise<StoredSession>;
|
|
536
554
|
/** The `RefreshTokens` function the SessionEngine (F003) injects. */
|
|
537
555
|
createRefresher(): RefreshTokens;
|
|
@@ -550,4 +568,4 @@ declare class AuthClient {
|
|
|
550
568
|
declare const PACKAGE_NAME = "@poly-x/core";
|
|
551
569
|
declare const version = "0.0.0";
|
|
552
570
|
//#endregion
|
|
553
|
-
export { AuthClient, type AuthClientOptions, type AuthorizeOutcome, type AuthorizeWithPasswordParams, type BuildAuthorizeUrlParams, type Clock, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUT_MS, ENDPOINTS, type ExchangeCodeParams, FetchTransport, type FieldError, ForbiddenError, type HttpMethod, INITIAL_STATE as INITIAL_SESSION_STATE, InMemoryLock, InMemoryPkceStore, InMemorySessionChannel, InMemorySessionStore, type KeyEnv, type KeyKind, type Lock, type MockRoute, MockTransport, PACKAGE_NAME, type ParsedKey, type PasswordAuthOutcome, type PkceEntry, type PkcePair, type PkceStore, type PlatformResponseLike, PolyXConfigError, PolyXError, type PolyXErrorOptions, RateLimitedError, type RefreshTokens, type ResolveConfigInput, type ResolvedConfig, type RetryPolicy, type RuntimeContext, type Session, type SessionChannel, type SessionChannelEvent, type SessionClaims, SessionEngine, type SessionEngineOptions, type SessionEvent, SessionExpiredError, SessionRevokedError, type SessionState, type SessionStore, type SignedOutReason, type StoredSession, SystemClock, type TenantOption, type TimerHandle, type TokenSet, type Transport, type TransportRequest, type TransportResponse, UnauthenticatedError, UpstreamError, ValidationError, computeChallenge, createSessionEngine, decodeJwtExp, generatePkce, isTransientStatus, mapPlatformError, normalizeExchange, normalizeRefresh, parseAuthorizeOutcome, parsePasswordOutcome, parsePolyXKey, randomState, redactSensitive, reduce as reduceSessionState, resolveConfig, version };
|
|
571
|
+
export { AuthClient, type AuthClientOptions, type AuthorizeOutcome, type AuthorizeWithPasswordParams, type BuildAuthorizeUrlParams, type Clock, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUT_MS, ENDPOINTS, type ExchangeCodeParams, FetchTransport, type FieldError, ForbiddenError, type HttpMethod, INITIAL_STATE as INITIAL_SESSION_STATE, InMemoryLock, InMemoryPkceStore, InMemorySessionChannel, InMemorySessionStore, type KeyEnv, type KeyKind, type Lock, type MockRoute, MockTransport, PACKAGE_NAME, type ParsedKey, type PasswordAuthOutcome, type PkceEntry, type PkcePair, type PkceStore, type PlatformResponseLike, PolyXConfigError, PolyXError, type PolyXErrorOptions, RateLimitedError, type RefreshTokens, type ResolveConfigInput, type ResolvedConfig, type RetryPolicy, type RuntimeContext, type Session, type SessionChannel, type SessionChannelEvent, type SessionClaims, SessionEngine, type SessionEngineOptions, type SessionEvent, SessionExpiredError, SessionRevokedError, type SessionState, type SessionStore, type SetPasswordParams, type SignedOutReason, type StoredSession, SystemClock, type TenantOption, type TimerHandle, type TokenSet, type Transport, type TransportRequest, type TransportResponse, UnauthenticatedError, UpstreamError, ValidationError, computeChallenge, createSessionEngine, decodeJwtExp, generatePkce, isTransientStatus, mapPlatformError, normalizeExchange, normalizeRefresh, parseAuthorizeOutcome, parsePasswordOutcome, parsePolyXKey, randomState, redactSensitive, reduce as reduceSessionState, resolveConfig, version };
|
package/dist/index.d.mts
CHANGED
|
@@ -392,6 +392,12 @@ declare const ENDPOINTS: {
|
|
|
392
392
|
readonly refresh: "/v1/auth/refresh-token";
|
|
393
393
|
readonly logout: "/v1/idp/logout";
|
|
394
394
|
readonly orgResolve: "/v1/idp/org-resolve";
|
|
395
|
+
/**
|
|
396
|
+
* Completes the admin temp-password flow: the user signed in with a temporary
|
|
397
|
+
* password, poly-auth answered `403 {userPasswordSet, userId}`, and this sets
|
|
398
|
+
* the real one. Only succeeds while the account is flagged `mustChangePassword`.
|
|
399
|
+
*/
|
|
400
|
+
readonly setPassword: "/v1/auth/set-password";
|
|
395
401
|
};
|
|
396
402
|
//#endregion
|
|
397
403
|
//#region src/auth/outcomes.d.ts
|
|
@@ -496,6 +502,11 @@ interface ExchangeCodeParams {
|
|
|
496
502
|
codeVerifier: string;
|
|
497
503
|
redirectUri: string;
|
|
498
504
|
}
|
|
505
|
+
interface SetPasswordParams {
|
|
506
|
+
userId: string;
|
|
507
|
+
newPassword: string;
|
|
508
|
+
confirmPassword: string;
|
|
509
|
+
}
|
|
499
510
|
interface AuthorizeWithPasswordParams {
|
|
500
511
|
email: string;
|
|
501
512
|
password: string;
|
|
@@ -532,6 +543,13 @@ declare class AuthClient {
|
|
|
532
543
|
* outcome the UI branches on.
|
|
533
544
|
*/
|
|
534
545
|
authorizeWithPassword(params: AuthorizeWithPasswordParams): Promise<PasswordAuthOutcome>;
|
|
546
|
+
/**
|
|
547
|
+
* Set the real password for a user the platform has flagged `mustChangePassword`
|
|
548
|
+
* (the admin temp-password flow). Call this only after `authorizeWithPassword`
|
|
549
|
+
* has returned `password_change_required` for that same user — that response IS
|
|
550
|
+
* the proof the caller knows the temporary password.
|
|
551
|
+
*/
|
|
552
|
+
setPassword(params: SetPasswordParams): Promise<void>;
|
|
535
553
|
exchangeCode(params: ExchangeCodeParams): Promise<StoredSession>;
|
|
536
554
|
/** The `RefreshTokens` function the SessionEngine (F003) injects. */
|
|
537
555
|
createRefresher(): RefreshTokens;
|
|
@@ -550,4 +568,4 @@ declare class AuthClient {
|
|
|
550
568
|
declare const PACKAGE_NAME = "@poly-x/core";
|
|
551
569
|
declare const version = "0.0.0";
|
|
552
570
|
//#endregion
|
|
553
|
-
export { AuthClient, type AuthClientOptions, type AuthorizeOutcome, type AuthorizeWithPasswordParams, type BuildAuthorizeUrlParams, type Clock, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUT_MS, ENDPOINTS, type ExchangeCodeParams, FetchTransport, type FieldError, ForbiddenError, type HttpMethod, INITIAL_STATE as INITIAL_SESSION_STATE, InMemoryLock, InMemoryPkceStore, InMemorySessionChannel, InMemorySessionStore, type KeyEnv, type KeyKind, type Lock, type MockRoute, MockTransport, PACKAGE_NAME, type ParsedKey, type PasswordAuthOutcome, type PkceEntry, type PkcePair, type PkceStore, type PlatformResponseLike, PolyXConfigError, PolyXError, type PolyXErrorOptions, RateLimitedError, type RefreshTokens, type ResolveConfigInput, type ResolvedConfig, type RetryPolicy, type RuntimeContext, type Session, type SessionChannel, type SessionChannelEvent, type SessionClaims, SessionEngine, type SessionEngineOptions, type SessionEvent, SessionExpiredError, SessionRevokedError, type SessionState, type SessionStore, type SignedOutReason, type StoredSession, SystemClock, type TenantOption, type TimerHandle, type TokenSet, type Transport, type TransportRequest, type TransportResponse, UnauthenticatedError, UpstreamError, ValidationError, computeChallenge, createSessionEngine, decodeJwtExp, generatePkce, isTransientStatus, mapPlatformError, normalizeExchange, normalizeRefresh, parseAuthorizeOutcome, parsePasswordOutcome, parsePolyXKey, randomState, redactSensitive, reduce as reduceSessionState, resolveConfig, version };
|
|
571
|
+
export { AuthClient, type AuthClientOptions, type AuthorizeOutcome, type AuthorizeWithPasswordParams, type BuildAuthorizeUrlParams, type Clock, DEFAULT_RETRY_POLICY, DEFAULT_TIMEOUT_MS, ENDPOINTS, type ExchangeCodeParams, FetchTransport, type FieldError, ForbiddenError, type HttpMethod, INITIAL_STATE as INITIAL_SESSION_STATE, InMemoryLock, InMemoryPkceStore, InMemorySessionChannel, InMemorySessionStore, type KeyEnv, type KeyKind, type Lock, type MockRoute, MockTransport, PACKAGE_NAME, type ParsedKey, type PasswordAuthOutcome, type PkceEntry, type PkcePair, type PkceStore, type PlatformResponseLike, PolyXConfigError, PolyXError, type PolyXErrorOptions, RateLimitedError, type RefreshTokens, type ResolveConfigInput, type ResolvedConfig, type RetryPolicy, type RuntimeContext, type Session, type SessionChannel, type SessionChannelEvent, type SessionClaims, SessionEngine, type SessionEngineOptions, type SessionEvent, SessionExpiredError, SessionRevokedError, type SessionState, type SessionStore, type SetPasswordParams, type SignedOutReason, type StoredSession, SystemClock, type TenantOption, type TimerHandle, type TokenSet, type Transport, type TransportRequest, type TransportResponse, UnauthenticatedError, UpstreamError, ValidationError, computeChallenge, createSessionEngine, decodeJwtExp, generatePkce, isTransientStatus, mapPlatformError, normalizeExchange, normalizeRefresh, parseAuthorizeOutcome, parsePasswordOutcome, parsePolyXKey, randomState, redactSensitive, reduce as reduceSessionState, resolveConfig, version };
|
package/dist/index.mjs
CHANGED
|
@@ -708,7 +708,13 @@ const ENDPOINTS = {
|
|
|
708
708
|
token: "/v1/idp/token",
|
|
709
709
|
refresh: "/v1/auth/refresh-token",
|
|
710
710
|
logout: "/v1/idp/logout",
|
|
711
|
-
orgResolve: "/v1/idp/org-resolve"
|
|
711
|
+
orgResolve: "/v1/idp/org-resolve",
|
|
712
|
+
/**
|
|
713
|
+
* Completes the admin temp-password flow: the user signed in with a temporary
|
|
714
|
+
* password, poly-auth answered `403 {userPasswordSet, userId}`, and this sets
|
|
715
|
+
* the real one. Only succeeds while the account is flagged `mustChangePassword`.
|
|
716
|
+
*/
|
|
717
|
+
setPassword: "/v1/auth/set-password"
|
|
712
718
|
};
|
|
713
719
|
//#endregion
|
|
714
720
|
//#region src/auth/outcomes.ts
|
|
@@ -907,6 +913,24 @@ var AuthClient = class {
|
|
|
907
913
|
if (response.status >= 500) throw this.toError(response);
|
|
908
914
|
return parsePasswordOutcome(response.status, response.body);
|
|
909
915
|
}
|
|
916
|
+
/**
|
|
917
|
+
* Set the real password for a user the platform has flagged `mustChangePassword`
|
|
918
|
+
* (the admin temp-password flow). Call this only after `authorizeWithPassword`
|
|
919
|
+
* has returned `password_change_required` for that same user — that response IS
|
|
920
|
+
* the proof the caller knows the temporary password.
|
|
921
|
+
*/
|
|
922
|
+
async setPassword(params) {
|
|
923
|
+
const response = await this.transport.request({
|
|
924
|
+
method: "PATCH",
|
|
925
|
+
url: this.config.baseUrl + ENDPOINTS.setPassword,
|
|
926
|
+
body: {
|
|
927
|
+
userId: params.userId,
|
|
928
|
+
newPassword: params.newPassword,
|
|
929
|
+
confirmPassword: params.confirmPassword
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
if (response.status !== 200) throw this.toError(response);
|
|
933
|
+
}
|
|
910
934
|
async exchangeCode(params) {
|
|
911
935
|
const response = await this.transport.request({
|
|
912
936
|
method: "POST",
|