@getstrata/core 2.2.59 → 3.0.3
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/CHANGELOG.md +27 -0
- package/dist/core/audit/exportAuditLogs.d.ts +12 -3
- package/dist/core/audit/exportStore.d.ts +6 -2
- package/dist/core/audit/siemFormatter.d.ts +2 -2
- package/dist/core/auth/abilityCatalog.d.ts +1 -9
- package/dist/core/auth/authContext.d.ts +2 -0
- package/dist/core/auth/authOutcome.d.ts +32 -0
- package/dist/core/auth/authReader.d.ts +22 -0
- package/dist/core/auth/basicAuthGuard.d.ts +19 -3
- package/dist/core/auth/emailVerification.d.ts +1 -1
- package/dist/core/auth/guard.d.ts +27 -6
- package/dist/core/auth/intendedUrlCookie.d.ts +13 -7
- package/dist/core/auth/jwt.d.ts +5 -4
- package/dist/core/auth/jwtGuard.d.ts +7 -6
- package/dist/core/auth/membershipContext.d.ts +10 -7
- package/dist/core/auth/membershipContextMiddleware.d.ts +3 -3
- package/dist/core/auth/membershipMiddleware.d.ts +1 -2
- package/dist/core/auth/membershipServiceImplementation.d.ts +1 -1
- package/dist/core/auth/oauth/oidcIdToken.d.ts +25 -16
- package/dist/core/auth/oauth/oidcProvider.d.ts +6 -4
- package/dist/core/auth/oauth/providers.d.ts +3 -1
- package/dist/core/auth/oneTimeToken.d.ts +2 -3
- package/dist/core/auth/passwordConfirmCookie.d.ts +15 -6
- package/dist/core/auth/passwordLogin.d.ts +5 -5
- package/dist/core/auth/pendingMfaCookie.d.ts +2 -2
- package/dist/core/auth/policy.d.ts +23 -10
- package/dist/core/auth/requireAuthCapability.d.ts +3 -0
- package/dist/core/auth/resolveMembershipService.d.ts +3 -2
- package/dist/core/auth/saml/samlAssertionReplay.d.ts +4 -4
- package/dist/core/auth/saml/samlServiceProvider.d.ts +11 -7
- package/dist/core/auth/scimAuthMiddleware.d.ts +10 -3
- package/dist/core/auth/sessionCookie.d.ts +20 -9
- package/dist/core/auth/sessionGuard.d.ts +14 -3
- package/dist/core/cache/createCacheStore.d.ts +6 -3
- package/dist/core/cache/redisCacheStore.d.ts +5 -1
- package/dist/core/cache/repository.d.ts +5 -1
- package/dist/core/cache/simpleCache.d.ts +2 -1
- package/dist/core/cache/tokens.d.ts +8 -0
- package/dist/core/config/applicationConfig.d.ts +21 -0
- package/dist/core/config/configSnapshot.d.ts +3 -0
- package/dist/core/config/envSchema.d.ts +3 -2
- package/dist/core/contracts/application.d.ts +153 -0
- package/dist/core/contracts/authUserDirectory.d.ts +24 -7
- package/dist/core/contracts/container.d.ts +20 -23
- package/dist/core/contracts/di.d.ts +4 -2
- package/dist/core/contracts/executionContext.d.ts +5 -0
- package/dist/core/contracts/executionOperations.d.ts +10 -0
- package/dist/core/contracts/executionOwnership.d.ts +38 -0
- package/dist/core/contracts/persistence.d.ts +20 -0
- package/dist/core/contracts/serviceTokens.d.ts +32 -18
- package/dist/core/contracts/services.d.ts +63 -0
- package/dist/core/contracts/token.d.ts +19 -0
- package/dist/core/crypto/fieldEncryption.d.ts +19 -7
- package/dist/core/crypto/fieldEncryptionRotation.d.ts +21 -5
- package/dist/core/crypto/mfaSecret.d.ts +10 -3
- package/dist/core/database/baseRepository.d.ts +14 -10
- package/dist/core/database/bindings.d.ts +6 -0
- package/dist/core/database/bunSql.d.ts +3 -12
- package/dist/core/database/definitions.d.ts +209 -0
- package/dist/core/database/dialect.d.ts +5 -24
- package/dist/core/database/driverPorts.d.ts +116 -0
- package/dist/core/database/errors.d.ts +47 -7
- package/dist/core/database/factory.d.ts +51 -31
- package/dist/core/database/index.d.ts +9 -10
- package/dist/core/database/keyset.d.ts +2 -1
- package/dist/core/database/legacyNativeTransaction.d.ts +5 -0
- package/dist/core/database/manager.d.ts +12 -0
- package/dist/core/database/model.d.ts +91 -97
- package/dist/core/database/modelQuery.d.ts +9 -5
- package/dist/core/database/modelRegistry.d.ts +52 -33
- package/dist/core/database/mysqlConnection.d.ts +1 -19
- package/dist/core/database/mysqlNative.d.ts +38 -0
- package/dist/core/database/nativeTransactions.d.ts +16 -0
- package/dist/core/database/ormInternal.d.ts +85 -0
- package/dist/core/database/ormRuntime.d.ts +4 -0
- package/dist/core/database/ownedReadOnlyObservation.d.ts +16 -0
- package/dist/core/database/postgresNative.d.ts +11 -0
- package/dist/core/database/query.d.ts +24 -23
- package/dist/core/database/queryPlanSnapshot.d.ts +7 -0
- package/dist/core/database/rawMysql.d.ts +7 -0
- package/dist/core/database/rawPostgres.d.ts +23 -0
- package/dist/core/database/rawSqlite.d.ts +6 -0
- package/dist/core/database/relationQueries.d.ts +3 -2
- package/dist/core/database/relationQuery.d.ts +24 -6
- package/dist/core/database/repositoryQuery.d.ts +6 -1
- package/dist/core/database/schema/driver.d.ts +1 -1
- package/dist/core/database/seeders/types.d.ts +1 -1
- package/dist/core/database/session.d.ts +13 -0
- package/dist/core/database/sessionFactory.d.ts +9 -0
- package/dist/core/database/sqlDialects.d.ts +22 -0
- package/dist/core/database/tokens.d.ts +7 -0
- package/dist/core/database/transactionSession.d.ts +43 -0
- package/dist/core/errors/http.d.ts +4 -1
- package/dist/core/events/{eventBus.d.ts → eventBusClass.d.ts} +1 -3
- package/dist/core/events/index.d.ts +2 -3
- package/dist/core/events/outbox/index.d.ts +44 -13
- package/dist/core/events/outbox/metrics.d.ts +4 -4
- package/dist/core/events/outbox/workerTransport.d.ts +17 -0
- package/dist/core/http/authMiddleware.d.ts +2 -2
- package/dist/core/http/authorizeMiddleware.d.ts +2 -2
- package/dist/core/http/bodySizeLimitMiddleware.d.ts +1 -1
- package/dist/core/http/conditionalResponse.d.ts +7 -2
- package/dist/core/http/contentSecurityPolicy.d.ts +4 -3
- package/dist/core/http/corsMiddleware.d.ts +2 -1
- package/dist/core/http/csrfMiddleware.d.ts +6 -1
- package/dist/core/http/csrfToken.d.ts +17 -7
- package/dist/core/http/databaseError.d.ts +4 -0
- package/dist/core/http/etag.d.ts +5 -2
- package/dist/core/http/flashMiddleware.d.ts +1 -1
- package/dist/core/http/flashSession.d.ts +13 -7
- package/dist/core/http/index.d.ts +1 -1
- package/dist/core/http/loginThrottleMiddleware.d.ts +3 -3
- package/dist/core/http/memoryThrottleMiddleware.d.ts +2 -2
- package/dist/core/http/parseMultipartUpload.d.ts +3 -2
- package/dist/core/http/requestMetaContext.d.ts +5 -0
- package/dist/core/http/requireAbilityMiddleware.d.ts +1 -1
- package/dist/core/http/requireAuthMiddleware.d.ts +2 -2
- package/dist/core/http/requirePasswordConfirmMiddleware.d.ts +2 -1
- package/dist/core/http/requireVerifiedMiddleware.d.ts +2 -2
- package/dist/core/http/requireWebAuthMiddleware.d.ts +2 -2
- package/dist/core/http/response.d.ts +4 -3
- package/dist/core/http/scimThrottleMiddleware.d.ts +4 -3
- package/dist/core/http/securedRouteModelBinding.d.ts +10 -3
- package/dist/core/http/securityHeadersMiddleware.d.ts +1 -2
- package/dist/core/http/signedUrl.d.ts +8 -6
- package/dist/core/http/throttleMiddleware.d.ts +9 -5
- package/dist/core/http/uploads.d.ts +9 -3
- package/dist/core/http/webErrorResponse.d.ts +8 -2
- package/dist/core/jobs/exportAuditLogsJob.d.ts +5 -2
- package/dist/core/jobs/invalidateCacheTagsJob.d.ts +5 -4
- package/dist/core/lifecycle/gracefulShutdown.d.ts +2 -5
- package/dist/core/logging/requestLoggingMiddleware.d.ts +1 -1
- package/dist/core/mail/mailer.d.ts +7 -5
- package/dist/core/openapi/generator.d.ts +12 -4
- package/dist/core/openapi/registeredRoute.d.ts +4 -4
- package/dist/core/queue/createAppQueue.d.ts +9 -4
- package/dist/core/queue/failedJobMetrics.d.ts +11 -2
- package/dist/core/queue/failedJobRepository.d.ts +6 -3
- package/dist/core/queue/failedJobService.d.ts +1 -0
- package/dist/core/queue/index.d.ts +16 -6
- package/dist/core/queue/jobRegistry.d.ts +3 -2
- package/dist/core/queue/jobRunner.d.ts +10 -4
- package/dist/core/queue/publicQueue.d.ts +18 -9
- package/dist/core/queue/queueConfig.d.ts +20 -10
- package/dist/core/queue/queueHandoff.d.ts +31 -0
- package/dist/core/queue/queueMetrics.d.ts +10 -3
- package/dist/core/queue/queueServices.d.ts +28 -0
- package/dist/core/queue/queueWorkerTransport.d.ts +28 -0
- package/dist/core/queue/redisQueue.d.ts +19 -10
- package/dist/core/queue/redisQueueKeys.d.ts +5 -5
- package/dist/core/queue/redisStreams.d.ts +17 -10
- package/dist/core/queue/resilientQueue.d.ts +10 -4
- package/dist/core/queue/types.d.ts +1 -0
- package/dist/core/runtime/appKeyPrefix.d.ts +5 -5
- package/dist/core/runtime/application.d.ts +7 -0
- package/dist/core/runtime/executionContext.d.ts +9 -0
- package/dist/core/runtime/executionTasks.d.ts +49 -0
- package/dist/core/runtime/resourceJournal.d.ts +67 -0
- package/dist/core/runtime/serviceGraph.d.ts +14 -0
- package/dist/core/security/oauthState.d.ts +13 -9
- package/dist/core/security/publicReads.d.ts +2 -2
- package/dist/core/security/safeFetch.d.ts +1 -0
- package/dist/core/security/safeUrl.d.ts +3 -0
- package/dist/core/security/scimTenantTokens.d.ts +1 -1
- package/dist/core/security/tokenExpiry.d.ts +1 -1
- package/dist/core/security/webhookSignature.d.ts +1 -1
- package/dist/core/storage/storage.d.ts +24 -16
- package/dist/core/tenant/databaseTenantContext.d.ts +5 -7
- package/dist/core/tenant/resolveTenant.d.ts +2 -2
- package/dist/core/tenant/scopedDatabasePolicy.d.ts +8 -0
- package/dist/core/tenant/tenantDatabaseScope.d.ts +3 -7
- package/dist/core/tenant/tenantMiddleware.d.ts +15 -4
- package/dist/core/tracing/otel.d.ts +4 -6
- package/dist/core/tracing/tracingMiddleware.d.ts +3 -3
- package/dist/core/view/etaViewEngine.d.ts +1 -1
- package/dist/core/view/index.d.ts +5 -4
- package/dist/core/view/tokens.d.ts +8 -0
- package/dist/core/view/viewRenderer.d.ts +2 -2
- package/dist/core/view/webErrorView.d.ts +8 -7
- package/dist/core/view/webLayoutData.d.ts +6 -4
- package/dist/entries/audit/exportAuditLogs.js +87 -1024
- package/dist/entries/audit/siemFormatter.js +4 -90
- package/dist/entries/auth/abilityCatalog.js +28 -0
- package/dist/entries/auth/accessControl.js +5 -16
- package/dist/entries/auth/accountStateMigration.js +216 -236
- package/dist/entries/auth/authOutcome.js +80 -0
- package/dist/entries/auth/authReader.js +68 -0
- package/dist/entries/auth/basicAuthGuard.js +144 -1249
- package/dist/entries/auth/emailVerification.js +2 -2
- package/dist/entries/auth/intendedUrlCookie.js +35 -59
- package/dist/entries/auth/jwt.js +22 -47
- package/dist/entries/auth/jwtGuard.js +99 -231
- package/dist/entries/auth/membershipMiddleware.js +71 -10
- package/dist/entries/auth/membershipScope.js +16 -22
- package/dist/entries/auth/membershipService.js +11 -28
- package/dist/entries/auth/oauth/oidcProvider.js +59 -64
- package/dist/entries/auth/oauth/providers.js +12 -95
- package/dist/entries/auth/oauth/samlProvider.js +53 -1080
- package/dist/entries/auth/oneTimeToken.js +27 -289
- package/dist/entries/auth/passwordConfirmCookie.js +40 -63
- package/dist/entries/auth/passwordLogin.js +94 -399
- package/dist/entries/auth/pendingMfaCookie.js +6 -6
- package/dist/entries/auth/policy.js +22 -56
- package/dist/entries/auth/saml/samlServiceProvider.js +55 -1084
- package/dist/entries/auth/scimAuthMiddleware.js +16 -3358
- package/dist/entries/auth/sessionCookie.js +58 -73
- package/dist/entries/auth/sessionGuard.js +95 -248
- package/dist/entries/auth/tokenHash.js +11 -43
- package/dist/entries/cache/createCacheStore.js +126 -117
- package/dist/entries/cache/repository.js +25 -0
- package/dist/entries/cache/simpleCache.js +12 -7
- package/dist/entries/cache/tokens.js +9 -0
- package/dist/entries/config/applicationConfig.js +163 -0
- package/dist/entries/config/envSchema.js +21 -4
- package/dist/entries/contracts/application.js +1 -0
- package/dist/entries/contracts/authUserDirectory.js +10 -0
- package/dist/entries/contracts/container.js +99 -26
- package/dist/entries/contracts/di.js +3 -0
- package/dist/entries/contracts/executionContext.js +7 -0
- package/dist/entries/contracts/executionOperations.js +7 -0
- package/dist/entries/contracts/executionOwnership.js +7 -0
- package/dist/entries/contracts/membership.js +1 -0
- package/dist/entries/contracts/persistence.js +1 -0
- package/dist/entries/contracts/serviceTokens.js +26 -116
- package/dist/entries/contracts/services.js +98 -0
- package/dist/entries/contracts/token.js +41 -0
- package/dist/entries/crypto/fieldEncryption.js +49 -50
- package/dist/entries/crypto/mfaSecret.js +86 -82
- package/dist/entries/database/acquisitionMetrics.js +107 -0
- package/dist/entries/database/baseRepository.d.ts +2 -0
- package/dist/entries/database/bindings.js +2082 -0
- package/dist/entries/database/definitions.js +175 -0
- package/dist/entries/database/errors.js +114 -89
- package/dist/entries/database/factory.js +67 -28
- package/dist/entries/database/migrations.js +172 -224
- package/dist/entries/database/model.d.ts +1 -0
- package/dist/entries/database/ownedReadOnlyObservation.js +1282 -0
- package/dist/entries/database/query.js +159 -161
- package/dist/entries/database/repositoryQuery.d.ts +1 -0
- package/dist/entries/database/repositoryQuery.js +1 -1373
- package/dist/entries/database/schema.js +216 -236
- package/dist/entries/database/session.js +1 -0
- package/dist/entries/database/sqliteConnection.js +525 -83
- package/dist/entries/database/tokens.js +9 -0
- package/dist/entries/errors/http.js +118 -1
- package/dist/entries/http/authMiddleware.js +8 -5
- package/dist/entries/http/authorizeMiddleware.js +1 -1
- package/dist/entries/http/bodySizeLimitMiddleware.js +2 -2
- package/dist/entries/http/clientIp.js +2 -2
- package/dist/entries/http/conditionalResponse.js +19 -7
- package/dist/entries/http/corsMiddleware.js +6 -101
- package/dist/entries/http/csrfMiddleware.js +92 -106
- package/dist/entries/http/csrfToken.js +58 -94
- package/dist/entries/http/etag.js +7 -4
- package/dist/entries/http/flashMiddleware.js +57 -99
- package/dist/entries/http/flashSession.js +41 -68
- package/dist/entries/http/memoryThrottleMiddleware.js +43 -186
- package/dist/entries/http/metricsMiddleware.js +2 -16
- package/dist/entries/http/parseMultipartUpload.js +15 -29
- package/dist/entries/http/requireAbilityMiddleware.js +2 -2
- package/dist/entries/http/requirePasswordConfirmMiddleware.js +19 -31
- package/dist/entries/http/requireVerifiedMiddleware.js +4 -7
- package/dist/entries/http/requireWebAuthMiddleware.js +2 -2
- package/dist/entries/http/response.js +67 -233
- package/dist/entries/http/routeMiddleware.js +0 -14
- package/dist/entries/http/scimThrottleMiddleware.js +43 -237
- package/dist/entries/http/securedRouteModelBinding.js +37 -25
- package/dist/entries/http/securityHeadersMiddleware.js +8 -25
- package/dist/entries/http/signedUrl.js +20 -110
- package/dist/entries/http/throttleMiddleware.js +41 -185
- package/dist/entries/http/uploads.js +9 -24
- package/dist/entries/jobs/exportAuditLogsJob.js +17 -1498
- package/dist/entries/jobs/invalidateCacheTagsJob.js +12 -47
- package/dist/entries/logging/requestLoggingMiddleware.js +4 -4
- package/dist/entries/mail/mailer.js +68 -78
- package/dist/entries/openapi/generator.js +33 -100
- package/dist/entries/queue/createAppQueue.js +416 -254
- package/dist/entries/queue/failedJobRepository.js +19 -8
- package/dist/entries/queue/failedJobService.js +1 -0
- package/dist/entries/queue/jobRunner.js +141 -66
- package/dist/entries/queue/publicQueue.js +411 -255
- package/dist/entries/queue/queueConfig.js +61 -0
- package/dist/entries/queue/queueHandoff.js +318 -0
- package/dist/entries/queue/queueMetrics.js +989 -1384
- package/dist/entries/queue/queueServices.js +133 -0
- package/dist/entries/queue/queueWorkerTransport.js +1703 -0
- package/dist/entries/queue/redisQueue.js +282 -180
- package/dist/entries/queue.js +6 -45
- package/dist/entries/runtime/application.js +1585 -0
- package/dist/entries/runtime/asyncContextStore.js +0 -16
- package/dist/entries/security/oauthState.js +35 -67
- package/dist/entries/security/publicReads.js +4 -4
- package/dist/entries/security/safeFetch.js +1 -0
- package/dist/entries/security/scimTenantTokens.js +3 -3
- package/dist/entries/security/tokenExpiry.js +2 -2
- package/dist/entries/security/totp.js +1 -87
- package/dist/entries/security/webhookSignature.js +2 -90
- package/dist/entries/storage/storage.js +120 -45
- package/dist/entries/tenant/databaseTenantContext.js +6 -907
- package/dist/entries/tenant/publicTenantHost.js +78 -0
- package/dist/entries/tenant/resolveTenant.js +14 -0
- package/dist/entries/tenant/scopedDatabasePolicy.js +75 -0
- package/dist/entries/tenant/tenancyConfig.js +1 -19
- package/dist/entries/tenant/tenantDatabaseScope.js +3 -892
- package/dist/entries/tracing/tracingMiddleware.js +104 -173
- package/dist/entries/view/tokens.js +11 -0
- package/dist/framework/public-api.d.ts +62 -44
- package/dist/index.js +10433 -11347
- package/dist/internal/ormInternal.js +117 -0
- package/dist/internal/ormRuntime.js +5000 -0
- package/package.json +158 -46
- package/dist/core/database/bindConnection.d.ts +0 -1
- package/dist/core/database/boundConnection.d.ts +0 -5
- package/dist/core/database/defaultConnection.d.ts +0 -7
- package/dist/core/database/namedConnections.d.ts +0 -15
- package/dist/core/database/readOnlyCollector.d.ts +0 -7
- package/dist/core/database/repositoryConnection.d.ts +0 -4
- package/dist/core/database/transaction.d.ts +0 -23
- package/dist/core/database/transactionControl.d.ts +0 -6
- package/dist/core/events/deferredModelEvents.d.ts +0 -7
- package/dist/core/facades/index.d.ts +0 -10
- package/dist/core/runtime/applicationRegistry.d.ts +0 -18
- package/dist/entries/database/bindConnection.js +0 -1
- package/dist/entries/database/boundConnection.js +0 -1
- package/dist/entries/database/defaultConnection.js +0 -1
- package/dist/entries/database/namedConnections.js +0 -1
- package/dist/entries/database/repositoryConnection.js +0 -1
- package/dist/entries/database/transaction.js +0 -1
- package/dist/entries/facades.js +0 -711
- package/dist/entries/runtime/applicationRegistry.js +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CommandScope } from "../contracts/application";
|
|
2
|
+
import type { ExecutionOperations } from "../contracts/executionOperations";
|
|
3
|
+
import type { OwnedBoundary, OwnedExecution, OwnedInvocation } from "../contracts/executionOwnership";
|
|
4
|
+
type Work<T> = (scope: CommandScope) => T | Promise<T>;
|
|
5
|
+
type Operation<T> = {
|
|
6
|
+
readonly promise: Promise<T>;
|
|
7
|
+
invoke(): void;
|
|
8
|
+
};
|
|
9
|
+
type TaskResources = {
|
|
10
|
+
readonly acquire: CommandScope["acquire"];
|
|
11
|
+
child(): TaskResources;
|
|
12
|
+
seal(): void;
|
|
13
|
+
finalize(): Promise<{
|
|
14
|
+
readonly acquisitionFailures: readonly unknown[];
|
|
15
|
+
readonly cleanupFailures: readonly unknown[];
|
|
16
|
+
readonly retained: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
/** The application supplies its existing body lease and the execution's resolver. */
|
|
20
|
+
type OperationFactory = <T>(work: (scope: CommandScope, task: OwnedBoundary) => T | Promise<T>, spawn: CommandScope["spawn"], resources: TaskResources, dispatch: TaskDispatch) => Operation<T>;
|
|
21
|
+
type TaskDispatch = {
|
|
22
|
+
readonly operation: ExecutionOperations["operation"];
|
|
23
|
+
readonly joined: OwnedExecution["joined"];
|
|
24
|
+
readonly finalize: OwnedBoundary["finalize"];
|
|
25
|
+
readonly bookkeeping: boolean;
|
|
26
|
+
readonly path: readonly symbol[];
|
|
27
|
+
readonly enter?: OwnedInvocation;
|
|
28
|
+
entryFailed(error: unknown): void;
|
|
29
|
+
};
|
|
30
|
+
type BodyOutcome<T> = {
|
|
31
|
+
readonly ok: true;
|
|
32
|
+
readonly value: T;
|
|
33
|
+
} | {
|
|
34
|
+
readonly ok: false;
|
|
35
|
+
readonly error: unknown;
|
|
36
|
+
};
|
|
37
|
+
type Settlement<T> = {
|
|
38
|
+
readonly invoked: boolean;
|
|
39
|
+
readonly retained: boolean;
|
|
40
|
+
readonly body: BodyOutcome<T>;
|
|
41
|
+
/** Private occurrences, never a publicly observed aggregate's mutable structure. */
|
|
42
|
+
readonly failures: readonly unknown[];
|
|
43
|
+
};
|
|
44
|
+
/** Joins actual bodies recursively; public subtree summaries never enter the ledger. */
|
|
45
|
+
declare function settleExecutionTasks<T>(work: Work<T>, check: () => void, createOperation: OperationFactory, resources: TaskResources, blank: <T>(work: () => T) => T): Promise<Settlement<T>>;
|
|
46
|
+
/** Build the public root observation only after all execution-owned cleanup is included. */
|
|
47
|
+
declare function completeExecution<T>(result: Settlement<T>): T;
|
|
48
|
+
export type { Settlement, TaskResources };
|
|
49
|
+
export { completeExecution, settleExecutionTasks };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ApplicationDiagnostic, CleanupContext, ResourceSpec } from "../contracts/application";
|
|
2
|
+
export type ResourceGroup = {
|
|
3
|
+
readonly key: symbol;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly requires: readonly symbol[];
|
|
6
|
+
};
|
|
7
|
+
export type ExecutionResourceTemplate = {
|
|
8
|
+
readonly key: symbol;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly requires: readonly symbol[];
|
|
11
|
+
};
|
|
12
|
+
export type ExecutionResources = {
|
|
13
|
+
acquire<T>(template: ExecutionResourceTemplate, spec: ResourceSpec<T>, signal: AbortSignal, validate?: (value: T) => void, check?: () => void): Promise<T>;
|
|
14
|
+
createRootTaskGroup(): ResourceGroup;
|
|
15
|
+
finalize(context: CleanupContext): Promise<TaskResourceResult>;
|
|
16
|
+
};
|
|
17
|
+
export type TaskResourceResult = {
|
|
18
|
+
readonly acquisitionFailures: readonly unknown[];
|
|
19
|
+
readonly cleanupFailures: readonly unknown[];
|
|
20
|
+
readonly retained: boolean;
|
|
21
|
+
};
|
|
22
|
+
type Observer = {
|
|
23
|
+
record(diagnostic: ApplicationDiagnostic): void;
|
|
24
|
+
changed(): void;
|
|
25
|
+
};
|
|
26
|
+
/** The sole acquisition and lifecycle engine for static and task-owned resources. */
|
|
27
|
+
export declare class ResourceJournal {
|
|
28
|
+
private readonly observer;
|
|
29
|
+
private readonly resources;
|
|
30
|
+
private readonly definitions;
|
|
31
|
+
private readonly providerOrder;
|
|
32
|
+
private readonly taskGroups;
|
|
33
|
+
private readonly taskKeys;
|
|
34
|
+
private readonly staticKeys;
|
|
35
|
+
private nextResource;
|
|
36
|
+
private nextGroup;
|
|
37
|
+
private nextHook;
|
|
38
|
+
private unsafe;
|
|
39
|
+
constructor(groups: readonly ResourceGroup[], observer: Observer);
|
|
40
|
+
createTaskGroup(parent?: ResourceGroup): ResourceGroup;
|
|
41
|
+
createExecutionResources(templates: readonly ExecutionResourceTemplate[]): ExecutionResources;
|
|
42
|
+
private registerDynamicGroup;
|
|
43
|
+
sealGroup(group: ResourceGroup): void;
|
|
44
|
+
finalizeGroup(group: ResourceGroup, context: CleanupContext): Promise<TaskResourceResult>;
|
|
45
|
+
private finalizeGroups;
|
|
46
|
+
acquire<T>(group: ResourceGroup, spec: ResourceSpec<T>, signal: AbortSignal, validate?: (value: T) => void, check?: () => void): Promise<T>;
|
|
47
|
+
scanStop(context: CleanupContext): Promise<boolean>;
|
|
48
|
+
drain(context: CleanupContext): Promise<boolean>;
|
|
49
|
+
flushAndClose(context: CleanupContext, selected?: ReadonlySet<symbol>): Promise<void>;
|
|
50
|
+
view(): Readonly<{
|
|
51
|
+
pendingAcquisitions: readonly string[];
|
|
52
|
+
retainedResources: readonly string[];
|
|
53
|
+
unstopped: boolean;
|
|
54
|
+
unsafe: boolean;
|
|
55
|
+
resourceCount: number;
|
|
56
|
+
groupCount: number;
|
|
57
|
+
taskGroupCount: number;
|
|
58
|
+
}>;
|
|
59
|
+
private groupResources;
|
|
60
|
+
private blockedGroups;
|
|
61
|
+
private blockDependencies;
|
|
62
|
+
private reverseResources;
|
|
63
|
+
private hook;
|
|
64
|
+
private pruneGroups;
|
|
65
|
+
private record;
|
|
66
|
+
}
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ServiceDeclaration } from "@getstrata/core/contracts/services";
|
|
2
|
+
import type { ServiceContainer } from "../contracts/container";
|
|
3
|
+
import type { ExecutionResourceTemplate, ResourceGroup, ResourceJournal } from "./resourceJournal";
|
|
4
|
+
type ResourceAcquisition = Pick<ResourceJournal, "acquire">;
|
|
5
|
+
/** Definitions and order only. ServiceContainer owns every initialized value and promise. */
|
|
6
|
+
interface ServiceGraph {
|
|
7
|
+
readonly resourceGroups: readonly ResourceGroup[];
|
|
8
|
+
readonly executionResourceTemplates: readonly ExecutionResourceTemplate[];
|
|
9
|
+
start(container: ServiceContainer, signal: AbortSignal, acquisition: ResourceAcquisition): Promise<void>;
|
|
10
|
+
startExecution(container: ServiceContainer, signal: AbortSignal, checkpoint?: () => void, acquisition?: ResourceAcquisition): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
declare function compileServiceGraph(declarations?: readonly ServiceDeclaration[], overrides?: readonly ServiceDeclaration[]): ServiceGraph;
|
|
13
|
+
export type { ServiceGraph };
|
|
14
|
+
export { compileServiceGraph };
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
declare const OAUTH_STATE_COOKIE = "oauth_state";
|
|
2
2
|
declare const OIDC_PKCE_COOKIE = "oidc_pkce";
|
|
3
|
+
interface OAuthStateOptions {
|
|
4
|
+
readonly secret: string;
|
|
5
|
+
readonly production: boolean;
|
|
6
|
+
}
|
|
3
7
|
interface OidcPkceSeal {
|
|
4
8
|
state: string;
|
|
5
9
|
nonce: string;
|
|
6
10
|
codeVerifier: string;
|
|
7
11
|
}
|
|
8
|
-
declare function verifySignedOAuthStateValue(value: string): boolean;
|
|
9
|
-
declare function createOAuthState(): {
|
|
12
|
+
declare function verifySignedOAuthStateValue(value: string, options?: OAuthStateOptions): boolean;
|
|
13
|
+
declare function createOAuthState(options?: OAuthStateOptions): {
|
|
10
14
|
state: string;
|
|
11
15
|
};
|
|
12
|
-
declare function createOAuthStateCookie(): {
|
|
16
|
+
declare function createOAuthStateCookie(options?: OAuthStateOptions): {
|
|
13
17
|
state: string;
|
|
14
18
|
cookie: string;
|
|
15
19
|
};
|
|
16
|
-
declare function verifyOAuthState(_request: Request, returnedState: string | null): boolean;
|
|
17
|
-
declare function clearOAuthStateCookie(): string;
|
|
18
|
-
declare function sealOidcPkceCookie(payload: OidcPkceSeal): string;
|
|
19
|
-
declare function clearOidcPkceCookie(): string;
|
|
20
|
-
declare function readOidcPkceCookie(request: Request, returnedState: string | null): {
|
|
20
|
+
declare function verifyOAuthState(_request: Request, returnedState: string | null, options?: OAuthStateOptions): boolean;
|
|
21
|
+
declare function clearOAuthStateCookie(options?: OAuthStateOptions): string;
|
|
22
|
+
declare function sealOidcPkceCookie(payload: OidcPkceSeal, options?: OAuthStateOptions): string;
|
|
23
|
+
declare function clearOidcPkceCookie(options?: OAuthStateOptions): string;
|
|
24
|
+
declare function readOidcPkceCookie(request: Request, returnedState: string | null, options?: OAuthStateOptions): {
|
|
21
25
|
nonce: string;
|
|
22
26
|
codeVerifier: string;
|
|
23
27
|
} | null;
|
|
24
|
-
export type { OidcPkceSeal };
|
|
28
|
+
export type { OAuthStateOptions, OidcPkceSeal };
|
|
25
29
|
export { clearOAuthStateCookie, clearOidcPkceCookie, createOAuthState, createOAuthStateCookie, OAUTH_STATE_COOKIE, OIDC_PKCE_COOKIE, readOidcPkceCookie, sealOidcPkceCookie, verifyOAuthState, verifySignedOAuthStateValue, };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare function isPublicReadsEnabled(): boolean;
|
|
2
|
-
declare function guestCanViewResource(): boolean;
|
|
1
|
+
declare function isPublicReadsEnabled(enabled?: boolean): boolean;
|
|
2
|
+
declare function guestCanViewResource(enabled?: boolean): boolean;
|
|
3
3
|
export { guestCanViewResource, isPublicReadsEnabled };
|
|
@@ -9,6 +9,7 @@ type DnsLookup = (hostname: string, options: {
|
|
|
9
9
|
declare function isBlockedHostname(hostname: string): boolean;
|
|
10
10
|
declare function assertSafeOutboundUrl(rawUrl: string, options?: {
|
|
11
11
|
allowHttp?: boolean;
|
|
12
|
+
production?: boolean;
|
|
12
13
|
allowPrivate?: boolean;
|
|
13
14
|
}): URL;
|
|
14
15
|
declare function isBlockedIpAddress(address: string): boolean;
|
|
@@ -20,11 +21,13 @@ interface ResolvedOutboundUrl {
|
|
|
20
21
|
declare function resolveSafeOutboundTarget(rawUrl: string, options?: {
|
|
21
22
|
allowHttp?: boolean;
|
|
22
23
|
resolveDns?: boolean;
|
|
24
|
+
production?: boolean;
|
|
23
25
|
allowPrivate?: boolean;
|
|
24
26
|
}): Promise<ResolvedOutboundUrl>;
|
|
25
27
|
declare function assertSafeOutboundUrlResolved(rawUrl: string, options?: {
|
|
26
28
|
allowHttp?: boolean;
|
|
27
29
|
resolveDns?: boolean;
|
|
30
|
+
production?: boolean;
|
|
28
31
|
allowPrivate?: boolean;
|
|
29
32
|
}): Promise<URL>;
|
|
30
33
|
declare function setDnsLookupForTests(lookupFn: DnsLookup): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
declare function parseScimTenantTokens(raw: string | undefined): Map<number, string>;
|
|
2
|
-
declare function resolveScimTenantFromToken(token: string): number | null;
|
|
2
|
+
declare function resolveScimTenantFromToken(token: string, env: Readonly<Record<string, string | undefined>>): number | null;
|
|
3
3
|
export { parseScimTenantTokens, resolveScimTenantFromToken };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function resolveDefaultTokenExpiryDays(): number | null;
|
|
1
|
+
declare function resolveDefaultTokenExpiryDays(value?: string): number | null;
|
|
2
2
|
export { resolveDefaultTokenExpiryDays };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
declare function signWebhookBody(secret: string, body: string | Buffer): string;
|
|
2
|
-
declare function signedWebhookHeaders(secret: string, body: string | Buffer): Record<string, string>;
|
|
2
|
+
declare function signedWebhookHeaders(secret: string, body: string | Buffer, headerName?: string): Record<string, string>;
|
|
3
3
|
export { signedWebhookHeaders, signWebhookBody };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { CORE_STORAGE_TOKEN } from "@getstrata/core/contracts/serviceTokens";
|
|
1
2
|
import { S3Client } from "bun";
|
|
2
|
-
/** Missing
|
|
3
|
+
/** Missing reads return null; deletion is idempotent. All other failures reject. */
|
|
3
4
|
interface StorageDriver {
|
|
4
5
|
put(path: string, contents: string | Uint8Array): Promise<string>;
|
|
5
6
|
get(path: string): Promise<Uint8Array | null>;
|
|
6
|
-
delete(path: string): Promise<
|
|
7
|
+
delete(path: string): Promise<void>;
|
|
7
8
|
}
|
|
8
9
|
interface S3StorageConfig {
|
|
9
10
|
accessKeyId: string;
|
|
@@ -11,35 +12,42 @@ interface S3StorageConfig {
|
|
|
11
12
|
bucket: string;
|
|
12
13
|
region?: string;
|
|
13
14
|
endpoint?: string;
|
|
15
|
+
sessionToken?: string;
|
|
14
16
|
}
|
|
15
17
|
declare class LocalStorageDriver implements StorageDriver {
|
|
16
|
-
private readonly rootDirectory
|
|
17
|
-
constructor(rootDirectory?: string
|
|
18
|
-
private resolveRootDirectory;
|
|
18
|
+
private readonly rootDirectory;
|
|
19
|
+
constructor(rootDirectory?: string);
|
|
19
20
|
private resolvePath;
|
|
20
21
|
put(path: string, contents: string | Uint8Array): Promise<string>;
|
|
21
22
|
get(path: string): Promise<Uint8Array | null>;
|
|
22
|
-
delete(path: string): Promise<
|
|
23
|
+
delete(path: string): Promise<void>;
|
|
23
24
|
}
|
|
24
25
|
declare class S3StorageDriver implements StorageDriver {
|
|
25
26
|
private readonly client;
|
|
26
27
|
constructor(client: S3Client);
|
|
27
28
|
put(path: string, contents: string | Uint8Array): Promise<string>;
|
|
28
29
|
get(path: string): Promise<Uint8Array | null>;
|
|
29
|
-
delete(path: string): Promise<
|
|
30
|
+
delete(path: string): Promise<void>;
|
|
30
31
|
}
|
|
31
32
|
declare class StorageManager {
|
|
32
33
|
private readonly driver;
|
|
33
34
|
constructor(driver: StorageDriver);
|
|
34
35
|
put(path: string, contents: string | Uint8Array): Promise<string>;
|
|
35
36
|
get(path: string): Promise<Uint8Array | null>;
|
|
36
|
-
delete(path: string): Promise<
|
|
37
|
+
delete(path: string): Promise<void>;
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
type StorageConfig = {
|
|
40
|
+
readonly driver: "local";
|
|
41
|
+
readonly rootDirectory: string;
|
|
42
|
+
} | {
|
|
43
|
+
readonly driver: "s3";
|
|
44
|
+
readonly s3: Readonly<S3StorageConfig>;
|
|
45
|
+
};
|
|
46
|
+
declare function snapshotStorageConfig(config: StorageConfig): StorageConfig;
|
|
47
|
+
/** Configuration adapter: read environment only during assembly. */
|
|
48
|
+
declare function resolveS3Config(env?: Readonly<Record<string, string | undefined>>): Readonly<S3StorageConfig>;
|
|
49
|
+
declare function resolveStorageConfig(env?: Readonly<Record<string, string | undefined>>): StorageConfig;
|
|
50
|
+
declare function createS3Client(config: Readonly<S3StorageConfig>): S3Client;
|
|
51
|
+
declare function createStorageDriver(config: StorageConfig): StorageDriver;
|
|
52
|
+
export type { S3StorageConfig, StorageConfig, StorageDriver };
|
|
53
|
+
export { CORE_STORAGE_TOKEN, createS3Client, createStorageDriver, LocalStorageDriver, resolveS3Config, resolveStorageConfig, S3StorageDriver, StorageManager, snapshotStorageConfig, };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare function
|
|
5
|
-
declare function
|
|
6
|
-
declare function runWithMigrationBypassForIdentifier<T>(identifier: string | number, callback: () => T | Promise<T>): Promise<T>;
|
|
7
|
-
export { runWithMigrationBypass, runWithMigrationBypassForIdentifier, runWithScopedTenantTransaction, };
|
|
1
|
+
import type { DatabaseSession, TransactionSession } from "../database/session";
|
|
2
|
+
import type { EstablishedDatabasePolicy, ScopedPolicy } from "./scopedDatabasePolicy";
|
|
3
|
+
export declare function runWithScopedTenantTransaction<T>(selected: DatabaseSession | TransactionSession, policy: ScopedPolicy, established: EstablishedDatabasePolicy, callback: (child: TransactionSession) => T | Promise<T>): Promise<T>;
|
|
4
|
+
export declare function runWithMigrationBypass<T>(selected: DatabaseSession | TransactionSession, policy: ScopedPolicy, callback: (child: TransactionSession) => T | Promise<T>): Promise<T>;
|
|
5
|
+
export declare function runWithMigrationBypassForIdentifier<T>(selected: DatabaseSession | TransactionSession, policy: ScopedPolicy, identifier: string | number, callback: (child: TransactionSession) => T | Promise<T>): Promise<T>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import type { DatabaseSession, TransactionSession } from "../database/session";
|
|
1
2
|
import type { TenantContext } from "./tenantContext";
|
|
2
|
-
declare function resolveTenant(tenantId: number): Promise<TenantContext | null>;
|
|
3
|
-
export { resolveTenant };
|
|
3
|
+
export declare function resolveTenant(selected: DatabaseSession | TransactionSession, tenantId: number): Promise<TenantContext | null>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExecutionContext } from "../contracts/application";
|
|
2
|
+
import type { OwnedExecution } from "../contracts/executionOwnership";
|
|
3
|
+
import type { ScopedPolicy } from "../contracts/persistence";
|
|
4
|
+
import type { DatabaseSession } from "../database/session";
|
|
5
|
+
export type { EstablishedDatabasePolicy, ScopedPolicy } from "../contracts/persistence";
|
|
6
|
+
export declare function assertBypassIdentifier(identifier: string | number): void;
|
|
7
|
+
/** The existing execution tree is the restore barrier, not merely the callback body. */
|
|
8
|
+
export declare function createScopedPolicy(ownership: OwnedExecution, context: Pick<ExecutionContext, "tenant">, selectedRoot: DatabaseSession): ScopedPolicy;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
+
import type { DatabaseSession, TransactionSession } from "../database/session";
|
|
2
|
+
import type { ScopedPolicy } from "./scopedDatabasePolicy";
|
|
1
3
|
import { type TenantContext } from "./tenantContext";
|
|
2
|
-
|
|
3
|
-
unsafe(query: string, params?: readonly unknown[]): Promise<unknown[]>;
|
|
4
|
-
};
|
|
5
|
-
declare function applyTenantContextToTransaction(transaction: TransactionHandle, tenantId: number): Promise<void>;
|
|
6
|
-
declare function runWithTenantDatabase<T>(tenant: TenantContext, callback: () => T | Promise<T>): Promise<T>;
|
|
7
|
-
declare function isInsideTenantDatabaseScope(tenantId?: number | undefined): boolean;
|
|
8
|
-
export { applyTenantContextToTransaction, isInsideTenantDatabaseScope, runWithTenantDatabase };
|
|
4
|
+
export declare function runWithTenantDatabase<T>(selected: DatabaseSession | TransactionSession, policy: ScopedPolicy, tenant: TenantContext, callback: (child: TransactionSession) => T | Promise<T>): Promise<T>;
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
+
import type { AuthUser, CredentialSource } from "../auth/authContext";
|
|
1
2
|
import { type PublicTenancyOptions } from "./publicTenantHost";
|
|
2
3
|
import { type TenantContext } from "./tenantContext";
|
|
3
4
|
declare const DEFAULT_TENANT: TenantContext;
|
|
4
|
-
declare function resolveUserTenantId(userId: number): Promise<number>;
|
|
5
5
|
declare function auditChecksum(payload: Record<string, unknown>): string;
|
|
6
6
|
type TenantResolver = (id: number) => Promise<TenantContext | null>;
|
|
7
7
|
interface TenantMiddlewareOptions {
|
|
8
8
|
/** Load trusted application metadata after the framework selects the tenant ID. */
|
|
9
|
-
resolveTenant
|
|
9
|
+
resolveTenant: TenantResolver;
|
|
10
|
+
userTenantId(userId: number): Promise<number>;
|
|
11
|
+
auth: {
|
|
12
|
+
user: AuthUser | null;
|
|
13
|
+
credentialSource: CredentialSource;
|
|
14
|
+
};
|
|
15
|
+
config: {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
production: boolean;
|
|
18
|
+
allowDevHeaders: boolean;
|
|
19
|
+
};
|
|
10
20
|
publicTenancy?: PublicTenancyOptions;
|
|
11
21
|
}
|
|
12
|
-
declare function
|
|
22
|
+
declare function resolveTenantForRequest(request: Request, options: TenantMiddlewareOptions, resolver: TenantResolver, selectPublicTenant?: (request: Request) => Promise<number>): Promise<TenantContext>;
|
|
23
|
+
declare function createTenantMiddleware(options: TenantMiddlewareOptions): (request: Request, next: () => Promise<Response>) => Promise<Response>;
|
|
13
24
|
export type { PublicTenancyOptions } from "./publicTenantHost";
|
|
14
25
|
export { normalizeTenantHostname } from "./publicTenantHost";
|
|
15
26
|
export type { TenantMiddlewareOptions, TenantResolver };
|
|
16
|
-
export { auditChecksum, createTenantMiddleware, DEFAULT_TENANT,
|
|
27
|
+
export { auditChecksum, createTenantMiddleware, DEFAULT_TENANT, resolveTenantForRequest };
|
|
@@ -3,6 +3,7 @@ import { W3CTraceContextPropagator } from "@opentelemetry/core";
|
|
|
3
3
|
import { type SpanExporter } from "@opentelemetry/sdk-trace-base";
|
|
4
4
|
import { type TracingMetricsSnapshot } from "./health";
|
|
5
5
|
type TracingOptions = {
|
|
6
|
+
env?: Readonly<Record<string, string | undefined>>;
|
|
6
7
|
exporter?: SpanExporter;
|
|
7
8
|
endpoint?: string;
|
|
8
9
|
serviceName?: string;
|
|
@@ -20,11 +21,8 @@ type TracingRuntime = {
|
|
|
20
21
|
forceFlush(): Promise<void>;
|
|
21
22
|
shutdown(): Promise<void>;
|
|
22
23
|
};
|
|
24
|
+
/** Prepare SDK transport configuration for one runtime owner; do not reuse the exporter. */
|
|
25
|
+
declare function captureTracingOptions(options?: TracingOptions): TracingOptions;
|
|
23
26
|
declare function createTracingRuntime(options?: TracingOptions): TracingRuntime;
|
|
24
|
-
declare function getTracingRuntime(): TracingRuntime;
|
|
25
|
-
declare function acquireTracingRuntime(): {
|
|
26
|
-
flush(): Promise<void>;
|
|
27
|
-
release(): Promise<void>;
|
|
28
|
-
};
|
|
29
27
|
export type { TracingOptions, TracingRuntime };
|
|
30
|
-
export {
|
|
28
|
+
export { captureTracingOptions, createTracingRuntime };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Middleware } from "@getstrata/core/http/middleware";
|
|
2
|
-
import {
|
|
3
|
-
declare function createTracingMiddleware(runtime
|
|
2
|
+
import type { TracingRuntime } from "./otel";
|
|
3
|
+
declare function createTracingMiddleware(runtime: TracingRuntime): Middleware;
|
|
4
4
|
export type { TracingMetricsSnapshot } from "./health";
|
|
5
5
|
export { renderTracingMetrics } from "./health";
|
|
6
6
|
export type { TracingOptions, TracingRuntime } from "./otel";
|
|
7
|
-
export {
|
|
7
|
+
export { captureTracingOptions, createTracingRuntime } from "./otel";
|
|
8
8
|
export { createTracingMiddleware };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
export { CORE_VIEW_RENDERER_TOKEN, CORE_WEB_ERROR_VIEW_TOKEN } from "@getstrata/core/view/tokens";
|
|
1
2
|
export type { LayoutDataResolver, RenderOptions } from "./etaViewEngine";
|
|
2
3
|
export { DEFAULT_VIEWS_DIRECTORY, EtaViewEngine } from "./etaViewEngine";
|
|
3
4
|
export { htmlResponse, isHtmxRequest, redirectResponse, rssResponse, textResponse, xmlResponse, } from "./htmlResponse";
|
|
4
5
|
export type { ViewEngine } from "./viewEngine";
|
|
5
6
|
export type { HtmxViewResponseOptions, NamespacedViewRenderer, ViewNamespaceOptions, ViewResponseOptions, } from "./viewRenderer";
|
|
6
|
-
export {
|
|
7
|
-
export type { WebErrorViewInput, WebErrorViewOptions } from "./webErrorView";
|
|
8
|
-
export {
|
|
7
|
+
export { ViewRenderer } from "./viewRenderer";
|
|
8
|
+
export type { WebErrorView, WebErrorViewInput, WebErrorViewOptions } from "./webErrorView";
|
|
9
|
+
export { createWebErrorView, errorTemplateName, htmlErrorResponse, notFoundHtmlResponse, renderKernelErrorChrome, renderWebErrorHtml, } from "./webErrorView";
|
|
9
10
|
export type { WebLayoutAuthUser, WebLayoutData, WebLayoutDataOptions, WebLayoutUserKey, } from "./webLayoutData";
|
|
10
|
-
export {
|
|
11
|
+
export { createWebLayoutDataResolver, resolveWebLayoutData, } from "./webLayoutData";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EtaViewEngine } from "./etaViewEngine";
|
|
2
|
+
import type { ViewRenderer } from "./viewRenderer";
|
|
3
|
+
import type { WebErrorView } from "./webErrorView";
|
|
4
|
+
/** Canonical identity shared by built providers and every supported view export. */
|
|
5
|
+
declare const CORE_VIEW_RENDERER_TOKEN: import("@getstrata/core/contracts/token").ServiceToken<ViewRenderer>;
|
|
6
|
+
declare const CORE_VIEW_TOKEN: import("@getstrata/core/contracts/token").ServiceToken<EtaViewEngine>;
|
|
7
|
+
declare const CORE_WEB_ERROR_VIEW_TOKEN: import("@getstrata/core/contracts/token").ServiceToken<WebErrorView>;
|
|
8
|
+
export { CORE_VIEW_RENDERER_TOKEN, CORE_VIEW_TOKEN, CORE_WEB_ERROR_VIEW_TOKEN };
|
|
@@ -29,6 +29,6 @@ declare class ViewRenderer {
|
|
|
29
29
|
/** Opt-in representation selection; auth/CSRF/tenancy remain the route's responsibility. */
|
|
30
30
|
renderHtmx(name: string, data?: Record<string, unknown>, options?: HtmxViewResponseOptions): Promise<Response>;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
export { CORE_VIEW_RENDERER_TOKEN } from "@getstrata/core/view/tokens";
|
|
33
33
|
export type { HtmxViewResponseOptions, NamespacedViewRenderer, ViewNamespaceOptions, ViewResponseOptions, };
|
|
34
|
-
export {
|
|
34
|
+
export { ViewRenderer };
|
|
@@ -8,14 +8,15 @@ interface WebErrorViewInput {
|
|
|
8
8
|
interface WebErrorViewOptions {
|
|
9
9
|
render?: (input: WebErrorViewInput) => Promise<string> | string;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
type WebErrorView = (input: WebErrorViewInput) => Promise<string>;
|
|
12
|
+
/** Captures a renderer for one application, including its safe kernel fallback. */
|
|
13
|
+
declare function createWebErrorView(options?: WebErrorViewOptions): WebErrorView;
|
|
13
14
|
declare function renderKernelErrorChrome(input: WebErrorViewInput): string;
|
|
14
15
|
declare function errorTemplateName(status: number): string;
|
|
15
|
-
declare function renderWebErrorHtml(input: WebErrorViewInput): Promise<string>;
|
|
16
|
+
declare function renderWebErrorHtml(input: WebErrorViewInput, render?: WebErrorView): Promise<string>;
|
|
16
17
|
declare function htmlErrorResponse(input: WebErrorViewInput & {
|
|
17
18
|
status: number;
|
|
18
|
-
}): Promise<Response>;
|
|
19
|
-
declare function notFoundHtmlResponse(body?: string): Promise<Response>;
|
|
20
|
-
export type { WebErrorViewInput, WebErrorViewOptions };
|
|
21
|
-
export {
|
|
19
|
+
}, render?: WebErrorView): Promise<Response>;
|
|
20
|
+
declare function notFoundHtmlResponse(body?: string, render?: WebErrorView): Promise<Response>;
|
|
21
|
+
export type { WebErrorView, WebErrorViewInput, WebErrorViewOptions };
|
|
22
|
+
export { createWebErrorView, errorTemplateName, htmlErrorResponse, notFoundHtmlResponse, renderKernelErrorChrome, renderWebErrorHtml, };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ServiceContainerLike } from "../contracts/serviceContainer";
|
|
2
|
+
import { type CsrfTokenOptions } from "../http/csrfToken";
|
|
3
|
+
import { type FlashSessionOptions } from "../http/flashSession";
|
|
2
4
|
interface WebLayoutAuthUser {
|
|
3
5
|
id: number;
|
|
4
6
|
email: string;
|
|
@@ -17,14 +19,14 @@ interface WebLayoutData {
|
|
|
17
19
|
}
|
|
18
20
|
type WebLayoutUserKey = "authUser" | "currentUser";
|
|
19
21
|
interface WebLayoutDataOptions {
|
|
22
|
+
csrf?: CsrfTokenOptions;
|
|
23
|
+
flash?: FlashSessionOptions;
|
|
20
24
|
userKey?: WebLayoutUserKey;
|
|
21
25
|
loadUser?: (container: ServiceContainerLike, request: Request | undefined) => Promise<Record<string, unknown> | null>;
|
|
22
26
|
extra?: Record<string, unknown> | ((user: Record<string, unknown> | null) => Record<string, unknown> | Promise<Record<string, unknown>>);
|
|
23
27
|
}
|
|
24
|
-
declare function configureWebLayoutData(options: WebLayoutDataOptions): void;
|
|
25
|
-
declare function resetWebLayoutDataConfigForTests(): void;
|
|
26
28
|
declare function resolveWebLayoutData(container: ServiceContainerLike, request?: Request, options?: WebLayoutDataOptions): Promise<Record<string, unknown>>;
|
|
27
|
-
/**
|
|
29
|
+
/** Captures layout configuration for one application. */
|
|
28
30
|
declare function createWebLayoutDataResolver(container: ServiceContainerLike, options?: WebLayoutDataOptions): (request?: Request) => Promise<Record<string, unknown>>;
|
|
29
31
|
export type { WebLayoutAuthUser, WebLayoutData, WebLayoutDataOptions, WebLayoutUserKey };
|
|
30
|
-
export {
|
|
32
|
+
export { createWebLayoutDataResolver, resolveWebLayoutData };
|