@brickkit/core 0.10.0 → 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 overrideSecret, A as ErrorBuilder, An as getPluginActionRoute, At as WorkflowsOptions, B as Resource, Bt as PostgresDefinition, C as ActionSchema, Cn as ResourcePluginAPI, Ct as EventListener, D as CacheOptions, Dn as ServicePluginContext, Dt as EventsWorld, E as BaseContext, En as ServicePlugin, Et as EventsOptions, F as NarrowAuthorizedContext, Ft as isOutboxTable, G as ServiceAuthOptions, Gt as PostgresDatabase, H as ResourceIdentity, Ht as defineDatabase, I as PreparationContribution, It as outboxTable, J as StandardErrorMap, Jt as SecretOptions, K as ServiceOptions, Kt as PostgresDatabaseConfig, L as ProxyOptions, Lt as DatabaseDefinition, M as InferTableRow, Mt as OutboxTable, N as LifecycleOptions, Nt as PostgresOutboxTable, O as CompiledRoutePlan, On as defineResourcePlugin, Ot as ServiceEvents, P as Logger, Pt as SQLiteOutboxTable, Q as ToolConfigWithAuthorize, Qt as listSecrets, R as RateLimitOptions, Rt as DatabaseHandle, S as ActionExecutionError, Sn as ResourcePlugin, St as EventEnvelope, T as BaseActionConfig, Tn as ResourcePluginTypes, Tt as EventWorkflow, U as ResourceTypeOptions, Ut as isDatabaseHandle, V as ResourceConfig, Vt as SQLiteDefinition, W as Service, Wt as DatabaseAdapter, X as Tool, Xt as SecretSource, Y as TelemetryOptions, Yt as SecretRef, Z as ToolAnnotations, Zt as envSource, _ as ActionConfig, _n as PluginEndpointContext, _t as Dispatcher, a as BrickClientOptions, an as BunSQLiteDatabase, b as ActionContext, bn as PluginRouteScope, bt as DispatchOptions, c as InferActionErrorCodes, cn as createSQLiteDatabase, d as InferActionOutput, dn as integer, dt as SocketEventArgs, en as overrideSecrets, et as ToolOptions, f as createBrickClient, fn as primaryKey, ft as SocketPayloads, g as ActionAccessPolicy, gn as uniqueIndex, gt as stopAllEvents, h as Action, hn as text, ht as EventsHub, i as BrickClientAction, in as BrickSQLiteDatabase, j as InferTableInsert, jn as getPluginEndpoints, jt as OutboxStatus, k as DefaultServiceContext, kn as defineServicePlugin, kt as WorkflowEvent, l as InferActionFailure, ln as foreignKey, lt as BrickSocketSchema, m as isBrickTransportError, mn as sqliteTable, mt as EventsDefinition, n as BrickCallOptions, nn as resolveSecrets, nt as ValidationErrorItem, o as BrickServerError, on as SQLiteDatabaseConfig, ot as BrickSocketConfig, p as isBrickServerError, pn as real, pt as SocketSchemas, q as ServiceSchema, qt as createPostgresDatabase, r as BrickClient, rn as secret, rt as RegisteredSocket, s as BrickTransportError, sn as blob, t as BrickActionCaller, tn as resetSecrets, tt as ValidationError, u as InferActionInput, un as index, ut as BrickSocketSender, v as ActionConfigWithAuthorize, vn as PluginRouteMethod, vt as OutboxCounts, w as ArchitectureSchema, wn as ResourcePluginContext, wt as EventRecorder, x as ActionErrorDefinition, xn as PluginRoutes, xt as EventDelivery, y as ActionConfigWithoutAuthorize, yn as PluginRouteRegistrar, yt as CrudEventPayload, z as ResilienceOptions, zt as EnvInput } 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;
@@ -204,7 +240,15 @@ type BrickApp = Elysia<any, any, any, any, any, any, any> & {
204
240
  readonly dashboard?: DashboardOptions;
205
241
  /** The listeners and settings of `events`, as plain data. */
206
242
  readonly events?: EventsDefinition;
243
+ /** Every `definePlugin` installation, in install order. */
244
+ readonly plugins?: readonly InstalledPlugin[];
207
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>;
208
252
  /**
209
253
  * The events of this app, when `events` is set: start and stop delivery, drain
210
254
  * what is due, and see or retry what is parked. `brick dev` and `brick start`
@@ -381,6 +425,37 @@ interface CreateServerOptions {
381
425
  * and an app without this option behaves exactly as before. See `EventsOptions`.
382
426
  */
383
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>[];
384
459
  }
