@brickkit/core 0.4.0 → 0.4.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/dist/index.js CHANGED
@@ -185,6 +185,31 @@ function resetGlobalRegistry() {
185
185
  globalRegistry = new ServiceRegistry();
186
186
  }
187
187
  //#endregion
188
+ //#region src/error-response.ts
189
+ /** Preserve declared failures, log and wrap unexpected throws without exposing internals. */
190
+ function normalizeActionError(err, { logger, requestId }) {
191
+ if (err instanceof ActionExecutionError || err instanceof ValidationError) return err;
192
+ logger.error("Unexpected action error", { requestId }, err);
193
+ const failure = new ActionExecutionError("INTERNAL_SERVER_ERROR", "Internal Server Error", 500, void 0, { cause: err });
194
+ failure.name = "InternalServerError";
195
+ return failure;
196
+ }
197
+ function toErrorResponse(err, context) {
198
+ const failure = normalizeActionError(err, context);
199
+ if (failure.status >= 500 && (err instanceof ActionExecutionError || err instanceof ValidationError)) context.logger.error("Server action error", { requestId: context.requestId }, err);
200
+ if (failure instanceof ValidationError && failure.status >= 500) return {
201
+ name: failure.name,
202
+ code: failure.code,
203
+ message: failure.message,
204
+ status: failure.status,
205
+ requestId: context.requestId
206
+ };
207
+ return {
208
+ ...failure.toJSON(),
209
+ requestId: context.requestId
210
+ };
211
+ }
212
+ //#endregion
188
213
  //#region src/typebox.ts
189
214
  const compilerCache = /* @__PURE__ */ new WeakMap();
