@specverse/engines 4.1.30 → 4.2.1
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/assets/examples/manifests/frontend-only.yaml +3 -6
- package/assets/examples/manifests/fullstack-app.yaml +5 -7
- package/assets/examples/manifests/fullstack-monorepo.yaml +3 -6
- package/assets/templates/default/specs/main.specly +65 -0
- package/dist/inference/comprehensive-engine.d.ts.map +1 -1
- package/dist/inference/comprehensive-engine.js +3 -19
- package/dist/inference/comprehensive-engine.js.map +1 -1
- package/dist/inference/core/rule-engine.d.ts +31 -0
- package/dist/inference/core/rule-engine.d.ts.map +1 -1
- package/dist/inference/core/rule-engine.js +117 -33
- package/dist/inference/core/rule-engine.js.map +1 -1
- package/dist/inference/core/rule-file-types.d.ts +0 -2
- package/dist/inference/core/rule-file-types.d.ts.map +1 -1
- package/dist/inference/core/rule-file-types.js +3 -6
- package/dist/inference/core/rule-file-types.js.map +1 -1
- package/dist/inference/core/rule-loader.d.ts +5 -15
- package/dist/inference/core/rule-loader.d.ts.map +1 -1
- package/dist/inference/core/rule-loader.js +43 -132
- package/dist/inference/core/rule-loader.js.map +1 -1
- package/dist/inference/core/types.d.ts +0 -6
- package/dist/inference/core/types.d.ts.map +1 -1
- package/dist/inference/core/types.js +0 -4
- package/dist/inference/core/types.js.map +1 -1
- package/dist/inference/logical/generators/component-type-resolver.d.ts +0 -26
- package/dist/inference/logical/generators/component-type-resolver.d.ts.map +1 -1
- package/dist/inference/logical/generators/component-type-resolver.js +0 -19
- package/dist/inference/logical/generators/component-type-resolver.js.map +1 -1
- package/dist/inference/logical/generators/specialist-view-expander.d.ts +1 -17
- package/dist/inference/logical/generators/specialist-view-expander.d.ts.map +1 -1
- package/dist/inference/logical/generators/specialist-view-expander.js +0 -15
- package/dist/inference/logical/generators/specialist-view-expander.js.map +1 -1
- package/dist/inference/logical/generators/view-generator.d.ts +4 -14
- package/dist/inference/logical/generators/view-generator.d.ts.map +1 -1
- package/dist/inference/logical/generators/view-generator.js +6 -26
- package/dist/inference/logical/generators/view-generator.js.map +1 -1
- package/dist/inference/logical/index.d.ts +2 -2
- package/dist/inference/logical/index.d.ts.map +1 -1
- package/dist/inference/logical/logical-engine.d.ts.map +1 -1
- package/dist/inference/logical/logical-engine.js +17 -80
- package/dist/inference/logical/logical-engine.js.map +1 -1
- package/dist/inference/quint-transpiler.d.ts +5 -3
- package/dist/inference/quint-transpiler.d.ts.map +1 -1
- package/dist/inference/quint-transpiler.js +11 -6
- package/dist/inference/quint-transpiler.js.map +1 -1
- package/dist/libs/instance-factories/CURVED-INTERFACE.md +278 -0
- package/dist/libs/instance-factories/README.md +73 -0
- package/dist/libs/instance-factories/applications/README.md +51 -0
- package/dist/libs/instance-factories/applications/generic-app.yaml +52 -0
- package/{libs/instance-factories/applications/react-app.yaml → dist/libs/instance-factories/applications/react-app-runtime.yaml} +30 -77
- package/dist/libs/instance-factories/applications/react-app-starter.yaml +143 -0
- package/dist/libs/instance-factories/applications/templates/react/env-example-generator.js +24 -2
- package/dist/libs/instance-factories/applications/templates/react/vite-config-generator.js +54 -33
- package/dist/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/api-types-starter-generator.js +69 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.js +110 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/belongs-to.js +40 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.js +129 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/detail-body-composer.js +80 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/form-body-composer.js +217 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/helpers-emitter.js +51 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/html-to-jsx.js +192 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/list-body-composer.js +56 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/orchestrator.js +41 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/package-json-generator.js +38 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/regen-safety.js +89 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +49 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +96 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +116 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +74 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/use-api-hooks-starter-generator.js +95 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/view-emitter.js +81 -0
- package/dist/libs/instance-factories/applications/templates/react-starter/views-generator.js +66 -0
- package/dist/libs/instance-factories/archived/fastify-prisma.yaml +104 -0
- package/dist/libs/instance-factories/cli/README.md +43 -0
- package/dist/libs/instance-factories/cli/commander-js.yaml +55 -0
- package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +63 -12
- package/dist/libs/instance-factories/communication/README.md +47 -0
- package/dist/libs/instance-factories/communication/event-emitter.yaml +60 -0
- package/dist/libs/instance-factories/communication/rabbitmq-events.yaml +87 -0
- package/dist/libs/instance-factories/controllers/README.md +42 -0
- package/dist/libs/instance-factories/controllers/fastify.yaml +139 -0
- package/dist/libs/instance-factories/controllers/templates/fastify/server-generator.js +29 -2
- package/dist/libs/instance-factories/infrastructure/README.md +29 -0
- package/dist/libs/instance-factories/infrastructure/docker-k8s.yaml +61 -0
- package/dist/libs/instance-factories/orms/README.md +54 -0
- package/dist/libs/instance-factories/orms/prisma.yaml +89 -0
- package/dist/libs/instance-factories/orms/templates/prisma/schema-generator.js +2 -2
- package/dist/libs/instance-factories/scaffolding/README.md +49 -0
- package/dist/libs/instance-factories/scaffolding/generic-scaffold.yaml +65 -0
- package/dist/libs/instance-factories/sdks/README.md +28 -0
- package/dist/libs/instance-factories/sdks/python-sdk.yaml +66 -0
- package/dist/libs/instance-factories/sdks/typescript-sdk.yaml +59 -0
- package/dist/libs/instance-factories/services/README.md +55 -0
- package/dist/libs/instance-factories/services/prisma-services.yaml +71 -0
- package/dist/libs/instance-factories/storage/README.md +34 -0
- package/dist/libs/instance-factories/storage/mongodb.yaml +79 -0
- package/dist/libs/instance-factories/storage/postgresql.yaml +75 -0
- package/dist/libs/instance-factories/storage/redis.yaml +79 -0
- package/dist/libs/instance-factories/testing/README.md +40 -0
- package/dist/libs/instance-factories/testing/vitest-tests.yaml +63 -0
- package/dist/libs/instance-factories/tools/README.md +70 -0
- package/dist/libs/instance-factories/tools/mcp.yaml +36 -0
- package/dist/libs/instance-factories/tools/vscode.yaml +35 -0
- package/dist/libs/instance-factories/validation/README.md +38 -0
- package/dist/libs/instance-factories/validation/zod.yaml +56 -0
- package/dist/realize/engines/code-generator.d.ts.map +1 -1
- package/dist/realize/engines/code-generator.js +3 -0
- package/dist/realize/engines/code-generator.js.map +1 -1
- package/dist/realize/index.d.ts.map +1 -1
- package/dist/realize/index.js +15 -22
- package/dist/realize/index.js.map +1 -1
- package/dist/registry/utils/manifest-adapter.d.ts +8 -1
- package/dist/registry/utils/manifest-adapter.d.ts.map +1 -1
- package/dist/registry/utils/manifest-adapter.js +8 -1
- package/dist/registry/utils/manifest-adapter.js.map +1 -1
- package/libs/instance-factories/applications/react-app-starter.yaml +143 -0
- package/libs/instance-factories/applications/templates/react/env-example-generator.ts +24 -2
- package/libs/instance-factories/applications/templates/react/vite-config-generator.ts +54 -33
- package/libs/instance-factories/applications/templates/react-starter/README.md +211 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/dashboard-body-composer.test.ts +153 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/detail-body-composer.test.ts +146 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/form-body-composer.test.ts +188 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/helpers-emitter.test.ts +55 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/html-to-jsx.test.ts +140 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/list-body-composer.test.ts +146 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/orchestrator.test.ts +184 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p2-factory-imports.test.ts +116 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/parity-p3-rendered-output.test.ts +183 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/regen-safety.test.ts +144 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/starter-generators.test.ts +114 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/view-emitter.test.ts +107 -0
- package/libs/instance-factories/applications/templates/react-starter/__tests__/views-generator.test.ts +139 -0
- package/libs/instance-factories/applications/templates/react-starter/api-types-starter-generator.ts +98 -0
- package/libs/instance-factories/applications/templates/react-starter/app-tsx-generator.ts +141 -0
- package/libs/instance-factories/applications/templates/react-starter/belongs-to.ts +82 -0
- package/libs/instance-factories/applications/templates/react-starter/dashboard-body-composer.ts +189 -0
- package/libs/instance-factories/applications/templates/react-starter/detail-body-composer.ts +135 -0
- package/libs/instance-factories/applications/templates/react-starter/form-body-composer.ts +383 -0
- package/libs/instance-factories/applications/templates/react-starter/helpers-emitter.ts +66 -0
- package/libs/instance-factories/applications/templates/react-starter/html-to-jsx.ts +334 -0
- package/libs/instance-factories/applications/templates/react-starter/list-body-composer.ts +146 -0
- package/libs/instance-factories/applications/templates/react-starter/orchestrator.ts +95 -0
- package/libs/instance-factories/applications/templates/react-starter/package-json-generator.ts +57 -0
- package/libs/instance-factories/applications/templates/react-starter/regen-safety.ts +157 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/dashboard.tsx.template +49 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/detail.tsx.template +96 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/form.tsx.template +116 -0
- package/libs/instance-factories/applications/templates/react-starter/skeletons/list.tsx.template +74 -0
- package/libs/instance-factories/applications/templates/react-starter/use-api-hooks-starter-generator.ts +124 -0
- package/libs/instance-factories/applications/templates/react-starter/view-emitter.ts +209 -0
- package/libs/instance-factories/applications/templates/react-starter/views-generator.ts +137 -0
- package/libs/instance-factories/cli/templates/commander/command-generator.ts +63 -12
- package/libs/instance-factories/controllers/fastify.yaml +7 -0
- package/libs/instance-factories/controllers/templates/fastify/server-generator.ts +36 -2
- package/libs/instance-factories/orms/templates/prisma/schema-generator.ts +11 -4
- package/package.json +3 -3
- package/dist/libs/instance-factories/applications/templates/react/_view-components-source.js +0 -530
- package/dist/libs/instance-factories/applications/templates/react/app-tsx-generator.js +0 -73
- package/dist/libs/instance-factories/applications/templates/react/field-helpers-generator.js +0 -99
- package/dist/libs/instance-factories/applications/templates/react/package-json-generator.js +0 -49
- package/dist/libs/instance-factories/applications/templates/react/pattern-adapter-generator.js +0 -156
- package/dist/libs/instance-factories/applications/templates/react/react-pattern-adapter.js +0 -935
- package/dist/libs/instance-factories/applications/templates/react/relationship-field-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.js +0 -646
- package/dist/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.js +0 -65
- package/dist/libs/instance-factories/applications/templates/react/view-dashboard-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/view-detail-generator.js +0 -143
- package/dist/libs/instance-factories/applications/templates/react/view-form-generator.js +0 -355
- package/dist/libs/instance-factories/applications/templates/react/view-list-generator.js +0 -91
- package/dist/libs/instance-factories/applications/templates/react/view-router-generator.js +0 -79
- package/dist/libs/instance-factories/views/index.js +0 -48
- package/dist/libs/instance-factories/views/templates/react/adapters/antd-adapter.js +0 -742
- package/dist/libs/instance-factories/views/templates/react/adapters/mui-adapter.js +0 -824
- package/dist/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.js +0 -719
- package/dist/libs/instance-factories/views/templates/react/app-generator.js +0 -45
- package/dist/libs/instance-factories/views/templates/react/components-generator.js +0 -820
- package/dist/libs/instance-factories/views/templates/react/forms-generator.js +0 -275
- package/dist/libs/instance-factories/views/templates/react/frontend-package-json-generator.js +0 -46
- package/dist/libs/instance-factories/views/templates/react/hooks-generator.js +0 -81
- package/dist/libs/instance-factories/views/templates/react/index-css-generator.js +0 -9
- package/dist/libs/instance-factories/views/templates/react/index-html-generator.js +0 -23
- package/dist/libs/instance-factories/views/templates/react/main-tsx-generator.js +0 -21
- package/dist/libs/instance-factories/views/templates/react/react-component-generator.js +0 -299
- package/dist/libs/instance-factories/views/templates/react/router-generator.js +0 -136
- package/dist/libs/instance-factories/views/templates/react/router-generic-generator.js +0 -107
- package/dist/libs/instance-factories/views/templates/react/shared-utils-generator.js +0 -187
- package/dist/libs/instance-factories/views/templates/react/spec-json-generator.js +0 -7
- package/dist/libs/instance-factories/views/templates/react/types-generator.js +0 -56
- package/dist/libs/instance-factories/views/templates/react/views-metadata-generator.js +0 -27
- package/dist/libs/instance-factories/views/templates/react/vite-config-generator.js +0 -29
- package/dist/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js +0 -261
- package/dist/libs/instance-factories/views/templates/shared/adapter-types.js +0 -34
- package/dist/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -800
- package/dist/libs/instance-factories/views/templates/shared/base-generator.js +0 -305
- package/dist/libs/instance-factories/views/templates/shared/component-metadata.js +0 -517
- package/dist/libs/instance-factories/views/templates/shared/composite-pattern-types.js +0 -0
- package/dist/libs/instance-factories/views/templates/shared/composite-patterns.js +0 -445
- package/dist/libs/instance-factories/views/templates/shared/index.js +0 -80
- package/dist/libs/instance-factories/views/templates/shared/pattern-validator.js +0 -210
- package/dist/libs/instance-factories/views/templates/shared/property-mapper.js +0 -492
- package/dist/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -321
- package/dist/realize/index.js.bak +0 -758
- package/libs/instance-factories/applications/templates/react/_view-components-source.ts +0 -555
- package/libs/instance-factories/applications/templates/react/app-tsx-generator.ts +0 -94
- package/libs/instance-factories/applications/templates/react/field-helpers-generator.ts +0 -106
- package/libs/instance-factories/applications/templates/react/package-json-generator.ts +0 -57
- package/libs/instance-factories/applications/templates/react/pattern-adapter-generator.ts +0 -179
- package/libs/instance-factories/applications/templates/react/react-pattern-adapter.tsx +0 -1347
- package/libs/instance-factories/applications/templates/react/relationship-field-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/tailwind-adapter-generator.ts +0 -704
- package/libs/instance-factories/applications/templates/react/tailwind-adapter-wrapper-generator.ts +0 -84
- package/libs/instance-factories/applications/templates/react/view-dashboard-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/view-detail-generator.ts +0 -150
- package/libs/instance-factories/applications/templates/react/view-form-generator.ts +0 -362
- package/libs/instance-factories/applications/templates/react/view-list-generator.ts +0 -98
- package/libs/instance-factories/applications/templates/react/view-router-generator.ts +0 -89
- package/libs/instance-factories/views/README.md +0 -62
- package/libs/instance-factories/views/index.d.ts +0 -13
- package/libs/instance-factories/views/index.d.ts.map +0 -1
- package/libs/instance-factories/views/index.js +0 -18
- package/libs/instance-factories/views/index.js.map +0 -1
- package/libs/instance-factories/views/index.ts +0 -45
- package/libs/instance-factories/views/react-components.yaml +0 -129
- package/libs/instance-factories/views/templates/ARCHITECTURE.md +0 -198
- package/libs/instance-factories/views/templates/react/adapters/antd-adapter.ts +0 -869
- package/libs/instance-factories/views/templates/react/adapters/mui-adapter.ts +0 -953
- package/libs/instance-factories/views/templates/react/adapters/shadcn-adapter.ts +0 -806
- package/libs/instance-factories/views/templates/react/app-generator.ts +0 -55
- package/libs/instance-factories/views/templates/react/components-generator.ts +0 -938
- package/libs/instance-factories/views/templates/react/forms-generator.ts +0 -325
- package/libs/instance-factories/views/templates/react/frontend-package-json-generator.ts +0 -57
- package/libs/instance-factories/views/templates/react/hooks-generator.ts +0 -106
- package/libs/instance-factories/views/templates/react/index-css-generator.ts +0 -14
- package/libs/instance-factories/views/templates/react/index-html-generator.ts +0 -34
- package/libs/instance-factories/views/templates/react/main-tsx-generator.ts +0 -29
- package/libs/instance-factories/views/templates/react/react-component-generator.d.ts +0 -152
- package/libs/instance-factories/views/templates/react/react-component-generator.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/react/react-component-generator.js +0 -398
- package/libs/instance-factories/views/templates/react/react-component-generator.js.map +0 -1
- package/libs/instance-factories/views/templates/react/react-component-generator.ts +0 -533
- package/libs/instance-factories/views/templates/react/router-generator.ts +0 -197
- package/libs/instance-factories/views/templates/react/router-generic-generator.ts +0 -132
- package/libs/instance-factories/views/templates/react/shared-utils-generator.ts +0 -196
- package/libs/instance-factories/views/templates/react/spec-json-generator.ts +0 -17
- package/libs/instance-factories/views/templates/react/types-generator.ts +0 -76
- package/libs/instance-factories/views/templates/react/views-metadata-generator.ts +0 -42
- package/libs/instance-factories/views/templates/react/vite-config-generator.ts +0 -38
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.js.map +0 -1
- package/libs/instance-factories/views/templates/runtime/runtime-view-renderer.ts +0 -474
- package/libs/instance-factories/views/templates/shared/__tests__/composite-patterns.test.ts +0 -242
- package/libs/instance-factories/views/templates/shared/adapter-types.d.ts +0 -77
- package/libs/instance-factories/views/templates/shared/adapter-types.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/adapter-types.js +0 -47
- package/libs/instance-factories/views/templates/shared/adapter-types.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/adapter-types.ts +0 -142
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts +0 -63
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.js +0 -822
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/atomic-components-registry.ts +0 -908
- package/libs/instance-factories/views/templates/shared/base-generator.d.ts +0 -247
- package/libs/instance-factories/views/templates/shared/base-generator.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/base-generator.js +0 -363
- package/libs/instance-factories/views/templates/shared/base-generator.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/base-generator.ts +0 -608
- package/libs/instance-factories/views/templates/shared/component-metadata.d.ts +0 -254
- package/libs/instance-factories/views/templates/shared/component-metadata.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/component-metadata.js +0 -602
- package/libs/instance-factories/views/templates/shared/component-metadata.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/component-metadata.ts +0 -803
- package/libs/instance-factories/views/templates/shared/composite-pattern-types.ts +0 -250
- package/libs/instance-factories/views/templates/shared/composite-patterns.ts +0 -535
- package/libs/instance-factories/views/templates/shared/index.ts +0 -68
- package/libs/instance-factories/views/templates/shared/pattern-validator.ts +0 -279
- package/libs/instance-factories/views/templates/shared/property-mapper.d.ts +0 -149
- package/libs/instance-factories/views/templates/shared/property-mapper.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/property-mapper.js +0 -580
- package/libs/instance-factories/views/templates/shared/property-mapper.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/property-mapper.ts +0 -700
- package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts +0 -143
- package/libs/instance-factories/views/templates/shared/syntax-mapper.d.ts.map +0 -1
- package/libs/instance-factories/views/templates/shared/syntax-mapper.js +0 -420
- package/libs/instance-factories/views/templates/shared/syntax-mapper.js.map +0 -1
- package/libs/instance-factories/views/templates/shared/syntax-mapper.ts +0 -539
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: EventEmitter
|
|
2
|
+
version: "2.0.0"
|
|
3
|
+
category: communication
|
|
4
|
+
description: "Typed in-memory event bus with WebSocket bridge for real-time frontend updates"
|
|
5
|
+
|
|
6
|
+
metadata:
|
|
7
|
+
author: "SpecVerse Team"
|
|
8
|
+
license: "MIT"
|
|
9
|
+
tags: [events, in-memory, pubsub, websocket, eventemitter, development]
|
|
10
|
+
|
|
11
|
+
compatibility:
|
|
12
|
+
specverse: ">=3.3.0"
|
|
13
|
+
node: ">=18.0.0"
|
|
14
|
+
|
|
15
|
+
capabilities:
|
|
16
|
+
provides:
|
|
17
|
+
- "messaging.pubsub"
|
|
18
|
+
- "messaging.events"
|
|
19
|
+
- "messaging.inmemory"
|
|
20
|
+
- "messaging.websocket"
|
|
21
|
+
requires: []
|
|
22
|
+
|
|
23
|
+
technology:
|
|
24
|
+
runtime: "node"
|
|
25
|
+
language: "typescript"
|
|
26
|
+
framework: "eventemitter3"
|
|
27
|
+
version: "^5.0.0"
|
|
28
|
+
|
|
29
|
+
dependencies:
|
|
30
|
+
runtime:
|
|
31
|
+
- name: "eventemitter3"
|
|
32
|
+
version: "^5.0.0"
|
|
33
|
+
- name: "@fastify/websocket"
|
|
34
|
+
version: "^11.0.0"
|
|
35
|
+
|
|
36
|
+
dev:
|
|
37
|
+
- name: "typescript"
|
|
38
|
+
version: "^5.2.0"
|
|
39
|
+
|
|
40
|
+
codeTemplates:
|
|
41
|
+
types:
|
|
42
|
+
engine: typescript
|
|
43
|
+
generator: "libs/instance-factories/communication/templates/eventemitter/types-generator.ts"
|
|
44
|
+
outputPattern: "{backendDir}/src/events/event-types.ts"
|
|
45
|
+
|
|
46
|
+
bus:
|
|
47
|
+
engine: typescript
|
|
48
|
+
generator: "libs/instance-factories/communication/templates/eventemitter/bus-generator.ts"
|
|
49
|
+
outputPattern: "{backendDir}/src/events/eventBus.ts"
|
|
50
|
+
|
|
51
|
+
websocket:
|
|
52
|
+
engine: typescript
|
|
53
|
+
generator: "libs/instance-factories/communication/templates/eventemitter/websocket-bridge-generator.ts"
|
|
54
|
+
outputPattern: "{backendDir}/src/events/websocket-bridge.ts"
|
|
55
|
+
|
|
56
|
+
configuration:
|
|
57
|
+
maxListeners: 100
|
|
58
|
+
captureRejections: true
|
|
59
|
+
errorHandling: "log"
|
|
60
|
+
websocket: true
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
name: RabbitMQEvents
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
category: communication
|
|
4
|
+
description: "RabbitMQ event bus for pub/sub messaging and event-driven architecture"
|
|
5
|
+
|
|
6
|
+
metadata:
|
|
7
|
+
author: "SpecVerse Team"
|
|
8
|
+
license: "MIT"
|
|
9
|
+
tags: [rabbitmq, events, messaging, pubsub, amqp]
|
|
10
|
+
|
|
11
|
+
compatibility:
|
|
12
|
+
specverse: ">=3.3.0"
|
|
13
|
+
node: ">=18.0.0"
|
|
14
|
+
|
|
15
|
+
capabilities:
|
|
16
|
+
provides:
|
|
17
|
+
- "messaging.pubsub"
|
|
18
|
+
- "messaging.events"
|
|
19
|
+
- "messaging.queue"
|
|
20
|
+
requires: []
|
|
21
|
+
|
|
22
|
+
technology:
|
|
23
|
+
runtime: "node"
|
|
24
|
+
language: "typescript"
|
|
25
|
+
framework: "amqplib"
|
|
26
|
+
version: "^0.10.3"
|
|
27
|
+
|
|
28
|
+
dependencies:
|
|
29
|
+
runtime:
|
|
30
|
+
- name: "amqplib"
|
|
31
|
+
version: "^0.10.3"
|
|
32
|
+
- name: "uuid"
|
|
33
|
+
version: "^9.0.0"
|
|
34
|
+
|
|
35
|
+
dev:
|
|
36
|
+
- name: "@types/amqplib"
|
|
37
|
+
version: "^0.10.4"
|
|
38
|
+
- name: "@types/uuid"
|
|
39
|
+
version: "^9.0.0"
|
|
40
|
+
- name: "typescript"
|
|
41
|
+
version: "^5.2.0"
|
|
42
|
+
|
|
43
|
+
codeTemplates:
|
|
44
|
+
publisher:
|
|
45
|
+
engine: typescript
|
|
46
|
+
generator: "libs/instance-factories/communication/templates/rabbitmq/publisher-generator.ts"
|
|
47
|
+
outputPattern: "src/events/publishers/{event}Publisher.ts"
|
|
48
|
+
|
|
49
|
+
subscriber:
|
|
50
|
+
engine: typescript
|
|
51
|
+
generator: "libs/instance-factories/communication/templates/rabbitmq/subscriber-generator.ts"
|
|
52
|
+
outputPattern: "src/events/subscribers/{event}Subscriber.ts"
|
|
53
|
+
|
|
54
|
+
connection:
|
|
55
|
+
engine: typescript
|
|
56
|
+
generator: "libs/instance-factories/communication/templates/rabbitmq/connection-generator.ts"
|
|
57
|
+
outputPattern: "src/events/connection.ts"
|
|
58
|
+
|
|
59
|
+
configuration:
|
|
60
|
+
connection:
|
|
61
|
+
protocol: "amqp"
|
|
62
|
+
hostname: "localhost"
|
|
63
|
+
port: 5672
|
|
64
|
+
username: "guest"
|
|
65
|
+
password: "guest"
|
|
66
|
+
vhost: "/"
|
|
67
|
+
heartbeat: 60
|
|
68
|
+
|
|
69
|
+
exchange:
|
|
70
|
+
type: "topic"
|
|
71
|
+
durable: true
|
|
72
|
+
autoDelete: false
|
|
73
|
+
|
|
74
|
+
queue:
|
|
75
|
+
durable: true
|
|
76
|
+
exclusive: false
|
|
77
|
+
autoDelete: false
|
|
78
|
+
|
|
79
|
+
publishing:
|
|
80
|
+
persistent: true
|
|
81
|
+
mandatory: true
|
|
82
|
+
confirmSelect: true
|
|
83
|
+
|
|
84
|
+
consuming:
|
|
85
|
+
prefetch: 10
|
|
86
|
+
noAck: false
|
|
87
|
+
exclusive: false
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Controllers Factory
|
|
2
|
+
|
|
3
|
+
Fastify REST API route handlers and server bootstrap generation.
|
|
4
|
+
|
|
5
|
+
## Definition
|
|
6
|
+
|
|
7
|
+
| File | Description |
|
|
8
|
+
|------|-------------|
|
|
9
|
+
| `fastify.yaml` | Fastify v4 REST API server with CORS, Helmet, and rate limiting |
|
|
10
|
+
|
|
11
|
+
## Generated Output
|
|
12
|
+
|
|
13
|
+
| Generator | Output | Purpose |
|
|
14
|
+
|-----------|--------|---------|
|
|
15
|
+
| `routes-generator` | `backend/src/routes/{controller}.ts` | Per-model route handler with CRUD endpoints |
|
|
16
|
+
| `meta-routes-generator` | `backend/src/routes/MetaRoutes.ts` | Meta API for spec/view metadata (serves frontend) |
|
|
17
|
+
| `server-generator` | `backend/src/server.ts` | Server bootstrap — registers all model routes |
|
|
18
|
+
|
|
19
|
+
The routes generator reads each controller from the spec and creates Fastify route
|
|
20
|
+
handlers. The server generator auto-imports and registers all model route files.
|
|
21
|
+
Meta routes expose spec and view metadata for the view-renderer architecture.
|
|
22
|
+
|
|
23
|
+
## Technology
|
|
24
|
+
|
|
25
|
+
- **Framework**: Fastify ^4.24.0
|
|
26
|
+
- **Middleware**: @fastify/cors, @fastify/helmet, @fastify/rate-limit
|
|
27
|
+
- **Language**: TypeScript with tsx for development
|
|
28
|
+
|
|
29
|
+
## Capabilities
|
|
30
|
+
|
|
31
|
+
| Provides | Requires |
|
|
32
|
+
|----------|----------|
|
|
33
|
+
| `api.rest` | `storage.database` |
|
|
34
|
+
| `api.rest.crud` | `validation.runtime` |
|
|
35
|
+
| `api.websocket` | |
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
- Server: port 3000, host 0.0.0.0, trust proxy, structured logging
|
|
40
|
+
- CORS: origin true, credentials true
|
|
41
|
+
- Rate limit: 100 requests per minute
|
|
42
|
+
- Scripts: `dev` (tsx watch), `start` (node dist)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
name: FastifyAPI
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
category: controller
|
|
4
|
+
description: "Fastify REST API server with WebSocket support"
|
|
5
|
+
|
|
6
|
+
metadata:
|
|
7
|
+
author: "SpecVerse Team"
|
|
8
|
+
license: "MIT"
|
|
9
|
+
tags: [fastify, rest-api, websocket, controller]
|
|
10
|
+
|
|
11
|
+
compatibility:
|
|
12
|
+
specverse: ">=3.3.0"
|
|
13
|
+
node: ">=18.0.0"
|
|
14
|
+
|
|
15
|
+
capabilities:
|
|
16
|
+
provides:
|
|
17
|
+
- "api.rest"
|
|
18
|
+
- "api.rest.crud"
|
|
19
|
+
- "api.websocket"
|
|
20
|
+
requires:
|
|
21
|
+
- "storage.database" # Needs a database for data persistence
|
|
22
|
+
- "validation.runtime" # Needs validation schemas
|
|
23
|
+
|
|
24
|
+
technology:
|
|
25
|
+
runtime: "node"
|
|
26
|
+
language: "typescript"
|
|
27
|
+
framework: "fastify"
|
|
28
|
+
version: "^4.24.0"
|
|
29
|
+
|
|
30
|
+
dependencies:
|
|
31
|
+
runtime:
|
|
32
|
+
- name: "fastify"
|
|
33
|
+
version: "^4.24.0"
|
|
34
|
+
- name: "@fastify/cors"
|
|
35
|
+
version: "^8.4.0"
|
|
36
|
+
- name: "@fastify/helmet"
|
|
37
|
+
version: "^11.1.0"
|
|
38
|
+
- name: "@fastify/rate-limit"
|
|
39
|
+
version: "^9.0.0"
|
|
40
|
+
# .env loading — main.ts calls `import 'dotenv/config'` first so
|
|
41
|
+
# PORT and other env vars populate before any module reads them.
|
|
42
|
+
# Mirrors vite's loadEnv on the frontend side, so `npm run
|
|
43
|
+
# dev:backend` honours the project's .env without a set -a dance.
|
|
44
|
+
- name: "dotenv"
|
|
45
|
+
version: "^16.4.0"
|
|
46
|
+
|
|
47
|
+
dev:
|
|
48
|
+
- name: "@types/node"
|
|
49
|
+
version: "^20.8.0"
|
|
50
|
+
- name: "typescript"
|
|
51
|
+
version: "^5.2.0"
|
|
52
|
+
- name: "tsx"
|
|
53
|
+
version: "^4.0.0"
|
|
54
|
+
|
|
55
|
+
codeTemplates:
|
|
56
|
+
routes:
|
|
57
|
+
engine: typescript
|
|
58
|
+
generator: "libs/instance-factories/controllers/templates/fastify/routes-generator.ts"
|
|
59
|
+
outputPattern: "{backendDir}/src/routes/{controller}.ts"
|
|
60
|
+
|
|
61
|
+
serviceRoutes:
|
|
62
|
+
engine: typescript
|
|
63
|
+
generator: "libs/instance-factories/services/templates/fastify/service-routes-generator.ts"
|
|
64
|
+
outputPattern: "{backendDir}/src/routes/{service}Routes.ts"
|
|
65
|
+
|
|
66
|
+
meta:
|
|
67
|
+
engine: typescript
|
|
68
|
+
generator: "libs/instance-factories/controllers/templates/fastify/meta-routes-generator.ts"
|
|
69
|
+
outputPattern: "{backendDir}/src/routes/MetaRoutes.ts"
|
|
70
|
+
|
|
71
|
+
server:
|
|
72
|
+
engine: typescript
|
|
73
|
+
generator: "libs/instance-factories/controllers/templates/fastify/server-generator.ts"
|
|
74
|
+
outputPattern: "{backendDir}/src/server.ts"
|
|
75
|
+
|
|
76
|
+
configuration:
|
|
77
|
+
outputStructure: "monorepo"
|
|
78
|
+
backendDir: "backend"
|
|
79
|
+
|
|
80
|
+
server:
|
|
81
|
+
port: 3000
|
|
82
|
+
host: "0.0.0.0"
|
|
83
|
+
trustProxy: true
|
|
84
|
+
requestIdLogLabel: "reqId"
|
|
85
|
+
logger:
|
|
86
|
+
level: "info"
|
|
87
|
+
prettyPrint: true
|
|
88
|
+
|
|
89
|
+
middleware:
|
|
90
|
+
cors:
|
|
91
|
+
origin: true
|
|
92
|
+
credentials: true
|
|
93
|
+
helmet:
|
|
94
|
+
enabled: true
|
|
95
|
+
rateLimit:
|
|
96
|
+
max: 100
|
|
97
|
+
timeWindow: "1 minute"
|
|
98
|
+
|
|
99
|
+
# Requirements for generic scaffolding (runtime-agnostic structure)
|
|
100
|
+
requirements:
|
|
101
|
+
# Package dependencies (Node.js/npm-specific)
|
|
102
|
+
dependencies:
|
|
103
|
+
npm:
|
|
104
|
+
dependencies:
|
|
105
|
+
"fastify": "^5.8.3"
|
|
106
|
+
"@fastify/cors": "^10.0.0"
|
|
107
|
+
"yaml": "^2.3.0"
|
|
108
|
+
"dotenv": "^16.4.0"
|
|
109
|
+
devDependencies:
|
|
110
|
+
"tsx": "^4.0.0"
|
|
111
|
+
scripts:
|
|
112
|
+
"dev": "tsx watch src/main.ts"
|
|
113
|
+
"start": "node dist/main.js"
|
|
114
|
+
|
|
115
|
+
# Environment variables (universal structure)
|
|
116
|
+
environment:
|
|
117
|
+
- name: "PORT"
|
|
118
|
+
description: "Server port"
|
|
119
|
+
example: "3000"
|
|
120
|
+
required: false
|
|
121
|
+
category: "Server"
|
|
122
|
+
- name: "HOST"
|
|
123
|
+
description: "Server host"
|
|
124
|
+
example: "0.0.0.0"
|
|
125
|
+
required: false
|
|
126
|
+
category: "Server"
|
|
127
|
+
- name: "LOG_LEVEL"
|
|
128
|
+
description: "Logging level (trace, debug, info, warn, error, fatal)"
|
|
129
|
+
example: "info"
|
|
130
|
+
required: false
|
|
131
|
+
category: "Server"
|
|
132
|
+
|
|
133
|
+
# Build/runtime configuration (TypeScript-specific)
|
|
134
|
+
configuration:
|
|
135
|
+
tsconfig:
|
|
136
|
+
compilerOptions:
|
|
137
|
+
target: "ES2022"
|
|
138
|
+
module: "ESNext"
|
|
139
|
+
moduleResolution: "node"
|
|
@@ -29,6 +29,27 @@ function generateFastifyServer(context) {
|
|
|
29
29
|
* Generated from SpecVerse specification
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
+
// Load .env from the closest ancestor that has one. Walks up from
|
|
33
|
+
// this file's directory so the backend picks up the project-root
|
|
34
|
+
// .env whether it's running in the monorepo layout
|
|
35
|
+
// (generated/code/backend/src/main.ts with .env at generated/code/)
|
|
36
|
+
// or the standalone layout (generated/code/src/main.ts with .env at
|
|
37
|
+
// generated/code/). dotenv's default cwd-based behaviour doesn't
|
|
38
|
+
// handle the monorepo case because npm workspaces \`cd\`s into the
|
|
39
|
+
// workspace before running the script.
|
|
40
|
+
import { config as loadEnv } from 'dotenv';
|
|
41
|
+
import { existsSync } from 'fs';
|
|
42
|
+
import { resolve as resolvePath, dirname, join } from 'path';
|
|
43
|
+
import { fileURLToPath } from 'url';
|
|
44
|
+
{
|
|
45
|
+
let dir = dirname(fileURLToPath(import.meta.url));
|
|
46
|
+
while (dir !== '/' && dir !== dirname(dir)) {
|
|
47
|
+
const candidate = join(dir, '.env');
|
|
48
|
+
if (existsSync(candidate)) { loadEnv({ path: candidate }); break; }
|
|
49
|
+
dir = dirname(dir);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
32
53
|
import Fastify from 'fastify';
|
|
33
54
|
import cors from '@fastify/cors';
|
|
34
55
|
import { PrismaClient } from '@prisma/client';
|
|
@@ -94,9 +115,9 @@ ${hasEvents ? ` // Register WebSocket bridge for real-time frontend events
|
|
|
94
115
|
// fall back to 127.0.0.1 cleanly. Binding :: fixes both cases.
|
|
95
116
|
await fastify.listen({ port, host: '::' });
|
|
96
117
|
console.log(\`Server running at http://localhost:\${port}\`);
|
|
97
|
-
console.log(\`API endpoints: ${modelNames.map((n) => `/api/${n
|
|
118
|
+
console.log(\`API endpoints: ${modelNames.map((n) => `/api/${pluralizeLower(n)}`).join(", ")}\`);
|
|
98
119
|
${hasEvents ? ` console.log(\`WebSocket: ws://localhost:\${port}/ws\`);
|
|
99
|
-
console.log(\`Events: ${specEvents.
|
|
120
|
+
console.log(\`Events: ${specEvents.length} wired (GET /api/runtime/events for the full list)\`);` : ""}
|
|
100
121
|
} catch (err) {
|
|
101
122
|
fastify.log.error(err);
|
|
102
123
|
process.exit(1);
|
|
@@ -106,6 +127,12 @@ ${hasEvents ? ` console.log(\`WebSocket: ws://localhost:\${port}/ws\`);
|
|
|
106
127
|
start();
|
|
107
128
|
`;
|
|
108
129
|
}
|
|
130
|
+
function pluralizeLower(s) {
|
|
131
|
+
const lower = s.toLowerCase();
|
|
132
|
+
if (/[^aeiou]y$/.test(lower)) return lower.slice(0, -1) + "ies";
|
|
133
|
+
if (/(s|x|z|ch|sh)$/.test(lower)) return lower + "es";
|
|
134
|
+
return lower + "s";
|
|
135
|
+
}
|
|
109
136
|
export {
|
|
110
137
|
generateFastifyServer as default
|
|
111
138
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Infrastructure Instance Factory
|
|
2
|
+
|
|
3
|
+
Generates Docker, Kubernetes, and CI/CD pipeline configurations from a SpecVerse specification.
|
|
4
|
+
|
|
5
|
+
## Definition
|
|
6
|
+
|
|
7
|
+
- **`docker-k8s.yaml`** -- Single definition covering Docker, Kubernetes, and GitHub Actions CI/CD.
|
|
8
|
+
|
|
9
|
+
## Generator
|
|
10
|
+
|
|
11
|
+
- `templates/docker-k8s/infrastructure-generator.ts` -- Wrapper that delegates to the existing `generate-infrastructure.js` script (650+ lines). Produces multi-stage Dockerfiles, docker-compose files, K8s manifests (deployments, services, ingress), and CI/CD pipelines.
|
|
12
|
+
|
|
13
|
+
## Capabilities
|
|
14
|
+
|
|
15
|
+
| Capability | Description |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `infrastructure.docker` | Multi-stage Dockerfiles (Node 20 Alpine) |
|
|
18
|
+
| `infrastructure.kubernetes` | K8s deployments, services, ingress (3 replicas, resource limits) |
|
|
19
|
+
| `infrastructure.cicd` | GitHub Actions pipelines (build on push, deploy on tag) |
|
|
20
|
+
|
|
21
|
+
## Default Configuration
|
|
22
|
+
|
|
23
|
+
- **Docker**: Multi-stage builds, `node:20-alpine` base image
|
|
24
|
+
- **Kubernetes**: `default` namespace, 3 replicas, 100m-500m CPU, 128Mi-512Mi memory
|
|
25
|
+
- **CI/CD**: GitHub Actions with build-on-push and deploy-on-tag
|
|
26
|
+
|
|
27
|
+
## Status
|
|
28
|
+
|
|
29
|
+
Wrapper implementation. The YAML notes a future TODO to break the monolithic JS script into native TypeScript template generators (Dockerfile, docker-compose, K8s manifests, CI/CD, env config).
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: DockerKubernetes
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
category: infrastructure
|
|
4
|
+
description: "Docker and Kubernetes infrastructure generator with CI/CD pipelines"
|
|
5
|
+
|
|
6
|
+
metadata:
|
|
7
|
+
author: "SpecVerse Team"
|
|
8
|
+
license: "MIT"
|
|
9
|
+
tags: [docker, kubernetes, infrastructure, ci-cd, devops]
|
|
10
|
+
|
|
11
|
+
compatibility:
|
|
12
|
+
specverse: ">=3.3.0"
|
|
13
|
+
|
|
14
|
+
capabilities:
|
|
15
|
+
provides:
|
|
16
|
+
- "infrastructure.docker"
|
|
17
|
+
- "infrastructure.kubernetes"
|
|
18
|
+
- "infrastructure.cicd"
|
|
19
|
+
requires: []
|
|
20
|
+
|
|
21
|
+
technology:
|
|
22
|
+
runtime: "node"
|
|
23
|
+
language: "typescript"
|
|
24
|
+
containerization: "docker"
|
|
25
|
+
orchestration: "kubernetes"
|
|
26
|
+
cicd: "github-actions"
|
|
27
|
+
|
|
28
|
+
codeTemplates:
|
|
29
|
+
infrastructure:
|
|
30
|
+
engine: typescript
|
|
31
|
+
generator: "libs/instance-factories/infrastructure/templates/docker-k8s/infrastructure-generator.ts"
|
|
32
|
+
outputPattern: "infrastructure/"
|
|
33
|
+
|
|
34
|
+
configuration:
|
|
35
|
+
docker:
|
|
36
|
+
multiStage: true
|
|
37
|
+
nodeVersion: "20-alpine"
|
|
38
|
+
kubernetes:
|
|
39
|
+
namespace: "default"
|
|
40
|
+
replicas: 3
|
|
41
|
+
resources:
|
|
42
|
+
requests:
|
|
43
|
+
cpu: "100m"
|
|
44
|
+
memory: "128Mi"
|
|
45
|
+
limits:
|
|
46
|
+
cpu: "500m"
|
|
47
|
+
memory: "512Mi"
|
|
48
|
+
cicd:
|
|
49
|
+
provider: "github-actions"
|
|
50
|
+
buildOnPush: true
|
|
51
|
+
deployOnTag: true
|
|
52
|
+
|
|
53
|
+
# NOTE: This implementation type wraps the existing generate-infrastructure.js script
|
|
54
|
+
# TODO: Future enhancement - Convert generate-infrastructure.js to native TypeScript template generator
|
|
55
|
+
# The current script is 650+ lines and generates complete infrastructure as code.
|
|
56
|
+
# Converting to native templates would require breaking it into multiple template files:
|
|
57
|
+
# - dockerfile-generator.ts (multi-stage Dockerfiles)
|
|
58
|
+
# - docker-compose-generator.ts (development and production compositions)
|
|
59
|
+
# - kubernetes-generator.ts (K8s manifests - deployments, services, ingress)
|
|
60
|
+
# - cicd-generator.ts (GitHub Actions / GitLab CI pipelines)
|
|
61
|
+
# - env-generator.ts (environment configuration templates)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# ORMs Factory
|
|
2
|
+
|
|
3
|
+
Prisma schema and service generation from spec models.
|
|
4
|
+
|
|
5
|
+
## Definition
|
|
6
|
+
|
|
7
|
+
| File | Description |
|
|
8
|
+
|------|-------------|
|
|
9
|
+
| `prisma.yaml` | Prisma ^5.5 ORM with schema generation and typed client |
|
|
10
|
+
|
|
11
|
+
## Generated Output
|
|
12
|
+
|
|
13
|
+
| Generator | Output | Purpose |
|
|
14
|
+
|-----------|--------|---------|
|
|
15
|
+
| `schema-generator` | `backend/prisma/schema.prisma` | Full Prisma schema from spec models (tables, relations, enums) |
|
|
16
|
+
| `services-generator` | (per-model service) | Prisma service classes with ORM integration |
|
|
17
|
+
|
|
18
|
+
The schema generator reads all spec models, maps SpecVerse types to Prisma types,
|
|
19
|
+
generates relation fields (1:1, 1:N, N:M), and produces a complete `schema.prisma`
|
|
20
|
+
file. It uses the `pluralize` utility from `@specverse/types` for table naming.
|
|
21
|
+
|
|
22
|
+
## Technology
|
|
23
|
+
|
|
24
|
+
- **ORM**: Prisma ^5.5.0
|
|
25
|
+
- **Client**: @prisma/client (auto-generated)
|
|
26
|
+
- **Default provider**: PostgreSQL (configurable)
|
|
27
|
+
|
|
28
|
+
## Capabilities
|
|
29
|
+
|
|
30
|
+
| Provides | Requires |
|
|
31
|
+
|----------|----------|
|
|
32
|
+
| `orm.prisma` | `storage.database` |
|
|
33
|
+
| `orm.schema` | |
|
|
34
|
+
| `orm.client` | |
|
|
35
|
+
| `database.migrations` | |
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
- Provider: `postgresql` (default, overridable)
|
|
40
|
+
- Relation mode: `foreignKeys`
|
|
41
|
+
- Log levels: query, error, warn
|
|
42
|
+
|
|
43
|
+
## Scripts
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
db:generate — prisma generate
|
|
47
|
+
db:migrate — prisma migrate dev
|
|
48
|
+
db:push — prisma db push
|
|
49
|
+
db:studio — prisma studio
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Environment
|
|
53
|
+
|
|
54
|
+
Requires `DATABASE_URL` (e.g., `postgresql://user:password@localhost:5432/dbname`)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: PrismaORM
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
category: service
|
|
4
|
+
description: "Prisma ORM for type-safe database access with auto-generated client"
|
|
5
|
+
|
|
6
|
+
metadata:
|
|
7
|
+
author: "SpecVerse Team"
|
|
8
|
+
license: "MIT"
|
|
9
|
+
tags: [prisma, orm, database, typescript]
|
|
10
|
+
|
|
11
|
+
compatibility:
|
|
12
|
+
specverse: ">=3.3.0"
|
|
13
|
+
node: ">=18.0.0"
|
|
14
|
+
|
|
15
|
+
capabilities:
|
|
16
|
+
provides:
|
|
17
|
+
- "orm.prisma"
|
|
18
|
+
- "orm.schema"
|
|
19
|
+
- "orm.client"
|
|
20
|
+
- "database.migrations"
|
|
21
|
+
requires:
|
|
22
|
+
- "storage.database" # Needs actual database instance
|
|
23
|
+
|
|
24
|
+
technology:
|
|
25
|
+
runtime: "node"
|
|
26
|
+
language: "typescript"
|
|
27
|
+
orm: "prisma"
|
|
28
|
+
version: "^5.5.0"
|
|
29
|
+
|
|
30
|
+
dependencies:
|
|
31
|
+
runtime:
|
|
32
|
+
- name: "@prisma/client"
|
|
33
|
+
version: "^5.5.0"
|
|
34
|
+
|
|
35
|
+
dev:
|
|
36
|
+
- name: "prisma"
|
|
37
|
+
version: "^5.5.0"
|
|
38
|
+
- name: "@types/node"
|
|
39
|
+
version: "^20.8.0"
|
|
40
|
+
- name: "typescript"
|
|
41
|
+
version: "^5.2.0"
|
|
42
|
+
|
|
43
|
+
codeTemplates:
|
|
44
|
+
schema:
|
|
45
|
+
engine: typescript
|
|
46
|
+
generator: "libs/instance-factories/orms/templates/prisma/schema-generator.ts"
|
|
47
|
+
outputPattern: "{backendDir}/prisma/schema.prisma"
|
|
48
|
+
|
|
49
|
+
configuration:
|
|
50
|
+
outputStructure: "monorepo"
|
|
51
|
+
backendDir: "backend"
|
|
52
|
+
|
|
53
|
+
provider: "postgresql" # Default, can be overridden
|
|
54
|
+
relationMode: "foreignKeys"
|
|
55
|
+
log: ["query", "error", "warn"]
|
|
56
|
+
previewFeatures: []
|
|
57
|
+
|
|
58
|
+
# Requirements for generic scaffolding (runtime-agnostic structure)
|
|
59
|
+
requirements:
|
|
60
|
+
# Package dependencies (Node.js/npm-specific)
|
|
61
|
+
dependencies:
|
|
62
|
+
npm:
|
|
63
|
+
dependencies:
|
|
64
|
+
"@prisma/client": "^5.5.0"
|
|
65
|
+
devDependencies:
|
|
66
|
+
"prisma": "^5.5.0"
|
|
67
|
+
scripts:
|
|
68
|
+
"db:generate": "prisma generate"
|
|
69
|
+
"db:migrate": "prisma migrate dev"
|
|
70
|
+
"db:push": "prisma db push"
|
|
71
|
+
"db:studio": "prisma studio"
|
|
72
|
+
|
|
73
|
+
# Environment variables (universal structure)
|
|
74
|
+
environment:
|
|
75
|
+
- name: "DATABASE_URL"
|
|
76
|
+
description: "Database connection string"
|
|
77
|
+
example: "postgresql://user:password@localhost:5432/dbname"
|
|
78
|
+
required: true
|
|
79
|
+
category: "Database"
|
|
80
|
+
|
|
81
|
+
# Build/runtime configuration (TypeScript-specific)
|
|
82
|
+
configuration: {}
|
|
83
|
+
|
|
84
|
+
# Generated files
|
|
85
|
+
files:
|
|
86
|
+
- path: ".env"
|
|
87
|
+
description: "Environment variables"
|
|
88
|
+
- path: "prisma/schema.prisma"
|
|
89
|
+
description: "Prisma schema definition"
|
|
@@ -83,7 +83,7 @@ function buildMissingBackRefs(allModels, relationMap) {
|
|
|
83
83
|
(r) => r.target === target && (r.type === "hasMany" || r.type === "hasOne")
|
|
84
84
|
);
|
|
85
85
|
const needsFieldInFk = parentRelsToSameTarget.length > 1;
|
|
86
|
-
const fkSuffix = needsFieldInFk ?
|
|
86
|
+
const fkSuffix = needsFieldInFk ? fieldName + "Id" : model.name.charAt(0).toLowerCase() + model.name.slice(1) + "Id";
|
|
87
87
|
const fkName = fkSuffix;
|
|
88
88
|
const fkPadding = " ".repeat(Math.max(1, 15 - fkName.length));
|
|
89
89
|
const refFieldName = needsFieldInFk ? fieldName + model.name : model.name.charAt(0).toLowerCase() + model.name.slice(1);
|
|
@@ -270,7 +270,7 @@ function generateRelationship(rel, model, relationMap, hasOneTargets, allModels)
|
|
|
270
270
|
const relAnnotation = ` @relation("${relName}")`;
|
|
271
271
|
switch (rel.type) {
|
|
272
272
|
case "belongsTo":
|
|
273
|
-
const fkBase = rel.foreignKey ||
|
|
273
|
+
const fkBase = rel.foreignKey || name + "Id";
|
|
274
274
|
const fkPadding = " ".repeat(Math.max(1, 15 - fkBase.length));
|
|
275
275
|
const isUniqueFK = hasOneTargets.has(`${rel.target}->${model.name}`);
|
|
276
276
|
let fkType = "String";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Scaffolding Factory
|
|
2
|
+
|
|
3
|
+
Project-level configuration files that adapt to manifest choices.
|
|
4
|
+
|
|
5
|
+
## Definition
|
|
6
|
+
|
|
7
|
+
| File | Description |
|
|
8
|
+
|------|-------------|
|
|
9
|
+
| `generic-scaffold.yaml` | Generic project scaffolding — aggregates requirements from all factories |
|
|
10
|
+
|
|
11
|
+
## Generated Output
|
|
12
|
+
|
|
13
|
+
| Generator | Output | Purpose |
|
|
14
|
+
|-----------|--------|---------|
|
|
15
|
+
| `package-json-generator` | `package.json` | Root package.json aggregating deps from all implementation types |
|
|
16
|
+
| `tsconfig-generator` | `tsconfig.json` | TypeScript configuration |
|
|
17
|
+
| `tsconfig-react-generator` | `tsconfig.react.json` | React-specific TypeScript config |
|
|
18
|
+
| `env-generator` | `.env` | Environment variables with values |
|
|
19
|
+
| `env-example-generator` | `.env.example` | Environment variable template (safe to commit) |
|
|
20
|
+
| `gitignore-generator` | `.gitignore` | Git ignore rules |
|
|
21
|
+
| `readme-generator` | `README.md` | Project README with tech stack and setup instructions |
|
|
22
|
+
|
|
23
|
+
The package.json generator is the key file — it walks all instance factories in
|
|
24
|
+
the manifest, aggregates their `requirements.dependencies` sections, and merges
|
|
25
|
+
them into a single `package.json` with combined scripts, dependencies, and
|
|
26
|
+
devDependencies.
|
|
27
|
+
|
|
28
|
+
## Technology
|
|
29
|
+
|
|
30
|
+
- **Runtime**: Node.js ^18.0.0
|
|
31
|
+
- **Language**: TypeScript
|
|
32
|
+
- **License**: MIT (default)
|
|
33
|
+
|
|
34
|
+
## Capabilities
|
|
35
|
+
|
|
36
|
+
| Provides | Requires |
|
|
37
|
+
|----------|----------|
|
|
38
|
+
| `project.scaffold` | (none) |
|
|
39
|
+
| `project.package.json` | |
|
|
40
|
+
| `project.tsconfig` | |
|
|
41
|
+
| `project.gitignore` | |
|
|
42
|
+
| `project.env` | |
|
|
43
|
+
|
|
44
|
+
## How It Works
|
|
45
|
+
|
|
46
|
+
Unlike other factories that generate domain-specific code, the scaffolding factory
|
|
47
|
+
generates project infrastructure. It reads the full manifest to understand which
|
|
48
|
+
other factories are in use, then aggregates their requirements into unified
|
|
49
|
+
project files.
|