385
460
  /**
386
461
  * Create the HTTP application: an Elysia app that serves every service's
@@ -396,11 +471,11 @@ interface CreateServerOptions {
396
471
  * @param options - `prefix` for action routes (default `/api`), `services`,
397
472
  * `title`, `version`, and `description` for the OpenAPI document, `docs` and the
398
473
  * paths of its pages, `requestLogging`, `reference`, `endpoints`, `secrets`,
399
- * `telemetry`, `documentation`, and `dashboard`. See `CreateServerOptions`.
474
+ * `telemetry`, `documentation`, `dashboard`, and `deps`. See `CreateServerOptions`.
400
475
  * @returns The app, with `definition` (its services, prefix, and routes),
401
476
  * `endpoint()` to add raw routes, and `listEndpoints()` to list them.
402
- * @throws When a required secret is missing, or `documentation` or `dashboard`
403
- * 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.
404
479
  * @example
405
480
  * import { brick } from "@brickkit/core";
406
481
  * import { pagesService } from "./services/pages";
@@ -524,6 +599,55 @@ export declare function buildFtsMatchQuery(search: string): string | null;
524
599
  */
525
600
  export declare function syncSchema(tablesOrService: Map<string, any> | any[] | Record<string, any> | Service, dbInstance?: any): Promise<void> | void;
526
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
527
651
  //#region src/service.d.ts