190
215
  function getCompiledCheck(schema) {
@@ -272,15 +297,15 @@ function createDefaultContext(partial) {
272
297
  }
273
298
  function buildErrorHelpers(errorsDef) {
274
299
  const helpers = {};
275
- for (const [code, def] of Object.entries(standardErrorDefaults)) helpers[code] = (overrideMessage, details) => {
300
+ for (const [code, def] of Object.entries(standardErrorDefaults)) helpers[code] = (overrideMessage, details, options) => {
276
301
  const message = overrideMessage || def.message;
277
302
  const status = def.status;
278
- throw new ActionExecutionError(code, message, status, details);
303
+ throw new ActionExecutionError(code, message, status, details, options);
279
304
  };
280
- if (errorsDef) for (const [code, def] of Object.entries(errorsDef)) helpers[code] = (overrideMessage, details) => {
305
+ if (errorsDef) for (const [code, def] of Object.entries(errorsDef)) helpers[code] = (overrideMessage, details, options) => {
281
306
  const message = overrideMessage || def.message;
282
307
  const status = def.status || 400;
283
- throw new ActionExecutionError(code, message, status, details);
308
+ throw new ActionExecutionError(code, message, status, details, options);
284
309
  };
285
310
  return helpers;
286
311
  }
@@ -313,34 +338,38 @@ function defineAction(config) {
313
338
  if (params?.ctx?.[RESOLVED_SYMBOL$1] === boundService) fullCtx = params.ctx;
314
339
  else if (boundService && typeof boundService.resolveContext === "function") fullCtx = await boundService.resolveContext(params?.ctx);
315
340
  else fullCtx = createDefaultContext(params?.ctx);
316
- if (!fullCtx.db) {
317
- if (actionFn.service?.getDb()) fullCtx.db = actionFn.service.getDb();
318
- else if (actionFn.serviceName) {
319
- const s = getGlobalRegistry().get(actionFn.serviceName);
320
- if (s?.getDb()) fullCtx.db = s.getDb();
341
+ try {
342
+ if (!fullCtx.db) {
343
+ if (actionFn.service?.getDb()) fullCtx.db = actionFn.service.getDb();
344
+ else if (actionFn.serviceName) {
345
+ const s = getGlobalRegistry().get(actionFn.serviceName);
346
+ if (s?.getDb()) fullCtx.db = s.getDb();
347
+ }
321
348
  }
322
- }
323
- if (config.input) {
324
- const inputValidation = actionFn.validateInput(params?.input);
325
- if (!inputValidation.success) throw new ValidationError(`Validation failed for action '${config.name}' input`, inputValidation.errors);
326
- }
327
- if (config.authorize) {
328
- if (!await config.authorize({
329
- user: fullCtx.user,
349
+ if (config.input) {
350
+ const inputValidation = actionFn.validateInput(params?.input);
351
+ if (!inputValidation.success) throw new ValidationError(`Validation failed for action '${config.name}' input`, inputValidation.errors);
352
+ }
353
+ if (config.authorize) {
354
+ if (!await config.authorize({
355
+ user: fullCtx.user,
356
+ input: params?.input,
357
+ ctx: fullCtx
358
+ })) throw new ActionExecutionError(fullCtx.user == null ? "UNAUTHORIZED" : "FORBIDDEN", `Access denied for action '${config.name}'`, fullCtx.user == null ? 401 : 403);
359
+ }
360
+ const result = await config.execute({
330
361
  input: params?.input,
331
- ctx: fullCtx
332
- })) throw new ActionExecutionError("UNAUTHORIZED", `Access denied for action '${config.name}'`, 403);
333
- }
334
- const result = await config.execute({
335
- input: params?.input,
336
- ctx: fullCtx,
337
- error: errorHelpers
338
- });
339
- if (actionFn.outputValidationSchema ?? config.output) {
340
- const outputValidation = actionFn.validateOutput(result);
341
- if (!outputValidation.success) throw new ValidationError(`Validation failed for action '${config.name}' output`, outputValidation.errors, 500);
362
+ ctx: fullCtx,
363
+ error: errorHelpers
364
+ });
365
+ if (actionFn.outputValidationSchema ?? config.output) {
366
+ const outputValidation = actionFn.validateOutput(result);
367
+ if (!outputValidation.success) throw new ValidationError(`Validation failed for action '${config.name}' output`, outputValidation.errors, 500);
368
+ }
369
+ return result;
370
+ } catch (err) {
371
+ throw normalizeActionError(err, fullCtx);
342
372
  }
343
- return result;
344
373
  };
345
374
  return actionFn;
346
375
  }
@@ -660,17 +689,10 @@ function validate(check, value, action, stage) {
660
689
  }));
661
690
  throw new ValidationError(`Validation failed for action '${action}' ${stage}`, errors, stage === "output" ? 500 : 400);
662
691
  }
663
- function mapError(err, set) {
664
- if (err instanceof ValidationError || err instanceof ActionExecutionError) {
665
- set.status = err.status || 400;
666
- return err.toJSON();
667
- }
668
- set.status = 500;
669
- return {
670
- name: "InternalServerError",
671
- message: err?.message || "An unexpected error occurred",
672
- status: 500
673
- };
692
+ function mapError(err, set, options) {
693
+ const response = toErrorResponse(err, options);
694
+ set.status = response.status;
695
+ return response;
674
696
  }
675
697
  const compilerRuntime = Object.freeze({
676
698
  emptyServices: EMPTY_SERVICES$2,
@@ -681,8 +703,8 @@ const compilerRuntime = Object.freeze({
681
703
  validate,
682
704
  mapError,
683
705
  isThenable: (value) => value != null && typeof value.then === "function",
684
- deny: (action) => {
685
- throw new ActionExecutionError("UNAUTHORIZED", `Access denied for action '${action}'`, 403);
706
+ deny: (action, user) => {
707
+ throw new ActionExecutionError(user == null ? "UNAUTHORIZED" : "FORBIDDEN", `Access denied for action '${action}'`, user == null ? 401 : 403);
686
708
  }
687
709
  });
688
710
  //#endregion
@@ -837,7 +859,7 @@ async function executeCompiledRoute(plan, elysiaCtx) {
837
859
  input,
838
860
  user: ctx.user
839
861
  });
840
- if (!(authRes instanceof Promise ? await authRes : authRes)) throw new ActionExecutionError("UNAUTHORIZED", `Access denied for action '${plan.actionName}'`, 403);
862
+ if (!(authRes instanceof Promise ? await authRes : authRes)) throw new ActionExecutionError(ctx.user == null ? "UNAUTHORIZED" : "FORBIDDEN", `Access denied for action '${plan.actionName}'`, ctx.user == null ? 401 : 403);
841
863
  }
842
864
  const execRes = plan.execute({
843
865
  input,
@@ -857,16 +879,12 @@ async function executeCompiledRoute(plan, elysiaCtx) {
857
879
  }
858
880
  return result;
859
881
  } catch (err) {
860
- if (err instanceof ValidationError || err instanceof ActionExecutionError) {
861
- set.status = err.status || 400;
862
- return err.toJSON();
863
- }
864
- set.status = 500;
865
- return {
866
- name: "InternalServerError",
867
- message: err.message || "An unexpected error occurred",
868
- status: 500
869
- };
882
+ const response = toErrorResponse(err, {
883
+ logger: ctx.logger,
884
+ requestId
885
+ });
886
+ set.status = response.status;
887
+ return response;
870
888
  }
871
889
  }
872
890
  function createActionHandler(service, action, routePath, method) {
@@ -944,14 +962,14 @@ function createHandlerFactory(route) {
944
962
  ctx,
945
963
  input,
946
964
  user: ctx.user
947
- })) runtime.deny(route.action);
965
+ })) runtime.deny(route.action, ctx.user);
948
966
  return validateOutput(await execute({
949
967
  input,
950
968
  ctx,
951
969
  error: errorBuilder
952
970
  }));
