@brickkit/effect 0.16.0-beta.8 → 0.16.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts 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 SQLiteDatabaseConfig, $n as RawSocketConfig, $r as hasSensitive, $t as PluginContext, A as FinishedSpan, Aa as toErrorResponse, Ai as RawDeps, An as ResourceChild, Ar as Action, At as AnyTool, B as recordWebhook, Bi as SecretValidator, Bn as EventEnvelope, Br as ErrorDefinitions, Bt as PluginEndpointContext, C as OutboxStatus, Ca as DuplicateNameError, Ci as redis, Cn as CommandDecision, Cr as CrudEventOperation, Ct as ActionFeatures, D as ScheduleRunRecord, Da as ValidationError, Di as FileDriver, Dn as ResourceActionAccess, Dr as crudEventSource, Dt as ServiceContext, E as ScheduleState, Ea as StandardErrorCode, Ei as CallFiles, En as Resource, Er as crudEventName, Et as Service, F as SpanStartRecord, Fi as StorageError, Fn as idSchema, Fr as AnyAction, Ft as defineTool, G as DASHBOARD_MCP_ROUTE, Gi as resetSecrets, Gn as WorkflowEvent, Gr as Next, Gt as RequirementOf, H as telemetryLayer, Hi as envSource, Hn as EventsOptions, Hr as ExecuteParams, Ht as PluginRouteRegistrar, I as SpanStore, Ii as StorageUnavailableError, In as loadRecord, Ir as AnySchema, It as isTool, J as DashboardOptions, Ji as DatabaseConnection, Jn as ScheduleRun, Jr as Wire, Jt as ResourcePluginContext, K as DASHBOARD_MCP_TOOLS, Ki as resolveSecrets, Kn as Schedule, Kr as PluginActionChecks, Kt as ResourcePlugin, L as Telemetry, Li as SecretOptions, Ln as CrudEventPayload, Lr as AuthorizedActionConfig, Lt as ContextOf, M as SpanAttributes, Mi as ScopedFiles, Mn as ResourceIdentity, Mr as ActionConfigBase, Mt as ToolAnnotations, N as SpanEndRecord, Ni as StoredFile, Nn as ResourceTypeOptions, Nr as ActionContext, Nt as ToolContext, O as ScheduleTable, Oa as ValidationIssue, Oi as FileStorage, On as ResourceActionConfig, Or as defineEvents, Ot as ServiceOptions, P as SpanEventRecord, Pi as s3, Pn as defineResource, Pr as ActionParams, Pt as ToolOptions, Q as requestLoggingPlugin, Qi as PostgresOptions, Qn as RawSocket, Qr as Sensitive, Qt as PluginAppContext, R as TelemetryOptions, Ri as SecretRef, Rn as DispatchOptions, Rr as Call, Rt as InstalledPlugin, S as OutboxRow, Sa as BrickError, Si as memory, Sn as CommandConfig, Sr as isWebhook, St as ActionAccessPolicy, T as outboxTable, Ta as STANDARD_ERRORS, Ti as CallDeps, Tn as CommandRow, Tr as EventRefs, Tt as NoIdentity, U as traceRoute, Ui as listSecrets, Un as ListenerFailure, Ur as HTTP_METHODS, Ut as PluginRouteScope, V as spanStore, Vi as defineSecret, Vn as EventListener, Vr as ErrorHelpers, Vt as PluginRouteMethod, W as traceScheduleRun, Wi as overrideSecret, Wn as RetryDecision, Wr as HttpMethod, Wt as PluginRoutes, X as normalizeDashboard, Xi as DatabaseService, Xn as defineSchedule, Xr as stagesOf, Xt as ServicePlugin, Y as DashboardPeer, Yi as DatabaseHandle, Yn as WorkflowScheduleRun, Yr as runStages, Yt as ResourcePluginTypes, Z as RequestLoggingOptions, Zi as PostgresDatabaseConfig, Zn as CronExpression, Zr as Reveal, Zt as ServicePluginContext, _ as EventsDefinition, _a as dashboardMcpCaller, _i as RedisStorageOptions, _n as getHostHooks, _r as SocketSchema, _t as RouteIR, a as Activity, aa as timestamptzText, ai as AuditOptions, an as PluginManifest, ar as SocketsOptions, at as EndpointContext, b as stopAllEvents, ba as signDashboardIdentity, bi as defineStorage, bn as Command, br as WebhookRequest, bt as kebabCase, c as Workflow, ca as Logger, ci as SQLiteAuditTable, cn as definePlugin, cr as RegisteredSocket, ct as CorsOptions, d as workflowEngine, da as DASHBOARD_KEY_ENV, di as recordAudit, dn as HOOK_NAMES, dr as SocketConfig, dt as ArchitectureApplication, ea as SQLiteOptions, ei as redact, en as PluginFactory, er as RawSocketFrame, et as DocumentationOptions, f as WORKFLOW_TABLE, fa as DashboardIdentity, fi as Counter, fn as HookResult, fr as SocketEmitArgs, ft as ArchitectureSchema, g as Events, ga as dashboardKey, gi as PutIfAbsentResult, gn as addHostHooks, gr as SocketReplay, gt as DEFAULT_PREFIX, h as EventRecorder, ha as dashboardIdentity, hi as KeyValueStorage, hn as PluginHooks, hr as SocketPayloads, ht as ActionRoute, i as brick, ia as isDatabaseHandle, ii as clientAddress, in as PluginLifecycleContext, ir as RawSocketStats, it as scalarDocsHTML, j as OtlpOptions, ja as toWireError, ji as S3StorageOptions, jn as ResourceConfig, jr as ActionConfig, jt as Tool, k as scheduleTable, ka as WireError, ki as LOCAL_FILES_ROUTE, kn as ResourceActionInput, kr as isCrudEvent, kt as defineService, l as WorkflowEngine, la as createLogger, li as auditTable, ln as PluginTableBuilders, lr as SocketBroker, lt as CorsOrigin, m as EventContext, ma as DashboardUser, mi as KeyValueDriver, mn as PluginHookArgs, mr as SocketEventArgs, mt as exportArchitecture, n as BrickOptions, na as createSQLiteDatabase, ni as RateLimit, nn as PluginInstallOptions, nr as RawSocketMessage, nt as ReferenceDocument, o as DurableClock, oa as BaseContext, oi as AuditTable, on as PluginServiceContext, or as BrickSocketHandle, ot as EndpointDefinition, p as AppEvents, pa as DashboardMcpCaller, pi as FrameworkStorage, pn as HostHooks, pr as SocketEmitOptions, pt as ServiceSchema, q as DashboardAuth, qi as AnyDatabaseHandle, qn as ScheduleConfig, qr as Stage, qt as ResourcePluginAPI, r as ListeningServer, ra as defineDatabase, ri as RateLimits, rn as PluginInstance, rr as RawSocketPhase, rt as ReferenceOptions, s as DurableDeferred, sa as CallContext, si as PostgresAuditTable, sn as PluginSetupContext, sr as BrickSocketSender, st as EndpointMethod, t as BrickApp, ta as createPostgresDatabase, ti as ClientIp, tn as PluginInfo, tr as RawSocketHandle, tt as OpenApiDocument, u as WorkflowEngineOptions, ua as DASHBOARD_IDENTITY_HEADER, ui as isAuditTable, un as pluginOwner, ur as SocketBrokerMessage, ut as ActionSchema, v as EventsHub, va as dashboardUser, vi as StorageDriver, vn as AnyResource, vr as SocketSchemas, vt as actionOwners, w as OutboxTable, wa as ErrorEnvelope, wi as storageKey, wn as CommandErrors, wr as EventRef, wt as AnyService, x as OutboxCounts, xa as signDashboardMcp, xi as frameworkStorage, xn as CommandChildren, xr as WebhookVerifier, xt as ActionAccessInfo, y as ScheduleControl, ya as markDashboardArrival, yi as StorageOf, yn as ChildChanges, yr as WebhookConfig, yt as getActionRoute, z as TelemetryRecord, zi as SecretSource, zn as EventDelivery, zr as ErrorDefinition, zt as PLUGIN_KIND } from "./server-CxyGTnai.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
@@ -1202,5 +1212,5 @@ export declare const GLOBAL_SYMBOL: {
1202
1212
  */
1203
1213
  readonly spanListeners: "brickkit.effect.telemetry.listeners";
1204
1214
  };
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 };
1215
+ 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 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 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
1216
  //# 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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ACA;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;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;;;;;;;wBCzeM,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,Q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;;;wBAoBJ,qBACd,UAAU,aAAa,YACvB,UAAU,cAAc,cAAc,UAAU,UAChD,2BAEA,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"}
