@pattern-stack/codegen 0.7.5 → 0.7.6

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.
Files changed (119) hide show
  1. package/dist/runtime/base-classes/index.d.ts +2 -0
  2. package/dist/runtime/base-classes/index.js +345 -18
  3. package/dist/runtime/base-classes/index.js.map +1 -1
  4. package/dist/runtime/base-classes/junction-sync-repository.d.ts +87 -0
  5. package/dist/runtime/base-classes/junction-sync-repository.js +362 -0
  6. package/dist/runtime/base-classes/junction-sync-repository.js.map +1 -0
  7. package/dist/runtime/base-classes/sync-upsert-config.d.ts +58 -0
  8. package/dist/runtime/base-classes/sync-upsert-config.js +1 -0
  9. package/dist/runtime/base-classes/sync-upsert-config.js.map +1 -0
  10. package/dist/runtime/base-classes/synced-entity-repository.d.ts +68 -6
  11. package/dist/runtime/base-classes/synced-entity-repository.js +173 -7
  12. package/dist/runtime/base-classes/synced-entity-repository.js.map +1 -1
  13. package/dist/runtime/subsystems/sync/execute-sync.use-case.js +19 -1
  14. package/dist/runtime/subsystems/sync/execute-sync.use-case.js.map +1 -1
  15. package/dist/runtime/subsystems/sync/index.js +19 -1
  16. package/dist/runtime/subsystems/sync/index.js.map +1 -1
  17. package/dist/runtime/subsystems/sync/sync-sink.protocol.d.ts +6 -0
  18. package/dist/src/cli/index.js +24 -2
  19. package/dist/src/cli/index.js.map +1 -1
  20. package/dist/src/index.js +21 -2
  21. package/dist/src/index.js.map +1 -1
  22. package/package.json +1 -1
  23. package/runtime/base-classes/index.ts +9 -0
  24. package/runtime/base-classes/junction-sync-repository.ts +284 -0
  25. package/runtime/base-classes/sync-upsert-config.ts +58 -0
  26. package/runtime/base-classes/synced-entity-repository.ts +263 -9
  27. package/runtime/subsystems/sync/execute-sync.use-case.ts +25 -1
  28. package/runtime/subsystems/sync/sync-sink.protocol.ts +7 -0
  29. package/src/patterns/library/synced.pattern.ts +2 -1
  30. package/templates/_shared/generated-banner.mjs +74 -0
  31. package/templates/broadcast/new/backend-interface.ejs.t +1 -0
  32. package/templates/broadcast/new/bridge-listener.ejs.t +1 -0
  33. package/templates/broadcast/new/channel.ejs.t +1 -0
  34. package/templates/broadcast/new/index.ejs.t +1 -0
  35. package/templates/broadcast/new/memory-backend.ejs.t +1 -0
  36. package/templates/broadcast/new/module.ejs.t +1 -0
  37. package/templates/broadcast/new/prompt.js +13 -0
  38. package/templates/broadcast/new/websocket-backend.ejs.t +1 -0
  39. package/templates/entity/new/backend/application/commands/create.ejs.t +1 -0
  40. package/templates/entity/new/backend/application/commands/delete.ejs.t +1 -0
  41. package/templates/entity/new/backend/application/commands/grouped-index.ejs.t +1 -0
  42. package/templates/entity/new/backend/application/commands/index.ejs.t +1 -0
  43. package/templates/entity/new/backend/application/commands/update.ejs.t +1 -0
  44. package/templates/entity/new/backend/application/queries/declarative-queries.ejs.t +1 -0
  45. package/templates/entity/new/backend/application/queries/get-by-id.ejs.t +1 -0
  46. package/templates/entity/new/backend/application/queries/grouped-index.ejs.t +1 -0
  47. package/templates/entity/new/backend/application/queries/index.ejs.t +1 -0
  48. package/templates/entity/new/backend/application/queries/list.ejs.t +1 -0
  49. package/templates/entity/new/backend/application/queries/relationships.queries.ejs.t +1 -0
  50. package/templates/entity/new/backend/application/schemas/dto.ejs.t +1 -0
  51. package/templates/entity/new/backend/database/repository.ejs.t +1 -0
  52. package/templates/entity/new/backend/database/schema.ejs.t +1 -0
  53. package/templates/entity/new/backend/domain/entity.ejs.t +1 -0
  54. package/templates/entity/new/backend/domain/grouped-index.ejs.t +1 -0
  55. package/templates/entity/new/backend/domain/index.ejs.t +1 -0
  56. package/templates/entity/new/backend/domain/repository-interface.ejs.t +1 -0
  57. package/templates/entity/new/backend/modules/core/module.ejs.t +1 -0
  58. package/templates/entity/new/backend/modules/core/sync-source.ejs.t +1 -0
  59. package/templates/entity/new/backend/modules/core/sync-source.providers.ejs.t +1 -0
  60. package/templates/entity/new/backend/modules/trpc/module.ejs.t +1 -0
  61. package/templates/entity/new/backend/presentation/controller.ejs.t +1 -0
  62. package/templates/entity/new/clean-lite-ps/controller.ejs.t +1 -0
  63. package/templates/entity/new/clean-lite-ps/dto/create.ejs.t +1 -0
  64. package/templates/entity/new/clean-lite-ps/dto/output.ejs.t +1 -0
  65. package/templates/entity/new/clean-lite-ps/dto/update.ejs.t +1 -0
  66. package/templates/entity/new/clean-lite-ps/entity.ejs.t +1 -0
  67. package/templates/entity/new/clean-lite-ps/index.ejs.t +1 -0
  68. package/templates/entity/new/clean-lite-ps/module.ejs.t +1 -0
  69. package/templates/entity/new/clean-lite-ps/prompt-extension.js +148 -0
  70. package/templates/entity/new/clean-lite-ps/repository.ejs.t +92 -1
  71. package/templates/entity/new/clean-lite-ps/search-controller.ejs.t +1 -0
  72. package/templates/entity/new/clean-lite-ps/service.ejs.t +1 -0
  73. package/templates/entity/new/clean-lite-ps/use-cases/create.ejs.t +1 -0
  74. package/templates/entity/new/clean-lite-ps/use-cases/declarative-queries.ejs.t +1 -0
  75. package/templates/entity/new/clean-lite-ps/use-cases/delete.ejs.t +1 -0
  76. package/templates/entity/new/clean-lite-ps/use-cases/find-by-id-with-fields.ejs.t +1 -0
  77. package/templates/entity/new/clean-lite-ps/use-cases/find-by-id.ejs.t +1 -0
  78. package/templates/entity/new/clean-lite-ps/use-cases/list-with-fields.ejs.t +1 -0
  79. package/templates/entity/new/clean-lite-ps/use-cases/list.ejs.t +1 -0
  80. package/templates/entity/new/clean-lite-ps/use-cases/search.ejs.t +1 -0
  81. package/templates/entity/new/clean-lite-ps/use-cases/update.ejs.t +1 -0
  82. package/templates/entity/new/frontend/entity/collection.ejs.t +1 -0
  83. package/templates/entity/new/frontend/entity/combined.ejs.t +1 -0
  84. package/templates/entity/new/frontend/entity/fields.ejs.t +1 -0
  85. package/templates/entity/new/frontend/entity/hooks.ejs.t +1 -0
  86. package/templates/entity/new/frontend/entity/index.ejs.t +1 -0
  87. package/templates/entity/new/frontend/entity/mutation-hooks.ejs.t +1 -0
  88. package/templates/entity/new/frontend/entity/mutations.ejs.t +1 -0
  89. package/templates/entity/new/frontend/entity/types.ejs.t +1 -0
  90. package/templates/entity/new/frontend/store/hooks.ejs.t +1 -0
  91. package/templates/entity/new/frontend/unified-entity.ejs.t +1 -0
  92. package/templates/entity/new/prompt.js +19 -0
  93. package/templates/junction/new/entity.ejs.t +1 -0
  94. package/templates/junction/new/index.ejs.t +1 -0
  95. package/templates/junction/new/module.ejs.t +1 -0
  96. package/templates/junction/new/prompt.js +83 -0
  97. package/templates/junction/new/repository.ejs.t +44 -3
  98. package/templates/junction/new/service.ejs.t +1 -0
  99. package/templates/relationship/new/controller.ejs.t +1 -0
  100. package/templates/relationship/new/dto/create.ejs.t +1 -0
  101. package/templates/relationship/new/dto/output.ejs.t +1 -0
  102. package/templates/relationship/new/dto/update.ejs.t +1 -0
  103. package/templates/relationship/new/entity.ejs.t +1 -0
  104. package/templates/relationship/new/index.ejs.t +1 -0
  105. package/templates/relationship/new/module.ejs.t +1 -0
  106. package/templates/relationship/new/prompt.js +14 -0
  107. package/templates/relationship/new/repository.ejs.t +1 -0
  108. package/templates/relationship/new/service.ejs.t +1 -0
  109. package/templates/relationship/new/use-cases/declarative-queries.ejs.t +1 -0
  110. package/templates/relationship/new/use-cases/find-by-id.ejs.t +1 -0
  111. package/templates/relationship/new/use-cases/list.ejs.t +1 -0
  112. package/templates/subsystem/auth/auth-oauth-state.schema.ejs.t +1 -0
  113. package/templates/subsystem/auth/prompt.js +8 -0
  114. package/templates/subsystem/events/domain-events.schema.ejs.t +1 -0
  115. package/templates/subsystem/events/prompt.js +8 -0
  116. package/templates/subsystem/jobs/job-orchestration.schema.ejs.t +1 -0
  117. package/templates/subsystem/jobs/prompt.js +8 -0
  118. package/templates/subsystem/sync/prompt.js +8 -0
  119. package/templates/subsystem/sync/sync-audit.schema.ejs.t +1 -0