953
971
  } catch (err) {
954
- return runtime.mapError(err, context.set);
972
+ return runtime.mapError(err, context.set, ctx);
955
973
  }
956
974
  };
957
975
  return function brickAction(context) {
@@ -964,10 +982,10 @@ function createHandlerFactory(route) {
964
982
  ctx,
965
983
  error: errorBuilder
966
984
  });
967
- if (runtime.isThenable(result)) return Promise.resolve(result).then(validateOutput).catch((err) => runtime.mapError(err, context.set));
985
+ if (runtime.isThenable(result)) return Promise.resolve(result).then(validateOutput).catch((err) => runtime.mapError(err, context.set, ctx));
968
986
  return validateOutput(result);
969
987
  } catch (err) {
970
- return runtime.mapError(err, context.set);
988
+ return runtime.mapError(err, context.set, ctx);
971
989
  }
972
990
  };
973
991
  };
@@ -1103,57 +1121,38 @@ function generateOpenApiSpec(options = {}) {
1103
1121
  content: { "application/json": { schema: action.config.output } }
1104
1122
  };
1105
1123
  else responses["200"] = { description: "Successful response" };
1106
- if (action.config.input) responses["400"] = {
1107
- description: "Validation error",
1108
- content: { "application/json": { schema: {
1124
+ const errorAlternatives = /* @__PURE__ */ new Set();
1125
+ const addError = (code, status, message) => {
1126
+ const key = `${status}:${code}`;
1127
+ if (errorAlternatives.has(key)) return;
1128
+ errorAlternatives.add(key);
1129
+ const schema = { allOf: [{ $ref: "#/components/schemas/ErrorEnvelope" }, {
1109
1130
  type: "object",
1110
1131
  properties: {
1111
- name: { type: "string" },
1112
- message: { type: "string" },
1113
- status: { type: "integer" },
1114
- errors: {
1115
- type: "array",
1116
- items: {
1117
- type: "object",
1118
- properties: {
1119
- path: { type: "string" },
1120
- message: { type: "string" }
1121
- }
1122
- }
1123
- }
1132
+ code: { const: code },
1133
+ status: { const: status }
1124
1134
  }
1125
- } } }
1135
+ }] };
1136
+ const existing = responses[String(status)];
1137
+ if (existing) {
1138
+ existing.description += "; " + message;
1139
+ existing.content["application/json"].schema.oneOf.push(schema);
1140
+ } else responses[String(status)] = {
1141
+ description: message,
1142
+ content: { "application/json": { schema: { oneOf: [schema] } } }
1143
+ };
1126
1144
  };
1127
- if (hasAuth) responses["403"] = { description: "Access denied / Unauthorized" };
1145
+ if (action.config.input) addError("VALIDATION_FAILED", 400, "Validation error");
1146
+ if (hasAuth) {
1147
+ addError("UNAUTHORIZED", 401, "Authentication required");
1148
+ addError("FORBIDDEN", 403, "Access denied");
1149
+ }
1128
1150
  if (action.config.errors) for (const [code, errorDef] of Object.entries(action.config.errors)) {
1129
1151
  const def = errorDef;
1130
- const status = String(def.status || 400);
1131
- responses[status] = {
1132
- description: def.message || code,
1133
- content: { "application/json": { schema: {
1134
- type: "object",
1135
- properties: {
1136
- name: {
1137
- type: "string",
1138
- example: "ActionExecutionError"
1139
- },
1140
- code: {
1141
- type: "string",
1142
- example: code
1143
- },
1144
- message: {
1145
- type: "string",
1146
- example: def.message
1147
- },
1148
- status: {
1149
- type: "integer",
1150
- example: def.status || 400
1151
- }
1152
- }
1153
- } } }
1154
- };
1152
+ addError(code, def.status || 400, def.message || code);
1155
1153
  }
1156
- responses["500"] = { description: "Internal server error" };
1154
+ addError("INTERNAL_SERVER_ERROR", 500, "Internal server error");
1155
+ if (action.config.output) addError("VALIDATION_FAILED", 500, "Output validation error");
1157
1156
  const operation = {
1158
1157
  operationId: `${service.name}_${action.name}_${method}`,
1159
1158
  summary: `${service.name}.${action.name}`,
@@ -1206,12 +1205,42 @@ function generateOpenApiSpec(options = {}) {
1206
1205
  description: `Actions exposed by '${name}' service`
1207
1206
  }))
