@happyvertical/smrt-core 0.45.2 → 0.46.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/AGENTS.md +1 -0
- package/agents/generators.md +0 -1
- package/dist/browser.d.ts +2 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/embedded-write-queue.d.ts.map +1 -1
- package/dist/embedded-write-queue.js +20 -1
- package/dist/embedded-write-queue.js.map +1 -1
- package/dist/generators/custom-action.d.ts +71 -39
- package/dist/generators/custom-action.d.ts.map +1 -1
- package/dist/generators/custom-action.js +71 -39
- package/dist/generators/custom-action.js.map +1 -1
- package/dist/generators/index.d.ts +0 -2
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +2 -3
- package/dist/generators/mcp.d.ts.map +1 -1
- package/dist/generators/mcp.js +1 -1
- package/dist/generators/mcp.js.map +1 -1
- package/dist/generators/tenant-gate.d.ts +33 -9
- package/dist/generators/tenant-gate.d.ts.map +1 -1
- package/dist/generators/tenant-gate.js +2 -1
- package/dist/generators/tenant-gate.js.map +1 -1
- package/dist/generators.js +2 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/knowledge.js +28 -16
- package/dist/knowledge.js.map +1 -1
- package/dist/manifest/static-manifest.js +1 -1
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/migrations/framework-base-tables.d.ts +148 -0
- package/dist/migrations/framework-base-tables.d.ts.map +1 -0
- package/dist/migrations/framework-base-tables.js +419 -0
- package/dist/migrations/framework-base-tables.js.map +1 -0
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +2 -1
- package/dist/migrations.js +2 -1
- package/dist/postgres-permissions.d.ts +40 -0
- package/dist/postgres-permissions.d.ts.map +1 -0
- package/dist/postgres-permissions.js +353 -0
- package/dist/postgres-permissions.js.map +1 -0
- package/dist/registry/framework-base-classes.d.ts.map +1 -1
- package/dist/registry/framework-base-classes.js +4 -1
- package/dist/registry/framework-base-classes.js.map +1 -1
- package/dist/scripts/create-wrappers.js +0 -5
- package/dist/smrt-knowledge.json +7 -8
- package/dist/testing/database.d.ts +6 -1
- package/dist/testing/database.d.ts.map +1 -1
- package/dist/testing/database.js +9 -1
- package/dist/testing/database.js.map +1 -1
- package/dist/vite-plugin/api-client-entries.d.ts.map +1 -1
- package/dist/vite-plugin/api-client-entries.js +16 -14
- package/dist/vite-plugin/api-client-entries.js.map +1 -1
- package/dist/vite-plugin/index.d.ts.map +1 -1
- package/dist/vite-plugin/index.js +2 -166
- package/dist/vite-plugin/index.js.map +1 -1
- package/dist/vite-plugin/sveltekit-generator.d.ts +3 -2
- package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
- package/dist/vite-plugin/sveltekit-generator.js +20 -24
- package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
- package/dist/vite-plugin/templates/default-ui.ts +22 -1
- package/dist/vite-plugin/web-collections.d.ts.map +1 -1
- package/dist/vite-plugin/web-collections.js.map +1 -1
- package/package.json +4 -9
- package/dist/generators/cli.d.ts +0 -155
- package/dist/generators/cli.d.ts.map +0 -1
- package/dist/generators/cli.js +0 -473
- package/dist/generators/cli.js.map +0 -1
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tenant entry-point gate — dependency-inversion hook for generated
|
|
2
|
+
* Tenant entry-point gate — dependency-inversion hook for generated in-process
|
|
3
3
|
* execution (#1554).
|
|
4
4
|
*
|
|
5
5
|
* `@happyvertical/smrt-core` cannot depend on `@happyvertical/smrt-tenancy`
|
|
6
6
|
* (tenancy depends on core, not the other way around). The generated SvelteKit
|
|
7
|
-
* routes establish tenant context from the request principal, but
|
|
8
|
-
*
|
|
9
|
-
* with no active context would fall
|
|
10
|
-
* pass-through and return rows across
|
|
7
|
+
* routes establish tenant context from the request principal, but an in-process
|
|
8
|
+
* generator with no principal of its own needs the same fail-closed guarantee —
|
|
9
|
+
* without a gate a tenant-scoped read with no active context would fall
|
|
10
|
+
* through the interceptor's optional-mode pass-through and return rows across
|
|
11
|
+
* **all** tenants.
|
|
12
|
+
*
|
|
13
|
+
* `MCPGenerator` (`generators/mcp.ts`) is the ONLY in-repo caller of
|
|
14
|
+
* {@link runWithTenantGate} today, passing `surface: 'MCP'`. Core's
|
|
15
|
+
* `CLIGenerator`, which used to call this with `surface: 'CLI'` and the
|
|
16
|
+
* `--tenant`/`--all-tenants` flags documented on {@link TenantGateOptions}
|
|
17
|
+
* below, was retired as unused public API (#2664). The live local CLI
|
|
18
|
+
* transport (`packages/cli/src/cli-generator.ts`, the shipped `smrt
|
|
19
|
+
* <object>:<action>` binary) has never called this gate and has no
|
|
20
|
+
* `--tenant`/`--all-tenants` flags of its own — it is NOT tenant-isolation
|
|
21
|
+
* fail-closed today. Do not read this module as evidence that it is; see
|
|
22
|
+
* `packages/tenancy/src/__tests__/cli-mcp-tenant-context.spec.ts` for the
|
|
23
|
+
* MCP-only coverage this leaves in place.
|
|
11
24
|
*
|
|
12
25
|
* Core exposes an injectable runner slot that tenancy fills at `enableTenancy()`
|
|
13
26
|
* time (the same inversion pattern as the DispatchBus tenant resolver and
|
|
@@ -29,11 +42,21 @@ export interface TenantGateOptions {
|
|
|
29
42
|
className?: string;
|
|
30
43
|
/** Explicit tenant-scoping decision; overrides `className` resolution. */
|
|
31
44
|
tenantScoped?: boolean;
|
|
32
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Explicit operator-provided tenant selector (`context.tenantId` for
|
|
47
|
+
* MCPGenerator, today's only caller; core's retired `CLIGenerator` used to
|
|
48
|
+
* pass this from a `--tenant` flag the shipped local CLI does not have,
|
|
49
|
+
* #2664).
|
|
50
|
+
*/
|
|
33
51
|
tenantId?: string | null;
|
|
34
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Explicit operator opt-in to cross-tenant/system access
|
|
54
|
+
* (`context.allowCrossTenant` for MCPGenerator; core's retired
|
|
55
|
+
* `CLIGenerator` used to pass this from a `--all-tenants` flag the shipped
|
|
56
|
+
* local CLI does not have, #2664).
|
|
57
|
+
*/
|
|
35
58
|
allowCrossTenant?: boolean;
|
|
36
|
-
/** Surface name for the fail-closed error message, e.g. `'
|
|
59
|
+
/** Surface name for the fail-closed error message, e.g. `'MCP'`. */
|
|
37
60
|
surface?: string;
|
|
38
61
|
}
|
|
39
62
|
/**
|
|
@@ -46,7 +69,8 @@ declare global {
|
|
|
46
69
|
var __smrtTenantEntryPointRunner: TenantEntryPointRunner | undefined;
|
|
47
70
|
}
|
|
48
71
|
/**
|
|
49
|
-
* Register the tenant entry-point runner used by generated
|
|
72
|
+
* Register the tenant entry-point runner used by generated in-process
|
|
73
|
+
* execution (`MCPGenerator` today; see the module docblock above).
|
|
50
74
|
*
|
|
51
75
|
* Called by `@happyvertical/smrt-tenancy`'s `enableTenancy()`; application code
|
|
52
76
|
* never calls this directly. Passing `undefined` clears the runner (restoring
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenant-gate.d.ts","sourceRoot":"","sources":["../../src/generators/tenant-gate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tenant-gate.d.ts","sourceRoot":"","sources":["../../src/generators/tenant-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,0DAA0D;AAC1D,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,EACrC,OAAO,EAAE,iBAAiB,EAC1B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KACjB,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhB,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,4BAA4B,EAAE,sBAAsB,GAAG,SAAS,CAAC;CACtE;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,sBAAsB,GAAG,SAAS,GACzC,IAAI,CAEN;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EACvC,OAAO,EAAE,iBAAiB,EAC1B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAOZ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/generators/tenant-gate.ts
|
|
2
2
|
/**
|
|
3
|
-
* Register the tenant entry-point runner used by generated
|
|
3
|
+
* Register the tenant entry-point runner used by generated in-process
|
|
4
|
+
* execution (`MCPGenerator` today; see the module docblock above).
|
|
4
5
|
*
|
|
5
6
|
* Called by `@happyvertical/smrt-tenancy`'s `enableTenancy()`; application code
|
|
6
7
|
* never calls this directly. Passing `undefined` clears the runner (restoring
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenant-gate.js","names":[],"sources":["../../src/generators/tenant-gate.ts"],"sourcesContent":["/**\n * Tenant entry-point gate — dependency-inversion hook for generated
|
|
1
|
+
{"version":3,"file":"tenant-gate.js","names":[],"sources":["../../src/generators/tenant-gate.ts"],"sourcesContent":["/**\n * Tenant entry-point gate — dependency-inversion hook for generated in-process\n * execution (#1554).\n *\n * `@happyvertical/smrt-core` cannot depend on `@happyvertical/smrt-tenancy`\n * (tenancy depends on core, not the other way around). The generated SvelteKit\n * routes establish tenant context from the request principal, but an in-process\n * generator with no principal of its own needs the same fail-closed guarantee —\n * without a gate a tenant-scoped read with no active context would fall\n * through the interceptor's optional-mode pass-through and return rows across\n * **all** tenants.\n *\n * `MCPGenerator` (`generators/mcp.ts`) is the ONLY in-repo caller of\n * {@link runWithTenantGate} today, passing `surface: 'MCP'`. Core's\n * `CLIGenerator`, which used to call this with `surface: 'CLI'` and the\n * `--tenant`/`--all-tenants` flags documented on {@link TenantGateOptions}\n * below, was retired as unused public API (#2664). The live local CLI\n * transport (`packages/cli/src/cli-generator.ts`, the shipped `smrt\n * <object>:<action>` binary) has never called this gate and has no\n * `--tenant`/`--all-tenants` flags of its own — it is NOT tenant-isolation\n * fail-closed today. Do not read this module as evidence that it is; see\n * `packages/tenancy/src/__tests__/cli-mcp-tenant-context.spec.ts` for the\n * MCP-only coverage this leaves in place.\n *\n * Core exposes an injectable runner slot that tenancy fills at `enableTenancy()`\n * time (the same inversion pattern as the DispatchBus tenant resolver and\n * `GlobalInterceptors`). When tenancy is not enabled (non-tenant deployments,\n * existing tests), the slot is empty and {@link runWithTenantGate} simply runs\n * the body — identical to pre-#1554 behavior.\n *\n * Stored on `globalThis` so all module instances share one runner, which\n * matters in the monorepo where the same package can be loaded from multiple\n * paths.\n */\n\n/** Options forwarded to the registered tenancy runner. */\nexport interface TenantGateOptions {\n /**\n * Class name of the target model. Tenant-scoping is resolved authoritatively\n * inside tenancy (`isTenantScopedClass`) — the same source the interceptor\n * uses, so it covers both `@TenantScoped` and `@smrt({ tenantScoped })`.\n */\n className?: string;\n /** Explicit tenant-scoping decision; overrides `className` resolution. */\n tenantScoped?: boolean;\n /**\n * Explicit operator-provided tenant selector (`context.tenantId` for\n * MCPGenerator, today's only caller; core's retired `CLIGenerator` used to\n * pass this from a `--tenant` flag the shipped local CLI does not have,\n * #2664).\n */\n tenantId?: string | null;\n /**\n * Explicit operator opt-in to cross-tenant/system access\n * (`context.allowCrossTenant` for MCPGenerator; core's retired\n * `CLIGenerator` used to pass this from a `--all-tenants` flag the shipped\n * local CLI does not have, #2664).\n */\n allowCrossTenant?: boolean;\n /** Surface name for the fail-closed error message, e.g. `'MCP'`. */\n surface?: string;\n}\n\n/**\n * Runner that establishes (or fail-closes) tenant context around `fn` for a\n * tenant-scoped model. Registered by tenancy; see\n * `runTenantScopedEntryPoint` in `@happyvertical/smrt-tenancy`.\n */\nexport type TenantEntryPointRunner = <T>(\n options: TenantGateOptions,\n fn: () => Promise<T>,\n) => Promise<T>;\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __smrtTenantEntryPointRunner: TenantEntryPointRunner | undefined;\n}\n\n/**\n * Register the tenant entry-point runner used by generated in-process\n * execution (`MCPGenerator` today; see the module docblock above).\n *\n * Called by `@happyvertical/smrt-tenancy`'s `enableTenancy()`; application code\n * never calls this directly. Passing `undefined` clears the runner (restoring\n * the no-op default), which `disableTenancy()` does.\n *\n * @param runner - The tenancy runner, or `undefined` to clear it.\n */\nexport function setTenantEntryPointRunner(\n runner: TenantEntryPointRunner | undefined,\n): void {\n globalThis.__smrtTenantEntryPointRunner = runner;\n}\n\n/**\n * Run `fn` through the registered tenant entry-point runner (when tenancy is\n * enabled), or directly when no runner is registered.\n *\n * For tenant-scoped models the runner establishes tenant context from\n * `options.tenantId` / `options.allowCrossTenant`, or fails closed (throws) when\n * neither is available — never silently reading across tenants. Non-scoped\n * models and tenancy-off deployments pass straight through.\n *\n * @param options - {@link TenantGateOptions}.\n * @param fn - The command/tool body to execute.\n * @returns The resolved value of `fn`.\n * @throws Propagates the tenancy runner's `TenantContextError` on the\n * fail-closed branch.\n */\nexport async function runWithTenantGate<T>(\n options: TenantGateOptions,\n fn: () => Promise<T>,\n): Promise<T> {\n const runner = globalThis.__smrtTenantEntryPointRunner;\n if (!runner) {\n // Tenancy not enabled → single-/no-tenant deployment, pass through.\n return fn();\n }\n return runner(options, fn);\n}\n"],"mappings":";;;;;;;;;;;AAwFA,SAAgB,0BACd,QACM;CACN,WAAW,+BAA+B;AAC5C;;;;;;;;;;;;;;;;AAiBA,eAAsB,kBACpB,SACA,IACY;CACZ,MAAM,SAAS,WAAW;CAC1B,IAAI,CAAC,QAEH,OAAO,GAAG;CAEZ,OAAO,OAAO,SAAS,EAAE;AAC3B"}
|
package/dist/generators.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { CRUD_OPERATIONS, SMRT_CUSTOM_ACTION_ERROR_METADATA_KEY, buildCustomActionInputSchema, buildCustomActionInvocationArgs, customActionParameterInputName, isCrudOperation, isCrudToolAction, normalizeCustomActionFailure, resolveCustomActionMetadata } from "./generators/custom-action.js";
|
|
2
|
-
import { runWithTenantGate, setTenantEntryPointRunner } from "./generators/tenant-gate.js";
|
|
3
|
-
import { CLIGenerator, getCLIHandler, setupCLI } from "./generators/cli.js";
|
|
4
2
|
import { PRIVATE_READ_CACHE_CONTROL, canonicalReadRepresentation, computeBodyEtag, computeTableVersionEtag, conditionalJsonResponse, ifNoneMatchHasConcreteMatch, ifNoneMatchSatisfied, resolveReadCacheControl, resolveTenantEtagDiscriminator, versionConditionalResponse, warnIfSharedCacheNeutralized } from "./generators/conditional-get.js";
|
|
5
3
|
import { DEFAULT_EVENTS_HEARTBEAT_MS, DEFAULT_EVENTS_MAX_SUBSCRIBERS, DEFAULT_EVENTS_RETRY_AFTER_SECONDS, buildChangeEventStream, changeEventSubscribersAtCapacity, eventStreamCapacityExceededResponse, normalizeEventsMaxSubscribers, signalVisibleToTenant, tryReserveChangeEventSubscriberSlot } from "./generators/events-route.js";
|
|
4
|
+
import { runWithTenantGate, setTenantEntryPointRunner } from "./generators/tenant-gate.js";
|
|
6
5
|
import { MCPGenerator, MCP_STABLE_CATALOG_TTL_MS, resolveMCPToolListCacheHint, sortMCPTools } from "./generators/mcp.js";
|
|
7
6
|
import { PLAYBOOK_PREFLIGHT_CAPABILITY, PLAYBOOK_PREFLIGHT_ROUTE_SEGMENT, handlePlaybookPreflightRoute, isApiActionEnabledForObject, isRestActionRoutable, isRestRoutePublic, resolveRegisteredObjectName, restFieldReadPermissions, restMethodForApiAction } from "./generators/preflight-route.js";
|
|
8
7
|
import { normalizeTypedHttpError } from "./generators/typed-http-error.js";
|
|
9
8
|
import { APIGenerator, computeRuntimeWebManifestHash, createRestServer, startRestServer } from "./generators/rest.js";
|
|
10
9
|
import { generateOpenAPISpec, setupSwaggerUI } from "./generators/swagger.js";
|
|
11
10
|
import "./generators/index.js";
|
|
12
|
-
export { APIGenerator,
|
|
11
|
+
export { APIGenerator, CRUD_OPERATIONS, DEFAULT_EVENTS_HEARTBEAT_MS, DEFAULT_EVENTS_MAX_SUBSCRIBERS, DEFAULT_EVENTS_RETRY_AFTER_SECONDS, MCPGenerator, MCP_STABLE_CATALOG_TTL_MS, PLAYBOOK_PREFLIGHT_CAPABILITY, PLAYBOOK_PREFLIGHT_ROUTE_SEGMENT, PRIVATE_READ_CACHE_CONTROL, SMRT_CUSTOM_ACTION_ERROR_METADATA_KEY, buildChangeEventStream, buildCustomActionInputSchema, buildCustomActionInvocationArgs, canonicalReadRepresentation, changeEventSubscribersAtCapacity, computeBodyEtag, computeRuntimeWebManifestHash, computeTableVersionEtag, conditionalJsonResponse, createRestServer, customActionParameterInputName, eventStreamCapacityExceededResponse, generateOpenAPISpec, handlePlaybookPreflightRoute, ifNoneMatchHasConcreteMatch, ifNoneMatchSatisfied, isApiActionEnabledForObject, isCrudOperation, isCrudToolAction, isRestActionRoutable, isRestRoutePublic, normalizeCustomActionFailure, normalizeEventsMaxSubscribers, normalizeTypedHttpError, resolveCustomActionMetadata, resolveMCPToolListCacheHint, resolveReadCacheControl, resolveRegisteredObjectName, resolveTenantEtagDiscriminator, restFieldReadPermissions, restMethodForApiAction, runWithTenantGate, setTenantEntryPointRunner, setupSwaggerUI, signalVisibleToTenant, sortMCPTools, startRestServer, tryReserveChangeEventSubscriberSlot, versionConditionalResponse, warnIfSharedCacheNeutralized };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
* - SmrtCollection: Collection interface for managing sets of SmrtObjects
|
|
12
12
|
*
|
|
13
13
|
* Generators:
|
|
14
|
-
* - CLIGenerator: Create admin CLI tools from SMRT objects
|
|
15
14
|
* - APIGenerator: Generate REST APIs for SMRT objects
|
|
15
|
+
* - CLI: local `smrt` binary transport lives in `@happyvertical/smrt-cli`
|
|
16
|
+
* (`packages/cli/src/cli-generator.ts`), not in this package.
|
|
16
17
|
* - MCPGenerator: Create MCP servers for AI model integration
|
|
17
18
|
*/
|
|
18
19
|
export * from './adapters/index';
|
|
@@ -50,6 +51,7 @@ export type { DiffOptions } from './migrations/differ';
|
|
|
50
51
|
export { generateSchemaDiff, getSQLFromDiff, hasActionableChanges, isAdvisoryOnlyChange, isManualOrAdvisoryChange, SchemaComparer, } from './migrations/differ';
|
|
51
52
|
export * from './object';
|
|
52
53
|
export { SmrtPolymorphicAssociation, type SmrtPolymorphicAssociationOptions, } from './polymorphic-association';
|
|
54
|
+
export { applyPostgresPermissions, type PostgresPermissionContract, type PostgresPermissionDiagnostic, type PostgresPermissionPlan, planPostgresPermissions, validatePostgresPermissionContract, } from './postgres-permissions.js';
|
|
53
55
|
export { applyPostgresRuntimeTimeouts, DEFAULT_POSTGRES_TIMEOUTS, POSTGRES_TIMEOUT_ENV_VARS, type PostgresTimeoutConfig, type ResolvedPostgresTimeouts, resolvePostgresTimeouts, } from './postgres-timeouts';
|
|
54
56
|
export { buildDefaultListOrderBy, DEFAULT_LIST_LIMIT, DEFAULT_LIST_ORDER_BY, type ListBoundOptions, MAX_LIST_LIMIT, QueryBoundsError, QueryOrderByError, resolveListLimit, resolveListOffset, } from './query-bounds';
|
|
55
57
|
export * from './registry';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,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AAC;AAE9B,OAAO,EACL,KAAK,EACL,cAAc,EACd,OAAO,EACP,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,EACL,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,SAAS,EACT,aAAa,EACb,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,2BAA2B,EAC3B,aAAa,EACb,eAAe,EACf,MAAM,EACN,KAAK,mBAAmB,EACxB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -56,10 +56,9 @@ import { DispatchSubscriptionCollection } from "./dispatch/collections/DispatchS
|
|
|
56
56
|
import { DispatchBus, createDispatchBus } from "./dispatch/bus.js";
|
|
57
57
|
import "./dispatch/index.js";
|
|
58
58
|
import "./embeddings/index.js";
|
|
59
|
-
import { runWithTenantGate, setTenantEntryPointRunner } from "./generators/tenant-gate.js";
|
|
60
|
-
import { CLIGenerator, getCLIHandler, setupCLI } from "./generators/cli.js";
|
|
61
59
|
import { PRIVATE_READ_CACHE_CONTROL, canonicalReadRepresentation, computeBodyEtag, computeTableVersionEtag, conditionalJsonResponse, ifNoneMatchHasConcreteMatch, ifNoneMatchSatisfied, resolveReadCacheControl, resolveTenantEtagDiscriminator, versionConditionalResponse, warnIfSharedCacheNeutralized } from "./generators/conditional-get.js";
|
|
62
60
|
import { DEFAULT_EVENTS_HEARTBEAT_MS, DEFAULT_EVENTS_MAX_SUBSCRIBERS, DEFAULT_EVENTS_RETRY_AFTER_SECONDS, buildChangeEventStream, changeEventSubscribersAtCapacity, eventStreamCapacityExceededResponse, normalizeEventsMaxSubscribers, signalVisibleToTenant, tryReserveChangeEventSubscriberSlot } from "./generators/events-route.js";
|
|
61
|
+
import { runWithTenantGate, setTenantEntryPointRunner } from "./generators/tenant-gate.js";
|
|
63
62
|
import { MCPGenerator, MCP_STABLE_CATALOG_TTL_MS, resolveMCPToolListCacheHint, sortMCPTools } from "./generators/mcp.js";
|
|
64
63
|
import { PLAYBOOK_PREFLIGHT_CAPABILITY, PLAYBOOK_PREFLIGHT_ROUTE_SEGMENT, handlePlaybookPreflightRoute, isApiActionEnabledForObject, isRestActionRoutable, isRestRoutePublic, resolveRegisteredObjectName, restFieldReadPermissions, restMethodForApiAction } from "./generators/preflight-route.js";
|
|
65
64
|
import { MAX_SYNC_APPLY_BATCH_SIZE, SYNC_APPLY_ROUTE_SEGMENTS, SYNC_APPLY_UUID_PATTERN, applySyncWritablePolicy, isStaleWrite, parseSyncApplyBatch, payloadMatchesRow, processSyncApplyBatch, validateSyncApplyItem } from "./sync/apply.js";
|
|
@@ -78,6 +77,7 @@ import manifest, { getManifest, staticManifest } from "./manifest/index.js";
|
|
|
78
77
|
import { planForeignKeyCreation } from "./schema/foreign-key-planner.js";
|
|
79
78
|
import { SchemaComparer, generateSchemaDiff, getSQLFromDiff, hasActionableChanges, isAdvisoryOnlyChange, isManualOrAdvisoryChange } from "./migrations/differ.js";
|
|
80
79
|
import { SmrtPolymorphicAssociation } from "./polymorphic-association.js";
|
|
80
|
+
import { applyPostgresPermissions, planPostgresPermissions, validatePostgresPermissionContract } from "./postgres-permissions.js";
|
|
81
81
|
import { createSmrtClient } from "./runtime/client.js";
|
|
82
82
|
import { SmrtMCPServer, createMCPServer } from "./runtime/mcp.js";
|
|
83
83
|
import { createSmrtServer } from "./runtime/server.js";
|
|
@@ -89,4 +89,4 @@ import "./system/index.js";
|
|
|
89
89
|
import { getTestDatabase } from "./testing/database.js";
|
|
90
90
|
import "./tools/index.js";
|
|
91
91
|
import { smrtPlugin } from "./vite-plugin/index.js";
|
|
92
|
-
export { AGENT_SURFACE_HASH_PREFIX, AIError, APIGenerator, AiUsageCollector, AiUsagePersistenceHandler, CACHE_INVALIDATION_CHANNEL, CHANGE_FEED_INTERCEPTOR_NAME, CHANGE_FEED_TABLE, CHANGE_SIGNAL_CHANNEL,
|
|
92
|
+
export { AGENT_SURFACE_HASH_PREFIX, AIError, APIGenerator, AiUsageCollector, AiUsagePersistenceHandler, CACHE_INVALIDATION_CHANNEL, CHANGE_FEED_INTERCEPTOR_NAME, CHANGE_FEED_TABLE, CHANGE_SIGNAL_CHANNEL, CRUD_OPERATIONS, ConfigurationError, ContentHasher, CosineSimilarity, DEFAULT_AI_COST_RATES, DEFAULT_CHANGES_LIMIT, DEFAULT_DATA_QUERY_PAGE_LIMIT, DEFAULT_DATA_QUERY_RESULT_BYTES, DEFAULT_EMBEDDING_CONFIG, DEFAULT_EVENTS_HEARTBEAT_MS, DEFAULT_EVENTS_MAX_SUBSCRIBERS, DEFAULT_EVENTS_RETRY_AFTER_SECONDS, DEFAULT_FACET_LIMIT, DEFAULT_LEARNING_CONFIG, DEFAULT_LIST_LIMIT, DEFAULT_LIST_ORDER_BY, DEFAULT_POSTGRES_TIMEOUTS, DEFAULT_RETENTION_POLICY, DataQueryValidationError, DatabaseError, Dispatch, DispatchBus, DispatchCollection, DispatchSubscription, DispatchSubscriptionCollection, EmbeddingProvider, EmbeddingStorage, ErrorUtils, FilesystemError, GlobalInterceptors, LearningMemory, LiveSchemaParityError, MAX_CHANGES_LIMIT, MAX_DATA_QUERY_CURSOR_LENGTH, MAX_DATA_QUERY_FACETS, MAX_DATA_QUERY_FILTERS, MAX_DATA_QUERY_FILTER_DEPTH, MAX_DATA_QUERY_IN_VALUES, MAX_DATA_QUERY_OFFSET, MAX_DATA_QUERY_PAGE_LIMIT, MAX_DATA_QUERY_REQUEST_BYTES, MAX_DATA_QUERY_RESULT_BYTES, MAX_DATA_QUERY_WARNINGS, MAX_FACET_FIELDS, MAX_FACET_LIMIT, MAX_LIST_LIMIT, MAX_STI_READ_SCOPE_TYPES, MAX_SYNC_APPLY_BATCH_SIZE, MCPGenerator, MCP_STABLE_CATALOG_TTL_MS, MODULE_DOC_HASH_PREFIX, ManifestBuilder, ManifestGenerator, ManifestManager, MetricsAdapter, NetworkError, ObjectRegistry, PLAYBOOK_PREFLIGHT_CAPABILITY, PLAYBOOK_PREFLIGHT_ROUTE_SEGMENT, POSTGRES_REVISION_GUARD_EXPRESSION, POSTGRES_TIMEOUT_ENV_VARS, PRIVATE_READ_CACHE_CONTROL, PubSubAdapter, QueryBoundsError, QueryOrderByError, RuntimeError, SMRT_COLLECTION_BASE_NAMES, SMRT_CUSTOM_ACTION_ERROR_METADATA_KEY, SYNC_APPLY_ROUTE_SEGMENTS, SYNC_APPLY_UUID_PATTERN, SYSTEM_TABLE_NAMES, SchemaComparer, SignalBus, SignalSanitizer, SmrtClass, SmrtCollection, SmrtError, SmrtHierarchical, SmrtJunction, SmrtMCPServer, SmrtObject, SmrtPolymorphicAssociation, TenantIsolationError, ValidationError, ValidationReport, ValidationUtils, appendChange, applyOneToManyChildAccessors, applyPendingDecoratorRegistrations, applyPostgresPermissions, applyPostgresRuntimeTimeouts, applySyncWritablePolicy, assertPostgresSystemTimestampsCurrent, broadcastCacheInvalidation, buildCascadePlan, buildChangeEventStream, buildCustomActionInputSchema, buildCustomActionInvocationArgs, buildDefaultListOrderBy, buildDomainKnowledgeManifest, bumpChangeFeed, canonicalReadRepresentation, canonicalizeDataQuery, cascadeReferencesTo, changeEventSubscribersAtCapacity, checkLiveSchemaParity, childAccessorName, classifyDatabaseError, classifyDialectMessage, clearRetentionTasks, clone, computeBodyEtag, computeRuntimeWebManifestHash, computeTableVersionEtag, conditionalJsonResponse, config, convertTypeToJsonSchema, createDataQueryFingerprint, createDispatchBus, createFilesystemAdapter, createInterceptorContext, createMCPServer, createQualifiedName, createRestServer, createSmrtClient, createSmrtServer, crossPackageRef, customActionParameterInputName, detectEngine, discoverManifestEntry, discoverScopedPackageDirectories, drainChangeFeed, ensureBootstrapSystemTableCompatibility, ensureCacheInvalidationListener, ensureChangeFeedTable, ensureDeferredSystemTableCompatibility, ensureDispatchSubscriptionsSystemTableCompatibility, ensureDispatchSystemTableCompatibility, ensureJobEventsSystemTableCompatibility, ensureJobsSystemTableCompatibility, ensureLegacySystemTableCompatibility, ensureSystemTables, estimateAiUsageCost, eventStreamCapacityExceededResponse, executeCollectionReadPlan, executeToolCall, executeToolCalls, field, findManifestEntryByQualifiedName, foreignKey, formatToolResults, generateDDLForEngine, generateOpenAPISpec, generateSchemaDiff, generateToolFromMethod, generateToolManifest, getAdapterInfo, getCacheGeneration, getChangesSince, getClassConfigResolvers, getClassName, getConfigResolver, getDatabaseEngine, getManifest, getPackageFromQualifiedName, getRetentionTasks, getSQLFromDiff, getSystemTableShapes, getTableVersion, getTenantScopedChangesSince, getTestDatabase, handlePlaybookPreflightRoute, hasActionableChanges, ifNoneMatchHasConcreteMatch, ifNoneMatchSatisfied, importOptionalDependency, invalidateCollectionCache, isAbortedTransactionError, isAdvisoryOnlyChange, isApiActionEnabledForObject, isCrudOperation, isCrudToolAction, isDatabaseInterface, isDeterministicDatabaseError, isEmbeddedDatabase, isFrameworkBaseClass, isFromPackage, isLazyConfigSentinel, isManualOrAdvisoryChange, isNotNullViolationError, isPostgresDatabase, isQualifiedName, isRestActionRoutable, isRestRoutePublic, isSmrtCollectionExtendsName, isStaleWrite, isTenantScopedClassResolved, isTransientDatabaseError, isType, isUniqueViolationError, isValid, listConfigResolvers, loadExternalManifest, loadExternalManifestSync, loadLocalTestManifestSync, loadManifestFromPathSync, manifest, manyToMany, meta, migratePostgresSystemTimestamps, normalizeCustomActionFailure, normalizeDataQueryRequest, normalizeDataQueryResult, normalizeDataQuerySchema, normalizeEventsMaxSubscribers, normalizeOnDelete, normalizeTypedHttpError, oneToMany, parse, parseQualifiedName, parseSyncApplyBatch, payloadMatchesRow, planForeignKeyCreation, planPostgresPermissions, planPostgresSystemTimestampMigrations, postgresRevisionCandidates, postgresRevisionCondition, processSyncApplyBatch, pruneAiUsage, pruneChangeFeed, pruneExpiredContexts, qualifiedNamesEqual, readAgentModuleDocs, readPackageAgentDoc, registerChangeFeedWriter, registerCompatibleFieldDecorator, registerConfigResolver, registerFilesystemAdapterFactory, registerOptionalDependency, registerRetentionTask, resetChangeFeedWarnings, resetChangeSignals, resetCollectionCache, resetConfigResolvers, resetVerifiedTables, resolveAgentModuleDocPaths, resolveCustomActionMetadata, resolveDatabase, resolveDbCacheKey, resolveDispatchTenantId, resolveDispatchTenantScope, resolveGetStringFilter, resolveLazyConfig, resolveListLimit, resolveListOffset, resolveMCPToolListCacheHint, resolvePostgresTimeouts, resolveReadCacheControl, resolveRegisteredObjectName, resolveTenantEtagDiscriminator, restFieldReadPermissions, restMethodForApiAction, runCascadeDelete, runRetentionSweep, runWithTenantGate, safeParse, safeStringify, setDispatchTenantResolver, setTenantEntryPointRunner, setTenantScopedClassResolver, setupSwaggerUI, shouldIncludeMethod, signalVisibleToTenant, smrt, smrtPlugin, smrt as smrtRegistry, sortMCPTools, startRestServer, staticManifest, stopCacheInvalidationListeners, stopChangeSignalListeners, stringify, subscribeToChangeSignals, tableExists, tryReserveChangeEventSubscriberSlot, unregisterChangeFeedWriter, unregisterConfigResolver, unregisterRetentionTask, usesEmbeddedRevisionFallback, validatePostgresPermissionContract, validateSyncApplyItem, validateToolCall, versionConditionalResponse, warnIfSharedCacheNeutralized, withEmbeddedWriteQueue, withEmbeddedWriteTransaction };
|
package/dist/knowledge.js
CHANGED
|
@@ -314,7 +314,8 @@ function configuredSurfaces(kind, object, manifest) {
|
|
|
314
314
|
* joined string, not just the object-name prefix. A CRUD verb is already
|
|
315
315
|
* lowercase so this is a no-op there, but a camelCase custom method name
|
|
316
316
|
* (`findByDimensions`) would otherwise report a surface `name` the real tool
|
|
317
|
-
* is never registered under. `
|
|
317
|
+
* is never registered under. `packages/cli/src/cli-generator.ts`'s command
|
|
318
|
+
* builder (`CLIGenerator`'s private `generateObjectCommands()`) does not
|
|
318
319
|
* lowercase the method half of its command string, so `cli` keeps the
|
|
319
320
|
* operation as-authored.
|
|
320
321
|
*
|
|
@@ -331,12 +332,20 @@ function surfaceName(kind, object, operation) {
|
|
|
331
332
|
* A hand-written `SmrtCollection` subclass (`class WidgetCollection extends
|
|
332
333
|
* SmrtCollection<Widget>`) is discovered structurally by the scanner and
|
|
333
334
|
* lands in the manifest even without its own `@smrt()` decorator, so it never
|
|
334
|
-
* registers with `ObjectRegistry
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
335
|
+
* registers with `ObjectRegistry` by decoration. `MCPGenerator` (and,
|
|
336
|
+
* historically, core's now-retired `CLIGenerator`, #2664) iterate the
|
|
337
|
+
* decoration-populated `ObjectRegistry` directly, not the manifest, so such a
|
|
338
|
+
* class never gets its own MCP tools there — only its collection-scoped
|
|
339
|
+
* custom actions get REST routes. The shipped local CLI
|
|
340
|
+
* (`packages/cli/src/cli-generator.ts`) is a documented exception: its
|
|
341
|
+
* `ensureManifestLoaded()` pre-registers every manifest entry into
|
|
342
|
+
* `ObjectRegistry` via `registerFromManifest()` before generating commands,
|
|
343
|
+
* with no collection-class filter, so a manifest-only collection class IS
|
|
344
|
+
* reachable there (e.g. `smrt itemcollection:list`) even though this
|
|
345
|
+
* projection reports none. Reporting full CRUD for it here would over-report
|
|
346
|
+
* the projection's own (registry-scoped) surface, trading the #2619
|
|
347
|
+
* under-report for a new false positive there -- it does not claim the
|
|
348
|
+
* shipped CLI binary lacks the surface too.
|
|
340
349
|
*
|
|
341
350
|
* A deeper subclass (`SpecialCollection extends WidgetCollection`) carries no
|
|
342
351
|
* `extendsTypeArg` of its own, so this walks the extends chain through the
|
|
@@ -387,7 +396,8 @@ function manifestObjectPackage(object, manifestKey) {
|
|
|
387
396
|
}
|
|
388
397
|
/**
|
|
389
398
|
* Operations exposed for one object's `api`/`cli`/`mcp` surface, derived from
|
|
390
|
-
* the same defaults `APIGenerator
|
|
399
|
+
* the same defaults `APIGenerator`/core's retired `CLIGenerator`
|
|
400
|
+
* (#2664)/`MCPGenerator` apply rather
|
|
391
401
|
* than from the presence of a config key (#2619): an omitted config is full
|
|
392
402
|
* CRUD, not a closed surface — an `include` list, when present, is the
|
|
393
403
|
* COMPLETE allowlist for custom methods too; without one, every public
|
|
@@ -395,7 +405,8 @@ function manifestObjectPackage(object, manifestKey) {
|
|
|
395
405
|
* false` closes the surface entirely.
|
|
396
406
|
*
|
|
397
407
|
* Custom (non-CRUD, public) method gating is NOT identical across the three
|
|
398
|
-
* kinds. `CLIGenerator.listCommands()`/`assertCommandExposed()`
|
|
408
|
+
* kinds. Core's retired `CLIGenerator.listCommands()`/`assertCommandExposed()`
|
|
409
|
+
* (#2664) and
|
|
399
410
|
* `MCPGenerator.generateTools()` both refuse a framework lifecycle method
|
|
400
411
|
* (`save`, `initialize`, ...) even when a class declares its own override —
|
|
401
412
|
* it is the mechanism behind generated CRUD, not a distinct action (#2638) —
|
|
@@ -415,13 +426,14 @@ function manifestObjectPackage(object, manifestKey) {
|
|
|
415
426
|
* keep declared casing in their command/route names, so neither behavior
|
|
416
427
|
* applies to them.
|
|
417
428
|
*
|
|
418
|
-
* This `cli` projection models `CLIGenerator`
|
|
419
|
-
*
|
|
420
|
-
* `cli-generator.ts`, the
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
429
|
+
* This `cli` projection models the reservation rule core's `CLIGenerator`
|
|
430
|
+
* used to apply (`generators/cli.ts`, retired by #2664), not the shipped
|
|
431
|
+
* local CLI transport (`packages/cli/src/cli-generator.ts`, the
|
|
432
|
+
* `smrt <object>:<action>` binary): that generator does not gate on
|
|
433
|
+
* `isFrameworkLifecycleMethod()` today, so a locally overridden lifecycle
|
|
434
|
+
* method the artifact now reports as absent can still be invoked there.
|
|
435
|
+
* Retargeting this projection at the shipped binary is a contract change
|
|
436
|
+
* tracked on #2692, not part of this fix.
|
|
425
437
|
*/
|
|
426
438
|
function configuredOperations(kind, object, config, manifest) {
|
|
427
439
|
if (config === false) return [];
|