@pattern-stack/codegen 0.10.1 → 0.11.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 +62 -0
- package/README.md +5 -5
- package/consumer-skills/codegen/SKILL.md +2 -2
- package/consumer-skills/{sync → integration}/SKILL.md +29 -29
- package/consumer-skills/{sync → integration}/audit-and-detection.md +22 -22
- package/consumer-skills/{sync → integration}/change-sources-and-sinks.md +60 -60
- package/consumer-skills/subsystems/SKILL.md +8 -8
- package/consumer-skills/subsystems/wiring-and-order.md +7 -7
- package/dist/runtime/base-classes/index.d.ts +4 -4
- package/dist/runtime/base-classes/index.js +35 -35
- package/dist/runtime/base-classes/index.js.map +1 -1
- package/dist/runtime/base-classes/{synced-entity-repository.d.ts → integrated-entity-repository.d.ts} +15 -15
- package/dist/runtime/base-classes/{synced-entity-repository.js → integrated-entity-repository.js} +21 -21
- package/dist/runtime/base-classes/integrated-entity-repository.js.map +1 -0
- package/dist/runtime/base-classes/{synced-entity-service.d.ts → integrated-entity-service.d.ts} +6 -6
- package/dist/runtime/base-classes/{synced-entity-service.js → integrated-entity-service.js} +4 -4
- package/dist/runtime/base-classes/integrated-entity-service.js.map +1 -0
- package/dist/runtime/base-classes/{sync-upsert-config.d.ts → integration-upsert-config.d.ts} +13 -13
- package/dist/runtime/base-classes/integration-upsert-config.js +1 -0
- package/dist/runtime/base-classes/{junction-sync-repository.d.ts → junction-integration-repository.d.ts} +11 -11
- package/dist/runtime/base-classes/{junction-sync-repository.js → junction-integration-repository.js} +15 -15
- package/dist/runtime/base-classes/junction-integration-repository.js.map +1 -0
- package/dist/runtime/subsystems/auth/auth-oauth-state.schema.js.map +1 -1
- package/dist/runtime/subsystems/auth/auth.module.d.ts +4 -4
- package/dist/runtime/subsystems/auth/auth.module.js +3 -3
- package/dist/runtime/subsystems/auth/auth.module.js.map +1 -1
- package/dist/runtime/subsystems/auth/auth.tokens.d.ts +8 -8
- package/dist/runtime/subsystems/auth/auth.tokens.js +6 -6
- package/dist/runtime/subsystems/auth/auth.tokens.js.map +1 -1
- package/dist/runtime/subsystems/auth/backends/state-store.drizzle-backend.js.map +1 -1
- package/dist/runtime/subsystems/auth/controllers/auth.controller.d.ts +2 -2
- package/dist/runtime/subsystems/auth/controllers/auth.controller.js +3 -3
- package/dist/runtime/subsystems/auth/controllers/auth.controller.js.map +1 -1
- package/dist/runtime/subsystems/auth/index.d.ts +3 -3
- package/dist/runtime/subsystems/auth/index.js +40 -40
- package/dist/runtime/subsystems/auth/index.js.map +1 -1
- package/dist/runtime/subsystems/auth/middleware/requester-context.js.map +1 -1
- package/dist/runtime/subsystems/auth/protocols/auth-strategy.d.ts +3 -3
- package/dist/runtime/subsystems/auth/protocols/{integration-store.d.ts → connection-store.d.ts} +20 -20
- package/dist/runtime/subsystems/auth/protocols/connection-store.js +1 -0
- package/dist/runtime/subsystems/auth/protocols/provider-strategy.d.ts +3 -3
- package/dist/runtime/subsystems/auth/runtime/{integration-broken.error.d.ts → connection-broken.error.d.ts} +5 -5
- package/dist/runtime/subsystems/auth/runtime/connection-broken.error.js +19 -0
- package/dist/runtime/subsystems/auth/runtime/connection-broken.error.js.map +1 -0
- package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.d.ts +10 -10
- package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.js +28 -28
- package/dist/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.js.map +1 -1
- package/dist/runtime/subsystems/auth/runtime/with-auth-retry.d.ts +1 -1
- package/dist/runtime/subsystems/auth/runtime/with-auth-retry.js +3 -3
- package/dist/runtime/subsystems/auth/runtime/with-auth-retry.js.map +1 -1
- package/dist/runtime/subsystems/index.d.ts +7 -7
- package/dist/runtime/subsystems/index.js +51 -51
- package/dist/runtime/subsystems/index.js.map +1 -1
- package/dist/runtime/subsystems/{sync → integration}/build-change-source.d.ts +3 -3
- package/dist/runtime/subsystems/{sync → integration}/build-change-source.js +3 -3
- package/dist/runtime/subsystems/integration/build-change-source.js.map +1 -0
- package/dist/runtime/subsystems/{sync → integration}/deep-equal.differ.d.ts +2 -2
- package/dist/runtime/subsystems/{sync → integration}/deep-equal.differ.js +1 -1
- package/dist/runtime/subsystems/integration/deep-equal.differ.js.map +1 -0
- package/dist/runtime/subsystems/{sync → integration}/detection-config.schema.d.ts +3 -3
- package/dist/runtime/subsystems/{sync → integration}/detection-config.schema.js +1 -1
- package/dist/runtime/subsystems/integration/detection-config.schema.js.map +1 -0
- package/dist/runtime/subsystems/{sync/execute-sync.use-case.d.ts → integration/execute-integration.use-case.d.ts} +13 -13
- package/dist/runtime/subsystems/{sync/execute-sync.use-case.js → integration/execute-integration.use-case.js} +30 -30
- package/dist/runtime/subsystems/integration/execute-integration.use-case.js.map +1 -0
- package/dist/runtime/subsystems/integration/index.d.ts +28 -0
- package/dist/runtime/subsystems/{sync → integration}/index.js +171 -171
- package/dist/runtime/subsystems/integration/index.js.map +1 -0
- package/dist/runtime/subsystems/{sync/sync-audit.schema.d.ts → integration/integration-audit.schema.d.ts} +64 -64
- package/dist/runtime/subsystems/{sync/sync-audit.schema.js → integration/integration-audit.schema.js} +47 -47
- package/dist/runtime/subsystems/integration/integration-audit.schema.js.map +1 -0
- package/dist/runtime/subsystems/{sync/sync-change-source.protocol.d.ts → integration/integration-change-source.protocol.d.ts} +10 -10
- package/dist/runtime/subsystems/integration/integration-change-source.protocol.js +1 -0
- package/dist/runtime/subsystems/{sync/sync-cursor-store.drizzle-backend.d.ts → integration/integration-cursor-store.drizzle-backend.d.ts} +1 -1
- package/dist/runtime/subsystems/{sync/sync-cursor-store.drizzle-backend.js → integration/integration-cursor-store.drizzle-backend.js} +65 -65
- package/dist/runtime/subsystems/integration/integration-cursor-store.drizzle-backend.js.map +1 -0
- package/dist/runtime/subsystems/{sync/sync-cursor-store.memory-backend.d.ts → integration/integration-cursor-store.memory-backend.d.ts} +6 -6
- package/dist/runtime/subsystems/{sync/sync-cursor-store.memory-backend.js → integration/integration-cursor-store.memory-backend.js} +5 -5
- package/dist/runtime/subsystems/integration/integration-cursor-store.memory-backend.js.map +1 -0
- package/dist/runtime/subsystems/{sync/sync-cursor-store.protocol.d.ts → integration/integration-cursor-store.protocol.d.ts} +13 -13
- package/dist/runtime/subsystems/integration/integration-cursor-store.protocol.js +1 -0
- package/dist/runtime/subsystems/{sync/sync-errors.d.ts → integration/integration-errors.d.ts} +2 -2
- package/dist/runtime/subsystems/{sync/sync-errors.js → integration/integration-errors.js} +3 -3
- package/dist/runtime/subsystems/integration/integration-errors.js.map +1 -0
- package/dist/runtime/subsystems/{sync/sync-field-diff.protocol.d.ts → integration/integration-field-diff.protocol.d.ts} +2 -2
- package/dist/runtime/subsystems/{sync/sync-field-diff.protocol.js → integration/integration-field-diff.protocol.js} +2 -2
- package/dist/runtime/subsystems/integration/integration-field-diff.protocol.js.map +1 -0
- package/dist/runtime/subsystems/{sync/sync-loopback.protocol.d.ts → integration/integration-loopback.protocol.d.ts} +2 -2
- package/dist/runtime/subsystems/integration/integration-loopback.protocol.js +1 -0
- package/dist/runtime/subsystems/{sync/sync-middleware.protocol.d.ts → integration/integration-middleware.protocol.d.ts} +5 -5
- package/dist/runtime/subsystems/integration/integration-middleware.protocol.js +1 -0
- package/dist/runtime/subsystems/{sync/sync-run-recorder.drizzle-backend.d.ts → integration/integration-run-recorder.drizzle-backend.d.ts} +5 -5
- package/dist/runtime/subsystems/{sync/sync-run-recorder.drizzle-backend.js → integration/integration-run-recorder.drizzle-backend.js} +73 -73
- package/dist/runtime/subsystems/integration/integration-run-recorder.drizzle-backend.js.map +1 -0
- package/dist/runtime/subsystems/{sync/sync-run-recorder.memory-backend.d.ts → integration/integration-run-recorder.memory-backend.d.ts} +15 -15
- package/dist/runtime/subsystems/{sync/sync-run-recorder.memory-backend.js → integration/integration-run-recorder.memory-backend.js} +11 -11
- package/dist/runtime/subsystems/integration/integration-run-recorder.memory-backend.js.map +1 -0
- package/dist/runtime/subsystems/{sync/sync-run-recorder.protocol.d.ts → integration/integration-run-recorder.protocol.d.ts} +25 -25
- package/dist/runtime/subsystems/integration/integration-run-recorder.protocol.js +1 -0
- package/dist/runtime/subsystems/{sync/sync-sink.protocol.d.ts → integration/integration-sink.protocol.d.ts} +5 -5
- package/dist/runtime/subsystems/integration/integration-sink.protocol.js +1 -0
- package/dist/runtime/subsystems/{sync/sync.module.d.ts → integration/integration.module.d.ts} +24 -24
- package/dist/runtime/subsystems/{sync/sync.module.js → integration/integration.module.js} +132 -132
- package/dist/runtime/subsystems/integration/integration.module.js.map +1 -0
- package/dist/runtime/subsystems/integration/integration.tokens.d.ts +47 -0
- package/dist/runtime/subsystems/integration/integration.tokens.js +18 -0
- package/dist/runtime/subsystems/integration/integration.tokens.js.map +1 -0
- package/dist/runtime/subsystems/{sync → integration}/loopback.middleware.d.ts +5 -5
- package/dist/runtime/subsystems/{sync → integration}/loopback.middleware.js +1 -1
- package/dist/runtime/subsystems/integration/loopback.middleware.js.map +1 -0
- package/dist/runtime/subsystems/{sync → integration}/poll-change-source.d.ts +5 -5
- package/dist/runtime/subsystems/{sync → integration}/poll-change-source.js +1 -1
- package/dist/runtime/subsystems/integration/poll-change-source.js.map +1 -0
- package/dist/runtime/subsystems/{sync → integration}/webhook-change-source.d.ts +5 -5
- package/dist/runtime/subsystems/{sync → integration}/webhook-change-source.js +1 -1
- package/dist/runtime/subsystems/integration/webhook-change-source.js.map +1 -0
- package/dist/runtime/subsystems/jobs/job-worker.module.d.ts +1 -1
- package/dist/runtime/subsystems/observability/index.d.ts +4 -4
- package/dist/runtime/subsystems/observability/index.js +11 -11
- package/dist/runtime/subsystems/observability/index.js.map +1 -1
- package/dist/runtime/subsystems/observability/observability.module.d.ts +2 -2
- package/dist/runtime/subsystems/observability/observability.module.js +11 -11
- package/dist/runtime/subsystems/observability/observability.module.js.map +1 -1
- package/dist/runtime/subsystems/observability/observability.protocol.d.ts +11 -11
- package/dist/runtime/subsystems/observability/observability.service.d.ts +6 -6
- package/dist/runtime/subsystems/observability/observability.service.js +11 -11
- package/dist/runtime/subsystems/observability/observability.service.js.map +1 -1
- package/dist/runtime/subsystems/observability/observability.tokens.d.ts +1 -1
- package/dist/runtime/subsystems/observability/observability.tokens.js.map +1 -1
- package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.d.ts +3 -3
- package/dist/runtime/subsystems/observability/reporters/bridge-metrics.reporter.js.map +1 -1
- package/dist/runtime/subsystems/observability/reporters/index.d.ts +3 -3
- package/dist/runtime/subsystems/observability/reporters/index.js.map +1 -1
- package/dist/src/cli/index.js +262 -269
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/index.d.ts +22 -22
- package/dist/src/index.js +191 -191
- package/dist/src/index.js.map +1 -1
- package/examples/auth-integrations/README.md +32 -32
- package/examples/auth-integrations/definitions/entities/{integration.yaml → connection.yaml} +10 -10
- package/examples/auth-integrations/runtime/{integrations/adapters/integration-grant-sink.adapter.ts → connections/adapters/connection-grant-sink.adapter.ts} +7 -7
- package/examples/auth-integrations/runtime/{integrations/adapters/integration-reader.adapter.ts → connections/adapters/connection-reader.adapter.ts} +10 -10
- package/examples/auth-integrations/runtime/{integrations/adapters/integration-token-writer.adapter.ts → connections/adapters/connection-token-writer.adapter.ts} +11 -11
- package/examples/auth-integrations/runtime/connections/connections-auth.module.ts +81 -0
- package/examples/auth-integrations/runtime/{integrations/facade/integrations.service.ts → connections/facade/connections.service.ts} +35 -35
- package/examples/auth-integrations/runtime/{integrations → connections}/oauth/use-cases/create-or-update-from-oauth-grant.use-case.ts +11 -11
- package/examples/auth-integrations/runtime/{integrations/oauth/use-cases/disconnect-integration.use-case.ts → connections/oauth/use-cases/disconnect-connection.use-case.ts} +6 -6
- package/examples/auth-integrations/runtime/connections/oauth/use-cases/list-user-connections.use-case.ts +21 -0
- package/examples/auth-integrations/runtime/connections/oauth/use-cases/mark-connection-requires-reauth.use-case.ts +21 -0
- package/package.json +1 -1
- package/runtime/base-classes/index.ts +8 -8
- package/runtime/base-classes/{synced-entity-repository.ts → integrated-entity-repository.ts} +36 -36
- package/runtime/base-classes/{synced-entity-service.ts → integrated-entity-service.ts} +6 -6
- package/runtime/base-classes/{sync-upsert-config.ts → integration-upsert-config.ts} +12 -12
- package/runtime/base-classes/{junction-sync-repository.ts → junction-integration-repository.ts} +28 -28
- package/runtime/subsystems/auth/auth-oauth-state.schema.ts +1 -1
- package/runtime/subsystems/auth/auth.module.ts +4 -4
- package/runtime/subsystems/auth/auth.tokens.ts +7 -7
- package/runtime/subsystems/auth/controllers/auth.controller.ts +7 -7
- package/runtime/subsystems/auth/index.ts +19 -19
- package/runtime/subsystems/auth/protocols/auth-strategy.ts +3 -3
- package/runtime/subsystems/auth/protocols/{integration-store.ts → connection-store.ts} +19 -19
- package/runtime/subsystems/auth/protocols/provider-strategy.ts +2 -2
- package/runtime/subsystems/auth/runtime/{integration-broken.error.ts → connection-broken.error.ts} +5 -5
- package/runtime/subsystems/auth/runtime/oauth2-refresh.strategy.ts +35 -35
- package/runtime/subsystems/auth/runtime/with-auth-retry.ts +3 -3
- package/runtime/subsystems/index.ts +11 -11
- package/runtime/subsystems/{sync → integration}/build-change-source.ts +3 -3
- package/runtime/subsystems/{sync → integration}/deep-equal.differ.ts +7 -7
- package/runtime/subsystems/{sync → integration}/detection-config.schema.ts +3 -3
- package/runtime/subsystems/{sync/execute-sync.use-case.ts → integration/execute-integration.use-case.ts} +40 -40
- package/runtime/subsystems/{sync → integration}/index.ts +47 -47
- package/runtime/subsystems/{sync/sync-audit.schema.ts → integration/integration-audit.schema.ts} +61 -61
- package/runtime/subsystems/{sync/sync-change-source.protocol.ts → integration/integration-change-source.protocol.ts} +9 -9
- package/runtime/subsystems/{sync/sync-cursor-store.drizzle-backend.ts → integration/integration-cursor-store.drizzle-backend.ts} +30 -30
- package/runtime/subsystems/{sync/sync-cursor-store.memory-backend.ts → integration/integration-cursor-store.memory-backend.ts} +9 -9
- package/runtime/subsystems/{sync/sync-cursor-store.protocol.ts → integration/integration-cursor-store.protocol.ts} +13 -13
- package/runtime/subsystems/{sync/sync-errors.ts → integration/integration-errors.ts} +3 -3
- package/runtime/subsystems/{sync/sync-field-diff.protocol.ts → integration/integration-field-diff.protocol.ts} +2 -2
- package/runtime/subsystems/{sync/sync-loopback.protocol.ts → integration/integration-loopback.protocol.ts} +2 -2
- package/runtime/subsystems/{sync/sync-middleware.protocol.ts → integration/integration-middleware.protocol.ts} +6 -6
- package/runtime/subsystems/{sync/sync-run-recorder.drizzle-backend.ts → integration/integration-run-recorder.drizzle-backend.ts} +39 -39
- package/runtime/subsystems/{sync/sync-run-recorder.memory-backend.ts → integration/integration-run-recorder.memory-backend.ts} +23 -23
- package/runtime/subsystems/{sync/sync-run-recorder.protocol.ts → integration/integration-run-recorder.protocol.ts} +25 -25
- package/runtime/subsystems/{sync/sync-sink.protocol.ts → integration/integration-sink.protocol.ts} +4 -4
- package/runtime/subsystems/{sync/sync.module.ts → integration/integration.module.ts} +48 -48
- package/runtime/subsystems/integration/integration.tokens.ts +49 -0
- package/runtime/subsystems/{sync → integration}/loopback.middleware.ts +5 -5
- package/runtime/subsystems/{sync → integration}/poll-change-source.ts +7 -7
- package/runtime/subsystems/{sync → integration}/webhook-change-source.ts +7 -7
- package/runtime/subsystems/observability/index.ts +1 -1
- package/runtime/subsystems/observability/observability.module.ts +2 -2
- package/runtime/subsystems/observability/observability.protocol.ts +11 -11
- package/runtime/subsystems/observability/observability.service.ts +13 -13
- package/runtime/subsystems/observability/observability.tokens.ts +1 -1
- package/src/patterns/library/index.ts +4 -4
- package/src/patterns/library/{synced.pattern.ts → integrated.pattern.ts} +12 -12
- package/src/patterns/library/junction.pattern.ts +1 -1
- package/src/patterns/pattern-definition.ts +3 -3
- package/templates/entity/new/backend/modules/core/{sync-source.ejs.t → integration-source.ejs.t} +6 -6
- package/templates/entity/new/backend/modules/core/{sync-source.providers.ejs.t → integration-source.providers.ejs.t} +2 -2
- package/templates/entity/new/clean-lite-ps/entity.ejs.t +1 -1
- package/templates/entity/new/clean-lite-ps/module.ejs.t +1 -1
- package/templates/entity/new/clean-lite-ps/prompt-extension.js +33 -33
- package/templates/entity/new/clean-lite-ps/repository.ejs.t +27 -27
- package/templates/entity/new/frontend/collections/collection.ejs.t +26 -1
- package/templates/entity/new/frontend/collections/collections-base.ejs.t +11 -0
- package/templates/entity/new/frontend/entity/combined.ejs.t +31 -1
- package/templates/entity/new/prompt.js +27 -15
- package/templates/junction/new/entity.ejs.t +1 -1
- package/templates/junction/new/prompt.js +24 -24
- package/templates/junction/new/repository.ejs.t +19 -19
- package/templates/subsystem/auth/auth-oauth-state.schema.ejs.t +2 -2
- package/templates/subsystem/auth-config/prompt.js +1 -1
- package/templates/subsystem/auth-integrations/app-module-hook.ejs.t +5 -5
- package/templates/subsystem/bridge/prompt.js +1 -1
- package/templates/subsystem/integration/integration-audit.schema.ejs.t +192 -0
- package/templates/subsystem/{sync → integration}/prompt.js +12 -12
- package/templates/subsystem/{sync-config/codegen-config-sync-block.ejs.t → integration-config/codegen-config-integration-block.ejs.t} +7 -7
- package/templates/subsystem/integration-config/prompt.js +22 -0
- package/templates/subsystem/jobs/worker.ejs.t +2 -2
- package/templates/subsystem/observability/main-hook.ejs.t +1 -1
- package/templates/subsystem/observability/prompt.js +1 -1
- package/templates/subsystem/openapi-config/prompt.js +1 -1
- package/dist/runtime/base-classes/junction-sync-repository.js.map +0 -1
- package/dist/runtime/base-classes/sync-upsert-config.js +0 -1
- package/dist/runtime/base-classes/synced-entity-repository.js.map +0 -1
- package/dist/runtime/base-classes/synced-entity-service.js.map +0 -1
- package/dist/runtime/subsystems/auth/protocols/integration-store.js +0 -1
- package/dist/runtime/subsystems/auth/runtime/integration-broken.error.js +0 -19
- package/dist/runtime/subsystems/auth/runtime/integration-broken.error.js.map +0 -1
- package/dist/runtime/subsystems/sync/build-change-source.js.map +0 -1
- package/dist/runtime/subsystems/sync/deep-equal.differ.js.map +0 -1
- package/dist/runtime/subsystems/sync/detection-config.schema.js.map +0 -1
- package/dist/runtime/subsystems/sync/execute-sync.use-case.js.map +0 -1
- package/dist/runtime/subsystems/sync/index.d.ts +0 -28
- package/dist/runtime/subsystems/sync/index.js.map +0 -1
- package/dist/runtime/subsystems/sync/loopback.middleware.js.map +0 -1
- package/dist/runtime/subsystems/sync/poll-change-source.js.map +0 -1
- package/dist/runtime/subsystems/sync/sync-audit.schema.js.map +0 -1
- package/dist/runtime/subsystems/sync/sync-change-source.protocol.js +0 -1
- package/dist/runtime/subsystems/sync/sync-cursor-store.drizzle-backend.js.map +0 -1
- package/dist/runtime/subsystems/sync/sync-cursor-store.memory-backend.js.map +0 -1
- package/dist/runtime/subsystems/sync/sync-cursor-store.protocol.js +0 -1
- package/dist/runtime/subsystems/sync/sync-errors.js.map +0 -1
- package/dist/runtime/subsystems/sync/sync-field-diff.protocol.js.map +0 -1
- package/dist/runtime/subsystems/sync/sync-loopback.protocol.js +0 -1
- package/dist/runtime/subsystems/sync/sync-middleware.protocol.js +0 -1
- package/dist/runtime/subsystems/sync/sync-run-recorder.drizzle-backend.js.map +0 -1
- package/dist/runtime/subsystems/sync/sync-run-recorder.memory-backend.js.map +0 -1
- package/dist/runtime/subsystems/sync/sync-run-recorder.protocol.js +0 -1
- package/dist/runtime/subsystems/sync/sync-sink.protocol.js +0 -1
- package/dist/runtime/subsystems/sync/sync.module.js.map +0 -1
- package/dist/runtime/subsystems/sync/sync.tokens.d.ts +0 -47
- package/dist/runtime/subsystems/sync/sync.tokens.js +0 -18
- package/dist/runtime/subsystems/sync/sync.tokens.js.map +0 -1
- package/dist/runtime/subsystems/sync/webhook-change-source.js.map +0 -1
- package/examples/auth-integrations/runtime/integrations/integrations-auth.module.ts +0 -81
- package/examples/auth-integrations/runtime/integrations/oauth/use-cases/list-user-integrations.use-case.ts +0 -21
- package/examples/auth-integrations/runtime/integrations/oauth/use-cases/mark-integration-requires-reauth.use-case.ts +0 -21
- package/runtime/subsystems/sync/sync.tokens.ts +0 -49
- package/templates/subsystem/sync/sync-audit.schema.ejs.t +0 -192
- package/templates/subsystem/sync-config/prompt.js +0 -22
- /package/dist/runtime/base-classes/{sync-upsert-config.js.map → integration-upsert-config.js.map} +0 -0
- /package/dist/runtime/subsystems/auth/protocols/{integration-store.js.map → connection-store.js.map} +0 -0
- /package/dist/runtime/subsystems/{sync/sync-change-source.protocol.js.map → integration/integration-change-source.protocol.js.map} +0 -0
- /package/dist/runtime/subsystems/{sync/sync-cursor-store.protocol.js.map → integration/integration-cursor-store.protocol.js.map} +0 -0
- /package/dist/runtime/subsystems/{sync/sync-loopback.protocol.js.map → integration/integration-loopback.protocol.js.map} +0 -0
- /package/dist/runtime/subsystems/{sync/sync-middleware.protocol.js.map → integration/integration-middleware.protocol.js.map} +0 -0
- /package/dist/runtime/subsystems/{sync/sync-run-recorder.protocol.js.map → integration/integration-run-recorder.protocol.js.map} +0 -0
- /package/dist/runtime/subsystems/{sync/sync-sink.protocol.js.map → integration/integration-sink.protocol.js.map} +0 -0
|
@@ -12,7 +12,32 @@ const hasApiBaseUrl = !!frontend.sync.apiBaseUrlImport;
|
|
|
12
12
|
const shapeUrlExpr = hasApiBaseUrl
|
|
13
13
|
? '`${API_BASE_URL}/' + plural + '`'
|
|
14
14
|
: '`' + frontend.sync.shapeUrl + '/' + plural + '`';
|
|
15
|
+
// REST list endpoint for 'api' sync mode
|
|
16
|
+
const apiUrlExpr = hasApiBaseUrl
|
|
17
|
+
? '`${API_BASE_URL}/' + plural + '`'
|
|
18
|
+
: '`' + frontend.sync.apiUrl + '/' + plural + '`';
|
|
19
|
+
const schemaPrefix = frontend.collections?.schemaPrefix ?? 'schema.';
|
|
15
20
|
-%>
|
|
21
|
+
<% if (frontend.sync.mode === 'api') { -%>
|
|
22
|
+
export const <%= camelName %>Collection = createCollection(
|
|
23
|
+
queryCollectionOptions({
|
|
24
|
+
id: '<%= plural %>',
|
|
25
|
+
queryKey: ['<%= plural %>'],
|
|
26
|
+
queryClient,
|
|
27
|
+
queryFn: async () => {
|
|
28
|
+
const res = await fetch(<%- apiUrlExpr %><% if (frontend.auth.function) { %>, {
|
|
29
|
+
headers: { Authorization: <%= frontend.auth.function %>() },
|
|
30
|
+
}<% } %>);
|
|
31
|
+
if (!res.ok) {
|
|
32
|
+
throw new Error(`GET <%= plural %> → ${res.status} ${res.statusText}`);
|
|
33
|
+
}
|
|
34
|
+
return res.json();
|
|
35
|
+
},
|
|
36
|
+
getKey: (item) => item.id,
|
|
37
|
+
schema: <%= schemaPrefix %><%= camelName %>Schema,
|
|
38
|
+
}),
|
|
39
|
+
);
|
|
40
|
+
<% } else { -%>
|
|
16
41
|
export const <%= camelName %>Collection = createCollection(
|
|
17
42
|
electricCollectionOptions({
|
|
18
43
|
id: '<%= plural %>',
|
|
@@ -53,9 +78,9 @@ export const <%= camelName %>Collection = createCollection(
|
|
|
53
78
|
<% } -%>
|
|
54
79
|
<% } -%>
|
|
55
80
|
},
|
|
56
|
-
<% const schemaPrefix = frontend.collections?.schemaPrefix ?? 'schema.'; -%>
|
|
57
81
|
schema: <%= schemaPrefix %><%= camelName %>Schema,
|
|
58
82
|
getKey: (item) => item.id,
|
|
59
83
|
}),
|
|
60
84
|
);
|
|
61
85
|
<% } -%>
|
|
86
|
+
<% } -%>
|
|
@@ -3,6 +3,16 @@ to: <%= locations.frontendCollections.path %>/collections.ts
|
|
|
3
3
|
skip_if: <%= !frontendEnabled %>
|
|
4
4
|
force: false
|
|
5
5
|
---
|
|
6
|
+
<% if (frontend.sync.mode === 'api') { -%>
|
|
7
|
+
/**
|
|
8
|
+
* REST-backed Collections (TanStack Query)
|
|
9
|
+
* Generated by entity codegen - do not edit directly
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { queryCollectionOptions } from '@tanstack/query-db-collection';
|
|
13
|
+
import { createCollection } from '@tanstack/react-db';
|
|
14
|
+
import { queryClient } from '<%= frontend.sync.queryClientImport ?? './query-client' %>';
|
|
15
|
+
<% } else { -%>
|
|
6
16
|
/**
|
|
7
17
|
* Electric SQL Collections
|
|
8
18
|
* Generated by entity codegen - do not edit directly
|
|
@@ -13,6 +23,7 @@ import { createCollection } from '@tanstack/react-db';
|
|
|
13
23
|
<% if (frontend.sync.columnMapper) { -%>
|
|
14
24
|
import { <%= frontend.sync.columnMapper %> } from '@electric-sql/client';
|
|
15
25
|
<% } -%>
|
|
26
|
+
<% } -%>
|
|
16
27
|
<% if (frontend.auth.function) { -%>
|
|
17
28
|
import { <%= frontend.auth.function %> } from '<%= locations.frontendCollectionsAuth.import %>';
|
|
18
29
|
<% } -%>
|
|
@@ -31,14 +31,19 @@ const returnKeySingular = generate.hookReturnStyle === 'named' ? camelName : 'da
|
|
|
31
31
|
<% if (generate.mutations && (exposeTrpc || exposeRepository)) { -%>
|
|
32
32
|
import { useState, useCallback } from 'react';
|
|
33
33
|
<% } -%>
|
|
34
|
-
<% if (frontend.sync.columnMapper) { -%>
|
|
34
|
+
<% if (frontend.sync.mode !== 'api' && frontend.sync.columnMapper) { -%>
|
|
35
35
|
import { <%= frontend.sync.columnMapper %> } from '@electric-sql/client';
|
|
36
36
|
<% } -%>
|
|
37
37
|
import { <%= camelName %>Schema, type <%= importedTypeName %> } from '<%= locations.dbEntities.import %><% if (!locations.dbEntities.barrelExport) { %>/<%= name %><% } %>';
|
|
38
38
|
<% if (exposeTrpc) { -%>
|
|
39
39
|
import { trpc } from '<%= locations.trpcClient.import %>';
|
|
40
40
|
<% } -%>
|
|
41
|
+
<% if (frontend.sync.mode === 'api') { -%>
|
|
42
|
+
import { queryCollectionOptions } from '@tanstack/query-db-collection';
|
|
43
|
+
import { queryClient } from '<%= frontend.sync.queryClientImport ?? './query-client' %>';
|
|
44
|
+
<% } else { -%>
|
|
41
45
|
import { electricCollectionOptions } from '@tanstack/electric-db-collection';
|
|
46
|
+
<% } -%>
|
|
42
47
|
import { createCollection<% if (generate.hookStyle === 'useLiveQuery') { %>, useLiveQuery, eq<% } %> } from '@tanstack/react-db';
|
|
43
48
|
<% if (generate.fieldMetadata) { -%>
|
|
44
49
|
import type { FieldMeta, FieldType, FieldImportance } from '<%= locations.frontendFieldMetaTypes.import %>/field-meta';
|
|
@@ -118,7 +123,31 @@ export type <%= className %>Resolved = <%= className %>;
|
|
|
118
123
|
// Without this filter, soft-deleted records will reappear after Electric sync.
|
|
119
124
|
<% } -%>
|
|
120
125
|
|
|
126
|
+
<%
|
|
127
|
+
// REST list endpoint for 'api' sync mode
|
|
128
|
+
const hasApiBaseUrl = !!frontend.sync.apiBaseUrlImport;
|
|
129
|
+
const apiUrlExpr = hasApiBaseUrl
|
|
130
|
+
? '`${API_BASE_URL}/' + plural + '`'
|
|
131
|
+
: '`' + frontend.sync.apiUrl + '/' + plural + '`';
|
|
132
|
+
-%>
|
|
121
133
|
export const <%= collectionVar %> = createCollection(
|
|
134
|
+
<% if (frontend.sync.mode === 'api') { -%>
|
|
135
|
+
queryCollectionOptions({
|
|
136
|
+
id: '<%= plural %>',
|
|
137
|
+
queryKey: ['<%= plural %>'],
|
|
138
|
+
queryClient,
|
|
139
|
+
queryFn: async () => {
|
|
140
|
+
const res = await fetch(<%- apiUrlExpr %><% if (frontend.auth.function) { %>, {
|
|
141
|
+
headers: { Authorization: <%= frontend.auth.function %>() },
|
|
142
|
+
}<% } %>);
|
|
143
|
+
if (!res.ok) {
|
|
144
|
+
throw new Error(`GET <%= plural %> → ${res.status} ${res.statusText}`);
|
|
145
|
+
}
|
|
146
|
+
return res.json();
|
|
147
|
+
},
|
|
148
|
+
getKey: (item) => item.id,
|
|
149
|
+
schema: <%= camelName %>Schema,
|
|
150
|
+
<% } else { -%>
|
|
122
151
|
electricCollectionOptions({
|
|
123
152
|
id: '<%= plural %>',
|
|
124
153
|
shapeOptions: {
|
|
@@ -168,6 +197,7 @@ export const <%= collectionVar %> = createCollection(
|
|
|
168
197
|
},
|
|
169
198
|
schema: <%= camelName %>Schema,
|
|
170
199
|
getKey: (item) => item.id,
|
|
200
|
+
<% } -%>
|
|
171
201
|
<% if (generate.mutations && (exposeTrpc || exposeRepository)) { -%>
|
|
172
202
|
<% if (exposeTrpc) { -%>
|
|
173
203
|
onInsert: async ({ transaction }) => {
|
|
@@ -305,7 +305,7 @@ export default {
|
|
|
305
305
|
|
|
306
306
|
// v2 blocks (optional — absent in v1 entities)
|
|
307
307
|
const queriesBlock = definition.queries || null;
|
|
308
|
-
const
|
|
308
|
+
const integrationBlock = definition.integration || null;
|
|
309
309
|
const eventsBlock = definition.events || null;
|
|
310
310
|
// EVT-7: emits is semantically 3-valued — undefined (fallback path),
|
|
311
311
|
// [] (explicit opt-out), or string[] (typed emission). Preserve the
|
|
@@ -579,7 +579,7 @@ export default {
|
|
|
579
579
|
moduleToController: importHelpers.moduleToController(fileNames.controller.replace('.ts', '')),
|
|
580
580
|
// OPENAPI-2: module imports DTO file to register Zod schemas at onModuleInit.
|
|
581
581
|
moduleToDto: importHelpers.moduleToDto(fileNames.dto.replace('.ts', '')),
|
|
582
|
-
// ADR-033.1:
|
|
582
|
+
// ADR-033.1: integration-source module imports the entity type from the
|
|
583
583
|
// domain barrel for the IChangeSource<T> type parameter.
|
|
584
584
|
moduleToDomain: importHelpers.moduleToDomain(),
|
|
585
585
|
// From controller (presentation/rest/) to queries/commands
|
|
@@ -1136,7 +1136,7 @@ export default {
|
|
|
1136
1136
|
const hasOrderedQuery = processedQueries.some((q) => q.hasOrder);
|
|
1137
1137
|
|
|
1138
1138
|
// ============================================================================
|
|
1139
|
-
// v2:
|
|
1139
|
+
// v2: Integration
|
|
1140
1140
|
// ============================================================================
|
|
1141
1141
|
|
|
1142
1142
|
// ADR-033.1 / ADR-033.2: provider-keyed detection block.
|
|
@@ -1150,18 +1150,18 @@ export default {
|
|
|
1150
1150
|
// Render the per-entity DetectionConfigs map as a TS object literal.
|
|
1151
1151
|
// JSON.stringify produces valid TS for the canonical DetectionConfig shape
|
|
1152
1152
|
// (strings, numbers, booleans, arrays, plain objects). Provider keys keep
|
|
1153
|
-
// YAML insertion order. Used by
|
|
1153
|
+
// YAML insertion order. Used by integration-source.ejs.t.
|
|
1154
1154
|
const detectionConfigsLiteral = hasDetection
|
|
1155
1155
|
? JSON.stringify(detectionBlock, null, 2)
|
|
1156
1156
|
: '{}';
|
|
1157
1157
|
|
|
1158
|
-
const
|
|
1159
|
-
const
|
|
1160
|
-
const
|
|
1161
|
-
const
|
|
1158
|
+
const hasIntegrationBlock = integrationBlock != null;
|
|
1159
|
+
const integrationElectric = hasIntegrationBlock ? (integrationBlock.electric ?? false) : false;
|
|
1160
|
+
const rawIntegrationProviders = hasIntegrationBlock ? (integrationBlock.providers ?? {}) : {};
|
|
1161
|
+
const hasIntegrationProviders = Object.keys(rawIntegrationProviders).length > 0;
|
|
1162
1162
|
|
|
1163
|
-
const
|
|
1164
|
-
? Object.entries(
|
|
1163
|
+
const integrationProviders = hasIntegrationProviders
|
|
1164
|
+
? Object.entries(rawIntegrationProviders).map(([providerName, cfg]) => {
|
|
1165
1165
|
// Normalize field_mapping: { local: key, remote: value }[]
|
|
1166
1166
|
const rawMapping = cfg.field_mapping ?? {};
|
|
1167
1167
|
const fieldMapping = Object.entries(rawMapping).map(([local, remote]) => ({
|
|
@@ -1488,6 +1488,18 @@ export default {
|
|
|
1488
1488
|
: 'getAuthorizationHeader',
|
|
1489
1489
|
},
|
|
1490
1490
|
sync: {
|
|
1491
|
+
// Read transport for the generated collection:
|
|
1492
|
+
// 'electric' (default) → electricCollectionOptions (real-time shape sync)
|
|
1493
|
+
// 'api' → queryCollectionOptions (REST via TanStack Query)
|
|
1494
|
+
// Additive + default-off: existing consumers are unaffected. The rest of
|
|
1495
|
+
// the store (hooks/useLiveQuery, resolve, mutations) is mode-agnostic.
|
|
1496
|
+
mode: frontendSync.mode ?? 'electric',
|
|
1497
|
+
// 'api' mode only: REST base path; the list endpoint is `${apiUrl}/${plural}`
|
|
1498
|
+
// (or `${API_BASE_URL}/${plural}` when apiBaseUrlImport is set).
|
|
1499
|
+
apiUrl: frontendSync.apiUrl ?? '/api',
|
|
1500
|
+
// 'api' mode only: import path for the shared TanStack QueryClient.
|
|
1501
|
+
// null → a sibling './query-client' is assumed (consumer-provided).
|
|
1502
|
+
queryClientImport: frontendSync.queryClientImport ?? null,
|
|
1491
1503
|
shapeUrl: frontendSync.shapeUrl ?? '/v1/shape',
|
|
1492
1504
|
useTableParam: frontendSync.useTableParam ?? true,
|
|
1493
1505
|
// Column mapper for snake_case to camelCase conversion (e.g., 'snakeCamelMapper')
|
|
@@ -1609,11 +1621,11 @@ export default {
|
|
|
1609
1621
|
hasMultiFieldQuery,
|
|
1610
1622
|
hasOrderedQuery,
|
|
1611
1623
|
|
|
1612
|
-
//
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1624
|
+
// Integration
|
|
1625
|
+
hasIntegrationBlock,
|
|
1626
|
+
integrationElectric,
|
|
1627
|
+
hasIntegrationProviders,
|
|
1628
|
+
integrationProviders,
|
|
1617
1629
|
|
|
1618
1630
|
// Detection (ADR-033.1 / ADR-033.2 typed provider artifacts)
|
|
1619
1631
|
hasDetection,
|
|
@@ -91,7 +91,7 @@ export const <%= tableVarName %> = pgTable(
|
|
|
91
91
|
// surrogate id). Role is part of the junction's identity — the same pair
|
|
92
92
|
// with two different roles is two distinct rows (e.g. a contact who is both
|
|
93
93
|
// `champion` and `decision_maker` on one opportunity). This is the
|
|
94
|
-
// ON CONFLICT target for
|
|
94
|
+
// ON CONFLICT target for integrationUpsert on role-bearing junctions.
|
|
95
95
|
primaryKey({ columns: [table.<%= leftColumnCamel %>, table.<%= rightColumnCamel %>, table.role] }),
|
|
96
96
|
<%_ } else { _%>
|
|
97
97
|
// Composite primary key on the two FK columns (Q4 resolution: no surrogate id)
|
|
@@ -378,23 +378,23 @@ export default {
|
|
|
378
378
|
const rightEntityCamel = camelCase(rightEntity);
|
|
379
379
|
|
|
380
380
|
// ======================================================================
|
|
381
|
-
// Inbound-
|
|
381
|
+
// Inbound-integration write surface (#374)
|
|
382
382
|
// ======================================================================
|
|
383
|
-
// The junction
|
|
383
|
+
// The junction integration identity is the tuple (leftId, rightId[, role]); its
|
|
384
384
|
// externalId is a COMPOSITE string. Both parent FKs resolve strictly. FK
|
|
385
385
|
// write-keys use `${camelCase(entity)}ExternalId` (matches the reference).
|
|
386
386
|
|
|
387
|
-
const
|
|
388
|
-
const
|
|
387
|
+
const leftIntegrationWriteKey = `${leftEntityCamel}ExternalId`;
|
|
388
|
+
const rightIntegrationWriteKey = `${rightEntityCamel}ExternalId`;
|
|
389
389
|
const roleColumnCamel = hasRole ? 'role' : null;
|
|
390
390
|
// Role TS type — literal union from the enum choices, else absent.
|
|
391
391
|
const roleTsType = hasRole
|
|
392
392
|
? roleChoices.map((c) => `'${c}'`).join(' | ')
|
|
393
393
|
: null;
|
|
394
394
|
|
|
395
|
-
//
|
|
395
|
+
// JunctionIntegrationConfig literal fields. refTable is emitted as a live table
|
|
396
396
|
// identifier (leftTable/rightTable) by the template.
|
|
397
|
-
const
|
|
397
|
+
const integrationConfig = {
|
|
398
398
|
leftColumn: leftColumnCamel,
|
|
399
399
|
leftRefTable: leftTable,
|
|
400
400
|
rightColumn: rightColumnCamel,
|
|
@@ -402,17 +402,17 @@ export default {
|
|
|
402
402
|
roleColumn: roleColumnCamel,
|
|
403
403
|
};
|
|
404
404
|
|
|
405
|
-
//
|
|
406
|
-
const
|
|
407
|
-
{ name:
|
|
408
|
-
{ name:
|
|
405
|
+
// TIntegrationWrite fields: both parent external ids + optional role + userId.
|
|
406
|
+
const integrationWriteFields = [
|
|
407
|
+
{ name: leftIntegrationWriteKey, tsType: 'string' },
|
|
408
|
+
{ name: rightIntegrationWriteKey, tsType: 'string' },
|
|
409
409
|
...(hasRole ? [{ name: 'role', tsType: roleTsType }] : []),
|
|
410
410
|
{ name: 'userId', tsType: 'string' },
|
|
411
411
|
];
|
|
412
412
|
|
|
413
|
-
//
|
|
413
|
+
// TIntegrationProjection fields: composite id + local FK columns + optional role +
|
|
414
414
|
// timestamps. No surrogate id column on a junction.
|
|
415
|
-
const
|
|
415
|
+
const integrationProjectionFields = [
|
|
416
416
|
{ name: 'id', tsType: 'string' },
|
|
417
417
|
{ name: leftColumnCamel, tsType: 'string' },
|
|
418
418
|
{ name: rightColumnCamel, tsType: 'string' },
|
|
@@ -423,15 +423,15 @@ export default {
|
|
|
423
423
|
|
|
424
424
|
// Parent-table imports for the FK resolvers, deduped (#368). Junction
|
|
425
425
|
// endpoints are distinct by schema, so two imports unless they collide.
|
|
426
|
-
const
|
|
427
|
-
const
|
|
426
|
+
const integrationParentImports = [];
|
|
427
|
+
const seenIntegrationImports = new Set();
|
|
428
428
|
for (const imp of [
|
|
429
429
|
{ table: leftTable, importPath: leftEntityImportFromJunction },
|
|
430
430
|
{ table: rightTable, importPath: rightEntityImportFromJunction },
|
|
431
431
|
]) {
|
|
432
|
-
if (
|
|
433
|
-
|
|
434
|
-
|
|
432
|
+
if (seenIntegrationImports.has(imp.table)) continue;
|
|
433
|
+
seenIntegrationImports.add(imp.table);
|
|
434
|
+
integrationParentImports.push(imp);
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
// ======================================================================
|
|
@@ -523,16 +523,16 @@ export default {
|
|
|
523
523
|
rightTable,
|
|
524
524
|
|
|
525
525
|
// ──────────────────────────────────────────────────────────────────
|
|
526
|
-
// Inbound-
|
|
526
|
+
// Inbound-integration write surface (#374)
|
|
527
527
|
// ──────────────────────────────────────────────────────────────────
|
|
528
|
-
|
|
529
|
-
|
|
528
|
+
leftIntegrationWriteKey,
|
|
529
|
+
rightIntegrationWriteKey,
|
|
530
530
|
roleColumnCamel,
|
|
531
531
|
roleTsType,
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
532
|
+
junctionIntegrationConfig: integrationConfig,
|
|
533
|
+
integrationWriteFields,
|
|
534
|
+
integrationProjectionFields,
|
|
535
|
+
integrationParentImports,
|
|
536
536
|
|
|
537
537
|
// ──────────────────────────────────────────────────────────────────
|
|
538
538
|
// CGP-60 — fan-out locals
|
|
@@ -7,41 +7,41 @@ import { Injectable, Inject } from '@nestjs/common';
|
|
|
7
7
|
import { eq } from 'drizzle-orm';
|
|
8
8
|
import { DRIZZLE } from '@shared/constants/tokens';
|
|
9
9
|
import type { DrizzleClient } from '@shared/types/drizzle';
|
|
10
|
-
import {
|
|
11
|
-
import type {
|
|
12
|
-
<%_
|
|
10
|
+
import { JunctionIntegrationRepository } from '@shared/base-classes/junction-integration-repository';
|
|
11
|
+
import type { JunctionIntegrationConfig } from '@shared/base-classes/junction-integration-repository';
|
|
12
|
+
<%_ integrationParentImports.forEach((imp) => { _%>
|
|
13
13
|
import { <%= imp.table %> } from '<%= imp.importPath %>';
|
|
14
14
|
<%_ }); _%>
|
|
15
15
|
import { <%= tableVarName %>, type <%= classNames.entity %> } from './<%= name %>.entity';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Canonical fields a
|
|
18
|
+
* Canonical fields a integrated <%= name %> junction write carries (#374). BOTH
|
|
19
19
|
* parent FKs are named by their vendor external ids and resolved STRICTLY in
|
|
20
20
|
* the tx (a missing parent throws → the orchestrator records a failed item and
|
|
21
21
|
* continues). `userId` is run context (no column on the junction).
|
|
22
22
|
*/
|
|
23
|
-
export interface <%= classNames.entity %>
|
|
24
|
-
<%_
|
|
23
|
+
export interface <%= classNames.entity %>IntegrationWrite {
|
|
24
|
+
<%_ integrationWriteFields.forEach((f) => { _%>
|
|
25
25
|
readonly <%= f.name %>: <%- f.tsType %>;
|
|
26
26
|
<%_ }); _%>
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* Canonical-projected view of a <%= name %> junction row, keyed for the
|
|
30
|
+
* Canonical-projected view of a <%= name %> junction row, keyed for the integration
|
|
31
31
|
* differ (#374). `id` is the COMPOSITE externalId (the junction has no
|
|
32
32
|
* surrogate id); the FKs are the LOCAL resolved uuids.
|
|
33
33
|
*/
|
|
34
|
-
export interface <%= classNames.entity %>
|
|
35
|
-
<%_
|
|
34
|
+
export interface <%= classNames.entity %>IntegrationProjection {
|
|
35
|
+
<%_ integrationProjectionFields.forEach((f) => { _%>
|
|
36
36
|
readonly <%= f.name %>: <%- f.tsType %>;
|
|
37
37
|
<%_ }); _%>
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
@Injectable()
|
|
41
|
-
export class <%= classNames.repository %> extends
|
|
41
|
+
export class <%= classNames.repository %> extends JunctionIntegrationRepository<
|
|
42
42
|
<%= classNames.entity %>,
|
|
43
|
-
<%= classNames.entity %>
|
|
44
|
-
<%= classNames.entity %>
|
|
43
|
+
<%= classNames.entity %>IntegrationWrite,
|
|
44
|
+
<%= classNames.entity %>IntegrationProjection
|
|
45
45
|
> {
|
|
46
46
|
readonly table = <%= tableVarName %>;
|
|
47
47
|
|
|
@@ -53,12 +53,12 @@ export class <%= classNames.repository %> extends JunctionSyncRepository<
|
|
|
53
53
|
userTracking: false,
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
// Inbound-
|
|
56
|
+
// Inbound-integration write surface (#374). Both endpoints resolve strictly against
|
|
57
57
|
// the live parent tables; role-bearing junctions conflict on (left,right,role).
|
|
58
|
-
protected readonly
|
|
59
|
-
left: { column: '<%=
|
|
60
|
-
right: { column: '<%=
|
|
61
|
-
roleColumn: <%-
|
|
58
|
+
protected readonly integrationConfig: JunctionIntegrationConfig = {
|
|
59
|
+
left: { column: '<%= junctionIntegrationConfig.leftColumn %>', refTable: <%= junctionIntegrationConfig.leftRefTable %> },
|
|
60
|
+
right: { column: '<%= junctionIntegrationConfig.rightColumn %>', refTable: <%= junctionIntegrationConfig.rightRefTable %> },
|
|
61
|
+
roleColumn: <%- junctionIntegrationConfig.roleColumn ? `'${junctionIntegrationConfig.roleColumn}'` : 'null' %>,
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
constructor(@Inject(DRIZZLE) db: DrizzleClient) {
|
|
@@ -102,7 +102,7 @@ export class <%= classNames.repository %> extends JunctionSyncRepository<
|
|
|
102
102
|
return rows as <%= classNames.entity %>[];
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
// Inherited from
|
|
105
|
+
// Inherited from JunctionIntegrationRepository (+ BaseRepository):
|
|
106
106
|
// findById, findByIds, list, count, exists, create, update, delete, upsertMany
|
|
107
|
-
//
|
|
107
|
+
// integrationUpsertOne, findByExternalIdProjected, softDeleteByExternalId
|
|
108
108
|
}
|
|
@@ -3,7 +3,7 @@ to: "<%= schemaPath %>"
|
|
|
3
3
|
force: true
|
|
4
4
|
---
|
|
5
5
|
<%- typeof generatedBanner !== 'undefined' ? generatedBanner : '' %>
|
|
6
|
-
// Schema barrel append tracked in #284 — same gap as events/jobs/
|
|
6
|
+
// Schema barrel append tracked in #284 — same gap as events/jobs/integration today.
|
|
7
7
|
/**
|
|
8
8
|
* Drizzle schema for the `auth_oauth_state` table — backs the
|
|
9
9
|
* `DrizzleOAuthStateStore` (`state-store.drizzle-backend.ts`).
|
|
@@ -21,7 +21,7 @@ force: true
|
|
|
21
21
|
* - `expires_at` — TTL boundary; entries past this are treated as absent.
|
|
22
22
|
*
|
|
23
23
|
* Convention: schema files live at the root of the subsystem dir
|
|
24
|
-
* (mirrors `cache.schema.ts`, `
|
|
24
|
+
* (mirrors `cache.schema.ts`, `integration-audit.schema.ts`, `domain-events.schema.ts`).
|
|
25
25
|
*/
|
|
26
26
|
import { pgTable, text, timestamp } from 'drizzle-orm/pg-core';
|
|
27
27
|
import type { InferSelectModel } from 'drizzle-orm';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* config-block inject step independently — `subsystem install auth --force`
|
|
6
6
|
* preserves an existing `auth:` block by skipping this action; pass
|
|
7
7
|
* `--force-config` to opt into regeneration. Mirrors `events-config` /
|
|
8
|
-
* `
|
|
8
|
+
* `integration-config` / `observability-config` exactly.
|
|
9
9
|
*
|
|
10
10
|
* Invoked via:
|
|
11
11
|
* bunx hygen subsystem auth-config --configPath <abs>
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
to: "<%= appModulePath %>"
|
|
3
3
|
inject: true
|
|
4
4
|
append: true
|
|
5
|
-
skip_if: "
|
|
5
|
+
skip_if: "ConnectionsAuthModule"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
// TODO: Register
|
|
8
|
+
// TODO: Register ConnectionsAuthModule (vendored from auth-integrations starter)
|
|
9
9
|
// Add to AppModule.imports AFTER AuthModule:
|
|
10
10
|
//
|
|
11
|
-
// import {
|
|
11
|
+
// import { ConnectionsAuthModule } from '@shared/connections/connections-auth.module';
|
|
12
12
|
// // ...
|
|
13
|
-
//
|
|
13
|
+
// ConnectionsAuthModule,
|
|
14
14
|
//
|
|
15
15
|
// Requires AuthModule.forRoot(...) registered first (provides ENCRYPTION_KEY).
|
|
16
|
-
// Run `cdp entity new
|
|
16
|
+
// Run `cdp entity new connection` to scaffold the codegen layer the adapters import.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Locals resolved by the CLI (src/cli/shared/bridge-scaffold-locals.ts) and
|
|
5
5
|
* forwarded as CLI args. This prompt.js coerces boolean-ish strings back into
|
|
6
|
-
* JS booleans for parity with events /
|
|
6
|
+
* JS booleans for parity with events / integration (Hygen args arrive as strings).
|
|
7
7
|
*
|
|
8
8
|
* Invoked via:
|
|
9
9
|
* bunx hygen subsystem bridge \
|