1208
1207
  };
1209
- if (hasAnyAuthorizedAction) spec.components = { securitySchemes: { bearerAuth: {
1208
+ spec.components = { schemas: { ErrorEnvelope: {
1209
+ type: "object",
1210
+ required: [
1211
+ "name",
1212
+ "code",
1213
+ "message",
1214
+ "status",
1215
+ "requestId"
1216
+ ],
1217
+ properties: {
1218
+ name: { type: "string" },
1219
+ code: { type: "string" },
1220
+ message: { type: "string" },
1221
+ status: { type: "integer" },
1222
+ requestId: { type: "string" },
1223
+ details: {},
1224
+ errors: {
1225
+ type: "array",
1226
+ items: {
1227
+ type: "object",
1228
+ required: ["path", "message"],
1229
+ properties: {
1230
+ path: { type: "string" },
1231
+ message: { type: "string" },
1232
+ value: {}
1233
+ }
1234
+ }
1235
+ }
1236
+ }
1237
+ } } };
1238
+ if (hasAnyAuthorizedAction) Object.assign(spec.components, { securitySchemes: { bearerAuth: {
1210
1239
  type: "http",
1211
1240
  scheme: "bearer",
1212
1241
  bearerFormat: "JWT",
1213
1242
  description: "Enter your Bearer authentication token"
1214
- } } };
1243
+ } } });
1215
1244
  return spec;
1216
1245
  }
1217
1246
  //#endregion
@@ -1530,26 +1559,12 @@ function createEndpointHandler(def, services) {
1530
1559
  try {
1531
1560
  return await def.handler(ctx);
1532
1561
  } catch (err) {
1533
- if (err instanceof ValidationError) {
1534
- set.status = err.status || 400;
1535
- return err.toJSON();
1536
- }
1537
- if (err instanceof ActionExecutionError) {
1538
- set.status = err.status || 400;
1539
- return err.toJSON();
1540
- }
1541
- if (typeof err?.status === "number") {
1542
- set.status = err.status;
1543
- return {
1544
- message: err.message || "Endpoint error",
1545
- status: err.status
1546
- };
1547
- }
1548
- set.status = 500;
1549
- return {
1550
- message: err?.message || "An unexpected error occurred",
1551
- status: 500
1552
- };
1562
+ const response = toErrorResponse(!(err instanceof ActionExecutionError || err instanceof ValidationError) && err !== null && typeof err === "object" && "status" in err && typeof err.status === "number" && Number.isInteger(err.status) && err.status >= 400 && err.status < 500 ? new ActionExecutionError("HTTP_ERROR", "message" in err && typeof err.message === "string" ? err.message : "Endpoint error", err.status, void 0, { cause: err }) : err, {
1563
+ logger: ctx.logger,
1564
+ requestId
1565
+ });
1566
+ set.status = response.status;
1567
+ return response;
1553
1568
  }
1554
1569
  };
