@happyvertical/smrt-core 0.45.3 → 0.47.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 +39 -0
- package/agents/generators.md +0 -1
- package/dist/browser.d.ts +2 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/decorators/compatibility.d.ts +46 -0
- package/dist/decorators/compatibility.d.ts.map +1 -1
- package/dist/decorators/compatibility.js +48 -5
- package/dist/decorators/compatibility.js.map +1 -1
- package/dist/decorators/index.d.ts +119 -1
- package/dist/decorators/index.d.ts.map +1 -1
- package/dist/decorators/index.js +52 -8
- package/dist/decorators/index.js.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 +450 -41
- package/dist/generators/custom-action.d.ts.map +1 -1
- package/dist/generators/custom-action.js +765 -56
- package/dist/generators/custom-action.js.map +1 -1
- package/dist/generators/index.d.ts +1 -3
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +3 -4
- 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/preflight-route.d.ts +12 -10
- package/dist/generators/preflight-route.d.ts.map +1 -1
- package/dist/generators/preflight-route.js +46 -14
- package/dist/generators/preflight-route.js.map +1 -1
- package/dist/generators/rest.d.ts +44 -0
- package/dist/generators/rest.d.ts.map +1 -1
- package/dist/generators/rest.js +84 -9
- package/dist/generators/rest.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 +3 -4
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/knowledge.d.ts.map +1 -1
- package/dist/knowledge.js +87 -31
- package/dist/knowledge.js.map +1 -1
- package/dist/manifest/static-manifest.d.ts.map +1 -1
- package/dist/manifest/static-manifest.js +125 -53
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.js +1 -1
- package/dist/manifest/store.js.map +1 -1
- package/dist/manifest.json +184 -53
- 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 +45 -0
- package/dist/postgres-permissions.d.ts.map +1 -0
- package/dist/postgres-permissions.js +424 -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/registry/index.d.ts +1 -1
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/shared-state.d.ts +19 -0
- package/dist/registry/shared-state.d.ts.map +1 -1
- package/dist/registry/shared-state.js +16 -1
- package/dist/registry/shared-state.js.map +1 -1
- package/dist/registry.d.ts +136 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +231 -1
- package/dist/registry.js.map +1 -1
- package/dist/scanner/manifest-generator.d.ts.map +1 -1
- package/dist/scanner/manifest-generator.js +18 -16
- package/dist/scanner/manifest-generator.js.map +1 -1
- package/dist/scanner/types.d.ts +59 -6
- package/dist/scanner/types.d.ts.map +1 -1
- package/dist/scanner/types.js.map +1 -1
- package/dist/scripts/create-wrappers.js +0 -5
- package/dist/smrt-knowledge.json +35 -35
- 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 +23 -19
- 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 +3 -167
- package/dist/vite-plugin/index.js.map +1 -1
- package/dist/vite-plugin/sveltekit-generator.d.ts +31 -4
- package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -1
- package/dist/vite-plugin/sveltekit-generator.js +137 -71
- 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 +1 -1
- package/dist/vite-plugin/web-collections.js.map +1 -1
- package/package.json +10 -10
- 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
package/dist/generators.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
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";
|
|
1
|
+
import { CRUD_OPERATIONS, SMRT_CUSTOM_ACTION_ERROR_METADATA_KEY, buildCustomActionInputSchema, buildCustomActionInvocationArgs, classifyMethodWireability, classifyParameterWireability, coerceCustomActionArgument, createClassNamePredicate, createManifestClassNamePredicate, customActionParameterInputName, declaredTypeAcceptsDate, declaresRuntimeRestRoute, declaresRuntimeRestRouteShape, isCrudOperation, isCrudToolAction, normalizeCustomActionFailure, queryStringDecoderFor, readMethodDecoratorConfig, resolveApiMethodExposure, resolveCustomActionMetadata, resolveDeclaredScopeMismatch, resolveEffectiveActionMetadata, toCustomActionBoolean, toCustomActionDate, toCustomActionNumber } from "./generators/custom-action.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, classifyMethodWireability, classifyParameterWireability, coerceCustomActionArgument, computeBodyEtag, computeRuntimeWebManifestHash, computeTableVersionEtag, conditionalJsonResponse, createClassNamePredicate, createManifestClassNamePredicate, createRestServer, customActionParameterInputName, declaredTypeAcceptsDate, declaresRuntimeRestRoute, declaresRuntimeRestRouteShape, eventStreamCapacityExceededResponse, generateOpenAPISpec, handlePlaybookPreflightRoute, ifNoneMatchHasConcreteMatch, ifNoneMatchSatisfied, isApiActionEnabledForObject, isCrudOperation, isCrudToolAction, isRestActionRoutable, isRestRoutePublic, normalizeCustomActionFailure, normalizeEventsMaxSubscribers, normalizeTypedHttpError, queryStringDecoderFor, readMethodDecoratorConfig, resolveApiMethodExposure, resolveCustomActionMetadata, resolveDeclaredScopeMismatch, resolveEffectiveActionMetadata, resolveMCPToolListCacheHint, resolveReadCacheControl, resolveRegisteredObjectName, resolveTenantEtagDiscriminator, restFieldReadPermissions, restMethodForApiAction, runWithTenantGate, setTenantEntryPointRunner, setupSwaggerUI, signalVisibleToTenant, sortMCPTools, startRestServer, toCustomActionBoolean, toCustomActionDate, toCustomActionNumber, 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';
|
|
@@ -29,8 +30,8 @@ export { config } from './config';
|
|
|
29
30
|
export { canonicalizeDataQuery, createDataQueryFingerprint, DataQueryValidationError, DEFAULT_DATA_QUERY_PAGE_LIMIT, DEFAULT_DATA_QUERY_RESULT_BYTES, MAX_DATA_QUERY_CURSOR_LENGTH, MAX_DATA_QUERY_FACETS, MAX_DATA_QUERY_FILTER_DEPTH, MAX_DATA_QUERY_FILTERS, 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, normalizeDataQueryRequest, normalizeDataQueryResult, normalizeDataQuerySchema, } from './data-query';
|
|
30
31
|
export { type DatabaseConfig, isDatabaseInterface, type ResolveDatabaseOptions, resolveDatabase, } from './database';
|
|
31
32
|
export { classifyDatabaseError, classifyDialectMessage, type DatabaseErrorClassification, type DatabaseErrorKind, isAbortedTransactionError, isDeterministicDatabaseError, isNotNullViolationError, isTransientDatabaseError, isUniqueViolationError, } from './db-errors';
|
|
32
|
-
export { applyPendingDecoratorRegistrations, type CompatiblePropertyDecorator, type CompatiblePropertyDecoratorContext, type LegacyPropertyDecoratorTarget, registerCompatibleFieldDecorator, } from './decorators/compatibility';
|
|
33
|
-
export { type CrossPackageRefOptions, crossPackageRef, type FieldOptions, type FieldUIHints, field, foreignKey, type Meta, manyToMany, meta, type NumericFieldOptions, oneToMany, type RelationshipFieldOptions, type TextFieldOptions, } from './decorators/index';
|
|
33
|
+
export { applyPendingDecoratorRegistrations, type CompatibleMethodDecorator, type CompatibleMethodDecoratorContext, type CompatiblePropertyDecorator, type CompatiblePropertyDecoratorContext, type LegacyPropertyDecoratorTarget, registerCompatibleFieldDecorator, registerCompatibleMethodDecorator, } from './decorators/compatibility';
|
|
34
|
+
export { type CrossPackageRefOptions, crossPackageRef, type FieldOptions, type FieldUIHints, field, foreignKey, type Meta, type MethodOptions, manyToMany, meta, method, type NumericFieldOptions, oneToMany, type RelationshipFieldOptions, type TextFieldOptions, } from './decorators/index';
|
|
34
35
|
export * from './dispatch/index';
|
|
35
36
|
export { isEmbeddedDatabase, isPostgresDatabase, usesEmbeddedRevisionFallback, withEmbeddedWriteQueue, withEmbeddedWriteTransaction, } from './embedded-write-queue';
|
|
36
37
|
export * from './embeddings/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,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EACL,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,cAAc,EACnB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,KAAK,iBAAiB,EACtB,YAAY,EACZ,cAAc,EACd,4BAA4B,EAC5B,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,eAAe,EACf,eAAe,EACf,2BAA2B,EAC3B,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AAKvB,OAAO,EACL,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,4BAA4B,EAC5B,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAE7B,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,KAAK,qBAAqB,EAC1B,+BAA+B,EAC/B,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,a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B,EAClB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EACL,eAAe,EACf,KAAK,mBAAmB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,cAAc,eAAe,CAAC;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
|
@@ -28,11 +28,11 @@ import { DEFAULT_EMBEDDING_CONFIG, EmbeddingProvider } from "./embeddings/provid
|
|
|
28
28
|
import { CosineSimilarity } from "./embeddings/similarity.js";
|
|
29
29
|
import { EmbeddingStorage } from "./embeddings/storage.js";
|
|
30
30
|
import { DEFAULT_LIST_LIMIT, DEFAULT_LIST_ORDER_BY, MAX_LIST_LIMIT, QueryBoundsError, QueryOrderByError, buildDefaultListOrderBy, resolveListLimit, resolveListOffset } from "./query-bounds.js";
|
|
31
|
-
import { applyPendingDecoratorRegistrations, registerCompatibleFieldDecorator } from "./decorators/compatibility.js";
|
|
31
|
+
import { applyPendingDecoratorRegistrations, registerCompatibleFieldDecorator, registerCompatibleMethodDecorator } from "./decorators/compatibility.js";
|
|
32
32
|
import { createQualifiedName, getClassName, getPackageFromQualifiedName, isFromPackage, isQualifiedName, isType, parseQualifiedName, qualifiedNamesEqual } from "./utils/qualified-names.js";
|
|
33
33
|
import { clone, getAdapterInfo, isValid, parse, safeParse, safeStringify, stringify } from "./utils/json.js";
|
|
34
34
|
import { convertTypeToJsonSchema, generateToolFromMethod, generateToolManifest, shouldIncludeMethod } from "./tools/tool-generator.js";
|
|
35
|
-
import { CRUD_OPERATIONS, SMRT_CUSTOM_ACTION_ERROR_METADATA_KEY, buildCustomActionInputSchema, buildCustomActionInvocationArgs, customActionParameterInputName, isCrudOperation, isCrudToolAction, normalizeCustomActionFailure, resolveCustomActionMetadata } from "./generators/custom-action.js";
|
|
35
|
+
import { CRUD_OPERATIONS, SMRT_CUSTOM_ACTION_ERROR_METADATA_KEY, buildCustomActionInputSchema, buildCustomActionInvocationArgs, classifyMethodWireability, classifyParameterWireability, coerceCustomActionArgument, createClassNamePredicate, createManifestClassNamePredicate, customActionParameterInputName, declaredTypeAcceptsDate, declaresRuntimeRestRoute, declaresRuntimeRestRouteShape, isCrudOperation, isCrudToolAction, normalizeCustomActionFailure, queryStringDecoderFor, readMethodDecoratorConfig, resolveApiMethodExposure, resolveCustomActionMetadata, resolveDeclaredScopeMismatch, resolveEffectiveActionMetadata, toCustomActionBoolean, toCustomActionDate, toCustomActionNumber } from "./generators/custom-action.js";
|
|
36
36
|
import { ManifestGenerator } from "./scanner/manifest-generator.js";
|
|
37
37
|
import { ManifestManager } from "./manifest/manager.js";
|
|
38
38
|
import { discoverManifestEntry, findManifestEntryByQualifiedName, loadExternalManifest, loadExternalManifestSync, loadLocalTestManifestSync, loadManifestFromPathSync } from "./manifest/manifest-loader.js";
|
|
@@ -48,7 +48,7 @@ import { DEFAULT_FACET_LIMIT, MAX_FACET_FIELDS, MAX_FACET_LIMIT, MAX_STI_READ_SC
|
|
|
48
48
|
import { executeCollectionReadPlan } from "./collection-read-plan.js";
|
|
49
49
|
import { DEFAULT_DATA_QUERY_PAGE_LIMIT, DEFAULT_DATA_QUERY_RESULT_BYTES, DataQueryValidationError, 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, canonicalizeDataQuery, createDataQueryFingerprint, normalizeDataQueryRequest, normalizeDataQueryResult, normalizeDataQuerySchema } from "./data-query.js";
|
|
50
50
|
import { isDatabaseInterface, resolveDatabase } from "./database.js";
|
|
51
|
-
import { crossPackageRef, field, foreignKey, manyToMany, meta, oneToMany } from "./decorators/index.js";
|
|
51
|
+
import { crossPackageRef, field, foreignKey, manyToMany, meta, method, oneToMany } from "./decorators/index.js";
|
|
52
52
|
import { Dispatch } from "./dispatch/models/Dispatch.js";
|
|
53
53
|
import { DispatchCollection } from "./dispatch/collections/Dispatches.js";
|
|
54
54
|
import { DispatchSubscription } from "./dispatch/models/DispatchSubscription.js";
|
|
@@ -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, classifyMethodWireability, classifyParameterWireability, clearRetentionTasks, clone, coerceCustomActionArgument, computeBodyEtag, computeRuntimeWebManifestHash, computeTableVersionEtag, conditionalJsonResponse, config, convertTypeToJsonSchema, createClassNamePredicate, createDataQueryFingerprint, createDispatchBus, createFilesystemAdapter, createInterceptorContext, createMCPServer, createManifestClassNamePredicate, createQualifiedName, createRestServer, createSmrtClient, createSmrtServer, crossPackageRef, customActionParameterInputName, declaredTypeAcceptsDate, declaresRuntimeRestRoute, declaresRuntimeRestRouteShape, 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, method, migratePostgresSystemTimestamps, normalizeCustomActionFailure, normalizeDataQueryRequest, normalizeDataQueryResult, normalizeDataQuerySchema, normalizeEventsMaxSubscribers, normalizeOnDelete, normalizeTypedHttpError, oneToMany, parse, parseQualifiedName, parseSyncApplyBatch, payloadMatchesRow, planForeignKeyCreation, planPostgresPermissions, planPostgresSystemTimestampMigrations, postgresRevisionCandidates, postgresRevisionCondition, processSyncApplyBatch, pruneAiUsage, pruneChangeFeed, pruneExpiredContexts, qualifiedNamesEqual, queryStringDecoderFor, readAgentModuleDocs, readMethodDecoratorConfig, readPackageAgentDoc, registerChangeFeedWriter, registerCompatibleFieldDecorator, registerCompatibleMethodDecorator, registerConfigResolver, registerFilesystemAdapterFactory, registerOptionalDependency, registerRetentionTask, resetChangeFeedWarnings, resetChangeSignals, resetCollectionCache, resetConfigResolvers, resetVerifiedTables, resolveAgentModuleDocPaths, resolveApiMethodExposure, resolveCustomActionMetadata, resolveDatabase, resolveDbCacheKey, resolveDeclaredScopeMismatch, resolveDispatchTenantId, resolveDispatchTenantScope, resolveEffectiveActionMetadata, 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, toCustomActionBoolean, toCustomActionDate, toCustomActionNumber, tryReserveChangeEventSubscriberSlot, unregisterChangeFeedWriter, unregisterConfigResolver, unregisterRetentionTask, usesEmbeddedRevisionFallback, validatePostgresPermissionContract, validateSyncApplyItem, validateToolCall, versionConditionalResponse, warnIfSharedCacheNeutralized, withEmbeddedWriteQueue, withEmbeddedWriteTransaction };
|
package/dist/knowledge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge.d.ts","sourceRoot":"","sources":["../src/knowledge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,mBAAmB,EACnB,KAAK,sBAAsB,GAC5B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,KAAK,EACV,2BAA2B,EAC3B,qBAAqB,EAGrB,uBAAuB,EAEvB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"knowledge.d.ts","sourceRoot":"","sources":["../src/knowledge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,mBAAmB,EACnB,KAAK,sBAAsB,GAC5B,MAAM,0BAA0B,CAAC;AAKlC,OAAO,KAAK,EACV,2BAA2B,EAC3B,qBAAqB,EAGrB,uBAAuB,EAEvB,wBAAwB,EAKzB,MAAM,2BAA2B,CAAC;AAanC,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAG5B;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,2BAA2B,CAAC;CAC5C;AAmDD,yFAAyF;AACzF,eAAO,MAAM,sBAAsB,eAAe,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,kBAAkB,CAAC;AAEzD;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,EAAE,CAgBV;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,wBAAwB,EAAE,CAM5B;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,2BAA2B,GACnC,uBAAuB,CAkFzB"}
|
package/dist/knowledge.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toSnakeCase } from "./utils/naming.js";
|
|
2
|
-
import { CRUD_OPERATIONS, isCrudOperation, isCrudToolAction, isFrameworkLifecycleMethod, resolveCustomActionMetadata } from "./generators/custom-action.js";
|
|
2
|
+
import { CRUD_OPERATIONS, createManifestClassNamePredicate, isCrudOperation, isCrudToolAction, isFrameworkLifecycleMethod, resolveApiMethodExposure, resolveCustomActionMetadata, resolveEffectiveActionMetadata } from "./generators/custom-action.js";
|
|
3
3
|
import { isFrameworkBaseClass } from "./registry/framework-base-classes.js";
|
|
4
4
|
import { discoverScopedPackageDirectories, readPackageAgentDoc } from "./knowledge-discovery.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
@@ -208,6 +208,7 @@ function buildKnowledgeObject(object, manifest) {
|
|
|
208
208
|
tableStrategy: object.decoratorConfig?.tableStrategy,
|
|
209
209
|
conflictColumns: conflictColumns && conflictColumns.length > 0 ? conflictColumns : void 0,
|
|
210
210
|
surfaces: objectSurfaces(object, manifest),
|
|
211
|
+
...withheldApiSurfaces(object, manifest),
|
|
211
212
|
relationshipFeatures: relationshipFeatures(object, fields),
|
|
212
213
|
tags: knowledge.tags ?? [],
|
|
213
214
|
summary: knowledge.summary,
|
|
@@ -293,6 +294,50 @@ function objectSurfaces(object, manifest) {
|
|
|
293
294
|
...aiSurfaces(object)
|
|
294
295
|
];
|
|
295
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Every API-exposure decision for one object's methods, from the shared
|
|
299
|
+
* resolver the route emitters use — so a method reported here as exposed has a
|
|
300
|
+
* route file, and one reported as withheld has none.
|
|
301
|
+
*
|
|
302
|
+
* The whole point of routing this through `resolveApiMethodExposure` rather
|
|
303
|
+
* than a local mirror is that a fourth copy of the rule is a fourth chance to
|
|
304
|
+
* disagree with the emitters (#2686).
|
|
305
|
+
*/
|
|
306
|
+
function apiMethodDecisions(object, manifest) {
|
|
307
|
+
const apiConfig = object.decoratorConfig?.api;
|
|
308
|
+
const isModelClassName = createManifestClassNamePredicate(manifest);
|
|
309
|
+
const collectionClass = isSurfaceCollectionClass(manifest, object);
|
|
310
|
+
return Object.entries(object.methods).map(([name, method]) => [name, resolveApiMethodExposure({
|
|
311
|
+
actionName: name,
|
|
312
|
+
method,
|
|
313
|
+
apiConfig,
|
|
314
|
+
isCollectionClass: collectionClass,
|
|
315
|
+
...isModelClassName ? { isModelClassName } : {}
|
|
316
|
+
})]);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* The `withheldSurfaces` half of the artifact: every public method the API
|
|
320
|
+
* declined, with the reason.
|
|
321
|
+
*
|
|
322
|
+
* Reported for `api` only. `cli`/`mcp` gate on a much smaller, purely
|
|
323
|
+
* name-based rule set that a reader can already infer from the config, while
|
|
324
|
+
* the API's wire-ability heuristic rejects on a signature detail nothing else
|
|
325
|
+
* in the artifact shows — which is exactly the silence #2686 set out to close.
|
|
326
|
+
*
|
|
327
|
+
* CRUD-reserved and non-public methods are excluded: neither was ever a
|
|
328
|
+
* candidate custom action, so listing them would bury the actionable entries.
|
|
329
|
+
*/
|
|
330
|
+
function withheldApiSurfaces(object, manifest) {
|
|
331
|
+
if (isFrameworkBaseClass(object.className, object.packageName)) return {};
|
|
332
|
+
const withheld = apiMethodDecisions(object, manifest).filter(([, decision]) => !decision.exposed && decision.code !== "crud-reserved" && decision.code !== "not-public").map(([operation, decision]) => ({
|
|
333
|
+
kind: "api",
|
|
334
|
+
operation,
|
|
335
|
+
code: decision.code ?? "unknown",
|
|
336
|
+
reason: decision.reason ?? "",
|
|
337
|
+
objectName: object.qualifiedName ?? object.className
|
|
338
|
+
})).sort((a, b) => a.operation.localeCompare(b.operation));
|
|
339
|
+
return withheld.length > 0 ? { withheldSurfaces: withheld } : {};
|
|
340
|
+
}
|
|
296
341
|
function configuredSurfaces(kind, object, manifest) {
|
|
297
342
|
const config = object.decoratorConfig?.[kind];
|
|
298
343
|
const collectionClass = isSurfaceCollectionClass(manifest, object);
|
|
@@ -314,7 +359,8 @@ function configuredSurfaces(kind, object, manifest) {
|
|
|
314
359
|
* joined string, not just the object-name prefix. A CRUD verb is already
|
|
315
360
|
* lowercase so this is a no-op there, but a camelCase custom method name
|
|
316
361
|
* (`findByDimensions`) would otherwise report a surface `name` the real tool
|
|
317
|
-
* is never registered under. `
|
|
362
|
+
* is never registered under. `packages/cli/src/cli-generator.ts`'s command
|
|
363
|
+
* builder (`CLIGenerator`'s private `generateObjectCommands()`) does not
|
|
318
364
|
* lowercase the method half of its command string, so `cli` keeps the
|
|
319
365
|
* operation as-authored.
|
|
320
366
|
*
|
|
@@ -331,12 +377,20 @@ function surfaceName(kind, object, operation) {
|
|
|
331
377
|
* A hand-written `SmrtCollection` subclass (`class WidgetCollection extends
|
|
332
378
|
* SmrtCollection<Widget>`) is discovered structurally by the scanner and
|
|
333
379
|
* lands in the manifest even without its own `@smrt()` decorator, so it never
|
|
334
|
-
* registers with `ObjectRegistry
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
380
|
+
* registers with `ObjectRegistry` by decoration. `MCPGenerator` (and,
|
|
381
|
+
* historically, core's now-retired `CLIGenerator`, #2664) iterate the
|
|
382
|
+
* decoration-populated `ObjectRegistry` directly, not the manifest, so such a
|
|
383
|
+
* class never gets its own MCP tools there — only its collection-scoped
|
|
384
|
+
* custom actions get REST routes. The shipped local CLI
|
|
385
|
+
* (`packages/cli/src/cli-generator.ts`) is a documented exception: its
|
|
386
|
+
* `ensureManifestLoaded()` pre-registers every manifest entry into
|
|
387
|
+
* `ObjectRegistry` via `registerFromManifest()` before generating commands,
|
|
388
|
+
* with no collection-class filter, so a manifest-only collection class IS
|
|
389
|
+
* reachable there (e.g. `smrt itemcollection:list`) even though this
|
|
390
|
+
* projection reports none. Reporting full CRUD for it here would over-report
|
|
391
|
+
* the projection's own (registry-scoped) surface, trading the #2619
|
|
392
|
+
* under-report for a new false positive there -- it does not claim the
|
|
393
|
+
* shipped CLI binary lacks the surface too.
|
|
340
394
|
*
|
|
341
395
|
* A deeper subclass (`SpecialCollection extends WidgetCollection`) carries no
|
|
342
396
|
* `extendsTypeArg` of its own, so this walks the extends chain through the
|
|
@@ -387,7 +441,8 @@ function manifestObjectPackage(object, manifestKey) {
|
|
|
387
441
|
}
|
|
388
442
|
/**
|
|
389
443
|
* Operations exposed for one object's `api`/`cli`/`mcp` surface, derived from
|
|
390
|
-
* the same defaults `APIGenerator
|
|
444
|
+
* the same defaults `APIGenerator`/core's retired `CLIGenerator`
|
|
445
|
+
* (#2664)/`MCPGenerator` apply rather
|
|
391
446
|
* than from the presence of a config key (#2619): an omitted config is full
|
|
392
447
|
* CRUD, not a closed surface — an `include` list, when present, is the
|
|
393
448
|
* COMPLETE allowlist for custom methods too; without one, every public
|
|
@@ -395,7 +450,8 @@ function manifestObjectPackage(object, manifestKey) {
|
|
|
395
450
|
* false` closes the surface entirely.
|
|
396
451
|
*
|
|
397
452
|
* Custom (non-CRUD, public) method gating is NOT identical across the three
|
|
398
|
-
* kinds. `CLIGenerator.listCommands()`/`assertCommandExposed()`
|
|
453
|
+
* kinds. Core's retired `CLIGenerator.listCommands()`/`assertCommandExposed()`
|
|
454
|
+
* (#2664) and
|
|
399
455
|
* `MCPGenerator.generateTools()` both refuse a framework lifecycle method
|
|
400
456
|
* (`save`, `initialize`, ...) even when a class declares its own override —
|
|
401
457
|
* it is the mechanism behind generated CRUD, not a distinct action (#2638) —
|
|
@@ -415,22 +471,25 @@ function manifestObjectPackage(object, manifestKey) {
|
|
|
415
471
|
* keep declared casing in their command/route names, so neither behavior
|
|
416
472
|
* applies to them.
|
|
417
473
|
*
|
|
418
|
-
* This `cli` projection models `CLIGenerator`
|
|
419
|
-
*
|
|
420
|
-
* `cli-generator.ts`, the
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
474
|
+
* This `cli` projection models the reservation rule core's `CLIGenerator`
|
|
475
|
+
* used to apply (`generators/cli.ts`, retired by #2664), not the shipped
|
|
476
|
+
* local CLI transport (`packages/cli/src/cli-generator.ts`, the
|
|
477
|
+
* `smrt <object>:<action>` binary): that generator does not gate on
|
|
478
|
+
* `isFrameworkLifecycleMethod()` today, so a locally overridden lifecycle
|
|
479
|
+
* method the artifact now reports as absent can still be invoked there.
|
|
480
|
+
* Retargeting this projection at the shipped binary is a contract change
|
|
481
|
+
* tracked on #2692, not part of this fix.
|
|
425
482
|
*/
|
|
426
483
|
function configuredOperations(kind, object, config, manifest) {
|
|
427
484
|
if (config === false) return [];
|
|
428
485
|
if (isFrameworkBaseClass(object.className, object.packageName)) return [];
|
|
429
|
-
const
|
|
430
|
-
|
|
486
|
+
const crud = isSurfaceCollectionClass(manifest, object) ? [] : resolveCrudOperations(config);
|
|
487
|
+
if (kind === "api") {
|
|
488
|
+
const custom = apiMethodDecisions(object, manifest).filter(([, decision]) => decision.exposed).map(([operation]) => operation);
|
|
489
|
+
return [...crud, ...custom];
|
|
490
|
+
}
|
|
431
491
|
const custom = resolveCustomMethodNames(Object.entries(object.methods), config, kind);
|
|
432
|
-
|
|
433
|
-
return [...crud, ...eligible];
|
|
492
|
+
return [...crud, ...custom];
|
|
434
493
|
}
|
|
435
494
|
function resolveCrudOperations(config) {
|
|
436
495
|
const { include, exclude } = includeExcludeConfig(config);
|
|
@@ -518,12 +577,16 @@ function apiCustomRoute(object, operation, collectionClass) {
|
|
|
518
577
|
if (collectionClass) {
|
|
519
578
|
if (scope !== "collection") return void 0;
|
|
520
579
|
} else if (scope === "collection" && !method?.isStatic) return;
|
|
521
|
-
const
|
|
522
|
-
|
|
580
|
+
const effective = resolveEffectiveActionMetadata({
|
|
581
|
+
actionName: operation,
|
|
582
|
+
...method ? { method } : {},
|
|
583
|
+
apiConfig
|
|
584
|
+
});
|
|
585
|
+
const overridden = typeof effective.path === "string" ? effective.path.split("/").map((segment) => segment.trim()).filter(Boolean) : [];
|
|
523
586
|
return {
|
|
524
587
|
scope,
|
|
525
588
|
segments: overridden.length > 0 ? overridden : [operation],
|
|
526
|
-
method: normalizeApiMethod(
|
|
589
|
+
method: normalizeApiMethod(effective.httpMethod)
|
|
527
590
|
};
|
|
528
591
|
}
|
|
529
592
|
/**
|
|
@@ -546,13 +609,6 @@ function resolveActionScope(operation, method, apiConfig, defaultScope) {
|
|
|
546
609
|
return defaultScope;
|
|
547
610
|
}
|
|
548
611
|
}
|
|
549
|
-
function customRouteConfig(apiConfig, operation) {
|
|
550
|
-
if (typeof apiConfig !== "object" || apiConfig === null) return void 0;
|
|
551
|
-
const routes = apiConfig.routes;
|
|
552
|
-
if (typeof routes !== "object" || routes === null) return void 0;
|
|
553
|
-
const route = routes[operation];
|
|
554
|
-
return typeof route === "object" && route !== null ? route : void 0;
|
|
555
|
-
}
|
|
556
612
|
/** Mirrors `normalizeApiHttpMethod` in `vite-plugin/sveltekit-generator.ts`. */
|
|
557
613
|
function normalizeApiMethod(method) {
|
|
558
614
|
const normalized = typeof method === "string" ? method.toUpperCase() : void 0;
|