syncorejs 0.2.0 → 0.2.2
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 +2 -1
- package/dist/_vendor/cli/app.d.mts.map +1 -1
- package/dist/_vendor/cli/app.mjs +323 -42
- package/dist/_vendor/cli/app.mjs.map +1 -1
- package/dist/_vendor/cli/context.mjs +27 -9
- package/dist/_vendor/cli/context.mjs.map +1 -1
- package/dist/_vendor/cli/doctor.mjs +513 -46
- package/dist/_vendor/cli/doctor.mjs.map +1 -1
- package/dist/_vendor/cli/messages.mjs +5 -4
- package/dist/_vendor/cli/messages.mjs.map +1 -1
- package/dist/_vendor/cli/project.mjs +110 -12
- package/dist/_vendor/cli/project.mjs.map +1 -1
- package/dist/_vendor/cli/render.mjs +57 -9
- package/dist/_vendor/cli/render.mjs.map +1 -1
- package/dist/_vendor/cli/targets.mjs +4 -3
- package/dist/_vendor/cli/targets.mjs.map +1 -1
- package/dist/_vendor/core/cli.d.mts +13 -3
- package/dist/_vendor/core/cli.d.mts.map +1 -1
- package/dist/_vendor/core/cli.mjs +242 -91
- package/dist/_vendor/core/cli.mjs.map +1 -1
- package/dist/_vendor/core/devtools-auth.mjs +60 -0
- package/dist/_vendor/core/devtools-auth.mjs.map +1 -0
- package/dist/_vendor/core/index.d.mts +5 -3
- package/dist/_vendor/core/index.mjs +22 -2
- package/dist/_vendor/core/index.mjs.map +1 -1
- package/dist/_vendor/core/runtime/components.d.mts +111 -0
- package/dist/_vendor/core/runtime/components.d.mts.map +1 -0
- package/dist/_vendor/core/runtime/components.mjs +186 -0
- package/dist/_vendor/core/runtime/components.mjs.map +1 -0
- package/dist/_vendor/core/runtime/devtools.d.mts +4 -4
- package/dist/_vendor/core/runtime/devtools.d.mts.map +1 -1
- package/dist/_vendor/core/runtime/devtools.mjs +52 -41
- package/dist/_vendor/core/runtime/devtools.mjs.map +1 -1
- package/dist/_vendor/core/runtime/functions.d.mts +10 -10
- package/dist/_vendor/core/runtime/functions.d.mts.map +1 -1
- package/dist/_vendor/core/runtime/functions.mjs +2 -2
- package/dist/_vendor/core/runtime/functions.mjs.map +1 -1
- package/dist/_vendor/core/runtime/internal/engines/devtoolsEngine.mjs +77 -0
- package/dist/_vendor/core/runtime/internal/engines/devtoolsEngine.mjs.map +1 -0
- package/dist/_vendor/core/runtime/internal/engines/executionEngine.mjs +617 -0
- package/dist/_vendor/core/runtime/internal/engines/executionEngine.mjs.map +1 -0
- package/dist/_vendor/core/runtime/internal/engines/reactivityEngine.mjs +186 -0
- package/dist/_vendor/core/runtime/internal/engines/reactivityEngine.mjs.map +1 -0
- package/dist/_vendor/core/runtime/internal/engines/schedulerEngine.mjs +220 -0
- package/dist/_vendor/core/runtime/internal/engines/schedulerEngine.mjs.map +1 -0
- package/dist/_vendor/core/runtime/internal/engines/schemaEngine.mjs +203 -0
- package/dist/_vendor/core/runtime/internal/engines/schemaEngine.mjs.map +1 -0
- package/dist/_vendor/core/runtime/internal/engines/shared.mjs +177 -0
- package/dist/_vendor/core/runtime/internal/engines/shared.mjs.map +1 -0
- package/dist/_vendor/core/runtime/internal/engines/storageEngine.mjs +144 -0
- package/dist/_vendor/core/runtime/internal/engines/storageEngine.mjs.map +1 -0
- package/dist/_vendor/core/runtime/internal/runtimeKernel.mjs +220 -0
- package/dist/_vendor/core/runtime/internal/runtimeKernel.mjs.map +1 -0
- package/dist/_vendor/core/runtime/internal/runtimeStatus.mjs +32 -0
- package/dist/_vendor/core/runtime/internal/runtimeStatus.mjs.map +1 -0
- package/dist/_vendor/core/runtime/internal/systemMeta.mjs +61 -0
- package/dist/_vendor/core/runtime/internal/systemMeta.mjs.map +1 -0
- package/dist/_vendor/core/runtime/internal/transactionCoordinator.mjs +37 -0
- package/dist/_vendor/core/runtime/internal/transactionCoordinator.mjs.map +1 -0
- package/dist/_vendor/core/runtime/runtime.d.mts +159 -205
- package/dist/_vendor/core/runtime/runtime.d.mts.map +1 -1
- package/dist/_vendor/core/runtime/runtime.mjs +16 -1371
- package/dist/_vendor/core/runtime/runtime.mjs.map +1 -1
- package/dist/_vendor/core/transport.d.mts +111 -0
- package/dist/_vendor/core/transport.d.mts.map +1 -0
- package/dist/_vendor/core/transport.mjs +419 -0
- package/dist/_vendor/core/transport.mjs.map +1 -0
- package/dist/_vendor/devtools-protocol/index.d.ts +39 -1
- package/dist/_vendor/devtools-protocol/index.d.ts.map +1 -1
- package/dist/_vendor/devtools-protocol/index.js +25 -9
- package/dist/_vendor/devtools-protocol/index.js.map +1 -1
- package/dist/_vendor/next/index.d.ts +1 -1
- package/dist/_vendor/next/index.d.ts.map +1 -1
- package/dist/_vendor/next/index.js +31 -13
- package/dist/_vendor/next/index.js.map +1 -1
- package/dist/_vendor/platform-expo/index.d.ts +12 -12
- package/dist/_vendor/platform-expo/index.d.ts.map +1 -1
- package/dist/_vendor/platform-expo/index.js +4 -2
- package/dist/_vendor/platform-expo/index.js.map +1 -1
- package/dist/_vendor/platform-expo/react.d.ts.map +1 -1
- package/dist/_vendor/platform-expo/react.js +11 -10
- package/dist/_vendor/platform-expo/react.js.map +1 -1
- package/dist/_vendor/platform-node/index.d.mts +23 -19
- package/dist/_vendor/platform-node/index.d.mts.map +1 -1
- package/dist/_vendor/platform-node/index.mjs +13 -5
- package/dist/_vendor/platform-node/index.mjs.map +1 -1
- package/dist/_vendor/platform-node/ipc-react.d.mts.map +1 -1
- package/dist/_vendor/platform-node/ipc-react.mjs +15 -2
- package/dist/_vendor/platform-node/ipc-react.mjs.map +1 -1
- package/dist/_vendor/platform-node/ipc.d.mts +11 -35
- package/dist/_vendor/platform-node/ipc.d.mts.map +1 -1
- package/dist/_vendor/platform-node/ipc.mjs +3 -273
- package/dist/_vendor/platform-node/ipc.mjs.map +1 -1
- package/dist/_vendor/platform-web/external-change.d.ts +2 -1
- package/dist/_vendor/platform-web/external-change.d.ts.map +1 -1
- package/dist/_vendor/platform-web/external-change.js +2 -1
- package/dist/_vendor/platform-web/external-change.js.map +1 -1
- package/dist/_vendor/platform-web/index.d.ts +21 -21
- package/dist/_vendor/platform-web/index.d.ts.map +1 -1
- package/dist/_vendor/platform-web/index.js +44 -7
- package/dist/_vendor/platform-web/index.js.map +1 -1
- package/dist/_vendor/platform-web/react.d.ts.map +1 -1
- package/dist/_vendor/platform-web/react.js +29 -13
- package/dist/_vendor/platform-web/react.js.map +1 -1
- package/dist/_vendor/platform-web/worker.d.ts +11 -35
- package/dist/_vendor/platform-web/worker.d.ts.map +1 -1
- package/dist/_vendor/platform-web/worker.js +3 -267
- package/dist/_vendor/platform-web/worker.js.map +1 -1
- package/dist/_vendor/react/index.d.ts +36 -20
- package/dist/_vendor/react/index.d.ts.map +1 -1
- package/dist/_vendor/react/index.js +279 -57
- package/dist/_vendor/react/index.js.map +1 -1
- package/dist/_vendor/schema/definition.d.ts +48 -63
- package/dist/_vendor/schema/definition.d.ts.map +1 -1
- package/dist/_vendor/schema/definition.js +22 -39
- package/dist/_vendor/schema/definition.js.map +1 -1
- package/dist/_vendor/schema/index.d.ts +4 -4
- package/dist/_vendor/schema/index.js +2 -2
- package/dist/_vendor/schema/planner.d.ts +19 -2
- package/dist/_vendor/schema/planner.d.ts.map +1 -1
- package/dist/_vendor/schema/planner.js +79 -3
- package/dist/_vendor/schema/planner.js.map +1 -1
- package/dist/_vendor/schema/validators.d.ts +141 -121
- package/dist/_vendor/schema/validators.d.ts.map +1 -1
- package/dist/_vendor/schema/validators.js +300 -42
- package/dist/_vendor/schema/validators.js.map +1 -1
- package/dist/_vendor/svelte/index.d.ts +47 -19
- package/dist/_vendor/svelte/index.d.ts.map +1 -1
- package/dist/_vendor/svelte/index.js +250 -20
- package/dist/_vendor/svelte/index.js.map +1 -1
- package/dist/components.d.ts +2 -0
- package/dist/components.js +2 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/package.json +8 -3
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
2
|
+
//#region src/devtools-auth.ts
|
|
3
|
+
const TOKEN_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
4
|
+
function sanitizeDevtoolsToken(value) {
|
|
5
|
+
if (!value) return null;
|
|
6
|
+
const sanitized = value.replace(/[^A-Za-z0-9]/g, "");
|
|
7
|
+
return sanitized.length > 0 ? sanitized : null;
|
|
8
|
+
}
|
|
9
|
+
function generateDevtoolsToken(length = 20) {
|
|
10
|
+
let token = "";
|
|
11
|
+
while (token.length < length) {
|
|
12
|
+
const bytes = randomBytes(length);
|
|
13
|
+
for (const byte of bytes) {
|
|
14
|
+
if (byte >= 248) continue;
|
|
15
|
+
token += TOKEN_ALPHABET[byte % 62];
|
|
16
|
+
if (token.length === length) break;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return token;
|
|
20
|
+
}
|
|
21
|
+
function readDevtoolsTokenFromUrl(requestUrl) {
|
|
22
|
+
if (!requestUrl) return null;
|
|
23
|
+
try {
|
|
24
|
+
const url = new URL(requestUrl, "ws://localhost");
|
|
25
|
+
return url.searchParams.get("token") ?? url.searchParams.get("hubToken");
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function isAllowedDashboardOrigin(originHeader, dashboardPort) {
|
|
31
|
+
if (!originHeader) return false;
|
|
32
|
+
try {
|
|
33
|
+
const origin = new URL(originHeader);
|
|
34
|
+
if (!isLoopbackHostname(origin.hostname)) return false;
|
|
35
|
+
const expectedPort = String(dashboardPort);
|
|
36
|
+
return (origin.port || (origin.protocol === "https:" ? "443" : origin.protocol === "http:" ? "80" : "")) === expectedPort;
|
|
37
|
+
} catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function isAuthorizedDashboardRequest(input) {
|
|
42
|
+
if (!isAllowedDashboardOrigin(input.originHeader, input.dashboardPort)) return false;
|
|
43
|
+
const providedToken = readDevtoolsTokenFromUrl(input.requestUrl);
|
|
44
|
+
if (!providedToken) return false;
|
|
45
|
+
return tokensMatch(providedToken, input.expectedToken);
|
|
46
|
+
}
|
|
47
|
+
function isLoopbackHostname(hostname) {
|
|
48
|
+
const normalized = hostname.toLowerCase();
|
|
49
|
+
return normalized === "localhost" || normalized === "127.0.0.1" || normalized === "::1" || normalized === "[::1]";
|
|
50
|
+
}
|
|
51
|
+
function tokensMatch(left, right) {
|
|
52
|
+
const leftBuffer = Buffer.from(left, "utf8");
|
|
53
|
+
const rightBuffer = Buffer.from(right, "utf8");
|
|
54
|
+
if (leftBuffer.length !== rightBuffer.length) return false;
|
|
55
|
+
return timingSafeEqual(leftBuffer, rightBuffer);
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { generateDevtoolsToken, isAllowedDashboardOrigin, isAuthorizedDashboardRequest, sanitizeDevtoolsToken };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=devtools-auth.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devtools-auth.mjs","names":[],"sources":["../src/devtools-auth.ts"],"sourcesContent":["import { randomBytes, timingSafeEqual } from \"node:crypto\";\n\nconst TOKEN_ALPHABET = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n\nexport function sanitizeDevtoolsToken(value: string | undefined): string | null {\n if (!value) {\n return null;\n }\n const sanitized = value.replace(/[^A-Za-z0-9]/g, \"\");\n return sanitized.length > 0 ? sanitized : null;\n}\n\nexport function generateDevtoolsToken(length = 20): string {\n let token = \"\";\n while (token.length < length) {\n const bytes = randomBytes(length);\n for (const byte of bytes) {\n if (byte >= 248) {\n continue;\n }\n token += TOKEN_ALPHABET[byte % TOKEN_ALPHABET.length];\n if (token.length === length) {\n break;\n }\n }\n }\n return token;\n}\n\nexport function readDevtoolsTokenFromUrl(requestUrl: string | undefined): string | null {\n if (!requestUrl) {\n return null;\n }\n try {\n const url = new URL(requestUrl, \"ws://localhost\");\n return url.searchParams.get(\"token\") ?? url.searchParams.get(\"hubToken\");\n } catch {\n return null;\n }\n}\n\nexport function isAllowedDashboardOrigin(\n originHeader: string | undefined,\n dashboardPort: number\n): boolean {\n if (!originHeader) {\n return false;\n }\n try {\n const origin = new URL(originHeader);\n if (!isLoopbackHostname(origin.hostname)) {\n return false;\n }\n const expectedPort = String(dashboardPort);\n const originPort =\n origin.port ||\n (origin.protocol === \"https:\" ? \"443\" : origin.protocol === \"http:\" ? \"80\" : \"\");\n return originPort === expectedPort;\n } catch {\n return false;\n }\n}\n\nexport function isAuthorizedDashboardRequest(input: {\n requestUrl: string | undefined;\n originHeader: string | undefined;\n dashboardPort: number;\n expectedToken: string;\n}): boolean {\n if (!isAllowedDashboardOrigin(input.originHeader, input.dashboardPort)) {\n return false;\n }\n const providedToken = readDevtoolsTokenFromUrl(input.requestUrl);\n if (!providedToken) {\n return false;\n }\n return tokensMatch(providedToken, input.expectedToken);\n}\n\nfunction isLoopbackHostname(hostname: string): boolean {\n const normalized = hostname.toLowerCase();\n return (\n normalized === \"localhost\" ||\n normalized === \"127.0.0.1\" ||\n normalized === \"::1\" ||\n normalized === \"[::1]\"\n );\n}\n\nfunction tokensMatch(left: string, right: string): boolean {\n const leftBuffer = Buffer.from(left, \"utf8\");\n const rightBuffer = Buffer.from(right, \"utf8\");\n if (leftBuffer.length !== rightBuffer.length) {\n return false;\n }\n return timingSafeEqual(leftBuffer, rightBuffer);\n}\n"],"mappings":";;AAEA,MAAM,iBAAiB;AAEvB,SAAgB,sBAAsB,OAA0C;AAC9E,KAAI,CAAC,MACH,QAAO;CAET,MAAM,YAAY,MAAM,QAAQ,iBAAiB,GAAG;AACpD,QAAO,UAAU,SAAS,IAAI,YAAY;;AAG5C,SAAgB,sBAAsB,SAAS,IAAY;CACzD,IAAI,QAAQ;AACZ,QAAO,MAAM,SAAS,QAAQ;EAC5B,MAAM,QAAQ,YAAY,OAAO;AACjC,OAAK,MAAM,QAAQ,OAAO;AACxB,OAAI,QAAQ,IACV;AAEF,YAAS,eAAe,OAAO;AAC/B,OAAI,MAAM,WAAW,OACnB;;;AAIN,QAAO;;AAGT,SAAgB,yBAAyB,YAA+C;AACtF,KAAI,CAAC,WACH,QAAO;AAET,KAAI;EACF,MAAM,MAAM,IAAI,IAAI,YAAY,iBAAiB;AACjD,SAAO,IAAI,aAAa,IAAI,QAAQ,IAAI,IAAI,aAAa,IAAI,WAAW;SAClE;AACN,SAAO;;;AAIX,SAAgB,yBACd,cACA,eACS;AACT,KAAI,CAAC,aACH,QAAO;AAET,KAAI;EACF,MAAM,SAAS,IAAI,IAAI,aAAa;AACpC,MAAI,CAAC,mBAAmB,OAAO,SAAS,CACtC,QAAO;EAET,MAAM,eAAe,OAAO,cAAc;AAI1C,UAFE,OAAO,SACN,OAAO,aAAa,WAAW,QAAQ,OAAO,aAAa,UAAU,OAAO,SACzD;SAChB;AACN,SAAO;;;AAIX,SAAgB,6BAA6B,OAKjC;AACV,KAAI,CAAC,yBAAyB,MAAM,cAAc,MAAM,cAAc,CACpE,QAAO;CAET,MAAM,gBAAgB,yBAAyB,MAAM,WAAW;AAChE,KAAI,CAAC,cACH,QAAO;AAET,QAAO,YAAY,eAAe,MAAM,cAAc;;AAGxD,SAAS,mBAAmB,UAA2B;CACrD,MAAM,aAAa,SAAS,aAAa;AACzC,QACE,eAAe,eACf,eAAe,eACf,eAAe,SACf,eAAe;;AAInB,SAAS,YAAY,MAAc,OAAwB;CACzD,MAAM,aAAa,OAAO,KAAK,MAAM,OAAO;CAC5C,MAAM,cAAc,OAAO,KAAK,OAAO,OAAO;AAC9C,KAAI,WAAW,WAAW,YAAY,OACpC,QAAO;AAET,QAAO,gBAAgB,YAAY,YAAY"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { CronJobs, EmptyArgs, FunctionArgs, FunctionArgsFromDefinition, FunctionConfig, FunctionKindFromDefinition, FunctionReference, FunctionReferenceFor, FunctionResult, FunctionResultFromDefinition, InferArgs, MisfirePolicy, RecurringDailySchedule, RecurringIntervalSchedule, RecurringJobDefinition, RecurringSchedule, RecurringWeeklySchedule, SyncoreFunctionDefinition, SyncoreFunctionKind, action, cronJobs, mutation, query } from "./runtime/functions.mjs";
|
|
2
|
-
import { ActionCtx,
|
|
2
|
+
import { ActionCtx, CapabilityDescriptor, ComparisonOperator, DevtoolsLiveQueryScope, DevtoolsLiveQuerySnapshot, DevtoolsSink, DocumentForTable, ExecutionResult, FilterBuilder, ImpactScope, ImpactSet, IndexRangeBuilder, InsertValueForTable, JsonObject, MutationCtx, PaginationOptions, PaginationResult, PatchValueForTable, QueryBuilder, QueryCondition, QueryCtx, QueryExpression, RegisteredSyncoreFunction, RegisteredSyncoreHandler, RunResult, SchedulerApi, SchedulerOptions, SearchIndexBuilder, SearchQuery, StorageObject, StorageWriteInput, SyncoreCapabilities, SyncoreClient, SyncoreDataModel, SyncoreDatabaseReader, SyncoreDatabaseWriter, SyncoreExternalChangeApplier, SyncoreExternalChangeEvent, SyncoreExternalChangeReason, SyncoreExternalChangeScope, SyncoreExternalChangeSignal, SyncoreFunctionRegistry, SyncorePaginatedQueryStatus, SyncoreQueriesRequest, SyncoreQueryRequest, SyncoreQueryState, SyncoreQueryStatus, SyncoreResolvedComponents, SyncoreRuntime, SyncoreRuntimeAdmin, SyncoreRuntimeOptions, SyncoreRuntimeStatus, SyncoreRuntimeStatusKind, SyncoreRuntimeStatusReason, SyncoreSqlDriver, SyncoreStorageAdapter, SyncoreStorageApi, SyncoreWatch, TableNames, UpdateScheduledJobOptions, UsePaginatedQueryResult, createFunctionReference, createFunctionReferenceFor } from "./runtime/runtime.mjs";
|
|
3
|
+
import { AnySyncoreFunctionDefinition, ComponentPath, FunctionReferencesForTree, InstalledComponentApi, InstalledComponentsApi, ResolvedSyncoreComponent, SyncoreComponent, SyncoreComponentFunctionMetadata, SyncoreComponentHookContext, SyncoreComponentInstall, SyncoreComponentsManifest, SyncoreCoreCapability, SyncoreFunctionTree, SyncoreHostServiceName, SyncoreRequestedCapability, composeProjectFunctionRegistry, composeProjectSchema, createBindingFunctionReference, createComponentPhysicalTableName, createInstalledComponentsApi, defineComponent, defineComponents, installComponent, resolveComponentsManifest, toCanonicalComponentFunctionName } from "./runtime/components.mjs";
|
|
3
4
|
import { DevtoolsCommandHandler, DevtoolsCommandHandlerDeps, DevtoolsSqlAnalysis, DevtoolsSqlMode, DevtoolsSqlReadResult, DevtoolsSqlSupport, DevtoolsSubscriptionHost, DevtoolsSubscriptionListener, createDevtoolsCommandHandler, createDevtoolsSubscriptionHost } from "./runtime/devtools.mjs";
|
|
4
5
|
import { generateId } from "./runtime/id.mjs";
|
|
6
|
+
import { AttachRuntimeBridgeOptions, AttachedRuntimeBridge, BridgeQueryWatch, SyncoreBridgeClient, SyncoreBridgeMessageEndpoint, SyncoreBridgeRequest, SyncoreBridgeResponse, attachRuntimeBridge, createDeferredSyncoreClient, createInvokeRequest, createUnavailableSyncoreClient, createWatchKey, normalizeOptionalArgs, stableStringify } from "./transport.mjs";
|
|
5
7
|
import { SyncoreActiveQueryInfo, SyncoreDevtoolsEvent, SyncoreRuntimeSummary } from "../devtools-protocol/index.d.ts";
|
|
6
8
|
export * from "../schema/index.d.ts";
|
|
7
9
|
|
|
8
10
|
//#region src/index.d.ts
|
|
9
11
|
declare namespace index_d_exports {
|
|
10
|
-
export { ActionCtx,
|
|
12
|
+
export { ActionCtx, AnySyncoreFunctionDefinition, AttachRuntimeBridgeOptions, AttachedRuntimeBridge, BridgeQueryWatch, CapabilityDescriptor, ComparisonOperator, ComponentPath, CronJobs, DevtoolsCommandHandler, DevtoolsCommandHandlerDeps, DevtoolsLiveQueryScope, DevtoolsLiveQuerySnapshot, DevtoolsSink, DevtoolsSqlAnalysis, DevtoolsSqlMode, DevtoolsSqlReadResult, DevtoolsSqlSupport, DevtoolsSubscriptionHost, DevtoolsSubscriptionListener, DocumentForTable, EmptyArgs, ExecutionResult, FilterBuilder, FunctionArgs, FunctionArgsFromDefinition, FunctionConfig, FunctionKindFromDefinition, FunctionReference, FunctionReferenceFor, FunctionReferencesForTree, FunctionResult, FunctionResultFromDefinition, ImpactScope, ImpactSet, IndexRangeBuilder, InferArgs, InsertValueForTable, InstalledComponentApi, InstalledComponentsApi, JsonObject, MisfirePolicy, MutationCtx, PaginationOptions, PaginationResult, PatchValueForTable, QueryBuilder, QueryCondition, QueryCtx, QueryExpression, RecurringDailySchedule, RecurringIntervalSchedule, RecurringJobDefinition, RecurringSchedule, RecurringWeeklySchedule, RegisteredSyncoreFunction, RegisteredSyncoreHandler, ResolvedSyncoreComponent, RunResult, SchedulerApi, SchedulerOptions, SearchIndexBuilder, SearchQuery, StorageObject, StorageWriteInput, SyncoreActiveQueryInfo, SyncoreBridgeClient, SyncoreBridgeMessageEndpoint, SyncoreBridgeRequest, SyncoreBridgeResponse, SyncoreCapabilities, SyncoreClient, SyncoreComponent, SyncoreComponentFunctionMetadata, SyncoreComponentHookContext, SyncoreComponentInstall, SyncoreComponentsManifest, SyncoreCoreCapability, SyncoreDataModel, SyncoreDatabaseReader, SyncoreDatabaseWriter, SyncoreDevtoolsEvent, SyncoreExternalChangeApplier, SyncoreExternalChangeEvent, SyncoreExternalChangeReason, SyncoreExternalChangeScope, SyncoreExternalChangeSignal, SyncoreFunctionDefinition, SyncoreFunctionKind, SyncoreFunctionRegistry, SyncoreFunctionTree, SyncoreHostServiceName, SyncorePaginatedQueryStatus, SyncoreQueriesRequest, SyncoreQueryRequest, SyncoreQueryState, SyncoreQueryStatus, SyncoreRequestedCapability, SyncoreResolvedComponents, SyncoreRuntime, SyncoreRuntimeAdmin, SyncoreRuntimeOptions, SyncoreRuntimeStatus, SyncoreRuntimeStatusKind, SyncoreRuntimeStatusReason, SyncoreRuntimeSummary, SyncoreSqlDriver, SyncoreStorageAdapter, SyncoreStorageApi, SyncoreWatch, TableNames, UpdateScheduledJobOptions, UsePaginatedQueryResult, action, attachRuntimeBridge, composeProjectFunctionRegistry, composeProjectSchema, createBindingFunctionReference, createComponentPhysicalTableName, createDeferredSyncoreClient, createDevtoolsCommandHandler, createDevtoolsSubscriptionHost, createFunctionReference, createFunctionReferenceFor, createInstalledComponentsApi, createInvokeRequest, createUnavailableSyncoreClient, createWatchKey, cronJobs, defineComponent, defineComponents, generateId, installComponent, mutation, normalizeOptionalArgs, query, resolveComponentsManifest, stableStringify, toCanonicalComponentFunctionName };
|
|
11
13
|
}
|
|
12
14
|
import * as import__syncore_schema from "../schema/index.d.ts";
|
|
13
15
|
//#endregion
|
|
14
|
-
export { ActionCtx,
|
|
16
|
+
export { ActionCtx, AnySyncoreFunctionDefinition, AttachRuntimeBridgeOptions, AttachedRuntimeBridge, BridgeQueryWatch, CapabilityDescriptor, ComparisonOperator, ComponentPath, CronJobs, DevtoolsCommandHandler, DevtoolsCommandHandlerDeps, DevtoolsLiveQueryScope, DevtoolsLiveQuerySnapshot, DevtoolsSink, DevtoolsSqlAnalysis, DevtoolsSqlMode, DevtoolsSqlReadResult, DevtoolsSqlSupport, DevtoolsSubscriptionHost, DevtoolsSubscriptionListener, DocumentForTable, EmptyArgs, ExecutionResult, FilterBuilder, FunctionArgs, FunctionArgsFromDefinition, FunctionConfig, FunctionKindFromDefinition, FunctionReference, FunctionReferenceFor, FunctionReferencesForTree, FunctionResult, FunctionResultFromDefinition, ImpactScope, ImpactSet, IndexRangeBuilder, InferArgs, InsertValueForTable, InstalledComponentApi, InstalledComponentsApi, JsonObject, MisfirePolicy, MutationCtx, PaginationOptions, PaginationResult, PatchValueForTable, QueryBuilder, QueryCondition, QueryCtx, QueryExpression, RecurringDailySchedule, RecurringIntervalSchedule, RecurringJobDefinition, RecurringSchedule, RecurringWeeklySchedule, RegisteredSyncoreFunction, RegisteredSyncoreHandler, ResolvedSyncoreComponent, RunResult, SchedulerApi, SchedulerOptions, SearchIndexBuilder, SearchQuery, StorageObject, StorageWriteInput, type SyncoreActiveQueryInfo, SyncoreBridgeClient, SyncoreBridgeMessageEndpoint, SyncoreBridgeRequest, SyncoreBridgeResponse, SyncoreCapabilities, SyncoreClient, SyncoreComponent, SyncoreComponentFunctionMetadata, SyncoreComponentHookContext, SyncoreComponentInstall, SyncoreComponentsManifest, SyncoreCoreCapability, SyncoreDataModel, SyncoreDatabaseReader, SyncoreDatabaseWriter, type SyncoreDevtoolsEvent, SyncoreExternalChangeApplier, SyncoreExternalChangeEvent, SyncoreExternalChangeReason, SyncoreExternalChangeScope, SyncoreExternalChangeSignal, SyncoreFunctionDefinition, SyncoreFunctionKind, SyncoreFunctionRegistry, SyncoreFunctionTree, SyncoreHostServiceName, SyncorePaginatedQueryStatus, SyncoreQueriesRequest, SyncoreQueryRequest, SyncoreQueryState, SyncoreQueryStatus, SyncoreRequestedCapability, SyncoreResolvedComponents, SyncoreRuntime, SyncoreRuntimeAdmin, SyncoreRuntimeOptions, SyncoreRuntimeStatus, SyncoreRuntimeStatusKind, SyncoreRuntimeStatusReason, type SyncoreRuntimeSummary, SyncoreSqlDriver, SyncoreStorageAdapter, SyncoreStorageApi, SyncoreWatch, TableNames, UpdateScheduledJobOptions, UsePaginatedQueryResult, action, attachRuntimeBridge, composeProjectFunctionRegistry, composeProjectSchema, createBindingFunctionReference, createComponentPhysicalTableName, createDeferredSyncoreClient, createDevtoolsCommandHandler, createDevtoolsSubscriptionHost, createFunctionReference, createFunctionReferenceFor, createInstalledComponentsApi, createInvokeRequest, createUnavailableSyncoreClient, createWatchKey, cronJobs, defineComponent, defineComponents, generateId, index_d_exports, installComponent, mutation, normalizeOptionalArgs, query, resolveComponentsManifest, stableStringify, toCanonicalComponentFunctionName };
|
|
15
17
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,26 +1,46 @@
|
|
|
1
1
|
import { __exportAll, __reExport } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { composeProjectFunctionRegistry, composeProjectSchema, createBindingFunctionReference, createComponentPhysicalTableName, createInstalledComponentsApi, defineComponent, defineComponents, installComponent, resolveComponentsManifest, toCanonicalComponentFunctionName } from "./runtime/components.mjs";
|
|
2
3
|
import { generateId } from "./runtime/id.mjs";
|
|
3
4
|
import { SyncoreRuntime, createFunctionReference, createFunctionReferenceFor } from "./runtime/runtime.mjs";
|
|
4
5
|
import { createDevtoolsCommandHandler, createDevtoolsSubscriptionHost } from "./runtime/devtools.mjs";
|
|
5
6
|
import { CronJobs, action, cronJobs, mutation, query } from "./runtime/functions.mjs";
|
|
7
|
+
import { SyncoreBridgeClient, attachRuntimeBridge, createDeferredSyncoreClient, createInvokeRequest, createUnavailableSyncoreClient, createWatchKey, normalizeOptionalArgs, stableStringify } from "./transport.mjs";
|
|
6
8
|
export * from "../schema/index.js";
|
|
7
9
|
//#region src/index.ts
|
|
8
10
|
var src_exports = /* @__PURE__ */ __exportAll({
|
|
9
11
|
CronJobs: () => CronJobs,
|
|
12
|
+
SyncoreBridgeClient: () => SyncoreBridgeClient,
|
|
10
13
|
SyncoreRuntime: () => SyncoreRuntime,
|
|
11
14
|
action: () => action,
|
|
15
|
+
attachRuntimeBridge: () => attachRuntimeBridge,
|
|
16
|
+
composeProjectFunctionRegistry: () => composeProjectFunctionRegistry,
|
|
17
|
+
composeProjectSchema: () => composeProjectSchema,
|
|
18
|
+
createBindingFunctionReference: () => createBindingFunctionReference,
|
|
19
|
+
createComponentPhysicalTableName: () => createComponentPhysicalTableName,
|
|
20
|
+
createDeferredSyncoreClient: () => createDeferredSyncoreClient,
|
|
12
21
|
createDevtoolsCommandHandler: () => createDevtoolsCommandHandler,
|
|
13
22
|
createDevtoolsSubscriptionHost: () => createDevtoolsSubscriptionHost,
|
|
14
23
|
createFunctionReference: () => createFunctionReference,
|
|
15
24
|
createFunctionReferenceFor: () => createFunctionReferenceFor,
|
|
25
|
+
createInstalledComponentsApi: () => createInstalledComponentsApi,
|
|
26
|
+
createInvokeRequest: () => createInvokeRequest,
|
|
27
|
+
createUnavailableSyncoreClient: () => createUnavailableSyncoreClient,
|
|
28
|
+
createWatchKey: () => createWatchKey,
|
|
16
29
|
cronJobs: () => cronJobs,
|
|
30
|
+
defineComponent: () => defineComponent,
|
|
31
|
+
defineComponents: () => defineComponents,
|
|
17
32
|
generateId: () => generateId,
|
|
33
|
+
installComponent: () => installComponent,
|
|
18
34
|
mutation: () => mutation,
|
|
19
|
-
|
|
35
|
+
normalizeOptionalArgs: () => normalizeOptionalArgs,
|
|
36
|
+
query: () => query,
|
|
37
|
+
resolveComponentsManifest: () => resolveComponentsManifest,
|
|
38
|
+
stableStringify: () => stableStringify,
|
|
39
|
+
toCanonicalComponentFunctionName: () => toCanonicalComponentFunctionName
|
|
20
40
|
});
|
|
21
41
|
import * as import__syncore_schema from "../schema/index.js";
|
|
22
42
|
__reExport(src_exports, import__syncore_schema);
|
|
23
43
|
//#endregion
|
|
24
|
-
export { CronJobs, SyncoreRuntime, action, createDevtoolsCommandHandler, createDevtoolsSubscriptionHost, createFunctionReference, createFunctionReferenceFor, cronJobs, generateId, mutation, query, src_exports };
|
|
44
|
+
export { CronJobs, SyncoreBridgeClient, SyncoreRuntime, action, attachRuntimeBridge, composeProjectFunctionRegistry, composeProjectSchema, createBindingFunctionReference, createComponentPhysicalTableName, createDeferredSyncoreClient, createDevtoolsCommandHandler, createDevtoolsSubscriptionHost, createFunctionReference, createFunctionReferenceFor, createInstalledComponentsApi, createInvokeRequest, createUnavailableSyncoreClient, createWatchKey, cronJobs, defineComponent, defineComponents, generateId, installComponent, mutation, normalizeOptionalArgs, query, resolveComponentsManifest, src_exports, stableStringify, toCanonicalComponentFunctionName };
|
|
25
45
|
|
|
26
46
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Syncore public API.\n *\n * This entrypoint exports the schema builders, runtime primitives, function\n * helpers, validators, and devtools types used by app code.\n */\nexport type {\n SyncoreActiveQueryInfo,\n SyncoreDevtoolsEvent,\n SyncoreRuntimeSummary\n} from \"@syncore/devtools-protocol\";\nexport * from \"@syncore/schema\";\nexport * from \"./runtime/devtools.js\";\nexport * from \"./runtime/functions.js\";\nexport * from \"./runtime/id.js\";\nexport * from \"./runtime/runtime.js\";\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Syncore public API.\n *\n * This entrypoint exports the schema builders, runtime primitives, function\n * helpers, validators, and devtools types used by app code.\n */\nexport type {\n SyncoreActiveQueryInfo,\n SyncoreDevtoolsEvent,\n SyncoreRuntimeSummary\n} from \"@syncore/devtools-protocol\";\nexport * from \"@syncore/schema\";\nexport * from \"./runtime/components.js\";\nexport * from \"./runtime/devtools.js\";\nexport * from \"./runtime/functions.js\";\nexport * from \"./runtime/id.js\";\nexport * from \"./runtime/runtime.js\";\nexport * from \"./transport.js\";\n"],"mappings":""}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { FunctionReference, FunctionReferenceFor, SyncoreFunctionDefinition, SyncoreFunctionKind } from "./functions.mjs";
|
|
2
|
+
import { JsonObject, RegisteredSyncoreFunction, SyncoreDataModel, SyncoreFunctionRegistry } from "./runtime.mjs";
|
|
3
|
+
import { AnyTableDefinition, SyncoreSchema, Validator } from "../../schema/index.d.ts";
|
|
4
|
+
import { SyncoreDevtoolsEvent } from "../../devtools-protocol/index.d.ts";
|
|
5
|
+
|
|
6
|
+
//#region src/runtime/components.d.ts
|
|
7
|
+
type ComponentPath = string;
|
|
8
|
+
type SyncoreCoreCapability = "storage" | "scheduler" | "devtools" | "ownTables" | "publicExports" | "internalActions";
|
|
9
|
+
type SyncoreHostServiceName = "http" | "notifications" | "secureStore" | "filesystem" | "backgroundTasks" | "crypto";
|
|
10
|
+
type SyncoreRequestedCapability = SyncoreCoreCapability | `host:${SyncoreHostServiceName}`;
|
|
11
|
+
type AnySyncoreFunctionDefinition = SyncoreFunctionDefinition<SyncoreFunctionKind, any, any, unknown>;
|
|
12
|
+
type SyncoreFunctionTree = {
|
|
13
|
+
readonly [key: string]: AnySyncoreFunctionDefinition | SyncoreFunctionTree | undefined;
|
|
14
|
+
};
|
|
15
|
+
interface SyncoreComponentHookContext {
|
|
16
|
+
runtimeId: string;
|
|
17
|
+
platform: string;
|
|
18
|
+
componentPath: ComponentPath;
|
|
19
|
+
componentName: string;
|
|
20
|
+
version: string;
|
|
21
|
+
config: unknown;
|
|
22
|
+
capabilities: readonly SyncoreRequestedCapability[];
|
|
23
|
+
emitDevtools(event: SyncoreDevtoolsEvent): void;
|
|
24
|
+
}
|
|
25
|
+
interface SyncoreComponent<TConfig = unknown, TSchema extends SyncoreDataModel | undefined = SyncoreDataModel | undefined, TPublic extends SyncoreFunctionTree | undefined = SyncoreFunctionTree | undefined, TInternal extends SyncoreFunctionTree | undefined = SyncoreFunctionTree | undefined> {
|
|
26
|
+
readonly kind: "syncore.component";
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly version: string;
|
|
29
|
+
readonly config?: Validator<TConfig>;
|
|
30
|
+
readonly requestedCapabilities?: readonly SyncoreRequestedCapability[];
|
|
31
|
+
readonly schema?: TSchema;
|
|
32
|
+
readonly public?: TPublic;
|
|
33
|
+
readonly internal?: TInternal;
|
|
34
|
+
readonly dependencies?: readonly string[];
|
|
35
|
+
onStart?(context: SyncoreComponentHookContext): Promise<void> | void;
|
|
36
|
+
onStop?(context: SyncoreComponentHookContext): Promise<void> | void;
|
|
37
|
+
}
|
|
38
|
+
interface SyncoreComponentInstall<TComponent extends SyncoreComponent = SyncoreComponent, TChildren extends SyncoreComponentsManifest = SyncoreComponentsManifest> {
|
|
39
|
+
readonly kind: "syncore.component.install";
|
|
40
|
+
readonly component: TComponent;
|
|
41
|
+
readonly source: string;
|
|
42
|
+
readonly config?: TComponent extends SyncoreComponent<infer TConfig, any, any, any> ? TConfig : unknown;
|
|
43
|
+
readonly capabilities?: readonly SyncoreRequestedCapability[];
|
|
44
|
+
readonly bindings?: Record<string, string>;
|
|
45
|
+
readonly children?: TChildren;
|
|
46
|
+
}
|
|
47
|
+
type SyncoreComponentsManifest = Record<string, SyncoreComponentInstall>;
|
|
48
|
+
interface SyncoreComponentFunctionMetadata {
|
|
49
|
+
componentPath: ComponentPath;
|
|
50
|
+
componentName: string;
|
|
51
|
+
version: string;
|
|
52
|
+
visibility: "public" | "internal";
|
|
53
|
+
localName: string;
|
|
54
|
+
localTables: Record<string, string>;
|
|
55
|
+
grantedCapabilities: readonly SyncoreRequestedCapability[];
|
|
56
|
+
bindings: Record<string, string>;
|
|
57
|
+
}
|
|
58
|
+
interface ResolvedSyncoreComponent {
|
|
59
|
+
alias: string;
|
|
60
|
+
path: ComponentPath;
|
|
61
|
+
source: string;
|
|
62
|
+
name: string;
|
|
63
|
+
version: string;
|
|
64
|
+
config: unknown;
|
|
65
|
+
grantedCapabilities: readonly SyncoreRequestedCapability[];
|
|
66
|
+
requestedCapabilities: readonly SyncoreRequestedCapability[];
|
|
67
|
+
bindings: Record<string, string>;
|
|
68
|
+
schema: SyncoreDataModel | undefined;
|
|
69
|
+
public: SyncoreFunctionTree | undefined;
|
|
70
|
+
internal: SyncoreFunctionTree | undefined;
|
|
71
|
+
publicEntries: Array<{
|
|
72
|
+
localName: string;
|
|
73
|
+
canonicalName: string;
|
|
74
|
+
definition: RegisteredSyncoreFunction;
|
|
75
|
+
}>;
|
|
76
|
+
internalEntries: Array<{
|
|
77
|
+
localName: string;
|
|
78
|
+
canonicalName: string;
|
|
79
|
+
definition: RegisteredSyncoreFunction;
|
|
80
|
+
}>;
|
|
81
|
+
localTables: Record<string, string>;
|
|
82
|
+
onStart: SyncoreComponent["onStart"] | undefined;
|
|
83
|
+
onStop: SyncoreComponent["onStop"] | undefined;
|
|
84
|
+
children: ResolvedSyncoreComponent[];
|
|
85
|
+
}
|
|
86
|
+
type Simplify<T> = { [K in keyof T]: T[K] } & {};
|
|
87
|
+
type PublicFunctionTreeOf<TComponent> = TComponent extends SyncoreComponent<any, any, infer TPublic, any> ? NonNullable<TPublic> : never;
|
|
88
|
+
type FunctionReferencesForTree<TTree extends SyncoreFunctionTree> = Simplify<{ [TKey in keyof TTree]: TTree[TKey] extends AnySyncoreFunctionDefinition ? FunctionReferenceFor<TTree[TKey]> : Record<string, unknown> }>;
|
|
89
|
+
type InstalledComponentApi<TInstall extends SyncoreComponentInstall> = Simplify<FunctionReferencesForTree<PublicFunctionTreeOf<TInstall["component"]>> & Record<string, unknown>>;
|
|
90
|
+
type InstalledComponentsApi<TManifest extends SyncoreComponentsManifest> = Simplify<{ [TAlias in keyof TManifest]: InstalledComponentApi<TManifest[TAlias]> }>;
|
|
91
|
+
type TablesOfSchema<TSchema extends SyncoreDataModel> = TSchema["tables"];
|
|
92
|
+
declare function defineComponent<TConfig = unknown, TSchema extends SyncoreDataModel | undefined = SyncoreDataModel | undefined, TPublic extends SyncoreFunctionTree | undefined = SyncoreFunctionTree | undefined, TInternal extends SyncoreFunctionTree | undefined = SyncoreFunctionTree | undefined>(component: Omit<SyncoreComponent<TConfig, TSchema, TPublic, TInternal>, "kind">): SyncoreComponent<TConfig, TSchema, TPublic, TInternal>;
|
|
93
|
+
declare function installComponent<TComponent extends SyncoreComponent, TChildren extends SyncoreComponentsManifest = {}>(install: {
|
|
94
|
+
component: TComponent;
|
|
95
|
+
source: string;
|
|
96
|
+
config?: TComponent extends SyncoreComponent<infer TConfig, any, any, any> ? TConfig : unknown;
|
|
97
|
+
capabilities?: readonly SyncoreRequestedCapability[];
|
|
98
|
+
bindings?: Record<string, string>;
|
|
99
|
+
children?: TChildren;
|
|
100
|
+
}): SyncoreComponentInstall<TComponent, TChildren>;
|
|
101
|
+
declare function defineComponents<TManifest extends SyncoreComponentsManifest>(components: TManifest): TManifest;
|
|
102
|
+
declare function createBindingFunctionReference<TKind extends SyncoreFunctionKind, TArgs = JsonObject, TResult = unknown>(kind: TKind, bindingName: string, functionName: string): FunctionReference<TKind, TArgs, TResult>;
|
|
103
|
+
declare function composeProjectSchema<TRootSchema extends SyncoreDataModel>(rootSchema: TRootSchema, manifest?: SyncoreComponentsManifest): SyncoreSchema<TablesOfSchema<TRootSchema> & Record<string, AnyTableDefinition>>;
|
|
104
|
+
declare function composeProjectFunctionRegistry(rootFunctions: SyncoreFunctionRegistry, manifest?: SyncoreComponentsManifest): SyncoreFunctionRegistry;
|
|
105
|
+
declare function createInstalledComponentsApi<TManifest extends SyncoreComponentsManifest>(manifest: TManifest): InstalledComponentsApi<TManifest>;
|
|
106
|
+
declare function resolveComponentsManifest(manifest?: SyncoreComponentsManifest): ResolvedSyncoreComponent[];
|
|
107
|
+
declare function toCanonicalComponentFunctionName(componentPath: ComponentPath, visibility: "public" | "internal", localName: string): string;
|
|
108
|
+
declare function createComponentPhysicalTableName(componentPath: ComponentPath, tableName: string): string;
|
|
109
|
+
//#endregion
|
|
110
|
+
export { AnySyncoreFunctionDefinition, ComponentPath, FunctionReferencesForTree, InstalledComponentApi, InstalledComponentsApi, ResolvedSyncoreComponent, SyncoreComponent, SyncoreComponentFunctionMetadata, SyncoreComponentHookContext, SyncoreComponentInstall, SyncoreComponentsManifest, SyncoreCoreCapability, SyncoreFunctionTree, SyncoreHostServiceName, SyncoreRequestedCapability, composeProjectFunctionRegistry, composeProjectSchema, createBindingFunctionReference, createComponentPhysicalTableName, createInstalledComponentsApi, defineComponent, defineComponents, installComponent, resolveComponentsManifest, toCanonicalComponentFunctionName };
|
|
111
|
+
//# sourceMappingURL=components.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.mts","names":[],"sources":["../../src/runtime/components.ts"],"mappings":";;;;;;KAqBY,aAAA;AAAA,KAEA,qBAAA;AAAA,KAQA,sBAAA;AAAA,KAQA,0BAAA,GACR,qBAAA,WACQ,sBAAA;AAAA,KAEA,4BAAA,GAA+B,yBAAA,CACzC,mBAAA;AAAA,KAMU,mBAAA;EAAA,UACA,GAAA,WACN,4BAAA,GACA,mBAAA;AAAA;AAAA,UAIW,2BAAA;EACf,SAAA;EACA,QAAA;EACA,aAAA,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,UAAA,SAAmB,gBAAA,iCACxB,OAAA;EAEJ,YAAA,YAAwB,0BAAA;EACxB,QAAA,GAAW,MAAA;EACX,QAAA,GAAW,SAAA;AAAA,IACT,uBAAA,CAAwB,UAAA,EAAY,SAAA;AAAA,iBAOxB,gBAAA,mBAAmC,yBAAA,CAAA,CACjD,UAAA,EAAY,SAAA,GACX,SAAA;AAAA,iBAIa,8BAAA,eACA,mBAAA,UACN,UAAA,oBAAA,CAGR,IAAA,EAAM,KAAA,EACN,WAAA,UACA,YAAA,WACC,iBAAA,CAAkB,KAAA,EAAO,KAAA,EAAO,OAAA;AAAA,iBAOnB,oBAAA,qBACM,gBAAA,CAAA,CAEpB,UAAA,EAAY,WAAA,EACZ,QAAA,GAAW,yBAAA,GACV,aAAA,CAAc,cAAA,CAAe,WAAA,IAAe,MAAA,SAAe,kBAAA;AAAA,iBAuB9C,8BAAA,CACd,aAAA,EAAe,uBAAA,EACf,QAAA,GAAW,yBAAA,GACV,uBAAA;AAAA,iBAea,4BAAA,mBACI,yBAAA,CAAA,CAClB,QAAA,EAAU,SAAA,GAAY,sBAAA,CAAuB,SAAA;AAAA,iBAI/B,yBAAA,CACd,QAAA,GAAW,yBAAA,GACV,wBAAA;AAAA,iBAUa,gCAAA,CACd,aAAA,EAAe,aAAA,EACf,UAAA,yBACA,SAAA;AAAA,iBAOc,gCAAA,CACd,aAAA,EAAe,aAAA,EACf,SAAA"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { TableDefinition, defineSchema } from "../../schema/index.js";
|
|
2
|
+
//#region src/runtime/components.ts
|
|
3
|
+
function defineComponent(component) {
|
|
4
|
+
return {
|
|
5
|
+
kind: "syncore.component",
|
|
6
|
+
...component
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function installComponent(install) {
|
|
10
|
+
return {
|
|
11
|
+
kind: "syncore.component.install",
|
|
12
|
+
...install
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function defineComponents(components) {
|
|
16
|
+
return components;
|
|
17
|
+
}
|
|
18
|
+
function createBindingFunctionReference(kind, bindingName, functionName) {
|
|
19
|
+
return {
|
|
20
|
+
kind,
|
|
21
|
+
name: `binding:${bindingName}/${functionName}`
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function composeProjectSchema(rootSchema, manifest) {
|
|
25
|
+
const tables = { ...rootSchema.tables };
|
|
26
|
+
for (const component of resolveComponentsManifest(manifest)) for (const [physicalTableName, tableDefinition] of composeComponentTables(component)) {
|
|
27
|
+
if (tables[physicalTableName]) throw new Error(`Component table collision detected for ${JSON.stringify(physicalTableName)}.`);
|
|
28
|
+
tables[physicalTableName] = tableDefinition;
|
|
29
|
+
}
|
|
30
|
+
return defineSchema(tables);
|
|
31
|
+
}
|
|
32
|
+
function composeProjectFunctionRegistry(rootFunctions, manifest) {
|
|
33
|
+
const registry = {};
|
|
34
|
+
for (const [name, definition] of Object.entries(rootFunctions)) if (definition) registry[name] = definition;
|
|
35
|
+
for (const component of resolveComponentsManifest(manifest)) appendResolvedComponentFunctions(registry, component);
|
|
36
|
+
return registry;
|
|
37
|
+
}
|
|
38
|
+
function createInstalledComponentsApi(manifest) {
|
|
39
|
+
return createInstalledComponentsApiObject(resolveComponentsManifest(manifest));
|
|
40
|
+
}
|
|
41
|
+
function resolveComponentsManifest(manifest) {
|
|
42
|
+
if (!manifest) return [];
|
|
43
|
+
return Object.entries(manifest).sort(([left], [right]) => left.localeCompare(right)).map(([alias, install]) => resolveInstalledComponent(alias, install, []));
|
|
44
|
+
}
|
|
45
|
+
function toCanonicalComponentFunctionName(componentPath, visibility, localName) {
|
|
46
|
+
return [
|
|
47
|
+
"components",
|
|
48
|
+
componentPath,
|
|
49
|
+
visibility,
|
|
50
|
+
localName
|
|
51
|
+
].filter(Boolean).join("/");
|
|
52
|
+
}
|
|
53
|
+
function createComponentPhysicalTableName(componentPath, tableName) {
|
|
54
|
+
return `__syncore_component__${sanitizeComponentPath(componentPath)}__${tableName}`;
|
|
55
|
+
}
|
|
56
|
+
function resolveInstalledComponent(alias, install, parentPath) {
|
|
57
|
+
const pathSegments = [...parentPath, alias];
|
|
58
|
+
const componentPath = pathSegments.join("/");
|
|
59
|
+
const component = install.component;
|
|
60
|
+
const requestedCapabilities = [...component.requestedCapabilities ?? []];
|
|
61
|
+
const localTables = createLocalTableMap(componentPath, component.schema);
|
|
62
|
+
const defaultCapabilities = new Set(component.schema ? ["ownTables"] : []);
|
|
63
|
+
if (component.public) defaultCapabilities.add("publicExports");
|
|
64
|
+
if (component.internal) defaultCapabilities.add("internalActions");
|
|
65
|
+
const grantedCapabilities = Array.from(new Set([...defaultCapabilities, ...install.capabilities ?? requestedCapabilities]));
|
|
66
|
+
for (const capability of requestedCapabilities) if (!grantedCapabilities.includes(capability)) throw new Error(`Component ${JSON.stringify(component.name)} at ${JSON.stringify(componentPath)} requested capability ${JSON.stringify(capability)} but it was not granted.`);
|
|
67
|
+
if (component.config) component.config.parse(install.config);
|
|
68
|
+
const bindings = { ...install.bindings ?? {} };
|
|
69
|
+
for (const dependency of component.dependencies ?? []) if (!bindings[dependency]) throw new Error(`Component ${JSON.stringify(component.name)} at ${JSON.stringify(componentPath)} requires binding ${JSON.stringify(dependency)}.`);
|
|
70
|
+
const children = Object.entries(install.children ?? {}).sort(([left], [right]) => left.localeCompare(right)).map(([childAlias, childInstall]) => resolveInstalledComponent(childAlias, childInstall, pathSegments));
|
|
71
|
+
return {
|
|
72
|
+
alias,
|
|
73
|
+
path: componentPath,
|
|
74
|
+
source: install.source,
|
|
75
|
+
name: component.name,
|
|
76
|
+
version: component.version,
|
|
77
|
+
config: install.config,
|
|
78
|
+
grantedCapabilities,
|
|
79
|
+
requestedCapabilities,
|
|
80
|
+
bindings,
|
|
81
|
+
schema: component.schema,
|
|
82
|
+
public: component.public,
|
|
83
|
+
internal: component.internal,
|
|
84
|
+
publicEntries: flattenComponentFunctionTree(component.public, componentPath, component.name, component.version, "public", localTables, grantedCapabilities, bindings),
|
|
85
|
+
internalEntries: flattenComponentFunctionTree(component.internal, componentPath, component.name, component.version, "internal", localTables, grantedCapabilities, bindings),
|
|
86
|
+
localTables,
|
|
87
|
+
onStart: component.onStart,
|
|
88
|
+
onStop: component.onStop,
|
|
89
|
+
children
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function createLocalTableMap(componentPath, schema) {
|
|
93
|
+
if (!schema) return {};
|
|
94
|
+
return Object.fromEntries(schema.tableNames().map((tableName) => [tableName, createComponentPhysicalTableName(componentPath, tableName)]));
|
|
95
|
+
}
|
|
96
|
+
function composeComponentTables(component) {
|
|
97
|
+
const entries = [];
|
|
98
|
+
if (component.schema) for (const localTableName of component.schema.tableNames()) {
|
|
99
|
+
const original = component.schema.getTable(localTableName);
|
|
100
|
+
const cloned = new TableDefinition(original.validator, {
|
|
101
|
+
...original.options,
|
|
102
|
+
tableName: localTableName,
|
|
103
|
+
componentPath: component.path,
|
|
104
|
+
componentName: component.name
|
|
105
|
+
});
|
|
106
|
+
for (const index of original.indexes) if (index.fields.length > 0) cloned.index(index.name, [...index.fields]);
|
|
107
|
+
for (const index of original.searchIndexes) cloned.searchIndex(index.name, {
|
|
108
|
+
searchField: index.searchField,
|
|
109
|
+
filterFields: [...index.filterFields]
|
|
110
|
+
});
|
|
111
|
+
entries.push([component.localTables[localTableName], cloned]);
|
|
112
|
+
}
|
|
113
|
+
for (const child of component.children) entries.push(...composeComponentTables(child));
|
|
114
|
+
return entries;
|
|
115
|
+
}
|
|
116
|
+
function appendResolvedComponentFunctions(registry, component) {
|
|
117
|
+
for (const entry of component.publicEntries) registry[entry.canonicalName] = entry.definition;
|
|
118
|
+
for (const entry of component.internalEntries) registry[entry.canonicalName] = entry.definition;
|
|
119
|
+
for (const child of component.children) appendResolvedComponentFunctions(registry, child);
|
|
120
|
+
}
|
|
121
|
+
function flattenComponentFunctionTree(tree, componentPath, componentName, version, visibility, localTables, grantedCapabilities, bindings, prefix = []) {
|
|
122
|
+
if (!tree) return [];
|
|
123
|
+
const entries = [];
|
|
124
|
+
for (const [key, value] of Object.entries(tree).sort(([left], [right]) => left.localeCompare(right))) {
|
|
125
|
+
if (!value) continue;
|
|
126
|
+
if (isFunctionDefinition(value)) {
|
|
127
|
+
const localName = [...prefix, key].join("/");
|
|
128
|
+
entries.push({
|
|
129
|
+
localName,
|
|
130
|
+
canonicalName: toCanonicalComponentFunctionName(componentPath, visibility, localName),
|
|
131
|
+
definition: decorateComponentFunctionDefinition(value, {
|
|
132
|
+
componentPath,
|
|
133
|
+
componentName,
|
|
134
|
+
version,
|
|
135
|
+
visibility,
|
|
136
|
+
localName,
|
|
137
|
+
localTables,
|
|
138
|
+
grantedCapabilities,
|
|
139
|
+
bindings
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
entries.push(...flattenComponentFunctionTree(value, componentPath, componentName, version, visibility, localTables, grantedCapabilities, bindings, [...prefix, key]));
|
|
145
|
+
}
|
|
146
|
+
return entries;
|
|
147
|
+
}
|
|
148
|
+
function decorateComponentFunctionDefinition(definition, metadata) {
|
|
149
|
+
return {
|
|
150
|
+
...definition,
|
|
151
|
+
__syncoreComponent: metadata
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function createInstalledComponentsApiObject(components) {
|
|
155
|
+
return Object.fromEntries(components.map((component) => [component.alias, createInstalledComponentApiNode(component)]));
|
|
156
|
+
}
|
|
157
|
+
function createInstalledComponentApiNode(component) {
|
|
158
|
+
const node = {};
|
|
159
|
+
for (const entry of component.publicEntries) assignFunctionReference(node, entry.localName.split("/"), {
|
|
160
|
+
kind: entry.definition.kind,
|
|
161
|
+
name: entry.canonicalName
|
|
162
|
+
});
|
|
163
|
+
for (const child of component.children) node[child.alias] = createInstalledComponentApiNode(child);
|
|
164
|
+
return node;
|
|
165
|
+
}
|
|
166
|
+
function assignFunctionReference(node, pathParts, reference) {
|
|
167
|
+
const [head, ...tail] = pathParts;
|
|
168
|
+
if (!head) return;
|
|
169
|
+
if (tail.length === 0) {
|
|
170
|
+
node[head] = reference;
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const child = node[head] && typeof node[head] === "object" ? node[head] : {};
|
|
174
|
+
node[head] = child;
|
|
175
|
+
assignFunctionReference(child, tail, reference);
|
|
176
|
+
}
|
|
177
|
+
function isFunctionDefinition(value) {
|
|
178
|
+
return Boolean(value) && typeof value === "object" && "kind" in value && "argsValidator" in value && "handler" in value;
|
|
179
|
+
}
|
|
180
|
+
function sanitizeComponentPath(componentPath) {
|
|
181
|
+
return componentPath.replace(/[^a-zA-Z0-9_]+/g, "_");
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
export { composeProjectFunctionRegistry, composeProjectSchema, createBindingFunctionReference, createComponentPhysicalTableName, createInstalledComponentsApi, defineComponent, defineComponents, installComponent, resolveComponentsManifest, toCanonicalComponentFunctionName };
|
|
185
|
+
|
|
186
|
+
//# sourceMappingURL=components.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.mjs","names":[],"sources":["../../src/runtime/components.ts"],"sourcesContent":["import {\n SyncoreSchema,\n TableDefinition,\n defineSchema,\n type AnyTableDefinition,\n type Validator\n} from \"@syncore/schema\";\nimport type { SyncoreDevtoolsEvent } from \"@syncore/devtools-protocol\";\nimport {\n type FunctionReference,\n type FunctionReferenceFor,\n type SyncoreFunctionDefinition,\n type SyncoreFunctionKind\n} from \"./functions.js\";\nimport type {\n JsonObject,\n RegisteredSyncoreFunction,\n SyncoreDataModel,\n SyncoreFunctionRegistry\n} from \"./runtime.js\";\n\nexport type ComponentPath = string;\n\nexport type SyncoreCoreCapability =\n | \"storage\"\n | \"scheduler\"\n | \"devtools\"\n | \"ownTables\"\n | \"publicExports\"\n | \"internalActions\";\n\nexport type SyncoreHostServiceName =\n | \"http\"\n | \"notifications\"\n | \"secureStore\"\n | \"filesystem\"\n | \"backgroundTasks\"\n | \"crypto\";\n\nexport type SyncoreRequestedCapability =\n | SyncoreCoreCapability\n | `host:${SyncoreHostServiceName}`;\n\nexport type AnySyncoreFunctionDefinition = SyncoreFunctionDefinition<\n SyncoreFunctionKind,\n any,\n any,\n unknown\n>;\n\nexport type SyncoreFunctionTree = {\n readonly [key: string]:\n | AnySyncoreFunctionDefinition\n | SyncoreFunctionTree\n | undefined;\n};\n\nexport interface SyncoreComponentHookContext {\n runtimeId: string;\n platform: string;\n componentPath: ComponentPath;\n componentName: string;\n version: string;\n config: unknown;\n capabilities: readonly SyncoreRequestedCapability[];\n emitDevtools(event: SyncoreDevtoolsEvent): void;\n}\n\nexport interface SyncoreComponent<\n TConfig = unknown,\n TSchema extends SyncoreDataModel | undefined =\n | SyncoreDataModel\n | undefined,\n TPublic extends SyncoreFunctionTree | undefined =\n | SyncoreFunctionTree\n | undefined,\n TInternal extends SyncoreFunctionTree | undefined =\n | SyncoreFunctionTree\n | undefined\n> {\n readonly kind: \"syncore.component\";\n readonly name: string;\n readonly version: string;\n readonly config?: Validator<TConfig>;\n readonly requestedCapabilities?: readonly SyncoreRequestedCapability[];\n readonly schema?: TSchema;\n readonly public?: TPublic;\n readonly internal?: TInternal;\n readonly dependencies?: readonly string[];\n onStart?(context: SyncoreComponentHookContext): Promise<void> | void;\n onStop?(context: SyncoreComponentHookContext): Promise<void> | void;\n}\n\nexport interface SyncoreComponentInstall<\n TComponent extends SyncoreComponent = SyncoreComponent,\n TChildren extends SyncoreComponentsManifest = SyncoreComponentsManifest\n> {\n readonly kind: \"syncore.component.install\";\n readonly component: TComponent;\n readonly source: string;\n readonly config?: TComponent extends SyncoreComponent<infer TConfig, any, any, any>\n ? TConfig\n : unknown;\n readonly capabilities?: readonly SyncoreRequestedCapability[];\n readonly bindings?: Record<string, string>;\n readonly children?: TChildren;\n}\n\nexport type SyncoreComponentsManifest = Record<string, SyncoreComponentInstall>;\n\nexport interface SyncoreComponentFunctionMetadata {\n componentPath: ComponentPath;\n componentName: string;\n version: string;\n visibility: \"public\" | \"internal\";\n localName: string;\n localTables: Record<string, string>;\n grantedCapabilities: readonly SyncoreRequestedCapability[];\n bindings: Record<string, string>;\n}\n\nexport interface ResolvedSyncoreComponent {\n alias: string;\n path: ComponentPath;\n source: string;\n name: string;\n version: string;\n config: unknown;\n grantedCapabilities: readonly SyncoreRequestedCapability[];\n requestedCapabilities: readonly SyncoreRequestedCapability[];\n bindings: Record<string, string>;\n schema: SyncoreDataModel | undefined;\n public: SyncoreFunctionTree | undefined;\n internal: SyncoreFunctionTree | undefined;\n publicEntries: Array<{\n localName: string;\n canonicalName: string;\n definition: RegisteredSyncoreFunction;\n }>;\n internalEntries: Array<{\n localName: string;\n canonicalName: string;\n definition: RegisteredSyncoreFunction;\n }>;\n localTables: Record<string, string>;\n onStart: SyncoreComponent[\"onStart\"] | undefined;\n onStop: SyncoreComponent[\"onStop\"] | undefined;\n children: ResolvedSyncoreComponent[];\n}\n\ntype Simplify<T> = { [K in keyof T]: T[K] } & {};\n\ntype PublicFunctionTreeOf<TComponent> = TComponent extends SyncoreComponent<\n any,\n any,\n infer TPublic,\n any\n>\n ? NonNullable<TPublic>\n : never;\n\nexport type FunctionReferencesForTree<TTree extends SyncoreFunctionTree> = Simplify<{\n [TKey in keyof TTree]: TTree[TKey] extends AnySyncoreFunctionDefinition\n ? FunctionReferenceFor<TTree[TKey]>\n : Record<string, unknown>;\n}>;\n\nexport type InstalledComponentApi<\n TInstall extends SyncoreComponentInstall\n> = Simplify<\n FunctionReferencesForTree<PublicFunctionTreeOf<TInstall[\"component\"]>> &\n Record<string, unknown>\n>;\n\nexport type InstalledComponentsApi<\n TManifest extends SyncoreComponentsManifest\n> = Simplify<{\n [TAlias in keyof TManifest]: InstalledComponentApi<TManifest[TAlias]>;\n}>;\n\ntype TablesOfSchema<TSchema extends SyncoreDataModel> = TSchema[\"tables\"];\n\nexport function defineComponent<\n TConfig = unknown,\n TSchema extends SyncoreDataModel | undefined =\n | SyncoreDataModel\n | undefined,\n TPublic extends SyncoreFunctionTree | undefined =\n | SyncoreFunctionTree\n | undefined,\n TInternal extends SyncoreFunctionTree | undefined =\n | SyncoreFunctionTree\n | undefined\n>(\n component: Omit<\n SyncoreComponent<TConfig, TSchema, TPublic, TInternal>,\n \"kind\"\n >\n): SyncoreComponent<TConfig, TSchema, TPublic, TInternal> {\n return {\n kind: \"syncore.component\",\n ...component\n };\n}\n\nexport function installComponent<\n TComponent extends SyncoreComponent,\n TChildren extends SyncoreComponentsManifest = {}\n>(install: {\n component: TComponent;\n source: string;\n config?: TComponent extends SyncoreComponent<infer TConfig, any, any, any>\n ? TConfig\n : unknown;\n capabilities?: readonly SyncoreRequestedCapability[];\n bindings?: Record<string, string>;\n children?: TChildren;\n}): SyncoreComponentInstall<TComponent, TChildren> {\n return {\n kind: \"syncore.component.install\",\n ...install\n };\n}\n\nexport function defineComponents<TManifest extends SyncoreComponentsManifest>(\n components: TManifest\n): TManifest {\n return components;\n}\n\nexport function createBindingFunctionReference<\n TKind extends SyncoreFunctionKind,\n TArgs = JsonObject,\n TResult = unknown\n>(\n kind: TKind,\n bindingName: string,\n functionName: string\n): FunctionReference<TKind, TArgs, TResult> {\n return {\n kind,\n name: `binding:${bindingName}/${functionName}`\n };\n}\n\nexport function composeProjectSchema<\n TRootSchema extends SyncoreDataModel\n>(\n rootSchema: TRootSchema,\n manifest?: SyncoreComponentsManifest\n): SyncoreSchema<TablesOfSchema<TRootSchema> & Record<string, AnyTableDefinition>> {\n const tables: Record<string, AnyTableDefinition> = {\n ...rootSchema.tables\n };\n\n for (const component of resolveComponentsManifest(manifest)) {\n for (const [physicalTableName, tableDefinition] of composeComponentTables(\n component\n )) {\n if (tables[physicalTableName]) {\n throw new Error(\n `Component table collision detected for ${JSON.stringify(physicalTableName)}.`\n );\n }\n tables[physicalTableName] = tableDefinition;\n }\n }\n\n return defineSchema(tables) as unknown as SyncoreSchema<\n TablesOfSchema<TRootSchema> & Record<string, AnyTableDefinition>\n >;\n}\n\nexport function composeProjectFunctionRegistry(\n rootFunctions: SyncoreFunctionRegistry,\n manifest?: SyncoreComponentsManifest\n): SyncoreFunctionRegistry {\n const registry: Record<string, RegisteredSyncoreFunction> = {};\n for (const [name, definition] of Object.entries(rootFunctions)) {\n if (definition) {\n registry[name] = definition;\n }\n }\n\n for (const component of resolveComponentsManifest(manifest)) {\n appendResolvedComponentFunctions(registry, component);\n }\n\n return registry;\n}\n\nexport function createInstalledComponentsApi<\n TManifest extends SyncoreComponentsManifest\n>(manifest: TManifest): InstalledComponentsApi<TManifest> {\n return createInstalledComponentsApiObject(resolveComponentsManifest(manifest)) as InstalledComponentsApi<TManifest>;\n}\n\nexport function resolveComponentsManifest(\n manifest?: SyncoreComponentsManifest\n): ResolvedSyncoreComponent[] {\n if (!manifest) {\n return [];\n }\n\n return Object.entries(manifest)\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([alias, install]) => resolveInstalledComponent(alias, install, []));\n}\n\nexport function toCanonicalComponentFunctionName(\n componentPath: ComponentPath,\n visibility: \"public\" | \"internal\",\n localName: string\n): string {\n return [\"components\", componentPath, visibility, localName]\n .filter(Boolean)\n .join(\"/\");\n}\n\nexport function createComponentPhysicalTableName(\n componentPath: ComponentPath,\n tableName: string\n): string {\n const pathPart = sanitizeComponentPath(componentPath);\n return `__syncore_component__${pathPart}__${tableName}`;\n}\n\nfunction resolveInstalledComponent(\n alias: string,\n install: SyncoreComponentInstall,\n parentPath: string[]\n): ResolvedSyncoreComponent {\n const pathSegments = [...parentPath, alias];\n const componentPath = pathSegments.join(\"/\");\n const component = install.component;\n const requestedCapabilities = [\n ...(component.requestedCapabilities ?? [])\n ];\n const localTables = createLocalTableMap(componentPath, component.schema);\n const defaultCapabilities = new Set<SyncoreRequestedCapability>(\n component.schema ? [\"ownTables\"] : []\n );\n if (component.public) {\n defaultCapabilities.add(\"publicExports\");\n }\n if (component.internal) {\n defaultCapabilities.add(\"internalActions\");\n }\n const grantedCapabilities = Array.from(\n new Set([\n ...defaultCapabilities,\n ...(install.capabilities ?? requestedCapabilities)\n ])\n );\n\n for (const capability of requestedCapabilities) {\n if (!grantedCapabilities.includes(capability)) {\n throw new Error(\n `Component ${JSON.stringify(component.name)} at ${JSON.stringify(componentPath)} requested capability ${JSON.stringify(capability)} but it was not granted.`\n );\n }\n }\n\n if (component.config) {\n component.config.parse(install.config);\n }\n\n const bindings = { ...(install.bindings ?? {}) };\n for (const dependency of component.dependencies ?? []) {\n if (!bindings[dependency]) {\n throw new Error(\n `Component ${JSON.stringify(component.name)} at ${JSON.stringify(componentPath)} requires binding ${JSON.stringify(dependency)}.`\n );\n }\n }\n\n const children = Object.entries(install.children ?? {})\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([childAlias, childInstall]) =>\n resolveInstalledComponent(childAlias, childInstall, pathSegments)\n );\n\n return {\n alias,\n path: componentPath,\n source: install.source,\n name: component.name,\n version: component.version,\n config: install.config,\n grantedCapabilities,\n requestedCapabilities,\n bindings,\n schema: component.schema,\n public: component.public,\n internal: component.internal,\n publicEntries: flattenComponentFunctionTree(\n component.public,\n componentPath,\n component.name,\n component.version,\n \"public\",\n localTables,\n grantedCapabilities,\n bindings\n ),\n internalEntries: flattenComponentFunctionTree(\n component.internal,\n componentPath,\n component.name,\n component.version,\n \"internal\",\n localTables,\n grantedCapabilities,\n bindings\n ),\n localTables,\n onStart: component.onStart,\n onStop: component.onStop,\n children\n };\n}\n\nfunction createLocalTableMap(\n componentPath: string,\n schema?: SyncoreDataModel\n): Record<string, string> {\n if (!schema) {\n return {};\n }\n return Object.fromEntries(\n schema.tableNames().map((tableName) => [\n tableName,\n createComponentPhysicalTableName(componentPath, tableName)\n ])\n );\n}\n\nfunction composeComponentTables(\n component: ResolvedSyncoreComponent\n): Array<[string, AnyTableDefinition]> {\n const entries: Array<[string, AnyTableDefinition]> = [];\n if (component.schema) {\n for (const localTableName of component.schema.tableNames()) {\n const original = component.schema.getTable(localTableName);\n const cloned = new TableDefinition(original.validator, {\n ...original.options,\n tableName: localTableName,\n componentPath: component.path,\n componentName: component.name\n });\n for (const index of original.indexes) {\n if (index.fields.length > 0) {\n cloned.index(index.name, [...index.fields] as [string, ...string[]]);\n }\n }\n for (const index of original.searchIndexes) {\n cloned.searchIndex(index.name, {\n searchField: index.searchField,\n filterFields: [...index.filterFields]\n });\n }\n entries.push([component.localTables[localTableName]!, cloned]);\n }\n }\n for (const child of component.children) {\n entries.push(...composeComponentTables(child));\n }\n return entries;\n}\n\nfunction appendResolvedComponentFunctions(\n registry: Record<string, RegisteredSyncoreFunction>,\n component: ResolvedSyncoreComponent\n): void {\n for (const entry of component.publicEntries) {\n registry[entry.canonicalName] = entry.definition;\n }\n for (const entry of component.internalEntries) {\n registry[entry.canonicalName] = entry.definition;\n }\n for (const child of component.children) {\n appendResolvedComponentFunctions(registry, child);\n }\n}\n\nfunction flattenComponentFunctionTree(\n tree: SyncoreFunctionTree | undefined,\n componentPath: string,\n componentName: string,\n version: string,\n visibility: \"public\" | \"internal\",\n localTables: Record<string, string>,\n grantedCapabilities: readonly SyncoreRequestedCapability[],\n bindings: Record<string, string>,\n prefix: string[] = []\n): Array<{\n localName: string;\n canonicalName: string;\n definition: RegisteredSyncoreFunction;\n}> {\n if (!tree) {\n return [];\n }\n\n const entries: Array<{\n localName: string;\n canonicalName: string;\n definition: RegisteredSyncoreFunction;\n }> = [];\n\n for (const [key, value] of Object.entries(tree).sort(([left], [right]) =>\n left.localeCompare(right)\n )) {\n if (!value) {\n continue;\n }\n if (isFunctionDefinition(value)) {\n const localName = [...prefix, key].join(\"/\");\n entries.push({\n localName,\n canonicalName: toCanonicalComponentFunctionName(\n componentPath,\n visibility,\n localName\n ),\n definition: decorateComponentFunctionDefinition(value, {\n componentPath,\n componentName,\n version,\n visibility,\n localName,\n localTables,\n grantedCapabilities,\n bindings\n })\n });\n continue;\n }\n entries.push(\n ...flattenComponentFunctionTree(\n value,\n componentPath,\n componentName,\n version,\n visibility,\n localTables,\n grantedCapabilities,\n bindings,\n [...prefix, key]\n )\n );\n }\n\n return entries;\n}\n\nfunction decorateComponentFunctionDefinition(\n definition: AnySyncoreFunctionDefinition,\n metadata: SyncoreComponentFunctionMetadata\n): RegisteredSyncoreFunction {\n return {\n ...definition,\n __syncoreComponent: metadata\n } as RegisteredSyncoreFunction;\n}\n\nfunction createInstalledComponentsApiObject(\n components: ResolvedSyncoreComponent[]\n): Record<string, unknown> {\n return Object.fromEntries(\n components.map((component) => [\n component.alias,\n createInstalledComponentApiNode(component)\n ])\n );\n}\n\nfunction createInstalledComponentApiNode(\n component: ResolvedSyncoreComponent\n): Record<string, unknown> {\n const node: Record<string, unknown> = {};\n for (const entry of component.publicEntries) {\n assignFunctionReference(\n node,\n entry.localName.split(\"/\"),\n {\n kind: entry.definition.kind,\n name: entry.canonicalName\n }\n );\n }\n for (const child of component.children) {\n node[child.alias] = createInstalledComponentApiNode(child);\n }\n return node;\n}\n\nfunction assignFunctionReference(\n node: Record<string, unknown>,\n pathParts: string[],\n reference: FunctionReference\n): void {\n const [head, ...tail] = pathParts;\n if (!head) {\n return;\n }\n if (tail.length === 0) {\n node[head] = reference;\n return;\n }\n const child =\n node[head] && typeof node[head] === \"object\"\n ? (node[head] as Record<string, unknown>)\n : {};\n node[head] = child;\n assignFunctionReference(child, tail, reference);\n}\n\nfunction isFunctionDefinition(value: unknown): value is AnySyncoreFunctionDefinition {\n return (\n Boolean(value) &&\n typeof value === \"object\" &&\n \"kind\" in (value as Record<string, unknown>) &&\n \"argsValidator\" in (value as Record<string, unknown>) &&\n \"handler\" in (value as Record<string, unknown>)\n );\n}\n\nfunction sanitizeComponentPath(componentPath: string): string {\n return componentPath.replace(/[^a-zA-Z0-9_]+/g, \"_\");\n}\n"],"mappings":";;AAsLA,SAAgB,gBAYd,WAIwD;AACxD,QAAO;EACL,MAAM;EACN,GAAG;EACJ;;AAGH,SAAgB,iBAGd,SASiD;AACjD,QAAO;EACL,MAAM;EACN,GAAG;EACJ;;AAGH,SAAgB,iBACd,YACW;AACX,QAAO;;AAGT,SAAgB,+BAKd,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H;AAEF,KAAI,KAAK,WAAW,GAAG;AACrB,OAAK,QAAQ;AACb;;CAEF,MAAM,QACJ,KAAK,SAAS,OAAO,KAAK,UAAU,WAC/B,KAAK,QACN,EAAE;AACR,MAAK,QAAQ;AACb,yBAAwB,OAAO,MAAM,UAAU;;AAGjD,SAAS,qBAAqB,OAAuD;AACnF,QACE,QAAQ,MAAM,IACd,OAAO,UAAU,YACjB,UAAW,SACX,mBAAoB,SACpB,aAAc;;AAIlB,SAAS,sBAAsB,eAA+B;AAC5D,QAAO,cAAc,QAAQ,mBAAmB,IAAI"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DevtoolsLiveQueryScope, SyncoreDataModel, SyncoreRuntimeAdmin, SyncoreRuntimeOptions, SyncoreSqlDriver } from "./runtime.mjs";
|
|
2
2
|
import { SyncoreDevtoolsCommandPayload, SyncoreDevtoolsCommandResultPayload, SyncoreDevtoolsSubscriptionPayload, SyncoreDevtoolsSubscriptionResultPayload } from "../../devtools-protocol/index.d.ts";
|
|
3
3
|
|
|
4
4
|
//#region src/runtime/devtools.d.ts
|
|
5
5
|
interface DevtoolsCommandHandlerDeps {
|
|
6
6
|
driver: SyncoreSqlDriver;
|
|
7
|
-
schema:
|
|
8
|
-
functions: SyncoreRuntimeOptions<
|
|
9
|
-
|
|
7
|
+
schema: SyncoreDataModel;
|
|
8
|
+
functions: SyncoreRuntimeOptions<SyncoreDataModel>["functions"];
|
|
9
|
+
admin: SyncoreRuntimeAdmin<SyncoreDataModel>;
|
|
10
10
|
sql?: DevtoolsSqlSupport;
|
|
11
11
|
}
|
|
12
12
|
type DevtoolsSqlMode = "read" | "write" | "ddl";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools.d.mts","names":[],"sources":["../../src/runtime/devtools.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"devtools.d.mts","names":[],"sources":["../../src/runtime/devtools.ts"],"mappings":";;;;UA8BiB,0BAAA;EACf,MAAA,EAAQ,gBAAA;EACR,MAAA,EAAQ,gBAAA;EACR,SAAA,EAAW,qBAAA,CAAsB,gBAAA;EACjC,KAAA,EAAO,mBAAA,CAAoB,gBAAA;EAC3B,GAAA,GAAM,kBAAA;AAAA;AAAA,KAGI,eAAA;AAAA,UAEK,mBAAA;EACf,IAAA,EAAM,eAAA;EACN,UAAA;EACA,WAAA;EACA,aAAA;EACA,cAAA,EAAgB,sBAAA;AAAA;AAAA,UAGD,qBAAA;EACf,OAAA;EACA,IAAA;EACA,cAAA;AAAA;AAAA,UAGe,kBAAA;EACf,mBAAA,CAAoB,KAAA,WAAgB,mBAAA;EACpC,aAAA,CACE,QAAA,EAAU,mBAAA,EACV,QAAA,EAAU,eAAA;EAEZ,gBAAA,CAAiB,YAAA,UAAsB,KAAA,WAAgB,qBAAA;AAAA;AAAA,KAG7C,sBAAA,IACV,OAAA,EAAS,6BAAA,KACN,OAAA,CAAQ,mCAAA;AAAA,KAED,4BAAA,IACV,OAAA,EAAS,wCAAA;AAAA,UAGM,wBAAA;EACf,SAAA,CACE,cAAA,UACA,OAAA,EAAS,kCAAA,EACT,QAAA,EAAU,4BAAA,GACT,OAAA;EACH,WAAA,CAAY,cAAA;EACZ,OAAA;AAAA;AAAA,iBAYc,4BAAA,CACd,IAAA,EAAM,0BAAA,GACL,sBAAA;AAAA,iBAuNa,8BAAA,CACd,IAAA,EAAM,0BAAA,GACL,wBAAA"}
|