@bett3r-dev/pv3 1.0.0 → 1.1.7
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,996 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const computeMDUs_1 = require("./computeMDUs");
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Helper to build minimal registeredEndpoints
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
const emptyEndpoints = () => ({
|
|
8
|
+
aggregates: {},
|
|
9
|
+
systems: {},
|
|
10
|
+
policies: {},
|
|
11
|
+
projectors: {}
|
|
12
|
+
});
|
|
13
|
+
const SERVICE_NAME = 'test-service';
|
|
14
|
+
const SERVICE_ROOT = '/app/services/test-service';
|
|
15
|
+
describe('computeMDUs', () => {
|
|
16
|
+
// -------------------------------------------------------------------------
|
|
17
|
+
// 1. Aggregate with createCommand policy (commandHandlerName) -> same MDU
|
|
18
|
+
// -------------------------------------------------------------------------
|
|
19
|
+
describe('aggregate with createCommand policy', () => {
|
|
20
|
+
it('places them in the same deployment unit', () => {
|
|
21
|
+
const endpoints = emptyEndpoints();
|
|
22
|
+
endpoints.aggregates['FooAggregate'] = {
|
|
23
|
+
getEndpoints: {},
|
|
24
|
+
commands: { CreateFoo: { route: '/foo', events: ['FooCreated'] } },
|
|
25
|
+
filePath: '/app/services/test-service/src/modules/foo/foo.aggregate.ts',
|
|
26
|
+
subdomain: 'foo'
|
|
27
|
+
};
|
|
28
|
+
endpoints.policies['FooCreationPolicy'] = {
|
|
29
|
+
route: '/foo-creation-policy',
|
|
30
|
+
events: ['FooCreated'],
|
|
31
|
+
filePath: '/app/services/test-service/src/modules/foo/fooCreation.policy.ts',
|
|
32
|
+
subdomain: 'foo',
|
|
33
|
+
commandHandlerName: 'FooAggregate'
|
|
34
|
+
};
|
|
35
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT);
|
|
36
|
+
const unitKeys = Object.keys(manifest.units);
|
|
37
|
+
expect(unitKeys).toHaveLength(1);
|
|
38
|
+
const unit = manifest.units[unitKeys[0]];
|
|
39
|
+
expect(unit.type).toBe('command-group');
|
|
40
|
+
expect(unit.artifacts.map(a => a.name).sort()).toEqual(['FooAggregate', 'FooCreationPolicy'].sort());
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
// -------------------------------------------------------------------------
|
|
44
|
+
// 2. Aggregate with linkedTo policy -> same MDU
|
|
45
|
+
// -------------------------------------------------------------------------
|
|
46
|
+
describe('aggregate with linkedTo policy', () => {
|
|
47
|
+
it('places them in the same deployment unit', () => {
|
|
48
|
+
const endpoints = emptyEndpoints();
|
|
49
|
+
endpoints.aggregates['BarAggregate'] = {
|
|
50
|
+
getEndpoints: {},
|
|
51
|
+
commands: { CreateBar: { route: '/bar', events: ['BarCreated'] } },
|
|
52
|
+
filePath: '/app/services/test-service/src/modules/bar/bar.aggregate.ts',
|
|
53
|
+
subdomain: 'bar'
|
|
54
|
+
};
|
|
55
|
+
endpoints.policies['BarSyncPolicy'] = {
|
|
56
|
+
route: '/bar-sync-policy',
|
|
57
|
+
events: ['SomethingHappened'],
|
|
58
|
+
filePath: '/app/services/test-service/src/modules/bar/barSync.policy.ts',
|
|
59
|
+
subdomain: 'bar',
|
|
60
|
+
linkedTo: ['BarAggregate']
|
|
61
|
+
};
|
|
62
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT);
|
|
63
|
+
const unitKeys = Object.keys(manifest.units);
|
|
64
|
+
expect(unitKeys).toHaveLength(1);
|
|
65
|
+
const unit = manifest.units[unitKeys[0]];
|
|
66
|
+
expect(unit.type).toBe('command-group');
|
|
67
|
+
expect(unit.artifacts.map(a => a.name)).toContain('BarAggregate');
|
|
68
|
+
expect(unit.artifacts.map(a => a.name)).toContain('BarSyncPolicy');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
// -------------------------------------------------------------------------
|
|
72
|
+
// 3. Standalone policy -> own MDU
|
|
73
|
+
// -------------------------------------------------------------------------
|
|
74
|
+
describe('standalone policy', () => {
|
|
75
|
+
it('gets its own deployment unit', () => {
|
|
76
|
+
const endpoints = emptyEndpoints();
|
|
77
|
+
endpoints.policies['NotificationPolicy'] = {
|
|
78
|
+
route: '/notification-policy',
|
|
79
|
+
events: ['OrderPlaced'],
|
|
80
|
+
filePath: '/app/services/test-service/src/modules/notifications/notification.policy.ts',
|
|
81
|
+
subdomain: 'notifications',
|
|
82
|
+
isStandalone: true
|
|
83
|
+
};
|
|
84
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT);
|
|
85
|
+
const unitKeys = Object.keys(manifest.units);
|
|
86
|
+
expect(unitKeys).toHaveLength(1);
|
|
87
|
+
const unit = manifest.units[unitKeys[0]];
|
|
88
|
+
expect(unit.type).toBe('command-group');
|
|
89
|
+
expect(unit.artifacts).toHaveLength(1);
|
|
90
|
+
expect(unit.artifacts[0].name).toBe('NotificationPolicy');
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
// -------------------------------------------------------------------------
|
|
94
|
+
// 4. Readmodel (projector) -> independent MDU of type 'readmodel'
|
|
95
|
+
// -------------------------------------------------------------------------
|
|
96
|
+
describe('readmodel projector', () => {
|
|
97
|
+
it('produces an independent readmodel deployment unit', () => {
|
|
98
|
+
const endpoints = emptyEndpoints();
|
|
99
|
+
endpoints.projectors['OrdersReadmodel'] = {
|
|
100
|
+
route: '/orders/:id?',
|
|
101
|
+
events: ['OrderPlaced', 'OrderCancelled'],
|
|
102
|
+
filePath: '/app/services/test-service/src/modules/sales/orders.readmodel.ts',
|
|
103
|
+
subdomain: 'sales'
|
|
104
|
+
};
|
|
105
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT);
|
|
106
|
+
const unitKeys = Object.keys(manifest.units);
|
|
107
|
+
expect(unitKeys).toHaveLength(1);
|
|
108
|
+
const unit = manifest.units[unitKeys[0]];
|
|
109
|
+
expect(unit.type).toBe('readmodel');
|
|
110
|
+
expect(unit.artifacts).toHaveLength(1);
|
|
111
|
+
expect(unit.artifacts[0].name).toBe('OrdersReadmodel');
|
|
112
|
+
expect(unit.consumes).toEqual(['OrderCancelled', 'OrderPlaced']);
|
|
113
|
+
});
|
|
114
|
+
// TV1-2275. A QUERY-ONLY readmodel — one with a query route and no events
|
|
115
|
+
// namespace — is registered as a projector with an empty `events`, and is a
|
|
116
|
+
// deployment artifact like any other: it simply consumes nothing. Before pv3
|
|
117
|
+
// registered it at all, there was no node here, so its GET route had no artifact
|
|
118
|
+
// to ride and belonged to no unit.
|
|
119
|
+
it('produces a unit for a readmodel that subscribes to nothing', () => {
|
|
120
|
+
const endpoints = emptyEndpoints();
|
|
121
|
+
endpoints.projectors['OrderStatusesReadmodel'] = {
|
|
122
|
+
route: '',
|
|
123
|
+
events: [],
|
|
124
|
+
filePath: '/app/services/test-service/src/modules/sales/orderStatuses.readmodel.ts',
|
|
125
|
+
subdomain: 'sales'
|
|
126
|
+
};
|
|
127
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT);
|
|
128
|
+
const unitKeys = Object.keys(manifest.units);
|
|
129
|
+
expect(unitKeys).toEqual(['sales:OrderStatusesReadmodel']);
|
|
130
|
+
const unit = manifest.units['sales:OrderStatusesReadmodel'];
|
|
131
|
+
expect(unit.type).toBe('readmodel');
|
|
132
|
+
expect(unit.artifacts.map(a => a.name)).toEqual(['OrderStatusesReadmodel']);
|
|
133
|
+
// No `consumes` at all, rather than an empty array: the unit subscribes to
|
|
134
|
+
// nothing, which is exactly the shape a topology consumer must tolerate.
|
|
135
|
+
expect(unit.consumes).toBeUndefined();
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
// -------------------------------------------------------------------------
|
|
139
|
+
// 5. Endpoint linking two aggregates -> merges MDUs
|
|
140
|
+
// -------------------------------------------------------------------------
|
|
141
|
+
describe('endpoint linking two aggregates from different modules', () => {
|
|
142
|
+
it('merges them into one command-group', () => {
|
|
143
|
+
const endpoints = emptyEndpoints();
|
|
144
|
+
endpoints.aggregates['AlphaAggregate'] = {
|
|
145
|
+
getEndpoints: {},
|
|
146
|
+
commands: { CreateAlpha: { route: '/alpha', events: ['AlphaCreated'] } },
|
|
147
|
+
filePath: '/app/services/test-service/src/modules/alpha/alpha.aggregate.ts',
|
|
148
|
+
subdomain: 'alpha'
|
|
149
|
+
};
|
|
150
|
+
endpoints.aggregates['BetaAggregate'] = {
|
|
151
|
+
getEndpoints: {},
|
|
152
|
+
commands: { CreateBeta: { route: '/beta', events: ['BetaCreated'] } },
|
|
153
|
+
filePath: '/app/services/test-service/src/modules/beta/beta.aggregate.ts',
|
|
154
|
+
subdomain: 'beta'
|
|
155
|
+
};
|
|
156
|
+
const customEndpoints = [
|
|
157
|
+
{
|
|
158
|
+
name: 'BridgeEndpoint',
|
|
159
|
+
route: '/alpha/bridge',
|
|
160
|
+
method: 'POST',
|
|
161
|
+
filePath: '/app/services/test-service/src/modules/alpha/bridge.endpoint.ts',
|
|
162
|
+
subdomain: 'alpha',
|
|
163
|
+
linkedTo: ['AlphaAggregate', 'BetaAggregate'],
|
|
164
|
+
exportName: 'BridgeEndpoint'
|
|
165
|
+
}
|
|
166
|
+
];
|
|
167
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
168
|
+
const unitKeys = Object.keys(manifest.units);
|
|
169
|
+
expect(unitKeys).toHaveLength(1);
|
|
170
|
+
const unit = manifest.units[unitKeys[0]];
|
|
171
|
+
expect(unit.type).toBe('command-group');
|
|
172
|
+
const artifactNames = unit.artifacts.map(a => a.name);
|
|
173
|
+
expect(artifactNames).toContain('AlphaAggregate');
|
|
174
|
+
expect(artifactNames).toContain('BetaAggregate');
|
|
175
|
+
expect(artifactNames).toContain('BridgeEndpoint');
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
// -------------------------------------------------------------------------
|
|
179
|
+
// 6. Cross-module merge detected in merges[]
|
|
180
|
+
// -------------------------------------------------------------------------
|
|
181
|
+
describe('cross-module merge detection', () => {
|
|
182
|
+
it('populates merges[] with reason when modules are merged', () => {
|
|
183
|
+
const endpoints = emptyEndpoints();
|
|
184
|
+
endpoints.aggregates['AlphaAggregate'] = {
|
|
185
|
+
getEndpoints: {},
|
|
186
|
+
commands: { CreateAlpha: { route: '/alpha', events: ['AlphaCreated'] } },
|
|
187
|
+
filePath: '/app/services/test-service/src/modules/alpha/alpha.aggregate.ts',
|
|
188
|
+
subdomain: 'alpha'
|
|
189
|
+
};
|
|
190
|
+
endpoints.aggregates['BetaAggregate'] = {
|
|
191
|
+
getEndpoints: {},
|
|
192
|
+
commands: { CreateBeta: { route: '/beta', events: ['BetaCreated'] } },
|
|
193
|
+
filePath: '/app/services/test-service/src/modules/beta/beta.aggregate.ts',
|
|
194
|
+
subdomain: 'beta'
|
|
195
|
+
};
|
|
196
|
+
const customEndpoints = [
|
|
197
|
+
{
|
|
198
|
+
name: 'BridgeEndpoint',
|
|
199
|
+
route: '/alpha/bridge',
|
|
200
|
+
method: 'POST',
|
|
201
|
+
filePath: '/app/services/test-service/src/modules/alpha/bridge.endpoint.ts',
|
|
202
|
+
subdomain: 'alpha',
|
|
203
|
+
linkedTo: ['AlphaAggregate', 'BetaAggregate'],
|
|
204
|
+
exportName: 'BridgeEndpoint'
|
|
205
|
+
}
|
|
206
|
+
];
|
|
207
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
208
|
+
expect(manifest.merges.length).toBeGreaterThanOrEqual(1);
|
|
209
|
+
const merge = manifest.merges[0];
|
|
210
|
+
expect(merge.trigger).toBe('BridgeEndpoint');
|
|
211
|
+
expect(merge.mergedUnits).toHaveLength(2);
|
|
212
|
+
expect(merge.mergedUnits).toContain('alpha:AlphaAggregate');
|
|
213
|
+
expect(merge.mergedUnits).toContain('beta:BetaAggregate');
|
|
214
|
+
expect(merge.reason).toContain('alpha');
|
|
215
|
+
expect(merge.reason).toContain('beta');
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
// -------------------------------------------------------------------------
|
|
219
|
+
// 7. Undeclared policy -> build error
|
|
220
|
+
// -------------------------------------------------------------------------
|
|
221
|
+
describe('undeclared policy (no commandHandlerName, linkedTo, or isStandalone)', () => {
|
|
222
|
+
it('throws a validation error', () => {
|
|
223
|
+
const endpoints = emptyEndpoints();
|
|
224
|
+
endpoints.policies['OrphanPolicy'] = {
|
|
225
|
+
route: '/orphan-policy',
|
|
226
|
+
events: ['SomeEvent'],
|
|
227
|
+
filePath: '/app/services/test-service/src/modules/misc/orphan.policy.ts',
|
|
228
|
+
subdomain: 'misc'
|
|
229
|
+
};
|
|
230
|
+
expect(() => (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT)).toThrow(/no dependency declaration/i);
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
// -------------------------------------------------------------------------
|
|
234
|
+
// 8. Deterministic output
|
|
235
|
+
// -------------------------------------------------------------------------
|
|
236
|
+
describe('deterministic output', () => {
|
|
237
|
+
it('produces identical JSON for the same input across multiple runs', () => {
|
|
238
|
+
const endpoints = emptyEndpoints();
|
|
239
|
+
endpoints.aggregates['ZetaAggregate'] = {
|
|
240
|
+
getEndpoints: {},
|
|
241
|
+
commands: { CreateZeta: { route: '/zeta', events: ['ZetaCreated'] } },
|
|
242
|
+
filePath: '/app/services/test-service/src/modules/zeta/zeta.aggregate.ts',
|
|
243
|
+
subdomain: 'zeta'
|
|
244
|
+
};
|
|
245
|
+
endpoints.aggregates['AlfaAggregate'] = {
|
|
246
|
+
getEndpoints: {},
|
|
247
|
+
commands: { CreateAlfa: { route: '/alfa', events: ['AlfaCreated'] } },
|
|
248
|
+
filePath: '/app/services/test-service/src/modules/alfa/alfa.aggregate.ts',
|
|
249
|
+
subdomain: 'alfa'
|
|
250
|
+
};
|
|
251
|
+
endpoints.policies['ZetaSyncPolicy'] = {
|
|
252
|
+
route: '/zeta-sync',
|
|
253
|
+
events: ['AlfaCreated'],
|
|
254
|
+
filePath: '/app/services/test-service/src/modules/zeta/zetaSync.policy.ts',
|
|
255
|
+
subdomain: 'zeta',
|
|
256
|
+
commandHandlerName: 'ZetaAggregate'
|
|
257
|
+
};
|
|
258
|
+
endpoints.projectors['AlfaReadmodel'] = {
|
|
259
|
+
route: '/alfa/:id?',
|
|
260
|
+
events: ['AlfaCreated'],
|
|
261
|
+
filePath: '/app/services/test-service/src/modules/alfa/alfa.readmodel.ts',
|
|
262
|
+
subdomain: 'alfa'
|
|
263
|
+
};
|
|
264
|
+
const result1 = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT);
|
|
265
|
+
const result2 = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT);
|
|
266
|
+
// Exclude generatedAt since it uses new Date()
|
|
267
|
+
const normalize = (m) => {
|
|
268
|
+
const { generatedAt, ...rest } = m;
|
|
269
|
+
return rest;
|
|
270
|
+
};
|
|
271
|
+
expect(JSON.stringify(normalize(result1))).toBe(JSON.stringify(normalize(result2)));
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
// -------------------------------------------------------------------------
|
|
275
|
+
// Additional: manifest metadata
|
|
276
|
+
// -------------------------------------------------------------------------
|
|
277
|
+
describe('manifest metadata', () => {
|
|
278
|
+
it('includes version, service name, and generatedAt', () => {
|
|
279
|
+
const endpoints = emptyEndpoints();
|
|
280
|
+
endpoints.aggregates['SimpleAggregate'] = {
|
|
281
|
+
getEndpoints: {},
|
|
282
|
+
commands: {},
|
|
283
|
+
filePath: '/app/services/test-service/src/modules/simple/simple.aggregate.ts',
|
|
284
|
+
subdomain: 'simple'
|
|
285
|
+
};
|
|
286
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT);
|
|
287
|
+
expect(manifest.version).toBe('1.0');
|
|
288
|
+
expect(manifest.service).toBe(SERVICE_NAME);
|
|
289
|
+
expect(manifest.generatedAt).toBeDefined();
|
|
290
|
+
expect(typeof manifest.generatedAt).toBe('string');
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
// -------------------------------------------------------------------------
|
|
294
|
+
// 9. Module label is derived from the artifact's /modules/<name>/ path
|
|
295
|
+
// -------------------------------------------------------------------------
|
|
296
|
+
describe('module label derivation', () => {
|
|
297
|
+
it('labels an artifact that declares an empty subdomain by its module directory', () => {
|
|
298
|
+
const endpoints = emptyEndpoints();
|
|
299
|
+
// billing declares .withSubdomain('') on purpose (ADR-026) so its routes
|
|
300
|
+
// carry no x-subdomain and the gateway authorizes them through the admin
|
|
301
|
+
// path. The deployment unit must still be addressable as `billing:*`.
|
|
302
|
+
endpoints.aggregates['BillingAccounts'] = {
|
|
303
|
+
getEndpoints: {},
|
|
304
|
+
commands: { RegisterBillingAccount: { route: '/billing-accounts', events: ['BillingAccountRegistered'] } },
|
|
305
|
+
filePath: `${SERVICE_ROOT}/src/modules/billing/billingAccounts/billingAccounts.aggregate.ts`,
|
|
306
|
+
subdomain: ''
|
|
307
|
+
};
|
|
308
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT);
|
|
309
|
+
expect(Object.keys(manifest.units)).toEqual(['billing:BillingAccounts']);
|
|
310
|
+
expect(manifest.units['billing:BillingAccounts'].module).toBe('billing');
|
|
311
|
+
});
|
|
312
|
+
it('derives the module for policies, readmodels and endpoints alike', () => {
|
|
313
|
+
const endpoints = emptyEndpoints();
|
|
314
|
+
endpoints.aggregates['Payments'] = {
|
|
315
|
+
getEndpoints: {},
|
|
316
|
+
commands: { CapturePayment: { route: '/payments', events: ['PaymentCaptured'] } },
|
|
317
|
+
filePath: `${SERVICE_ROOT}/src/modules/billing/payments/payments.aggregate.ts`,
|
|
318
|
+
subdomain: ''
|
|
319
|
+
};
|
|
320
|
+
endpoints.policies['PaymentSettlement'] = {
|
|
321
|
+
route: '/payment-settlement',
|
|
322
|
+
events: ['PaymentCaptured'],
|
|
323
|
+
filePath: `${SERVICE_ROOT}/src/modules/billing/payments/paymentSettlement.policy.ts`,
|
|
324
|
+
subdomain: '',
|
|
325
|
+
commandHandlerName: 'Payments'
|
|
326
|
+
};
|
|
327
|
+
endpoints.projectors['PaymentsReadmodel'] = {
|
|
328
|
+
route: '/payments/:id?',
|
|
329
|
+
events: ['PaymentCaptured'],
|
|
330
|
+
filePath: `${SERVICE_ROOT}/src/modules/billing/payments/payments.readmodel.ts`,
|
|
331
|
+
subdomain: ''
|
|
332
|
+
};
|
|
333
|
+
const customEndpoints = [
|
|
334
|
+
{
|
|
335
|
+
name: 'PaySubscriptionEndpoints',
|
|
336
|
+
route: '/billing/pay-my-subscription',
|
|
337
|
+
method: 'POST',
|
|
338
|
+
filePath: `${SERVICE_ROOT}/src/modules/billing/payments/paySubscription.endpoints.ts`,
|
|
339
|
+
subdomain: '',
|
|
340
|
+
linkedTo: ['Payments'],
|
|
341
|
+
exportName: 'PaySubscriptionEndpoints'
|
|
342
|
+
}
|
|
343
|
+
];
|
|
344
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
345
|
+
expect(Object.keys(manifest.units).sort()).toEqual(['billing:Payments', 'billing:PaymentsReadmodel']);
|
|
346
|
+
expect(manifest.units['billing:Payments'].artifacts.map(a => a.name).sort()).toEqual(['PaySubscriptionEndpoints', 'PaymentSettlement', 'Payments'].sort());
|
|
347
|
+
// Same module directory on every node ⇒ nothing to record as a merge.
|
|
348
|
+
expect(manifest.merges).toEqual([]);
|
|
349
|
+
});
|
|
350
|
+
it('falls back to the declared subdomain when the file sits outside any module directory', () => {
|
|
351
|
+
const endpoints = emptyEndpoints();
|
|
352
|
+
endpoints.projectors['PlatformStatsReadmodel'] = {
|
|
353
|
+
route: '/platform-stats/:id?',
|
|
354
|
+
events: ['StatsRecorded'],
|
|
355
|
+
filePath: `${SERVICE_ROOT}/src/shared/platformStats.readmodel.ts`,
|
|
356
|
+
subdomain: 'platform'
|
|
357
|
+
};
|
|
358
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT);
|
|
359
|
+
expect(Object.keys(manifest.units)).toEqual(['platform:PlatformStatsReadmodel']);
|
|
360
|
+
expect(manifest.units['platform:PlatformStatsReadmodel'].module).toBe('platform');
|
|
361
|
+
});
|
|
362
|
+
it('falls back to "unknown" when neither the path nor the subdomain names a module', () => {
|
|
363
|
+
const endpoints = emptyEndpoints();
|
|
364
|
+
endpoints.projectors['OrphanReadmodel'] = {
|
|
365
|
+
route: '/orphan/:id?',
|
|
366
|
+
events: ['SomethingHappened'],
|
|
367
|
+
filePath: `${SERVICE_ROOT}/src/shared/orphan.readmodel.ts`,
|
|
368
|
+
subdomain: ''
|
|
369
|
+
};
|
|
370
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT);
|
|
371
|
+
expect(Object.keys(manifest.units)).toEqual(['unknown:OrphanReadmodel']);
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
// -------------------------------------------------------------------------
|
|
375
|
+
// Additional: policy referencing non-existent aggregate -> validation error
|
|
376
|
+
// -------------------------------------------------------------------------
|
|
377
|
+
describe('policy referencing non-existent command handler', () => {
|
|
378
|
+
it('throws a validation error', () => {
|
|
379
|
+
const endpoints = emptyEndpoints();
|
|
380
|
+
endpoints.policies['BrokenPolicy'] = {
|
|
381
|
+
route: '/broken-policy',
|
|
382
|
+
events: ['SomeEvent'],
|
|
383
|
+
filePath: '/app/services/test-service/src/modules/misc/broken.policy.ts',
|
|
384
|
+
subdomain: 'misc',
|
|
385
|
+
commandHandlerName: 'NonExistentAggregate'
|
|
386
|
+
};
|
|
387
|
+
expect(() => (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT)).toThrow(/does not exist/i);
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
// -------------------------------------------------------------------------
|
|
391
|
+
// 10. Endpoint artifacts: one per declaring file, joined to their targets
|
|
392
|
+
// -------------------------------------------------------------------------
|
|
393
|
+
describe('endpoint artifacts', () => {
|
|
394
|
+
const itemsAndStock = () => {
|
|
395
|
+
const endpoints = emptyEndpoints();
|
|
396
|
+
endpoints.aggregates['Items'] = {
|
|
397
|
+
getEndpoints: {},
|
|
398
|
+
commands: { RegisterItem: { route: '/items', events: ['ItemRegistered'] } },
|
|
399
|
+
filePath: `${SERVICE_ROOT}/src/modules/items-publishing/items/items.aggregate.ts`,
|
|
400
|
+
subdomain: 'items-publishing'
|
|
401
|
+
};
|
|
402
|
+
endpoints.aggregates['WarehouseStockAvailability'] = {
|
|
403
|
+
getEndpoints: {},
|
|
404
|
+
commands: { SetStock: { route: '/stock', events: ['StockSet'] } },
|
|
405
|
+
filePath: `${SERVICE_ROOT}/src/modules/stock-management/warehouseStockAvailability.aggregate.ts`,
|
|
406
|
+
subdomain: 'stock-management'
|
|
407
|
+
};
|
|
408
|
+
return endpoints;
|
|
409
|
+
};
|
|
410
|
+
it('places an endpoint with a multi-target linkedTo in the unit its targets merge into', () => {
|
|
411
|
+
const endpoints = itemsAndStock();
|
|
412
|
+
// The real shape of createItemWithStock.ts: one route that writes to two
|
|
413
|
+
// aggregates in two modules, so exactly one pod must own both.
|
|
414
|
+
const customEndpoints = [
|
|
415
|
+
{
|
|
416
|
+
name: 'registerCreateItemWithStockEndpoint',
|
|
417
|
+
route: '/items-publishing/items/create-with-stock',
|
|
418
|
+
method: 'POST',
|
|
419
|
+
filePath: `${SERVICE_ROOT}/src/modules/items-publishing/items/createItemWithStock.ts`,
|
|
420
|
+
subdomain: 'items-publishing',
|
|
421
|
+
linkedTo: ['ItemsAggregate', 'WarehouseStockAvailabilityAggregate']
|
|
422
|
+
}
|
|
423
|
+
];
|
|
424
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
425
|
+
// One merged unit, not two — the endpoint is the join.
|
|
426
|
+
expect(Object.keys(manifest.units)).toEqual(['items-publishing:Items']);
|
|
427
|
+
const unit = manifest.units['items-publishing:Items'];
|
|
428
|
+
const endpointArtifacts = unit.artifacts.filter(a => a.type === 'endpoint');
|
|
429
|
+
expect(endpointArtifacts).toHaveLength(1);
|
|
430
|
+
expect(endpointArtifacts[0].linkedTo).toEqual(['ItemsAggregate', 'WarehouseStockAvailabilityAggregate']);
|
|
431
|
+
expect(unit.artifacts.map(a => a.name)).toEqual(expect.arrayContaining(['Items', 'WarehouseStockAvailability']));
|
|
432
|
+
});
|
|
433
|
+
it('collapses every endpoint declared in one file into a single artifact', () => {
|
|
434
|
+
const endpoints = emptyEndpoints();
|
|
435
|
+
endpoints.systems['SystemsIntegrationsInboundMessages'] = {
|
|
436
|
+
getEndpoints: {},
|
|
437
|
+
commands: { Receive: { route: '/inbound', events: ['MessageReceived'] } },
|
|
438
|
+
filePath: `${SERVICE_ROOT}/src/modules/systems-integrations/inboundMessages.system.ts`,
|
|
439
|
+
subdomain: 'systems-integrations'
|
|
440
|
+
};
|
|
441
|
+
// The real shape of systemsIntegrations.endpoints.ts: the GET and the POST
|
|
442
|
+
// webhook are two registrations in one file, declared by one factory.
|
|
443
|
+
const filePath = `${SERVICE_ROOT}/src/modules/systems-integrations/systemsIntegrations.endpoints.ts`;
|
|
444
|
+
const customEndpoints = [
|
|
445
|
+
{
|
|
446
|
+
name: 'Systems Integrations Webhooks (GET)',
|
|
447
|
+
route: '/systems-integrations/webhooks',
|
|
448
|
+
method: 'GET',
|
|
449
|
+
filePath,
|
|
450
|
+
subdomain: 'systems-integrations',
|
|
451
|
+
linkedTo: ['SystemsIntegrationsInboundMessagesSystem']
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
name: 'Systems Integrations Webhooks (POST)',
|
|
455
|
+
route: '/systems-integrations/webhooks',
|
|
456
|
+
method: 'POST',
|
|
457
|
+
filePath,
|
|
458
|
+
subdomain: 'systems-integrations',
|
|
459
|
+
linkedTo: ['SystemsIntegrationsInboundMessagesSystem']
|
|
460
|
+
}
|
|
461
|
+
];
|
|
462
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
463
|
+
const unit = manifest.units['systems-integrations:SystemsIntegrationsInboundMessages'];
|
|
464
|
+
const endpointArtifacts = unit.artifacts.filter(a => a.type === 'endpoint');
|
|
465
|
+
// One file, one artifact — otherwise the loader requires the same file
|
|
466
|
+
// once per route and re-runs every registration in it.
|
|
467
|
+
expect(endpointArtifacts).toHaveLength(1);
|
|
468
|
+
expect(endpointArtifacts[0].filePath).toBe('src/modules/systems-integrations/systemsIntegrations.endpoints.ts');
|
|
469
|
+
expect(endpointArtifacts[0].linkedTo).toEqual(['SystemsIntegrationsInboundMessagesSystem']);
|
|
470
|
+
});
|
|
471
|
+
it('lists every route the declaring file registers, sorted', () => {
|
|
472
|
+
const endpoints = emptyEndpoints();
|
|
473
|
+
endpoints.systems['SystemsIntegrationsInboundMessages'] = {
|
|
474
|
+
getEndpoints: {},
|
|
475
|
+
commands: { Receive: { route: '/inbound', events: ['MessageReceived'] } },
|
|
476
|
+
filePath: `${SERVICE_ROOT}/src/modules/systems-integrations/inboundMessages.system.ts`,
|
|
477
|
+
subdomain: 'systems-integrations'
|
|
478
|
+
};
|
|
479
|
+
// Declared POST-first on purpose: `.deployment-units.json` is committed and
|
|
480
|
+
// drift-watched, so a list that follows declaration order reorders the moment
|
|
481
|
+
// someone moves a registration and dirties the tree for nothing.
|
|
482
|
+
const filePath = `${SERVICE_ROOT}/src/modules/systems-integrations/systemsIntegrations.endpoints.ts`;
|
|
483
|
+
const customEndpoints = [
|
|
484
|
+
{
|
|
485
|
+
name: 'Systems Integrations Webhook',
|
|
486
|
+
route: '/systems-integrations/:connectorId/webhook',
|
|
487
|
+
method: 'POST',
|
|
488
|
+
filePath,
|
|
489
|
+
subdomain: 'systems-integrations',
|
|
490
|
+
linkedTo: ['SystemsIntegrationsInboundMessagesSystem']
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
name: 'Systems Integrations Accessible Channels',
|
|
494
|
+
route: '/systems-integrations-accessible-channels',
|
|
495
|
+
method: 'GET',
|
|
496
|
+
filePath,
|
|
497
|
+
subdomain: 'systems-integrations',
|
|
498
|
+
linkedTo: ['SystemsIntegrationsInboundMessagesSystem']
|
|
499
|
+
}
|
|
500
|
+
];
|
|
501
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
502
|
+
const unit = manifest.units['systems-integrations:SystemsIntegrationsInboundMessages'];
|
|
503
|
+
const [endpointArtifact] = unit.artifacts.filter(a => a.type === 'endpoint');
|
|
504
|
+
// One file is one artifact, so the one artifact carries BOTH registrars'
|
|
505
|
+
// routes — that is exactly what a pod lifting this unit brings up.
|
|
506
|
+
expect(endpointArtifact.routes).toEqual([
|
|
507
|
+
'GET /systems-integrations-accessible-channels',
|
|
508
|
+
'POST /systems-integrations/:connectorId/webhook'
|
|
509
|
+
]);
|
|
510
|
+
});
|
|
511
|
+
it('lists a route registered under an optional path parameter once, per method', () => {
|
|
512
|
+
const endpoints = itemsAndStock();
|
|
513
|
+
const filePath = `${SERVICE_ROOT}/src/modules/items-publishing/items/itemDrafts.endpoints.ts`;
|
|
514
|
+
const declaredIn = {
|
|
515
|
+
filePath,
|
|
516
|
+
subdomain: 'items-publishing',
|
|
517
|
+
linkedTo: ['ItemsAggregate']
|
|
518
|
+
};
|
|
519
|
+
// `registerEndpoint` stores `/x/:id?` under TWO keys (`/x/:id` and `/x`), so a
|
|
520
|
+
// caller reading the route table hands the same route in twice — the first two
|
|
521
|
+
// rows. The POST is the negative control: a same-path sibling on another verb
|
|
522
|
+
// is a DIFFERENT route and must survive the dedup.
|
|
523
|
+
//
|
|
524
|
+
// The method-less row carries a route NO OTHER ROW DECLARES, so the only way
|
|
525
|
+
// `GET /items-publishing/item-drafts-legacy` can appear is the key's GET
|
|
526
|
+
// default. That default is the one component of the join key that can diverge
|
|
527
|
+
// from teselly's `checkManifestCoverage.routeId` with no other symptom, so it
|
|
528
|
+
// needs a row it alone can produce: sharing a path with an explicit verb makes
|
|
529
|
+
// the row inert, since any other default just collapses it into that sibling.
|
|
530
|
+
const customEndpoints = [
|
|
531
|
+
{ name: 'Item Drafts', route: '/items-publishing/item-drafts/:id?', method: 'GET', ...declaredIn },
|
|
532
|
+
{ name: 'Item Drafts', route: '/items-publishing/item-drafts/:id?', method: 'GET', ...declaredIn },
|
|
533
|
+
{ name: 'Save Item Draft', route: '/items-publishing/item-drafts/:id?', method: 'POST', ...declaredIn },
|
|
534
|
+
{ name: 'Item Drafts Legacy', route: '/items-publishing/item-drafts-legacy', ...declaredIn }
|
|
535
|
+
];
|
|
536
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
537
|
+
const [endpointArtifact] = manifest.units['items-publishing:Items'].artifacts
|
|
538
|
+
.filter(a => a.type === 'endpoint');
|
|
539
|
+
expect(endpointArtifact.routes).toEqual([
|
|
540
|
+
'GET /items-publishing/item-drafts-legacy',
|
|
541
|
+
'GET /items-publishing/item-drafts/:id?',
|
|
542
|
+
'POST /items-publishing/item-drafts/:id?'
|
|
543
|
+
]);
|
|
544
|
+
});
|
|
545
|
+
it('throws when one file\'s endpoints resolve to different deployment units', () => {
|
|
546
|
+
const endpoints = itemsAndStock();
|
|
547
|
+
// Two unrelated routes sharing a file. Grouping them would silently merge
|
|
548
|
+
// two units that nothing in the domain says belong together — the file
|
|
549
|
+
// has to be split instead.
|
|
550
|
+
const filePath = `${SERVICE_ROOT}/src/modules/items-publishing/items/mixed.endpoints.ts`;
|
|
551
|
+
const customEndpoints = [
|
|
552
|
+
{
|
|
553
|
+
name: 'Item Conflict Resolution',
|
|
554
|
+
route: '/items-publishing/items/resolve-conflict',
|
|
555
|
+
method: 'POST',
|
|
556
|
+
filePath,
|
|
557
|
+
subdomain: 'items-publishing',
|
|
558
|
+
linkedTo: ['ItemsAggregate']
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: 'Stock Recount',
|
|
562
|
+
route: '/stock-management/recount',
|
|
563
|
+
method: 'POST',
|
|
564
|
+
filePath,
|
|
565
|
+
subdomain: 'items-publishing',
|
|
566
|
+
linkedTo: ['WarehouseStockAvailabilityAggregate']
|
|
567
|
+
}
|
|
568
|
+
];
|
|
569
|
+
expect(() => (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints)).toThrow(/resolve to different deployment units/i);
|
|
570
|
+
});
|
|
571
|
+
});
|
|
572
|
+
// -------------------------------------------------------------------------
|
|
573
|
+
// 11. Undeclared endpoints: one `<module>:Endpoints` unit per module
|
|
574
|
+
// -------------------------------------------------------------------------
|
|
575
|
+
describe('undeclared endpoints', () => {
|
|
576
|
+
const declaredIn = (filePath) => ({ filePath, subdomain: 'systems-integrations' });
|
|
577
|
+
const inboundMessagesSystem = () => {
|
|
578
|
+
const endpoints = emptyEndpoints();
|
|
579
|
+
endpoints.systems['SystemsIntegrationsInboundMessages'] = {
|
|
580
|
+
getEndpoints: {},
|
|
581
|
+
commands: { Receive: { route: '/inbound', events: ['MessageReceived'] } },
|
|
582
|
+
filePath: `${SERVICE_ROOT}/src/modules/systems-integrations/inboundMessages.system.ts`,
|
|
583
|
+
subdomain: 'systems-integrations'
|
|
584
|
+
};
|
|
585
|
+
return endpoints;
|
|
586
|
+
};
|
|
587
|
+
it('joins every undeclared file in a module into one <module>:Endpoints unit', () => {
|
|
588
|
+
const endpoints = inboundMessagesSystem();
|
|
589
|
+
// Three files, no `linkedTo` anywhere: none of them names an aggregate it
|
|
590
|
+
// has to sit with, and none of them should have to invent one.
|
|
591
|
+
const customEndpoints = [
|
|
592
|
+
{
|
|
593
|
+
name: 'registerErpStockImportEndpoints',
|
|
594
|
+
route: '/systems-integrations/erp/stock-import',
|
|
595
|
+
method: 'POST',
|
|
596
|
+
exportName: 'registerErpStockImportEndpoints',
|
|
597
|
+
...declaredIn(`${SERVICE_ROOT}/src/modules/systems-integrations/erpStockImport.endpoints.ts`)
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: 'registerErpPriceImportEndpoints',
|
|
601
|
+
route: '/systems-integrations/erp/price-import',
|
|
602
|
+
method: 'POST',
|
|
603
|
+
exportName: 'registerErpPriceImportEndpoints',
|
|
604
|
+
...declaredIn(`${SERVICE_ROOT}/src/modules/systems-integrations/erpPriceImport.endpoints.ts`)
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
name: 'registerChannelImportPreviewEndpoints',
|
|
608
|
+
route: '/systems-integrations/channel-import-preview',
|
|
609
|
+
method: 'GET',
|
|
610
|
+
exportName: 'registerChannelImportPreviewEndpoints',
|
|
611
|
+
...declaredIn(`${SERVICE_ROOT}/src/modules/systems-integrations/channelImportPreview.endpoints.ts`)
|
|
612
|
+
}
|
|
613
|
+
];
|
|
614
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
615
|
+
// The id is `<module>:Endpoints` — hand-written into topology-intent.yaml
|
|
616
|
+
// and unchanged when any of the three files is renamed. Deriving it from
|
|
617
|
+
// the first endpoint's name would make a rename rewrite a persisted
|
|
618
|
+
// deployment identifier.
|
|
619
|
+
expect(Object.keys(manifest.units).sort()).toEqual([
|
|
620
|
+
'systems-integrations:Endpoints',
|
|
621
|
+
'systems-integrations:SystemsIntegrationsInboundMessages'
|
|
622
|
+
]);
|
|
623
|
+
const unit = manifest.units['systems-integrations:Endpoints'];
|
|
624
|
+
expect(unit.module).toBe('systems-integrations');
|
|
625
|
+
expect(unit.artifacts.map(a => a.filePath).sort()).toEqual([
|
|
626
|
+
'src/modules/systems-integrations/channelImportPreview.endpoints.ts',
|
|
627
|
+
'src/modules/systems-integrations/erpPriceImport.endpoints.ts',
|
|
628
|
+
'src/modules/systems-integrations/erpStockImport.endpoints.ts'
|
|
629
|
+
]);
|
|
630
|
+
expect(unit.artifacts.every(a => a.type === 'endpoint')).toBe(true);
|
|
631
|
+
// One artifact per FILE, not per route: the loader requires each file once
|
|
632
|
+
// and runs its factory once, however many routes it registers.
|
|
633
|
+
expect(unit.artifacts.map(a => a.routes)).toEqual([
|
|
634
|
+
['GET /systems-integrations/channel-import-preview'],
|
|
635
|
+
['POST /systems-integrations/erp/price-import'],
|
|
636
|
+
['POST /systems-integrations/erp/stock-import']
|
|
637
|
+
]);
|
|
638
|
+
});
|
|
639
|
+
it('places a file that declares linkedTo anywhere wholly in its linked unit', () => {
|
|
640
|
+
const endpoints = emptyEndpoints();
|
|
641
|
+
endpoints.aggregates['Items'] = {
|
|
642
|
+
getEndpoints: {},
|
|
643
|
+
commands: { RegisterItem: { route: '/items', events: ['ItemRegistered'] } },
|
|
644
|
+
filePath: `${SERVICE_ROOT}/src/modules/items-publishing/items/items.aggregate.ts`,
|
|
645
|
+
subdomain: 'items-publishing'
|
|
646
|
+
};
|
|
647
|
+
const mixedFile = `${SERVICE_ROOT}/src/modules/items-publishing/items/itemMerge.endpoints.ts`;
|
|
648
|
+
const undeclaredFile = `${SERVICE_ROOT}/src/modules/items-publishing/items/generateSku.ts`;
|
|
649
|
+
const customEndpoints = [
|
|
650
|
+
{
|
|
651
|
+
name: 'Merge Items',
|
|
652
|
+
route: '/items-publishing/items/merge',
|
|
653
|
+
method: 'POST',
|
|
654
|
+
filePath: mixedFile,
|
|
655
|
+
subdomain: 'items-publishing',
|
|
656
|
+
linkedTo: ['ItemsAggregate'],
|
|
657
|
+
exportName: 'registerItemMergeEndpoints'
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
// Same file, no declaration of its own. A file in two units means two
|
|
661
|
+
// pods requiring it and both registering all of its routes.
|
|
662
|
+
name: 'Merge Preview',
|
|
663
|
+
route: '/items-publishing/items/merge-preview',
|
|
664
|
+
method: 'GET',
|
|
665
|
+
filePath: mixedFile,
|
|
666
|
+
subdomain: 'items-publishing',
|
|
667
|
+
exportName: 'registerItemMergeEndpoints'
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
name: 'Generate Sku',
|
|
671
|
+
route: '/items-publishing/items/generate-sku',
|
|
672
|
+
method: 'POST',
|
|
673
|
+
filePath: undeclaredFile,
|
|
674
|
+
subdomain: 'items-publishing',
|
|
675
|
+
exportName: 'registerGenerateSkuEndpoint'
|
|
676
|
+
}
|
|
677
|
+
];
|
|
678
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
679
|
+
const linkedUnit = manifest.units['items-publishing:Items'];
|
|
680
|
+
const [mergeArtifact] = linkedUnit.artifacts.filter(a => a.type === 'endpoint');
|
|
681
|
+
expect(linkedUnit.artifacts.filter(a => a.type === 'endpoint')).toHaveLength(1);
|
|
682
|
+
expect(mergeArtifact.filePath).toBe('src/modules/items-publishing/items/itemMerge.endpoints.ts');
|
|
683
|
+
// The undeclared sibling rides along — one file, one artifact, and the
|
|
684
|
+
// pod that requires it brings up both routes.
|
|
685
|
+
expect(mergeArtifact.routes).toEqual([
|
|
686
|
+
'GET /items-publishing/items/merge-preview',
|
|
687
|
+
'POST /items-publishing/items/merge'
|
|
688
|
+
]);
|
|
689
|
+
// ...and it is NOT also in the Endpoints unit.
|
|
690
|
+
expect(manifest.units['items-publishing:Endpoints'].artifacts.map(a => a.filePath)).toEqual([
|
|
691
|
+
'src/modules/items-publishing/items/generateSku.ts'
|
|
692
|
+
]);
|
|
693
|
+
});
|
|
694
|
+
it('gives a module with nothing but endpoints its own unit', () => {
|
|
695
|
+
const endpoints = emptyEndpoints();
|
|
696
|
+
// dev-utils is the live case: endpoint files and no aggregate, readmodel
|
|
697
|
+
// or policy at all. Without a unit its routes exist in the monolith and
|
|
698
|
+
// in no lifted pod — which is the whole defect this design closes.
|
|
699
|
+
const customEndpoints = [
|
|
700
|
+
{
|
|
701
|
+
name: 'registerEchoAuthHeadersEndpoint',
|
|
702
|
+
route: '/dev-utils/echo-auth-headers',
|
|
703
|
+
method: 'GET',
|
|
704
|
+
filePath: `${SERVICE_ROOT}/src/modules/dev-utils/echo-auth-headers.endpoint.ts`,
|
|
705
|
+
exportName: 'registerEchoAuthHeadersEndpoint'
|
|
706
|
+
}
|
|
707
|
+
];
|
|
708
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
709
|
+
expect(Object.keys(manifest.units)).toEqual(['dev-utils:Endpoints']);
|
|
710
|
+
// Not `readmodel`: nothing here projects an event, and teselly's topology
|
|
711
|
+
// generator reads this label to decide what a module wildcard expands to.
|
|
712
|
+
expect(manifest.units['dev-utils:Endpoints'].type).toBe('command-group');
|
|
713
|
+
expect(manifest.units['dev-utils:Endpoints'].consumes).toBeUndefined();
|
|
714
|
+
});
|
|
715
|
+
it('never pulls an Endpoints unit into a cross-module merge', () => {
|
|
716
|
+
const endpoints = emptyEndpoints();
|
|
717
|
+
endpoints.aggregates['AlphaAggregate'] = {
|
|
718
|
+
getEndpoints: {},
|
|
719
|
+
commands: { CreateAlpha: { route: '/alpha', events: ['AlphaCreated'] } },
|
|
720
|
+
filePath: `${SERVICE_ROOT}/src/modules/alpha/alpha.aggregate.ts`,
|
|
721
|
+
subdomain: 'alpha'
|
|
722
|
+
};
|
|
723
|
+
endpoints.aggregates['BetaAggregate'] = {
|
|
724
|
+
getEndpoints: {},
|
|
725
|
+
commands: { CreateBeta: { route: '/beta', events: ['BetaCreated'] } },
|
|
726
|
+
filePath: `${SERVICE_ROOT}/src/modules/beta/beta.aggregate.ts`,
|
|
727
|
+
subdomain: 'beta'
|
|
728
|
+
};
|
|
729
|
+
const customEndpoints = [
|
|
730
|
+
{
|
|
731
|
+
name: 'BridgeEndpoint',
|
|
732
|
+
route: '/alpha/bridge',
|
|
733
|
+
method: 'POST',
|
|
734
|
+
filePath: `${SERVICE_ROOT}/src/modules/alpha/bridge.endpoint.ts`,
|
|
735
|
+
subdomain: 'alpha',
|
|
736
|
+
linkedTo: ['AlphaAggregate', 'BetaAggregate'],
|
|
737
|
+
exportName: 'BridgeEndpoint'
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
// Same module as the merge trigger, and declares nothing. Being in
|
|
741
|
+
// the module a merge passes through must not drag it in.
|
|
742
|
+
name: 'AlphaStatusEndpoint',
|
|
743
|
+
route: '/alpha/status',
|
|
744
|
+
method: 'GET',
|
|
745
|
+
filePath: `${SERVICE_ROOT}/src/modules/alpha/alphaStatus.endpoints.ts`,
|
|
746
|
+
subdomain: 'alpha',
|
|
747
|
+
exportName: 'registerAlphaStatusEndpoint'
|
|
748
|
+
}
|
|
749
|
+
];
|
|
750
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
751
|
+
expect(Object.keys(manifest.units).sort()).toEqual(['alpha:AlphaAggregate', 'alpha:Endpoints']);
|
|
752
|
+
// Named after the function that registered it, not the route or the file.
|
|
753
|
+
expect(manifest.units['alpha:Endpoints'].artifacts.map(a => a.name)).toEqual(['registerAlphaStatusEndpoint']);
|
|
754
|
+
expect(manifest.merges).toHaveLength(1);
|
|
755
|
+
expect(manifest.merges[0].mergedUnits).toEqual(['alpha:AlphaAggregate', 'beta:BetaAggregate']);
|
|
756
|
+
expect(manifest.merges[0].resultUnit).toBe('alpha:AlphaAggregate');
|
|
757
|
+
});
|
|
758
|
+
it('attaches routes to the artifact that already owns the file, rather than emitting a second one', () => {
|
|
759
|
+
const endpoints = emptyEndpoints();
|
|
760
|
+
// The live shape of `feature-flags/featureFlags.readmodel.ts` (and three
|
|
761
|
+
// more): a projector file that ALSO registers manual routes, declaring
|
|
762
|
+
// nothing. A second artifact for the same file would put that file in two
|
|
763
|
+
// units — two pods requiring it, both running the same factory, both
|
|
764
|
+
// registering `/public-flags`. Two pods serving one route.
|
|
765
|
+
const readmodelFile = `${SERVICE_ROOT}/src/modules/feature-flags/featureFlags.readmodel.ts`;
|
|
766
|
+
endpoints.projectors['FeatureFlagsReadmodel'] = {
|
|
767
|
+
route: '/feature-flags/:id?',
|
|
768
|
+
events: ['FeatureFlagSet'],
|
|
769
|
+
filePath: readmodelFile,
|
|
770
|
+
subdomain: 'feature-flags'
|
|
771
|
+
};
|
|
772
|
+
// The registrations sit at the top level of the exported factory, so V8
|
|
773
|
+
// names the frame after the factory — the endpoint's exportName is the
|
|
774
|
+
// readmodel's own export, which is why a second artifact would collide on
|
|
775
|
+
// name AND exportName AND filePath and still not be deduplicated across
|
|
776
|
+
// two pods.
|
|
777
|
+
const declaredIn = {
|
|
778
|
+
filePath: readmodelFile,
|
|
779
|
+
subdomain: 'feature-flags',
|
|
780
|
+
exportName: 'FeatureFlagsReadmodel'
|
|
781
|
+
};
|
|
782
|
+
const customEndpoints = [
|
|
783
|
+
{ name: 'FeatureFlagsReadmodel', route: '/public-flags', method: 'GET', ...declaredIn },
|
|
784
|
+
{ name: 'FeatureFlagsReadmodel', route: '/feature-flags-by-key', method: 'GET', ...declaredIn },
|
|
785
|
+
// A genuine endpoint-only file in the same module: absorbing the
|
|
786
|
+
// readmodel's routes must not also swallow this one.
|
|
787
|
+
{
|
|
788
|
+
name: 'registerFeatureFlagSeedEndpoint',
|
|
789
|
+
route: '/feature-flags/seed',
|
|
790
|
+
method: 'POST',
|
|
791
|
+
filePath: `${SERVICE_ROOT}/src/modules/feature-flags/featureFlagSeed.ts`,
|
|
792
|
+
subdomain: 'feature-flags',
|
|
793
|
+
exportName: 'registerFeatureFlagSeedEndpoint'
|
|
794
|
+
}
|
|
795
|
+
];
|
|
796
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
797
|
+
expect(Object.keys(manifest.units).sort()).toEqual([
|
|
798
|
+
'feature-flags:Endpoints',
|
|
799
|
+
'feature-flags:FeatureFlagsReadmodel'
|
|
800
|
+
]);
|
|
801
|
+
// EXACTLY ONE unit claims the file. This is the assertion the whole case
|
|
802
|
+
// exists for: a second claimant is a second pod requiring the same file
|
|
803
|
+
// and re-registering every route in it.
|
|
804
|
+
const claimants = Object.entries(manifest.units).filter(([, unit]) => unit.artifacts.some(a => a.filePath === 'src/modules/feature-flags/featureFlags.readmodel.ts'));
|
|
805
|
+
expect(claimants.map(([key]) => key)).toEqual(['feature-flags:FeatureFlagsReadmodel']);
|
|
806
|
+
// One file, one artifact — the readmodel's own, now carrying the routes it
|
|
807
|
+
// registers so a route -> unit lookup still finds them.
|
|
808
|
+
const readmodelUnit = manifest.units['feature-flags:FeatureFlagsReadmodel'];
|
|
809
|
+
expect(readmodelUnit.artifacts).toHaveLength(1);
|
|
810
|
+
expect(readmodelUnit.artifacts[0].type).toBe('readmodel');
|
|
811
|
+
expect(readmodelUnit.artifacts[0].routes).toEqual([
|
|
812
|
+
'GET /feature-flags-by-key',
|
|
813
|
+
'GET /public-flags'
|
|
814
|
+
]);
|
|
815
|
+
// Still a plain readmodel unit: one artifact, of type readmodel.
|
|
816
|
+
expect(readmodelUnit.type).toBe('readmodel');
|
|
817
|
+
// The endpoint-only file keeps its own unit.
|
|
818
|
+
expect(manifest.units['feature-flags:Endpoints'].artifacts.map(a => a.filePath)).toEqual([
|
|
819
|
+
'src/modules/feature-flags/featureFlagSeed.ts'
|
|
820
|
+
]);
|
|
821
|
+
});
|
|
822
|
+
it('leaves an endpoint artifact unnameable by another artifact\'s linkedTo', () => {
|
|
823
|
+
const endpoints = inboundMessagesSystem();
|
|
824
|
+
// The command-handler lookup indexes aggregates and external systems.
|
|
825
|
+
// Nothing else may join an Endpoints group, so nothing else may name one
|
|
826
|
+
// — widening that lookup (readmodels are next) must not reach endpoints.
|
|
827
|
+
endpoints.policies['ErpImportRetryPolicy'] = {
|
|
828
|
+
route: '/erp-import-retry-policy',
|
|
829
|
+
events: ['ErpImportFailed'],
|
|
830
|
+
filePath: `${SERVICE_ROOT}/src/modules/systems-integrations/erpImportRetry.policy.ts`,
|
|
831
|
+
subdomain: 'systems-integrations',
|
|
832
|
+
linkedTo: ['registerErpStockImportEndpoints']
|
|
833
|
+
};
|
|
834
|
+
const customEndpoints = [
|
|
835
|
+
{
|
|
836
|
+
name: 'registerErpStockImportEndpoints',
|
|
837
|
+
route: '/systems-integrations/erp/stock-import',
|
|
838
|
+
method: 'POST',
|
|
839
|
+
exportName: 'registerErpStockImportEndpoints',
|
|
840
|
+
...declaredIn(`${SERVICE_ROOT}/src/modules/systems-integrations/erpStockImport.endpoints.ts`)
|
|
841
|
+
}
|
|
842
|
+
];
|
|
843
|
+
expect(() => (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints)).toThrow(/linkedTo "registerErpStockImportEndpoints" which does not exist/i);
|
|
844
|
+
});
|
|
845
|
+
});
|
|
846
|
+
// -------------------------------------------------------------------------
|
|
847
|
+
// 12. An endpoint pinned to a query pod
|
|
848
|
+
// -------------------------------------------------------------------------
|
|
849
|
+
describe('endpoint linked to a readmodel', () => {
|
|
850
|
+
const warehousesReadmodel = () => {
|
|
851
|
+
const endpoints = emptyEndpoints();
|
|
852
|
+
endpoints.projectors['WarehousesReadmodel'] = {
|
|
853
|
+
route: '/stock-management/warehouses/:id?',
|
|
854
|
+
events: ['WarehouseCreated', 'WarehouseEdited'],
|
|
855
|
+
filePath: `${SERVICE_ROOT}/src/modules/stock-management/warehouses.readmodel.ts`,
|
|
856
|
+
subdomain: 'stock-management'
|
|
857
|
+
};
|
|
858
|
+
return endpoints;
|
|
859
|
+
};
|
|
860
|
+
// The registrar is named so it sorts BEFORE the readmodel
|
|
861
|
+
// (`registerStockReportEndpoint` < `WarehousesReadmodel` under
|
|
862
|
+
// `localeCompare`), which is what the `register*` convention produces for
|
|
863
|
+
// most readmodel names. The unit key is therefore the readmodel's only
|
|
864
|
+
// because a readmodel is chosen as the component's primary — with the
|
|
865
|
+
// alphabetical fallthrough the same fixture keys the unit
|
|
866
|
+
// `stock-management:registerStockReportEndpoint`, and `--lift
|
|
867
|
+
// 'stock-management:WarehousesReadmodel'` no longer names the pod its own
|
|
868
|
+
// readmodel is in.
|
|
869
|
+
const stockReportEndpoint = (linkedTo) => ({
|
|
870
|
+
name: 'Stock Report',
|
|
871
|
+
route: '/stock-management/stock-report',
|
|
872
|
+
method: 'GET',
|
|
873
|
+
filePath: `${SERVICE_ROOT}/src/modules/stock-management/stockReport.endpoints.ts`,
|
|
874
|
+
subdomain: 'stock-management',
|
|
875
|
+
linkedTo,
|
|
876
|
+
exportName: 'registerStockReportEndpoint'
|
|
877
|
+
});
|
|
878
|
+
it('places the endpoint in that readmodel\'s unit, not its module\'s Endpoints unit', () => {
|
|
879
|
+
const endpoints = warehousesReadmodel();
|
|
880
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, [stockReportEndpoint(['WarehousesReadmodel'])]);
|
|
881
|
+
// ONE unit. A second (`stock-management:Endpoints`) means the pin did
|
|
882
|
+
// nothing and the route rides its module's block after all — the wall
|
|
883
|
+
// this escape hatch exists to open.
|
|
884
|
+
expect(Object.keys(manifest.units)).toEqual(['stock-management:WarehousesReadmodel']);
|
|
885
|
+
const unit = manifest.units['stock-management:WarehousesReadmodel'];
|
|
886
|
+
expect(unit.type).toBe('readmodel');
|
|
887
|
+
expect(unit.module).toBe('stock-management');
|
|
888
|
+
expect(unit.artifacts.map(a => `${a.type}:${a.name}`)).toEqual([
|
|
889
|
+
'endpoint:registerStockReportEndpoint',
|
|
890
|
+
'readmodel:WarehousesReadmodel'
|
|
891
|
+
]);
|
|
892
|
+
const [endpointArtifact] = unit.artifacts.filter(a => a.type === 'endpoint');
|
|
893
|
+
expect(endpointArtifact.linkedTo).toEqual(['WarehousesReadmodel']);
|
|
894
|
+
expect(endpointArtifact.routes).toEqual(['GET /stock-management/stock-report']);
|
|
895
|
+
// The pod is still the projector's: it subscribes to exactly what the
|
|
896
|
+
// readmodel did before an endpoint joined it.
|
|
897
|
+
expect(unit.consumes).toEqual(['WarehouseCreated', 'WarehouseEdited']);
|
|
898
|
+
});
|
|
899
|
+
it('still refuses the same name from a POLICY, with the same error', () => {
|
|
900
|
+
const endpoints = warehousesReadmodel();
|
|
901
|
+
// Same readmodel, same manifest, two declarers, opposite outcomes. A
|
|
902
|
+
// policy's `linkedTo` asserts "I dispatch commands here" — a readmodel
|
|
903
|
+
// cannot receive a command — so widening the ENDPOINT lookup must leave
|
|
904
|
+
// this one narrow. The endpoint beside it resolves, which is what rules
|
|
905
|
+
// out an implementation that widens by teaching the shared command-handler
|
|
906
|
+
// lookup about readmodels the first time an endpoint names one.
|
|
907
|
+
endpoints.policies['WarehouseRebalancePolicy'] = {
|
|
908
|
+
route: '/warehouse-rebalance-policy',
|
|
909
|
+
events: ['StockMoved'],
|
|
910
|
+
filePath: `${SERVICE_ROOT}/src/modules/stock-management/warehouseRebalance.policy.ts`,
|
|
911
|
+
subdomain: 'stock-management',
|
|
912
|
+
linkedTo: ['WarehousesReadmodel']
|
|
913
|
+
};
|
|
914
|
+
expect(() => (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, [stockReportEndpoint(['WarehousesReadmodel'])])).toThrow(/Policy "WarehouseRebalancePolicy" has linkedTo "WarehousesReadmodel" which does not exist in registeredEndpoints/);
|
|
915
|
+
});
|
|
916
|
+
it('stops at readmodels — an endpoint still cannot name another endpoint', () => {
|
|
917
|
+
const endpoints = warehousesReadmodel();
|
|
918
|
+
// The sibling control one describe up pins that a POLICY cannot name an
|
|
919
|
+
// endpoint, and it catches a widening made in the shared command-handler
|
|
920
|
+
// lookup. It does NOT catch one made in the endpoint resolver, which is
|
|
921
|
+
// the lookup this slice touched — so the same absence needs pinning from
|
|
922
|
+
// the endpoint side too. An Endpoints group is a module's block of
|
|
923
|
+
// unowned routes; a route that could name one would drag that whole block
|
|
924
|
+
// into someone else's unit.
|
|
925
|
+
const customEndpoints = [
|
|
926
|
+
stockReportEndpoint(['WarehousesReadmodel']),
|
|
927
|
+
{
|
|
928
|
+
name: 'Stock Report Export',
|
|
929
|
+
route: '/stock-management/stock-report/export',
|
|
930
|
+
method: 'GET',
|
|
931
|
+
filePath: `${SERVICE_ROOT}/src/modules/stock-management/stockReportExport.endpoints.ts`,
|
|
932
|
+
subdomain: 'stock-management',
|
|
933
|
+
linkedTo: ['registerStockReportEndpoint'],
|
|
934
|
+
exportName: 'registerStockReportExportEndpoint'
|
|
935
|
+
}
|
|
936
|
+
];
|
|
937
|
+
expect(() => (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints)).toThrow(/Endpoint "Stock Report Export" has linkedTo "registerStockReportEndpoint" which does not exist in registeredEndpoints/);
|
|
938
|
+
});
|
|
939
|
+
it('names the endpoint that reached across modules for a readmodel in the merge record', () => {
|
|
940
|
+
const endpoints = emptyEndpoints();
|
|
941
|
+
endpoints.aggregates['Items'] = {
|
|
942
|
+
getEndpoints: {},
|
|
943
|
+
commands: { RegisterItem: { route: '/items', events: ['ItemRegistered'] } },
|
|
944
|
+
filePath: `${SERVICE_ROOT}/src/modules/items-publishing/items/items.aggregate.ts`,
|
|
945
|
+
subdomain: 'items-publishing'
|
|
946
|
+
};
|
|
947
|
+
endpoints.aggregates['WarehouseStockAvailability'] = {
|
|
948
|
+
getEndpoints: {},
|
|
949
|
+
commands: { SetStock: { route: '/stock', events: ['StockSet'] } },
|
|
950
|
+
filePath: `${SERVICE_ROOT}/src/modules/stock-management/warehouseStockAvailability.aggregate.ts`,
|
|
951
|
+
subdomain: 'stock-management'
|
|
952
|
+
};
|
|
953
|
+
endpoints.projectors['WarehousesReadmodel'] = {
|
|
954
|
+
route: '/stock-management/warehouses/:id?',
|
|
955
|
+
events: ['WarehouseCreated'],
|
|
956
|
+
filePath: `${SERVICE_ROOT}/src/modules/stock-management/warehouses.readmodel.ts`,
|
|
957
|
+
subdomain: 'stock-management'
|
|
958
|
+
};
|
|
959
|
+
// Two aggregates in two modules, merged only THROUGH the readmodel both
|
|
960
|
+
// endpoints name. The items-publishing one is the sole cross-module
|
|
961
|
+
// reacher, and its only cross-module reference is the readmodel — so a
|
|
962
|
+
// merge-record trigger resolved with the narrow command-handler lookup
|
|
963
|
+
// reads `unknown` and blames nobody for a merge that has an author.
|
|
964
|
+
const customEndpoints = [
|
|
965
|
+
{
|
|
966
|
+
name: 'Item Stock Summary',
|
|
967
|
+
route: '/items-publishing/items/stock-summary',
|
|
968
|
+
method: 'GET',
|
|
969
|
+
filePath: `${SERVICE_ROOT}/src/modules/items-publishing/items/itemStockSummary.endpoints.ts`,
|
|
970
|
+
subdomain: 'items-publishing',
|
|
971
|
+
linkedTo: ['ItemsAggregate', 'WarehousesReadmodel'],
|
|
972
|
+
exportName: 'registerItemStockSummaryEndpoint'
|
|
973
|
+
},
|
|
974
|
+
{
|
|
975
|
+
name: 'Warehouse Report',
|
|
976
|
+
route: '/stock-management/warehouse-report',
|
|
977
|
+
method: 'GET',
|
|
978
|
+
filePath: `${SERVICE_ROOT}/src/modules/stock-management/warehouseReport.endpoints.ts`,
|
|
979
|
+
subdomain: 'stock-management',
|
|
980
|
+
linkedTo: ['WarehouseStockAvailabilityAggregate', 'WarehousesReadmodel'],
|
|
981
|
+
exportName: 'registerWarehouseReportEndpoint'
|
|
982
|
+
}
|
|
983
|
+
];
|
|
984
|
+
const manifest = (0, computeMDUs_1.computeMDUs)(endpoints, SERVICE_NAME, SERVICE_ROOT, customEndpoints);
|
|
985
|
+
expect(Object.keys(manifest.units)).toEqual(['items-publishing:Items']);
|
|
986
|
+
expect(manifest.merges).toHaveLength(1);
|
|
987
|
+
expect(manifest.merges[0].mergedUnits).toEqual([
|
|
988
|
+
'items-publishing:Items',
|
|
989
|
+
'stock-management:WarehouseStockAvailability'
|
|
990
|
+
]);
|
|
991
|
+
expect(manifest.merges[0].trigger).toBe('registerItemStockSummaryEndpoint');
|
|
992
|
+
expect(manifest.merges[0].reason).toBe('endpoint "registerItemStockSummaryEndpoint" links to aggregates in modules: items-publishing, stock-management');
|
|
993
|
+
});
|
|
994
|
+
});
|
|
995
|
+
});
|
|
996
|
+
//# sourceMappingURL=computeMDUs.test.js.map
|