@@ -17,6 +17,7 @@ import fs from "node:fs";
17
17
  import path from "node:path";
18
18
  import yaml from "yaml";
19
19
  import pluralizePkg from "pluralize";
20
+ import { renderGeneratedBanner } from "../../_shared/generated-banner.mjs";
20
21
 
21
22
  // ============================================================================
22
23
  // Naming Helpers (inlined to avoid import issues with Hygen)
@@ -376,6 +377,63 @@ export default {
376
377
  const leftEntityCamel = camelCase(leftEntity);
377
378
  const rightEntityCamel = camelCase(rightEntity);
378
379
 
380
+ // ======================================================================
381
+ // Inbound-sync write surface (#374)
382
+ // ======================================================================
383
+ // The junction sync identity is the tuple (leftId, rightId[, role]); its
384
+ // externalId is a COMPOSITE string. Both parent FKs resolve strictly. FK
385
+ // write-keys use `${camelCase(entity)}ExternalId` (matches the reference).
386
+
387
+ const leftSyncWriteKey = `${leftEntityCamel}ExternalId`;
388
+ const rightSyncWriteKey = `${rightEntityCamel}ExternalId`;
389
+ const roleColumnCamel = hasRole ? 'role' : null;
390
+ // Role TS type — literal union from the enum choices, else absent.
391
+ const roleTsType = hasRole
392
+ ? roleChoices.map((c) => `'${c}'`).join(' | ')
393
+ : null;
394
+
395
+ // JunctionSyncConfig literal fields. refTable is emitted as a live table
396
+ // identifier (leftTable/rightTable) by the template.
397
+ const syncConfig = {
398
+ leftColumn: leftColumnCamel,
399
+ leftRefTable: leftTable,
400
+ rightColumn: rightColumnCamel,
401
+ rightRefTable: rightTable,
402
+ roleColumn: roleColumnCamel,
403
+ };
404
+
405
+ // TSyncWrite fields: both parent external ids + optional role + userId.
406
+ const syncWriteFields = [
407
+ { name: leftSyncWriteKey, tsType: 'string' },
408
+ { name: rightSyncWriteKey, tsType: 'string' },
409
+ ...(hasRole ? [{ name: 'role', tsType: roleTsType }] : []),
410
+ { name: 'userId', tsType: 'string' },
411
+ ];
412
+
413
+ // TSyncProjection fields: composite id + local FK columns + optional role +
414
+ // timestamps. No surrogate id column on a junction.
415
+ const syncProjectionFields = [
416
+ { name: 'id', tsType: 'string' },
417
+ { name: leftColumnCamel, tsType: 'string' },
418
+ { name: rightColumnCamel, tsType: 'string' },
419
+ ...(hasRole ? [{ name: 'role', tsType: roleTsType }] : []),
420
+ { name: 'createdAt', tsType: 'Date' },
421
+ { name: 'updatedAt', tsType: 'Date' },
422
+ ];
423
+
424
+ // Parent-table imports for the FK resolvers, deduped (#368). Junction
425
+ // endpoints are distinct by schema, so two imports unless they collide.
426
+ const syncParentImports = [];
427
+ const seenSyncImports = new Set();
428
+ for (const imp of [
429
+ { table: leftTable, importPath: leftEntityImportFromJunction },
430
+ { table: rightTable, importPath: rightEntityImportFromJunction },
431
+ ]) {
432
+ if (seenSyncImports.has(imp.table)) continue;
433
+ seenSyncImports.add(imp.table);
434
+ syncParentImports.push(imp);
435
+ }
436
+
379
437
  // ======================================================================
380
438
  // Class names
381
439
  // ======================================================================
@@ -391,7 +449,20 @@ export default {
391
449
  // Return all template locals
392
450
  // ======================================================================
393
451
 
452
+ // @generated DO-NOT-EDIT banner — stamped at the top of every
453
+ // force-overwritten junction output. `yamlPath` is the consumer-relative
454
+ // source definition.
455
+ const generatedBanner = renderGeneratedBanner({
456
+ // Relative to cwd so the banner is portable across machines.
457
+ source: path.relative(cwd, fullPath),
458
+ generator: 'junction',
459
+ seam: 'the junction YAML',
460
+ });
461
+
394
462
  return {
463
+ // @generated DO-NOT-EDIT banner (see renderGeneratedBanner)
464
+ generatedBanner,
465
+
395
466
  // Identity
396
467
  name: junctionName,
397
468
  entityNamePascal,
@@ -451,6 +522,18 @@ export default {
451
522
  leftTable,
452
523
  rightTable,
453
524
 
525
+ // ──────────────────────────────────────────────────────────────────
526
+ // Inbound-sync write surface (#374)
527
+ // ──────────────────────────────────────────────────────────────────
528
+ leftSyncWriteKey,
529
+ rightSyncWriteKey,
530
+ roleColumnCamel,
531
+ roleTsType,
532
+ junctionSyncConfig: syncConfig,
533
+ syncWriteFields,
534
+ syncProjectionFields,
535
+ syncParentImports,
536
+
454
537
  // ──────────────────────────────────────────────────────────────────
455
538
  // CGP-60 — fan-out locals
456
539
  // ──────────────────────────────────────────────────────────────────
@@ -2,15 +2,47 @@
2
2
  to: "<%= outputPaths.repository %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import { Injectable, Inject } from '@nestjs/common';
6
7
  import { eq } from 'drizzle-orm';
7
8
  import { DRIZZLE } from '@shared/constants/tokens';
8
9
  import type { DrizzleClient } from '@shared/types/drizzle';
9
- import { BaseRepository } from '@shared/base-classes/base-repository';
10
+ import { JunctionSyncRepository } from '@shared/base-classes/junction-sync-repository';
11
+ import type { JunctionSyncConfig } from '@shared/base-classes/junction-sync-repository';
12
+ <%_ syncParentImports.forEach((imp) => { _%>
13
+ import { <%= imp.table %> } from '<%= imp.importPath %>';
14
+ <%_ }); _%>
10
15
  import { <%= tableVarName %>, type <%= classNames.entity %> } from './<%= name %>.entity';
11
16
 
17
+ /**
18
+ * Canonical fields a synced <%= name %> junction write carries (#374). BOTH
19
+ * parent FKs are named by their vendor external ids and resolved STRICTLY in
20
+ * the tx (a missing parent throws → the orchestrator records a failed item and
21
+ * continues). `userId` is run context (no column on the junction).
22
+ */
23
+ export interface <%= classNames.entity %>SyncWrite {
24
+ <%_ syncWriteFields.forEach((f) => { _%>
25
+ readonly <%= f.name %>: <%- f.tsType %>;
26
+ <%_ }); _%>
27
+ }
28
+
29
+ /**
30
+ * Canonical-projected view of a <%= name %> junction row, keyed for the sync
31
+ * differ (#374). `id` is the COMPOSITE externalId (the junction has no
32
+ * surrogate id); the FKs are the LOCAL resolved uuids.
33
+ */
34
+ export interface <%= classNames.entity %>SyncProjection {
35
+ <%_ syncProjectionFields.forEach((f) => { _%>
36
+ readonly <%= f.name %>: <%- f.tsType %>;
37
+ <%_ }); _%>
38
+ }
39
+
12
40
  @Injectable()
13
- export class <%= classNames.repository %> extends BaseRepository<<%= classNames.entity %>> {
41
+ export class <%= classNames.repository %> extends JunctionSyncRepository<
42
+ <%= classNames.entity %>,
43
+ <%= classNames.entity %>SyncWrite,
44
+ <%= classNames.entity %>SyncProjection
45
+ > {
14
46
  readonly table = <%= tableVarName %>;
15
47
 
16
48
  // Junctions track temporal validity via started_at / ended_at, NOT via
@@ -21,6 +53,14 @@ export class <%= classNames.repository %> extends BaseRepository<<%= classNames.
21
53
  userTracking: false,
22
54
  };
23
55
 
56
+ // Inbound-sync write surface (#374). Both endpoints resolve strictly against
57
+ // the live parent tables; role-bearing junctions conflict on (left,right,role).
58
+ protected readonly syncConfig: JunctionSyncConfig = {
59
+ left: { column: '<%= junctionSyncConfig.leftColumn %>', refTable: <%= junctionSyncConfig.leftRefTable %> },
60
+ right: { column: '<%= junctionSyncConfig.rightColumn %>', refTable: <%= junctionSyncConfig.rightRefTable %> },
61
+ roleColumn: <%- junctionSyncConfig.roleColumn ? `'${junctionSyncConfig.roleColumn}'` : 'null' %>,
62
+ };
63
+
24
64
  constructor(@Inject(DRIZZLE) db: DrizzleClient) {
25
65
  super(db);
26
66
  }
@@ -62,6 +102,7 @@ export class <%= classNames.repository %> extends BaseRepository<<%= classNames.
62
102
  return rows as <%= classNames.entity %>[];
63
103
  }
64
104
 
65
- // Inherited from BaseRepository:
105
+ // Inherited from JunctionSyncRepository (+ BaseRepository):
66
106
  // findById, findByIds, list, count, exists, create, update, delete, upsertMany
107
+ // syncUpsertOne, findByExternalIdProjected, softDeleteByExternalId
67
108
  }
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.service %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import { Injectable, Inject, Optional } from '@nestjs/common';
6
7
  import { WithAnalytics } from '@shared/base-classes/with-analytics';
7
8
  import { EVENT_BUS } from '@shared/constants/tokens';
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.controller %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import { Controller, Get, Param } from '@nestjs/common';
6
7
  import { <%= classNames.findByIdUseCase %> } from './use-cases/find-<%= name %>-by-id.use-case';
7
8
  import { <%= classNames.listUseCase %> } from './use-cases/list-<%= entityNamePlural %>.use-case';
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.createDto %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import { z } from 'zod';
6
7
  <%_ if (hasTypes) { _%>
7
8
  import { <%= typeEnumName %> } from '../<%= name %>.entity';
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.outputDto %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import { z } from 'zod';
6
7
 
7
8
  export const <%= classNames.outputSchema %> = z.object({
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.updateDto %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import { z } from 'zod';
6
7
  import { <%= classNames.createSchema %> } from './create-<%= name %>.dto';
7
8
 
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.entity %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import {
6
7
  <%_ drizzleImports.filter(i => i !== 'relations').forEach(i => { _%>
7
8
  <%= i %>,
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.index %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  /**
6
7
  * <%= classNames.entity %> module barrel export
7
8
  * Generated by relationship codegen - do not edit directly
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.module %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import { Module } from '@nestjs/common';
6
7
  import { DatabaseModule } from '@shared/database/database.module';
7
8
 
@@ -12,6 +12,7 @@ import fs from "node:fs";
12
12
  import path from "node:path";
13
13
  import yaml from "yaml";
14
14
  import pluralizePkg from "pluralize";
15
+ import { renderGeneratedBanner } from "../../_shared/generated-banner.mjs";
15
16
 
16
17
  // ============================================================================
17
18
  // Naming Helpers (inlined to avoid import issues with Hygen)
@@ -591,7 +592,20 @@ export default {
591
592
  // Return all template locals
592
593
  // ======================================================================
593
594
 
595
+ // @generated DO-NOT-EDIT banner — stamped at the top of every
596
+ // force-overwritten relationship output. `yamlPath` is the
597
+ // consumer-relative source definition.
598
+ const generatedBanner = renderGeneratedBanner({
599
+ // Relative to cwd so the banner is portable across machines.
600
+ source: path.relative(process.cwd(), fullPath),
601
+ generator: 'relationship',
602
+ seam: 'the relationship YAML',
603
+ });
604
+
594
605
  return {
606
+ // @generated DO-NOT-EDIT banner (see renderGeneratedBanner)
607
+ generatedBanner,
608
+
595
609
  // Identity
596
610
  name,
597
611
  entityNamePascal,
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.repository %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import { Injectable, Inject } from '@nestjs/common';
6
7
  <% if (hasDeclarativeQueries) { -%>
7
8
  import { eq<%= hasMultiFieldQuery ? ', and' : '' %><%= hasOrderedQuery ? ', desc, asc' : '' %> } from 'drizzle-orm';
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.service %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import { Injectable, Inject, Optional } from '@nestjs/common';
6
7
  import { WithAnalytics } from '@shared/base-classes/with-analytics';
7
8
  import { EVENT_BUS } from '@shared/constants/tokens';
@@ -2,6 +2,7 @@
2
2
  to: "<%= hasDeclarativeQueries ? outputPaths.declarativeQueries : null %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  <% if (hasDeclarativeQueries) { -%>
6
7
  /**
7
8
  * Declarative Query Use Cases for <%= classNames.entity %>
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.findByIdUseCase %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import { Injectable } from '@nestjs/common';
6
7
  import { <%= classNames.service %> } from '../<%= name %>.service';
7
8
  import type { <%= classNames.entity %> } from '../<%= name %>.entity';
@@ -2,6 +2,7 @@
2
2
  to: "<%= outputPaths.listUseCase %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  import { Injectable } from '@nestjs/common';
6
7
  import { <%= classNames.service %> } from '../<%= name %>.service';
7
8
  import type { <%= classNames.entity %> } from '../<%= name %>.entity';
@@ -2,6 +2,7 @@
2
2
  to: "<%= schemaPath %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  // Schema barrel append tracked in #284 — same gap as events/jobs/sync today.
6
7
  /**
7
8
  * Drizzle schema for the `auth_oauth_state` table — backs the
@@ -29,6 +29,8 @@
29
29
  * Auth has NO `multi_tenant` knob (see auth-scaffold-locals.ts docstring).
30
30
  */
31
31
 
32
+ import { renderGeneratedBanner } from "../../_shared/generated-banner.mjs";
33
+
32
34
  export default {
33
35
  prompt: async ({ args }) => {
34
36
  return {
@@ -41,6 +43,12 @@ export default {
41
43
  envConfigPath: args.envConfigPath ?? ".env.config",
42
44
  redirectUriBase: args.redirectUriBase ?? "http://localhost:3000",
43
45
  tokenEncryptionKey: args.tokenEncryptionKey ?? "",
46
+ // @generated DO-NOT-EDIT banner — the auth subsystem schema is
47
+ // force-overwritten on every `subsystem install`.
48
+ generatedBanner: renderGeneratedBanner({
49
+ generator: "subsystem auth",
50
+ seam: "the codegen.config.yaml auth block, then re-run `codegen subsystem install`",
51
+ }),
44
52
  };
45
53
  },
46
54
  };
@@ -2,6 +2,7 @@
2
2
  to: "<%= schemaPath %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  /**
6
7
  * Drizzle schema for the domain_events outbox table.
7
8
  *
@@ -16,6 +16,8 @@
16
16
  * imported. So no workerPath / workerMode / mainTsPath locals here.
17
17
  */
18
18
 
19
+ import { renderGeneratedBanner } from "../../_shared/generated-banner.mjs";
20
+
19
21
  function coerceBool(raw) {
20
22
  if (raw === true) return true;
21
23
  if (raw === false) return false;
@@ -34,6 +36,12 @@ export default {
34
36
  generatedKeepPath:
35
37
  args.generatedKeepPath ??
36
38
  "shared/subsystems/events/generated/.gitkeep",
39
+ // @generated DO-NOT-EDIT banner — the events subsystem schema is
40
+ // force-overwritten on every `subsystem install`.
41
+ generatedBanner: renderGeneratedBanner({
42
+ generator: "subsystem events",
43
+ seam: "the codegen.config.yaml events block, then re-run `codegen subsystem install`",
44
+ }),
37
45
  };
38
46
  },
39
47
  };
@@ -2,6 +2,7 @@
2
2
  to: "<%= schemaPath %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  /**
6
7
  * Drizzle schema for the job orchestration domain (ADR-022).
7
8
  *
@@ -14,6 +14,8 @@
14
14
  * --appName <string>
15
15
  */
16
16
 
17
+ import { renderGeneratedBanner } from "../../_shared/generated-banner.mjs";
18
+
17
19
  function coerceBool(raw) {
18
20
  if (raw === true) return true;
19
21
  if (raw === false) return false;
@@ -35,6 +37,12 @@ export default {
35
37
  workerPath: args.workerPath ?? "worker.ts",
36
38
  schemaPath:
37
39
  args.schemaPath ?? "shared/subsystems/jobs/job-orchestration.schema.ts",
40
+ // @generated DO-NOT-EDIT banner — the jobs subsystem schema is
41
+ // force-overwritten on every `subsystem install`.
42
+ generatedBanner: renderGeneratedBanner({
43
+ generator: "subsystem jobs",
44
+ seam: "the codegen.config.yaml jobs block, then re-run `codegen subsystem install`",
45
+ }),
38
46
  };
39
47
  },
40
48
  };
@@ -23,6 +23,8 @@
23
23
  * Phase 2 timing for `examples/sync/`.
24
24
  */
25
25
 
26
+ import { renderGeneratedBanner } from "../../_shared/generated-banner.mjs";
27
+
26
28
  function coerceBool(raw) {
27
29
  if (raw === true) return true;
28
30
  if (raw === false) return false;
@@ -38,6 +40,12 @@ export default {
38
40
  configPath: args.configPath ?? "codegen.config.yaml",
39
41
  schemaPath:
40
42
  args.schemaPath ?? "shared/subsystems/sync/sync-audit.schema.ts",
43
+ // @generated DO-NOT-EDIT banner — the sync subsystem schema is
44
+ // force-overwritten on every `subsystem install`.
45
+ generatedBanner: renderGeneratedBanner({
46
+ generator: "subsystem sync",
47
+ seam: "the codegen.config.yaml sync block, then re-run `codegen subsystem install`",
48
+ }),
41
49
  };
42
50
  },
43
51
  };
@@ -2,6 +2,7 @@
2
2
  to: "<%= schemaPath %>"
3
3
  force: true
4
4
  ---
5
+ <%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
5
6
  /**
6
7
  * Drizzle schema for the sync subsystem audit/observability tables (SYNC-1).
7
8
  *