@mojaloop/sdk-scheme-adapter 12.0.1 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +619 -0
- package/.env.example +13 -0
- package/CHANGELOG.md +29 -0
- package/CODEOWNERS +2 -0
- package/Dockerfile +35 -0
- package/LICENSE.md +10 -0
- package/PROXY.md +84 -0
- package/README.md +228 -0
- package/SECURITY.md +18 -0
- package/audit-resolve.json +20 -0
- package/docker/ml-testing-toolkit/secrets/keygen.sh +5 -0
- package/docker/ml-testing-toolkit/secrets/privatekey.pem +27 -0
- package/docker/ml-testing-toolkit/secrets/publickey.cer +21 -0
- package/docker/ml-testing-toolkit/secrets/tls/createSecrets.sh +29 -0
- package/docker/ml-testing-toolkit/secrets/tls/hub_client.csr +28 -0
- package/docker/ml-testing-toolkit/secrets/tls/hub_client_cacert.pem +32 -0
- package/docker/ml-testing-toolkit/secrets/tls/hub_client_cakey.key +51 -0
- package/docker/ml-testing-toolkit/secrets/tls/hub_client_key.key +51 -0
- package/docker/ml-testing-toolkit/secrets/tls/hub_server.csr +28 -0
- package/docker/ml-testing-toolkit/secrets/tls/hub_server_cacert.pem +32 -0
- package/docker/ml-testing-toolkit/secrets/tls/hub_server_cacert.srl +1 -0
- package/docker/ml-testing-toolkit/secrets/tls/hub_server_cakey.key +51 -0
- package/docker/ml-testing-toolkit/secrets/tls/hub_server_cert.pem +33 -0
- package/docker/ml-testing-toolkit/secrets/tls/hub_server_key.key +51 -0
- package/docker/ml-testing-toolkit/secrets/tls/openssl.conf +17 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/central_admin_9.3/api_spec.yaml +2450 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/central_admin_9.3/response_map.json +96 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/api_spec.yaml +4187 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/callback_map.json +542 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/mockRef.json +83 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.0/trigger_templates/transaction_request_followup.json +125 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/api_spec.yaml +3703 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/callback_map.json +568 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/mockRef.json +83 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/fspiop_1.1/trigger_templates/transaction_request_followup.json +125 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/settlements_1.0/api_spec.yaml +983 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/settlements_1.0/mockRef.json +38 -0
- package/docker/ml-testing-toolkit/spec_files/api_definitions/settlements_1.0/response_map.json +34 -0
- package/docker/ml-testing-toolkit/spec_files/reports/templates/newman/html_template.html +1074 -0
- package/docker/ml-testing-toolkit/spec_files/reports/templates/newman/pdf_template.html +765 -0
- package/docker/ml-testing-toolkit/spec_files/reports/templates/newman/script.js +98 -0
- package/docker/ml-testing-toolkit/spec_files/rules_callback/config.json +3 -0
- package/docker/ml-testing-toolkit/spec_files/rules_callback/default.json +426 -0
- package/docker/ml-testing-toolkit/spec_files/rules_response/config.json +3 -0
- package/docker/ml-testing-toolkit/spec_files/rules_response/default.json +1623 -0
- package/docker/ml-testing-toolkit/spec_files/rules_response/default_pisp_rules.json +161 -0
- package/docker/ml-testing-toolkit/spec_files/rules_validation/config.json +3 -0
- package/docker/ml-testing-toolkit/spec_files/rules_validation/default.json +672 -0
- package/docker/ml-testing-toolkit/spec_files/system_config.json +62 -0
- package/docker/ml-testing-toolkit/spec_files/user_config.json +45 -0
- package/docker/wait4/setup_hosts_file.sh +25 -0
- package/docker/wait4/wait4.config.js +71 -0
- package/docker/wait4/wait4.js +204 -0
- package/docker-compose.yml +67 -0
- package/docs/Mojaloop - Modusbox Onboarding functionality.pdf +0 -0
- package/docs/dfspInboundApi.yaml +1091 -0
- package/jest.config.js +4 -1
- package/package.json +13 -8
- package/secrets/jwsSigningKey.key +27 -0
- package/secrets/jwsVerificationKeys/mojaloop-sdk.pem +9 -0
- package/secrets/jwsVerificationKeys/switch.pem +9 -0
- package/sequences.puml +99 -0
- package/src/ControlAgent/index.js +221 -0
- package/{TestServer → src/ControlServer}/handlers.js +0 -0
- package/src/ControlServer/index.js +294 -0
- package/{InboundServer → src/InboundServer}/api.yaml +0 -0
- package/src/InboundServer/api_template.yaml +69 -0
- package/{InboundServer → src/InboundServer}/handlers.js +0 -0
- package/{InboundServer → src/InboundServer}/index.js +33 -1
- package/{InboundServer → src/InboundServer}/middlewares.js +0 -0
- package/{OAuthTestServer → src/OAuthTestServer}/index.js +0 -0
- package/{OAuthTestServer → src/OAuthTestServer}/model.js +0 -0
- package/{OutboundServer → src/OutboundServer}/api.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_interfaces/index.d.ts +0 -0
- package/{OutboundServer → src/OutboundServer}/api_interfaces/openapi.d.ts +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/bulkQuoteId.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/bulkTransferId.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/requestToPayTransactionId.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/components/parameters/transferId.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/accountsCreationCompleted.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/accountsCreationError.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/accountsCreationTimeout.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteBadRequest.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteServerError.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteSuccess.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkQuoteTimeout.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferBadRequest.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferServerError.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferSuccess.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/bulkTransferTimeout.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/partiesByIdError404.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/partiesByIdSuccess.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/quotesPostSuccess.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/quotesServerError.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/requestToPaySuccess.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/requestToPayTransferBadRequest.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/requestToPayTransferSuccess.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/simpleTransfersPostSuccess.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/simpleTransfersServerError.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferBadRequest.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferServerError.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferSuccess.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/responses/transferTimeout.yaml +0 -0
- package/src/OutboundServer/api_template/components/schemas/accountCreationStatus.yaml +18 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/accountsCreationState.yaml +0 -0
- package/src/OutboundServer/api_template/components/schemas/accountsRequest.yaml +20 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/accountsResponse.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/async2SyncCurrentState.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteErrorResponse.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteRequest.yaml +2 -2
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteResponse.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteStatus.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkQuoteStatusResponse.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferErrorResponse.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferRequest.yaml +2 -2
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferResponse.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferStatus.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/bulkTransferStatusResponse.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorAccountsResponse.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorQuotesResponse.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorResponse.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorSimpleTransfersResponse.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/errorTransferResponse.yaml +0 -0
- package/src/OutboundServer/api_template/components/schemas/extensionListEmptiable.yaml +6 -0
- package/src/OutboundServer/api_template/components/schemas/individualQuote.yaml +32 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/individualQuoteResult.yaml +5 -5
- package/src/OutboundServer/api_template/components/schemas/individualTransfer.yaml +32 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/individualTransferFulfilment.yaml +2 -2
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/individualTransferResult.yaml +6 -6
- package/src/OutboundServer/api_template/components/schemas/mojaloopError.yaml +5 -0
- package/src/OutboundServer/api_template/components/schemas/mojaloopTransactionRequestState.yaml +2 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/partiesByIdResponse.yaml +1 -1
- package/src/OutboundServer/api_template/components/schemas/quote.yaml +3 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/quoteError.yaml +0 -0
- package/src/OutboundServer/api_template/components/schemas/quotesPostRequest.yaml +13 -0
- package/src/OutboundServer/api_template/components/schemas/quotesPostResponse.yaml +48 -0
- package/src/OutboundServer/api_template/components/schemas/requestToPayRequest.yaml +39 -0
- package/src/OutboundServer/api_template/components/schemas/requestToPayResponse.yaml +41 -0
- package/src/OutboundServer/api_template/components/schemas/requestToPayTransferRequest.yaml +42 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/requestToPayTransferResponse.yaml +6 -6
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/simpleTransferServerError.yaml +0 -0
- package/src/OutboundServer/api_template/components/schemas/simpleTransfersPostRequest.yaml +12 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/simpleTransfersPostResponse.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transactionType.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferContinuationAcceptOTP.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferContinuationAcceptParty.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferContinuationAcceptQuote.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferError.yaml +0 -0
- package/src/OutboundServer/api_template/components/schemas/transferFulfilment.yaml +3 -0
- package/src/OutboundServer/api_template/components/schemas/transferParty.yaml +40 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferRequest.yaml +4 -4
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferResponse.yaml +6 -6
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferStatus.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/components/schemas/transferStatusResponse.yaml +1 -1
- package/{OutboundServer → src/OutboundServer}/api_template/health.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/openapi.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/accounts.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkQuotes.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkQuotes_bulkQuoteId.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkTransfers.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkTransfers_bulkTransferId.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/parties_Type_ID.yaml +2 -2
- package/{OutboundServer → src/OutboundServer}/api_template/paths/parties_Type_ID_SubId.yaml +3 -3
- package/{OutboundServer → src/OutboundServer}/api_template/paths/quotes.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/requestToPay.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/requestToPayTransfer.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/requestToPayTransfer_requestToPayTransactionId.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/simpleTransfers.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/transfers.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/api_template/paths/transfers_transferId.yaml +0 -0
- package/{OutboundServer → src/OutboundServer}/handlers.js +0 -0
- package/{OutboundServer → src/OutboundServer}/index.js +15 -0
- package/{OutboundServer → src/OutboundServer}/middlewares.js +0 -0
- package/{TestServer → src/TestServer}/api.yaml +0 -0
- package/src/TestServer/handlers.js +63 -0
- package/{TestServer → src/TestServer}/index.js +31 -0
- package/{config.js → src/config.js} +6 -0
- package/{index.d.ts → src/index.d.ts} +0 -0
- package/{index.js → src/index.js} +0 -0
- package/{lib → src/lib}/api/index.js +0 -0
- package/{lib → src/lib}/cache.js +0 -0
- package/{lib → src/lib}/check.js +0 -0
- package/{lib → src/lib}/model/AccountsModel.js +0 -0
- package/{lib → src/lib}/model/Async2SyncModel.js +0 -0
- package/{lib → src/lib}/model/InboundTransfersModel.js +0 -0
- package/{lib → src/lib}/model/OutboundBulkQuotesModel.js +3 -3
- package/{lib → src/lib}/model/OutboundBulkTransfersModel.js +1 -1
- package/{lib → src/lib}/model/OutboundRequestToPayModel.js +1 -1
- package/{lib → src/lib}/model/OutboundRequestToPayTransferModel.js +9 -9
- package/{lib → src/lib}/model/OutboundTransfersModel.js +1 -1
- package/{lib → src/lib}/model/PartiesModel.js +0 -0
- package/{lib → src/lib}/model/ProxyModel/MatchRules/Expression.js +0 -0
- package/{lib → src/lib}/model/ProxyModel/MatchRules/Headers.js +0 -0
- package/{lib → src/lib}/model/ProxyModel/MatchRules/MatchRule.js +0 -0
- package/{lib → src/lib}/model/ProxyModel/MatchRules/Path.js +0 -0
- package/{lib → src/lib}/model/ProxyModel/MatchRules/Query.js +0 -0
- package/{lib → src/lib}/model/ProxyModel/MatchRules/index.js +0 -0
- package/{lib → src/lib}/model/ProxyModel/Route.js +0 -0
- package/{lib → src/lib}/model/ProxyModel/configSchema.json +0 -0
- package/{lib → src/lib}/model/ProxyModel/index.js +0 -0
- package/{lib → src/lib}/model/QuotesModel.js +0 -0
- package/{lib → src/lib}/model/TransfersModel.js +0 -0
- package/{lib → src/lib}/model/common/BackendError.js +0 -0
- package/{lib → src/lib}/model/common/PersistentStateMachine.js +0 -0
- package/{lib → src/lib}/model/common/index.js +0 -0
- package/{lib → src/lib}/model/index.js +0 -0
- package/{lib → src/lib}/model/lib/deferredJob.js +0 -0
- package/{lib → src/lib}/model/lib/index.js +0 -0
- package/{lib → src/lib}/model/lib/requests/backendRequests.js +0 -0
- package/{lib → src/lib}/model/lib/requests/common.js +0 -0
- package/{lib → src/lib}/model/lib/requests/index.js +0 -0
- package/{lib → src/lib}/model/lib/shared.js +6 -5
- package/{lib → src/lib}/randomphrase/index.js +0 -0
- package/{lib → src/lib}/randomphrase/words.json +0 -0
- package/{lib → src/lib}/router.js +0 -0
- package/{lib → src/lib}/validate.js +0 -0
- package/test/config/integration.env +9 -0
- package/test/integration/lib/cache.test.js +3 -3
- package/test/unit/ControlClient.test.js +113 -0
- package/test/unit/ControlServer/events.js +41 -0
- package/test/unit/ControlServer/index.js +231 -0
- package/test/unit/ControlServer.test.js +126 -0
- package/test/unit/InboundServer.test.js +4 -4
- package/test/unit/TestServer.test.js +5 -5
- package/test/unit/api/utils.js +5 -5
- package/test/unit/config.test.js +10 -9
- package/test/unit/inboundApi/handlers.test.js +6 -6
- package/test/unit/index.test.js +2 -1
- package/test/unit/lib/cache.test.js +1 -1
- package/test/unit/lib/model/AccountsModel.test.js +2 -2
- package/test/unit/lib/model/InboundTransfersModel.test.js +5 -5
- package/test/unit/lib/model/OutboundBulkQuotesModel.test.js +2 -2
- package/test/unit/lib/model/OutboundBulkTransfersModel.test.js +2 -2
- package/test/unit/lib/model/OutboundRequestToPayModel.test.js +3 -3
- package/test/unit/lib/model/OutboundRequestToPayTransferModel.test.js +2 -2
- package/test/unit/lib/model/OutboundTransfersModel.test.js +36 -3
- package/test/unit/lib/model/PartiesModel.test.js +28 -28
- package/test/unit/lib/model/QuotesModel.test.js +31 -31
- package/test/unit/lib/model/TransfersModel.test.js +3 -3
- package/test/unit/lib/model/common/PersistentStateMachine.test.js +13 -13
- package/test/unit/lib/model/mockedLibRequests.js +1 -1
- package/test/unit/outboundApi/handlers.test.js +3 -3
- package/.eslintignore +0 -2
- package/InboundServer/api_template.yaml +0 -69
- package/OutboundServer/api_template/components/schemas/accountCreationStatus.yaml +0 -18
- package/OutboundServer/api_template/components/schemas/accountsRequest.yaml +0 -20
- package/OutboundServer/api_template/components/schemas/extensionListEmptiable.yaml +0 -6
- package/OutboundServer/api_template/components/schemas/individualQuote.yaml +0 -32
- package/OutboundServer/api_template/components/schemas/individualTransfer.yaml +0 -32
- package/OutboundServer/api_template/components/schemas/mojaloopError.yaml +0 -5
- package/OutboundServer/api_template/components/schemas/mojaloopTransactionRequestState.yaml +0 -2
- package/OutboundServer/api_template/components/schemas/quote.yaml +0 -3
- package/OutboundServer/api_template/components/schemas/quotesPostRequest.yaml +0 -13
- package/OutboundServer/api_template/components/schemas/quotesPostResponse.yaml +0 -48
- package/OutboundServer/api_template/components/schemas/requestToPayRequest.yaml +0 -39
- package/OutboundServer/api_template/components/schemas/requestToPayResponse.yaml +0 -41
- package/OutboundServer/api_template/components/schemas/requestToPayTransferRequest.yaml +0 -42
- package/OutboundServer/api_template/components/schemas/simpleTransfersPostRequest.yaml +0 -12
- package/OutboundServer/api_template/components/schemas/transferFulfilment.yaml +0 -3
- package/OutboundServer/api_template/components/schemas/transferParty.yaml +0 -40
|
File without changes
|
|
File without changes
|
package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkQuotes_bulkQuoteId.yaml
RENAMED
|
File without changes
|
|
File without changes
|
package/{OutboundServer → src/OutboundServer}/api_template/paths/bulkTransfers_bulkTransferId.yaml
RENAMED
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
parameters:
|
|
2
2
|
- $ref: >-
|
|
3
|
-
|
|
3
|
+
../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/Type.yaml
|
|
4
4
|
- $ref: >-
|
|
5
|
-
|
|
5
|
+
../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/ID.yaml
|
|
6
6
|
get:
|
|
7
7
|
description: >-
|
|
8
8
|
The HTTP request GET /parties// (or GET /parties///) is used to lookup
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
parameters:
|
|
2
2
|
- $ref: >-
|
|
3
|
-
|
|
3
|
+
../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/Type.yaml
|
|
4
4
|
- $ref: >-
|
|
5
|
-
|
|
5
|
+
../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/ID.yaml
|
|
6
6
|
- $ref: >-
|
|
7
|
-
|
|
7
|
+
../../../../node_modules/@mojaloop/api-snippets/fspiop/v1_1/openapi3/components/parameters/SubId.yaml
|
|
8
8
|
get:
|
|
9
9
|
description: >-
|
|
10
10
|
The HTTP request GET /parties// (or GET /parties///) is used to lookup
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -132,6 +132,21 @@ class OutboundServer extends EventEmitter {
|
|
|
132
132
|
}
|
|
133
133
|
this._logger.log('Shut down complete');
|
|
134
134
|
}
|
|
135
|
+
|
|
136
|
+
async reconfigure(conf, logger, cache, metricsClient) {
|
|
137
|
+
const newApi = new OutboundApi(conf, logger, cache, this._validator, metricsClient);
|
|
138
|
+
await newApi.start();
|
|
139
|
+
return () => {
|
|
140
|
+
this._logger = logger;
|
|
141
|
+
this._cache = cache;
|
|
142
|
+
this._server.removeAllListeners('request');
|
|
143
|
+
this._server.on('request', newApi.callback());
|
|
144
|
+
this._api.stop();
|
|
145
|
+
this._api = newApi;
|
|
146
|
+
this._conf = conf;
|
|
147
|
+
this._logger.log('restarted');
|
|
148
|
+
};
|
|
149
|
+
}
|
|
135
150
|
}
|
|
136
151
|
|
|
137
152
|
module.exports = OutboundServer;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**************************************************************************
|
|
2
|
+
* (C) Copyright ModusBox Inc. 2019 - All rights reserved. *
|
|
3
|
+
* *
|
|
4
|
+
* This file is made available under the terms of the license agreement *
|
|
5
|
+
* specified in the corresponding source code repository. *
|
|
6
|
+
* *
|
|
7
|
+
* ORIGINAL AUTHOR: *
|
|
8
|
+
* James Bush - james.bush@modusbox.com *
|
|
9
|
+
**************************************************************************/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const healthCheck = async(ctx) => {
|
|
14
|
+
ctx.response.status = 204;
|
|
15
|
+
ctx.response.body = '';
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Handles a GET /requests/{ID} request. This is a test support method that allows the caller
|
|
21
|
+
* to see the body of a previous incoming request.
|
|
22
|
+
*/
|
|
23
|
+
const getRequestById = async(ctx) => {
|
|
24
|
+
try {
|
|
25
|
+
const req = await ctx.state.cache.get(`request_${ctx.state.path.params.ID}`);
|
|
26
|
+
ctx.response.status = 200;
|
|
27
|
+
ctx.response.body = req;
|
|
28
|
+
}
|
|
29
|
+
catch(err) {
|
|
30
|
+
ctx.status = 500;
|
|
31
|
+
ctx.response.body = err;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Handles a GET /callbacks/{ID} request. This is a test support method that allows the caller
|
|
38
|
+
* to see the body of a previous incoming callback.
|
|
39
|
+
*/
|
|
40
|
+
const getCallbackById = async(ctx) => {
|
|
41
|
+
try {
|
|
42
|
+
const req = await ctx.state.cache.get(`callback_${ctx.state.path.params.ID}`);
|
|
43
|
+
ctx.response.status = 200;
|
|
44
|
+
ctx.response.body = req;
|
|
45
|
+
}
|
|
46
|
+
catch(err) {
|
|
47
|
+
ctx.status = 500;
|
|
48
|
+
ctx.response.body = err;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
module.exports = {
|
|
54
|
+
'/': {
|
|
55
|
+
get: healthCheck
|
|
56
|
+
},
|
|
57
|
+
'/requests/{ID}': {
|
|
58
|
+
get: getRequestById
|
|
59
|
+
},
|
|
60
|
+
'/callbacks/{ID}': {
|
|
61
|
+
get: getCallbackById
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
const Koa = require('koa');
|
|
12
12
|
const ws = require('ws');
|
|
13
13
|
|
|
14
|
+
const assert = require('assert').strict;
|
|
14
15
|
const http = require('http');
|
|
15
16
|
const yaml = require('js-yaml');
|
|
16
17
|
const fs = require('fs').promises;
|
|
@@ -210,6 +211,36 @@ class TestServer {
|
|
|
210
211
|
}
|
|
211
212
|
this._logger.log('Test server shutdown complete');
|
|
212
213
|
}
|
|
214
|
+
|
|
215
|
+
async reconfigure({ port, logger, cache }) {
|
|
216
|
+
assert(port === this._port, 'Cannot reconfigure running port');
|
|
217
|
+
const newApi = new TestApi(logger, cache, this._validator);
|
|
218
|
+
const newWsApi = new WsServer(logger.push({ component: 'websocket-server' }), cache);
|
|
219
|
+
await newWsApi.start();
|
|
220
|
+
|
|
221
|
+
return () => {
|
|
222
|
+
const oldWsApi = this._wsapi;
|
|
223
|
+
this._logger = logger;
|
|
224
|
+
this._cache = cache;
|
|
225
|
+
this._wsapi = newWsApi;
|
|
226
|
+
this._api = newApi;
|
|
227
|
+
this._server.removeAllListeners('upgrade');
|
|
228
|
+
this._server.on('upgrade', (req, socket, head) => {
|
|
229
|
+
this._wsapi.handleUpgrade(req, socket, head, (ws) =>
|
|
230
|
+
this._wsapi.emit('connection', ws, req));
|
|
231
|
+
});
|
|
232
|
+
this._server.removeAllListeners('request');
|
|
233
|
+
this._server.on('request', newApi.callback());
|
|
234
|
+
// TODO: we can't guarantee client implementations. Therefore we can't guarantee
|
|
235
|
+
// reconnect logic/behaviour. Therefore instead of closing all websocket client
|
|
236
|
+
// connections as we do below, we should replace handlers.
|
|
237
|
+
oldWsApi.stop().catch((err) => {
|
|
238
|
+
this._logger.push({ err }).log('Error stopping websocket server during reconfigure');
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
this._logger.log('restarted');
|
|
242
|
+
};
|
|
243
|
+
}
|
|
213
244
|
}
|
|
214
245
|
|
|
215
246
|
module.exports = TestServer;
|
|
@@ -58,6 +58,10 @@ const env = from(process.env, {
|
|
|
58
58
|
|
|
59
59
|
module.exports = {
|
|
60
60
|
__parseResourceVersion: parseResourceVersions,
|
|
61
|
+
control: {
|
|
62
|
+
mgmtAPIWsUrl: env.get('MGMT_API_WS_URL').required().asString(),
|
|
63
|
+
mgmtAPIWsPort: env.get('MGMT_API_WS_PORT').default('4005').asPortNumber()
|
|
64
|
+
},
|
|
61
65
|
mutualTLS: {
|
|
62
66
|
inboundRequests: {
|
|
63
67
|
enabled: env.get('INBOUND_MUTUAL_TLS_ENABLED').default('false').asBool(),
|
|
@@ -160,4 +164,6 @@ module.exports = {
|
|
|
160
164
|
// a transactionRequestId. this option decodes the ilp packet for
|
|
161
165
|
// the `transactionId` to retrieve the quote from cache
|
|
162
166
|
allowDifferentTransferTransactionId: env.get('ALLOW_DIFFERENT_TRANSFER_TRANSACTION_ID').default('false').asBool(),
|
|
167
|
+
|
|
168
|
+
pm4mlEnabled: env.get('PM4ML_ENABLED').default('false').asBool(),
|
|
163
169
|
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/{lib → src/lib}/cache.js
RENAMED
|
File without changes
|
package/{lib → src/lib}/check.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -115,7 +115,7 @@ class OutboundBulkQuotesModel {
|
|
|
115
115
|
|
|
116
116
|
case 'requestBulkQuote':
|
|
117
117
|
return this._requestBulkQuote();
|
|
118
|
-
|
|
118
|
+
|
|
119
119
|
case 'getBulkQuote':
|
|
120
120
|
return this._getBulkQuote(this.data.bulkQuoteId);
|
|
121
121
|
|
|
@@ -266,7 +266,7 @@ class OutboundBulkQuotesModel {
|
|
|
266
266
|
};
|
|
267
267
|
|
|
268
268
|
individualQuote.note && (quote.note = individualQuote.note);
|
|
269
|
-
|
|
269
|
+
|
|
270
270
|
if (individualQuote.extensions && individualQuote.extensions.length > 0) {
|
|
271
271
|
bulkQuoteRequest.extensionList = {
|
|
272
272
|
extension: individualQuote.extensions
|
|
@@ -440,7 +440,7 @@ class OutboundBulkQuotesModel {
|
|
|
440
440
|
await this.stateMachine.requestBulkQuote();
|
|
441
441
|
this._logger.log(`Quotes resolved for bulk quote ${this.data.bulkQuoteId}`);
|
|
442
442
|
break;
|
|
443
|
-
|
|
443
|
+
|
|
444
444
|
case 'getBulkQuote':
|
|
445
445
|
await this.stateMachine.getBulkQuote();
|
|
446
446
|
this._logger.log(`Get bulk quote ${this.data.bulkQuoteId} has been completed`);
|
|
@@ -257,7 +257,7 @@ class OutboundBulkTransfersModel {
|
|
|
257
257
|
ilpPacket: individualTransfer.ilpPacket,
|
|
258
258
|
condition: individualTransfer.condition,
|
|
259
259
|
};
|
|
260
|
-
|
|
260
|
+
|
|
261
261
|
if (individualTransfer.extensions && individualTransfer.extensions.length > 0) {
|
|
262
262
|
bulkTransferRequest.extensionList = {
|
|
263
263
|
extension: individualTransfer.extensions
|
|
@@ -297,7 +297,7 @@ class OutboundRequestToPayModel {
|
|
|
297
297
|
this._logger.push({ transactionRequestResponse }).log('Transaction Request Response received');
|
|
298
298
|
this.data.requestToPayState = transactionRequestResponse.transactionRequestState;
|
|
299
299
|
|
|
300
|
-
|
|
300
|
+
|
|
301
301
|
return resolve(transactionRequestResponse);
|
|
302
302
|
}
|
|
303
303
|
catch(err) {
|
|
@@ -145,7 +145,7 @@ class OutboundRequestToPayTransferModel {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
break;
|
|
148
|
-
|
|
148
|
+
|
|
149
149
|
case 'otpReceived':
|
|
150
150
|
// next transition is executeTransfer
|
|
151
151
|
await this.stateMachine.executeTransfer();
|
|
@@ -230,7 +230,7 @@ class OutboundRequestToPayTransferModel {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
|
-
* This method is used to communicate back to the Payee that a rejection is being
|
|
233
|
+
* This method is used to communicate back to the Payee that a rejection is being
|
|
234
234
|
* sent because the OTP did not match.
|
|
235
235
|
*/
|
|
236
236
|
async rejectRequestToPay() {
|
|
@@ -241,7 +241,7 @@ class OutboundRequestToPayTransferModel {
|
|
|
241
241
|
const response = {
|
|
242
242
|
status : `${this.data.requestToPayTransactionId} has been REJECTED`
|
|
243
243
|
};
|
|
244
|
-
return JSON.stringify(response);
|
|
244
|
+
return JSON.stringify(response);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
|
|
@@ -471,7 +471,7 @@ class OutboundRequestToPayTransferModel {
|
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
/**
|
|
474
|
-
* Sends request for
|
|
474
|
+
* Sends request for
|
|
475
475
|
* Starts the quote resolution process by sending a POST /quotes request to the switch;
|
|
476
476
|
* then waits for a notification from the cache that the quote response has been received
|
|
477
477
|
*/
|
|
@@ -480,7 +480,7 @@ class OutboundRequestToPayTransferModel {
|
|
|
480
480
|
return new Promise(async (resolve, reject) => {
|
|
481
481
|
|
|
482
482
|
if( this.data.initiatorType && this.data.initiatorType === 'BUSINESS') return resolve();
|
|
483
|
-
|
|
483
|
+
|
|
484
484
|
// listen for events on the quoteId
|
|
485
485
|
const otpKey = `otp_${this.data.requestToPayTransactionId}`;
|
|
486
486
|
|
|
@@ -501,9 +501,9 @@ class OutboundRequestToPayTransferModel {
|
|
|
501
501
|
|
|
502
502
|
const otpResponseBody = otpResponse.data;
|
|
503
503
|
this._logger.push({ otpResponseBody }).log('OTP response received');
|
|
504
|
-
|
|
504
|
+
|
|
505
505
|
this.data.otpResponse = otpResponseBody;
|
|
506
|
-
|
|
506
|
+
|
|
507
507
|
return resolve(otpResponse);
|
|
508
508
|
}
|
|
509
509
|
catch(err) {
|
|
@@ -587,7 +587,7 @@ class OutboundRequestToPayTransferModel {
|
|
|
587
587
|
return quote;
|
|
588
588
|
}
|
|
589
589
|
|
|
590
|
-
|
|
590
|
+
|
|
591
591
|
/**
|
|
592
592
|
* Executes a transfer
|
|
593
593
|
* Starts the transfer process by sending a POST /transfers (prepare) request to the switch;
|
|
@@ -886,7 +886,7 @@ class OutboundRequestToPayTransferModel {
|
|
|
886
886
|
}
|
|
887
887
|
|
|
888
888
|
|
|
889
|
-
|
|
889
|
+
|
|
890
890
|
}
|
|
891
891
|
|
|
892
892
|
|
|
@@ -277,7 +277,7 @@ class OutboundTransfersModel {
|
|
|
277
277
|
// a GET /parties request to the switch
|
|
278
278
|
try {
|
|
279
279
|
const res = await this._requests.getParties(this.data.to.idType, this.data.to.idValue,
|
|
280
|
-
this.data.to.idSubValue);
|
|
280
|
+
this.data.to.idSubValue, this.data.to.fspId);
|
|
281
281
|
this._logger.push({ peer: res }).log('Party lookup sent to peer');
|
|
282
282
|
}
|
|
283
283
|
catch(err) {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -68,7 +68,7 @@ const mojaloopPartyToInternalParty = (external) => {
|
|
|
68
68
|
internal.idType = external.partyIdInfo.partyIdType;
|
|
69
69
|
internal.idValue = external.partyIdInfo.partyIdentifier;
|
|
70
70
|
internal.idSubValue = external.partyIdInfo.partySubIdOrType;
|
|
71
|
-
|
|
71
|
+
internal.fspId = external.partyIdInfo.fspId;
|
|
72
72
|
if(external.partyIdInfo.extensionList){
|
|
73
73
|
internal.extensionList = external.partyIdInfo.extensionList.extension;
|
|
74
74
|
}
|
|
@@ -109,6 +109,7 @@ const mojaloopPartyIdInfoToInternalPartyIdInfo = (external) => {
|
|
|
109
109
|
internal.idType = external.partyIdType;
|
|
110
110
|
internal.idValue = external.partyIdentifier;
|
|
111
111
|
internal.idSubValue = external.partySubIdOrType;
|
|
112
|
+
internal.fspId = external.fspId;
|
|
112
113
|
|
|
113
114
|
return internal;
|
|
114
115
|
};
|
|
@@ -411,19 +412,19 @@ const mojaloopBulkPrepareToInternalBulkTransfer = (external, bulkQuotes, ilp) =>
|
|
|
411
412
|
if (bulkQuotes) {
|
|
412
413
|
// create a map of internal individual quotes payees indexed by quotedId, for faster lookup
|
|
413
414
|
const internalQuotesPayeesByQuoteId = {};
|
|
414
|
-
|
|
415
|
+
|
|
415
416
|
for (const quote of bulkQuotes.internalRequest.individualQuotes) {
|
|
416
417
|
internalQuotesPayeesByQuoteId[quote.quoteId] = quote.to;
|
|
417
418
|
}
|
|
418
|
-
|
|
419
|
+
|
|
419
420
|
// create a map of external individual transfers indexed by quotedId, for faster lookup
|
|
420
421
|
const externalTransferIdsByQuoteId = {};
|
|
421
|
-
|
|
422
|
+
|
|
422
423
|
for (const transfer of external.individualTransfers) {
|
|
423
424
|
const transactionObject = ilp.getTransactionObject(transfer.ilpPacket);
|
|
424
425
|
externalTransferIdsByQuoteId[transactionObject.quoteId] = transfer.transferId;
|
|
425
426
|
}
|
|
426
|
-
|
|
427
|
+
|
|
427
428
|
internal = {
|
|
428
429
|
bulkTransferId: external.bulkTransferId,
|
|
429
430
|
bulkQuotes: bulkQuotes.response,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -131,3 +131,12 @@ TRANSFERS_ENDPOINT=ml-testing-toolkit:5000
|
|
|
131
131
|
# The incoming transfer request should consists of an ILP packet and a matching condition in this case.
|
|
132
132
|
# The fulfilment will be generated from the provided ILP packet, and must hash to the provided condition.
|
|
133
133
|
ALLOW_TRANSFER_WITHOUT_QUOTE=false
|
|
134
|
+
|
|
135
|
+
# Management API websocket connection settings.
|
|
136
|
+
# The Management API uses this for exchanging connector management messages.
|
|
137
|
+
MGMT_API_WS_URL=127.0.0.1
|
|
138
|
+
MGMT_API_WS_PORT=4005
|
|
139
|
+
|
|
140
|
+
# Set to true to enable the use of PM4ML-related services e.g MCM, Management API service
|
|
141
|
+
# when running the scheme-adapter as a mojaloop connector component within Payment Manager for Mojaloop.
|
|
142
|
+
PM4ML_ENABLED=false
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
jest.dontMock('redis');
|
|
34
34
|
|
|
35
|
-
const Cache = require('
|
|
35
|
+
const Cache = require('~/lib/cache');
|
|
36
36
|
const { Logger } = require('@mojaloop/sdk-standard-components');
|
|
37
37
|
const env = require('../testEnv');
|
|
38
38
|
|
|
@@ -58,14 +58,14 @@ const createCache = async (config) => {
|
|
|
58
58
|
describe('Cache', () => {
|
|
59
59
|
let cache;
|
|
60
60
|
|
|
61
|
-
beforeEach(async () => {
|
|
61
|
+
beforeEach(async () => {
|
|
62
62
|
cache = await createCache(defaultCacheConfig);
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
afterEach(async () => {
|
|
66
66
|
await cache.disconnect();
|
|
67
67
|
});
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
test('Sets and retrieves an object in the cache', async () => {
|
|
70
70
|
// Arrange
|
|
71
71
|
const value = {test: true};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
|
|
2
|
+
const ControlAgent = require('~/ControlAgent');
|
|
3
|
+
const TestControlServer = require('./ControlServer');
|
|
4
|
+
const InboundServer = require('~/InboundServer');
|
|
5
|
+
const OutboundServer = require('~/OutboundServer');
|
|
6
|
+
const TestServer = require('~/TestServer');
|
|
7
|
+
const defaultConfig = require('./data/defaultConfig.json');
|
|
8
|
+
const { Logger } = require('@mojaloop/sdk-standard-components');
|
|
9
|
+
|
|
10
|
+
jest.mock('~/lib/cache');
|
|
11
|
+
const Cache = require('~/lib/cache');
|
|
12
|
+
|
|
13
|
+
// TODO:
|
|
14
|
+
// - diff against master to determine what else needs testing
|
|
15
|
+
// - especially look for assertions in the code
|
|
16
|
+
// - err.. grep the code for TODO
|
|
17
|
+
|
|
18
|
+
describe('ControlAgent', () => {
|
|
19
|
+
it('exposes a valid message API', () => {
|
|
20
|
+
expect(Object.keys(ControlAgent.build).sort()).toEqual(
|
|
21
|
+
Object.keys(ControlAgent.MESSAGE).sort(),
|
|
22
|
+
'The API exposed by the builder object must contain as top-level keys all of the message types exposed in the MESSAGE constant. Check that ControlAgent.MESSAGE has the same keys as ControlAgent.build.'
|
|
23
|
+
);
|
|
24
|
+
Object.entries(ControlAgent.build).forEach(([messageType, builders]) => {
|
|
25
|
+
expect(Object.keys(ControlAgent.VERB)).toEqual(
|
|
26
|
+
expect.arrayContaining(Object.keys(builders)),
|
|
27
|
+
`For message type '${messageType}' every builder must correspond to a verb. Check that ControlAgent.build.${messageType} has the same keys as ControlAgent.VERB.`
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
expect(Object.keys(ControlAgent.build.ERROR.NOTIFY).sort()).toEqual(
|
|
31
|
+
Object.keys(ControlAgent.ERROR).sort(),
|
|
32
|
+
'ControlAgent.ERROR.NOTIFY should contain the same keys as ControlAgent.ERROR'
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe('API', () => {
|
|
37
|
+
let server, logger, client;
|
|
38
|
+
const appConfig = { control: { port: 4005 }, what: 'ever' };
|
|
39
|
+
const changedConfig = { ...appConfig, some: 'thing' };
|
|
40
|
+
|
|
41
|
+
beforeEach(async () => {
|
|
42
|
+
logger = new Logger.Logger({ stringify: () => '' });
|
|
43
|
+
server = new TestControlServer.Server({ logger, appConfig });
|
|
44
|
+
client = await ControlAgent.Client.Create({
|
|
45
|
+
address: 'localhost',
|
|
46
|
+
port: server.address().port,
|
|
47
|
+
logger,
|
|
48
|
+
appConfig
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
afterEach(async () => {
|
|
53
|
+
await client.stop();
|
|
54
|
+
await server.stop();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('receives config when requested', async () => {
|
|
58
|
+
await client.send(ControlAgent.build.CONFIGURATION.READ());
|
|
59
|
+
const response = await client.receive();
|
|
60
|
+
expect(response).toEqual({
|
|
61
|
+
...JSON.parse(ControlAgent.build.CONFIGURATION.NOTIFY(appConfig, response.id)),
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('emits new config when received', async () => {
|
|
66
|
+
const newConfigEvent = new Promise(
|
|
67
|
+
(resolve) => client.on(ControlAgent.EVENT.RECONFIGURE, resolve)
|
|
68
|
+
);
|
|
69
|
+
await server.broadcastConfigChange(changedConfig);
|
|
70
|
+
const newConfEventData = await newConfigEvent;
|
|
71
|
+
expect(newConfEventData).toEqual(changedConfig);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe('Server reconfigure methods', () => {
|
|
77
|
+
let conf, logger, cache;
|
|
78
|
+
|
|
79
|
+
const isPromise = (o) => Promise.resolve(o) === o;
|
|
80
|
+
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
conf = JSON.parse(JSON.stringify(defaultConfig));
|
|
83
|
+
logger = new Logger.Logger({ stringify: () => '' });
|
|
84
|
+
cache = new Cache({ ...conf.cacheConfig, logger: logger.push({ component: 'cache' }) });
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('InboundServer reconfigure method returns sync function', async () => {
|
|
88
|
+
const server = new InboundServer(conf, logger, cache);
|
|
89
|
+
const res = await server.reconfigure(conf, logger, cache);
|
|
90
|
+
expect(isPromise(res)).toEqual(false);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('OutboundServer reconfigure method returns sync function', async () => {
|
|
94
|
+
const server = new OutboundServer(conf, logger, cache);
|
|
95
|
+
const res = await server.reconfigure(conf, logger, cache);
|
|
96
|
+
expect(isPromise(res)).toEqual(false);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('TestServer reconfigure method returns sync function', async () => {
|
|
100
|
+
const server = new TestServer({ logger, cache });
|
|
101
|
+
const res = await server.reconfigure({ logger, cache });
|
|
102
|
+
expect(isPromise(res)).toEqual(false);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test('ControlClient reconfigure method returns sync function', async () => {
|
|
106
|
+
const server = new TestControlServer.Server({ logger, appConfig: { ...conf, control: { port: 4005 }}});
|
|
107
|
+
const client = await ControlAgent.Client.Create({ port: 4005, logger, appConfig: {} });
|
|
108
|
+
const res = await client.reconfigure({ logger, port: 4005, appConfig: {} });
|
|
109
|
+
expect(isPromise(res)).toEqual(false);
|
|
110
|
+
await client.close();
|
|
111
|
+
await server.close();
|
|
112
|
+
});
|
|
113
|
+
});
|