@brickkit/effect 0.16.0-beta.7 → 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 DocumentationOptions, $i as createLogger, $n as RegisteredSocket, $r as SQLiteAuditTable, $t as PluginFactory, A as OtlpOptions, Ai as SecretSource, An as ResourceConfig, Ar as ErrorDefinition, At as Tool, B as spanStore, Bi as DatabaseHandle, Bn as EventListener, Br as runStages, Bt as PluginRouteMethod, C as OutboxTable, Ci as ScopedFiles, Cn as CommandErrors, Cr as ActionConfigBase, Ct as AnyService, D as ScheduleTable, Di as StorageUnavailableError, Dn as ResourceActionConfig, Dr as AnySchema, Dt as ServiceOptions, E as ScheduleRunRecord, Ei as StorageError, En as ResourceActionAccess, Er as AnyAction, Et as ServiceContext, F as SpanStore, Fi as overrideSecret, Fn as loadRecord, Fr as HttpMethod, Ft as isTool, G as DASHBOARD_MCP_TOOLS, Gi as SQLiteOptions, Gn as Schedule, Gr as redact, Gt as ResourcePlugin, H as traceRoute, Hi as PostgresDatabaseConfig, Hn as ListenerFailure, Hr as Reveal, Ht as PluginRouteScope, I as Telemetry, Ii as resetSecrets, In as CrudEventPayload, Ir as Next, It as ContextOf, J as normalizeDashboard, Ji as defineDatabase, Jn as WorkflowScheduleRun, Jr as RateLimits, Jt as ResourcePluginTypes, K as DashboardAuth, Ki as createPostgresDatabase, Kn as ScheduleConfig, Kr as ClientIp, Kt as ResourcePluginAPI, L as TelemetryOptions, Li as resolveSecrets, Ln as DispatchOptions, Lr as PluginActionChecks, Lt as InstalledPlugin, M as SpanEndRecord, Mi as defineSecret, Mn as ResourceTypeOptions, Mr as ErrorHelpers, Mt as ToolContext, N as SpanEventRecord, Ni as envSource, Nn as defineResource, Nr as ExecuteParams, Nt as ToolOptions, O as scheduleTable, Oi as SecretOptions, On as ResourceActionInput, Or as AuthorizedActionConfig, Ot as defineService, P as SpanStartRecord, Pi as listSecrets, Pn as idSchema, Pr as HTTP_METHODS, Pt as defineTool, Q as ApiDocument, Qi as Logger, Qn as BrickSocketSender, Qr as PostgresAuditTable, Qt as PluginContext, R as TelemetryRecord, Ri as AnyDatabaseHandle, Rn as EventDelivery, Rr as Stage, Rt as PLUGIN_KIND, S as OutboxStatus, Si as S3StorageOptions, Sn as CommandDecision, Sr as ActionConfig, St as ActionFeatures, T as ScheduleState, Ti as s3, Tn as Resource, Tr as ActionParams, Tt as Service, U as traceScheduleRun, Ui as PostgresOptions, Un as RetryDecision, Ur as Sensitive, Ut as PluginRoutes, V as telemetryLayer, Vi as DatabaseService, Vn as EventsOptions, Vr as stagesOf, Vt as PluginRouteRegistrar, W as DASHBOARD_MCP_ROUTE, Wi as SQLiteDatabaseConfig, Wn as WorkflowEvent, Wr as hasSensitive, Wt as RequirementOf, X as RequestLoggingOptions, Xi as BaseContext, Xn as CronExpression, Xr as AuditOptions, Xt as ServicePluginContext, Y as SocketsOptions, Yi as isDatabaseHandle, Yn as defineSchedule, Yr as clientAddress, Yt as ServicePlugin, Z as requestLoggingPlugin, Zi as CallContext, Zn as BrickSocketHandle, Zr as AuditTable, Zt as PluginAppContext, _ as EventsHub, _a as ValidationError, _i as CallFiles, _n as AnyResource, _r as crudEventName, _t as actionOwners, a as Activity, aa as dashboardIdentity, ai as KeyValueDriver, an as PluginServiceContext, ar as SocketEventArgs, at as EndpointDefinition, b as OutboxCounts, ba as toErrorResponse, bi as LOCAL_FILES_ROUTE, bn as CommandChildren, br as isCrudEvent, bt as ActionAccessInfo, c as WORKFLOW_TABLE, ca as dashboardUser, ci as RedisStorageOptions, cn as PluginTableBuilders, cr as SocketSchema, ct as CorsOrigin, d as workflowEngine, da as signDashboardMcp, di as defineStorage, dn as HookResult, dr as WebhookRequest, dt as ArchitectureSchema, ea as DASHBOARD_IDENTITY_HEADER, ei as auditTable, en as PluginInfo, er as SocketBroker, et as OpenApiDocument, f as AppEvents, fa as BrickError, fi as frameworkStorage, fn as HostHooks, fr as WebhookVerifier, ft as ServiceSchema, g as EventsDefinition, ga as StandardErrorCode, gi as CallDeps, gn as getHostHooks, gr as EventRefs, gt as RouteIR, h as Events, ha as STANDARD_ERRORS, hi as storageKey, hn as addHostHooks, hr as EventRef, ht as DEFAULT_PREFIX, i as brick, ia as DashboardUser, ii as FrameworkStorage, in as PluginManifest, ir as SocketEmitOptions, it as EndpointContext, j as SpanAttributes, ji as SecretValidator, jn as ResourceIdentity, jr as ErrorDefinitions, jt as ToolAnnotations, k as FinishedSpan, ki as SecretRef, kn as ResourceChild, kr as Call, kt as AnyTool, l as Workflow, la as markDashboardArrival, li as StorageDriver, ln as pluginOwner, lr as SocketSchemas, lt as ActionSchema, m as EventRecorder, ma as ErrorEnvelope, mi as redis, mn as PluginHooks, mr as CrudEventOperation, mt as ActionRoute, n as BrickOptions, na as DashboardIdentity, ni as recordAudit, nn as PluginInstance, nr as SocketConfig, nt as ReferenceOptions, o as DurableClock, oa as dashboardKey, oi as KeyValueStorage, on as PluginSetupContext, or as SocketPayloads, ot as EndpointMethod, p as EventContext, pa as DuplicateNameError, pi as memory, pn as PluginHookArgs, pr as isWebhook, pt as exportArchitecture, q as DashboardOptions, qi as createSQLiteDatabase, qn as ScheduleRun, qr as RateLimit, qt as ResourcePluginContext, r as ListeningServer, ra as DashboardMcpCaller, ri as Counter, rn as PluginLifecycleContext, rr as SocketEmitArgs, rt as scalarDocsHTML, s as DurableDeferred, sa as dashboardMcpCaller, si as PutIfAbsentResult, sn as definePlugin, sr as SocketReplay, st as CorsOptions, t as BrickApp, ta as DASHBOARD_KEY_ENV, ti as isAuditTable, tn as PluginInstallOptions, tr as SocketBrokerMessage, tt as ReferenceDocument, u as WorkflowEngine, ua as signDashboardIdentity, ui as StorageOf, un as HOOK_NAMES, ur as WebhookConfig, ut as ArchitectureApplication, v as ScheduleControl, va as ValidationIssue, vi as FileDriver, vn as ChildChanges, vr as crudEventSource, vt as getActionRoute, w as outboxTable, wi as StoredFile, wn as CommandRow, wr as ActionContext, wt as NoIdentity, x as OutboxRow, xa as toWireError, xi as RawDeps, xn as CommandConfig, xr as Action, xt as ActionAccessPolicy, y as stopAllEvents, ya as WireError, yi as FileStorage, yn as Command, yr as defineEvents, yt as kebabCase, z as recordWebhook, zi as DatabaseConnection, zn as EventEnvelope, zr as Wire, zt as PluginEndpointContext } from "./server-tJhU9lsW.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
@@ -1135,6 +1145,8 @@ export declare const SPAN: {
1135
1145
  readonly actionPrefix: "action ";
1136
1146
  /** `rpc <service>.<action>` */
1137
1147
  readonly rpcPrefix: "rpc ";
1148
+ /** `socket <service>.<name>`: a raw socket connection, from upgrade to close. */
1149
+ readonly socketPrefix: "socket ";
1138
1150
  readonly exceptionEvent: "exception";
1139
1151
  /** The span event a `ctx.logger` line becomes. */
1140
1152
  readonly logEvent: "log";
@@ -1159,6 +1171,12 @@ export declare const ATTR: {
1159
1171
  readonly scheduleAttempt: "brick.schedule.attempt";
1160
1172
  readonly scheduleSlot: "brick.schedule.slot";
1161
1173
  readonly scheduleOutcome: "brick.schedule.outcome";
1174
+ /** A raw socket connection: its route name, id, frames and bytes received, and close code. */
1175
+ readonly socketName: "brick.socket.name";
1176
+ readonly socketId: "brick.socket.id";
1177
+ readonly socketMessages: "brick.socket.messages";
1178
+ readonly socketBytes: "brick.socket.bytes";
1179
+ readonly socketCloseCode: "brick.socket.close_code";
1162
1180
  readonly traceId: "brick.trace_id";
1163
1181
  readonly errorCode: "brick.error.code";
1164
1182
  readonly errorMessage: "brick.error.message";
@@ -1194,5 +1212,5 @@ export declare const GLOBAL_SYMBOL: {
1194
1212
  */
1195
1213
  readonly spanListeners: "brickkit.effect.telemetry.listeners";
1196
1214
  };
1197
- 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 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 };
1198
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","../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,SA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BACd,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;WACA;;WAEA;;qBAGW;WACX;WACA;WACA;WACA;;WAEA;WACA;WACA;WACA;;WAEA;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;;;;;;;;;;;;;;wB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AMA"}
package/dist/index.js CHANGED
@@ -1,14 +1,15 @@
1
- import { $ as getGlobalRegistry, $t as listSecrets, A as runInTransaction, An as traceRoute, At as invalid, B as claimSegment, Bn as signDashboardMcp, Bt as frameworkStorage, C as scheduleTable, Cn as createLogger, Ct as reject, D as localBroker, Dn as recordWebhook, Dt as createAction, E as defineServiceSocket, En as Telemetry, Et as RESET_STAGES, F as isCrudEvent, Fn as dashboardKey, Ft as redact, G as getPluginEndpoints, Gn as BrickError, Gt as LOCAL_FILES_ROUTE, H as defineResourcePlugin, Hn as GLOBAL_SYMBOL, Ht as redis, I as OPENAPI_DEFAULTS, In as dashboardMcpCaller, It as sensitivePointer, J as validatePath, Jn as ValidationError, Jt as StorageError, K as hasPlugin, Kn as DuplicateNameError, Kt as s3, L as generateOpenApiSpec, Ln as dashboardUser, Lt as carryClientRequest, M as crudEventSource, Mn as DASHBOARD_IDENTITY_HEADER, Mt as stagesOf, N as defineEvents, Nn as DASHBOARD_KEY_ENV, Nt as Sensitive, O as splitSeq, On as spanStore, Ot as deny, P as encodePayload, Pn as dashboardIdentity, Pt as hasSensitive, Q as PLUGIN_KIND, Qt as envSource, R as requestLoggingPlugin, Rn as markDashboardArrival, Rt as clientAddress, S as outboxTable, Sn as baseContext, St as kindOf, T as SocketDenied, Tn as SpanStore, Tt as HTTP_METHODS, U as defineServicePlugin, Un as SPAN, Ut as requireStorage, V as copyControls, Vn as ATTR, Vt as memory, W as getPluginActionRoute, Wn as actionMeta, Wt as storageKey, X as setInternals, Xn as toErrorResponse, Xt as SecretRef, Y as internalsOf, Yn as normalizeFailures, Yt as StorageUnavailableError, Z as PLUGIN_COMMIT, Zn as toWireError, Zt as defineSecret, _ as idSchema, _n as isAuditTable, _t as decodeCursor, a as WORKFLOW_TABLE, an as depsOverride, at as isObjectSchema, b as stopAllEvents, bn as recordInline, bt as invalid$1, c as workflowEngine, cn as useDeps, ct as setActionAccess, d as createMcpHandler, dn as UploadedFiles, dt as SORTABLE_TYPES, en as overrideSecret, et as resetGlobalRegistry, f as createMcpRegistry, fn as fileFields, ft as UNFILTERABLE_TYPES, g as defineResource, gn as inlineAuditOptions, gt as databaseValue, h as normalizeDashboard, hn as bindAuditTarget, ht as columnValue, i as DurableDeferred, in as definitionSite, it as getActionRoute, j as crudEventName, jn as traceScheduleRun, jt as runStages, k as onTransactionCommit, kn as telemetryLayer, kt as errorHelpers, l as INTERNALS, ln as withOverride, lt as setActionAudit, m as DASHBOARD_MCP_TOOLS, mn as auditTableOf, mt as columnSchema, n as Activity, nn as resolveSecrets, nt as DEFAULT_PREFIX, o as Workflow, on as freezeAsBuiltDeps, ot as kebabCase, p as DASHBOARD_MCP_ROUTE, pn as auditTable, pt as checkJsonSchema, q as installPlugin, qn as STANDARD_ERRORS, qt as scopeFiles, r as DurableClock, rn as claimName, rt as actionOwners, s as WorkflowEngine, sn as ownDeps, st as getActionAccess, t as brick, tn as resetSecrets, tt as exportArchitecture, u as UnknownToolError, un as UploadedFile, ut as ORDERED_TYPES, v as loadRecord, vn as isInlineAudit, vt as encodeCursor, w as defineSchedule, wn as defaultLogger, wt as withoutNull, x as defineListener, xn as actorOf, xt as jsonValue, y as Events, yn as recordAudit, yt as idSchema$1, z as scalarDocsHTML, zn as signDashboardIdentity, zt as defineStorage } from "./server-BK0CrkGH.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
  /**
@@ -874,6 +980,7 @@ function isTool(value) {
874
980
  function defineService(name, options = {}) {
875
981
  const actions = /* @__PURE__ */ new Map();
876
982
  const sockets = /* @__PURE__ */ new Map();
983
+ const rawSockets = /* @__PURE__ */ new Map();
877
984
  const tools = /* @__PURE__ */ new Map();
878
985
  const resources = /* @__PURE__ */ new Map();
879
986
  const resolved = /* @__PURE__ */ new WeakSet();
@@ -883,9 +990,9 @@ function defineService(name, options = {}) {
883
990
  let events = defineEvents(name, options.events ?? {});
884
991
  const auditTable = auditTableOf(database);
885
992
  if (auditTable && !identity) throw new Error(`Service "${name}": its database holds an audit table, but the service declares no identity, so the log would not say who. Add identity: ({ request }) => Effect.succeed(user && { id: user.id }) to defineService("${name}", { ... }).`);
886
- const resolveContext = (call) => call && resolved.has(call) ? Effect.succeed(call) : Effect.gen(function* () {
993
+ const resolveContext = (call, pluginDeps) => call && resolved.has(call) ? Effect.succeed(call) : Effect.gen(function* () {
887
994
  const db = database && (yield* database.Database);
888
- const own = withOverride(deps, depsOverride(call));
995
+ const own = withOverride(pluginDeps ?? deps, depsOverride(call));
889
996
  const ctx = {
890
997
  ...baseContext(call),
891
998
  ...database && { db },
@@ -940,13 +1047,21 @@ function defineService(name, options = {}) {
940
1047
  getAction: (actionName) => actions.get(actionName),
941
1048
  listActions: () => [...actions.values()],
942
1049
  socket(config) {
943
- if (sockets.has(config.name)) throw new DuplicateNameError(`Brick: duplicate socket "${config.name}" in service "${name}"`);
1050
+ if (sockets.has(config.name) || rawSockets.has(config.name)) throw new DuplicateNameError(`Brick: duplicate socket "${config.name}" in service "${name}"`);
944
1051
  const socket = defineServiceSocket(name, config, (request) => resolveContext({ request }));
945
1052
  sockets.set(config.name, socket);
946
1053
  touch();
947
1054
  return socket.handle;
948
1055
  },
949
1056
  listSockets: () => [...sockets.values()],
1057
+ rawSocket(config) {
1058
+ if (sockets.has(config.name) || rawSockets.has(config.name)) throw new DuplicateNameError(`Brick: duplicate socket "${config.name}" in service "${name}"`);
1059
+ const socket = defineRawSocket(config, (request) => resolveContext({ request }, socket.deps));
1060
+ rawSockets.set(config.name, socket);
1061
+ touch();
1062
+ return socket.handle;
1063
+ },
1064
+ listRawSockets: () => [...rawSockets.values()],
950
1065
  tool(config) {
951
1066
  const existing = isTool(config);
952
1067
  const tool = existing ? config : defineTool(config);
@@ -984,6 +1099,7 @@ function defineService(name, options = {}) {
984
1099
  const maps = [
985
1100
  actions,
986
1101
  sockets,
1102
+ rawSockets,
987
1103
  tools,
988
1104
  resources,
989
1105
  sites
@@ -1824,16 +1940,20 @@ function operations(model) {
1824
1940
  const body = (tx, record) => Effect.forEach(items, (item, index) => perform(single, item, ctx, error, {
1825
1941
  tx,
1826
1942
  record
1827
- }).pipe(Effect.mapError((cause) => cause instanceof BrickError ? new BrickError({
1828
- code: cause.code,
1829
- message: `Item ${index}: ${cause.message}`,
1830
- status: cause.status,
1831
- details: {
1832
- index,
1833
- code: cause.code,
1834
- message: cause.message
1835
- }
1836
- }) : 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
+ })));
1837
1957
  const hub = yield* recorderFor(ctx.db, single);
1838
1958
  const results = yield* hub ? hub.transaction(ctx.db, eventContext(ctx), body) : runInTransaction(ctx.db, (tx) => body(tx));
1839
1959
  return single === "delete" ? { count: results.length } : { items: results };
@@ -2388,7 +2508,11 @@ function definePlugin(manifest) {
2388
2508
  }),
2389
2509
  claim: (segment) => context.routes.claim(segment)
2390
2510
  };
2391
- const before = /* @__PURE__ */ new Set([...service.listActions(), ...service.listTools()]);
2511
+ const before = /* @__PURE__ */ new Set([
2512
+ ...service.listActions(),
2513
+ ...service.listTools(),
2514
+ ...service.listRawSockets()
2515
+ ]);
2392
2516
  const started = bindings;
2393
2517
  const api = part({
2394
2518
  options,
@@ -2402,6 +2526,7 @@ function definePlugin(manifest) {
2402
2526
  hooks
2403
2527
  });
2404
2528
  for (const action of [...service.listActions(), ...service.listTools()]) if (!before.has(action)) bindPluginDeps(name, action, deps, started);
2529
+ for (const socket of service.listRawSockets()) if (!before.has(socket)) socket.deps ??= deps;
2405
2530
  context[PLUGIN_COMMIT]?.(() => {
2406
2531
  for (const table of Object.values(tables)) service.database.tables[getTableName(table)] = table;
2407
2532
  if (Object.keys(events).length) internalsOf(service).addEvents(Object.fromEntries(Object.entries(events).map(([key, ref]) => [`${camelName}.${key}`, ref])));
@@ -2496,6 +2621,6 @@ function requireBrickApp(app) {
2496
2621
  if (app.server) throw new Error("Brick: the app entry must not call .listen(); use a separate server bootstrap.");
2497
2622
  return app;
2498
2623
  }
2499
- 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 };
2500
2625
 
2501
2626
  //# sourceMappingURL=index.js.map