@brickkit/effect 0.16.0-beta.8 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as OpenApiDocument, $i as createPostgresDatabase, $n as RawSocketHandle, $r as ClientIp, $t as PluginInfo, A as OtlpOptions, Ai as ScopedFiles, An as ResourceIdentity, Ar as ActionConfigBase, At as ToolAnnotations, B as spanStore, Bi as envSource, Bn as EventsOptions, Br as ExecuteParams, Bt as PluginRouteRegistrar, C as OutboxTable, Ca as StandardErrorCode, Ci as CallDeps, Cn as CommandRow, Cr as EventRefs, Ct as NoIdentity, D as ScheduleTable, Da as toErrorResponse, Di as LOCAL_FILES_ROUTE, Dn as ResourceActionInput, Dr as isCrudEvent, Dt as defineService, E as ScheduleRunRecord, Ea as WireError, Ei as FileStorage, En as ResourceActionConfig, Er as defineEvents, Et as ServiceOptions, F as SpanStore, Fi as SecretOptions, Fn as CrudEventPayload, Fr as AuthorizedActionConfig, Ft as ContextOf, G as DASHBOARD_MCP_TOOLS, Gi as AnyDatabaseHandle, Gn as ScheduleConfig, Gr as Stage, Gt as ResourcePluginAPI, H as traceRoute, Hi as overrideSecret, Hn as RetryDecision, Hr as HttpMethod, Ht as PluginRoutes, I as Telemetry, Ii as SecretRef, In as DispatchOptions, Ir as Call, It as InstalledPlugin, J as normalizeDashboard, Ji as DatabaseService, Jn as defineSchedule, Jr as stagesOf, Jt as ServicePlugin, K as DashboardAuth, Ki as DatabaseConnection, Kn as ScheduleRun, Kr as Wire, Kt as ResourcePluginContext, L as TelemetryOptions, Li as SecretSource, Ln as EventDelivery, Lr as ErrorDefinition, Lt as PLUGIN_KIND, M as SpanEndRecord, Mi as s3, Mn as defineResource, Mr as ActionParams, Mt as ToolOptions, N as SpanEventRecord, Ni as StorageError, Nn as idSchema, Nr as AnyAction, Nt as defineTool, O as scheduleTable, Oa as toWireError, Oi as RawDeps, On as ResourceChild, Or as Action, Ot as AnyTool, P as SpanStartRecord, Pi as StorageUnavailableError, Pn as loadRecord, Pr as AnySchema, Pt as isTool, Q as DocumentationOptions, Qi as SQLiteOptions, Qn as RawSocketFrame, Qr as redact, Qt as PluginFactory, R as TelemetryRecord, Ri as SecretValidator, Rn as EventEnvelope, Rr as ErrorDefinitions, Rt as PluginEndpointContext, S as OutboxStatus, Sa as STANDARD_ERRORS, Si as storageKey, Sn as CommandErrors, Sr as EventRef, St as AnyService, T as ScheduleState, Ta as ValidationIssue, Ti as FileDriver, Tn as ResourceActionAccess, Tr as crudEventSource, Tt as ServiceContext, U as traceScheduleRun, Ui as resetSecrets, Un as WorkflowEvent, Ur as Next, Ut as RequirementOf, V as telemetryLayer, Vi as listSecrets, Vn as ListenerFailure, Vr as HTTP_METHODS, Vt as PluginRouteScope, W as DASHBOARD_MCP_ROUTE, Wi as resolveSecrets, Wn as Schedule, Wr as PluginActionChecks, Wt as ResourcePlugin, X as requestLoggingPlugin, Xi as PostgresOptions, Xn as RawSocket, Xr as Sensitive, Xt as PluginAppContext, Y as RequestLoggingOptions, Yi as PostgresDatabaseConfig, Yn as CronExpression, Yr as Reveal, Yt as ServicePluginContext, Z as ApiDocument, Zi as SQLiteDatabaseConfig, Zn as RawSocketConfig, Zr as hasSensitive, Zt as PluginContext, _ as EventsHub, _a as signDashboardIdentity, _i as StorageOf, _n as ChildChanges, _r as WebhookConfig, _t as getActionRoute, a as Activity, aa as Logger, ai as PostgresAuditTable, an as PluginSetupContext, ar as BrickSocketSender, at as EndpointMethod, b as OutboxCounts, ba as DuplicateNameError, bi as memory, bn as CommandConfig, br as isWebhook, bt as ActionAccessPolicy, c as WORKFLOW_TABLE, ca as DASHBOARD_KEY_ENV, ci as isAuditTable, cn as pluginOwner, cr as SocketBrokerMessage, ct as ActionSchema, d as workflowEngine, da as DashboardUser, di as FrameworkStorage, dn as HostHooks, dr as SocketEmitOptions, dt as ServiceSchema, ea as createSQLiteDatabase, ei as RateLimit, en as PluginInstallOptions, er as RawSocketMessage, et as ReferenceDocument, f as AppEvents, fa as dashboardIdentity, fi as KeyValueDriver, fn as PluginHookArgs, fr as SocketEventArgs, ft as exportArchitecture, g as EventsDefinition, ga as markDashboardArrival, gi as StorageDriver, gn as AnyResource, gr as SocketSchemas, gt as actionOwners, h as Events, ha as dashboardUser, hi as RedisStorageOptions, hn as getHostHooks, hr as SocketSchema, ht as RouteIR, i as brick, ia as CallContext, ii as AuditTable, in as PluginServiceContext, ir as BrickSocketHandle, it as EndpointDefinition, j as SpanAttributes, ji as StoredFile, jn as ResourceTypeOptions, jr as ActionContext, jt as ToolContext, k as FinishedSpan, ki as S3StorageOptions, kn as ResourceConfig, kr as ActionConfig, kt as Tool, l as Workflow, la as DashboardIdentity, li as recordAudit, ln as HOOK_NAMES, lr as SocketConfig, lt as ArchitectureApplication, m as EventRecorder, ma as dashboardMcpCaller, mi as PutIfAbsentResult, mn as addHostHooks, mr as SocketReplay, mt as DEFAULT_PREFIX, n as BrickOptions, na as isDatabaseHandle, ni as clientAddress, nn as PluginLifecycleContext, nr as RawSocketStats, nt as scalarDocsHTML, o as DurableClock, oa as createLogger, oi as SQLiteAuditTable, on as definePlugin, or as RegisteredSocket, ot as CorsOptions, p as EventContext, pa as dashboardKey, pi as KeyValueStorage, pn as PluginHooks, pr as SocketPayloads, pt as ActionRoute, q as DashboardOptions, qi as DatabaseHandle, qn as WorkflowScheduleRun, qr as runStages, qt as ResourcePluginTypes, r as ListeningServer, ra as BaseContext, ri as AuditOptions, rn as PluginManifest, rr as SocketsOptions, rt as EndpointContext, s as DurableDeferred, sa as DASHBOARD_IDENTITY_HEADER, si as auditTable, sn as PluginTableBuilders, sr as SocketBroker, st as CorsOrigin, t as BrickApp, ta as defineDatabase, ti as RateLimits, tn as PluginInstance, tr as RawSocketPhase, tt as ReferenceOptions, u as WorkflowEngine, ua as DashboardMcpCaller, ui as Counter, un as HookResult, ur as SocketEmitArgs, ut as ArchitectureSchema, v as ScheduleControl, va as signDashboardMcp, vi as defineStorage, vn as Command, vr as WebhookRequest, vt as kebabCase, w as outboxTable, wa as ValidationError, wi as CallFiles, wn as Resource, wr as crudEventName, wt as Service, x as OutboxRow, xa as ErrorEnvelope, xi as redis, xn as CommandDecision, xr as CrudEventOperation, xt as ActionFeatures, y as stopAllEvents, ya as BrickError, yi as frameworkStorage, yn as CommandChildren, yr as WebhookVerifier, yt as ActionAccessInfo, z as recordWebhook, zi as defineSecret, zn as EventListener, zr as ErrorHelpers, zt as PluginRouteMethod } from "./server-BpHnonj3.js";
1
+ import { $ as ApiDocument, $i as DatabaseHandle, $n as WorkflowScheduleRun, $r as runStages, $t as ResourcePluginTypes, A as FinishedSpan, Aa as StandardErrorCode, Ai as CallFiles, An as Resource, Ar as crudEventName, At as Service, B as recordWebhook, Bi as StorageUnavailableError, Bn as loadRecord, Br as AnySchema, Bt as isTool, C as OutboxStatus, Ca as markDashboardArrival, Ci as StorageOf, Cn as ChildChanges, Cr as WebhookConfig, Ct as getActionRoute, D as ScheduleRunRecord, Da as DuplicateNameError, Di as redis, Dn as CommandDecision, Dr as CrudEventOperation, Dt as ActionFeatures, E as ScheduleState, Ea as BrickError, Ei as memory, En as CommandConfig, Er as isWebhook, Et as ActionAccessPolicy, F as SpanStartRecord, Fa as toWireError, Fi as S3StorageOptions, Fn as ResourceConfig, Fr as ActionConfig, Ft as Tool, G as DASHBOARD_MCP_ROUTE, Gi as defineSecret, Gn as EventListener, Gr as ErrorHelpers, Gt as PluginRouteMethod, H as telemetryLayer, Hi as SecretRef, Hn as DispatchOptions, Hr as Call, Ht as InstalledPlugin, I as SpanStore, Ii as ScopedFiles, In as ResourceIdentity, Ir as ActionConfigBase, It as ToolAnnotations, J as DashboardOptions, Ji as overrideSecret, Jn as RetryDecision, Jr as HttpMethod, Jt as PluginRoutes, K as DASHBOARD_MCP_TOOLS, Ki as envSource, Kn as EventsOptions, Kr as ExecuteParams, Kt as PluginRouteRegistrar, L as Telemetry, Li as StoredFile, Ln as ResourceTypeOptions, Lr as ActionContext, Lt as ToolContext, M as SpanAttributes, Ma as ValidationIssue, Mi as FileStorage, Mn as ResourceActionConfig, Mr as defineEvents, Mt as ServiceOptions, N as SpanEndRecord, Na as WireError, Ni as LOCAL_FILES_ROUTE, Nn as ResourceActionInput, Nr as isCrudEvent, Nt as defineService, O as ScheduleTable, Oa as ErrorEnvelope, Oi as storageKey, On as CommandErrors, Or as EventRef, Ot as AnyService, P as SpanEventRecord, Pa as toErrorResponse, Pi as RawDeps, Pn as ResourceChild, Pr as Action, Pt as AnyTool, Q as requestLoggingPlugin, Qi as DatabaseConnection, Qn as ScheduleRun, Qr as Wire, Qt as ResourcePluginContext, R as TelemetryOptions, Ri as s3, Rn as defineResource, Rr as ActionParams, Rt as ToolOptions, S as OutboxRow, Sa as dashboardUser, Si as StorageDriver, Sn as AnyResource, Sr as SocketSchemas, St as actionOwners, T as outboxTable, Ta as signDashboardMcp, Ti as frameworkStorage, Tn as CommandChildren, Tr as WebhookVerifier, Tt as ActionAccessInfo, U as traceRoute, Ui as SecretSource, Un as EventDelivery, Ur as ErrorDefinition, Ut as PLUGIN_KIND, V as spanStore, Vi as SecretOptions, Vn as CrudEventPayload, Vr as AuthorizedActionConfig, Vt as ContextOf, W as traceScheduleRun, Wi as SecretValidator, Wn as EventEnvelope, Wr as ErrorDefinitions, Wt as PluginEndpointContext, X as normalizeDashboard, Xi as resolveSecrets, Xn as Schedule, Xr as PluginActionChecks, Xt as ResourcePlugin, Y as DashboardPeer, Yi as resetSecrets, Yn as WorkflowEvent, Yr as Next, Yt as RequirementOf, Z as RequestLoggingOptions, Zi as AnyDatabaseHandle, Zn as ScheduleConfig, Zr as Stage, Zt as ResourcePluginAPI, _ as EventsDefinition, _a as DashboardMcpCaller, _i as FrameworkStorage, _n as HostHooks, _r as SocketEmitOptions, _t as ServiceSchema, a as Activity, aa as createPostgresDatabase, ai as ClientIp, an as PluginInfo, ar as RawSocketHandle, at as EndpointContext, b as stopAllEvents, ba as dashboardKey, bi as PutIfAbsentResult, bn as addHostHooks, br as SocketReplay, bt as DEFAULT_PREFIX, c as Workflow, ca as isDatabaseHandle, ci as clientAddress, cn as PluginLifecycleContext, cr as RawSocketStats, ct as ErrorHookContext, d as workflowEngine, da as CallContext, di as PostgresAuditTable, dn as PluginSetupContext, dr as BrickSocketSender, dt as ResponseHookContext, ea as DatabaseService, ei as stagesOf, en as ServicePlugin, er as defineSchedule, et as DocumentationOptions, f as WORKFLOW_TABLE, fa as Logger, fi as SQLiteAuditTable, fn as definePlugin, fr as RegisteredSocket, ft as CorsOptions, g as Events, ga as DashboardIdentity, gi as Counter, gn as HookResult, gr as SocketEmitArgs, gt as ArchitectureSchema, h as EventRecorder, ha as DASHBOARD_KEY_ENV, hi as recordAudit, hn as HOOK_NAMES, hr as SocketConfig, ht as ArchitectureApplication, i as brick, ia as SQLiteOptions, ii as redact, in as PluginFactory, ir as RawSocketFrame, it as scalarDocsHTML, j as OtlpOptions, ja as ValidationError, ji as FileDriver, jn as ResourceActionAccess, jr as crudEventSource, jt as ServiceContext, k as scheduleTable, ka as STANDARD_ERRORS, ki as CallDeps, kn as CommandRow, kr as EventRefs, kt as NoIdentity, l as WorkflowEngine, la as timestamptzText, li as AuditOptions, ln as PluginManifest, lr as SocketsOptions, lt as OnError, m as EventContext, ma as DASHBOARD_IDENTITY_HEADER, mi as isAuditTable, mn as pluginOwner, mr as SocketBrokerMessage, mt as ActionSchema, n as BrickOptions, na as PostgresOptions, ni as Sensitive, nn as PluginAppContext, nr as RawSocket, nt as ReferenceDocument, o as DurableClock, oa as createSQLiteDatabase, oi as RateLimit, on as PluginInstallOptions, or as RawSocketMessage, ot as EndpointDefinition, p as AppEvents, pa as createLogger, pi as auditTable, pn as PluginTableBuilders, pr as SocketBroker, pt as CorsOrigin, q as DashboardAuth, qi as listSecrets, qn as ListenerFailure, qr as HTTP_METHODS, qt as PluginRouteScope, r as ListeningServer, ra as SQLiteDatabaseConfig, ri as hasSensitive, rn as PluginContext, rr as RawSocketConfig, rt as ReferenceOptions, s as DurableDeferred, sa as defineDatabase, si as RateLimits, sn as PluginInstance, sr as RawSocketPhase, st as EndpointMethod, t as BrickApp, ta as PostgresDatabaseConfig, ti as Reveal, tn as ServicePluginContext, tr as CronExpression, tt as OpenApiDocument, u as WorkflowEngineOptions, ua as BaseContext, ui as AuditTable, un as PluginServiceContext, ur as BrickSocketHandle, ut as OnResponse, v as EventsHub, va as DashboardUser, vi as KeyValueDriver, vn as PluginHookArgs, vr as SocketEventArgs, vt as exportArchitecture, w as OutboxTable, wa as signDashboardIdentity, wi as defineStorage, wn as Command, wr as WebhookRequest, wt as kebabCase, x as OutboxCounts, xa as dashboardMcpCaller, xi as RedisStorageOptions, xn as getHostHooks, xr as SocketSchema, xt as RouteIR, y as ScheduleControl, ya as dashboardIdentity, yi as KeyValueStorage, yn as PluginHooks, yr as SocketPayloads, yt as ActionRoute, z as TelemetryRecord, zi as StorageError, zn as idSchema, zr as AnyAction, zt as defineTool } from "./server-OV8Hd6Tx.js";
2
2
  import { Effect, Redacted, Schema } from "effect";
3
3
  import { Column, GetColumnData, InferInsertModel, InferSelectModel, SQL, Table } from "drizzle-orm";
4
4
  /**
@@ -8,6 +8,16 @@ import { Column, GetColumnData, InferInsertModel, InferSelectModel, SQL, Table }
8
8
  * holding a `migration.sql`. A folder with a `meta/_journal.json` was written by
9
9
  * an older drizzle-kit and is refused: run `drizzle-kit up` on it first.
10
10
  *
11
+ * On Postgres a migration may hold several statements with no
12
+ * `--> statement-breakpoint` between them, as a hand-written one often does.
13
+ * Drizzle's own Effect migrator fails on such a file with "cannot insert
14
+ * multiple commands into a prepared statement". Its recorded hash is the
15
+ * file's, as ever. `SELECT ... INTO` in such a file fails with a message that
16
+ * names `CREATE TABLE ... AS`; a lone one runs as written.
17
+ *
18
+ * Migrations run without the database's `statementTimeout`: on Postgres each
19
+ * transaction sets `statement_timeout` to 0 for itself.
20
+ *
11
21
  * @param database - A handle from `defineDatabase`.
12
22
  * @param migrationsFolder - The folder of migrations.
13
23
  * @example
@@ -416,8 +426,9 @@ export declare function redisBroker(options?: RedisBrokerOptions): SocketBroker;
416
426
  *
417
427
  * The event is committed in a transaction of its own, unless you are inside one
418
428
  * (`runInTransaction`, or drizzle's `db.transaction`): then it joins that one and
419
- * is committed, or rolled back, with your writes. Nothing is recorded when no
420
- * listener wants the event.
429
+ * is committed, or rolled back, with your writes, and delivered once the outermost
430
+ * transaction has committed (never before it, never when it rolls back).
431
+ * Nothing is recorded when no listener wants the event.
421
432
  *
422
433
  * Needs the app's `events` option. It fails as a defect when `ctx.db` is not the
423
434
  * database of a service with an outbox table, when the app has no `events`, or
@@ -1202,5 +1213,5 @@ export declare const GLOBAL_SYMBOL: {
1202
1213
  */
1203
1214
  readonly spanListeners: "brickkit.effect.telemetry.listeners";
1204
1215
  };
1205
- export { type Action, type ActionAccessInfo, type ActionAccessPolicy, type ActionConfig, type ActionConfigBase, type ActionContext, type ActionParams, type ActionRoute, type ActionSchema, Activity, type Actor, type AnyAction, type AnyDatabaseHandle, type AnyResource, type AnySchema, type AnyService, type AnyTool, type ApiDocument, type AppEvents, type ArchitectureApplication, type ArchitectureSchema, type AuditOptions, type AuditTable, type AuthorizedActionConfig, type BaseContext, type BrickApp, BrickError, type BrickOptions, type BrickServices, type BrickSocketHandle, type BrickSocketSender, type Call, type CallContext, type CallDeps, type CallFiles, type ChildChanges, type ClientIp, type ColumnFieldPolicy, type Command, type CommandChildren, type CommandConfig, type CommandDecision, type CommandErrors, type CommandRow, type ContextOf, type ContractServiceClient, type CorsOptions, type CorsOrigin, type Counter, type CronExpression, type CrudAPI, type CrudAccess, type CrudAuthorizeArgs, type BulkOperation as CrudBulkOperation, type CrudCommitArgs, type CrudEventOperation, type CrudEventPayload, type Fields as CrudFields, type FilterOperator as CrudFilterOperator, type CrudHooks, type Operation as CrudOperation, type CrudOptions, type ReadRow as CrudReadRow, type CrudResource, type Where as CrudWhere, DASHBOARD_IDENTITY_HEADER, DASHBOARD_KEY_ENV, DASHBOARD_MCP_ROUTE, DASHBOARD_MCP_TOOLS, DEFAULT_PREFIX, type DashboardAuth, type DashboardIdentity, type DashboardMcpCaller, type DashboardOptions, type DashboardUser, type DatabaseConnection, type DatabaseHandle, type DatabaseService, type DerivedFieldPolicy, type DispatchOptions, type DocumentationOptions, DuplicateNameError, DurableClock, DurableDeferred, type EndpointContext, type EndpointDefinition, type EndpointMethod, type ErrorDefinition, type ErrorDefinitions, type ErrorEnvelope, type ErrorHelpers, type EventContext, type EventDelivery, type EventEnvelope, type EventListener, type EventRecorder, type EventRef, type EventRefs, Events, type EventsDefinition, type EventsHub, type EventsOptions, type ExecuteParams, type FileDriver, type FileOptions, type FileStorage, type FinishedSpan, type FrameworkStorage, type GetAction, HOOK_NAMES, HTTP_METHODS, type HmacSignatureOptions, type HookResult, type HostHooks, type HttpMethod, type InstalledPlugin, type KeyValueDriver, type KeyValueStorage, LOCAL_FILES_ROUTE, type ListenerFailure, type ListeningServer, type Logger, type McpHandlerOptions, type McpRegistry, type McpRegistryOptions, type McpToolDefinition, type Next, type NoIdentity, type OpenApiDocument, type OpenApiOptions, type OtlpOptions, type OutboxCounts, type OutboxRow, type OutboxStatus, type OutboxTable, type PluginActionChecks, type PluginAppContext, type PluginContext, type PluginEndpoint, type PluginEndpointContext, type PluginFactory, type PluginHookArgs, type PluginHooks, type PluginInfo, type PluginInstallOptions, type PluginInstance, type PluginLifecycleContext, type PluginManifest, type PluginRouteMethod, type PluginRouteRegistrar, type PluginRouteScope, type PluginRoutes, type PluginServiceContext, type PluginSetupContext, type PluginTableBuilders, type PostgresAuditTable, type PostgresDatabaseConfig, type PostgresOptions, type ProxyOptions, type PutIfAbsentResult, type QueryAction, type RateLimit, type RateLimits, type RawDeps, type RawSocket, type RawSocketConfig, type RawSocketFrame, type RawSocketHandle, type RawSocketMessage, type RawSocketPhase, type RawSocketStats, type RedisBrokerOptions, type RedisStorageOptions, type ReferenceDocument, type ReferenceOptions, type RegisteredSocket, type RequestLoggingOptions, type RequirementOf, type Resource, type ResourceActionAccess, type ResourceActionConfig, type ResourceActionInput, type ResourceChild, type ResourceConfig, type ResourceIdentity, type ResourcePlugin, type ResourcePluginAPI, type ResourcePluginContext, type ResourcePluginTypes, type ResourceTypeOptions, type RetryDecision, type Reveal, type RouteIR, type S3StorageOptions, type SQLiteAuditTable, type SQLiteDatabaseConfig, type SQLiteOptions, STANDARD_ERRORS, type Schedule, type ScheduleConfig, type ScheduleControl, type ScheduleRun, type ScheduleRunRecord, type ScheduleState, type ScheduleTable, type ScopedFiles, type SecretOptions, SecretRef, type SecretSource, type SecretValidator, Sensitive, type Service, type ServiceActions, type ServiceClient, type ServiceContext, type ServiceOptions, type ServicePlugin, type ServicePluginContext, type ServiceRegistry, type ServiceSchema, type SocketBroker, type SocketBrokerMessage, type SocketConfig, type SocketEmitArgs, type SocketEmitOptions, type SocketEventArgs, type SocketPayloads, type SocketReplay, type SocketSchema, type SocketSchemas, type SocketsOptions, type SpanAttributes, type SpanEndRecord, type SpanEventRecord, type SpanStartRecord, SpanStore, type Stage, type StandardErrorCode, type StandardWebhooksOptions, type StorageDriver, StorageError, type StorageOf, StorageUnavailableError, type StoredFile, Telemetry, type TelemetryOptions, type TelemetryRecord, type Tool, type ToolAnnotations, type ToolContext, type ToolOptions, type TwilioSignatureOptions, type UntypedServiceClient, ValidationError, type ValidationIssue, WORKFLOW_TABLE, type WebhookConfig, type WebhookRequest, type WebhookSecret, type WebhookVerifier, type Wire, type WireError, Workflow, WorkflowEngine, type WorkflowEvent, type WorkflowScheduleRun, actionOwners, addHostHooks, auditTable, brick, clientAddress, createLogger, createPostgresDatabase, createSQLiteDatabase, crudEventName, crudEventSource, dashboardIdentity, dashboardKey, dashboardMcpCaller, dashboardUser, defineDatabase, defineEvents, definePlugin, defineResource, defineSchedule, defineSecret, defineService, defineStorage, defineTool, envSource, exportArchitecture, frameworkStorage, getActionRoute, getHostHooks, hasSensitive, idSchema, isAuditTable, isCrudEvent, isDatabaseHandle, isTool, isWebhook, kebabCase, listSecrets, loadRecord, markDashboardArrival, memory, normalizeDashboard, outboxTable, overrideSecret, pluginOwner, recordAudit, recordWebhook, redact, redis, requestLoggingPlugin, resetSecrets, resolveSecrets, runStages, s3, scalarDocsHTML, scheduleTable, signDashboardIdentity, signDashboardMcp, spanStore, stagesOf, stopAllEvents, storageKey, telemetryLayer, toErrorResponse, toWireError, traceRoute, traceScheduleRun, workflowEngine };
1216
+ export { type Action, type ActionAccessInfo, type ActionAccessPolicy, type ActionConfig, type ActionConfigBase, type ActionContext, type ActionParams, type ActionRoute, type ActionSchema, Activity, type Actor, type AnyAction, type AnyDatabaseHandle, type AnyResource, type AnySchema, type AnyService, type AnyTool, type ApiDocument, type AppEvents, type ArchitectureApplication, type ArchitectureSchema, type AuditOptions, type AuditTable, type AuthorizedActionConfig, type BaseContext, type BrickApp, BrickError, type BrickOptions, type BrickServices, type BrickSocketHandle, type BrickSocketSender, type Call, type CallContext, type CallDeps, type CallFiles, type ChildChanges, type ClientIp, type ColumnFieldPolicy, type Command, type CommandChildren, type CommandConfig, type CommandDecision, type CommandErrors, type CommandRow, type ContextOf, type ContractServiceClient, type CorsOptions, type CorsOrigin, type Counter, type CronExpression, type CrudAPI, type CrudAccess, type CrudAuthorizeArgs, type BulkOperation as CrudBulkOperation, type CrudCommitArgs, type CrudEventOperation, type CrudEventPayload, type Fields as CrudFields, type FilterOperator as CrudFilterOperator, type CrudHooks, type Operation as CrudOperation, type CrudOptions, type ReadRow as CrudReadRow, type CrudResource, type Where as CrudWhere, DASHBOARD_IDENTITY_HEADER, DASHBOARD_KEY_ENV, DASHBOARD_MCP_ROUTE, DASHBOARD_MCP_TOOLS, DEFAULT_PREFIX, type DashboardAuth, type DashboardIdentity, type DashboardMcpCaller, type DashboardOptions, type DashboardPeer, type DashboardUser, type DatabaseConnection, type DatabaseHandle, type DatabaseService, type DerivedFieldPolicy, type DispatchOptions, type DocumentationOptions, DuplicateNameError, DurableClock, DurableDeferred, type EndpointContext, type EndpointDefinition, type EndpointMethod, type ErrorDefinition, type ErrorDefinitions, type ErrorEnvelope, type ErrorHelpers, type ErrorHookContext, type EventContext, type EventDelivery, type EventEnvelope, type EventListener, type EventRecorder, type EventRef, type EventRefs, Events, type EventsDefinition, type EventsHub, type EventsOptions, type ExecuteParams, type FileDriver, type FileOptions, type FileStorage, type FinishedSpan, type FrameworkStorage, type GetAction, HOOK_NAMES, HTTP_METHODS, type HmacSignatureOptions, type HookResult, type HostHooks, type HttpMethod, type InstalledPlugin, type KeyValueDriver, type KeyValueStorage, LOCAL_FILES_ROUTE, type ListenerFailure, type ListeningServer, type Logger, type McpHandlerOptions, type McpRegistry, type McpRegistryOptions, type McpToolDefinition, type Next, type NoIdentity, type OnError, type OnResponse, type OpenApiDocument, type OpenApiOptions, type OtlpOptions, type OutboxCounts, type OutboxRow, type OutboxStatus, type OutboxTable, type PluginActionChecks, type PluginAppContext, type PluginContext, type PluginEndpoint, type PluginEndpointContext, type PluginFactory, type PluginHookArgs, type PluginHooks, type PluginInfo, type PluginInstallOptions, type PluginInstance, type PluginLifecycleContext, type PluginManifest, type PluginRouteMethod, type PluginRouteRegistrar, type PluginRouteScope, type PluginRoutes, type PluginServiceContext, type PluginSetupContext, type PluginTableBuilders, type PostgresAuditTable, type PostgresDatabaseConfig, type PostgresOptions, type ProxyOptions, type PutIfAbsentResult, type QueryAction, type RateLimit, type RateLimits, type RawDeps, type RawSocket, type RawSocketConfig, type RawSocketFrame, type RawSocketHandle, type RawSocketMessage, type RawSocketPhase, type RawSocketStats, type RedisBrokerOptions, type RedisStorageOptions, type ReferenceDocument, type ReferenceOptions, type RegisteredSocket, type RequestLoggingOptions, type RequirementOf, type Resource, type ResourceActionAccess, type ResourceActionConfig, type ResourceActionInput, type ResourceChild, type ResourceConfig, type ResourceIdentity, type ResourcePlugin, type ResourcePluginAPI, type ResourcePluginContext, type ResourcePluginTypes, type ResourceTypeOptions, type ResponseHookContext, type RetryDecision, type Reveal, type RouteIR, type S3StorageOptions, type SQLiteAuditTable, type SQLiteDatabaseConfig, type SQLiteOptions, STANDARD_ERRORS, type Schedule, type ScheduleConfig, type ScheduleControl, type ScheduleRun, type ScheduleRunRecord, type ScheduleState, type ScheduleTable, type ScopedFiles, type SecretOptions, SecretRef, type SecretSource, type SecretValidator, Sensitive, type Service, type ServiceActions, type ServiceClient, type ServiceContext, type ServiceOptions, type ServicePlugin, type ServicePluginContext, type ServiceRegistry, type ServiceSchema, type SocketBroker, type SocketBrokerMessage, type SocketConfig, type SocketEmitArgs, type SocketEmitOptions, type SocketEventArgs, type SocketPayloads, type SocketReplay, type SocketSchema, type SocketSchemas, type SocketsOptions, type SpanAttributes, type SpanEndRecord, type SpanEventRecord, type SpanStartRecord, SpanStore, type Stage, type StandardErrorCode, type StandardWebhooksOptions, type StorageDriver, StorageError, type StorageOf, StorageUnavailableError, type StoredFile, Telemetry, type TelemetryOptions, type TelemetryRecord, type Tool, type ToolAnnotations, type ToolContext, type ToolOptions, type TwilioSignatureOptions, type UntypedServiceClient, ValidationError, type ValidationIssue, WORKFLOW_TABLE, type WebhookConfig, type WebhookRequest, type WebhookSecret, type WebhookVerifier, type Wire, type WireError, Workflow, WorkflowEngine, type WorkflowEngineOptions, type WorkflowEvent, type WorkflowScheduleRun, actionOwners, addHostHooks, auditTable, brick, clientAddress, createLogger, createPostgresDatabase, createSQLiteDatabase, crudEventName, crudEventSource, dashboardIdentity, dashboardKey, dashboardMcpCaller, dashboardUser, defineDatabase, defineEvents, definePlugin, defineResource, defineSchedule, defineSecret, defineService, defineStorage, defineTool, envSource, exportArchitecture, frameworkStorage, getActionRoute, getHostHooks, hasSensitive, idSchema, isAuditTable, isCrudEvent, isDatabaseHandle, isTool, isWebhook, kebabCase, listSecrets, loadRecord, markDashboardArrival, memory, normalizeDashboard, outboxTable, overrideSecret, pluginOwner, recordAudit, recordWebhook, redact, redis, requestLoggingPlugin, resetSecrets, resolveSecrets, runStages, s3, scalarDocsHTML, scheduleTable, signDashboardIdentity, signDashboardMcp, spanStore, stagesOf, stopAllEvents, storageKey, telemetryLayer, timestamptzText, toErrorResponse, toWireError, traceRoute, traceScheduleRun, workflowEngine };
1206
1217
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["Json","HookResult"],"sources":["../src/db-schema.ts","../src/crud/codec.ts","../src/standalone.ts","../src/access.ts","../src/rpc.ts","../src/deps.ts","../src/registry.ts","../src/file-schema.ts","../src/actor.ts","../src/openapi.ts","../src/webhook-verifiers.ts","../src/socket.ts","../src/socket-redis.ts","../src/events/emit.ts","../src/events/listener.ts","../src/events/transaction.ts","../src/crud/where.ts","../src/crud/types.ts","../src/crud/index.ts","../src/mcp.ts","../src/plugin.ts","../src/version.ts","../src/app-entry.ts","../src/telemetry-names.ts"],"mappings":";;;;;;;;;;;;;;;qBA2Ca,kBAAe,UAChB,mBAAiB,6BAoBrB,OAAO,sBAAsB;;;;;wBAQrB,uBAAuB;;;;;;;wBAkDvB,uBACd,YACA;EAAQ;EAAqB;;;;;;;;;;;;;;wBA4Df,sBACd,SACA,YACA;EACE;EACA;EACA;IAED,OAAO;;;;;;;;;;;wBA8CM,gBACd,SACA,YACA,uBACC,OAAO;;;;;wBA2CM,mBAAmB;;;;;;;;;;;;;;;;wBAoLnB,WAAW,KACzB,QAAQ,eAAe,YACtB,OAAO,sBAAsB,gBAAgB;wBAChC,WACd,iBAAiB,UAAU,yBAC3B,cACC,OAAO;;;;;;;wBCzZM,YAAY,QAAQ,QAAQ;;;;;;;;;;;;;;;;;wBC+B5B,aACd,eAAe,mCACf,gBAAgB,yCACV,gBAAgB,uBACtB,OAAO,eACP,WACA,WACA,WACA,YAEA,QAAQ,uBAAuB,QAAQ,SAAS,SAAS,MAAM,GAAG,GAAG,GAAG,MACtE,eAAe,QAAQ,SAAS,QACjC,OAAO,QAAQ,SAAS,SAAS,GAAG,IAAI;wBAC3B,aACd,eAAe,mCACf,gBAAgB,yCACV,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AEA,YAAY,KAAK,eAAe,GAAG,GAAG,WAAW;EAC/C,QACE,SAAS,sBAAsB,GAAG,OAC/B,KAAK,UAAU;IAErB,eAAe,GAAG,GAAG;;UAmGP;EACf;EACA,QAAQ;EACR,SAAS;EACT;EACA;EACA;EACA;;EAEA,QACE,SAAS,KAAK,+BACd,OAAO,cACN,OAAO;;;;;;;;;;wBAWI,mBACd,SAAS,YACT,kBACC;;;;;;;;;wBA0Ba,qBACd,QAAQ,WACR;;;;;;;;;;;wBCrNc,eAAe,iBAAiB;;;;;;;;wBC9BhC,WAAW,eAAe,OAAO;;;;;;;;wBAoBjC,gBAAgB,eAAe;qBC1BlC;;WAEX;;WAEA;;WAEA;WACA;;WAEA;;qBAGW;WACX;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA;;WAEA;WACA;WACA;;WAEA;WACA;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;;;;;qBAOW;;WAEX;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;WAMA"}
1
+ {"version":3,"file":"index.d.ts","names":["Json","HookResult"],"sources":["../src/db-schema.ts","../src/crud/codec.ts","../src/standalone.ts","../src/access.ts","../src/rpc.ts","../src/deps.ts","../src/registry.ts","../src/file-schema.ts","../src/actor.ts","../src/openapi.ts","../src/webhook-verifiers.ts","../src/socket.ts","../src/socket-redis.ts","../src/events/emit.ts","../src/events/listener.ts","../src/events/transaction.ts","../src/crud/where.ts","../src/crud/types.ts","../src/crud/index.ts","../src/mcp.ts","../src/plugin.ts","../src/version.ts","../src/app-entry.ts","../src/telemetry-names.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;qBA2Fa,kBAAe,UAChB,mBAAiB,6BAoDrB,OAAO,sBAAsB;;;;;wBAQrB,uBAAuB;;;;;;;wBAkDvB,uBACd,YACA;EAAQ;EAAqB;;;;;;;;;;;;;;wBA4Df,sBACd,SACA,YACA;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ED
@@ -1,14 +1,15 @@
1
- import { $ as PLUGIN_KIND, $t as envSource, A as onTransactionCommit, An as telemetryLayer, At as errorHelpers, B as scalarDocsHTML, Bn as signDashboardIdentity, Bt as defineStorage, C as scheduleTable, Cn as baseContext, Ct as kindOf, D as defineServiceSocket, Dn as Telemetry, Dt as RESET_STAGES, E as SocketDenied, En as SpanStore, Et as HTTP_METHODS, F as encodePayload, Fn as dashboardIdentity, Ft as hasSensitive, G as getPluginActionRoute, Gn as actionMeta, Gt as storageKey, H as copyControls, Hn as ATTR, Ht as memory, I as isCrudEvent, In as dashboardKey, It as redact, J as installPlugin, Jn as STANDARD_ERRORS, Jt as scopeFiles, K as getPluginEndpoints, Kn as BrickError, Kt as LOCAL_FILES_ROUTE, L as OPENAPI_DEFAULTS, Ln as dashboardMcpCaller, Lt as sensitivePointer, M as crudEventName, Mn as traceScheduleRun, Mt as runStages, N as crudEventSource, Nn as DASHBOARD_IDENTITY_HEADER, Nt as stagesOf, O as localBroker, On as recordWebhook, Ot as createAction, P as defineEvents, Pn as DASHBOARD_KEY_ENV, Pt as Sensitive, Q as PLUGIN_COMMIT, Qn as toWireError, Qt as defineSecret, R as generateOpenApiSpec, Rn as dashboardUser, Rt as carryClientRequest, S as outboxTable, Sn as actorOf, St as jsonValue, T as defineRawSocket, Tn as defaultLogger, Tt as withoutNull, U as defineResourcePlugin, Un as GLOBAL_SYMBOL, Ut as redis, V as claimSegment, Vn as signDashboardMcp, Vt as frameworkStorage, W as defineServicePlugin, Wn as SPAN, Wt as requireStorage, X as internalsOf, Xn as normalizeFailures, Xt as StorageUnavailableError, Y as validatePath, Yn as ValidationError, Yt as StorageError, Z as setInternals, Zn as toErrorResponse, Zt as SecretRef, _ as idSchema, _n as inlineAuditOptions, _t as databaseValue, a as WORKFLOW_TABLE, an as definitionSite, at as getActionRoute, b as stopAllEvents, bn as recordAudit, bt as idSchema$1, c as workflowEngine, cn as ownDeps, ct as getActionAccess, d as createMcpHandler, dn as UploadedFile, dt as ORDERED_TYPES, en as listSecrets, et as getGlobalRegistry, f as createMcpRegistry, fn as UploadedFiles, ft as SORTABLE_TYPES, g as defineResource, gn as bindAuditTarget, gt as columnValue, h as normalizeDashboard, hn as auditTableOf, ht as columnSchema, i as DurableDeferred, in as claimName, it as actionOwners, j as runInTransaction, jn as traceRoute, jt as invalid, k as splitSeq, kn as spanStore, kt as deny, l as INTERNALS, ln as useDeps, lt as setActionAccess, m as DASHBOARD_MCP_TOOLS, mn as auditTable, mt as checkJsonSchema, n as Activity, nn as resetSecrets, nt as exportArchitecture, o as Workflow, on as depsOverride, ot as isObjectSchema, p as DASHBOARD_MCP_ROUTE, pn as fileFields, pt as UNFILTERABLE_TYPES, q as hasPlugin, qn as DuplicateNameError, qt as s3, r as DurableClock, rn as resolveSecrets, rt as DEFAULT_PREFIX, s as WorkflowEngine, sn as freezeAsBuiltDeps, st as kebabCase, t as brick, tn as overrideSecret, tt as resetGlobalRegistry, u as UnknownToolError, un as withOverride, ut as setActionAudit, v as loadRecord, vn as isAuditTable, vt as decodeCursor, w as defineSchedule, wn as createLogger, wt as reject, x as defineListener, xn as recordInline, xt as invalid$1, y as Events, yn as isInlineAudit, yt as encodeCursor, z as requestLoggingPlugin, zn as markDashboardArrival, zt as clientAddress } from "./server-D-fDM98-.js";
2
- import { Cause, Context, Effect, Exit, Layer, Option, Redacted, Result, Schema, SchemaIssue } from "effect";
1
+ import { $ as PLUGIN_KIND, $n as failureOfCause, $t as StorageUnavailableError, A as onTransactionCommit, An as Telemetry, At as RESET_STAGES, B as scalarDocsHTML, Bn as dashboardMcpCaller, Bt as sensitivePointer, C as scheduleTable, Cn as recordAudit, Ct as idSchema$1, D as defineServiceSocket, Dn as createLogger, Dt as reject, E as SocketDenied, En as baseContext, Et as kindOf, F as encodePayload, Fn as traceScheduleRun, Ft as runStages, G as getPluginActionRoute, Gn as ATTR, Gt as memory, H as copyControls, Hn as markDashboardArrival, Ht as clientAddress, I as isCrudEvent, In as DASHBOARD_IDENTITY_HEADER, It as stagesOf, J as installPlugin, Jn as actionMeta, Jt as storageKey, K as getPluginEndpoints, Kn as GLOBAL_SYMBOL, Kt as redis, L as OPENAPI_DEFAULTS, Ln as DASHBOARD_KEY_ENV, Lt as Sensitive, M as crudEventName, Mn as spanStore, Mt as deny, N as crudEventSource, Nn as telemetryLayer, Nt as errorHelpers, O as localBroker, On as defaultLogger, Ot as withoutNull, P as defineEvents, Pn as traceRoute, Pt as invalid, Q as PLUGIN_COMMIT, Qn as ValidationError, Qt as StorageError, R as generateOpenApiSpec, Rn as dashboardIdentity, Rt as hasSensitive, S as outboxTable, Sn as isInlineAudit, St as encodeCursor, T as defineRawSocket, Tn as actorOf, Tt as jsonValue, U as defineResourcePlugin, Un as signDashboardIdentity, Ut as defineStorage, V as claimSegment, Vn as dashboardUser, Vt as carryClientRequest, W as defineServicePlugin, Wn as signDashboardMcp, Wt as frameworkStorage, X as internalsOf, Xn as DuplicateNameError, Xt as s3, Y as validatePath, Yn as BrickError, Yt as LOCAL_FILES_ROUTE, Z as setInternals, Zn as STANDARD_ERRORS, Zt as scopeFiles, _ as idSchema, _n as auditTable, _t as checkJsonSchema, a as Workflow, an as resetSecrets, at as readCapped, b as stopAllEvents, bn as inlineAuditOptions, bt as databaseValue, c as WORKFLOW_TABLE, cn as definitionSite, ct as getActionRoute, d as createMcpHandler, dn as ownDeps, dt as getActionAccess, en as SecretRef, er as normalizeFailures, et as getGlobalRegistry, f as createMcpRegistry, fn as useDeps, ft as setActionAccess, g as defineResource, gn as fileFields, gt as UNFILTERABLE_TYPES, h as normalizeDashboard, hn as UploadedFiles, ht as SORTABLE_TYPES, i as DurableDeferred, in as overrideSecret, it as payloadTooLarge, j as runInTransaction, jn as recordWebhook, jt as createAction, k as splitSeq, kn as SpanStore, kt as HTTP_METHODS, l as INTERNALS, ln as depsOverride, lt as isObjectSchema, m as DASHBOARD_MCP_TOOLS, mn as UploadedFile, mt as ORDERED_TYPES, n as Activity, nn as envSource, nr as toErrorResponse, nt as exportArchitecture, o as WorkflowEngine, on as resolveSecrets, ot as DEFAULT_PREFIX, p as DASHBOARD_MCP_ROUTE, pn as withOverride, pt as setActionAudit, q as hasPlugin, qn as SPAN, qt as requireStorage, r as DurableClock, rn as listSecrets, rr as toWireError, rt as checkBodyLimit, s as workflowEngine, sn as claimName, st as actionOwners, t as brick, tn as defineSecret, tr as prefixedFailure, tt as resetGlobalRegistry, u as UnknownToolError, un as freezeAsBuiltDeps, ut as kebabCase, v as loadRecord, vn as auditTableOf, vt as columnSchema, w as defineSchedule, wn as recordInline, wt as invalid$1, x as defineListener, xn as isAuditTable, xt as decodeCursor, y as Events, yn as bindAuditTarget, yt as columnValue, z as requestLoggingPlugin, zn as dashboardKey, zt as redact } from "./server-CqCh1xgf.js";
2
+ import { Cause, Context, Duration, Effect, Exit, Layer, Option, Redacted, Result, Schema, SchemaIssue } from "effect";
3
3
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";
4
4
  import { Param, SQL, Table, and, asc, between, defineRelations, desc, eq, getTableColumns, getTableName, gt, gte, inArray, is, isNotNull, isNull, lt, lte, ne, notInArray, or, sql } from "drizzle-orm";
5
- import { PgDialect, PgTable, boolean, doublePrecision, getTableConfig, integer, isPgEnum, jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
5
+ import { PgDialect, PgTable, boolean, customType, doublePrecision, getTableConfig, integer, isPgEnum, jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
6
6
  import { SQLiteDialect, SQLiteTable, integer as integer$1, real, sqliteTable, text as text$1 } from "drizzle-orm/sqlite-core";
7
7
  import { dirname, isAbsolute, resolve } from "node:path";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import { mkdirSync, readFileSync } from "node:fs";
10
10
  import { SqlClient } from "effect/sql/SqlClient";
11
11
  import { SqlError, UnknownError } from "effect/sql/SqlError";
12
+ import { pgTimestampTextFromUtcDate } from "drizzle-orm/pg-core/codecs";
12
13
  // src/db.ts
13
14
  /**
14
15
  * Whether a value is a database handle made by `defineDatabase`.
@@ -61,7 +62,7 @@ function createSQLiteDatabase(config = {}) {
61
62
  * Open a Postgres database over drizzle's Effect driver, until the scope
62
63
  * closes. Needs `@effect/sql-pg`, loaded here and nowhere else.
63
64
  *
64
- * @param config - The `url`, `tables`, and the connection's `ssl`, pool size (`max`, `min`, `idleTimeout`) and `prepare`.
65
+ * @param config - The `url`, `tables`, and the connection's `ssl`, pool size (`max`, `min`), lifetimes (`idleTimeout`, `maxLifetime`, `connectTimeout`), `statementTimeout`, `applicationName` and `prepare`.
65
66
  * @returns The drizzle database, whose queries are Effects.
66
67
  * @example
67
68
  * const db = yield* createPostgresDatabase({ url: process.env.DATABASE_URL!, ssl: true, max: 10 });
@@ -78,11 +79,27 @@ function createPostgresDatabase(config) {
78
79
  ...config.max !== void 0 && { maxConnections: config.max },
79
80
  ...config.min !== void 0 && { minConnections: config.min },
80
81
  ...config.idleTimeout !== void 0 && { idleTimeout: config.idleTimeout },
82
+ ...config.maxLifetime !== void 0 && { connectionTTL: config.maxLifetime },
83
+ ...config.connectTimeout !== void 0 && { connectTimeout: config.connectTimeout },
84
+ ...config.statementTimeout !== void 0 && { startupParameters: { statement_timeout: String(Math.max(0, Math.ceil(Duration.isFinite(Duration.fromInputUnsafe(config.statementTimeout)) ? Duration.toMillis(config.statementTimeout) : 0))) } },
85
+ ...config.applicationName !== void 0 && { applicationName: config.applicationName },
81
86
  ...config.prepare !== void 0 && { prepare: config.prepare }
82
87
  }));
83
88
  return yield* drizzle.makeWithDefaults({ relations: defineRelations(config.tables ?? {}) }).pipe(Effect.provide(context));
84
89
  });
85
90
  }
91
+ const postgresOptionKeys = [
92
+ "ssl",
93
+ "max",
94
+ "min",
95
+ "idleTimeout",
96
+ "maxLifetime",
97
+ "connectTimeout",
98
+ "statementTimeout",
99
+ "applicationName",
100
+ "prepare"
101
+ ];
102
+ const postgresOptionsOf = (config) => Object.fromEntries(postgresOptionKeys.map((key) => [key, config[key]]));
86
103
  let databases = 0;
87
104
  function defineDatabase(config) {
88
105
  const Database = Context.Service(`@brickkit/effect/Database/${++databases}`);
@@ -95,11 +112,7 @@ function defineDatabase(config) {
95
112
  }) : createPostgresDatabase({
96
113
  url: config.postgres,
97
114
  tables,
98
- ssl: config.ssl,
99
- max: config.max,
100
- min: config.min,
101
- idleTimeout: config.idleTimeout,
102
- prepare: config.prepare
115
+ ...postgresOptionsOf(config)
103
116
  });
104
117
  const connection = "sqlite" in config ? {
105
118
  engine: "sqlite",
@@ -109,11 +122,7 @@ function defineDatabase(config) {
109
122
  } : {
110
123
  engine: "postgres",
111
124
  url: config.postgres,
112
- ssl: config.ssl,
113
- max: config.max,
114
- min: config.min,
115
- idleTimeout: config.idleTimeout,
116
- prepare: config.prepare
125
+ ...postgresOptionsOf(config)
117
126
  };
118
127
  return Object.defineProperty({
119
128
  kind: "brick-database",
@@ -124,18 +133,106 @@ function defineDatabase(config) {
124
133
  layer: Layer.effect(Database)(open)
125
134
  }, "connection", { value: connection });
126
135
  }
136
+ const utcText = pgTimestampTextFromUtcDate(true);
137
+ function readTimestamptz(value) {
138
+ if (Number.isNaN(value.getTime())) throw new Error("timestamptzText cannot read infinity or -infinity: the driver reads both as an invalid Date. Select the column cast to text, or leave those rows out.");
139
+ return utcText(value);
140
+ }
141
+ const jsonTimestamp = /^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(?:\.(\d+))?([+-])(\d\d)(?::(\d\d))?(?::(\d\d))?( BC)?$/;
142
+ /** A timestamp as PostgreSQL writes it in JSON, which `Date` cannot parse for a BC year, a five-digit year or an offset in seconds. */
143
+ function dateFromJson(value) {
144
+ const parts = jsonTimestamp.exec(value);
145
+ if (!parts) return /* @__PURE__ */ new Date(NaN);
146
+ const [, year, month, day, hour, minute, second, fraction = "", sign] = parts;
147
+ const offset = (Number(parts[9]) * 3600 + Number(parts[10] ?? 0) * 60 + Number(parts[11] ?? 0)) * 1e3;
148
+ const date = /* @__PURE__ */ new Date(0);
149
+ date.setUTCFullYear(parts[12] ? 1 - Number(year) : Number(year), Number(month) - 1, Number(day));
150
+ date.setUTCHours(Number(hour), Number(minute), Number(second), Number(fraction.slice(0, 3).padEnd(3, "0")));
151
+ const time = date.getTime() - (sign === "+" ? offset : -offset);
152
+ return new Date(/[1-9]/.test(fraction.slice(3)) && time < Date.UTC(2e3, 0, 1) ? time + 1 : time);
153
+ }
154
+ /**
155
+ * A `timestamp with time zone` column read as text. Drizzle's own
156
+ * `timestamp(name, { mode: "string", withTimezone: true })` throws a defect on
157
+ * every non-null read through the Effect driver, because the driver hands the
158
+ * value over as a `Date` and drops the offset. This column takes that `Date` and
159
+ * gives it back as PostgreSQL would write it in UTC (`2026-12-01 10:11:12.123+00`).
160
+ *
161
+ * Writes go to the server as given, with their offset and every digit
162
+ * (`"2026-12-01 15:41:12.123456+05:30"`). Reads are the same instant in UTC, cut
163
+ * to the millisecond, as drizzle's `timestamp` string mode is. For a default use
164
+ * `.default(sql`now()`)`. The server takes `infinity` and `-infinity` as given,
165
+ * but the driver reads them as an invalid `Date` that cannot say which it was,
166
+ * so reading one fails with an error that says so: cast the column to text in
167
+ * SQL (`"at"::text`) or leave those rows out.
168
+ *
169
+ * @param name - The column's name in the table.
170
+ * @param config - `precision`: the fractional-second digits the column keeps, `0` to `6`.
171
+ * @example
172
+ * const calls = pgTable("calls", { startedAt: timestamptzText("started_at").notNull() });
173
+ */
174
+ const timestamptzText = customType({
175
+ dataType: (config) => config?.precision === void 0 ? "timestamp with time zone" : `timestamp(${config.precision}) with time zone`,
176
+ toDriver: (value) => value,
177
+ fromDriver: readTimestamptz,
178
+ fromJson: (value) => readTimestamptz(dateFromJson(value))
179
+ });
127
180
  // src/db-schema.ts
128
181
  const warn = (message) => Effect.sync(() => console.warn(`[Brick DB] ${message}`));
129
182
  const reason = (error) => error instanceof Error ? error.message : String(error);
130
183
  /** Runs one raw statement on a drizzle database, whatever its engine. */
131
184
  const run = (db, statement) => typeof db.execute === "function" ? db.execute(sql.raw(statement)) : db.run(sql.raw(statement));
132
185
  /**
186
+ * What a statement is made of, token by token: whitespace and comments, quoted
187
+ * strings and names, dollar-quoted bodies, the `;` that ends a command, words
188
+ * (a `$` inside a word, as in `a$x$` or `é$x$`, is part of it),
189
+ * and any other character.
190
+ */
191
+ const token = /\s+|--[^\n]*|\/\*[\s\S]*?\*\/|\b[eE]'(?:[^'\\]|\\[\s\S]|'')*'|'(?:[^']|'')*'|"(?:[^"]|"")*"|(\$(?:[A-Za-z_\u0080-\uffff][\w\u0080-\uffff]*)?\$)[\s\S]*?\1|(;)|[\w\u0080-\uffff][\w$\u0080-\uffff]*|[\s\S]/g;
192
+ /** Whether a command follows a `;` that ends one, outside strings and comments. */
193
+ const holdsSeveralCommands = (statement) => {
194
+ let ended = false;
195
+ for (const [text, , terminator] of statement.matchAll(token)) {
196
+ if (/^(\s|--|\/\*)/.test(text)) continue;
197
+ if (terminator) ended = true;
198
+ else if (ended) return true;
199
+ }
200
+ return false;
201
+ };
202
+ /**
203
+ * Postgres's extended protocol, which drizzle's Effect driver speaks, refuses
204
+ * several commands in one statement, and `@effect/sql-pg` has no call that sends
205
+ * them over the simple protocol. A statement that holds a second command goes
206
+ * through `EXECUTE`, which takes them; any other is sent as written, so what
207
+ * drizzle-kit writes (one command between breakpoints) is untouched, and so is
208
+ * a lone `SELECT ... INTO`, which `EXECUTE` refuses.
209
+ * shortcut: a nested block comment ends at its first close, so its tail reads as
210
+ * a command and a lone command is wrapped, which `EXECUTE` runs the same except
211
+ * for `SELECT ... INTO`; upgrade if nested comments appear in migrations.
212
+ */
213
+ const runnable = (statement) => {
214
+ if (!holdsSeveralCommands(statement)) return statement;
215
+ let tag = "brick_migration";
216
+ while (statement.includes(tag)) tag += "_";
217
+ return `do $${tag}_do$ begin execute $${tag}$${statement}$${tag}$; end $${tag}_do$`;
218
+ };
219
+ /**
133
220
  * Apply the migrations in a folder that have not run yet, in order, and record
134
221
  * them in the database's `__drizzle_migrations` table. The folder is the one
135
222
  * `drizzle-kit generate` writes for drizzle 1.0: a folder per migration, each
136
223
  * holding a `migration.sql`. A folder with a `meta/_journal.json` was written by
137
224
  * an older drizzle-kit and is refused: run `drizzle-kit up` on it first.
138
225
  *
226
+ * On Postgres a migration may hold several statements with no
227
+ * `--> statement-breakpoint` between them, as a hand-written one often does.
228
+ * Drizzle's own Effect migrator fails on such a file with "cannot insert
229
+ * multiple commands into a prepared statement". Its recorded hash is the
230
+ * file's, as ever. `SELECT ... INTO` in such a file fails with a message that
231
+ * names `CREATE TABLE ... AS`; a lone one runs as written.
232
+ *
233
+ * Migrations run without the database's `statementTimeout`: on Postgres each
234
+ * transaction sets `statement_timeout` to 0 for itself.
235
+ *
139
236
  * @param database - A handle from `defineDatabase`.
140
237
  * @param migrationsFolder - The folder of migrations.
141
238
  * @example
@@ -143,11 +240,20 @@ const run = (db, statement) => typeof db.execute === "function" ? db.execute(sql
143
240
  */
144
241
  const migrateDatabase = (database, migrationsFolder) => Effect.gen(function* () {
145
242
  const db = yield* database.Database;
146
- const { migrate } = database.engine === "postgres" ? yield* Effect.promise(() => import("drizzle-orm/effect-postgres/migrator")) : yield* Effect.promise(() => import("drizzle-orm/effect-sqlite-bun/migrator"));
243
+ const migrating = database.engine === "postgres" ? yield* Effect.promise(async () => {
244
+ const [{ readMigrationFiles }, { migrate }] = await Promise.all([import("drizzle-orm/migrator"), import("drizzle-orm/pg-core/effect/session")]);
245
+ return () => migrate(readMigrationFiles({ migrationsFolder }).map((migration) => ({
246
+ ...migration,
247
+ sql: ["set local statement_timeout = 0", ...migration.sql.map(runnable)]
248
+ })), db.session, { migrationsFolder });
249
+ }) : yield* Effect.promise(async () => {
250
+ const { migrate } = await import("drizzle-orm/effect-sqlite-bun/migrator");
251
+ return () => migrate(db, { migrationsFolder });
252
+ });
147
253
  yield* Effect.flatten(Effect.try({
148
- try: () => migrate(db, { migrationsFolder }),
254
+ try: migrating,
149
255
  catch: (cause) => cause
150
- }));
256
+ })).pipe(Effect.catchCause((cause) => /EXECUTE of SELECT \.\.\. INTO is not implemented/.test(Cause.pretty(cause)) ? Effect.fail(new Error("migrateDatabase: a migration file of several commands runs through EXECUTE, which refuses SELECT ... INTO. Write it as CREATE TABLE ... AS SELECT ..., or put `--> statement-breakpoint` between the commands.", { cause: Cause.squash(cause) })) : Effect.failCause(cause)));
151
257
  });
152
258
  const sqliteDialect = new SQLiteDialect();
153
259
  /**
@@ -466,26 +572,6 @@ function fieldsOf(params) {
466
572
  for (const [name, value] of params) grouped.set(name, [...grouped.get(name) ?? [], value]);
467
573
  return Object.fromEntries([...grouped].map(([name, values]) => [name, values.length > 1 ? values : values[0]]));
468
574
  }
469
- /** The body, or `undefined` once it passes `limit`. */
470
- async function readBody(request, limit) {
471
- if (Number(request.headers.get("content-length")) > limit) return void 0;
472
- const chunks = [];
473
- let size = 0;
474
- if (request.body) {
475
- const reader = request.body.getReader();
476
- for (;;) {
477
- const { done, value } = await reader.read();
478
- if (done) break;
479
- size += value.byteLength;
480
- if (size > limit) {
481
- reader.cancel().catch(() => {});
482
- return;
483
- }
484
- chunks.push(value);
485
- }
486
- }
487
- return new Uint8Array(Buffer.concat(chunks));
488
- }
489
575
  /** The payload of a delivery before its schema checks it, and how it arrived. */
490
576
  function payloadOf(name, request, rawBody) {
491
577
  const text = new TextDecoder().decode(rawBody);
@@ -520,7 +606,7 @@ function check(service, config, hasReplay) {
520
606
  if (config.method !== void 0 && !["POST", "GET"].includes(config.method)) throw new Error(`${where}: method must be "POST" or "GET".`);
521
607
  if (config.method === "GET" && config.verify.signsBody) throw new Error(`${where}: method "GET" has no body, and this verifier signs the body, so it would accept one signature for every query. Use twilioSignature (it signs the URL) or a verifier of your own, or method "POST".`);
522
608
  for (const option of ["authorize", "output"]) if (config[option] !== void 0) throw new Error(`${where}: ${option} is not an option of a webhook, and would be ignored. verify is the check.`);
523
- if (!Number.isSafeInteger(config.maxBodyBytes ?? 1) || (config.maxBodyBytes ?? 1) < 1) throw new Error(`${where}: maxBodyBytes must be a positive integer.`);
609
+ checkBodyLimit(where, config.maxBodyBytes);
524
610
  const ttlMs = config.replay?.ttlMs;
525
611
  if (ttlMs !== void 0 && (!Number.isSafeInteger(ttlMs) || ttlMs < 1)) throw new Error(`${where}: replay.ttlMs must be a positive integer.`);
526
612
  if (hasReplay && !config.eventId && !config.verify.suppliesEventId) throw new Error(`${where} has no event id to tell deliveries apart by, so a delivery sent twice would run twice. Add eventId: ({ input }) => Effect.succeed(input.id), reading an id from a field of the signed payload (an id from a header the signature does not cover only removes accidental duplicates: anyone who captured a delivery can resend it with another id), use a verifier that supplies one (standardWebhooks), or set replay: false to run every delivery.`);
@@ -619,10 +705,10 @@ function createWebhook(host, config) {
619
705
  eventId: void 0
620
706
  };
621
707
  return Effect.gen(function* () {
622
- const rawBody = yield* Effect.promise(() => readBody(request, maxBodyBytes));
708
+ const rawBody = yield* Effect.promise(() => readCapped(request, maxBodyBytes));
623
709
  if (!rawBody) {
624
710
  delivery.outcome = "too_large";
625
- return yield* refuse("PAYLOAD_TOO_LARGE", `Request body exceeds ${maxBodyBytes} bytes`, 413);
711
+ return yield* payloadTooLarge(maxBodyBytes);
626
712
  }
627
713
  const verdict = yield* verified({
628
714
  rawBody,
@@ -1834,16 +1920,20 @@ function operations(model) {
1834
1920
  const body = (tx, record) => Effect.forEach(items, (item, index) => perform(single, item, ctx, error, {
1835
1921
  tx,
1836
1922
  record
1837
- }).pipe(Effect.mapError((cause) => cause instanceof BrickError ? new BrickError({
1838
- code: cause.code,
1839
- message: `Item ${index}: ${cause.message}`,
1840
- status: cause.status,
1841
- details: {
1842
- index,
1843
- code: cause.code,
1844
- message: cause.message
1845
- }
1846
- }) : cause)));
1923
+ }).pipe(Effect.catchCause((cause) => {
1924
+ const failure = failureOfCause(cause);
1925
+ return failure instanceof BrickError ? Effect.fail(prefixedFailure(failure, new BrickError({
1926
+ code: failure.code,
1927
+ message: `Item ${index}: ${failure.message}`,
1928
+ status: failure.status,
1929
+ details: {
1930
+ index,
1931
+ code: failure.code,
1932
+ message: failure.message
1933
+ },
1934
+ cause: failure.cause ?? failure
1935
+ }))) : Effect.failCause(cause);
1936
+ })));
1847
1937
  const hub = yield* recorderFor(ctx.db, single);
1848
1938
  const results = yield* hub ? hub.transaction(ctx.db, eventContext(ctx), body) : runInTransaction(ctx.db, (tx) => body(tx));
1849
1939
  return single === "delete" ? { count: results.length } : { items: results };
@@ -2003,7 +2093,10 @@ function crud(service, options) {
2003
2093
  offset: optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
2004
2094
  includeTotal: optional(Schema.Boolean)
2005
2095
  };
2006
- const rowSchema = struct(Object.fromEntries([...readable, ...includable].map((key) => [key, optional(fields[key].schema ?? (fields[key].scrub ? Schema.Unknown : schemas[key]))])));
2096
+ const rowOf = (loose) => struct(Object.fromEntries([...readable, ...includable].map((key) => {
2097
+ const schema = fields[key].schema ?? (fields[key].scrub ? Schema.Unknown : schemas[key]);
2098
+ return [key, loose || fields[key].resolve ? optional(schema) : schema];
2099
+ })));
2007
2100
  const writeSchema = (kind) => struct(Object.fromEntries(Object.entries(fields).filter(([, policy]) => policy[kind]).map(([key]) => [key, kind === "update" || columns[key].hasDefault || !columns[key].notNull ? optional(schemas[key]) : schemas[key]])));
2008
2101
  const createSchema = writeSchema("create");
2009
2102
  const updateSchema = writeSchema("update");
@@ -2035,7 +2128,7 @@ function crud(service, options) {
2035
2128
  })) }),
2036
2129
  bulkDelete: struct({ ids: batch(bodyId, true) })
2037
2130
  };
2038
- const outputs = {
2131
+ const outputsFor = (rowSchema) => ({
2039
2132
  list: struct({
2040
2133
  items: Schema.Array(rowSchema),
2041
2134
  total: optional(Schema.Int),
@@ -2053,7 +2146,9 @@ function crud(service, options) {
2053
2146
  bulkCreate: struct({ items: Schema.Array(rowSchema) }),
2054
2147
  bulkUpdate: struct({ items: Schema.Array(rowSchema) }),
2055
2148
  bulkDelete: struct({ count: Schema.Int })
2056
- };
2149
+ });
2150
+ const outputs = outputsFor(rowOf(false));
2151
+ const runtimeOutputs = outputsFor(rowOf(true));
2057
2152
  const resource = service.getResource(name) ?? service.resource({
2058
2153
  name,
2059
2154
  table,
@@ -2119,7 +2214,8 @@ function crud(service, options) {
2119
2214
  method,
2120
2215
  input: inputs[operation],
2121
2216
  output: outputs[operation],
2122
- strict: true,
2217
+ runtimeOutput: runtimeOutputs[operation],
2218
+ strict: "deep",
2123
2219
  audit: writes.has(operation) ? inlineAuditOptions({ resource: name }) : false,
2124
2220
  checkInput: (input) => whereDepthExceeded(input) ? [{
2125
2221
  path: "where",
@@ -2511,6 +2607,6 @@ function requireBrickApp(app) {
2511
2607
  if (app.server) throw new Error("Brick: the app entry must not call .listen(); use a separate server bootstrap.");
2512
2608
  return app;
2513
2609
  }
2514
- export { ATTR, Activity, BrickError, DASHBOARD_IDENTITY_HEADER, DASHBOARD_KEY_ENV, DASHBOARD_MCP_ROUTE, DASHBOARD_MCP_TOOLS, DEFAULT_PREFIX, DuplicateNameError, DurableClock, DurableDeferred, Events, GLOBAL_SYMBOL, HOOK_NAMES, HTTP_METHODS, LOCAL_FILES_ROUTE, OPENAPI_DEFAULTS, SPAN, STANDARD_ERRORS, SecretRef, Sensitive, SocketDenied, SpanStore, StorageError, StorageUnavailableError, Telemetry, UnknownToolError, UploadedFile, UploadedFiles, ValidationError, WORKFLOW_TABLE, Workflow, WorkflowEngine, actionOwners, actorOf, addHostHooks, auditTable, brick, buildFtsMatchQuery, clientAddress, columnValue, createLogger, createMcpHandler, createMcpRegistry, createPostgresDatabase, createSQLiteDatabase, crud, crudEventName, crudEventSource, dashboardIdentity, dashboardKey, dashboardMcpCaller, dashboardUser, defineAction, defineDatabase, defineEvents, defineListener, definePlugin, defineResource, defineResourcePlugin, defineSchedule, defineSecret, defineService, defineServicePlugin, defineStorage, defineTool, emitEvent, ensureResourceIndexes, ensureSQLiteFts, envSource, exportArchitecture, frameworkStorage, generateOpenApiSpec, generateSQLiteIndexDdl, generateSQLiteTableDdl, getActionAccess, getActionRoute, getGlobalRegistry, getHostHooks, getPluginActionRoute, getPluginEndpoints, hasSensitive, hmacSignature, idSchema, isAuditTable, isBrickApp, isCrudEvent, isDatabaseHandle, isTool, isWebhook, kebabCase, listSecrets, loadRecord, localBroker, markDashboardArrival, memory, migrateDatabase, normalizeDashboard, onTransactionCommit, outboxTable, overrideSecret, pluginOwner, recordAudit, recordWebhook, redact, redis, redisBroker, requestLoggingPlugin, requireBrickApp, resetGlobalRegistry, resetSecrets, resolveSecrets, runInTransaction, runStages, s3, satisfiesRange, scalarDocsHTML, scheduleTable, setActionAccess, setActionAudit, signDashboardIdentity, signDashboardMcp, spanStore, stagesOf, standardWebhooks, stopAllEvents, storageKey, syncSchema, telemetryLayer, toErrorResponse, toWireError, traceRoute, traceScheduleRun, twilioSignature, useDeps, useService, workflowEngine };
2610
+ export { ATTR, Activity, BrickError, DASHBOARD_IDENTITY_HEADER, DASHBOARD_KEY_ENV, DASHBOARD_MCP_ROUTE, DASHBOARD_MCP_TOOLS, DEFAULT_PREFIX, DuplicateNameError, DurableClock, DurableDeferred, Events, GLOBAL_SYMBOL, HOOK_NAMES, HTTP_METHODS, LOCAL_FILES_ROUTE, OPENAPI_DEFAULTS, SPAN, STANDARD_ERRORS, SecretRef, Sensitive, SocketDenied, SpanStore, StorageError, StorageUnavailableError, Telemetry, UnknownToolError, UploadedFile, UploadedFiles, ValidationError, WORKFLOW_TABLE, Workflow, WorkflowEngine, actionOwners, actorOf, addHostHooks, auditTable, brick, buildFtsMatchQuery, clientAddress, columnValue, createLogger, createMcpHandler, createMcpRegistry, createPostgresDatabase, createSQLiteDatabase, crud, crudEventName, crudEventSource, dashboardIdentity, dashboardKey, dashboardMcpCaller, dashboardUser, defineAction, defineDatabase, defineEvents, defineListener, definePlugin, defineResource, defineResourcePlugin, defineSchedule, defineSecret, defineService, defineServicePlugin, defineStorage, defineTool, emitEvent, ensureResourceIndexes, ensureSQLiteFts, envSource, exportArchitecture, frameworkStorage, generateOpenApiSpec, generateSQLiteIndexDdl, generateSQLiteTableDdl, getActionAccess, getActionRoute, getGlobalRegistry, getHostHooks, getPluginActionRoute, getPluginEndpoints, hasSensitive, hmacSignature, idSchema, isAuditTable, isBrickApp, isCrudEvent, isDatabaseHandle, isTool, isWebhook, kebabCase, listSecrets, loadRecord, localBroker, markDashboardArrival, memory, migrateDatabase, normalizeDashboard, onTransactionCommit, outboxTable, overrideSecret, pluginOwner, recordAudit, recordWebhook, redact, redis, redisBroker, requestLoggingPlugin, requireBrickApp, resetGlobalRegistry, resetSecrets, resolveSecrets, runInTransaction, runStages, s3, satisfiesRange, scalarDocsHTML, scheduleTable, setActionAccess, setActionAudit, signDashboardIdentity, signDashboardMcp, spanStore, stagesOf, standardWebhooks, stopAllEvents, storageKey, syncSchema, telemetryLayer, timestamptzText, toErrorResponse, toWireError, traceRoute, traceScheduleRun, twilioSignature, useDeps, useService, workflowEngine };
2515
2611
 
2516
2612
  //# sourceMappingURL=index.js.map