@brickkit/core 0.9.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,43 @@
1
- import { $ as ToolConfigWithoutAuthorize, $t as index, A as ErrorBuilder, At as SQLiteDefinition, B as Resource, Bt as envSource, C as ActionSchema, Ct as SQLiteOutboxTable, D as CacheOptions, Dt as DatabaseHandle, E as BaseContext, Et as DatabaseDefinition, F as NarrowAuthorizedContext, Ft as PostgresDatabaseConfig, G as ServiceAuthOptions, Gt as resolveSecrets, H as ResourceIdentity, Ht as overrideSecret, I as PreparationContribution, It as createPostgresDatabase, J as StandardErrorMap, Jt as BunSQLiteDatabase, K as ServiceOptions, Kt as secret, L as ProxyOptions, Lt as SecretOptions, M as InferTableRow, Mt as isDatabaseHandle, N as LifecycleOptions, Nt as DatabaseAdapter, O as CompiledRoutePlan, Ot as EnvInput, P as Logger, Pt as PostgresDatabase, Q as ToolConfigWithAuthorize, Qt as foreignKey, R as RateLimitOptions, Rt as SecretRef, S as ActionExecutionError, St as PostgresOutboxTable, T as BaseActionConfig, Tt as outboxTable, U as ResourceTypeOptions, Ut as overrideSecrets, V as ResourceConfig, Vt as listSecrets, W as Service, Wt as resetSecrets, X as Tool, Xt as blob, Y as TelemetryOptions, Yt as SQLiteDatabaseConfig, Z as ToolAnnotations, Zt as createSQLiteDatabase, _ as ActionConfig, _n as defineResourcePlugin, _t as ServiceEvents, a as BrickClientOptions, an as uniqueIndex, at as stopAllEvents, b as ActionContext, bn as getPluginEndpoints, bt as OutboxStatus, c as InferActionErrorCodes, cn as PluginRouteRegistrar, ct as CrudEventPayload, d as InferActionOutput, dn as ResourcePlugin, dt as EventEnvelope, en as integer, et as ToolOptions, f as createBrickClient, fn as ResourcePluginAPI, ft as EventListener, g as ActionAccessPolicy, gn as ServicePluginContext, gt as EventsWorld, h as Action, hn as ServicePlugin, ht as EventsOptions, i as BrickClientAction, in as text, it as EventsHub, j as InferTableInsert, jt as defineDatabase, k as DefaultServiceContext, kt as PostgresDefinition, l as InferActionFailure, ln as PluginRouteScope, lt as DispatchOptions, m as isBrickTransportError, mn as ResourcePluginTypes, mt as EventWorkflow, n as BrickCallOptions, nn as real, nt as ValidationErrorItem, o as BrickServerError, on as PluginEndpointContext, ot as Dispatcher, p as isBrickServerError, pn as ResourcePluginContext, pt as EventRecorder, q as ServiceSchema, qt as BrickSQLiteDatabase, r as BrickClient, rn as sqliteTable, rt as EventsDefinition, s as BrickTransportError, sn as PluginRouteMethod, st as OutboxCounts, t as BrickActionCaller, tn as primaryKey, tt as ValidationError, u as InferActionInput, un as PluginRoutes, ut as EventDelivery, v as ActionConfigWithAuthorize, vn as defineServicePlugin, vt as WorkflowEvent, w as ArchitectureSchema, wt as isOutboxTable, x as ActionErrorDefinition, xt as OutboxTable, y as ActionConfigWithoutAuthorize, yn as getPluginActionRoute, yt as WorkflowsOptions, z as ResilienceOptions, zt as SecretSource } from "./chunks/client.js";
1
+ import { $ as ResourceChild, $n as SecretSource, $t as integer, A as Command, An as isOutboxTable, At as SocketEmitOptions, B as InferTableInsert, Bn as PluginInstallOptions, Bt as defineDatabase, C as ActionExecutionError, Cn as stopAllEvents, Cr as EventRefs, D as BaseContext, Dn as OutboxTable, Dr as Ports, Dt as SocketBroker, E as BaseActionConfig, En as OutboxStatus, Er as Port, F as CommandRow, Fn as PluginAppContext, Ft as DatabaseDefinition, G as PreparationContribution, Gn as PluginSetupContext, Gt as createPostgresDatabase, H as LifecycleOptions, Hn as PluginLifecycleContext, Ht as DatabaseAdapter, I as CompiledRoutePlan, In as PluginContext, It as DatabaseHandle, J as ResilienceOptions, Jn as definePlugin, Jt as SQLiteDatabaseConfig, K as ProxyOptions, Kn as PluginTableBuilders, Kt as BrickSQLiteDatabase, L as DefaultServiceContext, Ln as PluginFactory, Lt as EnvInput, M as CommandConfig, Mn as emitEvent, Mt as SocketPayloads, N as CommandDecision, Nn as defineListener, Nt as SocketReplay, O as CacheOptions, On as PostgresOutboxTable, Or as port, Ot as SocketBrokerMessage, P as CommandErrors, Pn as InstalledPlugin, Pt as SocketSchemas, Q as ResourceActionInput, Qn as SecretRef, Qt as index, R as ErrorBuilder, Rn as PluginHooks, Rt as PostgresDefinition, S as ActionErrorDefinition, Sn as EventsHub, Sr as EventRef, St as BrickSocketHandle, T as ArchitectureSchema, Tn as OutboxCounts, Tr as DepsOf, Tt as BrickSocketSender, U as Logger, Un as PluginManifest, Ut as PostgresDatabase, V as InferTableRow, Vn as PluginInstance, Vt as isDatabaseHandle, W as NarrowAuthorizedContext, Wn as PluginServiceContext, Wt as PostgresDatabaseConfig, X as ResourceActionAccess, Xn as satisfiesRange, Xt as createSQLiteDatabase, Y as Resource, Yn as isPluginInstance, Yt as blob, Z as ResourceActionConfig, Zn as SecretOptions, Zt as foreignKey, _ as ActionAccessPolicy, _n as defineServicePlugin, _r as RetryDecision, _t as BrickClientSocket, a as BrickClientOptions, an as PluginEndpointContext, ar as resetSecrets, at as ServiceOptions, b as ActionConfigWithoutAuthorize, bn as resolveWorkflowPaths, br as WorkflowsOptions, c as BrickTransportError, cn as PluginRouteScope, cr as DispatchOptions, ct as TelemetryOptions, d as InferActionInput, dn as ResourcePluginAPI, dr as EventListener, dt as ToolConfigWithAuthorize, en as primaryKey, er as defineSecret, et as ResourceConfig, f as InferActionOutput, fn as ResourcePluginContext, fr as EventRecorder, ft as ToolConfigWithoutAuthorize, g as Action, gn as defineResourcePlugin, gr as ListenerFailure, gt as RegisteredSocket, h as isBrickTransportError, hn as ServicePluginContext, hr as EventsWorld, ht as ValidationErrorItem, i as BrickClientAction, in as uniqueIndex, ir as overrideSecrets, it as ServiceAuthOptions, j as CommandChildren, jn as outboxTable, jt as SocketEventArgs, k as ChildChanges, kn as SQLiteOutboxTable, kr as useDeps, kt as SocketEmitArgs, l as InferActionErrorCodes, ln as PluginRoutes, lr as EventDelivery, lt as Tool, m as isBrickServerError, mn as ServicePlugin, mr as EventsOptions, mt as ValidationError, n as BrickCallOptions, nn as sqliteTable, nr as listSecrets, nt as ResourceTypeOptions, o as BrickServerError, on as PluginRouteMethod, or as resolveSecrets, ot as ServiceSchema, p as createBrickClient, pn as ResourcePluginTypes, pr as EventWorkflow, pt as ToolOptions, q as RateLimitOptions, qn as brickVersion, qt as BunSQLiteDatabase, r as BrickClient, rn as text, rr as overrideSecret, rt as Service, s as BrickServices, sn as PluginRouteRegistrar, sr as CrudEventPayload, st as StandardErrorMap, t as BrickActionCaller, tn as real, tr as envSource, tt as ResourceIdentity, u as InferActionFailure, un as ResourcePlugin, ur as EventEnvelope, ut as ToolAnnotations, v as ActionConfig, vn as getPluginActionRoute, vr as ServiceEvents, w as ActionSchema, wn as Dispatcher, wr as isEventRef, wt as BrickSocketSchema, x as ActionContext, xn as EventsDefinition, xr as EventCatalog, y as ActionConfigWithAuthorize, yn as getPluginEndpoints, yr as WorkflowEvent, yt as BrickSocketConfig, z as ErrorDetails, zn as PluginInfo, zt as SQLiteDefinition } from "./chunks/client.js";
2
2
  import { SpanKind } from "@opentelemetry/api";
