@pattern-stack/codegen 0.2.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/CHANGELOG.md +67 -0
- package/README.md +214 -0
- package/dist/runtime/analytics/index.d.ts +6 -0
- package/dist/runtime/analytics/index.js +49 -0
- package/dist/runtime/analytics/index.js.map +1 -0
- package/dist/runtime/analytics/metrics.d.ts +75 -0
- package/dist/runtime/analytics/metrics.js +1 -0
- package/dist/runtime/analytics/metrics.js.map +1 -0
- package/dist/runtime/analytics/packs/crm-entity-measures.d.ts +21 -0
- package/dist/runtime/analytics/packs/crm-entity-measures.js +1 -0
- package/dist/runtime/analytics/packs/crm-entity-measures.js.map +1 -0
- package/dist/runtime/analytics/packs/index.d.ts +3 -0
- package/dist/runtime/analytics/packs/index.js +1 -0
- package/dist/runtime/analytics/packs/index.js.map +1 -0
- package/dist/runtime/analytics/packs/monetary-measures.d.ts +21 -0
- package/dist/runtime/analytics/packs/monetary-measures.js +1 -0
- package/dist/runtime/analytics/packs/monetary-measures.js.map +1 -0
- package/dist/runtime/analytics/specs.d.ts +49 -0
- package/dist/runtime/analytics/specs.js +1 -0
- package/dist/runtime/analytics/specs.js.map +1 -0
- package/dist/runtime/analytics/types.d.ts +85 -0
- package/dist/runtime/analytics/types.js +49 -0
- package/dist/runtime/analytics/types.js.map +1 -0
- package/dist/runtime/base-classes/activity-entity-repository.d.ts +26 -0
- package/dist/runtime/base-classes/activity-entity-repository.js +195 -0
- package/dist/runtime/base-classes/activity-entity-repository.js.map +1 -0
- package/dist/runtime/base-classes/activity-entity-service.d.ts +39 -0
- package/dist/runtime/base-classes/activity-entity-service.js +214 -0
- package/dist/runtime/base-classes/activity-entity-service.js.map +1 -0
- package/dist/runtime/base-classes/base-read-use-cases.d.ts +68 -0
- package/dist/runtime/base-classes/base-read-use-cases.js +32 -0
- package/dist/runtime/base-classes/base-read-use-cases.js.map +1 -0
- package/dist/runtime/base-classes/base-repository.d.ts +99 -0
- package/dist/runtime/base-classes/base-repository.js +160 -0
- package/dist/runtime/base-classes/base-repository.js.map +1 -0
- package/dist/runtime/base-classes/base-service.d.ts +98 -0
- package/dist/runtime/base-classes/base-service.js +186 -0
- package/dist/runtime/base-classes/base-service.js.map +1 -0
- package/dist/runtime/base-classes/index.d.ts +18 -0
- package/dist/runtime/base-classes/index.js +617 -0
- package/dist/runtime/base-classes/index.js.map +1 -0
- package/dist/runtime/base-classes/knowledge-entity-repository.d.ts +17 -0
- package/dist/runtime/base-classes/knowledge-entity-repository.js +166 -0
- package/dist/runtime/base-classes/knowledge-entity-repository.js.map +1 -0
- package/dist/runtime/base-classes/knowledge-entity-service.d.ts +15 -0
- package/dist/runtime/base-classes/knowledge-entity-service.js +192 -0
- package/dist/runtime/base-classes/knowledge-entity-service.js.map +1 -0
- package/dist/runtime/base-classes/lifecycle-events.d.ts +49 -0
- package/dist/runtime/base-classes/lifecycle-events.js +76 -0
- package/dist/runtime/base-classes/lifecycle-events.js.map +1 -0
- package/dist/runtime/base-classes/metadata-entity-repository.d.ts +27 -0
- package/dist/runtime/base-classes/metadata-entity-repository.js +212 -0
- package/dist/runtime/base-classes/metadata-entity-repository.js.map +1 -0
- package/dist/runtime/base-classes/metadata-entity-service.d.ts +39 -0
- package/dist/runtime/base-classes/metadata-entity-service.js +214 -0
- package/dist/runtime/base-classes/metadata-entity-service.js.map +1 -0
- package/dist/runtime/base-classes/synced-entity-repository.d.ts +32 -0
- package/dist/runtime/base-classes/synced-entity-repository.js +203 -0
- package/dist/runtime/base-classes/synced-entity-repository.js.map +1 -0
- package/dist/runtime/base-classes/synced-entity-service.d.ts +41 -0
- package/dist/runtime/base-classes/synced-entity-service.js +215 -0
- package/dist/runtime/base-classes/synced-entity-service.js.map +1 -0
- package/dist/runtime/base-classes/with-analytics.d.ts +18 -0
- package/dist/runtime/base-classes/with-analytics.js +11 -0
- package/dist/runtime/base-classes/with-analytics.js.map +1 -0
- package/dist/runtime/constants/tokens.d.ts +29 -0
- package/dist/runtime/constants/tokens.js +8 -0
- package/dist/runtime/constants/tokens.js.map +1 -0
- package/dist/runtime/subsystems/analytics/analytics-query.protocol.d.ts +30 -0
- package/dist/runtime/subsystems/analytics/analytics-query.protocol.js +1 -0
- package/dist/runtime/subsystems/analytics/analytics-query.protocol.js.map +1 -0
- package/dist/runtime/subsystems/analytics/analytics.module.d.ts +34 -0
- package/dist/runtime/subsystems/analytics/analytics.module.js +117 -0
- package/dist/runtime/subsystems/analytics/analytics.module.js.map +1 -0
- package/dist/runtime/subsystems/analytics/analytics.tokens.d.ts +24 -0
- package/dist/runtime/subsystems/analytics/analytics.tokens.js +10 -0
- package/dist/runtime/subsystems/analytics/analytics.tokens.js.map +1 -0
- package/dist/runtime/subsystems/analytics/cube-backend.d.ts +28 -0
- package/dist/runtime/subsystems/analytics/cube-backend.js +71 -0
- package/dist/runtime/subsystems/analytics/cube-backend.js.map +1 -0
- package/dist/runtime/subsystems/analytics/index.d.ts +6 -0
- package/dist/runtime/subsystems/analytics/index.js +122 -0
- package/dist/runtime/subsystems/analytics/index.js.map +1 -0
- package/dist/runtime/subsystems/analytics/noop-backend.d.ts +7 -0
- package/dist/runtime/subsystems/analytics/noop-backend.js +25 -0
- package/dist/runtime/subsystems/analytics/noop-backend.js.map +1 -0
- package/dist/runtime/subsystems/cache/cache.drizzle-backend.d.ts +43 -0
- package/dist/runtime/subsystems/cache/cache.drizzle-backend.js +133 -0
- package/dist/runtime/subsystems/cache/cache.drizzle-backend.js.map +1 -0
- package/dist/runtime/subsystems/cache/cache.memory-backend.d.ts +21 -0
- package/dist/runtime/subsystems/cache/cache.memory-backend.js +100 -0
- package/dist/runtime/subsystems/cache/cache.memory-backend.js.map +1 -0
- package/dist/runtime/subsystems/cache/cache.module.d.ts +37 -0
- package/dist/runtime/subsystems/cache/cache.module.js +272 -0
- package/dist/runtime/subsystems/cache/cache.module.js.map +1 -0
- package/dist/runtime/subsystems/cache/cache.protocol.d.ts +42 -0
- package/dist/runtime/subsystems/cache/cache.protocol.js +1 -0
- package/dist/runtime/subsystems/cache/cache.protocol.js.map +1 -0
- package/dist/runtime/subsystems/cache/cache.schema.d.ts +64 -0
- package/dist/runtime/subsystems/cache/cache.schema.js +18 -0
- package/dist/runtime/subsystems/cache/cache.schema.js.map +1 -0
- package/dist/runtime/subsystems/cache/cache.tokens.d.ts +18 -0
- package/dist/runtime/subsystems/cache/cache.tokens.js +8 -0
- package/dist/runtime/subsystems/cache/cache.tokens.js.map +1 -0
- package/dist/runtime/subsystems/cache/index.d.ts +11 -0
- package/dist/runtime/subsystems/cache/index.js +277 -0
- package/dist/runtime/subsystems/cache/index.js.map +1 -0
- package/dist/runtime/subsystems/events/domain-events.schema.d.ts +187 -0
- package/dist/runtime/subsystems/events/domain-events.schema.js +32 -0
- package/dist/runtime/subsystems/events/domain-events.schema.js.map +1 -0
- package/dist/runtime/subsystems/events/event-bus.drizzle-backend.d.ts +38 -0
- package/dist/runtime/subsystems/events/event-bus.drizzle-backend.js +199 -0
- package/dist/runtime/subsystems/events/event-bus.drizzle-backend.js.map +1 -0
- package/dist/runtime/subsystems/events/event-bus.memory-backend.d.ts +18 -0
- package/dist/runtime/subsystems/events/event-bus.memory-backend.js +71 -0
- package/dist/runtime/subsystems/events/event-bus.memory-backend.js.map +1 -0
- package/dist/runtime/subsystems/events/event-bus.protocol.d.ts +52 -0
- package/dist/runtime/subsystems/events/event-bus.protocol.js +1 -0
- package/dist/runtime/subsystems/events/event-bus.protocol.js.map +1 -0
- package/dist/runtime/subsystems/events/event-bus.redis-backend.d.ts +95 -0
- package/dist/runtime/subsystems/events/event-bus.redis-backend.js +229 -0
- package/dist/runtime/subsystems/events/event-bus.redis-backend.js.map +1 -0
- package/dist/runtime/subsystems/events/events.module.d.ts +46 -0
- package/dist/runtime/subsystems/events/events.module.js +531 -0
- package/dist/runtime/subsystems/events/events.module.js.map +1 -0
- package/dist/runtime/subsystems/events/events.tokens.d.ts +19 -0
- package/dist/runtime/subsystems/events/events.tokens.js +8 -0
- package/dist/runtime/subsystems/events/events.tokens.js.map +1 -0
- package/dist/runtime/subsystems/events/index.d.ts +12 -0
- package/dist/runtime/subsystems/events/index.js +536 -0
- package/dist/runtime/subsystems/events/index.js.map +1 -0
- package/dist/runtime/subsystems/index.d.ts +24 -0
- package/dist/runtime/subsystems/index.js +1643 -0
- package/dist/runtime/subsystems/index.js.map +1 -0
- package/dist/runtime/subsystems/jobs/index.d.ts +14 -0
- package/dist/runtime/subsystems/jobs/index.js +680 -0
- package/dist/runtime/subsystems/jobs/index.js.map +1 -0
- package/dist/runtime/subsystems/jobs/job-queue.bullmq-backend.d.ts +54 -0
- package/dist/runtime/subsystems/jobs/job-queue.bullmq-backend.js +186 -0
- package/dist/runtime/subsystems/jobs/job-queue.bullmq-backend.js.map +1 -0
- package/dist/runtime/subsystems/jobs/job-queue.drizzle-backend.d.ts +38 -0
- package/dist/runtime/subsystems/jobs/job-queue.drizzle-backend.js +228 -0
- package/dist/runtime/subsystems/jobs/job-queue.drizzle-backend.js.map +1 -0
- package/dist/runtime/subsystems/jobs/job-queue.memory-backend.d.ts +12 -0
- package/dist/runtime/subsystems/jobs/job-queue.memory-backend.js +44 -0
- package/dist/runtime/subsystems/jobs/job-queue.memory-backend.js.map +1 -0
- package/dist/runtime/subsystems/jobs/job-queue.protocol.d.ts +48 -0
- package/dist/runtime/subsystems/jobs/job-queue.protocol.js +1 -0
- package/dist/runtime/subsystems/jobs/job-queue.protocol.js.map +1 -0
- package/dist/runtime/subsystems/jobs/job-queue.redis-backend.d.ts +46 -0
- package/dist/runtime/subsystems/jobs/job-queue.redis-backend.js +187 -0
- package/dist/runtime/subsystems/jobs/job-queue.redis-backend.js.map +1 -0
- package/dist/runtime/subsystems/jobs/job-queue.schema.d.ts +237 -0
- package/dist/runtime/subsystems/jobs/job-queue.schema.js +44 -0
- package/dist/runtime/subsystems/jobs/job-queue.schema.js.map +1 -0
- package/dist/runtime/subsystems/jobs/jobs.module.d.ts +18 -0
- package/dist/runtime/subsystems/jobs/jobs.module.js +676 -0
- package/dist/runtime/subsystems/jobs/jobs.module.js.map +1 -0
- package/dist/runtime/subsystems/jobs/jobs.tokens.d.ts +13 -0
- package/dist/runtime/subsystems/jobs/jobs.tokens.js +8 -0
- package/dist/runtime/subsystems/jobs/jobs.tokens.js.map +1 -0
- package/dist/runtime/subsystems/storage/index.d.ts +6 -0
- package/dist/runtime/subsystems/storage/index.js +204 -0
- package/dist/runtime/subsystems/storage/index.js.map +1 -0
- package/dist/runtime/subsystems/storage/storage.local-backend.d.ts +18 -0
- package/dist/runtime/subsystems/storage/storage.local-backend.js +108 -0
- package/dist/runtime/subsystems/storage/storage.local-backend.js.map +1 -0
- package/dist/runtime/subsystems/storage/storage.memory-backend.d.ts +28 -0
- package/dist/runtime/subsystems/storage/storage.memory-backend.js +72 -0
- package/dist/runtime/subsystems/storage/storage.memory-backend.js.map +1 -0
- package/dist/runtime/subsystems/storage/storage.module.d.ts +40 -0
- package/dist/runtime/subsystems/storage/storage.module.js +201 -0
- package/dist/runtime/subsystems/storage/storage.module.js.map +1 -0
- package/dist/runtime/subsystems/storage/storage.protocol.d.ts +69 -0
- package/dist/runtime/subsystems/storage/storage.protocol.js +1 -0
- package/dist/runtime/subsystems/storage/storage.protocol.js.map +1 -0
- package/dist/runtime/subsystems/storage/storage.tokens.d.ts +11 -0
- package/dist/runtime/subsystems/storage/storage.tokens.js +6 -0
- package/dist/runtime/subsystems/storage/storage.tokens.js.map +1 -0
- package/dist/runtime/subsystems/storage/storage.utils.d.ts +9 -0
- package/dist/runtime/subsystems/storage/storage.utils.js +18 -0
- package/dist/runtime/subsystems/storage/storage.utils.js.map +1 -0
- package/dist/runtime/types/drizzle.d.ts +17 -0
- package/dist/runtime/types/drizzle.js +1 -0
- package/dist/runtime/types/drizzle.js.map +1 -0
- package/dist/src/cli/index.d.ts +1 -0
- package/dist/src/cli/index.js +7365 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/index.d.ts +2384 -0
- package/dist/src/index.js +2198 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +114 -0
- package/templates/broadcast/new/backend-interface.ejs.t +47 -0
- package/templates/broadcast/new/bridge-listener.ejs.t +67 -0
- package/templates/broadcast/new/channel.ejs.t +77 -0
- package/templates/broadcast/new/index.ejs.t +21 -0
- package/templates/broadcast/new/memory-backend.ejs.t +87 -0
- package/templates/broadcast/new/module.ejs.t +57 -0
- package/templates/broadcast/new/prompt.js +268 -0
- package/templates/broadcast/new/websocket-backend.ejs.t +259 -0
- package/templates/entity/new/backend/application/commands/create.ejs.t +55 -0
- package/templates/entity/new/backend/application/commands/delete.ejs.t +45 -0
- package/templates/entity/new/backend/application/commands/grouped-index.ejs.t +149 -0
- package/templates/entity/new/backend/application/commands/index.ejs.t +15 -0
- package/templates/entity/new/backend/application/commands/update.ejs.t +58 -0
- package/templates/entity/new/backend/application/queries/declarative-queries.ejs.t +36 -0
- package/templates/entity/new/backend/application/queries/get-by-id.ejs.t +42 -0
- package/templates/entity/new/backend/application/queries/grouped-index.ejs.t +81 -0
- package/templates/entity/new/backend/application/queries/index.ejs.t +14 -0
- package/templates/entity/new/backend/application/queries/list.ejs.t +36 -0
- package/templates/entity/new/backend/application/schemas/_inject-index.ejs.t +7 -0
- package/templates/entity/new/backend/application/schemas/dto.ejs.t +45 -0
- package/templates/entity/new/backend/database/_inject-index.ejs.t +7 -0
- package/templates/entity/new/backend/database/electric-migration.ejs.t +21 -0
- package/templates/entity/new/backend/database/repository.ejs.t +450 -0
- package/templates/entity/new/backend/database/schema.ejs.t +248 -0
- package/templates/entity/new/backend/domain/_inject-index.ejs.t +12 -0
- package/templates/entity/new/backend/domain/entity.ejs.t +108 -0
- package/templates/entity/new/backend/domain/grouped-index.ejs.t +163 -0
- package/templates/entity/new/backend/domain/index.ejs.t +15 -0
- package/templates/entity/new/backend/domain/repository-interface.ejs.t +71 -0
- package/templates/entity/new/backend/modules/core/_ensure-anchor-tokens.ejs.t +10 -0
- package/templates/entity/new/backend/modules/core/_inject-token.ejs.t +7 -0
- package/templates/entity/new/backend/modules/core/module.ejs.t +67 -0
- package/templates/entity/new/backend/modules/trpc/module.ejs.t +67 -0
- package/templates/entity/new/backend/presentation/controller.ejs.t +201 -0
- package/templates/entity/new/clean-lite-ps/controller.ejs.t +37 -0
- package/templates/entity/new/clean-lite-ps/dto/create.ejs.t +17 -0
- package/templates/entity/new/clean-lite-ps/dto/output.ejs.t +25 -0
- package/templates/entity/new/clean-lite-ps/dto/update.ejs.t +11 -0
- package/templates/entity/new/clean-lite-ps/entity.ejs.t +52 -0
- package/templates/entity/new/clean-lite-ps/index.ejs.t +20 -0
- package/templates/entity/new/clean-lite-ps/module.ejs.t +43 -0
- package/templates/entity/new/clean-lite-ps/prompt-extension.js +617 -0
- package/templates/entity/new/clean-lite-ps/repository.ejs.t +62 -0
- package/templates/entity/new/clean-lite-ps/service.ejs.t +34 -0
- package/templates/entity/new/clean-lite-ps/use-cases/declarative-queries.ejs.t +34 -0
- package/templates/entity/new/clean-lite-ps/use-cases/find-by-id.ejs.t +16 -0
- package/templates/entity/new/clean-lite-ps/use-cases/list.ejs.t +16 -0
- package/templates/entity/new/frontend/_inject-entities-entry.ejs.t +7 -0
- package/templates/entity/new/frontend/_inject-entities-import.ejs.t +7 -0
- package/templates/entity/new/frontend/collections/_ensure-anchor-collections.ejs.t +10 -0
- package/templates/entity/new/frontend/collections/_inject-index.ejs.t +9 -0
- package/templates/entity/new/frontend/collections/_inject-schema-import.ejs.t +9 -0
- package/templates/entity/new/frontend/collections/collection.ejs.t +61 -0
- package/templates/entity/new/frontend/collections/collections-base.ejs.t +24 -0
- package/templates/entity/new/frontend/entity/collection.ejs.t +172 -0
- package/templates/entity/new/frontend/entity/combined.ejs.t +474 -0
- package/templates/entity/new/frontend/entity/fields.ejs.t +104 -0
- package/templates/entity/new/frontend/entity/hooks.ejs.t +73 -0
- package/templates/entity/new/frontend/entity/index.ejs.t +21 -0
- package/templates/entity/new/frontend/entity/mutation-hooks.ejs.t +84 -0
- package/templates/entity/new/frontend/entity/mutations.ejs.t +38 -0
- package/templates/entity/new/frontend/entity/types.ejs.t +59 -0
- package/templates/entity/new/frontend/generated/_inject-index-export.ejs.t +7 -0
- package/templates/entity/new/frontend/generated/_inject-index-import.ejs.t +7 -0
- package/templates/entity/new/frontend/generated/_inject-index-registry.ejs.t +7 -0
- package/templates/entity/new/frontend/store/_inject-collection-import.ejs.t +9 -0
- package/templates/entity/new/frontend/store/_inject-collections.ejs.t +9 -0
- package/templates/entity/new/frontend/store/_inject-entity.ejs.t +9 -0
- package/templates/entity/new/frontend/store/_inject-import.ejs.t +9 -0
- package/templates/entity/new/frontend/store/_inject-lookups.ejs.t +9 -0
- package/templates/entity/new/frontend/store/_inject-resolve.ejs.t +10 -0
- package/templates/entity/new/frontend/store/hooks.ejs.t +72 -0
- package/templates/entity/new/frontend/unified-entity.ejs.t +28 -0
- package/templates/entity/new/prompt.js +1421 -0
- package/templates/relationship/new/controller.ejs.t +36 -0
- package/templates/relationship/new/dto/create.ejs.t +41 -0
- package/templates/relationship/new/dto/output.ejs.t +44 -0
- package/templates/relationship/new/dto/update.ejs.t +10 -0
- package/templates/relationship/new/entity.ejs.t +98 -0
- package/templates/relationship/new/index.ejs.t +19 -0
- package/templates/relationship/new/module.ejs.t +35 -0
- package/templates/relationship/new/prompt.js +682 -0
- package/templates/relationship/new/repository.ejs.t +54 -0
- package/templates/relationship/new/service.ejs.t +31 -0
- package/templates/relationship/new/use-cases/declarative-queries.ejs.t +34 -0
- package/templates/relationship/new/use-cases/find-by-id.ejs.t +16 -0
- package/templates/relationship/new/use-cases/list.ejs.t +16 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: "<%= outputPaths.controller %>"
|
|
3
|
+
force: true
|
|
4
|
+
---
|
|
5
|
+
import { Controller, Get, Param } from '@nestjs/common';
|
|
6
|
+
import { <%= classNames.findByIdUseCase %> } from './use-cases/find-<%= name %>-by-id.use-case';
|
|
7
|
+
import { <%= classNames.listUseCase %> } from './use-cases/list-<%= entityNamePlural %>.use-case';
|
|
8
|
+
import type { <%= classNames.entity %> } from './<%= name %>.entity';
|
|
9
|
+
// Write use cases must be hand-written. Import them here when ready.
|
|
10
|
+
|
|
11
|
+
@Controller('<%= entityNamePlural %>')
|
|
12
|
+
export class <%= classNames.controller %> {
|
|
13
|
+
constructor(
|
|
14
|
+
// All routes go through use cases (ADR-003 — no controller → service shortcuts)
|
|
15
|
+
private readonly findByIdUseCase: <%= classNames.findByIdUseCase %>,
|
|
16
|
+
private readonly listUseCase: <%= classNames.listUseCase %>,
|
|
17
|
+
// TODO: inject hand-written write use cases here
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
@Get()
|
|
21
|
+
async getAll(): Promise<<%= classNames.entity %>[]> {
|
|
22
|
+
return this.listUseCase.execute();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Get(':id')
|
|
26
|
+
async getById(@Param('id') id: string): Promise<<%= classNames.entity %> | null> {
|
|
27
|
+
return this.findByIdUseCase.execute(id);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// TODO: Add write routes. Each must call a hand-written use case, not the service.
|
|
31
|
+
// Example:
|
|
32
|
+
// @Post()
|
|
33
|
+
// async create(@Body() dto: <%= classNames.createDto %>): Promise<<%= classNames.entity %>> {
|
|
34
|
+
// return this.createUseCase.execute(dto);
|
|
35
|
+
// }
|
|
36
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: "<%= outputPaths.createDto %>"
|
|
3
|
+
force: true
|
|
4
|
+
---
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
<%_ if (hasTypes) { _%>
|
|
7
|
+
import { <%= typeEnumName %> } from '../<%= name %>.entity';
|
|
8
|
+
<%_ } _%>
|
|
9
|
+
|
|
10
|
+
export const <%= classNames.createSchema %> = z.object({
|
|
11
|
+
// FK endpoints (required)
|
|
12
|
+
<%= fromColumnCamel %>: z.string().uuid(),
|
|
13
|
+
<%= toColumnCamel %>: z.string().uuid(),
|
|
14
|
+
<%_ if (hasTypes) { _%>
|
|
15
|
+
|
|
16
|
+
// Relationship type (required)
|
|
17
|
+
type: z.enum(<%= typeEnumName %>.enumValues),
|
|
18
|
+
<%_ } _%>
|
|
19
|
+
<%_ if (temporal) { _%>
|
|
20
|
+
|
|
21
|
+
// Temporal fields (optional on create)
|
|
22
|
+
validFrom: z.coerce.date().nullable().optional(),
|
|
23
|
+
validTo: z.coerce.date().nullable().optional(),
|
|
24
|
+
isCurrent: z.boolean().default(true),
|
|
25
|
+
<%_ } _%>
|
|
26
|
+
<%_ if (sourced) { _%>
|
|
27
|
+
|
|
28
|
+
// Source tracking (optional on create)
|
|
29
|
+
source: z.string().nullable().optional(),
|
|
30
|
+
confidence: z.number().min(0).max(1).nullable().optional(),
|
|
31
|
+
<%_ } _%>
|
|
32
|
+
<%_ if (createDtoFields.length > 0) { _%>
|
|
33
|
+
|
|
34
|
+
// Custom fields
|
|
35
|
+
<%_ createDtoFields.forEach(field => { _%>
|
|
36
|
+
<%= field.camelName %>: <%- field.zodChainCreate %>,
|
|
37
|
+
<%_ }) _%>
|
|
38
|
+
<%_ } _%>
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export type <%= classNames.createDto %> = z.infer<typeof <%= classNames.createSchema %>>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: "<%= outputPaths.outputDto %>"
|
|
3
|
+
force: true
|
|
4
|
+
---
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
export const <%= classNames.outputSchema %> = z.object({
|
|
8
|
+
id: z.string().uuid(),
|
|
9
|
+
|
|
10
|
+
// FK endpoints
|
|
11
|
+
<%= fromColumnCamel %>: z.string().uuid(),
|
|
12
|
+
<%= toColumnCamel %>: z.string().uuid(),
|
|
13
|
+
<%_ if (hasTypes) { _%>
|
|
14
|
+
|
|
15
|
+
// Type
|
|
16
|
+
type: z.string(),
|
|
17
|
+
<%_ } _%>
|
|
18
|
+
<%_ if (temporal) { _%>
|
|
19
|
+
|
|
20
|
+
// Temporal
|
|
21
|
+
validFrom: z.coerce.date().nullable(),
|
|
22
|
+
validTo: z.coerce.date().nullable(),
|
|
23
|
+
isCurrent: z.boolean().nullable(),
|
|
24
|
+
<%_ } _%>
|
|
25
|
+
<%_ if (sourced) { _%>
|
|
26
|
+
|
|
27
|
+
// Source tracking
|
|
28
|
+
source: z.string().nullable(),
|
|
29
|
+
confidence: z.number().nullable(),
|
|
30
|
+
<%_ } _%>
|
|
31
|
+
<%_ if (outputDtoFields.length > 0) { _%>
|
|
32
|
+
|
|
33
|
+
// Custom fields
|
|
34
|
+
<%_ outputDtoFields.forEach(field => { _%>
|
|
35
|
+
<%= field.camelName %>: <%- field.zodChainOutput %>,
|
|
36
|
+
<%_ }) _%>
|
|
37
|
+
<%_ } _%>
|
|
38
|
+
|
|
39
|
+
// Timestamps
|
|
40
|
+
createdAt: z.coerce.date(),
|
|
41
|
+
updatedAt: z.coerce.date(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export type <%= classNames.outputDto %> = z.infer<typeof <%= classNames.outputSchema %>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: "<%= outputPaths.updateDto %>"
|
|
3
|
+
force: true
|
|
4
|
+
---
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { <%= classNames.createSchema %> } from './create-<%= name %>.dto';
|
|
7
|
+
|
|
8
|
+
export const <%= classNames.updateSchema %> = <%= classNames.createSchema %>.partial();
|
|
9
|
+
|
|
10
|
+
export type <%= classNames.updateDto %> = z.infer<typeof <%= classNames.updateSchema %>>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: "<%= outputPaths.entity %>"
|
|
3
|
+
force: true
|
|
4
|
+
---
|
|
5
|
+
import {
|
|
6
|
+
<%_ drizzleImports.filter(i => i !== 'relations').forEach(i => { _%>
|
|
7
|
+
<%= i %>,
|
|
8
|
+
<%_ }) _%>
|
|
9
|
+
} from 'drizzle-orm/pg-core';
|
|
10
|
+
import { type InferSelectModel } from 'drizzle-orm';
|
|
11
|
+
import { <%= fromTable %> } from '../../<%= fromTable %>/<%= from %>.entity';
|
|
12
|
+
<%_ if (from !== to) { _%>
|
|
13
|
+
import { <%= toTable %> } from '../../<%= toTable %>/<%= to %>.entity';
|
|
14
|
+
<%_ } _%>
|
|
15
|
+
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// Enums
|
|
18
|
+
// ============================================================================
|
|
19
|
+
<%_ if (hasTypes) { _%>
|
|
20
|
+
|
|
21
|
+
export const <%= typeEnumName %> = pgEnum('<%= name %>_type', [
|
|
22
|
+
<%_ typeEnumValues.forEach(t => { _%>
|
|
23
|
+
'<%= t %>',
|
|
24
|
+
<%_ }) _%>
|
|
25
|
+
]);
|
|
26
|
+
<%_ } _%>
|
|
27
|
+
<%_ if (sourced) { _%>
|
|
28
|
+
|
|
29
|
+
export const <%= sourceEnumName %> = pgEnum('<%= name %>_source', [
|
|
30
|
+
<%_ sourceEnumValues.forEach(s => { _%>
|
|
31
|
+
'<%= s %>',
|
|
32
|
+
<%_ }) _%>
|
|
33
|
+
]);
|
|
34
|
+
<%_ } _%>
|
|
35
|
+
<%_ enumFields.forEach(field => { _%>
|
|
36
|
+
|
|
37
|
+
export const <%= field.enumName %> = pgEnum('<%= name %>_<%= field.name %>', [
|
|
38
|
+
<%_ field.choices.forEach(c => { _%>
|
|
39
|
+
'<%= c %>',
|
|
40
|
+
<%_ }) _%>
|
|
41
|
+
]);
|
|
42
|
+
<%_ }) _%>
|
|
43
|
+
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// Table
|
|
46
|
+
// ============================================================================
|
|
47
|
+
|
|
48
|
+
export const <%= tableVarName %> = pgTable(
|
|
49
|
+
'<%= tableName %>',
|
|
50
|
+
{
|
|
51
|
+
id: uuid('id').primaryKey().defaultRandom(),
|
|
52
|
+
|
|
53
|
+
// FK columns (auto-generated from relationship endpoints)
|
|
54
|
+
<%= fromColumnCamel %>: uuid('<%= fromColumn %>').notNull().references(() => <%= fromTable %>.id, { onDelete: '<%= onDeleteFromSql %>' }),
|
|
55
|
+
<%= toColumnCamel %>: uuid('<%= toColumn %>').notNull().references(() => <%= toTable %>.id, { onDelete: '<%= onDeleteToSql %>' }),
|
|
56
|
+
<%_ if (hasTypes) { _%>
|
|
57
|
+
|
|
58
|
+
// Type taxonomy
|
|
59
|
+
type: <%= typeEnumName %>('type').notNull(),
|
|
60
|
+
<%_ } _%>
|
|
61
|
+
<%_ if (temporal) { _%>
|
|
62
|
+
|
|
63
|
+
// Temporal validity
|
|
64
|
+
validFrom: date('valid_from'),
|
|
65
|
+
validTo: date('valid_to'),
|
|
66
|
+
isCurrent: boolean('is_current').default(true),
|
|
67
|
+
<%_ } _%>
|
|
68
|
+
<%_ if (sourced) { _%>
|
|
69
|
+
|
|
70
|
+
// Source tracking
|
|
71
|
+
source: <%= sourceEnumName %>('source'),
|
|
72
|
+
confidence: numeric('confidence', { precision: 3, scale: 2 }),
|
|
73
|
+
<%_ } _%>
|
|
74
|
+
<%_ if (processedFields.length > 0) { _%>
|
|
75
|
+
|
|
76
|
+
// Custom fields
|
|
77
|
+
<%_ processedFields.forEach(field => { _%>
|
|
78
|
+
<%_ if (field.hasChoices) { _%>
|
|
79
|
+
<%= field.camelName %>: <%= field.enumName %>('<%= field.name %>'),
|
|
80
|
+
<%_ } else if (field.foreignKey) { _%>
|
|
81
|
+
<%= field.camelName %>: uuid('<%= field.name %>'),
|
|
82
|
+
<%_ } else { _%>
|
|
83
|
+
<%= field.camelName %>: <%- field.drizzleChain %>,
|
|
84
|
+
<%_ } _%>
|
|
85
|
+
<%_ }) _%>
|
|
86
|
+
<%_ } _%>
|
|
87
|
+
|
|
88
|
+
// Timestamps
|
|
89
|
+
createdAt: timestamp('created_at').notNull().defaultNow(),
|
|
90
|
+
updatedAt: timestamp('updated_at').notNull().defaultNow(),
|
|
91
|
+
},
|
|
92
|
+
(table) => [
|
|
93
|
+
uniqueIndex('<%= tableName %>_unique_idx').on(<%- uniqueOnCamel.map(c => `table.${c}`).join(', ') %>),
|
|
94
|
+
],
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
export type <%= classNames.entity %> = InferSelectModel<typeof <%= tableVarName %>>;
|
|
98
|
+
export type <%= classNames.entity %>Insert = typeof <%= tableVarName %>.$inferInsert;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: "<%= outputPaths.index %>"
|
|
3
|
+
force: true
|
|
4
|
+
---
|
|
5
|
+
/**
|
|
6
|
+
* <%= classNames.entity %> module barrel export
|
|
7
|
+
* Generated by relationship codegen - do not edit directly
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// Value exports (module, service, controller)
|
|
11
|
+
export { <%= classNames.module %> } from './<%= entityNamePlural %>.module';
|
|
12
|
+
export { <%= classNames.service %> } from './<%= name %>.service';
|
|
13
|
+
export { <%= classNames.controller %> } from './<%= name %>.controller';
|
|
14
|
+
|
|
15
|
+
// Type-only exports (entity, DTOs)
|
|
16
|
+
export type { <%= classNames.entity %> } from './<%= name %>.entity';
|
|
17
|
+
export type { <%= classNames.createDto %> } from './dto/create-<%= name %>.dto';
|
|
18
|
+
export type { <%= classNames.updateDto %> } from './dto/update-<%= name %>.dto';
|
|
19
|
+
export type { <%= classNames.outputDto %> } from './dto/<%= name %>-output.dto';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: "<%= outputPaths.module %>"
|
|
3
|
+
force: true
|
|
4
|
+
---
|
|
5
|
+
import { Module } from '@nestjs/common';
|
|
6
|
+
import { DatabaseModule } from '@shared/database/database.module';
|
|
7
|
+
|
|
8
|
+
import { <%= classNames.repository %> } from './<%= name %>.repository';
|
|
9
|
+
import { <%= classNames.service %> } from './<%= name %>.service';
|
|
10
|
+
import { <%= classNames.controller %> } from './<%= name %>.controller';
|
|
11
|
+
import { <%= classNames.findByIdUseCase %> } from './use-cases/find-<%= name %>-by-id.use-case';
|
|
12
|
+
import { <%= classNames.listUseCase %> } from './use-cases/list-<%= entityNamePlural %>.use-case';
|
|
13
|
+
<% if (hasDeclarativeQueries) { -%>
|
|
14
|
+
import { declarativeQueryClasses } from './use-cases/declarative-queries';
|
|
15
|
+
<% } -%>
|
|
16
|
+
|
|
17
|
+
@Module({
|
|
18
|
+
imports: [
|
|
19
|
+
DatabaseModule,
|
|
20
|
+
// TODO: Add subsystem modules as needed (EventsSubsystemModule, etc.)
|
|
21
|
+
],
|
|
22
|
+
controllers: [<%= classNames.controller %>],
|
|
23
|
+
providers: [
|
|
24
|
+
<%= classNames.repository %>,
|
|
25
|
+
<%= classNames.service %>,
|
|
26
|
+
<%= classNames.findByIdUseCase %>,
|
|
27
|
+
<%= classNames.listUseCase %>,
|
|
28
|
+
<% if (hasDeclarativeQueries) { -%>
|
|
29
|
+
...declarativeQueryClasses,
|
|
30
|
+
<% } -%>
|
|
31
|
+
// TODO: Register hand-written use cases here
|
|
32
|
+
],
|
|
33
|
+
exports: [<%= classNames.service %>], // Only service is exported (ADR-002)
|
|
34
|
+
})
|
|
35
|
+
export class <%= classNames.module %> {}
|