diff --git a/.github/workflows/lint_test_build.yml b/.github/workflows/lint_test_build.yml index 9fe54b8cad..f67949a766 100644 --- a/.github/workflows/lint_test_build.yml +++ b/.github/workflows/lint_test_build.yml @@ -121,7 +121,10 @@ jobs: - name: Setup hosts run: | - echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts + echo "127.0.0.1 cloud-nine-wallet-test-backend" | sudo tee -a /etc/hosts + echo "127.0.0.1 cloud-nine-wallet-test-auth" | sudo tee -a /etc/hosts + echo "127.0.0.1 happy-life-bank-test-backend" | sudo tee -a /etc/hosts + echo "127.0.0.1 happy-life-bank-test-auth" | sudo tee -a /etc/hosts - name: Build dependencies run: pnpm --filter integration build:deps diff --git a/aws/lambdas/exchange-rates/go.mod b/aws/lambdas/exchange-rates/go.mod index ba1d01db25..416a9c9d32 100644 --- a/aws/lambdas/exchange-rates/go.mod +++ b/aws/lambdas/exchange-rates/go.mod @@ -4,7 +4,7 @@ go 1.22.1 require ( github.com/aws/aws-lambda-go v1.46.0 - github.com/aws/aws-sdk-go v1.51.5 + github.com/aws/aws-sdk-go v1.51.9 ) require github.com/jmespath/go-jmespath v0.4.0 // indirect diff --git a/aws/lambdas/exchange-rates/go.sum b/aws/lambdas/exchange-rates/go.sum index 3f7df0de9d..1a3f6644d0 100644 --- a/aws/lambdas/exchange-rates/go.sum +++ b/aws/lambdas/exchange-rates/go.sum @@ -14,6 +14,8 @@ github.com/aws/aws-sdk-go v1.51.2 h1:Ruwgz5aqIXin5Yfcgc+PCzoqW5tEGb9aDL/JWDsre7k github.com/aws/aws-sdk-go v1.51.2/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go v1.51.5 h1:tUHg/ZJgS2Hog4Wl4xpbBqCrmFg6AYv7gPVaCs4v0+s= github.com/aws/aws-sdk-go v1.51.5/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.51.9 h1:w6ZlyFX7l4+ZNVPmWw7LwOHSaBDDQuP22l1gh7OYu7w= +github.com/aws/aws-sdk-go v1.51.9/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= diff --git a/infrastructure/helm/rafiki/Chart.lock b/infrastructure/helm/rafiki/Chart.lock index 6d9b9165c2..ef17f8ec69 100644 --- a/infrastructure/helm/rafiki/Chart.lock +++ b/infrastructure/helm/rafiki/Chart.lock @@ -1,10 +1,10 @@ dependencies: - name: redis repository: https://charts.bitnami.com/bitnami - version: 18.19.4 + version: 19.0.1 - name: postgresql repository: https://charts.bitnami.com/bitnami - version: 14.3.3 + version: 15.1.4 - name: rafiki-auth repository: https://interledger.github.io/helm-charts version: 0.4.0 @@ -14,5 +14,5 @@ dependencies: - name: rafiki-frontend repository: https://interledger.github.io/helm-charts version: 0.4.0 -digest: sha256:272dc69d4e5c3b37660ca38d5d959dc33e75c91c507c3af6df406f885dd90fad -generated: "2024-03-18T18:03:39.549030166Z" +digest: sha256:3aadc4eef1a8667d4e2f3406e08b919501fb1073feb5bff0d2339719ce3904a6 +generated: "2024-03-26T09:20:34.879805696Z" diff --git a/infrastructure/helm/rafiki/Chart.yaml b/infrastructure/helm/rafiki/Chart.yaml index e023eb4a44..3e28eb5b7c 100644 --- a/infrastructure/helm/rafiki/Chart.yaml +++ b/infrastructure/helm/rafiki/Chart.yaml @@ -25,10 +25,10 @@ appVersion: 'v1.0.0-alpha.1' dependencies: - name: redis - version: "18.19.4" + version: "19.0.1" repository: "https://charts.bitnami.com/bitnami" - name: postgresql - version: '14.3.3' + version: '15.1.4' repository: 'https://charts.bitnami.com/bitnami' - name: rafiki-auth version: '0.4.0' diff --git a/localenv/mock-account-servicing-entity/package.json b/localenv/mock-account-servicing-entity/package.json index 95ca85f07e..001d92a63c 100644 --- a/localenv/mock-account-servicing-entity/package.json +++ b/localenv/mock-account-servicing-entity/package.json @@ -9,7 +9,7 @@ "typecheck": "tsc" }, "dependencies": { - "@apollo/client": "^3.9.8", + "@apollo/client": "^3.9.9", "@interledger/http-signature-utils": "2.0.2", "@remix-run/node": "^2.6.0", "@remix-run/react": "^2.6.0", @@ -26,7 +26,7 @@ }, "devDependencies": { "@remix-run/dev": "^2.6.0", - "@types/react": "^18.2.67", + "@types/react": "^18.2.73", "@types/react-dom": "^18.2.22" }, "engines": { diff --git a/packages/auth/Dockerfile b/packages/auth/Dockerfile index 29db6c08e2..867cf8d38c 100644 --- a/packages/auth/Dockerfile +++ b/packages/auth/Dockerfile @@ -17,6 +17,7 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ FROM base AS prod-deps COPY package.json pnpm-workspace.yaml .npmrc ./ +COPY packages/auth/knexfile.js ./packages/auth/knexfile.js COPY packages/auth/package.json ./packages/auth/package.json COPY packages/token-introspection/package.json ./packages/token-introspection/package.json @@ -51,10 +52,10 @@ COPY --from=prod-deps /home/rafiki/packages/auth/node_modules ./packages/auth/no COPY --from=prod-deps /home/rafiki/packages/auth/package.json ./packages/auth/package.json COPY --from=prod-deps /home/rafiki/packages/token-introspection/node_modules ./packages/token-introspection/node_modules COPY --from=prod-deps /home/rafiki/packages/token-introspection/package.json ./packages/token-introspection/package.json +COPY --from=prod-deps /home/rafiki/packages/auth/knexfile.js ./packages/auth/knexfile.js COPY --from=builder /home/rafiki/packages/auth/migrations/ ./packages/auth/migrations COPY --from=builder /home/rafiki/packages/auth/dist ./packages/auth/dist COPY --from=builder /home/rafiki/packages/token-introspection/dist ./packages/token-introspection/dist - CMD ["node", "/home/rafiki/packages/auth/dist/index.js"] \ No newline at end of file diff --git a/packages/auth/jest.setup.js b/packages/auth/jest.setup.js index 1079349f0c..d73df42b18 100644 --- a/packages/auth/jest.setup.js +++ b/packages/auth/jest.setup.js @@ -1,7 +1,7 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires const { knex } = require('knex') // eslint-disable-next-line @typescript-eslint/no-var-requires -const { GenericContainer } = require('testcontainers') +const { GenericContainer, Wait } = require('testcontainers') const POSTGRES_PORT = 5432 @@ -20,6 +20,13 @@ module.exports = async (globalConfig) => { .withEnvironment({ POSTGRES_PASSWORD: 'password' }) + .withHealthCheck({ + test: ['CMD-SHELL', 'pg_isready -d testing'], + interval: 10000, + timeout: 5000, + retries: 5 + }) + .withWaitStrategy(Wait.forHealthCheck()) .start() process.env.AUTH_DATABASE_URL = `postgresql://postgres:password@localhost:${postgresContainer.getMappedPort( diff --git a/packages/auth/knexfile.js b/packages/auth/knexfile.js index 519e2b921f..b3f70c3404 100644 --- a/packages/auth/knexfile.js +++ b/packages/auth/knexfile.js @@ -59,11 +59,7 @@ module.exports = { production: { client: 'postgresql', - connection: { - database: 'my_auth_db', - user: 'username', - password: 'password' - }, + connection: process.env.AUTH_DATABASE_URL, pool: { min: 2, max: 10 diff --git a/packages/auth/package.json b/packages/auth/package.json index 33b3cc7f82..a452299d08 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -22,7 +22,7 @@ }, "dependencies": { "@adonisjs/fold": "^8.2.0", - "@apollo/server": "^4.10.1", + "@apollo/server": "^4.10.2", "@as-integrations/koa": "^1.1.1", "@escape.tech/graphql-armor": "^2.4.0", "@graphql-tools/graphql-file-loader": "^8.0.1", @@ -38,7 +38,7 @@ "dotenv": "^16.4.5", "graphql": "^16.8.1", "knex": "^3.1.0", - "koa": "^2.15.1", + "koa": "^2.15.2", "koa-bodyparser": "^4.4.1", "koa-session": "^6.4.0", "objection": "^3.1.4", @@ -49,7 +49,7 @@ "uuid": "^9.0.1" }, "devDependencies": { - "@apollo/client": "^3.9.8", + "@apollo/client": "^3.9.9", "@faker-js/faker": "^8.4.1", "@graphql-codegen/cli": "5.0.2", "@graphql-codegen/introspection": "4.0.3", @@ -66,7 +66,7 @@ "nock": "^13.5.4", "node-mocks-http": "^1.14.1", "openapi-types": "^12.1.3", - "pino-pretty": "^10.3.1", + "pino-pretty": "^11.0.0", "testcontainers": "^10.7.2" } } diff --git a/packages/auth/src/config/app.ts b/packages/auth/src/config/app.ts index 35a6c3410b..d738cd004c 100644 --- a/packages/auth/src/config/app.ts +++ b/packages/auth/src/config/app.ts @@ -28,6 +28,7 @@ export const Config = { introspectionPort: envInt('INTROSPECTION_PORT', 3007), env: envString('NODE_ENV', 'development'), trustProxy: envBool('TRUST_PROXY', false), + enableManualMigrations: envBool('ENABLE_MANUAL_MIGRATIONS', false), databaseUrl: process.env.NODE_ENV === 'test' ? `${process.env.AUTH_DATABASE_URL}_${process.env.JEST_WORKER_ID}` diff --git a/packages/auth/src/index.ts b/packages/auth/src/index.ts index 21ed6921af..a1daa2868d 100644 --- a/packages/auth/src/index.ts +++ b/packages/auth/src/index.ts @@ -263,18 +263,22 @@ export const start = async ( } }) + const config = await container.use('config') + // Do migrations const knex = await container.use('knex') - // Needs a wrapped inline function - await callWithRetry(async () => { - await knex.migrate.latest({ - directory: __dirname + '/../migrations' + + if (!config.enableManualMigrations) { + // Needs a wrapped inline function + await callWithRetry(async () => { + await knex.migrate.latest({ + directory: __dirname + '/../migrations' + }) }) - }) + } Model.knex(knex) - const config = await container.use('config') await app.boot() await app.startAdminServer(config.adminPort) diff --git a/packages/backend/Dockerfile b/packages/backend/Dockerfile index 8adacc2834..b236417d10 100644 --- a/packages/backend/Dockerfile +++ b/packages/backend/Dockerfile @@ -17,6 +17,7 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ FROM base AS prod-deps COPY package.json pnpm-workspace.yaml .npmrc ./ +COPY packages/backend/knexfile.js ./packages/backend/knexfile.js COPY packages/backend/package.json ./packages/backend/package.json COPY packages/token-introspection/package.json ./packages/token-introspection/package.json @@ -51,10 +52,11 @@ COPY --from=prod-deps /home/rafiki/packages/backend/node_modules ./packages/back COPY --from=prod-deps /home/rafiki/packages/backend/package.json ./packages/backend/package.json COPY --from=prod-deps /home/rafiki/packages/token-introspection/node_modules ./packages/token-introspection/node_modules COPY --from=prod-deps /home/rafiki/packages/token-introspection/package.json ./packages/token-introspection/package.json +COPY --from=prod-deps /home/rafiki/packages/backend/knexfile.js ./packages/backend/knexfile.js COPY --from=builder /home/rafiki/packages/backend/migrations/ ./packages/backend/migrations COPY --from=builder /home/rafiki/packages/backend/dist ./packages/backend/dist COPY --from=builder /home/rafiki/packages/token-introspection/dist ./packages/token-introspection/dist - +COPY --from=builder /home/rafiki/packages/backend/knexfile.js ./packages/backend/knexfile.js CMD ["node", "/home/rafiki/packages/backend/dist/index.js"] diff --git a/packages/backend/knexfile.js b/packages/backend/knexfile.js index 2d9b3bc015..6f8e2606ed 100644 --- a/packages/backend/knexfile.js +++ b/packages/backend/knexfile.js @@ -35,11 +35,7 @@ module.exports = { production: { client: 'postgresql', - connection: { - database: 'my_db', - user: 'username', - password: 'password' - }, + connection: process.env.DATABASE_URL, pool: { min: 2, max: 10 diff --git a/packages/backend/package.json b/packages/backend/package.json index 9087f840c2..712d8bb674 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -17,7 +17,7 @@ "postinstall": "pnpm copy-op-schemas" }, "devDependencies": { - "@apollo/client": "^3.9.8", + "@apollo/client": "^3.9.9", "@graphql-codegen/cli": "5.0.2", "@graphql-codegen/introspection": "4.0.3", "@graphql-codegen/typescript": "4.0.6", @@ -46,7 +46,7 @@ }, "dependencies": { "@adonisjs/fold": "^8.2.0", - "@apollo/server": "^4.10.1", + "@apollo/server": "^4.10.2", "@as-integrations/koa": "^1.1.1", "@escape.tech/graphql-armor": "^2.4.0", "@faker-js/faker": "^8.4.1", @@ -78,7 +78,7 @@ "ioredis": "^5.3.2", "json-canonicalize": "^1.0.6", "knex": "^3.1.0", - "koa": "^2.15.1", + "koa": "^2.15.2", "koa-bodyparser": "^4.4.1", "lodash": "^4.17.21", "luxon": "^3.4.4", diff --git a/packages/backend/src/accounting/service.ts b/packages/backend/src/accounting/service.ts index 7aed4097c9..baf13adf31 100644 --- a/packages/backend/src/accounting/service.ts +++ b/packages/backend/src/accounting/service.ts @@ -159,7 +159,7 @@ export async function createAccountToAccountTransfer( const balance = await getAccountBalance(account.id) if (balance === undefined) { - throw new Error() + throw new Error('undefined account balance') } await account.onDebit({ @@ -185,7 +185,7 @@ export async function createAccountToAccountTransfer( const totalReceived = await getAccountReceived(destinationAccount.id) if (totalReceived === undefined) { - throw new Error() + throw new Error('total received is undefined') } await destinationAccount.onCredit({ diff --git a/packages/backend/src/accounting/tigerbeetle/utils.ts b/packages/backend/src/accounting/tigerbeetle/utils.ts index b645cb6e9e..b9b1e32660 100644 --- a/packages/backend/src/accounting/tigerbeetle/utils.ts +++ b/packages/backend/src/accounting/tigerbeetle/utils.ts @@ -10,7 +10,7 @@ export function toTigerbeetleId(id: AccountId): bigint { return id } if (!validateId(id)) { - throw new Error() + throw new Error('wrong format of id') } return uuidToBigInt(id) diff --git a/packages/backend/src/config/app.ts b/packages/backend/src/config/app.ts index 4de99d4f5b..202abb5dd7 100644 --- a/packages/backend/src/config/app.ts +++ b/packages/backend/src/config/app.ts @@ -64,6 +64,7 @@ export const Config = { connectorPort: envInt('CONNECTOR_PORT', 3002), autoPeeringServerPort: envInt('AUTO_PEERING_SERVER_PORT', 3005), enableAutoPeering: envBool('ENABLE_AUTO_PEERING', false), + enableManualMigrations: envBool('ENABLE_MANUAL_MIGRATIONS', false), databaseUrl: process.env.NODE_ENV === 'test' ? `${process.env.DATABASE_URL}_${process.env.JEST_WORKER_ID}` diff --git a/packages/backend/src/graphql/resolvers/liquidity.ts b/packages/backend/src/graphql/resolvers/liquidity.ts index f8edac9773..0659ad78c1 100644 --- a/packages/backend/src/graphql/resolvers/liquidity.ts +++ b/packages/backend/src/graphql/resolvers/liquidity.ts @@ -385,7 +385,7 @@ export const depositEventLiquidity: MutationResolvers['depositEve return responses[LiquidityError.InvalidId] } if (!event.data.debitAmount) { - throw new Error() + throw new Error('missing debit amount') } const outgoingPaymentService = await ctx.container.use( 'outgoingPaymentService' @@ -434,7 +434,7 @@ export const withdrawEventLiquidity: MutationResolvers['withdrawE const assetService = await ctx.container.use('assetService') const asset = await assetService.get(event.withdrawal.assetId) if (!asset) { - throw new Error() + throw new Error('asset id does not map to asset') } const accountingService = await ctx.container.use('accountingService') const error = await accountingService.createWithdrawal({ diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts index d8053b020b..b700495ae3 100644 --- a/packages/backend/src/index.ts +++ b/packages/backend/src/index.ts @@ -569,18 +569,22 @@ export const start = async ( } }) + const config = await container.use('config') + // Do migrations const knex = await container.use('knex') - // Needs a wrapped inline function - await callWithRetry(async () => { - await knex.migrate.latest({ - directory: __dirname + '/../migrations' + + if (!config.enableManualMigrations) { + // Needs a wrapped inline function + await callWithRetry(async () => { + await knex.migrate.latest({ + directory: __dirname + '/../migrations' + }) }) - }) + } Model.knex(knex) - const config = await container.use('config') await app.boot() await app.startAdminServer(config.adminPort) logger.info(`Admin listening on ${app.getAdminPort()}`) diff --git a/packages/backend/src/open_payments/payment/incoming/service.ts b/packages/backend/src/open_payments/payment/incoming/service.ts index 533c687f04..9311d0874c 100644 --- a/packages/backend/src/open_payments/payment/incoming/service.ts +++ b/packages/backend/src/open_payments/payment/incoming/service.ts @@ -207,7 +207,7 @@ async function handleDeactivated( incomingPayment: IncomingPayment ): Promise { if (!incomingPayment.processAt) { - throw new Error() + throw new Error('processAt field is not defined') } try { const amountReceived = await deps.accountingService.getTotalReceived( diff --git a/packages/backend/src/open_payments/quote/model.ts b/packages/backend/src/open_payments/quote/model.ts index f636bb34e2..84add91113 100644 --- a/packages/backend/src/open_payments/quote/model.ts +++ b/packages/backend/src/open_payments/quote/model.ts @@ -144,7 +144,7 @@ export class Quote extends WalletAddressSubresource { Pay.Int.from(this.highEstimatedExchangeRateDenominator) as Pay.PositiveInt ) if (!highEstimatedExchangeRate.isPositive()) { - throw new Error() + throw new Error('high estimated exchange rate is not positive') } return highEstimatedExchangeRate } diff --git a/packages/backend/src/tests/outgoingPayment.ts b/packages/backend/src/tests/outgoingPayment.ts index ec2f604e27..13d756653d 100644 --- a/packages/backend/src/tests/outgoingPayment.ts +++ b/packages/backend/src/tests/outgoingPayment.ts @@ -65,7 +65,7 @@ export async function createOutgoingPayment( quoteId: quote.id }) if (isOutgoingPaymentError(outgoingPaymentOrError)) { - throw new Error() + throw new Error(outgoingPaymentOrError) } const accountingService = await deps.use('accountingService') diff --git a/packages/backend/src/tests/quote.ts b/packages/backend/src/tests/quote.ts index 0287538996..85072b9da1 100644 --- a/packages/backend/src/tests/quote.ts +++ b/packages/backend/src/tests/quote.ts @@ -76,14 +76,14 @@ export async function createQuote( const walletAddressService = await deps.use('walletAddressService') const walletAddress = await walletAddressService.get(walletAddressId) if (!walletAddress) { - throw new Error() + throw new Error('wallet not found') } if ( debitAmount && (walletAddress.asset.code !== debitAmount.assetCode || walletAddress.asset.scale !== debitAmount.assetScale) ) { - throw new Error() + throw new Error('asset code or scale do not match') } const config = await deps.use('config') @@ -92,23 +92,23 @@ export async function createQuote( const receiverService = await deps.use('receiverService') const receiver = await receiverService.get(receiverUrl) if (!receiver) { - throw new Error() + throw new Error('receiver not found') } if (!receiver.incomingAmount && !receiveAmount && !debitAmount) { - throw new Error() + throw new Error('missing amount') } if (receiveAmount) { if ( receiver.assetCode !== receiveAmount.assetCode || receiver.assetScale !== receiveAmount.assetScale ) { - throw new Error() + throw new Error('asset code or asset scale do not match') } if ( receiver.incomingAmount && receiveAmount.value > receiver.incomingAmount.value ) { - throw new Error() + throw new Error('receive amount is higher than the incoming amount') } } else { receiveAsset = receiver.asset @@ -129,7 +129,7 @@ export async function createQuote( if (debitAmount) { if (!receiveAsset) { - throw new Error() + throw new Error('receive asset is not defined') } receiveAmount = { value: BigInt( @@ -143,7 +143,7 @@ export async function createQuote( } } else { if (!receiveAmount) { - throw new Error() + throw new Error('receive amount is not defined') } debitAmount = { value: BigInt( diff --git a/packages/documentation/src/content/docs/integration/deployment.md b/packages/documentation/src/content/docs/integration/deployment.md index 47846bd5ad..1c04ab8dcf 100644 --- a/packages/documentation/src/content/docs/integration/deployment.md +++ b/packages/documentation/src/content/docs/integration/deployment.md @@ -105,6 +105,7 @@ Now, the Admin UI can be found on localhost:3010. | `WEBHOOK_WORKERS` | backend.workers.webhook | `1` | number of workers processing webhook events | | `WEBHOOK_WORKER_IDLE` | backend.workerIdle | `200` | time in milliseconds that WEBHOOK_WORKERS will wait until they check an empty webhook event queue again | | `WITHDRAWAL_THROTTLE_DELAY` | backend.withdrawalThrottleDelay | `undefined` | delay in liquidity withdrawal processing | +| `ENABLE_MANUAL_MIGRATIONS` | backend.enableManualMigrations | `false` | When set to true, user needs to run database manually with command `npm run knex -- migrate:latest --env production` | #### Auth @@ -129,6 +130,7 @@ Now, the Admin UI can be found on localhost:3010. | `QUOTE_INTERACTION` | auth.interaction.quote | `false` | flag - quote grants are interactive or not | | `TRUST_PROXY` | | `false` | flag to use X-Forwarded-Proto header to determine if connections is secure | | `WAIT_SECONDS` | auth.grant.waitSeconds | `5` | wait time included in grant request response (`grant.continue`) | +| `ENABLE_MANUAL_MIGRATIONS` | auth.enableManualMigrations | `false` | When set to true, user needs to run database manually with command `npm run knex -- migrate:latest --env production` | #### Frontend diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 7a60460b4b..416aebfd85 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -11,7 +11,7 @@ "typecheck": "tsc" }, "dependencies": { - "@apollo/client": "^3.9.8", + "@apollo/client": "^3.9.9", "@headlessui/react": "^1.7.18", "@remix-run/node": "^2.6.0", "@remix-run/react": "^2.6.0", @@ -29,7 +29,7 @@ "@remix-run/dev": "^2.6.0", "@remix-run/eslint-config": "^2.6.0", "@tailwindcss/forms": "^0.5.7", - "@types/react": "^18.2.67", + "@types/react": "^18.2.73", "@types/react-dom": "^18.2.22", "@types/uuid": "^9.0.8", "autoprefixer": "^10.4.19", diff --git a/packages/mock-account-service-lib/package.json b/packages/mock-account-service-lib/package.json index 9144e9cf46..f68779120f 100644 --- a/packages/mock-account-service-lib/package.json +++ b/packages/mock-account-service-lib/package.json @@ -16,11 +16,11 @@ "@types/uuid": "^9.0.8" }, "dependencies": { - "@apollo/client": "^3.9.8", + "@apollo/client": "^3.9.9", "@interledger/http-signature-utils": "2.0.2", "graphql": "^16.8.1", "pino": "^8.19.0", - "pino-pretty": "^10.3.1", + "pino-pretty": "^11.0.0", "uuid": "^9.0.1" } } diff --git a/packages/mock-account-service-lib/src/account-provider.ts b/packages/mock-account-service-lib/src/account-provider.ts index 5be375a920..37554fadec 100644 --- a/packages/mock-account-service-lib/src/account-provider.ts +++ b/packages/mock-account-service-lib/src/account-provider.ts @@ -60,7 +60,7 @@ export class AccountProvider implements AccountsServer { const acc = this.accounts.get(id) if (!acc) { - throw new Error() + throw new Error('account not found') } acc.walletAddress = walletAddress @@ -139,7 +139,7 @@ export class AccountProvider implements AccountsServer { const acc = this.accounts.get(id) if (!acc) { - throw new Error() + throw new Error('account not found') } if (clearPending && acc.creditsPending - amount < 0) { @@ -167,7 +167,7 @@ export class AccountProvider implements AccountsServer { const acc = this.accounts.get(id) if (!acc) { - throw new Error() + throw new Error('account not found') } if ( @@ -200,7 +200,7 @@ export class AccountProvider implements AccountsServer { const acc = this.accounts.get(id) if (!acc) { - throw new Error() + throw new Error('account not found') } acc.creditsPending += amount @@ -217,7 +217,7 @@ export class AccountProvider implements AccountsServer { const acc = this.accounts.get(id) if (!acc) { - throw new Error() + throw new Error('account not found') } if (acc.creditsPosted < acc.debitsPosted + acc.debitsPending + amount) { @@ -238,7 +238,7 @@ export class AccountProvider implements AccountsServer { const acc = this.accounts.get(id) if (!acc) { - throw new Error() + throw new Error('account not found') } if (acc.debitsPending - amount < 0) { @@ -259,7 +259,7 @@ export class AccountProvider implements AccountsServer { const acc = this.accounts.get(id) if (!acc) { - throw new Error() + throw new Error('account not found') } if (acc.debitsPending - amount < 0) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a2e03e499f..004e71e8cd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -57,8 +57,8 @@ importers: localenv/mock-account-servicing-entity: dependencies: '@apollo/client': - specifier: ^3.9.8 - version: 3.9.8(@types/react@18.2.67)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) + specifier: ^3.9.9 + version: 3.9.9(@types/react@18.2.73)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) '@interledger/http-signature-utils': specifier: 2.0.2 version: 2.0.2 @@ -103,8 +103,8 @@ importers: specifier: ^2.6.0 version: 2.6.0(@remix-run/serve@2.6.0)(@types/node@18.11.9)(typescript@5.4.3) '@types/react': - specifier: ^18.2.67 - version: 18.2.67 + specifier: ^18.2.73 + version: 18.2.73 '@types/react-dom': specifier: ^18.2.22 version: 18.2.22 @@ -115,14 +115,14 @@ importers: specifier: ^8.2.0 version: 8.2.0 '@apollo/server': - specifier: ^4.10.1 - version: 4.10.1(graphql@16.8.1) + specifier: ^4.10.2 + version: 4.10.2(graphql@16.8.1) '@as-integrations/koa': specifier: ^1.1.1 - version: 1.1.1(@apollo/server@4.10.1)(koa@2.15.1) + version: 1.1.1(@apollo/server@4.10.2)(koa@2.15.2) '@escape.tech/graphql-armor': specifier: ^2.4.0 - version: 2.4.0(@apollo/server@4.10.1) + version: 2.4.0(@apollo/server@4.10.2) '@graphql-tools/graphql-file-loader': specifier: ^8.0.1 version: 8.0.1(graphql@16.8.1) @@ -163,8 +163,8 @@ importers: specifier: ^3.1.0 version: 3.1.0(pg@8.11.3) koa: - specifier: ^2.15.1 - version: 2.15.1 + specifier: ^2.15.2 + version: 2.15.2 koa-bodyparser: specifier: ^4.4.1 version: 4.4.1 @@ -191,8 +191,8 @@ importers: version: 9.0.1 devDependencies: '@apollo/client': - specifier: ^3.9.8 - version: 3.9.8(@types/react@18.2.67)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) + specifier: ^3.9.9 + version: 3.9.9(@types/react@18.2.73)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) '@faker-js/faker': specifier: ^8.4.1 version: 8.4.1 @@ -242,8 +242,8 @@ importers: specifier: ^12.1.3 version: 12.1.3 pino-pretty: - specifier: ^10.3.1 - version: 10.3.1 + specifier: ^11.0.0 + version: 11.0.0 testcontainers: specifier: ^10.7.2 version: 10.7.2 @@ -254,14 +254,14 @@ importers: specifier: ^8.2.0 version: 8.2.0 '@apollo/server': - specifier: ^4.10.1 - version: 4.10.1(graphql@16.8.1) + specifier: ^4.10.2 + version: 4.10.2(graphql@16.8.1) '@as-integrations/koa': specifier: ^1.1.1 - version: 1.1.1(@apollo/server@4.10.1)(koa@2.15.1) + version: 1.1.1(@apollo/server@4.10.2)(koa@2.15.2) '@escape.tech/graphql-armor': specifier: ^2.4.0 - version: 2.4.0(@apollo/server@4.10.1) + version: 2.4.0(@apollo/server@4.10.2) '@faker-js/faker': specifier: ^8.4.1 version: 8.4.1 @@ -350,8 +350,8 @@ importers: specifier: ^3.1.0 version: 3.1.0(pg@8.11.3) koa: - specifier: ^2.15.1 - version: 2.15.1 + specifier: ^2.15.2 + version: 2.15.2 koa-bodyparser: specifier: ^4.4.1 version: 4.4.1 @@ -390,8 +390,8 @@ importers: version: 9.0.1 devDependencies: '@apollo/client': - specifier: ^3.9.8 - version: 3.9.8(@types/react@18.2.67)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) + specifier: ^3.9.9 + version: 3.9.9(@types/react@18.2.73)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) '@graphql-codegen/cli': specifier: 5.0.2 version: 5.0.2(@babel/core@7.24.0)(@types/node@18.19.24)(graphql@16.8.1) @@ -498,8 +498,8 @@ importers: packages/frontend: dependencies: '@apollo/client': - specifier: ^3.9.8 - version: 3.9.8(@types/react@18.2.67)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) + specifier: ^3.9.9 + version: 3.9.9(@types/react@18.2.73)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) '@headlessui/react': specifier: ^1.7.18 version: 1.7.18(react-dom@18.2.0)(react@18.2.0) @@ -547,8 +547,8 @@ importers: specifier: ^0.5.7 version: 0.5.7(tailwindcss@3.4.1) '@types/react': - specifier: ^18.2.67 - version: 18.2.67 + specifier: ^18.2.73 + version: 18.2.73 '@types/react-dom': specifier: ^18.2.22 version: 18.2.22 @@ -577,8 +577,8 @@ importers: packages/mock-account-service-lib: dependencies: '@apollo/client': - specifier: ^3.9.8 - version: 3.9.8(@types/react@18.2.67)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) + specifier: ^3.9.9 + version: 3.9.9(@types/react@18.2.73)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) '@interledger/http-signature-utils': specifier: 2.0.2 version: 2.0.2 @@ -589,8 +589,8 @@ importers: specifier: ^8.19.0 version: 8.19.0 pino-pretty: - specifier: ^10.3.1 - version: 10.3.1 + specifier: ^11.0.0 + version: 11.0.0 uuid: specifier: ^9.0.1 version: 9.0.1 @@ -656,6 +656,9 @@ importers: dotenv: specifier: ^16.4.1 version: 16.4.5 + hostile: + specifier: ^1.4.0 + version: 1.4.0 koa: specifier: ^2.15.0 version: 2.15.1 @@ -747,7 +750,7 @@ packages: hoist-non-react-statics: 3.3.2 optimism: 0.18.0 prop-types: 15.8.1 - rehackt: 0.0.6(@types/react@18.2.67)(react@18.2.0) + rehackt: 0.0.6(@types/react@18.2.73)(react@18.2.0) response-iterator: 0.2.6 symbol-observable: 4.0.0 ts-invariant: 0.10.3 @@ -757,8 +760,8 @@ packages: - '@types/react' dev: true - /@apollo/client@3.9.8(@types/react@18.2.67)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-ausPftEb2xAUkZqz+VkSSIhNxKraShJXdV2/NJ7JbHAAciGsFlapGtZ++b7lF0/+3Jp/p34g/i6dvO8b4WjQig==} + /@apollo/client@3.9.9(@types/react@18.2.73)(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-/sMecU/M0WK9knrguts1lSLV8xFKzIgOMVb4mi6MOxgJXjliDB8PvOtmXhTqh2cVMMR4TzXgOnb+af/690zlQw==} peerDependencies: graphql: ^15.0.0 || ^16.0.0 graphql-ws: ^5.5.5 @@ -786,7 +789,7 @@ packages: prop-types: 15.8.1 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - rehackt: 0.0.6(@types/react@18.2.67)(react@18.2.0) + rehackt: 0.0.6(@types/react@18.2.73)(react@18.2.0) response-iterator: 0.2.6 symbol-observable: 4.0.0 ts-invariant: 0.10.3 @@ -826,8 +829,8 @@ packages: graphql: 16.8.1 dev: false - /@apollo/server@4.10.1(graphql@16.8.1): - resolution: {integrity: sha512-XGMOgTyzV4EBHQq0xQVKFry9hZF7AA/6nxxGLamqdxodhdSdGbU9jrlb5/XDveeGuXP3+5JDdrB2HcziVLJcMA==} + /@apollo/server@4.10.2(graphql@16.8.1): + resolution: {integrity: sha512-qlTZE4XyzMPprtkxFjmPxMwc2KC4nvNQrKXk2PMotEACKcaLXVZFIgstxbSqBCNl2KgzbsgU1g6vvbV6Xcfikw==} engines: {node: '>=14.16.0'} peerDependencies: graphql: ^16.6.0 @@ -1003,15 +1006,15 @@ packages: transitivePeerDependencies: - encoding - /@as-integrations/koa@1.1.1(@apollo/server@4.10.1)(koa@2.15.1): + /@as-integrations/koa@1.1.1(@apollo/server@4.10.2)(koa@2.15.2): resolution: {integrity: sha512-v84cVhkLUxAH9l19pajbWp/Z9ZYTzO7jkAOiY1xndTclfpXZstiWDKejZYq7xpkBtUSSAKzNyM66uox8MP9qVg==} engines: {node: '>=16.0'} peerDependencies: '@apollo/server': ^4.0.0 koa: ^2.0.0 dependencies: - '@apollo/server': 4.10.1(graphql@16.8.1) - koa: 2.15.1 + '@apollo/server': 4.10.2(graphql@16.8.1) + koa: 2.15.2 dev: false /@astrojs/compiler@2.3.2: @@ -2909,7 +2912,7 @@ packages: dev: false optional: true - /@escape.tech/graphql-armor@2.4.0(@apollo/server@4.10.1): + /@escape.tech/graphql-armor@2.4.0(@apollo/server@4.10.2): resolution: {integrity: sha512-/ef11cDjzg3Rjsa7jxtUzM9hRVlj+GB4z/YCChNqNGW+BvYrv6E6esbdGzIiaoauKfszXSQXSu0CgPXe0I7NbQ==} engines: {node: '>=16.0.0'} peerDependencies: @@ -2924,7 +2927,7 @@ packages: '@escape.tech/graphql-armor-types': optional: true dependencies: - '@apollo/server': 4.10.1(graphql@16.8.1) + '@apollo/server': 4.10.2(graphql@16.8.1) '@escape.tech/graphql-armor-block-field-suggestions': 2.1.0 '@escape.tech/graphql-armor-cost-limit': 2.1.0 '@escape.tech/graphql-armor-max-aliases': 2.3.0 @@ -3760,7 +3763,7 @@ packages: engines: {node: ^8.13.0 || >=10.10.0} dependencies: '@grpc/proto-loader': 0.7.10 - '@types/node': 18.19.19 + '@types/node': 18.19.24 dev: false /@grpc/proto-loader@0.7.10: @@ -3859,7 +3862,7 @@ packages: '@apidevtools/json-schema-ref-parser': 10.1.0 ajv: 8.12.0 ajv-formats: 2.1.1(ajv@8.12.0) - koa: 2.15.1 + koa: 2.15.2 openapi-default-setter: 12.1.3 openapi-request-coercer: 12.1.3 openapi-request-validator: 12.1.3 @@ -3932,7 +3935,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 18.19.19 + '@types/node': 18.19.24 chalk: 4.1.2 jest-message-util: 29.7.0 jest-util: 29.7.0 @@ -4055,7 +4058,7 @@ packages: '@jest/transform': 29.7.0 '@jest/types': 29.6.3 '@jridgewell/trace-mapping': 0.3.23 - '@types/node': 18.19.19 + '@types/node': 18.19.24 chalk: 4.1.2 collect-v8-coverage: 1.0.1 exit: 0.1.2 @@ -4263,6 +4266,13 @@ packages: path-to-regexp: 6.2.1 dev: false + /@ljharb/through@2.3.13: + resolution: {integrity: sha512-/gKJun8NNiWGZJkGzI/Ragc53cOdcLNdzjLaIa+GEjguQs0ulsurx8WN0jijdK9yPqDvziX995sMRLyLt1uZMQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + dev: true + /@mdx-js/mdx@2.3.0: resolution: {integrity: sha512-jLuwRlz8DQfQNiUCJR50Y09CGPq3fLtmtUQfVrj79E0JWu3dvsVcxVIcfhR5h0iXu+/z++zDrYeiJqifRynJkA==} dependencies: @@ -5305,7 +5315,7 @@ packages: /@types/docker-modem@3.0.6: resolution: {integrity: sha512-yKpAGEuKRSS8wwx0joknWxsmLha78wNMe9R2S3UNsVOkZded8UqOrV8KoeDXoXsjndxwyF3eIhyClGbO1SEhEg==} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 '@types/ssh2': 0.5.52 dev: true @@ -5343,7 +5353,7 @@ packages: /@types/graceful-fs@4.1.5: resolution: {integrity: sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 dev: true /@types/hast@2.3.4: @@ -5526,27 +5536,27 @@ packages: /@types/node-fetch@2.6.11: resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 form-data: 4.0.0 dev: false /@types/node-fetch@2.6.2: resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 form-data: 3.0.1 dev: true /@types/node-localstorage@1.3.2: resolution: {integrity: sha512-i3KDc7Y5xQgR395Gw9nn0H/HbY0VC131pqfF2PYMbvNpvDugJ95xpSseudiJV4vcQxnj2g24yys83eMEB+Ewgw==} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 dev: true /@types/node-persist@3.1.5: resolution: {integrity: sha512-etovBJhoENhCxgmxf1gEnu4Wsq/JQy2lTaXVypuA85KkY0A7/pGbgwELtXTgwj2DVgRUb6IAhG8GHEqLPCogVA==} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 dev: true /@types/node@17.0.45: @@ -5592,21 +5602,20 @@ packages: /@types/react-dom@18.2.22: resolution: {integrity: sha512-fHkBXPeNtfvri6gdsMYyW+dW7RXFo6Ad09nLFK0VQWR7yGLai/Cyvyj696gbwYvBnhGtevUG9cET0pmUbMtoPQ==} dependencies: - '@types/react': 18.2.67 + '@types/react': 18.2.73 dev: true - /@types/react@18.2.67: - resolution: {integrity: sha512-vkIE2vTIMHQ/xL0rgmuoECBCkZFZeHr49HeWSc24AptMbNRo7pwSBvj73rlJJs9fGKj0koS+V7kQB1jHS0uCgw==} + /@types/react@18.2.73: + resolution: {integrity: sha512-XcGdod0Jjv84HOC7N5ziY3x+qL0AfmubvKOZ9hJjJ2yd5EE+KYjWhdOjt387e9HPheHkdggF9atTifMRtyAaRA==} dependencies: '@types/prop-types': 15.7.5 - '@types/scheduler': 0.16.2 csstype: 3.1.0 /@types/request@2.48.8: resolution: {integrity: sha512-whjk1EDJPcAR2kYHRbFl/lKeeKYTi05A15K9bnLInCVroNDCtXce57xKdI0/rQaA3K+6q0eFyUBPmqfSndUZdQ==} dependencies: '@types/caseless': 0.12.2 - '@types/node': 18.19.19 + '@types/node': 18.19.24 '@types/tough-cookie': 4.0.2 form-data: 2.5.1 dev: true @@ -5618,12 +5627,9 @@ packages: /@types/sax@1.2.4: resolution: {integrity: sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 dev: false - /@types/scheduler@0.16.2: - resolution: {integrity: sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==} - /@types/semver@7.5.0: resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==} dev: true @@ -5650,13 +5656,13 @@ packages: /@types/ssh2-streams@0.1.9: resolution: {integrity: sha512-I2J9jKqfmvXLR5GomDiCoHrEJ58hAOmFrekfFqmCFd+A6gaEStvWnPykoWUwld1PNg4G5ag1LwdA+Lz1doRJqg==} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 dev: true /@types/ssh2@0.5.52: resolution: {integrity: sha512-lbLLlXxdCZOSJMCInKH2+9V/77ET2J6NPQHpFI0kda61Dd1KglJs+fPQBchizmzYSOJBgdTajhPqBO1xxLywvg==} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 '@types/ssh2-streams': 0.1.9 dev: true @@ -5668,7 +5674,7 @@ packages: resolution: {integrity: sha512-mu/N4uvfDN2zVQQ5AYJI/g4qxn2bHB6521t1UuH09ShNWjebTqN0ZFuYK9uYjcgmI0dTQEs+Owi1EO6U0OkOZQ==} dependencies: '@types/cookiejar': 2.1.2 - '@types/node': 18.19.19 + '@types/node': 18.19.24 dev: true /@types/tmp@0.2.6: @@ -5695,13 +5701,13 @@ packages: /@types/ws@7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 dev: true /@types/ws@8.5.3: resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 /@types/yargs-parser@21.0.0: resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==} @@ -10259,6 +10265,17 @@ packages: lru-cache: 7.18.3 dev: true + /hostile@1.4.0: + resolution: {integrity: sha512-q5eniv6NnjeQ2S1Wh3/knyl4UE2FAQ9xz7yT0f6y5FK2j3fFHBI2jyaUVwAiAU20G6LQMAkRGM1WbTMXoeUwMg==} + hasBin: true + dependencies: + '@ljharb/through': 2.3.13 + chalk: 4.1.2 + minimist: 1.2.8 + once: 1.4.0 + split: 1.0.1 + dev: true + /html-encoding-sniffer@4.0.0: resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==} engines: {node: '>=18'} @@ -11085,7 +11102,7 @@ packages: '@jest/expect': 29.7.0 '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 18.19.19 + '@types/node': 18.19.24 chalk: 4.1.2 co: 4.6.0 dedent: 1.2.0 @@ -11240,7 +11257,7 @@ packages: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.5 - '@types/node': 18.19.19 + '@types/node': 18.19.24 anymatch: 3.1.2 fb-watchman: 2.0.1 graceful-fs: 4.2.10 @@ -11365,7 +11382,7 @@ packages: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 18.19.19 + '@types/node': 18.19.24 chalk: 4.1.2 emittery: 0.13.1 graceful-fs: 4.2.10 @@ -11396,7 +11413,7 @@ packages: '@jest/test-result': 29.7.0 '@jest/transform': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 18.19.19 + '@types/node': 18.19.24 chalk: 4.1.2 cjs-module-lexer: 1.2.2 collect-v8-coverage: 1.0.1 @@ -11473,7 +11490,7 @@ packages: dependencies: '@jest/test-result': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 18.19.19 + '@types/node': 18.19.24 ansi-escapes: 4.3.2 chalk: 4.1.2 emittery: 0.13.1 @@ -11485,7 +11502,7 @@ packages: resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@types/node': 18.19.19 + '@types/node': 18.19.24 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -11809,6 +11826,37 @@ packages: vary: 1.1.2 transitivePeerDependencies: - supports-color + dev: true + + /koa@2.15.2: + resolution: {integrity: sha512-MXTeZH3M6AJ8ukW2QZ8wqO3Dcdfh2WRRmjCBkEP+NhKNCiqlO5RDqHmSnsyNrbRJrdjyvIGSJho4vQiWgQJSVA==} + engines: {node: ^4.8.4 || ^6.10.1 || ^7.10.1 || >= 8.1.4} + dependencies: + accepts: 1.3.8 + cache-content-type: 1.0.1 + content-disposition: 0.5.4 + content-type: 1.0.5 + cookies: 0.9.1 + debug: 4.3.4(supports-color@9.4.0) + delegates: 1.0.0 + depd: 2.0.0 + destroy: 1.2.0 + encodeurl: 1.0.2 + escape-html: 1.0.3 + fresh: 0.5.2 + http-assert: 1.5.0 + http-errors: 1.8.1 + is-generator-function: 1.0.10 + koa-compose: 4.1.0 + koa-convert: 2.0.0 + on-finished: 2.4.1 + only: 0.0.2 + parseurl: 1.3.3 + statuses: 1.5.0 + type-is: 1.6.18 + vary: 1.1.2 + transitivePeerDependencies: + - supports-color /language-subtag-registry@0.3.22: resolution: {integrity: sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w==} @@ -13021,6 +13069,10 @@ packages: /minimist@1.2.6: resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==} + /minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + dev: true + /minipass-collect@1.0.2: resolution: {integrity: sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==} engines: {node: '>= 8'} @@ -14042,8 +14094,8 @@ packages: readable-stream: 4.1.0 split2: 4.1.0 - /pino-pretty@10.3.1: - resolution: {integrity: sha512-az8JbIYeN/1iLj2t0jR9DV48/LQ3RC6hZPpapKPkb84Q+yTidMCpgWxIT3N0flnBDilyBQ1luWNpOeJptjdp/g==} + /pino-pretty@11.0.0: + resolution: {integrity: sha512-YFJZqw59mHIY72wBnBs7XhLGG6qpJMa4pEQTRgEPEbjIYbng2LXEZZF1DoyDg9CfejEy8uZCyzpcBXXG0oOCwQ==} hasBin: true dependencies: colorette: 2.0.19 @@ -14540,7 +14592,7 @@ packages: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 18.19.19 + '@types/node': 18.19.24 long: 5.2.3 dev: false @@ -14836,7 +14888,7 @@ packages: engines: {node: '>=8'} dev: true - /rehackt@0.0.6(@types/react@18.2.67)(react@18.2.0): + /rehackt@0.0.6(@types/react@18.2.73)(react@18.2.0): resolution: {integrity: sha512-l3WEzkt4ntlEc/IB3/mF6SRgNHA6zfQR7BlGOgBTOmx7IJJXojDASav+NsgXHFjHn+6RmwqsGPFgZpabWpeOdw==} peerDependencies: '@types/react': '*' @@ -14847,7 +14899,7 @@ packages: react: optional: true dependencies: - '@types/react': 18.2.67 + '@types/react': 18.2.73 react: 18.2.0 /rehype-mathjax@6.0.0: @@ -15608,6 +15660,12 @@ packages: resolution: {integrity: sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ==} engines: {node: '>= 10.x'} + /split@1.0.1: + resolution: {integrity: sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==} + dependencies: + through: 2.3.8 + dev: true + /sponge-case@1.0.1: resolution: {integrity: sha512-dblb9Et4DAtiZ5YSUZHLl4XhH4uK80GhAZrVXdN4O2P4gQ40Wa5UIOPUHlA/nFd2PLblBZWUioLMMAVrgpoYcA==} dependencies: diff --git a/test/integration/integration.test.ts b/test/integration/integration.test.ts index 3ae69d7811..7b27b5d9da 100644 --- a/test/integration/integration.test.ts +++ b/test/integration/integration.test.ts @@ -39,9 +39,9 @@ describe('Integration tests', (): void => { describe('Open Payments Flow', (): void => { const receiverWalletAddressUrl = - 'http://host.docker.internal:4000/accounts/pfry' + 'http://happy-life-bank-test-backend:4000/accounts/pfry' const senderWalletAddressUrl = - 'http://host.docker.internal:3000/accounts/gfranklin' + 'http://cloud-nine-wallet-test-backend:3000/accounts/gfranklin' let receiverWalletAddress: WalletAddress let senderWalletAddress: WalletAddress @@ -70,7 +70,7 @@ describe('Integration tests', (): void => { test('Can Get Non-Existing Wallet Address', async (): Promise => { const notFoundWalletAddress = - 'https://host.docker.internal:4000/accounts/asmith' + 'https://happy-life-bank-test-backend:4000/accounts/asmith' const handleWebhookEventSpy = jest.spyOn( hlb.integrationServer.webhookEventHandler, @@ -458,7 +458,7 @@ describe('Integration tests', (): void => { describe('Peer to Peer Flow', (): void => { const receiverWalletAddressUrl = - 'https://host.docker.internal:4000/accounts/pfry' + 'https://happy-life-bank-test-backend:4000/accounts/pfry' const amountValueToSend = '500' let gfranklinWalletAddressId: string @@ -468,7 +468,7 @@ describe('Integration tests', (): void => { beforeAll(async () => { const gfranklinWalletAddress = await c9.accounts.getByWalletAddressUrl( - 'https://host.docker.internal:3000/accounts/gfranklin' + 'https://cloud-nine-wallet-test-backend:3000/accounts/gfranklin' ) assert(gfranklinWalletAddress?.walletAddressID) gfranklinWalletAddressId = gfranklinWalletAddress.walletAddressID diff --git a/test/integration/lib/integration-server.ts b/test/integration/lib/integration-server.ts index 2c0dcd2d76..f4d3088574 100644 --- a/test/integration/lib/integration-server.ts +++ b/test/integration/lib/integration-server.ts @@ -54,9 +54,7 @@ export class IntegrationServer { } }) - this.server = this.app.listen(port, () => { - console.log(`Integration server listening on port ${port}`) - }) + this.server = this.app.listen(port) } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/test/integration/package.json b/test/integration/package.json index c9b8671819..48abdaf892 100644 --- a/test/integration/package.json +++ b/test/integration/package.json @@ -7,7 +7,8 @@ "build:deps": "pnpm --filter mock-account-service-lib build", "testenv:compose": "docker compose -f ./testenv/cloud-nine-wallet/docker-compose.yml -f ./testenv/happy-life-bank/docker-compose.yml -f ./testenv/docker-compose.yml", "test": "jest", - "run-tests": "./scripts/run-tests.sh" + "run-tests": "./scripts/run-tests.sh", + "hostile": "hostile" }, "keywords": [], "author": "", @@ -22,6 +23,7 @@ "@types/node": "^18.19.19", "@types/uuid": "^9.0.8", "dotenv": "^16.4.1", + "hostile": "^1.4.0", "koa": "^2.15.0", "mock-account-service-lib": "workspace:*", "uuid": "^9.0.1", diff --git a/test/integration/scripts/run-tests.sh b/test/integration/scripts/run-tests.sh index 3199ca78ce..d91e9be99e 100755 --- a/test/integration/scripts/run-tests.sh +++ b/test/integration/scripts/run-tests.sh @@ -1,7 +1,7 @@ #!/bin/bash # This script runs the integration tests. It starts the test environment, runs the tests, -# saves the container logs to a file, and stops the containers. +# and stops the containers. It saves the container logs to a file and edits /etc/hosts. # Usage: # ./script.sh # Run the script with default options # ./script.sh --build # Re-build the docker images (-b or --build) @@ -23,16 +23,36 @@ while [[ $# -gt 0 ]]; do esac done +# setup hosts +addHost() { + local hostname="$1" + + # check first to avoid sudo prompt if host is already set + if pnpm --filter integration hostile list | grep -q "127.0.0.1 $hostname"; then + echo "$hostname already set" + else + sudo pnpm --filter integration hostile set 127.0.0.1 "$hostname" + if [ $? -ne 0 ]; then + echo "Error: Failed to write hosts to hostfile." + exit 1 + fi + fi +} +addHost "cloud-nine-wallet-test-backend" +addHost "cloud-nine-wallet-test-auth" +addHost "happy-life-bank-test-backend" +addHost "happy-life-bank-test-auth" + +# idempotent start pnpm --filter integration testenv:compose down --volumes pnpm --filter integration testenv:compose up -d --wait $build_flag - if [ $? -ne 0 ]; then echo "Error: Failed to start containers." exit 1 fi +# run tests mkdir -p ./tmp pnpm --filter integration testenv:compose logs -f > "$log_file" 2>&1 & - pnpm --filter integration test pnpm --filter integration testenv:compose down --volumes diff --git a/test/integration/testenv/cloud-nine-wallet/.env b/test/integration/testenv/cloud-nine-wallet/.env index edc1fb68b0..59a116e613 100644 --- a/test/integration/testenv/cloud-nine-wallet/.env +++ b/test/integration/testenv/cloud-nine-wallet/.env @@ -1,7 +1,7 @@ -OPEN_PAYMENTS_URL=https://host.docker.internal:3000 -AUTH_SERVER_DOMAIN=http://host.docker.internal:3006 +OPEN_PAYMENTS_URL=https://cloud-nine-wallet-test-backend:3000 +AUTH_SERVER_DOMAIN=http://cloud-nine-wallet-test-auth:3006 INTEGRATION_SERVER_PORT=8888 -WALLET_ADDRESS_URL=https://host.docker.internal:3000/.well-known/pay -GRAPHQL_URL=http://host.docker.internal:3001/graphql +WALLET_ADDRESS_URL=https://cloud-nine-wallet-test-backend:3000/.well-known/pay +GRAPHQL_URL=http://cloud-nine-wallet-test-backend:3001/graphql # matches pfry key id KEY_ID=keyid-97a3a431-8ee1-48fc-ac85-70e2f5eba8e5 \ No newline at end of file diff --git a/test/integration/testenv/cloud-nine-wallet/docker-compose.yml b/test/integration/testenv/cloud-nine-wallet/docker-compose.yml index aa2d7ae53b..c013fbed56 100644 --- a/test/integration/testenv/cloud-nine-wallet/docker-compose.yml +++ b/test/integration/testenv/cloud-nine-wallet/docker-compose.yml @@ -23,13 +23,13 @@ services: ADMIN_PORT: 3001 OPEN_PAYMENTS_PORT: 3000 DATABASE_URL: postgresql://cloud_nine_wallet_test_backend:cloud_nine_wallet_test_backend@shared-database/cloud_nine_wallet_test_backend - OPEN_PAYMENTS_URL: https://host.docker.internal:3000 - WALLET_ADDRESS_URL: https://host.docker.internal:3000/.well-known/pay + OPEN_PAYMENTS_URL: https://cloud-nine-wallet-test-backend:3000 + WALLET_ADDRESS_URL: https://cloud-nine-wallet-test-backend:3000/.well-known/pay # matches pfry key id KEY_ID: keyid-97a3a431-8ee1-48fc-ac85-70e2f5eba8e5 PRIVATE_KEY_FILE: /workspace/private-key.pem - AUTH_SERVER_INTROSPECTION_URL: http://host.docker.internal:3007 - AUTH_SERVER_GRANT_URL: http://host.docker.internal:3006 + AUTH_SERVER_INTROSPECTION_URL: http://cloud-nine-wallet-test-auth:3007 + AUTH_SERVER_GRANT_URL: http://cloud-nine-wallet-test-auth:3006 ILP_ADDRESS: test.cloud-nine-wallet-test STREAM_SECRET: BjPXtnd00G2mRQwP/8ZpwyZASOch5sUXT5o0iR5b5wU= WEBHOOK_URL: http://host.docker.internal:8888/webhooks @@ -53,11 +53,9 @@ services: - '3003:3003' - '3006:3006' - '3007:3007' - extra_hosts: - - 'host.docker.internal:host-gateway' environment: NODE_ENV: ${NODE_ENV:-development} - AUTH_SERVER_DOMAIN: http://host.docker.internal:3006 + AUTH_SERVER_DOMAIN: http://cloud-nine-wallet-test-auth:3006 AUTH_DATABASE_URL: postgresql://cloud_nine_wallet_test_auth:cloud_nine_wallet_test_auth@shared-database/cloud_nine_wallet_test_auth INTROSPECTION_PORT: 3007 AUTH_PORT: 3006 diff --git a/test/integration/testenv/cloud-nine-wallet/seed.yml b/test/integration/testenv/cloud-nine-wallet/seed.yml index 3419f16034..5fca3f18db 100644 --- a/test/integration/testenv/cloud-nine-wallet/seed.yml +++ b/test/integration/testenv/cloud-nine-wallet/seed.yml @@ -18,7 +18,7 @@ assets: peeringAsset: 'USD' peers: - initialLiquidity: '100000' - peerUrl: http://host.docker.internal:4002 + peerUrl: http://happy-life-bank-test-backend:4002 peerIlpAddress: test.happy-life-bank-test liquidityThreshold: 10000 accounts: diff --git a/test/integration/testenv/happy-life-bank/.env b/test/integration/testenv/happy-life-bank/.env index 83cc2ecef7..e2f6e5e72e 100644 --- a/test/integration/testenv/happy-life-bank/.env +++ b/test/integration/testenv/happy-life-bank/.env @@ -1,7 +1,7 @@ -OPEN_PAYMENTS_URL=https://host.docker.internal:4000 -AUTH_SERVER_DOMAIN=http://host.docker.internal:4006 +OPEN_PAYMENTS_URL=https://happy-life-bank-test-backend:4000 +AUTH_SERVER_DOMAIN=http://happy-life-bank-test-auth:4006 INTEGRATION_SERVER_PORT=8889 -WALLET_ADDRESS_URL=https://host.docker.internal:4000/accounts/pfry -GRAPHQL_URL=http://host.docker.internal:4001/graphql +WALLET_ADDRESS_URL=https://happy-life-bank-test-backend:4000/accounts/pfry +GRAPHQL_URL=http://happy-life-bank-test-backend:4001/graphql # matches pfry key id KEY_ID=keyid-97a3a431-8ee1-48fc-ac85-70e2f5eba8e5 \ No newline at end of file diff --git a/test/integration/testenv/happy-life-bank/docker-compose.yml b/test/integration/testenv/happy-life-bank/docker-compose.yml index cc15f65446..d18b128dfc 100644 --- a/test/integration/testenv/happy-life-bank/docker-compose.yml +++ b/test/integration/testenv/happy-life-bank/docker-compose.yml @@ -17,14 +17,14 @@ services: environment: NODE_ENV: development LOG_LEVEL: debug - OPEN_PAYMENTS_URL: https://host.docker.internal:4000 - WALLET_ADDRESS_URL: https://host.docker.internal:4000/.well-known/pay + OPEN_PAYMENTS_URL: https://happy-life-bank-test-backend:4000 + WALLET_ADDRESS_URL: https://happy-life-bank-test-backend:4000/.well-known/pay ADMIN_PORT: 4001 CONNECTOR_PORT: 4002 OPEN_PAYMENTS_PORT: 4000 DATABASE_URL: postgresql://happy_life_bank_test_backend:happy_life_bank_test_backend@shared-database/happy_life_bank_test_backend - AUTH_SERVER_GRANT_URL: http://host.docker.internal:4006 - AUTH_SERVER_INTROSPECTION_URL: http://host.docker.internal:4007 + AUTH_SERVER_GRANT_URL: http://happy-life-bank-test-auth:4006 + AUTH_SERVER_INTROSPECTION_URL: http://happy-life-bank-test-auth:4007 # matches pfry key id KEY_ID: keyid-97a3a431-8ee1-48fc-ac85-70e2f5eba8e5 PRIVATE_KEY_FILE: /workspace/private-key.pem @@ -53,12 +53,10 @@ services: - '4003:4003' - '4006:4006' - '4007:4007' - extra_hosts: - - 'host.docker.internal:host-gateway' environment: NODE_ENV: development AUTH_DATABASE_URL: postgresql://happy_life_bank_test_auth:happy_life_bank_test_auth@shared-database/happy_life_bank_test_auth - AUTH_SERVER_DOMAIN: http://host.docker.internal:4006 + AUTH_SERVER_DOMAIN: http://happy-life-bank-test-auth:4006 INTROSPECTION_PORT: 4007 ADMIN_PORT: 4003 AUTH_PORT: 4006 diff --git a/test/integration/testenv/happy-life-bank/seed.yml b/test/integration/testenv/happy-life-bank/seed.yml index 2da51e7caa..9d881dbcc8 100644 --- a/test/integration/testenv/happy-life-bank/seed.yml +++ b/test/integration/testenv/happy-life-bank/seed.yml @@ -18,7 +18,7 @@ assets: peeringAsset: 'USD' peers: - initialLiquidity: '1000000000000' - peerUrl: http://host.docker.internal:3002 + peerUrl: http://cloud-nine-wallet-test-backend:3002 peerIlpAddress: test.cloud-nine-wallet-test liquidityThreshold: 100000 accounts: