@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
package/AGENTS.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# @happyvertical/smrt-core
|
|
2
|
+
|
|
3
|
+
ORM, code generation, AI integration, and the DispatchBus. Everything else builds on this.
|
|
4
|
+
|
|
5
|
+
## Key Classes
|
|
6
|
+
|
|
7
|
+
| Class | File | Purpose |
|
|
8
|
+
|-------|------|---------|
|
|
9
|
+
| SmrtObject | `src/object.ts` | Base persistent object — save, delete, is(), do(), loadFromId/Slug |
|
|
10
|
+
| SmrtCollection | `src/collection.ts` | CRUD collection — list, get, create, delete, getOrUpsert |
|
|
11
|
+
| ObjectRegistry | `src/registry.ts` | Global singleton (globalThis) — class metadata, fields, STI chains, manifests |
|
|
12
|
+
| DispatchBus | `src/dispatch/bus.ts` | Inter-agent messaging — emit, subscribe (persistent), process |
|
|
13
|
+
| GlobalInterceptors | `src/interceptors.ts` | Plugin system — beforeList/Get/Save/Delete hooks (used by tenancy) |
|
|
14
|
+
|
|
15
|
+
## SmrtObject Lifecycle
|
|
16
|
+
|
|
17
|
+
`constructor(options)` → `initialize()` → ready for `save()`/`delete()`/`loadFromId()`
|
|
18
|
+
|
|
19
|
+
- `initialize()`: loads field initializers, applies option values (options override initializers), loads from DB if id/slug provided
|
|
20
|
+
- `save()`: upsert with STI validation, interceptor execution, auto-embeddings. Persisted objects (`isPersisted` — set by DB hydration and successful saves) upsert on `['id']` so natural-key edits (e.g. slug renames) update in place; new objects upsert on the natural-key conflict columns for ingestion-style dedup (#1472)
|
|
21
|
+
- `is(criteria)` / `do(instructions)` / `describe()`: AI operations via function calling. They inject the object's own `toPublicJSON()` (sensitive fields stripped) as a "content body" so the model reasons over the instance. Options: `includeData: false` skips injection (for callers that already curate the relevant fields into the instruction); `maxDataLength` overrides the truncation budget. Neither key is forwarded to `ai.message()`. (#1567)
|
|
22
|
+
- `getSlug()`: auto-generates from name → title → label → id
|
|
23
|
+
- `loadRelated(fieldName)`: lazy-loads relationships (cached in `_loadedRelationships` Map)
|
|
24
|
+
|
|
25
|
+
## SmrtCollection Query
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
await collection.list({
|
|
29
|
+
where: { status: 'active', price: { op: '>', value: 10 } },
|
|
30
|
+
limit: 50, offset: 0, orderBy: 'created_at DESC'
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**WHERE operators**: `=`, `>`, `<`, `>=`, `<=`, `!=`, `in`, `not in`, `like`, `is null`, `is not null`. Arrays auto-detect `IN`. Dot notation for JSON paths: `metadata.userId`.
|
|
35
|
+
|
|
36
|
+
STI child collections auto-filter by `_meta_type`.
|
|
37
|
+
|
|
38
|
+
## @smrt() Decorator Options
|
|
39
|
+
|
|
40
|
+
Key options: `tableName`, `tableStrategy` ('cti'|'sti'), `conflictColumns`, `api`/`mcp`/`cli` (generation config), `ai` (callable methods), `hooks` (beforeSave/afterSave/beforeDelete/afterDelete), `embeddings` (auto-generate), `tenantScoped`, `agent`.
|
|
41
|
+
|
|
42
|
+
Registration sets `SMRT_TABLE_NAME` static property (survives minification).
|
|
43
|
+
|
|
44
|
+
## Domain Knowledge Artifacts
|
|
45
|
+
|
|
46
|
+
`smrtPlugin()` writes runtime manifests and agent/developer knowledge artifacts:
|
|
47
|
+
|
|
48
|
+
- local dev/build: `.smrt/manifest.json` and `.smrt/smrt-knowledge.json`
|
|
49
|
+
- package build: `dist/manifest.json` and `dist/smrt-knowledge.json`
|
|
50
|
+
|
|
51
|
+
Keep `manifest.json` runtime-focused. `smrt-knowledge.json` is the deterministic
|
|
52
|
+
agent contract for downstream review and architecture tools.
|
|
53
|
+
|
|
54
|
+
Config precedence for knowledge is defaults → top-level `knowledge` in
|
|
55
|
+
`smrt.config.ts` → `packages[packageName].knowledge` → plugin option →
|
|
56
|
+
object-level `@smrt({ knowledge })`.
|
|
57
|
+
|
|
58
|
+
Object-level `knowledge: false` excludes an object from authored context only;
|
|
59
|
+
it must not change runtime manifest registration. Use
|
|
60
|
+
`knowledge: { tags, summary, risks }` for review-sensitive domain objects.
|
|
61
|
+
|
|
62
|
+
HTTP knowledge routes are disabled by default. If `knowledge.api.enabled` is
|
|
63
|
+
true, generated SvelteKit routes must stay GET-only and guarded by dev mode or
|
|
64
|
+
admin auth.
|
|
65
|
+
|
|
66
|
+
## DispatchBus
|
|
67
|
+
|
|
68
|
+
- `emit(signalType, payload, metadata)` → creates persistent Dispatch record
|
|
69
|
+
- `on(pattern, handler)` → in-memory handler (immediate)
|
|
70
|
+
- `subscribe({ signalType, subscriber })` → persistent subscription (survives restarts)
|
|
71
|
+
- `process(subscriberName, handler)` → process pending dispatches
|
|
72
|
+
- Wildcards: `campaign.*` matches `campaign.completed` (single segment only)
|
|
73
|
+
- Tables: `_smrt_dispatch`, `_smrt_dispatch_subscriptions`
|
|
74
|
+
- Status: `pending → processing → completed` (or `failed`)
|
|
75
|
+
|
|
76
|
+
## Single Table Inheritance (STI)
|
|
77
|
+
|
|
78
|
+
- Base: `@smrt({ tableStrategy: 'sti' })` — children inherit, share one table
|
|
79
|
+
- Discriminator: `_meta_type` column with qualified names (`@happyvertical/smrt-content:Article`)
|
|
80
|
+
- Child fields: `@meta()` decorator → stored in `_meta_data` JSONB (not as columns)
|
|
81
|
+
- Polymorphic queries: collection loads `_meta_type`, creates correct subclass dynamically
|
|
82
|
+
- Validation: fail-fast on save if `_meta_type` missing or mismatched
|
|
83
|
+
|
|
84
|
+
## Code Generators
|
|
85
|
+
|
|
86
|
+
| Generator | Location | Output |
|
|
87
|
+
|-----------|----------|--------|
|
|
88
|
+
| REST API | `src/generators/rest.ts` | OpenAPI-compliant CRUD endpoints |
|
|
89
|
+
| CLI | `src/generators/cli.ts` | `objectname:action` admin commands — writable allowlist, exhaustive-include, `--from-file`, fail-closed tenant context |
|
|
90
|
+
| MCP Server | `src/generators/mcp.ts` | Model Context Protocol tools |
|
|
91
|
+
|
|
92
|
+
## Child Accessors (R10)
|
|
93
|
+
|
|
94
|
+
`src/child-accessors.ts` installs a consistent `get<FieldName>()` instance method for every `@oneToMany` field at `@smrt()` registration time (e.g. `@oneToMany('OrderItem') items` → `order.getItems()`), delegating to `loadRelatedMany`. Two invariants:
|
|
95
|
+
|
|
96
|
+
- **Additive** — never overwrites a hand-rolled method of the same name (checks the whole prototype chain). `Profile.getMetadata()` (key-value) and `ProfileRelationship.getTerms()` are preserved.
|
|
97
|
+
- **Runtime-only** — attached to the prototype, invisible to the build-time manifest, so it never leaks into the REST/CLI/MCP surface.
|
|
98
|
+
|
|
99
|
+
When the target declares multiple FKs back to the parent, annotate `@oneToMany(Target, { foreignKey: '<inverseField>' })`; `loadRelatedMany` and the eager `include:` loader both honor it (else first-match).
|
|
100
|
+
|
|
101
|
+
## Vite Plugin
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
// vite.config.ts — required for @smrt() decorators
|
|
105
|
+
export default defineConfig({
|
|
106
|
+
esbuild: {
|
|
107
|
+
tsconfigRaw: {
|
|
108
|
+
compilerOptions: { experimentalDecorators: true, emitDecoratorMetadata: true }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Gotchas
|
|
115
|
+
|
|
116
|
+
- **Never override toJSON()** — handles STI discriminator + meta field extraction. Use `transformJSON()`
|
|
117
|
+
- **Property init order**: TypeScript initializers run first, then `initialize()` applies option values (options win)
|
|
118
|
+
- **No runtime schema creation**: application tables must be prepared explicitly via migrations/tooling; runtime only verifies and fails clearly
|
|
119
|
+
- **Retry logic**: `db.get()` (3 retries, 250ms) and `db.upsert()` (3 retries, 500ms) have built-in retry
|
|
120
|
+
- **Field caching**: `_cachedFields` populated during `Collection.create()` — eliminates async `getFields()` per query
|
|
121
|
+
- **Smart cloning**: arrays/objects shallow-cloned in property init to prevent aliasing (Issue #22)
|
|
122
|
+
- **Table verification cache**: `isTableVerified(dbUrl, tableName)` avoids redundant `tableExists()` calls
|
|
123
|
+
- **Manifest required**: build-time AST scanning creates manifest. Without vitest plugin → "No field metadata"
|
|
124
|
+
- **Vite plugin loads scanner from `dist/` first**: `src/vite-plugin/import-build-aware.ts` prefers `dist/` when it exists on disk; it only falls back to `src/` on fresh clones. So if you edit `src/scanner/*.ts` or `src/schema/generator.ts` and want those edits reflected in consumer manifest generation, you must rebuild (`pnpm build` or have `pnpm dev` / `pnpm build:watch` running in core). This is intentional — sniffing `.ts` vs `.js` via `import.meta.url` was non-deterministic under tsx and broke 12–13 publishes (#1139).
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright <2025> <Happy Vertical Corporation>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# @happyvertical/smrt-core
|
|
2
|
+
|
|
3
|
+
ORM, code generation, AI integration, and the DispatchBus. Everything else in the SMRT framework builds on this.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @happyvertical/smrt-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Define a class with `@smrt()`
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { smrt, SmrtObject, SmrtCollection, foreignKey } from '@happyvertical/smrt-core';
|
|
17
|
+
|
|
18
|
+
@smrt({ api: true, cli: true, mcp: true })
|
|
19
|
+
class Product extends SmrtObject {
|
|
20
|
+
name: string = '';
|
|
21
|
+
price: number = 0.0; // DECIMAL (has decimal point)
|
|
22
|
+
quantity: number = 0; // INTEGER (no decimal point)
|
|
23
|
+
isPublished: boolean = false;
|
|
24
|
+
categoryId = foreignKey(Category);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class ProductCollection extends SmrtCollection<Product> {
|
|
28
|
+
static readonly _itemClass = Product;
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Basic CRUD
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
const products = await ProductCollection.create({ db: 'products.db' });
|
|
36
|
+
|
|
37
|
+
// Create
|
|
38
|
+
const product = await products.create({ name: 'Widget', price: 9.99 });
|
|
39
|
+
await product.save();
|
|
40
|
+
|
|
41
|
+
// Query
|
|
42
|
+
const results = await products.list({
|
|
43
|
+
where: { isPublished: true, price: { op: '>', value: 5 } },
|
|
44
|
+
orderBy: 'price DESC',
|
|
45
|
+
limit: 20,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// AI operations
|
|
49
|
+
const isExpensive = await product.is('costs more than the average product');
|
|
50
|
+
const description = await product.do('Write a short marketing description');
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Opt-In Read Cache
|
|
54
|
+
|
|
55
|
+
SSR apps that re-query read-heavy / write-rare collections on every request
|
|
56
|
+
can memoize `list()` and `get()` results with an opt-in TTL. Defaults are
|
|
57
|
+
off — nothing is cached unless a call or model opts in.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
// Per call
|
|
61
|
+
const published = await resumes.list({
|
|
62
|
+
where: { status: 'published' },
|
|
63
|
+
cache: { ttl: 60_000 },
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Per model — list()/get() on this collection cache by default
|
|
67
|
+
@smrt({ cache: { ttl: 60_000 } })
|
|
68
|
+
class Resume extends SmrtObject {}
|
|
69
|
+
|
|
70
|
+
// Force a fresh read on hot paths that must read through
|
|
71
|
+
const latest = await resumes.list({ cache: false });
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Because SMRT owns every mutation path (`save()`, `delete()`,
|
|
75
|
+
`collection.create()`, `getOrUpsert()`, junction attach/detach), any write
|
|
76
|
+
automatically invalidates the affected table's cached entries in-process —
|
|
77
|
+
including STI siblings sharing the table. Cached values are raw rows:
|
|
78
|
+
hydration and read interceptors (tenancy, audit) still run on every call.
|
|
79
|
+
|
|
80
|
+
Caches are per-process. For multi-replica deployments, add
|
|
81
|
+
`crossProcess: true` to broadcast invalidations over the database adapter's
|
|
82
|
+
notification capability (e.g. Postgres LISTEN/NOTIFY) so peers drop their
|
|
83
|
+
entries immediately instead of waiting out the TTL:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
@smrt({ cache: { ttl: 60_000, crossProcess: true } })
|
|
87
|
+
class Resume extends SmrtObject {}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Model-level config is the reliable cross-process opt-in: every process
|
|
91
|
+
writing the model knows to broadcast, and STI children writing the shared
|
|
92
|
+
table broadcast even if they opted out of caching their own reads. As a
|
|
93
|
+
per-call option (`list({ cache: { ttl, crossProcess: true } })`), writes
|
|
94
|
+
broadcast only from processes that have already performed such a read —
|
|
95
|
+
typical for homogeneous replicas running the same routes, but a
|
|
96
|
+
write-only process never learns about a call-site opt-in.
|
|
97
|
+
|
|
98
|
+
Writes that bypass SMRT (raw SQL, external processes without
|
|
99
|
+
`crossProcess`) are only bounded by the TTL — pick one that matches how
|
|
100
|
+
stale the data may be.
|
|
101
|
+
|
|
102
|
+
### Bundled Runtimes And External Manifests
|
|
103
|
+
|
|
104
|
+
Long-lived bundled runtimes such as SvelteKit servers, background workers, and
|
|
105
|
+
CLI entrypoints should ship two things together:
|
|
106
|
+
|
|
107
|
+
1. The generated `smrt-register` runtime entrypoint for local class
|
|
108
|
+
registration.
|
|
109
|
+
2. The `manifest.json` exports for any installed external `@happyvertical/smrt-*`
|
|
110
|
+
packages the runtime needs to hydrate at query time.
|
|
111
|
+
|
|
112
|
+
`ObjectRegistry.ensureManifestLoaded()` can now auto-load installed external
|
|
113
|
+
classes by either simple name (`'EventType'`) or qualified name
|
|
114
|
+
(`'@happyvertical/smrt-events:EventType'`). `SmrtCollection.list()` and
|
|
115
|
+
`SmrtCollection.get()` use that path when they encounter STI discriminators from
|
|
116
|
+
external packages, so bundled runtimes do not need to import every child class
|
|
117
|
+
eagerly just to hydrate rows correctly.
|
|
118
|
+
|
|
119
|
+
If you want to avoid on-demand manifest discovery in a long-lived process, call
|
|
120
|
+
`ObjectRegistry.loadAllManifests()` during startup after your local registration
|
|
121
|
+
file has run.
|
|
122
|
+
|
|
123
|
+
## API
|
|
124
|
+
|
|
125
|
+
### Core Classes
|
|
126
|
+
|
|
127
|
+
| Export | Description |
|
|
128
|
+
|--------|------------|
|
|
129
|
+
| `SmrtClass` | Base class with DB, AI, and filesystem access |
|
|
130
|
+
| `SmrtObject` | Persistent object — save, delete, is(), do() |
|
|
131
|
+
| `SmrtCollection` | CRUD collection — list, get, create, upsert |
|
|
132
|
+
| `ObjectRegistry` | Global singleton for class/field metadata |
|
|
133
|
+
| `smrt` (decorator) | Registers a class for code generation and AI |
|
|
134
|
+
|
|
135
|
+
### Field Decorators
|
|
136
|
+
|
|
137
|
+
| Export | Description |
|
|
138
|
+
|--------|------------|
|
|
139
|
+
| `field` | General-purpose field decorator |
|
|
140
|
+
| `foreignKey` | Foreign key relationship |
|
|
141
|
+
| `oneToMany` | One-to-many relationship |
|
|
142
|
+
| `manyToMany` | Many-to-many relationship |
|
|
143
|
+
| `meta` | STI child field stored in `_meta_data` JSONB |
|
|
144
|
+
|
|
145
|
+
### Dispatch (Inter-Agent Messaging)
|
|
146
|
+
|
|
147
|
+
| Export | Description |
|
|
148
|
+
|--------|------------|
|
|
149
|
+
| `DispatchBus` | Persistent message bus with wildcard subscriptions |
|
|
150
|
+
| `createDispatchBus` | Factory function for DispatchBus |
|
|
151
|
+
| `Dispatch` | Dispatch record model |
|
|
152
|
+
| `DispatchSubscription` | Persistent subscription model |
|
|
153
|
+
|
|
154
|
+
### Code Generators
|
|
155
|
+
|
|
156
|
+
| Export | Description |
|
|
157
|
+
|--------|------------|
|
|
158
|
+
| `APIGenerator` | Generates OpenAPI-compliant REST endpoints |
|
|
159
|
+
| `MCPGenerator` | Generates Model Context Protocol tool servers |
|
|
160
|
+
| `createRestServer` | Creates an Express REST server from config |
|
|
161
|
+
| `generateOpenAPISpec` | Generates OpenAPI/Swagger spec |
|
|
162
|
+
|
|
163
|
+
### Embeddings (Semantic Search)
|
|
164
|
+
|
|
165
|
+
| Export | Description |
|
|
166
|
+
|--------|------------|
|
|
167
|
+
| `EmbeddingProvider` | Generates embeddings via AI provider |
|
|
168
|
+
| `EmbeddingStorage` | Persists/queries embedding vectors |
|
|
169
|
+
| `CosineSimilarity` | Ranks results by vector similarity |
|
|
170
|
+
| `ContentHasher` | Content hashing for change detection |
|
|
171
|
+
|
|
172
|
+
### Signals (Observability)
|
|
173
|
+
|
|
174
|
+
| Export | Description |
|
|
175
|
+
|--------|------------|
|
|
176
|
+
| `SignalBus` | Universal method-tracking event bus |
|
|
177
|
+
| `SignalSanitizer` | Sanitizes sensitive data in signals |
|
|
178
|
+
| `MetricsAdapter` | Prometheus-compatible metrics adapter |
|
|
179
|
+
| `PubSubAdapter` | Broadcast signals to subscribers |
|
|
180
|
+
|
|
181
|
+
### Manifest (Build-Time Metadata)
|
|
182
|
+
|
|
183
|
+
| Export | Description |
|
|
184
|
+
|--------|------------|
|
|
185
|
+
| `ManifestManager` | Reads, writes, and generates manifests |
|
|
186
|
+
| `ManifestBuilder` | Orchestrates scanning to manifest |
|
|
187
|
+
| `ManifestGenerator` | Converts scan results to manifest format |
|
|
188
|
+
| `getManifest` | Async getter for static manifest data |
|
|
189
|
+
|
|
190
|
+
### Runtime
|
|
191
|
+
|
|
192
|
+
| Export | Description |
|
|
193
|
+
|--------|------------|
|
|
194
|
+
| `createMCPServer` / `SmrtMCPServer` | MCP server runtime |
|
|
195
|
+
| `createSmrtServer` | REST server runtime |
|
|
196
|
+
| `createSmrtClient` | API client runtime |
|
|
197
|
+
|
|
198
|
+
### Schema & Migrations
|
|
199
|
+
|
|
200
|
+
| Export | Description |
|
|
201
|
+
|--------|------------|
|
|
202
|
+
| `SchemaComparer` | Compares current vs. desired schema |
|
|
203
|
+
| `generateSchemaDiff` | Produces a diff between two schemas |
|
|
204
|
+
| `getSQLFromDiff` | Converts schema diff to SQL statements |
|
|
205
|
+
|
|
206
|
+
### Interceptors
|
|
207
|
+
|
|
208
|
+
| Export | Description |
|
|
209
|
+
|--------|------------|
|
|
210
|
+
| `GlobalInterceptors` | Plugin hooks for beforeList/Get/Save/Delete |
|
|
211
|
+
| `createInterceptorContext` | Creates context for interceptor execution |
|
|
212
|
+
|
|
213
|
+
### Errors
|
|
214
|
+
|
|
215
|
+
| Export | Description |
|
|
216
|
+
|--------|------------|
|
|
217
|
+
| `SmrtError` | Abstract base error class |
|
|
218
|
+
| `DatabaseError` | Database operation failures |
|
|
219
|
+
| `AIError` | AI provider failures |
|
|
220
|
+
| `ValidationError` | Field/object validation failures |
|
|
221
|
+
| `RuntimeError` | General runtime failures |
|
|
222
|
+
| `ErrorUtils` | Sanitization and formatting helpers |
|
|
223
|
+
|
|
224
|
+
### Tools (AI Function Calling)
|
|
225
|
+
|
|
226
|
+
| Export | Description |
|
|
227
|
+
|--------|------------|
|
|
228
|
+
| `generateToolManifest` | Generates AI tool definitions from methods |
|
|
229
|
+
| `executeToolCall` / `executeToolCalls` | Executes AI tool calls |
|
|
230
|
+
|
|
231
|
+
### Utilities
|
|
232
|
+
|
|
233
|
+
| Export | Description |
|
|
234
|
+
|--------|------------|
|
|
235
|
+
| `config` | Global SMRT configuration function |
|
|
236
|
+
| `resolveDatabase` | Resolves DB config to a DatabaseInterface |
|
|
237
|
+
| `smrtPlugin` | Vite plugin for auto-service generation |
|
|
238
|
+
| `generateSvelteKitRoutes` | SvelteKit route generator |
|
|
239
|
+
| `resetVerifiedTables` | Resets table verification cache (testing) |
|
|
240
|
+
| `getTestDatabase` | Creates isolated test databases |
|
|
241
|
+
| `parse` / `stringify` / `clone` | JSON utilities with optional SIMD |
|
|
242
|
+
| `createQualifiedName` / `parseQualifiedName` | STI qualified name helpers |
|
|
243
|
+
|
|
244
|
+
## Code Generation
|
|
245
|
+
|
|
246
|
+
The `@smrt()` decorator controls what gets generated. Set `api`, `cli`, or `mcp` to `true` or `{ include: [...] }`:
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
@smrt({
|
|
250
|
+
api: { include: ['list', 'get', 'create'] },
|
|
251
|
+
mcp: true,
|
|
252
|
+
cli: true,
|
|
253
|
+
})
|
|
254
|
+
class Product extends SmrtObject { /* ... */ }
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Generators produce OpenAPI REST endpoints, Commander CLI commands, and MCP server tools respectively. The Vite plugin (`smrtPlugin`) generates virtual modules at dev time for routes, clients, and manifests.
|
|
258
|
+
|
|
259
|
+
## Dependencies
|
|
260
|
+
|
|
261
|
+
- `@happyvertical/ai` -- AI client (is/do operations, embeddings)
|
|
262
|
+
- `@happyvertical/sql` -- Database interface (SQLite, PostgreSQL)
|
|
263
|
+
- `@happyvertical/files` -- Filesystem adapter
|
|
264
|
+
- `@happyvertical/logger` -- Structured logging
|
|
265
|
+
- `@happyvertical/smrt-types` -- Shared type definitions
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
import { dirname, resolve } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
9
|
+
const distEntry = resolve(packageRoot, 'dist/prebuild/cli.js');
|
|
10
|
+
const sourceEntry = resolve(packageRoot, 'src/prebuild/cli.ts');
|
|
11
|
+
|
|
12
|
+
const command = existsSync(distEntry)
|
|
13
|
+
? [distEntry, ...process.argv.slice(2)]
|
|
14
|
+
: ['--import', 'tsx', sourceEntry, ...process.argv.slice(2)];
|
|
15
|
+
|
|
16
|
+
const result = spawnSync(process.execPath, command, { stdio: 'inherit' });
|
|
17
|
+
|
|
18
|
+
if (result.error) {
|
|
19
|
+
throw result.error;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (result.signal) {
|
|
23
|
+
process.kill(process.pid, result.signal);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SmrtObject } from '../../object.js';
|
|
2
|
+
/**
|
|
3
|
+
* Rich object: object-form api/mcp with include lists, cli enabled, hooks,
|
|
4
|
+
* a custom method, and fields carrying constraints (min/max/maxLength).
|
|
5
|
+
*/
|
|
6
|
+
export declare class AdvisorRichProduct extends SmrtObject {
|
|
7
|
+
title: string;
|
|
8
|
+
quantity: number;
|
|
9
|
+
rate: number;
|
|
10
|
+
/** A custom domain method that should surface in get-object-config. */
|
|
11
|
+
recalculate(): Promise<number>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Boolean-config object: api/mcp enabled via `true`, cli disabled. Exercises
|
|
15
|
+
* the boolean branches in list-registered-objects and get-object-config.
|
|
16
|
+
*/
|
|
17
|
+
export declare class AdvisorBooleanWidget extends SmrtObject {
|
|
18
|
+
label: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Exclude-config object: api/mcp use `exclude` lists. Exercises the
|
|
22
|
+
* preview-api-endpoints exclusion path and the `exclude !== undefined`
|
|
23
|
+
* enabled-detection branch.
|
|
24
|
+
*/
|
|
25
|
+
export declare class AdvisorExcludeNote extends SmrtObject {
|
|
26
|
+
body: string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=advisor-test-classes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advisor-test-classes.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/advisor-test-classes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;GAGG;AACH,qBASa,kBAAmB,SAAQ,UAAU;IAMhD,KAAK,EAAE,MAAM,CAAM;IAGnB,QAAQ,EAAE,MAAM,CAAK;IAGrB,IAAI,EAAE,MAAM,CAAO;IAEnB,uEAAuE;IACjE,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;CAGrC;AAED;;;GAGG;AACH,qBAKa,oBAAqB,SAAQ,UAAU;IAElD,KAAK,EAAE,MAAM,CAAM;CACpB;AAED;;;;GAIG;AACH,qBAIa,kBAAmB,SAAQ,UAAU;IAEhD,IAAI,EAAE,MAAM,CAAM;CACnB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SmrtCollection } from '../../collection.js';
|
|
2
|
+
import { SmrtObject } from '../../object.js';
|
|
3
|
+
export declare class CovWidget extends SmrtObject {
|
|
4
|
+
name: string;
|
|
5
|
+
price: number;
|
|
6
|
+
category: string;
|
|
7
|
+
inStock: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class CovWidgetCollection extends SmrtCollection<CovWidget> {
|
|
10
|
+
static readonly _itemClass: typeof CovWidget;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=collection-coverage-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-coverage-fixtures.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/collection-coverage-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,qBACa,SAAU,SAAQ,UAAU;IACvC,IAAI,EAAE,MAAM,CAAM;IAClB,KAAK,EAAE,MAAM,CAAO;IACpB,QAAQ,EAAE,MAAM,CAAM;IACtB,OAAO,EAAE,OAAO,CAAQ;CACzB;AAED,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,SAAS,CAAC;IAChE,MAAM,CAAC,QAAQ,CAAC,UAAU,mBAAa;CACxC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SmrtHierarchical } from '../../hierarchical.js';
|
|
2
|
+
import { SmrtObject } from '../../object.js';
|
|
3
|
+
export declare class IRBase extends SmrtObject {
|
|
4
|
+
baseTitle: string;
|
|
5
|
+
shared: string;
|
|
6
|
+
baseMethod(): Promise<string>;
|
|
7
|
+
}
|
|
8
|
+
export declare class IRMiddle extends IRBase {
|
|
9
|
+
middleField: string;
|
|
10
|
+
middleMethod(): Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
export declare class IRLeaf extends IRMiddle {
|
|
13
|
+
leafField: string;
|
|
14
|
+
baseMethod(): Promise<string>;
|
|
15
|
+
}
|
|
16
|
+
export declare class IRConstraintParent extends SmrtObject {
|
|
17
|
+
amount: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class IRConstraintChild extends IRConstraintParent {
|
|
20
|
+
amount: number;
|
|
21
|
+
}
|
|
22
|
+
export declare class IRTreeNode extends SmrtHierarchical {
|
|
23
|
+
label: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class IRSolo extends SmrtObject {
|
|
26
|
+
soloField: string;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=inheritance-resolver-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritance-resolver-fixtures.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/inheritance-resolver-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,qBACa,MAAO,SAAQ,UAAU;IACpC,SAAS,EAAE,MAAM,CAAM;IACvB,MAAM,EAAE,MAAM,CAAM;IAEd,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;CAGpC;AAED,qBACa,QAAS,SAAQ,MAAM;IAClC,WAAW,EAAE,MAAM,CAAM;IAEnB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;CAGtC;AAED,qBACa,MAAO,SAAQ,QAAQ;IAClC,SAAS,EAAE,MAAM,CAAM;IAGjB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;CAGpC;AAGD,qBACa,kBAAmB,SAAQ,UAAU;IAEhD,MAAM,EAAE,MAAM,CAAK;CACpB;AAED,qBACa,iBAAkB,SAAQ,kBAAkB;IAEvD,MAAM,EAAE,MAAM,CAAK;CACpB;AAKD,qBACa,UAAW,SAAQ,gBAAgB;IAC9C,KAAK,EAAE,MAAM,CAAM;CACpB;AAGD,qBACa,MAAO,SAAQ,UAAU;IACpC,SAAS,EAAE,MAAM,CAAM;CACxB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SmrtObject } from '../../object.js';
|
|
2
|
+
export declare class InheritanceTestContent extends SmrtObject {
|
|
3
|
+
title: string;
|
|
4
|
+
body: string;
|
|
5
|
+
publishedAt: Date | null;
|
|
6
|
+
wordCount: number;
|
|
7
|
+
generateSummary(): Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
export declare class InheritanceTestPraecoContent extends InheritanceTestContent {
|
|
10
|
+
praecoCustom1: string;
|
|
11
|
+
sourceUrl: string;
|
|
12
|
+
rating: number;
|
|
13
|
+
analyzeSentiment(): Promise<string>;
|
|
14
|
+
}
|
|
15
|
+
export declare class InheritanceTestBentleyContent extends InheritanceTestPraecoContent {
|
|
16
|
+
bentleyCustom1: string;
|
|
17
|
+
localTags: string[];
|
|
18
|
+
analyzeLocal(): Promise<string>;
|
|
19
|
+
}
|
|
20
|
+
export declare class ParentWithConstraints extends SmrtObject {
|
|
21
|
+
age: number;
|
|
22
|
+
score: number;
|
|
23
|
+
}
|
|
24
|
+
export declare class ChildWithConstraints extends ParentWithConstraints {
|
|
25
|
+
age: number;
|
|
26
|
+
score: number;
|
|
27
|
+
}
|
|
28
|
+
export declare class ParentTypeMismatch extends SmrtObject {
|
|
29
|
+
myField: string;
|
|
30
|
+
}
|
|
31
|
+
export declare class ChildTypeMismatch extends ParentTypeMismatch {
|
|
32
|
+
myField: number;
|
|
33
|
+
}
|
|
34
|
+
export declare class ParentWithMethod extends SmrtObject {
|
|
35
|
+
doSomething(): Promise<string>;
|
|
36
|
+
}
|
|
37
|
+
export declare class ChildWithMethod extends ParentWithMethod {
|
|
38
|
+
doSomething(): Promise<string>;
|
|
39
|
+
}
|
|
40
|
+
export declare class OrphanClass extends SmrtObject {
|
|
41
|
+
orphanField: string;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=inheritance-test-classes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritance-test-classes.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/inheritance-test-classes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,qBACa,sBAAuB,SAAQ,UAAU;IACpD,KAAK,EAAE,MAAM,CAAM;IACnB,IAAI,EAAE,MAAM,CAAM;IAClB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAQ;IAChC,SAAS,EAAE,MAAM,CAAK;IAEhB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;CAGzC;AAGD,qBACa,4BAA6B,SAAQ,sBAAsB;IACtE,aAAa,EAAE,MAAM,CAAM;IAC3B,SAAS,EAAE,MAAM,CAAM;IACvB,MAAM,EAAE,MAAM,CAAO;IAEf,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;CAG1C;AAGD,qBACa,6BAA8B,SAAQ,4BAA4B;IAC7E,cAAc,EAAE,MAAM,CAAM;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAM;IAEnB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;CAGtC;AAGD,qBACa,qBAAsB,SAAQ,UAAU;IAEnD,GAAG,EAAE,MAAM,CAAK;IAGhB,KAAK,EAAE,MAAM,CAAO;CACrB;AAED,qBACa,oBAAqB,SAAQ,qBAAqB;IAG7D,GAAG,EAAE,MAAM,CAAK;IAGhB,KAAK,EAAE,MAAM,CAAO;CACrB;AAGD,qBACa,kBAAmB,SAAQ,UAAU;IAChD,OAAO,EAAE,MAAM,CAAM;CACtB;AAED,qBACa,iBAAkB,SAAQ,kBAAkB;IAGvD,OAAO,EAAE,MAAM,CAAK;CACrB;AAGD,qBACa,gBAAiB,SAAQ,UAAU;IACxC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;CAGrC;AAED,qBACa,eAAgB,SAAQ,gBAAgB;IAC7C,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;CAGrC;AAGD,qBACa,WAAY,SAAQ,UAAU;IACzC,WAAW,EAAE,MAAM,CAAM;CAC1B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SmrtCollection } from '../../collection.js';
|
|
2
|
+
import { SmrtObject } from '../../object.js';
|
|
3
|
+
export declare class McpIntegrationTestProduct extends SmrtObject {
|
|
4
|
+
name: string;
|
|
5
|
+
price: number;
|
|
6
|
+
stock: number;
|
|
7
|
+
analyze(options?: any): Promise<{
|
|
8
|
+
action: string;
|
|
9
|
+
product: string;
|
|
10
|
+
price: number;
|
|
11
|
+
inStock: boolean;
|
|
12
|
+
timestamp: Date;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export declare class McpIntegrationTestProductCollection extends SmrtCollection<McpIntegrationTestProduct> {
|
|
16
|
+
static readonly _itemClass: typeof McpIntegrationTestProduct;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=mcp-integration-test-classes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-integration-test-classes.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/mcp-integration-test-classes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,qBAKa,yBAA0B,SAAQ,UAAU;IAEvD,IAAI,EAAE,MAAM,CAAM;IAGlB,KAAK,EAAE,MAAM,CAAO;IAGpB,KAAK,EAAE,MAAM,CAAK;IAEZ,OAAO,CAAC,OAAO,GAAE,GAAQ;;;;;;;CAShC;AAED,qBAAa,mCAAoC,SAAQ,cAAc,CAAC,yBAAyB,CAAC;IAChG,MAAM,CAAC,QAAQ,CAAC,UAAU,mCAA6B;CACxD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SmrtObject } from '../../object.js';
|
|
2
|
+
/** Minimal stub matching the slice of AIClient that is()/do()/describe() use. */
|
|
3
|
+
export interface StubAi {
|
|
4
|
+
message: (prompt: string, options?: any) => Promise<string>;
|
|
5
|
+
}
|
|
6
|
+
export declare class ObjectAiMemoryNode extends SmrtObject {
|
|
7
|
+
name: string;
|
|
8
|
+
/** Test seam: set this to control what the AI returns. */
|
|
9
|
+
stubAi?: StubAi;
|
|
10
|
+
/** Capture the last prompt/options passed to the stub for assertions. */
|
|
11
|
+
lastPrompt?: string;
|
|
12
|
+
lastOptions?: any;
|
|
13
|
+
protected getAiClient(): Promise<any>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=object-ai-memory-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-ai-memory-fixtures.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/object-ai-memory-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,iFAAiF;AACjF,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7D;AAED,qBACa,kBAAmB,SAAQ,UAAU;IAChD,IAAI,EAAE,MAAM,CAAM;IAElB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,GAAG,CAAC;cAIF,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;CAa5C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SmrtObject } from '../../object.js';
|
|
2
|
+
export declare class TestObject extends SmrtObject {
|
|
3
|
+
static tableName: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
active: boolean;
|
|
7
|
+
count: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class ObjectSpecTestCouncil extends SmrtObject {
|
|
10
|
+
name: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=object-spec-test-classes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-spec-test-classes.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/object-spec-test-classes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,qBACa,UAAW,SAAQ,UAAU;IACxC,MAAM,CAAC,SAAS,SAAkB;IAGlC,IAAI,EAAE,MAAM,CAAM;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAS;IACxB,KAAK,EAAE,MAAM,CAAK;CACnB;AAGD,qBACa,qBAAsB,SAAQ,UAAU;IACnD,IAAI,EAAE,MAAM,CAAM;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SmrtObject } from '../../object.js';
|
|
2
|
+
export declare class TestCategory extends SmrtObject {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class TestCustomer extends SmrtObject {
|
|
7
|
+
name: string;
|
|
8
|
+
email: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class RegistryTestProduct extends SmrtObject {
|
|
11
|
+
name: string;
|
|
12
|
+
price: number;
|
|
13
|
+
categoryId: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class TestOrder extends SmrtObject {
|
|
16
|
+
customerId: string;
|
|
17
|
+
productId: string;
|
|
18
|
+
total: number;
|
|
19
|
+
}
|
|
20
|
+
export declare class OverwriteTestObject extends SmrtObject {
|
|
21
|
+
name: string;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=registry-test-classes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-test-classes.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/registry-test-classes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,qBACa,YAAa,SAAQ,UAAU;IAC1C,IAAI,EAAE,MAAM,CAAM;IAClB,WAAW,EAAE,MAAM,CAAM;CAC1B;AAED,qBACa,YAAa,SAAQ,UAAU;IAC1C,IAAI,EAAE,MAAM,CAAM;IAClB,KAAK,EAAE,MAAM,CAAM;CACpB;AAED,qBACa,mBAAoB,SAAQ,UAAU;IACjD,IAAI,EAAE,MAAM,CAAM;IAClB,KAAK,EAAE,MAAM,CAAK;IAClB,UAAU,EAAE,MAAM,CAAM;CACzB;AAED,qBACa,SAAU,SAAQ,UAAU;IACvC,UAAU,EAAE,MAAM,CAAM;IACxB,SAAS,EAAE,MAAM,CAAM;IACvB,KAAK,EAAE,MAAM,CAAK;CACnB;AAGD,qBACa,mBAAoB,SAAQ,UAAU;IAGjD,IAAI,EAAE,MAAM,CAAM;CACnB"}
|