1555
1570
  }
@@ -1774,13 +1789,13 @@ function emitHandlerFactory(route) {
1774
1789
  const asyncStages = route.context || route.authorize;
1775
1790
  const context = route.context ? "const extra = await contextHook(ctx); if (extra) Object.assign(ctx, extra);" : "";
1776
1791
  const validation = route.input ? `checkDepth(input, ${name}); validate(inputChecker, input, ${name}, "input");` : "";
1777
- const authorization = route.authorize ? `if (!await authorize({ ctx, input, user: ctx.user })) deny(${name});` : "";
1792
+ const authorization = route.authorize ? `if (!await authorize({ ctx, input, user: ctx.user })) deny(${name}, ctx.user);` : "";
1778
1793
  const output = route.output ? `validate(outputChecker, result, ${name}, "output");` : "";
1779
1794
  const execute = asyncStages ? `const result = await execute({ input, ctx, error: errorBuilder });\n${output}\nreturn result;` : `const result = execute({ input, ctx, error: errorBuilder });
1780
1795
  if (isThenable(result)) return Promise.resolve(result).then(value => {
1781
1796
  ${route.output ? `validate(outputChecker, value, ${name}, "output");` : ""}
1782
1797
  return value;
1783
- }).catch(err => mapError(err, set));
1798
+ }).catch(err => mapError(err, set, ctx));
1784
1799
  ${output}
1785
1800
  return result;`;
1786
1801
  return `function bindAction(binding, runtime) {
@@ -1799,7 +1814,7 @@ ${context}
1799
1814
  ${validation}
1800
1815
  ${authorization}
1801
1816
  ${execute}
1802
- } catch (err) { return mapError(err, set); }
1817
+ } catch (err) { return mapError(err, set, ctx); }
1803
1818
  };
1804
1819
  }`;
1805
1820
  }
@@ -2182,6 +2197,18 @@ function defineResource(service, config) {
2182
2197
  return resource;
2183
2198
  }
2184
2199
  //#endregion
2200
+ //#region src/context.ts
2201
+ function pickContextEnvelope(context) {
2202
+ if (!context) return {};
2203
+ const envelope = {};
2204
+ if (context.caller !== void 0) envelope.caller = context.caller;
2205
+ if (context.user !== void 0) envelope.user = context.user;
2206
+ if (context.traceId !== void 0) envelope.traceId = context.traceId;
2207
+ if (context.requestId !== void 0) envelope.requestId = context.requestId;
2208
+ if (context.tenantId !== void 0) envelope.tenantId = context.tenantId;
2209
+ return envelope;
2210
+ }
2211
+ //#endregion
2185
2212
  //#region src/service.ts
