@enterprisestandard/core 0.0.17-beta.20260423.1 → 0.0.17
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.d.ts +310 -263
- package/dist/index.js +1 -1
- package/dist/server.d.ts +160 -74
- package/dist/server.js +1 -1
- package/dist/shared/core-1x31ar7h.js +12 -0
- package/package.json +3 -3
- package/dist/shared/core-wpy88bze.js +0 -12
package/dist/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ declare const consoleLogger: Logger;
|
|
|
39
39
|
/**
|
|
40
40
|
* Result of a paginated list operation.
|
|
41
41
|
*
|
|
42
|
-
* @template T - Item type (e.g. StoredGroup, StoredUser,
|
|
42
|
+
* @template T - Item type (e.g. StoredGroup, StoredUser, BaseTenant)
|
|
43
43
|
*/
|
|
44
44
|
interface ListResult<T> {
|
|
45
45
|
/** Total number of records matching (before pagination). */
|
|
@@ -642,7 +642,6 @@ interface GroupStore<TExtended = Record<string, never>> {
|
|
|
642
642
|
removeMember(groupId: string, memberId: string): Promise<void>;
|
|
643
643
|
}
|
|
644
644
|
import { StandardSchemaV1 as StandardSchemaV16 } from "@standard-schema/spec";
|
|
645
|
-
import { StandardSchemaV1 as StandardSchemaV13 } from "@standard-schema/spec";
|
|
646
645
|
import { StandardSchemaV1 as StandardSchemaV12 } from "@standard-schema/spec";
|
|
647
646
|
/**
|
|
648
647
|
* OIDC Code Flow Callback URL Parameters
|
|
@@ -884,7 +883,7 @@ interface SessionStore<TExtended = object> {
|
|
|
884
883
|
}
|
|
885
884
|
/**
|
|
886
885
|
* Base user with simple, developer-friendly attributes.
|
|
887
|
-
* Extended by
|
|
886
|
+
* Extended by WorkforceUser/Customer and EnterpriseUser (SCIM).
|
|
888
887
|
*/
|
|
889
888
|
interface BaseUser {
|
|
890
889
|
/**
|
|
@@ -914,10 +913,10 @@ interface BaseUser {
|
|
|
914
913
|
userType?: string;
|
|
915
914
|
}
|
|
916
915
|
/**
|
|
917
|
-
*
|
|
918
|
-
*
|
|
916
|
+
* Workforce user type for SSO/OIDC and IAM-backed applications.
|
|
917
|
+
* Carries the SSO/OIDC context used by server helpers and user stores.
|
|
919
918
|
*/
|
|
920
|
-
interface
|
|
919
|
+
interface WorkforceUser extends BaseUser {
|
|
921
920
|
/**
|
|
922
921
|
* SSO/OIDC authentication data
|
|
923
922
|
*/
|
|
@@ -951,6 +950,93 @@ interface User2 extends BaseUser {
|
|
|
951
950
|
expires: Date;
|
|
952
951
|
};
|
|
953
952
|
}
|
|
953
|
+
/**
|
|
954
|
+
* Customer user type for CIAM-backed applications.
|
|
955
|
+
*/
|
|
956
|
+
interface Customer extends BaseUser {
|
|
957
|
+
ciam: {
|
|
958
|
+
/**
|
|
959
|
+
* ID token-like claims for CIAM sessions.
|
|
960
|
+
*/
|
|
961
|
+
profile: IdTokenClaims;
|
|
962
|
+
/**
|
|
963
|
+
* OAuth scopes granted for this customer session.
|
|
964
|
+
*/
|
|
965
|
+
scope?: string;
|
|
966
|
+
/**
|
|
967
|
+
* Token type (typically "Bearer").
|
|
968
|
+
*/
|
|
969
|
+
tokenType: string;
|
|
970
|
+
/**
|
|
971
|
+
* Session expiration time.
|
|
972
|
+
*/
|
|
973
|
+
expires: Date;
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Union of currently authenticated user domains.
|
|
978
|
+
*/
|
|
979
|
+
type AuthenticatedUser = WorkforceUser | Customer;
|
|
980
|
+
import { StandardSchemaV1 as StandardSchemaV13 } from "@standard-schema/spec";
|
|
981
|
+
/**
|
|
982
|
+
* Result type for Standard Schema validation (success or failure).
|
|
983
|
+
*/
|
|
984
|
+
type ValidateResult<T> = StandardSchemaV13.Result<T>;
|
|
985
|
+
/**
|
|
986
|
+
* A Standard Schema with a top-level `validate()` method for a cleaner API.
|
|
987
|
+
* Use this so callers can call `schema.validate(value)` instead of `schema['~standard'].validate(value)`.
|
|
988
|
+
*/
|
|
989
|
+
type StandardSchemaWithValidate<T> = StandardSchemaV13<unknown, T> & {
|
|
990
|
+
validate(value: unknown): Promise<StandardSchemaV13.Result<T>>;
|
|
991
|
+
};
|
|
992
|
+
/**
|
|
993
|
+
* Wraps a Standard Schema so it has a top-level `validate(value)` method.
|
|
994
|
+
* Use when creating or modifying validators so application code can call
|
|
995
|
+
* `validators.ciam.baseUser.validate(raw)` instead of `validators.ciam.baseUser['~standard'].validate(raw)`.
|
|
996
|
+
*
|
|
997
|
+
* @example
|
|
998
|
+
* const baseUser = withValidate(createBaseUserValidator());
|
|
999
|
+
* const result = await baseUser.validate(requestBody);
|
|
1000
|
+
*/
|
|
1001
|
+
declare function withValidate<T>(schema: StandardSchemaV13<unknown, T>): StandardSchemaWithValidate<T>;
|
|
1002
|
+
declare function must<T>(value: T | undefined | null, message?: string): T;
|
|
1003
|
+
/**
|
|
1004
|
+
* Returns a 400 Response with the issues if there are any.
|
|
1005
|
+
* @param issues - Any validation issues.
|
|
1006
|
+
* @param message - The message to include in the response.
|
|
1007
|
+
* @returns A 400 Response with the issues if it does, otherwise null.
|
|
1008
|
+
*/
|
|
1009
|
+
declare function validationFailureResponse(issues: unknown, message: string): Response;
|
|
1010
|
+
/**
|
|
1011
|
+
* Merges two config objects, ensuring critical fields from vault take precedence.
|
|
1012
|
+
*
|
|
1013
|
+
* @param fromVault - Configuration from vault (takes precedence for critical fields)
|
|
1014
|
+
* @param fromCode - Configuration from code (used as fallback)
|
|
1015
|
+
* @param criticalFields - Array of field names that should prefer vault values
|
|
1016
|
+
* @returns Merged configuration object
|
|
1017
|
+
*/
|
|
1018
|
+
declare function mergeConfig<T extends Record<string, unknown>>(fromVault: T | undefined, fromCode: T | undefined, criticalFields?: string[]): T;
|
|
1019
|
+
/**
|
|
1020
|
+
* Strips // and /* *\/ comments from JSONC, respecting string literals.
|
|
1021
|
+
*/
|
|
1022
|
+
declare function stripJsonComments(content: string): string;
|
|
1023
|
+
declare function parseJsonc<T>(content: string): T;
|
|
1024
|
+
/**
|
|
1025
|
+
* Deep equality for JSON-like values used in config snapshots.
|
|
1026
|
+
* Treats object key order as irrelevant and treats missing and `undefined`
|
|
1027
|
+
* object properties as equal by ignoring `undefined` keys on both sides.
|
|
1028
|
+
*/
|
|
1029
|
+
declare function deepEqualPlain(a: unknown, b: unknown): boolean;
|
|
1030
|
+
/**
|
|
1031
|
+
* Waits for a HTTP service to be ready by polling its URL.
|
|
1032
|
+
* Connection errors (e.g. connection refused) are treated as "not ready" and retried.
|
|
1033
|
+
* @param url - The URL to poll.
|
|
1034
|
+
* @param pingInterval - The interval in milliseconds to poll the URL.
|
|
1035
|
+
* @param warnInterval - The interval in milliseconds to warn about the status. Set warnInterval to 0 to disable warnings.
|
|
1036
|
+
* @param timeout - The timeout in milliseconds to reject the promise.
|
|
1037
|
+
* @returns A promise that resolves when the service is ready.
|
|
1038
|
+
*/
|
|
1039
|
+
declare function waitOn(url: string, test?: (resp: Response) => boolean | Promise<boolean>, pingInterval?: number, warnInterval?: number, timeout?: number): Promise<void>;
|
|
954
1040
|
type SSOConfig<
|
|
955
1041
|
TSessionData = Record<string, never>,
|
|
956
1042
|
TUserData = Record<string, never>
|
|
@@ -1031,16 +1117,16 @@ type SSOHandlerConfig = {
|
|
|
1031
1117
|
logoutBackChannelUrl?: string;
|
|
1032
1118
|
};
|
|
1033
1119
|
type SSOValidators = {
|
|
1034
|
-
callbackParams:
|
|
1035
|
-
idTokenClaims:
|
|
1036
|
-
tokenResponse:
|
|
1120
|
+
callbackParams: StandardSchemaWithValidate<OidcCallbackParams>;
|
|
1121
|
+
idTokenClaims: StandardSchemaWithValidate<IdTokenClaims>;
|
|
1122
|
+
tokenResponse: StandardSchemaWithValidate<TokenResponse>;
|
|
1037
1123
|
};
|
|
1038
1124
|
type SSO<
|
|
1039
1125
|
TSessionData = Record<string, never>,
|
|
1040
1126
|
TUserData = Record<string, never>
|
|
1041
1127
|
> = SSOConfig<TSessionData, TUserData> & {
|
|
1042
|
-
getUser: (request: Request) => Promise<
|
|
1043
|
-
getRequiredUser: (request: Request) => Promise<
|
|
1128
|
+
getUser: (request: Request) => Promise<WorkforceUser | undefined>;
|
|
1129
|
+
getRequiredUser: (request: Request) => Promise<WorkforceUser>;
|
|
1044
1130
|
getJwt: (request: Request) => Promise<string | undefined>;
|
|
1045
1131
|
initiateLogin: (config: LoginConfig, requestUrl?: string) => Promise<Response>;
|
|
1046
1132
|
logout: (request: Request, config?: LoginConfig) => Promise<Response>;
|
|
@@ -1833,10 +1919,22 @@ type VaultWebSocketSecretsConfig = {
|
|
|
1833
1919
|
/** Header name used to send the websocket token. Defaults to X-Vault-Token. */
|
|
1834
1920
|
header?: VaultWebSocketAuthHeader;
|
|
1835
1921
|
};
|
|
1922
|
+
type VaultWorkloadAuthConfig = {
|
|
1923
|
+
/** OAuth2 token endpoint used to mint workload access tokens for vault calls. */
|
|
1924
|
+
idpTokenUrl?: string;
|
|
1925
|
+
/** OAuth2 client id for this workload. */
|
|
1926
|
+
clientId?: string;
|
|
1927
|
+
/** OAuth2 client secret for this workload. */
|
|
1928
|
+
clientSecret?: string;
|
|
1929
|
+
/** Optional OAuth2 scope for the workload token request. */
|
|
1930
|
+
scope?: string;
|
|
1931
|
+
};
|
|
1836
1932
|
type VaultSecretsConfig = {
|
|
1837
1933
|
type: "vault";
|
|
1838
1934
|
url?: string;
|
|
1839
1935
|
token?: string;
|
|
1936
|
+
/** Optional workload identity used to authenticate vault HTTP and websocket requests. */
|
|
1937
|
+
workload?: VaultWorkloadAuthConfig;
|
|
1840
1938
|
/** Optional LFV transport capability for reads/lifecycle operations. */
|
|
1841
1939
|
lfv?: VaultLfvSecretsConfig;
|
|
1842
1940
|
/** Optional websocket capability for vault commands and live subscriptions. */
|
|
@@ -1937,6 +2035,97 @@ type AzureSecretsConfig = {
|
|
|
1937
2035
|
ttl?: number;
|
|
1938
2036
|
};
|
|
1939
2037
|
type ConfigSourceType = "vault" | "azure" | "aws" | "gcp";
|
|
2038
|
+
type ConfigSourceEnv = {
|
|
2039
|
+
ES_CONFIG_TYPE?: ConfigSourceType;
|
|
2040
|
+
ES_VAULT_URL?: string;
|
|
2041
|
+
ES_VAULT_TOKEN?: string;
|
|
2042
|
+
ES_VAULT_PATH?: string;
|
|
2043
|
+
ES_VAULT_TTL?: string;
|
|
2044
|
+
ES_VAULT_WORKLOAD_TOKEN_URL?: string;
|
|
2045
|
+
ES_VAULT_WORKLOAD_CLIENT_ID?: string;
|
|
2046
|
+
ES_VAULT_WORKLOAD_CLIENT_SECRET?: string;
|
|
2047
|
+
ES_VAULT_WORKLOAD_SCOPE?: string;
|
|
2048
|
+
ES_VAULT_LFV_SERVER_URL?: string;
|
|
2049
|
+
ES_VAULT_LFV_CLIENT_ID?: string;
|
|
2050
|
+
ES_VAULT_LFV_SIGNATURE?: string;
|
|
2051
|
+
ES_VAULT_LFV_DELIVERY_ENDPOINT?: string;
|
|
2052
|
+
ES_VAULT_LFV_VERIFY_PUBLIC_KEY?: string;
|
|
2053
|
+
ES_VAULT_LFV_EVENTS_ENDPOINT?: string;
|
|
2054
|
+
ES_VAULT_LFV_DELIVERY_TIMEOUT?: string;
|
|
2055
|
+
ES_VAULT_LFV_RETRY_INTERVAL?: string;
|
|
2056
|
+
ES_VAULT_LFV_WARN_INTERVAL?: string;
|
|
2057
|
+
ES_VAULT_WEBSOCKET_URL?: string;
|
|
2058
|
+
ES_VAULT_WEBSOCKET_TOKEN?: string;
|
|
2059
|
+
ES_VAULT_WEBSOCKET_HEADER?: "X-Vault-Token" | "Authorization";
|
|
2060
|
+
ES_AZURE_API_VERSION?: string;
|
|
2061
|
+
ES_AZURE_SCOPE?: string;
|
|
2062
|
+
ES_AZURE_SECRET_NAME_PREFIX?: string;
|
|
2063
|
+
ES_AZURE_AUTH_METHOD?: AwsAuthMethod;
|
|
2064
|
+
ES_AZURE_TENANT_ID?: string;
|
|
2065
|
+
ES_AZURE_CLIENT_ID?: string;
|
|
2066
|
+
ES_AZURE_CLIENT_SECRET?: string;
|
|
2067
|
+
ES_AZURE_FEDERATED_TOKEN_FILE?: string;
|
|
2068
|
+
ES_AZURE_MANAGED_IDENTITY_CLIENT_ID?: string;
|
|
2069
|
+
ES_AZURE_IMDS_API_VERSION?: string;
|
|
2070
|
+
ES_AZURE_PATH?: string;
|
|
2071
|
+
ES_AZURE_VAULT_URL?: string;
|
|
2072
|
+
ES_AZURE_VAULT_NAME?: string;
|
|
2073
|
+
ES_AZURE_TTL?: string;
|
|
2074
|
+
ES_AWS_WEBHOOK_URL?: string;
|
|
2075
|
+
ES_AWS_TTL?: string;
|
|
2076
|
+
ES_GCP_TTL?: string;
|
|
2077
|
+
};
|
|
2078
|
+
type VaultConfigLocator = {
|
|
2079
|
+
type: "vault";
|
|
2080
|
+
vaultUrl?: string;
|
|
2081
|
+
vaultToken?: string;
|
|
2082
|
+
vaultPath: string;
|
|
2083
|
+
vaultTtl?: number;
|
|
2084
|
+
vaultWorkloadTokenUrl?: string;
|
|
2085
|
+
vaultWorkloadClientId?: string;
|
|
2086
|
+
vaultWorkloadClientSecret?: string;
|
|
2087
|
+
vaultWorkloadScope?: string;
|
|
2088
|
+
vaultLfvServerUrl?: string;
|
|
2089
|
+
vaultLfvClientId?: string;
|
|
2090
|
+
vaultLfvSignature?: string;
|
|
2091
|
+
vaultLfvDeliveryEndpoint?: string;
|
|
2092
|
+
vaultLfvVerifyPublicKey?: string;
|
|
2093
|
+
vaultLfvEventsEndpoint?: string;
|
|
2094
|
+
vaultLfvPath?: string;
|
|
2095
|
+
vaultLfvDeliveryTimeout?: number;
|
|
2096
|
+
vaultLfvRetryInterval?: number;
|
|
2097
|
+
vaultLfvWarnInterval?: number;
|
|
2098
|
+
vaultWebsocketUrl?: string;
|
|
2099
|
+
vaultWebsocketToken?: string;
|
|
2100
|
+
vaultWebsocketHeader?: VaultWebSocketAuthHeader;
|
|
2101
|
+
};
|
|
2102
|
+
type AwsConfigLocator = {
|
|
2103
|
+
type: "aws";
|
|
2104
|
+
awsWebhookUrl: string;
|
|
2105
|
+
awsTtl?: number;
|
|
2106
|
+
};
|
|
2107
|
+
type AzureConfigLocator = {
|
|
2108
|
+
type: "azure";
|
|
2109
|
+
azureAuthMethod?: AwsAuthMethod;
|
|
2110
|
+
azureTenantId?: string;
|
|
2111
|
+
azureClientId?: string;
|
|
2112
|
+
azureClientSecret?: string;
|
|
2113
|
+
azureFederatedTokenFile?: string;
|
|
2114
|
+
azureManagedIdentityClientId?: string;
|
|
2115
|
+
azureImdsApiVersion?: string;
|
|
2116
|
+
azurePath?: string;
|
|
2117
|
+
azureVaultUrl?: string;
|
|
2118
|
+
azureVaultName?: string;
|
|
2119
|
+
azureApiVersion?: string;
|
|
2120
|
+
azureScope?: string;
|
|
2121
|
+
azureSecretNamePrefix?: string;
|
|
2122
|
+
azureTtl?: number;
|
|
2123
|
+
};
|
|
2124
|
+
type GcpConfigLocator = {
|
|
2125
|
+
type: "gcp";
|
|
2126
|
+
gcpTtl?: number;
|
|
2127
|
+
};
|
|
2128
|
+
type ConfigLocator = VaultConfigLocator | AwsConfigLocator | AzureConfigLocator | GcpConfigLocator;
|
|
1940
2129
|
type ESValidators = {
|
|
1941
2130
|
sso: SSOValidators;
|
|
1942
2131
|
iam: IAMValidators;
|
|
@@ -2008,6 +2197,40 @@ type ESConfigChangeResult = {
|
|
|
2008
2197
|
config?: RemoteConfig;
|
|
2009
2198
|
frameworkConfig?: FrameworkConfig;
|
|
2010
2199
|
};
|
|
2200
|
+
type RemoteConfigLoadErrorKind = "auth" | "connection" | "invalid_payload" | "invalid_status" | "not_found" | "timeout" | "unknown";
|
|
2201
|
+
type RemoteConfigRetryContext = {
|
|
2202
|
+
/** 1-based retry attempt count for the current unavailable period. */
|
|
2203
|
+
attempt: number;
|
|
2204
|
+
/** Original error thrown by the ConfigSource. */
|
|
2205
|
+
error: unknown;
|
|
2206
|
+
/** Best-effort error classification for logging and policy decisions. */
|
|
2207
|
+
errorKind: RemoteConfigLoadErrorKind;
|
|
2208
|
+
/** Human-readable single-line error detail. */
|
|
2209
|
+
message: string;
|
|
2210
|
+
/** Retry delay selected by the policy. */
|
|
2211
|
+
nextDelayMs: number;
|
|
2212
|
+
/** Maximum delay allowed by the policy. */
|
|
2213
|
+
maxDelayMs: number;
|
|
2214
|
+
/** Config source transport when known, such as "vault", "azure", or "aws". */
|
|
2215
|
+
sourceType?: ConfigSourceType | string;
|
|
2216
|
+
/** Config path when known. */
|
|
2217
|
+
path?: string;
|
|
2218
|
+
};
|
|
2219
|
+
type RemoteConfigRetryHook = (context: RemoteConfigRetryContext) => void | Promise<void>;
|
|
2220
|
+
type RemoteConfigRetryOptions = {
|
|
2221
|
+
/** Initial retry delay. Defaults to 2000ms. */
|
|
2222
|
+
initialDelayMs?: number;
|
|
2223
|
+
/** Maximum retry delay. Defaults to 600000ms. */
|
|
2224
|
+
maxDelayMs?: number;
|
|
2225
|
+
/** Exponential multiplier applied after each failed attempt. Defaults to 2. */
|
|
2226
|
+
multiplier?: number;
|
|
2227
|
+
/** Jitter ratio applied to retry delays. Defaults to 0.2. */
|
|
2228
|
+
jitterRatio?: number;
|
|
2229
|
+
/** Timeout for each ConfigSource load attempt. Defaults to 30000ms. */
|
|
2230
|
+
loadTimeoutMs?: number;
|
|
2231
|
+
/** Called before each retry is scheduled. Throw to stop retrying and reject ready(). */
|
|
2232
|
+
onRetry?: RemoteConfigRetryHook;
|
|
2233
|
+
};
|
|
2011
2234
|
/** beforeChange callback invoked on every config application (initial load and updates). */
|
|
2012
2235
|
type ESConfigChangeCallback = (config: RemoteConfig, frameworkConfig: ModifiableFrameworkConfig, oldConfig: RemoteConfig | undefined) => ESConfigChangeResult | void;
|
|
2013
2236
|
type ConfigSource = {
|
|
@@ -2044,7 +2267,7 @@ type UpsertTenantRequestBase = {
|
|
|
2044
2267
|
email?: string;
|
|
2045
2268
|
webhookUrl?: string;
|
|
2046
2269
|
callbackUrl?: string;
|
|
2047
|
-
configSource:
|
|
2270
|
+
configSource: ConfigLocator;
|
|
2048
2271
|
};
|
|
2049
2272
|
type UpsertTenantRequest<TExtended extends object = object> = UpsertTenantRequestBase & TExtended;
|
|
2050
2273
|
type UpsertTenantResponse = {
|
|
@@ -2059,8 +2282,6 @@ type UpsertTenantResponse = {
|
|
|
2059
2282
|
expiresAt: string;
|
|
2060
2283
|
refs?: RefUrls[];
|
|
2061
2284
|
};
|
|
2062
|
-
type CreateTenantRequest = UpsertTenantRequest;
|
|
2063
|
-
type CreateTenantResponse = UpsertTenantResponse;
|
|
2064
2285
|
/**
|
|
2065
2286
|
* The audience of the reference URL.
|
|
2066
2287
|
* - 'human' for human-readable documentation such as user guides, documentation, etc.
|
|
@@ -2099,78 +2320,9 @@ type TenantValidators<
|
|
|
2099
2320
|
> = {
|
|
2100
2321
|
upsertTenantRequest: StandardSchemaV16<unknown, TUpsertTenantRequest>;
|
|
2101
2322
|
upsertTenantResponse?: StandardSchemaV16<unknown, TUpsertTenantResponse>;
|
|
2102
|
-
createTenantRequest?: StandardSchemaV16<unknown, TUpsertTenantRequest>;
|
|
2103
|
-
createTenantResponse?: StandardSchemaV16<unknown, TUpsertTenantResponse>;
|
|
2104
2323
|
};
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
* These mirror the ES_* variables read by envConfig().
|
|
2108
|
-
*/
|
|
2109
|
-
type TenantConfigEnv = {
|
|
2110
|
-
ES_CONFIG_TYPE?: ConfigSourceType;
|
|
2111
|
-
ES_VAULT_URL?: string;
|
|
2112
|
-
ES_VAULT_TOKEN?: string;
|
|
2113
|
-
ES_VAULT_PATH?: string;
|
|
2114
|
-
ES_VAULT_TTL?: string;
|
|
2115
|
-
ES_VAULT_LFV_SERVER_URL?: string;
|
|
2116
|
-
ES_VAULT_LFV_CLIENT_ID?: string;
|
|
2117
|
-
ES_VAULT_LFV_SIGNATURE?: string;
|
|
2118
|
-
ES_VAULT_LFV_DELIVERY_ENDPOINT?: string;
|
|
2119
|
-
ES_VAULT_LFV_VERIFY_PUBLIC_KEY?: string;
|
|
2120
|
-
ES_VAULT_LFV_EVENTS_ENDPOINT?: string;
|
|
2121
|
-
ES_VAULT_LFV_DELIVERY_TIMEOUT?: string;
|
|
2122
|
-
ES_VAULT_LFV_RETRY_INTERVAL?: string;
|
|
2123
|
-
ES_VAULT_LFV_WARN_INTERVAL?: string;
|
|
2124
|
-
ES_VAULT_WEBSOCKET_URL?: string;
|
|
2125
|
-
ES_VAULT_WEBSOCKET_TOKEN?: string;
|
|
2126
|
-
ES_VAULT_WEBSOCKET_HEADER?: "X-Vault-Token" | "Authorization";
|
|
2127
|
-
ES_AZURE_API_VERSION?: string;
|
|
2128
|
-
ES_AZURE_SCOPE?: string;
|
|
2129
|
-
ES_AZURE_SECRET_NAME_PREFIX?: string;
|
|
2130
|
-
ES_AZURE_AUTH_METHOD?: AwsAuthMethod;
|
|
2131
|
-
ES_AZURE_TENANT_ID?: string;
|
|
2132
|
-
ES_AZURE_CLIENT_ID?: string;
|
|
2133
|
-
ES_AZURE_CLIENT_SECRET?: string;
|
|
2134
|
-
ES_AZURE_FEDERATED_TOKEN_FILE?: string;
|
|
2135
|
-
ES_AZURE_MANAGED_IDENTITY_CLIENT_ID?: string;
|
|
2136
|
-
ES_AZURE_IMDS_API_VERSION?: string;
|
|
2137
|
-
ES_AZURE_PATH?: string;
|
|
2138
|
-
ES_AZURE_VAULT_URL?: string;
|
|
2139
|
-
ES_AZURE_VAULT_NAME?: string;
|
|
2140
|
-
ES_AZURE_TTL?: string;
|
|
2141
|
-
ES_AWS_WEBHOOK_URL?: string;
|
|
2142
|
-
ES_AWS_TTL?: string;
|
|
2143
|
-
ES_GCP_TTL?: string;
|
|
2144
|
-
};
|
|
2145
|
-
type TenantSecretsConfig = (VaultSecretsConfig & {
|
|
2146
|
-
path: string;
|
|
2147
|
-
retryInterval?: number;
|
|
2148
|
-
}) | (AwsSecretsConfig & {
|
|
2149
|
-
ttl?: number;
|
|
2150
|
-
}) | (AzureSecretsConfig & {
|
|
2151
|
-
path?: string;
|
|
2152
|
-
}) | (GcpSecretsConfig & {
|
|
2153
|
-
ttl?: number;
|
|
2154
|
-
});
|
|
2155
|
-
type TenantStoredConfigLocator = {
|
|
2156
|
-
/** Indicates that the tenant config descriptor is stored securely outside the tenant record. */
|
|
2157
|
-
type: "stored";
|
|
2158
|
-
/** Root secure source type used to fetch the stored tenant config descriptor. */
|
|
2159
|
-
sourceType: "vault";
|
|
2160
|
-
/** Path to the stored tenant config descriptor. */
|
|
2161
|
-
path: string;
|
|
2162
|
-
};
|
|
2163
|
-
type TenantRemoteConfigLocator = {
|
|
2164
|
-
/** Indicates that the tenant RemoteConfig already exists at this secure source path. */
|
|
2165
|
-
type: "remoteConfig";
|
|
2166
|
-
/** Secure source type used to load the RemoteConfig document directly. */
|
|
2167
|
-
sourceType: "vault";
|
|
2168
|
-
/** Path to the tenant RemoteConfig document. */
|
|
2169
|
-
path: string;
|
|
2170
|
-
};
|
|
2171
|
-
type TenantConfigLocator = TenantStoredConfigLocator | TenantRemoteConfigLocator;
|
|
2172
|
-
type TenantConfigSourceInput = TenantConfigLocator | ConfigSource;
|
|
2173
|
-
type TenantBaseRecord = {
|
|
2324
|
+
declare function isConfigLocator(value: unknown): value is ConfigLocator;
|
|
2325
|
+
type BaseTenant = {
|
|
2174
2326
|
tenantId: string;
|
|
2175
2327
|
companyId: string;
|
|
2176
2328
|
companyName: string;
|
|
@@ -2186,121 +2338,60 @@ type TenantBaseRecord = {
|
|
|
2186
2338
|
expiresAt?: string;
|
|
2187
2339
|
createdAt: Date;
|
|
2188
2340
|
updatedAt: Date;
|
|
2189
|
-
/**
|
|
2190
|
-
configSource:
|
|
2341
|
+
/** Serializable metadata used to materialize this tenant's ConfigSource. */
|
|
2342
|
+
configSource: ConfigLocator;
|
|
2191
2343
|
/** Runtime helper that returns a ConfigSource for this tenant. */
|
|
2192
2344
|
config?: (source?: SecretsSource) => ConfigSource;
|
|
2193
2345
|
};
|
|
2194
|
-
type
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
es: EnterpriseStandard;
|
|
2206
|
-
tenantId: string;
|
|
2207
|
-
request: TRequest;
|
|
2208
|
-
configData: TenantSecretsConfig;
|
|
2209
|
-
existingTenant: StoredTenant<TTenant> | undefined;
|
|
2210
|
-
};
|
|
2211
|
-
type TenantStoreWithESOptions<TTenant extends TenantRecordBase = TenantRecordBase> = {
|
|
2212
|
-
/**
|
|
2213
|
-
* TTL for cached per-tenant EnterpriseStandard instances, in milliseconds.
|
|
2214
|
-
* Default is forever; set to 0 to recreate ES on every getEs() call.
|
|
2215
|
-
*/
|
|
2216
|
-
ttl?: number;
|
|
2217
|
-
/**
|
|
2218
|
-
* Optional factory used to create an ES instance for a tenant.
|
|
2219
|
-
* If omitted, getEs() throws.
|
|
2220
|
-
*/
|
|
2221
|
-
createEs?: TenantEsFactory<TTenant>;
|
|
2222
|
-
};
|
|
2223
|
-
type TenantUserRegistration = {
|
|
2224
|
-
registerUserTenantId(userId: string, tenantId: string | null | undefined): void | Promise<void>;
|
|
2225
|
-
registerUserToTenant?(userId: string, tenantId: string): void | Promise<void>;
|
|
2226
|
-
};
|
|
2227
|
-
declare abstract class TenantStore<TTenant extends TenantRecordBase = TenantRecordBase> implements TenantUserRegistration {
|
|
2228
|
-
storeConfig?(config: TenantConfigStoreRequest<TTenant>): Promise<TenantConfigSourceInput>;
|
|
2229
|
-
abstract get(tenantId: string): Promise<StoredTenant<TTenant> | undefined>;
|
|
2230
|
-
abstract list(options?: TenantListOptions): Promise<ListResult<StoredTenant<TTenant>>>;
|
|
2231
|
-
abstract upsert(tenant: StoredTenant<TTenant>): Promise<StoredTenant<TTenant>>;
|
|
2232
|
-
abstract delete(tenantId: string): Promise<number>;
|
|
2233
|
-
abstract registerUserTenantId(userId: string, tenantId: string | null | undefined): void | Promise<void>;
|
|
2234
|
-
registerUserToTenant?(userId: string, tenantId: string): void | Promise<void>;
|
|
2235
|
-
abstract findTenantsByUser(user: User2): Promise<StoredTenant<TTenant>[]>;
|
|
2236
|
-
findTenantByUser(user: User2): Promise<StoredTenant<TTenant> | undefined>;
|
|
2237
|
-
}
|
|
2238
|
-
type TenantManagerStore<TTenant extends TenantRecordBase = TenantRecordBase> = Pick<TenantStoreWithES<TTenant>, "get" | "list" | "upsert" | "delete" | "getEs" | "findTenantByUser" | "findTenantsByUser"> & {
|
|
2239
|
-
storeConfig?: TenantStoreWithES<TTenant>["storeConfig"];
|
|
2240
|
-
};
|
|
2241
|
-
type InMemoryTenantStoreOptions<TTenant extends TenantRecordBase = TenantRecordBase> = TenantStoreWithESOptions<TTenant>;
|
|
2242
|
-
type TenantStoreWithRequiredEsOptions<TTenant extends TenantRecordBase = TenantRecordBase> = Omit<TenantStoreWithESOptions<TTenant>, "createEs"> & {
|
|
2243
|
-
createEs: TenantEsFactory<TTenant>;
|
|
2244
|
-
};
|
|
2245
|
-
type SingleTenantStoreOptions<TTenant extends TenantRecordBase = TenantRecordBase> = TenantStoreWithRequiredEsOptions<TTenant>;
|
|
2246
|
-
type MultiTenantStoreOptions<TTenant extends TenantRecordBase = TenantRecordBase> = TenantStoreWithRequiredEsOptions<TTenant>;
|
|
2247
|
-
declare abstract class TenantStoreWithEsCache<TTenant extends TenantRecordBase = TenantRecordBase> extends TenantStore<TTenant> {
|
|
2248
|
-
readonly ttl: number;
|
|
2249
|
-
private readonly createEs?;
|
|
2250
|
-
private readonly tenantEsMap;
|
|
2251
|
-
constructor(options: TenantStoreWithESOptions<TTenant>);
|
|
2252
|
-
registerUserTenantId(userId: string, tenantId: string | null | undefined): Promise<void>;
|
|
2253
|
-
registerUserToTenant(_userId: string, _tenantId: string): Promise<void>;
|
|
2254
|
-
protected prepareTenantForCreateEs(tenant: StoredTenant<TTenant>): StoredTenant<TTenant>;
|
|
2255
|
-
protected invalidateTenantEsCache(tenantId: string): void;
|
|
2256
|
-
getEs(tenantId: string): Promise<EnterpriseStandard | undefined>;
|
|
2257
|
-
getCachedTenantIds(): string[];
|
|
2258
|
-
}
|
|
2259
|
-
declare abstract class SingleTenantStore<TTenant extends TenantRecordBase = TenantRecordBase> extends TenantStoreWithEsCache<TTenant> {
|
|
2260
|
-
abstract findTenantByUser(user: User2): Promise<StoredTenant<TTenant> | undefined>;
|
|
2261
|
-
findTenantsByUser(user: User2): Promise<StoredTenant<TTenant>[]>;
|
|
2262
|
-
}
|
|
2263
|
-
declare abstract class MultiTenantStore<TTenant extends TenantRecordBase = TenantRecordBase> extends TenantStoreWithEsCache<TTenant> {}
|
|
2264
|
-
type TenantStoreWithES<TTenant extends TenantRecordBase = TenantRecordBase> = TenantStoreWithEsCache<TTenant>;
|
|
2265
|
-
type InMemorySingleTenantStoreOptions<TTenant extends TenantRecordBase = TenantRecordBase> = InMemoryTenantStoreOptions<TTenant>;
|
|
2266
|
-
type InMemoryMultiTenantStoreOptions<TTenant extends TenantRecordBase = TenantRecordBase> = InMemoryTenantStoreOptions<TTenant>;
|
|
2267
|
-
declare class InMemorySingleTenantStore<TTenant extends TenantRecordBase = TenantRecordBase> extends SingleTenantStore<TTenant> {
|
|
2268
|
-
private readonly store;
|
|
2269
|
-
constructor(options?: InMemorySingleTenantStoreOptions<TTenant>);
|
|
2270
|
-
get(tenantId: string): Promise<StoredTenant<TTenant> | undefined>;
|
|
2271
|
-
list(options?: TenantListOptions): Promise<ListResult<StoredTenant<TTenant>>>;
|
|
2272
|
-
upsert(tenant: StoredTenant<TTenant>): Promise<StoredTenant<TTenant>>;
|
|
2346
|
+
type SerializableTenant<TTenant extends BaseTenant = BaseTenant> = Omit<TTenant, "config">;
|
|
2347
|
+
type TenantEsFactory<TTenant extends BaseTenant = BaseTenant> = (tenant: TTenant) => EnterpriseStandard;
|
|
2348
|
+
interface TenantStore<
|
|
2349
|
+
TTenant extends BaseTenant = BaseTenant,
|
|
2350
|
+
TUser extends {
|
|
2351
|
+
id?: string;
|
|
2352
|
+
} = AuthenticatedUser
|
|
2353
|
+
> {
|
|
2354
|
+
get(tenantId: string): Promise<TTenant | undefined>;
|
|
2355
|
+
list(options?: TenantListOptions): Promise<ListResult<TTenant>>;
|
|
2356
|
+
upsert(tenant: TTenant): Promise<TTenant>;
|
|
2273
2357
|
delete(tenantId: string): Promise<number>;
|
|
2358
|
+
getEs(tenantId: string): Promise<EnterpriseStandard | undefined>;
|
|
2359
|
+
findTenantsByUser(user: TUser): Promise<TTenant[]>;
|
|
2274
2360
|
registerUserTenantId(userId: string, tenantId: string | null | undefined): Promise<void>;
|
|
2275
|
-
findTenantByUser(user: User2): Promise<StoredTenant<TTenant> | undefined>;
|
|
2276
2361
|
}
|
|
2277
|
-
|
|
2362
|
+
type InMemoryTenantStoreOptions<TTenant extends BaseTenant = BaseTenant> = {
|
|
2363
|
+
createEs?: TenantEsFactory<TTenant>;
|
|
2364
|
+
};
|
|
2365
|
+
declare function hydrateTenantForEs<TTenant extends BaseTenant = BaseTenant>(tenant: TTenant): TTenant;
|
|
2366
|
+
declare class InMemoryTenantStore<
|
|
2367
|
+
TTenant extends BaseTenant = BaseTenant,
|
|
2368
|
+
TUser extends {
|
|
2369
|
+
id?: string;
|
|
2370
|
+
} = AuthenticatedUser
|
|
2371
|
+
> implements TenantStore<TTenant, TUser> {
|
|
2278
2372
|
private readonly store;
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2373
|
+
private readonly createEs?;
|
|
2374
|
+
constructor(options?: InMemoryTenantStoreOptions<TTenant>);
|
|
2375
|
+
get(tenantId: string): Promise<TTenant | undefined>;
|
|
2376
|
+
list(options?: TenantListOptions): Promise<ListResult<TTenant>>;
|
|
2377
|
+
upsert(tenant: TTenant): Promise<TTenant>;
|
|
2283
2378
|
delete(tenantId: string): Promise<number>;
|
|
2284
2379
|
registerUserTenantId(userId: string, tenantId: string | null | undefined): Promise<void>;
|
|
2285
|
-
findTenantsByUser(user:
|
|
2380
|
+
findTenantsByUser(user: TUser): Promise<TTenant[]>;
|
|
2381
|
+
getEs(tenantId: string): Promise<EnterpriseStandard | undefined>;
|
|
2286
2382
|
}
|
|
2287
2383
|
declare function sendTenantWebhook(webhookUrl: string, payload: TenantWebhookPayload, log: Logger): Promise<void>;
|
|
2288
2384
|
/**
|
|
2289
2385
|
* Stored user data with required id and tracking metadata.
|
|
2290
2386
|
*
|
|
2291
|
-
* Extends the
|
|
2292
|
-
* -
|
|
2387
|
+
* Extends the BaseUser type with:
|
|
2388
|
+
* - Optional auth envelopes for workforce (`sso`) and customer (`ciam`) sessions
|
|
2293
2389
|
* - Timestamps for tracking when users were first seen and last updated
|
|
2294
2390
|
* - Optional custom extended data
|
|
2295
2391
|
*
|
|
2296
2392
|
* @template TExtended - Type-safe custom data that consumers can add to users
|
|
2297
2393
|
*/
|
|
2298
|
-
type StoredUser<TExtended = object> =
|
|
2299
|
-
/**
|
|
2300
|
-
* Required unique identifier (the `sub` claim from the IdP).
|
|
2301
|
-
* This is the primary key for user storage.
|
|
2302
|
-
*/
|
|
2303
|
-
id?: string;
|
|
2394
|
+
type StoredUser<TExtended = object> = BaseUser & {
|
|
2304
2395
|
/**
|
|
2305
2396
|
* Optional Enterprise Standard tenant identifier for tenant-aware apps.
|
|
2306
2397
|
* Built-in user stores can use this when registering HRD mappings.
|
|
@@ -2430,7 +2521,11 @@ type StoredUser<TExtended = object> = Omit<User2, "sso"> & {
|
|
|
2430
2521
|
* Optional SSO envelope for stores that persist full auth profile data.
|
|
2431
2522
|
* Simple app stores MAY omit this field.
|
|
2432
2523
|
*/
|
|
2433
|
-
sso?:
|
|
2524
|
+
sso?: WorkforceUser["sso"];
|
|
2525
|
+
/**
|
|
2526
|
+
* Optional CIAM envelope for stores that persist customer session profile data.
|
|
2527
|
+
*/
|
|
2528
|
+
ciam?: Customer["ciam"];
|
|
2434
2529
|
} & TExtended;
|
|
2435
2530
|
type UserStoreOptions = {
|
|
2436
2531
|
tenantId: string;
|
|
@@ -2466,22 +2561,19 @@ type UserStoreOptions = {
|
|
|
2466
2561
|
*/
|
|
2467
2562
|
interface UserStore<TExtended = object> {
|
|
2468
2563
|
/**
|
|
2469
|
-
* Retrieve a user by their
|
|
2470
|
-
*
|
|
2471
|
-
* This is the canonical lookup used by SDK flows whenever possible.
|
|
2472
|
-
* Other lookup methods (userName) are secondary convenience indexes.
|
|
2564
|
+
* Retrieve a user by their unique identifier.
|
|
2473
2565
|
*
|
|
2474
|
-
* @param
|
|
2566
|
+
* @param id - The user's unique identifier as defined by the store implementation
|
|
2475
2567
|
* @returns The user if found, undefined otherwise
|
|
2476
2568
|
*/
|
|
2477
|
-
get(
|
|
2569
|
+
get(id: string): Promise<StoredUser<TExtended> | undefined>;
|
|
2478
2570
|
/**
|
|
2479
|
-
* Retrieve a user
|
|
2571
|
+
* Retrieve a user based on their SCIM attributes or SSO JWT Claims.
|
|
2480
2572
|
*
|
|
2481
|
-
* @param
|
|
2573
|
+
* @param user - The user to lookup by SCIM attributes or SSO JWT Claims
|
|
2482
2574
|
* @returns The user if found, undefined otherwise
|
|
2483
2575
|
*/
|
|
2484
|
-
|
|
2576
|
+
lookup(user: StoredUser<TExtended>): Promise<StoredUser<TExtended> | undefined>;
|
|
2485
2577
|
/**
|
|
2486
2578
|
* Create or update a user in the store.
|
|
2487
2579
|
*
|
|
@@ -2492,11 +2584,12 @@ interface UserStore<TExtended = object> {
|
|
|
2492
2584
|
*/
|
|
2493
2585
|
upsert(user: StoredUser<TExtended>): Promise<StoredUser<TExtended>>;
|
|
2494
2586
|
/**
|
|
2495
|
-
* Delete a user by their
|
|
2587
|
+
* Delete a user by their unique identifier.
|
|
2496
2588
|
*
|
|
2497
|
-
* @param
|
|
2589
|
+
* @param id - The user's unique identifier as defined by the store implementation
|
|
2590
|
+
* @returns The number of users deleted (0 or 1)
|
|
2498
2591
|
*/
|
|
2499
|
-
delete(
|
|
2592
|
+
delete(id: string): Promise<number>;
|
|
2500
2593
|
/**
|
|
2501
2594
|
* List users in the store with optional pagination and sort.
|
|
2502
2595
|
*
|
|
@@ -2904,6 +2997,10 @@ type EnterpriseStandardBase = {
|
|
|
2904
2997
|
reload?(): Promise<void>;
|
|
2905
2998
|
/** When present (e.g. from server enterpriseStandard), merge config then reload from the config source and reapply. */
|
|
2906
2999
|
reconfigure?(config?: FrameworkConfig): Promise<void>;
|
|
3000
|
+
/** When present (e.g. from server enterpriseStandard), release config subscriptions and background resources. */
|
|
3001
|
+
close?(): void;
|
|
3002
|
+
/** When present (e.g. from server enterpriseStandard), replace runtime store instances. */
|
|
3003
|
+
setStores?(stores: FrameworkStores): void;
|
|
2907
3004
|
};
|
|
2908
3005
|
/** Config-driven module types: null in config → never; otherwise module type (non-optional). */
|
|
2909
3006
|
type EnterpriseStandardStrict<C extends FrameworkConfig> = {
|
|
@@ -2921,6 +3018,8 @@ type EnterpriseStandardStrict<C extends FrameworkConfig> = {
|
|
|
2921
3018
|
isReady(): boolean;
|
|
2922
3019
|
reload?(): Promise<void>;
|
|
2923
3020
|
reconfigure?(config?: FrameworkConfig): Promise<void>;
|
|
3021
|
+
close?(): void;
|
|
3022
|
+
setStores(stores: FrameworkStores): void;
|
|
2924
3023
|
};
|
|
2925
3024
|
type EnterpriseStandard = EnterpriseStandardBase;
|
|
2926
3025
|
type ESRouteModule = "sso" | "iam" | "workload" | "ciam" | "secrets";
|
|
@@ -2961,6 +3060,14 @@ type ESConfigChangeOptions = {
|
|
|
2961
3060
|
* Optional runtime routing customization for `es.handler(request)`.
|
|
2962
3061
|
*/
|
|
2963
3062
|
routing?: ESRoutingOptions;
|
|
3063
|
+
/**
|
|
3064
|
+
* ConfigSource retry policy for loading RemoteConfig. The default retries forever with exponential backoff.
|
|
3065
|
+
*/
|
|
3066
|
+
configRetry?: RemoteConfigRetryOptions;
|
|
3067
|
+
/**
|
|
3068
|
+
* Called before each RemoteConfig retry is scheduled. Throw to stop retrying and reject ready().
|
|
3069
|
+
*/
|
|
3070
|
+
onConfigLoadError?: RemoteConfigRetryHook;
|
|
2964
3071
|
};
|
|
2965
3072
|
/**
|
|
2966
3073
|
* Validators for CIAM (magic link) request bodies.
|
|
@@ -3071,8 +3178,8 @@ type CIAM<
|
|
|
3071
3178
|
TMagicLinkData = Record<string, never>,
|
|
3072
3179
|
TUserData = Record<string, never>
|
|
3073
3180
|
> = CIAMConfig<TMagicLinkData, TUserData> & {
|
|
3074
|
-
getUser: (request: Request) => Promise<
|
|
3075
|
-
getRequiredUser: (request: Request) => Promise<
|
|
3181
|
+
getUser: (request: Request) => Promise<Customer | undefined>;
|
|
3182
|
+
getRequiredUser: (request: Request) => Promise<Customer>;
|
|
3076
3183
|
logout: (request: Request) => Promise<Response>;
|
|
3077
3184
|
logoutBackChannel: (request: Request) => Promise<Response>;
|
|
3078
3185
|
handler: (request: Request) => Promise<Response>;
|
|
@@ -3083,12 +3190,12 @@ type CIAMConfigFromCode<
|
|
|
3083
3190
|
TUserData = Record<string, never>
|
|
3084
3191
|
> = Omit<CIAMConfig<TMagicLinkData, TUserData>, "signingKey">;
|
|
3085
3192
|
/**
|
|
3086
|
-
* Maps OIDC ID token claims to the shared
|
|
3193
|
+
* Maps OIDC ID token claims to the shared workforce user type.
|
|
3087
3194
|
* Used by decodeUser and verifyUser; no config required (iss/exp from claims).
|
|
3088
3195
|
*/
|
|
3089
|
-
declare function claimsToUser(claims: IdTokenClaims):
|
|
3196
|
+
declare function claimsToUser(claims: IdTokenClaims): WorkforceUser;
|
|
3090
3197
|
/**
|
|
3091
|
-
* Decodes the JWT payload and returns a
|
|
3198
|
+
* Decodes the JWT payload and returns a workforce user.
|
|
3092
3199
|
*
|
|
3093
3200
|
* **This only decodes the payload.** It does not verify the signature, expiry, or
|
|
3094
3201
|
* issuer. Do not use the result for authorization. Safe for client-side use for
|
|
@@ -3098,10 +3205,10 @@ declare function claimsToUser(claims: IdTokenClaims): User2;
|
|
|
3098
3205
|
* `@enterprisestandard/core/server` or `@enterprisestandard/server`.
|
|
3099
3206
|
*
|
|
3100
3207
|
* @param jwt - Raw JWT string (e.g. OIDC ID token).
|
|
3101
|
-
* @returns
|
|
3208
|
+
* @returns WorkforceUser shaped from the payload.
|
|
3102
3209
|
* @throws If the JWT format is invalid or the payload does not match ID token claims shape.
|
|
3103
3210
|
*/
|
|
3104
|
-
declare function decodeUser(jwt: string): Promise<
|
|
3211
|
+
declare function decodeUser(jwt: string): Promise<WorkforceUser>;
|
|
3105
3212
|
/**
|
|
3106
3213
|
* List result from total count, sliced items, start index, and optional limit.
|
|
3107
3214
|
* When limit is omitted, size is set to total (one logical page), page and pages are 1.
|
|
@@ -3110,7 +3217,7 @@ declare function list<T>(total: number, items: T[], start: number, limit: number
|
|
|
3110
3217
|
type TenantDirectoryAccount = {
|
|
3111
3218
|
clientId: string;
|
|
3112
3219
|
active: boolean;
|
|
3113
|
-
user:
|
|
3220
|
+
user: AuthenticatedUser;
|
|
3114
3221
|
valid: boolean;
|
|
3115
3222
|
expiresAt?: string;
|
|
3116
3223
|
tenantId?: string;
|
|
@@ -3448,64 +3555,4 @@ type LfvErrorResponse = {
|
|
|
3448
3555
|
error: LfvErrorCode;
|
|
3449
3556
|
message: string;
|
|
3450
3557
|
};
|
|
3451
|
-
|
|
3452
|
-
/**
|
|
3453
|
-
* Result type for Standard Schema validation (success or failure).
|
|
3454
|
-
*/
|
|
3455
|
-
type ValidateResult<T> = StandardSchemaV110.Result<T>;
|
|
3456
|
-
/**
|
|
3457
|
-
* A Standard Schema with a top-level `validate()` method for a cleaner API.
|
|
3458
|
-
* Use this so callers can call `schema.validate(value)` instead of `schema['~standard'].validate(value)`.
|
|
3459
|
-
*/
|
|
3460
|
-
type StandardSchemaWithValidate<T> = StandardSchemaV110<unknown, T> & {
|
|
3461
|
-
validate(value: unknown): Promise<StandardSchemaV110.Result<T>>;
|
|
3462
|
-
};
|
|
3463
|
-
/**
|
|
3464
|
-
* Wraps a Standard Schema so it has a top-level `validate(value)` method.
|
|
3465
|
-
* Use when creating or modifying validators so application code can call
|
|
3466
|
-
* `validators.ciam.baseUser.validate(raw)` instead of `validators.ciam.baseUser['~standard'].validate(raw)`.
|
|
3467
|
-
*
|
|
3468
|
-
* @example
|
|
3469
|
-
* const baseUser = withValidate(createBaseUserValidator());
|
|
3470
|
-
* const result = await baseUser.validate(requestBody);
|
|
3471
|
-
*/
|
|
3472
|
-
declare function withValidate<T>(schema: StandardSchemaV110<unknown, T>): StandardSchemaWithValidate<T>;
|
|
3473
|
-
declare function must<T>(value: T | undefined | null, message?: string): T;
|
|
3474
|
-
/**
|
|
3475
|
-
* Returns a 400 Response with the issues if there are any.
|
|
3476
|
-
* @param issues - Any validation issues.
|
|
3477
|
-
* @param message - The message to include in the response.
|
|
3478
|
-
* @returns A 400 Response with the issues if it does, otherwise null.
|
|
3479
|
-
*/
|
|
3480
|
-
declare function validationFailureResponse(issues: unknown, message: string): Response;
|
|
3481
|
-
/**
|
|
3482
|
-
* Merges two config objects, ensuring critical fields from vault take precedence.
|
|
3483
|
-
*
|
|
3484
|
-
* @param fromVault - Configuration from vault (takes precedence for critical fields)
|
|
3485
|
-
* @param fromCode - Configuration from code (used as fallback)
|
|
3486
|
-
* @param criticalFields - Array of field names that should prefer vault values
|
|
3487
|
-
* @returns Merged configuration object
|
|
3488
|
-
*/
|
|
3489
|
-
declare function mergeConfig<T extends Record<string, unknown>>(fromVault: T | undefined, fromCode: T | undefined, criticalFields?: string[]): T;
|
|
3490
|
-
/**
|
|
3491
|
-
* Strips // and /* *\/ comments from JSONC, respecting string literals.
|
|
3492
|
-
*/
|
|
3493
|
-
declare function stripJsonComments(content: string): string;
|
|
3494
|
-
declare function parseJsonc<T>(content: string): T;
|
|
3495
|
-
/**
|
|
3496
|
-
* Deep equality for JSON-like values used in config snapshots.
|
|
3497
|
-
* Treats object key order as irrelevant and treats missing and `undefined`
|
|
3498
|
-
* object properties as equal by ignoring `undefined` keys on both sides.
|
|
3499
|
-
*/
|
|
3500
|
-
declare function deepEqualPlain(a: unknown, b: unknown): boolean;
|
|
3501
|
-
/**
|
|
3502
|
-
* Waits for a HTTP service to be ready by polling its URL.
|
|
3503
|
-
* Connection errors (e.g. connection refused) are treated as "not ready" and retried.
|
|
3504
|
-
* @param url - The URL to poll.
|
|
3505
|
-
* @param pingInterval - The interval in milliseconds to poll the URL.
|
|
3506
|
-
* @param warnInterval - The interval in milliseconds to warn about the status. Set warnInterval to 0 to disable warnings.
|
|
3507
|
-
* @param timeout - The timeout in milliseconds to reject the promise.
|
|
3508
|
-
* @returns A promise that resolves when the service is ready.
|
|
3509
|
-
*/
|
|
3510
|
-
declare function waitOn(url: string, test?: (resp: Response) => boolean | Promise<boolean>, pingInterval?: number, warnInterval?: number, timeout?: number): Promise<void>;
|
|
3511
|
-
export { workloadTokenResponseSchema, withValidate, waitOn, version, validationFailureResponse, userSchema, tokenResponseSchema, stripJsonComments, silentLogger, setActiveSession, serializeESConfig, sendTenantWebhook, parseJsonc, oidcCallbackSchema, normalizeTenantRoutingStrategy, normalizeTenantPathNamespace, must, mergeConfig, matchTenantPath, listSsoClientIdsFromCookies, list, jwtAssertionClaimsSchema, infoLogger, idTokenClaimsSchema, groupResourceSchema, getActiveSession, findTenantFromStateParam, defaultLogger, deepEqualPlain, decodeUser, debugLogger, consoleLogger, clearActiveSession, claimsToUser, buildTenantPath, X509Certificate, WorkloadValidators, WorkloadTokenStore, WorkloadTokenResponse, WorkloadIncomingOutgoing, WorkloadIdentity, WorkloadConfigMap, WorkloadConfig, WorkloadClient, Workload, VaultWebSocketSecretsConfig, VaultWebSocketAuthHeader, VaultSecretsConfig, VaultLfvSecretsConfig, ValidateResult, UsersInboundHandlerConfig, UserStoreOptions, UserStore, UserSortOptions, UserSortField, UserListOptions, User2 as User, UpsertTenantResponse, UpsertTenantRequest, TokenValidationResult, TokenResponse, TenantWebhookPayload, TenantValidators, TenantUserRegistration, TenantStoredConfigLocator, TenantStoreWithEsCache, TenantStoreWithESOptions, TenantStoreWithES, TenantStore, TenantStatus, TenantSortOptions, TenantSortField, TenantSecretsConfig, TenantRoutingStrategy, TenantRequestError, TenantRemoteConfigLocator, TenantPathRoutingStrategy, TenantPathNamespace, TenantPathMatch, TenantManagerStore, TenantListOptions, TenantJwtRoutingStrategy, TenantEsFactory, TenantDirectoryTenant, TenantDirectoryResponse, TenantDirectoryAccount, TenantConfigStoreRequest, TenantConfigSourceInput, TenantConfigLocator, TenantConfigEnv, StoredUser, StoredTenantRecord, StoredTenant, StoredGroup, StateCookie, StandardSchemaWithValidate, SortDirection, SingleTenantStoreOptions, SingleTenantStore, SessionStore, Session, ServerOnlyWorkloadConfig, SecretsValidators, SecretsSourceType, SecretsSourceMap, SecretsSourceConfig, SecretsSource, SecretsOperationOptions, SecretsModuleConfig, Secrets, SecretRequestSeverity, SecretLifecycleRequest, Secret, User as ScimUser, ScimServiceProviderConfig, ScimSchemaDefinition, ScimSchemaAttributeDefinition, ScimResult, ScimResourceTypeSchemaExtension, ScimResourceType, ScimListResponse, ScimError, ScimAuthenticationScheme, SSOValidators, SSOHandlerConfig, SSOConfig, SSOAppValidators, SSOAppRegistry, SSO, Role, ResolvedVaultLfvSecretsConfig, RemoteConfig, RegisterSSOAppResult, RegisterSSOAppPayload, RegisterSSOAppError, RegisterIAMAppResult, RegisterIAMAppPayload, RegisterIAMAppError, ReactiveHandle, Photo, PhoneNumber, OidcCallbackParams, Name, MultipleTenantsForUserError, MultiTenantStoreOptions, MultiTenantStore, ModifiableFrameworkConfig, MetaData, MagicLinkStore, MagicLink, LoginConfig, Logger, ListResult, LfvOtpResponse, LfvOtpRequest, LfvErrorResponse, LfvErrorCode, LfvActionRequestBase, LfvActionName, LfvActionAcceptedResponse, JwtBearerWorkloadConfig, JWTAssertionClaims, InMemoryTenantStoreOptions, InMemorySingleTenantStoreOptions, InMemorySingleTenantStore, InMemoryMultiTenantStoreOptions, InMemoryMultiTenantStore, IdTokenClaims, IAMValidators, IAMUsersInbound, IAMInboundUsersConfig, IAMInboundUserContext, IAMHandlerConfig, IAMGroupsOutbound, IAMGroupsInbound, IAMDiscoveryHandlerConfig, IAMDiscoveryContext, IAMDiscoveryConfig, IAMConfig, IAMAppValidators, IAMAppRole, IAMAppRegistry, IAM, GroupsInboundHandlerConfig, GroupStore, GroupSortOptions, GroupSortField, GroupResource, GroupMember, GroupListOptions, Group, GcpSecretsConfig, FrameworkWorkloadIncomingOutgoing, FrameworkWorkloadConfig, FrameworkStores, FrameworkSecretsSourceConfig, FrameworkSecretsModuleConfig, FrameworkConfig, EnvironmentType, EnterpriseUser, EnterpriseStandardFromConfig, EnterpriseStandardBase, EnterpriseStandard, EnterpriseExtension, Email, ESValidators, ESRoutingOptions, ESRouteModule, ESRouteFilterResult, ESResolvedRoute, ESModuleFromConfig, ESConfigChangeResult, ESConfigChangeOptions, ESConfigChangeCallback, ESConfig, DevSecretsConfig, DEFAULT_TENANT_UI_NAMESPACE, DEFAULT_TENANT_API_NAMESPACE, CreateUserOptions, CreateTenantResponse, CreateTenantRequest, CreateGroupOptions, ConfigSourceType, ConfigSource, ClientCredentialsWorkloadConfig, ChangeListener, CachedWorkloadToken, CIAMValidators, CIAMConfigFromCode, CIAMConfig, CIAM, BaseUser, AzureSecretsConfig, AwsSecretsConfig, AwsAuthMethod, ApplicationValidators, Address };
|
|
3558
|
+
export { workloadTokenResponseSchema, withValidate, waitOn, version, validationFailureResponse, userSchema, tokenResponseSchema, stripJsonComments, silentLogger, setActiveSession, serializeESConfig, sendTenantWebhook, parseJsonc, oidcCallbackSchema, normalizeTenantRoutingStrategy, normalizeTenantPathNamespace, must, mergeConfig, matchTenantPath, listSsoClientIdsFromCookies, list, jwtAssertionClaimsSchema, isConfigLocator, infoLogger, idTokenClaimsSchema, hydrateTenantForEs, groupResourceSchema, getActiveSession, findTenantFromStateParam, defaultLogger, deepEqualPlain, decodeUser, debugLogger, consoleLogger, clearActiveSession, claimsToUser, buildTenantPath, X509Certificate, WorkloadValidators, WorkloadTokenStore, WorkloadTokenResponse, WorkloadIncomingOutgoing, WorkloadIdentity, WorkloadConfigMap, WorkloadConfig, WorkloadClient, Workload, WorkforceUser, VaultWorkloadAuthConfig, VaultWebSocketSecretsConfig, VaultWebSocketAuthHeader, VaultSecretsConfig, VaultLfvSecretsConfig, VaultConfigLocator, ValidateResult, UsersInboundHandlerConfig, UserStoreOptions, UserStore, UserSortOptions, UserSortField, UserListOptions, UpsertTenantResponse, UpsertTenantRequest, TokenValidationResult, TokenResponse, TenantWebhookPayload, TenantValidators, TenantStore, TenantStatus, TenantSortOptions, TenantSortField, TenantRoutingStrategy, TenantRequestError, TenantPathRoutingStrategy, TenantPathNamespace, TenantPathMatch, TenantListOptions, TenantJwtRoutingStrategy, TenantEsFactory, TenantDirectoryTenant, TenantDirectoryResponse, TenantDirectoryAccount, StoredUser, StoredGroup, StateCookie, StandardSchemaWithValidate, SortDirection, SessionStore, Session, ServerOnlyWorkloadConfig, SerializableTenant, SecretsValidators, SecretsSourceType, SecretsSourceMap, SecretsSourceConfig, SecretsSource, SecretsOperationOptions, SecretsModuleConfig, Secrets, SecretRequestSeverity, SecretLifecycleRequest, Secret, User as ScimUser, ScimServiceProviderConfig, ScimSchemaDefinition, ScimSchemaAttributeDefinition, ScimResult, ScimResourceTypeSchemaExtension, ScimResourceType, ScimListResponse, ScimError, ScimAuthenticationScheme, SSOValidators, SSOHandlerConfig, SSOConfig, SSOAppValidators, SSOAppRegistry, SSO, Role, ResolvedVaultLfvSecretsConfig, RemoteConfigRetryOptions, RemoteConfigRetryHook, RemoteConfigRetryContext, RemoteConfigLoadErrorKind, RemoteConfig, RegisterSSOAppResult, RegisterSSOAppPayload, RegisterSSOAppError, RegisterIAMAppResult, RegisterIAMAppPayload, RegisterIAMAppError, ReactiveHandle, Photo, PhoneNumber, OidcCallbackParams, Name, MultipleTenantsForUserError, ModifiableFrameworkConfig, MetaData, MagicLinkStore, MagicLink, LoginConfig, Logger, ListResult, LfvOtpResponse, LfvOtpRequest, LfvErrorResponse, LfvErrorCode, LfvActionRequestBase, LfvActionName, LfvActionAcceptedResponse, JwtBearerWorkloadConfig, JWTAssertionClaims, InMemoryTenantStoreOptions, InMemoryTenantStore, IdTokenClaims, IAMValidators, IAMUsersInbound, IAMInboundUsersConfig, IAMInboundUserContext, IAMHandlerConfig, IAMGroupsOutbound, IAMGroupsInbound, IAMDiscoveryHandlerConfig, IAMDiscoveryContext, IAMDiscoveryConfig, IAMConfig, IAMAppValidators, IAMAppRole, IAMAppRegistry, IAM, GroupsInboundHandlerConfig, GroupStore, GroupSortOptions, GroupSortField, GroupResource, GroupMember, GroupListOptions, Group, GcpSecretsConfig, GcpConfigLocator, FrameworkWorkloadIncomingOutgoing, FrameworkWorkloadConfig, FrameworkStores, FrameworkSecretsSourceConfig, FrameworkSecretsModuleConfig, FrameworkConfig, EnvironmentType, EnterpriseUser, EnterpriseStandardFromConfig, EnterpriseStandardBase, EnterpriseStandard, EnterpriseExtension, Email, ESValidators, ESRoutingOptions, ESRouteModule, ESRouteFilterResult, ESResolvedRoute, ESModuleFromConfig, ESConfigChangeResult, ESConfigChangeOptions, ESConfigChangeCallback, ESConfig, DevSecretsConfig, DEFAULT_TENANT_UI_NAMESPACE, DEFAULT_TENANT_API_NAMESPACE, Customer, CreateUserOptions, CreateGroupOptions, ConfigSourceType, ConfigSourceEnv, ConfigSource, ConfigLocator, ClientCredentialsWorkloadConfig, ChangeListener, CachedWorkloadToken, CIAMValidators, CIAMConfigFromCode, CIAMConfig, CIAM, BaseUser, BaseTenant, AzureSecretsConfig, AzureConfigLocator, AwsSecretsConfig, AwsConfigLocator, AwsAuthMethod, AuthenticatedUser, ApplicationValidators, Address };
|