@rawsql-ts/ztd-cli 0.17.0 → 0.19.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/README.md +532 -366
- package/package.json +26 -15
- package/templates/.editorconfig +16 -16
- package/templates/.prettierignore +2 -2
- package/templates/.prettierrc +24 -24
- package/templates/AGENTS.md +30 -52
- package/templates/CONTEXT.md +11 -0
- package/templates/CONTEXT.webapi.md +11 -0
- package/templates/DESIGN.md +17 -0
- package/templates/DEV_NOTES.md +14 -0
- package/templates/PROMPT_DOGFOOD.webapi.md +49 -0
- package/templates/README.md +46 -14
- package/templates/README.webapi.md +38 -0
- package/templates/scripts/local-source-guard.mjs +189 -0
- package/templates/src/AGENTS.md +26 -26
- package/templates/src/application/AGENTS.md +15 -0
- package/templates/src/application/README.md +6 -0
- package/templates/src/catalog/AGENTS.md +28 -37
- package/templates/src/catalog/runtime/AGENTS.md +28 -75
- package/templates/src/catalog/runtime/_coercions.local-source.ts +30 -0
- package/templates/src/catalog/runtime/_coercions.ts +30 -1
- package/templates/src/catalog/runtime/_smoke.runtime.ts +21 -21
- package/templates/src/catalog/specs/AGENTS.md +41 -48
- package/templates/src/catalog/specs/_smoke.spec.arktype.ts +21 -21
- package/templates/src/catalog/specs/_smoke.spec.zod.ts +20 -20
- package/templates/src/db/sql-client-adapters.ts +32 -0
- package/templates/src/db/sql-client.ts +24 -24
- package/templates/src/domain/AGENTS.md +15 -0
- package/templates/src/domain/README.md +6 -0
- package/templates/src/infrastructure/AGENTS.md +14 -0
- package/templates/src/infrastructure/README.md +6 -0
- package/templates/src/infrastructure/db/AGENTS.md +14 -0
- package/templates/src/infrastructure/db/sql-client-adapters.ts +34 -0
- package/templates/{dist/ztd-cli/templates/src → src/infrastructure}/db/sql-client.ts +3 -3
- package/templates/src/infrastructure/persistence/AGENTS.md +18 -0
- package/templates/src/infrastructure/persistence/README.md +8 -0
- package/templates/src/infrastructure/persistence/repositories/AGENTS.md +17 -0
- package/templates/src/infrastructure/persistence/repositories/tables/AGENTS.md +20 -0
- package/templates/src/infrastructure/persistence/repositories/tables/README.md +5 -0
- package/templates/src/infrastructure/persistence/repositories/views/AGENTS.md +16 -0
- package/templates/src/infrastructure/persistence/repositories/views/README.md +5 -0
- package/templates/src/infrastructure/telemetry/AGENTS.md +14 -0
- package/templates/src/infrastructure/telemetry/consoleRepositoryTelemetry.ts +66 -0
- package/templates/src/infrastructure/telemetry/repositoryTelemetry.ts +26 -0
- package/templates/src/infrastructure/telemetry/types.ts +48 -0
- package/templates/src/jobs/AGENTS.md +25 -26
- package/templates/src/jobs/README.md +2 -2
- package/templates/src/local/sql-contract.ts +1 -0
- package/templates/src/presentation/AGENTS.md +15 -0
- package/templates/src/presentation/http/AGENTS.md +15 -0
- package/templates/src/presentation/http/README.md +6 -0
- package/templates/src/repositories/AGENTS.md +30 -118
- package/templates/src/repositories/tables/AGENTS.md +29 -94
- package/templates/src/repositories/tables/README.md +5 -3
- package/templates/src/repositories/views/AGENTS.md +25 -25
- package/templates/src/repositories/views/README.md +5 -3
- package/templates/src/sql/AGENTS.md +30 -77
- package/templates/src/sql/README.md +5 -5
- package/templates/tests/AGENTS.md +29 -62
- package/templates/tests/generated/AGENTS.md +23 -16
- package/templates/tests/smoke.test.ts +25 -5
- package/templates/tests/smoke.validation.test.ts +34 -34
- package/templates/tests/support/AGENTS.md +24 -26
- package/templates/tests/support/global-setup.ts +15 -15
- package/templates/tests/support/testkit-client.ts +14 -14
- package/templates/tests/support/testkit-client.webapi.ts +14 -0
- package/templates/tests/ztd-layout.generated.ts +6 -6
- package/templates/tsconfig.json +15 -15
- package/templates/vitest.config.ts +13 -13
- package/templates/ztd/AGENTS.md +23 -18
- package/templates/ztd/README.md +5 -5
- package/templates/ztd/ddl/AGENTS.md +26 -34
- package/templates/ztd/ddl/demo.sql +74 -74
- package/LICENSE +0 -21
- package/dist/commands/ddl.d.ts +0 -7
- package/dist/commands/ddl.js +0 -118
- package/dist/commands/ddl.js.map +0 -1
- package/dist/commands/diff.d.ts +0 -10
- package/dist/commands/diff.js +0 -38
- package/dist/commands/diff.js.map +0 -1
- package/dist/commands/genEntities.d.ts +0 -6
- package/dist/commands/genEntities.js +0 -50
- package/dist/commands/genEntities.js.map +0 -1
- package/dist/commands/init.d.ts +0 -79
- package/dist/commands/init.js +0 -1083
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/lint.d.ts +0 -59
- package/dist/commands/lint.js +0 -358
- package/dist/commands/lint.js.map +0 -1
- package/dist/commands/options.d.ts +0 -9
- package/dist/commands/options.js +0 -48
- package/dist/commands/options.js.map +0 -1
- package/dist/commands/pull.d.ts +0 -10
- package/dist/commands/pull.js +0 -105
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/ztdConfig.d.ts +0 -23
- package/dist/commands/ztdConfig.js +0 -216
- package/dist/commands/ztdConfig.js.map +0 -1
- package/dist/commands/ztdConfigCommand.d.ts +0 -5
- package/dist/commands/ztdConfigCommand.js +0 -157
- package/dist/commands/ztdConfigCommand.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/utils/agents.d.ts +0 -1
- package/dist/utils/agents.js +0 -48
- package/dist/utils/agents.js.map +0 -1
- package/dist/utils/collectSqlFiles.d.ts +0 -9
- package/dist/utils/collectSqlFiles.js +0 -58
- package/dist/utils/collectSqlFiles.js.map +0 -1
- package/dist/utils/connectionSummary.d.ts +0 -3
- package/dist/utils/connectionSummary.js +0 -29
- package/dist/utils/connectionSummary.js.map +0 -1
- package/dist/utils/dbConnection.d.ts +0 -29
- package/dist/utils/dbConnection.js +0 -210
- package/dist/utils/dbConnection.js.map +0 -1
- package/dist/utils/fs.d.ts +0 -1
- package/dist/utils/fs.js +0 -12
- package/dist/utils/fs.js.map +0 -1
- package/dist/utils/normalizePulledSchema.d.ts +0 -12
- package/dist/utils/normalizePulledSchema.js +0 -213
- package/dist/utils/normalizePulledSchema.js.map +0 -1
- package/dist/utils/optionalDependencies.d.ts +0 -35
- package/dist/utils/optionalDependencies.js +0 -96
- package/dist/utils/optionalDependencies.js.map +0 -1
- package/dist/utils/pgDump.d.ts +0 -11
- package/dist/utils/pgDump.js +0 -55
- package/dist/utils/pgDump.js.map +0 -1
- package/dist/utils/sqlLintHelpers.d.ts +0 -18
- package/dist/utils/sqlLintHelpers.js +0 -270
- package/dist/utils/sqlLintHelpers.js.map +0 -1
- package/dist/utils/typeMapper.d.ts +0 -4
- package/dist/utils/typeMapper.js +0 -76
- package/dist/utils/typeMapper.js.map +0 -1
- package/dist/utils/ztdProjectConfig.d.ts +0 -40
- package/dist/utils/ztdProjectConfig.js +0 -167
- package/dist/utils/ztdProjectConfig.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/driver/PgTestkitClient.d.ts +0 -38
- package/templates/dist/drivers/pg-testkit/src/driver/PgTestkitClient.js +0 -117
- package/templates/dist/drivers/pg-testkit/src/driver/PgTestkitClient.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/driver/createPgTestkitPool.d.ts +0 -4
- package/templates/dist/drivers/pg-testkit/src/driver/createPgTestkitPool.js +0 -71
- package/templates/dist/drivers/pg-testkit/src/driver/createPgTestkitPool.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/index.d.ts +0 -5
- package/templates/dist/drivers/pg-testkit/src/index.js +0 -11
- package/templates/dist/drivers/pg-testkit/src/index.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/proxy/wrapPgClient.d.ts +0 -3
- package/templates/dist/drivers/pg-testkit/src/proxy/wrapPgClient.js +0 -79
- package/templates/dist/drivers/pg-testkit/src/proxy/wrapPgClient.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/types.d.ts +0 -69
- package/templates/dist/drivers/pg-testkit/src/types.js +0 -3
- package/templates/dist/drivers/pg-testkit/src/types.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureState.d.ts +0 -15
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureState.js +0 -34
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureState.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureValidation.d.ts +0 -12
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureValidation.js +0 -53
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureValidation.js.map +0 -1
- package/templates/dist/mapper-core/src/index.d.ts +0 -160
- package/templates/dist/mapper-core/src/index.js +0 -637
- package/templates/dist/mapper-core/src/index.js.map +0 -1
- package/templates/dist/testkit-core/src/errors/index.d.ts +0 -49
- package/templates/dist/testkit-core/src/errors/index.js +0 -111
- package/templates/dist/testkit-core/src/errors/index.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/ColumnAffinity.d.ts +0 -5
- package/templates/dist/testkit-core/src/fixtures/ColumnAffinity.js +0 -29
- package/templates/dist/testkit-core/src/fixtures/ColumnAffinity.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/DdlFixtureLoader.d.ts +0 -37
- package/templates/dist/testkit-core/src/fixtures/DdlFixtureLoader.js +0 -182
- package/templates/dist/testkit-core/src/fixtures/DdlFixtureLoader.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/FixtureProvider.d.ts +0 -20
- package/templates/dist/testkit-core/src/fixtures/FixtureProvider.js +0 -121
- package/templates/dist/testkit-core/src/fixtures/FixtureProvider.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/FixtureStore.d.ts +0 -51
- package/templates/dist/testkit-core/src/fixtures/FixtureStore.js +0 -199
- package/templates/dist/testkit-core/src/fixtures/FixtureStore.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/TableDefinitionSchemaRegistry.d.ts +0 -10
- package/templates/dist/testkit-core/src/fixtures/TableDefinitionSchemaRegistry.js +0 -28
- package/templates/dist/testkit-core/src/fixtures/TableDefinitionSchemaRegistry.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/TableNameResolver.d.ts +0 -18
- package/templates/dist/testkit-core/src/fixtures/TableNameResolver.js +0 -80
- package/templates/dist/testkit-core/src/fixtures/TableNameResolver.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/ddlLint.d.ts +0 -59
- package/templates/dist/testkit-core/src/fixtures/ddlLint.js +0 -489
- package/templates/dist/testkit-core/src/fixtures/ddlLint.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/naming.d.ts +0 -1
- package/templates/dist/testkit-core/src/fixtures/naming.js +0 -6
- package/templates/dist/testkit-core/src/fixtures/naming.js.map +0 -1
- package/templates/dist/testkit-core/src/index.d.ts +0 -17
- package/templates/dist/testkit-core/src/index.js +0 -47
- package/templates/dist/testkit-core/src/index.js.map +0 -1
- package/templates/dist/testkit-core/src/logger/NoopLogger.d.ts +0 -8
- package/templates/dist/testkit-core/src/logger/NoopLogger.js +0 -16
- package/templates/dist/testkit-core/src/logger/NoopLogger.js.map +0 -1
- package/templates/dist/testkit-core/src/provider/TestkitProvider.d.ts +0 -57
- package/templates/dist/testkit-core/src/provider/TestkitProvider.js +0 -149
- package/templates/dist/testkit-core/src/provider/TestkitProvider.js.map +0 -1
- package/templates/dist/testkit-core/src/rewriter/ResultSelectRewriter.d.ts +0 -43
- package/templates/dist/testkit-core/src/rewriter/ResultSelectRewriter.js +0 -473
- package/templates/dist/testkit-core/src/rewriter/ResultSelectRewriter.js.map +0 -1
- package/templates/dist/testkit-core/src/rewriter/SelectAnalyzer.d.ts +0 -9
- package/templates/dist/testkit-core/src/rewriter/SelectAnalyzer.js +0 -38
- package/templates/dist/testkit-core/src/rewriter/SelectAnalyzer.js.map +0 -1
- package/templates/dist/testkit-core/src/rewriter/SelectFixtureRewriter.d.ts +0 -42
- package/templates/dist/testkit-core/src/rewriter/SelectFixtureRewriter.js +0 -298
- package/templates/dist/testkit-core/src/rewriter/SelectFixtureRewriter.js.map +0 -1
- package/templates/dist/testkit-core/src/sql/SqliteValuesBuilder.d.ts +0 -12
- package/templates/dist/testkit-core/src/sql/SqliteValuesBuilder.js +0 -63
- package/templates/dist/testkit-core/src/sql/SqliteValuesBuilder.js.map +0 -1
- package/templates/dist/testkit-core/src/types/index.d.ts +0 -69
- package/templates/dist/testkit-core/src/types/index.js +0 -3
- package/templates/dist/testkit-core/src/types/index.js.map +0 -1
- package/templates/dist/testkit-core/src/utils/queryHelpers.d.ts +0 -28
- package/templates/dist/testkit-core/src/utils/queryHelpers.js +0 -81
- package/templates/dist/testkit-core/src/utils/queryHelpers.js.map +0 -1
- package/templates/dist/writer-core/src/index.d.ts +0 -34
- package/templates/dist/writer-core/src/index.js +0 -115
- package/templates/dist/writer-core/src/index.js.map +0 -1
- package/templates/dist/ztd-cli/templates/src/db/sql-client.d.ts +0 -20
- package/templates/dist/ztd-cli/templates/src/db/sql-client.js +0 -3
- package/templates/dist/ztd-cli/templates/src/db/sql-client.js.map +0 -1
- package/templates/dist/ztd-cli/templates/src/repositories/user-accounts.d.ts +0 -36
- package/templates/dist/ztd-cli/templates/src/repositories/user-accounts.js +0 -85
- package/templates/dist/ztd-cli/templates/src/repositories/user-accounts.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/generated/ztd-row-map.generated.d.ts +0 -20
- package/templates/dist/ztd-cli/templates/tests/generated/ztd-row-map.generated.js +0 -33
- package/templates/dist/ztd-cli/templates/tests/generated/ztd-row-map.generated.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/support/global-setup.d.ts +0 -10
- package/templates/dist/ztd-cli/templates/tests/support/global-setup.js +0 -29
- package/templates/dist/ztd-cli/templates/tests/support/global-setup.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/support/testkit-client.d.ts +0 -66
- package/templates/dist/ztd-cli/templates/tests/support/testkit-client.js +0 -552
- package/templates/dist/ztd-cli/templates/tests/support/testkit-client.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/user-profiles.test.d.ts +0 -1
- package/templates/dist/ztd-cli/templates/tests/user-profiles.test.js +0 -82
- package/templates/dist/ztd-cli/templates/tests/user-profiles.test.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/writer-constraints.test.d.ts +0 -1
- package/templates/dist/ztd-cli/templates/tests/writer-constraints.test.js +0 -29
- package/templates/dist/ztd-cli/templates/tests/writer-constraints.test.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/ztd-layout.generated.d.ts +0 -7
- package/templates/dist/ztd-cli/templates/tests/ztd-layout.generated.js +0 -10
- package/templates/dist/ztd-cli/templates/tests/ztd-layout.generated.js.map +0 -1
package/templates/src/AGENTS.md
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
# Package Scope
|
|
2
|
+
- Applies to `packages/ztd-cli/templates/src`.
|
|
3
|
+
- Governs runtime application code emitted by template generation across both generic and WebAPI-oriented layouts.
|
|
4
|
+
|
|
5
|
+
# Policy
|
|
6
|
+
## REQUIRED
|
|
7
|
+
- Runtime code under `src/` MUST remain independent from `tests/` and `tests/generated/` imports.
|
|
8
|
+
- Runtime code MUST remain independent from ZTD internals.
|
|
9
|
+
- Runtime modules MUST use explicit contracts and deterministic failure surfaces.
|
|
10
|
+
- Domain, application, and presentation layers MUST stay free from direct SQL/DDL ownership when those directories exist.
|
|
11
|
+
|
|
12
|
+
## ALLOWED
|
|
13
|
+
- Runtime modules MAY use project typecheck and filtered test commands for validation.
|
|
14
|
+
|
|
15
|
+
## PROHIBITED
|
|
16
|
+
- Importing test-only helpers into runtime code.
|
|
17
|
+
- Treating generated artifacts as runtime dependencies.
|
|
18
|
+
|
|
19
|
+
# Mandatory Workflow
|
|
20
|
+
- Before committing changes under `src/`, run project typecheck and relevant tests.
|
|
21
|
+
|
|
22
|
+
# Hygiene
|
|
23
|
+
- Keep runtime modules explicit and small enough to preserve contract boundaries.
|
|
24
|
+
|
|
25
|
+
# References
|
|
26
|
+
- Parent policy: [../AGENTS.md](../AGENTS.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Package Scope
|
|
2
|
+
- Applies to `packages/ztd-cli/templates/src/application`.
|
|
3
|
+
- Defines application-layer orchestration for WebAPI-oriented scaffolds.
|
|
4
|
+
|
|
5
|
+
# Policy
|
|
6
|
+
## REQUIRED
|
|
7
|
+
- Application modules MUST orchestrate domain-facing ports and policies without embedding transport or SQL details.
|
|
8
|
+
- Validation and command handling MAY live here when it stays independent from persistence mechanics.
|
|
9
|
+
|
|
10
|
+
## PROHIBITED
|
|
11
|
+
- Direct SQL file access.
|
|
12
|
+
- Direct dependence on DDL or QuerySpec implementation details.
|
|
13
|
+
|
|
14
|
+
# Mandatory Workflow
|
|
15
|
+
- Application changes MUST run the relevant typecheck and behavioral tests.
|
|
@@ -1,37 +1,28 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Catalog
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- validation and
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- "ztd/"
|
|
30
|
-
- Do not depend on ZTD internals at runtime.
|
|
31
|
-
|
|
32
|
-
## Testing rule (required)
|
|
33
|
-
|
|
34
|
-
Every spec MUST have tests that verify:
|
|
35
|
-
- SQL executes under ZTD rewriting
|
|
36
|
-
- mapping/validation behavior is correct (success and failure)
|
|
37
|
-
- output DTO shape matches expectations
|
|
1
|
+
# Package Scope
|
|
2
|
+
- Applies to `packages/ztd-cli/templates/src/catalog`.
|
|
3
|
+
- Defines runtime catalog contract boundaries between human-owned specs and runtime wiring.
|
|
4
|
+
|
|
5
|
+
# Policy
|
|
6
|
+
## REQUIRED
|
|
7
|
+
- Catalog entrypoints MUST bind SQL assets, parameter contracts, output contracts, and runtime validation/mapping.
|
|
8
|
+
- `src/catalog/specs` MUST be treated as human-owned contracts.
|
|
9
|
+
- `src/catalog/runtime` MUST implement runtime wiring only.
|
|
10
|
+
- Code in `src/catalog` MUST remain independent from `tests`, `tests/generated`, and `ztd` imports.
|
|
11
|
+
- Each spec MUST be covered by tests for rewrite execution, mapping/validation outcomes, and output shape.
|
|
12
|
+
|
|
13
|
+
## ALLOWED
|
|
14
|
+
- Runtime catalog code MAY add observability hooks where contract behavior is unchanged.
|
|
15
|
+
|
|
16
|
+
## PROHIBITED
|
|
17
|
+
- Changing spec params/DTO contracts without explicit instruction.
|
|
18
|
+
- Runtime dependency on ZTD internals.
|
|
19
|
+
|
|
20
|
+
# Mandatory Workflow
|
|
21
|
+
- Catalog spec or runtime changes MUST run tests that exercise affected specs.
|
|
22
|
+
|
|
23
|
+
# Hygiene
|
|
24
|
+
- Preserve clear separation between `specs` and `runtime` responsibilities.
|
|
25
|
+
|
|
26
|
+
# References
|
|
27
|
+
- Specs contract: [./specs/AGENTS.md](./specs/AGENTS.md)
|
|
28
|
+
- Runtime contract: [./runtime/AGENTS.md](./runtime/AGENTS.md)
|
|
@@ -1,75 +1,28 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- outputs (mapped DTO -> validated DTO)
|
|
30
|
-
|
|
31
|
-
Do not rely on TypeScript types alone.
|
|
32
|
-
|
|
33
|
-
## SQL row normalization (important)
|
|
34
|
-
|
|
35
|
-
SQL drivers may return different runtime representations for the same column types.
|
|
36
|
-
Runtime MUST normalize driver-dependent values before validating DTOs.
|
|
37
|
-
|
|
38
|
-
Required normalization rules:
|
|
39
|
-
- Timestamp columns (e.g. timestamptz) may arrive as Date or string.
|
|
40
|
-
- Runtime MUST use `timestampFromDriver` from `@rawsql-ts/sql-contract`.
|
|
41
|
-
- Do NOT re-implement `normalizeTimestamp` locally.
|
|
42
|
-
- Do NOT call `new Date(...)` directly for driver-dependent timestamp normalization.
|
|
43
|
-
- Numeric columns may arrive as number, string, or bigint depending on driver.
|
|
44
|
-
- Normalization rules MUST be explicit per contract and MUST NOT be silent.
|
|
45
|
-
|
|
46
|
-
Never force SQL assets to encode driver-specific behavior.
|
|
47
|
-
|
|
48
|
-
## Mapping rules (required)
|
|
49
|
-
|
|
50
|
-
- Keep SQL assets snake_case and DTO-independent.
|
|
51
|
-
- Mapping occurs in runtime:
|
|
52
|
-
- snake_case row -> DTO-shaped object
|
|
53
|
-
- apply normalization
|
|
54
|
-
- validate via spec-owned validator
|
|
55
|
-
- DTO camelCase aliases in SQL are forbidden.
|
|
56
|
-
|
|
57
|
-
## Entry points (recommended)
|
|
58
|
-
|
|
59
|
-
Prefer these patterns:
|
|
60
|
-
- `ensureXxxParams(value: unknown): XxxParams` (validate inputs)
|
|
61
|
-
- `mapXxxRowToDto(row: XxxSqlRow): XxxDto` (normalize + validate outputs)
|
|
62
|
-
|
|
63
|
-
The `map*` functions MUST always validate before returning.
|
|
64
|
-
|
|
65
|
-
## Error behavior (required)
|
|
66
|
-
|
|
67
|
-
- Validation errors must fail fast with clear messages.
|
|
68
|
-
- Do not swallow validator errors.
|
|
69
|
-
- Do not silently coerce invalid values unless explicitly defined by the contract.
|
|
70
|
-
|
|
71
|
-
## Boundaries
|
|
72
|
-
|
|
73
|
-
- Do not perform database I/O here.
|
|
74
|
-
- Do not import from "tests/" or "tests/generated/".
|
|
75
|
-
- Do not define human-owned contracts here; they live in "src/catalog/specs".
|
|
1
|
+
# Package Scope
|
|
2
|
+
- Applies to `packages/ztd-cli/templates/src/catalog/runtime`.
|
|
3
|
+
- Defines runtime validation, normalization, and row-to-DTO mapping behavior.
|
|
4
|
+
|
|
5
|
+
# Policy
|
|
6
|
+
## REQUIRED
|
|
7
|
+
- Runtime MUST be the only layer that validates unknown input into typed params and validates output contracts.
|
|
8
|
+
- Runtime MUST map snake_case SQL rows into DTO objects using explicit normalization rules.
|
|
9
|
+
- Timestamp normalization MUST use `timestampFromDriver`.
|
|
10
|
+
- Numeric normalization rules MUST be explicit per contract.
|
|
11
|
+
- Runtime helpers (`ensure*`, `map*`) MUST validate before returning values.
|
|
12
|
+
|
|
13
|
+
## ALLOWED
|
|
14
|
+
- Command outputs MAY be scalar identifiers or `void` when the contract output is non-DTO.
|
|
15
|
+
|
|
16
|
+
## PROHIBITED
|
|
17
|
+
- Database I/O in runtime mapping modules.
|
|
18
|
+
- Importing from `tests/` or `tests/generated/`.
|
|
19
|
+
- Defining or editing human-owned contracts in runtime modules.
|
|
20
|
+
|
|
21
|
+
# Mandatory Workflow
|
|
22
|
+
- Runtime changes MUST run tests that cover normalization and validator failure paths.
|
|
23
|
+
|
|
24
|
+
# Hygiene
|
|
25
|
+
- Do not swallow validator errors or silently coerce unsupported values.
|
|
26
|
+
|
|
27
|
+
# References
|
|
28
|
+
- Parent catalog policy: [../AGENTS.md](../AGENTS.md)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Runtime coercions run BEFORE validator schemas.
|
|
2
|
+
// See docs/recipes/mapping-vs-validation.md for pipeline details.
|
|
3
|
+
export function normalizeTimestamp(value: unknown, fieldName?: string): Date {
|
|
4
|
+
const fieldLabel = fieldName?.trim() ? ` for "${fieldName}"` : '';
|
|
5
|
+
|
|
6
|
+
// Preserve valid Date instances while rejecting invalid dates eagerly.
|
|
7
|
+
if (value instanceof Date) {
|
|
8
|
+
if (Number.isNaN(value.getTime())) {
|
|
9
|
+
throw new Error(`Invalid Date value${fieldLabel}.`);
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Parse driver-returned timestamp strings after trimming transport whitespace.
|
|
15
|
+
if (typeof value === 'string') {
|
|
16
|
+
const trimmed = value.trim();
|
|
17
|
+
if (!trimmed) {
|
|
18
|
+
throw new Error(`Expected a non-empty timestamp string${fieldLabel}.`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const timestamp = Date.parse(trimmed);
|
|
22
|
+
if (Number.isNaN(timestamp)) {
|
|
23
|
+
throw new Error(`Invalid timestamp string${fieldLabel}: "${value}".`);
|
|
24
|
+
}
|
|
25
|
+
return new Date(timestamp);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const actualType = value === null ? 'null' : typeof value;
|
|
29
|
+
throw new Error(`Expected Date or timestamp string${fieldLabel}, received ${actualType}.`);
|
|
30
|
+
}
|
|
@@ -1 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
// Runtime coercions run BEFORE validator schemas.
|
|
2
|
+
// See docs/recipes/mapping-vs-validation.md for pipeline details.
|
|
3
|
+
export function normalizeTimestamp(value: unknown, fieldName?: string): Date {
|
|
4
|
+
const fieldLabel = fieldName?.trim() ? ` for "${fieldName}"` : '';
|
|
5
|
+
|
|
6
|
+
// Preserve valid Date instances while rejecting invalid dates eagerly.
|
|
7
|
+
if (value instanceof Date) {
|
|
8
|
+
if (Number.isNaN(value.getTime())) {
|
|
9
|
+
throw new Error(`Invalid Date value${fieldLabel}.`);
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Parse driver-returned timestamp strings after trimming transport whitespace.
|
|
15
|
+
if (typeof value === 'string') {
|
|
16
|
+
const trimmed = value.trim();
|
|
17
|
+
if (!trimmed) {
|
|
18
|
+
throw new Error(`Expected a non-empty timestamp string${fieldLabel}.`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const timestamp = Date.parse(trimmed);
|
|
22
|
+
if (Number.isNaN(timestamp)) {
|
|
23
|
+
throw new Error(`Invalid timestamp string${fieldLabel}: "${value}".`);
|
|
24
|
+
}
|
|
25
|
+
return new Date(timestamp);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const actualType = value === null ? 'null' : typeof value;
|
|
29
|
+
throw new Error(`Expected Date or timestamp string${fieldLabel}, received ${actualType}.`);
|
|
30
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { parseSmokeOutput, type SmokeOutput } from '../specs/_smoke.spec';
|
|
2
|
-
import { normalizeTimestamp } from './_coercions';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Validate runtime output against the catalog smoke invariant.
|
|
6
|
-
*/
|
|
7
|
-
export function ensureSmokeOutput(value: unknown): SmokeOutput {
|
|
8
|
-
// Normalize driver-dependent timestamp representations before contract validation.
|
|
9
|
-
if (isRecord(value) && 'createdAt' in value) {
|
|
10
|
-
return parseSmokeOutput({
|
|
11
|
-
...value,
|
|
12
|
-
createdAt: normalizeTimestamp(value.createdAt, 'createdAt')
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return parseSmokeOutput(value);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
20
|
-
return typeof value === 'object' && value !== null;
|
|
21
|
-
}
|
|
1
|
+
import { parseSmokeOutput, type SmokeOutput } from '../specs/_smoke.spec';
|
|
2
|
+
import { normalizeTimestamp } from './_coercions';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Validate runtime output against the catalog smoke invariant.
|
|
6
|
+
*/
|
|
7
|
+
export function ensureSmokeOutput(value: unknown): SmokeOutput {
|
|
8
|
+
// Normalize driver-dependent timestamp representations before contract validation.
|
|
9
|
+
if (isRecord(value) && 'createdAt' in value) {
|
|
10
|
+
return parseSmokeOutput({
|
|
11
|
+
...value,
|
|
12
|
+
createdAt: normalizeTimestamp(value.createdAt, 'createdAt')
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return parseSmokeOutput(value);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
20
|
+
return typeof value === 'object' && value !== null;
|
|
21
|
+
}
|
|
@@ -1,48 +1,41 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- Specs
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## What does NOT belong here
|
|
44
|
-
|
|
45
|
-
- No executors
|
|
46
|
-
- No database connections
|
|
47
|
-
- No ZTD internals
|
|
48
|
-
- No SQL camelCase aliasing rules (SQL rules live under src/sql)
|
|
1
|
+
# Package Scope
|
|
2
|
+
- Applies to `packages/ztd-cli/templates/src/catalog/specs`.
|
|
3
|
+
- Defines human-owned query/command contracts for params, DTOs, and semantics.
|
|
4
|
+
|
|
5
|
+
# Policy
|
|
6
|
+
## REQUIRED
|
|
7
|
+
- Specs MUST define public input and output validators.
|
|
8
|
+
- Specs MUST preserve declared parameter shape, DTO shape, nullability, cardinality, and semantics.
|
|
9
|
+
- Driver-dependent normalization behavior MUST be specified for runtime handling, not SQL workaround encoding.
|
|
10
|
+
|
|
11
|
+
## ALLOWED
|
|
12
|
+
- Specs MAY acknowledge driver representation variance when runtime normalization is defined.
|
|
13
|
+
|
|
14
|
+
## PROHIBITED
|
|
15
|
+
- Inferring or modifying contract shape without explicit instruction.
|
|
16
|
+
- Adding executors, DB connections, or ZTD internal dependencies.
|
|
17
|
+
|
|
18
|
+
# Mandatory Workflow
|
|
19
|
+
- Contract changes MUST run tests that validate success and failure paths.
|
|
20
|
+
|
|
21
|
+
## Generating initial output types
|
|
22
|
+
|
|
23
|
+
Use `npx ztd model-gen <sql-file> --probe-mode ztd --out src/catalog/specs/<spec-file>.ts` to derive the first QuerySpec scaffold from the local DDL snapshot.
|
|
24
|
+
|
|
25
|
+
- SQL assets are expected to use named parameters (`:name`).
|
|
26
|
+
- `ztd model-gen` is names-first and derives `sqlFile` / `spec id` from the SQL path under `src/sql` by default.
|
|
27
|
+
- `ztd model-gen --probe-mode ztd` is the recommended fast-loop path when the referenced schema already exists in `ztd/ddl/*.sql`.
|
|
28
|
+
- In `--probe-mode ztd`, unqualified table references follow the configured `defaultSchema` / `searchPath` priority from `ztd.config.json`.
|
|
29
|
+
- The CLI default remains `--probe-mode live` for backward compatibility, but project guidance should treat `--probe-mode ztd` as the preferred inner-loop mode.
|
|
30
|
+
- `ztd model-gen --probe-mode ztd` uses the ZTD-owned test database from `ZTD_TEST_DATABASE_URL`.
|
|
31
|
+
- `ztd model-gen --probe-mode live` is an explicit target inspection path and MUST be used with `--url` or a complete `--db-*` flag set.
|
|
32
|
+
- `DATABASE_URL` is a runtime concern and is not read implicitly by `ztd-cli`.
|
|
33
|
+
- Positional placeholders are legacy and should be rewritten whenever possible.
|
|
34
|
+
- Use `--allow-positional` only when a legacy SQL asset cannot be rewritten immediately.
|
|
35
|
+
- Review the generated file before commit: confirm imports, nullability, cardinality, rowMapping key, runtime normalization, and example values.
|
|
36
|
+
|
|
37
|
+
# Hygiene
|
|
38
|
+
- Keep contract definitions isolated from runtime wiring and SQL implementation logic.
|
|
39
|
+
|
|
40
|
+
# References
|
|
41
|
+
- Parent catalog policy: [../AGENTS.md](../AGENTS.md)
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { type } from 'arktype';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Validator invariant contract used to prove runtime validation wiring.
|
|
5
|
-
*
|
|
6
|
-
* This file is intentionally minimal and domain-agnostic.
|
|
7
|
-
*/
|
|
8
|
-
export const smokeOutputSchema = type({
|
|
9
|
-
id: 'number.integer',
|
|
10
|
-
createdAt: 'Date'
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export type SmokeOutput = ReturnType<typeof smokeOutputSchema>;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Parse and validate an unknown runtime payload.
|
|
17
|
-
*/
|
|
18
|
-
export function parseSmokeOutput(value: unknown): SmokeOutput {
|
|
19
|
-
smokeOutputSchema.assert(value);
|
|
20
|
-
return value as SmokeOutput;
|
|
21
|
-
}
|
|
1
|
+
import { type } from 'arktype';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Validator invariant contract used to prove runtime validation wiring.
|
|
5
|
+
*
|
|
6
|
+
* This file is intentionally minimal and domain-agnostic.
|
|
7
|
+
*/
|
|
8
|
+
export const smokeOutputSchema = type({
|
|
9
|
+
id: 'number.integer',
|
|
10
|
+
createdAt: 'Date'
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type SmokeOutput = ReturnType<typeof smokeOutputSchema>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Parse and validate an unknown runtime payload.
|
|
17
|
+
*/
|
|
18
|
+
export function parseSmokeOutput(value: unknown): SmokeOutput {
|
|
19
|
+
smokeOutputSchema.assert(value);
|
|
20
|
+
return value as SmokeOutput;
|
|
21
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Validator invariant contract used to prove runtime validation wiring.
|
|
5
|
-
*
|
|
6
|
-
* This file is intentionally minimal and domain-agnostic.
|
|
7
|
-
*/
|
|
8
|
-
export const smokeOutputSchema = z.object({
|
|
9
|
-
id: z.number().int(),
|
|
10
|
-
createdAt: z.date()
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export type SmokeOutput = z.infer<typeof smokeOutputSchema>;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Parse and validate an unknown runtime payload.
|
|
17
|
-
*/
|
|
18
|
-
export function parseSmokeOutput(value: unknown): SmokeOutput {
|
|
19
|
-
return smokeOutputSchema.parse(value);
|
|
20
|
-
}
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Validator invariant contract used to prove runtime validation wiring.
|
|
5
|
+
*
|
|
6
|
+
* This file is intentionally minimal and domain-agnostic.
|
|
7
|
+
*/
|
|
8
|
+
export const smokeOutputSchema = z.object({
|
|
9
|
+
id: z.number().int(),
|
|
10
|
+
createdAt: z.date()
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export type SmokeOutput = z.infer<typeof smokeOutputSchema>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Parse and validate an unknown runtime payload.
|
|
17
|
+
*/
|
|
18
|
+
export function parseSmokeOutput(value: unknown): SmokeOutput {
|
|
19
|
+
return smokeOutputSchema.parse(value);
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SqlClient } from './sql-client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Adapt a `pg`-style queryable (Client or Pool) into a SqlClient.
|
|
5
|
+
*
|
|
6
|
+
* pg's `query()` returns `QueryResult<T>` with a `.rows` property.
|
|
7
|
+
* This helper unwraps the result so it satisfies the `SqlClient` contract.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* const pool = new Pool({ connectionString: process.env.DATABASE_URL });
|
|
11
|
+
* const client = fromPg(pool);
|
|
12
|
+
* const users = await client.query<{ id: number }>('SELECT id ...', []);
|
|
13
|
+
*/
|
|
14
|
+
export function fromPg(
|
|
15
|
+
queryable: {
|
|
16
|
+
query(text: string, values?: readonly unknown[]): Promise<{ rows: Record<string, unknown>[] }>;
|
|
17
|
+
}
|
|
18
|
+
): SqlClient {
|
|
19
|
+
return {
|
|
20
|
+
query<T extends Record<string, unknown> = Record<string, unknown>>(
|
|
21
|
+
text: string,
|
|
22
|
+
values?: readonly unknown[] | Record<string, unknown>
|
|
23
|
+
): Promise<T[]> {
|
|
24
|
+
if (values != null && !Array.isArray(values)) {
|
|
25
|
+
throw new Error('fromPg adapter does not support named parameter objects; use positional parameter arrays');
|
|
26
|
+
}
|
|
27
|
+
return queryable
|
|
28
|
+
.query(text, values as readonly unknown[])
|
|
29
|
+
.then((result) => result.rows as T[]);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Promise that resolves to the array of rows produced by an SQL query.
|
|
3
|
-
* @template T Shape of each row yielded by the SQL client.
|
|
4
|
-
* @example
|
|
5
|
-
* const rows: SqlQueryRows<{ id: number; name: string }> = client.query('SELECT id, name FROM users');
|
|
6
|
-
*/
|
|
7
|
-
export type SqlQueryRows<T> = Promise<T[]>;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Minimal SQL client interface required by the repository layer.
|
|
11
|
-
*
|
|
12
|
-
* - Production: adapt this interface to your preferred driver (pg, mysql2, etc.) and normalize the results to `T[]`.
|
|
13
|
-
* - Tests: replace the implementation with a mock, a fixture helper, or an adapter that follows this contract.
|
|
14
|
-
*
|
|
15
|
-
* Connection strategy note:
|
|
16
|
-
* - Prefer a shared client per worker process for better performance.
|
|
17
|
-
* - Do not share a live client across parallel workers without proper synchronization.
|
|
18
|
-
*/
|
|
19
|
-
export type SqlClient = {
|
|
20
|
-
query<T extends Record<string, unknown> = Record<string, unknown>>(
|
|
21
|
-
text: string,
|
|
22
|
-
values?: readonly unknown[] | Record<string, unknown>
|
|
23
|
-
): SqlQueryRows<T>;
|
|
24
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Promise that resolves to the array of rows produced by an SQL query.
|
|
3
|
+
* @template T Shape of each row yielded by the SQL client.
|
|
4
|
+
* @example
|
|
5
|
+
* const rows: SqlQueryRows<{ id: number; name: string }> = client.query('SELECT id, name FROM users');
|
|
6
|
+
*/
|
|
7
|
+
export type SqlQueryRows<T> = Promise<T[]>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Minimal SQL client interface required by the repository layer.
|
|
11
|
+
*
|
|
12
|
+
* - Production: adapt this interface to your preferred driver (pg, mysql2, etc.) and normalize the results to `T[]`.
|
|
13
|
+
* - Tests: replace the implementation with a mock, a fixture helper, or an adapter that follows this contract.
|
|
14
|
+
*
|
|
15
|
+
* Connection strategy note:
|
|
16
|
+
* - Prefer a shared client per worker process for better performance.
|
|
17
|
+
* - Do not share a live client across parallel workers without proper synchronization.
|
|
18
|
+
*/
|
|
19
|
+
export type SqlClient = {
|
|
20
|
+
query<T extends Record<string, unknown> = Record<string, unknown>>(
|
|
21
|
+
text: string,
|
|
22
|
+
values?: readonly unknown[] | Record<string, unknown>
|
|
23
|
+
): SqlQueryRows<T>;
|
|
24
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Package Scope
|
|
2
|
+
- Applies to `packages/ztd-cli/templates/src/domain`.
|
|
3
|
+
- Defines the domain layer for WebAPI-oriented scaffolds.
|
|
4
|
+
|
|
5
|
+
# Policy
|
|
6
|
+
## REQUIRED
|
|
7
|
+
- Domain code MUST remain independent from SQL, DDL, QuerySpecs, and generated test artifacts.
|
|
8
|
+
- Domain modules MUST express business rules in transport-agnostic types.
|
|
9
|
+
|
|
10
|
+
## PROHIBITED
|
|
11
|
+
- Importing `src/sql`, `src/catalog`, `ztd`, or telemetry scaffolds into domain code.
|
|
12
|
+
- Encoding HTTP or persistence concerns in domain rules.
|
|
13
|
+
|
|
14
|
+
# Mandatory Workflow
|
|
15
|
+
- Domain changes MUST run the relevant typecheck and unit tests.
|