528
652
  export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>>, TServiceContext extends Record<string, any> = Record<string, any>> implements Service<TDb, TServiceContext> {
529
653
  readonly name: string;
@@ -532,10 +656,14 @@ export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>
532
656
  readonly tools: Map<string, Tool<any, any, any, any>>;
533
657
  readonly tables: Map<string, any>;
534
658
  private readonly sockets;
535
- readonly resources: Map<string, Resource<any, BaseContext<TDb> & TServiceContext, {}>>;
659
+ readonly resources: Map<string, Resource<any, BaseContext<TDb> & TServiceContext, {}, EventCatalog>>;
536
660
  readonly preparations: Map<string, PreparationContribution>;
661
+ /** Where each `kind:name` was defined, to reject duplicates from another file. */
662
+ private readonly sites;
537
663
  private database?;
538
664
  private _isBuilt;
665
+ /** The declared events: `service.events.<name>`. */
666
+ readonly events: Readonly<Record<string, EventRef>>;
539
667
  constructor(name: string, options?: ServiceOptions<TServiceContext, TDb>);
540
668
  use<A>(plugin: ServicePlugin<this, A>): A;
541
669
  get db(): TDb | undefined;
@@ -544,6 +672,7 @@ export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>
544
672
  * Closes declarations after plugins have registered their actions and preparations.
545
673
  */
546
674
  build(): this;
675
+ private claim;
547
676
  contributePreparation(contribution: PreparationContribution): void;
548
677
  listPreparations(): PreparationContribution[];
549
678
  prepareContributions(): void;
@@ -558,16 +687,25 @@ export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>
558
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>;
559
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>;
560
689
  getTool(name: string): Tool<any, any, any, any> | undefined;
561
- socket<const I extends SocketSchemas, const O extends SocketSchemas>(config: BrickSocketConfig<I, O, BaseContext<TDb> & TServiceContext>): this;
690
+ socket<const I extends SocketSchemas, const O extends SocketSchemas>(config: BrickSocketConfig<I, O, BaseContext<TDb> & TServiceContext>): BrickSocketHandle<SocketPayloads<O>>;
562
691
  listSockets(): RegisteredSocket[];
563
692
  listTools(): Tool<any, any, any, any>[];
564
693
  getAction(name: string): Action<any, any, any, any> | undefined;
565
694
  listActions(): Action<any, any, any, any>[];
566
695
  getDb(): TDb | undefined;
696
+ /** The handle from `defineDatabase`, without connecting. */
697
+ getDatabaseHandle(): DatabaseHandle<TDb> | undefined;
567
698
  /** What a write needs to record events. Set by `brick({ events })`. */
568
- events?: ServiceEvents;
699
+ recorder?: ServiceEvents;
569
700
  getOutbox(): OutboxTable | undefined;
570
- 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;
571
709
  setDb(database: DatabaseHandle<TDb>): void;
572
710
  /**
573
711
  * Resolves the complete service execution context once per incoming request.
@@ -580,16 +718,19 @@ export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>
580
718
  /**
581
719
  * Declare a service: a named group of actions, tools, and resources with its own
582
720
  * database and request context. It is registered globally, so `brick()`, the
583
- * OpenAPI generator, and `createServiceProxy` find it by name.
721
+ * OpenAPI generator, and `useService` find it by name.
584
722
  *
585
723
  * Add actions with `service.action(...)`, tools with `service.tool(...)`,
586
724
  * resources with `service.resource(...)`, and plugins with `service.use(...)`.
587
725
  *
588
726
  * @param name - Unique name. It is the service's segment of every action route
589
- * (`/api/<name>/<action>`) and appears in OpenAPI and the dashboard. Defining a
590
- * second service with the same name replaces the first and logs a warning.
591
- * @param options - `database` (a handle from `defineDatabase`), `context` (adds
592
- * 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`,
593
734
  * `rateLimit`, `cache`, `resilience`, `telemetry`, and `lifecycle`.
594
735
  * @returns The service.
595
736
  * @example
@@ -611,12 +752,32 @@ export declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>
611
752
  * ctx.db.select().from(pages).limit(input.limit ?? 20),
612
753
  * });
613
754
  */
614
- 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>;
615
761
  //#endregion
616
762
  //#region src/socket-schema.d.ts
617
763
  /** Keep validators browser-safe and reject schemas whose behavior cannot cross JSON. */
618
764
  export declare function serializeSocketSchema(schema: TSchema$1): unknown;
619
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;
780
+ //#endregion
620
781
  //#region src/access.d.ts
621
782
  interface ActionAccessInfo {
622
783
  hasAuthorize: boolean;
@@ -669,6 +830,35 @@ export declare function getActionAccess(action: Action | object): ActionAccessIn
669
830
  * and always throw.
670
831
  */
671
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;
672
862
  /**
673
863
  * Define an action: a typed, validated function that Brick serves over HTTP,
674
864
  * runs in-process, and exposes to the typed client and OpenAPI.
@@ -710,174 +900,55 @@ export declare function buildErrorHelpers<TErrors extends Record<string, ActionE
710
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>;
711
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>;
712
902
  //#endregion
713
- //#region src/resource.d.ts
714
- /** Declares a plugin host without registering actions or changing the schema. */
715
- 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>>;
716
- //#endregion
717
- //#region src/rpc.d.ts
718
- /**
719
- * A typed way to call another service's actions in-process. Each property of
720
- * the proxy is an action of that service: call it with the action's input, and
721
- * optionally a call context.
722
- *
723
- * The call runs through the target's own validation and authorization, with the
724
- * target's database and context (never the caller's), and shows as an `rpc`
725
- * span in the trace. Only in-process dispatch exists: with `isMonolith: false`
726
- * a call throws. Use the typed client to call a service over HTTP.
727
- *
728
- * @param serviceName - The registered name of the service to call.
729
- * @param options - `from` (the calling service's name, which becomes `ctx.caller`
730
- * in the target and cannot be spoofed), `context` (defaults for every call), and
731
- * `isMonolith`.
732
- * @returns A proxy typed as `T`, usually the target's actions.
733
- * @throws On a call, when the service or the action is not registered.
734
- * @example
735
- * import { createServiceProxy } from "@brickkit/core";
736
- *
737
- * const pages = createServiceProxy<{ get(input: { id: string }): Promise<Page> }>(
738
- * "pages",
739
- * { from: "billing" },
740
- * );
741
- * const page = await pages.get({ id: "p_1" });
742
- */
743
- export declare function createServiceProxy<T extends Record<string, any>>(serviceName: string, options?: ProxyOptions): T;
744
- //#endregion
745
- //#region src/events/listener.d.ts
746
- type ListenerConfig<TPayload> = {
747
- name: string;
748
- on: string | readonly string[];
749
- maxAttempts?: number;
750
- } & ({
751
- run: (delivery: EventDelivery<TPayload>) => void | Promise<void>;
752
- workflow?: never;
753
- } | {
754
- workflow: EventWorkflow<TPayload>;
755
- run?: never;
756
- });
757
- /**
758
- * Define a listener: code that runs for each event it listens for, after the write
759
- * that caused the event has been committed. Pass it to `brick({ events: {
760
- * listeners } })`.
761
- *
762
- * It either runs a handler (`run`) in the process that delivers events, or starts
763
- * a durable workflow (`workflow`) on the app's `events.world`. Delivery is at
764
- * least once. A handler that throws is retried later with a growing delay, then
765
- * parked as dead, so it can run again for the same event: use
766
- * `delivery.deliveryId` to make its work idempotent. A workflow needs no such
767
- * care: a delivery starts one run however often it is tried, and the workflow
768
- * retries its own steps.
769
- *
770
- * @param config - `name` (unique; it is part of each delivery's id), `on` (an
771
- * event name or a list of them; a trailing `*` matches a prefix, as in
772
- * `user.*`), `run` or `workflow`, and optionally `maxAttempts`.
773
- * @returns The listener.
774
- * @throws When the name is empty or contains `:`, `on` is empty, or the listener
775
- * has both or neither of `run` and `workflow`.
776
- * @example
777
- * import { brick, defineListener } from "@brickkit/core";
778
- *
779
- * const welcome = defineListener({
780
- * name: "welcome-email",
781
- * on: "user.create",
782
- * run: async ({ payload, deliveryId }) => {
783
- * await mailer.sendWelcome(payload.row.email, { idempotencyKey: deliveryId });
784
- * },
785
- * });
786
- *
787
- * export default brick({ services, events: { listeners: [welcome] } });
788
- * @example
789
- * // src/workflows/onboard.ts
790
- * export async function onboard(event: WorkflowEvent<CrudEventPayload>) {
791
- * "use workflow";
792
- * await sendWelcome(event.payload.row.email);
793
- * }
794
- *
795
- * defineListener({ name: "onboard", on: "user.create", workflow: onboard });
796
- */
797
- export declare function defineListener<TPayload = any>(config: ListenerConfig<TPayload>): EventListener<TPayload>;
798
- //#endregion
799
- //#region src/events/emit.d.ts
903
+ //#region src/kebab.d.ts
800
904
  /**
801
- * Record an event of your own from an action, a tool or a hook. Listeners get it
802
- * as they get a generated CRUD event, with the payload you give.
803
- *
804
- * By default the event is committed in a transaction of its own. Pass the `tx`
805
- * of a transaction you have open to commit it with your writes instead: then it
806
- * is delivered at the dispatcher's next poll, because Brick does not see your
807
- * commit. Nothing is recorded when no listener wants the event.
808
- *
809
- * @param ctx - The action context: its `db` finds the service's outbox, and its
810
- * `traceId` follows the event to its listeners.
811
- * @param name - The event name, such as `order.refunded`.
812
- * @param payload - JSON data for the listeners.
813
- * @param options - `tx`: an open transaction on the service's database. `source`:
814
- * what emitted it, shown to listeners.
815
- * @throws When the context's database has no outbox table, or the app has no
816
- * `events`.
817
- * @example
818
- * refund: service.action({
819
- * name: "refund",
820
- * execute: async ({ ctx, input }) => {
821
- * await ctx.db.update(orders).set({ status: "refunded" }).where(eq(orders.id, input.id));
822
- * await emitEvent(ctx, "order.refunded", { id: input.id });
823
- * },
824
- * });
905
+ * The URL segment for a declared name: `orderBilling` becomes `order-billing`,
906
+ * `importCSV` becomes `import-csv`. Dots and existing dashes stay.
825
907
  */
826
- export declare function emitEvent(ctx: {
827
- db?: unknown;
828
- traceId?: string;
829
- }, name: string, payload: unknown, options?: {
830
- tx?: unknown;
831
- source?: string;
832
- }): Promise<void>;
908
+ export declare function kebabCase(name: string): string;
833
909
  //#endregion
834
- //#region src/events/transaction.d.ts
835
- /**
836
- * Run `fn` in a database transaction: everything it writes through the `tx` it is
837
- * given is committed together when it returns, or undone if it throws.
838
- *
839
- * Postgres uses a real transaction on one connection. SQLite has one connection
840
- * and a synchronous driver, which Drizzle's own `transaction` cannot use with an
841
- * async callback (it would commit before the callback finished). So transactions
842
- * on one SQLite database take turns, each between `BEGIN IMMEDIATE` and `COMMIT`.
843
- * A write made elsewhere in the process during that time, outside this helper,
844
- * would join the transaction; use Postgres where that matters.
845
- *
846
- * A call made inside `fn` with the `tx` it was given (on SQLite, the database
847
- * itself) joins the open transaction as a savepoint instead of waiting for it: a
848
- * nested failure undoes only the nested work, and the outer transaction decides
849
- * the commit. Nested calls must run one at a time.
850
- *
851
- * @param db - A Drizzle database, from `service.getDb()`.
852
- * @param fn - Receives the transaction handle to run queries on.
853
- * @returns What `fn` returned.
854
- * @throws What `fn` threw, after rolling back.
855
- */
856
- 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
+ }
857
917
  /**
858
- * Run `fn` once the transaction that `db` belongs to has committed, or now when
859
- * `db` is not in one opened by `runInTransaction`. It never runs when that
860
- * transaction, or the savepoint it was queued in, rolls back. An error it throws
861
- * 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}`).
862
921
  *
863
- * @param db - The handle the work ran on: a `tx`, or a database.
864
- * @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.
865
925
  */
866
- 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
+ }
867
936
  //#endregion
