Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: drop using internal modules #258

Merged
merged 14 commits into from
Feb 24, 2021
Merged
11 changes: 0 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ jobs:
- checkout
- restore_cache:
key: dependency-cache-v3-{{ checksum "src/package-lock.json" }}
paths:
- src/node_modules
- run:
name: Create dir for lint results
command: cd src && mkdir -p /lintresults
Expand All @@ -207,8 +205,6 @@ jobs:
- checkout
- restore_cache:
key: dependency-cache-v3-{{ checksum "src/package-lock.json" }}
paths:
- src/node_modules
- run:
name: Create dir for test results
command: mkdir -p ./audit/results
Expand All @@ -217,7 +213,6 @@ jobs:
command: cd src && npm run audit:check --silent -- --json > ../audit/results/auditResults.json
- store_artifacts:
path: ./audit/results
prefix: audit

audit-licenses:
executor: default-docker
Expand All @@ -230,14 +225,11 @@ jobs:
<<: *defaults_license_scanner
- restore_cache:
key: dependency-cache-v3-{{ checksum "src/package-lock.json" }}
paths:
- src/node_modules
- run:
name: Run the license-scanner
command: cd /tmp/license-scanner && pathToRepo=$CIRCLE_WORKING_DIRECTORY make run
- store_artifacts:
path: /tmp/license-scanner/results
prefix: licenses

build-local:
executor: default-machine
Expand Down Expand Up @@ -272,7 +264,6 @@ jobs:
command: cd /tmp/license-scanner && mode=docker dockerImages=mojaloop/$CIRCLE_PROJECT_REPONAME:local make run
- store_artifacts:
path: /tmp/license-scanner/results
prefix: licenses

image-scan:
executor: anchore/anchore_engine
Expand Down Expand Up @@ -333,8 +324,6 @@ jobs:
- checkout
- restore_cache:
key: dependency-cache-v3-{{ checksum "src/package-lock.json" }}
paths:
- src/node_modules
- run:
name: Configure git
command: |
Expand Down
8 changes: 0 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ WORKDIR /src/
# relying on docker-compose.
COPY ./src/package.json ./package.json
COPY ./src/package-lock.json ./package-lock.json
COPY ./src/lib/cache/package.json ./lib/cache/package.json
COPY ./src/lib/check/package.json ./lib/check/package.json
COPY ./src/lib/model/lib/requests/package.json ./lib/model/lib/requests/package.json
COPY ./src/lib/model/lib/shared/package.json ./lib/model/lib/shared/package.json
COPY ./src/lib/model/package.json ./lib/model/package.json
COPY ./src/lib/randomphrase/package.json ./lib/randomphrase/package.json
COPY ./src/lib/router/package.json ./lib/router/package.json
COPY ./src/lib/validate/package.json ./lib/validate/package.json
RUN npm ci --only=production

FROM node:14.15-alpine
Expand Down
10 changes: 5 additions & 5 deletions src/InboundServer/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

'use strict';

const Model = require('@internal/model').InboundTransfersModel;
const PartiesModel = require('@internal/model').PartiesModel;
const QuotesModel = require('@internal/model').QuotesModel;
const TransfersModel = require('@internal/model').TransfersModel;
const AuthorizationsModel = require('@internal/model').AuthorizationsModel;
const Model = require('../lib/model').InboundTransfersModel;
const PartiesModel = require('../lib/model').PartiesModel;
const QuotesModel = require('../lib/model').QuotesModel;
const TransfersModel = require('../lib/model').TransfersModel;
const AuthorizationsModel = require('../lib/model').AuthorizationsModel;

/**
* Handles a GET /authorizations/{id} request
Expand Down
4 changes: 2 additions & 2 deletions src/InboundServer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const EventEmitter = require('events');

const { WSO2Auth } = require('@mojaloop/sdk-standard-components');

const Validate = require('@internal/validate');
const router = require('@internal/router');
const Validate = require('../lib/validate');
const router = require('../lib/router');
const handlers = require('./handlers');
const middlewares = require('./middlewares');

Expand Down
2 changes: 1 addition & 1 deletion src/InboundServer/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

const coBody = require('co-body');

const randomPhrase = require('@internal/randomphrase');
const randomPhrase = require('../lib/randomphrase');
const { Jws, Errors } = require('@mojaloop/sdk-standard-components');

/**
Expand Down
2 changes: 1 addition & 1 deletion src/OutboundServer/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const {
QuotesModel,
TransfersModel,
AuthorizationsModel
} = require('@internal/model');
} = require('../lib/model');


/**
Expand Down
4 changes: 2 additions & 2 deletions src/OutboundServer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const cors = require('@koa/cors');

const { WSO2Auth } = require('@mojaloop/sdk-standard-components');

const Validate = require('@internal/validate');
const router = require('@internal/router');
const Validate = require('../lib/validate');
const router = require('../lib/router');
const handlers = require('./handlers');
const middlewares = require('./middlewares');

Expand Down
2 changes: 1 addition & 1 deletion src/OutboundServer/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
**************************************************************************/


