@ionite/core 0.0.23-beta.20260812.6 → 0.0.23-beta.20260814.1

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 CHANGED
@@ -389,8 +389,8 @@ type AuthenticatedUser = WorkforceUser | Customer;
389
389
  * flows that are inherently human.
390
390
  */
391
391
  type AuthenticatedPrincipal = AuthenticatedUser | WorkloadPrincipal;
392
+ import { StandardSchemaV1 as StandardSchemaV19 } from "@standard-schema/spec";
392
393
  import { StandardSchemaV1 as StandardSchemaV18 } from "@standard-schema/spec";
393
- import { StandardSchemaV1 as StandardSchemaV17 } from "@standard-schema/spec";
394
394
  /**
395
395
  * Third-party CIAM provider presets and claim mapping.
396
396
  *
@@ -2052,45 +2052,45 @@ type IAM = IAMConfig & {
2052
2052
  */
2053
2053
  delta?: IamDeltaEmitter;
2054
2054
  };
2055
- type KmsKeyState = "pending" | "active" | "deprecated" | "revoked";
2056
- type KmsPoolKind = "token" | "allocation";
2057
- type KmsTokenKey = {
2055
+ type KmsKeyState = "pending" | "active" | "deprecated" | "rotated" | "revoked";
2056
+ type KmsKey = {
2058
2057
  id: string;
2059
2058
  state: KmsKeyState;
2060
2059
  value?: string;
2061
2060
  notBefore?: string;
2062
2061
  notAfter?: string;
2062
+ /** Control-plane lifecycle timestamps. Vaults omit these from personalized client grants. */
2063
+ createdAt?: string;
2064
+ activatedAt?: string;
2065
+ deprecatedAt?: string;
2066
+ rotatedAt?: string;
2067
+ revokedAt?: string;
2063
2068
  /** Control-plane metadata used for allocation policy and UI. Consumers should treat it as opaque. */
2064
2069
  meta?: Record<string, unknown>;
2065
2070
  };
2066
- type KmsTokenPoolDocument = {
2067
- kind: "token";
2068
- active: string;
2069
- keys: KmsTokenKey[];
2070
- };
2071
- /** Per-client allocation view delivered by a secrets source. */
2072
- type KmsAllocationPoolView = {
2073
- kind: "allocation";
2074
- active: string;
2075
- keys: KmsTokenKey[];
2071
+ /** Personalized per-client view delivered by a secrets source. */
2072
+ type KmsPoolDocument = {
2073
+ kind: "kms";
2074
+ /** Omitted when the server has revoked the previous grant and no replacement is available yet. */
2075
+ active?: string;
2076
+ keys: KmsKey[];
2076
2077
  };
2077
- type KmsPoolDocument = KmsTokenPoolDocument | KmsAllocationPoolView;
2078
2078
  type KmsAllocationStrategy = "spread" | "low-quota-first";
2079
2079
  type KmsAllocationPolicy = {
2080
2080
  strategy?: KmsAllocationStrategy;
2081
2081
  maxHoldersPerKey?: number;
2082
+ /** Grace period during which a gracefully rotated key remains accepted. Defaults to 300 seconds. */
2083
+ overlapSeconds?: number;
2082
2084
  };
2083
- /** Control-plane allocation document stored by the vault. Clients receive a personalized view instead. */
2084
- type KmsAllocationPoolDocument = {
2085
- kind: "allocation";
2086
- keys: KmsTokenKey[];
2085
+ /** Control-plane pool document stored by the vault. Clients receive a personalized view instead. */
2086
+ type KmsPoolControlDocument = {
2087
+ kind: "kms";
2088
+ keys: KmsKey[];
2087
2089
  assignments: Record<string, string>;
2088
2090
  policy?: KmsAllocationPolicy;
2089
2091
  };
2090
2092
  /** ConfigSource-owned pointer to a KMS pool document. */
2091
2093
  type KmsPoolConfig = {
2092
- /** Pool semantics. Defaults to `token`. */
2093
- kind?: KmsPoolKind;
2094
2094
  /** Named `ion.secrets` source. Omit to use the default `ion.secret` source. */
2095
2095
  source?: string;
2096
2096
  /** Secret path. Defaults to `/kms/{poolName}`. */
@@ -2098,13 +2098,16 @@ type KmsPoolConfig = {
2098
2098
  };
2099
2099
  /** ConfigSource-owned named KMS pool declarations. */
2100
2100
  type KmsConfig = Record<string, KmsPoolConfig>;
2101
- type KmsPoolListener = (current: KmsTokenKey | undefined) => void;
2101
+ type KmsPoolListener = (current: KmsKey | undefined) => void;
2102
2102
  type KmsPool = {
2103
- /** Returns the usable token value, briefly awaiting only a locally scheduled imminent activation. */
2104
- value(): Promise<string>;
2105
- /** Timing-safe verification against the active token and usable deprecated overlap tokens. */
2103
+ /**
2104
+ * Returns the current granted key. Calls wait on one shared local subscription until a grant is
2105
+ * available; repeated calls resolve from the local cache and never initiate a vault request.
2106
+ */
2107
+ value(timeout?: number): Promise<string>;
2108
+ /** Timing-safe verification against the active key and usable deprecated rotation-overlap keys. */
2106
2109
  accepts(candidate: string): boolean;
2107
- /** Notifies immediately and whenever the selected active token changes. */
2110
+ /** Notifies immediately and whenever the selected active key changes. */
2108
2111
  subscribe(listener: KmsPoolListener): () => void;
2109
2112
  beforeChange(listener: ChangeListener): () => void;
2110
2113
  afterChange(listener: ChangeListener): () => void;
@@ -2121,12 +2124,9 @@ type Kms = ModuleReadiness & {
2121
2124
  getPool(name: string): KmsPool;
2122
2125
  };
2123
2126
  /** Parse and fail closed on a personalized KMS pool document. */
2124
- declare function parseKmsPoolDocument(value: unknown): KmsTokenPoolDocument;
2125
- declare function parseKmsPoolDocument(value: unknown, expectedKind: "token"): KmsTokenPoolDocument;
2126
- declare function parseKmsPoolDocument(value: unknown, expectedKind: "allocation"): KmsAllocationPoolView;
2127
- declare function parseKmsPoolDocument(value: unknown, expectedKind: KmsPoolKind): KmsPoolDocument;
2128
- /** Parse and fail closed on a control-plane allocation-pool document. */
2129
- declare function parseKmsAllocationPool(value: unknown): KmsAllocationPoolDocument;
2127
+ declare function parseKmsPoolDocument(value: unknown): KmsPoolDocument;
2128
+ /** Parse and fail closed on a control-plane KMS pool document. */
2129
+ declare function parseKmsPoolControlDocument(value: unknown): KmsPoolControlDocument;
2130
2130
  type OtelSignalName = "traces" | "metrics" | "logs";
2131
2131
  type OtelProtocol = "http/protobuf" | "http/json";
2132
2132
  type OtelProviderType = "otlp" | "grafana-lgtm" | "datadog" | "splunk" | "elastic";
@@ -2170,7 +2170,7 @@ type OtelConfig = {
2170
2170
  protocol?: OtelProtocol;
2171
2171
  headers?: Record<string, string>;
2172
2172
  apiKey?: string;
2173
- /** Name of a `RemoteConfig.kms` token pool used for exporter authentication. */
2173
+ /** Name of a `RemoteConfig.kms` key pool used for exporter authentication. */
2174
2174
  apiKeyPool?: string;
2175
2175
  apiKeyHeader?: string;
2176
2176
  oauth?: OtelOAuthClientCredentialsConfig;
@@ -2494,9 +2494,7 @@ declare function validationFailureResponse(issues: unknown, message: string): Re
2494
2494
  * @returns Merged configuration object
2495
2495
  */
2496
2496
  declare function mergeConfig<T extends Record<string, unknown>>(fromVault: T | undefined, fromCode: T | undefined, criticalFields?: string[]): T;
2497
- /**
2498
- * Strips // and /* *\/ comments from JSONC, respecting string literals.
2499
- */
2497
+ /** Strips // and /* *\/ comments from JSONC, respecting string literals. */
2500
2498
  declare function stripJsonComments(content: string): string;
2501
2499
  declare function parseJsonc<T>(content: string): T;
2502
2500
  /**
@@ -2849,6 +2847,57 @@ interface MagicLinkStore<TExtended = object> {
2849
2847
  */
2850
2848
  delete(token: string): Promise<void>;
2851
2849
  }
2850
+ import { StandardSchemaV1 as StandardSchemaV17 } from "@standard-schema/spec";
2851
+ declare const DEFAULT_SECRET_MIME_TYPES: Readonly<Record<SecretFormat, string>>;
2852
+ type SecretTypeRegistryEntry = SecretContentType & {
2853
+ id: string;
2854
+ label?: string;
2855
+ };
2856
+ type SecretTypeInput<T> = {
2857
+ id: string;
2858
+ label?: string;
2859
+ format: SecretFormat;
2860
+ mimeType?: string;
2861
+ schemaUrl?: string;
2862
+ schema?: StandardSchemaV17<unknown, T>;
2863
+ };
2864
+ /**
2865
+ * Runtime contract for a custom secret type. The Standard Schema value is used only by server-side
2866
+ * parsing; `toRegistryEntry()` returns the serializable half that a vault editor can register.
2867
+ */
2868
+ type SecretTypeDescriptor<T = unknown> = Readonly<{
2869
+ id: string;
2870
+ label?: string;
2871
+ format: SecretFormat;
2872
+ mimeType: string;
2873
+ schemaUrl?: string;
2874
+ schema?: StandardSchemaV17<unknown, T>;
2875
+ toRegistryEntry(): SecretTypeRegistryEntry;
2876
+ }>;
2877
+ type InferSecretType<TType> = TType extends SecretTypeDescriptor<infer T> ? T : never;
2878
+ declare function defineSecretType<T>(input: SecretTypeInput<T> & {
2879
+ schema: StandardSchemaV17<unknown, T>;
2880
+ }): SecretTypeDescriptor<T>;
2881
+ declare function defineSecretType(input: SecretTypeInput<unknown>): SecretTypeDescriptor<unknown>;
2882
+ declare function defaultSecretContentType(format?: SecretFormat): SecretContentType;
2883
+ /** Raised before decoding when a stored secret does not match the requested runtime contract. */
2884
+ declare class SecretContentTypeMismatchError extends Error {
2885
+ readonly expected: SecretContentType;
2886
+ readonly received: SecretContentType;
2887
+ constructor(expected: SecretContentType, received: SecretContentType);
2888
+ }
2889
+ type SecretFormat = "jsonc" | "env" | "text" | "binary" | "yaml" | "toml" | "xml";
2890
+ /**
2891
+ * Self-describing content metadata persisted with a secret. `typeId` identifies an authoring preset;
2892
+ * decoding never depends on the preset registry because the resolved format/mime/schema travel with
2893
+ * the secret.
2894
+ */
2895
+ type SecretContentType = {
2896
+ format: SecretFormat;
2897
+ mimeType: string;
2898
+ schemaUrl?: string;
2899
+ typeId?: string;
2900
+ };
2852
2901
  type Secret<T> = {
2853
2902
  data: T;
2854
2903
  metadata: MetaData;
@@ -2857,6 +2906,8 @@ type MetaData = {
2857
2906
  path: string;
2858
2907
  version: number;
2859
2908
  created: Date;
2909
+ /** Absent on legacy secrets, which are interpreted as JSONC. */
2910
+ contentType?: SecretContentType;
2860
2911
  };
2861
2912
  type SecretsSourceType = "vault" | "azure" | "aws" | "gcp" | "dev";
2862
2913
  type SecretRequestSeverity = "low" | "medium" | "high" | "critical";
@@ -2878,6 +2929,24 @@ type SecretsOperationOptions = {
2878
2929
  /** Optional timeout in milliseconds for this secrets operation. */
2879
2930
  timeout?: number;
2880
2931
  };
2932
+ type SecretsWriteOptions = SecretsOperationOptions & {
2933
+ /** Content contract stored with the secret and returned by all transports. */
2934
+ contentType?: SecretContentType;
2935
+ };
2936
+ type SecretHandle = {
2937
+ /** Reads the canonical textual representation. Binary secrets reject this accessor. */
2938
+ text(): Promise<string>;
2939
+ /** Decodes JSONC. Other formats reject this accessor. */
2940
+ json<T = unknown>(): Promise<T>;
2941
+ /** Reads the canonical bytes. Text formats are UTF-8 encoded. */
2942
+ bytes(): Promise<Uint8Array>;
2943
+ /** Decodes an env/key=value secret. */
2944
+ env(): Promise<Record<string, string>>;
2945
+ /** Reads metadata without decoding the value. */
2946
+ metadata(): Promise<MetaData>;
2947
+ /** Decodes and validates using a runtime secret-type descriptor. */
2948
+ parse<T>(type: SecretTypeDescriptor<T>): Promise<T>;
2949
+ };
2881
2950
  type SubscriptionMode = "fail-fast" | "wait";
2882
2951
  type SecretsSubscriptionOptions = SecretsOperationOptions & {
2883
2952
  /**
@@ -2923,13 +2992,15 @@ type FrameworkLfvConfig = {
2923
2992
  };
2924
2993
  type SecretsSource = ReactiveHandle & ModuleReadiness & {
2925
2994
  type: SecretsSourceType;
2995
+ /** Creates a lazy, Bun.file-style handle. No I/O occurs until an accessor is awaited. */
2996
+ get(path: string, options?: SecretsOperationOptions): SecretHandle;
2926
2997
  getFullSecret: <T>(path: string, options?: SecretsOperationOptions) => Promise<Secret<T>>;
2927
2998
  getSecret: <T>(path: string, options?: SecretsOperationOptions) => Promise<T>;
2928
2999
  /**
2929
3000
  * Write a secret at the given path.
2930
3001
  * Implementations may throw for read-only or unsupported secret sources.
2931
3002
  */
2932
- putSecret: (path: string, value: Record<string, unknown>, options?: SecretsOperationOptions) => Promise<void>;
3003
+ putSecret: (path: string, value: Record<string, unknown>, options?: SecretsWriteOptions) => Promise<void>;
2933
3004
  /**
2934
3005
  * When set, the secret source supports change detection, reads the current value first, and calls onChange
2935
3006
  * immediately with that value before watching for changes.
@@ -2991,12 +3062,14 @@ type Secrets = ModuleReadiness & {
2991
3062
  listSecretsSources(): string[];
2992
3063
  /** Gets a named secrets source client. Throws when missing. */
2993
3064
  getSecretsSource(sourceName: string): SecretsSource;
3065
+ /** Creates a lazy handle for a secret in a named source. */
3066
+ get(sourceName: string, path: string, options?: SecretsOperationOptions): SecretHandle;
2994
3067
  /** Reads a secret from a named secrets source client. */
2995
3068
  getSecret<T>(sourceName: string, path: string, options?: SecretsOperationOptions): Promise<T>;
2996
3069
  /** Reads full secret data + metadata from a named secrets source client. */
2997
3070
  getFullSecret<T>(sourceName: string, path: string, options?: SecretsOperationOptions): Promise<Secret<T>>;
2998
3071
  /** Writes a secret to a named secrets source client. */
2999
- putSecret(sourceName: string, path: string, value: Record<string, unknown>, options?: SecretsOperationOptions): Promise<void>;
3072
+ putSecret(sourceName: string, path: string, value: Record<string, unknown>, options?: SecretsWriteOptions): Promise<void>;
3000
3073
  /** Deletes a secret from a named secrets source client. */
3001
3074
  deleteSecret(sourceName: string, path: string, options?: SecretsOperationOptions): Promise<void>;
3002
3075
  /** Lists child paths under a base path for a named secrets source client. */
@@ -3563,7 +3636,7 @@ type RemoteConfig = {
3563
3636
  workload?: WorkloadConfig | WorkloadConfigMap | WorkloadIncomingOutgoing;
3564
3637
  /** Optional named secrets-source configs available to this App instance. */
3565
3638
  secrets?: SecretsModuleConfig;
3566
- /** ConfigSource-owned named managed token pools consumed through `ion.kms`. */
3639
+ /** ConfigSource-owned named server-allocated key pools consumed through `ion.kms`. */
3567
3640
  kms?: KmsConfig;
3568
3641
  ciam?: CIAMConfig;
3569
3642
  /** OpenTelemetry collector/exporter config loaded from ConfigSource. */
@@ -3782,8 +3855,8 @@ type ConfigSource = {
3782
3855
  * built-in core schemas.
3783
3856
  */
3784
3857
  type CIAMValidators = {
3785
- customer: StandardSchemaV17<unknown, BaseCustomer> & {
3786
- validate(value: unknown): Promise<StandardSchemaV17.Result<BaseCustomer>>;
3858
+ customer: StandardSchemaV18<unknown, BaseCustomer> & {
3859
+ validate(value: unknown): Promise<StandardSchemaV18.Result<BaseCustomer>>;
3787
3860
  };
3788
3861
  callbackParams?: StandardSchemaWithValidate<OidcCallbackParams>;
3789
3862
  idTokenClaims?: StandardSchemaWithValidate<IdTokenClaims>;
@@ -4205,9 +4278,9 @@ type TenantValidators<
4205
4278
  TUpdateTenantRequest extends UpdateTenantRequest = UpdateTenantRequest,
4206
4279
  TTenantResponse extends TenantResponse = TenantResponse
4207
4280
  > = {
4208
- createTenantRequest: StandardSchemaV18<unknown, TCreateTenantRequest>;
4209
- updateTenantRequest: StandardSchemaV18<unknown, TUpdateTenantRequest>;
4210
- tenantResponse?: StandardSchemaV18<unknown, TTenantResponse>;
4281
+ createTenantRequest: StandardSchemaV19<unknown, TCreateTenantRequest>;
4282
+ updateTenantRequest: StandardSchemaV19<unknown, TUpdateTenantRequest>;
4283
+ tenantResponse?: StandardSchemaV19<unknown, TTenantResponse>;
4211
4284
  };
4212
4285
  declare function isConfigLocator(value: unknown): value is ConfigLocator;
4213
4286
  type BaseTenant = {
@@ -5422,7 +5495,7 @@ declare function normalizeTenantPathNamespace(namespace?: TenantPathNamespace):
5422
5495
  declare function normalizeTenantRoutingStrategy(strategy?: TenantRoutingStrategy): TenantPathRoutingStrategy;
5423
5496
  declare function matchTenantPath(pathname: string, namespace?: TenantPathNamespace): TenantPathMatch | null;
5424
5497
  declare function buildTenantPath(id: string, restPath?: string, namespace?: TenantPathNamespace): string;
5425
- import { StandardSchemaV1 as StandardSchemaV19 } from "@standard-schema/spec";
5498
+ import { StandardSchemaV1 as StandardSchemaV110 } from "@standard-schema/spec";
5426
5499
  type RegisterSSOAppPayload = {
5427
5500
  /** Redirect URIs for the client. */
5428
5501
  redirectUris: string[];
@@ -5464,7 +5537,7 @@ type SSOAppRegistry = {
5464
5537
  register: (payload: RegisterSSOAppPayload) => Promise<RegisterSSOAppResult>;
5465
5538
  };
5466
5539
  type SSOAppValidators = {
5467
- registerSSOAppPayload: StandardSchemaV19<unknown, RegisterSSOAppPayload>;
5540
+ registerSSOAppPayload: StandardSchemaV110<unknown, RegisterSSOAppPayload>;
5468
5541
  };
5469
5542
  type RegisterIAMAppPayload = {
5470
5543
  /** App/tenant identifier (same globally unique id used by the App tenant). */
@@ -5503,7 +5576,7 @@ type IAMAppRegistry = {
5503
5576
  register: (payload: RegisterIAMAppPayload) => Promise<RegisterIAMAppResult>;
5504
5577
  };
5505
5578
  type IAMAppValidators = {
5506
- registerIAMAppPayload: StandardSchemaV19<unknown, RegisterIAMAppPayload>;
5579
+ registerIAMAppPayload: StandardSchemaV110<unknown, RegisterIAMAppPayload>;
5507
5580
  };
5508
5581
  type LfvActionName = "read_secret" | "create_secret" | "update_secret" | "delete_secret" | "request_rotate" | "request_revoke" | "rotate_secret" | "revoke_secret" | "list_paths" | "list_secrets" | "read_metadata" | "remove_path";
5509
5582
  type LfvOtpRequest = {
@@ -5536,4 +5609,4 @@ type LfvErrorResponse = {
5536
5609
  };
5537
5610
  /** Generates a ULID */
5538
5611
  declare function generateULID(prefix?: string): string;
5539
- export { workloadTokenResponseSchema, withValidate, warnLogger, waitOn, version, validationFailureResponse, userSchema, unionCatalogRead, trustedClientPermissionsForPrincipal, trimTrailingSlash, tokenResponseSchema, toCodeCatalog, stripJsonComments, stableConfigHash, silentLogger, serializeConfig, readyCatalogEntry, parseKmsPoolDocument, parseKmsAllocationPool, parseJsonc, parseEcid, oidcCallbackSchema, normalizeTenantRoutingStrategy, normalizeTenantPathNamespace, must, mergeConfig, matchTenantPath, listGenerator, list, jwtAssertionClaimsSchema, isStoreConflictError, isEcid, isConfigSourceError, isConfigLocator, isCodeCatalog, infoLogger, idTokenClaimsSchema, groupResourceSchema, generateULID, formatEcid, defineCatalog, defaultLogger, deepEqualPlain, decodeUser, debugLogger, configTrustedClientGrants, claimsToUser, buildTenantPath, assertValidSubjectTypeScoping, assertEcid, accessRootId, accessRefId, X509Certificate, WorkloadValidators, WorkloadTokenStore, WorkloadTokenResponse, WorkloadPrincipal, WorkloadIncomingOutgoing, WorkloadIdentityStore, WorkloadIdentity, WorkloadGetToken, WorkloadConfigMap, WorkloadConfig, WorkloadClient, Workload, WorkforceUser, VaultWorkloadAuthConfig, VaultWebSocketSecretsConfig, VaultWebSocketAuthHeader, VaultSecretsConfig, VaultLfvSecretsConfig, VaultConfigLocator, ValidateResult, UsersInboundHandlerConfig, UserStoreOptions, UserStore, UpdateTenantRequest, TrustedProvisioningClient, TrustedIdp, TokenValidationResult, TokenResponse, TenantWebhookPayload, TenantValidators, TenantStore, TenantStatus, TenantRoutingStrategy, TenantResponse, TenantPathRoutingStrategy, TenantPathNamespace, TenantPathMatch, TenantIonCache, TenantFactory, TenantConfigLocator, SubscriptionMode, SubjectTypeScoping, SubjectType, SubjectScope, SubjectRef, StoreConflictKind, StoreConflictError, StateCookie, StandardSchemaWithValidate, SessionStore, Session, ServerOnlyWorkloadConfig, SecretsValidators, SecretsSubscriptionOptions, SecretsSourceType, SecretsSourceMap, SecretsSourceConfig, SecretsSource, SecretsOperationOptions, SecretsModuleConfig, Secrets, SecretRequestSeverity, SecretLifecycleRequest, SecretEventName, SecretEventListener, SecretEvent, Secret, User as ScimUser, ScimServiceProviderConfig, ScimSchemaDefinition, ScimSchemaAttributeDefinition, Role2 as ScimRole, ScimResult, ScimResourceTypeSchemaExtension, ScimResourceType, ScimMutationSummary, ScimListResponse, Group2 as ScimGroup, ScimError, ScimAuthenticationScheme, SSOValidators, SSOHandlerConfig, SSOConfigFromCode, SSOConfig, SSOAppValidators, SSOAppRegistry, SSO, RoutingOptions, RouteModule, RouteFilterResult, Role, ResourceProvider, ResourceChangeListener, ResourceChange, Resource, ResolvedVaultLfvSecretsConfig, ResolvedRoute, RequireReadyResult, RemoteConfigRetryOptions, RemoteConfigRetryHook, RemoteConfigRetryContext, RemoteConfigLoadErrorKind, RemoteConfig, RegisterSSOAppResult, RegisterSSOAppPayload, RegisterSSOAppError, RegisterIAMAppResult, RegisterIAMAppPayload, RegisterIAMAppError, ReconcileReport, ReadyzEndpointConfig, ReadyAccessCatalogEntry, ReadinessReport, ReactiveHandle, Photo, PhoneNumber, Permission, ParsedEcid, PLATFORM_ASSIGNABLE_SUBJECT_TYPES, OtelSignalName, OtelSignalConfig, OtelProviderType, OtelProtocol, OtelOAuthClientCredentialsConfig, OtelMetricsSignalConfig, OtelLogRecord, OtelLogLevel, OtelLevels, OtelConfig, OtelAttributes, OtelAttributeValue, Otel, OidcCallbackParams, OaaSyncResult, OaaSyncOptions, OaaSyncInput, OaaClient, OaaAccessTargetType, OaaAccessChangeBatchItem, Name, ModuleReadinessState, ModuleReadiness, ModuleName, ModifiableFrameworkConfig, MetaData, MagicLinkStore, MagicLink, Logger, ListResult, ListOptions, ListFilter, LfvOtpResponse, LfvOtpRequest, LfvJwks, LfvErrorResponse, LfvErrorCode, LfvEd25519PublicJwk, LfvEd25519PrivateJwk, LfvCallbackTransport, LfvCallbackKind, LfvCallbackHeaders, LfvCallbackEnvelopeListener, LfvCallbackEnvelope, LfvActionRequestBase, LfvActionName, LfvActionAcceptedResponse, KmsTokenPoolDocument, KmsTokenKey, KmsPoolListener, KmsPoolKind, KmsPoolDocument, KmsPoolConfig, KmsPool, KmsKeyState, KmsConfig, KmsAllocationStrategy, KmsAllocationPoolView, KmsAllocationPoolDocument, KmsAllocationPolicy, Kms, JwtBearerWorkloadConfig, JWTAssertionClaims, IoniteValidators, IoniteUserExtension, IoniteErrorOptions, IoniteError, IoniteBase, Ionite, InMemoryTenantStoreOptions, IdentityResolution, IdTokenClaims, IamDeltaResourceType, IamDeltaReconcileResult, IamDeltaMode, IamDeltaIdMapStore, IamDeltaIdMapKey, IamDeltaEmitter, ION_TENANT_MANAGE, ION_SDK_PERMISSIONS, ION_SCIM_USER_EXTENSION_URN, ION_IAM_USERS_WRITE, ION_IAM_READ, ION_IAM_GROUPS_WRITE, ION_ENDPOINT_PERMISSIONS, ION_CIAM_MAGIC_LINK_CREATE, ION_CAPABILITIEZ_READ, ION_AUTHZ_OAA_SYNC, ION_AUTHZ_GROUP_SCHEMA, IAMValidators, IAMUsersInbound, IAMInboundUsersConfig, IAMInboundUserContext, IAMHandlerConfig, IAMGroupsOutbound, IAMGroupsInbound, IAMDiscoveryHandlerConfig, IAMDiscoveryContext, IAMDiscoveryConfig, IAMConfigFromCode, IAMConfig, IAMAppValidators, IAMAppRegistry, IAM, GroupsInboundHandlerConfig, GroupResource, GroupMember, Group, GcpSecretsConfig, GcpConfigLocator, FrameworkWorkloadIncomingOutgoing, FrameworkWorkloadConfigFromCode, FrameworkWorkloadConfig, FrameworkStores, FrameworkSecretsSourceConfig, FrameworkSecretsModuleConfig, FrameworkOtelConfig, FrameworkLfvConfig, FrameworkConfigInput, FrameworkConfig, EnvironmentType, EntityStore, EntitlementType, Entitlement, EnterpriseExtension, EndpointPermission, EndpointOperation, Email, EgressOutcome, EgressChannelOutcome, EffectiveEdge, EcidFormatError, ECID_SCHEME, DevSecretsConfig, DEFAULT_TENANT_UI_NAMESPACE, DEFAULT_TENANT_API_NAMESPACE, CustomerStoreOptions, CustomerStore, Customer, CreateUserOptions, CreateTenantRequest, CreateGroupOptions, ConfigSubscriptionOptions, ConfigSourceType, ConfigSourceResolver, ConfigSourceErrorInit, ConfigSourceError, ConfigSourceEnv, ConfigSource, ConfigLocator, ConfigErrorKind, ConfigChangeResult, ConfigChangeOptions, ConfigChangeCallback, ConfigApplyStatus, CodeCatalogNamespace, CodeCatalogInput, CodeCatalog, ClientCredentialsWorkloadConfig, ChangeListener, CatalogChangeListener, CatalogChangeKind, CatalogChange, CapabilityState, CapabilityKey, CapabilityEndpointUrls, CapabilitiezManifest, CachedWorkloadToken, CacheConfig, CIAMValidators, CIAMProviderType, CIAMProviderDescriptor, CIAMProviderConfig, CIAMProviderColors, CIAMProviderBranding, CIAMConfigFromCodeInput, CIAMConfigFromCode, CIAMConfig, CIAM, BaseWorkloadIdentity, BaseUser, BaseTenant, BaseCustomer, AzureSecretsConfig, AzureConfigLocator, AzureAuthMethod, AwsSecretsConfig, AwsConfigLocator, AuthzScimGroupType, AuthzScimGroupExtension, AuthzOaaConfig, AuthzEntityBase, AuthzDecision, AuthzConfig, Authz, AuthenticatedUser, AuthenticatedPrincipal, ApplicationValidators, Address, AccessStatus, AccessRef, AccessProvenance, AccessMutationStatus, AccessMutationResult, AccessIndex, AccessCheckTarget, AccessCheckResult, AccessCheckReason, AccessChange, AccessCatalogStore, AccessAssignmentStore };
5612
+ export { workloadTokenResponseSchema, withValidate, warnLogger, waitOn, version, validationFailureResponse, userSchema, unionCatalogRead, trustedClientPermissionsForPrincipal, trimTrailingSlash, tokenResponseSchema, toCodeCatalog, stripJsonComments, stableConfigHash, silentLogger, serializeConfig, readyCatalogEntry, parseKmsPoolDocument, parseKmsPoolControlDocument, parseJsonc, parseEcid, oidcCallbackSchema, normalizeTenantRoutingStrategy, normalizeTenantPathNamespace, must, mergeConfig, matchTenantPath, listGenerator, list, jwtAssertionClaimsSchema, isStoreConflictError, isEcid, isConfigSourceError, isConfigLocator, isCodeCatalog, infoLogger, idTokenClaimsSchema, groupResourceSchema, generateULID, formatEcid, defineSecretType, defineCatalog, defaultSecretContentType, defaultLogger, deepEqualPlain, decodeUser, debugLogger, configTrustedClientGrants, claimsToUser, buildTenantPath, assertValidSubjectTypeScoping, assertEcid, accessRootId, accessRefId, X509Certificate, WorkloadValidators, WorkloadTokenStore, WorkloadTokenResponse, WorkloadPrincipal, WorkloadIncomingOutgoing, WorkloadIdentityStore, WorkloadIdentity, WorkloadGetToken, WorkloadConfigMap, WorkloadConfig, WorkloadClient, Workload, WorkforceUser, VaultWorkloadAuthConfig, VaultWebSocketSecretsConfig, VaultWebSocketAuthHeader, VaultSecretsConfig, VaultLfvSecretsConfig, VaultConfigLocator, ValidateResult, UsersInboundHandlerConfig, UserStoreOptions, UserStore, UpdateTenantRequest, TrustedProvisioningClient, TrustedIdp, TokenValidationResult, TokenResponse, TenantWebhookPayload, TenantValidators, TenantStore, TenantStatus, TenantRoutingStrategy, TenantResponse, TenantPathRoutingStrategy, TenantPathNamespace, TenantPathMatch, TenantIonCache, TenantFactory, TenantConfigLocator, SubscriptionMode, SubjectTypeScoping, SubjectType, SubjectScope, SubjectRef, StoreConflictKind, StoreConflictError, StateCookie, StandardSchemaWithValidate, SessionStore, Session, ServerOnlyWorkloadConfig, SecretsWriteOptions, SecretsValidators, SecretsSubscriptionOptions, SecretsSourceType, SecretsSourceMap, SecretsSourceConfig, SecretsSource, SecretsOperationOptions, SecretsModuleConfig, Secrets, SecretTypeRegistryEntry, SecretTypeInput, SecretTypeDescriptor, SecretRequestSeverity, SecretLifecycleRequest, SecretHandle, SecretFormat, SecretEventName, SecretEventListener, SecretEvent, SecretContentTypeMismatchError, SecretContentType, Secret, User as ScimUser, ScimServiceProviderConfig, ScimSchemaDefinition, ScimSchemaAttributeDefinition, Role2 as ScimRole, ScimResult, ScimResourceTypeSchemaExtension, ScimResourceType, ScimMutationSummary, ScimListResponse, Group2 as ScimGroup, ScimError, ScimAuthenticationScheme, SSOValidators, SSOHandlerConfig, SSOConfigFromCode, SSOConfig, SSOAppValidators, SSOAppRegistry, SSO, RoutingOptions, RouteModule, RouteFilterResult, Role, ResourceProvider, ResourceChangeListener, ResourceChange, Resource, ResolvedVaultLfvSecretsConfig, ResolvedRoute, RequireReadyResult, RemoteConfigRetryOptions, RemoteConfigRetryHook, RemoteConfigRetryContext, RemoteConfigLoadErrorKind, RemoteConfig, RegisterSSOAppResult, RegisterSSOAppPayload, RegisterSSOAppError, RegisterIAMAppResult, RegisterIAMAppPayload, RegisterIAMAppError, ReconcileReport, ReadyzEndpointConfig, ReadyAccessCatalogEntry, ReadinessReport, ReactiveHandle, Photo, PhoneNumber, Permission, ParsedEcid, PLATFORM_ASSIGNABLE_SUBJECT_TYPES, OtelSignalName, OtelSignalConfig, OtelProviderType, OtelProtocol, OtelOAuthClientCredentialsConfig, OtelMetricsSignalConfig, OtelLogRecord, OtelLogLevel, OtelLevels, OtelConfig, OtelAttributes, OtelAttributeValue, Otel, OidcCallbackParams, OaaSyncResult, OaaSyncOptions, OaaSyncInput, OaaClient, OaaAccessTargetType, OaaAccessChangeBatchItem, Name, ModuleReadinessState, ModuleReadiness, ModuleName, ModifiableFrameworkConfig, MetaData, MagicLinkStore, MagicLink, Logger, ListResult, ListOptions, ListFilter, LfvOtpResponse, LfvOtpRequest, LfvJwks, LfvErrorResponse, LfvErrorCode, LfvEd25519PublicJwk, LfvEd25519PrivateJwk, LfvCallbackTransport, LfvCallbackKind, LfvCallbackHeaders, LfvCallbackEnvelopeListener, LfvCallbackEnvelope, LfvActionRequestBase, LfvActionName, LfvActionAcceptedResponse, KmsPoolListener, KmsPoolDocument, KmsPoolControlDocument, KmsPoolConfig, KmsPool, KmsKeyState, KmsKey, KmsConfig, KmsAllocationStrategy, KmsAllocationPolicy, Kms, JwtBearerWorkloadConfig, JWTAssertionClaims, IoniteValidators, IoniteUserExtension, IoniteErrorOptions, IoniteError, IoniteBase, Ionite, InferSecretType, InMemoryTenantStoreOptions, IdentityResolution, IdTokenClaims, IamDeltaResourceType, IamDeltaReconcileResult, IamDeltaMode, IamDeltaIdMapStore, IamDeltaIdMapKey, IamDeltaEmitter, ION_TENANT_MANAGE, ION_SDK_PERMISSIONS, ION_SCIM_USER_EXTENSION_URN, ION_IAM_USERS_WRITE, ION_IAM_READ, ION_IAM_GROUPS_WRITE, ION_ENDPOINT_PERMISSIONS, ION_CIAM_MAGIC_LINK_CREATE, ION_CAPABILITIEZ_READ, ION_AUTHZ_OAA_SYNC, ION_AUTHZ_GROUP_SCHEMA, IAMValidators, IAMUsersInbound, IAMInboundUsersConfig, IAMInboundUserContext, IAMHandlerConfig, IAMGroupsOutbound, IAMGroupsInbound, IAMDiscoveryHandlerConfig, IAMDiscoveryContext, IAMDiscoveryConfig, IAMConfigFromCode, IAMConfig, IAMAppValidators, IAMAppRegistry, IAM, GroupsInboundHandlerConfig, GroupResource, GroupMember, Group, GcpSecretsConfig, GcpConfigLocator, FrameworkWorkloadIncomingOutgoing, FrameworkWorkloadConfigFromCode, FrameworkWorkloadConfig, FrameworkStores, FrameworkSecretsSourceConfig, FrameworkSecretsModuleConfig, FrameworkOtelConfig, FrameworkLfvConfig, FrameworkConfigInput, FrameworkConfig, EnvironmentType, EntityStore, EntitlementType, Entitlement, EnterpriseExtension, EndpointPermission, EndpointOperation, Email, EgressOutcome, EgressChannelOutcome, EffectiveEdge, EcidFormatError, ECID_SCHEME, DevSecretsConfig, DEFAULT_TENANT_UI_NAMESPACE, DEFAULT_TENANT_API_NAMESPACE, DEFAULT_SECRET_MIME_TYPES, CustomerStoreOptions, CustomerStore, Customer, CreateUserOptions, CreateTenantRequest, CreateGroupOptions, ConfigSubscriptionOptions, ConfigSourceType, ConfigSourceResolver, ConfigSourceErrorInit, ConfigSourceError, ConfigSourceEnv, ConfigSource, ConfigLocator, ConfigErrorKind, ConfigChangeResult, ConfigChangeOptions, ConfigChangeCallback, ConfigApplyStatus, CodeCatalogNamespace, CodeCatalogInput, CodeCatalog, ClientCredentialsWorkloadConfig, ChangeListener, CatalogChangeListener, CatalogChangeKind, CatalogChange, CapabilityState, CapabilityKey, CapabilityEndpointUrls, CapabilitiezManifest, CachedWorkloadToken, CacheConfig, CIAMValidators, CIAMProviderType, CIAMProviderDescriptor, CIAMProviderConfig, CIAMProviderColors, CIAMProviderBranding, CIAMConfigFromCodeInput, CIAMConfigFromCode, CIAMConfig, CIAM, BaseWorkloadIdentity, BaseUser, BaseTenant, BaseCustomer, AzureSecretsConfig, AzureConfigLocator, AzureAuthMethod, AwsSecretsConfig, AwsConfigLocator, AuthzScimGroupType, AuthzScimGroupExtension, AuthzOaaConfig, AuthzEntityBase, AuthzDecision, AuthzConfig, Authz, AuthenticatedUser, AuthenticatedPrincipal, ApplicationValidators, Address, AccessStatus, AccessRef, AccessProvenance, AccessMutationStatus, AccessMutationResult, AccessIndex, AccessCheckTarget, AccessCheckResult, AccessCheckReason, AccessChange, AccessCatalogStore, AccessAssignmentStore };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{A as K0,B as b0,C as T0,D as L0,E as R0,F as N0,G as A0,H as _0,I as I0,J as f0,K as O0,L as v0,M as k0,N as w0,Q as y0,R as g0,S as h0,T as p0,U as m0,V as c0,a as $0,b as J0,c as V0,d as B0,e as Z0,f as F0,l as G0,m as H0,n as U0,o as q0,p as j0,q as Y0,r as z0,s as M0,t as C0,u as W0,v as D0,w as E0,x as P0,y as x0,z as S0}from"./shared/core-f0gk15rd.js";var A="0.0.23-beta.20260812.6";class z extends Error{kind;recoverable;code;status;path;sourceType;constructor(X,$){super(X,$.cause!==void 0?{cause:$.cause}:void 0);this.name="ConfigSourceError",this.kind=$.kind,this.recoverable=$.recoverable,this.code=$.code,this.status=$.status,this.path=$.path,this.sourceType=$.sourceType,Object.setPrototypeOf(this,z.prototype)}}function _(X){return X instanceof z}var q=["workload"],M={id:"ion:iam:read",name:"Read Identities (SCIM)",description:"Authorizes a workload to list and read Users and Groups via the SCIM endpoints.",requestable:!1,permissionTypes:["DataRead"],assignableSubjectTypes:q,recommendedSubjectTypes:q},C={id:"ion:iam:users:write",name:"Manage Identities (SCIM Users)",description:"Authorizes a workload to create, replace, modify (including attribute changes), and delete Users via SCIM, including access-root revocation on user delete.",requestable:!1,permissionTypes:["DataCreate","DataWrite","DataDelete"],assignableSubjectTypes:q,recommendedSubjectTypes:q},W={id:"ion:iam:groups:write",name:"Manage Groups & Access (SCIM Groups)",description:"Authorizes a workload to create, replace, modify, and delete Groups via SCIM, including membership changes that grant or revoke entitlements.",requestable:!1,permissionTypes:["DataCreate","DataWrite","DataDelete"],assignableSubjectTypes:q,recommendedSubjectTypes:q},D={id:"ion:capabilitiez:read",name:"Read Capability Manifest",description:"Authorizes a workload to read the capability manifest at the capabilitiez endpoint (only when RemoteConfig.capabilitiez is enabled).",requestable:!1,permissionTypes:["DataRead"],assignableSubjectTypes:q,recommendedSubjectTypes:q},E={id:"ion:ciam:magic-link:create",name:"Issue CIAM Magic Links",description:"Authorizes a caller to mint customer magic-link login credentials via the magic-link endpoint. Grant narrowly.",requestable:!1,permissionTypes:["DataCreate"],assignableSubjectTypes:["workload","user"],recommendedSubjectTypes:q},P={id:"ion:authz:oaa:sync",name:"Trigger OAA Full Sync",description:"Authorizes a workload (Ops/ECI client) to trigger a full OAA reconcile via the authz OAA sync endpoint (only when RemoteConfig.authz.oaa.fullSync.enabled is true).",requestable:!1,permissionTypes:["DataWrite"],assignableSubjectTypes:q,recommendedSubjectTypes:q},x={id:"ion:tenant:manage",name:"Manage Tenants",description:"Authorizes a workload (ECI/TMS client) to create, read, update, and delete tenant records via the tenant-management endpoints.",requestable:!1,permissionTypes:["DataCreate","DataRead","DataWrite","DataDelete"],assignableSubjectTypes:q,recommendedSubjectTypes:q},I=[M,C,W,D,E,P,x],f={"iam.read":{permission:M,subjectType:["workload"]},"iam.users.write":{permission:C,subjectType:["workload"]},"iam.groups.write":{permission:W,subjectType:["workload"]},"capabilitiez.read":{permission:D,subjectType:["workload"]},"ciam.magic-link.create":{permission:E,subjectType:["workload","user"]},"authz.oaa.sync":{permission:P,subjectType:["workload"]},"tenant.manage":{permission:x,subjectType:["workload"]}};var O=["sessionStore","userStore","customerStore","accessStore","tokenStore","magicLinkStore"];function S(X){if(X===null||typeof X!=="object")return X;let $={};for(let[Q,J]of Object.entries(X)){if(O.includes(Q)||Q==="validators"||Q==="setStores")continue;$[Q]=J!==null&&typeof J==="object"&&!Array.isArray(J)&&Object.getPrototypeOf(J)===Object.prototype?S(J):J}return $}function v(X){return S(X)}function j(X,$){if(!X||typeof X!=="object"||Array.isArray(X))throw Error(`${$} must be an object.`);return X}function K(X,$){if(X===void 0)return;if(typeof X!=="string"||X.length===0||!Number.isFinite(Date.parse(X)))throw Error(`${$} must be a valid timestamp string.`);return X}function b(X,$,Q){if(!Array.isArray(X)||!Q.allowEmpty&&X.length===0)throw Error(`${$} keys must be ${Q.allowEmpty?"an":"a non-empty"} array.`);let J=new Set;return X.map((Z,F)=>{let B=j(Z,`${$} keys[${F}]`);if(typeof B.id!=="string"||B.id.length===0)throw Error(`${$} keys[${F}].id must be a non-empty string.`);if(J.has(B.id))throw Error(`${$} contains duplicate key id "${B.id}".`);if(J.add(B.id),!["pending","active","deprecated","revoked"].includes(String(B.state)))throw Error(`${$} keys[${F}].state is invalid.`);if(B.value!==void 0&&(typeof B.value!=="string"||B.value.length===0))throw Error(`${$} keys[${F}].value must be a non-empty string when present.`);let U=B.meta===void 0?void 0:j(B.meta,`${$} keys[${F}].meta`);return{id:B.id,state:B.state,...B.value===void 0?{}:{value:B.value},...B.notBefore===void 0?{}:{notBefore:K(B.notBefore,`${$} keys[${F}].notBefore`)},...B.notAfter===void 0?{}:{notAfter:K(B.notAfter,`${$} keys[${F}].notAfter`)},...U?{meta:{...U}}:{}}})}function k(X,$){let Q=`KMS ${$} pool`,J=j(X,Q);if(J.kind!==$)throw Error(`${Q} kind must be "${$}".`);if(typeof J.active!=="string"||J.active.length===0)throw Error(`${Q} active must be a non-empty key id.`);let Z=b(J.keys,Q,{allowEmpty:!1}),F=Z.find((B)=>B.id===J.active);if(!F)throw Error(`${Q} active key "${J.active}" is not present in keys.`);if(F.state!=="active")throw Error(`${Q} active key "${J.active}" must have state "active".`);if(!F.value)throw Error(`${Q} active key "${J.active}" must include a value.`);return{kind:$,active:J.active,keys:Z}}function w(X,$="token"){return k(X,$)}function y(X){let Q=j(X,"KMS allocation pool");if(Q.kind!=="allocation")throw Error('KMS allocation pool kind must be "allocation".');let J=b(Q.keys,"KMS allocation pool",{allowEmpty:!0}),Z=j(Q.assignments,"KMS allocation pool assignments"),F={},B=new Map(J.map((V)=>[V.id,V]));for(let[V,H]of Object.entries(Z)){if(V.length===0||typeof H!=="string"||H.length===0)throw Error("KMS allocation pool assignments must map non-empty client ids to non-empty key ids.");let G=B.get(H);if(!G)throw Error(`KMS allocation pool assignment for "${V}" references missing key "${H}".`);if(G.state!=="active"||!G.value)throw Error(`KMS allocation pool assignment for "${V}" must reference an active key with a value.`);F[V]=H}let U;if(Q.policy!==void 0){let V=j(Q.policy,"KMS allocation pool policy"),H=V.strategy;if(H!==void 0&&H!=="spread"&&H!=="low-quota-first")throw Error("KMS allocation pool policy.strategy is invalid.");let G=V.maxHoldersPerKey;if(G!==void 0&&(typeof G!=="number"||!Number.isInteger(G)||G<=0))throw Error("KMS allocation pool policy.maxHoldersPerKey must be a positive integer when present.");U={...H?{strategy:H}:{},...G===void 0?{}:{maxHoldersPerKey:G}}}return{kind:"allocation",keys:J,assignments:F,...U?{policy:U}:{}}}var T={trace:()=>{},debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},g=T,h={trace:()=>{},debug:console.debug,info:console.info,warn:console.warn,error:console.error},p={trace:()=>{},debug:()=>{},info:console.info,warn:console.warn,error:console.error},m={trace:()=>{},debug:()=>{},info:()=>{},warn:console.warn,error:console.error};function c(X,$){if(typeof $!=="number"||$<=0)return X;return new Promise((Q,J)=>{let Z=setTimeout(()=>{J(Error(`Authz catalog entry did not become ready within ${$}ms`))},$);X.then(()=>{clearTimeout(Z),Q()},(F)=>{clearTimeout(Z),J(F)})})}function u(X,$){let Q=!1,J,Z=$.then(()=>{Q=!0},(B)=>{Q=!1,J=B}),F=X;return Object.defineProperty(F,"ready",{enumerable:!1,configurable:!0,value:(B)=>c(Z.then(()=>{if(!Q)throw J}),B)}),Object.defineProperty(F,"isReady",{enumerable:!1,configurable:!0,value:()=>Q}),F}var d={beforeTenantSegments:["ui"]},l={beforeTenantSegments:["api"]};function L(X){return(X??[]).map(($)=>$.trim()).filter(Boolean)}function n(X){let $=X.trim();if(!$)return"/";let Q=$.replace(/\\/g,"/").replace(/\/+/g,"/");return Q.startsWith("/")?Q:`/${Q}`}function R(X){return n(X).split("/").filter(Boolean)}function Y(X){return{beforeTenantSegments:L(X?.beforeTenantSegments),afterTenantSegments:L(X?.afterTenantSegments)}}function a(X){return{type:"path",ui:Y(X?.ui),api:Y(X?.api)}}function i(X,$){let Q=Y($),J=Q.beforeTenantSegments??[],Z=Q.afterTenantSegments??[],F=R(X),B=J.length+1+Z.length;if(F.length<B)return null;for(let G=0;G<J.length;G++)if(F[G]!==J[G])return null;let U=J.length,V=F[U];if(!V)return null;for(let G=0;G<Z.length;G++)if(F[U+1+G]!==Z[G])return null;let H=F.slice(U+1+Z.length);return{id:decodeURIComponent(V),restSegments:H,restPath:H.length>0?`/${H.join("/")}`:"/"}}function o(X,$="/",Q){let J=Y(Q),Z=J.beforeTenantSegments??[],F=J.afterTenantSegments??[],B=R($),U=[...Z,encodeURIComponent(X),...F,...B];return U.length>0?`/${U.join("/")}`:"/"}function r(X){return{"~standard":{version:1,vendor:X,validate:($)=>{if(typeof $!=="object"||$===null)return{issues:[{message:"Expected an object"}]};let Q=$,J=[],Z={...Q},F=["iss","sub"];for(let V of F)if(V in Q){if(typeof Q[V]!=="string")J.push({message:`${V} must be a string`,path:[V]})}else J.push({message:`${V} is required`,path:[V]});if("aud"in Q&&Q.aud!==void 0){let V=Q.aud;if(typeof V!=="string"&&!Array.isArray(V))J.push({message:"aud must be a string or array of strings",path:["aud"]});else if(Array.isArray(V)&&!V.every((H)=>typeof H==="string"))J.push({message:"aud array must contain only strings",path:["aud"]})}let B=["jti","scope"];for(let V of B)if(V in Q&&Q[V]!==void 0){if(typeof Q[V]!=="string")J.push({message:`${V} must be a string`,path:[V]})}let U=["exp","iat"];for(let V of U)if(V in Q){if(typeof Q[V]!=="number")J.push({message:`${V} must be a number`,path:[V]})}else J.push({message:`${V} is required`,path:[V]});if(J.length>0)return{issues:J};return{value:Z}}}}}function t(X){return{"~standard":{version:1,vendor:X,validate:($)=>{if(typeof $!=="object"||$===null)return{issues:[{message:"Expected an object"}]};let Q=$,J=[],Z={};if("access_token"in Q)if(typeof Q.access_token==="string")Z.access_token=Q.access_token;else J.push({message:"access_token must be a string",path:["access_token"]});else J.push({message:"access_token is required",path:["access_token"]});if("token_type"in Q)if(typeof Q.token_type==="string")Z.token_type=Q.token_type;else J.push({message:"token_type must be a string",path:["token_type"]});else J.push({message:"token_type is required",path:["token_type"]});if("scope"in Q)if(typeof Q.scope==="string"||Q.scope===void 0)Z.scope=Q.scope;else J.push({message:"scope must be a string",path:["scope"]});if("refresh_token"in Q)if(typeof Q.refresh_token==="string"||Q.refresh_token===void 0)Z.refresh_token=Q.refresh_token;else J.push({message:"refresh_token must be a string",path:["refresh_token"]});if("expires"in Q)if(typeof Q.expires==="string"||Q.expires===void 0)Z.expires=Q.expires;else J.push({message:"expires must be a string",path:["expires"]});if("expires_in"in Q)if(typeof Q.expires_in==="number"||Q.expires_in===void 0)Z.expires_in=Q.expires_in;else J.push({message:"expires_in must be a number",path:["expires_in"]});if(J.length>0)return{issues:J};return{value:Z}}}}}function s(X){let $=new Uint8Array(X);return crypto.getRandomValues($),$}function e(X){let $="",Q=s(X);for(let J=0;J<X;J++){let Z=Q[J]%32;$+="0123456789ABCDEFGHJKMNPQRSTVWXYZ".charAt(Z)}return $}function Q0(X,$){let Q="";for(let J=$;J>0;J--){let Z=X%32;Q="0123456789ABCDEFGHJKMNPQRSTVWXYZ".charAt(Z)+Q,X=Math.floor(X/32)}return Q}function X0(X){let $=Date.now(),Q=Q0($,10),J=e(16);return`${X??""}${Q}${J}`}export{t as workloadTokenResponseSchema,x0 as withValidate,m as warnLogger,_0 as waitOn,A as version,K0 as validationFailureResponse,m0 as userSchema,q0 as unionCatalogRead,$0 as trustedClientPermissionsForPrincipal,R0 as trimTrailingSlash,E0 as tokenResponseSchema,H0 as toCodeCatalog,T0 as stripJsonComments,A0 as stableConfigHash,T as silentLogger,v as serializeConfig,u as readyCatalogEntry,w as parseKmsPoolDocument,y as parseKmsAllocationPool,L0 as parseJsonc,C0 as parseEcid,D0 as oidcCallbackSchema,a as normalizeTenantRoutingStrategy,Y as normalizeTenantPathNamespace,S0 as must,b0 as mergeConfig,i as matchTenantPath,B0 as listGenerator,V0 as list,r as jwtAssertionClaimsSchema,v0 as isStoreConflictError,z0 as isEcid,_ as isConfigSourceError,w0 as isConfigLocator,G0 as isCodeCatalog,p as infoLogger,P0 as idTokenClaimsSchema,c0 as groupResourceSchema,X0 as generateULID,M0 as formatEcid,U0 as defineCatalog,g as defaultLogger,N0 as deepEqualPlain,f0 as decodeUser,h as debugLogger,J0 as configTrustedClientGrants,I0 as claimsToUser,o as buildTenantPath,h0 as assertValidSubjectTypeScoping,W0 as assertEcid,F0 as accessRootId,Z0 as accessRefId,O0 as StoreConflictError,g0 as PLATFORM_ASSIGNABLE_SUBJECT_TYPES,k0 as IoniteError,x as ION_TENANT_MANAGE,I as ION_SDK_PERMISSIONS,p0 as ION_SCIM_USER_EXTENSION_URN,C as ION_IAM_USERS_WRITE,M as ION_IAM_READ,W as ION_IAM_GROUPS_WRITE,f as ION_ENDPOINT_PERMISSIONS,E as ION_CIAM_MAGIC_LINK_CREATE,D as ION_CAPABILITIEZ_READ,P as ION_AUTHZ_OAA_SYNC,y0 as ION_AUTHZ_GROUP_SCHEMA,Y0 as EcidFormatError,j0 as ECID_SCHEME,d as DEFAULT_TENANT_UI_NAMESPACE,l as DEFAULT_TENANT_API_NAMESPACE,z as ConfigSourceError};
1
+ import{A as A0,B as T0,C as _0,D as I0,E as O0,F as f0,G as w0,H as k0,I as v0,J as g0,K as y0,L as h0,M as m0,N as c0,Q as d0,R as p0,S as u0,T as l0,U as n0,V as a0,a as F0,b as G0,c as H0,d as U0,e as j0,f as q0,l as z0,m as Y0,n as W0,o as C0,p as M0,q as D0,r as K0,s as P0,t as E0,u as x0,v as b0,w as S0,x as L0,y as R0,z as N0}from"./shared/core-ymmjvtpm.js";var O="0.0.23-beta.20260814.1";class W extends Error{kind;recoverable;code;status;path;sourceType;constructor(Q,$){super(Q,$.cause!==void 0?{cause:$.cause}:void 0);this.name="ConfigSourceError",this.kind=$.kind,this.recoverable=$.recoverable,this.code=$.code,this.status=$.status,this.path=$.path,this.sourceType=$.sourceType,Object.setPrototypeOf(this,W.prototype)}}function f(Q){return Q instanceof W}var j=["workload"],C={id:"ion:iam:read",name:"Read Identities (SCIM)",description:"Authorizes a workload to list and read Users and Groups via the SCIM endpoints.",requestable:!1,permissionTypes:["DataRead"],assignableSubjectTypes:j,recommendedSubjectTypes:j},M={id:"ion:iam:users:write",name:"Manage Identities (SCIM Users)",description:"Authorizes a workload to create, replace, modify (including attribute changes), and delete Users via SCIM, including access-root revocation on user delete.",requestable:!1,permissionTypes:["DataCreate","DataWrite","DataDelete"],assignableSubjectTypes:j,recommendedSubjectTypes:j},D={id:"ion:iam:groups:write",name:"Manage Groups & Access (SCIM Groups)",description:"Authorizes a workload to create, replace, modify, and delete Groups via SCIM, including membership changes that grant or revoke entitlements.",requestable:!1,permissionTypes:["DataCreate","DataWrite","DataDelete"],assignableSubjectTypes:j,recommendedSubjectTypes:j},K={id:"ion:capabilitiez:read",name:"Read Capability Manifest",description:"Authorizes a workload to read the capability manifest at the capabilitiez endpoint (only when RemoteConfig.capabilitiez is enabled).",requestable:!1,permissionTypes:["DataRead"],assignableSubjectTypes:j,recommendedSubjectTypes:j},P={id:"ion:ciam:magic-link:create",name:"Issue CIAM Magic Links",description:"Authorizes a caller to mint customer magic-link login credentials via the magic-link endpoint. Grant narrowly.",requestable:!1,permissionTypes:["DataCreate"],assignableSubjectTypes:["workload","user"],recommendedSubjectTypes:j},E={id:"ion:authz:oaa:sync",name:"Trigger OAA Full Sync",description:"Authorizes a workload (Ops/ECI client) to trigger a full OAA reconcile via the authz OAA sync endpoint (only when RemoteConfig.authz.oaa.fullSync.enabled is true).",requestable:!1,permissionTypes:["DataWrite"],assignableSubjectTypes:j,recommendedSubjectTypes:j},x={id:"ion:tenant:manage",name:"Manage Tenants",description:"Authorizes a workload (ECI/TMS client) to create, read, update, and delete tenant records via the tenant-management endpoints.",requestable:!1,permissionTypes:["DataCreate","DataRead","DataWrite","DataDelete"],assignableSubjectTypes:j,recommendedSubjectTypes:j},w=[C,M,D,K,P,E,x],k={"iam.read":{permission:C,subjectType:["workload"]},"iam.users.write":{permission:M,subjectType:["workload"]},"iam.groups.write":{permission:D,subjectType:["workload"]},"capabilitiez.read":{permission:K,subjectType:["workload"]},"ciam.magic-link.create":{permission:P,subjectType:["workload","user"]},"authz.oaa.sync":{permission:E,subjectType:["workload"]},"tenant.manage":{permission:x,subjectType:["workload"]}};var v=["sessionStore","userStore","customerStore","accessStore","tokenStore","magicLinkStore"];function L(Q){if(Q===null||typeof Q!=="object")return Q;let $={};for(let[X,J]of Object.entries(Q)){if(v.includes(X)||X==="validators"||X==="setStores")continue;$[X]=J!==null&&typeof J==="object"&&!Array.isArray(J)&&Object.getPrototypeOf(J)===Object.prototype?L(J):J}return $}function g(Q){return L(Q)}function z(Q,$){if(!Q||typeof Q!=="object"||Array.isArray(Q))throw Error(`${$} must be an object.`);return Q}function q(Q,$){if(Q===void 0)return;if(typeof Q!=="string"||Q.length===0||!Number.isFinite(Date.parse(Q)))throw Error(`${$} must be a valid timestamp string.`);return Q}function R(Q,$,X){if(!Array.isArray(Q)||!X.allowEmpty&&Q.length===0)throw Error(`${$} keys must be ${X.allowEmpty?"an":"a non-empty"} array.`);let J=new Set;return Q.map((Z,F)=>{let V=z(Z,`${$} keys[${F}]`);if(typeof V.id!=="string"||V.id.length===0)throw Error(`${$} keys[${F}].id must be a non-empty string.`);if(J.has(V.id))throw Error(`${$} contains duplicate key id "${V.id}".`);if(J.add(V.id),!["pending","active","deprecated","rotated","revoked"].includes(String(V.state)))throw Error(`${$} keys[${F}].state is invalid.`);if(V.value!==void 0&&(typeof V.value!=="string"||V.value.length===0))throw Error(`${$} keys[${F}].value must be a non-empty string when present.`);let U=V.meta===void 0?void 0:z(V.meta,`${$} keys[${F}].meta`);return{id:V.id,state:V.state,...V.value===void 0?{}:{value:V.value},...V.notBefore===void 0?{}:{notBefore:q(V.notBefore,`${$} keys[${F}].notBefore`)},...V.notAfter===void 0?{}:{notAfter:q(V.notAfter,`${$} keys[${F}].notAfter`)},...V.createdAt===void 0?{}:{createdAt:q(V.createdAt,`${$} keys[${F}].createdAt`)},...V.activatedAt===void 0?{}:{activatedAt:q(V.activatedAt,`${$} keys[${F}].activatedAt`)},...V.deprecatedAt===void 0?{}:{deprecatedAt:q(V.deprecatedAt,`${$} keys[${F}].deprecatedAt`)},...V.rotatedAt===void 0?{}:{rotatedAt:q(V.rotatedAt,`${$} keys[${F}].rotatedAt`)},...V.revokedAt===void 0?{}:{revokedAt:q(V.revokedAt,`${$} keys[${F}].revokedAt`)},...U?{meta:{...U}}:{}}})}function y(Q,$){if(Q===void 0)return;if(typeof Q!=="number"||!Number.isInteger(Q)||Q<0)throw Error(`${$} must be a non-negative integer when present.`);return Q}function h(Q){let X=z(Q,"KMS pool");if(X.kind!=="kms")throw Error('KMS pool kind must be "kms".');let J=R(X.keys,"KMS pool",{allowEmpty:!0});if(J.length===0){if(X.active!==void 0)throw Error("KMS pool active must be omitted when keys is empty.");return{kind:"kms",keys:J}}if(typeof X.active!=="string"||X.active.length===0)throw Error("KMS pool active must be a non-empty key id when keys are present.");let Z=J.find((F)=>F.id===X.active);if(!Z)throw Error(`KMS pool active key "${X.active}" is not present in keys.`);if(Z.state!=="active")throw Error(`KMS pool active key "${X.active}" must have state "active".`);if(!Z.value)throw Error(`KMS pool active key "${X.active}" must include a value.`);return{kind:"kms",active:X.active,keys:J}}function m(Q){let X=z(Q,"KMS pool control document");if(X.kind!=="kms")throw Error('KMS pool control document kind must be "kms".');let J=R(X.keys,"KMS pool control document",{allowEmpty:!0}),Z=z(X.assignments,"KMS pool control document assignments"),F={},V=new Map(J.map((B)=>[B.id,B]));for(let[B,H]of Object.entries(Z)){if(B.length===0||typeof H!=="string"||H.length===0)throw Error("KMS pool control document assignments must map non-empty client ids to non-empty key ids.");let G=V.get(H);if(!G)throw Error(`KMS pool control document assignment for "${B}" references missing key "${H}".`);if(G.state!=="active"||!G.value)throw Error(`KMS pool control document assignment for "${B}" must reference an active key with a value.`);F[B]=H}let U;if(X.policy!==void 0){let B=z(X.policy,"KMS pool control document policy"),H=B.strategy;if(H!==void 0&&H!=="spread"&&H!=="low-quota-first")throw Error("KMS pool control document policy.strategy is invalid.");let G=B.maxHoldersPerKey;if(G!==void 0&&(typeof G!=="number"||!Number.isInteger(G)||G<=0))throw Error("KMS pool control document policy.maxHoldersPerKey must be a positive integer when present.");let S=y(B.overlapSeconds,"KMS pool control document policy.overlapSeconds");U={...H?{strategy:H}:{},...G===void 0?{}:{maxHoldersPerKey:G},...S===void 0?{}:{overlapSeconds:S}}}if(X.rotation!==void 0)throw Error("KMS pool control document rotation is no longer supported; use policy.overlapSeconds.");return{kind:"kms",keys:J,assignments:F,...U?{policy:U}:{}}}var N={trace:()=>{},debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},c=N,d={trace:()=>{},debug:console.debug,info:console.info,warn:console.warn,error:console.error},p={trace:()=>{},debug:()=>{},info:console.info,warn:console.warn,error:console.error},u={trace:()=>{},debug:()=>{},info:()=>{},warn:console.warn,error:console.error};function l(Q,$){if(typeof $!=="number"||$<=0)return Q;return new Promise((X,J)=>{let Z=setTimeout(()=>{J(Error(`Authz catalog entry did not become ready within ${$}ms`))},$);Q.then(()=>{clearTimeout(Z),X()},(F)=>{clearTimeout(Z),J(F)})})}function n(Q,$){let X=!1,J,Z=$.then(()=>{X=!0},(V)=>{X=!1,J=V}),F=Q;return Object.defineProperty(F,"ready",{enumerable:!1,configurable:!0,value:(V)=>l(Z.then(()=>{if(!X)throw J}),V)}),Object.defineProperty(F,"isReady",{enumerable:!1,configurable:!0,value:()=>X}),F}var b=Object.freeze({jsonc:"application/json",env:"text/x-dotenv",text:"text/plain",binary:"application/octet-stream",yaml:"application/yaml",toml:"application/toml",xml:"application/xml"});function a(Q){if(!Q.id.trim())throw Error("defineSecretType: id is required");let $=Q.mimeType?.trim()||b[Q.format],X=Object.freeze({id:Q.id,...Q.label?{label:Q.label}:{},format:Q.format,mimeType:$,...Q.schemaUrl?{schemaUrl:Q.schemaUrl}:{},typeId:Q.id});return Object.freeze({id:Q.id,...Q.label?{label:Q.label}:{},format:Q.format,mimeType:$,...Q.schemaUrl?{schemaUrl:Q.schemaUrl}:{},...Q.schema?{schema:Q.schema}:{},toRegistryEntry:()=>X})}function o(Q="jsonc"){return{format:Q,mimeType:b[Q]}}class A extends Error{expected;received;constructor(Q,$){super(`Secret content type mismatch: expected "${Q.mimeType}" (${Q.format}) but received "${$.mimeType}" (${$.format})`);this.name="SecretContentTypeMismatchError",this.expected=Q,this.received=$}}var i={beforeTenantSegments:["ui"]},s={beforeTenantSegments:["api"]};function T(Q){return(Q??[]).map(($)=>$.trim()).filter(Boolean)}function r(Q){let $=Q.trim();if(!$)return"/";let X=$.replace(/\\/g,"/").replace(/\/+/g,"/");return X.startsWith("/")?X:`/${X}`}function _(Q){return r(Q).split("/").filter(Boolean)}function Y(Q){return{beforeTenantSegments:T(Q?.beforeTenantSegments),afterTenantSegments:T(Q?.afterTenantSegments)}}function t(Q){return{type:"path",ui:Y(Q?.ui),api:Y(Q?.api)}}function e(Q,$){let X=Y($),J=X.beforeTenantSegments??[],Z=X.afterTenantSegments??[],F=_(Q),V=J.length+1+Z.length;if(F.length<V)return null;for(let G=0;G<J.length;G++)if(F[G]!==J[G])return null;let U=J.length,B=F[U];if(!B)return null;for(let G=0;G<Z.length;G++)if(F[U+1+G]!==Z[G])return null;let H=F.slice(U+1+Z.length);return{id:decodeURIComponent(B),restSegments:H,restPath:H.length>0?`/${H.join("/")}`:"/"}}function Q0(Q,$="/",X){let J=Y(X),Z=J.beforeTenantSegments??[],F=J.afterTenantSegments??[],V=_($),U=[...Z,encodeURIComponent(Q),...F,...V];return U.length>0?`/${U.join("/")}`:"/"}function X0(Q){return{"~standard":{version:1,vendor:Q,validate:($)=>{if(typeof $!=="object"||$===null)return{issues:[{message:"Expected an object"}]};let X=$,J=[],Z={...X},F=["iss","sub"];for(let B of F)if(B in X){if(typeof X[B]!=="string")J.push({message:`${B} must be a string`,path:[B]})}else J.push({message:`${B} is required`,path:[B]});if("aud"in X&&X.aud!==void 0){let B=X.aud;if(typeof B!=="string"&&!Array.isArray(B))J.push({message:"aud must be a string or array of strings",path:["aud"]});else if(Array.isArray(B)&&!B.every((H)=>typeof H==="string"))J.push({message:"aud array must contain only strings",path:["aud"]})}let V=["jti","scope"];for(let B of V)if(B in X&&X[B]!==void 0){if(typeof X[B]!=="string")J.push({message:`${B} must be a string`,path:[B]})}let U=["exp","iat"];for(let B of U)if(B in X){if(typeof X[B]!=="number")J.push({message:`${B} must be a number`,path:[B]})}else J.push({message:`${B} is required`,path:[B]});if(J.length>0)return{issues:J};return{value:Z}}}}}function $0(Q){return{"~standard":{version:1,vendor:Q,validate:($)=>{if(typeof $!=="object"||$===null)return{issues:[{message:"Expected an object"}]};let X=$,J=[],Z={};if("access_token"in X)if(typeof X.access_token==="string")Z.access_token=X.access_token;else J.push({message:"access_token must be a string",path:["access_token"]});else J.push({message:"access_token is required",path:["access_token"]});if("token_type"in X)if(typeof X.token_type==="string")Z.token_type=X.token_type;else J.push({message:"token_type must be a string",path:["token_type"]});else J.push({message:"token_type is required",path:["token_type"]});if("scope"in X)if(typeof X.scope==="string"||X.scope===void 0)Z.scope=X.scope;else J.push({message:"scope must be a string",path:["scope"]});if("refresh_token"in X)if(typeof X.refresh_token==="string"||X.refresh_token===void 0)Z.refresh_token=X.refresh_token;else J.push({message:"refresh_token must be a string",path:["refresh_token"]});if("expires"in X)if(typeof X.expires==="string"||X.expires===void 0)Z.expires=X.expires;else J.push({message:"expires must be a string",path:["expires"]});if("expires_in"in X)if(typeof X.expires_in==="number"||X.expires_in===void 0)Z.expires_in=X.expires_in;else J.push({message:"expires_in must be a number",path:["expires_in"]});if(J.length>0)return{issues:J};return{value:Z}}}}}function J0(Q){let $=new Uint8Array(Q);return crypto.getRandomValues($),$}function V0(Q){let $="",X=J0(Q);for(let J=0;J<Q;J++){let Z=X[J]%32;$+="0123456789ABCDEFGHJKMNPQRSTVWXYZ".charAt(Z)}return $}function B0(Q,$){let X="";for(let J=$;J>0;J--){let Z=Q%32;X="0123456789ABCDEFGHJKMNPQRSTVWXYZ".charAt(Z)+X,Q=Math.floor(Q/32)}return X}function Z0(Q){let $=Date.now(),X=B0($,10),J=V0(16);return`${Q??""}${X}${J}`}export{$0 as workloadTokenResponseSchema,R0 as withValidate,u as warnLogger,k0 as waitOn,O as version,A0 as validationFailureResponse,n0 as userSchema,C0 as unionCatalogRead,F0 as trustedClientPermissionsForPrincipal,O0 as trimTrailingSlash,S0 as tokenResponseSchema,Y0 as toCodeCatalog,_0 as stripJsonComments,w0 as stableConfigHash,N as silentLogger,g as serializeConfig,n as readyCatalogEntry,h as parseKmsPoolDocument,m as parseKmsPoolControlDocument,I0 as parseJsonc,E0 as parseEcid,b0 as oidcCallbackSchema,t as normalizeTenantRoutingStrategy,Y as normalizeTenantPathNamespace,N0 as must,T0 as mergeConfig,e as matchTenantPath,U0 as listGenerator,H0 as list,X0 as jwtAssertionClaimsSchema,h0 as isStoreConflictError,K0 as isEcid,f as isConfigSourceError,c0 as isConfigLocator,z0 as isCodeCatalog,p as infoLogger,L0 as idTokenClaimsSchema,a0 as groupResourceSchema,Z0 as generateULID,P0 as formatEcid,a as defineSecretType,W0 as defineCatalog,o as defaultSecretContentType,c as defaultLogger,f0 as deepEqualPlain,g0 as decodeUser,d as debugLogger,G0 as configTrustedClientGrants,v0 as claimsToUser,Q0 as buildTenantPath,u0 as assertValidSubjectTypeScoping,x0 as assertEcid,q0 as accessRootId,j0 as accessRefId,y0 as StoreConflictError,A as SecretContentTypeMismatchError,p0 as PLATFORM_ASSIGNABLE_SUBJECT_TYPES,m0 as IoniteError,x as ION_TENANT_MANAGE,w as ION_SDK_PERMISSIONS,l0 as ION_SCIM_USER_EXTENSION_URN,M as ION_IAM_USERS_WRITE,C as ION_IAM_READ,D as ION_IAM_GROUPS_WRITE,k as ION_ENDPOINT_PERMISSIONS,P as ION_CIAM_MAGIC_LINK_CREATE,K as ION_CAPABILITIEZ_READ,E as ION_AUTHZ_OAA_SYNC,d0 as ION_AUTHZ_GROUP_SCHEMA,D0 as EcidFormatError,M0 as ECID_SCHEME,i as DEFAULT_TENANT_UI_NAMESPACE,s as DEFAULT_TENANT_API_NAMESPACE,b as DEFAULT_SECRET_MIME_TYPES,W as ConfigSourceError};
package/dist/server.d.ts CHANGED
@@ -356,7 +356,7 @@ type AuthenticatedUser = WorkforceUser | Customer;
356
356
  * flows that are inherently human.
357
357
  */
358
358
  type AuthenticatedPrincipal = AuthenticatedUser | WorkloadPrincipal;
359
- import { StandardSchemaV1 as StandardSchemaV17 } from "@standard-schema/spec";
359
+ import { StandardSchemaV1 as StandardSchemaV18 } from "@standard-schema/spec";
360
360
  /**
361
361
  * Third-party CIAM provider presets and claim mapping.
362
362
  *
@@ -1983,21 +1983,24 @@ type IAM = IAMConfig & {
1983
1983
  * @returns IAM service instance
1984
1984
  */
1985
1985
  declare function iam(validators: IAMValidators, log: Logger, workload: Workload | undefined, authz: Authz, accessStore?: AccessAssignmentStore, accessIndex?: AccessIndex, catalogStore?: AccessCatalogStore, codeCatalog?: CodeCatalog, resources?: ResourceProvider, fromVault?: Partial<IAMConfig>, fromCode?: Partial<IAMConfig>, iamDelta?: IamDeltaEmitter, onAccessMutation?: (summary: ScimMutationSummary) => void, trustedClientGrants?: AccessChange[], authzQueueSettle?: () => Promise<void>): IAM | undefined;
1986
- type KmsKeyState = "pending" | "active" | "deprecated" | "revoked";
1987
- type KmsPoolKind = "token" | "allocation";
1988
- type KmsTokenKey = {
1986
+ type KmsKeyState = "pending" | "active" | "deprecated" | "rotated" | "revoked";
1987
+ type KmsKey = {
1989
1988
  id: string;
1990
1989
  state: KmsKeyState;
1991
1990
  value?: string;
1992
1991
  notBefore?: string;
1993
1992
  notAfter?: string;
1993
+ /** Control-plane lifecycle timestamps. Vaults omit these from personalized client grants. */
1994
+ createdAt?: string;
1995
+ activatedAt?: string;
1996
+ deprecatedAt?: string;
1997
+ rotatedAt?: string;
1998
+ revokedAt?: string;
1994
1999
  /** Control-plane metadata used for allocation policy and UI. Consumers should treat it as opaque. */
1995
2000
  meta?: Record<string, unknown>;
1996
2001
  };
1997
2002
  /** ConfigSource-owned pointer to a KMS pool document. */
1998
2003
  type KmsPoolConfig = {
1999
- /** Pool semantics. Defaults to `token`. */
2000
- kind?: KmsPoolKind;
2001
2004
  /** Named `ion.secrets` source. Omit to use the default `ion.secret` source. */
2002
2005
  source?: string;
2003
2006
  /** Secret path. Defaults to `/kms/{poolName}`. */
@@ -2005,13 +2008,16 @@ type KmsPoolConfig = {
2005
2008
  };
2006
2009
  /** ConfigSource-owned named KMS pool declarations. */
2007
2010
  type KmsConfig = Record<string, KmsPoolConfig>;
2008
- type KmsPoolListener = (current: KmsTokenKey | undefined) => void;
2011
+ type KmsPoolListener = (current: KmsKey | undefined) => void;
2009
2012
  type KmsPool = {
2010
- /** Returns the usable token value, briefly awaiting only a locally scheduled imminent activation. */
2011
- value(): Promise<string>;
2012
- /** Timing-safe verification against the active token and usable deprecated overlap tokens. */
2013
+ /**
2014
+ * Returns the current granted key. Calls wait on one shared local subscription until a grant is
2015
+ * available; repeated calls resolve from the local cache and never initiate a vault request.
2016
+ */
2017
+ value(timeout?: number): Promise<string>;
2018
+ /** Timing-safe verification against the active key and usable deprecated rotation-overlap keys. */
2013
2019
  accepts(candidate: string): boolean;
2014
- /** Notifies immediately and whenever the selected active token changes. */
2020
+ /** Notifies immediately and whenever the selected active key changes. */
2015
2021
  subscribe(listener: KmsPoolListener): () => void;
2016
2022
  beforeChange(listener: ChangeListener): () => void;
2017
2023
  afterChange(listener: ChangeListener): () => void;
@@ -2063,7 +2069,7 @@ type OtelConfig = {
2063
2069
  protocol?: OtelProtocol;
2064
2070
  headers?: Record<string, string>;
2065
2071
  apiKey?: string;
2066
- /** Name of a `RemoteConfig.kms` token pool used for exporter authentication. */
2072
+ /** Name of a `RemoteConfig.kms` key pool used for exporter authentication. */
2067
2073
  apiKeyPool?: string;
2068
2074
  apiKeyHeader?: string;
2069
2075
  oauth?: OtelOAuthClientCredentialsConfig;
@@ -2801,6 +2807,36 @@ interface MagicLinkStore<TExtended = object> {
2801
2807
  */
2802
2808
  delete(token: string): Promise<void>;
2803
2809
  }
2810
+ import { StandardSchemaV1 as StandardSchemaV17 } from "@standard-schema/spec";
2811
+ type SecretTypeRegistryEntry = SecretContentType & {
2812
+ id: string;
2813
+ label?: string;
2814
+ };
2815
+ /**
2816
+ * Runtime contract for a custom secret type. The Standard Schema value is used only by server-side
2817
+ * parsing; `toRegistryEntry()` returns the serializable half that a vault editor can register.
2818
+ */
2819
+ type SecretTypeDescriptor<T = unknown> = Readonly<{
2820
+ id: string;
2821
+ label?: string;
2822
+ format: SecretFormat;
2823
+ mimeType: string;
2824
+ schemaUrl?: string;
2825
+ schema?: StandardSchemaV17<unknown, T>;
2826
+ toRegistryEntry(): SecretTypeRegistryEntry;
2827
+ }>;
2828
+ type SecretFormat = "jsonc" | "env" | "text" | "binary" | "yaml" | "toml" | "xml";
2829
+ /**
2830
+ * Self-describing content metadata persisted with a secret. `typeId` identifies an authoring preset;
2831
+ * decoding never depends on the preset registry because the resolved format/mime/schema travel with
2832
+ * the secret.
2833
+ */
2834
+ type SecretContentType = {
2835
+ format: SecretFormat;
2836
+ mimeType: string;
2837
+ schemaUrl?: string;
2838
+ typeId?: string;
2839
+ };
2804
2840
  type Secret<T> = {
2805
2841
  data: T;
2806
2842
  metadata: MetaData;
@@ -2809,6 +2845,8 @@ type MetaData = {
2809
2845
  path: string;
2810
2846
  version: number;
2811
2847
  created: Date;
2848
+ /** Absent on legacy secrets, which are interpreted as JSONC. */
2849
+ contentType?: SecretContentType;
2812
2850
  };
2813
2851
  type SecretsSourceType = "vault" | "azure" | "aws" | "gcp" | "dev";
2814
2852
  type SecretRequestSeverity = "low" | "medium" | "high" | "critical";
@@ -2830,6 +2868,24 @@ type SecretsOperationOptions = {
2830
2868
  /** Optional timeout in milliseconds for this secrets operation. */
2831
2869
  timeout?: number;
2832
2870
  };
2871
+ type SecretsWriteOptions = SecretsOperationOptions & {
2872
+ /** Content contract stored with the secret and returned by all transports. */
2873
+ contentType?: SecretContentType;
2874
+ };
2875
+ type SecretHandle = {
2876
+ /** Reads the canonical textual representation. Binary secrets reject this accessor. */
2877
+ text(): Promise<string>;
2878
+ /** Decodes JSONC. Other formats reject this accessor. */
2879
+ json<T = unknown>(): Promise<T>;
2880
+ /** Reads the canonical bytes. Text formats are UTF-8 encoded. */
2881
+ bytes(): Promise<Uint8Array>;
2882
+ /** Decodes an env/key=value secret. */
2883
+ env(): Promise<Record<string, string>>;
2884
+ /** Reads metadata without decoding the value. */
2885
+ metadata(): Promise<MetaData>;
2886
+ /** Decodes and validates using a runtime secret-type descriptor. */
2887
+ parse<T>(type: SecretTypeDescriptor<T>): Promise<T>;
2888
+ };
2833
2889
  type SubscriptionMode = "fail-fast" | "wait";
2834
2890
  type SecretsSubscriptionOptions = SecretsOperationOptions & {
2835
2891
  /**
@@ -2841,13 +2897,15 @@ type SecretsSubscriptionOptions = SecretsOperationOptions & {
2841
2897
  };
2842
2898
  type SecretsSource = ReactiveHandle & ModuleReadiness & {
2843
2899
  type: SecretsSourceType;
2900
+ /** Creates a lazy, Bun.file-style handle. No I/O occurs until an accessor is awaited. */
2901
+ get(path: string, options?: SecretsOperationOptions): SecretHandle;
2844
2902
  getFullSecret: <T>(path: string, options?: SecretsOperationOptions) => Promise<Secret<T>>;
2845
2903
  getSecret: <T>(path: string, options?: SecretsOperationOptions) => Promise<T>;
2846
2904
  /**
2847
2905
  * Write a secret at the given path.
2848
2906
  * Implementations may throw for read-only or unsupported secret sources.
2849
2907
  */
2850
- putSecret: (path: string, value: Record<string, unknown>, options?: SecretsOperationOptions) => Promise<void>;
2908
+ putSecret: (path: string, value: Record<string, unknown>, options?: SecretsWriteOptions) => Promise<void>;
2851
2909
  /**
2852
2910
  * When set, the secret source supports change detection, reads the current value first, and calls onChange
2853
2911
  * immediately with that value before watching for changes.
@@ -2902,12 +2960,14 @@ type Secrets = ModuleReadiness & {
2902
2960
  listSecretsSources(): string[];
2903
2961
  /** Gets a named secrets source client. Throws when missing. */
2904
2962
  getSecretsSource(sourceName: string): SecretsSource;
2963
+ /** Creates a lazy handle for a secret in a named source. */
2964
+ get(sourceName: string, path: string, options?: SecretsOperationOptions): SecretHandle;
2905
2965
  /** Reads a secret from a named secrets source client. */
2906
2966
  getSecret<T>(sourceName: string, path: string, options?: SecretsOperationOptions): Promise<T>;
2907
2967
  /** Reads full secret data + metadata from a named secrets source client. */
2908
2968
  getFullSecret<T>(sourceName: string, path: string, options?: SecretsOperationOptions): Promise<Secret<T>>;
2909
2969
  /** Writes a secret to a named secrets source client. */
2910
- putSecret(sourceName: string, path: string, value: Record<string, unknown>, options?: SecretsOperationOptions): Promise<void>;
2970
+ putSecret(sourceName: string, path: string, value: Record<string, unknown>, options?: SecretsWriteOptions): Promise<void>;
2911
2971
  /** Deletes a secret from a named secrets source client. */
2912
2972
  deleteSecret(sourceName: string, path: string, options?: SecretsOperationOptions): Promise<void>;
2913
2973
  /** Lists child paths under a base path for a named secrets source client. */
@@ -3276,7 +3336,7 @@ type RemoteConfig = {
3276
3336
  workload?: WorkloadConfig | WorkloadConfigMap | WorkloadIncomingOutgoing;
3277
3337
  /** Optional named secrets-source configs available to this App instance. */
3278
3338
  secrets?: SecretsModuleConfig;
3279
- /** ConfigSource-owned named managed token pools consumed through `ion.kms`. */
3339
+ /** ConfigSource-owned named server-allocated key pools consumed through `ion.kms`. */
3280
3340
  kms?: KmsConfig;
3281
3341
  ciam?: CIAMConfig;
3282
3342
  /** OpenTelemetry collector/exporter config loaded from ConfigSource. */
@@ -3463,8 +3523,8 @@ declare function resolveCacheConfig(cache: CacheConfig | undefined): ResolvedCac
3463
3523
  * built-in core schemas.
3464
3524
  */
3465
3525
  type CIAMValidators = {
3466
- customer: StandardSchemaV17<unknown, BaseCustomer> & {
3467
- validate(value: unknown): Promise<StandardSchemaV17.Result<BaseCustomer>>;
3526
+ customer: StandardSchemaV18<unknown, BaseCustomer> & {
3527
+ validate(value: unknown): Promise<StandardSchemaV18.Result<BaseCustomer>>;
3468
3528
  };
3469
3529
  callbackParams?: StandardSchemaWithValidate<OidcCallbackParams>;
3470
3530
  idTokenClaims?: StandardSchemaWithValidate<IdTokenClaims>;