Skip to content

Commit

Permalink
chore: migrate dependencies to corev3 (#122)
Browse files Browse the repository at this point in the history
* chore: migrate to corev3

* chore: migrate dependencies in yarnrc to latest

* chore: update yarn.lock

* fix: remove custom transaction handler and replace it with default one

* chore: add publish commands
  • Loading branch information
KovacZan authored Sep 23, 2021
1 parent abb805e commit 50afcf9
Show file tree
Hide file tree
Showing 161 changed files with 1,282 additions and 2,779 deletions.
1,814 changes: 541 additions & 1,273 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/dlv-npm-1.1.3-187c903a21-d7381bca22.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/dset-npm-2.1.0-cdaa38ed50-9fdb325dde.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/nopt-npm-4.0.3-b35e68a869-66cd3b6021.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
29 changes: 14 additions & 15 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
packageExtensions:
"@arkecosystem/core-kernel@*":
dependencies:
"@arkecosystem/core-api": next
"@arkecosystem/core-blockchain": next
"@arkecosystem/core-database": next
"@arkecosystem/core-forger": next
"@arkecosystem/core-logger-pino": next
"@arkecosystem/core-magistrate-api": next
"@arkecosystem/core-magistrate-transactions": next
"@arkecosystem/core-manager": next
"@arkecosystem/core-p2p": next
"@arkecosystem/core-snapshots": next
"@arkecosystem/core-state": next
"@arkecosystem/core-transaction-pool": next
"@arkecosystem/core-transactions": next
"@arkecosystem/core-webhooks": next
"@arkecosystem/core-api": latest
"@arkecosystem/core-blockchain": latest
"@arkecosystem/core-database": latest
"@arkecosystem/core-forger": latest
"@arkecosystem/core-logger-pino": latest
"@arkecosystem/core-magistrate-api": latest
"@arkecosystem/core-magistrate-transactions": latest
"@arkecosystem/core-p2p": latest
"@arkecosystem/core-snapshots": latest
"@arkecosystem/core-state": latest
"@arkecosystem/core-transaction-pool": latest
"@arkecosystem/core-transactions": latest
"@arkecosystem/core-webhooks": latest
"@protokol/guardian-api": "workspace:packages/guardian-api"
"@protokol/guardian-transactions": "workspace:packages/guardian-transactions"
"@arkecosystem/core-magistrate-api@*":
dependencies:
"@arkecosystem/crypto": next
"@arkecosystem/crypto": latest
"@arkecosystem/core-manager@*":
dependencies:
lodash: latest
Expand Down
3 changes: 0 additions & 3 deletions config/networks/testnet/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
{
"package": "@arkecosystem/core-logger-pino"
},
{
"package": "@arkecosystem/core-manager"
},
{
"package": "@arkecosystem/core-state"
},
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"scripts": {
"publish:beta": "yarn workspaces foreach -pt run publish:beta",
"publish": "yarn workspaces foreach -pt --no-private run publish",
"build": "yarn workspaces foreach -pt run build",
"clean": "yarn workspaces foreach -pt run clean",
"version": "yarn workspaces foreach version",
Expand All @@ -34,8 +35,8 @@
"full:testnet": "cross-env CORE_PATH_CONFIG=./config/networks/testnet ark core:run --networkStart --env=test --network=testnet"
},
"dependencies": {
"@arkecosystem/core": "^3.0.0-next",
"@arkecosystem/core-cli": "^3.0.0-next"
"@arkecosystem/core": "^3.0.0",
"@arkecosystem/core-cli": "^3.0.0"
},
"devDependencies": {
"@sindresorhus/tsconfig": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
{
"package": "@arkecosystem/core-logger-pino"
},
{
"package": "@arkecosystem/core-manager"
},
{
"package": "@arkecosystem/core-state"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Utils as AppUtils } from "@arkecosystem/core-kernel";
import { Sandbox } from "@arkecosystem/core-test-framework";
import { Managers } from "@arkecosystem/crypto";
import { EventEmitter } from "events";

EventEmitter.prototype.constructor = Object.prototype.constructor;

const sandbox: Sandbox = new Sandbox();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("API - Post transaction", () => {
transactions: [actual.data],
});

// response should be 403 (without custom error handler is 500)
expect(response.data.statusCode).toBe(403);
expect(response.statusCode).toBe(200);
expect(response.data.data.invalid[0]).toStrictEqual(actual.id);
});
});
5 changes: 4 additions & 1 deletion packages/guardian-api/__tests__/unit/__support__/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Application, Container, Contracts, Providers, Services } from "@arkecosystem/core-kernel";
import { Wallets } from "@arkecosystem/core-state";
import { Handlers } from "@arkecosystem/core-transactions";
import { Handlers, ServiceProvider } from "@arkecosystem/core-transactions";
import { Identities, Utils } from "@arkecosystem/crypto";
import { Handlers as GuardianHandlers, Indexers } from "@protokol/guardian-transactions";