const { ProxyModel } = require('@internal/model');
const { ProxyModel } = require('../lib/model');
const { applyState, createErrorHandler, createLogger, createRequestIdGenerator } =
require('../InboundServer/middlewares');

Expand Down
4 changes: 2 additions & 2 deletions src/TestServer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const yaml = require('js-yaml');
const fs = require('fs').promises;
const path = require('path');

const Validate = require('@internal/validate');
const router = require('@internal/router');
const Validate = require('../lib/validate');
const router = require('../lib/router');
const handlers = require('./handlers');
const middlewares = require('../InboundServer/middlewares');

Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ const TestServer = require('./TestServer');
// scheme adapter as a service
const InboundServerMiddleware = require('./InboundServer/middlewares.js');
const OutboundServerMiddleware = require('./OutboundServer/middlewares.js');
const Router = require('@internal/router');
const Validate = require('@internal/validate');
const RandomPhrase = require('@internal/randomphrase');
const Cache = require('@internal/cache');
const Router = require('./lib/router');
const Validate = require('./lib/validate');
const RandomPhrase = require('./lib/randomphrase');
const Cache = require('./lib/cache');
const { Logger } = require('@mojaloop/sdk-standard-components');

/**
Expand Down
File renamed without changes.
20 changes: 0 additions & 20 deletions src/lib/cache/package.json

This file was deleted.

File renamed without changes.
12 changes: 0 additions & 12 deletions src/lib/check/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion src/lib/model/Async2SyncModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const util = require('util');

const PSM = require('./common').PersistentStateMachine;
const MojaloopRequests = require('@mojaloop/sdk-standard-components').MojaloopRequests;
const deferredJob = require('@internal/shared/deferredJob');
const deferredJob = require('./lib').deferredJob;

function generate({
/**
Expand Down
4 changes: 2 additions & 2 deletions src/lib/model/InboundTransfersModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
const {
BackendRequests,
HTTPResponseError,
} = require('@internal/requests');
} = require('./lib/requests');
const {
MojaloopRequests,
Ilp,
Errors,
} = require('@mojaloop/sdk-standard-components');
const shared = require('@internal/shared');
const shared = require('./lib/shared');

/**
* Models the operations required for performing inbound transfers
Expand Down
2 changes: 1 addition & 1 deletion src/lib/model/OutboundBulkQuotesModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const util = require('util');
const { uuid } = require('uuidv4');
const StateMachine = require('javascript-state-machine');
const { MojaloopRequests } = require('@mojaloop/sdk-standard-components');
const shared = require('@internal/shared');
const shared = require('./lib/shared');
const { BackendError } = require('./common');

const stateEnum = {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/model/OutboundRequestToPayTransferModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const util = require('util');
const { uuid } = require('uuidv4');
const StateMachine = require('javascript-state-machine');
const { Ilp, MojaloopRequests } = require('@mojaloop/sdk-standard-components');
const shared = require('@internal/shared');
const shared = require('./lib/shared');
const { BackendError } = require('./common');
const PartiesModel = require('./PartiesModel');

Expand Down
2 changes: 1 addition & 1 deletion src/lib/model/OutboundTransfersModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const util = require('util');
const { uuid } = require('uuidv4');
const StateMachine = require('javascript-state-machine');
const { Ilp, MojaloopRequests } = require('@mojaloop/sdk-standard-components');
const shared = require('@internal/shared');
const shared = require('./lib/shared');
const { BackendError } = require('./common');
const PartiesModel = require('./PartiesModel');

Expand Down
9 changes: 9 additions & 0 deletions src/lib/model/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const deferredJob = require('./deferredJob');
const request = require('./requests');
const shared = require('./shared');

module.exports = {
deferredJob,
request,
shared,
};
19 changes: 0 additions & 19 deletions src/lib/model/lib/requests/package.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,6 @@ const mojaloopBulkPrepareToInternalBulkTransfer = (external, bulkQuotes, ilp) =>
return internal;
};

const deferredJob = require('./deferredJob');

module.exports = {
internalPartyToMojaloopParty,
internalQuoteResponseToMojaloop,
Expand All @@ -452,6 +450,5 @@ module.exports = {
mojaloopTransactionRequestToInternal,
mojaloopBulkQuotesRequestToInternal,
internalBulkQuotesResponseToMojaloop,
mojaloopBulkPrepareToInternalBulkTransfer,
deferredJob
mojaloopBulkPrepareToInternalBulkTransfer
};
19 changes: 0 additions & 19 deletions src/lib/model/lib/shared/package.json

This file was deleted.

22 changes: 0 additions & 22 deletions src/lib/model/package.json

This file was deleted.

File renamed without changes.
17 changes: 0 additions & 17 deletions src/lib/randomphrase/package.json

This file was deleted.

File renamed without changes.
17 changes: 0 additions & 17 deletions src/lib/router/package.json

This file was deleted.

File renamed without changes.
Loading