@brickkit/core 0.7.4 → 0.8.1
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/README.md +34 -80
- package/dist/chunks/client.d.ts +122 -3
- package/dist/chunks/client.d.ts.map +1 -1
- package/dist/chunks/client.js +264 -0
- package/dist/chunks/client.js.map +1 -0
- package/dist/client.js +1 -206
- package/dist/index.d.ts +902 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3284 -4
- package/dist/index.js.map +1 -1
- package/dist/tanstack-query.js +1 -1
- package/package.json +5 -6
- package/dist/chunks/effect.d.ts +0 -583
- package/dist/chunks/effect.d.ts.map +0 -1
- package/dist/chunks/effect.js +0 -2965
- package/dist/chunks/effect.js.map +0 -1
- package/dist/chunks/types.js +0 -46
- package/dist/chunks/types.js.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/effect.d.ts +0 -3
- package/dist/effect.js +0 -1
package/dist/tanstack-query.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createBrickClient } from "./client.js";
|
|
1
|
+
import { r as createBrickClient } from "./chunks/client.js";
|
|
2
2
|
//#region src/tanstack-query.ts
|
|
3
3
|
/** Query helpers share the ordinary Brick HTTP client, including custom routes. */
|
|
4
4
|
function createBrickQueryClient(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brickkit/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Core engine primitives for the Brick-TS framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -33,10 +33,6 @@
|
|
|
33
33
|
"import": "./dist/pg.js",
|
|
34
34
|
"types": "./dist/pg.d.ts"
|
|
35
35
|
},
|
|
36
|
-
"./effect": {
|
|
37
|
-
"import": "./dist/effect.js",
|
|
38
|
-
"types": "./dist/effect.d.ts"
|
|
39
|
-
},
|
|
40
36
|
"./tanstack-query": {
|
|
41
37
|
"import": "./dist/tanstack-query.js",
|
|
42
38
|
"types": "./dist/tanstack-query.d.ts"
|
|
@@ -63,13 +59,16 @@
|
|
|
63
59
|
"format:check": "oxfmt --check ."
|
|
64
60
|
},
|
|
65
61
|
"dependencies": {
|
|
62
|
+
"@opentelemetry/api": "^1.9.1",
|
|
66
63
|
"@sinclair/typebox": "^0.34.52",
|
|
67
64
|
"drizzle-orm": "^0.45.2",
|
|
68
|
-
"effect": "^4",
|
|
69
65
|
"elysia": "2.0.0-beta.29",
|
|
70
66
|
"postgres": "^3.4.9"
|
|
71
67
|
},
|
|
72
68
|
"devDependencies": {
|
|
69
|
+
"@opentelemetry/context-async-hooks": "^2.12.0",
|
|
70
|
+
"@opentelemetry/core": "^2.12.0",
|
|
71
|
+
"@opentelemetry/sdk-trace-base": "^2.12.0",
|
|
73
72
|
"@tanstack/query-core": "5.104.3",
|
|
74
73
|
"@tanstack/vue-query": "5.104.3",
|
|
75
74
|
"@types/bun": "^1.4.3",
|
package/dist/chunks/effect.d.ts
DELETED
|
@@ -1,583 +0,0 @@
|
|
|
1
|
-
import { $ as ToolConfigWithoutAuthorize, A as ErrorBuilder, B as Resource, E as BaseContext, Et as SQLiteDatabaseConfig, H as ResourceIdentity, Ht as ResourcePlugin, I as PreparationContribution, K as ServiceOptions, Kt as ServicePlugin, L as ProxyOptions, Lt as PluginEndpointContext, N as LifecycleOptions, O as CompiledRoutePlan, P as Logger, Q as ToolConfigWithAuthorize, S as ActionExecutionError, Tt as BunSQLiteDatabase, U as ResourceTypeOptions, V as ResourceConfig, W as Service, Wt as ResourcePluginContext, X as Tool, Z as ToolAnnotations, b as ActionContext, dt as PostgresDatabase, et as ToolOptions, ft as PostgresDatabaseConfig, g as ActionAccessPolicy, gt as SecretSource, h as Action, it as DatabaseHandle, nt as ValidationErrorItem, q as ServiceSchema, qt as ServicePluginContext, tt as ValidationError, v as ActionConfigWithAuthorize, w as ArchitectureSchema, x as ActionErrorDefinition, y as ActionConfigWithoutAuthorize, zt as PluginRouteRegistrar } from "./client.js";
|
|
2
|
-
import { Effect, Layer, ManagedRuntime } from "effect";
|
|
3
|
-
import { Static as Static$1, TSchema, TSchema as TSchema$1, Type } from "@sinclair/typebox";
|
|
4
|
-
import { TypeCheck } from "@sinclair/typebox/compiler";
|
|
5
|
-
import { Elysia } from "elysia";
|
|
6
|
-
import { Table as Table$1, and, asc, desc, eq, getTableColumns as getTableColumns$1, getTableName as getTableName$1, gt, gte, ilike, inArray, is, isNotNull, isNull, like, lt, lte, ne, not, notInArray, or, relations, sql as sql$1 } from "drizzle-orm";
|
|
7
|
-
//#region src/effect-service.d.ts
|
|
8
|
-
type EffectRegistration<C extends BaseContext<any>, R> = {
|
|
9
|
-
<I extends TSchema | undefined = undefined, O extends TSchema | undefined = undefined, Errors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, E = never, Q = never>(config: EffectActionConfigWithAuthorize<I, O, Errors, C, E, Q>): EffectAction<I, O, Errors, C, E, R | Q>;
|
|
10
|
-
<I extends TSchema | undefined = undefined, O extends TSchema | undefined = undefined, Errors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, E = never, Q = never>(config: EffectActionConfigWithoutAuthorize<I, O, Errors, C, E, Q>): EffectAction<I, O, Errors, C, E, R | Q>;
|
|
11
|
-
(action: EffectAction<any, any, any, C, any, any>): EffectService<any, any, R>;
|
|
12
|
-
};
|
|
13
|
-
type EffectToolRegistration<C extends BaseContext<any>, R> = {
|
|
14
|
-
<I extends TSchema | undefined = undefined, O extends TSchema | undefined = undefined, Errors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, E = never, Q = never>(config: EffectActionConfigWithAuthorize<I, O, Errors, C, E, Q> & ToolOptions): EffectTool<I, O, Errors, C, E, R | Q>;
|
|
15
|
-
<I extends TSchema | undefined = undefined, O extends TSchema | undefined = undefined, Errors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, E = never, Q = never>(config: EffectActionConfigWithoutAuthorize<I, O, Errors, C, E, Q> & ToolOptions): EffectTool<I, O, Errors, C, E, R | Q>;
|
|
16
|
-
(action: EffectTool<any, any, any, C, any, any>): EffectService<any, any, R>;
|
|
17
|
-
};
|
|
18
|
-
type EffectServiceOptions<C extends Record<string, any>, D, R = never> = Omit<ServiceOptions<C, D>, "context" | "lifecycle"> & {
|
|
19
|
-
context?: (base: BaseContext<D>) => Effect.Effect<C, unknown, R>;
|
|
20
|
-
lifecycle?: {
|
|
21
|
-
onInit?: (ctx: Parameters<NonNullable<LifecycleOptions["onInit"]>>[0]) => Effect.Effect<void, unknown, R>;
|
|
22
|
-
onDestroy?: () => Effect.Effect<void, unknown, R>;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
type EffectService<D = BunSQLiteDatabase<Record<string, unknown>>, C extends Record<string, any> = Record<string, any>, R = never> = Omit<Service<D, C>, "action" | "tool" | "resolveContext" | "resource"> & {
|
|
26
|
-
action: EffectRegistration<BaseContext<D> & C, R> & Service<D, C>["action"];
|
|
27
|
-
tool: EffectToolRegistration<BaseContext<D> & C, R> & Service<D, C>["tool"];
|
|
28
|
-
resolveContext: Service<D, C>["resolveContext"];
|
|
29
|
-
resolveContextEffect(ctx?: Partial<BaseContext<D> & C>): Effect.Effect<BaseContext<D> & C, unknown, R>;
|
|
30
|
-
resource<TTable = any, const TOptions extends ResourceTypeOptions = ResourceTypeOptions>(config: ResourceConfig<TTable, BaseContext<D> & C> & TOptions & Record<Exclude<keyof TOptions, keyof ResourceConfig>, never>): Resource<TTable, BaseContext<D> & C, ResourceIdentity<TTable, TOptions>>;
|
|
31
|
-
};
|
|
32
|
-
/** Native authoring shares the same registration host and metadata as Promise services. */
|
|
33
|
-
declare function defineEffectService<D = BunSQLiteDatabase<Record<string, unknown>>, C extends Record<string, any> = Record<string, any>, R = never>(name: string, options?: EffectServiceOptions<C, D, R>): EffectService<D, C, R>;
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/resource.d.ts
|
|
36
|
-
/** Declares a plugin host without registering actions or changing the schema. */
|
|
37
|
-
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>>;
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/effect-plugin.d.ts
|
|
40
|
-
type RouteOptions = Pick<Parameters<PluginRouteRegistrar["action"]>[0], "path" | "method" | "scope">;
|
|
41
|
-
interface EffectPluginRouteRegistrar<C extends ActionContext = ActionContext> {
|
|
42
|
-
action<I extends TSchema | undefined = undefined, O extends TSchema | undefined = undefined, Errors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, E = never, R = never>(config: EffectActionConfigWithAuthorize<I, O, Errors, C, E, R> & RouteOptions): EffectAction<I, O, Errors, C, E, R>;
|
|
43
|
-
action<I extends TSchema | undefined = undefined, O extends TSchema | undefined = undefined, Errors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, E = never, R = never>(config: EffectActionConfigWithoutAuthorize<I, O, Errors, C, E, R> & RouteOptions): EffectAction<I, O, Errors, C, E, R>;
|
|
44
|
-
endpoint(config: Omit<Parameters<PluginRouteRegistrar<C>["endpoint"]>[0], "handler"> & {
|
|
45
|
-
handler: (context: PluginEndpointContext<C>) => Effect.Effect<unknown, unknown, any>;
|
|
46
|
-
}): void;
|
|
47
|
-
}
|
|
48
|
-
type EffectServicePluginContext<S extends Service<any, any>> = Omit<ServicePluginContext<S>, "routes"> & {
|
|
49
|
-
routes: EffectPluginRouteRegistrar<ServicePluginContext<S>["routes"] extends PluginRouteRegistrar<infer C, any> ? C : never>;
|
|
50
|
-
};
|
|
51
|
-
type EffectResourcePluginContext<S extends Service<any, any>, R extends Resource<any, any, any>> = Omit<ResourcePluginContext<S, R>, "routes"> & {
|
|
52
|
-
routes: EffectPluginRouteRegistrar<ResourcePluginContext<S, R>["routes"] extends PluginRouteRegistrar<infer C, any> ? C : never>;
|
|
53
|
-
};
|
|
54
|
-
declare function defineEffectServicePlugin<S extends Service<any, any> = Service<any, any>, A = unknown>(definition: Pick<ServicePlugin<S, A>, "name" | "routes"> & {
|
|
55
|
-
setup: (context: EffectServicePluginContext<S>) => A & (A extends PromiseLike<unknown> ? never : unknown);
|
|
56
|
-
}): ServicePlugin<S, A>;
|
|
57
|
-
declare function defineEffectResourcePlugin<S extends Service<any, any> = Service<any, any>, R extends Resource<any, any, any> = Resource<any, any, any>, A extends object = object>(definition: Pick<ResourcePlugin<S, R, A>, "name" | "routes"> & {
|
|
58
|
-
setup: (context: EffectResourcePluginContext<S, R>) => A & (A extends PromiseLike<unknown> ? never : unknown);
|
|
59
|
-
}): ResourcePlugin<S, R, A>;
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/compiler/ir.d.ts
|
|
62
|
-
type RouteMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
63
|
-
interface RouteIR {
|
|
64
|
-
readonly method: RouteMethod;
|
|
65
|
-
readonly path: string;
|
|
66
|
-
readonly service: string;
|
|
67
|
-
readonly action: string;
|
|
68
|
-
readonly kind: "action";
|
|
69
|
-
readonly input: boolean;
|
|
70
|
-
readonly output: boolean;
|
|
71
|
-
readonly context: boolean;
|
|
72
|
-
readonly authorize: boolean;
|
|
73
|
-
readonly inputPrecedence: readonly ("query" | "params" | "body")[];
|
|
74
|
-
readonly coercions: readonly {
|
|
75
|
-
readonly key: string;
|
|
76
|
-
readonly type: "number" | "boolean";
|
|
77
|
-
}[];
|
|
78
|
-
/** JSON projection for inspection and stale-artifact detection, not runtime validation. */
|
|
79
|
-
readonly inputSchema?: unknown;
|
|
80
|
-
readonly outputSchema?: unknown;
|
|
81
|
-
}
|
|
82
|
-
interface BrickIR {
|
|
83
|
-
readonly version: 1;
|
|
84
|
-
readonly target: "bun-elysia";
|
|
85
|
-
readonly prefix: string;
|
|
86
|
-
readonly services: readonly string[];
|
|
87
|
-
readonly routes: readonly RouteIR[];
|
|
88
|
-
readonly preparations: readonly {
|
|
89
|
-
service: string;
|
|
90
|
-
name: string;
|
|
91
|
-
metadata: unknown;
|
|
92
|
-
}[];
|
|
93
|
-
readonly diagnostics: readonly string[];
|
|
94
|
-
}
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region src/endpoints.d.ts
|
|
97
|
-
type EndpointMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
98
|
-
/** Logger subset handed to endpoint handlers (mirrors action context loggers). */
|
|
99
|
-
interface EndpointLogger {
|
|
100
|
-
info: (...args: any[]) => void;
|
|
101
|
-
warn: (...args: any[]) => void;
|
|
102
|
-
error: (...args: any[]) => void;
|
|
103
|
-
debug: (...args: any[]) => void;
|
|
104
|
-
}
|
|
105
|
-
/** Context for raw endpoint handlers: Elysia route fields + Brick extras. */
|
|
106
|
-
interface EndpointContext {
|
|
107
|
-
params: Record<string, string>;
|
|
108
|
-
query: Record<string, string | undefined>;
|
|
109
|
-
body: unknown;
|
|
110
|
-
headers: Record<string, string>;
|
|
111
|
-
request: Request;
|
|
112
|
-
/** Elysia response setter (status/headers). Mutate like in `app.get`. */
|
|
113
|
-
set: {
|
|
114
|
-
status?: number;
|
|
115
|
-
headers: Record<string, string>;
|
|
116
|
-
};
|
|
117
|
-
/** Drizzle db from `service` (or first service with one); `undefined` when none. */
|
|
118
|
-
db: any;
|
|
119
|
-
logger: EndpointLogger;
|
|
120
|
-
traceId: string;
|
|
121
|
-
requestId: string;
|
|
122
|
-
}
|
|
123
|
-
interface EndpointDefinition {
|
|
124
|
-
method: EndpointMethod;
|
|
125
|
-
/** Elysia-style path, e.g. `/p/:slug`. */
|
|
126
|
-
path: string;
|
|
127
|
-
handler: (ctx: EndpointContext) => unknown | Promise<unknown>;
|
|
128
|
-
/** Db source: instance or registered service name. Defaults to first service with a db. */
|
|
129
|
-
service?: Service<any, any> | string;
|
|
130
|
-
/** Explicit database handle, independent of a service. */
|
|
131
|
-
database?: DatabaseHandle<unknown>;
|
|
132
|
-
summary?: string;
|
|
133
|
-
description?: string;
|
|
134
|
-
tags?: string[];
|
|
135
|
-
}
|
|
136
|
-
/** Resolve the db for an endpoint: explicit service first, else first service holding one. */
|
|
137
|
-
declare function resolveEndpointDb(service: Service<any, any> | string | undefined, services: Service<any, any>[]): any;
|
|
138
|
-
/** Wrap a raw handler with trace ids, logger, db, and mesh-consistent error mapping. */
|
|
139
|
-
declare function createEndpointHandler(def: EndpointDefinition, services: Service<any, any>[]): (elysiaCtx: any) => Promise<unknown>;
|
|
140
|
-
/** `/p/:slug` → `/p/{slug}` for OpenAPI. */
|
|
141
|
-
declare function toOpenApiPath(elysiaPath: string): string;
|
|
142
|
-
/** OpenAPI `paths` fragment for declared endpoints (raw HTML included). */
|
|
143
|
-
declare function endpointPaths(defs: EndpointDefinition[]): Record<string, any>;
|
|
144
|
-
/** The app object returned by `brick`: Elysia plus `endpoint()`. */
|
|
145
|
-
type BrickApp = Elysia<any, any, any, any, any, any, any> & {
|
|
146
|
-
/** Service definitions and prefix selected when this app was constructed. */
|
|
147
|
-
readonly definition: {
|
|
148
|
-
readonly routes: readonly RouteIR[];
|
|
149
|
-
readonly services: readonly Service<any, any>[];
|
|
150
|
-
readonly prefix: string;
|
|
151
|
-
};
|
|
152
|
-
/** Register a raw endpoint (outside the JSON action mesh). */
|
|
153
|
-
endpoint(def: EndpointDefinition): void;
|
|
154
|
-
/** All endpoints registered via `endpoint()` (declaration order). */
|
|
155
|
-
listEndpoints(): EndpointDefinition[];
|
|
156
|
-
};
|
|
157
|
-
//#endregion
|
|
158
|
-
//#region src/action-handler.d.ts
|
|
159
|
-
declare function compileRoutePlan(service: Service, action: Action, routePath: string, method?: string): CompiledRoutePlan;
|
|
160
|
-
declare function executeCompiledRoute(plan: CompiledRoutePlan, elysiaCtx: any): Promise<any>;
|
|
161
|
-
declare function createActionHandler(service: Service, action: Action, routePath: string, method?: string): (elysiaCtx: any) => Promise<any>;
|
|
162
|
-
//#endregion
|
|
163
|
-
//#region src/app-entry.d.ts
|
|
164
|
-
declare function isBrickApp(app: unknown): app is BrickApp;
|
|
165
|
-
declare function requireBrickApp(app: unknown): BrickApp;
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region src/request-logger.d.ts
|
|
168
|
-
interface RequestLoggingOptions {
|
|
169
|
-
enabled?: boolean;
|
|
170
|
-
logger?: (msg: string) => void;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Elysia plugin that logs each request as `METHOD path → status (elapsedms)`.
|
|
174
|
-
* Timing is tracked per-Request via a WeakMap. The onError hook only logs and
|
|
175
|
-
* returns undefined so existing error mapping is preserved. Logging only —
|
|
176
|
-
* no CORS headers are set here.
|
|
177
|
-
*
|
|
178
|
-
* Hooks are registered with the "global" scope so they propagate to the
|
|
179
|
-
* parent app when mounted via `app.use(...)` — Elysia scopes plain instance
|
|
180
|
-
* hooks to the plugin's own routes. Timing is captured in beforeHandle
|
|
181
|
-
* because request hooks are not propagated from a
|
|
182
|
-
* used instance. Unmatched routes (no beforeHandle) fall back to Date.now().
|
|
183
|
-
*/
|
|
184
|
-
declare function requestLoggingPlugin(opts?: RequestLoggingOptions): Elysia;
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/docs.d.ts
|
|
187
|
-
interface ReferenceOptions {
|
|
188
|
-
path?: string;
|
|
189
|
-
title?: string;
|
|
190
|
-
specUrl?: string;
|
|
191
|
-
}
|
|
192
|
-
/** Renders the Scalar API reference page for the given OpenAPI URL. */
|
|
193
|
-
declare function scalarDocsHTML(specUrl: string, title: string): string;
|
|
194
|
-
/** Standalone Elysia plugin serving GET <path> with the Scalar HTML page. */
|
|
195
|
-
declare function referencePlugin(opts?: ReferenceOptions): Elysia;
|
|
196
|
-
/** Mounts the Scalar reference route onto an existing app. */
|
|
197
|
-
declare function registerReferenceRoute(app: Elysia, opts?: ReferenceOptions): Elysia;
|
|
198
|
-
/** Renders the Swagger UI page. */
|
|
199
|
-
declare function swaggerDocsHTML(specUrl: string, title: string): string;
|
|
200
|
-
//#endregion
|
|
201
|
-
//#region src/compiler/emit.d.ts
|
|
202
|
-
/** Emits framework code only. User callbacks remain closures bound separately. */
|
|
203
|
-
declare function emitHandlerFactory(route: RouteIR): string;
|
|
204
|
-
//#endregion
|
|
205
|
-
//#region src/db/index.d.ts
|
|
206
|
-
interface DatabaseConfig<TSchema extends Record<string, unknown> = Record<string, unknown>> extends Omit<SQLiteDatabaseConfig<TSchema>, "client">, Omit<PostgresDatabaseConfig<TSchema>, "client"> {
|
|
207
|
-
client?: SQLiteDatabaseConfig<TSchema>["client"] | PostgresDatabaseConfig<TSchema>["client"];
|
|
208
|
-
/** Database engine. Default: 'sqlite' */
|
|
209
|
-
engine?: "sqlite" | "postgres" | "clickhouse";
|
|
210
|
-
/** Optional service name associated with this database */
|
|
211
|
-
name?: string;
|
|
212
|
-
}
|
|
213
|
-
type BrickDatabase<TSchema extends Record<string, unknown> = Record<string, unknown>> = BunSQLiteDatabase<TSchema> | PostgresDatabase<TSchema>;
|
|
214
|
-
/**
|
|
215
|
-
* Creates a database instance based on the provided configuration.
|
|
216
|
-
* Zero-config: calling `createDatabase()` returns an ultra-fast Bun-native SQLite
|
|
217
|
-
* database in `:memory:` mode wrapped with Drizzle ORM.
|
|
218
|
-
*/
|
|
219
|
-
declare function createDatabase<TSchema extends Record<string, unknown> = Record<string, unknown>>(config?: DatabaseConfig<TSchema>): BunSQLiteDatabase<TSchema> | PostgresDatabase<TSchema>;
|
|
220
|
-
/** Attach a defined database. Schema changes remain the caller's responsibility. */
|
|
221
|
-
declare function attachDatabase<TDb>(service: Service<TDb, any>, database: DatabaseHandle<TDb>): TDb;
|
|
222
|
-
/**
|
|
223
|
-
* Generates an idempotent SQLite CREATE TABLE IF NOT EXISTS definition
|
|
224
|
-
* directly from a Drizzle table schema.
|
|
225
|
-
*/
|
|
226
|
-
declare function generateSQLiteTableDdl(table: any): string;
|
|
227
|
-
/**
|
|
228
|
-
* Generates idempotent secondary index DDL for a Drizzle table.
|
|
229
|
-
* Covers owner scoping, sort columns, and exact-match filters.
|
|
230
|
-
* UNIQUE columns already carry an implicit index — skipped here.
|
|
231
|
-
* FTS/trigram indexes are handled separately by the search layer.
|
|
232
|
-
*/
|
|
233
|
-
declare function generateSQLiteIndexDdl(table: any, opts?: {
|
|
234
|
-
ownerField?: string;
|
|
235
|
-
sortFields?: string[];
|
|
236
|
-
}): string[];
|
|
237
|
-
/**
|
|
238
|
-
* Ensures secondary indexes exist for a resource table.
|
|
239
|
-
* SQLite: B-tree indexes for owner scope + sort + composite hot path.
|
|
240
|
-
* Postgres: same B-trees plus pg_trgm GIN indexes for substring search.
|
|
241
|
-
* Best-effort: failures warn and continue (e.g. read-only replicas).
|
|
242
|
-
*/
|
|
243
|
-
declare function ensureResourceIndexes(db: any, table: any, opts?: {
|
|
244
|
-
ownerField?: string;
|
|
245
|
-
sortFields?: string[];
|
|
246
|
-
searchFields?: string[];
|
|
247
|
-
}): void;
|
|
248
|
-
/**
|
|
249
|
-
* Creates the FTS5 sidecar table + sync triggers + backfills existing rows.
|
|
250
|
-
* Idempotent; safe to call on every resource registration.
|
|
251
|
-
* No-op on Postgres (relies on pg_trgm instead) and when searchCols is empty.
|
|
252
|
-
*/
|
|
253
|
-
declare function ensureSQLiteFts(db: any, table: any, searchCols: string[]): void;
|
|
254
|
-
/**
|
|
255
|
-
* Builds an FTS5 MATCH condition for a resource search term.
|
|
256
|
-
* Returns null when the term has no usable tokens or FTS errors.
|
|
257
|
-
* Caller falls back to LIKE in that case.
|
|
258
|
-
*/
|
|
259
|
-
declare function buildFtsMatchQuery(search: string): string | null;
|
|
260
|
-
/**
|
|
261
|
-
* Explicit SQLite development/test schema preparation helper.
|
|
262
|
-
* Never called by services, resources, auth, or server startup.
|
|
263
|
-
* Not a migration runner; PostgreSQL schema management is caller-owned.
|
|
264
|
-
*/
|
|
265
|
-
declare function syncSchema(tablesOrService: Map<string, any> | any[] | Record<string, any> | Service, dbInstance?: any): Promise<void> | void;
|
|
266
|
-
//#endregion
|
|
267
|
-
//#region src/service.d.ts
|
|
268
|
-
declare class ServiceImpl<TDb = BunSQLiteDatabase<Record<string, unknown>>, TServiceContext extends Record<string, any> = Record<string, any>> implements Service<TDb, TServiceContext> {
|
|
269
|
-
readonly name: string;
|
|
270
|
-
readonly options: ServiceOptions<TServiceContext, TDb>;
|
|
271
|
-
readonly actions: Map<string, Action<any, any, any, any>>;
|
|
272
|
-
readonly tools: Map<string, Tool<any, any, any, any>>;
|
|
273
|
-
readonly tables: Map<string, any>;
|
|
274
|
-
readonly resources: Map<string, Resource<any, BaseContext<TDb> & TServiceContext, {}>>;
|
|
275
|
-
readonly preparations: Map<string, PreparationContribution>;
|
|
276
|
-
private database?;
|
|
277
|
-
private _isBuilt;
|
|
278
|
-
constructor(name: string, options?: ServiceOptions<TServiceContext, TDb>);
|
|
279
|
-
use<A>(plugin: ServicePlugin<this, A>): A;
|
|
280
|
-
get db(): TDb | undefined;
|
|
281
|
-
get isBuilt(): boolean;
|
|
282
|
-
/**
|
|
283
|
-
* Closes declarations after plugins have registered their actions and preparations.
|
|
284
|
-
*/
|
|
285
|
-
build(): this;
|
|
286
|
-
contributePreparation(contribution: PreparationContribution): void;
|
|
287
|
-
listPreparations(): PreparationContribution[];
|
|
288
|
-
prepareContributions(): void;
|
|
289
|
-
registerTable(table: any): this;
|
|
290
|
-
resource: <TTable = any, const TOptions extends ResourceTypeOptions = ResourceTypeOptions>(config: ResourceConfig<TTable, BaseContext<TDb> & TServiceContext> & TOptions & Record<Exclude<keyof TOptions, keyof ResourceConfig>, never>) => Resource<TTable, BaseContext<TDb> & TServiceContext, ResourceIdentity<TTable, TOptions>>;
|
|
291
|
-
getResource(name: string): Resource<any, BaseContext<TDb> & TServiceContext> | undefined;
|
|
292
|
-
listResources(): Resource<any, BaseContext<TDb> & TServiceContext>[];
|
|
293
|
-
action<TIn extends TSchema | undefined = undefined, TOut extends TSchema | undefined = undefined, TErr extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>>(action: Action<TIn, TOut, TErr, BaseContext<TDb> & TServiceContext>): this;
|
|
294
|
-
action<TIn extends TSchema | undefined = undefined, TOut extends TSchema | undefined = undefined, TErr extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>>(config: ActionConfigWithAuthorize<TIn, TOut, TErr, BaseContext<TDb> & TServiceContext>): Action<TIn, TOut, TErr, BaseContext<TDb> & TServiceContext>;
|
|
295
|
-
action<TIn extends TSchema | undefined = undefined, TOut extends TSchema | undefined = undefined, TErr extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>>(config: ActionConfigWithoutAuthorize<TIn, TOut, TErr, BaseContext<TDb> & TServiceContext>): Action<TIn, TOut, TErr, BaseContext<TDb> & TServiceContext>;
|
|
296
|
-
tool<TIn extends TSchema | undefined = undefined, TOut extends TSchema | undefined = undefined, TErr extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>>(action: Tool<TIn, TOut, TErr, BaseContext<TDb> & TServiceContext>): this;
|
|
297
|
-
tool<TIn extends TSchema | undefined = undefined, TOut extends TSchema | 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>;
|
|
298
|
-
tool<TIn extends TSchema | undefined = undefined, TOut extends TSchema | 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>;
|
|
299
|
-
getTool(name: string): Tool<any, any, any, any> | undefined;
|
|
300
|
-
listTools(): Tool<any, any, any, any>[];
|
|
301
|
-
getAction(name: string): Action<any, any, any, any> | undefined;
|
|
302
|
-
listActions(): Action<any, any, any, any>[];
|
|
303
|
-
getDb(): TDb | undefined;
|
|
304
|
-
setDb(database: DatabaseHandle<TDb>): void;
|
|
305
|
-
getDatabaseHandle(): DatabaseHandle<TDb> | undefined;
|
|
306
|
-
/**
|
|
307
|
-
* Resolves the complete service execution context once per incoming request.
|
|
308
|
-
* Merges framework BaseContext with the service's custom context hook.
|
|
309
|
-
* Always rebuilds context for this service to prevent caller context from overriding.
|
|
310
|
-
*/
|
|
311
|
-
resolveContext(callCtx?: Partial<BaseContext<TDb> & TServiceContext>): Promise<BaseContext<TDb> & TServiceContext>;
|
|
312
|
-
resolveContextEffect(callCtx?: Partial<BaseContext<TDb> & TServiceContext>): Effect.Effect<BaseContext<TDb> & TServiceContext, unknown, any>;
|
|
313
|
-
introspect(): ServiceSchema;
|
|
314
|
-
}
|
|
315
|
-
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>;
|
|
316
|
-
//#endregion
|
|
317
|
-
//#region src/access.d.ts
|
|
318
|
-
interface ActionAccessInfo {
|
|
319
|
-
hasAuthorize: boolean;
|
|
320
|
-
hasScope: boolean;
|
|
321
|
-
policy: ActionAccessPolicy;
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Cross-copy access metadata protocol. CRUD enforces its access policy
|
|
325
|
-
* inside `execute`, so `config.authorize` is absent and introspection
|
|
326
|
-
* can't see it. The plugin stamps each action under this process-global
|
|
327
|
-
* symbol; introspection and OpenAPI read it back. Uses `Symbol.for` so
|
|
328
|
-
* the binding survives a second copy of core (bundler SSR, Vitest),
|
|
329
|
-
* same as the plugin action-binding key.
|
|
330
|
-
*/
|
|
331
|
-
declare const ACTION_ACCESS_KEY: unique symbol;
|
|
332
|
-
declare function setActionAccess(action: object, info: ActionAccessInfo): void;
|
|
333
|
-
declare function getActionAccess(action: Action | object): ActionAccessInfo;
|
|
334
|
-
//#endregion
|
|
335
|
-
//#region src/action.d.ts
|
|
336
|
-
declare function buildErrorHelpers<TErrors extends Record<string, ActionErrorDefinition>>(errorsDef?: TErrors): ErrorBuilder<TErrors>;
|
|
337
|
-
declare function defineAction<TInputSchema extends TSchema | undefined = undefined, TOutputSchema extends TSchema | 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>;
|
|
338
|
-
declare function defineAction<TInputSchema extends TSchema | undefined = undefined, TOutputSchema extends TSchema | 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>;
|
|
339
|
-
//#endregion
|
|
340
|
-
//#region src/rpc.d.ts
|
|
341
|
-
declare function createServiceProxy<T extends Record<string, any>>(serviceName: string, options?: ProxyOptions): T;
|
|
342
|
-
//#endregion
|
|
343
|
-
//#region src/registry.d.ts
|
|
344
|
-
interface ArchitectureApplication {
|
|
345
|
-
services: readonly Service[];
|
|
346
|
-
routes: readonly RouteIR[];
|
|
347
|
-
}
|
|
348
|
-
declare class ServiceRegistry {
|
|
349
|
-
private _revision;
|
|
350
|
-
/** Definition revision for invalidating serialized architecture snapshots. */
|
|
351
|
-
get revision(): number;
|
|
352
|
-
touch(): void;
|
|
353
|
-
private services;
|
|
354
|
-
private routes;
|
|
355
|
-
/** Remember the actual registered routes for subsequent registry exports. */
|
|
356
|
-
setApplicationRoutes(application: ArchitectureApplication): void;
|
|
357
|
-
register(service: Service): void;
|
|
358
|
-
get(name: string): Service | undefined;
|
|
359
|
-
has(name: string): boolean;
|
|
360
|
-
list(): Service[];
|
|
361
|
-
clear(): void;
|
|
362
|
-
exportArchitecture(application?: ArchitectureApplication): ArchitectureSchema;
|
|
363
|
-
}
|
|
364
|
-
declare function getGlobalRegistry(): ServiceRegistry;
|
|
365
|
-
declare function resetGlobalRegistry(): void;
|
|
366
|
-
//#endregion
|
|
367
|
-
//#region src/typebox.d.ts
|
|
368
|
-
declare function getCompiledCheck<T extends TSchema$1>(schema: T): TypeCheck<T>;
|
|
369
|
-
declare function validateWithSchema<T extends TSchema$1>(schema: T | undefined, value: unknown): {
|
|
370
|
-
success: true;
|
|
371
|
-
data: Static$1<T>;
|
|
372
|
-
} | {
|
|
373
|
-
success: false;
|
|
374
|
-
errors: ValidationErrorItem[];
|
|
375
|
-
};
|
|
376
|
-
//#endregion
|
|
377
|
-
//#region src/openapi.d.ts
|
|
378
|
-
interface OpenApiGeneratorOptions {
|
|
379
|
-
title?: string;
|
|
380
|
-
version?: string;
|
|
381
|
-
description?: string;
|
|
382
|
-
prefix?: string;
|
|
383
|
-
services?: Service<any, any>[];
|
|
384
|
-
registry?: ServiceRegistry;
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* TypeBox expresses recursive schemas with bare `$id`/`$ref` anchors
|
|
388
|
-
* (`{ $id: "T0", ..., { $ref: "T0" } }`). OpenAPI interprets a bare `$ref`
|
|
389
|
-
* as an external file reference, so downstream tooling tries to load a
|
|
390
|
-
* file named `T0` and fails. Hoist every anchored subschema into
|
|
391
|
-
* `#/components/schemas/` and rewrite the refs to local pointers.
|
|
392
|
-
* First definition wins when one `$id` is declared twice.
|
|
393
|
-
*/
|
|
394
|
-
declare function hoistAnchoredSchemas(spec: Record<string, any>): string[];
|
|
395
|
-
declare function generateOpenApiSpec(options?: OpenApiGeneratorOptions): Record<string, any>;
|
|
396
|
-
//#endregion
|
|
397
|
-
//#region src/tool.d.ts
|
|
398
|
-
declare function defineTool<TInputSchema extends TSchema | undefined = undefined, TOutputSchema extends TSchema | undefined = undefined, TErrors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, TContext extends ActionContext = ActionContext>(config: ToolConfigWithAuthorize<TInputSchema, TOutputSchema, TErrors, TContext>): Tool<TInputSchema, TOutputSchema, TErrors, TContext>;
|
|
399
|
-
declare function defineTool<TInputSchema extends TSchema | undefined = undefined, TOutputSchema extends TSchema | undefined = undefined, TErrors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, TContext extends ActionContext = ActionContext>(config: ToolConfigWithoutAuthorize<TInputSchema, TOutputSchema, TErrors, TContext>): Tool<TInputSchema, TOutputSchema, TErrors, TContext>;
|
|
400
|
-
declare function isTool(value: unknown): value is Tool<any, any, any, any>;
|
|
401
|
-
//#endregion
|
|
402
|
-
//#region src/mcp.d.ts
|
|
403
|
-
interface McpToolDefinition {
|
|
404
|
-
name: string;
|
|
405
|
-
title?: string;
|
|
406
|
-
description: string;
|
|
407
|
-
inputSchema: unknown;
|
|
408
|
-
annotations: ToolAnnotations;
|
|
409
|
-
}
|
|
410
|
-
interface McpRegistryOptions {
|
|
411
|
-
services?: readonly Pick<Service<any, any>, "listTools">[];
|
|
412
|
-
tools?: readonly Tool<any, any, any, any>[];
|
|
413
|
-
}
|
|
414
|
-
interface McpRegistry {
|
|
415
|
-
listTools(): McpToolDefinition[];
|
|
416
|
-
callTool(name: string, args?: Record<string, unknown>, ctx?: Partial<ActionContext>): Promise<unknown>;
|
|
417
|
-
}
|
|
418
|
-
declare class UnknownToolError extends Error {
|
|
419
|
-
constructor(name: string);
|
|
420
|
-
}
|
|
421
|
-
/** Collect only explicitly defined tools, without exposing ordinary actions. */
|
|
422
|
-
declare function createMcpRegistry(options: McpRegistryOptions): McpRegistry;
|
|
423
|
-
interface McpHandlerOptions {
|
|
424
|
-
registry: McpRegistry;
|
|
425
|
-
serverInfo: {
|
|
426
|
-
name: string;
|
|
427
|
-
version: string;
|
|
428
|
-
title?: string;
|
|
429
|
-
};
|
|
430
|
-
/** Versions supported by this transport, newest first. */
|
|
431
|
-
protocolVersions?: readonly string[];
|
|
432
|
-
}
|
|
433
|
-
/** Stateless MCP JSON-RPC POST handler. Wrap with the app's authentication. */
|
|
434
|
-
declare function createMcpHandler(options: McpHandlerOptions): (request: Request, ctx?: Partial<ActionContext>) => Promise<Response>;
|
|
435
|
-
//#endregion
|
|
436
|
-
//#region src/error-response.d.ts
|
|
437
|
-
interface ErrorEnvelope {
|
|
438
|
-
name: string;
|
|
439
|
-
code: string;
|
|
440
|
-
message: string;
|
|
441
|
-
status: number;
|
|
442
|
-
requestId: string;
|
|
443
|
-
details?: unknown;
|
|
444
|
-
errors?: ValidationError["errors"];
|
|
445
|
-
}
|
|
446
|
-
type ErrorContext = {
|
|
447
|
-
logger: Pick<Logger, "error">;
|
|
448
|
-
requestId: string;
|
|
449
|
-
};
|
|
450
|
-
declare function toErrorResponse(err: unknown, context: ErrorContext): ErrorEnvelope;
|
|
451
|
-
//#endregion
|
|
452
|
-
//#region src/compiler/runtime.d.ts
|
|
453
|
-
type CompiledHandler = (context: any) => unknown | Promise<unknown>;
|
|
454
|
-
type HandlerFactory = (binding: CompiledRoutePlan, runtime: typeof compilerRuntime) => CompiledHandler;
|
|
455
|
-
/** Retains Brick's existing source precedence and treatment of empty bodies. */
|
|
456
|
-
declare function mergeInput(first: any, second: any, third: any): any;
|
|
457
|
-
declare function checkDepth(value: unknown, action: string): void;
|
|
458
|
-
declare function validate(check: NonNullable<CompiledRoutePlan["inputChecker"]>, value: unknown, action: string, stage: "input" | "output"): void;
|
|
459
|
-
declare function mapError(err: unknown, set: any, options: {
|
|
460
|
-
logger: Logger;
|
|
461
|
-
requestId: string;
|
|
462
|
-
}): ErrorEnvelope;
|
|
463
|
-
declare const compilerRuntime: Readonly<{
|
|
464
|
-
emptyServices: Readonly<{}>;
|
|
465
|
-
defaultRequest: Request;
|
|
466
|
-
nextSequence: () => string;
|
|
467
|
-
mergeInput: typeof mergeInput;
|
|
468
|
-
checkDepth: typeof checkDepth;
|
|
469
|
-
validate: typeof validate;
|
|
470
|
-
mapError: typeof mapError;
|
|
471
|
-
isThenable: (value: any) => boolean;
|
|
472
|
-
deny: (action: string, user: unknown) => never;
|
|
473
|
-
}>;
|
|
474
|
-
//#endregion
|
|
475
|
-
//#region src/compiler.d.ts
|
|
476
|
-
type ApplicationBinder = (services: Service<any, any>[]) => CompiledApplication;
|
|
477
|
-
/** Build artifact bootstrap: bind generated handlers while evaluating the original app. */
|
|
478
|
-
declare function loadCompiledBrickApp(load: () => Promise<{
|
|
479
|
-
default: unknown;
|
|
480
|
-
}>, ir: BrickIR, bind: ApplicationBinder): Promise<BrickApp>;
|
|
481
|
-
interface CompiledRoute {
|
|
482
|
-
readonly ir: RouteIR;
|
|
483
|
-
readonly handler: CompiledHandler;
|
|
484
|
-
}
|
|
485
|
-
interface CompiledApplication {
|
|
486
|
-
readonly ir: BrickIR;
|
|
487
|
-
readonly routes: readonly CompiledRoute[];
|
|
488
|
-
}
|
|
489
|
-
/** Startup compiler: analyzes once, then binds live callbacks. */
|
|
490
|
-
declare function compileBrickApplication(options: {
|
|
491
|
-
services: Service<any, any>[];
|
|
492
|
-
prefix?: string;
|
|
493
|
-
mode?: "specialized" | "generic";
|
|
494
|
-
}): CompiledApplication;
|
|
495
|
-
/** Build artifact binder: consumes emitted functions, with no runtime handler code generation. */
|
|
496
|
-
declare function bindCompiledApplication(ir: BrickIR, services: Service<any, any>[], factories: readonly HandlerFactory[]): CompiledApplication;
|
|
497
|
-
//#endregion
|
|
498
|
-
//#region src/server.d.ts
|
|
499
|
-
interface CreateServerOptions {
|
|
500
|
-
port?: number;
|
|
501
|
-
/** Generate specialized handlers once at startup (default true). */
|
|
502
|
-
compiler?: boolean;
|
|
503
|
-
/** Ahead-of-time handlers already bound to the supplied services. */
|
|
504
|
-
compilation?: CompiledApplication;
|
|
505
|
-
services?: Service<any, any>[];
|
|
506
|
-
prefix?: string;
|
|
507
|
-
title?: string;
|
|
508
|
-
version?: string;
|
|
509
|
-
description?: string;
|
|
510
|
-
docs?: boolean;
|
|
511
|
-
openApiPath?: string;
|
|
512
|
-
docsPath?: string;
|
|
513
|
-
swaggerPath?: string;
|
|
514
|
-
requestLogging?: boolean | RequestLoggingOptions;
|
|
515
|
-
reference?: boolean | ReferenceOptions;
|
|
516
|
-
secrets?: {
|
|
517
|
-
source?: SecretSource;
|
|
518
|
-
validate?: boolean;
|
|
519
|
-
};
|
|
520
|
-
/** Raw endpoints (outside the JSON action mesh), mounted at startup. */
|
|
521
|
-
endpoints?: EndpointDefinition[];
|
|
522
|
-
}
|
|
523
|
-
declare function brick(options?: CreateServerOptions): BrickApp;
|
|
524
|
-
//#endregion
|
|
525
|
-
//#region src/effect-server.d.ts
|
|
526
|
-
type EffectEndpointDefinition<R = never> = Omit<EndpointDefinition, "handler"> & {
|
|
527
|
-
handler: (ctx: EndpointContext) => Effect.Effect<unknown, unknown, R>;
|
|
528
|
-
};
|
|
529
|
-
type EffectServerOptions<R = never, E = never> = Omit<CreateServerOptions, "endpoints"> & {
|
|
530
|
-
layer?: Layer.Layer<R, E>;
|
|
531
|
-
endpoints?: EffectEndpointDefinition<R>[];
|
|
532
|
-
};
|
|
533
|
-
type EffectBrickApp = BrickApp & {
|
|
534
|
-
endpoint(definition: EffectEndpointDefinition<any>): void;
|
|
535
|
-
initialize(): Promise<void>;
|
|
536
|
-
dispose(): Promise<void>;
|
|
537
|
-
initializeEffect: Effect.Effect<void, unknown>;
|
|
538
|
-
disposeEffect: Effect.Effect<void, unknown>;
|
|
539
|
-
handleEffect(request: Request): Effect.Effect<Response, unknown>;
|
|
540
|
-
listenEffect(port: number): Effect.Effect<EffectBrickApp, unknown>;
|
|
541
|
-
};
|
|
542
|
-
/** One runtime owns the dependency layer across every service and transport. */
|
|
543
|
-
declare function effectBrick<R = never, E = never>(options?: EffectServerOptions<R, E>): EffectBrickApp;
|
|
544
|
-
//#endregion
|
|
545
|
-
//#region src/effect-runtime.d.ts
|
|
546
|
-
/** The HTTP and Promise boundary preserves original failures and shares the app runtime. */
|
|
547
|
-
declare function runEffectPromise<A, E, R>(effect: Effect.Effect<A, E, R>, owner?: object, signal?: AbortSignal): Promise<A>;
|
|
548
|
-
//#endregion
|
|
549
|
-
//#region src/effect-rpc.d.ts
|
|
550
|
-
type NativeProxy<T, R> = { [K in keyof T]: T[K] extends ((...args: infer A) => infer O) ? (...args: A) => O extends Effect.Effect<any, any, any> ? O : Effect.Effect<Awaited<O>, unknown, R> : never; };
|
|
551
|
-
/** Local dispatch stays in the caller's Effect environment and scope. */
|
|
552
|
-
declare function createEffectServiceProxy<T extends Record<string, any>, R = never>(serviceName: string, options?: ProxyOptions): NativeProxy<T, R>;
|
|
553
|
-
interface EffectMcpRegistry<R = never> extends McpRegistry {
|
|
554
|
-
callToolEffect(name: string, args?: Record<string, unknown>, ctx?: Partial<ActionContext>): Effect.Effect<unknown, unknown, R>;
|
|
555
|
-
}
|
|
556
|
-
/** Native tool calls compose directly; the existing MCP Promise interface remains available. */
|
|
557
|
-
declare function createEffectMcpRegistry<R = never>(options: McpRegistryOptions): EffectMcpRegistry<R>;
|
|
558
|
-
//#endregion
|
|
559
|
-
//#region src/effect.d.ts
|
|
560
|
-
type NativeConfig<C extends {
|
|
561
|
-
execute: (...args: any[]) => any;
|
|
562
|
-
}, E, R> = Omit<C, "execute" | "authorize"> & {
|
|
563
|
-
execute: (params: Parameters<C["execute"]>[0]) => Effect.Effect<Awaited<ReturnType<C["execute"]>>, E, R>;
|
|
564
|
-
};
|
|
565
|
-
type EffectActionConfigWithAuthorize<I extends TSchema | undefined, O extends TSchema | undefined, Errors extends Record<string, ActionErrorDefinition>, C extends ActionContext, E = never, R = never> = NativeConfig<ActionConfigWithAuthorize<I, O, Errors, C>, E, R> & {
|
|
566
|
-
authorize: (params: Parameters<ActionConfigWithAuthorize<I, O, Errors, C>["authorize"]>[0]) => Effect.Effect<boolean, E, R> | boolean | Promise<boolean>;
|
|
567
|
-
};
|
|
568
|
-
type EffectActionConfigWithoutAuthorize<I extends TSchema | undefined, O extends TSchema | undefined, Errors extends Record<string, ActionErrorDefinition>, C extends ActionContext, E = never, R = never> = NativeConfig<ActionConfigWithoutAuthorize<I, O, Errors, C>, E, R> & {
|
|
569
|
-
authorize?: undefined;
|
|
570
|
-
};
|
|
571
|
-
type EffectAction<I extends TSchema | undefined, O extends TSchema | undefined, Errors extends Record<string, ActionErrorDefinition>, C extends ActionContext, E = never, R = never> = Action<I, O, Errors, C> & {
|
|
572
|
-
executeEffect: (params: Parameters<Action<I, O, Errors, C>["execute"]>[0]) => Effect.Effect<Awaited<ReturnType<Action<I, O, Errors, C>["execute"]>>, E | ActionExecutionError | ValidationError | Error, R>;
|
|
573
|
-
};
|
|
574
|
-
type EffectTool<I extends TSchema | undefined, O extends TSchema | undefined, Errors extends Record<string, ActionErrorDefinition>, C extends ActionContext, E = never, R = never> = EffectAction<I, O, Errors, C, E, R> & Tool<I, O, Errors, C>;
|
|
575
|
-
/** Normalize native callbacks once; compiled and interpreted transports share them. */
|
|
576
|
-
declare function adaptEffectActionConfig(config: any, owner?: object): any;
|
|
577
|
-
declare function defineEffectAction<I extends TSchema | undefined = undefined, O extends TSchema | undefined = undefined, Errors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, C extends ActionContext = ActionContext, E = never, R = never>(config: EffectActionConfigWithAuthorize<I, O, Errors, C, E, R>): EffectAction<I, O, Errors, C, E, R>;
|
|
578
|
-
declare function defineEffectAction<I extends TSchema | undefined = undefined, O extends TSchema | undefined = undefined, Errors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, C extends ActionContext = ActionContext, E = never, R = never>(config: EffectActionConfigWithoutAuthorize<I, O, Errors, C, E, R>): EffectAction<I, O, Errors, C, E, R>;
|
|
579
|
-
declare function defineEffectTool<I extends TSchema | undefined = undefined, O extends TSchema | undefined = undefined, Errors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, C extends ActionContext = ActionContext, E = never, R = never>(config: EffectActionConfigWithAuthorize<I, O, Errors, C, E, R> & ToolOptions): EffectTool<I, O, Errors, C, E, R>;
|
|
580
|
-
declare function defineEffectTool<I extends TSchema | undefined = undefined, O extends TSchema | undefined = undefined, Errors extends Record<string, ActionErrorDefinition> = Record<string, ActionErrorDefinition>, C extends ActionContext = ActionContext, E = never, R = never>(config: EffectActionConfigWithoutAuthorize<I, O, Errors, C, E, R> & ToolOptions): EffectTool<I, O, Errors, C, E, R>;
|
|
581
|
-
//#endregion
|
|
582
|
-
export { setActionAccess as $, createEndpointHandler as $t, McpToolDefinition as A, notInArray as At, TSchema$1 as B, swaggerDocsHTML as Bt, HandlerFactory as C, isNotNull as Ct, McpHandlerOptions as D, lte as Dt, toErrorResponse as E, lt as Et, isTool as F, emitHandlerFactory as Ft, getGlobalRegistry as G, compileRoutePlan as Gt, getCompiledCheck as H, requestLoggingPlugin as Ht, OpenApiGeneratorOptions as I, ReferenceOptions as It, buildErrorHelpers as J, BrickApp as Jt, resetGlobalRegistry as K, createActionHandler as Kt, generateOpenApiSpec as L, referencePlugin as Lt, createMcpHandler as M, relations as Mt, createMcpRegistry as N, sql$1 as Nt, McpRegistry as O, ne as Ot, defineTool as P, syncSchema as Pt, getActionAccess as Q, EndpointMethod as Qt, hoistAnchoredSchemas as R, registerReferenceRoute as Rt, CompiledHandler as S, is as St, ErrorEnvelope as T, like as Tt, validateWithSchema as U, isBrickApp as Ut, Type as V, RequestLoggingOptions as Vt, ServiceRegistry as W, requireBrickApp as Wt, ACTION_ACCESS_KEY as X, EndpointDefinition as Xt, defineAction as Y, EndpointContext as Yt, ActionAccessInfo as Z, EndpointLogger as Zt, CompiledApplication as _, getTableName$1 as _t, adaptEffectActionConfig as a, RouteMethod as an, and as at, compileBrickApplication as b, ilike as bt, EffectMcpRegistry as c, defineResource as cn, buildFtsMatchQuery as ct, runEffectPromise as d, defineEffectService as dn, ensureResourceIndexes as dt, endpointPaths as en, ServiceImpl as et, EffectBrickApp as f, ensureSQLiteFts as ft, brick as g, getTableColumns$1 as gt, CreateServerOptions as h, generateSQLiteTableDdl as ht, EffectTool as i, RouteIR as in, Table$1 as it, UnknownToolError as j, or as jt, McpRegistryOptions as k, not as kt, createEffectMcpRegistry as l, EffectService as ln, createDatabase as lt, effectBrick as m, generateSQLiteIndexDdl as mt, EffectActionConfigWithAuthorize as n, toOpenApiPath as nn, BrickDatabase as nt, defineEffectAction as o, defineEffectResourcePlugin as on, asc as ot, EffectServerOptions as p, eq as pt, createServiceProxy as q, executeCompiledRoute as qt, EffectActionConfigWithoutAuthorize as r, BrickIR as rn, DatabaseConfig as rt, defineEffectTool as s, defineEffectServicePlugin as sn, attachDatabase as st, EffectAction as t, resolveEndpointDb as tn, defineService as tt, createEffectServiceProxy as u, EffectServiceOptions as un, desc as ut, CompiledRoute as v, gt as vt, compilerRuntime as w, isNull as wt, loadCompiledBrickApp as x, inArray as xt, bindCompiledApplication as y, gte as yt, Static$1 as z, scalarDocsHTML as zt };
|
|
583
|
-
//# sourceMappingURL=effect.d.ts.map
|