@db3.ai/app 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +31 -0
- package/README.md +241 -0
- package/agent-instructions.md +69 -0
- package/bin/db3-agents.mjs +140 -0
- package/bin/db3.mjs +11 -0
- package/dist/ai/AIErrors.d.ts +33 -0
- package/dist/ai/AIErrors.js +43 -0
- package/dist/ai/AIFailover.d.ts +25 -0
- package/dist/ai/AIFailover.js +96 -0
- package/dist/ai/AIProviders.d.ts +35 -0
- package/dist/ai/AIProviders.js +197 -0
- package/dist/ai/AIQuotaDeferredError.d.ts +19 -0
- package/dist/ai/AIQuotaDeferredError.js +25 -0
- package/dist/ai/AIRateLimiter.d.ts +103 -0
- package/dist/ai/AIRateLimiter.js +690 -0
- package/dist/ai/Agent.d.ts +633 -0
- package/dist/ai/Agent.js +2976 -0
- package/dist/ai/AgentHistory.d.ts +11 -0
- package/dist/ai/AgentHistory.js +495 -0
- package/dist/ai/AgentRunJob.d.ts +21 -0
- package/dist/ai/AgentRunJob.js +53 -0
- package/dist/ai/Ai.d.ts +375 -0
- package/dist/ai/Ai.js +1771 -0
- package/dist/ai/AiConversation.d.ts +17 -0
- package/dist/ai/AiConversation.js +38 -0
- package/dist/ai/AiExecutionContext.d.ts +7 -0
- package/dist/ai/AiExecutionContext.js +16 -0
- package/dist/ai/AiMessage.d.ts +43 -0
- package/dist/ai/AiMessage.js +105 -0
- package/dist/ai/AiRateLimitBucket.d.ts +69 -0
- package/dist/ai/AiRateLimitBucket.js +138 -0
- package/dist/ai/AiRateLimitReservation.d.ts +56 -0
- package/dist/ai/AiRateLimitReservation.js +101 -0
- package/dist/ai/AiRequest.d.ts +78 -0
- package/dist/ai/AiRequest.js +384 -0
- package/dist/ai/Estimates.d.ts +26 -0
- package/dist/ai/Estimates.js +34 -0
- package/dist/ai/Models.d.ts +88 -0
- package/dist/ai/Models.js +328 -0
- package/dist/ai/OpenAIProviderError.d.ts +30 -0
- package/dist/ai/OpenAIProviderError.js +77 -0
- package/dist/ai/OpenAIQuotaRetry.d.ts +27 -0
- package/dist/ai/OpenAIQuotaRetry.js +144 -0
- package/dist/ai/ProviderCosts.d.ts +55 -0
- package/dist/ai/ProviderCosts.js +108 -0
- package/dist/ai/ResponsesProviderCall.d.ts +13 -0
- package/dist/ai/ResponsesProviderCall.js +29 -0
- package/dist/ai/agentCitations.d.ts +27 -0
- package/dist/ai/agentCitations.js +153 -0
- package/dist/ai/contracts/AI.d.ts +347 -0
- package/dist/ai/contracts/AI.js +13 -0
- package/dist/ai/contracts/Agent.d.ts +476 -0
- package/dist/ai/contracts/Agent.js +1 -0
- package/dist/ai/contracts/AiRequestRunCostSummary.d.ts +31 -0
- package/dist/ai/contracts/AiRequestRunCostSummary.js +1 -0
- package/dist/ai/contracts/Pricing.d.ts +88 -0
- package/dist/ai/contracts/Pricing.js +1 -0
- package/dist/ai/contracts/Providers.d.ts +68 -0
- package/dist/ai/contracts/Providers.js +1 -0
- package/dist/ai/contracts/QuotaRetry.d.ts +38 -0
- package/dist/ai/contracts/QuotaRetry.js +1 -0
- package/dist/ai/contracts/RateLimits.d.ts +45 -0
- package/dist/ai/contracts/RateLimits.js +1 -0
- package/dist/ai/contracts/ResponsesProviderCall.d.ts +28 -0
- package/dist/ai/contracts/ResponsesProviderCall.js +1 -0
- package/dist/ai/contracts/index.d.ts +8 -0
- package/dist/ai/contracts/index.js +8 -0
- package/dist/ai/index.d.ts +27 -0
- package/dist/ai/index.js +27 -0
- package/dist/ai/registry.d.ts +28 -0
- package/dist/ai/registry.js +49 -0
- package/dist/ai/sdkNodeCompatibility.d.ts +76 -0
- package/dist/ai/toolCallRecovery.d.ts +16 -0
- package/dist/ai/toolCallRecovery.js +71 -0
- package/dist/ai/toolHelpers.d.ts +65 -0
- package/dist/ai/toolHelpers.js +106 -0
- package/dist/auth/Auth.d.ts +641 -0
- package/dist/auth/Auth.js +927 -0
- package/dist/auth/AuthProvider.d.ts +104 -0
- package/dist/auth/AuthProvider.js +185 -0
- package/dist/auth/AuthToken.d.ts +123 -0
- package/dist/auth/AuthToken.js +156 -0
- package/dist/auth/PasswordResetToken.d.ts +33 -0
- package/dist/auth/PasswordResetToken.js +64 -0
- package/dist/auth/UserIdentity.d.ts +46 -0
- package/dist/auth/UserIdentity.js +72 -0
- package/dist/auth/contracts/AuthProviderDriver.d.ts +94 -0
- package/dist/auth/contracts/AuthProviderDriver.js +1 -0
- package/dist/auth/contracts/index.d.ts +1 -0
- package/dist/auth/contracts/index.js +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/passwordHash.d.ts +26 -0
- package/dist/auth/passwordHash.js +96 -0
- package/dist/auth/providers/GoogleAuthProvider.d.ts +135 -0
- package/dist/auth/providers/GoogleAuthProvider.js +305 -0
- package/dist/auth/providers/PasswordAuthProvider.d.ts +115 -0
- package/dist/auth/providers/PasswordAuthProvider.js +195 -0
- package/dist/auth/providers/index.d.ts +3 -0
- package/dist/auth/providers/index.js +3 -0
- package/dist/auth/providers/resolveAuthProviders.d.ts +29 -0
- package/dist/auth/providers/resolveAuthProviders.js +111 -0
- package/dist/cache/Cache.d.ts +67 -0
- package/dist/cache/Cache.js +115 -0
- package/dist/cache/contracts/CacheDriver.d.ts +10 -0
- package/dist/cache/contracts/CacheDriver.js +1 -0
- package/dist/cache/contracts/CacheOperations.d.ts +26 -0
- package/dist/cache/contracts/CacheOperations.js +1 -0
- package/dist/cache/contracts/CacheOptions.d.ts +51 -0
- package/dist/cache/contracts/CacheOptions.js +1 -0
- package/dist/cache/contracts/CacheRepository.d.ts +45 -0
- package/dist/cache/contracts/CacheRepository.js +1 -0
- package/dist/cache/contracts/index.d.ts +4 -0
- package/dist/cache/contracts/index.js +4 -0
- package/dist/cache/drivers/CacheManagerDriver.d.ts +55 -0
- package/dist/cache/drivers/CacheManagerDriver.js +68 -0
- package/dist/cache/drivers/createCacheDriver.d.ts +8 -0
- package/dist/cache/drivers/createCacheDriver.js +147 -0
- package/dist/cache/index.d.ts +2 -0
- package/dist/cache/index.js +2 -0
- package/dist/cli/Cli.d.ts +17 -0
- package/dist/cli/Cli.js +120 -0
- package/dist/cli/commands/repl.d.ts +9 -0
- package/dist/cli/commands/repl.js +27 -0
- package/dist/cli/contracts/CliCommand.d.ts +30 -0
- package/dist/cli/contracts/CliCommand.js +1 -0
- package/dist/cli/contracts/CliConfig.d.ts +9 -0
- package/dist/cli/contracts/CliConfig.js +1 -0
- package/dist/cli/contracts/CliOptions.d.ts +13 -0
- package/dist/cli/contracts/CliOptions.js +1 -0
- package/dist/cli/contracts/CommandDefinition.d.ts +18 -0
- package/dist/cli/contracts/CommandDefinition.js +1 -0
- package/dist/cli/contracts/ReplOptions.d.ts +11 -0
- package/dist/cli/contracts/ReplOptions.js +1 -0
- package/dist/cli/contracts/index.d.ts +5 -0
- package/dist/cli/contracts/index.js +1 -0
- package/dist/cli/defineCommand.d.ts +10 -0
- package/dist/cli/defineCommand.js +25 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.js +5 -0
- package/dist/cli/runDb3.d.ts +11 -0
- package/dist/cli/runDb3.js +70 -0
- package/dist/cli/runRepl.d.ts +12 -0
- package/dist/cli/runRepl.js +54 -0
- package/dist/config/Config.d.ts +48 -0
- package/dist/config/Config.js +80 -0
- package/dist/config/env.d.ts +26 -0
- package/dist/config/env.js +117 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +2 -0
- package/dist/db/ActiveProjection.d.ts +90 -0
- package/dist/db/ActiveProjection.js +134 -0
- package/dist/db/ActiveQueryBuilder.d.ts +268 -0
- package/dist/db/ActiveQueryBuilder.js +621 -0
- package/dist/db/ActiveRecord.d.ts +483 -0
- package/dist/db/ActiveRecord.js +765 -0
- package/dist/db/Database.d.ts +277 -0
- package/dist/db/Database.js +827 -0
- package/dist/db/FieldType.d.ts +540 -0
- package/dist/db/FieldType.js +706 -0
- package/dist/db/SoftDeletes.d.ts +30 -0
- package/dist/db/SoftDeletes.js +93 -0
- package/dist/db/commands/check.d.ts +6 -0
- package/dist/db/commands/check.js +8 -0
- package/dist/db/commands/index.d.ts +6 -0
- package/dist/db/commands/index.js +17 -0
- package/dist/db/commands/makeMigration.d.ts +7 -0
- package/dist/db/commands/makeMigration.js +9 -0
- package/dist/db/commands/migrate.d.ts +6 -0
- package/dist/db/commands/migrate.js +8 -0
- package/dist/db/connection.d.ts +10 -0
- package/dist/db/connection.js +55 -0
- package/dist/db/contracts/ActiveRecordDefinition.d.ts +64 -0
- package/dist/db/contracts/ActiveRecordDefinition.js +1 -0
- package/dist/db/contracts/DatabaseBackup.d.ts +7 -0
- package/dist/db/contracts/DatabaseBackup.js +1 -0
- package/dist/db/contracts/DatabaseMigrationsConfig.d.ts +9 -0
- package/dist/db/contracts/DatabaseMigrationsConfig.js +1 -0
- package/dist/db/contracts/index.d.ts +3 -0
- package/dist/db/contracts/index.js +3 -0
- package/dist/db/dialects/columnTypes.d.ts +20 -0
- package/dist/db/dialects/columnTypes.js +67 -0
- package/dist/db/dialects/index.d.ts +6 -0
- package/dist/db/dialects/index.js +6 -0
- package/dist/db/dialects/mariadb.d.ts +7 -0
- package/dist/db/dialects/mariadb.js +35 -0
- package/dist/db/dialects/mysql.d.ts +14 -0
- package/dist/db/dialects/mysql.js +203 -0
- package/dist/db/dialects/postgres.d.ts +5 -0
- package/dist/db/dialects/postgres.js +106 -0
- package/dist/db/dialects/resolveDialect.d.ts +14 -0
- package/dist/db/dialects/resolveDialect.js +57 -0
- package/dist/db/dialects/types.d.ts +44 -0
- package/dist/db/dialects/types.js +1 -0
- package/dist/db/errors.d.ts +15 -0
- package/dist/db/errors.js +20 -0
- package/dist/db/fields/BooleanField.d.ts +29 -0
- package/dist/db/fields/BooleanField.js +89 -0
- package/dist/db/fields/CharUuidField.d.ts +29 -0
- package/dist/db/fields/CharUuidField.js +63 -0
- package/dist/db/fields/ChoiceStringField.d.ts +25 -0
- package/dist/db/fields/ChoiceStringField.js +58 -0
- package/dist/db/fields/DecimalField.d.ts +20 -0
- package/dist/db/fields/DecimalField.js +105 -0
- package/dist/db/fields/EmailField.d.ts +31 -0
- package/dist/db/fields/EmailField.js +52 -0
- package/dist/db/fields/EncryptedJsonField.d.ts +82 -0
- package/dist/db/fields/EncryptedJsonField.js +169 -0
- package/dist/db/fields/IntegerField.d.ts +35 -0
- package/dist/db/fields/IntegerField.js +139 -0
- package/dist/db/fields/JsonField.d.ts +40 -0
- package/dist/db/fields/JsonField.js +79 -0
- package/dist/db/fields/JsonStringField.d.ts +21 -0
- package/dist/db/fields/JsonStringField.js +41 -0
- package/dist/db/fields/LinkField.d.ts +180 -0
- package/dist/db/fields/LinkField.js +359 -0
- package/dist/db/fields/PasswordField.d.ts +93 -0
- package/dist/db/fields/PasswordField.js +180 -0
- package/dist/db/fields/StringField.d.ts +43 -0
- package/dist/db/fields/StringField.js +102 -0
- package/dist/db/fields/StringListField.d.ts +54 -0
- package/dist/db/fields/StringListField.js +124 -0
- package/dist/db/fields/TextField.d.ts +25 -0
- package/dist/db/fields/TextField.js +44 -0
- package/dist/db/fields/TimestampField.d.ts +47 -0
- package/dist/db/fields/TimestampField.js +97 -0
- package/dist/db/fields/UlidField.d.ts +69 -0
- package/dist/db/fields/UlidField.js +114 -0
- package/dist/db/fields/UrlField.d.ts +30 -0
- package/dist/db/fields/UrlField.js +61 -0
- package/dist/db/fields/VectorField.d.ts +64 -0
- package/dist/db/fields/VectorField.js +180 -0
- package/dist/db/fields/createField.d.ts +2 -0
- package/dist/db/fields/createField.js +13 -0
- package/dist/db/fields/field.d.ts +36 -0
- package/dist/db/fields/field.js +101 -0
- package/dist/db/fields/index.d.ts +18 -0
- package/dist/db/fields/index.js +18 -0
- package/dist/db/fields/resolveFields.d.ts +17 -0
- package/dist/db/fields/resolveFields.js +38 -0
- package/dist/db/index.d.ts +13 -0
- package/dist/db/index.js +13 -0
- package/dist/db/migrations/DatabaseMigrationManager.d.ts +57 -0
- package/dist/db/migrations/DatabaseMigrationManager.js +589 -0
- package/dist/db/migrations/DatabaseSchemaInspector.d.ts +19 -0
- package/dist/db/migrations/DatabaseSchemaInspector.js +384 -0
- package/dist/db/migrations/KnexMigrationRenderer.d.ts +11 -0
- package/dist/db/migrations/KnexMigrationRenderer.js +390 -0
- package/dist/db/migrations/ModelSchemaCollector.d.ts +29 -0
- package/dist/db/migrations/ModelSchemaCollector.js +183 -0
- package/dist/db/migrations/SchemaDiffer.d.ts +13 -0
- package/dist/db/migrations/SchemaDiffer.js +427 -0
- package/dist/db/migrations/SchemaNames.d.ts +27 -0
- package/dist/db/migrations/SchemaNames.js +46 -0
- package/dist/db/migrations/SchemaSnapshotSerializer.d.ts +30 -0
- package/dist/db/migrations/SchemaSnapshotSerializer.js +49 -0
- package/dist/db/migrations/contracts/DatabaseMigration.d.ts +118 -0
- package/dist/db/migrations/contracts/DatabaseMigration.js +1 -0
- package/dist/db/migrations/contracts/SchemaChange.d.ts +83 -0
- package/dist/db/migrations/contracts/SchemaChange.js +1 -0
- package/dist/db/migrations/contracts/SchemaSnapshot.d.ts +94 -0
- package/dist/db/migrations/contracts/SchemaSnapshot.js +1 -0
- package/dist/db/migrations/contracts/index.d.ts +3 -0
- package/dist/db/migrations/contracts/index.js +3 -0
- package/dist/db/migrations/errors.d.ts +35 -0
- package/dist/db/migrations/errors.js +45 -0
- package/dist/db/migrations/index.d.ts +10 -0
- package/dist/db/migrations/index.js +10 -0
- package/dist/db/migrations/promoteDestructiveSchemaChanges.d.ts +19 -0
- package/dist/db/migrations/promoteDestructiveSchemaChanges.js +102 -0
- package/dist/db/queryMonitor.d.ts +142 -0
- package/dist/db/queryMonitor.js +357 -0
- package/dist/db/sqlErrors.d.ts +11 -0
- package/dist/db/sqlErrors.js +17 -0
- package/dist/db/test/db.d.ts +11 -0
- package/dist/db/test/db.js +109 -0
- package/dist/devtools/HttpEventDispatcher.d.ts +19 -0
- package/dist/devtools/HttpEventDispatcher.js +180 -0
- package/dist/devtools/contracts/DevtoolsEventDispatcher.d.ts +53 -0
- package/dist/devtools/contracts/DevtoolsEventDispatcher.js +1 -0
- package/dist/devtools/contracts/index.d.ts +1 -0
- package/dist/devtools/contracts/index.js +1 -0
- package/dist/devtools/environment.d.ts +10 -0
- package/dist/devtools/environment.js +14 -0
- package/dist/devtools/index.d.ts +3 -0
- package/dist/devtools/index.js +3 -0
- package/dist/events/Events.d.ts +70 -0
- package/dist/events/Events.js +126 -0
- package/dist/events/contracts/EventConstructor.d.ts +12 -0
- package/dist/events/contracts/EventConstructor.js +1 -0
- package/dist/events/contracts/EventListener.d.ts +6 -0
- package/dist/events/contracts/EventListener.js +1 -0
- package/dist/events/contracts/EventUnsubscribe.d.ts +4 -0
- package/dist/events/contracts/EventUnsubscribe.js +1 -0
- package/dist/events/contracts/index.d.ts +3 -0
- package/dist/events/contracts/index.js +3 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/index.js +2 -0
- package/dist/flows/FlowBlockRegistry.d.ts +39 -0
- package/dist/flows/FlowBlockRegistry.js +66 -0
- package/dist/flows/FlowCompiler.d.ts +26 -0
- package/dist/flows/FlowCompiler.js +488 -0
- package/dist/flows/FlowDefinitionError.d.ts +21 -0
- package/dist/flows/FlowDefinitionError.js +16 -0
- package/dist/flows/FlowStepJob.d.ts +28 -0
- package/dist/flows/FlowStepJob.js +31 -0
- package/dist/flows/FlowValueValidator.d.ts +32 -0
- package/dist/flows/FlowValueValidator.js +105 -0
- package/dist/flows/Flows.d.ts +102 -0
- package/dist/flows/Flows.js +871 -0
- package/dist/flows/blocks/FlowInput.d.ts +10 -0
- package/dist/flows/blocks/FlowInput.js +29 -0
- package/dist/flows/blocks/FlowOutput.d.ts +10 -0
- package/dist/flows/blocks/FlowOutput.js +29 -0
- package/dist/flows/blocks/Subflow.d.ts +10 -0
- package/dist/flows/blocks/Subflow.js +21 -0
- package/dist/flows/blocks/index.d.ts +6 -0
- package/dist/flows/blocks/index.js +8 -0
- package/dist/flows/constants.d.ts +55 -0
- package/dist/flows/constants.js +47 -0
- package/dist/flows/contracts/FlowBlock.d.ts +64 -0
- package/dist/flows/contracts/FlowBlock.js +1 -0
- package/dist/flows/contracts/FlowCompiler.d.ts +30 -0
- package/dist/flows/contracts/FlowCompiler.js +1 -0
- package/dist/flows/contracts/FlowDefinition.d.ts +118 -0
- package/dist/flows/contracts/FlowDefinition.js +1 -0
- package/dist/flows/contracts/FlowDefinitionStore.d.ts +47 -0
- package/dist/flows/contracts/FlowDefinitionStore.js +1 -0
- package/dist/flows/contracts/FlowRun.d.ts +40 -0
- package/dist/flows/contracts/FlowRun.js +1 -0
- package/dist/flows/contracts/FlowValue.d.ts +49 -0
- package/dist/flows/contracts/FlowValue.js +1 -0
- package/dist/flows/contracts/FlowsService.d.ts +37 -0
- package/dist/flows/contracts/FlowsService.js +1 -0
- package/dist/flows/contracts/index.d.ts +7 -0
- package/dist/flows/contracts/index.js +7 -0
- package/dist/flows/defineBlock.d.ts +18 -0
- package/dist/flows/defineBlock.js +19 -0
- package/dist/flows/drivers/FileFlowDefinitionStore.d.ts +53 -0
- package/dist/flows/drivers/FileFlowDefinitionStore.js +313 -0
- package/dist/flows/drivers/index.d.ts +1 -0
- package/dist/flows/drivers/index.js +1 -0
- package/dist/flows/errors.d.ts +8 -0
- package/dist/flows/errors.js +19 -0
- package/dist/flows/index.d.ts +13 -0
- package/dist/flows/index.js +13 -0
- package/dist/flows/models/FlowRun.d.ts +55 -0
- package/dist/flows/models/FlowRun.js +126 -0
- package/dist/flows/models/FlowRunEvent.d.ts +41 -0
- package/dist/flows/models/FlowRunEvent.js +85 -0
- package/dist/flows/models/FlowStepRun.d.ts +56 -0
- package/dist/flows/models/FlowStepRun.js +137 -0
- package/dist/flows/models/index.d.ts +10 -0
- package/dist/flows/models/index.js +14 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +16 -0
- package/dist/logging/Log.d.ts +66 -0
- package/dist/logging/Log.js +79 -0
- package/dist/logging/contracts/HttpExchange.d.ts +50 -0
- package/dist/logging/contracts/HttpExchange.js +1 -0
- package/dist/logging/contracts/Logger.d.ts +41 -0
- package/dist/logging/contracts/Logger.js +1 -0
- package/dist/logging/contracts/LoggerDriver.d.ts +16 -0
- package/dist/logging/contracts/LoggerDriver.js +1 -0
- package/dist/logging/contracts/LoggingOptions.d.ts +49 -0
- package/dist/logging/contracts/LoggingOptions.js +1 -0
- package/dist/logging/contracts/index.d.ts +4 -0
- package/dist/logging/contracts/index.js +4 -0
- package/dist/logging/drivers/PinoLoggerDriver.d.ts +24 -0
- package/dist/logging/drivers/PinoLoggerDriver.js +291 -0
- package/dist/logging/drivers/index.d.ts +1 -0
- package/dist/logging/drivers/index.js +1 -0
- package/dist/logging/index.d.ts +3 -0
- package/dist/logging/index.js +3 -0
- package/dist/logging/transports/DevtoolsLogTransport.d.ts +35 -0
- package/dist/logging/transports/DevtoolsLogTransport.js +96 -0
- package/dist/mail/Mail.d.ts +62 -0
- package/dist/mail/Mail.js +98 -0
- package/dist/mail/index.d.ts +4 -0
- package/dist/mail/index.js +4 -0
- package/dist/mail/transports/FileMailTransport.d.ts +12 -0
- package/dist/mail/transports/FileMailTransport.js +41 -0
- package/dist/mail/transports/MailgunTransport.d.ts +22 -0
- package/dist/mail/transports/MailgunTransport.js +57 -0
- package/dist/mail/transports/ResendTransport.d.ts +14 -0
- package/dist/mail/transports/ResendTransport.js +55 -0
- package/dist/media/MediaFile.d.ts +48 -0
- package/dist/media/MediaFile.js +104 -0
- package/dist/media/MediaItem.d.ts +47 -0
- package/dist/media/MediaItem.js +106 -0
- package/dist/media/MediaLibrary.d.ts +42 -0
- package/dist/media/MediaLibrary.js +94 -0
- package/dist/media/MediaManager.d.ts +159 -0
- package/dist/media/MediaManager.js +754 -0
- package/dist/media/constants.d.ts +27 -0
- package/dist/media/constants.js +19 -0
- package/dist/media/contracts/MediaOptions.d.ts +8 -0
- package/dist/media/contracts/MediaOptions.js +1 -0
- package/dist/media/contracts/index.d.ts +1 -0
- package/dist/media/contracts/index.js +1 -0
- package/dist/media/image/ImageReconstructionError.d.ts +15 -0
- package/dist/media/image/ImageReconstructionError.js +18 -0
- package/dist/media/image/ImageVariantRenderer.d.ts +44 -0
- package/dist/media/image/ImageVariantRenderer.js +337 -0
- package/dist/media/image/ImageVariantRequest.d.ts +28 -0
- package/dist/media/image/ImageVariantRequest.js +55 -0
- package/dist/media/image/contracts/ImageProcessor.d.ts +46 -0
- package/dist/media/image/contracts/ImageProcessor.js +1 -0
- package/dist/media/image/contracts/ImageVariant.d.ts +31 -0
- package/dist/media/image/contracts/ImageVariant.js +7 -0
- package/dist/media/image/contracts/ImageVariantCacheOptions.d.ts +20 -0
- package/dist/media/image/contracts/ImageVariantCacheOptions.js +1 -0
- package/dist/media/image/contracts/index.d.ts +3 -0
- package/dist/media/image/contracts/index.js +3 -0
- package/dist/media/image/index.d.ts +5 -0
- package/dist/media/image/index.js +5 -0
- package/dist/media/image/processors/SharpImageProcessor.d.ts +25 -0
- package/dist/media/image/processors/SharpImageProcessor.js +112 -0
- package/dist/media/image/processors/index.d.ts +1 -0
- package/dist/media/image/processors/index.js +1 -0
- package/dist/media/index.d.ts +8 -0
- package/dist/media/index.js +8 -0
- package/dist/media/types.d.ts +129 -0
- package/dist/media/types.js +1 -0
- package/dist/queue/FailedJob.d.ts +31 -0
- package/dist/queue/FailedJob.js +41 -0
- package/dist/queue/Queue.d.ts +208 -0
- package/dist/queue/Queue.js +685 -0
- package/dist/queue/QueueEvents.d.ts +31 -0
- package/dist/queue/QueueEvents.js +49 -0
- package/dist/queue/QueueRetryLaterError.d.ts +23 -0
- package/dist/queue/QueueRetryLaterError.js +34 -0
- package/dist/queue/QueueWorker.d.ts +72 -0
- package/dist/queue/QueueWorker.js +236 -0
- package/dist/queue/QueueableJob.d.ts +109 -0
- package/dist/queue/QueueableJob.js +137 -0
- package/dist/queue/QueuedJob.d.ts +31 -0
- package/dist/queue/QueuedJob.js +52 -0
- package/dist/queue/RetryPolicy.d.ts +51 -0
- package/dist/queue/RetryPolicy.js +84 -0
- package/dist/queue/commands/index.d.ts +4 -0
- package/dist/queue/commands/index.js +11 -0
- package/dist/queue/commands/makeJob.d.ts +7 -0
- package/dist/queue/commands/makeJob.js +9 -0
- package/dist/queue/console.d.ts +60 -0
- package/dist/queue/console.js +348 -0
- package/dist/queue/contracts/CreateJob.d.ts +12 -0
- package/dist/queue/contracts/CreateJob.js +1 -0
- package/dist/queue/contracts/QueueDriver.d.ts +122 -0
- package/dist/queue/contracts/QueueDriver.js +1 -0
- package/dist/queue/contracts/QueueEvents.d.ts +61 -0
- package/dist/queue/contracts/QueueEvents.js +1 -0
- package/dist/queue/contracts/QueuePayload.d.ts +136 -0
- package/dist/queue/contracts/QueuePayload.js +1 -0
- package/dist/queue/contracts/QueueRetry.d.ts +43 -0
- package/dist/queue/contracts/QueueRetry.js +1 -0
- package/dist/queue/contracts/QueueService.d.ts +199 -0
- package/dist/queue/contracts/QueueService.js +1 -0
- package/dist/queue/contracts/QueueWorkerLifecycle.d.ts +65 -0
- package/dist/queue/contracts/QueueWorkerLifecycle.js +1 -0
- package/dist/queue/contracts/QueueableJob.d.ts +50 -0
- package/dist/queue/contracts/QueueableJob.js +1 -0
- package/dist/queue/contracts/RedisQueueDriver.d.ts +37 -0
- package/dist/queue/contracts/RedisQueueDriver.js +1 -0
- package/dist/queue/contracts/index.d.ts +9 -0
- package/dist/queue/contracts/index.js +9 -0
- package/dist/queue/createJob.d.ts +18 -0
- package/dist/queue/createJob.js +52 -0
- package/dist/queue/drivers/DatabaseQueueDriver.d.ts +83 -0
- package/dist/queue/drivers/DatabaseQueueDriver.js +393 -0
- package/dist/queue/drivers/RedisQueueDriver.d.ts +102 -0
- package/dist/queue/drivers/RedisQueueDriver.js +641 -0
- package/dist/queue/index.d.ts +13 -0
- package/dist/queue/index.js +13 -0
- package/dist/queue/queueMonitor.d.ts +133 -0
- package/dist/queue/queueMonitor.js +238 -0
- package/dist/scheduler/ScheduledCall.d.ts +25 -0
- package/dist/scheduler/ScheduledCall.js +31 -0
- package/dist/scheduler/ScheduledEvent.d.ts +74 -0
- package/dist/scheduler/ScheduledEvent.js +115 -0
- package/dist/scheduler/ScheduledJob.d.ts +34 -0
- package/dist/scheduler/ScheduledJob.js +50 -0
- package/dist/scheduler/ScheduledOccurrence.d.ts +74 -0
- package/dist/scheduler/ScheduledOccurrence.js +194 -0
- package/dist/scheduler/ScheduledOccurrenceRecorder.d.ts +34 -0
- package/dist/scheduler/ScheduledOccurrenceRecorder.js +106 -0
- package/dist/scheduler/Scheduler.d.ts +76 -0
- package/dist/scheduler/Scheduler.js +186 -0
- package/dist/scheduler/SchedulerWorker.d.ts +37 -0
- package/dist/scheduler/SchedulerWorker.js +119 -0
- package/dist/scheduler/console.d.ts +18 -0
- package/dist/scheduler/console.js +288 -0
- package/dist/scheduler/constants.d.ts +13 -0
- package/dist/scheduler/constants.js +23 -0
- package/dist/scheduler/contracts/Scheduler.d.ts +104 -0
- package/dist/scheduler/contracts/Scheduler.js +1 -0
- package/dist/scheduler/contracts/SchedulerConsole.d.ts +37 -0
- package/dist/scheduler/contracts/SchedulerConsole.js +1 -0
- package/dist/scheduler/contracts/SchedulerWorker.d.ts +18 -0
- package/dist/scheduler/contracts/SchedulerWorker.js +1 -0
- package/dist/scheduler/contracts/index.d.ts +3 -0
- package/dist/scheduler/contracts/index.js +3 -0
- package/dist/scheduler/index.d.ts +9 -0
- package/dist/scheduler/index.js +9 -0
- package/dist/scheduler/scheduleTime.d.ts +30 -0
- package/dist/scheduler/scheduleTime.js +64 -0
- package/dist/security/Security.d.ts +60 -0
- package/dist/security/Security.js +252 -0
- package/dist/security/SecurityError.d.ts +13 -0
- package/dist/security/SecurityError.js +16 -0
- package/dist/security/contracts/SecurityOptions.d.ts +17 -0
- package/dist/security/contracts/SecurityOptions.js +1 -0
- package/dist/security/contracts/SecurityPayload.d.ts +13 -0
- package/dist/security/contracts/SecurityPayload.js +1 -0
- package/dist/security/contracts/index.d.ts +2 -0
- package/dist/security/contracts/index.js +2 -0
- package/dist/security/ensureAppKey.d.ts +16 -0
- package/dist/security/ensureAppKey.js +69 -0
- package/dist/security/index.d.ts +4 -0
- package/dist/security/index.js +4 -0
- package/dist/serialization/Serializable.d.ts +17 -0
- package/dist/serialization/Serializable.js +1 -0
- package/dist/serialization/SerializationError.d.ts +40 -0
- package/dist/serialization/SerializationError.js +42 -0
- package/dist/serialization/SerializationRegistry.d.ts +76 -0
- package/dist/serialization/SerializationRegistry.js +153 -0
- package/dist/serialization/SerializationRegistryError.d.ts +18 -0
- package/dist/serialization/SerializationRegistryError.js +18 -0
- package/dist/serialization/Serializer.d.ts +37 -0
- package/dist/serialization/Serializer.js +477 -0
- package/dist/serialization/contracts/SerializableClass.d.ts +20 -0
- package/dist/serialization/contracts/SerializableClass.js +1 -0
- package/dist/serialization/contracts/SerializedValue.d.ts +59 -0
- package/dist/serialization/contracts/SerializedValue.js +19 -0
- package/dist/serialization/contracts/SerializerOptions.d.ts +17 -0
- package/dist/serialization/contracts/SerializerOptions.js +1 -0
- package/dist/serialization/contracts/SerializerService.d.ts +26 -0
- package/dist/serialization/contracts/SerializerService.js +1 -0
- package/dist/serialization/contracts/index.d.ts +4 -0
- package/dist/serialization/contracts/index.js +4 -0
- package/dist/serialization/index.d.ts +6 -0
- package/dist/serialization/index.js +6 -0
- package/dist/server/App.d.ts +141 -0
- package/dist/server/App.js +225 -0
- package/dist/server/RequestContext.d.ts +42 -0
- package/dist/server/RequestContext.js +95 -0
- package/dist/server/appContext.d.ts +34 -0
- package/dist/server/appContext.js +42 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +3 -0
- package/dist/ssr/constants.d.ts +6 -0
- package/dist/ssr/constants.js +6 -0
- package/dist/ssr/contracts/DocumentHead.d.ts +32 -0
- package/dist/ssr/contracts/DocumentHead.js +1 -0
- package/dist/ssr/contracts/SsrRenderContext.d.ts +23 -0
- package/dist/ssr/contracts/SsrRenderContext.js +1 -0
- package/dist/ssr/contracts/SsrRenderResult.d.ts +21 -0
- package/dist/ssr/contracts/SsrRenderResult.js +1 -0
- package/dist/ssr/contracts/SsrRenderer.d.ts +9 -0
- package/dist/ssr/contracts/SsrRenderer.js +1 -0
- package/dist/ssr/contracts/SsrRequest.d.ts +16 -0
- package/dist/ssr/contracts/SsrRequest.js +1 -0
- package/dist/ssr/contracts/index.d.ts +5 -0
- package/dist/ssr/contracts/index.js +1 -0
- package/dist/ssr/createSsrRenderContext.d.ts +9 -0
- package/dist/ssr/createSsrRenderContext.js +20 -0
- package/dist/ssr/fastify/contracts/FastifySsrOptions.d.ts +21 -0
- package/dist/ssr/fastify/contracts/FastifySsrOptions.js +1 -0
- package/dist/ssr/fastify/contracts/index.d.ts +1 -0
- package/dist/ssr/fastify/contracts/index.js +1 -0
- package/dist/ssr/fastify/fastifySsr.d.ts +25 -0
- package/dist/ssr/fastify/fastifySsr.js +89 -0
- package/dist/ssr/fastify/index.d.ts +2 -0
- package/dist/ssr/fastify/index.js +1 -0
- package/dist/ssr/index.d.ts +6 -0
- package/dist/ssr/index.js +5 -0
- package/dist/ssr/renderDocumentHead.d.ts +8 -0
- package/dist/ssr/renderDocumentHead.js +62 -0
- package/dist/ssr/renderSsrDocument.d.ts +14 -0
- package/dist/ssr/renderSsrDocument.js +28 -0
- package/dist/ssr/serializeSsrState.d.ts +10 -0
- package/dist/ssr/serializeSsrState.js +18 -0
- package/dist/ssr/vite/contracts/ViteSsrOptions.d.ts +45 -0
- package/dist/ssr/vite/contracts/ViteSsrOptions.js +1 -0
- package/dist/ssr/vite/contracts/index.d.ts +1 -0
- package/dist/ssr/vite/contracts/index.js +1 -0
- package/dist/ssr/vite/fastifyViteSsr.d.ts +24 -0
- package/dist/ssr/vite/fastifyViteSsr.js +213 -0
- package/dist/ssr/vite/index.d.ts +4 -0
- package/dist/ssr/vite/index.js +2 -0
- package/dist/ssr/vite/viteSsrManifest.d.ts +16 -0
- package/dist/ssr/vite/viteSsrManifest.js +63 -0
- package/dist/storage/Storage.d.ts +244 -0
- package/dist/storage/Storage.js +348 -0
- package/dist/storage/contents.d.ts +8 -0
- package/dist/storage/contents.js +18 -0
- package/dist/storage/contracts/StorageListing.d.ts +50 -0
- package/dist/storage/contracts/StorageListing.js +1 -0
- package/dist/storage/contracts/index.d.ts +1 -0
- package/dist/storage/contracts/index.js +1 -0
- package/dist/storage/drivers/FlystorageDisk.d.ts +185 -0
- package/dist/storage/drivers/FlystorageDisk.js +250 -0
- package/dist/storage/drivers/FlystorageListing.d.ts +27 -0
- package/dist/storage/drivers/FlystorageListing.js +69 -0
- package/dist/storage/drivers/LocalStorageDisk.d.ts +25 -0
- package/dist/storage/drivers/LocalStorageDisk.js +38 -0
- package/dist/storage/drivers/S3StorageDisk.d.ts +17 -0
- package/dist/storage/drivers/S3StorageDisk.js +102 -0
- package/dist/storage/drivers/index.d.ts +3 -0
- package/dist/storage/drivers/index.js +3 -0
- package/dist/storage/index.d.ts +7 -0
- package/dist/storage/index.js +7 -0
- package/dist/storage/mime.d.ts +7 -0
- package/dist/storage/mime.js +28 -0
- package/dist/storage/path.d.ts +22 -0
- package/dist/storage/path.js +61 -0
- package/dist/storage/types.d.ts +218 -0
- package/dist/storage/types.js +1 -0
- package/dist/url/UrlGenerator.d.ts +32 -0
- package/dist/url/UrlGenerator.js +61 -0
- package/dist/url/contracts/UrlGeneratorOptions.d.ts +13 -0
- package/dist/url/contracts/UrlGeneratorOptions.js +1 -0
- package/dist/url/contracts/index.d.ts +1 -0
- package/dist/url/contracts/index.js +1 -0
- package/dist/url/index.d.ts +2 -0
- package/dist/url/index.js +2 -0
- package/dist/validation/index.d.ts +28 -0
- package/dist/validation/index.js +260 -0
- package/package.json +290 -0
- package/src/ai/AIErrors.ts +46 -0
- package/src/ai/AIFailover.ts +101 -0
- package/src/ai/AIProviders.ts +228 -0
- package/src/ai/AIQuotaDeferredError.ts +26 -0
- package/src/ai/AIRateLimiter.ts +880 -0
- package/src/ai/Agent.ts +3630 -0
- package/src/ai/AgentHistory.ts +576 -0
- package/src/ai/AgentRunJob.ts +65 -0
- package/src/ai/Ai.ts +2176 -0
- package/src/ai/AiConversation.ts +49 -0
- package/src/ai/AiExecutionContext.ts +19 -0
- package/src/ai/AiMessage.ts +131 -0
- package/src/ai/AiRateLimitBucket.ts +163 -0
- package/src/ai/AiRateLimitReservation.ts +117 -0
- package/src/ai/AiRequest.ts +466 -0
- package/src/ai/Estimates.ts +36 -0
- package/src/ai/Models.ts +373 -0
- package/src/ai/OpenAIProviderError.ts +98 -0
- package/src/ai/OpenAIQuotaRetry.ts +183 -0
- package/src/ai/ProviderCosts.ts +156 -0
- package/src/ai/README.md +187 -0
- package/src/ai/ResponsesProviderCall.ts +34 -0
- package/src/ai/agentCitations.ts +186 -0
- package/src/ai/contracts/AI.ts +380 -0
- package/src/ai/contracts/Agent.ts +539 -0
- package/src/ai/contracts/AiRequestRunCostSummary.ts +31 -0
- package/src/ai/contracts/Pricing.ts +95 -0
- package/src/ai/contracts/Providers.ts +73 -0
- package/src/ai/contracts/QuotaRetry.ts +39 -0
- package/src/ai/contracts/RateLimits.ts +49 -0
- package/src/ai/contracts/ResponsesProviderCall.ts +30 -0
- package/src/ai/contracts/index.ts +8 -0
- package/src/ai/examples/Conversation.ts +12 -0
- package/src/ai/examples/HelpAgent.ts +27 -0
- package/src/ai/examples/createHelpImage.ts +13 -0
- package/src/ai/index.ts +27 -0
- package/src/ai/registry.ts +70 -0
- package/src/ai/sdkNodeCompatibility.d.ts +76 -0
- package/src/ai/toolCallRecovery.ts +82 -0
- package/src/ai/toolHelpers.ts +145 -0
- package/src/auth/Auth.ts +1422 -0
- package/src/auth/AuthProvider.ts +251 -0
- package/src/auth/AuthToken.ts +239 -0
- package/src/auth/PasswordResetToken.ts +93 -0
- package/src/auth/README.md +396 -0
- package/src/auth/UserIdentity.ts +112 -0
- package/src/auth/contracts/AuthProviderDriver.ts +114 -0
- package/src/auth/contracts/index.ts +1 -0
- package/src/auth/examples/runPasswordAuth.ts +45 -0
- package/src/auth/index.ts +8 -0
- package/src/auth/passwordHash.ts +160 -0
- package/src/auth/providers/GoogleAuthProvider.ts +470 -0
- package/src/auth/providers/PasswordAuthProvider.ts +256 -0
- package/src/auth/providers/index.ts +3 -0
- package/src/auth/providers/resolveAuthProviders.ts +166 -0
- package/src/cache/Cache.ts +151 -0
- package/src/cache/README.md +137 -0
- package/src/cache/contracts/CacheDriver.ts +11 -0
- package/src/cache/contracts/CacheOperations.ts +28 -0
- package/src/cache/contracts/CacheOptions.ts +56 -0
- package/src/cache/contracts/CacheRepository.ts +62 -0
- package/src/cache/contracts/index.ts +4 -0
- package/src/cache/drivers/CacheManagerDriver.ts +84 -0
- package/src/cache/drivers/createCacheDriver.ts +191 -0
- package/src/cache/examples/runNoteCache.ts +37 -0
- package/src/cache/index.ts +2 -0
- package/src/cli/Cli.ts +110 -0
- package/src/cli/README.md +164 -0
- package/src/cli/commands/repl.ts +29 -0
- package/src/cli/contracts/CliCommand.ts +33 -0
- package/src/cli/contracts/CliConfig.ts +10 -0
- package/src/cli/contracts/CliOptions.ts +13 -0
- package/src/cli/contracts/CommandDefinition.ts +19 -0
- package/src/cli/contracts/ReplOptions.ts +11 -0
- package/src/cli/contracts/index.ts +5 -0
- package/src/cli/defineCommand.ts +25 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/runDb3.ts +63 -0
- package/src/cli/runRepl.ts +55 -0
- package/src/config/Config.ts +110 -0
- package/src/config/README.md +142 -0
- package/src/config/env.ts +164 -0
- package/src/config/examples/loadNotesConfig.ts +29 -0
- package/src/config/examples/runConfig.ts +40 -0
- package/src/config/index.ts +2 -0
- package/src/db/ActiveProjection.ts +311 -0
- package/src/db/ActiveQueryBuilder.ts +831 -0
- package/src/db/ActiveRecord.ts +1317 -0
- package/src/db/Database.ts +1283 -0
- package/src/db/FieldType.ts +1243 -0
- package/src/db/README.md +508 -0
- package/src/db/SoftDeletes.ts +158 -0
- package/src/db/commands/check.ts +10 -0
- package/src/db/commands/index.ts +19 -0
- package/src/db/commands/makeMigration.ts +11 -0
- package/src/db/commands/migrate.ts +10 -0
- package/src/db/connection.ts +68 -0
- package/src/db/contracts/ActiveRecordDefinition.ts +69 -0
- package/src/db/contracts/DatabaseBackup.ts +7 -0
- package/src/db/contracts/DatabaseMigrationsConfig.ts +10 -0
- package/src/db/contracts/index.ts +3 -0
- package/src/db/dialects/columnTypes.ts +103 -0
- package/src/db/dialects/index.ts +6 -0
- package/src/db/dialects/mariadb.ts +51 -0
- package/src/db/dialects/mysql.ts +277 -0
- package/src/db/dialects/postgres.ts +143 -0
- package/src/db/dialects/resolveDialect.ts +88 -0
- package/src/db/dialects/types.ts +59 -0
- package/src/db/errors.ts +22 -0
- package/src/db/examples/DefinedUser.ts +20 -0
- package/src/db/examples/FieldNote.ts +27 -0
- package/src/db/examples/KnowledgeNote.ts +29 -0
- package/src/db/examples/NoteCodeField.ts +9 -0
- package/src/db/examples/createNotesTogether.ts +24 -0
- package/src/db/examples/outputs/workspace-notes.json +9 -0
- package/src/db/examples/runFieldNotes.ts +51 -0
- package/src/db/examples/runNoteMigrations.ts +64 -0
- package/src/db/examples/runWorkspaceNotes.ts +86 -0
- package/src/db/examples/workspaceNotes.ts +57 -0
- package/src/db/fields/BooleanField.ts +128 -0
- package/src/db/fields/CharUuidField.ts +91 -0
- package/src/db/fields/ChoiceStringField.ts +97 -0
- package/src/db/fields/DecimalField.ts +157 -0
- package/src/db/fields/EmailField.ts +79 -0
- package/src/db/fields/EncryptedJsonField.ts +211 -0
- package/src/db/fields/IntegerField.ts +200 -0
- package/src/db/fields/JsonField.ts +108 -0
- package/src/db/fields/JsonStringField.ts +63 -0
- package/src/db/fields/LinkField.ts +502 -0
- package/src/db/fields/PasswordField.ts +294 -0
- package/src/db/fields/StringField.ts +154 -0
- package/src/db/fields/StringListField.ts +179 -0
- package/src/db/fields/TextField.ts +71 -0
- package/src/db/fields/TimestampField.ts +164 -0
- package/src/db/fields/UlidField.ts +189 -0
- package/src/db/fields/UrlField.ts +97 -0
- package/src/db/fields/VectorField.ts +266 -0
- package/src/db/fields/createField.ts +22 -0
- package/src/db/fields/field.ts +209 -0
- package/src/db/fields/index.ts +76 -0
- package/src/db/fields/resolveFields.ts +69 -0
- package/src/db/index.ts +13 -0
- package/src/db/migrations/DatabaseMigrationManager.ts +756 -0
- package/src/db/migrations/DatabaseSchemaInspector.ts +541 -0
- package/src/db/migrations/KnexMigrationRenderer.ts +490 -0
- package/src/db/migrations/ModelSchemaCollector.ts +240 -0
- package/src/db/migrations/SchemaDiffer.ts +541 -0
- package/src/db/migrations/SchemaNames.ts +62 -0
- package/src/db/migrations/SchemaSnapshotSerializer.ts +59 -0
- package/src/db/migrations/contracts/DatabaseMigration.ts +143 -0
- package/src/db/migrations/contracts/SchemaChange.ts +113 -0
- package/src/db/migrations/contracts/SchemaSnapshot.ts +122 -0
- package/src/db/migrations/contracts/index.ts +3 -0
- package/src/db/migrations/errors.ts +45 -0
- package/src/db/migrations/index.ts +10 -0
- package/src/db/migrations/promoteDestructiveSchemaChanges.ts +120 -0
- package/src/db/queryMonitor.ts +549 -0
- package/src/db/sqlErrors.ts +36 -0
- package/src/db/test/db.ts +159 -0
- package/src/devtools/HttpEventDispatcher.ts +214 -0
- package/src/devtools/contracts/DevtoolsEventDispatcher.ts +57 -0
- package/src/devtools/contracts/index.ts +1 -0
- package/src/devtools/environment.ts +18 -0
- package/src/devtools/index.ts +3 -0
- package/src/events/Events.ts +165 -0
- package/src/events/README.md +106 -0
- package/src/events/contracts/EventConstructor.ts +12 -0
- package/src/events/contracts/EventListener.ts +8 -0
- package/src/events/contracts/EventUnsubscribe.ts +4 -0
- package/src/events/contracts/index.ts +3 -0
- package/src/events/examples/NoteSaved.ts +9 -0
- package/src/events/examples/runNoteEvents.ts +31 -0
- package/src/events/index.ts +2 -0
- package/src/flows/FlowBlockRegistry.ts +79 -0
- package/src/flows/FlowCompiler.ts +624 -0
- package/src/flows/FlowDefinitionError.ts +24 -0
- package/src/flows/FlowStepJob.ts +54 -0
- package/src/flows/FlowValueValidator.ts +120 -0
- package/src/flows/Flows.ts +1118 -0
- package/src/flows/README.md +144 -0
- package/src/flows/blocks/FlowInput.ts +32 -0
- package/src/flows/blocks/FlowOutput.ts +32 -0
- package/src/flows/blocks/Subflow.ts +24 -0
- package/src/flows/blocks/index.ts +11 -0
- package/src/flows/constants.ts +62 -0
- package/src/flows/contracts/FlowBlock.ts +73 -0
- package/src/flows/contracts/FlowCompiler.ts +32 -0
- package/src/flows/contracts/FlowDefinition.ts +126 -0
- package/src/flows/contracts/FlowDefinitionStore.ts +52 -0
- package/src/flows/contracts/FlowRun.ts +44 -0
- package/src/flows/contracts/FlowValue.ts +54 -0
- package/src/flows/contracts/FlowsService.ts +39 -0
- package/src/flows/contracts/index.ts +7 -0
- package/src/flows/defineBlock.ts +25 -0
- package/src/flows/drivers/FileFlowDefinitionStore.ts +372 -0
- package/src/flows/drivers/index.ts +1 -0
- package/src/flows/errors.ts +22 -0
- package/src/flows/examples/FlowExampleApp.ts +15 -0
- package/src/flows/examples/createTextFlow.ts +14 -0
- package/src/flows/examples/normalizeTextBlock.ts +15 -0
- package/src/flows/examples/runTextFlow.ts +46 -0
- package/src/flows/examples/uppercaseTextBlock.ts +11 -0
- package/src/flows/index.ts +13 -0
- package/src/flows/models/FlowRun.ts +164 -0
- package/src/flows/models/FlowRunEvent.ts +108 -0
- package/src/flows/models/FlowStepRun.ts +176 -0
- package/src/flows/models/index.ts +16 -0
- package/src/index.ts +40 -0
- package/src/logging/Log.ts +100 -0
- package/src/logging/README.md +139 -0
- package/src/logging/contracts/HttpExchange.ts +53 -0
- package/src/logging/contracts/Logger.ts +45 -0
- package/src/logging/contracts/LoggerDriver.ts +19 -0
- package/src/logging/contracts/LoggingOptions.ts +51 -0
- package/src/logging/contracts/index.ts +4 -0
- package/src/logging/drivers/PinoLoggerDriver.ts +376 -0
- package/src/logging/drivers/index.ts +1 -0
- package/src/logging/examples/runNoteLogs.ts +38 -0
- package/src/logging/index.ts +3 -0
- package/src/logging/transports/DevtoolsLogTransport.ts +142 -0
- package/src/mail/Mail.ts +188 -0
- package/src/mail/README.md +206 -0
- package/src/mail/examples/runMailPreview.ts +44 -0
- package/src/mail/examples/welcomeMessage.ts +26 -0
- package/src/mail/index.ts +4 -0
- package/src/mail/transports/FileMailTransport.ts +58 -0
- package/src/mail/transports/MailgunTransport.ts +85 -0
- package/src/mail/transports/ResendTransport.ts +80 -0
- package/src/media/MediaFile.ts +132 -0
- package/src/media/MediaItem.ts +132 -0
- package/src/media/MediaLibrary.ts +117 -0
- package/src/media/MediaManager.ts +874 -0
- package/src/media/README.md +358 -0
- package/src/media/constants.ts +31 -0
- package/src/media/contracts/MediaOptions.ts +9 -0
- package/src/media/contracts/index.ts +1 -0
- package/src/media/examples/createPrivateFileServer.ts +55 -0
- package/src/media/examples/runPrivateFiles.ts +45 -0
- package/src/media/examples/runProjectMedia.ts +46 -0
- package/src/media/image/ImageReconstructionError.ts +18 -0
- package/src/media/image/ImageVariantRenderer.ts +386 -0
- package/src/media/image/ImageVariantRequest.ts +65 -0
- package/src/media/image/contracts/ImageProcessor.ts +53 -0
- package/src/media/image/contracts/ImageVariant.ts +37 -0
- package/src/media/image/contracts/ImageVariantCacheOptions.ts +21 -0
- package/src/media/image/contracts/index.ts +3 -0
- package/src/media/image/index.ts +5 -0
- package/src/media/image/processors/SharpImageProcessor.ts +121 -0
- package/src/media/image/processors/index.ts +1 -0
- package/src/media/index.ts +8 -0
- package/src/media/types.ts +168 -0
- package/src/queue/FailedJob.ts +58 -0
- package/src/queue/Queue.ts +938 -0
- package/src/queue/QueueEvents.ts +57 -0
- package/src/queue/QueueRetryLaterError.ts +40 -0
- package/src/queue/QueueWorker.ts +296 -0
- package/src/queue/QueueableJob.ts +167 -0
- package/src/queue/QueuedJob.ts +69 -0
- package/src/queue/README.md +368 -0
- package/src/queue/RetryPolicy.ts +129 -0
- package/src/queue/commands/index.ts +13 -0
- package/src/queue/commands/makeJob.ts +11 -0
- package/src/queue/console.ts +518 -0
- package/src/queue/contracts/CreateJob.ts +13 -0
- package/src/queue/contracts/QueueDriver.ts +135 -0
- package/src/queue/contracts/QueueEvents.ts +77 -0
- package/src/queue/contracts/QueuePayload.ts +150 -0
- package/src/queue/contracts/QueueRetry.ts +47 -0
- package/src/queue/contracts/QueueService.ts +219 -0
- package/src/queue/contracts/QueueWorkerLifecycle.ts +71 -0
- package/src/queue/contracts/QueueableJob.ts +56 -0
- package/src/queue/contracts/RedisQueueDriver.ts +37 -0
- package/src/queue/contracts/index.ts +9 -0
- package/src/queue/createJob.ts +54 -0
- package/src/queue/drivers/DatabaseQueueDriver.ts +449 -0
- package/src/queue/drivers/RedisQueueDriver.ts +733 -0
- package/src/queue/examples/DeferredReportJob.ts +25 -0
- package/src/queue/examples/GenerateReportJob.ts +37 -0
- package/src/queue/examples/WriteReportJob.ts +37 -0
- package/src/queue/examples/createAndProcessReportJob.ts +29 -0
- package/src/queue/examples/dispatchReportWorkflows.ts +40 -0
- package/src/queue/examples/manageReportRetries.ts +47 -0
- package/src/queue/examples/outputs/create-and-process-report-job.json +6 -0
- package/src/queue/examples/outputs/dispatch-report-workflows.json +14 -0
- package/src/queue/examples/outputs/manage-report-retries.json +24 -0
- package/src/queue/examples/outputs/queue-reports.json +11 -0
- package/src/queue/examples/reportConsole.ts +47 -0
- package/src/queue/examples/runBackpressure.ts +27 -0
- package/src/queue/examples/runQueueReports.ts +80 -0
- package/src/queue/examples/runQueueWorkflows.ts +43 -0
- package/src/queue/index.ts +13 -0
- package/src/queue/queueMonitor.ts +368 -0
- package/src/scheduler/README.md +139 -0
- package/src/scheduler/ScheduledCall.ts +36 -0
- package/src/scheduler/ScheduledEvent.ts +149 -0
- package/src/scheduler/ScheduledJob.ts +58 -0
- package/src/scheduler/ScheduledOccurrence.ts +250 -0
- package/src/scheduler/ScheduledOccurrenceRecorder.ts +125 -0
- package/src/scheduler/Scheduler.ts +225 -0
- package/src/scheduler/SchedulerWorker.ts +151 -0
- package/src/scheduler/console.ts +368 -0
- package/src/scheduler/constants.ts +27 -0
- package/src/scheduler/contracts/Scheduler.ts +123 -0
- package/src/scheduler/contracts/SchedulerConsole.ts +40 -0
- package/src/scheduler/contracts/SchedulerWorker.ts +23 -0
- package/src/scheduler/contracts/index.ts +3 -0
- package/src/scheduler/examples/RecoverableSummaryJob.ts +18 -0
- package/src/scheduler/examples/WriteDailySummaryJob.ts +17 -0
- package/src/scheduler/examples/registerDailySummary.ts +13 -0
- package/src/scheduler/examples/runDailySummary.ts +46 -0
- package/src/scheduler/examples/runScheduledReplay.ts +60 -0
- package/src/scheduler/index.ts +9 -0
- package/src/scheduler/scheduleTime.ts +78 -0
- package/src/security/README.md +130 -0
- package/src/security/Security.ts +346 -0
- package/src/security/SecurityError.ts +16 -0
- package/src/security/contracts/SecurityOptions.ts +20 -0
- package/src/security/contracts/SecurityPayload.ts +14 -0
- package/src/security/contracts/index.ts +2 -0
- package/src/security/ensureAppKey.ts +82 -0
- package/src/security/examples/runSecretRoundTrip.ts +42 -0
- package/src/security/index.ts +4 -0
- package/src/serialization/README.md +169 -0
- package/src/serialization/Serializable.ts +17 -0
- package/src/serialization/SerializationError.ts +91 -0
- package/src/serialization/SerializationRegistry.ts +208 -0
- package/src/serialization/SerializationRegistryError.ts +24 -0
- package/src/serialization/Serializer.ts +793 -0
- package/src/serialization/contracts/SerializableClass.ts +26 -0
- package/src/serialization/contracts/SerializedValue.ts +71 -0
- package/src/serialization/contracts/SerializerOptions.ts +19 -0
- package/src/serialization/contracts/SerializerService.ts +29 -0
- package/src/serialization/contracts/index.ts +4 -0
- package/src/serialization/examples/ExportRequest.ts +25 -0
- package/src/serialization/examples/runExportSerialization.ts +24 -0
- package/src/serialization/index.ts +6 -0
- package/src/server/App.ts +326 -0
- package/src/server/README.md +219 -0
- package/src/server/RequestContext.ts +122 -0
- package/src/server/appContext.ts +59 -0
- package/src/server/examples/createFirstServer.ts +25 -0
- package/src/server/examples/startFirstServer.ts +19 -0
- package/src/server/index.ts +16 -0
- package/src/ssr/README.md +158 -0
- package/src/ssr/constants.ts +8 -0
- package/src/ssr/contracts/DocumentHead.ts +35 -0
- package/src/ssr/contracts/SsrRenderContext.ts +25 -0
- package/src/ssr/contracts/SsrRenderResult.ts +23 -0
- package/src/ssr/contracts/SsrRenderer.ts +12 -0
- package/src/ssr/contracts/SsrRequest.ts +17 -0
- package/src/ssr/contracts/index.ts +19 -0
- package/src/ssr/createSsrRenderContext.ts +25 -0
- package/src/ssr/examples/createPublicPageServer.ts +32 -0
- package/src/ssr/examples/runPublicPages.ts +25 -0
- package/src/ssr/fastify/contracts/FastifySsrOptions.ts +24 -0
- package/src/ssr/fastify/contracts/index.ts +5 -0
- package/src/ssr/fastify/fastifySsr.ts +110 -0
- package/src/ssr/fastify/index.ts +2 -0
- package/src/ssr/index.ts +10 -0
- package/src/ssr/renderDocumentHead.ts +72 -0
- package/src/ssr/renderSsrDocument.ts +35 -0
- package/src/ssr/serializeSsrState.ts +19 -0
- package/src/ssr/vite/contracts/ViteSsrOptions.ts +52 -0
- package/src/ssr/vite/contracts/index.ts +6 -0
- package/src/ssr/vite/fastifyViteSsr.ts +279 -0
- package/src/ssr/vite/index.ts +4 -0
- package/src/ssr/vite/viteSsrManifest.ts +92 -0
- package/src/storage/README.md +310 -0
- package/src/storage/Storage.ts +392 -0
- package/src/storage/contents.ts +23 -0
- package/src/storage/contracts/StorageListing.ts +55 -0
- package/src/storage/contracts/index.ts +1 -0
- package/src/storage/drivers/FlystorageDisk.ts +295 -0
- package/src/storage/drivers/FlystorageListing.ts +78 -0
- package/src/storage/drivers/LocalStorageDisk.ts +45 -0
- package/src/storage/drivers/S3StorageDisk.ts +114 -0
- package/src/storage/drivers/index.ts +3 -0
- package/src/storage/examples/runStorage.ts +37 -0
- package/src/storage/examples/runStreamExport.ts +41 -0
- package/src/storage/examples/writeCsvExport.ts +45 -0
- package/src/storage/index.ts +7 -0
- package/src/storage/mime.ts +30 -0
- package/src/storage/path.ts +76 -0
- package/src/storage/types.ts +251 -0
- package/src/url/README.md +41 -0
- package/src/url/UrlGenerator.ts +72 -0
- package/src/url/contracts/UrlGeneratorOptions.ts +14 -0
- package/src/url/contracts/index.ts +1 -0
- package/src/url/examples/runApplicationLinks.ts +33 -0
- package/src/url/index.ts +2 -0
- package/src/validation/README.md +433 -0
- package/src/validation/examples/runNoteValidation.ts +18 -0
- package/src/validation/examples/validateNoteInput.ts +31 -0
- package/src/validation/index.ts +398 -0
- package/templates/AGENTS.md +15 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Server
|
|
2
|
+
|
|
3
|
+
`@db3.ai/app/server` provides the framework application service hub, the
|
|
4
|
+
active-application accessor used by framework code, and isolated request-scoped
|
|
5
|
+
state. Despite the module name, it does not create or own an HTTP server. A
|
|
6
|
+
Fastify, Express, CLI, worker, or test runtime creates an `App` and integrates
|
|
7
|
+
its own process boundary.
|
|
8
|
+
|
|
9
|
+
## Module Ownership
|
|
10
|
+
|
|
11
|
+
Server is the framework composition root inside `packages/app`:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
server/
|
|
15
|
+
App.ts
|
|
16
|
+
appContext.ts
|
|
17
|
+
RequestContext.ts
|
|
18
|
+
tests/
|
|
19
|
+
index.ts
|
|
20
|
+
README.md
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`App` composes framework services but leaves their behavior in the owning
|
|
24
|
+
service modules. It currently discovers database, auth, request context, cache,
|
|
25
|
+
events, logging, URL, queue, scheduler, security, serialization, storage, and
|
|
26
|
+
media services. Application-specific capabilities belong on an application
|
|
27
|
+
subclass and can reuse `service(...)` for lazy singleton ownership.
|
|
28
|
+
|
|
29
|
+
## Public API
|
|
30
|
+
|
|
31
|
+
Import the application boundary from its supported subpath:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { App, app, clearActiveApp, RequestContext, type AppOptions } from '@db3.ai/app/server';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The public surface includes:
|
|
38
|
+
|
|
39
|
+
- `App` and `AppOptions` for framework service composition and lifecycle.
|
|
40
|
+
- `app<TApp>()` for resolving the active application from models, jobs, and
|
|
41
|
+
other code running inside a bootstrapped process.
|
|
42
|
+
- `setActiveApp(...)` and `clearActiveApp(...)` for explicit runtime and test
|
|
43
|
+
ownership.
|
|
44
|
+
- `activeAppDatabase()` and `activeAppRequestContext()`, which expose optional
|
|
45
|
+
low-level context to framework internals.
|
|
46
|
+
- `RequestContext` and `RequestContextValues` for request-isolated values.
|
|
47
|
+
|
|
48
|
+
Normal application code should use `app().db`, `app().queue`, and the other
|
|
49
|
+
service getters. `activeAppDatabase()` is a framework escape hatch, not a
|
|
50
|
+
second application data-access pattern.
|
|
51
|
+
|
|
52
|
+
## Application Setup
|
|
53
|
+
|
|
54
|
+
Create one application during process boot and close it during shutdown:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { App } from '@db3.ai/app/server';
|
|
58
|
+
|
|
59
|
+
const application = new App({
|
|
60
|
+
config: {
|
|
61
|
+
cache: {
|
|
62
|
+
default: 'memory',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
url: {
|
|
66
|
+
baseUrl: 'https://example.com',
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
process.once('SIGTERM', async () => {
|
|
71
|
+
await application.close();
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Constructing `App` registers it as the process's active application. Service
|
|
76
|
+
getters instantiate their service on first access and return the same instance
|
|
77
|
+
thereafter.
|
|
78
|
+
|
|
79
|
+
`AppOptions` accepts explicit database, database behavior, auth, config,
|
|
80
|
+
logging, URL, queue, serializer, and storage configuration. Cache, media, and
|
|
81
|
+
security read their named options from the application config repository. When
|
|
82
|
+
`config.security` exists, construction resolves the security service
|
|
83
|
+
immediately so invalid key configuration fails during boot rather than on the
|
|
84
|
+
first encrypted operation.
|
|
85
|
+
|
|
86
|
+
The default database connection is owned by the framework and is closed by
|
|
87
|
+
`App.close()`. An injected `db` connection remains owned by its caller and is
|
|
88
|
+
not destroyed during application shutdown.
|
|
89
|
+
|
|
90
|
+
## Extending The Service Hub
|
|
91
|
+
|
|
92
|
+
An application can expose domain services without adding them to the reusable
|
|
93
|
+
framework root:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { App as FrameworkApp } from '@db3.ai/app/server';
|
|
97
|
+
import { createMailFromEnv, type Mail } from '@db3.ai/app/mail';
|
|
98
|
+
|
|
99
|
+
export class Application extends FrameworkApp {
|
|
100
|
+
/**
|
|
101
|
+
* Returns the application-owned outbound mail service.
|
|
102
|
+
*
|
|
103
|
+
* @returns Shared mail service configured from the process environment.
|
|
104
|
+
*/
|
|
105
|
+
get mail(): Mail {
|
|
106
|
+
return this.service('mail', () => createMailFromEnv());
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Use a stable, application-owned service name. `set(name, instance)` replaces or
|
|
112
|
+
registers a concrete service, which is useful for runtime adapters and tests.
|
|
113
|
+
`service(name, factory)` only invokes its factory when no truthy instance has
|
|
114
|
+
already been stored.
|
|
115
|
+
|
|
116
|
+
## Active Application Context
|
|
117
|
+
|
|
118
|
+
Framework models and queued jobs can resolve the current service hub without
|
|
119
|
+
threading an `App` argument through every API:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import { app } from '@db3.ai/app/server';
|
|
123
|
+
|
|
124
|
+
await app().queue.dispatch(new GenerateReportJob({ reportId }));
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The active application is process-global. Constructing or explicitly setting a
|
|
128
|
+
second application replaces the prior active reference, so runtimes should not
|
|
129
|
+
interleave multiple application instances in one process. Tests must close or
|
|
130
|
+
clear applications they create to prevent state leaking into another test.
|
|
131
|
+
|
|
132
|
+
`clearActiveApp(application)` only clears the context when that application is
|
|
133
|
+
still active. Calling it without an argument unconditionally clears the active
|
|
134
|
+
reference.
|
|
135
|
+
|
|
136
|
+
## Request Context
|
|
137
|
+
|
|
138
|
+
`RequestContext` uses Node `AsyncLocalStorage` to isolate values across
|
|
139
|
+
concurrent asynchronous request chains. An HTTP adapter should wrap the complete
|
|
140
|
+
request lifecycle:
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
return application.requestContext.run(async () => {
|
|
144
|
+
application.requestContext.set('requestId', request.id);
|
|
145
|
+
|
|
146
|
+
return handleRequest(request);
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Use `get`, `has`, `set`, and `delete` for explicit values. `remember(...)`
|
|
151
|
+
computes a value once per active request and shares an in-flight promise with
|
|
152
|
+
concurrent consumers in that request:
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
const user = application.requestContext.remember('auth.user', async () => {
|
|
156
|
+
return authenticateRequest(request);
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
A rejected remembered promise removes itself from the request store, allowing a
|
|
161
|
+
later call to retry. Outside an active request, `remember(...)` invokes its
|
|
162
|
+
factory normally without caching, while `set(...)` throws because there is no
|
|
163
|
+
request-owned store.
|
|
164
|
+
|
|
165
|
+
## Shutdown And Failure Behaviour
|
|
166
|
+
|
|
167
|
+
`App.close()` clears the active reference when it owns it, detaches the Scheduler recorder,
|
|
168
|
+
clears Events listeners, awaits Cache and Log shutdown, closes the
|
|
169
|
+
framework-owned default database, and clears cached service instances.
|
|
170
|
+
Application subclasses remain responsible for closing any additional resources
|
|
171
|
+
they introduce.
|
|
172
|
+
|
|
173
|
+
It does not stop a `SchedulerWorker`, drain Queue workers, or close a Redis
|
|
174
|
+
queue driver. Stop accepting work, finish or deliberately terminate workers,
|
|
175
|
+
and close their owned transports before closing the App, while running jobs
|
|
176
|
+
can still resolve `app()`. An injected database remains caller-owned.
|
|
177
|
+
|
|
178
|
+
Calling `app()` before boot fails with `No active application has been
|
|
179
|
+
created.`. Invalid `DB_SYNC_COLUMNS` values also fail explicitly; accepted true
|
|
180
|
+
values are `1`, `true`, `yes`, and `on`, while false values are `0`, `false`,
|
|
181
|
+
`no`, and `off`. When unset, automatic safe column synchronization remains
|
|
182
|
+
enabled unless `dbOptions.syncColumns` overrides it.
|
|
183
|
+
|
|
184
|
+
The application hub is not an HTTP dependency container, request router, or
|
|
185
|
+
durable registry. Process startup remains responsible for constructing the app,
|
|
186
|
+
registering models, jobs and adapters, and attaching clean shutdown handlers.
|
|
187
|
+
|
|
188
|
+
## Testing And Verification
|
|
189
|
+
|
|
190
|
+
The shipped [application factory](./examples/createFirstServer.ts) and
|
|
191
|
+
[process entry point](./examples/startFirstServer.ts) form the independent
|
|
192
|
+
first-app walkthrough. After installing the package, Fastify, `tsx`, TypeScript
|
|
193
|
+
and Vitest, copy `src/server/examples` into an application's `examples`
|
|
194
|
+
directory and run `npx tsx examples/startFirstServer.ts`.
|
|
195
|
+
The website includes the exact consumer-copyable HTTP injection test.
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
The service-owned tests cover active-app lookup and request-context isolation,
|
|
199
|
+
memoization, promise sharing, rejection recovery, and behaviour outside a
|
|
200
|
+
request:
|
|
201
|
+
|
|
202
|
+
```sh
|
|
203
|
+
npm run test:service --workspace packages/app -- server
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Run the complete framework suite and source checks before publishing a change:
|
|
207
|
+
|
|
208
|
+
```sh
|
|
209
|
+
npm test --workspace packages/app
|
|
210
|
+
npm run check --workspace packages/app
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Tests that create an `App` must use a disposable test database or inject the
|
|
214
|
+
specific real framework component they need, then call `close()` or
|
|
215
|
+
`clearActiveApp()` during cleanup. Relevant implementation lives in
|
|
216
|
+
[`App.ts`](./App.ts), [`appContext.ts`](./appContext.ts),
|
|
217
|
+
and [`RequestContext.ts`](./RequestContext.ts). Behavioural tests live at
|
|
218
|
+
`packages/app/src/server/tests/` in the source repository and are not included
|
|
219
|
+
in the installed runtime package.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
|
|
3
|
+
export type RequestContextValues =
|
|
4
|
+
| Map<string, unknown>
|
|
5
|
+
| Record<string, unknown>
|
|
6
|
+
| Iterable<readonly [string, unknown]>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Request-scoped key/value context.
|
|
10
|
+
*
|
|
11
|
+
* Values are isolated with AsyncLocalStorage so the app singleton can expose
|
|
12
|
+
* request data without sharing it across concurrent requests.
|
|
13
|
+
*/
|
|
14
|
+
export class RequestContext {
|
|
15
|
+
private readonly storage = new AsyncLocalStorage<Map<string, unknown>>();
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns true when code is running inside a request context.
|
|
19
|
+
*/
|
|
20
|
+
get active(): boolean {
|
|
21
|
+
return Boolean(this.storage.getStore());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Runs a callback inside an isolated request context.
|
|
26
|
+
*/
|
|
27
|
+
run<TResult>(
|
|
28
|
+
callback: () => TResult,
|
|
29
|
+
initialValues?: RequestContextValues,
|
|
30
|
+
): TResult {
|
|
31
|
+
return this.storage.run(this.initialStore(initialValues), callback);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Reads a value from the active request context.
|
|
36
|
+
*/
|
|
37
|
+
get<TValue = unknown>(key: string): TValue | undefined {
|
|
38
|
+
return this.storage.getStore()?.get(key) as TValue | undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns true when the active request context contains a value for the key.
|
|
43
|
+
*/
|
|
44
|
+
has(key: string): boolean {
|
|
45
|
+
return this.storage.getStore()?.has(key) ?? false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Stores a value on the active request context.
|
|
50
|
+
*/
|
|
51
|
+
set<TValue>(key: string, value: TValue): TValue {
|
|
52
|
+
const store = this.storage.getStore();
|
|
53
|
+
|
|
54
|
+
if (!store) {
|
|
55
|
+
throw new Error('No active request context.');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
store.set(key, value);
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Returns an existing request value or stores the factory result for reuse.
|
|
64
|
+
*/
|
|
65
|
+
remember<TValue>(key: string, factory: () => TValue): TValue {
|
|
66
|
+
const store = this.storage.getStore();
|
|
67
|
+
|
|
68
|
+
if (!store) {
|
|
69
|
+
return factory();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (store.has(key)) {
|
|
73
|
+
return store.get(key) as TValue;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const value = factory();
|
|
77
|
+
|
|
78
|
+
store.set(key, value);
|
|
79
|
+
|
|
80
|
+
if (isPromiseLike(value)) {
|
|
81
|
+
Promise.resolve(value).catch(() => {
|
|
82
|
+
if (store.get(key) === value) {
|
|
83
|
+
store.delete(key);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Deletes a value from the active request context.
|
|
93
|
+
*/
|
|
94
|
+
delete(key: string): boolean {
|
|
95
|
+
return this.storage.getStore()?.delete(key) ?? false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Normalises initial request values into the internal map store.
|
|
100
|
+
*/
|
|
101
|
+
private initialStore(initialValues?: RequestContextValues): Map<string, unknown> {
|
|
102
|
+
if (!initialValues) return new Map();
|
|
103
|
+
if (initialValues instanceof Map) return new Map(initialValues);
|
|
104
|
+
if (Symbol.iterator in Object(initialValues)) {
|
|
105
|
+
return new Map(initialValues as Iterable<readonly [string, unknown]>);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return new Map(Object.entries(initialValues));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Detects promise-like values without forcing callers to return real promises.
|
|
114
|
+
*/
|
|
115
|
+
function isPromiseLike(value: unknown): value is PromiseLike<unknown> {
|
|
116
|
+
return Boolean(
|
|
117
|
+
value
|
|
118
|
+
&& typeof value === 'object'
|
|
119
|
+
&& 'then' in value
|
|
120
|
+
&& typeof value.then === 'function',
|
|
121
|
+
);
|
|
122
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Knex } from 'knex';
|
|
2
|
+
import type { App } from './App';
|
|
3
|
+
import type { RequestContext } from './RequestContext';
|
|
4
|
+
|
|
5
|
+
export interface AppDatabaseProvider {
|
|
6
|
+
db: {
|
|
7
|
+
knex: Knex;
|
|
8
|
+
};
|
|
9
|
+
requestContext?: RequestContext;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let activeApp: AppDatabaseProvider | null = null;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Registers the active app for framework services that need app-scoped access.
|
|
16
|
+
*/
|
|
17
|
+
export function setActiveApp(app: AppDatabaseProvider): AppDatabaseProvider {
|
|
18
|
+
activeApp = app;
|
|
19
|
+
return app;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Returns the active application service hub.
|
|
24
|
+
*
|
|
25
|
+
* Framework and application jobs use this accessor to resolve services when
|
|
26
|
+
* their handle methods run inside a bootstrapped worker process.
|
|
27
|
+
*
|
|
28
|
+
* @returns Active application instance.
|
|
29
|
+
*/
|
|
30
|
+
export function app<TApp extends AppDatabaseProvider = App>(): TApp {
|
|
31
|
+
if (!activeApp) {
|
|
32
|
+
throw new Error('No active application has been created.');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return activeApp as TApp;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Clears the active app when the caller owns the current active instance.
|
|
40
|
+
*/
|
|
41
|
+
export function clearActiveApp(app?: AppDatabaseProvider): void {
|
|
42
|
+
if (app && activeApp !== app) return;
|
|
43
|
+
|
|
44
|
+
activeApp = null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Returns the active app database connection when an app is registered.
|
|
49
|
+
*/
|
|
50
|
+
export function activeAppDatabase(): Knex | null {
|
|
51
|
+
return activeApp?.db.knex ?? null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Returns the active app request context when an app is registered.
|
|
56
|
+
*/
|
|
57
|
+
export function activeAppRequestContext(): RequestContext | null {
|
|
58
|
+
return activeApp?.requestContext ?? null;
|
|
59
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Fastify, { type FastifyInstance } from 'fastify';
|
|
2
|
+
import { App } from '@db3.ai/app/server';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a small HTTP application without opening a port or database.
|
|
6
|
+
*
|
|
7
|
+
* The caller owns listen/close, so the same app can serve requests in a process
|
|
8
|
+
* or be exercised through Fastify.inject in an isolated test.
|
|
9
|
+
*
|
|
10
|
+
* @param greeting - Application-owned greeting, configurable at process boot.
|
|
11
|
+
* @returns HTTP server with framework cleanup attached to its close lifecycle.
|
|
12
|
+
*/
|
|
13
|
+
export function createFirstServer(greeting = 'Hello'): FastifyInstance {
|
|
14
|
+
const application = new App({ config: { greeting } });
|
|
15
|
+
const server = Fastify();
|
|
16
|
+
server.addHook('onClose', async () => { await application.close(); });
|
|
17
|
+
server.get('/health', async () => ({ status: 'ready' }));
|
|
18
|
+
server.get<{ Params: { name: string } }>('/hello/:name', {
|
|
19
|
+
schema: { params: { type: 'object', required: ['name'], properties: { name: { type: 'string', minLength: 1, maxLength: 80 } } } },
|
|
20
|
+
}, async request => application.requestContext.run(async () => {
|
|
21
|
+
application.requestContext.set('requestId', request.id);
|
|
22
|
+
return { message: `${application.config.get<string>('greeting')}, ${request.params.name}!` };
|
|
23
|
+
}));
|
|
24
|
+
return server;
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFirstServer } from './createFirstServer';
|
|
2
|
+
|
|
3
|
+
const port = Number(process.env.PORT ?? 3000);
|
|
4
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error('PORT must be an integer from 1 to 65535.');
|
|
5
|
+
const server = createFirstServer(process.env.GREETING ?? 'Hello');
|
|
6
|
+
|
|
7
|
+
/** Closes the listener and framework resources when the local process stops. */
|
|
8
|
+
async function shutdown(): Promise<void> {
|
|
9
|
+
await server.close();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
process.once('SIGINT', shutdown);
|
|
13
|
+
process.once('SIGTERM', shutdown);
|
|
14
|
+
try {
|
|
15
|
+
console.log(await server.listen({ port, host: '127.0.0.1' }));
|
|
16
|
+
} catch (error) {
|
|
17
|
+
await server.close();
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export {
|
|
2
|
+
App,
|
|
3
|
+
type AppOptions,
|
|
4
|
+
} from './App';
|
|
5
|
+
export {
|
|
6
|
+
app,
|
|
7
|
+
activeAppDatabase,
|
|
8
|
+
activeAppRequestContext,
|
|
9
|
+
clearActiveApp,
|
|
10
|
+
setActiveApp,
|
|
11
|
+
type AppDatabaseProvider,
|
|
12
|
+
} from './appContext';
|
|
13
|
+
export {
|
|
14
|
+
RequestContext,
|
|
15
|
+
type RequestContextValues,
|
|
16
|
+
} from './RequestContext';
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Server-side rendering
|
|
2
|
+
|
|
3
|
+
## Runnable public-page boundary
|
|
4
|
+
|
|
5
|
+
Install `fastify@5`, copy the package's `src/ssr/examples/` into `examples/`,
|
|
6
|
+
then run `npx tsx examples/runPublicPages.ts`. The injectable server renders
|
|
7
|
+
isolated requests, safely embeds JSON state, preserves literal replacement-token
|
|
8
|
+
text, rejects unknown API routes and recovers after a private render failure.
|
|
9
|
+
It needs no SQL, listening port, Vue build or provider credentials. The exact
|
|
10
|
+
consumer test is `tests/examples/runPublicPages.test.ts`. It proves the adapter
|
|
11
|
+
boundary, not a complete Vue hydration or production proxy configuration.
|
|
12
|
+
|
|
13
|
+
Document substitution treats rendered values literally, including `$&` and
|
|
14
|
+
marker-like text in application output. Body markup still must be trusted;
|
|
15
|
+
literal insertion is not HTML sanitization.
|
|
16
|
+
|
|
17
|
+
`@db3.ai/app/ssr` provides the transport-neutral boundary for rendering public
|
|
18
|
+
HTML. It deliberately does not live on `App`: SSR is an optional web delivery
|
|
19
|
+
concern, while queues, schedulers, APIs and other processes can continue using
|
|
20
|
+
the framework without Vue, Vite or Fastify SSR dependencies.
|
|
21
|
+
|
|
22
|
+
The initial framework component owns:
|
|
23
|
+
|
|
24
|
+
- one isolated render context per request;
|
|
25
|
+
- document head and render-result contracts;
|
|
26
|
+
- safe JSON hydration-state serialization;
|
|
27
|
+
- deterministic HTML document assembly;
|
|
28
|
+
- an optional Fastify adapter with its own error boundary;
|
|
29
|
+
- a first-class Vite/Fastify lifecycle adapter for development and production.
|
|
30
|
+
|
|
31
|
+
The host application owns its Vue app, router, page data loading, client and
|
|
32
|
+
server entries. The optional Vite adapter owns development middleware,
|
|
33
|
+
production bundle loading, manifest links, and static asset registration. SSR
|
|
34
|
+
data should still be loaded through the application's HTTP API rather than
|
|
35
|
+
importing app models into the frontend server entry.
|
|
36
|
+
|
|
37
|
+
## Document template
|
|
38
|
+
|
|
39
|
+
The application marker is required. Head and state markers are optional for
|
|
40
|
+
documents that intentionally do not hydrate in the browser.
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<!doctype html>
|
|
44
|
+
<html lang="en">
|
|
45
|
+
<head>
|
|
46
|
+
<meta charset="UTF-8">
|
|
47
|
+
<!--platform-ssr-head-->
|
|
48
|
+
</head>
|
|
49
|
+
<body>
|
|
50
|
+
<div id="app"><!--platform-ssr-app--></div>
|
|
51
|
+
<script id="__PLATFORM_SSR_STATE__" type="application/json"><!--platform-ssr-state--></script>
|
|
52
|
+
<script type="module" src="/src/entry-client.ts"></script>
|
|
53
|
+
</body>
|
|
54
|
+
</html>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The state marker receives escaped JSON, not executable JavaScript. The client
|
|
58
|
+
entry can parse it before hydrating:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
const element = document.querySelector('#__PLATFORM_SSR_STATE__');
|
|
62
|
+
const state = JSON.parse(element?.textContent || '{}');
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Fastify adapter
|
|
66
|
+
|
|
67
|
+
Install Fastify in the host application and register the optional adapter:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import Fastify from 'fastify';
|
|
71
|
+
import { fastifySsr } from '@db3.ai/app/ssr/fastify';
|
|
72
|
+
import template from './index.html?raw';
|
|
73
|
+
import { renderPage } from './src/entry-server';
|
|
74
|
+
|
|
75
|
+
const server = Fastify();
|
|
76
|
+
|
|
77
|
+
server.get('/api/health', async () => ({ ok: true }));
|
|
78
|
+
|
|
79
|
+
await server.register(fastifySsr({
|
|
80
|
+
template,
|
|
81
|
+
render: renderPage,
|
|
82
|
+
routes: ['/blog', '/blog/*'],
|
|
83
|
+
shouldRender: (request) => {
|
|
84
|
+
const path = request.url.split('?')[0];
|
|
85
|
+
return path !== '/api' && !path.startsWith('/api/');
|
|
86
|
+
},
|
|
87
|
+
}));
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Prefer explicit `routes` when SSR owns a contained public surface. When omitted,
|
|
91
|
+
the adapter retains its `/*` fallback for applications whose complete page
|
|
92
|
+
surface is server rendered. Fastify's specific routes take precedence over that
|
|
93
|
+
fallback. `shouldRender` remains an additional guard for reserved route prefixes
|
|
94
|
+
so an unknown API route does not accidentally receive an HTML page.
|
|
95
|
+
|
|
96
|
+
The application renderer returns markup and can collect status, head metadata
|
|
97
|
+
and hydration state on its request-owned context:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import type { SsrRenderer } from '@db3.ai/app/ssr';
|
|
101
|
+
|
|
102
|
+
export const renderPage: SsrRenderer = async (context) => {
|
|
103
|
+
context.head.title = 'Example App';
|
|
104
|
+
context.state.page = await loadPageThroughHttpApi(context.request.url);
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
appHtml: renderApplicationMarkup(context.state.page),
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Create a fresh Vue application, router and store inside every call to the
|
|
113
|
+
renderer. Module-level mutable auth, router or store state can leak between
|
|
114
|
+
concurrent requests and must not be used.
|
|
115
|
+
|
|
116
|
+
## Vite and Fastify integration
|
|
117
|
+
|
|
118
|
+
`@db3.ai/app/ssr/vite` provides the complete Vite lifecycle while retaining
|
|
119
|
+
explicit route ownership:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import Fastify from 'fastify';
|
|
123
|
+
import { fastifyViteSsr } from '@db3.ai/app/ssr/vite';
|
|
124
|
+
|
|
125
|
+
const server = Fastify();
|
|
126
|
+
|
|
127
|
+
await server.register(fastifyViteSsr({
|
|
128
|
+
root: import.meta.dirname,
|
|
129
|
+
routes: ['/blog', '/blog/*'],
|
|
130
|
+
viteConfigFile: 'vite.marketing.config.ts',
|
|
131
|
+
template: 'marketing.html',
|
|
132
|
+
developmentEntry: '/src/marketing/entry-server.ts',
|
|
133
|
+
preloadJavaScript: false,
|
|
134
|
+
staticAssets: {
|
|
135
|
+
prefix: '/site-assets/',
|
|
136
|
+
directory: 'dist/client/site-assets',
|
|
137
|
+
},
|
|
138
|
+
}));
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`viteConfigFile` lets one application keep its SPA and SSR marketing graphs
|
|
142
|
+
separate while sharing the same source tree. The SSR adapter uses that config
|
|
143
|
+
for development transforms; production continues loading the explicit client
|
|
144
|
+
and server output paths supplied by the application.
|
|
145
|
+
|
|
146
|
+
In development the adapter uses Vite middleware mode, transforms the HTML shell
|
|
147
|
+
per request, hot-loads `/src/entry-server.ts`, and makes Vite's source, module,
|
|
148
|
+
dependency, filesystem, and HMR URL namespaces available to the browser. Unknown
|
|
149
|
+
page URLs still fall through to the application's ordinary not-found boundary.
|
|
150
|
+
In production it reads `dist/client/index.html`, imports
|
|
151
|
+
`dist/server/entry-server.js`, serves the configured asset directory, and maps
|
|
152
|
+
`context.modules` through Vite's SSR manifest. Set `preloadJavaScript: false`
|
|
153
|
+
for HTML/CSS-only pages; hydrating apps can retain the default module-preload
|
|
154
|
+
behavior.
|
|
155
|
+
|
|
156
|
+
This makes SSR designation deliberate and visible: a page is server-rendered
|
|
157
|
+
only when the application router implements it and its URL appears in the
|
|
158
|
+
adapter's `routes` list. An existing SPA can continue owning every other route.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Marker replaced with document head tags during SSR document assembly. */
|
|
2
|
+
export const SSR_HEAD_MARKER = '<!--platform-ssr-head-->';
|
|
3
|
+
|
|
4
|
+
/** Marker replaced with application markup during SSR document assembly. */
|
|
5
|
+
export const SSR_APP_MARKER = '<!--platform-ssr-app-->';
|
|
6
|
+
|
|
7
|
+
/** Marker replaced with safely serialised hydration state. */
|
|
8
|
+
export const SSR_STATE_MARKER = '<!--platform-ssr-state-->';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Attribute value supported by server-rendered document head tags. */
|
|
2
|
+
export type DocumentHeadAttributeValue = string | number | boolean | null | undefined;
|
|
3
|
+
|
|
4
|
+
/** Attributes written onto a server-rendered document head tag. */
|
|
5
|
+
export type DocumentHeadAttributes = Record<string, DocumentHeadAttributeValue>;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Script emitted through the single server-rendered document head pipeline.
|
|
9
|
+
*
|
|
10
|
+
* Content must come from trusted application code. The renderer prevents a
|
|
11
|
+
* closing script sequence from escaping the tag but does not sanitise scripts.
|
|
12
|
+
*/
|
|
13
|
+
export interface DocumentHeadScript {
|
|
14
|
+
/** HTML attributes written onto the script element. */
|
|
15
|
+
attributes?: DocumentHeadAttributes;
|
|
16
|
+
/** Trusted inline script or JSON-LD content. */
|
|
17
|
+
content?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Head metadata collected while rendering one HTTP request.
|
|
22
|
+
*
|
|
23
|
+
* Applications can mutate this request-owned object from their SSR router or
|
|
24
|
+
* page components. It is rendered once into the document template.
|
|
25
|
+
*/
|
|
26
|
+
export interface DocumentHead {
|
|
27
|
+
/** Browser and search-result title for the rendered document. */
|
|
28
|
+
title?: string;
|
|
29
|
+
/** Meta elements, including descriptions, robots and social metadata. */
|
|
30
|
+
meta: DocumentHeadAttributes[];
|
|
31
|
+
/** Link elements, including canonical URLs and alternate resources. */
|
|
32
|
+
link: DocumentHeadAttributes[];
|
|
33
|
+
/** Trusted scripts, including JSON-LD structured data. */
|
|
34
|
+
script: DocumentHeadScript[];
|
|
35
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DocumentHead } from './DocumentHead';
|
|
2
|
+
import type { SsrRequest } from './SsrRequest';
|
|
3
|
+
|
|
4
|
+
/** JSON-compatible request state made available to the hydrating client. */
|
|
5
|
+
export type SsrState = Record<string, unknown>;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Mutable state isolated to one server-side render request.
|
|
9
|
+
*
|
|
10
|
+
* Vue and other renderers may use `modules` to record the modules touched by a
|
|
11
|
+
* render. A later build adapter can map those identifiers to route-specific
|
|
12
|
+
* JavaScript and CSS without changing the application renderer contract.
|
|
13
|
+
*/
|
|
14
|
+
export interface SsrRenderContext<TState extends object = SsrState> {
|
|
15
|
+
/** Transport-neutral request information. */
|
|
16
|
+
request: SsrRequest;
|
|
17
|
+
/** Response status used when the render result does not override it. */
|
|
18
|
+
status: number;
|
|
19
|
+
/** Document metadata collected during rendering. */
|
|
20
|
+
head: DocumentHead;
|
|
21
|
+
/** State serialised into the document for client hydration. */
|
|
22
|
+
state: TState;
|
|
23
|
+
/** Module identifiers observed by the concrete server renderer. */
|
|
24
|
+
modules: Set<string>;
|
|
25
|
+
}
|