2186
2213
  const defaultLogger = {
2187
2214
  info: (...args) => console.log("[INFO]", ...args),
@@ -2320,55 +2347,22 @@ var ServiceImpl = class {
2320
2347
  }
2321
2348
  async _resolveContextSlow(callCtx) {
2322
2349
  const seq = ++_ctxSeq;
2323
- const req = callCtx?.request ?? DEFAULT_REQUEST;
2324
- const db = this.getDb();
2325
- const logger = callCtx?.logger ?? defaultLogger;
2326
- const traceId = callCtx?.traceId ?? `tr_${seq.toString(36)}`;
2327
- const requestId = callCtx?.requestId ?? `req_${seq.toString(36)}`;
2328
- const services = callCtx?.services ?? EMPTY_SERVICES;
2329
- const metadata = callCtx?.metadata ?? EMPTY_METADATA;
2330
- if (!this.options.context) {
2331
- const finalCtx = {
2332
- request: req,
2333
- db,
2334
- logger,
2335
- traceId,
2336
- requestId,
2337
- services,
2338
- metadata,
2339
- [RESOLVED_SYMBOL]: this
2340
- };
2341
- if (callCtx?.user !== void 0) finalCtx.user = callCtx.user;
2342
- if (callCtx?.caller !== void 0) finalCtx.caller = callCtx.caller;
2343
- return finalCtx;
2344
- }
2345
2350
  const fullBaseCtx = {
2346
- request: req,
2347
- db,
2348
- logger,
2349
- traceId,
2350
- requestId,
2351
- services,
2352
- metadata
2351
+ request: callCtx?.request ?? DEFAULT_REQUEST,
2352
+ db: this.getDb(),
2353
+ logger: callCtx?.logger ?? defaultLogger,
2354
+ traceId: callCtx?.traceId ?? `tr_${seq.toString(36)}`,
2355
+ requestId: callCtx?.requestId ?? `req_${seq.toString(36)}`,
2356
+ services: callCtx?.services ?? EMPTY_SERVICES,
2357
+ metadata: callCtx?.metadata ?? EMPTY_METADATA,
2358
+ ...pickContextEnvelope(callCtx)
2353
2359
  };
2354
- const resolvedExtra = await this.options.context(fullBaseCtx);
2355
- const finalCtx = {
2360
+ const resolvedExtra = this.options.context ? await this.options.context(fullBaseCtx) : {};
2361
+ return {
2356
2362
  ...fullBaseCtx,
2357
2363
  ...resolvedExtra,
2358
2364
  [RESOLVED_SYMBOL]: this
2359
2365
  };
2360
- if (callCtx) {
2361
- for (const [key, value] of Object.entries(callCtx)) if (![
2362
- "db",
2363
- "request",
2364
- "logger",
2365
- "services",
2366
- "metadata",
2367
- "_resolved",
2368
- RESOLVED_SYMBOL
2369
- ].includes(key)) finalCtx[key] = value;
2370
- }
2371
- return finalCtx;
2372
2366
  }
2373
2367
  introspect() {
2374
2368
  const databaseConfig = this.database ? {
@@ -2420,27 +2414,16 @@ function createServiceProxy(serviceName, options = {}) {
2420
2414
  if (!service) throw new Error(`[Brick-TS RPC] Service '${serviceName}' is not registered in the local runtime.`);
2421
2415
  const action = service.getAction(actionName);
2422
2416
  if (!action) throw new Error(`[Brick-TS RPC] Action '${actionName}' does not exist on service '${serviceName}'.`);
2423
- const dangerousFields = /* @__PURE__ */ new Set([
2424
- "db",
2425
- "request",
2426
- "logger",
2427
- "services",
2428
- "metadata",
2429
- "_resolved"
2430
- ]);
2431
- const envelopeCtx = {};
2432
- if (options.context) {
2433
- for (const [key, value] of Object.entries(options.context)) if (!dangerousFields.has(key)) envelopeCtx[key] = value;
2434
- }
2435
- if (callCtx) {
2436
- for (const [key, value] of Object.entries(callCtx)) if (!dangerousFields.has(key)) envelopeCtx[key] = value;
2437
- }
2417
+ const envelopeCtx = {
2418
+ ...pickContextEnvelope(options.context),
2419
+ ...pickContextEnvelope(callCtx)
2420
+ };
2438
2421
  if (!envelopeCtx.caller) envelopeCtx.caller = serviceName;
2439
2422
  return action.execute({
2440
2423
  input: payload,
2441
2424
  ctx: envelopeCtx
2442
2425
  });
2443
- } else throw new Error(`[Brick-TS RPC] Remote microservice dispatch for '${serviceName}.${actionName}' is not yet configured for this environment.`);
2426
+ } else throw new Error(`[Brick-TS RPC] Remote microservice dispatch for '${serviceName}.${actionName}' is not configured. Use createClient({ baseUrl, contract }) for HTTP calls to remote services.`);
2444
2427
  };
2445
2428
  } });
