@happyvertical/smrt-core 0.30.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 +124 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +7 -0
- package/README.md +265 -0
- package/bin/smrt-prebuild.js +26 -0
- package/dist/__tests__/fixtures/advisor-test-classes.d.ts +28 -0
- package/dist/__tests__/fixtures/advisor-test-classes.d.ts.map +1 -0
- package/dist/__tests__/fixtures/collection-coverage-fixtures.d.ts +12 -0
- package/dist/__tests__/fixtures/collection-coverage-fixtures.d.ts.map +1 -0
- package/dist/__tests__/fixtures/inheritance-resolver-fixtures.d.ts +28 -0
- package/dist/__tests__/fixtures/inheritance-resolver-fixtures.d.ts.map +1 -0
- package/dist/__tests__/fixtures/inheritance-test-classes.d.ts +43 -0
- package/dist/__tests__/fixtures/inheritance-test-classes.d.ts.map +1 -0
- package/dist/__tests__/fixtures/mcp-integration-test-classes.d.ts +18 -0
- package/dist/__tests__/fixtures/mcp-integration-test-classes.d.ts.map +1 -0
- package/dist/__tests__/fixtures/object-ai-memory-fixtures.d.ts +15 -0
- package/dist/__tests__/fixtures/object-ai-memory-fixtures.d.ts.map +1 -0
- package/dist/__tests__/fixtures/object-spec-test-classes.d.ts +13 -0
- package/dist/__tests__/fixtures/object-spec-test-classes.d.ts.map +1 -0
- package/dist/__tests__/fixtures/registry-test-classes.d.ts +23 -0
- package/dist/__tests__/fixtures/registry-test-classes.d.ts.map +1 -0
- package/dist/adapters/ai-usage.d.ts +23 -0
- package/dist/adapters/ai-usage.d.ts.map +1 -0
- package/dist/adapters/ai-usage.js +105 -0
- package/dist/adapters/ai-usage.js.map +1 -0
- package/dist/adapters/cost-rates.d.ts +20 -0
- package/dist/adapters/cost-rates.d.ts.map +1 -0
- package/dist/adapters/cost-rates.js +40 -0
- package/dist/adapters/cost-rates.js.map +1 -0
- package/dist/adapters/index.d.ts +19 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/metrics.d.ts +111 -0
- package/dist/adapters/metrics.d.ts.map +1 -0
- package/dist/adapters/metrics.js +169 -0
- package/dist/adapters/metrics.js.map +1 -0
- package/dist/adapters/pubsub.d.ts +124 -0
- package/dist/adapters/pubsub.d.ts.map +1 -0
- package/dist/adapters/pubsub.js +121 -0
- package/dist/adapters/pubsub.js.map +1 -0
- package/dist/browser.d.ts +32 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +68 -0
- package/dist/browser.js.map +1 -0
- package/dist/child-accessors.d.ts +27 -0
- package/dist/child-accessors.d.ts.map +1 -0
- package/dist/child-accessors.js +35 -0
- package/dist/child-accessors.js.map +1 -0
- package/dist/class.d.ts +313 -0
- package/dist/class.d.ts.map +1 -0
- package/dist/class.js +896 -0
- package/dist/class.js.map +1 -0
- package/dist/collection-cache.d.ts +110 -0
- package/dist/collection-cache.d.ts.map +1 -0
- package/dist/collection-cache.js +187 -0
- package/dist/collection-cache.js.map +1 -0
- package/dist/collection.d.ts +894 -0
- package/dist/collection.d.ts.map +1 -0
- package/dist/collection.js +1987 -0
- package/dist/collection.js.map +1 -0
- package/dist/config/global-config.d.ts +3 -0
- package/dist/config/global-config.d.ts.map +1 -0
- package/dist/config/global-config.js +19 -0
- package/dist/config/global-config.js.map +1 -0
- package/dist/config.d.ts +145 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +57 -0
- package/dist/config.js.map +1 -0
- package/dist/consumer-plugin/index.d.ts +22 -0
- package/dist/consumer-plugin/index.d.ts.map +1 -0
- package/dist/consumer-plugin/index.js +452 -0
- package/dist/consumer-plugin/index.js.map +1 -0
- package/dist/consumer-plugin.d.ts +8 -0
- package/dist/consumer-plugin.d.ts.map +1 -0
- package/dist/consumer-plugin.js +5 -0
- package/dist/consumer-plugin.js.map +1 -0
- package/dist/database.d.ts +95 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +32 -0
- package/dist/database.js.map +1 -0
- package/dist/decorators/compatibility.d.ts +14 -0
- package/dist/decorators/compatibility.d.ts.map +1 -0
- package/dist/decorators/compatibility.js +111 -0
- package/dist/decorators/compatibility.js.map +1 -0
- package/dist/decorators/index.d.ts +381 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/index.js +104 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/dispatch/bus.d.ts +306 -0
- package/dist/dispatch/bus.d.ts.map +1 -0
- package/dist/dispatch/bus.js +583 -0
- package/dist/dispatch/bus.js.map +1 -0
- package/dist/dispatch/collections/DispatchSubscriptions.d.ts +79 -0
- package/dist/dispatch/collections/DispatchSubscriptions.d.ts.map +1 -0
- package/dist/dispatch/collections/DispatchSubscriptions.js +243 -0
- package/dist/dispatch/collections/DispatchSubscriptions.js.map +1 -0
- package/dist/dispatch/collections/Dispatches.d.ts +98 -0
- package/dist/dispatch/collections/Dispatches.d.ts.map +1 -0
- package/dist/dispatch/collections/Dispatches.js +358 -0
- package/dist/dispatch/collections/Dispatches.js.map +1 -0
- package/dist/dispatch/index.d.ts +47 -0
- package/dist/dispatch/index.d.ts.map +1 -0
- package/dist/dispatch/models/Dispatch.d.ts +101 -0
- package/dist/dispatch/models/Dispatch.d.ts.map +1 -0
- package/dist/dispatch/models/Dispatch.js +162 -0
- package/dist/dispatch/models/Dispatch.js.map +1 -0
- package/dist/dispatch/models/DispatchSubscription.d.ts +83 -0
- package/dist/dispatch/models/DispatchSubscription.d.ts.map +1 -0
- package/dist/dispatch/models/DispatchSubscription.js +112 -0
- package/dist/dispatch/models/DispatchSubscription.js.map +1 -0
- package/dist/dispatch/tenant-resolver.d.ts +98 -0
- package/dist/dispatch/tenant-resolver.d.ts.map +1 -0
- package/dist/dispatch/tenant-resolver.js +32 -0
- package/dist/dispatch/tenant-resolver.js.map +1 -0
- package/dist/dispatch/types.d.ts +149 -0
- package/dist/dispatch/types.d.ts.map +1 -0
- package/dist/embeddings/hash.d.ts +33 -0
- package/dist/embeddings/hash.d.ts.map +1 -0
- package/dist/embeddings/hash.js +37 -0
- package/dist/embeddings/hash.js.map +1 -0
- package/dist/embeddings/index.d.ts +36 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/provider.d.ts +75 -0
- package/dist/embeddings/provider.d.ts.map +1 -0
- package/dist/embeddings/provider.js +170 -0
- package/dist/embeddings/provider.js.map +1 -0
- package/dist/embeddings/similarity.d.ts +47 -0
- package/dist/embeddings/similarity.d.ts.map +1 -0
- package/dist/embeddings/similarity.js +64 -0
- package/dist/embeddings/similarity.js.map +1 -0
- package/dist/embeddings/storage.d.ts +125 -0
- package/dist/embeddings/storage.d.ts.map +1 -0
- package/dist/embeddings/storage.js +283 -0
- package/dist/embeddings/storage.js.map +1 -0
- package/dist/embeddings/types.d.ts +250 -0
- package/dist/embeddings/types.d.ts.map +1 -0
- package/dist/errors.d.ts +363 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +669 -0
- package/dist/errors.js.map +1 -0
- package/dist/generators/cli.d.ts +162 -0
- package/dist/generators/cli.d.ts.map +1 -0
- package/dist/generators/cli.js +462 -0
- package/dist/generators/cli.js.map +1 -0
- package/dist/generators/index.d.ts +13 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/mcp-runtime-template.d.ts +60 -0
- package/dist/generators/mcp-runtime-template.d.ts.map +1 -0
- package/dist/generators/mcp-runtime-template.js +509 -0
- package/dist/generators/mcp-runtime-template.js.map +1 -0
- package/dist/generators/mcp.d.ts +231 -0
- package/dist/generators/mcp.d.ts.map +1 -0
- package/dist/generators/mcp.js +1220 -0
- package/dist/generators/mcp.js.map +1 -0
- package/dist/generators/rest.d.ts +171 -0
- package/dist/generators/rest.d.ts.map +1 -0
- package/dist/generators/rest.js +591 -0
- package/dist/generators/rest.js.map +1 -0
- package/dist/generators/swagger.d.ts +21 -0
- package/dist/generators/swagger.d.ts.map +1 -0
- package/dist/generators/swagger.js +307 -0
- package/dist/generators/swagger.js.map +1 -0
- package/dist/generators/tenant-gate.d.ts +74 -0
- package/dist/generators/tenant-gate.d.ts.map +1 -0
- package/dist/generators/tenant-gate.js +15 -0
- package/dist/generators/tenant-gate.js.map +1 -0
- package/dist/generators.d.ts +8 -0
- package/dist/generators.d.ts.map +1 -0
- package/dist/generators.js +19 -0
- package/dist/generators.js.map +1 -0
- package/dist/hierarchical.d.ts +103 -0
- package/dist/hierarchical.d.ts.map +1 -0
- package/dist/hierarchical.js +184 -0
- package/dist/hierarchical.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +202 -0
- package/dist/index.js.map +1 -0
- package/dist/interceptors.d.ts +251 -0
- package/dist/interceptors.d.ts.map +1 -0
- package/dist/interceptors.js +259 -0
- package/dist/interceptors.js.map +1 -0
- package/dist/junction.d.ts +99 -0
- package/dist/junction.d.ts.map +1 -0
- package/dist/junction.js +136 -0
- package/dist/junction.js.map +1 -0
- package/dist/knowledge.d.ts +11 -0
- package/dist/knowledge.d.ts.map +1 -0
- package/dist/knowledge.js +310 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/lazy-config.d.ts +160 -0
- package/dist/lazy-config.d.ts.map +1 -0
- package/dist/lazy-config.js +146 -0
- package/dist/lazy-config.js.map +1 -0
- package/dist/manifest/discover-base-classes.d.ts +78 -0
- package/dist/manifest/discover-base-classes.d.ts.map +1 -0
- package/dist/manifest/discover-base-classes.js +85 -0
- package/dist/manifest/discover-base-classes.js.map +1 -0
- package/dist/manifest/discover-smrt-packages.d.ts +48 -0
- package/dist/manifest/discover-smrt-packages.d.ts.map +1 -0
- package/dist/manifest/discover-smrt-packages.js +361 -0
- package/dist/manifest/discover-smrt-packages.js.map +1 -0
- package/dist/manifest/generator.d.ts +93 -0
- package/dist/manifest/generator.d.ts.map +1 -0
- package/dist/manifest/generator.js +380 -0
- package/dist/manifest/generator.js.map +1 -0
- package/dist/manifest/index.d.ts +16 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +51 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/manifest/manager.d.ts +51 -0
- package/dist/manifest/manager.d.ts.map +1 -0
- package/dist/manifest/manager.js +89 -0
- package/dist/manifest/manager.js.map +1 -0
- package/dist/manifest/manifest-loader.d.ts +187 -0
- package/dist/manifest/manifest-loader.d.ts.map +1 -0
- package/dist/manifest/manifest-loader.js +847 -0
- package/dist/manifest/manifest-loader.js.map +1 -0
- package/dist/manifest/sources/composite.d.ts +22 -0
- package/dist/manifest/sources/composite.d.ts.map +1 -0
- package/dist/manifest/sources/composite.js +60 -0
- package/dist/manifest/sources/composite.js.map +1 -0
- package/dist/manifest/sources/embedded.d.ts +7 -0
- package/dist/manifest/sources/embedded.d.ts.map +1 -0
- package/dist/manifest/sources/embedded.js +30 -0
- package/dist/manifest/sources/embedded.js.map +1 -0
- package/dist/manifest/sources/explicit-paths.d.ts +17 -0
- package/dist/manifest/sources/explicit-paths.d.ts.map +1 -0
- package/dist/manifest/sources/explicit-paths.js +35 -0
- package/dist/manifest/sources/explicit-paths.js.map +1 -0
- package/dist/manifest/sources/fallback.d.ts +25 -0
- package/dist/manifest/sources/fallback.d.ts.map +1 -0
- package/dist/manifest/sources/fallback.js +63 -0
- package/dist/manifest/sources/fallback.js.map +1 -0
- package/dist/manifest/sources/index.d.ts +17 -0
- package/dist/manifest/sources/index.d.ts.map +1 -0
- package/dist/manifest/sources/local-test.d.ts +7 -0
- package/dist/manifest/sources/local-test.d.ts.map +1 -0
- package/dist/manifest/sources/local-test.js +21 -0
- package/dist/manifest/sources/local-test.js.map +1 -0
- package/dist/manifest/sources/static.d.ts +7 -0
- package/dist/manifest/sources/static.d.ts.map +1 -0
- package/dist/manifest/sources/static.js +19 -0
- package/dist/manifest/sources/static.js.map +1 -0
- package/dist/manifest/sources/test.d.ts +7 -0
- package/dist/manifest/sources/test.d.ts.map +1 -0
- package/dist/manifest/sources/test.js +21 -0
- package/dist/manifest/sources/test.js.map +1 -0
- package/dist/manifest/sources/types.d.ts +79 -0
- package/dist/manifest/sources/types.d.ts.map +1 -0
- package/dist/manifest/sources/types.js +61 -0
- package/dist/manifest/sources/types.js.map +1 -0
- package/dist/manifest/static-manifest.d.ts +4 -0
- package/dist/manifest/static-manifest.d.ts.map +1 -0
- package/dist/manifest/static-manifest.js +1535 -0
- package/dist/manifest/static-manifest.js.map +1 -0
- package/dist/manifest/store.d.ts +111 -0
- package/dist/manifest/store.d.ts.map +1 -0
- package/dist/manifest/store.js +431 -0
- package/dist/manifest/store.js.map +1 -0
- package/dist/manifest/test-manifest-loader.d.ts +3 -0
- package/dist/manifest/test-manifest-loader.d.ts.map +1 -0
- package/dist/manifest/test-manifest-stub.d.ts +4 -0
- package/dist/manifest/test-manifest-stub.d.ts.map +1 -0
- package/dist/manifest/test-manifest-stub.js +80013 -0
- package/dist/manifest/test-manifest-stub.js.map +1 -0
- package/dist/manifest.d.ts +8 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +20 -0
- package/dist/manifest.js.map +1 -0
- package/dist/manifest.json +1489 -0
- package/dist/mcp-advisor/index.d.ts +499 -0
- package/dist/mcp-advisor/index.d.ts.map +1 -0
- package/dist/mcp-advisor/tools/add-ai-methods.d.ts +6 -0
- package/dist/mcp-advisor/tools/add-ai-methods.d.ts.map +1 -0
- package/dist/mcp-advisor/tools/configure-decorators.d.ts +6 -0
- package/dist/mcp-advisor/tools/configure-decorators.d.ts.map +1 -0
- package/dist/mcp-advisor/tools/generate-collection.d.ts +6 -0
- package/dist/mcp-advisor/tools/generate-collection.d.ts.map +1 -0
- package/dist/mcp-advisor/tools/generate-field-definitions.d.ts +6 -0
- package/dist/mcp-advisor/tools/generate-field-definitions.d.ts.map +1 -0
- package/dist/mcp-advisor/tools/generate-smrt-class.d.ts +6 -0
- package/dist/mcp-advisor/tools/generate-smrt-class.d.ts.map +1 -0
- package/dist/mcp-advisor/tools/get-object-config.d.ts +6 -0
- package/dist/mcp-advisor/tools/get-object-config.d.ts.map +1 -0
- package/dist/mcp-advisor/tools/get-object-schema.d.ts +10 -0
- package/dist/mcp-advisor/tools/get-object-schema.d.ts.map +1 -0
- package/dist/mcp-advisor/tools/list-registered-objects.d.ts +9 -0
- package/dist/mcp-advisor/tools/list-registered-objects.d.ts.map +1 -0
- package/dist/mcp-advisor/tools/preview-api-endpoints.d.ts +9 -0
- package/dist/mcp-advisor/tools/preview-api-endpoints.d.ts.map +1 -0
- package/dist/mcp-advisor/tools/preview-mcp-tools.d.ts +9 -0
- package/dist/mcp-advisor/tools/preview-mcp-tools.d.ts.map +1 -0
- package/dist/mcp-advisor/tools/validate-smrt-object.d.ts +6 -0
- package/dist/mcp-advisor/tools/validate-smrt-object.d.ts.map +1 -0
- package/dist/mcp-advisor/types.d.ts +209 -0
- package/dist/mcp-advisor/types.d.ts.map +1 -0
- package/dist/migrations/backfill-tracker.d.ts +84 -0
- package/dist/migrations/backfill-tracker.d.ts.map +1 -0
- package/dist/migrations/backfill-tracker.js +118 -0
- package/dist/migrations/backfill-tracker.js.map +1 -0
- package/dist/migrations/checksum.d.ts +43 -0
- package/dist/migrations/checksum.d.ts.map +1 -0
- package/dist/migrations/checksum.js +32 -0
- package/dist/migrations/checksum.js.map +1 -0
- package/dist/migrations/differ.d.ts +186 -0
- package/dist/migrations/differ.d.ts.map +1 -0
- package/dist/migrations/differ.js +601 -0
- package/dist/migrations/differ.js.map +1 -0
- package/dist/migrations/generator.d.ts +133 -0
- package/dist/migrations/generator.d.ts.map +1 -0
- package/dist/migrations/generator.js +328 -0
- package/dist/migrations/generator.js.map +1 -0
- package/dist/migrations/index.d.ts +20 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/orchestrate.d.ts +148 -0
- package/dist/migrations/orchestrate.d.ts.map +1 -0
- package/dist/migrations/orchestrate.js +118 -0
- package/dist/migrations/orchestrate.js.map +1 -0
- package/dist/migrations/tracker.d.ts +134 -0
- package/dist/migrations/tracker.d.ts.map +1 -0
- package/dist/migrations/tracker.js +624 -0
- package/dist/migrations/tracker.js.map +1 -0
- package/dist/migrations/types.d.ts +221 -0
- package/dist/migrations/types.d.ts.map +1 -0
- package/dist/migrations.d.ts +7 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +26 -0
- package/dist/migrations.js.map +1 -0
- package/dist/node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js +56 -0
- package/dist/node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js.map +1 -0
- package/dist/node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/esm/index.js +163 -0
- package/dist/node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/esm/index.js.map +1 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/assert-valid-pattern.js +13 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/ast.js +654 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/ast.js.map +1 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/brace-expressions.js +111 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/escape.js +10 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/escape.js.map +1 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/index.js +824 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/index.js.map +1 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/unescape.js +10 -0
- package/dist/node_modules/.pnpm/minimatch@10.2.3/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
- package/dist/object.d.ts +1202 -0
- package/dist/object.d.ts.map +1 -0
- package/dist/object.js +2731 -0
- package/dist/object.js.map +1 -0
- package/dist/polymorphic-association.d.ts +69 -0
- package/dist/polymorphic-association.d.ts.map +1 -0
- package/dist/polymorphic-association.js +96 -0
- package/dist/polymorphic-association.js.map +1 -0
- package/dist/prebuild/cli.d.ts +7 -0
- package/dist/prebuild/cli.d.ts.map +1 -0
- package/dist/prebuild/cli.js +29 -0
- package/dist/prebuild/cli.js.map +1 -0
- package/dist/prebuild/index.d.ts +22 -0
- package/dist/prebuild/index.d.ts.map +1 -0
- package/dist/prebuild/index.js +239 -0
- package/dist/prebuild/index.js.map +1 -0
- package/dist/prebuild.d.ts +8 -0
- package/dist/prebuild.d.ts.map +1 -0
- package/dist/prebuild.js +6 -0
- package/dist/prebuild.js.map +1 -0
- package/dist/registry/cache-config.d.ts +13 -0
- package/dist/registry/cache-config.d.ts.map +1 -0
- package/dist/registry/cache-config.js +17 -0
- package/dist/registry/cache-config.js.map +1 -0
- package/dist/registry/class-registration.d.ts +31 -0
- package/dist/registry/class-registration.d.ts.map +1 -0
- package/dist/registry/class-registration.js +1074 -0
- package/dist/registry/class-registration.js.map +1 -0
- package/dist/registry/collection-resolution.d.ts +45 -0
- package/dist/registry/collection-resolution.d.ts.map +1 -0
- package/dist/registry/collection-resolution.js +121 -0
- package/dist/registry/collection-resolution.js.map +1 -0
- package/dist/registry/collision-policy.d.ts +179 -0
- package/dist/registry/collision-policy.d.ts.map +1 -0
- package/dist/registry/collision-policy.js +153 -0
- package/dist/registry/collision-policy.js.map +1 -0
- package/dist/registry/diagnostics.d.ts +58 -0
- package/dist/registry/diagnostics.d.ts.map +1 -0
- package/dist/registry/diagnostics.js +54 -0
- package/dist/registry/diagnostics.js.map +1 -0
- package/dist/registry/embedding-manager.d.ts +23 -0
- package/dist/registry/embedding-manager.d.ts.map +1 -0
- package/dist/registry/embedding-manager.js +62 -0
- package/dist/registry/embedding-manager.js.map +1 -0
- package/dist/registry/index.d.ts +13 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/inheritance-resolver.d.ts +13 -0
- package/dist/registry/inheritance-resolver.d.ts.map +1 -0
- package/dist/registry/inheritance-resolver.js +244 -0
- package/dist/registry/inheritance-resolver.js.map +1 -0
- package/dist/registry/manifest-field-merge.d.ts +4 -0
- package/dist/registry/manifest-field-merge.d.ts.map +1 -0
- package/dist/registry/manifest-field-merge.js +82 -0
- package/dist/registry/manifest-field-merge.js.map +1 -0
- package/dist/registry/name-resolver.d.ts +102 -0
- package/dist/registry/name-resolver.d.ts.map +1 -0
- package/dist/registry/name-resolver.js +241 -0
- package/dist/registry/name-resolver.js.map +1 -0
- package/dist/registry/relationship-graph.d.ts +16 -0
- package/dist/registry/relationship-graph.d.ts.map +1 -0
- package/dist/registry/relationship-graph.js +79 -0
- package/dist/registry/relationship-graph.js.map +1 -0
- package/dist/registry/schema-builder.d.ts +113 -0
- package/dist/registry/schema-builder.d.ts.map +1 -0
- package/dist/registry/schema-builder.js +474 -0
- package/dist/registry/schema-builder.js.map +1 -0
- package/dist/registry/shared-state.d.ts +62 -0
- package/dist/registry/shared-state.d.ts.map +1 -0
- package/dist/registry/shared-state.js +135 -0
- package/dist/registry/shared-state.js.map +1 -0
- package/dist/registry/types.d.ts +667 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/validator.d.ts +13 -0
- package/dist/registry/validator.d.ts.map +1 -0
- package/dist/registry/validator.js +138 -0
- package/dist/registry/validator.js.map +1 -0
- package/dist/registry.d.ts +1358 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +2301 -0
- package/dist/registry.js.map +1 -0
- package/dist/runtime/client.d.ts +34 -0
- package/dist/runtime/client.d.ts.map +1 -0
- package/dist/runtime/client.js +104 -0
- package/dist/runtime/client.js.map +1 -0
- package/dist/runtime/index.d.ts +10 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/mcp.d.ts +47 -0
- package/dist/runtime/mcp.d.ts.map +1 -0
- package/dist/runtime/mcp.js +72 -0
- package/dist/runtime/mcp.js.map +1 -0
- package/dist/runtime/server.d.ts +92 -0
- package/dist/runtime/server.d.ts.map +1 -0
- package/dist/runtime/server.js +390 -0
- package/dist/runtime/server.js.map +1 -0
- package/dist/runtime/types.d.ts +58 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime.d.ts +8 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +10 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scanner/import-scanner.d.ts +7 -0
- package/dist/scanner/import-scanner.d.ts.map +1 -0
- package/dist/scanner/index.d.ts +12 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/manifest-generator.d.ts +304 -0
- package/dist/scanner/manifest-generator.d.ts.map +1 -0
- package/dist/scanner/manifest-generator.js +1707 -0
- package/dist/scanner/manifest-generator.js.map +1 -0
- package/dist/scanner/test-file-patterns.d.ts +18 -0
- package/dist/scanner/test-file-patterns.d.ts.map +1 -0
- package/dist/scanner/test-file-patterns.js +16 -0
- package/dist/scanner/test-file-patterns.js.map +1 -0
- package/dist/scanner/types.d.ts +313 -0
- package/dist/scanner/types.d.ts.map +1 -0
- package/dist/scanner/types.js +2 -0
- package/dist/scanner/types.js.map +1 -0
- package/dist/scanner.d.ts +6 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +6 -0
- package/dist/scanner.js.map +1 -0
- package/dist/schema/code-generator.d.ts +53 -0
- package/dist/schema/code-generator.d.ts.map +1 -0
- package/dist/schema/ddl/base-strategy.d.ts +80 -0
- package/dist/schema/ddl/base-strategy.d.ts.map +1 -0
- package/dist/schema/ddl/base-strategy.js +240 -0
- package/dist/schema/ddl/base-strategy.js.map +1 -0
- package/dist/schema/ddl/duckdb-strategy.d.ts +33 -0
- package/dist/schema/ddl/duckdb-strategy.d.ts.map +1 -0
- package/dist/schema/ddl/duckdb-strategy.js +74 -0
- package/dist/schema/ddl/duckdb-strategy.js.map +1 -0
- package/dist/schema/ddl/index.d.ts +53 -0
- package/dist/schema/ddl/index.d.ts.map +1 -0
- package/dist/schema/ddl/index.js +80 -0
- package/dist/schema/ddl/index.js.map +1 -0
- package/dist/schema/ddl/json-duckdb-strategy.d.ts +8 -0
- package/dist/schema/ddl/json-duckdb-strategy.d.ts.map +1 -0
- package/dist/schema/ddl/json-duckdb-strategy.js +14 -0
- package/dist/schema/ddl/json-duckdb-strategy.js.map +1 -0
- package/dist/schema/ddl/postgres-strategy.d.ts +29 -0
- package/dist/schema/ddl/postgres-strategy.d.ts.map +1 -0
- package/dist/schema/ddl/postgres-strategy.js +102 -0
- package/dist/schema/ddl/postgres-strategy.js.map +1 -0
- package/dist/schema/ddl/sqlite-strategy.d.ts +38 -0
- package/dist/schema/ddl/sqlite-strategy.d.ts.map +1 -0
- package/dist/schema/ddl/sqlite-strategy.js +74 -0
- package/dist/schema/ddl/sqlite-strategy.js.map +1 -0
- package/dist/schema/ddl/types.d.ts +114 -0
- package/dist/schema/ddl/types.d.ts.map +1 -0
- package/dist/schema/generator.d.ts +176 -0
- package/dist/schema/generator.d.ts.map +1 -0
- package/dist/schema/generator.js +1076 -0
- package/dist/schema/generator.js.map +1 -0
- package/dist/schema/index-utils.d.ts +19 -0
- package/dist/schema/index-utils.d.ts.map +1 -0
- package/dist/schema/index-utils.js +32 -0
- package/dist/schema/index-utils.js.map +1 -0
- package/dist/schema/index.d.ts +13 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/override-system.d.ts +43 -0
- package/dist/schema/override-system.d.ts.map +1 -0
- package/dist/schema/schema-aggregator.d.ts +112 -0
- package/dist/schema/schema-aggregator.d.ts.map +1 -0
- package/dist/schema/schema-manager.d.ts +95 -0
- package/dist/schema/schema-manager.d.ts.map +1 -0
- package/dist/schema/schema-manager.js +283 -0
- package/dist/schema/schema-manager.js.map +1 -0
- package/dist/schema/sql-identifiers.d.ts +107 -0
- package/dist/schema/sql-identifiers.d.ts.map +1 -0
- package/dist/schema/sql-identifiers.js +190 -0
- package/dist/schema/sql-identifiers.js.map +1 -0
- package/dist/schema/table-verifier.d.ts +10 -0
- package/dist/schema/table-verifier.d.ts.map +1 -0
- package/dist/schema/table-verifier.js +37 -0
- package/dist/schema/table-verifier.js.map +1 -0
- package/dist/schema/types.d.ts +241 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/utils.d.ts +32 -0
- package/dist/schema/utils.d.ts.map +1 -0
- package/dist/schema/utils.js +134 -0
- package/dist/schema/utils.js.map +1 -0
- package/dist/scripts/create-wrappers.js +89 -0
- package/dist/scripts/generate-manifest.js +155 -0
- package/dist/scripts/generate-test-manifest.js +77 -0
- package/dist/scripts/migrate-datetime-to-timestamp.ts +310 -0
- package/dist/scripts/prepack.js +49 -0
- package/dist/signals/bus.d.ts +64 -0
- package/dist/signals/bus.d.ts.map +1 -0
- package/dist/signals/bus.js +102 -0
- package/dist/signals/bus.js.map +1 -0
- package/dist/signals/index.d.ts +11 -0
- package/dist/signals/index.d.ts.map +1 -0
- package/dist/signals/sanitizer.d.ts +54 -0
- package/dist/signals/sanitizer.d.ts.map +1 -0
- package/dist/signals/sanitizer.js +111 -0
- package/dist/signals/sanitizer.js.map +1 -0
- package/dist/smrt-knowledge.json +335 -0
- package/dist/system/compatibility.d.ts +8 -0
- package/dist/system/compatibility.d.ts.map +1 -0
- package/dist/system/compatibility.js +409 -0
- package/dist/system/compatibility.js.map +1 -0
- package/dist/system/index.d.ts +9 -0
- package/dist/system/index.d.ts.map +1 -0
- package/dist/system/schema.d.ts +69 -0
- package/dist/system/schema.d.ts.map +1 -0
- package/dist/system/schema.js +271 -0
- package/dist/system/schema.js.map +1 -0
- package/dist/system/types.d.ts +135 -0
- package/dist/system/types.d.ts.map +1 -0
- package/dist/system-fields.d.ts +44 -0
- package/dist/system-fields.d.ts.map +1 -0
- package/dist/system-fields.js +55 -0
- package/dist/system-fields.js.map +1 -0
- package/dist/table-cache.d.ts +28 -0
- package/dist/table-cache.d.ts.map +1 -0
- package/dist/table-cache.js +21 -0
- package/dist/table-cache.js.map +1 -0
- package/dist/test-utils.d.ts +140 -0
- package/dist/test-utils.d.ts.map +1 -0
- package/dist/testing/database.d.ts +73 -0
- package/dist/testing/database.d.ts.map +1 -0
- package/dist/testing/database.js +204 -0
- package/dist/testing/database.js.map +1 -0
- package/dist/testing/index.d.ts +21 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing.d.ts +6 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +5 -0
- package/dist/testing.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/tool-executor.d.ts +101 -0
- package/dist/tools/tool-executor.d.ts.map +1 -0
- package/dist/tools/tool-executor.js +142 -0
- package/dist/tools/tool-executor.js.map +1 -0
- package/dist/tools/tool-generator.d.ts +54 -0
- package/dist/tools/tool-generator.d.ts.map +1 -0
- package/dist/tools/tool-generator.js +121 -0
- package/dist/tools/tool-generator.js.map +1 -0
- package/dist/utils/chunk.d.ts +32 -0
- package/dist/utils/chunk.d.ts.map +1 -0
- package/dist/utils/chunk.js +14 -0
- package/dist/utils/chunk.js.map +1 -0
- package/dist/utils/import-workspace-module.d.ts +8 -0
- package/dist/utils/import-workspace-module.d.ts.map +1 -0
- package/dist/utils/import-workspace-module.js +81 -0
- package/dist/utils/import-workspace-module.js.map +1 -0
- package/dist/utils/json.d.ts +102 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +43 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/lru-cache.d.ts +69 -0
- package/dist/utils/lru-cache.d.ts.map +1 -0
- package/dist/utils/lru-cache.js +100 -0
- package/dist/utils/lru-cache.js.map +1 -0
- package/dist/utils/naming.d.ts +16 -0
- package/dist/utils/naming.d.ts.map +1 -0
- package/dist/utils/naming.js +23 -0
- package/dist/utils/naming.js.map +1 -0
- package/dist/utils/qualified-names.d.ts +122 -0
- package/dist/utils/qualified-names.d.ts.map +1 -0
- package/dist/utils/qualified-names.js +82 -0
- package/dist/utils/qualified-names.js.map +1 -0
- package/dist/utils/scanner-module.d.ts +37 -0
- package/dist/utils/scanner-module.d.ts.map +1 -0
- package/dist/utils.d.ts +177 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +185 -0
- package/dist/utils.js.map +1 -0
- package/dist/vite-plugin/import-build-aware.d.ts +68 -0
- package/dist/vite-plugin/import-build-aware.d.ts.map +1 -0
- package/dist/vite-plugin/import-build-aware.js +72 -0
- package/dist/vite-plugin/import-build-aware.js.map +1 -0
- package/dist/vite-plugin/index.d.ts +59 -0
- package/dist/vite-plugin/index.d.ts.map +1 -0
- package/dist/vite-plugin/index.js +1400 -0
- package/dist/vite-plugin/index.js.map +1 -0
- package/dist/vite-plugin/sveltekit-generator.d.ts +66 -0
- package/dist/vite-plugin/sveltekit-generator.d.ts.map +1 -0
- package/dist/vite-plugin/sveltekit-generator.js +1375 -0
- package/dist/vite-plugin/sveltekit-generator.js.map +1 -0
- package/dist/vite-plugin/templates/default-ui.ts +432 -0
- package/dist/vite-plugin/templates/default.html +206 -0
- package/dist/vite-plugin.d.ts +8 -0
- package/dist/vite-plugin.d.ts.map +1 -0
- package/dist/vite-plugin.js +11 -0
- package/dist/vite-plugin.js.map +1 -0
- package/package.json +208 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { SmrtObject } from "./object.js";
|
|
2
|
+
import { ObjectRegistry } from "./registry.js";
|
|
3
|
+
import { chunkArray, IN_LIST_CHUNK_SIZE } from "./utils/chunk.js";
|
|
4
|
+
class SmrtHierarchical extends SmrtObject {
|
|
5
|
+
/**
|
|
6
|
+
* Internal marker so the scanner can recognize this framework abstract base
|
|
7
|
+
* even when consumers haven't built its package. Mirrors
|
|
8
|
+
* `SmrtJunction._isJunctionBase`. Don't rename without also updating the
|
|
9
|
+
* scanner's `FRAMEWORK_BASE_CLASSES` set in
|
|
10
|
+
* `packages/scanner/src/inheritance-resolver.ts`.
|
|
11
|
+
*/
|
|
12
|
+
static _isHierarchicalBase = true;
|
|
13
|
+
/** Self-referencing parent. `null` means top-level (no parent). */
|
|
14
|
+
parentId = null;
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the collection used to load siblings/ancestors/descendants.
|
|
17
|
+
*
|
|
18
|
+
* Goes through `ObjectRegistry.getCollection` so subclasses don't have to
|
|
19
|
+
* hard-code a dynamic import of their own collection module. Also acts as
|
|
20
|
+
* the abstract-base guard — `new SmrtHierarchical()` followed by any
|
|
21
|
+
* traversal method throws a clear error rather than producing garbage.
|
|
22
|
+
*
|
|
23
|
+
* For STI subclasses, queries are issued against the STI base collection
|
|
24
|
+
* so the table/discriminator are correct.
|
|
25
|
+
*
|
|
26
|
+
* Lookup uses the constructor's qualified name when available — set by
|
|
27
|
+
* the registry on every registered class as `_smrtQualifiedName` (R5-
|
|
28
|
+
* canon prep). Then `ObjectRegistry.getSTIBase(...)` returns the
|
|
29
|
+
* qualified name of the STI base directly (R5-canon main), so the
|
|
30
|
+
* `getCollection` lookup never collapses to a simple-name ambiguity
|
|
31
|
+
* even when two packages ship a hierarchical class with the same
|
|
32
|
+
* simple name. Falls back through `getClassByConstructor` → simple
|
|
33
|
+
* `this.constructor.name` when the static / WeakMap aren't populated
|
|
34
|
+
* (rare; `getCollection` then surfaces the existing "not found in
|
|
35
|
+
* ObjectRegistry" error).
|
|
36
|
+
*
|
|
37
|
+
* The constructor prototype-chain walk that lived here from PR #1269
|
|
38
|
+
* is gone — the registry now returns qualified names directly so the
|
|
39
|
+
* walk became dead code.
|
|
40
|
+
*/
|
|
41
|
+
async _hierarchyCollection() {
|
|
42
|
+
if (this.constructor === SmrtHierarchical) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
"SmrtHierarchical is abstract — extend it from a concrete @smrt() class before calling hierarchy methods."
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
const ctor = this.constructor;
|
|
48
|
+
const tagged = ctor._smrtQualifiedName;
|
|
49
|
+
const registered = tagged ? void 0 : ObjectRegistry.getClassByConstructor(ctor);
|
|
50
|
+
const className = tagged ?? registered?.qualifiedName ?? registered?.name ?? ctor.name;
|
|
51
|
+
const stiBase = ObjectRegistry.getSTIBase(className);
|
|
52
|
+
const collectionClass = stiBase ?? className;
|
|
53
|
+
return await ObjectRegistry.getCollection(
|
|
54
|
+
collectionClass,
|
|
55
|
+
this.options
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The parent row, or `null` when this row is top-level.
|
|
60
|
+
*
|
|
61
|
+
* Single query. Returns the hydrated row (STI dispatch applies, so an
|
|
62
|
+
* Article-extends-Document subclass comes back as `Article`).
|
|
63
|
+
*/
|
|
64
|
+
async getParent() {
|
|
65
|
+
if (!this.parentId) return null;
|
|
66
|
+
const collection = await this._hierarchyCollection();
|
|
67
|
+
const parent = await collection.get({ id: this.parentId });
|
|
68
|
+
return parent;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Immediate children. Single query: `WHERE parent_id = this.id`.
|
|
72
|
+
*/
|
|
73
|
+
async getChildren() {
|
|
74
|
+
if (!this.id) return [];
|
|
75
|
+
const collection = await this._hierarchyCollection();
|
|
76
|
+
const children = await collection.list({
|
|
77
|
+
where: { parentId: this.id }
|
|
78
|
+
});
|
|
79
|
+
return children;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* All ancestors, root-first (immediate parent last). Does not include self.
|
|
83
|
+
*
|
|
84
|
+
* Intrinsically O(depth) queries — each step needs the previous level's
|
|
85
|
+
* `parentId` before it can fetch the next. Includes cycle protection: if
|
|
86
|
+
* a row's ancestor chain loops back on itself (data corruption), the walk
|
|
87
|
+
* stops cleanly instead of looping forever.
|
|
88
|
+
*/
|
|
89
|
+
async getAncestors() {
|
|
90
|
+
const ancestors = [];
|
|
91
|
+
const visited = /* @__PURE__ */ new Set();
|
|
92
|
+
if (this.id) visited.add(this.id);
|
|
93
|
+
let current = this;
|
|
94
|
+
while (current.parentId) {
|
|
95
|
+
if (visited.has(current.parentId)) break;
|
|
96
|
+
visited.add(current.parentId);
|
|
97
|
+
const parent = await current.getParent();
|
|
98
|
+
if (!parent) break;
|
|
99
|
+
ancestors.unshift(parent);
|
|
100
|
+
current = parent;
|
|
101
|
+
}
|
|
102
|
+
return ancestors;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* All descendants in BFS order. One query per level of depth using `IN`
|
|
106
|
+
* on the previous level's IDs — eliminates the recursive-per-child N+1
|
|
107
|
+
* pattern the duplicated implementations used.
|
|
108
|
+
*
|
|
109
|
+
* Each level's frontier is chunked at `IN_LIST_CHUNK_SIZE` before being
|
|
110
|
+
* expanded into a `parent_id IN (?, ?, …)` clause: the generic
|
|
111
|
+
* `collection.list()` does NOT chunk array-valued WHERE clauses, so a level
|
|
112
|
+
* wider than the backend's `SQLITE_MAX_VARIABLE_NUMBER` (999 on legacy
|
|
113
|
+
* SQLite, 32766 on modern builds) would otherwise throw before traversal
|
|
114
|
+
* completes. Mirrors the chunking the relationship/junction loaders in
|
|
115
|
+
* `collection.ts` already do.
|
|
116
|
+
*
|
|
117
|
+
* Cycle-safe via a visited Set keyed on row id.
|
|
118
|
+
*/
|
|
119
|
+
async getDescendants() {
|
|
120
|
+
if (!this.id) return [];
|
|
121
|
+
const collection = await this._hierarchyCollection();
|
|
122
|
+
const descendants = [];
|
|
123
|
+
const visited = /* @__PURE__ */ new Set([this.id]);
|
|
124
|
+
let frontier = [this.id];
|
|
125
|
+
while (frontier.length > 0) {
|
|
126
|
+
const next = [];
|
|
127
|
+
for (const idChunk of chunkArray(frontier, IN_LIST_CHUNK_SIZE)) {
|
|
128
|
+
const children = await collection.list({
|
|
129
|
+
where: { parentId: idChunk }
|
|
130
|
+
});
|
|
131
|
+
for (const child of children) {
|
|
132
|
+
if (!child.id || visited.has(child.id)) continue;
|
|
133
|
+
visited.add(child.id);
|
|
134
|
+
descendants.push(child);
|
|
135
|
+
next.push(child.id);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
frontier = next;
|
|
139
|
+
}
|
|
140
|
+
return descendants;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Full hierarchy view: ancestors, self, descendants. Issued concurrently.
|
|
144
|
+
*/
|
|
145
|
+
async getHierarchy() {
|
|
146
|
+
const [ancestors, descendants] = await Promise.all([
|
|
147
|
+
this.getAncestors(),
|
|
148
|
+
this.getDescendants()
|
|
149
|
+
]);
|
|
150
|
+
return { ancestors, current: this, descendants };
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Reparent this row. Pass `null` to make it a root, an id string, or the
|
|
154
|
+
* target row itself. Refuses to:
|
|
155
|
+
*
|
|
156
|
+
* - move a row to itself (self-loop)
|
|
157
|
+
* - move a row under one of its own descendants (would create a cycle)
|
|
158
|
+
*
|
|
159
|
+
* Persists via `save()`. Caller is responsible for any out-of-band
|
|
160
|
+
* denormalization (e.g. depth caches on subclasses like Tag.level).
|
|
161
|
+
*/
|
|
162
|
+
async moveTo(newParent) {
|
|
163
|
+
const newParentId = newParent === null ? null : typeof newParent === "string" ? newParent : newParent.id ?? null;
|
|
164
|
+
if (newParentId !== null && newParentId === this.id) {
|
|
165
|
+
throw new Error(
|
|
166
|
+
`Cannot move ${this.constructor.name} ${this.id} to itself.`
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
if (newParentId !== null) {
|
|
170
|
+
const descendants = await this.getDescendants();
|
|
171
|
+
if (descendants.some((d) => d.id === newParentId)) {
|
|
172
|
+
throw new Error(
|
|
173
|
+
`Cannot move ${this.constructor.name} ${this.id} under one of its own descendants (${newParentId}) — would create a cycle.`
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
this.parentId = newParentId;
|
|
178
|
+
await this.save();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export {
|
|
182
|
+
SmrtHierarchical
|
|
183
|
+
};
|
|
184
|
+
//# sourceMappingURL=hierarchical.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hierarchical.js","sources":["../src/hierarchical.ts"],"sourcesContent":["/**\n * SmrtHierarchical — base class for self-referencing tree hierarchies.\n *\n * Provides batched parent/children/ancestors/descendants/hierarchy traversal\n * and a cycle-safe `moveTo`. Replaces five copies of the same logic across\n * Place, Event, Tag, Account, and Zone.\n *\n * Examples in the monorepo:\n *\n * | Subclass | Domain |\n * |----------|------------------------------------------------|\n * | Place | hierarchical geographic places |\n * | Event | nestable event hierarchy (game → period → …) |\n * | Tag | tag taxonomies and category trees |\n * | Account | chart of accounts |\n * | Zone | placement zones inside a digital property |\n *\n * Convention: every subclass uses `parentId: string | null` referencing\n * another row in the same table (or STI base table) by UUID. Classes whose\n * self-reference has different semantics — e.g. `Fact.previousFactId` (an\n * evolution chain) or `Asset.sourceAssetId` (a derivation DAG) — should\n * NOT extend SmrtHierarchical. Use descriptive names and class-specific\n * methods instead.\n *\n * @example\n * ```typescript\n * @smrt({ tableStrategy: 'sti', api: true })\n * export class Place extends SmrtHierarchical {\n * name = '';\n * }\n *\n * const ancestors = await place.getAncestors();\n * const descendants = await place.getDescendants(); // BFS, one query per level\n * await place.moveTo(newParent); // cycle-checked\n * ```\n */\n\nimport type { SmrtCollection } from './collection';\nimport { SmrtObject } from './object';\nimport { ObjectRegistry } from './registry';\nimport { chunkArray, IN_LIST_CHUNK_SIZE } from './utils/chunk';\n\n/**\n * Aggregate hierarchy view: ancestors (root-first), self, and all descendants\n * (BFS order). Generic on the concrete subclass so `getHierarchy()` preserves\n * the caller's type — `place.getHierarchy()` yields `HierarchyView<Place>`.\n */\nexport interface HierarchyView<T extends SmrtHierarchical> {\n ancestors: T[];\n current: T;\n descendants: T[];\n}\n\nexport class SmrtHierarchical extends SmrtObject {\n /**\n * Internal marker so the scanner can recognize this framework abstract base\n * even when consumers haven't built its package. Mirrors\n * `SmrtJunction._isJunctionBase`. Don't rename without also updating the\n * scanner's `FRAMEWORK_BASE_CLASSES` set in\n * `packages/scanner/src/inheritance-resolver.ts`.\n */\n static readonly _isHierarchicalBase = true as const;\n\n /** Self-referencing parent. `null` means top-level (no parent). */\n parentId: string | null = null;\n\n /**\n * Resolve the collection used to load siblings/ancestors/descendants.\n *\n * Goes through `ObjectRegistry.getCollection` so subclasses don't have to\n * hard-code a dynamic import of their own collection module. Also acts as\n * the abstract-base guard — `new SmrtHierarchical()` followed by any\n * traversal method throws a clear error rather than producing garbage.\n *\n * For STI subclasses, queries are issued against the STI base collection\n * so the table/discriminator are correct.\n *\n * Lookup uses the constructor's qualified name when available — set by\n * the registry on every registered class as `_smrtQualifiedName` (R5-\n * canon prep). Then `ObjectRegistry.getSTIBase(...)` returns the\n * qualified name of the STI base directly (R5-canon main), so the\n * `getCollection` lookup never collapses to a simple-name ambiguity\n * even when two packages ship a hierarchical class with the same\n * simple name. Falls back through `getClassByConstructor` → simple\n * `this.constructor.name` when the static / WeakMap aren't populated\n * (rare; `getCollection` then surfaces the existing \"not found in\n * ObjectRegistry\" error).\n *\n * The constructor prototype-chain walk that lived here from PR #1269\n * is gone — the registry now returns qualified names directly so the\n * walk became dead code.\n */\n protected async _hierarchyCollection(): Promise<SmrtCollection<this>> {\n if (this.constructor === SmrtHierarchical) {\n throw new Error(\n 'SmrtHierarchical is abstract — extend it from a concrete @smrt() class before calling hierarchy methods.',\n );\n }\n\n // Identity priority:\n // 1. The constructor's `_smrtQualifiedName` static (set at\n // registration, survives HMR / federated-module duplication).\n // 2. The registry's WeakMap (`getClassByConstructor`) — same value\n // as the static when both are populated, but the WeakMap is\n // where simple-name fallback lives.\n // 3. The simple constructor name as a last-ditch fallback.\n const ctor = this.constructor as typeof SmrtHierarchical & {\n _smrtQualifiedName?: string;\n };\n const tagged = ctor._smrtQualifiedName;\n const registered = tagged\n ? undefined\n : ObjectRegistry.getClassByConstructor(ctor as any);\n const className =\n tagged ?? registered?.qualifiedName ?? registered?.name ?? ctor.name;\n\n const stiBase = ObjectRegistry.getSTIBase(className);\n const collectionClass = stiBase ?? className;\n return await ObjectRegistry.getCollection<this>(\n collectionClass,\n this.options,\n );\n }\n\n /**\n * The parent row, or `null` when this row is top-level.\n *\n * Single query. Returns the hydrated row (STI dispatch applies, so an\n * Article-extends-Document subclass comes back as `Article`).\n */\n async getParent(): Promise<this | null> {\n if (!this.parentId) return null;\n const collection = await this._hierarchyCollection();\n const parent = await collection.get({ id: this.parentId });\n return parent as this | null;\n }\n\n /**\n * Immediate children. Single query: `WHERE parent_id = this.id`.\n */\n async getChildren(): Promise<this[]> {\n if (!this.id) return [];\n const collection = await this._hierarchyCollection();\n const children = await collection.list({\n where: { parentId: this.id },\n });\n return children as this[];\n }\n\n /**\n * All ancestors, root-first (immediate parent last). Does not include self.\n *\n * Intrinsically O(depth) queries — each step needs the previous level's\n * `parentId` before it can fetch the next. Includes cycle protection: if\n * a row's ancestor chain loops back on itself (data corruption), the walk\n * stops cleanly instead of looping forever.\n */\n async getAncestors(): Promise<this[]> {\n const ancestors: this[] = [];\n const visited = new Set<string>();\n if (this.id) visited.add(this.id);\n let current: this = this;\n\n while (current.parentId) {\n if (visited.has(current.parentId)) break;\n visited.add(current.parentId);\n\n const parent = (await current.getParent()) as this | null;\n if (!parent) break;\n ancestors.unshift(parent);\n current = parent;\n }\n\n return ancestors;\n }\n\n /**\n * All descendants in BFS order. One query per level of depth using `IN`\n * on the previous level's IDs — eliminates the recursive-per-child N+1\n * pattern the duplicated implementations used.\n *\n * Each level's frontier is chunked at `IN_LIST_CHUNK_SIZE` before being\n * expanded into a `parent_id IN (?, ?, …)` clause: the generic\n * `collection.list()` does NOT chunk array-valued WHERE clauses, so a level\n * wider than the backend's `SQLITE_MAX_VARIABLE_NUMBER` (999 on legacy\n * SQLite, 32766 on modern builds) would otherwise throw before traversal\n * completes. Mirrors the chunking the relationship/junction loaders in\n * `collection.ts` already do.\n *\n * Cycle-safe via a visited Set keyed on row id.\n */\n async getDescendants(): Promise<this[]> {\n if (!this.id) return [];\n const collection = await this._hierarchyCollection();\n const descendants: this[] = [];\n const visited = new Set<string>([this.id]);\n let frontier: string[] = [this.id];\n\n while (frontier.length > 0) {\n const next: string[] = [];\n\n // Chunk the frontier so each query stays under the bind-variable cap.\n // Children are merged into the same BFS level in chunk order, so the\n // overall ordering remains breadth-first.\n for (const idChunk of chunkArray(frontier, IN_LIST_CHUNK_SIZE)) {\n const children = (await collection.list({\n where: { parentId: idChunk },\n })) as this[];\n\n for (const child of children) {\n if (!child.id || visited.has(child.id)) continue;\n visited.add(child.id);\n descendants.push(child);\n next.push(child.id);\n }\n }\n\n frontier = next;\n }\n\n return descendants;\n }\n\n /**\n * Full hierarchy view: ancestors, self, descendants. Issued concurrently.\n */\n async getHierarchy(): Promise<HierarchyView<this>> {\n const [ancestors, descendants] = await Promise.all([\n this.getAncestors(),\n this.getDescendants(),\n ]);\n return { ancestors, current: this, descendants };\n }\n\n /**\n * Reparent this row. Pass `null` to make it a root, an id string, or the\n * target row itself. Refuses to:\n *\n * - move a row to itself (self-loop)\n * - move a row under one of its own descendants (would create a cycle)\n *\n * Persists via `save()`. Caller is responsible for any out-of-band\n * denormalization (e.g. depth caches on subclasses like Tag.level).\n */\n async moveTo(newParent: this | string | null): Promise<void> {\n const newParentId =\n newParent === null\n ? null\n : typeof newParent === 'string'\n ? newParent\n : (newParent.id ?? null);\n\n if (newParentId !== null && newParentId === this.id) {\n throw new Error(\n `Cannot move ${this.constructor.name} ${this.id} to itself.`,\n );\n }\n\n if (newParentId !== null) {\n const descendants = await this.getDescendants();\n if (descendants.some((d) => d.id === newParentId)) {\n throw new Error(\n `Cannot move ${this.constructor.name} ${this.id} under one of its own descendants (${newParentId}) — would create a cycle.`,\n );\n }\n }\n\n this.parentId = newParentId;\n await this.save();\n }\n}\n"],"names":[],"mappings":";;;AAqDO,MAAM,yBAAyB,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;A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D,WAAO,EAAE,WAAW,SAAS,MAAM,YAAA;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,OAAO,WAAgD;AAC3D,UAAM,cACJ,cAAc,OACV,OACA,OAAO,cAAc,WACnB,YACC,UAAU,MAAM;AAEzB,QAAI,gBAAgB,QAAQ,gBAAgB,KAAK,IAAI;AACnD,YAAM,IAAI;AAAA,QACR,eAAe,KAAK,YAAY,IAAI,IAAI,KAAK,EAAE;AAAA,MAAA;AAAA,IAEnD;AAEA,QAAI,gBAAgB,MAAM;AACxB,YAAM,cAAc,MAAM,KAAK,eAAA;AAC/B,UAAI,YAAY,KAAK,CAAC,MAAM,EAAE,OAAO,WAAW,GAAG;AACjD,cAAM,IAAI;AAAA,UACR,eAAe,KAAK,YAAY,IAAI,IAAI,KAAK,EAAE,sCAAsC,WAAW;AAAA,QAAA;AAAA,MAEpG;AAAA,IACF;AAEA,SAAK,WAAW;AAChB,UAAM,KAAK,KAAA;AAAA,EACb;AACF;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @smrt/core - Core AI agent framework with standardized collections and code generators
|
|
3
|
+
*
|
|
4
|
+
* This package provides the foundational framework for building vertical AI agents.
|
|
5
|
+
* It provides core abstractions and integrates with other HAVE SDK packages
|
|
6
|
+
* (ai, files, sql) to provide a unified interface.
|
|
7
|
+
*
|
|
8
|
+
* Key components:
|
|
9
|
+
* - SmrtClass: Foundation class providing access to database, filesystem, and AI
|
|
10
|
+
* - SmrtObject: Persistent object with unique identifiers and database storage
|
|
11
|
+
* - SmrtCollection: Collection interface for managing sets of SmrtObjects
|
|
12
|
+
*
|
|
13
|
+
* Generators:
|
|
14
|
+
* - CLIGenerator: Create admin CLI tools from SMRT objects
|
|
15
|
+
* - APIGenerator: Generate REST APIs for SMRT objects
|
|
16
|
+
* - MCPGenerator: Create MCP servers for AI model integration
|
|
17
|
+
*/
|
|
18
|
+
export * from './adapters/index';
|
|
19
|
+
export { applyOneToManyChildAccessors, childAccessorName, } from './child-accessors';
|
|
20
|
+
export * from './class';
|
|
21
|
+
export * from './collection';
|
|
22
|
+
export { broadcastCacheInvalidation, CACHE_INVALIDATION_CHANNEL, type CollectionCacheConfig, ensureCacheInvalidationListener, getCacheGeneration, invalidateCollectionCache, resetCollectionCache, resolveDbCacheKey, stopCacheInvalidationListeners, } from './collection-cache';
|
|
23
|
+
export type { AiUsageConfig, GlobalSignalConfig, MetricsConfig, PubSubConfig, } from './config';
|
|
24
|
+
export { config } from './config';
|
|
25
|
+
export { type DatabaseConfig, isDatabaseInterface, type ResolveDatabaseOptions, resolveDatabase, } from './database';
|
|
26
|
+
export { applyPendingDecoratorRegistrations, type CompatiblePropertyDecorator, type CompatiblePropertyDecoratorContext, type LegacyPropertyDecoratorTarget, registerCompatibleFieldDecorator, } from './decorators/compatibility';
|
|
27
|
+
export { type CrossPackageRefOptions, crossPackageRef, type FieldOptions, field, foreignKey, type Meta, manyToMany, meta, type NumericFieldOptions, oneToMany, type RelationshipFieldOptions, type TextFieldOptions, } from './decorators/index';
|
|
28
|
+
export * from './dispatch/index';
|
|
29
|
+
export * from './embeddings/index';
|
|
30
|
+
export * from './errors';
|
|
31
|
+
export * from './generators/index';
|
|
32
|
+
export { type HierarchyView, SmrtHierarchical } from './hierarchical';
|
|
33
|
+
export * from './interceptors';
|
|
34
|
+
export { type JunctionAttachOptions, type JunctionFilterOptions, SmrtJunction, } from './junction';
|
|
35
|
+
export * from './knowledge';
|
|
36
|
+
export type { ConfigResolver, LazyConfigSentinel, ResolveLazyConfigOptions, } from './lazy-config';
|
|
37
|
+
export { getClassConfigResolvers, getConfigResolver, isLazyConfigSentinel, listConfigResolvers, registerConfigResolver, resetConfigResolvers, resolveLazyConfig, unregisterConfigResolver, } from './lazy-config';
|
|
38
|
+
export * from './manifest/index';
|
|
39
|
+
export type { DiffOptions } from './migrations/differ';
|
|
40
|
+
export { generateSchemaDiff, getSQLFromDiff, hasActionableChanges, SchemaComparer, } from './migrations/differ';
|
|
41
|
+
export * from './object';
|
|
42
|
+
export { SmrtPolymorphicAssociation, type SmrtPolymorphicAssociationOptions, } from './polymorphic-association';
|
|
43
|
+
export * from './registry';
|
|
44
|
+
export { smrt as smrtRegistry } from './registry';
|
|
45
|
+
export * from './runtime/index';
|
|
46
|
+
export { detectEngine, generateDDLForEngine } from './schema/ddl';
|
|
47
|
+
export type { SchemaDefinition } from './schema/types';
|
|
48
|
+
export * from './signals/index';
|
|
49
|
+
export * from './system/index';
|
|
50
|
+
export type { DiscoveryStrategy, ForgetOptions, ForgetScopeOptions, NoteMetadata, NoteOptions, RecallAllOptions, RecallOptions, SystemTableConfig, } from './system/types';
|
|
51
|
+
export { resetVerifiedTables } from './table-cache';
|
|
52
|
+
export { getTestDatabase, type TestDatabaseOptions, } from './testing/database';
|
|
53
|
+
export * from './tools/index';
|
|
54
|
+
export { clone, getAdapterInfo, isValid, type JSONAdapter, type ParseError, parse, type Result, type StringifyError, safeParse, safeStringify, stringify, } from './utils/json';
|
|
55
|
+
export { createQualifiedName, getClassName, getPackageFromQualifiedName, isFromPackage, isQualifiedName, isType, type ParsedQualifiedName, parseQualifiedName, qualifiedNamesEqual, } from './utils/qualified-names';
|
|
56
|
+
export { smrtPlugin } from './vite-plugin/index';
|
|
57
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,cAAc,kBAAkB,CAAC;AAEjC,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,+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AAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { AiUsageCollector, AiUsagePersistenceHandler } from "./adapters/ai-usage.js";
|
|
2
|
+
import { DEFAULT_AI_COST_RATES, estimateAiUsageCost } from "./adapters/cost-rates.js";
|
|
3
|
+
import { MetricsAdapter } from "./adapters/metrics.js";
|
|
4
|
+
import { PubSubAdapter } from "./adapters/pubsub.js";
|
|
5
|
+
import { applyOneToManyChildAccessors, childAccessorName } from "./child-accessors.js";
|
|
6
|
+
import { SmrtClass } from "./class.js";
|
|
7
|
+
import { SmrtCollection } from "./collection.js";
|
|
8
|
+
import { CACHE_INVALIDATION_CHANNEL, broadcastCacheInvalidation, ensureCacheInvalidationListener, getCacheGeneration, invalidateCollectionCache, resetCollectionCache, resolveDbCacheKey, stopCacheInvalidationListeners } from "./collection-cache.js";
|
|
9
|
+
import { config } from "./config.js";
|
|
10
|
+
import { isDatabaseInterface, resolveDatabase } from "./database.js";
|
|
11
|
+
import { applyPendingDecoratorRegistrations, registerCompatibleFieldDecorator } from "./decorators/compatibility.js";
|
|
12
|
+
import { crossPackageRef, field, foreignKey, manyToMany, meta, oneToMany } from "./decorators/index.js";
|
|
13
|
+
import { DispatchBus, createDispatchBus } from "./dispatch/bus.js";
|
|
14
|
+
import { DispatchCollection } from "./dispatch/collections/Dispatches.js";
|
|
15
|
+
import { DispatchSubscriptionCollection } from "./dispatch/collections/DispatchSubscriptions.js";
|
|
16
|
+
import { Dispatch } from "./dispatch/models/Dispatch.js";
|
|
17
|
+
import { DispatchSubscription } from "./dispatch/models/DispatchSubscription.js";
|
|
18
|
+
import { resolveDispatchTenantId, resolveDispatchTenantScope, setDispatchTenantResolver } from "./dispatch/tenant-resolver.js";
|
|
19
|
+
import { ContentHasher } from "./embeddings/hash.js";
|
|
20
|
+
import { DEFAULT_EMBEDDING_CONFIG, EmbeddingProvider } from "./embeddings/provider.js";
|
|
21
|
+
import { CosineSimilarity } from "./embeddings/similarity.js";
|
|
22
|
+
import { EmbeddingStorage } from "./embeddings/storage.js";
|
|
23
|
+
import { AIError, ConfigurationError, DatabaseError, ErrorUtils, FilesystemError, NetworkError, RuntimeError, SmrtError, TenantIsolationError, ValidationError, ValidationReport, ValidationUtils } from "./errors.js";
|
|
24
|
+
import { CLIGenerator, getCLIHandler, setupCLI } from "./generators/cli.js";
|
|
25
|
+
import { MCPGenerator } from "./generators/mcp.js";
|
|
26
|
+
import { APIGenerator, createRestServer, startRestServer } from "./generators/rest.js";
|
|
27
|
+
import { generateOpenAPISpec, setupSwaggerUI } from "./generators/swagger.js";
|
|
28
|
+
import { runWithTenantGate, setTenantEntryPointRunner } from "./generators/tenant-gate.js";
|
|
29
|
+
import { SmrtHierarchical } from "./hierarchical.js";
|
|
30
|
+
import { GlobalInterceptors, createInterceptorContext } from "./interceptors.js";
|
|
31
|
+
import { SmrtJunction } from "./junction.js";
|
|
32
|
+
import { buildDomainKnowledgeManifest } from "./knowledge.js";
|
|
33
|
+
import { getClassConfigResolvers, getConfigResolver, isLazyConfigSentinel, listConfigResolvers, registerConfigResolver, resetConfigResolvers, resolveLazyConfig, unregisterConfigResolver } from "./lazy-config.js";
|
|
34
|
+
import { getManifest, manifest, staticManifest } from "./manifest/index.js";
|
|
35
|
+
import { SchemaComparer, generateSchemaDiff, getSQLFromDiff, hasActionableChanges } from "./migrations/differ.js";
|
|
36
|
+
import { SmrtObject } from "./object.js";
|
|
37
|
+
import { SmrtPolymorphicAssociation } from "./polymorphic-association.js";
|
|
38
|
+
import { ObjectRegistry, smrt, smrt as smrt2 } from "./registry.js";
|
|
39
|
+
import { createSmrtClient } from "./runtime/client.js";
|
|
40
|
+
import { SmrtMCPServer, createMCPServer } from "./runtime/mcp.js";
|
|
41
|
+
import { createSmrtServer } from "./runtime/server.js";
|
|
42
|
+
import { detectEngine, generateDDLForEngine } from "./schema/ddl/index.js";
|
|
43
|
+
import { SignalBus } from "./signals/bus.js";
|
|
44
|
+
import { SignalSanitizer } from "./signals/sanitizer.js";
|
|
45
|
+
import { ensureDispatchSubscriptionsSystemTableCompatibility, ensureDispatchSystemTableCompatibility, ensureJobEventsSystemTableCompatibility, ensureJobsSystemTableCompatibility, ensureLegacySystemTableCompatibility, tableExists } from "./system/compatibility.js";
|
|
46
|
+
import { resetVerifiedTables } from "./table-cache.js";
|
|
47
|
+
import { getTestDatabase } from "./testing/database.js";
|
|
48
|
+
import { executeToolCall, executeToolCalls, formatToolResults, validateToolCall } from "./tools/tool-executor.js";
|
|
49
|
+
import { convertTypeToJsonSchema, generateToolFromMethod, generateToolManifest, shouldIncludeMethod } from "./tools/tool-generator.js";
|
|
50
|
+
import { clone, getAdapterInfo, isValid, parse, safeParse, safeStringify, stringify } from "./utils/json.js";
|
|
51
|
+
import { createQualifiedName, getClassName, getPackageFromQualifiedName, isFromPackage, isQualifiedName, isType, parseQualifiedName, qualifiedNamesEqual } from "./utils/qualified-names.js";
|
|
52
|
+
import { smrtPlugin } from "./vite-plugin/index.js";
|
|
53
|
+
import { ManifestBuilder } from "./manifest/generator.js";
|
|
54
|
+
import { ManifestGenerator } from "./scanner/manifest-generator.js";
|
|
55
|
+
import { ManifestManager } from "./manifest/manager.js";
|
|
56
|
+
import { SMRT_COLLECTION_BASE_NAMES, isSmrtCollectionExtendsName } from "./registry/collection-resolution.js";
|
|
57
|
+
import { discoverManifestEntry, findManifestEntryByQualifiedName, loadExternalManifest, loadExternalManifestSync, loadLocalTestManifestSync, loadManifestFromPathSync } from "./manifest/manifest-loader.js";
|
|
58
|
+
export {
|
|
59
|
+
AIError,
|
|
60
|
+
APIGenerator,
|
|
61
|
+
AiUsageCollector,
|
|
62
|
+
AiUsagePersistenceHandler,
|
|
63
|
+
CACHE_INVALIDATION_CHANNEL,
|
|
64
|
+
CLIGenerator,
|
|
65
|
+
ConfigurationError,
|
|
66
|
+
ContentHasher,
|
|
67
|
+
CosineSimilarity,
|
|
68
|
+
DEFAULT_AI_COST_RATES,
|
|
69
|
+
DEFAULT_EMBEDDING_CONFIG,
|
|
70
|
+
DatabaseError,
|
|
71
|
+
Dispatch,
|
|
72
|
+
DispatchBus,
|
|
73
|
+
DispatchCollection,
|
|
74
|
+
DispatchSubscription,
|
|
75
|
+
DispatchSubscriptionCollection,
|
|
76
|
+
EmbeddingProvider,
|
|
77
|
+
EmbeddingStorage,
|
|
78
|
+
ErrorUtils,
|
|
79
|
+
FilesystemError,
|
|
80
|
+
GlobalInterceptors,
|
|
81
|
+
MCPGenerator,
|
|
82
|
+
ManifestBuilder,
|
|
83
|
+
ManifestGenerator,
|
|
84
|
+
ManifestManager,
|
|
85
|
+
MetricsAdapter,
|
|
86
|
+
NetworkError,
|
|
87
|
+
ObjectRegistry,
|
|
88
|
+
PubSubAdapter,
|
|
89
|
+
RuntimeError,
|
|
90
|
+
SMRT_COLLECTION_BASE_NAMES,
|
|
91
|
+
SchemaComparer,
|
|
92
|
+
SignalBus,
|
|
93
|
+
SignalSanitizer,
|
|
94
|
+
SmrtClass,
|
|
95
|
+
SmrtCollection,
|
|
96
|
+
SmrtError,
|
|
97
|
+
SmrtHierarchical,
|
|
98
|
+
SmrtJunction,
|
|
99
|
+
SmrtMCPServer,
|
|
100
|
+
SmrtObject,
|
|
101
|
+
SmrtPolymorphicAssociation,
|
|
102
|
+
TenantIsolationError,
|
|
103
|
+
ValidationError,
|
|
104
|
+
ValidationReport,
|
|
105
|
+
ValidationUtils,
|
|
106
|
+
applyOneToManyChildAccessors,
|
|
107
|
+
applyPendingDecoratorRegistrations,
|
|
108
|
+
broadcastCacheInvalidation,
|
|
109
|
+
buildDomainKnowledgeManifest,
|
|
110
|
+
childAccessorName,
|
|
111
|
+
clone,
|
|
112
|
+
config,
|
|
113
|
+
convertTypeToJsonSchema,
|
|
114
|
+
createDispatchBus,
|
|
115
|
+
createInterceptorContext,
|
|
116
|
+
createMCPServer,
|
|
117
|
+
createQualifiedName,
|
|
118
|
+
createRestServer,
|
|
119
|
+
createSmrtClient,
|
|
120
|
+
createSmrtServer,
|
|
121
|
+
crossPackageRef,
|
|
122
|
+
detectEngine,
|
|
123
|
+
discoverManifestEntry,
|
|
124
|
+
ensureCacheInvalidationListener,
|
|
125
|
+
ensureDispatchSubscriptionsSystemTableCompatibility,
|
|
126
|
+
ensureDispatchSystemTableCompatibility,
|
|
127
|
+
ensureJobEventsSystemTableCompatibility,
|
|
128
|
+
ensureJobsSystemTableCompatibility,
|
|
129
|
+
ensureLegacySystemTableCompatibility,
|
|
130
|
+
estimateAiUsageCost,
|
|
131
|
+
executeToolCall,
|
|
132
|
+
executeToolCalls,
|
|
133
|
+
field,
|
|
134
|
+
findManifestEntryByQualifiedName,
|
|
135
|
+
foreignKey,
|
|
136
|
+
formatToolResults,
|
|
137
|
+
generateDDLForEngine,
|
|
138
|
+
generateOpenAPISpec,
|
|
139
|
+
generateSchemaDiff,
|
|
140
|
+
generateToolFromMethod,
|
|
141
|
+
generateToolManifest,
|
|
142
|
+
getAdapterInfo,
|
|
143
|
+
getCLIHandler,
|
|
144
|
+
getCacheGeneration,
|
|
145
|
+
getClassConfigResolvers,
|
|
146
|
+
getClassName,
|
|
147
|
+
getConfigResolver,
|
|
148
|
+
getManifest,
|
|
149
|
+
getPackageFromQualifiedName,
|
|
150
|
+
getSQLFromDiff,
|
|
151
|
+
getTestDatabase,
|
|
152
|
+
hasActionableChanges,
|
|
153
|
+
invalidateCollectionCache,
|
|
154
|
+
isDatabaseInterface,
|
|
155
|
+
isFromPackage,
|
|
156
|
+
isLazyConfigSentinel,
|
|
157
|
+
isQualifiedName,
|
|
158
|
+
isSmrtCollectionExtendsName,
|
|
159
|
+
isType,
|
|
160
|
+
isValid,
|
|
161
|
+
listConfigResolvers,
|
|
162
|
+
loadExternalManifest,
|
|
163
|
+
loadExternalManifestSync,
|
|
164
|
+
loadLocalTestManifestSync,
|
|
165
|
+
loadManifestFromPathSync,
|
|
166
|
+
manifest,
|
|
167
|
+
manyToMany,
|
|
168
|
+
meta,
|
|
169
|
+
oneToMany,
|
|
170
|
+
parse,
|
|
171
|
+
parseQualifiedName,
|
|
172
|
+
qualifiedNamesEqual,
|
|
173
|
+
registerCompatibleFieldDecorator,
|
|
174
|
+
registerConfigResolver,
|
|
175
|
+
resetCollectionCache,
|
|
176
|
+
resetConfigResolvers,
|
|
177
|
+
resetVerifiedTables,
|
|
178
|
+
resolveDatabase,
|
|
179
|
+
resolveDbCacheKey,
|
|
180
|
+
resolveDispatchTenantId,
|
|
181
|
+
resolveDispatchTenantScope,
|
|
182
|
+
resolveLazyConfig,
|
|
183
|
+
runWithTenantGate,
|
|
184
|
+
safeParse,
|
|
185
|
+
safeStringify,
|
|
186
|
+
setDispatchTenantResolver,
|
|
187
|
+
setTenantEntryPointRunner,
|
|
188
|
+
setupCLI,
|
|
189
|
+
setupSwaggerUI,
|
|
190
|
+
shouldIncludeMethod,
|
|
191
|
+
smrt,
|
|
192
|
+
smrtPlugin,
|
|
193
|
+
smrt2 as smrtRegistry,
|
|
194
|
+
startRestServer,
|
|
195
|
+
staticManifest,
|
|
196
|
+
stopCacheInvalidationListeners,
|
|
197
|
+
stringify,
|
|
198
|
+
tableExists,
|
|
199
|
+
unregisterConfigResolver,
|
|
200
|
+
validateToolCall
|
|
201
|
+
};
|
|
202
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|