diff --git a/.github/dependabot.yml b/.github/dependabot.yml index aff82a102..db9ba4179 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,6 @@ version: 2 updates: - - package-ecosystem: "npm" - directory: "/" + - package-ecosystem: 'npm' + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' diff --git a/.github/workflows/authz_ci.yml b/.github/workflows/authz_ci.yml index 28b1304bb..3209a0a37 100644 --- a/.github/workflows/authz_ci.yml +++ b/.github/workflows/authz_ci.yml @@ -1,11 +1,10 @@ -name: "@app/authz CI" +name: '@app/authz CI' on: push: paths: - apps/authz/** - .github/workflows/authz_ci.yml - - Makefile - jest.config.ts - jest.preset.js - .eslintrc.json @@ -60,8 +59,8 @@ jobs: - name: Code format shell: bash run: | - make format/check - make lint/check + make authz/format/check + make authz/lint/check # TODO: Finish once the authz-node has a database. - name: Setup database and Prisma types @@ -101,7 +100,7 @@ jobs: uses: 8398a7/action-slack@v3 with: username: GitHub - author_name: "@app/authz CI failed" + author_name: '@app/authz CI failed' status: ${{ job.status }} fields: message,commit,author env: diff --git a/.github/workflows/authz_shared_ci.yml b/.github/workflows/authz_shared_ci.yml index 734e55158..7cf90011c 100644 --- a/.github/workflows/authz_shared_ci.yml +++ b/.github/workflows/authz_shared_ci.yml @@ -1,11 +1,10 @@ -name: "@narval/authz-shared CI" +name: '@narval/authz-shared CI' on: push: paths: - packages/authz-shared/** - .github/workflows/authz_shared_ci.yml - - Makefile - jest.config.ts - jest.preset.js - .eslintrc.json @@ -35,22 +34,21 @@ jobs: - name: Code format shell: bash run: | - make format/check - make lint/check + make authz-shared/format/check + make authz-shared/lint/check - name: Test unit shell: bash run: | - make authz-shared/test/unit + make authz-shared/test/unit - name: Send Slack notification on failure if: failure() uses: 8398a7/action-slack@v3 with: username: GitHub - author_name: "@narval/authz-shared CI failed" + author_name: '@narval/authz-shared CI failed' status: ${{ job.status }} fields: message,commit,author env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - diff --git a/.github/workflows/orchestration_ci.yml b/.github/workflows/orchestration_ci.yml index 1638aa7e8..72514eb66 100644 --- a/.github/workflows/orchestration_ci.yml +++ b/.github/workflows/orchestration_ci.yml @@ -1,11 +1,10 @@ -name: "@app/orchestration CI" +name: '@app/orchestration CI' on: push: paths: - apps/orchestration/** - .github/workflows/orchestration_ci.yml - - Makefile - jest.config.ts - jest.preset.js - .eslintrc.json @@ -60,8 +59,8 @@ jobs: - name: Code format shell: bash run: | - make format/check - make lint/check + make orchestration/format/check + make orchestration/lint/check - name: Setup database and Prisma types shell: bash @@ -97,7 +96,7 @@ jobs: uses: 8398a7/action-slack@v3 with: username: GitHub - author_name: "@app/orchestration CI failed" + author_name: '@app/orchestration CI failed' status: ${{ job.status }} fields: message,commit,author env: diff --git a/.github/workflows/transaction_request_intent_ci.yml b/.github/workflows/transaction_request_intent_ci.yml index f5ce5b95a..37821583c 100644 --- a/.github/workflows/transaction_request_intent_ci.yml +++ b/.github/workflows/transaction_request_intent_ci.yml @@ -1,11 +1,10 @@ -name: "@narval/transaction-request-intent CI" +name: '@narval/transaction-request-intent CI' on: push: paths: - packages/transaction-request-intent/** - .github/workflows/transaction_request_intent_ci.yml - - Makefile - jest.config.ts - jest.preset.js - .eslintrc.json @@ -35,22 +34,21 @@ jobs: - name: Code format shell: bash run: | - make format/check - make lint/check + make transaction-request-intent/format/check + make transaction-request-intent/lint/check - name: Test unit shell: bash run: | - make transaction-request-intent/test/unit + make transaction-request-intent/test/unit - name: Send Slack notification on failure if: failure() uses: 8398a7/action-slack@v3 with: username: GitHub - author_name: "@narval/transaction-request-intent CI failed" + author_name: '@narval/transaction-request-intent CI failed' status: ${{ job.status }} fields: message,commit,author env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - diff --git a/Makefile b/Makefile index 5839b060f..521c228c9 100644 --- a/Makefile +++ b/Makefile @@ -7,12 +7,16 @@ include ./packages/transaction-request-intent/Makefile TERM_NO_COLOR := \033[0m TERM_GREEN := \033[0;32m +# == Install == + install: npm install install/ci: npm ci +# == Setup == + setup: make install make docker/up @@ -22,19 +26,21 @@ setup: @echo "${TERM_GREEN}Orchestration & AuthZ applications are ready 🐋${TERM_NO_COLOR}" @echo "${TERM_GREEN}Run 'make orchestration/start/dev' or/and 'make authz/start/dev' to get them running.${TERM_NO_COLOR}" +# == Docker == + docker/stop: docker-compose stop docker/up: docker-compose up --detach +# == Code format == + format: - npx prettier \ - --write "apps/**/*.ts" "packages/**/*.ts" "./*.{js,json}" + npx nx format:write --all format/check: - npx prettier \ - --check "apps/**/*.ts" "packages/**/*.ts" "./*.{js,json}" + npx nx format:check --all lint: npx nx run-many \ @@ -42,5 +48,4 @@ lint: --fix lint/check: - npx nx run-many \ - --target lint + npx nx run-many --target lint diff --git a/apps/authz/Makefile b/apps/authz/Makefile index 2a9a633d3..b04f29aaa 100644 --- a/apps/authz/Makefile +++ b/apps/authz/Makefile @@ -15,6 +15,20 @@ authz/copy-default-env: cp ${AUTHZ_PROJECT_DIR}/.env.default ${AUTHZ_PROJECT_DIR}/.env cp ${AUTHZ_PROJECT_DIR}/.env.test.default ${AUTHZ_PROJECT_DIR}/.env.test +# == Code format == + +authz/format: + npx nx format:write --projects ${AUTHZ_PROJECT_NAME} + +authz/lint: + npx nx lint ${AUTHZ_PROJECT_NAME} -- --fix + +authz/format/check: + npx nx format:check --projects ${AUTHZ_PROJECT_NAME} + +authz/lint/check: + npx nx lint ${AUTHZ_PROJECT_NAME} + # === Testing === authz/test/type: diff --git a/apps/authz/README.md b/apps/authz/README.md index f7cf789c6..c026c2ad8 100644 --- a/apps/authz/README.md +++ b/apps/authz/README.md @@ -24,3 +24,13 @@ make authz/test/unit make authz/test/integration make authz/test/e2e ``` + +## Formatting + +```bash +make authz/format +make authz/lint + +make authz/format/check +make authz/lint/check +``` diff --git a/apps/authz/src/app/opa/poc/entities.json b/apps/authz/src/app/opa/poc/entities.json index 23d384213..9e41557da 100644 --- a/apps/authz/src/app/opa/poc/entities.json +++ b/apps/authz/src/app/opa/poc/entities.json @@ -1,65 +1,69 @@ { - "entities":{ - "users": { - "test-bob-uid": { - "uid": "test-bob-uid", - "role": "root" - }, - "test-alice-uid": { - "uid": "test-alice-uid", - "role": "member" - }, - "test-foo-uid": { - "uid": "test-foo-uid", - "role": "admin" - }, - "0xaaa8ee1cbaa1856f4550c6fc24abb16c5c9b2a43": { - "uid": "0xaaa8ee1cbaa1856f4550c6fc24abb16c5c9b2a43", - "role": "admin" - } - }, - "wallets": {"eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e": { - "uid": "eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", - "address": "0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", - "accountType": "eoa", - "assignees": ["test-bob-uid", "test-bar-uid"] - }}, - "user_groups": { - "test-user-group-one-uid": { - "uid": "test-user-group-one-uid", - "name": "dev", - "users": ["test-bob-uid", "test-bar-uid"] - }, - "test-user-group-two-uid": { - "uid": "test-user-group-two-uid", - "name": "finance", - "users": ["test-bob-uid", "test-bar-uid"] - } - }, - "wallet_groups": {"test-wallet-group-one-uid": { - "uid": "test-wallet-group-one-uid", - "name": "dev", - "wallets": ["eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e"] - }}, - "address_book": { - "eip155:137:0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3": { - "uid": "eip155:137:0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3", - "address": "0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3", - "chain_id": 137, - "classification": "internal" - }, - "eip155:137:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e": { - "uid": "eip155:137:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", - "address": "0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", - "chain_id": 137, - "classification": "wallet" - }, - "eip155:1:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e": { - "uid": "eip155:1:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", - "address": "0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", - "chain_id": 1, - "classification": "wallet" - } - } + "entities": { + "users": { + "test-bob-uid": { + "uid": "test-bob-uid", + "role": "root" + }, + "test-alice-uid": { + "uid": "test-alice-uid", + "role": "member" + }, + "test-foo-uid": { + "uid": "test-foo-uid", + "role": "admin" + }, + "0xaaa8ee1cbaa1856f4550c6fc24abb16c5c9b2a43": { + "uid": "0xaaa8ee1cbaa1856f4550c6fc24abb16c5c9b2a43", + "role": "admin" + } + }, + "wallets": { + "eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e": { + "uid": "eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", + "address": "0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", + "accountType": "eoa", + "assignees": ["test-bob-uid", "test-bar-uid"] + } + }, + "user_groups": { + "test-user-group-one-uid": { + "uid": "test-user-group-one-uid", + "name": "dev", + "users": ["test-bob-uid", "test-bar-uid"] + }, + "test-user-group-two-uid": { + "uid": "test-user-group-two-uid", + "name": "finance", + "users": ["test-bob-uid", "test-bar-uid"] + } + }, + "wallet_groups": { + "test-wallet-group-one-uid": { + "uid": "test-wallet-group-one-uid", + "name": "dev", + "wallets": ["eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e"] + } + }, + "address_book": { + "eip155:137:0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3": { + "uid": "eip155:137:0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3", + "address": "0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3", + "chain_id": 137, + "classification": "internal" + }, + "eip155:137:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e": { + "uid": "eip155:137:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", + "address": "0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", + "chain_id": 137, + "classification": "wallet" + }, + "eip155:1:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e": { + "uid": "eip155:1:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", + "address": "0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", + "chain_id": 1, + "classification": "wallet" + } } -} \ No newline at end of file + } +} diff --git a/apps/authz/src/app/opa/poc/input_admin_transfer_token.json b/apps/authz/src/app/opa/poc/input_admin_transfer_token.json index a7445df3b..cbba4df8c 100644 --- a/apps/authz/src/app/opa/poc/input_admin_transfer_token.json +++ b/apps/authz/src/app/opa/poc/input_admin_transfer_token.json @@ -1,52 +1,52 @@ { "action": "signTransaction", - "principal": {"uid": "test-bob-uid"}, - "resource": {"uid": "eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e"}, + "principal": { "uid": "test-bob-uid" }, + "resource": { "uid": "eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e" }, "request": { - "type": "eip1559", - "chain_id": 137, - "max_fee_per_gas": "20000000000", - "max_priority_fee_per_gas": "3000000000", - "gas": "21000", - "nonce": 1, - "from": "0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", - "to": "0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3" + "type": "eip1559", + "chain_id": 137, + "max_fee_per_gas": "20000000000", + "max_priority_fee_per_gas": "3000000000", + "gas": "21000", + "nonce": 1, + "from": "0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", + "to": "0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3" }, "intent": { - "type": "transferToken", - "from": { - "uid": "eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", - "address": "0xddcf208f219a6e6af072f2cfdc615b2c1805f98e" - }, - "to": { - "uid": "eip155:137:0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3", - "chain_id": 137, - "address": "0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3" - }, - "amount": 1000000000000000000, - "token": { - "uid": "eip155:137/erc20:0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - "address": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - "chainId": 137, - "classification": "internal" - } + "type": "transferToken", + "from": { + "uid": "eip155:eoa:0xddcf208f219a6e6af072f2cfdc615b2c1805f98e", + "address": "0xddcf208f219a6e6af072f2cfdc615b2c1805f98e" + }, + "to": { + "uid": "eip155:137:0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3", + "chain_id": 137, + "address": "0xa45e21e9370ba031c5e1f47dedca74a7ce2ed7a3" + }, + "amount": 1000000000000000000, + "token": { + "uid": "eip155:137/erc20:0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + "address": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + "chainId": 137, + "classification": "internal" + } }, "signatures": [ - { - "signer": "test-bob-uid", - "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" - }, - { - "signer": "test-alice-uid", - "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" - }, - { - "signer": "test-foo-uid", - "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" - }, - { - "signer": "0xaaa8ee1cbaa1856f4550c6fc24abb16c5c9b2a43", - "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" - } + { + "signer": "test-bob-uid", + "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" + }, + { + "signer": "test-alice-uid", + "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" + }, + { + "signer": "test-foo-uid", + "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" + }, + { + "signer": "0xaaa8ee1cbaa1856f4550c6fc24abb16c5c9b2a43", + "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" + } ] } diff --git a/apps/authz/src/app/opa/poc/meta_permissions/user_permissions.json b/apps/authz/src/app/opa/poc/meta_permissions/user_permissions.json index 17416386f..b9b9aa9ee 100644 --- a/apps/authz/src/app/opa/poc/meta_permissions/user_permissions.json +++ b/apps/authz/src/app/opa/poc/meta_permissions/user_permissions.json @@ -1,25 +1,25 @@ { - "action": "user:create", - "principal": { - "uid": "0xbbb7be636c3ad8cf9d08ba8bdba4abd2ef29bd23" + "action": "user:create", + "principal": { + "uid": "0xbbb7be636c3ad8cf9d08ba8bdba4abd2ef29bd23" + }, + "resource": { + "user": { + "uid": "0xaaa8ee1cbaa1856f4550c6fc24abb16c5c9b2a43" + } + }, + "signatures": [ + { + "signer": "0x54d48e47e85e5dec57fa913c4c4f6e74fe3cc930", + "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" }, - "resource": { - "user": { - "uid": "0xaaa8ee1cbaa1856f4550c6fc24abb16c5c9b2a43" - } + { + "signer": "0xf0938535e0d64f1e148676adf6f0d82662d778a1", + "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" }, - "signatures": [ - { - "signer": "0x54d48e47e85e5dec57fa913c4c4f6e74fe3cc930", - "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" - }, - { - "signer": "0xf0938535e0d64f1e148676adf6f0d82662d778a1", - "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" - }, - { - "signer": "0xbbb7be636c3ad8cf9d08ba8bdba4abd2ef29bd23", - "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" - } - ] - } \ No newline at end of file + { + "signer": "0xbbb7be636c3ad8cf9d08ba8bdba4abd2ef29bd23", + "hash": "0x894ee391f2fb86469042159c46084add956d1d1f997bb4c43d9c8d2a52970a615b790c416077ec5d199ede5ae0fc925859c80c52c5c74328e25d9e9d5195e3981c" + } + ] +} diff --git a/apps/documentation/babel.config.js b/apps/documentation/babel.config.js index e00595dae..14e5baf05 100644 --- a/apps/documentation/babel.config.js +++ b/apps/documentation/babel.config.js @@ -1,3 +1,3 @@ module.exports = { - presets: [require.resolve('@docusaurus/core/lib/babel/preset')], -}; + presets: [require.resolve('@docusaurus/core/lib/babel/preset')] +} diff --git a/apps/documentation/docs/tutorial-basics/create-a-document.md b/apps/documentation/docs/tutorial-basics/create-a-document.md index c22fe2944..f33028a36 100644 --- a/apps/documentation/docs/tutorial-basics/create-a-document.md +++ b/apps/documentation/docs/tutorial-basics/create-a-document.md @@ -50,8 +50,8 @@ export default { { type: 'category', label: 'Tutorial', - items: ['tutorial-basics/create-a-document'], - }, - ], -}; + items: ['tutorial-basics/create-a-document'] + } + ] +} ``` diff --git a/apps/documentation/docs/tutorial-basics/create-a-page.md b/apps/documentation/docs/tutorial-basics/create-a-page.md index 20e2ac300..36f46ce0c 100644 --- a/apps/documentation/docs/tutorial-basics/create-a-page.md +++ b/apps/documentation/docs/tutorial-basics/create-a-page.md @@ -15,8 +15,8 @@ Add **Markdown or React** files to `src/pages` to create a **standalone page**: Create a file at `src/pages/my-react-page.js`: ```jsx title="src/pages/my-react-page.js" -import React from 'react'; -import Layout from '@theme/Layout'; +import React from 'react' +import Layout from '@theme/Layout' export default function MyReactPage() { return ( @@ -24,7 +24,7 @@ export default function MyReactPage() {
This is a React page
- ); + ) } ``` diff --git a/apps/documentation/docs/tutorial-basics/markdown-features.mdx b/apps/documentation/docs/tutorial-basics/markdown-features.mdx index 0337f34d6..200e6310a 100644 --- a/apps/documentation/docs/tutorial-basics/markdown-features.mdx +++ b/apps/documentation/docs/tutorial-basics/markdown-features.mdx @@ -71,7 +71,7 @@ Markdown code blocks are supported with Syntax highlighting. ```jsx title="src/components/HelloDocusaurus.js" function HelloDocusaurus() { - returndocs
directory.
+ Docusaurus lets you focus on your docs, and we'll do the chores. Go ahead and move your docs into the{' '}
+ docs
directory.
>
- ),
+ )
},
{
title: 'Powered by React',
Svg: require('@site/static/img/undraw_docusaurus_react.svg').default,
description: (
<>
- Extend or customize your website layout by reusing React. Docusaurus can
- be extended while reusing the same header and footer.
+ Extend or customize your website layout by reusing React. Docusaurus can be extended while reusing the same
+ header and footer.
>
- ),
- },
-];
+ )
+ }
+]
-function Feature({title, Svg, description}: FeatureItem) {
+function Feature({ title, Svg, description }: FeatureItem) {
return (
{description}
{siteConfig.tagline}