@brickkit/core 0.13.3 → 0.15.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/chunks/client.d.ts +3 -1
- package/dist/chunks/client.js +32 -18
- package/dist/chunks/client.js.map +1 -1
- package/dist/chunks/server.d.ts +18 -3
- package/dist/chunks/server.js +867 -44
- package/dist/chunks/server.js.map +1 -1
- package/dist/chunks/types.d.ts +696 -5
- package/dist/client.d.ts +1 -1
- package/dist/index.d.ts +27 -4
- package/dist/index.js +51 -2
- package/dist/index.js.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/workflow.d.ts +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as BrickSocketError,
|
|
1
|
+
import { $ as BrickSocketError, Ot as STANDARD_ERRORS, Q as BrickSocketConnectOptions, X as BrickSocketClient, Y as BrickClientSocket, at as BrickSocketStatus, it as BrickSocketSender, jt as isControlEvent, nt as BrickSocketReconnectOptions, tt as BrickSocketHandlerError, ut as SocketEventArgs } from "./chunks/types.js";
|
|
2
2
|
import { a as BrickClientOptions, c as BrickTransportError, d as InferActionInput, f as InferActionOutput, g as ATTR, h as isBrickTransportError, i as BrickClientAction, l as InferActionErrorCodes, m as isBrickServerError, n as BrickCallOptions, o as BrickServerError, p as createBrickClient, r as BrickClient, s as BrickServices, t as BrickActionCaller, u as InferActionFailure, v as SPAN, y as kebabCase } from "./chunks/client.js";
|
|
3
3
|
export { ATTR, BrickActionCaller, BrickCallOptions, BrickClient, BrickClientAction, BrickClientOptions, type BrickClientSocket, BrickServerError, BrickServices, type BrickSocketClient, type BrickSocketConnectOptions, BrickSocketError, type BrickSocketHandlerError, type BrickSocketReconnectOptions, type BrickSocketSender, type BrickSocketStatus, BrickTransportError, InferActionErrorCodes, InferActionFailure, InferActionInput, InferActionOutput, SPAN, STANDARD_ERRORS, type SocketEventArgs, createBrickClient, isBrickServerError, isBrickTransportError, isControlEvent, kebabCase };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $n as
|
|
1
|
+
import { $n as CrudEventPayload, $t as text, A as Resource, An as PluginFactory, Ar as useDeps, At as WireError, B as ServiceSchema, Bn as SecretRef, Bt as PostgresDatabaseConfig, C as ErrorDetails, Cn as OutboxStatus, Cr as crudEventName, Ct as DashboardIdentity, D as NarrowAuthorizedContext, Dn as outboxTable, Dr as Port, Dt as signDashboardIdentity, E as Logger, En as SQLiteOutboxTable, Er as DepsOf, Et as dashboardUser, F as ResourceConfig, Fn as PluginManifest, Ft as PostgresDefinition, G as ToolConfigWithoutAuthorize, Gn as overrideSecret, Gt as blob, H as Tool, Hn as defineSecret, Ht as BrickSQLiteDatabase, I as ResourceIdentity, In as PluginServiceContext, It as SQLiteDefinition, J as ValidationErrorItem, Jn as PluginTableBuilders, Jt as index, K as ToolOptions, Kn as resetSecrets, Kt as createSQLiteDatabase, L as ResourceTypeOptions, Ln as PluginSetupContext, Lt as defineDatabase, M as ResourceActionConfig, Mn as PluginInstallOptions, Mt as DatabaseDefinition, N as ResourceActionInput, Nn as PluginInstance, Nt as DatabaseHandle, O as PreparationContribution, On as PluginAppContext, Or as Ports, P as ResourceChild, Pn as PluginLifecycleContext, Pt as EnvInput, Qn as getHostHooks, Qt as sqliteTable, R as Service, Rn as definePlugin, Rt as isDatabaseHandle, S as ErrorBuilder, Sn as scheduleTable, Sr as EventRefs, St as DASHBOARD_KEY_ENV, T as InferTableRow, Tn as PostgresOutboxTable, Tr as isCrudEvent, Tt as dashboardKey, U as ToolAnnotations, Un as envSource, Ut as BunSQLiteDatabase, V as StandardErrorMap, Vn as SecretSource, Vt as createPostgresDatabase, W as ToolConfigWithAuthorize, Wn as listSecrets, Wt as SQLiteDatabaseConfig, Xn as PluginHookArgs, Xt as primaryKey, Y as BrickClientSocket, Yn as HostHooks, Yt as integer, Z as BrickSocketConfig, Zn as PluginHooks, Zt as real, _ as CommandDecision, _r as ScheduleWorkflowRun, _t as stopAllEvents, a as ActionConfigWithoutAuthorize, an as PluginRouteMethod, ar as EventWorkflow, b as DefaultServiceContext, bn as ScheduleRunRecord, br as EventCatalog, bt as OutboxCounts, c as ActionExecutionError, cn as PluginRoutes, cr as ListenerFailure, ct as SocketEmitArgs, d as BaseActionConfig, dn as ResourcePluginContext, dr as WorkflowEvent, dt as SocketPayloads, en as uniqueIndex, er as DispatchOptions, et as BrickSocketHandle, f as BaseContext, fn as ResourcePluginTypes, fr as WorkflowsOptions, ft as SocketReplay, g as CommandConfig, gn as ResourceActionInfo, gr as ScheduleWorkflow, gt as ScheduleControl, h as CommandChildren, hn as ActionAccessInfo, hr as ScheduleRun, ht as EventsHub, i as ActionConfigWithAuthorize, in as PluginEndpointContext, ir as EventRecorder, it as BrickSocketSender, j as ResourceActionAccess, jn as PluginInfo, jr as HttpMethod, k as ProxyOptions, kn as PluginContext, kr as port, l as ActionSchema, ln as ResourcePlugin, lr as RetryDecision, lt as SocketEmitOptions, m as Command, mn as ServicePluginContext, mr as ScheduleConfig, mt as EventsDefinition, n as ActionAccessPolicy, nn as InstalledPlugin, nr as EventEnvelope, o as ActionContext, on as PluginRouteRegistrar, or as EventsOptions, ot as SocketBroker, p as ChildChanges, pn as ServicePlugin, pr as Schedule, pt as SocketSchemas, q as ValidationError, qn as resolveSecrets, qt as foreignKey, r as ActionConfig, rn as PLUGIN_KIND, rr as EventListener, rt as BrickSocketSchema, s as ActionErrorDefinition, sn as PluginRouteScope, sr as EventsWorld, st as SocketBrokerMessage, t as Action, tn as ContextOf, tr as EventDelivery, u as ArchitectureSchema, un as ResourcePluginAPI, ur as ServiceEvents, ut as SocketEventArgs, v as CommandErrors, vn as PostgresScheduleTable, vr as defineSchedule, vt as ScheduleState, w as InferTableInsert, wn as OutboxTable, wr as crudEventSource, wt as DashboardUser, x as DuplicateNameError, xn as ScheduleTable, xr as EventRef, xt as DASHBOARD_IDENTITY_HEADER, y as CommandRow, yn as SQLiteScheduleTable, yr as CrudEventOperation, yt as Dispatcher, z as ServiceOptions, zn as SecretOptions, zt as PostgresDatabase } from "./chunks/types.js";
|
|
2
2
|
import { A as scalarDocsHTML, C as ApiDocument, D as ReferenceOptions, E as ReferenceDocument, M as RouteIR, N as RouteMethod, O as referencePlugin, S as DashboardOptions, T as OpenApiDocument, _ as EndpointContext, a as RequestLoggingOptions, b as EndpointMethod, c as CompiledRoute, d as loadCompiledBrickApp, f as CompiledHandler, g as BrickApp, h as deny, i as CorsOrigin, j as BrickIR, k as registerReferenceRoute, l as bindCompiledApplication, m as HandlerFactory, n as brick, o as requestLoggingPlugin, p as CompiledRoutePlan, r as CorsOptions, s as CompiledApplication, t as CreateServerOptions, u as compileBrickApplication, v as EndpointDefinition, w as DocumentationOptions, x as DashboardAuth, y as EndpointLogger } from "./chunks/server.js";
|
|
3
3
|
import { _ as GLOBAL_SYMBOL, a as BrickClientOptions, c as BrickTransportError, d as InferActionInput, f as InferActionOutput, g as ATTR, h as isBrickTransportError, i as BrickClientAction, l as InferActionErrorCodes, m as isBrickServerError, n as BrickCallOptions, o as BrickServerError, p as createBrickClient, r as BrickClient, s as BrickServices, t as BrickActionCaller, u as InferActionFailure, v as SPAN, y as kebabCase } from "./chunks/client.js";
|
|
4
4
|
import { StepErrorBuilder, defineError, stepErrors, stepFailure } from "./workflow.js";
|
|
5
5
|
import { SpanKind } from "@opentelemetry/api";
|
|
6
|
-
import { Static, TSchema, TSchema as TSchema$1,
|
|
6
|
+
import { SchemaOptions, Static, TArray, TSchema, TSchema as TSchema$1, TUnsafe } from "@sinclair/typebox";
|
|
7
7
|
import "@sinclair/typebox/compiler";
|
|
8
8
|
import { Column, Table, Table as Table$1, 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";
|
|
9
9
|
/**
|
|
@@ -298,7 +298,7 @@ export declare function defineService<TDb = BunSQLiteDatabase<Record<string, unk
|
|
|
298
298
|
deps: DepsOf<TPorts>;
|
|
299
299
|
}, TEvents> & NamedService<TName>;
|
|
300
300
|
/** Keep validators browser-safe and reject schemas whose behavior cannot cross JSON. */
|
|
301
|
-
export declare function serializeSocketSchema(schema: TSchema$1): unknown;
|
|
301
|
+
export declare function serializeSocketSchema(schema: TSchema$1, path?: string): unknown;
|
|
302
302
|
interface RedisBrokerOptions {
|
|
303
303
|
/** Defaults to `REDIS_URL`, then `redis://localhost:6379`. */
|
|
304
304
|
url?: string;
|
|
@@ -655,6 +655,29 @@ export declare function getGlobalRegistry(): ServiceRegistry;
|
|
|
655
655
|
* services again in each case; an application never needs it.
|
|
656
656
|
*/
|
|
657
657
|
export declare function resetGlobalRegistry(): void;
|
|
658
|
+
/**
|
|
659
|
+
* Any JSON value: null, boolean, number, string, or an array or object of
|
|
660
|
+
* JSON values.
|
|
661
|
+
*/
|
|
662
|
+
declare function Json(options?: SchemaOptions): import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TNull, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TString, TArray<import("@sinclair/typebox").TThis>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TThis>]>>;
|
|
663
|
+
interface FileOptions {
|
|
664
|
+
/** The largest file accepted, in bytes. Also caps the request body before it is read. */
|
|
665
|
+
maxSize?: number;
|
|
666
|
+
description?: string;
|
|
667
|
+
}
|
|
668
|
+
/** A file from a `multipart/form-data` body: a `File` (a `Blob`), at most `maxSize` bytes. */
|
|
669
|
+
declare function File(options?: FileOptions): TUnsafe<File>;
|
|
670
|
+
/** Several files under one form field. */
|
|
671
|
+
declare function Files(options?: FileOptions & {
|
|
672
|
+
minItems?: number;
|
|
673
|
+
maxItems?: number;
|
|
674
|
+
}): TArray<TUnsafe<File>>;
|
|
675
|
+
/** TypeBox's `Type` plus Brick's `Json`, `File` and `Files`. */
|
|
676
|
+
export declare const Type: import("@sinclair/typebox").JavaScriptTypeBuilder & {
|
|
677
|
+
Json: typeof Json;
|
|
678
|
+
File: typeof File;
|
|
679
|
+
Files: typeof Files;
|
|
680
|
+
};
|
|
658
681
|
/**
|
|
659
682
|
* Check a value against a schema, the way actions check their input and output.
|
|
660
683
|
*
|
|
@@ -762,5 +785,5 @@ export declare function createMcpHandler(options: McpHandlerOptions): (request:
|
|
|
762
785
|
interface ErrorEnvelope extends WireError {
|
|
763
786
|
requestId: string;
|
|
764
787
|
}
|
|
765
|
-
export { ATTR, 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, ChildChanges, Command, CommandChildren, CommandConfig, CommandDecision, CommandErrors, CommandRow, type CompiledApplication, type CompiledHandler, type CompiledRoute, type CompiledRoutePlan, type CorsOptions, type CorsOrigin, type CreateServerOptions, type CrudEventOperation, type CrudEventPayload, type DashboardAuth, type DashboardOptions, DatabaseDefinition, DatabaseHandle, DefaultServiceContext, type DepsOf, type DispatchOptions, Dispatcher, type DocumentationOptions, DuplicateNameError, 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, type EventsHub, type EventsOptions, type EventsWorld, GLOBAL_SYMBOL, type HandlerFactory, type HostHooks, type HttpMethod, type InferActionErrorCodes, type InferActionFailure, type InferActionInput, type InferActionOutput, InferTableInsert, InferTableRow, type InstalledPlugin, 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 PluginHookArgs, type PluginHooks, type PluginInfo, type PluginInstallOptions, type PluginInstance, type PluginLifecycleContext, type PluginManifest, type PluginRouteMethod, type PluginRouteRegistrar, type PluginRouteScope, type PluginRoutes, type PluginServiceContext, type PluginSetupContext, type PluginTableBuilders, type Port, type Ports, PostgresDatabase, PostgresDatabaseConfig, PostgresDefinition, type PostgresOutboxTable, PreparationContribution, ProxyOptions, type RedisBrokerOptions, type ReferenceDocument, type ReferenceOptions, type RequestLoggingOptions, Resource, ResourceActionAccess, ResourceActionConfig, type ResourceActionInfo, ResourceActionInput, ResourceChild, ResourceConfig, ResourceIdentity, type ResourcePlugin, type ResourcePluginAPI, type ResourcePluginContext, type ResourcePluginTypes, ResourceTypeOptions, type RetryDecision, type RouteIR, type RouteMethod, SPAN, SQLiteDatabaseConfig, SQLiteDefinition, type SQLiteOutboxTable, type SecretOptions, SecretRef, type SecretSource, Service, type ServiceActionCaller, type ServiceClient, type ServiceEvents, ServiceOptions, type ServicePlugin, type ServicePluginContext, type ServiceRegistry, ServiceSchema, type SocketBroker, type SocketBrokerMessage, type SocketEmitArgs, type SocketEmitOptions, type SocketEventArgs, type SocketPayloads, type SocketReplay, type SocketSchemas, StandardErrorMap, type Static, type StepErrorBuilder, type TSchema, type Table, Tool, ToolAnnotations, ToolConfigWithAuthorize, ToolConfigWithoutAuthorize, ToolOptions, Type
|
|
788
|
+
export { ATTR, 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, ChildChanges, Command, CommandChildren, CommandConfig, CommandDecision, CommandErrors, CommandRow, type CompiledApplication, type CompiledHandler, type CompiledRoute, type CompiledRoutePlan, type CorsOptions, type CorsOrigin, type CreateServerOptions, type CrudEventOperation, type CrudEventPayload, DASHBOARD_IDENTITY_HEADER, DASHBOARD_KEY_ENV, type DashboardAuth, type DashboardIdentity, type DashboardOptions, type DashboardUser, DatabaseDefinition, DatabaseHandle, DefaultServiceContext, type DepsOf, type DispatchOptions, Dispatcher, type DocumentationOptions, DuplicateNameError, 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, type EventsHub, type EventsOptions, type EventsWorld, GLOBAL_SYMBOL, type HandlerFactory, type HostHooks, type HttpMethod, type InferActionErrorCodes, type InferActionFailure, type InferActionInput, type InferActionOutput, InferTableInsert, InferTableRow, type InstalledPlugin, 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 PluginHookArgs, type PluginHooks, type PluginInfo, type PluginInstallOptions, type PluginInstance, type PluginLifecycleContext, type PluginManifest, type PluginRouteMethod, type PluginRouteRegistrar, type PluginRouteScope, type PluginRoutes, type PluginServiceContext, type PluginSetupContext, type PluginTableBuilders, type Port, type Ports, PostgresDatabase, PostgresDatabaseConfig, PostgresDefinition, type PostgresOutboxTable, type PostgresScheduleTable, PreparationContribution, ProxyOptions, type RedisBrokerOptions, type ReferenceDocument, type ReferenceOptions, type RequestLoggingOptions, Resource, ResourceActionAccess, ResourceActionConfig, type ResourceActionInfo, ResourceActionInput, ResourceChild, ResourceConfig, ResourceIdentity, type ResourcePlugin, type ResourcePluginAPI, type ResourcePluginContext, type ResourcePluginTypes, ResourceTypeOptions, type RetryDecision, type RouteIR, type RouteMethod, SPAN, SQLiteDatabaseConfig, SQLiteDefinition, type SQLiteOutboxTable, type SQLiteScheduleTable, type Schedule, type ScheduleConfig, type ScheduleControl, type ScheduleRun, type ScheduleRunRecord, type ScheduleState, type ScheduleTable, type ScheduleWorkflow, type ScheduleWorkflowRun, type SecretOptions, SecretRef, type SecretSource, Service, type ServiceActionCaller, type ServiceClient, type ServiceEvents, ServiceOptions, type ServicePlugin, type ServicePluginContext, type ServiceRegistry, ServiceSchema, type SocketBroker, type SocketBrokerMessage, type SocketEmitArgs, type SocketEmitOptions, type SocketEventArgs, type SocketPayloads, type SocketReplay, type SocketSchemas, StandardErrorMap, type Static, type StepErrorBuilder, type TSchema, type Table, Tool, ToolAnnotations, ToolConfigWithAuthorize, ToolConfigWithoutAuthorize, ToolOptions, Type as t, type UntypedServiceClient, ValidationError, ValidationErrorItem, type WorkflowEvent, type WorkflowsOptions, and, asc, bindCompiledApplication, blob, brick, compileBrickApplication, createBrickClient, createPostgresDatabase, createSQLiteDatabase, crudEventName, crudEventSource, dashboardKey, dashboardUser, defineDatabase, defineError, definePlugin, defineSchedule, defineSecret, deny, desc, envSource, eq, foreignKey, getHostHooks, getTableColumns, getTableName, gt, gte, ilike, inArray, index, integer, is, isBrickServerError, isBrickTransportError, isCrudEvent, isDatabaseHandle, isNotNull, isNull, kebabCase, like, listSecrets, loadCompiledBrickApp, lt, lte, ne, not, notInArray, or, outboxTable, overrideSecret, port, primaryKey, real, referencePlugin, registerReferenceRoute, relations, requestLoggingPlugin, resetSecrets, resolveSecrets, scalarDocsHTML, scheduleTable, signDashboardIdentity, sql, sqliteTable, stepErrors, stepFailure, stopAllEvents, text, uniqueIndex, useDeps };
|
|
766
789
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as segmentClaimant, A as WORKFLOW_BUNDLE, B as requireBrickApp, C as getActionAccess, D as bindCompiledApplication, E as resetGlobalRegistry, F as crudEventName, G as port, H as claimName, I as crudEventSource, J as defineServicePlugin, K as useDeps, L as eventRefs, M as defineListener, N as checkEvent, O as compileBrickApplication, P as checkPayload, Q as isInstallingPlugin, R as isCrudEvent, S as generateOpenApiSpec, T as getGlobalRegistry, U as definitionSite, V as createActionHandler, W as INTERNALS, X as hasPlugin, Y as getPluginEndpoints, Z as installPlugin, _ as envSource, _t as withCallSpan, a as defineSchedule, at as deny, b as resetSecrets, c as runInTransaction, ct as DASHBOARD_IDENTITY_HEADER, d as referencePlugin, dt as dashboardUser, et as validateName, f as registerReferenceRoute, ft as signDashboardIdentity, g as defineSecret, gt as traceRoute, h as SecretRef, ht as validateWithSchema, i as stopAllEvents, it as errorsOf, j as resolveWorkflowPaths, k as loadCompiledBrickApp, l as isOutboxTable, lt as DASHBOARD_KEY_ENV, m as requestLoggingPlugin, mt as fileFields, n as defineServiceSocket, nt as buildErrorHelpers, o as Dispatcher, ot as baseContext, p as scalarDocsHTML, pt as Type, q as defineResourcePlugin, r as recordingServices, rt as defineAction, s as onTransactionCommit, st as pickContextEnvelope, t as brick, tt as portOf, u as outboxTable, ut as dashboardKey, v as listSecrets, vt as PLUGIN_COMMIT, w as setActionAccess, x as resolveSecrets, y as overrideSecret, yt as PLUGIN_KIND, z as isBrickApp } from "./chunks/server.js";
|
|
2
2
|
import { G as DuplicateNameError, H as GLOBAL_SYMBOL, K as ValidationError, S as actionMeta, U as SPAN, V as ATTR, W as ActionExecutionError, a as isBrickTransportError, d as getActionRoute, f as getPluginActionRoute, i as isBrickServerError, j as compareSocketSeq, l as actionOwners, n as BrickTransportError, r as createBrickClient, s as serializeSocketSchema, t as BrickServerError, x as kebabCase } from "./chunks/client.js";
|
|
3
3
|
import { defineError, stepErrors, stepFailure } from "./workflow.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
@@ -373,6 +373,7 @@ function checkOptions(plugin, schema, input) {
|
|
|
373
373
|
// src/tool.ts
|
|
374
374
|
function defineTool(config) {
|
|
375
375
|
if (config.input && config.input.type !== "object") throw new Error(`Tool '${config.name}' input must be an object schema`);
|
|
376
|
+
if (fileFields(config.input).length) throw new Error(`Tool '${config.name}' input has file fields; MCP carries JSON only, so take uploads in an action`);
|
|
376
377
|
const tool = defineAction(config);
|
|
377
378
|
Object.defineProperty(tool, "kind", { value: "tool" });
|
|
378
379
|
return tool;
|
|
@@ -1057,6 +1058,50 @@ function defineResource(service, config) {
|
|
|
1057
1058
|
};
|
|
1058
1059
|
return resource;
|
|
1059
1060
|
}
|
|
1061
|
+
// src/schedules/table.ts
|
|
1062
|
+
const SCHEDULES = Symbol.for("brick.schedules");
|
|
1063
|
+
function sqliteSchedules(name) {
|
|
1064
|
+
const at = (column) => integer$1(column, { mode: "timestamp_ms" });
|
|
1065
|
+
return sqliteTable$1(name, {
|
|
1066
|
+
name: text$1("name").primaryKey(),
|
|
1067
|
+
spec: text$1("spec").notNull(),
|
|
1068
|
+
slot: at("slot").notNull(),
|
|
1069
|
+
nextAt: at("next_at").notNull(),
|
|
1070
|
+
attempts: integer$1("attempts").notNull().default(0),
|
|
1071
|
+
trigger: text$1("trigger").$type().notNull(),
|
|
1072
|
+
runId: text$1("run_id"),
|
|
1073
|
+
startedAt: at("started_at"),
|
|
1074
|
+
leaseUntil: at("lease_until"),
|
|
1075
|
+
lastSuccessAt: at("last_success_at"),
|
|
1076
|
+
runs: text$1("runs", { mode: "json" }).$type().notNull()
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
function postgresSchedules(name) {
|
|
1080
|
+
const at = (column) => timestamp(column, { withTimezone: true });
|
|
1081
|
+
return pgTable(name, {
|
|
1082
|
+
name: text$2("name").primaryKey(),
|
|
1083
|
+
spec: text$2("spec").notNull(),
|
|
1084
|
+
slot: at("slot").notNull(),
|
|
1085
|
+
nextAt: at("next_at").notNull(),
|
|
1086
|
+
attempts: integer$2("attempts").notNull().default(0),
|
|
1087
|
+
trigger: text$2("trigger").$type().notNull(),
|
|
1088
|
+
runId: text$2("run_id"),
|
|
1089
|
+
startedAt: at("started_at"),
|
|
1090
|
+
leaseUntil: at("lease_until"),
|
|
1091
|
+
lastSuccessAt: at("last_success_at"),
|
|
1092
|
+
runs: jsonb("runs").$type().notNull()
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
function scheduleTable(engine, options = {}) {
|
|
1096
|
+
const name = options.name ?? "brick_schedules";
|
|
1097
|
+
const table = engine === "sqlite" ? sqliteSchedules(name) : postgresSchedules(name);
|
|
1098
|
+
Object.defineProperty(table, SCHEDULES, { value: { engine } });
|
|
1099
|
+
return table;
|
|
1100
|
+
}
|
|
1101
|
+
/** Whether a value is a table made by `scheduleTable`. */
|
|
1102
|
+
function isScheduleTable(value) {
|
|
1103
|
+
return typeof value === "object" && value !== null && SCHEDULES in value;
|
|
1104
|
+
}
|
|
1060
1105
|
// src/service.ts
|
|
1061
1106
|
const RESOLVED_SYMBOL = Symbol("resolved");
|
|
1062
1107
|
/** The deps a resolved context was resolved with, to restore them when a plugin's copy comes back. */
|
|
@@ -1240,6 +1285,9 @@ var ServiceImpl = class {
|
|
|
1240
1285
|
getOutbox() {
|
|
1241
1286
|
return Object.values(this.database?.tables ?? {}).find(isOutboxTable);
|
|
1242
1287
|
}
|
|
1288
|
+
getScheduleTable() {
|
|
1289
|
+
return Object.values(this.database?.tables ?? {}).find(isScheduleTable);
|
|
1290
|
+
}
|
|
1243
1291
|
setRecorder(recorder) {
|
|
1244
1292
|
this.recorder = recorder;
|
|
1245
1293
|
}
|
|
@@ -1338,6 +1386,7 @@ async function resolveServiceContext(service, callCtx, pluginDeps) {
|
|
|
1338
1386
|
requestId: callCtx?.requestId,
|
|
1339
1387
|
services: callCtx?.services,
|
|
1340
1388
|
metadata: callCtx?.metadata,
|
|
1389
|
+
dashboard: callCtx?.dashboard,
|
|
1341
1390
|
deps: service.deps ?? (callCtx?.[RESOLVED_SYMBOL] ? void 0 : callCtx?.deps)
|
|
1342
1391
|
});
|
|
1343
1392
|
const fullBaseCtx = {
|
|
@@ -1816,6 +1865,6 @@ function createMcpHandler(options) {
|
|
|
1816
1865
|
}
|
|
1817
1866
|
};
|
|
1818
1867
|
}
|
|
1819
|
-
export { ATTR, ActionExecutionError, BrickServerError, BrickTransportError, Dispatcher, DuplicateNameError, GLOBAL_SYMBOL, SPAN, SecretRef, Table, Type, UnknownToolError, ValidationError, WORKFLOW_BUNDLE, actionOwners, and, asc, attachDatabase, bindCompiledApplication, blob, brick, buildErrorHelpers, buildFtsMatchQuery, columnValue, compileBrickApplication, createActionHandler, createBrickClient, createMcpHandler, createMcpRegistry, createPostgresDatabase, createSQLiteDatabase, crudEventName, crudEventSource, defineAction, defineDatabase, defineError, defineListener, definePlugin, defineResource, defineResourcePlugin, defineSecret, defineService, defineServicePlugin, defineTool, deny, desc, drizzleSchema, emitEvent, ensureResourceIndexes, ensureSQLiteFts, envSource, eq, errorsOf, foreignKey, generateOpenApiSpec, generateSQLiteIndexDdl, generateSQLiteTableDdl, getActionAccess, getActionRoute, getGlobalRegistry, getHostHooks, getPluginActionRoute, getPluginEndpoints, getTableColumns, getTableName, gt, gte, idSchema, ilike, inArray, index, integer, is, isBrickApp, isBrickServerError, isBrickTransportError, isCrudEvent, isDatabaseHandle, isNotNull, isNull, isTool, kebabCase, like, listSecrets, loadCompiledBrickApp, loadRecord, lt, lte, migrateDatabase, ne, not, notInArray, onTransactionCommit, or, outboxTable, overrideSecret, port, primaryKey, real, redisBroker, referencePlugin, registerReferenceRoute, relations, requestLoggingPlugin, requireBrickApp, resetGlobalRegistry, resetSecrets, resolveSecrets, resolveWorkflowPaths, runInTransaction, scalarDocsHTML, serializeSocketSchema, setActionAccess, sql, sqliteTable, stepErrors, stepFailure, stopAllEvents, syncSchema,
|
|
1868
|
+
export { ATTR, ActionExecutionError, BrickServerError, BrickTransportError, DASHBOARD_IDENTITY_HEADER, DASHBOARD_KEY_ENV, Dispatcher, DuplicateNameError, GLOBAL_SYMBOL, SPAN, SecretRef, Table, Type, Type as t, UnknownToolError, ValidationError, WORKFLOW_BUNDLE, actionOwners, and, asc, attachDatabase, bindCompiledApplication, blob, brick, buildErrorHelpers, buildFtsMatchQuery, columnValue, compileBrickApplication, createActionHandler, createBrickClient, createMcpHandler, createMcpRegistry, createPostgresDatabase, createSQLiteDatabase, crudEventName, crudEventSource, dashboardKey, dashboardUser, defineAction, defineDatabase, defineError, defineListener, definePlugin, defineResource, defineResourcePlugin, defineSchedule, defineSecret, defineService, defineServicePlugin, defineTool, deny, desc, drizzleSchema, emitEvent, ensureResourceIndexes, ensureSQLiteFts, envSource, eq, errorsOf, foreignKey, generateOpenApiSpec, generateSQLiteIndexDdl, generateSQLiteTableDdl, getActionAccess, getActionRoute, getGlobalRegistry, getHostHooks, getPluginActionRoute, getPluginEndpoints, getTableColumns, getTableName, gt, gte, idSchema, ilike, inArray, index, integer, is, isBrickApp, isBrickServerError, isBrickTransportError, isCrudEvent, isDatabaseHandle, isNotNull, isNull, isTool, kebabCase, like, listSecrets, loadCompiledBrickApp, loadRecord, lt, lte, migrateDatabase, ne, not, notInArray, onTransactionCommit, or, outboxTable, overrideSecret, port, primaryKey, real, redisBroker, referencePlugin, registerReferenceRoute, relations, requestLoggingPlugin, requireBrickApp, resetGlobalRegistry, resetSecrets, resolveSecrets, resolveWorkflowPaths, runInTransaction, scalarDocsHTML, scheduleTable, serializeSocketSchema, setActionAccess, signDashboardIdentity, sql, sqliteTable, stepErrors, stepFailure, stopAllEvents, syncSchema, text, traceRoute, uniqueIndex, useDeps, useService, validateWithSchema };
|
|
1820
1869
|
|
|
1821
1870
|
//# sourceMappingURL=index.js.map
|