2446
2429
  }
@@ -2566,6 +2549,6 @@ function createMcpHandler(options) {
2566
2549
  };
2567
2550
  }
2568
2551
  //#endregion
2569
- export { ACTION_ACCESS_KEY, ActionExecutionError, BrickServerError, BrickTransportError, SecretRef, ServiceImpl, ServiceRegistry, Table, Type, UnknownToolError, ValidationError, and, asc, attachDatabase, bindCompiledApplication, blob, brick, buildErrorHelpers, buildFtsMatchQuery, compileBrickApplication, compileRoutePlan, compilerRuntime, createActionHandler, createBrickClient, createDatabase, createEndpointHandler, createMcpHandler, createMcpRegistry, createPostgresDatabase, createSQLiteDatabase, createServiceProxy, defineAction, defineDatabase, defineResource, defineResourcePlugin, defineService, defineServicePlugin, defineTool, desc, emitHandlerFactory, endpointPaths, ensureResourceIndexes, ensureSQLiteFts, envSource, eq, executeCompiledRoute, foreignKey, generateOpenApiSpec, generateSQLiteIndexDdl, generateSQLiteTableDdl, getActionAccess, getCompiledCheck, getGlobalRegistry, getPluginActionRoute, getPluginEndpoints, getTableColumns, getTableName, gt, gte, ilike, inArray, index, integer, is, isBrickApp, isBrickServerError, isBrickTransportError, isDatabaseHandle, isNotNull, isNull, isTool, like, listSecrets, loadCompiledBrickApp, lt, lte, ne, not, notInArray, or, overrideSecret, overrideSecrets, primaryKey, real, referencePlugin, registerReferenceRoute, relations, requestLoggingPlugin, requireBrickApp, resetGlobalRegistry, resetSecrets, resolveEndpointDb, resolveSecrets, scalarDocsHTML, secret, setActionAccess, sql, sqliteTable, swaggerDocsHTML, syncSchema, t, text, toOpenApiPath, uniqueIndex, validateWithSchema };
2552
+ export { ACTION_ACCESS_KEY, ActionExecutionError, BrickServerError, BrickTransportError, SecretRef, ServiceImpl, ServiceRegistry, Table, Type, UnknownToolError, ValidationError, and, asc, attachDatabase, bindCompiledApplication, blob, brick, buildErrorHelpers, buildFtsMatchQuery, compileBrickApplication, compileRoutePlan, compilerRuntime, createActionHandler, createBrickClient, createDatabase, createEndpointHandler, createMcpHandler, createMcpRegistry, createPostgresDatabase, createSQLiteDatabase, createServiceProxy, defineAction, defineDatabase, defineResource, defineResourcePlugin, defineService, defineServicePlugin, defineTool, desc, emitHandlerFactory, endpointPaths, ensureResourceIndexes, ensureSQLiteFts, envSource, eq, executeCompiledRoute, foreignKey, generateOpenApiSpec, generateSQLiteIndexDdl, generateSQLiteTableDdl, getActionAccess, getCompiledCheck, getGlobalRegistry, getPluginActionRoute, getPluginEndpoints, getTableColumns, getTableName, gt, gte, ilike, inArray, index, integer, is, isBrickApp, isBrickServerError, isBrickTransportError, isDatabaseHandle, isNotNull, isNull, isTool, like, listSecrets, loadCompiledBrickApp, lt, lte, ne, not, notInArray, or, overrideSecret, overrideSecrets, primaryKey, real, referencePlugin, registerReferenceRoute, relations, requestLoggingPlugin, requireBrickApp, resetGlobalRegistry, resetSecrets, resolveEndpointDb, resolveSecrets, scalarDocsHTML, secret, setActionAccess, sql, sqliteTable, swaggerDocsHTML, syncSchema, t, text, toErrorResponse, toOpenApiPath, uniqueIndex, validateWithSchema };
2570
2553
 
2571
2554
  //# sourceMappingURL=index.js.map