@angriff36/manifest 2.18.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/LICENSE +21 -0
- package/README.md +476 -0
- package/dist/manifest/agent-sdk/agent-runtime.d.ts +30 -0
- package/dist/manifest/agent-sdk/agent-runtime.d.ts.map +1 -0
- package/dist/manifest/agent-sdk/agent-runtime.js +232 -0
- package/dist/manifest/agent-sdk/agent-runtime.js.map +1 -0
- package/dist/manifest/agent-sdk/index.d.ts +17 -0
- package/dist/manifest/agent-sdk/index.d.ts.map +1 -0
- package/dist/manifest/agent-sdk/index.js +21 -0
- package/dist/manifest/agent-sdk/index.js.map +1 -0
- package/dist/manifest/agent-sdk/intent-mapper.d.ts +17 -0
- package/dist/manifest/agent-sdk/intent-mapper.d.ts.map +1 -0
- package/dist/manifest/agent-sdk/intent-mapper.js +115 -0
- package/dist/manifest/agent-sdk/intent-mapper.js.map +1 -0
- package/dist/manifest/agent-sdk/introspect.d.ts +42 -0
- package/dist/manifest/agent-sdk/introspect.d.ts.map +1 -0
- package/dist/manifest/agent-sdk/introspect.js +284 -0
- package/dist/manifest/agent-sdk/introspect.js.map +1 -0
- package/dist/manifest/agent-sdk/json-schema.d.ts +29 -0
- package/dist/manifest/agent-sdk/json-schema.d.ts.map +1 -0
- package/dist/manifest/agent-sdk/json-schema.js +132 -0
- package/dist/manifest/agent-sdk/json-schema.js.map +1 -0
- package/dist/manifest/agent-sdk/tool-definitions.d.ts +41 -0
- package/dist/manifest/agent-sdk/tool-definitions.d.ts.map +1 -0
- package/dist/manifest/agent-sdk/tool-definitions.js +288 -0
- package/dist/manifest/agent-sdk/tool-definitions.js.map +1 -0
- package/dist/manifest/agent-sdk/types.d.ts +293 -0
- package/dist/manifest/agent-sdk/types.d.ts.map +1 -0
- package/dist/manifest/agent-sdk/types.js +6 -0
- package/dist/manifest/agent-sdk/types.js.map +1 -0
- package/dist/manifest/api-diagnostics.d.ts +41 -0
- package/dist/manifest/api-diagnostics.d.ts.map +1 -0
- package/dist/manifest/api-diagnostics.js +105 -0
- package/dist/manifest/api-diagnostics.js.map +1 -0
- package/dist/manifest/approval/approval-store.d.ts +52 -0
- package/dist/manifest/approval/approval-store.d.ts.map +1 -0
- package/dist/manifest/approval/approval-store.js +25 -0
- package/dist/manifest/approval/approval-store.js.map +1 -0
- package/dist/manifest/approval/stores/memory.d.ts +33 -0
- package/dist/manifest/approval/stores/memory.d.ts.map +1 -0
- package/dist/manifest/approval/stores/memory.js +56 -0
- package/dist/manifest/approval/stores/memory.js.map +1 -0
- package/dist/manifest/approval/stores/postgres.d.ts +41 -0
- package/dist/manifest/approval/stores/postgres.d.ts.map +1 -0
- package/dist/manifest/approval/stores/postgres.js +124 -0
- package/dist/manifest/approval/stores/postgres.js.map +1 -0
- package/dist/manifest/audit/audit-sink.d.ts +53 -0
- package/dist/manifest/audit/audit-sink.d.ts.map +1 -0
- package/dist/manifest/audit/audit-sink.js +15 -0
- package/dist/manifest/audit/audit-sink.js.map +1 -0
- package/dist/manifest/audit/sinks/memory.d.ts +50 -0
- package/dist/manifest/audit/sinks/memory.d.ts.map +1 -0
- package/dist/manifest/audit/sinks/memory.js +66 -0
- package/dist/manifest/audit/sinks/memory.js.map +1 -0
- package/dist/manifest/audit/sinks/postgres.d.ts +31 -0
- package/dist/manifest/audit/sinks/postgres.d.ts.map +1 -0
- package/dist/manifest/audit/sinks/postgres.js +67 -0
- package/dist/manifest/audit/sinks/postgres.js.map +1 -0
- package/dist/manifest/binary-ir.d.ts +76 -0
- package/dist/manifest/binary-ir.d.ts.map +1 -0
- package/dist/manifest/binary-ir.js +124 -0
- package/dist/manifest/binary-ir.js.map +1 -0
- package/dist/manifest/breaking-change.d.ts +75 -0
- package/dist/manifest/breaking-change.d.ts.map +1 -0
- package/dist/manifest/breaking-change.js +704 -0
- package/dist/manifest/breaking-change.js.map +1 -0
- package/dist/manifest/compiler.d.ts +12 -0
- package/dist/manifest/compiler.d.ts.map +1 -0
- package/dist/manifest/compiler.js +23 -0
- package/dist/manifest/compiler.js.map +1 -0
- package/dist/manifest/config.d.ts +171 -0
- package/dist/manifest/config.d.ts.map +1 -0
- package/dist/manifest/config.js +65 -0
- package/dist/manifest/config.js.map +1 -0
- package/dist/manifest/constraint-analysis.d.ts +122 -0
- package/dist/manifest/constraint-analysis.d.ts.map +1 -0
- package/dist/manifest/constraint-analysis.js +340 -0
- package/dist/manifest/constraint-analysis.js.map +1 -0
- package/dist/manifest/date-time.d.ts +13 -0
- package/dist/manifest/date-time.d.ts.map +1 -0
- package/dist/manifest/date-time.js +60 -0
- package/dist/manifest/date-time.js.map +1 -0
- package/dist/manifest/debug/command-trace.d.ts +37 -0
- package/dist/manifest/debug/command-trace.d.ts.map +1 -0
- package/dist/manifest/debug/command-trace.js +51 -0
- package/dist/manifest/debug/command-trace.js.map +1 -0
- package/dist/manifest/debug/index.d.ts +3 -0
- package/dist/manifest/debug/index.d.ts.map +1 -0
- package/dist/manifest/debug/index.js +2 -0
- package/dist/manifest/debug/index.js.map +1 -0
- package/dist/manifest/domain-completeness.d.ts +13 -0
- package/dist/manifest/domain-completeness.d.ts.map +1 -0
- package/dist/manifest/domain-completeness.js +245 -0
- package/dist/manifest/domain-completeness.js.map +1 -0
- package/dist/manifest/entity-composition.d.ts +24 -0
- package/dist/manifest/entity-composition.d.ts.map +1 -0
- package/dist/manifest/entity-composition.js +157 -0
- package/dist/manifest/entity-composition.js.map +1 -0
- package/dist/manifest/examples.d.ts +6 -0
- package/dist/manifest/examples.d.ts.map +1 -0
- package/dist/manifest/examples.js +443 -0
- package/dist/manifest/examples.js.map +1 -0
- package/dist/manifest/federation/client.d.ts +52 -0
- package/dist/manifest/federation/client.d.ts.map +1 -0
- package/dist/manifest/federation/client.js +152 -0
- package/dist/manifest/federation/client.js.map +1 -0
- package/dist/manifest/federation/descriptor.d.ts +25 -0
- package/dist/manifest/federation/descriptor.d.ts.map +1 -0
- package/dist/manifest/federation/descriptor.js +97 -0
- package/dist/manifest/federation/descriptor.js.map +1 -0
- package/dist/manifest/federation/http-adapter.d.ts +26 -0
- package/dist/manifest/federation/http-adapter.d.ts.map +1 -0
- package/dist/manifest/federation/http-adapter.js +209 -0
- package/dist/manifest/federation/http-adapter.js.map +1 -0
- package/dist/manifest/federation/index.d.ts +51 -0
- package/dist/manifest/federation/index.d.ts.map +1 -0
- package/dist/manifest/federation/index.js +49 -0
- package/dist/manifest/federation/index.js.map +1 -0
- package/dist/manifest/federation/policy-bridge.d.ts +51 -0
- package/dist/manifest/federation/policy-bridge.d.ts.map +1 -0
- package/dist/manifest/federation/policy-bridge.js +122 -0
- package/dist/manifest/federation/policy-bridge.js.map +1 -0
- package/dist/manifest/federation/registry.d.ts +88 -0
- package/dist/manifest/federation/registry.d.ts.map +1 -0
- package/dist/manifest/federation/registry.js +165 -0
- package/dist/manifest/federation/registry.js.map +1 -0
- package/dist/manifest/federation/types.d.ts +209 -0
- package/dist/manifest/federation/types.d.ts.map +1 -0
- package/dist/manifest/federation/types.js +13 -0
- package/dist/manifest/federation/types.js.map +1 -0
- package/dist/manifest/generator.d.ts +44 -0
- package/dist/manifest/generator.d.ts.map +1 -0
- package/dist/manifest/generator.js +899 -0
- package/dist/manifest/generator.js.map +1 -0
- package/dist/manifest/ir-cache.d.ts +48 -0
- package/dist/manifest/ir-cache.d.ts.map +1 -0
- package/dist/manifest/ir-cache.js +91 -0
- package/dist/manifest/ir-cache.js.map +1 -0
- package/dist/manifest/ir-compiler.d.ts +135 -0
- package/dist/manifest/ir-compiler.d.ts.map +1 -0
- package/dist/manifest/ir-compiler.js +1477 -0
- package/dist/manifest/ir-compiler.js.map +1 -0
- package/dist/manifest/ir-diff.d.ts +266 -0
- package/dist/manifest/ir-diff.d.ts.map +1 -0
- package/dist/manifest/ir-diff.js +731 -0
- package/dist/manifest/ir-diff.js.map +1 -0
- package/dist/manifest/ir-version-store.d.ts +109 -0
- package/dist/manifest/ir-version-store.d.ts.map +1 -0
- package/dist/manifest/ir-version-store.js +162 -0
- package/dist/manifest/ir-version-store.js.map +1 -0
- package/dist/manifest/ir.d.ts +616 -0
- package/dist/manifest/ir.d.ts.map +1 -0
- package/dist/manifest/ir.js +2 -0
- package/dist/manifest/ir.js.map +1 -0
- package/dist/manifest/lexer.d.ts +37 -0
- package/dist/manifest/lexer.d.ts.map +1 -0
- package/dist/manifest/lexer.js +224 -0
- package/dist/manifest/lexer.js.map +1 -0
- package/dist/manifest/masking.d.ts +11 -0
- package/dist/manifest/masking.d.ts.map +1 -0
- package/dist/manifest/masking.js +34 -0
- package/dist/manifest/masking.js.map +1 -0
- package/dist/manifest/module-resolver.d.ts +42 -0
- package/dist/manifest/module-resolver.d.ts.map +1 -0
- package/dist/manifest/module-resolver.js +162 -0
- package/dist/manifest/module-resolver.js.map +1 -0
- package/dist/manifest/multi-compiler.d.ts +40 -0
- package/dist/manifest/multi-compiler.d.ts.map +1 -0
- package/dist/manifest/multi-compiler.js +324 -0
- package/dist/manifest/multi-compiler.js.map +1 -0
- package/dist/manifest/outbox/outbox-store.d.ts +56 -0
- package/dist/manifest/outbox/outbox-store.d.ts.map +1 -0
- package/dist/manifest/outbox/outbox-store.js +13 -0
- package/dist/manifest/outbox/outbox-store.js.map +1 -0
- package/dist/manifest/outbox/stores/dynamodb.d.ts +100 -0
- package/dist/manifest/outbox/stores/dynamodb.d.ts.map +1 -0
- package/dist/manifest/outbox/stores/dynamodb.js +239 -0
- package/dist/manifest/outbox/stores/dynamodb.js.map +1 -0
- package/dist/manifest/outbox/stores/memory.d.ts +54 -0
- package/dist/manifest/outbox/stores/memory.d.ts.map +1 -0
- package/dist/manifest/outbox/stores/memory.js +131 -0
- package/dist/manifest/outbox/stores/memory.js.map +1 -0
- package/dist/manifest/outbox/stores/mongodb.d.ts +58 -0
- package/dist/manifest/outbox/stores/mongodb.d.ts.map +1 -0
- package/dist/manifest/outbox/stores/mongodb.js +151 -0
- package/dist/manifest/outbox/stores/mongodb.js.map +1 -0
- package/dist/manifest/outbox/stores/postgres.d.ts +81 -0
- package/dist/manifest/outbox/stores/postgres.d.ts.map +1 -0
- package/dist/manifest/outbox/stores/postgres.js +182 -0
- package/dist/manifest/outbox/stores/postgres.js.map +1 -0
- package/dist/manifest/outbox/stores/redis.d.ts +95 -0
- package/dist/manifest/outbox/stores/redis.d.ts.map +1 -0
- package/dist/manifest/outbox/stores/redis.js +248 -0
- package/dist/manifest/outbox/stores/redis.js.map +1 -0
- package/dist/manifest/parser.d.ts +148 -0
- package/dist/manifest/parser.d.ts.map +1 -0
- package/dist/manifest/parser.js +2243 -0
- package/dist/manifest/parser.js.map +1 -0
- package/dist/manifest/plugin-api.d.ts +202 -0
- package/dist/manifest/plugin-api.d.ts.map +1 -0
- package/dist/manifest/plugin-api.js +101 -0
- package/dist/manifest/plugin-api.js.map +1 -0
- package/dist/manifest/plugin-loader.d.ts +101 -0
- package/dist/manifest/plugin-loader.d.ts.map +1 -0
- package/dist/manifest/plugin-loader.js +332 -0
- package/dist/manifest/plugin-loader.js.map +1 -0
- package/dist/manifest/profiling.d.ts +183 -0
- package/dist/manifest/profiling.d.ts.map +1 -0
- package/dist/manifest/profiling.js +186 -0
- package/dist/manifest/profiling.js.map +1 -0
- package/dist/manifest/projections/analytics/generator.d.ts +27 -0
- package/dist/manifest/projections/analytics/generator.d.ts.map +1 -0
- package/dist/manifest/projections/analytics/generator.js +686 -0
- package/dist/manifest/projections/analytics/generator.js.map +1 -0
- package/dist/manifest/projections/analytics/types.d.ts +46 -0
- package/dist/manifest/projections/analytics/types.d.ts.map +1 -0
- package/dist/manifest/projections/analytics/types.js +8 -0
- package/dist/manifest/projections/analytics/types.js.map +1 -0
- package/dist/manifest/projections/builtins.d.ts +29 -0
- package/dist/manifest/projections/builtins.d.ts.map +1 -0
- package/dist/manifest/projections/builtins.js +143 -0
- package/dist/manifest/projections/builtins.js.map +1 -0
- package/dist/manifest/projections/convex/expression.d.ts +52 -0
- package/dist/manifest/projections/convex/expression.d.ts.map +1 -0
- package/dist/manifest/projections/convex/expression.js +166 -0
- package/dist/manifest/projections/convex/expression.js.map +1 -0
- package/dist/manifest/projections/convex/functions.d.ts +22 -0
- package/dist/manifest/projections/convex/functions.d.ts.map +1 -0
- package/dist/manifest/projections/convex/functions.js +786 -0
- package/dist/manifest/projections/convex/functions.js.map +1 -0
- package/dist/manifest/projections/convex/generator.d.ts +79 -0
- package/dist/manifest/projections/convex/generator.d.ts.map +1 -0
- package/dist/manifest/projections/convex/generator.js +406 -0
- package/dist/manifest/projections/convex/generator.js.map +1 -0
- package/dist/manifest/projections/convex/index.d.ts +10 -0
- package/dist/manifest/projections/convex/index.d.ts.map +1 -0
- package/dist/manifest/projections/convex/index.js +10 -0
- package/dist/manifest/projections/convex/index.js.map +1 -0
- package/dist/manifest/projections/convex/options.d.ts +153 -0
- package/dist/manifest/projections/convex/options.d.ts.map +1 -0
- package/dist/manifest/projections/convex/options.js +60 -0
- package/dist/manifest/projections/convex/options.js.map +1 -0
- package/dist/manifest/projections/convex/orchestration.d.ts +23 -0
- package/dist/manifest/projections/convex/orchestration.d.ts.map +1 -0
- package/dist/manifest/projections/convex/orchestration.js +150 -0
- package/dist/manifest/projections/convex/orchestration.js.map +1 -0
- package/dist/manifest/projections/convex/type-mapping.d.ts +40 -0
- package/dist/manifest/projections/convex/type-mapping.d.ts.map +1 -0
- package/dist/manifest/projections/convex/type-mapping.js +71 -0
- package/dist/manifest/projections/convex/type-mapping.js.map +1 -0
- package/dist/manifest/projections/dart/generator.d.ts +33 -0
- package/dist/manifest/projections/dart/generator.d.ts.map +1 -0
- package/dist/manifest/projections/dart/generator.js +981 -0
- package/dist/manifest/projections/dart/generator.js.map +1 -0
- package/dist/manifest/projections/dart/types.d.ts +29 -0
- package/dist/manifest/projections/dart/types.d.ts.map +1 -0
- package/dist/manifest/projections/dart/types.js +5 -0
- package/dist/manifest/projections/dart/types.js.map +1 -0
- package/dist/manifest/projections/drizzle/generator.d.ts +27 -0
- package/dist/manifest/projections/drizzle/generator.d.ts.map +1 -0
- package/dist/manifest/projections/drizzle/generator.js +654 -0
- package/dist/manifest/projections/drizzle/generator.js.map +1 -0
- package/dist/manifest/projections/drizzle/index.d.ts +12 -0
- package/dist/manifest/projections/drizzle/index.d.ts.map +1 -0
- package/dist/manifest/projections/drizzle/index.js +12 -0
- package/dist/manifest/projections/drizzle/index.js.map +1 -0
- package/dist/manifest/projections/drizzle/options.d.ts +94 -0
- package/dist/manifest/projections/drizzle/options.d.ts.map +1 -0
- package/dist/manifest/projections/drizzle/options.js +31 -0
- package/dist/manifest/projections/drizzle/options.js.map +1 -0
- package/dist/manifest/projections/drizzle/type-mapping.d.ts +74 -0
- package/dist/manifest/projections/drizzle/type-mapping.d.ts.map +1 -0
- package/dist/manifest/projections/drizzle/type-mapping.js +101 -0
- package/dist/manifest/projections/drizzle/type-mapping.js.map +1 -0
- package/dist/manifest/projections/dynamodb/generator.d.ts +48 -0
- package/dist/manifest/projections/dynamodb/generator.d.ts.map +1 -0
- package/dist/manifest/projections/dynamodb/generator.js +341 -0
- package/dist/manifest/projections/dynamodb/generator.js.map +1 -0
- package/dist/manifest/projections/elasticsearch/generator.d.ts +44 -0
- package/dist/manifest/projections/elasticsearch/generator.d.ts.map +1 -0
- package/dist/manifest/projections/elasticsearch/generator.js +613 -0
- package/dist/manifest/projections/elasticsearch/generator.js.map +1 -0
- package/dist/manifest/projections/elasticsearch/options.d.ts +56 -0
- package/dist/manifest/projections/elasticsearch/options.d.ts.map +1 -0
- package/dist/manifest/projections/elasticsearch/options.js +37 -0
- package/dist/manifest/projections/elasticsearch/options.js.map +1 -0
- package/dist/manifest/projections/elasticsearch/type-mapping.d.ts +30 -0
- package/dist/manifest/projections/elasticsearch/type-mapping.d.ts.map +1 -0
- package/dist/manifest/projections/elasticsearch/type-mapping.js +34 -0
- package/dist/manifest/projections/elasticsearch/type-mapping.js.map +1 -0
- package/dist/manifest/projections/elasticsearch/types.d.ts +81 -0
- package/dist/manifest/projections/elasticsearch/types.d.ts.map +1 -0
- package/dist/manifest/projections/elasticsearch/types.js +10 -0
- package/dist/manifest/projections/elasticsearch/types.js.map +1 -0
- package/dist/manifest/projections/express/generator.d.ts +38 -0
- package/dist/manifest/projections/express/generator.d.ts.map +1 -0
- package/dist/manifest/projections/express/generator.js +620 -0
- package/dist/manifest/projections/express/generator.js.map +1 -0
- package/dist/manifest/projections/express/index.d.ts +8 -0
- package/dist/manifest/projections/express/index.d.ts.map +1 -0
- package/dist/manifest/projections/express/index.js +7 -0
- package/dist/manifest/projections/express/index.js.map +1 -0
- package/dist/manifest/projections/express/types.d.ts +92 -0
- package/dist/manifest/projections/express/types.d.ts.map +1 -0
- package/dist/manifest/projections/express/types.js +9 -0
- package/dist/manifest/projections/express/types.js.map +1 -0
- package/dist/manifest/projections/graphql/generator.d.ts +43 -0
- package/dist/manifest/projections/graphql/generator.d.ts.map +1 -0
- package/dist/manifest/projections/graphql/generator.js +662 -0
- package/dist/manifest/projections/graphql/generator.js.map +1 -0
- package/dist/manifest/projections/graphql/index.d.ts +11 -0
- package/dist/manifest/projections/graphql/index.d.ts.map +1 -0
- package/dist/manifest/projections/graphql/index.js +10 -0
- package/dist/manifest/projections/graphql/index.js.map +1 -0
- package/dist/manifest/projections/graphql/types.d.ts +69 -0
- package/dist/manifest/projections/graphql/types.d.ts.map +1 -0
- package/dist/manifest/projections/graphql/types.js +9 -0
- package/dist/manifest/projections/graphql/types.js.map +1 -0
- package/dist/manifest/projections/health/generator.d.ts +36 -0
- package/dist/manifest/projections/health/generator.d.ts.map +1 -0
- package/dist/manifest/projections/health/generator.js +355 -0
- package/dist/manifest/projections/health/generator.js.map +1 -0
- package/dist/manifest/projections/health/types.d.ts +67 -0
- package/dist/manifest/projections/health/types.d.ts.map +1 -0
- package/dist/manifest/projections/health/types.js +28 -0
- package/dist/manifest/projections/health/types.js.map +1 -0
- package/dist/manifest/projections/hono/generator.d.ts +36 -0
- package/dist/manifest/projections/hono/generator.d.ts.map +1 -0
- package/dist/manifest/projections/hono/generator.js +578 -0
- package/dist/manifest/projections/hono/generator.js.map +1 -0
- package/dist/manifest/projections/hono/types.d.ts +86 -0
- package/dist/manifest/projections/hono/types.d.ts.map +1 -0
- package/dist/manifest/projections/hono/types.js +10 -0
- package/dist/manifest/projections/hono/types.js.map +1 -0
- package/dist/manifest/projections/index.d.ts +58 -0
- package/dist/manifest/projections/index.d.ts.map +1 -0
- package/dist/manifest/projections/index.js +41 -0
- package/dist/manifest/projections/index.js.map +1 -0
- package/dist/manifest/projections/interface.d.ts +285 -0
- package/dist/manifest/projections/interface.d.ts.map +1 -0
- package/dist/manifest/projections/interface.js +8 -0
- package/dist/manifest/projections/interface.js.map +1 -0
- package/dist/manifest/projections/jsonschema/generator.d.ts +35 -0
- package/dist/manifest/projections/jsonschema/generator.d.ts.map +1 -0
- package/dist/manifest/projections/jsonschema/generator.js +347 -0
- package/dist/manifest/projections/jsonschema/generator.js.map +1 -0
- package/dist/manifest/projections/jsonschema/index.d.ts +3 -0
- package/dist/manifest/projections/jsonschema/index.d.ts.map +1 -0
- package/dist/manifest/projections/jsonschema/index.js +2 -0
- package/dist/manifest/projections/jsonschema/index.js.map +1 -0
- package/dist/manifest/projections/jsonschema/types.d.ts +31 -0
- package/dist/manifest/projections/jsonschema/types.d.ts.map +1 -0
- package/dist/manifest/projections/jsonschema/types.js +2 -0
- package/dist/manifest/projections/jsonschema/types.js.map +1 -0
- package/dist/manifest/projections/kysely/generator.d.ts +36 -0
- package/dist/manifest/projections/kysely/generator.d.ts.map +1 -0
- package/dist/manifest/projections/kysely/generator.js +325 -0
- package/dist/manifest/projections/kysely/generator.js.map +1 -0
- package/dist/manifest/projections/kysely/index.d.ts +4 -0
- package/dist/manifest/projections/kysely/index.d.ts.map +1 -0
- package/dist/manifest/projections/kysely/index.js +2 -0
- package/dist/manifest/projections/kysely/index.js.map +1 -0
- package/dist/manifest/projections/kysely/options.d.ts +61 -0
- package/dist/manifest/projections/kysely/options.d.ts.map +1 -0
- package/dist/manifest/projections/kysely/options.js +31 -0
- package/dist/manifest/projections/kysely/options.js.map +1 -0
- package/dist/manifest/projections/kysely/type-mapping.d.ts +61 -0
- package/dist/manifest/projections/kysely/type-mapping.d.ts.map +1 -0
- package/dist/manifest/projections/kysely/type-mapping.js +84 -0
- package/dist/manifest/projections/kysely/type-mapping.js.map +1 -0
- package/dist/manifest/projections/llm-context/generator.d.ts +24 -0
- package/dist/manifest/projections/llm-context/generator.d.ts.map +1 -0
- package/dist/manifest/projections/llm-context/generator.js +371 -0
- package/dist/manifest/projections/llm-context/generator.js.map +1 -0
- package/dist/manifest/projections/llm-context/types.d.ts +205 -0
- package/dist/manifest/projections/llm-context/types.d.ts.map +1 -0
- package/dist/manifest/projections/llm-context/types.js +9 -0
- package/dist/manifest/projections/llm-context/types.js.map +1 -0
- package/dist/manifest/projections/materialized-views/expression-to-sql.d.ts +29 -0
- package/dist/manifest/projections/materialized-views/expression-to-sql.d.ts.map +1 -0
- package/dist/manifest/projections/materialized-views/expression-to-sql.js +211 -0
- package/dist/manifest/projections/materialized-views/expression-to-sql.js.map +1 -0
- package/dist/manifest/projections/materialized-views/generator.d.ts +29 -0
- package/dist/manifest/projections/materialized-views/generator.d.ts.map +1 -0
- package/dist/manifest/projections/materialized-views/generator.js +263 -0
- package/dist/manifest/projections/materialized-views/generator.js.map +1 -0
- package/dist/manifest/projections/materialized-views/options.d.ts +59 -0
- package/dist/manifest/projections/materialized-views/options.d.ts.map +1 -0
- package/dist/manifest/projections/materialized-views/options.js +34 -0
- package/dist/manifest/projections/materialized-views/options.js.map +1 -0
- package/dist/manifest/projections/materialized-views/types.d.ts +100 -0
- package/dist/manifest/projections/materialized-views/types.d.ts.map +1 -0
- package/dist/manifest/projections/materialized-views/types.js +11 -0
- package/dist/manifest/projections/materialized-views/types.js.map +1 -0
- package/dist/manifest/projections/mermaid/generator.d.ts +46 -0
- package/dist/manifest/projections/mermaid/generator.d.ts.map +1 -0
- package/dist/manifest/projections/mermaid/generator.js +436 -0
- package/dist/manifest/projections/mermaid/generator.js.map +1 -0
- package/dist/manifest/projections/mongoose/options.d.ts +30 -0
- package/dist/manifest/projections/mongoose/options.d.ts.map +1 -0
- package/dist/manifest/projections/mongoose/options.js +18 -0
- package/dist/manifest/projections/mongoose/options.js.map +1 -0
- package/dist/manifest/projections/mongoose/type-mapping.d.ts +42 -0
- package/dist/manifest/projections/mongoose/type-mapping.d.ts.map +1 -0
- package/dist/manifest/projections/mongoose/type-mapping.js +64 -0
- package/dist/manifest/projections/mongoose/type-mapping.js.map +1 -0
- package/dist/manifest/projections/nextjs/defaults.d.ts +161 -0
- package/dist/manifest/projections/nextjs/defaults.d.ts.map +1 -0
- package/dist/manifest/projections/nextjs/defaults.js +157 -0
- package/dist/manifest/projections/nextjs/defaults.js.map +1 -0
- package/dist/manifest/projections/nextjs/generator.d.ts +78 -0
- package/dist/manifest/projections/nextjs/generator.d.ts.map +1 -0
- package/dist/manifest/projections/nextjs/generator.js +1339 -0
- package/dist/manifest/projections/nextjs/generator.js.map +1 -0
- package/dist/manifest/projections/nextjs/schedule-generator.d.ts +10 -0
- package/dist/manifest/projections/nextjs/schedule-generator.d.ts.map +1 -0
- package/dist/manifest/projections/nextjs/schedule-generator.js +54 -0
- package/dist/manifest/projections/nextjs/schedule-generator.js.map +1 -0
- package/dist/manifest/projections/openapi/generator.d.ts +37 -0
- package/dist/manifest/projections/openapi/generator.d.ts.map +1 -0
- package/dist/manifest/projections/openapi/generator.js +690 -0
- package/dist/manifest/projections/openapi/generator.js.map +1 -0
- package/dist/manifest/projections/openapi/index.d.ts +11 -0
- package/dist/manifest/projections/openapi/index.d.ts.map +1 -0
- package/dist/manifest/projections/openapi/index.js +10 -0
- package/dist/manifest/projections/openapi/index.js.map +1 -0
- package/dist/manifest/projections/openapi/types.d.ts +75 -0
- package/dist/manifest/projections/openapi/types.d.ts.map +1 -0
- package/dist/manifest/projections/openapi/types.js +9 -0
- package/dist/manifest/projections/openapi/types.js.map +1 -0
- package/dist/manifest/projections/prisma/generator.d.ts +32 -0
- package/dist/manifest/projections/prisma/generator.d.ts.map +1 -0
- package/dist/manifest/projections/prisma/generator.js +861 -0
- package/dist/manifest/projections/prisma/generator.js.map +1 -0
- package/dist/manifest/projections/prisma/index.d.ts +12 -0
- package/dist/manifest/projections/prisma/index.d.ts.map +1 -0
- package/dist/manifest/projections/prisma/index.js +12 -0
- package/dist/manifest/projections/prisma/index.js.map +1 -0
- package/dist/manifest/projections/prisma/options.d.ts +243 -0
- package/dist/manifest/projections/prisma/options.d.ts.map +1 -0
- package/dist/manifest/projections/prisma/options.js +59 -0
- package/dist/manifest/projections/prisma/options.js.map +1 -0
- package/dist/manifest/projections/prisma/type-mapping.d.ts +60 -0
- package/dist/manifest/projections/prisma/type-mapping.d.ts.map +1 -0
- package/dist/manifest/projections/prisma/type-mapping.js +95 -0
- package/dist/manifest/projections/prisma/type-mapping.js.map +1 -0
- package/dist/manifest/projections/prisma-store/generator.d.ts +12 -0
- package/dist/manifest/projections/prisma-store/generator.d.ts.map +1 -0
- package/dist/manifest/projections/prisma-store/generator.js +52 -0
- package/dist/manifest/projections/prisma-store/generator.js.map +1 -0
- package/dist/manifest/projections/prisma-store/metadata-builder.d.ts +11 -0
- package/dist/manifest/projections/prisma-store/metadata-builder.d.ts.map +1 -0
- package/dist/manifest/projections/prisma-store/metadata-builder.js +183 -0
- package/dist/manifest/projections/prisma-store/metadata-builder.js.map +1 -0
- package/dist/manifest/projections/prisma-store/options.d.ts +31 -0
- package/dist/manifest/projections/prisma-store/options.d.ts.map +1 -0
- package/dist/manifest/projections/prisma-store/options.js +21 -0
- package/dist/manifest/projections/prisma-store/options.js.map +1 -0
- package/dist/manifest/projections/prisma-store/persistence.d.ts +4 -0
- package/dist/manifest/projections/prisma-store/persistence.d.ts.map +1 -0
- package/dist/manifest/projections/prisma-store/persistence.js +24 -0
- package/dist/manifest/projections/prisma-store/persistence.js.map +1 -0
- package/dist/manifest/projections/pydantic/generator.d.ts +27 -0
- package/dist/manifest/projections/pydantic/generator.d.ts.map +1 -0
- package/dist/manifest/projections/pydantic/generator.js +798 -0
- package/dist/manifest/projections/pydantic/generator.js.map +1 -0
- package/dist/manifest/projections/pydantic/types.d.ts +32 -0
- package/dist/manifest/projections/pydantic/types.d.ts.map +1 -0
- package/dist/manifest/projections/pydantic/types.js +5 -0
- package/dist/manifest/projections/pydantic/types.js.map +1 -0
- package/dist/manifest/projections/react-query/generator.d.ts +87 -0
- package/dist/manifest/projections/react-query/generator.d.ts.map +1 -0
- package/dist/manifest/projections/react-query/generator.js +413 -0
- package/dist/manifest/projections/react-query/generator.js.map +1 -0
- package/dist/manifest/projections/registry.d.ts +59 -0
- package/dist/manifest/projections/registry.d.ts.map +1 -0
- package/dist/manifest/projections/registry.js +110 -0
- package/dist/manifest/projections/registry.js.map +1 -0
- package/dist/manifest/projections/remix/generator.d.ts +58 -0
- package/dist/manifest/projections/remix/generator.d.ts.map +1 -0
- package/dist/manifest/projections/remix/generator.js +788 -0
- package/dist/manifest/projections/remix/generator.js.map +1 -0
- package/dist/manifest/projections/routes/generator.d.ts +32 -0
- package/dist/manifest/projections/routes/generator.d.ts.map +1 -0
- package/dist/manifest/projections/routes/generator.js +401 -0
- package/dist/manifest/projections/routes/generator.js.map +1 -0
- package/dist/manifest/projections/routes/types.d.ts +104 -0
- package/dist/manifest/projections/routes/types.d.ts.map +1 -0
- package/dist/manifest/projections/routes/types.js +11 -0
- package/dist/manifest/projections/routes/types.js.map +1 -0
- package/dist/manifest/projections/shared/naming.d.ts +64 -0
- package/dist/manifest/projections/shared/naming.d.ts.map +1 -0
- package/dist/manifest/projections/shared/naming.js +138 -0
- package/dist/manifest/projections/shared/naming.js.map +1 -0
- package/dist/manifest/projections/storybook/generator.d.ts +38 -0
- package/dist/manifest/projections/storybook/generator.d.ts.map +1 -0
- package/dist/manifest/projections/storybook/generator.js +462 -0
- package/dist/manifest/projections/storybook/generator.js.map +1 -0
- package/dist/manifest/projections/sveltekit/generator.d.ts +64 -0
- package/dist/manifest/projections/sveltekit/generator.d.ts.map +1 -0
- package/dist/manifest/projections/sveltekit/generator.js +1043 -0
- package/dist/manifest/projections/sveltekit/generator.js.map +1 -0
- package/dist/manifest/projections/sveltekit/index.d.ts +11 -0
- package/dist/manifest/projections/sveltekit/index.d.ts.map +1 -0
- package/dist/manifest/projections/sveltekit/index.js +10 -0
- package/dist/manifest/projections/sveltekit/index.js.map +1 -0
- package/dist/manifest/projections/sveltekit/types.d.ts +122 -0
- package/dist/manifest/projections/sveltekit/types.d.ts.map +1 -0
- package/dist/manifest/projections/sveltekit/types.js +10 -0
- package/dist/manifest/projections/sveltekit/types.js.map +1 -0
- package/dist/manifest/projections/terraform/generator.d.ts +29 -0
- package/dist/manifest/projections/terraform/generator.d.ts.map +1 -0
- package/dist/manifest/projections/terraform/generator.js +722 -0
- package/dist/manifest/projections/terraform/generator.js.map +1 -0
- package/dist/manifest/projections/terraform/index.d.ts +7 -0
- package/dist/manifest/projections/terraform/index.d.ts.map +1 -0
- package/dist/manifest/projections/terraform/index.js +7 -0
- package/dist/manifest/projections/terraform/index.js.map +1 -0
- package/dist/manifest/projections/terraform/options.d.ts +92 -0
- package/dist/manifest/projections/terraform/options.d.ts.map +1 -0
- package/dist/manifest/projections/terraform/options.js +37 -0
- package/dist/manifest/projections/terraform/options.js.map +1 -0
- package/dist/manifest/projections/terraform/types.d.ts +55 -0
- package/dist/manifest/projections/terraform/types.d.ts.map +1 -0
- package/dist/manifest/projections/terraform/types.js +38 -0
- package/dist/manifest/projections/terraform/types.js.map +1 -0
- package/dist/manifest/projections/zod/generator.d.ts +27 -0
- package/dist/manifest/projections/zod/generator.d.ts.map +1 -0
- package/dist/manifest/projections/zod/generator.js +367 -0
- package/dist/manifest/projections/zod/generator.js.map +1 -0
- package/dist/manifest/projections/zod/index.d.ts +8 -0
- package/dist/manifest/projections/zod/index.d.ts.map +1 -0
- package/dist/manifest/projections/zod/index.js +7 -0
- package/dist/manifest/projections/zod/index.js.map +1 -0
- package/dist/manifest/projections/zod/types.d.ts +14 -0
- package/dist/manifest/projections/zod/types.d.ts.map +1 -0
- package/dist/manifest/projections/zod/types.js +5 -0
- package/dist/manifest/projections/zod/types.js.map +1 -0
- package/dist/manifest/reaction-completeness-checks.d.ts +11 -0
- package/dist/manifest/reaction-completeness-checks.d.ts.map +1 -0
- package/dist/manifest/reaction-completeness-checks.js +106 -0
- package/dist/manifest/reaction-completeness-checks.js.map +1 -0
- package/dist/manifest/reaction-completeness.d.ts +9 -0
- package/dist/manifest/reaction-completeness.d.ts.map +1 -0
- package/dist/manifest/reaction-completeness.js +35 -0
- package/dist/manifest/reaction-completeness.js.map +1 -0
- package/dist/manifest/registry/emit.d.ts +53 -0
- package/dist/manifest/registry/emit.d.ts.map +1 -0
- package/dist/manifest/registry/emit.js +96 -0
- package/dist/manifest/registry/emit.js.map +1 -0
- package/dist/manifest/runtime-command-extensions.d.ts +21 -0
- package/dist/manifest/runtime-command-extensions.d.ts.map +1 -0
- package/dist/manifest/runtime-command-extensions.js +136 -0
- package/dist/manifest/runtime-command-extensions.js.map +1 -0
- package/dist/manifest/runtime-engine.d.ts +1019 -0
- package/dist/manifest/runtime-engine.d.ts.map +1 -0
- package/dist/manifest/runtime-engine.js +3872 -0
- package/dist/manifest/runtime-engine.js.map +1 -0
- package/dist/manifest/runtime-profiling-bridge.d.ts +22 -0
- package/dist/manifest/runtime-profiling-bridge.d.ts.map +1 -0
- package/dist/manifest/runtime-profiling-bridge.js +69 -0
- package/dist/manifest/runtime-profiling-bridge.js.map +1 -0
- package/dist/manifest/runtime-rate-limit.d.ts +52 -0
- package/dist/manifest/runtime-rate-limit.d.ts.map +1 -0
- package/dist/manifest/runtime-rate-limit.js +70 -0
- package/dist/manifest/runtime-rate-limit.js.map +1 -0
- package/dist/manifest/runtime-retry.d.ts +68 -0
- package/dist/manifest/runtime-retry.d.ts.map +1 -0
- package/dist/manifest/runtime-retry.js +93 -0
- package/dist/manifest/runtime-retry.js.map +1 -0
- package/dist/manifest/runtime-schedule.d.ts +47 -0
- package/dist/manifest/runtime-schedule.d.ts.map +1 -0
- package/dist/manifest/runtime-schedule.js +95 -0
- package/dist/manifest/runtime-schedule.js.map +1 -0
- package/dist/manifest/schedule-utils.d.ts +15 -0
- package/dist/manifest/schedule-utils.d.ts.map +1 -0
- package/dist/manifest/schedule-utils.js +82 -0
- package/dist/manifest/schedule-utils.js.map +1 -0
- package/dist/manifest/standalone-generator.d.ts +32 -0
- package/dist/manifest/standalone-generator.d.ts.map +1 -0
- package/dist/manifest/standalone-generator.js +596 -0
- package/dist/manifest/standalone-generator.js.map +1 -0
- package/dist/manifest/stores/prisma-generic/coercion.d.ts +17 -0
- package/dist/manifest/stores/prisma-generic/coercion.d.ts.map +1 -0
- package/dist/manifest/stores/prisma-generic/coercion.js +83 -0
- package/dist/manifest/stores/prisma-generic/coercion.js.map +1 -0
- package/dist/manifest/stores/prisma-generic/index.d.ts +3 -0
- package/dist/manifest/stores/prisma-generic/index.d.ts.map +1 -0
- package/dist/manifest/stores/prisma-generic/index.js +2 -0
- package/dist/manifest/stores/prisma-generic/index.js.map +1 -0
- package/dist/manifest/stores/prisma-generic/store.d.ts +35 -0
- package/dist/manifest/stores/prisma-generic/store.d.ts.map +1 -0
- package/dist/manifest/stores/prisma-generic/store.js +216 -0
- package/dist/manifest/stores/prisma-generic/store.js.map +1 -0
- package/dist/manifest/stores/prisma-generic/types.d.ts +46 -0
- package/dist/manifest/stores/prisma-generic/types.d.ts.map +1 -0
- package/dist/manifest/stores/prisma-generic/types.js +6 -0
- package/dist/manifest/stores/prisma-generic/types.js.map +1 -0
- package/dist/manifest/stores.node.d.ts +248 -0
- package/dist/manifest/stores.node.d.ts.map +1 -0
- package/dist/manifest/stores.node.js +718 -0
- package/dist/manifest/stores.node.js.map +1 -0
- package/dist/manifest/test/postgres-live-env.d.ts +9 -0
- package/dist/manifest/test/postgres-live-env.d.ts.map +1 -0
- package/dist/manifest/test/postgres-live-env.js +14 -0
- package/dist/manifest/test/postgres-live-env.js.map +1 -0
- package/dist/manifest/types.d.ts +570 -0
- package/dist/manifest/types.d.ts.map +1 -0
- package/dist/manifest/types.js +2 -0
- package/dist/manifest/types.js.map +1 -0
- package/dist/manifest/version.d.ts +15 -0
- package/dist/manifest/version.d.ts.map +1 -0
- package/dist/manifest/version.js +15 -0
- package/dist/manifest/version.js.map +1 -0
- package/dist/manifest/wasm/index.d.ts +15 -0
- package/dist/manifest/wasm/index.d.ts.map +1 -0
- package/dist/manifest/wasm/index.js +15 -0
- package/dist/manifest/wasm/index.js.map +1 -0
- package/dist/manifest/wasm/wasm-evaluator.d.ts +93 -0
- package/dist/manifest/wasm/wasm-evaluator.d.ts.map +1 -0
- package/dist/manifest/wasm/wasm-evaluator.js +242 -0
- package/dist/manifest/wasm/wasm-evaluator.js.map +1 -0
- package/dist/manifest/wasm/wasm-loader.d.ts +56 -0
- package/dist/manifest/wasm/wasm-loader.d.ts.map +1 -0
- package/dist/manifest/wasm/wasm-loader.js +132 -0
- package/dist/manifest/wasm/wasm-loader.js.map +1 -0
- package/docs/spec/config/manifest.config.schema.json +737 -0
- package/docs/spec/config/prisma-projection.schema.json +173 -0
- package/docs/spec/ir/ir-v1.schema.json +2033 -0
- package/docs/spec/plugins/plugin.schema.json +104 -0
- package/docs/spec/registry/bypasses.schema.json +87 -0
- package/docs/spec/registry/commands.schema.json +61 -0
- package/docs/spec/registry/entities.schema.json +52 -0
- package/docs/spec/semantics.md +630 -0
- package/package.json +356 -0
- package/packages/cli/dist/audit/bypass-violations.d.ts +16 -0
- package/packages/cli/dist/audit/bypass-violations.d.ts.map +1 -0
- package/packages/cli/dist/audit/bypass-violations.js +98 -0
- package/packages/cli/dist/audit/bypass-violations.js.map +1 -0
- package/packages/cli/dist/audit/direct-writes.d.ts +15 -0
- package/packages/cli/dist/audit/direct-writes.d.ts.map +1 -0
- package/packages/cli/dist/audit/direct-writes.js +86 -0
- package/packages/cli/dist/audit/direct-writes.js.map +1 -0
- package/packages/cli/dist/audit/event-fabrication.d.ts +17 -0
- package/packages/cli/dist/audit/event-fabrication.d.ts.map +1 -0
- package/packages/cli/dist/audit/event-fabrication.js +101 -0
- package/packages/cli/dist/audit/event-fabrication.js.map +1 -0
- package/packages/cli/dist/audit/existing-command-available.d.ts +20 -0
- package/packages/cli/dist/audit/existing-command-available.d.ts.map +1 -0
- package/packages/cli/dist/audit/existing-command-available.js +158 -0
- package/packages/cli/dist/audit/existing-command-available.js.map +1 -0
- package/packages/cli/dist/audit/missing-tests.d.ts +17 -0
- package/packages/cli/dist/audit/missing-tests.d.ts.map +1 -0
- package/packages/cli/dist/audit/missing-tests.js +108 -0
- package/packages/cli/dist/audit/missing-tests.js.map +1 -0
- package/packages/cli/dist/audit/route-drift.d.ts +16 -0
- package/packages/cli/dist/audit/route-drift.d.ts.map +1 -0
- package/packages/cli/dist/audit/route-drift.js +86 -0
- package/packages/cli/dist/audit/route-drift.js.map +1 -0
- package/packages/cli/dist/audit/types.d.ts +63 -0
- package/packages/cli/dist/audit/types.d.ts.map +1 -0
- package/packages/cli/dist/audit/types.js +10 -0
- package/packages/cli/dist/audit/types.js.map +1 -0
- package/packages/cli/dist/audit/unregistered-command-call.d.ts +25 -0
- package/packages/cli/dist/audit/unregistered-command-call.d.ts.map +1 -0
- package/packages/cli/dist/audit/unregistered-command-call.js +196 -0
- package/packages/cli/dist/audit/unregistered-command-call.js.map +1 -0
- package/packages/cli/dist/audit/unregistered-entity-write.d.ts +16 -0
- package/packages/cli/dist/audit/unregistered-entity-write.d.ts.map +1 -0
- package/packages/cli/dist/audit/unregistered-entity-write.js +96 -0
- package/packages/cli/dist/audit/unregistered-entity-write.js.map +1 -0
- package/packages/cli/dist/audit/write-receiver.d.ts +23 -0
- package/packages/cli/dist/audit/write-receiver.d.ts.map +1 -0
- package/packages/cli/dist/audit/write-receiver.js +32 -0
- package/packages/cli/dist/audit/write-receiver.js.map +1 -0
- package/packages/cli/dist/checks/dispatcher-presence.d.ts +37 -0
- package/packages/cli/dist/checks/dispatcher-presence.d.ts.map +1 -0
- package/packages/cli/dist/checks/dispatcher-presence.js +57 -0
- package/packages/cli/dist/checks/dispatcher-presence.js.map +1 -0
- package/packages/cli/dist/checks/package-shape.d.ts +81 -0
- package/packages/cli/dist/checks/package-shape.d.ts.map +1 -0
- package/packages/cli/dist/checks/package-shape.js +359 -0
- package/packages/cli/dist/checks/package-shape.js.map +1 -0
- package/packages/cli/dist/checks/runtime-smoke.d.ts +42 -0
- package/packages/cli/dist/checks/runtime-smoke.d.ts.map +1 -0
- package/packages/cli/dist/checks/runtime-smoke.js +167 -0
- package/packages/cli/dist/checks/runtime-smoke.js.map +1 -0
- package/packages/cli/dist/commands/analyze.d.ts +97 -0
- package/packages/cli/dist/commands/analyze.d.ts.map +1 -0
- package/packages/cli/dist/commands/analyze.js +411 -0
- package/packages/cli/dist/commands/analyze.js.map +1 -0
- package/packages/cli/dist/commands/audit-bypasses.d.ts +31 -0
- package/packages/cli/dist/commands/audit-bypasses.d.ts.map +1 -0
- package/packages/cli/dist/commands/audit-bypasses.js +152 -0
- package/packages/cli/dist/commands/audit-bypasses.js.map +1 -0
- package/packages/cli/dist/commands/audit-constitution.d.ts +20 -0
- package/packages/cli/dist/commands/audit-constitution.d.ts.map +1 -0
- package/packages/cli/dist/commands/audit-constitution.js +18 -0
- package/packages/cli/dist/commands/audit-constitution.js.map +1 -0
- package/packages/cli/dist/commands/audit-governance.d.ts +37 -0
- package/packages/cli/dist/commands/audit-governance.d.ts.map +1 -0
- package/packages/cli/dist/commands/audit-governance.js +78 -0
- package/packages/cli/dist/commands/audit-governance.js.map +1 -0
- package/packages/cli/dist/commands/audit-routes.d.ts +135 -0
- package/packages/cli/dist/commands/audit-routes.d.ts.map +1 -0
- package/packages/cli/dist/commands/audit-routes.js +514 -0
- package/packages/cli/dist/commands/audit-routes.js.map +1 -0
- package/packages/cli/dist/commands/breaking-change.d.ts +15 -0
- package/packages/cli/dist/commands/breaking-change.d.ts.map +1 -0
- package/packages/cli/dist/commands/breaking-change.js +150 -0
- package/packages/cli/dist/commands/breaking-change.js.map +1 -0
- package/packages/cli/dist/commands/build.d.ts +26 -0
- package/packages/cli/dist/commands/build.d.ts.map +1 -0
- package/packages/cli/dist/commands/build.js +58 -0
- package/packages/cli/dist/commands/build.js.map +1 -0
- package/packages/cli/dist/commands/changelog.d.ts +26 -0
- package/packages/cli/dist/commands/changelog.d.ts.map +1 -0
- package/packages/cli/dist/commands/changelog.js +365 -0
- package/packages/cli/dist/commands/changelog.js.map +1 -0
- package/packages/cli/dist/commands/check.d.ts +21 -0
- package/packages/cli/dist/commands/check.d.ts.map +1 -0
- package/packages/cli/dist/commands/check.js +31 -0
- package/packages/cli/dist/commands/check.js.map +1 -0
- package/packages/cli/dist/commands/compile.d.ts +19 -0
- package/packages/cli/dist/commands/compile.d.ts.map +1 -0
- package/packages/cli/dist/commands/compile.js +325 -0
- package/packages/cli/dist/commands/compile.js.map +1 -0
- package/packages/cli/dist/commands/config.d.ts +23 -0
- package/packages/cli/dist/commands/config.d.ts.map +1 -0
- package/packages/cli/dist/commands/config.js +172 -0
- package/packages/cli/dist/commands/config.js.map +1 -0
- package/packages/cli/dist/commands/coverage.d.ts +55 -0
- package/packages/cli/dist/commands/coverage.d.ts.map +1 -0
- package/packages/cli/dist/commands/coverage.js +343 -0
- package/packages/cli/dist/commands/coverage.js.map +1 -0
- package/packages/cli/dist/commands/diagram.d.ts +22 -0
- package/packages/cli/dist/commands/diagram.d.ts.map +1 -0
- package/packages/cli/dist/commands/diagram.js +176 -0
- package/packages/cli/dist/commands/diagram.js.map +1 -0
- package/packages/cli/dist/commands/docs.d.ts +18 -0
- package/packages/cli/dist/commands/docs.d.ts.map +1 -0
- package/packages/cli/dist/commands/docs.js +722 -0
- package/packages/cli/dist/commands/docs.js.map +1 -0
- package/packages/cli/dist/commands/doctor-lib.d.ts +147 -0
- package/packages/cli/dist/commands/doctor-lib.d.ts.map +1 -0
- package/packages/cli/dist/commands/doctor-lib.js +491 -0
- package/packages/cli/dist/commands/doctor-lib.js.map +1 -0
- package/packages/cli/dist/commands/doctor.d.ts +31 -0
- package/packages/cli/dist/commands/doctor.d.ts.map +1 -0
- package/packages/cli/dist/commands/doctor.js +628 -0
- package/packages/cli/dist/commands/doctor.js.map +1 -0
- package/packages/cli/dist/commands/emit-registries.d.ts +33 -0
- package/packages/cli/dist/commands/emit-registries.d.ts.map +1 -0
- package/packages/cli/dist/commands/emit-registries.js +109 -0
- package/packages/cli/dist/commands/emit-registries.js.map +1 -0
- package/packages/cli/dist/commands/enforce-surface.d.ts +62 -0
- package/packages/cli/dist/commands/enforce-surface.d.ts.map +1 -0
- package/packages/cli/dist/commands/enforce-surface.js +172 -0
- package/packages/cli/dist/commands/enforce-surface.js.map +1 -0
- package/packages/cli/dist/commands/fmt.d.ts +17 -0
- package/packages/cli/dist/commands/fmt.d.ts.map +1 -0
- package/packages/cli/dist/commands/fmt.js +129 -0
- package/packages/cli/dist/commands/fmt.js.map +1 -0
- package/packages/cli/dist/commands/gen-tests.d.ts +41 -0
- package/packages/cli/dist/commands/gen-tests.d.ts.map +1 -0
- package/packages/cli/dist/commands/gen-tests.js +370 -0
- package/packages/cli/dist/commands/gen-tests.js.map +1 -0
- package/packages/cli/dist/commands/generate-from-prompt.d.ts +34 -0
- package/packages/cli/dist/commands/generate-from-prompt.d.ts.map +1 -0
- package/packages/cli/dist/commands/generate-from-prompt.js +990 -0
- package/packages/cli/dist/commands/generate-from-prompt.js.map +1 -0
- package/packages/cli/dist/commands/generate.d.ts +36 -0
- package/packages/cli/dist/commands/generate.d.ts.map +1 -0
- package/packages/cli/dist/commands/generate.js +371 -0
- package/packages/cli/dist/commands/generate.js.map +1 -0
- package/packages/cli/dist/commands/harness.d.ts +13 -0
- package/packages/cli/dist/commands/harness.d.ts.map +1 -0
- package/packages/cli/dist/commands/harness.js +276 -0
- package/packages/cli/dist/commands/harness.js.map +1 -0
- package/packages/cli/dist/commands/init-ci.d.ts +19 -0
- package/packages/cli/dist/commands/init-ci.d.ts.map +1 -0
- package/packages/cli/dist/commands/init-ci.js +148 -0
- package/packages/cli/dist/commands/init-ci.js.map +1 -0
- package/packages/cli/dist/commands/init.d.ts +33 -0
- package/packages/cli/dist/commands/init.d.ts.map +1 -0
- package/packages/cli/dist/commands/init.js +157 -0
- package/packages/cli/dist/commands/init.js.map +1 -0
- package/packages/cli/dist/commands/install-hooks.d.ts +29 -0
- package/packages/cli/dist/commands/install-hooks.d.ts.map +1 -0
- package/packages/cli/dist/commands/install-hooks.js +139 -0
- package/packages/cli/dist/commands/install-hooks.js.map +1 -0
- package/packages/cli/dist/commands/integration-check.d.ts +62 -0
- package/packages/cli/dist/commands/integration-check.d.ts.map +1 -0
- package/packages/cli/dist/commands/integration-check.js +298 -0
- package/packages/cli/dist/commands/integration-check.js.map +1 -0
- package/packages/cli/dist/commands/ir-diff.d.ts +8 -0
- package/packages/cli/dist/commands/ir-diff.d.ts.map +1 -0
- package/packages/cli/dist/commands/ir-diff.js +199 -0
- package/packages/cli/dist/commands/ir-diff.js.map +1 -0
- package/packages/cli/dist/commands/lint-routes.d.ts +56 -0
- package/packages/cli/dist/commands/lint-routes.d.ts.map +1 -0
- package/packages/cli/dist/commands/lint-routes.js +228 -0
- package/packages/cli/dist/commands/lint-routes.js.map +1 -0
- package/packages/cli/dist/commands/load-test.d.ts +61 -0
- package/packages/cli/dist/commands/load-test.d.ts.map +1 -0
- package/packages/cli/dist/commands/load-test.js +675 -0
- package/packages/cli/dist/commands/load-test.js.map +1 -0
- package/packages/cli/dist/commands/migrate.d.ts +21 -0
- package/packages/cli/dist/commands/migrate.d.ts.map +1 -0
- package/packages/cli/dist/commands/migrate.js +264 -0
- package/packages/cli/dist/commands/migrate.js.map +1 -0
- package/packages/cli/dist/commands/mock.d.ts +79 -0
- package/packages/cli/dist/commands/mock.d.ts.map +1 -0
- package/packages/cli/dist/commands/mock.js +324 -0
- package/packages/cli/dist/commands/mock.js.map +1 -0
- package/packages/cli/dist/commands/pack-unpack.d.ts +30 -0
- package/packages/cli/dist/commands/pack-unpack.d.ts.map +1 -0
- package/packages/cli/dist/commands/pack-unpack.js +108 -0
- package/packages/cli/dist/commands/pack-unpack.js.map +1 -0
- package/packages/cli/dist/commands/preflight.d.ts +31 -0
- package/packages/cli/dist/commands/preflight.d.ts.map +1 -0
- package/packages/cli/dist/commands/preflight.js +246 -0
- package/packages/cli/dist/commands/preflight.js.map +1 -0
- package/packages/cli/dist/commands/profile.d.ts +30 -0
- package/packages/cli/dist/commands/profile.d.ts.map +1 -0
- package/packages/cli/dist/commands/profile.js +201 -0
- package/packages/cli/dist/commands/profile.js.map +1 -0
- package/packages/cli/dist/commands/repl.d.ts +16 -0
- package/packages/cli/dist/commands/repl.d.ts.map +1 -0
- package/packages/cli/dist/commands/repl.js +772 -0
- package/packages/cli/dist/commands/repl.js.map +1 -0
- package/packages/cli/dist/commands/routes.d.ts +24 -0
- package/packages/cli/dist/commands/routes.d.ts.map +1 -0
- package/packages/cli/dist/commands/routes.js +144 -0
- package/packages/cli/dist/commands/routes.js.map +1 -0
- package/packages/cli/dist/commands/scan.d.ts +23 -0
- package/packages/cli/dist/commands/scan.d.ts.map +1 -0
- package/packages/cli/dist/commands/scan.js +722 -0
- package/packages/cli/dist/commands/scan.js.map +1 -0
- package/packages/cli/dist/commands/seed.d.ts +35 -0
- package/packages/cli/dist/commands/seed.d.ts.map +1 -0
- package/packages/cli/dist/commands/seed.js +503 -0
- package/packages/cli/dist/commands/seed.js.map +1 -0
- package/packages/cli/dist/commands/validate-ai-ajv.d.ts +4 -0
- package/packages/cli/dist/commands/validate-ai-ajv.d.ts.map +1 -0
- package/packages/cli/dist/commands/validate-ai-ajv.js +78 -0
- package/packages/cli/dist/commands/validate-ai-ajv.js.map +1 -0
- package/packages/cli/dist/commands/validate-ai-compiler.d.ts +5 -0
- package/packages/cli/dist/commands/validate-ai-compiler.d.ts.map +1 -0
- package/packages/cli/dist/commands/validate-ai-compiler.js +8 -0
- package/packages/cli/dist/commands/validate-ai-compiler.js.map +1 -0
- package/packages/cli/dist/commands/validate-ai-report.d.ts +5 -0
- package/packages/cli/dist/commands/validate-ai-report.d.ts.map +1 -0
- package/packages/cli/dist/commands/validate-ai-report.js +80 -0
- package/packages/cli/dist/commands/validate-ai-report.js.map +1 -0
- package/packages/cli/dist/commands/validate-ai-resolve-inputs.d.ts +6 -0
- package/packages/cli/dist/commands/validate-ai-resolve-inputs.d.ts.map +1 -0
- package/packages/cli/dist/commands/validate-ai-resolve-inputs.js +54 -0
- package/packages/cli/dist/commands/validate-ai-resolve-inputs.js.map +1 -0
- package/packages/cli/dist/commands/validate-ai-semantic-checks.d.ts +4 -0
- package/packages/cli/dist/commands/validate-ai-semantic-checks.d.ts.map +1 -0
- package/packages/cli/dist/commands/validate-ai-semantic-checks.js +218 -0
- package/packages/cli/dist/commands/validate-ai-semantic-checks.js.map +1 -0
- package/packages/cli/dist/commands/validate-ai-types.d.ts +41 -0
- package/packages/cli/dist/commands/validate-ai-types.d.ts.map +1 -0
- package/packages/cli/dist/commands/validate-ai-types.js +2 -0
- package/packages/cli/dist/commands/validate-ai-types.js.map +1 -0
- package/packages/cli/dist/commands/validate-ai-validate-file.d.ts +5 -0
- package/packages/cli/dist/commands/validate-ai-validate-file.d.ts.map +1 -0
- package/packages/cli/dist/commands/validate-ai-validate-file.js +126 -0
- package/packages/cli/dist/commands/validate-ai-validate-file.js.map +1 -0
- package/packages/cli/dist/commands/validate-ai.d.ts +15 -0
- package/packages/cli/dist/commands/validate-ai.d.ts.map +1 -0
- package/packages/cli/dist/commands/validate-ai.js +124 -0
- package/packages/cli/dist/commands/validate-ai.js.map +1 -0
- package/packages/cli/dist/commands/validate.d.ts +15 -0
- package/packages/cli/dist/commands/validate.d.ts.map +1 -0
- package/packages/cli/dist/commands/validate.js +205 -0
- package/packages/cli/dist/commands/validate.js.map +1 -0
- package/packages/cli/dist/commands/versions.d.ts +56 -0
- package/packages/cli/dist/commands/versions.d.ts.map +1 -0
- package/packages/cli/dist/commands/versions.js +427 -0
- package/packages/cli/dist/commands/versions.js.map +1 -0
- package/packages/cli/dist/commands/watch.d.ts +34 -0
- package/packages/cli/dist/commands/watch.d.ts.map +1 -0
- package/packages/cli/dist/commands/watch.js +253 -0
- package/packages/cli/dist/commands/watch.js.map +1 -0
- package/packages/cli/dist/index.d.ts +14 -0
- package/packages/cli/dist/index.d.ts.map +1 -0
- package/packages/cli/dist/index.js +1159 -0
- package/packages/cli/dist/index.js.map +1 -0
- package/packages/cli/dist/utils/config-validate.d.ts +48 -0
- package/packages/cli/dist/utils/config-validate.d.ts.map +1 -0
- package/packages/cli/dist/utils/config-validate.js +116 -0
- package/packages/cli/dist/utils/config-validate.js.map +1 -0
- package/packages/cli/dist/utils/config.d.ts +360 -0
- package/packages/cli/dist/utils/config.d.ts.map +1 -0
- package/packages/cli/dist/utils/config.js +567 -0
- package/packages/cli/dist/utils/config.js.map +1 -0
- package/packages/cli/dist/utils/schema.d.ts +8 -0
- package/packages/cli/dist/utils/schema.d.ts.map +1 -0
- package/packages/cli/dist/utils/schema.js +13 -0
- package/packages/cli/dist/utils/schema.js.map +1 -0
- package/packages/lsp-server/bin/manifest-lsp.js +3 -0
- package/packages/lsp-server/dist/compiler-bridge.d.ts +24 -0
- package/packages/lsp-server/dist/compiler-bridge.d.ts.map +1 -0
- package/packages/lsp-server/dist/compiler-bridge.js +32 -0
- package/packages/lsp-server/dist/compiler-bridge.js.map +1 -0
- package/packages/lsp-server/dist/document-store.d.ts +23 -0
- package/packages/lsp-server/dist/document-store.d.ts.map +1 -0
- package/packages/lsp-server/dist/document-store.js +40 -0
- package/packages/lsp-server/dist/document-store.js.map +1 -0
- package/packages/lsp-server/dist/features/completion.d.ts +23 -0
- package/packages/lsp-server/dist/features/completion.d.ts.map +1 -0
- package/packages/lsp-server/dist/features/completion.js +293 -0
- package/packages/lsp-server/dist/features/completion.js.map +1 -0
- package/packages/lsp-server/dist/features/definition.d.ts +9 -0
- package/packages/lsp-server/dist/features/definition.d.ts.map +1 -0
- package/packages/lsp-server/dist/features/definition.js +24 -0
- package/packages/lsp-server/dist/features/definition.js.map +1 -0
- package/packages/lsp-server/dist/features/diagnostics.d.ts +8 -0
- package/packages/lsp-server/dist/features/diagnostics.d.ts.map +1 -0
- package/packages/lsp-server/dist/features/diagnostics.js +40 -0
- package/packages/lsp-server/dist/features/diagnostics.js.map +1 -0
- package/packages/lsp-server/dist/features/document-symbols.d.ts +8 -0
- package/packages/lsp-server/dist/features/document-symbols.d.ts.map +1 -0
- package/packages/lsp-server/dist/features/document-symbols.js +164 -0
- package/packages/lsp-server/dist/features/document-symbols.js.map +1 -0
- package/packages/lsp-server/dist/features/hover.d.ts +9 -0
- package/packages/lsp-server/dist/features/hover.d.ts.map +1 -0
- package/packages/lsp-server/dist/features/hover.js +100 -0
- package/packages/lsp-server/dist/features/hover.js.map +1 -0
- package/packages/lsp-server/dist/index.d.ts +6 -0
- package/packages/lsp-server/dist/index.d.ts.map +1 -0
- package/packages/lsp-server/dist/index.js +11 -0
- package/packages/lsp-server/dist/index.js.map +1 -0
- package/packages/lsp-server/dist/position-utils.d.ts +25 -0
- package/packages/lsp-server/dist/position-utils.d.ts.map +1 -0
- package/packages/lsp-server/dist/position-utils.js +39 -0
- package/packages/lsp-server/dist/position-utils.js.map +1 -0
- package/packages/lsp-server/dist/server.d.ts +14 -0
- package/packages/lsp-server/dist/server.d.ts.map +1 -0
- package/packages/lsp-server/dist/server.js +96 -0
- package/packages/lsp-server/dist/server.js.map +1 -0
- package/packages/lsp-server/dist/symbols/builtin-docs.d.ts +34 -0
- package/packages/lsp-server/dist/symbols/builtin-docs.d.ts.map +1 -0
- package/packages/lsp-server/dist/symbols/builtin-docs.js +193 -0
- package/packages/lsp-server/dist/symbols/builtin-docs.js.map +1 -0
- package/packages/lsp-server/dist/symbols/symbol-index.d.ts +18 -0
- package/packages/lsp-server/dist/symbols/symbol-index.d.ts.map +1 -0
- package/packages/lsp-server/dist/symbols/symbol-index.js +107 -0
- package/packages/lsp-server/dist/symbols/symbol-index.js.map +1 -0
- package/packages/mcp-server/bin/manifest-mcp.js +27 -0
- package/packages/mcp-server/dist/index.d.ts +24 -0
- package/packages/mcp-server/dist/index.d.ts.map +1 -0
- package/packages/mcp-server/dist/index.js +36 -0
- package/packages/mcp-server/dist/index.js.map +1 -0
- package/packages/mcp-server/dist/resources/ir-cache.d.ts +9 -0
- package/packages/mcp-server/dist/resources/ir-cache.d.ts.map +1 -0
- package/packages/mcp-server/dist/resources/ir-cache.js +47 -0
- package/packages/mcp-server/dist/resources/ir-cache.js.map +1 -0
- package/packages/mcp-server/dist/resources/ir-schema.d.ts +8 -0
- package/packages/mcp-server/dist/resources/ir-schema.d.ts.map +1 -0
- package/packages/mcp-server/dist/resources/ir-schema.js +39 -0
- package/packages/mcp-server/dist/resources/ir-schema.js.map +1 -0
- package/packages/mcp-server/dist/resources/semantics.d.ts +8 -0
- package/packages/mcp-server/dist/resources/semantics.d.ts.map +1 -0
- package/packages/mcp-server/dist/resources/semantics.js +38 -0
- package/packages/mcp-server/dist/resources/semantics.js.map +1 -0
- package/packages/mcp-server/dist/server.d.ts +7 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -0
- package/packages/mcp-server/dist/server.js +22 -0
- package/packages/mcp-server/dist/server.js.map +1 -0
- package/packages/mcp-server/dist/state/session-store.d.ts +39 -0
- package/packages/mcp-server/dist/state/session-store.d.ts.map +1 -0
- package/packages/mcp-server/dist/state/session-store.js +58 -0
- package/packages/mcp-server/dist/state/session-store.js.map +1 -0
- package/packages/mcp-server/dist/tools/compile.d.ts +30 -0
- package/packages/mcp-server/dist/tools/compile.d.ts.map +1 -0
- package/packages/mcp-server/dist/tools/compile.js +54 -0
- package/packages/mcp-server/dist/tools/compile.js.map +1 -0
- package/packages/mcp-server/dist/tools/execute.d.ts +112 -0
- package/packages/mcp-server/dist/tools/execute.d.ts.map +1 -0
- package/packages/mcp-server/dist/tools/execute.js +103 -0
- package/packages/mcp-server/dist/tools/execute.js.map +1 -0
- package/packages/mcp-server/dist/tools/explain.d.ts +25 -0
- package/packages/mcp-server/dist/tools/explain.d.ts.map +1 -0
- package/packages/mcp-server/dist/tools/explain.js +254 -0
- package/packages/mcp-server/dist/tools/explain.js.map +1 -0
- package/packages/mcp-server/dist/tools/validate.d.ts +23 -0
- package/packages/mcp-server/dist/tools/validate.d.ts.map +1 -0
- package/packages/mcp-server/dist/tools/validate.js +38 -0
- package/packages/mcp-server/dist/tools/validate.js.map +1 -0
- package/src/manifest/audit/sinks/postgres.sql +51 -0
- package/src/manifest/outbox/stores/postgres.sql +61 -0
|
@@ -0,0 +1,899 @@
|
|
|
1
|
+
import { COMPILER_VERSION, SCHEMA_VERSION } from './version.js';
|
|
2
|
+
export class CodeGenerator {
|
|
3
|
+
out = [];
|
|
4
|
+
serverOut = [];
|
|
5
|
+
testOut = [];
|
|
6
|
+
indent = 0;
|
|
7
|
+
provenance; // Definitely assigned in generate()
|
|
8
|
+
generate(program) {
|
|
9
|
+
this.out = [];
|
|
10
|
+
this.serverOut = [];
|
|
11
|
+
this.testOut = [];
|
|
12
|
+
this.indent = 0;
|
|
13
|
+
this.provenance = {
|
|
14
|
+
compilerVersion: COMPILER_VERSION,
|
|
15
|
+
schemaVersion: SCHEMA_VERSION,
|
|
16
|
+
generatedAt: new Date().toISOString(),
|
|
17
|
+
};
|
|
18
|
+
this.emitRuntime();
|
|
19
|
+
this.emitStoreRuntime(program);
|
|
20
|
+
for (const store of program.stores)
|
|
21
|
+
this.genStore(store);
|
|
22
|
+
for (const e of program.entities) {
|
|
23
|
+
this.genEntity(e);
|
|
24
|
+
this.line();
|
|
25
|
+
}
|
|
26
|
+
for (const c of program.commands) {
|
|
27
|
+
this.genCommand(c);
|
|
28
|
+
this.line();
|
|
29
|
+
}
|
|
30
|
+
for (const f of program.flows) {
|
|
31
|
+
this.genFlow(f);
|
|
32
|
+
this.line();
|
|
33
|
+
}
|
|
34
|
+
for (const e of program.effects) {
|
|
35
|
+
this.genEffect(e);
|
|
36
|
+
this.line();
|
|
37
|
+
}
|
|
38
|
+
for (const ev of program.events) {
|
|
39
|
+
this.genOutboxEvent(ev);
|
|
40
|
+
this.line();
|
|
41
|
+
}
|
|
42
|
+
for (const r of (program.reactions || [])) {
|
|
43
|
+
this.genReaction(r);
|
|
44
|
+
this.line();
|
|
45
|
+
}
|
|
46
|
+
for (const s of (program.sagas || [])) {
|
|
47
|
+
this.genSaga(s);
|
|
48
|
+
this.line();
|
|
49
|
+
}
|
|
50
|
+
for (const role of (program.roles || [])) {
|
|
51
|
+
this.genRole(role);
|
|
52
|
+
this.line();
|
|
53
|
+
}
|
|
54
|
+
for (const x of program.exposures) {
|
|
55
|
+
this.genExpose(x);
|
|
56
|
+
this.line();
|
|
57
|
+
}
|
|
58
|
+
for (const c of program.compositions) {
|
|
59
|
+
this.genComposition(c);
|
|
60
|
+
this.line();
|
|
61
|
+
}
|
|
62
|
+
this.emitExports(program);
|
|
63
|
+
this.genServerCode(program);
|
|
64
|
+
this.genTestCode(program);
|
|
65
|
+
return {
|
|
66
|
+
code: this.out.join('\n'),
|
|
67
|
+
serverCode: this.serverOut.join('\n'),
|
|
68
|
+
testCode: this.testOut.join('\n')
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
emitRuntime() {
|
|
72
|
+
this.line('// Generated by Manifest Compiler v2.0');
|
|
73
|
+
this.line('// This code is a PROJECTION from a Manifest source file.');
|
|
74
|
+
this.line('// The IR (Intermediate Representation) is the single source of truth.');
|
|
75
|
+
this.line('// This generated code should not be edited manually.');
|
|
76
|
+
this.line('//');
|
|
77
|
+
this.line(`// Provenance:`);
|
|
78
|
+
this.line(`// Compiler Version: ${this.provenance.compilerVersion}`);
|
|
79
|
+
this.line(`// Schema Version: ${this.provenance.schemaVersion}`);
|
|
80
|
+
this.line(`// Generated At: ${this.provenance.generatedAt}`);
|
|
81
|
+
this.line('//');
|
|
82
|
+
this.line('// Includes: Commands, Computed Properties, Relationships, Policies, Stores, Events');
|
|
83
|
+
this.line();
|
|
84
|
+
this.line('type Subscriber<T> = (value: T) => void;');
|
|
85
|
+
this.line('type User = { id: string; role?: string; [key: string]: unknown };');
|
|
86
|
+
this.line('type Context = { user?: User; [key: string]: unknown };');
|
|
87
|
+
this.line();
|
|
88
|
+
this.line('let _context: Context = {};');
|
|
89
|
+
this.line('const setContext = (ctx: Context) => { _context = ctx; };');
|
|
90
|
+
this.line('const getContext = () => _context;');
|
|
91
|
+
this.line();
|
|
92
|
+
this.line('class Observable<T> {');
|
|
93
|
+
this.in();
|
|
94
|
+
this.line('private subs: Set<Subscriber<T>> = new Set();');
|
|
95
|
+
this.line('private _v: T;');
|
|
96
|
+
this.line('constructor(v: T) { this._v = v; }');
|
|
97
|
+
this.line('get value(): T { return this._v; }');
|
|
98
|
+
this.line('set(v: T) { this._v = v; this.subs.forEach(fn => fn(v)); }');
|
|
99
|
+
this.line('subscribe(fn: Subscriber<T>) { this.subs.add(fn); fn(this._v); return () => this.subs.delete(fn); }');
|
|
100
|
+
this.de();
|
|
101
|
+
this.line('}');
|
|
102
|
+
this.line();
|
|
103
|
+
this.line('class EventEmitter<T extends Record<string, unknown>> {');
|
|
104
|
+
this.in();
|
|
105
|
+
this.line('private listeners: Map<keyof T, Set<(d: unknown) => void>> = new Map();');
|
|
106
|
+
this.line('on<K extends keyof T>(e: K, fn: (d: T[K]) => void) { if (!this.listeners.has(e)) this.listeners.set(e, new Set()); this.listeners.get(e)!.add(fn); return () => this.listeners.get(e)?.delete(fn); }');
|
|
107
|
+
this.line('emit<K extends keyof T>(e: K, d: T[K]) { this.listeners.get(e)?.forEach(fn => fn(d)); }');
|
|
108
|
+
this.de();
|
|
109
|
+
this.line('}');
|
|
110
|
+
this.line();
|
|
111
|
+
this.line('class EventBus {');
|
|
112
|
+
this.in();
|
|
113
|
+
this.line('private static channels: Map<string, Set<(d: unknown) => void>> = new Map();');
|
|
114
|
+
this.line('static publish(channel: string, data: unknown) { this.channels.get(channel)?.forEach(fn => fn(data)); }');
|
|
115
|
+
this.line('static subscribe(channel: string, fn: (d: unknown) => void) { if (!this.channels.has(channel)) this.channels.set(channel, new Set()); this.channels.get(channel)!.add(fn); return () => this.channels.get(channel)?.delete(fn); }');
|
|
116
|
+
this.de();
|
|
117
|
+
this.line('}');
|
|
118
|
+
this.line();
|
|
119
|
+
}
|
|
120
|
+
emitStoreRuntime(program) {
|
|
121
|
+
const hasSupabase = program.stores.some(s => s.target === 'supabase');
|
|
122
|
+
if (hasSupabase) {
|
|
123
|
+
this.line('// Development-time Supabase client mock (production runtime uses stores.node.ts:SupabaseStore)');
|
|
124
|
+
this.line('const supabase = { from: (table: string) => ({ select: () => Promise.resolve({ data: [], error: null }), insert: (d: unknown) => Promise.resolve({ data: d, error: null }), update: (d: unknown) => ({ eq: () => Promise.resolve({ data: d, error: null }) }), delete: () => ({ eq: () => Promise.resolve({ error: null }) }) }) };');
|
|
125
|
+
this.line();
|
|
126
|
+
}
|
|
127
|
+
this.line('interface Store<T> {');
|
|
128
|
+
this.in();
|
|
129
|
+
this.line('getAll(): Promise<T[]>;');
|
|
130
|
+
this.line('getById(id: string): Promise<T | null>;');
|
|
131
|
+
this.line('create(item: Partial<T>): Promise<T>;');
|
|
132
|
+
this.line('update(id: string, item: Partial<T>): Promise<T>;');
|
|
133
|
+
this.line('delete(id: string): Promise<boolean>;');
|
|
134
|
+
this.line('query(filter: (item: T) => boolean): Promise<T[]>;');
|
|
135
|
+
this.de();
|
|
136
|
+
this.line('}');
|
|
137
|
+
this.line();
|
|
138
|
+
this.line('class MemoryStore<T extends { id: string }> implements Store<T> {');
|
|
139
|
+
this.in();
|
|
140
|
+
this.line('private data: Map<string, T> = new Map();');
|
|
141
|
+
this.line('async getAll() { return Array.from(this.data.values()); }');
|
|
142
|
+
this.line('async getById(id: string) { return this.data.get(id) || null; }');
|
|
143
|
+
this.line('async create(item: Partial<T>) { const id = item.id || crypto.randomUUID(); const full = { ...item, id } as T; this.data.set(id, full); return full; }');
|
|
144
|
+
this.line('async update(id: string, item: Partial<T>) { const existing = this.data.get(id); if (!existing) throw new Error("Not found"); const updated = { ...existing, ...item }; this.data.set(id, updated); return updated; }');
|
|
145
|
+
this.line('async delete(id: string) { return this.data.delete(id); }');
|
|
146
|
+
this.line('async query(filter: (item: T) => boolean) { return Array.from(this.data.values()).filter(filter); }');
|
|
147
|
+
this.de();
|
|
148
|
+
this.line('}');
|
|
149
|
+
this.line();
|
|
150
|
+
this.line('class LocalStorageStore<T extends { id: string }> implements Store<T> {');
|
|
151
|
+
this.in();
|
|
152
|
+
this.line('constructor(private key: string) {}');
|
|
153
|
+
this.line('private load(): T[] { const d = localStorage.getItem(this.key); return d ? JSON.parse(d) : []; }');
|
|
154
|
+
this.line('private save(data: T[]) { localStorage.setItem(this.key, JSON.stringify(data)); }');
|
|
155
|
+
this.line('async getAll() { return this.load(); }');
|
|
156
|
+
this.line('async getById(id: string) { return this.load().find(x => x.id === id) || null; }');
|
|
157
|
+
this.line('async create(item: Partial<T>) { const data = this.load(); const id = item.id || crypto.randomUUID(); const full = { ...item, id } as T; data.push(full); this.save(data); return full; }');
|
|
158
|
+
this.line('async update(id: string, item: Partial<T>) { const data = this.load(); const idx = data.findIndex(x => x.id === id); if (idx < 0) throw new Error("Not found"); data[idx] = { ...data[idx], ...item }; this.save(data); return data[idx]; }');
|
|
159
|
+
this.line('async delete(id: string) { const data = this.load(); const idx = data.findIndex(x => x.id === id); if (idx < 0) return false; data.splice(idx, 1); this.save(data); return true; }');
|
|
160
|
+
this.line('async query(filter: (item: T) => boolean) { return this.load().filter(filter); }');
|
|
161
|
+
this.de();
|
|
162
|
+
this.line('}');
|
|
163
|
+
this.line();
|
|
164
|
+
if (hasSupabase) {
|
|
165
|
+
this.line('class SupabaseStore<T extends { id: string }> implements Store<T> {');
|
|
166
|
+
this.in();
|
|
167
|
+
this.line('constructor(private table: string) {}');
|
|
168
|
+
this.line('async getAll() { const { data } = await supabase.from(this.table).select(); return (data || []) as T[]; }');
|
|
169
|
+
this.line('async getById(id: string) { const { data } = await supabase.from(this.table).select().eq("id", id).single(); return data as T | null; }');
|
|
170
|
+
this.line('async create(item: Partial<T>) { const { data } = await supabase.from(this.table).insert(item).select().single(); return data as T; }');
|
|
171
|
+
this.line('async update(id: string, item: Partial<T>) { const { data } = await supabase.from(this.table).update(item).eq("id", id).select().single(); return data as T; }');
|
|
172
|
+
this.line('async delete(id: string) { const { error } = await supabase.from(this.table).delete().eq("id", id); return !error; }');
|
|
173
|
+
this.line('async query(filter: (item: T) => boolean) { const all = await this.getAll(); return all.filter(filter); }');
|
|
174
|
+
this.de();
|
|
175
|
+
this.line('}');
|
|
176
|
+
this.line();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
genStore(store) {
|
|
180
|
+
const storeName = `${store.entity}Store`;
|
|
181
|
+
switch (store.target) {
|
|
182
|
+
case 'memory':
|
|
183
|
+
this.line(`const ${storeName}: Store<I${store.entity}> = new MemoryStore();`);
|
|
184
|
+
break;
|
|
185
|
+
case 'localStorage': {
|
|
186
|
+
const key = store.config?.['key'] ? this.genExpr(store.config['key']) : `"${store.entity.toLowerCase()}s"`;
|
|
187
|
+
this.line(`const ${storeName}: Store<I${store.entity}> = new LocalStorageStore(${key});`);
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
case 'supabase':
|
|
191
|
+
case 'postgres': {
|
|
192
|
+
const table = store.config?.['table'] ? this.genExpr(store.config['table']) : `"${store.entity.toLowerCase()}s"`;
|
|
193
|
+
this.line(`const ${storeName}: Store<I${store.entity}> = new SupabaseStore(${table});`);
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
this.line();
|
|
198
|
+
}
|
|
199
|
+
genEntity(e) {
|
|
200
|
+
const iface = `I${e.name}`;
|
|
201
|
+
this.line(`interface ${iface} {`);
|
|
202
|
+
this.in();
|
|
203
|
+
for (const p of e.properties) {
|
|
204
|
+
const opt = p.modifiers.includes('required') ? '' : '?';
|
|
205
|
+
this.line(`${p.name}${opt}: ${this.tsType(p.dataType)};`);
|
|
206
|
+
}
|
|
207
|
+
for (const cp of e.computedProperties) {
|
|
208
|
+
this.line(`readonly ${cp.name}: ${this.tsType(cp.dataType)};`);
|
|
209
|
+
}
|
|
210
|
+
for (const r of e.relationships) {
|
|
211
|
+
this.line(`${r.name}${r.kind === 'belongsTo' || r.kind === 'ref' ? '?' : ''}: ${this.relationType(r)};`);
|
|
212
|
+
}
|
|
213
|
+
this.de();
|
|
214
|
+
this.line('}');
|
|
215
|
+
this.line();
|
|
216
|
+
const events = this.collectEvents(e);
|
|
217
|
+
const evtMap = events.size ? `{ ${[...events].map(ev => `${ev}: unknown`).join('; ')} }` : '{}';
|
|
218
|
+
this.line(`class ${e.name} extends EventEmitter<${evtMap}> {`);
|
|
219
|
+
this.in();
|
|
220
|
+
for (const p of e.properties) {
|
|
221
|
+
const def = p.defaultValue ? this.genExpr(p.defaultValue) : this.defVal(p.dataType);
|
|
222
|
+
this.line(`private _${p.name} = new Observable(${def});`);
|
|
223
|
+
}
|
|
224
|
+
this.line();
|
|
225
|
+
for (const p of e.properties) {
|
|
226
|
+
this.line(`get ${p.name}() { return this._${p.name}.value; }`);
|
|
227
|
+
if (!p.modifiers.includes('readonly')) {
|
|
228
|
+
this.line(`set ${p.name}(v: ${this.tsType(p.dataType)}) {`);
|
|
229
|
+
this.in();
|
|
230
|
+
this.genConstraintChecks(e.constraints, p.name);
|
|
231
|
+
this.line(`const old = this._${p.name}.value;`);
|
|
232
|
+
this.line(`this._${p.name}.set(v);`);
|
|
233
|
+
this.line(`if (old !== v) this._recompute();`);
|
|
234
|
+
this.de();
|
|
235
|
+
this.line('}');
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
for (const cp of e.computedProperties) {
|
|
239
|
+
this.line(`private _computed_${cp.name}: ${this.tsType(cp.dataType)} = ${this.defVal(cp.dataType)};`);
|
|
240
|
+
this.line(`get ${cp.name}() { return this._computed_${cp.name}; }`);
|
|
241
|
+
}
|
|
242
|
+
for (const r of e.relationships) {
|
|
243
|
+
if (r.kind === 'hasMany') {
|
|
244
|
+
this.line(`private _rel_${r.name}: ${r.target}[] = [];`);
|
|
245
|
+
this.line(`get ${r.name}() { return this._rel_${r.name}; }`);
|
|
246
|
+
this.line(`add${this.capitalize(r.name.replace(/s$/, ''))}(item: ${r.target}) { this._rel_${r.name}.push(item); }`);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
this.line(`private _rel_${r.name}: ${r.target} | null = null;`);
|
|
250
|
+
this.line(`get ${r.name}() { return this._rel_${r.name}; }`);
|
|
251
|
+
this.line(`set ${r.name}(v: ${r.target} | null) { this._rel_${r.name} = v; }`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
this.line();
|
|
255
|
+
this.line(`constructor(init?: Partial<${iface}>) {`);
|
|
256
|
+
this.in();
|
|
257
|
+
this.line('super();');
|
|
258
|
+
this.line('if (init) {');
|
|
259
|
+
this.in();
|
|
260
|
+
for (const p of e.properties)
|
|
261
|
+
this.line(`if (init.${p.name} !== undefined) this._${p.name}.set(init.${p.name});`);
|
|
262
|
+
this.de();
|
|
263
|
+
this.line('}');
|
|
264
|
+
this.line('this._initBehaviors();');
|
|
265
|
+
this.line('this._recompute();');
|
|
266
|
+
this.de();
|
|
267
|
+
this.line('}');
|
|
268
|
+
this.line();
|
|
269
|
+
this.line('private _recompute() {');
|
|
270
|
+
this.in();
|
|
271
|
+
for (const cp of e.computedProperties) {
|
|
272
|
+
this.line(`this._computed_${cp.name} = ${this.genExpr(cp.expression).replace(/\bthis\./g, 'this.')};`);
|
|
273
|
+
}
|
|
274
|
+
this.de();
|
|
275
|
+
this.line('}');
|
|
276
|
+
this.line();
|
|
277
|
+
this.line('private _initBehaviors() {');
|
|
278
|
+
this.in();
|
|
279
|
+
for (const b of e.behaviors)
|
|
280
|
+
this.genBehaviorBinding(b);
|
|
281
|
+
this.de();
|
|
282
|
+
this.line('}');
|
|
283
|
+
if (e.policies.length > 0) {
|
|
284
|
+
this.line();
|
|
285
|
+
this.line('checkPolicy(action: string, user: User): boolean {');
|
|
286
|
+
this.in();
|
|
287
|
+
this.line('const context = getContext();');
|
|
288
|
+
for (const p of e.policies) {
|
|
289
|
+
const actionCheck = p.action === 'all' ? 'true' : `action === "${p.action}"`;
|
|
290
|
+
this.line(`if (${actionCheck} && !(${this.genExpr(p.expression)})) return false;`);
|
|
291
|
+
}
|
|
292
|
+
this.line('return true;');
|
|
293
|
+
this.de();
|
|
294
|
+
this.line('}');
|
|
295
|
+
}
|
|
296
|
+
this.line();
|
|
297
|
+
this.line(`subscribe(prop: keyof ${iface}, fn: (v: unknown) => void) { return (this as Record<string, unknown>)[\`_\${prop}\`]?.subscribe?.(fn); }`);
|
|
298
|
+
this.line();
|
|
299
|
+
this.line('toJSON() {');
|
|
300
|
+
this.in();
|
|
301
|
+
this.line('return {');
|
|
302
|
+
this.in();
|
|
303
|
+
for (const p of e.properties)
|
|
304
|
+
this.line(`${p.name}: this.${p.name},`);
|
|
305
|
+
for (const cp of e.computedProperties)
|
|
306
|
+
this.line(`${cp.name}: this.${cp.name},`);
|
|
307
|
+
this.de();
|
|
308
|
+
this.line('};');
|
|
309
|
+
this.de();
|
|
310
|
+
this.line('}');
|
|
311
|
+
for (const cmd of e.commands)
|
|
312
|
+
this.genCommandMethod(cmd, e);
|
|
313
|
+
for (const b of e.behaviors)
|
|
314
|
+
if (b.trigger.event !== 'create' && !b.trigger.event.startsWith('_'))
|
|
315
|
+
this.genBehaviorMethod(b);
|
|
316
|
+
this.de();
|
|
317
|
+
this.line('}');
|
|
318
|
+
}
|
|
319
|
+
collectEvents(e) {
|
|
320
|
+
const events = new Set();
|
|
321
|
+
for (const b of e.behaviors) {
|
|
322
|
+
events.add(b.trigger.event);
|
|
323
|
+
for (const a of b.actions) {
|
|
324
|
+
if (a.kind === 'emit' && a.expression.type === 'Identifier' && 'name' in a.expression)
|
|
325
|
+
events.add(a.expression.name);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
for (const cmd of e.commands) {
|
|
329
|
+
if (cmd.emits)
|
|
330
|
+
cmd.emits.forEach(ev => events.add(ev));
|
|
331
|
+
}
|
|
332
|
+
return events;
|
|
333
|
+
}
|
|
334
|
+
relationType(r) {
|
|
335
|
+
if (r.kind === 'hasMany')
|
|
336
|
+
return `${r.target}[]`;
|
|
337
|
+
return `${r.target} | null`;
|
|
338
|
+
}
|
|
339
|
+
genCommandMethod(cmd, entity) {
|
|
340
|
+
const params = cmd.parameters.map(p => `${p.name}${p.required ? '' : '?'}: ${this.tsType(p.dataType)}`).join(', ');
|
|
341
|
+
// Return the last action result type if specified, otherwise infer from actions or default to unknown
|
|
342
|
+
const returnType = cmd.returns ? this.tsType(cmd.returns) : 'unknown';
|
|
343
|
+
this.line();
|
|
344
|
+
this.line(`async ${cmd.name}(${params}): Promise<${returnType}> {`);
|
|
345
|
+
this.in();
|
|
346
|
+
// Check policies first (if entity has policies with execute/all action)
|
|
347
|
+
if (entity && entity.policies.length > 0) {
|
|
348
|
+
this.line('// Policy checks');
|
|
349
|
+
const hasRelevantPolicies = entity.policies.some(p => p.action === 'all' || p.action === 'execute');
|
|
350
|
+
if (hasRelevantPolicies) {
|
|
351
|
+
this.line(`const user = getContext().user;`);
|
|
352
|
+
for (const p of entity.policies) {
|
|
353
|
+
if (p.action !== 'all' && p.action !== 'execute')
|
|
354
|
+
continue;
|
|
355
|
+
this.line(`if (!(${this.genExpr(p.expression)})) throw new Error(${JSON.stringify(p.message || `Denied by policy '${p.name}'`)});`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
// Check guards
|
|
360
|
+
if (cmd.guards && cmd.guards.length > 0) {
|
|
361
|
+
this.line('// Guard checks');
|
|
362
|
+
for (const g of cmd.guards) {
|
|
363
|
+
this.line(`if (!(${this.genExpr(g)})) throw new Error("Guard failed for ${cmd.name}");`);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
// Execute actions and capture the last result
|
|
367
|
+
if (cmd.actions.length > 0) {
|
|
368
|
+
this.line('let _result: unknown;');
|
|
369
|
+
for (const action of cmd.actions) {
|
|
370
|
+
this.line(`_result = ${this.genAction(action)};`);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (cmd.emits) {
|
|
374
|
+
for (const ev of cmd.emits) {
|
|
375
|
+
this.line(`this.emit('${ev}', { ${cmd.parameters.map(p => p.name).join(', ')} });`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
// Return the last action result
|
|
379
|
+
if (cmd.actions.length > 0) {
|
|
380
|
+
this.line(`return _result as ${returnType};`);
|
|
381
|
+
}
|
|
382
|
+
this.de();
|
|
383
|
+
this.line('}');
|
|
384
|
+
}
|
|
385
|
+
genCommand(cmd) {
|
|
386
|
+
const params = cmd.parameters.map(p => `${p.name}${p.required ? '' : '?'}: ${this.tsType(p.dataType)}`).join(', ');
|
|
387
|
+
const returnType = cmd.returns ? this.tsType(cmd.returns) : 'unknown';
|
|
388
|
+
this.line(`async function ${cmd.name}(${params}): Promise<${returnType}> {`);
|
|
389
|
+
this.in();
|
|
390
|
+
if (cmd.guards && cmd.guards.length > 0) {
|
|
391
|
+
this.line('// Guard checks');
|
|
392
|
+
for (const g of cmd.guards) {
|
|
393
|
+
this.line(`if (!(${this.genExpr(g)})) throw new Error("Guard failed for ${cmd.name}");`);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
// Execute actions and capture the last result
|
|
397
|
+
if (cmd.actions.length > 0) {
|
|
398
|
+
this.line('let _result: unknown;');
|
|
399
|
+
for (const action of cmd.actions) {
|
|
400
|
+
this.line(`_result = ${this.genAction(action)};`);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (cmd.emits) {
|
|
404
|
+
for (const ev of cmd.emits) {
|
|
405
|
+
this.line(`EventBus.publish('${ev}', { ${cmd.parameters.map(p => p.name).join(', ')} });`);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
// Return the last action result
|
|
409
|
+
if (cmd.actions.length > 0) {
|
|
410
|
+
this.line(`return _result as ${returnType};`);
|
|
411
|
+
}
|
|
412
|
+
this.de();
|
|
413
|
+
this.line('}');
|
|
414
|
+
}
|
|
415
|
+
genOutboxEvent(ev) {
|
|
416
|
+
if ('fields' in ev.payload && Array.isArray(ev.payload.fields)) {
|
|
417
|
+
const payloadType = `{ ${ev.payload.fields.map((f) => `${f.name}: ${this.tsType(f.dataType)}`).join('; ')} }`;
|
|
418
|
+
this.line(`interface ${ev.name}Event ${payloadType}`);
|
|
419
|
+
this.line();
|
|
420
|
+
this.line(`const publish${ev.name} = (data: ${ev.name}Event) => {`);
|
|
421
|
+
this.in();
|
|
422
|
+
this.line(`EventBus.publish('${ev.channel}', data);`);
|
|
423
|
+
this.de();
|
|
424
|
+
this.line('};');
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
// At this point, ev.payload must be TypeNode (not { fields }) since we returned above
|
|
428
|
+
const payloadType = this.tsType(ev.payload);
|
|
429
|
+
this.line(`interface ${ev.name}Event ${payloadType}`);
|
|
430
|
+
this.line();
|
|
431
|
+
this.line(`const publish${ev.name} = (data: ${ev.name}Event) => {`);
|
|
432
|
+
this.in();
|
|
433
|
+
this.line(`EventBus.publish('${ev.channel}', data);`);
|
|
434
|
+
this.de();
|
|
435
|
+
this.line('};');
|
|
436
|
+
this.line();
|
|
437
|
+
this.line(`const subscribe${ev.name} = (fn: (data: ${ev.name}Event) => void) => {`);
|
|
438
|
+
this.in();
|
|
439
|
+
this.line(`return EventBus.subscribe('${ev.channel}', fn);`);
|
|
440
|
+
this.de();
|
|
441
|
+
this.line('};');
|
|
442
|
+
}
|
|
443
|
+
genReaction(r) {
|
|
444
|
+
const paramsStr = r.params
|
|
445
|
+
? `{ ${r.params.map(p => `${p.name}: ${this.genExpr(p.expression)}`).join(', ')} }`
|
|
446
|
+
: '{}';
|
|
447
|
+
this.line(`// Reaction: on ${r.event} → ${r.targetEntity}.${r.targetCommand}`);
|
|
448
|
+
this.line(`EventBus.subscribe('${r.event}', async (payload) => {`);
|
|
449
|
+
this.in();
|
|
450
|
+
if (r.fanOut) {
|
|
451
|
+
// Fan-out: run the command on every target row where row.<matchField> == matchSource.
|
|
452
|
+
const sourceExpr = this.genExpr(r.fanOut.matchSource);
|
|
453
|
+
this.line(`const __matches = await ${r.targetEntity}Store.query((row) => (row as any).${r.fanOut.matchField} === ${sourceExpr});`);
|
|
454
|
+
this.line(`for (const __m of __matches) {`);
|
|
455
|
+
this.in();
|
|
456
|
+
this.line(`await ${r.targetEntity}Store.runCommand('${r.targetCommand}', (__m as any).id, ${paramsStr});`);
|
|
457
|
+
this.de();
|
|
458
|
+
this.line(`}`);
|
|
459
|
+
}
|
|
460
|
+
else if (r.resolve) {
|
|
461
|
+
this.line(`const instanceId = ${this.genExpr(r.resolve)};`);
|
|
462
|
+
this.line(`await ${r.targetEntity}Store.runCommand('${r.targetCommand}', instanceId, ${paramsStr});`);
|
|
463
|
+
}
|
|
464
|
+
this.de();
|
|
465
|
+
this.line('});');
|
|
466
|
+
}
|
|
467
|
+
genRole(role) {
|
|
468
|
+
this.line(`// Role: ${role.name}${role.parent ? ` extends ${role.parent}` : ''}`);
|
|
469
|
+
this.line(`const ${role.name}Role = {`);
|
|
470
|
+
this.in();
|
|
471
|
+
this.line(`name: '${role.name}',`);
|
|
472
|
+
if (role.parent)
|
|
473
|
+
this.line(`parent: '${role.parent}',`);
|
|
474
|
+
const allows = role.permissions.filter(p => p.kind === 'allow');
|
|
475
|
+
const denies = role.permissions.filter(p => p.kind === 'deny');
|
|
476
|
+
if (allows.length > 0) {
|
|
477
|
+
this.line(`allow: [${allows.map(p => `{ action: '${p.action}'${p.target ? `, target: '${p.target}'` : ''} }`).join(', ')}],`);
|
|
478
|
+
}
|
|
479
|
+
if (denies.length > 0) {
|
|
480
|
+
this.line(`deny: [${denies.map(p => `{ action: '${p.action}'${p.target ? `, target: '${p.target}'` : ''} }`).join(', ')}],`);
|
|
481
|
+
}
|
|
482
|
+
this.de();
|
|
483
|
+
this.line('} as const;');
|
|
484
|
+
}
|
|
485
|
+
genSaga(s) {
|
|
486
|
+
this.line(`// Saga: ${s.name} (on_failure: ${s.onFailure})`);
|
|
487
|
+
this.line(`export const ${s.name}Saga = {`);
|
|
488
|
+
this.in();
|
|
489
|
+
this.line(`name: '${s.name}',`);
|
|
490
|
+
this.line(`onFailure: '${s.onFailure}',`);
|
|
491
|
+
this.line(`steps: [`);
|
|
492
|
+
this.in();
|
|
493
|
+
for (const step of s.steps) {
|
|
494
|
+
const comp = step.compensate
|
|
495
|
+
? `, compensate: '${step.compensateEntity}.${step.compensate}'`
|
|
496
|
+
: '';
|
|
497
|
+
this.line(`{ name: '${step.name}', command: '${step.commandEntity}.${step.command}'${comp} },`);
|
|
498
|
+
}
|
|
499
|
+
this.de();
|
|
500
|
+
this.line(`],`);
|
|
501
|
+
this.line(`emits: [${s.emits.map(e => `'${e}'`).join(', ')}],`);
|
|
502
|
+
this.de();
|
|
503
|
+
this.line('} as const;');
|
|
504
|
+
}
|
|
505
|
+
genConstraintChecks(constraints, prop) {
|
|
506
|
+
for (const c of constraints) {
|
|
507
|
+
const expr = this.genExpr(c.expression);
|
|
508
|
+
if (expr.includes(prop) || expr.includes('this.')) {
|
|
509
|
+
this.line(`if (!(${expr.replace(new RegExp(`this\\.${prop}`, 'g'), 'v')})) throw new Error(${JSON.stringify(c.message || `Constraint '${c.name}' violated`)});`);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
genBehaviorBinding(b) {
|
|
514
|
+
if (b.trigger.event === 'create') {
|
|
515
|
+
for (const a of b.actions)
|
|
516
|
+
this.line(this.genAction(a));
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
const params = b.trigger.parameters?.join(', ') || 'd';
|
|
520
|
+
this.line(`this.on('${b.trigger.event}', (${params}) => {`);
|
|
521
|
+
this.in();
|
|
522
|
+
if (b.guards?.length) {
|
|
523
|
+
const g = b.guards.map(x => `(${this.genExpr(x)})`).join(' && ');
|
|
524
|
+
this.line(`if (!(${g})) return;`);
|
|
525
|
+
}
|
|
526
|
+
for (const a of b.actions)
|
|
527
|
+
this.line(this.genAction(a));
|
|
528
|
+
this.de();
|
|
529
|
+
this.line('});');
|
|
530
|
+
}
|
|
531
|
+
genBehaviorMethod(b) {
|
|
532
|
+
const params = b.trigger.parameters || [];
|
|
533
|
+
this.line();
|
|
534
|
+
this.line(`${b.trigger.event}(${params.map(p => `${p}: unknown`).join(', ')}) {`);
|
|
535
|
+
this.in();
|
|
536
|
+
this.line(`this.emit('${b.trigger.event}', ${params.length ? `{ ${params.join(', ')} }` : '{}'});`);
|
|
537
|
+
this.de();
|
|
538
|
+
this.line('}');
|
|
539
|
+
}
|
|
540
|
+
genAction(a) {
|
|
541
|
+
if (a.kind === 'mutate')
|
|
542
|
+
return `this.${a.target} = ${this.genExpr(a.expression)};`;
|
|
543
|
+
if (a.kind === 'emit') {
|
|
544
|
+
if (a.expression.type === 'Identifier' && 'name' in a.expression)
|
|
545
|
+
return `this.emit('${a.expression.name}', {});`;
|
|
546
|
+
return `this.emit('event', ${this.genExpr(a.expression)});`;
|
|
547
|
+
}
|
|
548
|
+
if (a.kind === 'effect')
|
|
549
|
+
return `await (${this.genExpr(a.expression)});`;
|
|
550
|
+
if (a.kind === 'publish')
|
|
551
|
+
return `EventBus.publish('event', ${this.genExpr(a.expression)});`;
|
|
552
|
+
if (a.kind === 'persist')
|
|
553
|
+
return `await ${a.target}Store.update(this.id, this.toJSON());`;
|
|
554
|
+
return `${this.genExpr(a.expression)};`;
|
|
555
|
+
}
|
|
556
|
+
genFlow(f) {
|
|
557
|
+
this.line(`function ${f.name}(input: ${this.tsType(f.input)}): ${this.tsType(f.output)} {`);
|
|
558
|
+
this.in();
|
|
559
|
+
this.line('let _v = input;');
|
|
560
|
+
this.line();
|
|
561
|
+
for (const s of f.steps) {
|
|
562
|
+
const expr = this.genExpr(s.expression);
|
|
563
|
+
if (s.condition) {
|
|
564
|
+
this.line(`if (${this.genExpr(s.condition)}) {`);
|
|
565
|
+
this.in();
|
|
566
|
+
}
|
|
567
|
+
if (s.operation === 'map')
|
|
568
|
+
this.line(`_v = (${expr})(_v);`);
|
|
569
|
+
else if (s.operation === 'filter')
|
|
570
|
+
this.line(`if (!(${expr})(_v)) return null;`);
|
|
571
|
+
else if (s.operation === 'validate')
|
|
572
|
+
this.line(`if (!(${expr})(_v)) throw new Error('Validation failed');`);
|
|
573
|
+
else if (s.operation === 'transform')
|
|
574
|
+
this.line(`_v = ${expr};`);
|
|
575
|
+
else if (s.operation === 'tap')
|
|
576
|
+
this.line(`(${expr})(_v);`);
|
|
577
|
+
else
|
|
578
|
+
this.line(`_v = ${expr};`);
|
|
579
|
+
if (s.condition) {
|
|
580
|
+
this.de();
|
|
581
|
+
this.line('}');
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
this.line();
|
|
585
|
+
this.line('return _v;');
|
|
586
|
+
this.de();
|
|
587
|
+
this.line('}');
|
|
588
|
+
}
|
|
589
|
+
genEffect(e) {
|
|
590
|
+
this.line(`const ${e.name}Effect = {`);
|
|
591
|
+
this.in();
|
|
592
|
+
this.line(`kind: '${e.kind}' as const,`);
|
|
593
|
+
if (e.kind === 'http') {
|
|
594
|
+
const url = e.config['url'] ? this.genExpr(e.config['url']) : '""';
|
|
595
|
+
const method = e.config['method'] ? this.genExpr(e.config['method']) : '"GET"';
|
|
596
|
+
this.line(`async execute(data?: unknown) {`);
|
|
597
|
+
this.in();
|
|
598
|
+
this.line(`const res = await fetch(${url}, { method: ${method}, headers: { 'Content-Type': 'application/json' }, body: data ? JSON.stringify(data) : undefined });`);
|
|
599
|
+
this.line('return res.json();');
|
|
600
|
+
this.de();
|
|
601
|
+
this.line('},');
|
|
602
|
+
}
|
|
603
|
+
else if (e.kind === 'storage') {
|
|
604
|
+
const key = e.config['key'] ? this.genExpr(e.config['key']) : '"data"';
|
|
605
|
+
this.line(`get() { const d = localStorage.getItem(${key}); return d ? JSON.parse(d) : null; },`);
|
|
606
|
+
this.line(`set(v: unknown) { localStorage.setItem(${key}, JSON.stringify(v)); },`);
|
|
607
|
+
this.line(`remove() { localStorage.removeItem(${key}); },`);
|
|
608
|
+
}
|
|
609
|
+
else if (e.kind === 'timer') {
|
|
610
|
+
const interval = e.config['interval'] ? this.genExpr(e.config['interval']) : '1000';
|
|
611
|
+
this.line(`start(cb: () => void) { return setInterval(cb, ${interval}); },`);
|
|
612
|
+
this.line('stop(id: number) { clearInterval(id); },');
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
this.line('config: {');
|
|
616
|
+
this.in();
|
|
617
|
+
for (const [k, v] of Object.entries(e.config))
|
|
618
|
+
this.line(`${k}: ${this.genExpr(v)},`);
|
|
619
|
+
this.de();
|
|
620
|
+
this.line('},');
|
|
621
|
+
this.line('execute(data?: unknown) { /* custom */ },');
|
|
622
|
+
}
|
|
623
|
+
this.de();
|
|
624
|
+
this.line('};');
|
|
625
|
+
}
|
|
626
|
+
genExpose(x) {
|
|
627
|
+
if (x.protocol === 'rest') {
|
|
628
|
+
// Use entity name for variable (always valid identifier), path for basePath
|
|
629
|
+
const apiName = x.entity;
|
|
630
|
+
const basePath = x.name.startsWith('/') ? x.name : `/${x.name}`;
|
|
631
|
+
this.line(`const ${apiName}API = {`);
|
|
632
|
+
this.in();
|
|
633
|
+
this.line(`basePath: '${basePath}',`);
|
|
634
|
+
this.line(`entity: ${x.entity},`);
|
|
635
|
+
const ops = x.operations.length ? x.operations : ['list', 'get', 'create', 'update', 'delete'];
|
|
636
|
+
if (ops.includes('list'))
|
|
637
|
+
this.line(`async list(q?: Record<string, unknown>) { return ${x.entity}Store.getAll(); },`);
|
|
638
|
+
if (ops.includes('get'))
|
|
639
|
+
this.line(`async get(id: string) { return ${x.entity}Store.getById(id); },`);
|
|
640
|
+
if (ops.includes('create'))
|
|
641
|
+
this.line(`async create(d: Partial<I${x.entity}>) { return ${x.entity}Store.create(d); },`);
|
|
642
|
+
if (ops.includes('update'))
|
|
643
|
+
this.line(`async update(id: string, d: Partial<I${x.entity}>) { return ${x.entity}Store.update(id, d); },`);
|
|
644
|
+
if (ops.includes('delete'))
|
|
645
|
+
this.line(`async delete(id: string) { return ${x.entity}Store.delete(id); },`);
|
|
646
|
+
this.de();
|
|
647
|
+
this.line('};');
|
|
648
|
+
}
|
|
649
|
+
else if (x.protocol === 'function') {
|
|
650
|
+
this.line(`function create${x.entity}(d: Partial<I${x.entity}>) { return new ${x.entity}(d); }`);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
genServerCode(program) {
|
|
654
|
+
this.serverOut.push('// Generated Server Code - Express/Hono compatible routes');
|
|
655
|
+
this.serverOut.push('// Copy this to your server file');
|
|
656
|
+
this.serverOut.push('');
|
|
657
|
+
this.serverOut.push('import { Hono } from "hono";');
|
|
658
|
+
this.serverOut.push('import { cors } from "hono/cors";');
|
|
659
|
+
this.serverOut.push('');
|
|
660
|
+
this.serverOut.push('const app = new Hono();');
|
|
661
|
+
this.serverOut.push('app.use("*", cors());');
|
|
662
|
+
this.serverOut.push('');
|
|
663
|
+
for (const x of program.exposures.filter(e => e.generateServer && e.protocol === 'rest')) {
|
|
664
|
+
const entity = program.entities.find(e => e.name === x.entity);
|
|
665
|
+
const basePath = `/${x.name}`;
|
|
666
|
+
const ops = x.operations.length ? x.operations : ['list', 'get', 'create', 'update', 'delete'];
|
|
667
|
+
this.serverOut.push(`// ${x.entity} Routes`);
|
|
668
|
+
if (ops.includes('list')) {
|
|
669
|
+
this.serverOut.push(`app.get("${basePath}", async (c) => {`);
|
|
670
|
+
this.serverOut.push(` const items = await ${x.entity}Store.getAll();`);
|
|
671
|
+
this.serverOut.push(` return c.json(items);`);
|
|
672
|
+
this.serverOut.push(`});`);
|
|
673
|
+
}
|
|
674
|
+
if (ops.includes('get')) {
|
|
675
|
+
this.serverOut.push(`app.get("${basePath}/:id", async (c) => {`);
|
|
676
|
+
this.serverOut.push(` const item = await ${x.entity}Store.getById(c.req.param("id"));`);
|
|
677
|
+
this.serverOut.push(` if (!item) return c.json({ error: "Not found" }, 404);`);
|
|
678
|
+
this.serverOut.push(` return c.json(item);`);
|
|
679
|
+
this.serverOut.push(`});`);
|
|
680
|
+
}
|
|
681
|
+
if (ops.includes('create')) {
|
|
682
|
+
this.serverOut.push(`app.post("${basePath}", async (c) => {`);
|
|
683
|
+
this.serverOut.push(` const body = await c.req.json();`);
|
|
684
|
+
if (entity?.constraints.length) {
|
|
685
|
+
this.serverOut.push(` // Validation from constraints`);
|
|
686
|
+
for (const constraint of entity.constraints) {
|
|
687
|
+
this.serverOut.push(` if (!(${this.genExpr(constraint.expression).replace(/this\./g, 'body.')})) {`);
|
|
688
|
+
this.serverOut.push(` return c.json({ error: ${JSON.stringify(constraint.message || constraint.name)} }, 400);`);
|
|
689
|
+
this.serverOut.push(` }`);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
this.serverOut.push(` const item = await ${x.entity}Store.create(body);`);
|
|
693
|
+
this.serverOut.push(` return c.json(item, 201);`);
|
|
694
|
+
this.serverOut.push(`});`);
|
|
695
|
+
}
|
|
696
|
+
if (ops.includes('update')) {
|
|
697
|
+
this.serverOut.push(`app.put("${basePath}/:id", async (c) => {`);
|
|
698
|
+
this.serverOut.push(` const body = await c.req.json();`);
|
|
699
|
+
this.serverOut.push(` const item = await ${x.entity}Store.update(c.req.param("id"), body);`);
|
|
700
|
+
this.serverOut.push(` return c.json(item);`);
|
|
701
|
+
this.serverOut.push(`});`);
|
|
702
|
+
}
|
|
703
|
+
if (ops.includes('delete')) {
|
|
704
|
+
this.serverOut.push(`app.delete("${basePath}/:id", async (c) => {`);
|
|
705
|
+
this.serverOut.push(` await ${x.entity}Store.delete(c.req.param("id"));`);
|
|
706
|
+
this.serverOut.push(` return c.json({ success: true });`);
|
|
707
|
+
this.serverOut.push(`});`);
|
|
708
|
+
}
|
|
709
|
+
this.serverOut.push('');
|
|
710
|
+
}
|
|
711
|
+
for (const cmd of program.commands) {
|
|
712
|
+
this.serverOut.push(`app.post("/commands/${cmd.name}", async (c) => {`);
|
|
713
|
+
this.serverOut.push(` const body = await c.req.json();`);
|
|
714
|
+
this.serverOut.push(` const user = c.get("user");`);
|
|
715
|
+
// Check guards (standalone commands don't have entity policies)
|
|
716
|
+
if (cmd.guards?.length) {
|
|
717
|
+
this.serverOut.push(` // Guard checks`);
|
|
718
|
+
for (const g of cmd.guards) {
|
|
719
|
+
this.serverOut.push(` if (!(${this.genExpr(g).replace(/\buser\./g, 'user.')})) {`);
|
|
720
|
+
this.serverOut.push(` return c.json({ error: "Unauthorized" }, 403);`);
|
|
721
|
+
this.serverOut.push(` }`);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
this.serverOut.push(` const result = await ${cmd.name}(${cmd.parameters.map(p => `body.${p.name}`).join(', ')});`);
|
|
725
|
+
this.serverOut.push(` return c.json({ success: true, result });`);
|
|
726
|
+
this.serverOut.push(`});`);
|
|
727
|
+
this.serverOut.push('');
|
|
728
|
+
}
|
|
729
|
+
this.serverOut.push('export default app;');
|
|
730
|
+
}
|
|
731
|
+
genTestCode(program) {
|
|
732
|
+
this.testOut.push('// Generated Tests from Constraints');
|
|
733
|
+
this.testOut.push('// Run with: vitest or jest');
|
|
734
|
+
this.testOut.push('');
|
|
735
|
+
this.testOut.push('import { describe, it, expect } from "vitest";');
|
|
736
|
+
this.testOut.push('');
|
|
737
|
+
for (const entity of program.entities) {
|
|
738
|
+
if (entity.constraints.length === 0)
|
|
739
|
+
continue;
|
|
740
|
+
this.testOut.push(`describe("${entity.name}", () => {`);
|
|
741
|
+
for (const constraint of entity.constraints) {
|
|
742
|
+
this.testOut.push(` describe("constraint: ${constraint.name}", () => {`);
|
|
743
|
+
// Escape constraint message for safe embedding in double-quoted string in generated code
|
|
744
|
+
const message = constraint.message || constraint.name;
|
|
745
|
+
const safeMessage = message.replace(/"/g, '\\"').replace(/\\/g, '\\\\');
|
|
746
|
+
this.testOut.push(` it("should enforce: ${safeMessage}", () => {`);
|
|
747
|
+
this.testOut.push(` const instance = new ${entity.name}();`);
|
|
748
|
+
this.testOut.push(` // Test valid case`);
|
|
749
|
+
this.testOut.push(` expect(() => {`);
|
|
750
|
+
this.testOut.push(` // Set values that satisfy constraint`);
|
|
751
|
+
this.testOut.push(` }).not.toThrow();`);
|
|
752
|
+
this.testOut.push(` });`);
|
|
753
|
+
this.testOut.push('');
|
|
754
|
+
this.testOut.push(` it("should reject invalid values", () => {`);
|
|
755
|
+
this.testOut.push(` const instance = new ${entity.name}();`);
|
|
756
|
+
this.testOut.push(` expect(() => {`);
|
|
757
|
+
this.testOut.push(` // Set values that violate constraint`);
|
|
758
|
+
this.testOut.push(` }).toThrow(${JSON.stringify(constraint.message || `Constraint '${constraint.name}' violated`)});`);
|
|
759
|
+
this.testOut.push(` });`);
|
|
760
|
+
this.testOut.push(` });`);
|
|
761
|
+
this.testOut.push('');
|
|
762
|
+
}
|
|
763
|
+
this.testOut.push(`});`);
|
|
764
|
+
this.testOut.push('');
|
|
765
|
+
}
|
|
766
|
+
for (const cmd of program.commands) {
|
|
767
|
+
if (!cmd.guards?.length)
|
|
768
|
+
continue;
|
|
769
|
+
this.testOut.push(`describe("command: ${cmd.name}", () => {`);
|
|
770
|
+
for (let i = 0; i < cmd.guards.length; i++) {
|
|
771
|
+
this.testOut.push(` it("should enforce guard ${i + 1}", async () => {`);
|
|
772
|
+
this.testOut.push(` await expect(${cmd.name}(/* invalid params */)).rejects.toThrow("Guard failed");`);
|
|
773
|
+
this.testOut.push(` });`);
|
|
774
|
+
}
|
|
775
|
+
this.testOut.push(`});`);
|
|
776
|
+
this.testOut.push('');
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
genComposition(c) {
|
|
780
|
+
this.line(`class ${c.name} {`);
|
|
781
|
+
this.in();
|
|
782
|
+
for (const comp of c.components) {
|
|
783
|
+
const n = comp.alias || comp.entity.toLowerCase();
|
|
784
|
+
this.line(`${n}: ${comp.entity};`);
|
|
785
|
+
}
|
|
786
|
+
this.line();
|
|
787
|
+
this.line('constructor() {');
|
|
788
|
+
this.in();
|
|
789
|
+
for (const comp of c.components) {
|
|
790
|
+
const n = comp.alias || comp.entity.toLowerCase();
|
|
791
|
+
this.line(`this.${n} = new ${comp.entity}();`);
|
|
792
|
+
}
|
|
793
|
+
this.line();
|
|
794
|
+
for (const conn of c.connections) {
|
|
795
|
+
if (conn.transform)
|
|
796
|
+
this.line(`this.${conn.from.component}.on('${conn.from.output}', (d) => { const t = (${this.genExpr(conn.transform)})(d); this.${conn.to.component}.emit('${conn.to.input}', t); });`);
|
|
797
|
+
else
|
|
798
|
+
this.line(`this.${conn.from.component}.on('${conn.from.output}', (d) => this.${conn.to.component}.emit('${conn.to.input}', d));`);
|
|
799
|
+
}
|
|
800
|
+
this.de();
|
|
801
|
+
this.line('}');
|
|
802
|
+
this.de();
|
|
803
|
+
this.line('}');
|
|
804
|
+
}
|
|
805
|
+
emitExports(p) {
|
|
806
|
+
const exports = ['setContext', 'getContext', 'EventBus'];
|
|
807
|
+
for (const s of p.stores)
|
|
808
|
+
exports.push(`${s.entity}Store`);
|
|
809
|
+
for (const e of p.entities)
|
|
810
|
+
exports.push(e.name);
|
|
811
|
+
for (const cmd of p.commands)
|
|
812
|
+
exports.push(cmd.name);
|
|
813
|
+
for (const f of p.flows)
|
|
814
|
+
exports.push(f.name);
|
|
815
|
+
for (const e of p.effects)
|
|
816
|
+
exports.push(`${e.name}Effect`);
|
|
817
|
+
for (const ev of p.events) {
|
|
818
|
+
exports.push(`publish${ev.name}`);
|
|
819
|
+
exports.push(`subscribe${ev.name}`);
|
|
820
|
+
}
|
|
821
|
+
for (const x of p.exposures)
|
|
822
|
+
exports.push(x.protocol === 'rest' ? `${x.entity}API` : `create${x.entity}`);
|
|
823
|
+
for (const c of p.compositions)
|
|
824
|
+
exports.push(c.name);
|
|
825
|
+
if (exports.length) {
|
|
826
|
+
this.line();
|
|
827
|
+
this.line(`export { ${exports.join(', ')} };`);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
genExpr(e) {
|
|
831
|
+
switch (e.type) {
|
|
832
|
+
case 'Literal':
|
|
833
|
+
return e.dataType === 'string' ? JSON.stringify(e.value) : String(e.value);
|
|
834
|
+
case 'Identifier': {
|
|
835
|
+
const name = e.name;
|
|
836
|
+
if (name === 'self')
|
|
837
|
+
return 'this';
|
|
838
|
+
if (name === 'user')
|
|
839
|
+
return 'getContext().user';
|
|
840
|
+
if (name === 'context')
|
|
841
|
+
return 'getContext()';
|
|
842
|
+
return name;
|
|
843
|
+
}
|
|
844
|
+
case 'BinaryOp': {
|
|
845
|
+
const op = e.operator;
|
|
846
|
+
const l = this.genExpr(e.left);
|
|
847
|
+
const r = this.genExpr(e.right);
|
|
848
|
+
const m = { 'and': '&&', 'or': '||', 'is': '===', 'contains': '.includes' };
|
|
849
|
+
if (op === 'contains')
|
|
850
|
+
return `${l}.includes(${r})`;
|
|
851
|
+
return `(${l} ${m[op] || op} ${r})`;
|
|
852
|
+
}
|
|
853
|
+
case 'UnaryOp':
|
|
854
|
+
return `${e.operator === 'not' ? '!' : e.operator}${this.genExpr(e.operand)}`;
|
|
855
|
+
case 'Call':
|
|
856
|
+
return `${this.genExpr(e.callee)}(${e.arguments.map((a) => this.genExpr(a)).join(', ')})`;
|
|
857
|
+
case 'MemberAccess':
|
|
858
|
+
return `${this.genExpr(e.object)}.${e.property}`;
|
|
859
|
+
case 'Conditional':
|
|
860
|
+
return `(${this.genExpr(e.condition)} ? ${this.genExpr(e.consequent)} : ${this.genExpr(e.alternate)})`;
|
|
861
|
+
case 'Array':
|
|
862
|
+
return `[${e.elements.map((x) => this.genExpr(x)).join(', ')}]`;
|
|
863
|
+
case 'Object':
|
|
864
|
+
return `{ ${e.properties.map((p) => `${p.key}: ${this.genExpr(p.value)}`).join(', ')} }`;
|
|
865
|
+
case 'Lambda':
|
|
866
|
+
return `(${e.parameters.join(', ')}) => ${this.genExpr(e.body)}`;
|
|
867
|
+
case 'AggregateCount': {
|
|
868
|
+
const pred = e.predicates.length
|
|
869
|
+
? e.predicates.map(p => `(row as any).${p.field} === ${this.genExpr(p.value)}`).join(' && ')
|
|
870
|
+
: 'true';
|
|
871
|
+
return `(await ${e.entity}Store.query((row) => ${pred})).length`;
|
|
872
|
+
}
|
|
873
|
+
default:
|
|
874
|
+
return '/* ? */';
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
tsType(t) {
|
|
878
|
+
const m = { string: 'string', number: 'number', boolean: 'boolean', any: 'any', void: 'void', list: 'Array', map: 'Map', date: 'string', time: 'string', datetime: 'number', duration: 'number' };
|
|
879
|
+
let r = m[t.name] || t.name;
|
|
880
|
+
if (t.generic)
|
|
881
|
+
r += `<${this.tsType(t.generic)}>`;
|
|
882
|
+
if (t.nullable)
|
|
883
|
+
r += ' | null';
|
|
884
|
+
return r;
|
|
885
|
+
}
|
|
886
|
+
defVal(t) {
|
|
887
|
+
if (t.nullable)
|
|
888
|
+
return 'null';
|
|
889
|
+
const d = { string: '""', number: '0', boolean: 'false', list: '[]', map: 'new Map()', unknown: 'null', date: '""', time: '""', datetime: '0', duration: '0' };
|
|
890
|
+
return d[t.name] || 'null';
|
|
891
|
+
}
|
|
892
|
+
capitalize(s) {
|
|
893
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
894
|
+
}
|
|
895
|
+
line(s = '') { this.out.push(' '.repeat(this.indent) + s); }
|
|
896
|
+
in() { this.indent++; }
|
|
897
|
+
de() { this.indent = Math.max(0, this.indent - 1); }
|
|
898
|
+
}
|
|
899
|
+
//# sourceMappingURL=generator.js.map
|