@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
package/src/ports/base.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PortEmitter, PortEmitterEvents, TypedEventEmitter } from '@bett3r-dev/pv3-types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Factory wrapper to create Ports, Extends the port definition with the PortEmitter Interface.
|
|
5
|
-
* @param port The Port to instanciate.
|
|
6
|
-
*/
|
|
7
|
-
export const createPort = <PORT>( port: PORT ): PORT & PortEmitter => {
|
|
8
|
-
const emitter = new TypedEventEmitter<PortEmitterEvents>();
|
|
9
|
-
emitter.setMaxListeners( 100 );
|
|
10
|
-
const instance = {
|
|
11
|
-
emitter,
|
|
12
|
-
isStarted: false,
|
|
13
|
-
onStarted: ( fn: () => void ) => {
|
|
14
|
-
if ( instance.isStarted ) fn();
|
|
15
|
-
emitter.once( 'started', fn );
|
|
16
|
-
},
|
|
17
|
-
...port
|
|
18
|
-
};
|
|
19
|
-
return instance;
|
|
20
|
-
};
|
package/src/ports/cache/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* Provides the abstraction For Caching data on Memory, Redis, Memcached, etc.
|
|
4
|
-
*/
|
|
5
|
-
import { createPort } from '../base';
|
|
6
|
-
import { CacheAdapter, CachePort } from '@bett3r-dev/pv3-types';
|
|
7
|
-
|
|
8
|
-
export const Cache = ( adapter: CacheAdapter ): CachePort => {
|
|
9
|
-
const cache = createPort( adapter );
|
|
10
|
-
adapter.start()
|
|
11
|
-
.then(() => {
|
|
12
|
-
cache.isStarted = true;
|
|
13
|
-
cache.emitter.emit( 'started' );
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
return cache;
|
|
17
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import S from '@bett3r-dev/jsonschema-definer';
|
|
2
|
-
import { Configuration } from '../index';
|
|
3
|
-
|
|
4
|
-
describe( 'configuration', function() {
|
|
5
|
-
const getAdapter = ( config: any ) => ({
|
|
6
|
-
applyConfig: async () => config,
|
|
7
|
-
name:'test',
|
|
8
|
-
_adapter:() => {},
|
|
9
|
-
start: async () =>{},
|
|
10
|
-
stop:async () => {}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
describe( 'getModuleConfig', function() {
|
|
14
|
-
it( 'returns all the config', async () => {
|
|
15
|
-
const config = { module1:{ prop1: 'prop1' }, module2:{ prop2: 'prop2' }};
|
|
16
|
-
const configuration = await Configuration( getAdapter( config ));
|
|
17
|
-
expect( configuration._getConfig()).toEqual({ module1: { prop1: 'prop1' }, module2: { prop2: 'prop2' }});
|
|
18
|
-
});
|
|
19
|
-
it( 'returns a partial of the configuration object', async () => {
|
|
20
|
-
const config = { module1:{ prop1: 'prop1' }, module2:{ prop2: 'prop2' }};
|
|
21
|
-
const configuration = await Configuration( getAdapter( config ));
|
|
22
|
-
expect( configuration.getModuleConfig( 'module1', S.shape({ prop1: S.string() }))).toEqual({ prop1: 'prop1' });
|
|
23
|
-
expect( configuration.getModuleConfig( 'module2', S.shape({ prop2: S.string() }))).toEqual({ prop2: 'prop2' });
|
|
24
|
-
});
|
|
25
|
-
it( 'throws when module not found', done => {
|
|
26
|
-
const config = { module1:{ prop1: 'prop1' }, module2:{ prop2: 'prop2' }};
|
|
27
|
-
Configuration( getAdapter( config ))
|
|
28
|
-
.then( configuration=>{
|
|
29
|
-
expect( configuration.getModuleConfig( 'module3', S.shape({ prop1: S.string() }))).toThrow( /Configuration not available/ );
|
|
30
|
-
})
|
|
31
|
-
.catch(() => done());
|
|
32
|
-
});
|
|
33
|
-
it( 'returns {} when optional module not found', async () => {
|
|
34
|
-
const config = { module1:{ prop1: 'prop1' }, module2:{ prop2: 'prop2' }};
|
|
35
|
-
const configuration = await Configuration( getAdapter( config ));
|
|
36
|
-
expect( configuration.getModuleConfig( 'module3', S.shape({ prop1: S.string() }).optional())).toEqual({});
|
|
37
|
-
});
|
|
38
|
-
it( 'throws when schema does not match', done => {
|
|
39
|
-
const config = { module1:{ prop1: 'prop1' }, module2:{ prop2: 'prop2' }};
|
|
40
|
-
Configuration( getAdapter( config ))
|
|
41
|
-
.then( configuration=>{
|
|
42
|
-
expect( configuration.getModuleConfig( 'module1', S.shape({ prop2: S.string() }))).toThrow( /should have required property/ );
|
|
43
|
-
})
|
|
44
|
-
.catch(() => done());
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { omit } from 'ramda';
|
|
2
|
-
import yargs from 'yargs';
|
|
3
|
-
import { mergeConfigProperty } from './common';
|
|
4
|
-
|
|
5
|
-
export const getYargs = () => yargs;
|
|
6
|
-
|
|
7
|
-
export const getYargsInit = () =>
|
|
8
|
-
yargs
|
|
9
|
-
.config()
|
|
10
|
-
.usage( 'Usage: $0 [Commands | Options]' )
|
|
11
|
-
.help( 'h' )
|
|
12
|
-
.alias( 'h', 'help' )
|
|
13
|
-
.array( 'modules' )
|
|
14
|
-
.alias( 'modules', 'm' )
|
|
15
|
-
.boolean( 'admin' )
|
|
16
|
-
.alias( 'admin', 's' )
|
|
17
|
-
.boolean( 'infrastructure' )
|
|
18
|
-
.alias( 'infrastructure', 'i' )
|
|
19
|
-
.boolean( 'requestAuthorization' )
|
|
20
|
-
.alias( 'requestAuthorization', 'r' )
|
|
21
|
-
.boolean( 'outbox' )
|
|
22
|
-
.alias( 'outbox', 'o' )
|
|
23
|
-
.describe( 'modules', 'Modules to load' )
|
|
24
|
-
.epilog( `copyright bett3r.dev ${new Date().getFullYear()}` );
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export const formatArgs = async( config:Record<string,any> ) => {
|
|
28
|
-
const y = getYargsInit();
|
|
29
|
-
const args = await y.parseAsync();
|
|
30
|
-
return omit([ 'm', '$0', '_' ], args );
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const applyArgs = async ( config: Record<string, any> = {}) => {
|
|
34
|
-
const args = await formatArgs( config );
|
|
35
|
-
return {
|
|
36
|
-
config: mergeConfigProperty( config, args ),
|
|
37
|
-
args
|
|
38
|
-
};
|
|
39
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export function mergeConfigProperty( configObj:any, newConfig:any ) {
|
|
2
|
-
if ( !newConfig ) return configObj;
|
|
3
|
-
Object.getOwnPropertyNames( newConfig ).forEach(( prop ) => {
|
|
4
|
-
if ( newConfig[prop] && typeof newConfig[prop] === 'object' && !Array.isArray( newConfig[prop])) {
|
|
5
|
-
configObj[prop] = configObj[prop] || {};
|
|
6
|
-
mergeConfigProperty( configObj[prop], newConfig[prop]);
|
|
7
|
-
} else{
|
|
8
|
-
configObj[prop] = newConfig[prop];
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
return configObj;
|
|
12
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { ObjectSchema } from '@bett3r-dev/jsonschema-definer';
|
|
2
|
-
import { CliArgDefinition, CliCommandDefinition, ConfigurationAdapter, ConfigurationPort, ConfigurationPortEmitterEvents, TypedEventEmitter } from '@bett3r-dev/pv3-types';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import R from 'ramda';
|
|
5
|
-
import { Argv } from 'yargs';
|
|
6
|
-
import { validateSchema } from '../../libraries/validation';
|
|
7
|
-
import { createPort } from '../base';
|
|
8
|
-
import { applyArgs, getYargs } from './args';
|
|
9
|
-
import { getLocalConfig, getProjectRootConfig } from './localConfig';
|
|
10
|
-
|
|
11
|
-
declare global {
|
|
12
|
-
namespace globalThis {
|
|
13
|
-
interface global{
|
|
14
|
-
appRoot: string
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const appRoot = process.env.APP_ROOT_DIR || global.appRoot || process.cwd() || path.dirname( require.main?.filename || '' );
|
|
20
|
-
|
|
21
|
-
//*******************************************
|
|
22
|
-
// Public interface
|
|
23
|
-
//*******************************************
|
|
24
|
-
|
|
25
|
-
type AppConfig = Record<string, any>;
|
|
26
|
-
|
|
27
|
-
export const Configuration = ( ...adapters: ConfigurationAdapter[]): Promise<ConfigurationPort> => {
|
|
28
|
-
let _config: AppConfig;
|
|
29
|
-
let _args: Record<string, any> = {};
|
|
30
|
-
|
|
31
|
-
const applyAdapters = ( config: AppConfig ): Promise<AppConfig> => {
|
|
32
|
-
return ( adapters || []).reduce(
|
|
33
|
-
( success, adapter ) => success.then( adapter.applyConfig ), Promise.resolve( config )
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const _getConfig = () : Promise<AppConfig> =>
|
|
38
|
-
_config
|
|
39
|
-
? Promise.resolve( _config )
|
|
40
|
-
: getProjectRootConfig( appRoot )
|
|
41
|
-
.then(( rootConfig ) => getLocalConfig( appRoot, './config', rootConfig ))
|
|
42
|
-
.then( applyAdapters )
|
|
43
|
-
.then( config=> _config = config );
|
|
44
|
-
|
|
45
|
-
const getModuleConfig = <T extends Record<string,any>>( configPath:string, schema: ObjectSchema<T> ) =>{
|
|
46
|
-
const moduleConfig = R.path( configPath.split( '.' ), _config ) as T;
|
|
47
|
-
if ( !moduleConfig ) {
|
|
48
|
-
if ( schema.isRequired )
|
|
49
|
-
throw Error( `Configuration not available for ${configPath}` );
|
|
50
|
-
// return { config: {} as T, onArgsApplied: () => {} };
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
config: validateSchema( schema, true )( moduleConfig || {}),
|
|
54
|
-
onArgsApplied: ( callback: ( config: T ) => void ) => {
|
|
55
|
-
config.emitter.on( 'argsApplied', ({ config }) => {
|
|
56
|
-
callback( R.path( configPath.split( '.' ), config ) as T );
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const applyCLIArgs = async () => {
|
|
63
|
-
const appliedArgs = await applyArgs( _config );
|
|
64
|
-
config.emitter.emit( 'argsApplied', appliedArgs );
|
|
65
|
-
_config = appliedArgs.config;
|
|
66
|
-
_args = appliedArgs.args;
|
|
67
|
-
return config;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const getArgs = async () => {
|
|
71
|
-
await applyCLIArgs();
|
|
72
|
-
return _args;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const configureCliArg = ( options: CliArgDefinition, yargs?: Argv ) => {
|
|
76
|
-
const args = yargs || getYargs();
|
|
77
|
-
args[options['type'] as any]( options['name']);
|
|
78
|
-
options.alias && args.alias( options['name'], options['alias']);
|
|
79
|
-
options.default && args.default( options['name'], options['default']);
|
|
80
|
-
options.description && args.describe( options['name'], options['description']);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const configureCliCommand = ( options: CliCommandDefinition ) => {
|
|
84
|
-
const args = getYargs();
|
|
85
|
-
args.command([ options.name, options.alias || '' ].filter( n => !!n ), options.description || '', ( yargs ) => {
|
|
86
|
-
options.arguments && options.arguments.forEach(( arg ) => {
|
|
87
|
-
yargs.positional( arg.name, arg );
|
|
88
|
-
});
|
|
89
|
-
return yargs;
|
|
90
|
-
}, options.handler );
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const config: ConfigurationPort = createPort({
|
|
94
|
-
_getConfig: () => _config,
|
|
95
|
-
getModules: () => _config.modules,
|
|
96
|
-
getArgs,
|
|
97
|
-
applyArgs: applyCLIArgs,
|
|
98
|
-
getModuleConfig,
|
|
99
|
-
configureCliArg,
|
|
100
|
-
configureCliCommand,
|
|
101
|
-
emitter: new TypedEventEmitter<ConfigurationPortEmitterEvents>()
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
return _getConfig()
|
|
105
|
-
.then(( _config ) => {
|
|
106
|
-
config.isStarted = true;
|
|
107
|
-
config.emitter.emit( 'started' );
|
|
108
|
-
return config;
|
|
109
|
-
});
|
|
110
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import * as glob from 'glob';
|
|
3
|
-
import yaml from 'js-yaml';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { always } from 'ramda';
|
|
6
|
-
import { promisify } from 'util';
|
|
7
|
-
import { mergeConfigProperty } from './common';
|
|
8
|
-
|
|
9
|
-
type LocalConfigOptions = {
|
|
10
|
-
configFolder: string
|
|
11
|
-
configFilePattern: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const environment = process.env.NODE_ENV || 'development';
|
|
15
|
-
|
|
16
|
-
const readFile = promisify( fs.readFile );
|
|
17
|
-
function searchFile( folder: string, pattern: string ) {
|
|
18
|
-
const files = glob.globSync( pattern, { cwd: folder });
|
|
19
|
-
if ( files && files.length && files[0]) return files[0];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const createDefaultConfigFile = ( folder:string ) => ( content: any ) => {
|
|
23
|
-
Promise.resolve();
|
|
24
|
-
return promisify( fs.writeFile )( path.join( folder, 'default.yaml' ), yaml.dump( content, {
|
|
25
|
-
indent: 2,
|
|
26
|
-
sortKeys: true,
|
|
27
|
-
}))
|
|
28
|
-
.then( always( content ));
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
function getFileContent( fileName: string ) {
|
|
32
|
-
if ([ '.js', '.json' ].includes( path.extname( fileName ))) {
|
|
33
|
-
return import( fileName );
|
|
34
|
-
} else if ([ '.yaml', '.yml' ].includes( path.extname( fileName ))) {
|
|
35
|
-
return readFile( fileName, 'utf8' ).then(
|
|
36
|
-
( file ) => yaml.load( file, { json: true })
|
|
37
|
-
);
|
|
38
|
-
} else {
|
|
39
|
-
return Promise.reject(
|
|
40
|
-
Error( `Unkown config file type for file ${fileName}.` )
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const getProjectRootConfig = ( appRoot: string ) => {
|
|
46
|
-
do {
|
|
47
|
-
appRoot = path.dirname( appRoot );
|
|
48
|
-
const rootProjectFolder = path.join( appRoot, '.esas.config.json' );
|
|
49
|
-
if ( fs.existsSync( rootProjectFolder )) {
|
|
50
|
-
return getLocalConfig( appRoot );
|
|
51
|
-
}
|
|
52
|
-
} while ( appRoot !== '/' );
|
|
53
|
-
return Promise.resolve({});
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export function getLocalConfig( appRoot: string, configFolder = './config', initialConfig = {}, forceCreateDefaultConfigFile = false ) {
|
|
57
|
-
const options: LocalConfigOptions = {
|
|
58
|
-
configFolder: path.join( appRoot, configFolder ),
|
|
59
|
-
configFilePattern: '*+(c|C)onfig.+(js|json|yaml|yml)',
|
|
60
|
-
};
|
|
61
|
-
let defaultConfigFile = searchFile(
|
|
62
|
-
options.configFolder,
|
|
63
|
-
'default.+(js|json|yaml|yml)'
|
|
64
|
-
);
|
|
65
|
-
let defaultConfigPromise: Promise<any> = Promise.resolve();
|
|
66
|
-
return (
|
|
67
|
-
!defaultConfigFile && forceCreateDefaultConfigFile
|
|
68
|
-
? defaultConfigPromise
|
|
69
|
-
.then( createDefaultConfigFile( path.join( appRoot, '/config' )))
|
|
70
|
-
:
|
|
71
|
-
defaultConfigPromise
|
|
72
|
-
.then(() => !defaultConfigFile ? {} : getFileContent( path.join( options.configFolder, defaultConfigFile as string )))
|
|
73
|
-
.then(( defaultConfig ) => mergeConfigProperty( initialConfig, defaultConfig ))
|
|
74
|
-
)
|
|
75
|
-
.then( async ( configObj ) => {
|
|
76
|
-
let localConfigFile = searchFile(
|
|
77
|
-
options.configFolder,
|
|
78
|
-
'local.+(js|json|yaml|yml)'
|
|
79
|
-
);
|
|
80
|
-
if ( localConfigFile ) {
|
|
81
|
-
localConfigFile = path.join( options.configFolder, localConfigFile );
|
|
82
|
-
configObj = mergeConfigProperty(
|
|
83
|
-
configObj,
|
|
84
|
-
await getFileContent( localConfigFile )
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
let environmentFileName = searchFile(
|
|
88
|
-
options.configFolder,
|
|
89
|
-
`${environment}.+(js|json|yaml|yml)`
|
|
90
|
-
);
|
|
91
|
-
if ( environmentFileName ) {
|
|
92
|
-
environmentFileName = path.join(
|
|
93
|
-
options.configFolder,
|
|
94
|
-
environmentFileName
|
|
95
|
-
);
|
|
96
|
-
configObj = mergeConfigProperty(
|
|
97
|
-
configObj,
|
|
98
|
-
await getFileContent( environmentFileName )
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
let environmentFileLocalName = searchFile(
|
|
102
|
-
options.configFolder,
|
|
103
|
-
`local-${environment}.+(js|json|yaml|yml)`
|
|
104
|
-
);
|
|
105
|
-
if ( environmentFileLocalName ) {
|
|
106
|
-
environmentFileLocalName = path.join(
|
|
107
|
-
options.configFolder,
|
|
108
|
-
environmentFileLocalName
|
|
109
|
-
);
|
|
110
|
-
configObj = mergeConfigProperty(
|
|
111
|
-
configObj,
|
|
112
|
-
await getFileContent( environmentFileLocalName )
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
return configObj;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { AppError } from '../../utils';
|
|
2
|
-
import { createPort } from '../base';
|
|
3
|
-
import { DatabaseAdapter, DatabasePort } from '@bett3r-dev/pv3-types';
|
|
4
|
-
import S from '@bett3r-dev/jsonschema-definer';
|
|
5
|
-
|
|
6
|
-
export const DuplicatedValueInIndex = () => AppError({
|
|
7
|
-
error: 'NotUniqueError',
|
|
8
|
-
description: 'Duplicated values for Index marked as Unique',
|
|
9
|
-
schema: S.shape({}).additionalProperties( true ),
|
|
10
|
-
type: 'ConflictError',
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export const Database = ( adapter: DatabaseAdapter ): DatabasePort => {
|
|
14
|
-
const database = Object.assign(
|
|
15
|
-
createPort( adapter ),
|
|
16
|
-
{ _adapter: adapter },
|
|
17
|
-
);
|
|
18
|
-
adapter.start()
|
|
19
|
-
.then(() => {
|
|
20
|
-
database.isStarted = true;
|
|
21
|
-
database.emitter.emit( 'started' );
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return database;
|
|
25
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Configuration } from '@bett3r-dev/pv3';
|
|
2
|
-
import { ConfigurationPort } from '@bett3r-dev/pv3-types';
|
|
3
|
-
import { Endpoints } from '../index';
|
|
4
|
-
import { create } from './test-client-library';
|
|
5
|
-
|
|
6
|
-
describe( 'Endpoints', () => {
|
|
7
|
-
let configuration: ConfigurationPort;
|
|
8
|
-
beforeAll( async() => {
|
|
9
|
-
configuration = await Configuration();
|
|
10
|
-
});
|
|
11
|
-
it( 'should be defined', async () => {
|
|
12
|
-
const endpoints = Endpoints({ packageJson:{ name: 'test', version: '3' }, configuration });
|
|
13
|
-
const clientLibrary = create({ baseUrl: '' }, endpoints.fetch );
|
|
14
|
-
const response = await clientLibrary.commands.AssignFlowGroup({
|
|
15
|
-
id: 'asdf',
|
|
16
|
-
body: {},
|
|
17
|
-
query: {}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/** OneOf type helpers */
|
|
2
|
-
export type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
|
|
3
|
-
export type XOR<T, U> = ( T | U ) extends object ? ( Without<T, U> & U ) | ( Without<U, T> & T ) : T | U;
|
|
4
|
-
export type OneOf<T extends any[]> = T extends [infer Only] ? Only : T extends [infer A, infer B, ...infer Rest] ? OneOf<[XOR<A, B>, ...Rest]> : never;
|
|
5
|
-
|
|
6
|
-
export type BackendConfig = {
|
|
7
|
-
baseUrl: string,
|
|
8
|
-
token?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type EventMetadata = {
|
|
12
|
-
causationId?: string | undefined;
|
|
13
|
-
correlationId?: string | undefined;
|
|
14
|
-
user?: any;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type CommittedEvent<Payload = any> = {
|
|
18
|
-
name: string,
|
|
19
|
-
data?: Payload,
|
|
20
|
-
stream: string
|
|
21
|
-
metadata: EventMetadata
|
|
22
|
-
id: number
|
|
23
|
-
timestamp: string
|
|
24
|
-
version: number
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type CommandParams<Body=any> = {
|
|
28
|
-
id: string,
|
|
29
|
-
query?: {
|
|
30
|
-
expectedVersion?: string
|
|
31
|
-
correlationId?: string
|
|
32
|
-
},
|
|
33
|
-
body?: Body
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type CommandExecutionResponse<Model = any, Event = any> = {
|
|
37
|
-
state?: Model,
|
|
38
|
-
events: CommittedEvent<Event>[]
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type ReadModelChange<T = any> = {
|
|
42
|
-
type: 'insert' | 'update' | 'delete',
|
|
43
|
-
data: T
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export type QueryParams<Query=any,Params=any> = {
|
|
47
|
-
// params?: Partial<Params>,
|
|
48
|
-
query?: Partial<Query>
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export type FetchResponse<T = any> = Response & {
|
|
52
|
-
bodyParsed: T
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type Document = {
|
|
56
|
-
id: string | number;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export type QueryFilter<Model extends Document = any> = {
|
|
60
|
-
field: keyof Model;
|
|
61
|
-
op: 'eq' | 'neq' | 'lt' | 'gt' | 'lte' | 'gte' | 'in' | 'nin' | 'contains' | 'notContains' | 'some' | 'every' | 'exists'| 'notExists';
|
|
62
|
-
value: any;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export type QuerySort<Model extends Document = any> = {
|
|
66
|
-
field: keyof Model;
|
|
67
|
-
direction?: 'asc' | 'desc';
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export type ReadModelQueryBase<Model extends Document = any> = {
|
|
71
|
-
access_token?: string;
|
|
72
|
-
apikey?: string;
|
|
73
|
-
limit?: number;
|
|
74
|
-
after?: string | number;
|
|
75
|
-
sort?: QuerySort<Model>[];
|
|
76
|
-
filter?: QueryFilter<Model>[];
|
|
77
|
-
select?: keyof Model | ( keyof Model )[]
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const parseResponseBody = ( type:'json'|'text' ,response: Response, method: 'reject'| 'resolve' ): Promise<void|FetchResponse> =>{
|
|
81
|
-
return response[type]()
|
|
82
|
-
.then(( bodyParsed ) => {
|
|
83
|
-
return Promise[method]( Object.assign( response, {
|
|
84
|
-
bodyParsed
|
|
85
|
-
}) as FetchResponse );
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
export const processFetchResponse = <T = any>( response: Response ): Promise<void|FetchResponse<T>> =>{
|
|
89
|
-
if ( response.ok === true )
|
|
90
|
-
return parseResponseBody( 'json', response, 'resolve' );
|
|
91
|
-
else
|
|
92
|
-
return parseResponseBody( 'json', response, 'reject' );
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const processQueryPropertyMap = {
|
|
96
|
-
filter: ( filter: QueryFilter[], params: URLSearchParams )=>{
|
|
97
|
-
return filter.reduce(( acc, filterItem ) => {
|
|
98
|
-
acc.append( 'filter', `${filterItem.field as string},${filterItem.op},${filterItem.value}` );
|
|
99
|
-
return acc;
|
|
100
|
-
}, params );
|
|
101
|
-
},
|
|
102
|
-
sort: ( sort: QuerySort[], params: URLSearchParams )=>{
|
|
103
|
-
return sort.reduce(( acc, sortItem ) => {
|
|
104
|
-
acc.append( 'sort', `${sortItem.field as string},${sortItem.direction || 'asc'}` );
|
|
105
|
-
return acc;
|
|
106
|
-
}, params );
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export const parseQueryParams = ( query?: Record<string, any> ) =>{
|
|
111
|
-
if ( query && Object.keys( query ).length ){
|
|
112
|
-
return Object.keys( query ).reduce(( acc, key ) => {
|
|
113
|
-
if ([ 'filter', 'sort' ].includes( key )){
|
|
114
|
-
return processQueryPropertyMap[key as keyof typeof processQueryPropertyMap]( query[key], acc );
|
|
115
|
-
} else if ( Array.isArray( query[key])){
|
|
116
|
-
( query[key] as string[]).forEach(( value ) => acc.append( key, value ));
|
|
117
|
-
return acc;
|
|
118
|
-
} else {
|
|
119
|
-
acc.append( key, query[key]);
|
|
120
|
-
}
|
|
121
|
-
return acc;
|
|
122
|
-
}, new URLSearchParams());
|
|
123
|
-
}
|
|
124
|
-
return '';
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export type Requests = ReturnType<typeof requests>;
|
|
128
|
-
export const requests = ( params: BackendConfig, _fetch = fetch ) => {
|
|
129
|
-
const defaultHeaders = {
|
|
130
|
-
'Content-Type': 'application/json',
|
|
131
|
-
'Authorization': `Bearer ${params.token}`
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const post = ( path: string, body?: any, headers: Record<string, string> = {}) => {
|
|
135
|
-
return _fetch( `${params.baseUrl}${path}`, { method: 'post',
|
|
136
|
-
headers: { ...defaultHeaders, ...headers }, ...( body
|
|
137
|
-
? { body: JSON.stringify( body ) }
|
|
138
|
-
: {}),
|
|
139
|
-
})
|
|
140
|
-
.then( processFetchResponse )
|
|
141
|
-
.then(( response: FetchResponse | void ) => { return response?.bodyParsed; });
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const get = ( path: string, headers: Record<string, string> = {}) => {
|
|
145
|
-
return _fetch( `${params.baseUrl}${path}`, { method: 'get',
|
|
146
|
-
headers: { ...defaultHeaders, ...headers }, })
|
|
147
|
-
.then( processFetchResponse )
|
|
148
|
-
.then(( response: FetchResponse | void ) => { return response?.bodyParsed; });
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const subscribe = ( path:string, name: string, onChange: ( change: ReadModelChange )=>void ) => {
|
|
152
|
-
console.log( `Stablishing connection with subscription ${name}...` );
|
|
153
|
-
const source = new EventSource( `${params.baseUrl}${path}` );
|
|
154
|
-
source.addEventListener( 'open', ( e ) => console.log( `Connections to the server established for subscription ${name}` ), false );
|
|
155
|
-
source.onmessage = ( e ) => {
|
|
156
|
-
if ( e.data === 'Connected' ) return;
|
|
157
|
-
onChange( JSON.parse( e.data ));
|
|
158
|
-
};
|
|
159
|
-
return source.close.bind( source );
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
return {
|
|
163
|
-
post,
|
|
164
|
-
get,
|
|
165
|
-
subscribe
|
|
166
|
-
};
|
|
167
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BackendConfig, requests, CommandParams } from './base';
|
|
2
|
-
import * as service from './services/service';
|
|
3
|
-
export * as service from './services/service';
|
|
4
|
-
// TODO: Export service as service
|
|
5
|
-
|
|
6
|
-
export { CommandParams, BackendConfig };
|
|
7
|
-
|
|
8
|
-
export const create = ( params: BackendConfig, fetch?: any ) => {
|
|
9
|
-
const req = requests( params, fetch );
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
commands: {
|
|
13
|
-
...service.commands( req, params ),
|
|
14
|
-
|
|
15
|
-
},queries: {
|
|
16
|
-
...service.queries( req, params ),
|
|
17
|
-
|
|
18
|
-
},subscriptions: {
|
|
19
|
-
...service.subscriptions( req, params ),
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
};
|