@enterprisestandard/core 0.0.9-beta.20260303.7 → 0.0.9
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 +269 -430
- package/dist/index.js +1 -1
- package/dist/server.d.ts +60 -181
- package/dist/server.js +1 -1
- package/dist/shared/{core-5zzt9q6h.js → core-q2xp5jrk.js} +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { version } from "../package.json";
|
|
2
|
-
import {
|
|
3
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
+
import { StandardSchemaV1 as StandardSchemaV17 } from "@standard-schema/spec";
|
|
3
|
+
import { StandardSchemaV1 as StandardSchemaV15 } from "@standard-schema/spec";
|
|
4
4
|
/**
|
|
5
5
|
* Minimal logger interface compatible with common patterns (console, pino, winston, etc.)
|
|
6
6
|
*/
|
|
@@ -89,389 +89,7 @@ interface UserListOptions {
|
|
|
89
89
|
/** Sort order (applied in array order). */
|
|
90
90
|
sort?: UserSortOptions[];
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
type TenantSortField = "tenantId" | "companyId" | "companyName" | "environmentType" | "email" | "webhookUrl" | "callbackUrl" | "tenantUrl" | "status" | "error" | "createdAt" | "updatedAt";
|
|
94
|
-
/** Single sort option for tenant list. */
|
|
95
|
-
interface TenantSortOptions {
|
|
96
|
-
field: TenantSortField;
|
|
97
|
-
direction: SortDirection;
|
|
98
|
-
}
|
|
99
|
-
/** Options for TenantStore.list() and getByCompanyId(). */
|
|
100
|
-
interface TenantListOptions {
|
|
101
|
-
/** 0-based index of first item. Default 0. */
|
|
102
|
-
start?: number;
|
|
103
|
-
/** Max items to return. Omitted = implementation-defined (InMemory: no limit). */
|
|
104
|
-
limit?: number;
|
|
105
|
-
/** Sort order (applied in array order). */
|
|
106
|
-
sort?: TenantSortOptions[];
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Environment type for tenant creation
|
|
110
|
-
*/
|
|
111
|
-
type EnvironmentType = "POC" | "DEV" | "QA" | "PROD";
|
|
112
|
-
/**
|
|
113
|
-
* Status of tenant creation process
|
|
114
|
-
*/
|
|
115
|
-
type TenantStatus = "pending" | "processing" | "completed" | "failed" | "action_required";
|
|
116
|
-
/**
|
|
117
|
-
* Request payload sent by a TMR (e.g. ESV or control plane) for creating a tenant
|
|
118
|
-
*/
|
|
119
|
-
interface CreateTenantRequest {
|
|
120
|
-
/**
|
|
121
|
-
* Required app identifier to use when initializing EnterpriseStandard for this tenant.
|
|
122
|
-
* This is the primary identifier for tenant management. A company can have multiple
|
|
123
|
-
* applications (e.g., one instance on the east coast, one on the west coast).
|
|
124
|
-
*/
|
|
125
|
-
tenantId: string;
|
|
126
|
-
/**
|
|
127
|
-
* Company ID (used for reporting purposes only, not for tenant identification)
|
|
128
|
-
*/
|
|
129
|
-
companyId: string;
|
|
130
|
-
/**
|
|
131
|
-
* Company Name
|
|
132
|
-
*/
|
|
133
|
-
companyName: string;
|
|
134
|
-
/**
|
|
135
|
-
* Environment Type (POC, DEV, QA, PROD)
|
|
136
|
-
*/
|
|
137
|
-
environmentType: EnvironmentType;
|
|
138
|
-
/**
|
|
139
|
-
* Email (The email or distribution list used to communicate to the team)
|
|
140
|
-
*/
|
|
141
|
-
email: string;
|
|
142
|
-
/**
|
|
143
|
-
* Webhook URL where the application can send updates concerning the creation of the tenant
|
|
144
|
-
*/
|
|
145
|
-
webhookUrl: string;
|
|
146
|
-
/**
|
|
147
|
-
* Callback URL where the customer should be redirected after completing TMS steps
|
|
148
|
-
*/
|
|
149
|
-
callbackUrl: string;
|
|
150
|
-
/**
|
|
151
|
-
* URL that the tenant will be available at (optional; deployer may allocate)
|
|
152
|
-
*/
|
|
153
|
-
tenantUrl?: string;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Response payload for tenant creation
|
|
157
|
-
*/
|
|
158
|
-
type CreateTenantResponse = {
|
|
159
|
-
/**
|
|
160
|
-
* URL that the tenant will be available at
|
|
161
|
-
*/
|
|
162
|
-
tenantUrl: string;
|
|
163
|
-
/**
|
|
164
|
-
* Current status of tenant creation
|
|
165
|
-
*/
|
|
166
|
-
status: Exclude<TenantStatus, "action_required">;
|
|
167
|
-
} | {
|
|
168
|
-
/**
|
|
169
|
-
* Current status of tenant creation
|
|
170
|
-
*/
|
|
171
|
-
status: "action_required";
|
|
172
|
-
/**
|
|
173
|
-
* URL where the customer should provide additional information
|
|
174
|
-
*/
|
|
175
|
-
actionUrl: string;
|
|
176
|
-
/**
|
|
177
|
-
* Signed request token for the action flow
|
|
178
|
-
*/
|
|
179
|
-
requestToken: string;
|
|
180
|
-
/**
|
|
181
|
-
* ISO timestamp when the request token expires
|
|
182
|
-
*/
|
|
183
|
-
expiresAt: string;
|
|
184
|
-
};
|
|
185
|
-
/**
|
|
186
|
-
* Payload sent to webhook URL for status updates
|
|
187
|
-
*/
|
|
188
|
-
interface TenantWebhookPayload {
|
|
189
|
-
/**
|
|
190
|
-
* Tenant ID (primary identifier)
|
|
191
|
-
*/
|
|
192
|
-
tenantId: string;
|
|
193
|
-
/**
|
|
194
|
-
* Company ID
|
|
195
|
-
*/
|
|
196
|
-
companyId: string;
|
|
197
|
-
/**
|
|
198
|
-
* Current status of tenant creation
|
|
199
|
-
*/
|
|
200
|
-
status: TenantStatus;
|
|
201
|
-
/**
|
|
202
|
-
* URL that the tenant will be available at (provided once creation completes)
|
|
203
|
-
*/
|
|
204
|
-
tenantUrl?: string;
|
|
205
|
-
/**
|
|
206
|
-
* URL where the customer should provide additional information
|
|
207
|
-
*/
|
|
208
|
-
actionUrl?: string;
|
|
209
|
-
/**
|
|
210
|
-
* Signed request token for the action flow
|
|
211
|
-
*/
|
|
212
|
-
requestToken?: string;
|
|
213
|
-
/**
|
|
214
|
-
* ISO timestamp when the request token expires
|
|
215
|
-
*/
|
|
216
|
-
expiresAt?: string;
|
|
217
|
-
/**
|
|
218
|
-
* Error message (only present if status is "failed")
|
|
219
|
-
*/
|
|
220
|
-
error?: string;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Error thrown when tenant request validation or processing fails.
|
|
224
|
-
*/
|
|
225
|
-
declare class TenantRequestError extends Error {
|
|
226
|
-
constructor(message: string, options?: ErrorOptions);
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Validators for tenant management
|
|
230
|
-
*/
|
|
231
|
-
type TenantValidators = {
|
|
232
|
-
createTenantRequest: StandardSchemaV1<unknown, CreateTenantRequest>;
|
|
233
|
-
};
|
|
234
|
-
/**
|
|
235
|
-
* Configuration for tenant management
|
|
236
|
-
*/
|
|
237
|
-
type TenantConfig = {
|
|
238
|
-
/**
|
|
239
|
-
* Vault-only signing key used for request token signing
|
|
240
|
-
*/
|
|
241
|
-
signingKey?: string;
|
|
242
|
-
/**
|
|
243
|
-
* Default TTL (seconds) for request tokens
|
|
244
|
-
*/
|
|
245
|
-
requestTokenTtl?: number;
|
|
246
|
-
};
|
|
247
|
-
/** Tenant config that code may provide; excludes signingKey (vault-only). */
|
|
248
|
-
type TenantConfigFromCode = Omit<TenantConfig, "signingKey">;
|
|
249
|
-
type TenantRequestTokenPayload = {
|
|
250
|
-
tenantId: string;
|
|
251
|
-
callbackUrl: string;
|
|
252
|
-
exp: number;
|
|
253
|
-
iat: number;
|
|
254
|
-
};
|
|
255
|
-
/**
|
|
256
|
-
* Tenant service interface
|
|
257
|
-
*/
|
|
258
|
-
type Tenant = TenantConfig & {
|
|
259
|
-
/**
|
|
260
|
-
* Parse and validate a tenant creation request from an HTTP request.
|
|
261
|
-
* Returns a validation result object with either `issues` (if validation fails) or `value` (if validation succeeds).
|
|
262
|
-
*
|
|
263
|
-
* @param request - The HTTP request containing the tenant creation data
|
|
264
|
-
* @returns Validation result with either `issues` array or `value` containing the validated request
|
|
265
|
-
*
|
|
266
|
-
* @example
|
|
267
|
-
* ```typescript
|
|
268
|
-
* app.post('/api/tenant', async (c) => {
|
|
269
|
-
* const result = await tenantService.parseTenantRequest(c.req.raw);
|
|
270
|
-
* if (result.issues) {
|
|
271
|
-
* return validationFailureResponse(result.issues, 'Tenant request validation failed');
|
|
272
|
-
* }
|
|
273
|
-
* // Use result.value as CreateTenantRequest
|
|
274
|
-
* });
|
|
275
|
-
* ```
|
|
276
|
-
*/
|
|
277
|
-
parseTenantRequest: (request: Request) => Promise<StandardSchemaV1.Result<CreateTenantRequest>>;
|
|
278
|
-
/**
|
|
279
|
-
* Send a webhook update to ESVS with tenant creation status.
|
|
280
|
-
*
|
|
281
|
-
* @param webhookUrl - The webhook URL provided in the tenant creation request
|
|
282
|
-
* @param payload - The webhook payload with status and tenant information
|
|
283
|
-
*/
|
|
284
|
-
sendTenantWebhook: (webhookUrl: string, payload: TenantWebhookPayload) => Promise<void>;
|
|
285
|
-
/**
|
|
286
|
-
* Create a signed request token for the action_required flow
|
|
287
|
-
*/
|
|
288
|
-
createRequestToken: (tenantId: string, callbackUrl: string, ttlSeconds?: number) => Promise<{
|
|
289
|
-
token: string;
|
|
290
|
-
expiresAt: Date;
|
|
291
|
-
payload: TenantRequestTokenPayload;
|
|
292
|
-
}>;
|
|
293
|
-
/**
|
|
294
|
-
* Verify a signed request token and return its payload
|
|
295
|
-
*/
|
|
296
|
-
verifyRequestToken: (token: string) => Promise<TenantRequestTokenPayload>;
|
|
297
|
-
};
|
|
298
|
-
/**
|
|
299
|
-
* Creates a tenant service instance.
|
|
300
|
-
*
|
|
301
|
-
* @param validators - Validators for tenant request validation
|
|
302
|
-
* @param fromVault - Configuration from vault (optional)
|
|
303
|
-
* @param fromCode - Configuration from code (optional)
|
|
304
|
-
* @returns Tenant service instance or undefined if no config provided
|
|
305
|
-
*/
|
|
306
|
-
declare function tenant(validators: TenantValidators, log: Logger, fromVault?: Partial<TenantConfig>, fromCode?: Partial<TenantConfigFromCode>): Tenant | undefined;
|
|
307
|
-
/**
|
|
308
|
-
* Parse and validate a tenant creation request from an HTTP request using default validators.
|
|
309
|
-
* Use this when you do not have a tenant service instance (e.g. in a standalone tenant creation endpoint).
|
|
310
|
-
*
|
|
311
|
-
* @param request - The HTTP request containing the tenant creation data
|
|
312
|
-
* @returns Validation result with either `issues` array or `value` containing the validated request
|
|
313
|
-
*/
|
|
314
|
-
declare function parseTenantRequest(request: Request): Promise<StandardSchemaV1.Result<CreateTenantRequest>>;
|
|
315
|
-
declare function sendTenantWebhook(webhookUrl: string, payload: TenantWebhookPayload, log: Logger): Promise<void>;
|
|
316
|
-
/**
|
|
317
|
-
* Stored tenant data with required tenantId and tracking metadata.
|
|
318
|
-
*
|
|
319
|
-
* @template TExtended - Type-safe custom data that consumers can add to tenants
|
|
320
|
-
*/
|
|
321
|
-
type StoredTenant<TExtended = {}> = {
|
|
322
|
-
/**
|
|
323
|
-
* Required app identifier used to initialize EnterpriseStandard for this tenant.
|
|
324
|
-
* This is the primary key for tenant storage. A company can have multiple
|
|
325
|
-
* applications (e.g., one instance on the east coast, one on the west coast).
|
|
326
|
-
*/
|
|
327
|
-
tenantId: string;
|
|
328
|
-
/**
|
|
329
|
-
* Company ID (used for reporting purposes only, not for tenant identification)
|
|
330
|
-
*/
|
|
331
|
-
companyId: string;
|
|
332
|
-
/**
|
|
333
|
-
* Company Name
|
|
334
|
-
*/
|
|
335
|
-
companyName: string;
|
|
336
|
-
/**
|
|
337
|
-
* Environment Type (POC, DEV, QA, PROD)
|
|
338
|
-
*/
|
|
339
|
-
environmentType: EnvironmentType;
|
|
340
|
-
/**
|
|
341
|
-
* Email (The email or distribution list used to communicate to the team)
|
|
342
|
-
*/
|
|
343
|
-
email: string;
|
|
344
|
-
/**
|
|
345
|
-
* Webhook URL where the application can send updates around the creation of the tenant
|
|
346
|
-
*/
|
|
347
|
-
webhookUrl: string;
|
|
348
|
-
/**
|
|
349
|
-
* Callback URL where the customer should be redirected after completing TMS steps
|
|
350
|
-
*/
|
|
351
|
-
callbackUrl: string;
|
|
352
|
-
/**
|
|
353
|
-
* URL that the tenant will be available at
|
|
354
|
-
*/
|
|
355
|
-
tenantUrl?: string;
|
|
356
|
-
/**
|
|
357
|
-
* Current status of tenant creation
|
|
358
|
-
*/
|
|
359
|
-
status: TenantStatus;
|
|
360
|
-
/**
|
|
361
|
-
* Error message (only present if status is "failed")
|
|
362
|
-
*/
|
|
363
|
-
error?: string;
|
|
364
|
-
/**
|
|
365
|
-
* Timestamp when the tenant was first stored.
|
|
366
|
-
*/
|
|
367
|
-
createdAt: Date;
|
|
368
|
-
/**
|
|
369
|
-
* Timestamp when the tenant was last updated.
|
|
370
|
-
*/
|
|
371
|
-
updatedAt: Date;
|
|
372
|
-
/**
|
|
373
|
-
* Serialized Enterprise Standard configuration.
|
|
374
|
-
* This is a JSON-serializable version of the FrameworkConfig with non-serializable items excluded.
|
|
375
|
-
*/
|
|
376
|
-
config?: unknown;
|
|
377
|
-
} & TExtended;
|
|
378
|
-
/**
|
|
379
|
-
* Abstract interface for tenant storage backends.
|
|
380
|
-
*
|
|
381
|
-
* Consumers can implement this interface to use different storage backends:
|
|
382
|
-
* - In-memory (for development/testing)
|
|
383
|
-
* - Redis (for production with fast lookups)
|
|
384
|
-
* - Database (PostgreSQL, MySQL, etc.)
|
|
385
|
-
*
|
|
386
|
-
* @template TExtended - Type-safe custom data that consumers can add to tenants
|
|
387
|
-
*/
|
|
388
|
-
interface TenantStore<TExtended = {}> {
|
|
389
|
-
/**
|
|
390
|
-
* Retrieve a tenant by its app identifier.
|
|
391
|
-
*
|
|
392
|
-
* @param tenantId - The tenant's identifier (primary key) - matches an ionite Application ID
|
|
393
|
-
* @returns The tenant if found, null otherwise
|
|
394
|
-
*/
|
|
395
|
-
get(tenantId: string): Promise<StoredTenant<TExtended> | null>;
|
|
396
|
-
/**
|
|
397
|
-
* Retrieve tenants for a company ID with optional pagination and sort.
|
|
398
|
-
*
|
|
399
|
-
* @param companyId - The company ID (used for reporting, not primary identification)
|
|
400
|
-
* @param options - Optional start (0-based), limit (page size), and sort
|
|
401
|
-
* @returns ListResult with total, count, items, size, page, pages
|
|
402
|
-
*/
|
|
403
|
-
getByCompanyId(companyId: string, options?: TenantListOptions): Promise<ListResult<StoredTenant<TExtended>>>;
|
|
404
|
-
/**
|
|
405
|
-
* List tenants in the store with optional pagination and sort.
|
|
406
|
-
*
|
|
407
|
-
* @param options - Optional start (0-based), limit (page size), and sort
|
|
408
|
-
* @returns ListResult with total, count, items, size, page, pages
|
|
409
|
-
*/
|
|
410
|
-
list(options?: TenantListOptions): Promise<ListResult<StoredTenant<TExtended>>>;
|
|
411
|
-
/**
|
|
412
|
-
* Create or update a tenant in the store.
|
|
413
|
-
*
|
|
414
|
-
* If a tenant with the same `tenantId` exists, it will be updated.
|
|
415
|
-
* Otherwise, a new tenant will be created.
|
|
416
|
-
*
|
|
417
|
-
* @param tenant - The tenant data to store
|
|
418
|
-
* @returns The stored tenant
|
|
419
|
-
*/
|
|
420
|
-
upsert(tenant: StoredTenant<TExtended>): Promise<StoredTenant<TExtended>>;
|
|
421
|
-
/**
|
|
422
|
-
* Delete a tenant by its app identifier.
|
|
423
|
-
*
|
|
424
|
-
* @param tenantId - The tenant's app identifier to delete
|
|
425
|
-
*/
|
|
426
|
-
delete(tenantId: string): Promise<void>;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* In-memory tenant store implementation using Maps.
|
|
430
|
-
*
|
|
431
|
-
* Suitable for:
|
|
432
|
-
* - Development and testing
|
|
433
|
-
* - Single-server deployments
|
|
434
|
-
* - Applications without high availability requirements
|
|
435
|
-
*
|
|
436
|
-
* NOT suitable for:
|
|
437
|
-
* - Multi-server deployments (tenants not shared)
|
|
438
|
-
* - High availability scenarios (tenants lost on restart)
|
|
439
|
-
* - Production applications with distributed architecture
|
|
440
|
-
*
|
|
441
|
-
* For production, implement TenantStore with Redis or a database.
|
|
442
|
-
*
|
|
443
|
-
* @template TExtended - Type-safe custom data that consumers can add to tenants
|
|
444
|
-
*/
|
|
445
|
-
declare class InMemoryTenantStore<TExtended = {}> implements TenantStore<TExtended> {
|
|
446
|
-
private tenants;
|
|
447
|
-
/** Secondary index: companyId -> Set of tenantId (since one company can have multiple apps) */
|
|
448
|
-
private companyIdIndex;
|
|
449
|
-
get(tenantId: string): Promise<StoredTenant<TExtended> | null>;
|
|
450
|
-
getByCompanyId(companyId: string, options?: TenantListOptions): Promise<ListResult<StoredTenant<TExtended>>>;
|
|
451
|
-
list(options?: TenantListOptions): Promise<ListResult<StoredTenant<TExtended>>>;
|
|
452
|
-
upsert(tenant: StoredTenant<TExtended>): Promise<StoredTenant<TExtended>>;
|
|
453
|
-
delete(tenantId: string): Promise<void>;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Validator for CreateTenantResponse (tenant creation API response).
|
|
457
|
-
* Used by ESV and other consumers that need to validate tenant response shape.
|
|
458
|
-
*/
|
|
459
|
-
declare function createTenantResponseValidator(): {
|
|
460
|
-
"~standard": {
|
|
461
|
-
validate(value: unknown): {
|
|
462
|
-
value: CreateTenantResponse;
|
|
463
|
-
} | {
|
|
464
|
-
issues: Array<{
|
|
465
|
-
message: string;
|
|
466
|
-
path?: ReadonlyArray<PropertyKey>;
|
|
467
|
-
}>;
|
|
468
|
-
};
|
|
469
|
-
};
|
|
470
|
-
};
|
|
471
|
-
declare function basicValidators(): ESValidators;
|
|
472
|
-
import { StandardSchemaV1 as StandardSchemaV18 } from "@standard-schema/spec";
|
|
473
|
-
import { StandardSchemaV1 as StandardSchemaV16 } from "@standard-schema/spec";
|
|
474
|
-
import { StandardSchemaV1 as StandardSchemaV12 } from "@standard-schema/spec";
|
|
92
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
475
93
|
/**
|
|
476
94
|
* SCIM 2.0 User Resource
|
|
477
95
|
* @see https://datatracker.ietf.org/doc/html/rfc7643#section-4.1
|
|
@@ -899,13 +517,13 @@ interface User {
|
|
|
899
517
|
* @param vendor - The name of the vendor creating this schema
|
|
900
518
|
* @returns A StandardSchemaV1 instance for SCIM User resources
|
|
901
519
|
*/
|
|
902
|
-
declare function userSchema(vendor: string):
|
|
520
|
+
declare function userSchema(vendor: string): StandardSchemaV1<Record<string, unknown>, User>;
|
|
903
521
|
/**
|
|
904
522
|
* Creates a StandardSchemaV1 for validating SCIM Group resources.
|
|
905
523
|
* @param vendor - The name of the vendor creating this schema
|
|
906
524
|
* @returns A StandardSchemaV1 instance for SCIM Group resources
|
|
907
525
|
*/
|
|
908
|
-
declare function groupResourceSchema(vendor: string):
|
|
526
|
+
declare function groupResourceSchema(vendor: string): StandardSchemaV1<Record<string, unknown>, GroupResource>;
|
|
909
527
|
/**
|
|
910
528
|
* Stored group data with required id and tracking metadata.
|
|
911
529
|
*
|
|
@@ -1038,7 +656,7 @@ interface BaseUser {
|
|
|
1038
656
|
*/
|
|
1039
657
|
userType?: string;
|
|
1040
658
|
}
|
|
1041
|
-
import { StandardSchemaV1 as
|
|
659
|
+
import { StandardSchemaV1 as StandardSchemaV12 } from "@standard-schema/spec";
|
|
1042
660
|
/**
|
|
1043
661
|
* OIDC Code Flow Callback URL Parameters
|
|
1044
662
|
* @see https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth
|
|
@@ -1080,7 +698,7 @@ interface OidcCallbackParams {
|
|
|
1080
698
|
* @param vendor - The name of the vendor creating this schema
|
|
1081
699
|
* @returns A StandardSchemaV1 instance for OIDC callback parameters
|
|
1082
700
|
*/
|
|
1083
|
-
declare function oidcCallbackSchema(vendor: string):
|
|
701
|
+
declare function oidcCallbackSchema(vendor: string): StandardSchemaV12<Record<string, unknown>, OidcCallbackParams>;
|
|
1084
702
|
/**
|
|
1085
703
|
* Token Response from IdP
|
|
1086
704
|
*/
|
|
@@ -1100,7 +718,7 @@ interface TokenResponse {
|
|
|
1100
718
|
* @param vendor - The name of the vendor creating this schema
|
|
1101
719
|
* @returns A StandardSchemaV1 instance for Token Response validation
|
|
1102
720
|
*/
|
|
1103
|
-
declare function tokenResponseSchema(vendor: string):
|
|
721
|
+
declare function tokenResponseSchema(vendor: string): StandardSchemaV12<Record<string, unknown>, TokenResponse>;
|
|
1104
722
|
/**
|
|
1105
723
|
* ID Token Claims
|
|
1106
724
|
*/
|
|
@@ -1122,7 +740,7 @@ interface IdTokenClaims {
|
|
|
1122
740
|
* @param vendor - The name of the vendor creating this schema
|
|
1123
741
|
* @returns A StandardSchemaV1 instance for ID Token Claims validation
|
|
1124
742
|
*/
|
|
1125
|
-
declare function idTokenClaimsSchema(vendor: string):
|
|
743
|
+
declare function idTokenClaimsSchema(vendor: string): StandardSchemaV12<Record<string, unknown>, IdTokenClaims>;
|
|
1126
744
|
/**
|
|
1127
745
|
* Primary user type for SSO/OIDC applications.
|
|
1128
746
|
* Extends BaseUser with SSO-specific data.
|
|
@@ -1171,7 +789,7 @@ interface User2 extends BaseUser {
|
|
|
1171
789
|
*
|
|
1172
790
|
* @template TExtended - Type-safe custom data that consumers can add to users
|
|
1173
791
|
*/
|
|
1174
|
-
type StoredUser<TExtended =
|
|
792
|
+
type StoredUser<TExtended = object> = User2 & {
|
|
1175
793
|
/**
|
|
1176
794
|
* Required unique identifier (the `sub` claim from the IdP).
|
|
1177
795
|
* This is the primary key for user storage.
|
|
@@ -1214,7 +832,7 @@ type StoredUser<TExtended = {}> = User2 & {
|
|
|
1214
832
|
* }
|
|
1215
833
|
* ```
|
|
1216
834
|
*/
|
|
1217
|
-
interface UserStore<TExtended =
|
|
835
|
+
interface UserStore<TExtended = object> {
|
|
1218
836
|
/**
|
|
1219
837
|
* Retrieve a user by their subject identifier (sub).
|
|
1220
838
|
*
|
|
@@ -1259,8 +877,8 @@ interface UserStore<TExtended = {}> {
|
|
|
1259
877
|
*/
|
|
1260
878
|
list(options?: UserListOptions): Promise<ListResult<StoredUser<TExtended>>>;
|
|
1261
879
|
}
|
|
1262
|
-
import { StandardSchemaV1 as StandardSchemaV15 } from "@standard-schema/spec";
|
|
1263
880
|
import { StandardSchemaV1 as StandardSchemaV14 } from "@standard-schema/spec";
|
|
881
|
+
import { StandardSchemaV1 as StandardSchemaV13 } from "@standard-schema/spec";
|
|
1264
882
|
/**
|
|
1265
883
|
* JWT Assertion Claims for OAuth2 JWT Bearer Grant (RFC 7523) and OAuth2 Access Tokens
|
|
1266
884
|
* @see https://datatracker.ietf.org/doc/html/rfc7523
|
|
@@ -1307,7 +925,7 @@ interface JWTAssertionClaims {
|
|
|
1307
925
|
* @param vendor - The name of the vendor creating this schema
|
|
1308
926
|
* @returns A StandardSchemaV1 instance for JWT Assertion Claims validation
|
|
1309
927
|
*/
|
|
1310
|
-
declare function jwtAssertionClaimsSchema(vendor: string):
|
|
928
|
+
declare function jwtAssertionClaimsSchema(vendor: string): StandardSchemaV13<Record<string, unknown>, JWTAssertionClaims>;
|
|
1311
929
|
/**
|
|
1312
930
|
* Workload Token Response from OAuth2 token endpoint
|
|
1313
931
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.1
|
|
@@ -1343,7 +961,7 @@ interface WorkloadTokenResponse {
|
|
|
1343
961
|
* @param vendor - The name of the vendor creating this schema
|
|
1344
962
|
* @returns A StandardSchemaV1 instance for Workload Token Response validation
|
|
1345
963
|
*/
|
|
1346
|
-
declare function workloadTokenResponseSchema(vendor: string):
|
|
964
|
+
declare function workloadTokenResponseSchema(vendor: string): StandardSchemaV13<Record<string, unknown>, WorkloadTokenResponse>;
|
|
1347
965
|
/**
|
|
1348
966
|
* Token Validation Result
|
|
1349
967
|
*/
|
|
@@ -1590,8 +1208,8 @@ type WorkloadConfigBase = {
|
|
|
1590
1208
|
validators?: WorkloadValidators;
|
|
1591
1209
|
};
|
|
1592
1210
|
type WorkloadValidators = {
|
|
1593
|
-
jwtAssertionClaims:
|
|
1594
|
-
tokenResponse:
|
|
1211
|
+
jwtAssertionClaims: StandardSchemaV14<unknown, JWTAssertionClaims>;
|
|
1212
|
+
tokenResponse: StandardSchemaV14<unknown, WorkloadTokenResponse>;
|
|
1595
1213
|
};
|
|
1596
1214
|
/**
|
|
1597
1215
|
* JWT Bearer Grant (RFC 7523) Configuration
|
|
@@ -1710,13 +1328,27 @@ type WorkloadConfigMap = Record<string, WorkloadConfig>;
|
|
|
1710
1328
|
/**
|
|
1711
1329
|
* Workload config with separate incoming (server) and outgoing (client) roles.
|
|
1712
1330
|
* - **incoming**: Server-only config for validating tokens presented to this app (jwksUri, issuer).
|
|
1713
|
-
* - **outgoing**: Map of named clients for outbound calls; use getWorkloadToken(client
|
|
1331
|
+
* - **outgoing**: Map of named clients for outbound calls; use getWorkloadToken(client, es, scope?) from server (client is required and must be one of the outgoing names; pass the ES instance).
|
|
1714
1332
|
*/
|
|
1715
1333
|
type WorkloadIncomingOutgoing = {
|
|
1716
1334
|
incoming?: Partial<WorkloadConfig>;
|
|
1717
1335
|
outgoing?: Record<string, Partial<WorkloadConfig>>;
|
|
1718
1336
|
};
|
|
1719
1337
|
/**
|
|
1338
|
+
* Framework-level workload declarations used by app code to define the expected
|
|
1339
|
+
* incoming/outgoing workload shape without needing all remote credentials in code.
|
|
1340
|
+
*/
|
|
1341
|
+
type FrameworkWorkloadIncomingOutgoing = {
|
|
1342
|
+
incoming?: Partial<WorkloadConfig>;
|
|
1343
|
+
outgoing?: Record<string, Partial<WorkloadConfig>>;
|
|
1344
|
+
};
|
|
1345
|
+
/**
|
|
1346
|
+
* Workload config shape accepted from framework/app code.
|
|
1347
|
+
* Apps may provide a partial single config or an incoming/outgoing declaration
|
|
1348
|
+
* to expose named outgoing clients in the type system.
|
|
1349
|
+
*/
|
|
1350
|
+
type FrameworkWorkloadConfig = Partial<WorkloadConfig> | FrameworkWorkloadIncomingOutgoing;
|
|
1351
|
+
/**
|
|
1720
1352
|
* Workload Identity extracted from validated tokens
|
|
1721
1353
|
*/
|
|
1722
1354
|
type WorkloadIdentity = {
|
|
@@ -1741,10 +1373,11 @@ type WorkloadIdentity = {
|
|
|
1741
1373
|
* Workload Identity Authentication Interface
|
|
1742
1374
|
*/
|
|
1743
1375
|
type Workload = WorkloadConfig & {
|
|
1744
|
-
/**
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1376
|
+
/**
|
|
1377
|
+
* Returns a token for this workload configuration.
|
|
1378
|
+
* The optional argument overrides the configured default scope.
|
|
1379
|
+
*/
|
|
1380
|
+
getToken: (scope?: string) => Promise<string>;
|
|
1748
1381
|
refreshToken: (scope?: string) => Promise<WorkloadTokenResponse>;
|
|
1749
1382
|
generateJWTAssertion: (scope?: string) => Promise<string>;
|
|
1750
1383
|
revokeToken: (token: string) => Promise<void>;
|
|
@@ -1754,6 +1387,7 @@ type Workload = WorkloadConfig & {
|
|
|
1754
1387
|
/** Framework-agnostic request handler for the Workload module (token, validate, jwks, refresh). */
|
|
1755
1388
|
handler: (request: Request) => Promise<Response>;
|
|
1756
1389
|
};
|
|
1390
|
+
type WorkloadClient = Pick<Workload, "getToken" | "refreshToken" | "generateJWTAssertion" | "revokeToken">;
|
|
1757
1391
|
/**
|
|
1758
1392
|
* SCIM Error response structure
|
|
1759
1393
|
*/
|
|
@@ -1826,8 +1460,8 @@ type IAMConfig = {
|
|
|
1826
1460
|
groupsUrl?: string;
|
|
1827
1461
|
};
|
|
1828
1462
|
type IAMValidators = {
|
|
1829
|
-
user:
|
|
1830
|
-
group:
|
|
1463
|
+
user: StandardSchemaV15<unknown, User>;
|
|
1464
|
+
group: StandardSchemaV15<unknown, GroupResource>;
|
|
1831
1465
|
};
|
|
1832
1466
|
/**
|
|
1833
1467
|
* Options for creating a user
|
|
@@ -1943,7 +1577,7 @@ type IAM = IAMConfig & {
|
|
|
1943
1577
|
*/
|
|
1944
1578
|
handler: (request: Request, config?: IAMHandlerConfig) => Promise<Response>;
|
|
1945
1579
|
};
|
|
1946
|
-
import { StandardSchemaV1 as
|
|
1580
|
+
import { StandardSchemaV1 as StandardSchemaV16 } from "@standard-schema/spec";
|
|
1947
1581
|
/**
|
|
1948
1582
|
* Session management for tracking user sessions and enabling backchannel logout.
|
|
1949
1583
|
*
|
|
@@ -2011,7 +1645,7 @@ import { StandardSchemaV1 as StandardSchemaV17 } from "@standard-schema/spec";
|
|
|
2011
1645
|
*
|
|
2012
1646
|
* @template TExtended - Type-safe custom data that consumers can add to sessions
|
|
2013
1647
|
*/
|
|
2014
|
-
type Session<TExtended =
|
|
1648
|
+
type Session<TExtended = object> = {
|
|
2015
1649
|
/**
|
|
2016
1650
|
* Session ID from the Identity Provider (from `sid` claim in ID token).
|
|
2017
1651
|
* This is the unique identifier for the session.
|
|
@@ -2064,7 +1698,7 @@ type Session<TExtended = {}> = {
|
|
|
2064
1698
|
* }
|
|
2065
1699
|
* ```
|
|
2066
1700
|
*/
|
|
2067
|
-
interface SessionStore<TExtended =
|
|
1701
|
+
interface SessionStore<TExtended = object> {
|
|
2068
1702
|
/**
|
|
2069
1703
|
* Create a new session in the store.
|
|
2070
1704
|
*
|
|
@@ -2174,9 +1808,9 @@ type SSOHandlerConfig = {
|
|
|
2174
1808
|
logoutBackChannelUrl?: string;
|
|
2175
1809
|
};
|
|
2176
1810
|
type SSOValidators = {
|
|
2177
|
-
callbackParams:
|
|
2178
|
-
idTokenClaims:
|
|
2179
|
-
tokenResponse:
|
|
1811
|
+
callbackParams: StandardSchemaV16<unknown, OidcCallbackParams>;
|
|
1812
|
+
idTokenClaims: StandardSchemaV16<unknown, IdTokenClaims>;
|
|
1813
|
+
tokenResponse: StandardSchemaV16<unknown, TokenResponse>;
|
|
2180
1814
|
};
|
|
2181
1815
|
type SSO<
|
|
2182
1816
|
TSessionData = {},
|
|
@@ -2296,6 +1930,16 @@ type Secrets = {
|
|
|
2296
1930
|
handleLfvEvents?(request: Request): Promise<Response>;
|
|
2297
1931
|
};
|
|
2298
1932
|
/**
|
|
1933
|
+
* Partial secrets source config used in framework/app code to declare expected source names.
|
|
1934
|
+
* ConfigSource-backed values may still provide the actual source details at runtime.
|
|
1935
|
+
*/
|
|
1936
|
+
type FrameworkSecretsSourceConfig = Partial<SecretsSourceConfig>;
|
|
1937
|
+
/**
|
|
1938
|
+
* Framework-level named secrets source declarations keyed by source name.
|
|
1939
|
+
* Values may be partial or empty when the app only wants to declare expected names/types.
|
|
1940
|
+
*/
|
|
1941
|
+
type FrameworkSecretsModuleConfig = Record<string, FrameworkSecretsSourceConfig>;
|
|
1942
|
+
/**
|
|
2299
1943
|
* TODO: Let's see if we can do some clean inference and remove this!!!
|
|
2300
1944
|
*/
|
|
2301
1945
|
type SecretsSourceMap = Record<string, SecretsSource>;
|
|
@@ -2343,6 +1987,15 @@ type LfvSecretsConfig = {
|
|
|
2343
1987
|
*/
|
|
2344
1988
|
logger?: Logger;
|
|
2345
1989
|
};
|
|
1990
|
+
/**
|
|
1991
|
+
* Runtime-ready LFV source config.
|
|
1992
|
+
* Input config can be partially declared/merged, but LFV operations require these fields.
|
|
1993
|
+
*/
|
|
1994
|
+
type ResolvedLfvSecretsConfig = Omit<LfvSecretsConfig, "lfvServerUrl" | "clientId" | "path"> & {
|
|
1995
|
+
lfvServerUrl: string;
|
|
1996
|
+
clientId: string;
|
|
1997
|
+
path: string;
|
|
1998
|
+
};
|
|
2346
1999
|
type VaultSecretsConfig = {
|
|
2347
2000
|
type: "vault";
|
|
2348
2001
|
url?: string;
|
|
@@ -2443,11 +2096,10 @@ type AzureSecretsConfig = {
|
|
|
2443
2096
|
ttl?: number;
|
|
2444
2097
|
};
|
|
2445
2098
|
type ConfigSourceType = "vault" | "lfv" | "azure" | "aws" | "gcp" | "dev" | "localFile";
|
|
2446
|
-
type
|
|
2099
|
+
type ESValidators = {
|
|
2447
2100
|
sso: SSOValidators;
|
|
2448
2101
|
iam: IAMValidators;
|
|
2449
2102
|
workload: WorkloadValidators;
|
|
2450
|
-
tenant: TenantValidators;
|
|
2451
2103
|
ciam: CIAMValidators;
|
|
2452
2104
|
secrets?: SecretsValidators;
|
|
2453
2105
|
};
|
|
@@ -2455,16 +2107,18 @@ type ESValidators2 = {
|
|
|
2455
2107
|
* Configuration supplied by the framework/application when creating an Enterprise Standard instance.
|
|
2456
2108
|
* Merged with RemoteConfig from the ConfigSource (framework config wins). Pass as the second
|
|
2457
2109
|
* argument to enterpriseStandard(source, config).
|
|
2110
|
+
* Set a module to `null` to explicitly disable it; then the corresponding property on the
|
|
2111
|
+
* EnterpriseStandard instance is typed as `never`. Omit a module to allow it to be supplied
|
|
2112
|
+
* from ConfigSource / adaptive (typed as the module type, non-optional).
|
|
2458
2113
|
*/
|
|
2459
2114
|
type FrameworkConfig = {
|
|
2460
2115
|
logger?: Logger;
|
|
2461
|
-
sso?: SSOConfig;
|
|
2462
|
-
iam?: IAMConfig;
|
|
2463
|
-
workload?:
|
|
2464
|
-
secrets?:
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
validators?: ESValidators2;
|
|
2116
|
+
sso?: SSOConfig | null;
|
|
2117
|
+
iam?: IAMConfig | null;
|
|
2118
|
+
workload?: FrameworkWorkloadConfig | null;
|
|
2119
|
+
secrets?: FrameworkSecretsModuleConfig | null;
|
|
2120
|
+
ciam?: CIAMConfig | null;
|
|
2121
|
+
validators: ESValidators;
|
|
2468
2122
|
};
|
|
2469
2123
|
/**
|
|
2470
2124
|
* Final configuration after merging ConfigSource (RemoteConfig) and FrameworkConfig.
|
|
@@ -2489,7 +2143,6 @@ type RemoteConfig = {
|
|
|
2489
2143
|
workload?: WorkloadConfig | WorkloadConfigMap | WorkloadIncomingOutgoing;
|
|
2490
2144
|
/** Optional named secrets-source configs available to this ESA instance. */
|
|
2491
2145
|
secrets?: SecretsModuleConfig;
|
|
2492
|
-
tenant?: TenantConfig;
|
|
2493
2146
|
ciam?: CIAMConfig;
|
|
2494
2147
|
};
|
|
2495
2148
|
/** Return type from the beforeChange hook passed to enterpriseStandard(). */
|
|
@@ -2516,14 +2169,45 @@ type ConfigSource = {
|
|
|
2516
2169
|
* Optional. If not set by the creator, the framework may set this before calling load/subscribe
|
|
2517
2170
|
* so the source can use the same validators.
|
|
2518
2171
|
*/
|
|
2519
|
-
validators?:
|
|
2172
|
+
validators?: ESValidators;
|
|
2520
2173
|
};
|
|
2521
2174
|
/**
|
|
2522
2175
|
* Serializes a FrameworkConfig (or ESConfig) to a JSON-serializable object.
|
|
2523
2176
|
* Strips store instances and validators so the result can be sent in API responses.
|
|
2524
2177
|
*/
|
|
2525
2178
|
declare function serializeESConfig(es: FrameworkConfig): Record<string, unknown>;
|
|
2526
|
-
|
|
2179
|
+
/**
|
|
2180
|
+
* Maps a module key in config C to the corresponding property type on EnterpriseStandard.
|
|
2181
|
+
* - If C[K] is null (explicitly disabled), the property type is never (still appears in autocomplete).
|
|
2182
|
+
* - If the key is omitted or present and not null, the property type is T (non-optional, assumed available from ConfigSource/adaptive).
|
|
2183
|
+
*/
|
|
2184
|
+
type ESModuleFromConfig<
|
|
2185
|
+
C extends FrameworkConfig,
|
|
2186
|
+
K extends keyof FrameworkConfig,
|
|
2187
|
+
T
|
|
2188
|
+
> = C[K] extends null ? never : [Exclude<C[K], undefined>] extends [never] ? T : [Exclude<C[K], undefined>] extends [null] ? never : T;
|
|
2189
|
+
type StringKeys<T> = Extract<keyof T, string>;
|
|
2190
|
+
type EmptyNamedModule = Record<string, never>;
|
|
2191
|
+
type NamedSecretsFromConfig<C extends FrameworkConfig> = Exclude<C["secrets"], null | undefined> extends infer S ? S extends Record<string, unknown> ? { [K in Exclude<StringKeys<S>, keyof Secrets>] : SecretsSource } : EmptyNamedModule : EmptyNamedModule;
|
|
2192
|
+
type NamedWorkloadClientsFromConfig<C extends FrameworkConfig> = Exclude<C["workload"], null | undefined> extends infer W ? W extends {
|
|
2193
|
+
outgoing?: infer O;
|
|
2194
|
+
} ? O extends Record<string, unknown> ? { [K in Exclude<StringKeys<O>, keyof Workload>] : WorkloadClient } : EmptyNamedModule : EmptyNamedModule : EmptyNamedModule;
|
|
2195
|
+
type AggregateWorkload = Omit<Workload, "getToken"> & {
|
|
2196
|
+
getToken: (client: string, scope?: string) => Promise<string>;
|
|
2197
|
+
getServerToken: (scope?: string) => Promise<string>;
|
|
2198
|
+
};
|
|
2199
|
+
type WorkloadModuleFromConfig<C extends FrameworkConfig> = Exclude<C["workload"], null | undefined> extends infer W ? W extends {
|
|
2200
|
+
outgoing?: infer O;
|
|
2201
|
+
} ? O extends Record<string, unknown> ? AggregateWorkload & NamedWorkloadClientsFromConfig<C> : Workload : Workload : Workload;
|
|
2202
|
+
/**
|
|
2203
|
+
* EnterpriseStandard type driven by the config type C.
|
|
2204
|
+
* Module properties are:
|
|
2205
|
+
* - never when that module is set to null (explicitly disabled);
|
|
2206
|
+
* - the module type (non-optional) when omitted or present, so you can use es.module.method.
|
|
2207
|
+
*/
|
|
2208
|
+
type EnterpriseStandardFromConfig<C extends FrameworkConfig = FrameworkConfig> = EnterpriseStandardStrict<C>;
|
|
2209
|
+
/** Base shape shared by all EnterpriseStandard variants (modules optional for backward compatibility). */
|
|
2210
|
+
type EnterpriseStandardBase = {
|
|
2527
2211
|
logger?: Logger;
|
|
2528
2212
|
/** App/tenant identifier when provided by ConfigSource (e.g. vault). */
|
|
2529
2213
|
tenantId?: string;
|
|
@@ -2532,19 +2216,39 @@ type EnterpriseStandard = {
|
|
|
2532
2216
|
secrets?: Secrets;
|
|
2533
2217
|
sso?: SSO;
|
|
2534
2218
|
iam?: IAM;
|
|
2535
|
-
workload?: Workload;
|
|
2536
|
-
tenants?: Tenant;
|
|
2219
|
+
workload?: Workload | AggregateWorkload;
|
|
2537
2220
|
ciam?: CIAM;
|
|
2538
2221
|
/**
|
|
2539
2222
|
* Framework-agnostic request handler that routes requests to the appropriate
|
|
2540
2223
|
* module (SSO, IAM, Workload, or CIAM) based on the configured URLs.
|
|
2541
2224
|
*/
|
|
2542
2225
|
handler: (request: Request) => Promise<Response>;
|
|
2226
|
+
/** Returns a promise that resolves when configured at least once. If timeout is > 0, rejects after timeout ms. */
|
|
2227
|
+
ready(timeout?: number): Promise<void>;
|
|
2228
|
+
/** Returns true once config has been applied at least once, false otherwise. */
|
|
2229
|
+
isReady(): boolean;
|
|
2543
2230
|
/** When present (e.g. from server enterpriseStandard), reload config from the config source and reapply. */
|
|
2544
2231
|
reload?(): Promise<void>;
|
|
2545
2232
|
/** When present (e.g. from server enterpriseStandard), merge config then reload from the config source and reapply. */
|
|
2546
2233
|
reconfigure?(config?: FrameworkConfig): Promise<void>;
|
|
2547
2234
|
};
|
|
2235
|
+
/** Config-driven module types: null in config → never; otherwise module type (non-optional). */
|
|
2236
|
+
type EnterpriseStandardStrict<C extends FrameworkConfig> = {
|
|
2237
|
+
logger?: Logger;
|
|
2238
|
+
tenantId?: string;
|
|
2239
|
+
config?: RemoteConfig;
|
|
2240
|
+
secrets: ESModuleFromConfig<C, "secrets", Secrets & NamedSecretsFromConfig<C>>;
|
|
2241
|
+
sso: ESModuleFromConfig<C, "sso", SSO>;
|
|
2242
|
+
iam: ESModuleFromConfig<C, "iam", IAM>;
|
|
2243
|
+
workload: ESModuleFromConfig<C, "workload", WorkloadModuleFromConfig<C>>;
|
|
2244
|
+
ciam: ESModuleFromConfig<C, "ciam", CIAM>;
|
|
2245
|
+
handler: (request: Request) => Promise<Response>;
|
|
2246
|
+
ready(timeout?: number): Promise<void>;
|
|
2247
|
+
isReady(): boolean;
|
|
2248
|
+
reload?(): Promise<void>;
|
|
2249
|
+
reconfigure?(config?: FrameworkConfig): Promise<void>;
|
|
2250
|
+
};
|
|
2251
|
+
type EnterpriseStandard = EnterpriseStandardBase;
|
|
2548
2252
|
type ESRouteModule = "sso" | "iam" | "workload" | "ciam" | "secrets";
|
|
2549
2253
|
type ESResolvedRoute = {
|
|
2550
2254
|
module: ESRouteModule;
|
|
@@ -2589,7 +2293,7 @@ type ESConfigChangeOptions = {
|
|
|
2589
2293
|
*
|
|
2590
2294
|
* @template TExtended - Type-safe custom data that consumers can add to magic links
|
|
2591
2295
|
*/
|
|
2592
|
-
type MagicLink<TExtended =
|
|
2296
|
+
type MagicLink<TExtended = object> = {
|
|
2593
2297
|
/**
|
|
2594
2298
|
* The magic link token (unique identifier)
|
|
2595
2299
|
*/
|
|
@@ -2647,7 +2351,7 @@ type MagicLink<TExtended = {}> = {
|
|
|
2647
2351
|
* }
|
|
2648
2352
|
* ```
|
|
2649
2353
|
*/
|
|
2650
|
-
interface MagicLinkStore<TExtended =
|
|
2354
|
+
interface MagicLinkStore<TExtended = object> {
|
|
2651
2355
|
/**
|
|
2652
2356
|
* Create a new magic link in the store.
|
|
2653
2357
|
*
|
|
@@ -2679,8 +2383,8 @@ interface MagicLinkStore<TExtended = {}> {
|
|
|
2679
2383
|
* baseUser includes a top-level .validate() for a cleaner API (see withValidate).
|
|
2680
2384
|
*/
|
|
2681
2385
|
type CIAMValidators = {
|
|
2682
|
-
baseUser:
|
|
2683
|
-
validate(value: unknown): Promise<
|
|
2386
|
+
baseUser: StandardSchemaV17<unknown, BaseUser> & {
|
|
2387
|
+
validate(value: unknown): Promise<StandardSchemaV17.Result<BaseUser>>;
|
|
2684
2388
|
};
|
|
2685
2389
|
};
|
|
2686
2390
|
type CIAMConfig<
|
|
@@ -2818,6 +2522,141 @@ declare function decodeUser(jwt: string): Promise<User2>;
|
|
|
2818
2522
|
* When limit is omitted, size is set to total (one logical page), page and pages are 1.
|
|
2819
2523
|
*/
|
|
2820
2524
|
declare function list<T>(total: number, items: T[], start: number, limit: number | undefined): ListResult<T>;
|
|
2525
|
+
import { StandardSchemaV1 as StandardSchemaV18 } from "@standard-schema/spec";
|
|
2526
|
+
type EnvironmentType = "POC" | "DEV" | "QA" | "PROD";
|
|
2527
|
+
type TenantStatus = "pending" | "processing" | "completed" | "failed" | "action_required";
|
|
2528
|
+
interface UpsertTenantRequest {
|
|
2529
|
+
tenantId: string;
|
|
2530
|
+
companyId: string;
|
|
2531
|
+
companyName: string;
|
|
2532
|
+
environmentType: EnvironmentType;
|
|
2533
|
+
email: string;
|
|
2534
|
+
webhookUrl: string;
|
|
2535
|
+
callbackUrl: string;
|
|
2536
|
+
tenantUrl?: string;
|
|
2537
|
+
configSource: TenantSecretsConfig;
|
|
2538
|
+
}
|
|
2539
|
+
type UpsertTenantResponse = {
|
|
2540
|
+
tenantUrl?: string;
|
|
2541
|
+
status: Exclude<TenantStatus, "action_required">;
|
|
2542
|
+
error?: string;
|
|
2543
|
+
} | {
|
|
2544
|
+
status: "action_required";
|
|
2545
|
+
actionUrl: string;
|
|
2546
|
+
requestToken: string;
|
|
2547
|
+
expiresAt: string;
|
|
2548
|
+
};
|
|
2549
|
+
type CreateTenantRequest = UpsertTenantRequest;
|
|
2550
|
+
type CreateTenantResponse = UpsertTenantResponse;
|
|
2551
|
+
interface TenantWebhookPayload {
|
|
2552
|
+
tenantId: string;
|
|
2553
|
+
companyId: string;
|
|
2554
|
+
status: TenantStatus;
|
|
2555
|
+
tenantUrl?: string;
|
|
2556
|
+
actionUrl?: string;
|
|
2557
|
+
requestToken?: string;
|
|
2558
|
+
expiresAt?: string;
|
|
2559
|
+
error?: string;
|
|
2560
|
+
}
|
|
2561
|
+
declare class TenantRequestError extends Error {
|
|
2562
|
+
constructor(message: string, options?: ErrorOptions);
|
|
2563
|
+
}
|
|
2564
|
+
type TenantValidators = {
|
|
2565
|
+
upsertTenantRequest: StandardSchemaV18<unknown, UpsertTenantRequest>;
|
|
2566
|
+
upsertTenantResponse?: StandardSchemaV18<unknown, UpsertTenantResponse>;
|
|
2567
|
+
};
|
|
2568
|
+
/**
|
|
2569
|
+
* Env-like tenant config variables used to build a ConfigSource at runtime.
|
|
2570
|
+
* These mirror the ES_* variables read by envConfig().
|
|
2571
|
+
*/
|
|
2572
|
+
type TenantConfigEnv = {
|
|
2573
|
+
ES_CONFIG_TYPE?: ConfigSourceType;
|
|
2574
|
+
ES_APP_ID?: string;
|
|
2575
|
+
ES_CONFIG_PATH?: string;
|
|
2576
|
+
ES_IONITE_URL?: string;
|
|
2577
|
+
ES_LFV_PATH?: string;
|
|
2578
|
+
ES_LFV_SERVER_URL?: string;
|
|
2579
|
+
ES_LFV_CLIENT_ID?: string;
|
|
2580
|
+
ES_LFV_SIGNATURE?: string;
|
|
2581
|
+
ES_LFV_DELIVERY_ENDPOINT?: string;
|
|
2582
|
+
ES_LFV_VERIFY_PUBLIC_KEY?: string;
|
|
2583
|
+
ES_LFV_EVENTS_ENDPOINT?: string;
|
|
2584
|
+
ES_LFV_DELIVERY_TIMEOUT?: string;
|
|
2585
|
+
ES_LFV_RETRY_INTERVAL?: string;
|
|
2586
|
+
ES_LFV_WARN_INTERVAL?: string;
|
|
2587
|
+
ES_FILE_PATH?: string;
|
|
2588
|
+
ES_FILE_WATCH?: string;
|
|
2589
|
+
ES_FILE_TTL?: string;
|
|
2590
|
+
ES_VAULT_URL?: string;
|
|
2591
|
+
ES_VAULT_TOKEN?: string;
|
|
2592
|
+
ES_VAULT_PATH?: string;
|
|
2593
|
+
ES_VAULT_TTL?: string;
|
|
2594
|
+
ES_AZURE_API_VERSION?: string;
|
|
2595
|
+
ES_AZURE_SCOPE?: string;
|
|
2596
|
+
ES_AZURE_SECRET_NAME_PREFIX?: string;
|
|
2597
|
+
ES_AZURE_AUTH_METHOD?: AwsAuthMethod;
|
|
2598
|
+
ES_AZURE_TENANT_ID?: string;
|
|
2599
|
+
ES_AZURE_CLIENT_ID?: string;
|
|
2600
|
+
ES_AZURE_CLIENT_SECRET?: string;
|
|
2601
|
+
ES_AZURE_FEDERATED_TOKEN_FILE?: string;
|
|
2602
|
+
ES_AZURE_MANAGED_IDENTITY_CLIENT_ID?: string;
|
|
2603
|
+
ES_AZURE_IMDS_API_VERSION?: string;
|
|
2604
|
+
ES_AZURE_VAULT_URL?: string;
|
|
2605
|
+
ES_AZURE_VAULT_NAME?: string;
|
|
2606
|
+
ES_AZURE_TTL?: string;
|
|
2607
|
+
ES_AWS_WEBHOOK_URL?: string;
|
|
2608
|
+
ES_AWS_TTL?: string;
|
|
2609
|
+
ES_GCP_TTL?: string;
|
|
2610
|
+
};
|
|
2611
|
+
type TenantSecretsConfig = LfvSecretsConfig | (VaultSecretsConfig & {
|
|
2612
|
+
path: string;
|
|
2613
|
+
retryInterval?: number;
|
|
2614
|
+
}) | (DevSecretsConfig & {
|
|
2615
|
+
path?: string;
|
|
2616
|
+
appId?: string;
|
|
2617
|
+
}) | (AwsSecretsConfig & {
|
|
2618
|
+
ttl?: number;
|
|
2619
|
+
}) | AzureSecretsConfig | (GcpSecretsConfig & {
|
|
2620
|
+
ttl?: number;
|
|
2621
|
+
}) | {
|
|
2622
|
+
type: "localFile";
|
|
2623
|
+
path?: string;
|
|
2624
|
+
watch?: boolean;
|
|
2625
|
+
ttl?: number;
|
|
2626
|
+
};
|
|
2627
|
+
type StoredTenant<TExtended extends object = Record<string, never>> = {
|
|
2628
|
+
tenantId: string;
|
|
2629
|
+
companyId: string;
|
|
2630
|
+
companyName: string;
|
|
2631
|
+
environmentType: EnvironmentType;
|
|
2632
|
+
email: string;
|
|
2633
|
+
webhookUrl: string;
|
|
2634
|
+
callbackUrl: string;
|
|
2635
|
+
tenantUrl?: string;
|
|
2636
|
+
status: TenantStatus;
|
|
2637
|
+
error?: string;
|
|
2638
|
+
actionUrl?: string;
|
|
2639
|
+
requestToken?: string;
|
|
2640
|
+
expiresAt?: string;
|
|
2641
|
+
createdAt: Date;
|
|
2642
|
+
updatedAt: Date;
|
|
2643
|
+
/** Persisted typed config used to construct a ConfigSource at runtime. */
|
|
2644
|
+
configSource: TenantSecretsConfig;
|
|
2645
|
+
/** Runtime helper that returns a ConfigSource for this tenant. */
|
|
2646
|
+
config: () => ConfigSource;
|
|
2647
|
+
} & TExtended;
|
|
2648
|
+
interface TenantStore<TExtended extends object = Record<string, never>> {
|
|
2649
|
+
get(tenantId: string): Promise<StoredTenant<TExtended> | null>;
|
|
2650
|
+
upsert(tenant: Omit<StoredTenant<TExtended>, "config" | "status" | "createdAt" | "updatedAt"> & Partial<Pick<StoredTenant<TExtended>, "status" | "createdAt" | "updatedAt">>): Promise<StoredTenant<TExtended>>;
|
|
2651
|
+
delete(tenantId: string): Promise<void>;
|
|
2652
|
+
}
|
|
2653
|
+
declare class InMemoryTenantStore<TExtended extends object = Record<string, never>> implements TenantStore<TExtended> {
|
|
2654
|
+
private tenants;
|
|
2655
|
+
get(tenantId: string): Promise<StoredTenant<TExtended> | null>;
|
|
2656
|
+
upsert(tenant: Omit<StoredTenant<TExtended>, "config" | "status" | "createdAt" | "updatedAt"> & Partial<Pick<StoredTenant<TExtended>, "status" | "createdAt" | "updatedAt">>): Promise<StoredTenant<TExtended>>;
|
|
2657
|
+
delete(tenantId: string): Promise<void>;
|
|
2658
|
+
}
|
|
2659
|
+
declare function sendTenantWebhook(webhookUrl: string, payload: TenantWebhookPayload, log: Logger): Promise<void>;
|
|
2821
2660
|
/**
|
|
2822
2661
|
* Enterprise user with SCIM attributes.
|
|
2823
2662
|
* Extends BaseUser (simple fields) with optional complex SCIM fields.
|
|
@@ -3018,4 +2857,4 @@ declare function parseJsonc<T>(content: string): T;
|
|
|
3018
2857
|
* @returns A promise that resolves when the service is ready.
|
|
3019
2858
|
*/
|
|
3020
2859
|
declare function waitOn(url: string, pingInterval?: number, warnInterval?: number, timeout?: number): Promise<void>;
|
|
3021
|
-
export { workloadTokenResponseSchema, withValidate, waitOn, version, validationFailureResponse, userSchema, tokenResponseSchema,
|
|
2860
|
+
export { workloadTokenResponseSchema, withValidate, waitOn, version, validationFailureResponse, userSchema, tokenResponseSchema, stripJsonComments, silentLogger, setActiveSession, serializeESConfig, sendTenantWebhook, parseJsonc, oidcCallbackSchema, must, mergeConfig, list, jwtAssertionClaimsSchema, infoLogger, idTokenClaimsSchema, groupResourceSchema, getActiveSession, findTenantFromStateParam, defaultLogger, decodeUser, debugLogger, consoleLogger, claimsToUser, X509Certificate, WorkloadValidators, WorkloadTokenStore, WorkloadTokenResponse, WorkloadIncomingOutgoing, WorkloadIdentity, WorkloadConfigMap, WorkloadConfig, WorkloadClient, Workload, VaultSecretsConfig, ValidateResult, UsersInboundHandlerConfig, UserStore, UserSortOptions, UserSortField, UserListOptions, User2 as User, UpsertTenantResponse, UpsertTenantRequest, TokenValidationResult, TokenResponse, TenantWebhookPayload, TenantValidators, TenantStore, TenantStatus, TenantSecretsConfig, TenantRequestError, TenantConfigEnv, StoredUser, StoredTenant, StoredGroup, StateCookie, StandardSchemaWithValidate, SortDirection, SessionStore, Session, ServerOnlyWorkloadConfig, SecretsValidators, SecretsSourceType, SecretsSourceMap, SecretsSourceConfig, SecretsSource, SecretsOperationOptions, SecretsModuleConfig, Secrets, SecretRequestSeverity, SecretLifecycleRequest, Secret, User as ScimUser, ScimResult, ScimListResponse, ScimError, SSOValidators, SSOHandlerConfig, SSOConfig, SSO, Role, ResolvedLfvSecretsConfig, RemoteConfig, Photo, PhoneNumber, OidcCallbackParams, Name, MetaData, MagicLinkStore, MagicLink, LoginConfig, Logger, ListResult, LfvSecretsConfig, JwtBearerWorkloadConfig, JWTAssertionClaims, InMemoryTenantStore, IdTokenClaims, IAMValidators, IAMUsersInbound, IAMHandlerConfig, IAMGroupsOutbound, IAMGroupsInbound, IAMConfig, IAM, GroupsInboundHandlerConfig, GroupStore, GroupSortOptions, GroupSortField, GroupResource, GroupMember, GroupListOptions, Group, GcpSecretsConfig, FrameworkWorkloadIncomingOutgoing, FrameworkWorkloadConfig, FrameworkSecretsSourceConfig, FrameworkSecretsModuleConfig, FrameworkConfig, EnvironmentType, EnterpriseUser, EnterpriseStandardFromConfig, EnterpriseStandardBase, EnterpriseStandard, EnterpriseExtension, Email, ESValidators, ESRoutingOptions, ESRouteModule, ESRouteFilterResult, ESResolvedRoute, ESModuleFromConfig, ESConfigChangeResult, ESConfigChangeOptions, ESConfigChangeCallback, ESConfig, DevSecretsConfig, CreateUserOptions, CreateTenantResponse, CreateTenantRequest, CreateGroupOptions, ConfigSourceType, ConfigSource, ClientCredentialsWorkloadConfig, CachedWorkloadToken, CIAMValidators, CIAMConfigFromCode, CIAMConfig, CIAM, BaseUser, AzureSecretsConfig, AwsSecretsConfig, AwsAuthMethod, Address };
|