Expand Down Expand Up @@ -92,6 +92,9 @@ export const initApp = (): Application => {
.to(Handlers.TransactionHandlerProvider)
.inSingletonScope();
app.bind(Container.Identifiers.TransactionHandlerRegistry).to(Handlers.Registry).inSingletonScope();
app.bind(Container.Identifiers.TransactionHandlerConstructors).toDynamicValue(
ServiceProvider.getTransactionHandlerConstructorsBinding(),
);

app.bind(Container.Identifiers.EventDispatcherService).to(Services.Events.NullEventDispatcher).inSingletonScope();

Expand Down
23 changes: 12 additions & 11 deletions packages/guardian-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,27 @@
"test:unit:coverage": "jest __tests__/unit --coverage",
"test:integration": "jest __tests__/integration --runInBand --forceExit",
"test:integration:coverage": "jest __tests__/integration --coverage --runInBand --forceExit",
"publish:beta": "yarn build && yarn npm publish --tag beta --access public --tolerate-republish"
"publish:beta": "yarn build && yarn npm publish --tag beta --access public --tolerate-republish",
"publish": "yarn build && yarn npm publish --access public --tolerate-republish"
},
"dependencies": {
"@arkecosystem/core-api": "^3.0.0-next",
"@arkecosystem/core-kernel": "^3.0.0-next",
"@arkecosystem/crypto": "^3.0.0-next",
"@arkecosystem/core-api": "^3.0.0",
"@arkecosystem/core-kernel": "^3.0.0",
"@arkecosystem/crypto": "^3.0.0",
"@hapi/boom": "^9.1.0",
"@hapi/hapi": "^20.0.2",
"@protokol/guardian-crypto": "workspace:packages/guardian-crypto",
"@protokol/guardian-transactions": "workspace:packages/guardian-transactions",
"joi": "^17.3.0",
"joi": "^17.4.2",
"latest-version": "^5.1.0"
},
"devDependencies": {
"@arkecosystem/core-database": "^3.0.0-next",
"@arkecosystem/core-kernel": "^3.0.0-next",
"@arkecosystem/core-state": "^3.0.0-next",
"@arkecosystem/core-test-framework": "^3.0.0-next",
"@arkecosystem/core-transaction-pool": "^3.0.0-next",
"@arkecosystem/core-transactions": "^3.0.0-next",
"@arkecosystem/core-database": "^3.0.0",
"@arkecosystem/core-kernel": "^3.0.0",
"@arkecosystem/core-state": "^3.0.0",
"@arkecosystem/core-test-framework": "^3.0.0",
"@arkecosystem/core-transaction-pool": "^3.0.0",
"@arkecosystem/core-transactions": "^3.0.0",
"@sindresorhus/tsconfig": "^2.0.0",
"@types/eslint": "^7.2.10",
"@types/eslint-plugin-prettier": "^3.1.0",
Expand Down
21 changes: 0 additions & 21 deletions packages/guardian-api/src/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { Server } from "@arkecosystem/core-api";
import Boom from "@hapi/boom";
import Hapi from "@hapi/hapi";
import { Errors } from "@protokol/guardian-transactions";

import * as Configurations from "./routes/configurations";
import * as Groups from "./routes/groups";
Expand All @@ -16,21 +13,3 @@ export const Handler = {
name: "Guardian Api",
version: "1.0.0",
};

export const initForbiddenErrorHandler = (server: Server): void => {
const route = server.getRoute("POST", "/api/transactions");
if (!route) return;

const originalHandler = route.settings.handler.bind(route.settings.bind);
route.settings.handler = async (request: Hapi.Request, h: Hapi.ResponseToolkit) => {
try {
return await originalHandler(request, h);
} catch (err) {
if (err instanceof Errors.WalletDoesntHavePermissionsError) {
return Boom.forbidden(`Sending of ${err.type}/${err.group!} not allowed for this sender`);
}

throw err;
}
};
};
3 changes: 1 addition & 2 deletions packages/guardian-api/src/service-provider.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Identifiers as ApiIdentifiers, Server } from "@arkecosystem/core-api";
import { Container, Contracts, Providers } from "@arkecosystem/core-kernel";

import { Handler, initForbiddenErrorHandler } from "./handlers";
import { Handler } from "./handlers";
import { Identifiers } from "./identifiers";
import { GroupSearchService, UserSearchService } from "./services";