package/dist/index.js CHANGED
@@ -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 toErrorResponse, $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 prefixedFailure, 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 failureOfCause, Xt as StorageUnavailableError, Y as validatePath, Yn as ValidationError, Yt as StorageError, Z as setInternals, Zn as normalizeFailures, Zt as SecretRef, _ as idSchema, _n as inlineAuditOptions, _t as databaseValue, a as Workflow, an as definitionSite, at as getActionRoute, b as stopAllEvents, bn as recordAudit, bt as idSchema$1, c as WORKFLOW_TABLE, cn as ownDeps, ct as getActionAccess, d as createMcpHandler, dn as UploadedFile, dt as ORDERED_TYPES, en as listSecrets, er as toWireError, 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 WorkflowEngine, 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-B1gl742e.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
  /**
@@ -1834,16 +1940,20 @@ function operations(model) {
1834
1940
  const body = (tx, record) => Effect.forEach(items, (item, index) => perform(single, item, ctx, error, {
1835
1941
  tx,
1836
1942
  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)));
1943
+ }).pipe(Effect.catchCause((cause) => {
1944
+ const failure = failureOfCause(cause);
1945
+ return failure instanceof BrickError ? Effect.fail(prefixedFailure(failure, new BrickError({
1946
+ code: failure.code,
1947
+ message: `Item ${index}: ${failure.message}`,
1948
+ status: failure.status,
1949
+ details: {
1950
+ index,
1951
+ code: failure.code,
1952
+ message: failure.message
1953
+ },
1954
+ cause: failure.cause ?? failure
1955
+ }))) : Effect.failCause(cause);
1956
+ })));
1847
1957
  const hub = yield* recorderFor(ctx.db, single);
1848
1958
  const results = yield* hub ? hub.transaction(ctx.db, eventContext(ctx), body) : runInTransaction(ctx.db, (tx) => body(tx));
1849
1959
  return single === "delete" ? { count: results.length } : { items: results };
@@ -2511,6 +2621,6 @@ function requireBrickApp(app) {
2511
2621
  if (app.server) throw new Error("Brick: the app entry must not call .listen(); use a separate server bootstrap.");
2512
2622
  return app;
2513
2623
  }
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 };
2624
+ 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
2625
 
2516
2626
  //# sourceMappingURL=index.js.map