3
3
  import { Static, TSchema, TSchema as TSchema$1, Type } from "@sinclair/typebox";
4
4
  import { TypeCheck } from "@sinclair/typebox/compiler";
5
- import { Elysia } from "elysia";
6
5
  import { Table, and, asc, desc, eq, getTableColumns, getTableName, gt, gte, ilike, inArray, is, isNotNull, isNull, like, lt, lte, ne, not, notInArray, or, relations, sql } from "drizzle-orm";
6
+ import { Elysia } from "elysia";
7
+ //#region src/events/transaction.d.ts
8
+ /**
9
+ * Run `fn` in a database transaction: everything it writes through the `tx` it is
10
+ * given is committed together when it returns, or undone if it throws.
11
+ *
12
+ * Postgres uses a real transaction on one connection. SQLite has one connection
13
+ * and a synchronous driver, which Drizzle's own `transaction` cannot use with an
14
+ * async callback (it would commit before the callback finished). So transactions
15
+ * on one SQLite database take turns, each between `BEGIN IMMEDIATE` and `COMMIT`.
16
+ * A write made elsewhere in the process during that time, outside this helper,
17
+ * would join the transaction; use Postgres where that matters.
18
+ *
19
+ * A call made inside `fn` with the `tx` it was given (on SQLite, the database
20
+ * itself) joins the open transaction as a savepoint instead of waiting for it: a
21
+ * nested failure undoes only the nested work, and the outer transaction decides
22
+ * the commit. Nested calls must run one at a time.
23
+ *
24
+ * @param db - A Drizzle database, from `service.getDb()`.
25
+ * @param fn - Receives the transaction handle to run queries on.
26
+ * @returns What `fn` returned.
27
+ * @throws What `fn` threw, after rolling back.
28
+ */
29
+ export declare function runInTransaction<T>(db: any, fn: (tx: any) => Promise<T>): Promise<T>;
30
+ /**
31
+ * Run `fn` once the transaction that `db` belongs to has committed, or now when
32
+ * `db` is not in one opened by `runInTransaction`. It never runs when that
33
+ * transaction, or the savepoint it was queued in, rolls back. An error it throws
34
+ * reaches the caller of the outermost `runInTransaction`, after the commit.
35
+ *
36
+ * @param db - The handle the work ran on: a `tx`, or a database.
37
+ * @param fn - The side effect, such as clearing a cache.
38
+ */
39
+ export declare function onTransactionCommit(db: unknown, fn: () => unknown): Promise<void>;
40
+ //#endregion
7
41
  //#region src/compiler/ir.d.ts
8
42
  type RouteMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
9
43
  interface RouteIR {
@@ -178,6 +212,8 @@ interface EndpointDefinition {
178
212
  summary?: string;
179
213
  description?: string;
180
214
  tags?: string[];
215
+ /** The plugin that contributed it; OpenAPI labels it `x-brick-plugin`. */
216
+ plugin?: string;
181
217
  }
182
218
  /** Resolve the db for an endpoint: explicit service first, else first service holding one. */
183
219
  export declare function resolveEndpointDb(service: Service<any, any> | string | undefined, services: Service<any, any>[]): any;
@@ -192,6 +228,10 @@ type BrickApp = Elysia<any, any, any, any, any, any, any> & {
192
228
  /** Service definitions, prefix, and telemetry setting chosen at construction. */
193
229
  readonly definition: {
194
230
  readonly routes: readonly RouteIR[];
231
+ readonly sockets: readonly (BrickSocketSchema & {
232
+ service: string;
233
+ path: string;
234
+ })[];
195
235
  readonly services: readonly Service<any, any>[];
196
236
  readonly prefix: string;
197
237
  readonly telemetry: boolean;
@@ -200,7 +240,15 @@ type BrickApp = Elysia<any, any, any, any, any, any, any> & {
200
240
  readonly dashboard?: DashboardOptions;
201
241
  /** The listeners and settings of `events`, as plain data. */
202
242
  readonly events?: EventsDefinition;
243
+ /** Every `definePlugin` installation, in install order. */
244
+ readonly plugins?: readonly InstalledPlugin[];
203
245
  };
246
+ /**
247
+ * Run the plugins' `on("start")` handlers in install order, once. `listen`
248
+ * calls it; `brick dev` and `brick start` await it before serving. `stop()`
249
+ * runs their `on("stop")` handlers in reverse order.
250
+ */
251
+ start(): Promise<void>;
204
252
  /**
205
253
  * The events of this app, when `events` is set: start and stop delivery, drain
206
254
  * what is due, and see or retry what is parked. `brick dev` and `brick start`
@@ -377,6 +425,37 @@ interface CreateServerOptions {
377
425
  * and an app without this option behaves exactly as before. See `EventsOptions`.
378
426
  */
379
427
  events?: EventsOptions;
428
+ /**
429
+ * Also serve the v0.10 paths (CRUD at `${prefix}/${resource}/...`, service
430
+ * actions and sockets at `${prefix}/${service}/${name}` as declared, and
431
+ * explicit paths that still start with the prefix) with the same handlers.
432
+ * Their responses carry `Deprecation: true` and a `Link` to the new path, and
433
+ * their spans `brick.legacy_route`. OpenAPI and the client describe only the
434
+ * new paths. Removed in v0.12.
435
+ */
436
+ legacyRoutes?: boolean;
437
+ /**
438
+ * Socket fan-out. `broker` carries emits and kicks between processes
439
+ * (default: this process only). See `redisBroker`. The app closes it on stop.
440
+ * `secret` signs replay sequences; give every process the same one so a
441
+ * client can resume on any of them (default: random per process).
442
+ */
443
+ sockets?: {
444
+ broker?: SocketBroker;
445
+ secret?: string;
446
+ };
447
+ /**
448
+ * The values of the services' declared `deps` (`port<T>()`), by name. Every
449
+ * declared dep must be provided, and every provided one declared. Actions read
450
+ * them as `ctx.deps`, listeners and workflow steps with `useDeps()`.
451
+ */
452
+ deps?: Record<string, unknown>;
453
+ /**
454
+ * App-wide plugins from `definePlugin`, in install order: their `app` part
455
+ * adds start/stop lifecycle, middleware and listeners. Plugins installed with
456
+ * `service.use()` or `resource.use()` take part too, before these.
457
+ */
458
+ plugins?: readonly PluginInstance<any, any>[];
380
459
  }
381
460
  /**
382
461
  * Create the HTTP application: an Elysia app that serves every service's
@@ -392,11 +471,11 @@ interface CreateServerOptions {
392
471
  * @param options - `prefix` for action routes (default `/api`), `services`,
393
472
  * `title`, `version`, and `description` for the OpenAPI document, `docs` and the
394
473
  * paths of its pages, `requestLogging`, `reference`, `endpoints`, `secrets`,
395
- * `telemetry`, `documentation`, and `dashboard`. See `CreateServerOptions`.
474
+ * `telemetry`, `documentation`, `dashboard`, and `deps`. See `CreateServerOptions`.
396
475
  * @returns The app, with `definition` (its services, prefix, and routes),
397
476
  * `endpoint()` to add raw routes, and `listEndpoints()` to list them.
398
- * @throws When a required secret is missing, or `documentation` or `dashboard`
399
- * is invalid.
477
+ * @throws When a required secret is missing, `documentation` or `dashboard`
478
+ * is invalid, or `deps` misses a dep a service declares or has one none declares.
400
479
  * @example
401
480
  * import { brick } from "@brickkit/core";
402
481
  * import { pagesService } from "./services/pages";
@@ -520,6 +599,55 @@ export declare function buildFtsMatchQuery(search: string): string | null;
520
599
  */
521
600
  export declare function syncSchema(tablesOrService: Map<string, any> | any[] | Record<string, any> | Service, dbInstance?: any): Promise<void> | void;
522
601
  //#endregion
602
+ //#region src/rpc.d.ts
603
+ /** An in-process caller for one action: its input, then an optional call context. */
604
+ type ServiceActionCaller<A> = undefined extends InferActionInput<A> ? (input?: InferActionInput<A>, ctx?: Partial<ActionContext>) => Promise<InferActionOutput<A>> : (input: InferActionInput<A>, ctx?: Partial<ActionContext>) => Promise<InferActionOutput<A>>;
605
+ /**
606
+ * What `useService` returns: the service's actions as methods, with each
607
+ * resource's actions under the resource's name. Sockets are left out.
608
+ */
609
+ type ServiceClient<T> = { [K in keyof T as T[K] extends BrickClientSocket<any, any> ? never : K]: T[K] extends BrickClientAction<any, any, any> | Action<any, any, any, any> | ((...args: any[]) => any) ? ServiceActionCaller<T[K]> : ServiceClient<T[K]>; };
610
+ declare const serviceNameType: unique symbol;
611
+ /** Type only: the literal name of a service, which `useService` finds its contract by. */
612
+ interface NamedService<N extends string> {
613
+ readonly [serviceNameType]?: N;
614
+ }
615
+ /** What `useService` returns while the contract does not describe the service yet. */
616
+ type UntypedServiceClient = {
617
+ [name: string]: any;
618
+ };
619
+ /**
620
+ * Call another service's actions in-process, typed from that service. Each
621
+ * action is a method, and each resource's actions sit under the resource's
622
+ * name: `billing.charge(input)`, `billing.invoice.list()`.
623
+ *
624
+ * The types come from the app's generated contract (`_brick/contract.ts`, which
625
+ * `brick dev` and `brick gen client` keep current), so renaming an action or
626
+ * changing its input is a compile error at every caller. Until the contract
627
+ * describes the service, the client is untyped.
628
+ *
629
+ * A call runs through the target's own validation and authorization, with the
630
+ * target's database, context and deps (never the caller's), and shows as an
631
+ * `rpc` span in the trace.
632
+ *
633
+ * @param service - The service to call, as `defineService` returned it.
634
+ * @param options - `from` (the calling service's name, which becomes `ctx.caller`
635
+ * in the target and cannot be spoofed) and `context` (defaults for every call).
636
+ * Each call also takes an optional call context after its input.
637
+ * @returns The client.
638
+ * @throws On a call, when the service is not registered or has no such action.
639
+ * @example
640
+ * import { useService } from "@brickkit/core";
641
+ * import { billingService } from "../billing/billing.service";
642
+ *
643
+ * const billing = useService(billingService, { from: "orders" });
644
+ * await billing.charge({ orderId, amountCents });
645
+ * await billing.invoice.list({ limit: 10 });
646
+ */
647
+ export declare function useService<const N extends string = string>(service: {
648
+ readonly name: string;
649
+ } & NamedService<N>, options?: ProxyOptions): N extends keyof BrickServices ? ServiceClient<BrickServices[N]> : UntypedServiceClient;
650
+ //#endregion
523
651
  //#region src/service.d.ts
524
652
  export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>>, TServiceContext extends Record<string, any> = Record<string, any>> implements Service<TDb, TServiceContext> {
525
653
  readonly name: string;
@@ -527,10 +655,15 @@ export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>
527
655
  readonly actions: Map<string, Action<any, any, any, any>>;
528
656
  readonly tools: Map<string, Tool<any, any, any, any>>;
529
657
  readonly tables: Map<string, any>;
530
- readonly resources: Map<string, Resource<any, BaseContext<TDb> & TServiceContext, {}>>;
658
+ private readonly sockets;
659
+ readonly resources: Map<string, Resource<any, BaseContext<TDb> & TServiceContext, {}, EventCatalog>>;
531
660
  readonly preparations: Map<string, PreparationContribution>;
661
+ /** Where each `kind:name` was defined, to reject duplicates from another file. */
662
+ private readonly sites;
532
663
  private database?;
533
664
  private _isBuilt;
665
+ /** The declared events: `service.events.<name>`. */
666
+ readonly events: Readonly<Record<string, EventRef>>;
534
667
  constructor(name: string, options?: ServiceOptions<TServiceContext, TDb>);
535
668
  use<A>(plugin: ServicePlugin<this, A>): A;
536
669
  get db(): TDb | undefined;
@@ -539,6 +672,7 @@ export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>
539
672
  * Closes declarations after plugins have registered their actions and preparations.
540
673
  */
541
674
  build(): this;
675
+ private claim;
542
676
  contributePreparation(contribution: PreparationContribution): void;
543
677
  listPreparations(): PreparationContribution[];
544
678
  prepareContributions(): void;
@@ -553,14 +687,25 @@ export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>
553
687
  tool<TIn extends TSchema$1 | undefined = undefined, TOut extends TSchema$1 | undefined = undefined, TErr extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>>(config: ToolConfigWithAuthorize<TIn, TOut, TErr, BaseContext<TDb> & TServiceContext>): Tool<TIn, TOut, TErr, BaseContext<TDb> & TServiceContext>;
554
688
  tool<TIn extends TSchema$1 | undefined = undefined, TOut extends TSchema$1 | undefined = undefined, TErr extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>>(config: ToolConfigWithoutAuthorize<TIn, TOut, TErr, BaseContext<TDb> & TServiceContext>): Tool<TIn, TOut, TErr, BaseContext<TDb> & TServiceContext>;
555
689
  getTool(name: string): Tool<any, any, any, any> | undefined;
690
+ socket<const I extends SocketSchemas, const O extends SocketSchemas>(config: BrickSocketConfig<I, O, BaseContext<TDb> & TServiceContext>): BrickSocketHandle<SocketPayloads<O>>;
691
+ listSockets(): RegisteredSocket[];
556
692
  listTools(): Tool<any, any, any, any>[];
557
693
  getAction(name: string): Action<any, any, any, any> | undefined;
558
694
  listActions(): Action<any, any, any, any>[];
559
695
  getDb(): TDb | undefined;
696
+ /** The handle from `defineDatabase`, without connecting. */
697
+ getDatabaseHandle(): DatabaseHandle<TDb> | undefined;
560
698
  /** What a write needs to record events. Set by `brick({ events })`. */
561
- events?: ServiceEvents;
699
+ recorder?: ServiceEvents;
562
700
  getOutbox(): OutboxTable | undefined;
563
- setEvents(events: ServiceEvents | undefined): void;
701
+ setRecorder(recorder: ServiceEvents | undefined): void;
702
+ /** Whether the service declares an event catalog. */
703
+ get hasCatalog(): boolean;
704
+ /** @throws When the event is not in the catalog or its payload does not match. */
705
+ checkEvent(name: string, payload: unknown): void;
706
+ /** The values of this service's `deps`. Set by `brick({ deps })`. */
707
+ deps?: Readonly<Record<string, unknown>>;
708
+ setDeps(deps: Readonly<Record<string, unknown>>): void;
564
709
  setDb(database: DatabaseHandle<TDb>): void;
565
710
  /**
566
711
  * Resolves the complete service execution context once per incoming request.
@@ -573,16 +718,19 @@ export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>
573
718
  /**
574
719
  * Declare a service: a named group of actions, tools, and resources with its own
575
720
  * database and request context. It is registered globally, so `brick()`, the
576
- * OpenAPI generator, and `createServiceProxy` find it by name.
721
+ * OpenAPI generator, and `useService` find it by name.
577
722
  *
578
723
  * Add actions with `service.action(...)`, tools with `service.tool(...)`,
579
724
  * resources with `service.resource(...)`, and plugins with `service.use(...)`.
580
725
  *
581
726
  * @param name - Unique name. It is the service's segment of every action route
582
- * (`/api/<name>/<action>`) and appears in OpenAPI and the dashboard. Defining a
583
- * second service with the same name replaces the first and logs a warning.
584
- * @param options - `database` (a handle from `defineDatabase`), `context` (adds
585
- * fields such as the signed-in user to every action's `ctx`), and `auth`,
727
+ * (`/api/<name>/<action>`) and appears in OpenAPI and the dashboard. Defining it
728
+ * again from the same file (a dev reload) replaces it; from another file throws.
729
+ * @param options - `database` (a handle from `defineDatabase`), `deps` (typed
730
+ * slots from `port<T>()` that `brick({ deps })` fills, read as `ctx.deps`),
731
+ * `context` (adds fields such as the signed-in user to every action's `ctx`),
732
+ * `events` (the event catalog: a payload schema per event name, recorded as
733
+ * `<service>.<name>` and offered as `service.events.<name>`), and `auth`,
586
734
  * `rateLimit`, `cache`, `resilience`, `telemetry`, and `lifecycle`.
587
735
  * @returns The service.
588
736
  * @example
@@ -604,7 +752,31 @@ export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>
604
752
  * ctx.db.select().from(pages).limit(input.limit ?? 20),
605
753
  * });
606
754
  */
607
- export declare function defineService<TDb = BunSQLiteDatabase<Record<string, unknown>>, TServiceContext extends Record<string, any> = Record<string, any>>(name: string, options?: ServiceOptions<TServiceContext, TDb>): Service<TDb, TServiceContext>;
755
+ export declare function defineService<TDb = BunSQLiteDatabase<Record<string, unknown>>, TServiceContext extends Record<string, any> = Record<string, any>, const TEvents extends EventCatalog = {}, const TName extends string = string, TPorts extends Ports = {}>(name: TName, options?: ServiceOptions<TServiceContext, TDb> & {
756
+ events?: TEvents;
757
+ deps?: TPorts;
758
+ }): Service<TDb, {} extends TPorts ? TServiceContext : TServiceContext & {
759
+ deps: DepsOf<TPorts>;
760
+ }, TEvents> & NamedService<TName>;
761
+ //#endregion
762
+ //#region src/socket-schema.d.ts
763
+ /** Keep validators browser-safe and reject schemas whose behavior cannot cross JSON. */
764
+ export declare function serializeSocketSchema(schema: TSchema$1): unknown;
765
+ //#endregion
766
+ //#region src/socket-redis.d.ts
767
+ interface RedisBrokerOptions {
768
+ /** Defaults to `REDIS_URL`, then `redis://localhost:6379`. */
769
+ url?: string;
770
+ /** Emits held while Redis is unreachable; older ones are dropped. Default 1000. */
771
+ queue?: number;
772
+ }
773
+ /**
774
+ * Fans socket emits and kicks out across processes through Redis pub/sub, one
775
+ * channel per room topic. An emit is a PUBLISH only: every process, the emitting
776
+ * one included, delivers it once to its own connections. Uses Bun's built-in
777
+ * Redis client and two connections, one to publish and one to subscribe.
778
+ */
779
+ export declare function redisBroker(options?: RedisBrokerOptions): SocketBroker;
608
780
  //#endregion
609
781
  //#region src/access.d.ts
610
782
  interface ActionAccessInfo {
@@ -658,6 +830,35 @@ export declare function getActionAccess(action: Action | object): ActionAccessIn
658
830
  * and always throw.
659
831
  */
660
832
  export declare function buildErrorHelpers<TErrors extends Record<string, ActionErrorDefinition>>(errorsDef?: TErrors): ErrorBuilder<TErrors>;
833
+ /**
834
+ * Define a reusable error. Spread it into the `errors` of any action, listener or
835
+ * command; give it a `details` schema and `error.CODE(message, details)` checks
836
+ * the details against it in types. The details are not validated at runtime.
837
+ *
838
+ * @example
839
+ * const SlugExists = defineError("SLUG_EXISTS", {
840
+ * status: 409,
841
+ * message: "Slug is already taken",
842
+ * details: t.Object({ slug: t.String() }),
843
+ * });
844
+ * // errors: { ...SlugExists } then error.SLUG_EXISTS(undefined, { slug })
845
+ */
846
+ export declare function defineError<const TCode extends string, TDetails extends TSchema$1 | undefined = undefined>(code: TCode, definition: {
847
+ status?: number;
848
+ message: string;
849
+ details?: TDetails;
850
+ }): { [K in TCode]: {
851
+ status?: number;
852
+ message: string;
853
+ } & (TDetails extends TSchema$1 ? {
854
+ details: TDetails;
855
+ } : {}); };
856
+ /** The `errors` map of an action, to re-declare in another action or listener: `errors: { ...errorsOf(charge) }`. */
857
+ export declare function errorsOf<TErrors extends Record<string, ActionErrorDefinition>>(action: {
858
+ config: {
859
+ errors?: TErrors;
860
+ };
861
+ }): TErrors;
661
862
  /**
662
863
  * Define an action: a typed, validated function that Brick serves over HTTP,
663
864
  * runs in-process, and exposes to the typed client and OpenAPI.
@@ -699,180 +900,66 @@ export declare function buildErrorHelpers<TErrors extends Record<string, ActionE
699
900
  export declare function defineAction<TInputSchema extends TSchema$1 | undefined = undefined, TOutputSchema extends TSchema$1 | undefined = undefined, TErrors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, TContext extends ActionContext = ActionContext>(config: ActionConfigWithAuthorize<TInputSchema, TOutputSchema, TErrors, TContext>): Action<TInputSchema, TOutputSchema, TErrors, TContext>;
700
901
  export declare function defineAction<TInputSchema extends TSchema$1 | undefined = undefined, TOutputSchema extends TSchema$1 | undefined = undefined, TErrors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, TContext extends ActionContext = ActionContext>(config: ActionConfigWithoutAuthorize<TInputSchema, TOutputSchema, TErrors, TContext>): Action<TInputSchema, TOutputSchema, TErrors, TContext>;
701
902
  //#endregion
702
- //#region src/resource.d.ts
703
- /** Declares a plugin host without registering actions or changing the schema. */
704
- export declare function defineResource<TTable = any, TCtx extends ActionContext = ActionContext, const O extends ResourceTypeOptions = ResourceTypeOptions>(service: Service<any, any>, config: ResourceConfig<TTable, TCtx> & O): Resource<TTable, TCtx, ResourceIdentity<TTable, O>>;
705
- //#endregion
706
- //#region src/rpc.d.ts
903
+ //#region src/kebab.d.ts
707
904
  /**
708
- * A typed way to call another service's actions in-process. Each property of
709
- * the proxy is an action of that service: call it with the action's input, and
710
- * optionally a call context.
711
- *
712
- * The call runs through the target's own validation and authorization, with the
713
- * target's database and context (never the caller's), and shows as an `rpc`
714
- * span in the trace. Only in-process dispatch exists: with `isMonolith: false`
715
- * a call throws. Use the typed client to call a service over HTTP.
716
- *
717
- * @param serviceName - The registered name of the service to call.
718
- * @param options - `from` (the calling service's name, which becomes `ctx.caller`
719
- * in the target and cannot be spoofed), `context` (defaults for every call), and
720
- * `isMonolith`.
721
- * @returns A proxy typed as `T`, usually the target's actions.
722
- * @throws On a call, when the service or the action is not registered.
723
- * @example
724
- * import { createServiceProxy } from "@brickkit/core";
725
- *
726
- * const pages = createServiceProxy<{ get(input: { id: string }): Promise<Page> }>(
727
- * "pages",
728
- * { from: "billing" },
729
- * );
730
- * const page = await pages.get({ id: "p_1" });
905
+ * The URL segment for a declared name: `orderBilling` becomes `order-billing`,
906
+ * `importCSV` becomes `import-csv`. Dots and existing dashes stay.
731
907
  */
732
- export declare function createServiceProxy<T extends Record<string, any>>(serviceName: string, options?: ProxyOptions): T;
908
+ export declare function kebabCase(name: string): string;
733
909
  //#endregion
734
- //#region src/events/listener.d.ts
735
- type ListenerConfig<TPayload> = {
736
- name: string;
737
- on: string | readonly string[];
738
- maxAttempts?: number;
739
- } & ({
740
- run: (delivery: EventDelivery<TPayload>) => void | Promise<void>;
741
- workflow?: never;
742
- } | {
743
- workflow: EventWorkflow<TPayload>;
744
- run?: never;
745
- });
746
- /**
747
- * Define a listener: code that runs for each event it listens for, after the write
748
- * that caused the event has been committed. Pass it to `brick({ events: {
749
- * listeners } })`.
750
- *
751
- * It either runs a handler (`run`) in the process that delivers events, or starts
752
- * a durable workflow (`workflow`) on the app's `events.world`. Delivery is at
753
- * least once. A handler that throws is retried later with a growing delay, then
754
- * parked as dead, so it can run again for the same event: use
755
- * `delivery.deliveryId` to make its work idempotent. A workflow needs no such
756
- * care: a delivery starts one run however often it is tried, and the workflow
757
- * retries its own steps.
758
- *
759
- * @param config - `name` (unique; it is part of each delivery's id), `on` (an
760
- * event name or a list of them; a trailing `*` matches a prefix, as in
761
- * `user.*`), `run` or `workflow`, and optionally `maxAttempts`.
762
- * @returns The listener.
763
- * @throws When the name is empty or contains `:`, `on` is empty, or the listener
764
- * has both or neither of `run` and `workflow`.
765
- * @example
766
- * import { brick, defineListener } from "@brickkit/core";
767
- *
768
- * const welcome = defineListener({
769
- * name: "welcome-email",
770
- * on: "user.create",
771
- * run: async ({ payload, deliveryId }) => {
772
- * await mailer.sendWelcome(payload.row.email, { idempotencyKey: deliveryId });
773
- * },
774
- * });
775
- *
776
- * export default brick({ services, events: { listeners: [welcome] } });
777
- * @example
778
- * // src/workflows/onboard.ts
779
- * export async function onboard(event: WorkflowEvent<CrudEventPayload>) {
780
- * "use workflow";
781
- * await sendWelcome(event.payload.row.email);
782
- * }
783
- *
784
- * defineListener({ name: "onboard", on: "user.create", workflow: onboard });
785
- */
786
- export declare function defineListener<TPayload = any>(config: ListenerConfig<TPayload>): EventListener<TPayload>;
787
- //#endregion
788
- //#region src/events/emit.d.ts
789
- /**
790
- * Record an event of your own from an action, a tool or a hook. Listeners get it
791
- * as they get a generated CRUD event, with the payload you give.
792
- *
793
- * By default the event is committed in a transaction of its own. Pass the `tx`
794
- * of a transaction you have open to commit it with your writes instead: then it
795
- * is delivered at the dispatcher's next poll, because Brick does not see your
796
- * commit. Nothing is recorded when no listener wants the event.
797
- *
798
- * @param ctx - The action context: its `db` finds the service's outbox, and its
799
- * `traceId` follows the event to its listeners.
800
- * @param name - The event name, such as `order.refunded`.
801
- * @param payload - JSON data for the listeners.
802
- * @param options - `tx`: an open transaction on the service's database. `source`:
803
- * what emitted it, shown to listeners.
804
- * @throws When the context's database has no outbox table, or the app has no
805
- * `events`.
806
- * @example
807
- * refund: service.action({
808
- * name: "refund",
809
- * execute: async ({ ctx, input }) => {
810
- * await ctx.db.update(orders).set({ status: "refunded" }).where(eq(orders.id, input.id));
811
- * await emitEvent(ctx, "order.refunded", { id: input.id });
812
- * },
813
- * });
814
- */
815
- export declare function emitEvent(ctx: {
816
- db?: unknown;
817
- traceId?: string;
818
- }, name: string, payload: unknown, options?: {
819
- tx?: unknown;
820
- source?: string;
821
- }): Promise<void>;
822
- //#endregion
823
- //#region src/events/transaction.d.ts
824
- /**
825
- * Run `fn` in a database transaction: everything it writes through the `tx` it is
826
- * given is committed together when it returns, or undone if it throws.
827
- *
828
- * Postgres uses a real transaction on one connection. SQLite has one connection
829
- * and a synchronous driver, which Drizzle's own `transaction` cannot use with an
830
- * async callback (it would commit before the callback finished). So transactions
831
- * on one SQLite database take turns, each between `BEGIN IMMEDIATE` and `COMMIT`.
832
- * A write made elsewhere in the process during that time, outside this helper,
833
- * would join the transaction; use Postgres where that matters.
834
- *
835
- * A call made inside `fn` with the `tx` it was given (on SQLite, the database
836
- * itself) joins the open transaction as a savepoint instead of waiting for it: a
837
- * nested failure undoes only the nested work, and the outer transaction decides
838
- * the commit. Nested calls must run one at a time.
839
- *
840
- * @param db - A Drizzle database, from `service.getDb()`.
841
- * @param fn - Receives the transaction handle to run queries on.
842
- * @returns What `fn` returned.
843
- * @throws What `fn` threw, after rolling back.
844
- */
845
- export declare function runInTransaction<T>(db: any, fn: (tx: any) => Promise<T>): Promise<T>;
910
+ //#region src/routes.d.ts
911
+ interface ActionRoute {
912
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
913
+ path: string;
914
+ /** The v0.10 path, served too by `brick({ legacyRoutes: true })`. */
915
+ legacyPath?: string;
916
+ }
846
917
  /**
847
- * Run `fn` once the transaction that `db` belongs to has committed, or now when
848
- * `db` is not in one opened by `runInTransaction`. It never runs when that
849
- * transaction, or the savepoint it was queued in, rolls back. An error it throws
850
- * reaches the caller of the outermost `runInTransaction`, after the commit.
918
+ * Where an action is served over HTTP: its method and its path under the owner
919
+ * tree (`${prefix}/${service}/${action}`, a plugin's route, or a resource
920
+ * action's `${prefix}/${service}/${resource}[/:id]/${action}`).
851
921
  *
852
- * @param db - The handle the work ran on: a `tx`, or a database.
853
- * @param fn - The side effect, such as clearing a cache.
922
+ * @param action - An action registered on a service.
923
+ * @param prefix - The application's route prefix (default `/api`).
924
+ * @returns `false` when a plugin switched the route off, otherwise the route.
854
925
  */
855
- export declare function onTransactionCommit(db: unknown, fn: () => unknown): Promise<void>;
926
+ export declare function getActionRoute(action: Action<any, any, any, any>, prefix?: string): ActionRoute | false;
927
+ /** Stamped on actions declared with `resource.action(...)`. */
928
+ interface ResourceActionInfo {
929
+ resource: string;
930
+ /** The declared name, without the `resource.` prefix. */
931
+ name: string;
932
+ record: boolean;
933
+ /** A record action's own access rule. */
934
+ access?: ResourceActionAccess;
935
+ }
856
936
  //#endregion
857
- //#region src/events/workflows.d.ts
937
+ //#region src/resource.d.ts
858
938
  /**
859
- * Where the workflow bundle is read from, and the project it is built from.
939
+ * Load the row a record action (or command) works on, through its `access`.
860
940
  *
861
- * @param options - The `events.workflows` option.
862
- * @returns Absolute `root` and `dir`. The bundle cannot live elsewhere: the
863
- * builder finds the SDK from where it writes, and skips only this directory when it
864
- * looks for workflows.
941
+ * @returns The row, or `undefined` when it is missing or hidden.
942
+ * @throws When `access` is missing.
865
943
  */
866
- export declare function resolveWorkflowPaths(options?: WorkflowsOptions): {
867
- root: string;
868
- dir: string;
869
- };
944
+ export declare function loadRecord(resource: Resource<any, any, any>, args: {
945
+ id: unknown;
946
+ ctx: any;
947
+ db?: any;
948
+ access?: ResourceActionAccess;
949
+ }): Promise<Record<string, unknown> | undefined>;
950
+ /** Declares a plugin host without registering actions or changing the schema. */
951
+ export declare function defineResource<TTable = any, TCtx extends ActionContext = ActionContext, const O extends ResourceTypeOptions = ResourceTypeOptions>(service: Service<any, any>, config: ResourceConfig<TTable, TCtx> & O): Resource<TTable, TCtx, ResourceIdentity<TTable, O>>;
870
952
  //#endregion
871
953
  //#region src/registry.d.ts
872
954
  interface ArchitectureApplication {
873
955
  services: readonly Service[];
874
956
  routes: readonly RouteIR[];
875
957
  events?: EventsDefinition;
958
+ sockets?: readonly (BrickSocketSchema & {
959
+ service: string;
960
+ path: string;
961
+ })[];
962
+ plugins?: readonly InstalledPlugin[];
876
963
  }
877
964
  export declare class ServiceRegistry {
878
965
  private _revision;
@@ -880,10 +967,12 @@ export declare class ServiceRegistry {
880
967
  get revision(): number;
881
968
  touch(): void;
882
969
  private services;
970
+ private sites;
883
971
  private routes;
884
972
  /** Remember the actual registered routes for subsequent registry exports. */
885
973
  setApplicationRoutes(application: ArchitectureApplication): void;
886
- register(service: Service): void;
974
+ /** @throws When a different file already registered a service with this name. */
975
+ register(service: Service, site?: string | undefined): void;
887
976
  get(name: string): Service | undefined;
888
977
  has(name: string): boolean;
889
978
  list(): Service[];
@@ -892,7 +981,7 @@ export declare class ServiceRegistry {
892
981
  }
893
982
  /**
894
983
  * The registry every `defineService` adds to: it is how `brick()`, the OpenAPI
895
- * generator, `createServiceProxy`, and the dashboard find services by name.
984
+ * generator, `useService`, and the dashboard find services by name.
896
985
  *
897
986
  * @returns The current global registry.
898
987
  */
@@ -951,7 +1040,8 @@ export declare function hoistAnchoredSchemas(spec: Record<string, any>): string[
951
1040
  * Build the OpenAPI 3.1 document for the services: one path per action route,
952
1041
  * with request and response schemas from the actions' TypeBox schemas, their
953
1042
  * declared errors, tags by service, and a bearer security scheme where any
954
- * action needs authorization.
1043
+ * action needs authorization. Declared events are listed under `x-brick-events`,
1044
+ * by wire name, with their service and payload schema.
955
1045
  *
956
1046
  * `brick()` calls this for `/openapi.json`; call it yourself to write the
957
1047
  * document to a file or feed another tool.
@@ -1057,5 +1147,5 @@ type ErrorContext = {
1057
1147
  */
1058
1148
  export declare function toErrorResponse(err: unknown, context: ErrorContext): ErrorEnvelope;
1059
1149
  //#endregion
1060
- export { Action, type ActionAccessInfo, ActionAccessPolicy, ActionConfig, ActionConfigWithAuthorize, ActionConfigWithoutAuthorize, ActionContext, ActionErrorDefinition, ActionExecutionError, ActionSchema, type ApiDocument, ArchitectureSchema, BaseActionConfig, BaseContext, type BrickActionCaller, type BrickApp, type BrickCallOptions, type BrickClient, type BrickClientAction, type BrickClientOptions, type BrickIR, BrickSQLiteDatabase, BrickServerError, BrickTransportError, type BunSQLiteDatabase, CacheOptions, type CompiledApplication, type CompiledHandler, type CompiledRoute, CompiledRoutePlan, type CreateServerOptions, type CrudEventPayload, type DashboardAuth, type DashboardOptions, DatabaseAdapter, DatabaseDefinition, DatabaseHandle, DefaultServiceContext, type DispatchOptions, Dispatcher, type DocumentationOptions, type EndpointContext, type EndpointDefinition, type EndpointLogger, type EndpointMethod, EnvInput, ErrorBuilder, type ErrorEnvelope, type EventDelivery, type EventEnvelope, type EventListener, type EventRecorder, type EventWorkflow, type EventsDefinition, EventsHub, type EventsOptions, type EventsWorld, type HandlerFactory, type InferActionErrorCodes, type InferActionFailure, type InferActionInput, type InferActionOutput, InferTableInsert, InferTableRow, LifecycleOptions, Logger, type McpHandlerOptions, type McpRegistry, type McpRegistryOptions, type McpToolDefinition, NarrowAuthorizedContext, type OpenApiDocument, type OpenApiGeneratorOptions, type OutboxCounts, type OutboxStatus, type OutboxTable, type PluginEndpointContext, type PluginRouteMethod, type PluginRouteRegistrar, type PluginRouteScope, type PluginRoutes, PostgresDatabase, PostgresDatabaseConfig, PostgresDefinition, type PostgresOutboxTable, PreparationContribution, ProxyOptions, RateLimitOptions, type ReferenceDocument, type ReferenceOptions, type RequestLoggingOptions, ResilienceOptions, Resource, ResourceConfig, ResourceIdentity, type ResourcePlugin, type ResourcePluginAPI, type ResourcePluginContext, type ResourcePluginTypes, ResourceTypeOptions, type RouteIR, type RouteMethod, SQLiteDatabaseConfig, SQLiteDefinition, type SQLiteOutboxTable, type SecretOptions, SecretRef, type SecretSource, Service, ServiceAuthOptions, type ServiceEvents, ServiceOptions, type ServicePlugin, type ServicePluginContext, ServiceSchema, StandardErrorMap, type Static, type TSchema, Table, TelemetryOptions, Tool, ToolAnnotations, ToolConfigWithAuthorize, ToolConfigWithoutAuthorize, ToolOptions, Type, Type as t, ValidationError, ValidationErrorItem, type WorkflowEvent, type WorkflowsOptions, and, asc, blob, createBrickClient, createPostgresDatabase, createSQLiteDatabase, defineDatabase, defineResourcePlugin, defineServicePlugin, desc, envSource, eq, foreignKey, getPluginActionRoute, getPluginEndpoints, getTableColumns, getTableName, gt, gte, ilike, inArray, index, integer, is, isBrickServerError, isBrickTransportError, isDatabaseHandle, isNotNull, isNull, isOutboxTable, like, listSecrets, lt, lte, ne, not, notInArray, or, outboxTable, overrideSecret, overrideSecrets, primaryKey, real, relations, resetSecrets, resolveSecrets, secret, sql, sqliteTable, stopAllEvents, text, uniqueIndex };
1150
+ export { Action, type ActionAccessInfo, ActionAccessPolicy, ActionConfig, ActionConfigWithAuthorize, ActionConfigWithoutAuthorize, ActionContext, ActionErrorDefinition, ActionExecutionError, type ActionRoute, ActionSchema, type ApiDocument, ArchitectureSchema, BaseActionConfig, BaseContext, type BrickActionCaller, type BrickApp, type BrickCallOptions, type BrickClient, type BrickClientAction, type BrickClientOptions, type BrickIR, BrickSQLiteDatabase, BrickServerError, type BrickServices, type BrickSocketConfig, type BrickSocketHandle, type BrickSocketSchema, type BrickSocketSender, BrickTransportError, type BunSQLiteDatabase, CacheOptions, ChildChanges, Command, CommandChildren, CommandConfig, CommandDecision, CommandErrors, CommandRow, type CompiledApplication, type CompiledHandler, type CompiledRoute, CompiledRoutePlan, type CreateServerOptions, type CrudEventPayload, type DashboardAuth, type DashboardOptions, DatabaseAdapter, DatabaseDefinition, DatabaseHandle, DefaultServiceContext, type DepsOf, type DispatchOptions, Dispatcher, type DocumentationOptions, type EndpointContext, type EndpointDefinition, type EndpointLogger, type EndpointMethod, EnvInput, ErrorBuilder, ErrorDetails, type ErrorEnvelope, type EventCatalog, type EventDelivery, type EventEnvelope, type EventListener, type EventRecorder, type EventRef, type EventRefs, type EventWorkflow, type EventsDefinition, EventsHub, type EventsOptions, type EventsWorld, type HandlerFactory, type InferActionErrorCodes, type InferActionFailure, type InferActionInput, type InferActionOutput, InferTableInsert, InferTableRow, type InstalledPlugin, LifecycleOptions, type ListenerFailure, Logger, type McpHandlerOptions, type McpRegistry, type McpRegistryOptions, type McpToolDefinition, NarrowAuthorizedContext, type OpenApiDocument, type OpenApiGeneratorOptions, type OutboxCounts, type OutboxStatus, type OutboxTable, type PluginAppContext, type PluginContext, type PluginEndpointContext, type PluginFactory, 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 Port, type Ports, PostgresDatabase, PostgresDatabaseConfig, PostgresDefinition, type PostgresOutboxTable, PreparationContribution, ProxyOptions, RateLimitOptions, type RedisBrokerOptions, type ReferenceDocument, type ReferenceOptions, type RequestLoggingOptions, ResilienceOptions, Resource, ResourceActionAccess, ResourceActionConfig, type ResourceActionInfo, ResourceActionInput, ResourceChild, ResourceConfig, ResourceIdentity, type ResourcePlugin, type ResourcePluginAPI, type ResourcePluginContext, type ResourcePluginTypes, ResourceTypeOptions, type RetryDecision, type RouteIR, type RouteMethod, SQLiteDatabaseConfig, SQLiteDefinition, type SQLiteOutboxTable, type SecretOptions, SecretRef, type SecretSource, Service, type ServiceActionCaller, ServiceAuthOptions, type ServiceClient, type ServiceEvents, ServiceOptions, type ServicePlugin, type ServicePluginContext, ServiceSchema, type SocketBroker, type SocketBrokerMessage, type SocketEmitArgs, type SocketEmitOptions, type SocketEventArgs, type SocketPayloads, type SocketReplay, type SocketSchemas, StandardErrorMap, type Static, type TSchema, Table, TelemetryOptions, Tool, ToolAnnotations, ToolConfigWithAuthorize, ToolConfigWithoutAuthorize, ToolOptions, Type, Type as t, type UntypedServiceClient, ValidationError, ValidationErrorItem, type WorkflowEvent, type WorkflowsOptions, and, asc, blob, brickVersion, createBrickClient, createPostgresDatabase, createSQLiteDatabase, defineDatabase, defineListener, definePlugin, defineResourcePlugin, defineSecret, defineServicePlugin, desc, emitEvent, envSource, eq, foreignKey, getPluginActionRoute, getPluginEndpoints, getTableColumns, getTableName, gt, gte, ilike, inArray, index, integer, is, isBrickServerError, isBrickTransportError, isDatabaseHandle, isEventRef, isNotNull, isNull, isOutboxTable, isPluginInstance, like, listSecrets, lt, lte, ne, not, notInArray, or, outboxTable, overrideSecret, overrideSecrets, port, primaryKey, real, relations, resetSecrets, resolveSecrets, resolveWorkflowPaths, satisfiesRange, sql, sqliteTable, stopAllEvents, text, uniqueIndex, useDeps };
1061
1151
  //# sourceMappingURL=index.d.ts.map