Expand All @@ -22,7 +22,6 @@ export class ServiceProvider extends Providers.ServiceProvider {
plugin: Handler,
routes: { prefix: "/api/guardian" },
});
initForbiddenErrorHandler(server);
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions packages/guardian-crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@
"coverage:report": "codecov",
"test:unit": "jest __tests__/unit/** --forceExit",
"test:unit:coverage": "jest __tests__/unit --coverage",
"publish:beta": "yarn build && yarn npm publish --tag beta --access public --tolerate-republish"
"publish:beta": "yarn build && yarn npm publish --tag beta --access public --tolerate-republish",
"publish": "yarn build && yarn npm publish --access public --tolerate-republish"
},
"dependencies": {
"@arkecosystem/crypto": "^3.0.0-next",
"@protokol/utils": "^1.0.0-beta.38",
"@arkecosystem/crypto": "^3.0.0",
"@protokol/utils": "^1.0.0",
"bytebuffer": "^5.0.1"
},
"devDependencies": {
"@arkecosystem/core-test-framework": "^3.0.0-next",
"@arkecosystem/core-test-framework": "^3.0.0",
"@sindresorhus/tsconfig": "~2.0.0",
"@types/jest": "~27.0.0",
"codecov": "^3.8.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
{
"package": "@arkecosystem/core-logger-pino"
},
{
"package": "@arkecosystem/core-manager"
},
{
"package": "@arkecosystem/core-state"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { Container, Contracts } from "@arkecosystem/core-kernel";
import { DatabaseInteraction, StateBuilder } from "@arkecosystem/core-state";
import { passphrases, Sandbox } from "@arkecosystem/core-test-framework";
import { Identities, Managers, Utils } from "@arkecosystem/crypto";
import { EventEmitter } from "events";

EventEmitter.prototype.constructor = Object.prototype.constructor;

jest.setTimeout(1200000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
ThrowIfCannotEnterPoolAction,
VerifyTransactionAction,
} from "@arkecosystem/core-transaction-pool";
import { Handlers } from "@arkecosystem/core-transactions";
import { Handlers, ServiceProvider } from "@arkecosystem/core-transactions";
import { Identities, Managers, Utils } from "@arkecosystem/crypto";

import { GuardianGroupPermissionsHandler, GuardianUserPermissionsHandler } from "../../../src/handlers";
Expand Down Expand Up @@ -128,6 +128,9 @@ export const initApp = (): Application => {
.to(Handlers.TransactionHandlerProvider)
.inSingletonScope();
app.bind(Container.Identifiers.TransactionHandlerRegistry).to(Handlers.Registry).inSingletonScope();
app.bind(Container.Identifiers.TransactionHandlerConstructors).toDynamicValue(
ServiceProvider.getTransactionHandlerConstructorsBinding(),
);

app.bind(Container.Identifiers.TriggerService).to(Services.Triggers.Triggers).inSingletonScope();

Expand Down
21 changes: 11 additions & 10 deletions packages/guardian-transactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,22 @@
"test:unit:coverage": "jest __tests__/unit --coverage",
"test:functional": "CORE_ENV=test jest __tests__/functional --forceExit",
"test:functional:coverage": "CORE_ENV=test jest __tests__/functional --coverage --forceExit",
"publish:beta": "yarn build && yarn npm publish --tag beta --access public --tolerate-republish"
"publish:beta": "yarn build && yarn npm publish --tag beta --access public --tolerate-republish",
"publish": "yarn build && yarn npm publish --access public --tolerate-republish"
},
"dependencies": {
"@arkecosystem/core-database": "^3.0.0-next",
"@arkecosystem/core-kernel": "^3.0.0-next",
"@arkecosystem/core-state": "^3.0.0-next",
"@arkecosystem/core-transactions": "^3.0.0-next",
"@arkecosystem/crypto": "^3.0.0-next",
"@arkecosystem/core-database": "^3.0.0",
"@arkecosystem/core-kernel": "^3.0.0",
"@arkecosystem/core-state": "^3.0.0",
"@arkecosystem/core-transactions": "^3.0.0",
"@arkecosystem/crypto": "^3.0.0",
"@protokol/guardian-crypto": "workspace:packages/guardian-crypto"
},
"devDependencies": {
"@arkecosystem/core-kernel": "^3.0.0-next",
"@arkecosystem/core-state": "^3.0.0-next",
"@arkecosystem/core-test-framework": "^3.0.0-next",
"@arkecosystem/core-transaction-pool": "^3.0.0-next",
"@arkecosystem/core-kernel": "^3.0.0",
"@arkecosystem/core-state": "^3.0.0",
"@arkecosystem/core-test-framework": "^3.0.0",
"@arkecosystem/core-transaction-pool": "^3.0.0",
"@sindresorhus/tsconfig": "~2.0.0",
"@types/eslint": "^7.2.10",
"@types/eslint-plugin-prettier": "^3.1.0",
Expand Down
Loading

0 comments on commit 50afcf9

Please sign in to comment.