@bett3r-dev/pv3 1.0.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +329 -0
- package/build/adapters/cache/memory/index.d.ts.map +1 -1
- package/build/adapters/cache/memory/index.js +93 -20
- package/build/adapters/cache/memory/index.js.map +1 -1
- package/build/adapters/cache/memory/index.test.d.ts +2 -0
- package/build/adapters/cache/memory/index.test.d.ts.map +1 -0
- package/build/adapters/cache/memory/index.test.js +98 -0
- package/build/adapters/cache/memory/index.test.js.map +1 -0
- package/build/adapters/configuration/dotEnv.d.ts.map +1 -1
- package/build/adapters/configuration/dotEnv.js.map +1 -1
- package/build/adapters/database/memory/index.d.ts +5 -1
- package/build/adapters/database/memory/index.d.ts.map +1 -1
- package/build/adapters/database/memory/index.js +336 -44
- package/build/adapters/database/memory/index.js.map +1 -1
- package/build/adapters/database/memory/index.test.d.ts +2 -0
- package/build/adapters/database/memory/index.test.d.ts.map +1 -0
- package/build/adapters/database/memory/index.test.js +167 -0
- package/build/adapters/database/memory/index.test.js.map +1 -0
- package/build/adapters/database/memory/pagingCursorZero.test.d.ts +2 -0
- package/build/adapters/database/memory/pagingCursorZero.test.d.ts.map +1 -0
- package/build/adapters/database/memory/pagingCursorZero.test.js +60 -0
- package/build/adapters/database/memory/pagingCursorZero.test.js.map +1 -0
- package/build/adapters/database/memory/pagingVanishedCursor.test.d.ts +2 -0
- package/build/adapters/database/memory/pagingVanishedCursor.test.d.ts.map +1 -0
- package/build/adapters/database/memory/pagingVanishedCursor.test.js +72 -0
- package/build/adapters/database/memory/pagingVanishedCursor.test.js.map +1 -0
- package/build/adapters/endpoints/addAuthUser/index.d.ts +6 -4
- package/build/adapters/endpoints/addAuthUser/index.d.ts.map +1 -1
- package/build/adapters/endpoints/addAuthUser/index.js +12 -31
- package/build/adapters/endpoints/addAuthUser/index.js.map +1 -1
- package/build/adapters/endpoints/addDevAuthUser/index.d.ts +32 -0
- package/build/adapters/endpoints/addDevAuthUser/index.d.ts.map +1 -0
- package/build/adapters/endpoints/addDevAuthUser/index.js +39 -0
- package/build/adapters/endpoints/addDevAuthUser/index.js.map +1 -0
- package/build/adapters/endpoints/asyncLocalStorage/__tests__/asyncLocalStorage.test.d.ts +2 -0
- package/build/adapters/endpoints/asyncLocalStorage/__tests__/asyncLocalStorage.test.d.ts.map +1 -0
- package/build/adapters/endpoints/asyncLocalStorage/__tests__/asyncLocalStorage.test.js +97 -0
- package/build/adapters/endpoints/asyncLocalStorage/__tests__/asyncLocalStorage.test.js.map +1 -0
- package/build/adapters/endpoints/asyncLocalStorage/index.d.ts +22 -0
- package/build/adapters/endpoints/asyncLocalStorage/index.d.ts.map +1 -0
- package/build/adapters/endpoints/asyncLocalStorage/index.js +62 -0
- package/build/adapters/endpoints/asyncLocalStorage/index.js.map +1 -0
- package/build/adapters/endpoints/endpointValidation/__tests__/endpointValidation.test.d.ts +2 -0
- package/build/adapters/endpoints/endpointValidation/__tests__/endpointValidation.test.d.ts.map +1 -0
- package/build/adapters/endpoints/endpointValidation/__tests__/endpointValidation.test.js +98 -0
- package/build/adapters/endpoints/endpointValidation/__tests__/endpointValidation.test.js.map +1 -0
- package/build/adapters/endpoints/endpointValidation/index.d.ts +2 -2
- package/build/adapters/endpoints/endpointValidation/index.d.ts.map +1 -1
- package/build/adapters/endpoints/endpointValidation/index.js +19 -9
- package/build/adapters/endpoints/endpointValidation/index.js.map +1 -1
- package/build/adapters/endpoints/genericMiddleware/index.d.ts +23 -0
- package/build/adapters/endpoints/genericMiddleware/index.d.ts.map +1 -0
- package/build/adapters/endpoints/genericMiddleware/index.js +30 -0
- package/build/adapters/endpoints/genericMiddleware/index.js.map +1 -0
- package/build/adapters/endpoints/httpMethodOverride/index.d.ts +8 -0
- package/build/adapters/endpoints/httpMethodOverride/index.d.ts.map +1 -0
- package/build/adapters/endpoints/httpMethodOverride/index.js +44 -0
- package/build/adapters/endpoints/httpMethodOverride/index.js.map +1 -0
- package/build/adapters/endpoints/index.d.ts +5 -0
- package/build/adapters/endpoints/index.d.ts.map +1 -1
- package/build/adapters/endpoints/index.js +5 -1
- package/build/adapters/endpoints/index.js.map +1 -1
- package/build/adapters/endpoints/localAuthorization/index.d.ts +1 -0
- package/build/adapters/endpoints/localAuthorization/index.js +2 -0
- package/build/adapters/endpoints/localAuthorization/index.js.map +1 -1
- package/build/adapters/endpoints/mapQueryFromHeaders/index.d.ts +8 -0
- package/build/adapters/endpoints/mapQueryFromHeaders/index.d.ts.map +1 -0
- package/build/adapters/endpoints/mapQueryFromHeaders/index.js +36 -0
- package/build/adapters/endpoints/mapQueryFromHeaders/index.js.map +1 -0
- package/build/adapters/endpoints/tcpConsumer/index.d.ts.map +1 -1
- package/build/adapters/endpoints/tcpConsumer/index.js +8 -7
- package/build/adapters/endpoints/tcpConsumer/index.js.map +1 -1
- package/build/adapters/endpoints/userSession/__tests__/userSession.test.d.ts +2 -0
- package/build/adapters/endpoints/userSession/__tests__/userSession.test.d.ts.map +1 -0
- package/build/adapters/endpoints/userSession/__tests__/userSession.test.js +175 -0
- package/build/adapters/endpoints/userSession/__tests__/userSession.test.js.map +1 -0
- package/build/adapters/endpoints/userSession/index.d.ts +2 -2
- package/build/adapters/endpoints/userSession/index.d.ts.map +1 -1
- package/build/adapters/endpoints/userSession/index.js +36 -2
- package/build/adapters/endpoints/userSession/index.js.map +1 -1
- package/build/adapters/eventstore/database.d.ts.map +1 -1
- package/build/adapters/eventstore/database.js +261 -58
- package/build/adapters/eventstore/database.js.map +1 -1
- package/build/adapters/eventstore/database.test.d.ts +2 -0
- package/build/adapters/eventstore/database.test.d.ts.map +1 -0
- package/build/adapters/eventstore/database.test.js +123 -0
- package/build/adapters/eventstore/database.test.js.map +1 -0
- package/build/adapters/infrastructure/local/index.d.ts +2 -2
- package/build/adapters/infrastructure/local/index.d.ts.map +1 -1
- package/build/adapters/infrastructure/local/index.js +3 -3
- package/build/adapters/infrastructure/local/index.js.map +1 -1
- package/build/adapters/logger/__tests__/json.test.d.ts +2 -0
- package/build/adapters/logger/__tests__/json.test.d.ts.map +1 -0
- package/build/adapters/logger/__tests__/json.test.js +125 -0
- package/build/adapters/logger/__tests__/json.test.js.map +1 -0
- package/build/adapters/logger/console.d.ts.map +1 -1
- package/build/adapters/logger/console.js +4 -2
- package/build/adapters/logger/console.js.map +1 -1
- package/build/adapters/logger/http.d.ts +3 -0
- package/build/adapters/logger/http.d.ts.map +1 -0
- package/build/adapters/logger/http.js +49 -0
- package/build/adapters/logger/http.js.map +1 -0
- package/build/adapters/logger/index.d.ts +3 -0
- package/build/adapters/logger/index.d.ts.map +1 -1
- package/build/adapters/logger/index.js +3 -0
- package/build/adapters/logger/index.js.map +1 -1
- package/build/adapters/logger/json.d.ts +3 -0
- package/build/adapters/logger/json.d.ts.map +1 -0
- package/build/adapters/logger/json.js +41 -0
- package/build/adapters/logger/json.js.map +1 -0
- package/build/adapters/logger/stdout.d.ts +3 -0
- package/build/adapters/logger/stdout.d.ts.map +1 -0
- package/build/adapters/logger/stdout.js +52 -0
- package/build/adapters/logger/stdout.js.map +1 -0
- package/build/index.d.ts +3 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/libraries/deployment-units/computeMDUs.d.ts +11 -0
- package/build/libraries/deployment-units/computeMDUs.d.ts.map +1 -0
- package/build/libraries/deployment-units/computeMDUs.js +695 -0
- package/build/libraries/deployment-units/computeMDUs.js.map +1 -0
- package/build/libraries/deployment-units/computeMDUs.test.d.ts +2 -0
- package/build/libraries/deployment-units/computeMDUs.test.d.ts.map +1 -0
- package/build/libraries/deployment-units/computeMDUs.test.js +996 -0
- package/build/libraries/deployment-units/computeMDUs.test.js.map +1 -0
- package/build/libraries/deployment-units/index.d.ts +6 -0
- package/build/libraries/deployment-units/index.d.ts.map +1 -0
- package/build/libraries/deployment-units/index.js +8 -0
- package/build/libraries/deployment-units/index.js.map +1 -0
- package/build/libraries/deployment-units/manifestWriter.d.ts +11 -0
- package/build/libraries/deployment-units/manifestWriter.d.ts.map +1 -0
- package/build/libraries/deployment-units/manifestWriter.js +28 -0
- package/build/libraries/deployment-units/manifestWriter.js.map +1 -0
- package/build/libraries/deployment-units/types.d.ts +43 -0
- package/build/libraries/deployment-units/types.d.ts.map +1 -0
- package/build/libraries/deployment-units/types.js +3 -0
- package/build/libraries/deployment-units/types.js.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/defaultVisibilityThings.readmodel.d.ts +2 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/defaultVisibilityThings.readmodel.d.ts.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/defaultVisibilityThings.readmodel.js +17 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/defaultVisibilityThings.readmodel.js.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/dupA/things.readmodel.d.ts +2 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/dupA/things.readmodel.d.ts.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/dupA/things.readmodel.js +13 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/dupA/things.readmodel.js.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/dupB/things.readmodel.d.ts +2 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/dupB/things.readmodel.d.ts.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/dupB/things.readmodel.js +12 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/dupB/things.readmodel.js.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/publicThings.readmodel.d.ts +2 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/publicThings.readmodel.d.ts.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/publicThings.readmodel.js +21 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/publicThings.readmodel.js.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/queryOnlyThings.readmodel.d.ts +2 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/queryOnlyThings.readmodel.d.ts.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/queryOnlyThings.readmodel.js +16 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/queryOnlyThings.readmodel.js.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/subscribingThings.readmodel.d.ts +2 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/subscribingThings.readmodel.d.ts.map +1 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/subscribingThings.readmodel.js +14 -0
- package/build/libraries/eventsourcing/__tests__/fixtures/subscribingThings.readmodel.js.map +1 -0
- package/build/libraries/eventsourcing/__tests__/queryOnlyReadmodel.test.d.ts +2 -0
- package/build/libraries/eventsourcing/__tests__/queryOnlyReadmodel.test.d.ts.map +1 -0
- package/build/libraries/eventsourcing/__tests__/queryOnlyReadmodel.test.js +88 -0
- package/build/libraries/eventsourcing/__tests__/queryOnlyReadmodel.test.js.map +1 -0
- package/build/libraries/eventsourcing/__tests__/queryVisibility.test.d.ts +2 -0
- package/build/libraries/eventsourcing/__tests__/queryVisibility.test.d.ts.map +1 -0
- package/build/libraries/eventsourcing/__tests__/queryVisibility.test.js +82 -0
- package/build/libraries/eventsourcing/__tests__/queryVisibility.test.js.map +1 -0
- package/build/libraries/eventsourcing/commandHandlers/index.d.ts +40 -0
- package/build/libraries/eventsourcing/commandHandlers/index.d.ts.map +1 -0
- package/build/libraries/eventsourcing/commandHandlers/index.js +1065 -0
- package/build/libraries/eventsourcing/commandHandlers/index.js.map +1 -0
- package/build/libraries/eventsourcing/commandTemplates/index.d.ts.map +1 -0
- package/build/libraries/eventsourcing/commandTemplates/index.js.map +1 -0
- package/build/libraries/eventsourcing/commandTemplates/multiStream.d.ts +7 -0
- package/build/libraries/eventsourcing/commandTemplates/multiStream.d.ts.map +1 -0
- package/build/libraries/eventsourcing/commandTemplates/multiStream.js +116 -0
- package/build/libraries/eventsourcing/commandTemplates/multiStream.js.map +1 -0
- package/build/libraries/eventsourcing/commandTemplates/snapshot.d.ts +108 -0
- package/build/libraries/eventsourcing/commandTemplates/snapshot.d.ts.map +1 -0
- package/build/libraries/eventsourcing/commandTemplates/snapshot.js +127 -0
- package/build/libraries/eventsourcing/commandTemplates/snapshot.js.map +1 -0
- package/build/libraries/eventsourcing/eventHandlers/__tests__/queryResponseFormatterCaller.test.d.ts +2 -0
- package/build/libraries/eventsourcing/eventHandlers/__tests__/queryResponseFormatterCaller.test.d.ts.map +1 -0
- package/build/libraries/eventsourcing/eventHandlers/__tests__/queryResponseFormatterCaller.test.js +77 -0
- package/build/libraries/eventsourcing/eventHandlers/__tests__/queryResponseFormatterCaller.test.js.map +1 -0
- package/build/libraries/eventsourcing/eventHandlers/index.d.ts +52 -0
- package/build/libraries/eventsourcing/eventHandlers/index.d.ts.map +1 -0
- package/build/libraries/eventsourcing/eventHandlers/index.js +474 -0
- package/build/libraries/eventsourcing/eventHandlers/index.js.map +1 -0
- package/build/libraries/eventsourcing/executionContext.d.ts +50 -0
- package/build/libraries/eventsourcing/executionContext.d.ts.map +1 -0
- package/build/libraries/eventsourcing/executionContext.js +10 -0
- package/build/libraries/eventsourcing/executionContext.js.map +1 -0
- package/build/libraries/eventsourcing/idempotencyChecks/index.d.ts +5 -0
- package/build/libraries/eventsourcing/idempotencyChecks/index.d.ts.map +1 -0
- package/build/libraries/eventsourcing/idempotencyChecks/index.js +26 -0
- package/build/libraries/eventsourcing/idempotencyChecks/index.js.map +1 -0
- package/build/libraries/eventsourcing/index.d.ts +14 -0
- package/build/libraries/eventsourcing/index.d.ts.map +1 -0
- package/build/{ports → libraries}/eventsourcing/index.js +50 -15
- package/build/{ports → libraries}/eventsourcing/index.js.map +1 -1
- package/build/libraries/eventsourcing/invariants/combinators.d.ts +4 -0
- package/build/libraries/eventsourcing/invariants/combinators.d.ts.map +1 -0
- package/build/{ports → libraries}/eventsourcing/invariants/combinators.js +3 -3
- package/build/libraries/eventsourcing/invariants/combinators.js.map +1 -0
- package/build/libraries/eventsourcing/invariants/common.d.ts +15 -0
- package/build/libraries/eventsourcing/invariants/common.d.ts.map +1 -0
- package/build/libraries/eventsourcing/invariants/common.js +27 -0
- package/build/libraries/eventsourcing/invariants/common.js.map +1 -0
- package/build/libraries/eventsourcing/invariants/comparisons.d.ts +16 -0
- package/build/libraries/eventsourcing/invariants/comparisons.d.ts.map +1 -0
- package/build/libraries/eventsourcing/invariants/comparisons.js +35 -0
- package/build/libraries/eventsourcing/invariants/comparisons.js.map +1 -0
- package/build/libraries/eventsourcing/invariants/comparisons.test.d.ts +2 -0
- package/build/libraries/eventsourcing/invariants/comparisons.test.d.ts.map +1 -0
- package/build/libraries/eventsourcing/invariants/comparisons.test.js +25 -0
- package/build/libraries/eventsourcing/invariants/comparisons.test.js.map +1 -0
- package/build/libraries/eventsourcing/invariants/index.d.ts +17 -0
- package/build/libraries/eventsourcing/invariants/index.d.ts.map +1 -0
- package/build/libraries/eventsourcing/invariants/index.js +47 -0
- package/build/libraries/eventsourcing/invariants/index.js.map +1 -0
- package/build/libraries/eventsourcing/invariants/stateExistance.d.ts +4 -0
- package/build/libraries/eventsourcing/invariants/stateExistance.d.ts.map +1 -0
- package/build/libraries/eventsourcing/invariants/stateExistance.js +22 -0
- package/build/libraries/eventsourcing/invariants/stateExistance.js.map +1 -0
- package/build/libraries/eventsourcing/subscriptions/__tests__/sseSubscriptions.test.d.ts +2 -0
- package/build/libraries/eventsourcing/subscriptions/__tests__/sseSubscriptions.test.d.ts.map +1 -0
- package/build/libraries/eventsourcing/subscriptions/__tests__/sseSubscriptions.test.js +563 -0
- package/build/libraries/eventsourcing/subscriptions/__tests__/sseSubscriptions.test.js.map +1 -0
- package/build/libraries/eventsourcing/subscriptions/index.d.ts.map +1 -0
- package/build/libraries/eventsourcing/subscriptions/index.js.map +1 -0
- package/build/libraries/eventsourcing/subscriptions/sseSubscriptions.d.ts +5 -0
- package/build/libraries/eventsourcing/subscriptions/sseSubscriptions.d.ts.map +1 -0
- package/build/libraries/eventsourcing/subscriptions/sseSubscriptions.js +198 -0
- package/build/libraries/eventsourcing/subscriptions/sseSubscriptions.js.map +1 -0
- package/build/libraries/eventsourcing/utils/aggregateBuilder.d.ts +5 -0
- package/build/libraries/eventsourcing/utils/aggregateBuilder.d.ts.map +1 -0
- package/build/{ports → libraries}/eventsourcing/utils/aggregateBuilder.js +17 -3
- package/build/libraries/eventsourcing/utils/aggregateBuilder.js.map +1 -0
- package/build/libraries/eventsourcing/utils/commandBuilder.d.ts +3 -0
- package/build/libraries/eventsourcing/utils/commandBuilder.d.ts.map +1 -0
- package/build/{ports → libraries}/eventsourcing/utils/commandBuilder.js +44 -1
- package/build/libraries/eventsourcing/utils/commandBuilder.js.map +1 -0
- package/build/{ports → libraries}/eventsourcing/utils/eventHandlerBuilder.d.ts +2 -2
- package/build/libraries/eventsourcing/utils/eventHandlerBuilder.d.ts.map +1 -0
- package/build/libraries/eventsourcing/utils/eventHandlerBuilder.js.map +1 -0
- package/build/libraries/eventsourcing/utils/externalSystemBuilder.d.ts +5 -0
- package/build/libraries/eventsourcing/utils/externalSystemBuilder.d.ts.map +1 -0
- package/build/libraries/eventsourcing/utils/externalSystemBuilder.js +43 -0
- package/build/libraries/eventsourcing/utils/externalSystemBuilder.js.map +1 -0
- package/build/libraries/eventsourcing/utils/index.d.ts +22 -0
- package/build/libraries/eventsourcing/utils/index.d.ts.map +1 -0
- package/build/libraries/eventsourcing/utils/index.js +88 -0
- package/build/libraries/eventsourcing/utils/index.js.map +1 -0
- package/build/libraries/eventsourcing/utils/policyBuilder.d.ts +4 -0
- package/build/libraries/eventsourcing/utils/policyBuilder.d.ts.map +1 -0
- package/build/libraries/eventsourcing/utils/policyBuilder.js +53 -0
- package/build/libraries/eventsourcing/utils/policyBuilder.js.map +1 -0
- package/build/libraries/eventsourcing/utils/readmodelBuilder.d.ts +6 -0
- package/build/libraries/eventsourcing/utils/readmodelBuilder.d.ts.map +1 -0
- package/build/libraries/eventsourcing/utils/readmodelBuilder.js +68 -0
- package/build/libraries/eventsourcing/utils/readmodelBuilder.js.map +1 -0
- package/build/libraries/localOutbox/index.d.ts +6 -0
- package/build/libraries/localOutbox/index.d.ts.map +1 -0
- package/build/libraries/localOutbox/index.js +72 -0
- package/build/libraries/localOutbox/index.js.map +1 -0
- package/build/libraries/modulePath.d.ts +14 -0
- package/build/libraries/modulePath.d.ts.map +1 -0
- package/build/libraries/modulePath.js +21 -0
- package/build/libraries/modulePath.js.map +1 -0
- package/build/libraries/modules/fs.d.ts +2 -4
- package/build/libraries/modules/fs.d.ts.map +1 -1
- package/build/libraries/modules/fs.js +21 -84
- package/build/libraries/modules/fs.js.map +1 -1
- package/build/libraries/modules/index.d.ts +2 -0
- package/build/libraries/modules/index.d.ts.map +1 -1
- package/build/libraries/modules/index.js +2 -0
- package/build/libraries/modules/index.js.map +1 -1
- package/build/libraries/modules/scopedPortsView.d.ts +42 -0
- package/build/libraries/modules/scopedPortsView.d.ts.map +1 -0
- package/build/libraries/modules/scopedPortsView.js +55 -0
- package/build/libraries/modules/scopedPortsView.js.map +1 -0
- package/build/libraries/modules/scopedPortsView.test.d.ts +10 -0
- package/build/libraries/modules/scopedPortsView.test.d.ts.map +1 -0
- package/build/libraries/modules/scopedPortsView.test.js +103 -0
- package/build/libraries/modules/scopedPortsView.test.js.map +1 -0
- package/build/libraries/modules/selectiveLoader.d.ts +21 -0
- package/build/libraries/modules/selectiveLoader.d.ts.map +1 -0
- package/build/libraries/modules/selectiveLoader.js +164 -0
- package/build/libraries/modules/selectiveLoader.js.map +1 -0
- package/build/libraries/modules/selectiveLoader.test.d.ts +2 -0
- package/build/libraries/modules/selectiveLoader.test.d.ts.map +1 -0
- package/build/libraries/modules/selectiveLoader.test.js +471 -0
- package/build/libraries/modules/selectiveLoader.test.js.map +1 -0
- package/build/libraries/openApi/pruneUnusedRef.d.ts.map +1 -1
- package/build/libraries/openApi/pruneUnusedRef.js.map +1 -1
- package/build/libraries/tcp/index.d.ts +0 -1
- package/build/libraries/tcp/index.d.ts.map +1 -1
- package/build/libraries/tcp/index.js +32 -9
- package/build/libraries/tcp/index.js.map +1 -1
- package/build/libraries/tcp/types.d.ts +0 -1
- package/build/libraries/tcp/types.d.ts.map +1 -1
- package/build/libraries/validation/__tests__/readmodelQuerySchema.test.d.ts +2 -0
- package/build/libraries/validation/__tests__/readmodelQuerySchema.test.d.ts.map +1 -0
- package/build/libraries/validation/__tests__/readmodelQuerySchema.test.js +100 -0
- package/build/libraries/validation/__tests__/readmodelQuerySchema.test.js.map +1 -0
- package/build/libraries/validation/__tests__/validation.test.js +17 -7
- package/build/libraries/validation/__tests__/validation.test.js.map +1 -1
- package/build/libraries/validation/index.d.ts +3 -3
- package/build/libraries/validation/index.d.ts.map +1 -1
- package/build/libraries/validation/index.js +49 -15
- package/build/libraries/validation/index.js.map +1 -1
- package/build/ports/authentication/index.js.map +1 -1
- package/build/ports/authentication/index.test.d.ts +2 -0
- package/build/ports/authentication/index.test.d.ts.map +1 -0
- package/build/ports/authentication/index.test.js +38 -0
- package/build/ports/authentication/index.test.js.map +1 -0
- package/build/ports/base.d.ts.map +1 -1
- package/build/ports/base.js +39 -5
- package/build/ports/base.js.map +1 -1
- package/build/ports/base.test.d.ts +2 -0
- package/build/ports/base.test.d.ts.map +1 -0
- package/build/ports/base.test.js +92 -0
- package/build/ports/base.test.js.map +1 -0
- package/build/ports/cache/index.js.map +1 -1
- package/build/ports/cache/index.test.d.ts +2 -0
- package/build/ports/cache/index.test.d.ts.map +1 -0
- package/build/ports/cache/index.test.js +43 -0
- package/build/ports/cache/index.test.js.map +1 -0
- package/build/ports/configuration/__tests__/cliArgs.test.d.ts +2 -0
- package/build/ports/configuration/__tests__/cliArgs.test.d.ts.map +1 -0
- package/build/ports/configuration/__tests__/cliArgs.test.js +158 -0
- package/build/ports/configuration/__tests__/cliArgs.test.js.map +1 -0
- package/build/ports/configuration/__tests__/configurationPortEmitter.test.d.ts +2 -0
- package/build/ports/configuration/__tests__/configurationPortEmitter.test.d.ts.map +1 -0
- package/build/ports/configuration/__tests__/configurationPortEmitter.test.js +63 -0
- package/build/ports/configuration/__tests__/configurationPortEmitter.test.js.map +1 -0
- package/build/ports/configuration/__tests__/getArgsSync.test.d.ts +2 -0
- package/build/ports/configuration/__tests__/getArgsSync.test.d.ts.map +1 -0
- package/build/ports/configuration/__tests__/getArgsSync.test.js +85 -0
- package/build/ports/configuration/__tests__/getArgsSync.test.js.map +1 -0
- package/build/ports/configuration/args.d.ts +50 -43
- package/build/ports/configuration/args.d.ts.map +1 -1
- package/build/ports/configuration/args.js +76 -13
- package/build/ports/configuration/args.js.map +1 -1
- package/build/ports/configuration/common.js +1 -2
- package/build/ports/configuration/common.js.map +1 -1
- package/build/ports/configuration/index.d.ts +1 -1
- package/build/ports/configuration/index.d.ts.map +1 -1
- package/build/ports/configuration/index.js +85 -17
- package/build/ports/configuration/index.js.map +1 -1
- package/build/ports/configuration/localConfig.d.ts.map +1 -1
- package/build/ports/configuration/localConfig.js +46 -27
- package/build/ports/configuration/localConfig.js.map +1 -1
- package/build/ports/database/index.d.ts +1 -2
- package/build/ports/database/index.d.ts.map +1 -1
- package/build/ports/database/index.js +23 -17
- package/build/ports/database/index.js.map +1 -1
- package/build/ports/database/index.test.d.ts +2 -0
- package/build/ports/database/index.test.d.ts.map +1 -0
- package/build/ports/database/index.test.js +43 -0
- package/build/ports/database/index.test.js.map +1 -0
- package/build/ports/endpoints/__tests__/declarationSite.test.d.ts +2 -0
- package/build/ports/endpoints/__tests__/declarationSite.test.d.ts.map +1 -0
- package/build/ports/endpoints/__tests__/declarationSite.test.js +165 -0
- package/build/ports/endpoints/__tests__/declarationSite.test.js.map +1 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/appLoginUrl.d.ts +9 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/appLoginUrl.d.ts.map +1 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/appLoginUrl.js +20 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/appLoginUrl.js.map +1 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/index.d.ts +10 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/index.d.ts.map +1 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/index.js +21 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/index.js.map +1 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/orders.endpoints.d.ts +15 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/orders.endpoints.d.ts.map +1 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/orders.endpoints.js +46 -0
- package/build/ports/endpoints/__tests__/fixtures/modules/sales/orders.endpoints.js.map +1 -0
- package/build/ports/endpoints/__tests__/manifestEndpoints.test.d.ts +2 -0
- package/build/ports/endpoints/__tests__/manifestEndpoints.test.d.ts.map +1 -0
- package/build/ports/endpoints/__tests__/manifestEndpoints.test.js +117 -0
- package/build/ports/endpoints/__tests__/manifestEndpoints.test.js.map +1 -0
- package/build/ports/endpoints/declarationSite.d.ts +63 -0
- package/build/ports/endpoints/declarationSite.d.ts.map +1 -0
- package/build/ports/endpoints/declarationSite.js +126 -0
- package/build/ports/endpoints/declarationSite.js.map +1 -0
- package/build/ports/endpoints/health.d.ts +26 -0
- package/build/ports/endpoints/health.d.ts.map +1 -0
- package/build/ports/endpoints/health.js +96 -0
- package/build/ports/endpoints/health.js.map +1 -0
- package/build/ports/endpoints/index.d.ts +43 -7
- package/build/ports/endpoints/index.d.ts.map +1 -1
- package/build/ports/endpoints/index.js +317 -67
- package/build/ports/endpoints/index.js.map +1 -1
- package/build/ports/endpoints/openApi.d.ts +3 -2
- package/build/ports/endpoints/openApi.d.ts.map +1 -1
- package/build/ports/endpoints/openApi.js +184 -55
- package/build/ports/endpoints/openApi.js.map +1 -1
- package/build/ports/endpoints/utils.d.ts.map +1 -1
- package/build/ports/endpoints/utils.js.map +1 -1
- package/build/ports/eventstore/index.d.ts.map +1 -1
- package/build/ports/eventstore/index.js +37 -5
- package/build/ports/eventstore/index.js.map +1 -1
- package/build/ports/eventstore/index.test.d.ts +2 -0
- package/build/ports/eventstore/index.test.d.ts.map +1 -0
- package/build/ports/eventstore/index.test.js +68 -0
- package/build/ports/eventstore/index.test.js.map +1 -0
- package/build/ports/infrastructure/index.d.ts +61 -23
- package/build/ports/infrastructure/index.d.ts.map +1 -1
- package/build/ports/infrastructure/index.js +187 -37
- package/build/ports/infrastructure/index.js.map +1 -1
- package/build/ports/infrastructure/index.test.d.ts +2 -0
- package/build/ports/infrastructure/index.test.d.ts.map +1 -0
- package/build/ports/infrastructure/index.test.js +228 -0
- package/build/ports/infrastructure/index.test.js.map +1 -0
- package/build/ports/infrastructure/utils.d.ts +2 -1
- package/build/ports/infrastructure/utils.d.ts.map +1 -1
- package/build/ports/infrastructure/utils.js +48 -22
- package/build/ports/infrastructure/utils.js.map +1 -1
- package/build/ports/logger/__tests__/logger.test.d.ts +2 -0
- package/build/ports/logger/__tests__/logger.test.d.ts.map +1 -0
- package/build/ports/logger/__tests__/logger.test.js +69 -0
- package/build/ports/logger/__tests__/logger.test.js.map +1 -0
- package/build/ports/logger/index.d.ts.map +1 -1
- package/build/ports/logger/index.js +3 -2
- package/build/ports/logger/index.js.map +1 -1
- package/build/utils/__tests__/applyCollectionFilterInMemory.test.d.ts +2 -0
- package/build/utils/__tests__/applyCollectionFilterInMemory.test.d.ts.map +1 -0
- package/build/utils/__tests__/applyCollectionFilterInMemory.test.js +33 -0
- package/build/utils/__tests__/applyCollectionFilterInMemory.test.js.map +1 -0
- package/build/utils/__tests__/decodeObjectQueryParams.test.d.ts +2 -0
- package/build/utils/__tests__/decodeObjectQueryParams.test.d.ts.map +1 -0
- package/build/utils/__tests__/decodeObjectQueryParams.test.js +118 -0
- package/build/utils/__tests__/decodeObjectQueryParams.test.js.map +1 -0
- package/build/utils/index.d.ts +26 -34
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +159 -170
- package/build/utils/index.js.map +1 -1
- package/package.json +31 -11
- package/build/adapters/cache/memory/__tests__/memoryCache.test.d.ts +0 -1
- package/build/adapters/cache/memory/__tests__/memoryCache.test.d.ts.map +0 -1
- package/build/adapters/cache/memory/__tests__/memoryCache.test.js +0 -6
- package/build/adapters/cache/memory/__tests__/memoryCache.test.js.map +0 -1
- package/build/adapters/database/memory/__tests__/memoryDb.test.d.ts +0 -1
- package/build/adapters/database/memory/__tests__/memoryDb.test.d.ts.map +0 -1
- package/build/adapters/database/memory/__tests__/memoryDb.test.js +0 -36
- package/build/adapters/database/memory/__tests__/memoryDb.test.js.map +0 -1
- package/build/ports/endpoints/__tests__/endpointsCall.test.d.ts +0 -2
- package/build/ports/endpoints/__tests__/endpointsCall.test.d.ts.map +0 -1
- package/build/ports/endpoints/__tests__/endpointsCall.test.js +0 -21
- package/build/ports/endpoints/__tests__/endpointsCall.test.js.map +0 -1
- package/build/ports/endpoints/__tests__/test-client-library/base.d.ts +0 -77
- package/build/ports/endpoints/__tests__/test-client-library/base.d.ts.map +0 -1
- package/build/ports/endpoints/__tests__/test-client-library/base.js +0 -91
- package/build/ports/endpoints/__tests__/test-client-library/base.js.map +0 -1
- package/build/ports/endpoints/__tests__/test-client-library/index.d.ts +0 -29
- package/build/ports/endpoints/__tests__/test-client-library/index.d.ts.map +0 -1
- package/build/ports/endpoints/__tests__/test-client-library/index.js +0 -43
- package/build/ports/endpoints/__tests__/test-client-library/index.js.map +0 -1
- package/build/ports/endpoints/__tests__/test-client-library/services/service.d.ts +0 -106
- package/build/ports/endpoints/__tests__/test-client-library/services/service.d.ts.map +0 -1
- package/build/ports/endpoints/__tests__/test-client-library/services/service.js +0 -62
- package/build/ports/endpoints/__tests__/test-client-library/services/service.js.map +0 -1
- package/build/ports/endpoints/__tests__/utils.test.d.ts +0 -1
- package/build/ports/endpoints/__tests__/utils.test.d.ts.map +0 -1
- package/build/ports/endpoints/__tests__/utils.test.js +0 -53
- package/build/ports/endpoints/__tests__/utils.test.js.map +0 -1
- package/build/ports/eventsourcing/__tests__/eventhandlers.test.d.ts +0 -2
- package/build/ports/eventsourcing/__tests__/eventhandlers.test.d.ts.map +0 -1
- package/build/ports/eventsourcing/__tests__/eventhandlers.test.js +0 -35
- package/build/ports/eventsourcing/__tests__/eventhandlers.test.js.map +0 -1
- package/build/ports/eventsourcing/__tests__/invariants.test.d.ts +0 -2
- package/build/ports/eventsourcing/__tests__/invariants.test.d.ts.map +0 -1
- package/build/ports/eventsourcing/__tests__/invariants.test.js +0 -210
- package/build/ports/eventsourcing/__tests__/invariants.test.js.map +0 -1
- package/build/ports/eventsourcing/commandHandlers/index.d.ts +0 -25
- package/build/ports/eventsourcing/commandHandlers/index.d.ts.map +0 -1
- package/build/ports/eventsourcing/commandHandlers/index.js +0 -392
- package/build/ports/eventsourcing/commandHandlers/index.js.map +0 -1
- package/build/ports/eventsourcing/commandTemplates/index.d.ts.map +0 -1
- package/build/ports/eventsourcing/commandTemplates/index.js.map +0 -1
- package/build/ports/eventsourcing/commandTemplates/multiStream.d.ts +0 -4
- package/build/ports/eventsourcing/commandTemplates/multiStream.d.ts.map +0 -1
- package/build/ports/eventsourcing/commandTemplates/multiStream.js +0 -73
- package/build/ports/eventsourcing/commandTemplates/multiStream.js.map +0 -1
- package/build/ports/eventsourcing/commandTemplates/snapshot.d.ts +0 -9
- package/build/ports/eventsourcing/commandTemplates/snapshot.d.ts.map +0 -1
- package/build/ports/eventsourcing/commandTemplates/snapshot.js +0 -39
- package/build/ports/eventsourcing/commandTemplates/snapshot.js.map +0 -1
- package/build/ports/eventsourcing/eventHandlers/index.d.ts +0 -33
- package/build/ports/eventsourcing/eventHandlers/index.d.ts.map +0 -1
- package/build/ports/eventsourcing/eventHandlers/index.js +0 -276
- package/build/ports/eventsourcing/eventHandlers/index.js.map +0 -1
- package/build/ports/eventsourcing/index.d.ts +0 -9
- package/build/ports/eventsourcing/index.d.ts.map +0 -1
- package/build/ports/eventsourcing/invariants/combinators.d.ts +0 -4
- package/build/ports/eventsourcing/invariants/combinators.d.ts.map +0 -1
- package/build/ports/eventsourcing/invariants/combinators.js.map +0 -1
- package/build/ports/eventsourcing/invariants/common.d.ts +0 -10
- package/build/ports/eventsourcing/invariants/common.d.ts.map +0 -1
- package/build/ports/eventsourcing/invariants/common.js +0 -37
- package/build/ports/eventsourcing/invariants/common.js.map +0 -1
- package/build/ports/eventsourcing/invariants/comparisons.d.ts +0 -19
- package/build/ports/eventsourcing/invariants/comparisons.d.ts.map +0 -1
- package/build/ports/eventsourcing/invariants/comparisons.js +0 -83
- package/build/ports/eventsourcing/invariants/comparisons.js.map +0 -1
- package/build/ports/eventsourcing/invariants/index.d.ts +0 -5
- package/build/ports/eventsourcing/invariants/index.d.ts.map +0 -1
- package/build/ports/eventsourcing/invariants/index.js +0 -21
- package/build/ports/eventsourcing/invariants/index.js.map +0 -1
- package/build/ports/eventsourcing/invariants/stateExistance.d.ts +0 -4
- package/build/ports/eventsourcing/invariants/stateExistance.d.ts.map +0 -1
- package/build/ports/eventsourcing/invariants/stateExistance.js +0 -33
- package/build/ports/eventsourcing/invariants/stateExistance.js.map +0 -1
- package/build/ports/eventsourcing/subscriptions/index.d.ts.map +0 -1
- package/build/ports/eventsourcing/subscriptions/index.js.map +0 -1
- package/build/ports/eventsourcing/subscriptions/sseSubscriptions.d.ts +0 -3
- package/build/ports/eventsourcing/subscriptions/sseSubscriptions.d.ts.map +0 -1
- package/build/ports/eventsourcing/subscriptions/sseSubscriptions.js +0 -81
- package/build/ports/eventsourcing/subscriptions/sseSubscriptions.js.map +0 -1
- package/build/ports/eventsourcing/utils/aggregateBuilder.d.ts +0 -4
- package/build/ports/eventsourcing/utils/aggregateBuilder.d.ts.map +0 -1
- package/build/ports/eventsourcing/utils/aggregateBuilder.js.map +0 -1
- package/build/ports/eventsourcing/utils/commandBuilder.d.ts +0 -3
- package/build/ports/eventsourcing/utils/commandBuilder.d.ts.map +0 -1
- package/build/ports/eventsourcing/utils/commandBuilder.js.map +0 -1
- package/build/ports/eventsourcing/utils/eventHandlerBuilder.d.ts.map +0 -1
- package/build/ports/eventsourcing/utils/eventHandlerBuilder.js.map +0 -1
- package/build/ports/eventsourcing/utils/externalSystemBuilder.d.ts +0 -4
- package/build/ports/eventsourcing/utils/externalSystemBuilder.d.ts.map +0 -1
- package/build/ports/eventsourcing/utils/externalSystemBuilder.js +0 -34
- package/build/ports/eventsourcing/utils/externalSystemBuilder.js.map +0 -1
- package/build/ports/eventsourcing/utils/index.d.ts +0 -13
- package/build/ports/eventsourcing/utils/index.d.ts.map +0 -1
- package/build/ports/eventsourcing/utils/index.js +0 -45
- package/build/ports/eventsourcing/utils/index.js.map +0 -1
- package/build/ports/eventsourcing/utils/policyBuilder.d.ts +0 -3
- package/build/ports/eventsourcing/utils/policyBuilder.d.ts.map +0 -1
- package/build/ports/eventsourcing/utils/policyBuilder.js +0 -29
- package/build/ports/eventsourcing/utils/policyBuilder.js.map +0 -1
- package/build/ports/eventsourcing/utils/readmodelBuilder.d.ts +0 -5
- package/build/ports/eventsourcing/utils/readmodelBuilder.d.ts.map +0 -1
- package/build/ports/eventsourcing/utils/readmodelBuilder.js +0 -45
- package/build/ports/eventsourcing/utils/readmodelBuilder.js.map +0 -1
- package/build/ports/infrastructure/__tests__/fixture/index.d.ts +0 -3
- package/build/ports/infrastructure/__tests__/fixture/index.d.ts.map +0 -1
- package/build/ports/infrastructure/__tests__/fixture/index.js +0 -19
- package/build/ports/infrastructure/__tests__/fixture/index.js.map +0 -1
- package/build/ports/infrastructure/__tests__/fixture/infrastructureServices.d.ts +0 -19
- package/build/ports/infrastructure/__tests__/fixture/infrastructureServices.d.ts.map +0 -1
- package/build/ports/infrastructure/__tests__/fixture/infrastructureServices.js +0 -76
- package/build/ports/infrastructure/__tests__/fixture/infrastructureServices.js.map +0 -1
- package/build/ports/infrastructure/__tests__/fixture/structureState.d.ts +0 -177
- package/build/ports/infrastructure/__tests__/fixture/structureState.d.ts.map +0 -1
- package/build/ports/infrastructure/__tests__/fixture/structureState.js +0 -258
- package/build/ports/infrastructure/__tests__/fixture/structureState.js.map +0 -1
- package/build/ports/infrastructure/__tests__/infrastructure.test.d.ts +0 -2
- package/build/ports/infrastructure/__tests__/infrastructure.test.d.ts.map +0 -1
- package/build/ports/infrastructure/__tests__/infrastructure.test.js +0 -11
- package/build/ports/infrastructure/__tests__/infrastructure.test.js.map +0 -1
- package/src/adapters/cache/index.ts +0 -1
- package/src/adapters/cache/memory/__tests__/memoryCache.test.ts +0 -6
- package/src/adapters/cache/memory/index.ts +0 -142
- package/src/adapters/configuration/__tests__/.env +0 -4
- package/src/adapters/configuration/__tests__/dotEnv.test.ts +0 -38
- package/src/adapters/configuration/dotEnv.ts +0 -33
- package/src/adapters/configuration/index.ts +0 -1
- package/src/adapters/database/index.ts +0 -1
- package/src/adapters/database/memory/__tests__/memoryDb.test.ts +0 -37
- package/src/adapters/database/memory/index.ts +0 -279
- package/src/adapters/endpoints/addAuthUser/index.ts +0 -55
- package/src/adapters/endpoints/endpointValidation/index.ts +0 -26
- package/src/adapters/endpoints/index.ts +0 -4
- package/src/adapters/endpoints/localAuthorization/index.ts +0 -75
- package/src/adapters/endpoints/tcpConsumer/index.ts +0 -69
- package/src/adapters/endpoints/userSession/index.ts +0 -40
- package/src/adapters/eventstore/database.ts +0 -178
- package/src/adapters/eventstore/index.ts +0 -1
- package/src/adapters/infrastructure/index.ts +0 -1
- package/src/adapters/infrastructure/local/index.ts +0 -40
- package/src/adapters/logger/console.ts +0 -42
- package/src/adapters/logger/index.ts +0 -1
- package/src/index.ts +0 -25
- package/src/libraries/modules/fs.ts +0 -88
- package/src/libraries/modules/index.ts +0 -1
- package/src/libraries/openApi/index.ts +0 -1
- package/src/libraries/openApi/pruneUnusedRef.ts +0 -35
- package/src/libraries/tcp/index.ts +0 -98
- package/src/libraries/tcp/types.ts +0 -43
- package/src/libraries/validation/__tests__/validation.test.ts +0 -25
- package/src/libraries/validation/index.ts +0 -48
- package/src/ports/authentication/index.ts +0 -25
- package/src/ports/base.ts +0 -20
- package/src/ports/cache/index.ts +0 -17
- package/src/ports/configuration/__tests__/configurationPort.test.ts +0 -47
- package/src/ports/configuration/args.ts +0 -39
- package/src/ports/configuration/common.ts +0 -12
- package/src/ports/configuration/index.ts +0 -110
- package/src/ports/configuration/localConfig.ts +0 -117
- package/src/ports/database/index.ts +0 -25
- package/src/ports/endpoints/__tests__/endpointsCall.test.ts +0 -20
- package/src/ports/endpoints/__tests__/test-client-library/base.ts +0 -167
- package/src/ports/endpoints/__tests__/test-client-library/index.ts +0 -23
- package/src/ports/endpoints/__tests__/test-client-library/services/service.ts +0 -181
- package/src/ports/endpoints/__tests__/utils.test.ts +0 -54
- package/src/ports/endpoints/index.ts +0 -272
- package/src/ports/endpoints/openApi.ts +0 -191
- package/src/ports/endpoints/utils.ts +0 -31
- package/src/ports/eventsourcing/__tests__/eventhandlers.test.ts +0 -30
- package/src/ports/eventsourcing/__tests__/invariants.test.ts +0 -213
- package/src/ports/eventsourcing/commandHandlers/index.ts +0 -625
- package/src/ports/eventsourcing/commandTemplates/index.ts +0 -2
- package/src/ports/eventsourcing/commandTemplates/multiStream.ts +0 -70
- package/src/ports/eventsourcing/commandTemplates/snapshot.ts +0 -43
- package/src/ports/eventsourcing/eventHandlers/index.ts +0 -429
- package/src/ports/eventsourcing/index.ts +0 -98
- package/src/ports/eventsourcing/invariants/combinators.ts +0 -25
- package/src/ports/eventsourcing/invariants/common.ts +0 -42
- package/src/ports/eventsourcing/invariants/comparisons.ts +0 -90
- package/src/ports/eventsourcing/invariants/index.ts +0 -4
- package/src/ports/eventsourcing/invariants/stateExistance.ts +0 -34
- package/src/ports/eventsourcing/subscriptions/index.ts +0 -1
- package/src/ports/eventsourcing/subscriptions/sseSubscriptions.ts +0 -103
- package/src/ports/eventsourcing/utils/aggregateBuilder.ts +0 -49
- package/src/ports/eventsourcing/utils/commandBuilder.ts +0 -113
- package/src/ports/eventsourcing/utils/eventHandlerBuilder.ts +0 -22
- package/src/ports/eventsourcing/utils/externalSystemBuilder.ts +0 -42
- package/src/ports/eventsourcing/utils/index.ts +0 -25
- package/src/ports/eventsourcing/utils/policyBuilder.ts +0 -31
- package/src/ports/eventsourcing/utils/readmodelBuilder.ts +0 -52
- package/src/ports/eventstore/index.ts +0 -11
- package/src/ports/infrastructure/__tests__/fixture/index.ts +0 -2
- package/src/ports/infrastructure/__tests__/fixture/infrastructureServices.ts +0 -72
- package/src/ports/infrastructure/__tests__/fixture/structureState.ts +0 -254
- package/src/ports/infrastructure/__tests__/infrastructure.test.ts +0 -11
- package/src/ports/infrastructure/index.ts +0 -162
- package/src/ports/infrastructure/utils.ts +0 -130
- package/src/ports/logger/index.ts +0 -34
- package/src/utils/index.ts +0 -186
- package/tsconfig.json +0 -19
- /package/build/{ports → libraries}/eventsourcing/commandTemplates/index.d.ts +0 -0
- /package/build/{ports → libraries}/eventsourcing/commandTemplates/index.js +0 -0
- /package/build/{ports → libraries}/eventsourcing/subscriptions/index.d.ts +0 -0
- /package/build/{ports → libraries}/eventsourcing/subscriptions/index.js +0 -0
- /package/build/{ports → libraries}/eventsourcing/utils/eventHandlerBuilder.js +0 -0
|
@@ -0,0 +1,695 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.computeMDUs = void 0;
|
|
7
|
+
const modulePath_1 = require("../modulePath");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Union-Find for connected components
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
class UnionFind {
|
|
13
|
+
parent = new Map();
|
|
14
|
+
rank = new Map();
|
|
15
|
+
add(id) {
|
|
16
|
+
if (!this.parent.has(id)) {
|
|
17
|
+
this.parent.set(id, id);
|
|
18
|
+
this.rank.set(id, 0);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
find(id) {
|
|
22
|
+
let current = id;
|
|
23
|
+
while (this.parent.get(current) !== current) {
|
|
24
|
+
const grandparent = this.parent.get(this.parent.get(current));
|
|
25
|
+
this.parent.set(current, grandparent);
|
|
26
|
+
current = grandparent;
|
|
27
|
+
}
|
|
28
|
+
return current;
|
|
29
|
+
}
|
|
30
|
+
union(a, b) {
|
|
31
|
+
const rootA = this.find(a);
|
|
32
|
+
const rootB = this.find(b);
|
|
33
|
+
if (rootA === rootB)
|
|
34
|
+
return;
|
|
35
|
+
const rankA = this.rank.get(rootA);
|
|
36
|
+
const rankB = this.rank.get(rootB);
|
|
37
|
+
if (rankA < rankB) {
|
|
38
|
+
this.parent.set(rootA, rootB);
|
|
39
|
+
}
|
|
40
|
+
else if (rankA > rankB) {
|
|
41
|
+
this.parent.set(rootB, rootA);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.parent.set(rootB, rootA);
|
|
45
|
+
this.rank.set(rootA, rankA + 1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
getComponents() {
|
|
49
|
+
const components = new Map();
|
|
50
|
+
for (const id of this.parent.keys()) {
|
|
51
|
+
const root = this.find(id);
|
|
52
|
+
if (!components.has(root)) {
|
|
53
|
+
components.set(root, []);
|
|
54
|
+
}
|
|
55
|
+
components.get(root).push(id);
|
|
56
|
+
}
|
|
57
|
+
return components;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// Helpers
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
const makeRelativePath = (absolutePath, serviceRoot) => {
|
|
64
|
+
if (!absolutePath)
|
|
65
|
+
return '';
|
|
66
|
+
return path_1.default.relative(serviceRoot, absolutePath).replace(/\\/g, '/');
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Derives the named export from an artifact's registered name.
|
|
70
|
+
* getStackTrace() captures the file-derived name (e.g. "ChartOfAccounts" from
|
|
71
|
+
* chartOfAccounts.aggregate.ts), but the actual export in the file typically
|
|
72
|
+
* includes a type suffix (e.g. "ChartOfAccountsAggregate").
|
|
73
|
+
*
|
|
74
|
+
* If the registered name already ends with the expected suffix, it's returned as-is.
|
|
75
|
+
* Otherwise the suffix is appended.
|
|
76
|
+
*/
|
|
77
|
+
const typeSuffixMap = {
|
|
78
|
+
aggregate: 'Aggregate',
|
|
79
|
+
externalSystem: 'System',
|
|
80
|
+
readmodel: 'Readmodel',
|
|
81
|
+
policy: 'Policy'
|
|
82
|
+
};
|
|
83
|
+
const deriveExportName = (name, type) => {
|
|
84
|
+
const suffix = typeSuffixMap[type];
|
|
85
|
+
if (!suffix)
|
|
86
|
+
return name; // endpoints and unknown types
|
|
87
|
+
// If name already ends with the suffix, return as-is
|
|
88
|
+
if (name.endsWith(suffix))
|
|
89
|
+
return name;
|
|
90
|
+
return `${name}${suffix}`;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* The module a unit is addressed by (`<module>:<Name>` in `--lift`).
|
|
94
|
+
*
|
|
95
|
+
* The filesystem is authoritative: an artifact under `modules/billing/` belongs
|
|
96
|
+
* to billing whatever it declares. The declared subdomain is only a fallback for
|
|
97
|
+
* artifacts that sit outside a module directory, because subdomain answers a
|
|
98
|
+
* different question — it drives route authorization, and billing deliberately
|
|
99
|
+
* declares `.withSubdomain('')` (ADR-026) so its routes carry no `x-subdomain`.
|
|
100
|
+
* Reading the label off the subdomain made all 18 of those units `unknown:` and
|
|
101
|
+
* therefore unaddressable.
|
|
102
|
+
*/
|
|
103
|
+
const deriveModule = (filePath, subdomain) => {
|
|
104
|
+
return (0, modulePath_1.moduleFromPath)(filePath) || subdomain || 'unknown';
|
|
105
|
+
};
|
|
106
|
+
/** `healthSync.endpoints.ts` -> `healthSync`, mirroring `getStackTrace()`'s naming. */
|
|
107
|
+
const fileDerivedName = (filePath) => path_1.default.basename(filePath).replace(/\..+$/, '');
|
|
108
|
+
/**
|
|
109
|
+
* A route's identity: `<METHOD> <route>`, method defaulting to GET exactly as
|
|
110
|
+
* `registerOpenApiEndpoint` does for the same endpoint.
|
|
111
|
+
*
|
|
112
|
+
* This string is the join key. Teselly's manifest-coverage guard builds the
|
|
113
|
+
* other side of the comparison with the identical expression (`routeId` in
|
|
114
|
+
* `scripts/checkManifestCoverage.ts`), and a key that differs by so much as the
|
|
115
|
+
* default verb makes that join half-match in silence.
|
|
116
|
+
*/
|
|
117
|
+
const routeId = (endpoint) => `${(endpoint.method || 'GET').toUpperCase()} ${endpoint.route}`;
|
|
118
|
+
const groupEndpointsByFile = (customEndpoints) => {
|
|
119
|
+
const groups = new Map();
|
|
120
|
+
for (const endpoint of customEndpoints) {
|
|
121
|
+
const group = groups.get(endpoint.filePath) || {
|
|
122
|
+
filePath: endpoint.filePath,
|
|
123
|
+
name: '',
|
|
124
|
+
subdomain: endpoint.subdomain,
|
|
125
|
+
linkedTo: [],
|
|
126
|
+
routes: [],
|
|
127
|
+
endpoints: []
|
|
128
|
+
};
|
|
129
|
+
group.endpoints.push(endpoint);
|
|
130
|
+
// One endpoint's declaration speaks for the whole file — see `linkedTo` on
|
|
131
|
+
// EndpointGroup. Its undeclared siblings ride along into the linked unit.
|
|
132
|
+
for (const target of endpoint.linkedTo || []) {
|
|
133
|
+
if (!group.linkedTo.includes(target))
|
|
134
|
+
group.linkedTo.push(target);
|
|
135
|
+
}
|
|
136
|
+
// Deduplicated by route id, because `registerEndpoint` stores an endpoint
|
|
137
|
+
// under TWO route-table keys when its path has an optional parameter, so a
|
|
138
|
+
// caller reading that table hands the same route in twice.
|
|
139
|
+
//
|
|
140
|
+
// The `route` guard is not for the port path — `route` is required on
|
|
141
|
+
// `ManifestEndpoint`, and `registerEndpoint` would throw on
|
|
142
|
+
// `endpoint.route.match( … )` immediately after the capture anyway, so a
|
|
143
|
+
// route-less endpoint never reaches the route table. It is for the OTHER
|
|
144
|
+
// caller class: one passing `customEndpoints` in directly, from untyped
|
|
145
|
+
// JavaScript (teselly's manifest fixtures do exactly this). Such an entry
|
|
146
|
+
// contributes nothing rather than a `"GET undefined"` line in a committed,
|
|
147
|
+
// drift-watched artifact.
|
|
148
|
+
if (endpoint.route) {
|
|
149
|
+
const id = routeId(endpoint);
|
|
150
|
+
if (!group.routes.includes(id))
|
|
151
|
+
group.routes.push(id);
|
|
152
|
+
}
|
|
153
|
+
groups.set(endpoint.filePath, group);
|
|
154
|
+
}
|
|
155
|
+
for (const group of groups.values()) {
|
|
156
|
+
const [declaringFunction, ...furtherDeclaringFunctions] = [
|
|
157
|
+
...new Set(group.endpoints.map(e => e.exportName).filter((name) => !!name))
|
|
158
|
+
];
|
|
159
|
+
// One declaring function is the shape the loader can honour — it calls that
|
|
160
|
+
// one export. Anything else falls back to the file name and leans on the
|
|
161
|
+
// loader's fuzzy export match.
|
|
162
|
+
group.name = declaringFunction && furtherDeclaringFunctions.length === 0
|
|
163
|
+
? declaringFunction
|
|
164
|
+
: fileDerivedName(group.filePath);
|
|
165
|
+
}
|
|
166
|
+
return [...groups.values()];
|
|
167
|
+
};
|
|
168
|
+
// ---------------------------------------------------------------------------
|
|
169
|
+
// computeMDUs — the main algorithm
|
|
170
|
+
// ---------------------------------------------------------------------------
|
|
171
|
+
const computeMDUs = (registeredEndpoints, serviceName, serviceRoot, customEndpoints) => {
|
|
172
|
+
const nodes = new Map();
|
|
173
|
+
const uf = new UnionFind();
|
|
174
|
+
const validationErrors = [];
|
|
175
|
+
// Node keys are type-prefixed to avoid collisions (e.g., an aggregate and
|
|
176
|
+
// policy can share the same registered name like "LanggraphAgentRunner")
|
|
177
|
+
const nodeKey = (type, name) => `${type}::${name}`;
|
|
178
|
+
// -----------------------------------------------------------------------
|
|
179
|
+
// 1. INITIALIZE nodes
|
|
180
|
+
// -----------------------------------------------------------------------
|
|
181
|
+
// Aggregates
|
|
182
|
+
for (const [name, data] of Object.entries(registeredEndpoints.aggregates)) {
|
|
183
|
+
const module = deriveModule(data.filePath, data.subdomain);
|
|
184
|
+
const key = nodeKey('aggregate', name);
|
|
185
|
+
nodes.set(key, {
|
|
186
|
+
name,
|
|
187
|
+
type: 'aggregate',
|
|
188
|
+
module,
|
|
189
|
+
filePath: data.filePath
|
|
190
|
+
});
|
|
191
|
+
uf.add(key);
|
|
192
|
+
}
|
|
193
|
+
// External systems
|
|
194
|
+
for (const [name, data] of Object.entries(registeredEndpoints.systems)) {
|
|
195
|
+
const module = deriveModule(data.filePath, data.subdomain);
|
|
196
|
+
const key = nodeKey('externalSystem', name);
|
|
197
|
+
nodes.set(key, {
|
|
198
|
+
name,
|
|
199
|
+
type: 'externalSystem',
|
|
200
|
+
module,
|
|
201
|
+
filePath: data.filePath
|
|
202
|
+
});
|
|
203
|
+
uf.add(key);
|
|
204
|
+
}
|
|
205
|
+
// Readmodels — registered under `projectors`, which since TV1-2275 also holds
|
|
206
|
+
// readmodels that project NOTHING. A query-only readmodel (`ReadmodelBuilder(
|
|
207
|
+
// Schema )` with no events namespace) serves a GET route and is therefore a
|
|
208
|
+
// deployment artifact like any other; it simply consumes nothing, so `events` is
|
|
209
|
+
// empty and it joins no component through an event edge. The map keeps the name:
|
|
210
|
+
// renaming it is a pv3-types breaking change across every consumer, for a naming
|
|
211
|
+
// gain.
|
|
212
|
+
for (const [name, data] of Object.entries(registeredEndpoints.projectors)) {
|
|
213
|
+
const module = deriveModule(data.filePath, data.subdomain);
|
|
214
|
+
const key = nodeKey('readmodel', name);
|
|
215
|
+
nodes.set(key, {
|
|
216
|
+
name,
|
|
217
|
+
type: 'readmodel',
|
|
218
|
+
module,
|
|
219
|
+
filePath: data.filePath,
|
|
220
|
+
events: data.events
|
|
221
|
+
});
|
|
222
|
+
uf.add(key);
|
|
223
|
+
}
|
|
224
|
+
// Policies
|
|
225
|
+
for (const [name, data] of Object.entries(registeredEndpoints.policies)) {
|
|
226
|
+
const module = deriveModule(data.filePath, data.subdomain);
|
|
227
|
+
const key = nodeKey('policy', name);
|
|
228
|
+
nodes.set(key, {
|
|
229
|
+
name,
|
|
230
|
+
type: 'policy',
|
|
231
|
+
module,
|
|
232
|
+
filePath: data.filePath,
|
|
233
|
+
commandHandlerName: data.commandHandlerName,
|
|
234
|
+
linkedTo: data.linkedTo,
|
|
235
|
+
isStandalone: data.isStandalone,
|
|
236
|
+
events: data.events
|
|
237
|
+
});
|
|
238
|
+
uf.add(key);
|
|
239
|
+
}
|
|
240
|
+
// The artifact that already owns a file, by path. A readmodel, aggregate,
|
|
241
|
+
// system or policy file may ALSO register manual routes at the top level of
|
|
242
|
+
// its factory (`featureFlags.readmodel.ts` registers two), and V8 then names
|
|
243
|
+
// the frame after that same factory — so a second node for it would carry the
|
|
244
|
+
// same filePath, name AND exportName as the first. Insertion order decides if
|
|
245
|
+
// one file somehow declares two artifacts; that order is the fixed
|
|
246
|
+
// aggregates -> systems -> readmodels -> policies walk above.
|
|
247
|
+
const artifactNodeByFilePath = new Map();
|
|
248
|
+
for (const [key, node] of nodes) {
|
|
249
|
+
if (!artifactNodeByFilePath.has(node.filePath))
|
|
250
|
+
artifactNodeByFilePath.set(node.filePath, key);
|
|
251
|
+
}
|
|
252
|
+
// Manually registered endpoints, one node per declaring file. Keyed by path
|
|
253
|
+
// rather than by name, so two files that derive the same name cannot collide
|
|
254
|
+
// and silently drop one of them.
|
|
255
|
+
const endpointGroups = groupEndpointsByFile(customEndpoints || []);
|
|
256
|
+
/**
|
|
257
|
+
* The node a declaring file resolves to: the artifact that already owns the
|
|
258
|
+
* file when there is one, otherwise the file's own endpoint node.
|
|
259
|
+
*
|
|
260
|
+
* One file is one unit. A file that already owns an artifact is already
|
|
261
|
+
* placed by it, and emitting a second artifact would put that file in two
|
|
262
|
+
* units — two pods requiring it, both running its factory, both registering
|
|
263
|
+
* every route in it. The routes are attached to the owning artifact instead,
|
|
264
|
+
* which keeps the route -> unit join whole.
|
|
265
|
+
*/
|
|
266
|
+
const groupNodeKey = (group) => artifactNodeByFilePath.get(group.filePath) || nodeKey('endpoint', group.filePath);
|
|
267
|
+
for (const group of endpointGroups) {
|
|
268
|
+
const owningKey = artifactNodeByFilePath.get(group.filePath);
|
|
269
|
+
if (owningKey) {
|
|
270
|
+
nodes.get(owningKey).routes = group.routes;
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
const key = nodeKey('endpoint', group.filePath);
|
|
274
|
+
nodes.set(key, {
|
|
275
|
+
name: group.name,
|
|
276
|
+
type: 'endpoint',
|
|
277
|
+
module: deriveModule(group.filePath, group.subdomain),
|
|
278
|
+
filePath: group.filePath,
|
|
279
|
+
linkedTo: group.linkedTo,
|
|
280
|
+
routes: group.routes
|
|
281
|
+
});
|
|
282
|
+
uf.add(key);
|
|
283
|
+
}
|
|
284
|
+
// Every file in a module that declares no target — and owns no other artifact
|
|
285
|
+
// — joins ONE component, which below becomes `<module>:Endpoints`. Per module
|
|
286
|
+
// rather than per file because that id is hand-written into a topology intent
|
|
287
|
+
// and must survive a file rename — a filename-derived unit id makes a rename
|
|
288
|
+
// silently rewrite a persisted deployment identifier (and it is ~13 units
|
|
289
|
+
// instead of ~35).
|
|
290
|
+
const undeclaredEndpointsByModule = new Map();
|
|
291
|
+
for (const group of endpointGroups) {
|
|
292
|
+
if (group.linkedTo.length > 0)
|
|
293
|
+
continue;
|
|
294
|
+
if (artifactNodeByFilePath.has(group.filePath))
|
|
295
|
+
continue;
|
|
296
|
+
const key = nodeKey('endpoint', group.filePath);
|
|
297
|
+
const module = deriveModule(group.filePath, group.subdomain);
|
|
298
|
+
const first = undeclaredEndpointsByModule.get(module);
|
|
299
|
+
if (first === undefined)
|
|
300
|
+
undeclaredEndpointsByModule.set(module, key);
|
|
301
|
+
else
|
|
302
|
+
uf.union(first, key);
|
|
303
|
+
}
|
|
304
|
+
// Build a lookup of command handler names → node keys (aggregates + systems)
|
|
305
|
+
// Supports both file-derived names ("publications") and function-style names ("PublicationsAggregate")
|
|
306
|
+
const commandHandlerByName = new Map(); // registered name → node key
|
|
307
|
+
const commandHandlerNormalizedLookup = new Map(); // normalized → node key
|
|
308
|
+
const normalizeCommandHandlerName = (name) => name.toLowerCase().replace(/aggregate$|system$|externalsystem$/, '');
|
|
309
|
+
for (const [key, node] of nodes) {
|
|
310
|
+
if (node.type === 'aggregate' || node.type === 'externalSystem') {
|
|
311
|
+
commandHandlerByName.set(node.name, key);
|
|
312
|
+
commandHandlerNormalizedLookup.set(normalizeCommandHandlerName(node.name), key);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/** Resolves a command handler reference (name) to its node key */
|
|
316
|
+
const resolveCommandHandler = (ref) => {
|
|
317
|
+
if (commandHandlerByName.has(ref))
|
|
318
|
+
return commandHandlerByName.get(ref);
|
|
319
|
+
return commandHandlerNormalizedLookup.get(normalizeCommandHandlerName(ref));
|
|
320
|
+
};
|
|
321
|
+
// Readmodels, by their registered name. A SECOND map on purpose, read only by
|
|
322
|
+
// `resolveEndpointTarget` below — see there.
|
|
323
|
+
const readmodelByName = new Map();
|
|
324
|
+
for (const [key, node] of nodes) {
|
|
325
|
+
if (node.type === 'readmodel')
|
|
326
|
+
readmodelByName.set(node.name, key);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* The node an ENDPOINT's `linkedTo` entry names — a command handler, or a
|
|
330
|
+
* readmodel, so a route can be pinned to a query pod and not only to a
|
|
331
|
+
* command one.
|
|
332
|
+
*
|
|
333
|
+
* This is deliberately NOT a widening of `resolveCommandHandler`, and the two
|
|
334
|
+
* must not be merged: the same word means different things on the two
|
|
335
|
+
* declarers. A policy's `linkedTo` asserts *"I dispatch commands here"*, which
|
|
336
|
+
* a readmodel cannot receive — one shared lookup would legalise a command
|
|
337
|
+
* aimed at something that can never take it, silently, at generation time. An
|
|
338
|
+
* endpoint's asserts *"serve me where this lives"*, which a query pod honours
|
|
339
|
+
* exactly as well as a command pod.
|
|
340
|
+
*
|
|
341
|
+
* Readmodels match by their REGISTERED NAME ONLY — no suffix-stripping
|
|
342
|
+
* counterpart to `normalizeCommandHandlerName`. That normalization exists so a
|
|
343
|
+
* declaration may name the export (`ItemsAggregate`) where the registration is
|
|
344
|
+
* file-derived (`Items`); every registered readmodel name already ends in
|
|
345
|
+
* `Readmodel`, so the equivalent buys nothing here. A miss is a loud
|
|
346
|
+
* generation error naming the reference, never a silent placement.
|
|
347
|
+
*
|
|
348
|
+
* Command handlers win a tie: a name that resolves as both keeps resolving to
|
|
349
|
+
* the aggregate it already did, so no existing declaration changes meaning.
|
|
350
|
+
*/
|
|
351
|
+
const resolveEndpointTarget = (ref) => resolveCommandHandler(ref) || readmodelByName.get(ref);
|
|
352
|
+
// -----------------------------------------------------------------------
|
|
353
|
+
// 2. BUILD edges (command execution dependencies only)
|
|
354
|
+
// -----------------------------------------------------------------------
|
|
355
|
+
// For each policy: edges from commandHandlerName and linkedTo
|
|
356
|
+
for (const [key, node] of nodes) {
|
|
357
|
+
if (node.type !== 'policy')
|
|
358
|
+
continue;
|
|
359
|
+
const targetKeys = [];
|
|
360
|
+
if (node.commandHandlerName) {
|
|
361
|
+
const resolvedKey = resolveCommandHandler(node.commandHandlerName);
|
|
362
|
+
if (resolvedKey) {
|
|
363
|
+
targetKeys.push(resolvedKey);
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
validationErrors.push(`Policy "${node.name}" references commandHandler "${node.commandHandlerName}" which does not exist in registeredEndpoints.`);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (node.linkedTo) {
|
|
370
|
+
for (const target of node.linkedTo) {
|
|
371
|
+
const resolvedKey = resolveCommandHandler(target);
|
|
372
|
+
if (resolvedKey) {
|
|
373
|
+
targetKeys.push(resolvedKey);
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
validationErrors.push(`Policy "${node.name}" has linkedTo "${target}" which does not exist in registeredEndpoints.`);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
// VALIDATE: every policy must have commandHandlerName, linkedTo, or isStandalone
|
|
381
|
+
if (!node.commandHandlerName && (!node.linkedTo || node.linkedTo.length === 0) && !node.isStandalone) {
|
|
382
|
+
validationErrors.push(`Policy "${node.name}" has no dependency declaration. Use .linkedTo() or .standalone().`);
|
|
383
|
+
}
|
|
384
|
+
// Union the policy with each of its targets
|
|
385
|
+
for (const targetKey of targetKeys) {
|
|
386
|
+
uf.union(key, targetKey);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/** The targets of one endpoint, in declaration order, dropping unresolved ones. */
|
|
390
|
+
const resolveEndpointTargets = (endpoint) => (endpoint.linkedTo || [])
|
|
391
|
+
.map(target => resolveEndpointTarget(target))
|
|
392
|
+
.filter((key) => key !== undefined);
|
|
393
|
+
// For each custom endpoint: edges from linkedTo. Unioned per endpoint rather
|
|
394
|
+
// than per file, because the two cases are not the same declaration: ONE route
|
|
395
|
+
// naming several aggregates deliberately merges them (it writes to all of
|
|
396
|
+
// them), whereas two routes in one file pulling towards different units is an
|
|
397
|
+
// accident of file layout. Merging those silently would fuse two unrelated
|
|
398
|
+
// units, so the per-file check below has to be able to see them apart.
|
|
399
|
+
for (const group of endpointGroups) {
|
|
400
|
+
for (const endpoint of group.endpoints) {
|
|
401
|
+
for (const target of endpoint.linkedTo || []) {
|
|
402
|
+
if (!resolveEndpointTarget(target)) {
|
|
403
|
+
validationErrors.push(`Endpoint "${endpoint.name}" has linkedTo "${target}" which does not exist in registeredEndpoints.`);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
const [firstTarget, ...furtherTargets] = resolveEndpointTargets(endpoint);
|
|
407
|
+
for (const targetKey of furtherTargets) {
|
|
408
|
+
uf.union(firstTarget, targetKey);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
// -----------------------------------------------------------------------
|
|
413
|
+
// Fail fast on validation errors
|
|
414
|
+
// -----------------------------------------------------------------------
|
|
415
|
+
if (validationErrors.length > 0) {
|
|
416
|
+
throw new Error(`[deployment-units] Validation errors:\n${validationErrors.map(e => ` - ${e}`).join('\n')}`);
|
|
417
|
+
}
|
|
418
|
+
// -----------------------------------------------------------------------
|
|
419
|
+
// 2b. One file, one unit — then join the file's artifact to that unit
|
|
420
|
+
// -----------------------------------------------------------------------
|
|
421
|
+
for (const group of endpointGroups) {
|
|
422
|
+
const perEndpointRoots = group.endpoints
|
|
423
|
+
// An endpoint declaring nothing pulls the file nowhere: its file is placed
|
|
424
|
+
// by whatever its siblings declare, or — if none of them declares
|
|
425
|
+
// anything — by its module. Only a declaration can contradict another.
|
|
426
|
+
.filter(endpoint => resolveEndpointTargets(endpoint).length > 0)
|
|
427
|
+
.map(endpoint => {
|
|
428
|
+
// An endpoint's own targets were unioned above, so any one of them names
|
|
429
|
+
// the unit the endpoint resolves to.
|
|
430
|
+
const [firstTarget] = resolveEndpointTargets(endpoint);
|
|
431
|
+
return { endpoint, root: uf.find(firstTarget) };
|
|
432
|
+
});
|
|
433
|
+
if (new Set(perEndpointRoots.map(r => r.root)).size > 1) {
|
|
434
|
+
const declarations = perEndpointRoots
|
|
435
|
+
.map(r => ` - "${r.endpoint.name}" -> ${(r.endpoint.linkedTo || []).join(', ')}`)
|
|
436
|
+
.join('\n');
|
|
437
|
+
throw new Error(`[deployment-units] Endpoints declared in "${makeRelativePath(group.filePath, serviceRoot)}" ` +
|
|
438
|
+
`resolve to different deployment units:\n${declarations}\n` +
|
|
439
|
+
'A declaring file is one deployment artifact, so it can only belong to one unit. ' +
|
|
440
|
+
'Split the file so each unit\'s routes live in their own file.');
|
|
441
|
+
}
|
|
442
|
+
// `groupNodeKey` and not the endpoint key: a file that already owns an
|
|
443
|
+
// artifact has no endpoint node, and its `linkedTo` is a co-location claim
|
|
444
|
+
// made by the file — so it is that artifact which joins the target's unit.
|
|
445
|
+
const key = groupNodeKey(group);
|
|
446
|
+
for (const target of group.linkedTo) {
|
|
447
|
+
const resolvedKey = resolveEndpointTarget(target);
|
|
448
|
+
if (resolvedKey)
|
|
449
|
+
uf.union(key, resolvedKey);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
// -----------------------------------------------------------------------
|
|
453
|
+
// 3. COMPUTE connected components
|
|
454
|
+
// -----------------------------------------------------------------------
|
|
455
|
+
const components = uf.getComponents();
|
|
456
|
+
// -----------------------------------------------------------------------
|
|
457
|
+
// 4. CLASSIFY MDUs and build units
|
|
458
|
+
// -----------------------------------------------------------------------
|
|
459
|
+
const units = {};
|
|
460
|
+
const merges = [];
|
|
461
|
+
const componentInfos = [];
|
|
462
|
+
for (const [, memberNames] of components) {
|
|
463
|
+
const componentNodes = memberNames
|
|
464
|
+
.map(n => nodes.get(n))
|
|
465
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
466
|
+
const hasCommandHandler = componentNodes.some(n => n.type === 'aggregate' || n.type === 'externalSystem');
|
|
467
|
+
const hasOnlyReadmodel = componentNodes.length === 1 && componentNodes[0].type === 'readmodel';
|
|
468
|
+
// Already sorted by name, so `[0]` is the alphabetically first readmodel —
|
|
469
|
+
// the same tie-break `hasCommandHandler` uses to pick among aggregates.
|
|
470
|
+
const readmodelNodes = componentNodes.filter(n => n.type === 'readmodel');
|
|
471
|
+
const isStandalonePolicy = componentNodes.length === 1 && componentNodes[0].type === 'policy' && componentNodes[0].isStandalone;
|
|
472
|
+
const hasOnlyEndpoints = componentNodes.every(n => n.type === 'endpoint');
|
|
473
|
+
let unitType;
|
|
474
|
+
let primaryNode;
|
|
475
|
+
if (hasOnlyReadmodel) {
|
|
476
|
+
unitType = 'readmodel';
|
|
477
|
+
primaryNode = componentNodes[0];
|
|
478
|
+
}
|
|
479
|
+
else if (hasCommandHandler) {
|
|
480
|
+
unitType = 'command-group';
|
|
481
|
+
// Primary is the first aggregate/system alphabetically
|
|
482
|
+
primaryNode = componentNodes.find(n => n.type === 'aggregate' || n.type === 'externalSystem');
|
|
483
|
+
}
|
|
484
|
+
else if (isStandalonePolicy) {
|
|
485
|
+
// Standalone policies become their own MDU as command-group (no aggregate)
|
|
486
|
+
unitType = 'command-group';
|
|
487
|
+
primaryNode = componentNodes[0];
|
|
488
|
+
}
|
|
489
|
+
else if (hasOnlyEndpoints) {
|
|
490
|
+
// A module's undeclared routes. Typed like the standalone policy beside
|
|
491
|
+
// it — a unit with no command handler that must still be liftable and
|
|
492
|
+
// routable — and deliberately NOT `readmodel`: nothing here projects an
|
|
493
|
+
// event, and teselly's topology generator reads this label when it
|
|
494
|
+
// decides what a module wildcard expands to.
|
|
495
|
+
unitType = 'command-group';
|
|
496
|
+
primaryNode = componentNodes[0];
|
|
497
|
+
}
|
|
498
|
+
else if (readmodelNodes.length > 0) {
|
|
499
|
+
// A query pod with routes pinned to it. It stays the READMODEL's unit —
|
|
500
|
+
// `<module>:<Readmodel>` is the id a topology intent already names and
|
|
501
|
+
// `--lift` already selects, and letting the fallthrough pick the
|
|
502
|
+
// alphabetically-first member instead renames that unit after whichever
|
|
503
|
+
// endpoint joined it (`register*` sorts before most readmodel names). A
|
|
504
|
+
// pinned route must not be able to rename the pod it asks to live in.
|
|
505
|
+
unitType = 'readmodel';
|
|
506
|
+
primaryNode = readmodelNodes[0];
|
|
507
|
+
}
|
|
508
|
+
else {
|
|
509
|
+
// Readmodel that ended up grouped (shouldn't happen, but handle gracefully)
|
|
510
|
+
unitType = 'readmodel';
|
|
511
|
+
primaryNode = componentNodes[0];
|
|
512
|
+
}
|
|
513
|
+
const primaryModule = primaryNode.module;
|
|
514
|
+
// `<module>:Endpoints` — stable across a rename of any file in it, unlike
|
|
515
|
+
// the first endpoint's name the fallthrough would otherwise pick.
|
|
516
|
+
const unitKey = hasOnlyEndpoints
|
|
517
|
+
? `${primaryModule}:Endpoints`
|
|
518
|
+
: `${primaryModule}:${primaryNode.name}`;
|
|
519
|
+
// Build artifact entries
|
|
520
|
+
const artifacts = componentNodes.map(node => {
|
|
521
|
+
const entry = {
|
|
522
|
+
name: node.name,
|
|
523
|
+
type: node.type,
|
|
524
|
+
filePath: makeRelativePath(node.filePath, serviceRoot),
|
|
525
|
+
exportName: deriveExportName(node.name, node.type)
|
|
526
|
+
};
|
|
527
|
+
// For policies/endpoints, record what they link to
|
|
528
|
+
if (node.type === 'policy') {
|
|
529
|
+
const targets = [
|
|
530
|
+
...(node.commandHandlerName ? [node.commandHandlerName] : []),
|
|
531
|
+
...(node.linkedTo || [])
|
|
532
|
+
].filter((v, i, a) => a.indexOf(v) === i).sort();
|
|
533
|
+
if (targets.length > 0) {
|
|
534
|
+
entry.linkedTo = targets;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (node.type === 'endpoint' && node.linkedTo && node.linkedTo.length > 0) {
|
|
538
|
+
entry.linkedTo = [...node.linkedTo].sort();
|
|
539
|
+
}
|
|
540
|
+
// Any artifact that manually registers routes, not just endpoint ones: a
|
|
541
|
+
// readmodel file that registers its own routes carries them here, because
|
|
542
|
+
// it is the artifact the loader brings up and therefore the one whose pod
|
|
543
|
+
// serves them.
|
|
544
|
+
//
|
|
545
|
+
// Sorted: `.deployment-units.json` is committed and drift-watched, so a
|
|
546
|
+
// list in declaration order reorders whenever a registration moves and
|
|
547
|
+
// dirties the tree for nothing.
|
|
548
|
+
if (node.routes && node.routes.length > 0) {
|
|
549
|
+
entry.routes = [...node.routes].sort();
|
|
550
|
+
}
|
|
551
|
+
return entry;
|
|
552
|
+
});
|
|
553
|
+
// Sort artifacts: by type priority then by name for determinism
|
|
554
|
+
const typePriority = {
|
|
555
|
+
aggregate: 0,
|
|
556
|
+
externalSystem: 1,
|
|
557
|
+
policy: 2,
|
|
558
|
+
endpoint: 3,
|
|
559
|
+
readmodel: 4
|
|
560
|
+
};
|
|
561
|
+
artifacts.sort((a, b) => {
|
|
562
|
+
const typeDiff = (typePriority[a.type] ?? 99) - (typePriority[b.type] ?? 99);
|
|
563
|
+
if (typeDiff !== 0)
|
|
564
|
+
return typeDiff;
|
|
565
|
+
return a.name.localeCompare(b.name);
|
|
566
|
+
});
|
|
567
|
+
// Collect consumed events (informational)
|
|
568
|
+
const consumes = [];
|
|
569
|
+
for (const node of componentNodes) {
|
|
570
|
+
if (node.events) {
|
|
571
|
+
for (const event of node.events) {
|
|
572
|
+
if (!consumes.includes(event)) {
|
|
573
|
+
consumes.push(event);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
consumes.sort();
|
|
579
|
+
const unit = {
|
|
580
|
+
type: unitType,
|
|
581
|
+
module: primaryModule,
|
|
582
|
+
artifacts
|
|
583
|
+
};
|
|
584
|
+
if (consumes.length > 0) {
|
|
585
|
+
unit.consumes = consumes;
|
|
586
|
+
}
|
|
587
|
+
units[unitKey] = unit;
|
|
588
|
+
componentInfos.push({
|
|
589
|
+
componentNodes,
|
|
590
|
+
unitKey,
|
|
591
|
+
type: unitType
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
// -----------------------------------------------------------------------
|
|
595
|
+
// 5. DETECT cross-module merges
|
|
596
|
+
// -----------------------------------------------------------------------
|
|
597
|
+
for (const info of componentInfos) {
|
|
598
|
+
const modules = new Set(info.componentNodes.map(n => n.module));
|
|
599
|
+
if (modules.size <= 1)
|
|
600
|
+
continue;
|
|
601
|
+
// Find which artifact triggered the cross-module merge
|
|
602
|
+
// This is the artifact that has linkedTo pointing to a different module
|
|
603
|
+
const triggers = [];
|
|
604
|
+
for (const node of info.componentNodes) {
|
|
605
|
+
if (node.type === 'policy' || node.type === 'endpoint') {
|
|
606
|
+
const targetRefs = [
|
|
607
|
+
...(node.commandHandlerName ? [node.commandHandlerName] : []),
|
|
608
|
+
...(node.linkedTo || [])
|
|
609
|
+
];
|
|
610
|
+
for (const ref of targetRefs) {
|
|
611
|
+
// Resolved the way the declarer's own edges were: an endpoint's
|
|
612
|
+
// `linkedTo` may name a readmodel, and reading it back through the
|
|
613
|
+
// narrow lookup leaves a merge THAT ENDPOINT CAUSED attributed to
|
|
614
|
+
// `unknown` — the reason line is the only record of who joined two
|
|
615
|
+
// modules.
|
|
616
|
+
const resolvedKey = node.type === 'endpoint'
|
|
617
|
+
? resolveEndpointTarget(ref)
|
|
618
|
+
: resolveCommandHandler(ref);
|
|
619
|
+
const targetNode = resolvedKey ? nodes.get(resolvedKey) : undefined;
|
|
620
|
+
if (targetNode && targetNode.module !== node.module) {
|
|
621
|
+
triggers.push(node.name);
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
// Determine what individual module units would have existed pre-merge
|
|
628
|
+
const mergedUnitKeys = [];
|
|
629
|
+
for (const mod of [...modules].sort()) {
|
|
630
|
+
const moduleAggregates = info.componentNodes
|
|
631
|
+
.filter(n => n.module === mod && (n.type === 'aggregate' || n.type === 'externalSystem'))
|
|
632
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
633
|
+
if (moduleAggregates.length > 0) {
|
|
634
|
+
mergedUnitKeys.push(`${mod}:${moduleAggregates[0].name}`);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
if (mergedUnitKeys.length > 1) {
|
|
638
|
+
const resultKey = info.unitKey;
|
|
639
|
+
const triggerName = triggers.length > 0 ? triggers.sort()[0] : 'unknown';
|
|
640
|
+
// Find the trigger node by scanning componentNodes (since triggerName is a display name, not a key)
|
|
641
|
+
const triggerNode = info.componentNodes.find(n => n.name === triggerName);
|
|
642
|
+
const reason = triggerNode
|
|
643
|
+
? `${triggerNode.type} "${triggerName}" links to aggregates in modules: ${[...modules].sort().join(', ')}`
|
|
644
|
+
: `Cross-module dependency between modules: ${[...modules].sort().join(', ')}`;
|
|
645
|
+
merges.push({
|
|
646
|
+
reason,
|
|
647
|
+
trigger: triggerName,
|
|
648
|
+
mergedUnits: mergedUnitKeys.sort(),
|
|
649
|
+
resultUnit: resultKey
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
// Sort merges for determinism
|
|
654
|
+
merges.sort((a, b) => a.resultUnit.localeCompare(b.resultUnit));
|
|
655
|
+
// -----------------------------------------------------------------------
|
|
656
|
+
// 6. VALIDATE: every non-standalone policy is in a component with its target
|
|
657
|
+
// -----------------------------------------------------------------------
|
|
658
|
+
for (const [key, node] of nodes) {
|
|
659
|
+
if (node.type !== 'policy')
|
|
660
|
+
continue;
|
|
661
|
+
if (node.isStandalone)
|
|
662
|
+
continue;
|
|
663
|
+
const policyRoot = uf.find(key);
|
|
664
|
+
const targetRefs = [
|
|
665
|
+
...(node.commandHandlerName ? [node.commandHandlerName] : []),
|
|
666
|
+
...(node.linkedTo || [])
|
|
667
|
+
];
|
|
668
|
+
for (const ref of targetRefs) {
|
|
669
|
+
const resolvedKey = resolveCommandHandler(ref);
|
|
670
|
+
if (!resolvedKey)
|
|
671
|
+
continue; // Already reported in earlier validation
|
|
672
|
+
const targetRoot = uf.find(resolvedKey);
|
|
673
|
+
if (policyRoot !== targetRoot) {
|
|
674
|
+
// This should never happen with union-find (union was applied), but guard defensively
|
|
675
|
+
throw new Error(`[deployment-units] Internal error: Policy "${node.name}" is not in the same component as its target "${ref}".`);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
// -----------------------------------------------------------------------
|
|
680
|
+
// Build sorted output
|
|
681
|
+
// -----------------------------------------------------------------------
|
|
682
|
+
const sortedUnits = {};
|
|
683
|
+
for (const key of Object.keys(units).sort()) {
|
|
684
|
+
sortedUnits[key] = units[key];
|
|
685
|
+
}
|
|
686
|
+
return {
|
|
687
|
+
version: '1.0',
|
|
688
|
+
generatedAt: new Date().toISOString(),
|
|
689
|
+
service: serviceName,
|
|
690
|
+
units: sortedUnits,
|
|
691
|
+
merges
|
|
692
|
+
};
|
|
693
|
+
};
|
|
694
|
+
exports.computeMDUs = computeMDUs;
|
|
695
|
+
//# sourceMappingURL=computeMDUs.js.map
|