868
- //#region src/events/workflows.d.ts
937
+ //#region src/resource.d.ts
869
938
  /**
870
- * 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`.
871
940
  *
872
- * @param options - The `events.workflows` option.
873
- * @returns Absolute `root` and `dir`. The bundle cannot live elsewhere: the
874
- * builder finds the SDK from where it writes, and skips only this directory when it
875
- * looks for workflows.
941
+ * @returns The row, or `undefined` when it is missing or hidden.
942
+ * @throws When `access` is missing.
876
943
  */
877
- export declare function resolveWorkflowPaths(options?: WorkflowsOptions): {
878
- root: string;
879
- dir: string;
880
- };
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>>;
881
952
  //#endregion
882
953
  //#region src/registry.d.ts
883
954
  interface ArchitectureApplication {
@@ -888,6 +959,7 @@ interface ArchitectureApplication {
888
959
  service: string;
889
960
  path: string;
890
961
  })[];
962
+ plugins?: readonly InstalledPlugin[];
891
963
  }
892
964
  export declare class ServiceRegistry {
893
965
  private _revision;
@@ -895,10 +967,12 @@ export declare class ServiceRegistry {
895
967
  get revision(): number;
896
968
  touch(): void;
897
969
  private services;
970
+ private sites;
898
971
  private routes;
899
972
  /** Remember the actual registered routes for subsequent registry exports. */
900
973
  setApplicationRoutes(application: ArchitectureApplication): void;
901
- 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;
902
976
  get(name: string): Service | undefined;
903
977
  has(name: string): boolean;
904
978
  list(): Service[];
@@ -907,7 +981,7 @@ export declare class ServiceRegistry {
907
981
  }
908
982
  /**
909
983
  * The registry every `defineService` adds to: it is how `brick()`, the OpenAPI
910
- * generator, `createServiceProxy`, and the dashboard find services by name.
984
+ * generator, `useService`, and the dashboard find services by name.
911
985
  *
912
986
  * @returns The current global registry.
913
987
  */
@@ -966,7 +1040,8 @@ export declare function hoistAnchoredSchemas(spec: Record<string, any>): string[
966
1040
  * Build the OpenAPI 3.1 document for the services: one path per action route,
967
1041
  * with request and response schemas from the actions' TypeBox schemas, their
968
1042
  * declared errors, tags by service, and a bearer security scheme where any
969
- * 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.
970
1045
  *
971
1046
  * `brick()` calls this for `/openapi.json`; call it yourself to write the
972
1047
  * document to a file or feed another tool.
@@ -1072,5 +1147,5 @@ type ErrorContext = {
1072
1147
  */
1073
1148
  export declare function toErrorResponse(err: unknown, context: ErrorContext): ErrorEnvelope;
1074
1149
  //#endregion
1075
- 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, type BrickSocketConfig, type BrickSocketSchema, type BrickSocketSender, 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, type SocketEventArgs, type SocketPayloads, type SocketSchemas, 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 };
1076
1151
  //# sourceMappingURL=index.d.ts.map