-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #171 from narval-xyz/feature/vault
Vault setup
- Loading branch information
Showing
87 changed files
with
2,956 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 9 additions & 108 deletions
117
apps/policy-engine/src/engine/evaluation-request.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
NODE_ENV=development | ||
|
||
PORT=3011 | ||
|
||
APP_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/vault?schema=public" | ||
|
||
APP_UID="local-dev-vault-instance-1" | ||
|
||
MASTER_PASSWORD="unsafe-local-dev-master-password" | ||
|
||
KEYRING_TYPE="raw" | ||
|
||
# MASTER_AWS_KMS_ARN="arn:aws:kms:us-east-2:728783560968:key/f6aa3ddb-47c3-4f31-977d-b93205bb23d1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
NODE_ENV=test | ||
|
||
PORT=3011 | ||
|
||
APP_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/vault-test?schema=public" | ||
|
||
APP_UID="local-dev-vault-instance-1" | ||
|
||
MASTER_PASSWORD="unsafe-local-test-master-password" | ||
|
||
KEYRING_TYPE="raw" | ||
|
||
# MASTER_AWS_KMS_ARN="arn:aws:kms:us-east-2:728783560968:key/f6aa3ddb-47c3-4f31-977d-b93205bb23d1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
'*.{ts,tsx}': (filenames) => [ | ||
`eslint --no-error-on-unmatched-pattern ${filenames.join(' ')}; echo "ESLint completed with exit code $?"`, | ||
`prettier --write ${filenames.join(' ')}` | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
VAULT_PROJECT_NAME := vault | ||
VAULT_PROJECT_DIR := ./apps/vault | ||
VAULT_DATABASE_SCHEMA := ${VAULT_PROJECT_DIR}/src/shared/module/persistence/schema/schema.prisma | ||
|
||
# === Start === | ||
|
||
vault/start/dev: | ||
npx nx serve ${VAULT_PROJECT_NAME} | ||
|
||
# === Setup === | ||
|
||
vault/setup: | ||
make vault/copy-default-env | ||
make vault/db/setup | ||
make vault/test/db/setup | ||
make vault/cli CMD=provision | ||
|
||
vault/copy-default-env: | ||
cp ${VAULT_PROJECT_DIR}/.env.default ${VAULT_PROJECT_DIR}/.env | ||
cp ${VAULT_PROJECT_DIR}/.env.test.default ${VAULT_PROJECT_DIR}/.env.test | ||
|
||
# === Build === | ||
|
||
vault/build/script: | ||
npx tsc --project ${VAULT_PROJECT_DIR}/tsconfig.app.json | ||
npx tsc-alias --project ${VAULT_PROJECT_DIR}/tsconfig.app.json | ||
|
||
# == Code format == | ||
|
||
vault/format: | ||
npx nx format:write --projects ${VAULT_PROJECT_NAME} | ||
|
||
vault/lint: | ||
npx nx lint ${VAULT_PROJECT_NAME} -- --fix | ||
|
||
vault/format/check: | ||
npx nx format:check --projects ${VAULT_PROJECT_NAME} | ||
|
||
vault/lint/check: | ||
npx nx lint ${VAULT_PROJECT_NAME} | ||
|
||
# === Database === | ||
|
||
vault/db/generate-types: | ||
npx prisma generate \ | ||
--schema ${VAULT_DATABASE_SCHEMA} | ||
|
||
vault/db/migrate: | ||
npx dotenv -e ${VAULT_PROJECT_DIR}/.env -- \ | ||
prisma migrate dev \ | ||
--schema ${VAULT_DATABASE_SCHEMA} | ||
|
||
vault/db/setup: | ||
@echo "" | ||
@echo "${TERM_GREEN}🛠️ Setting up Vault development database${TERM_NO_COLOR}" | ||
@echo "" | ||
npx dotenv -e ${VAULT_PROJECT_DIR}/.env -- \ | ||
prisma migrate reset \ | ||
--schema ${VAULT_DATABASE_SCHEMA} \ | ||
--force | ||
make vault/db/seed | ||
|
||
@echo "" | ||
@echo "${TERM_GREEN}🛠️ Setting up Vault test database${TERM_NO_COLOR}" | ||
@echo "" | ||
make vault/test/db/setup | ||
|
||
vault/db/create-migration: | ||
npx dotenv -e ${VAULT_PROJECT_DIR}/.env -- \ | ||
prisma migrate dev \ | ||
--schema ${VAULT_DATABASE_SCHEMA} \ | ||
--name ${NAME} | ||
|
||
# To maintain seed data within their respective modules and then import them | ||
# into the main seed.ts file for execution, it's necessary to compile the | ||
# project and resolve its path aliases before running the vanilla JavaScript | ||
# seed entry point. | ||
vault/db/seed: | ||
npx dotenv -e ${VAULT_PROJECT_DIR}/.env -- \ | ||
ts-node -r tsconfig-paths/register --project ${VAULT_PROJECT_DIR}/tsconfig.app.json ${VAULT_PROJECT_DIR}/src/shared/module/persistence/seed.ts | ||
|
||
|
||
# === Testing === | ||
|
||
vault/test/db/setup: | ||
npx dotenv -e ${VAULT_PROJECT_DIR}/.env.test --override -- \ | ||
prisma migrate reset \ | ||
--schema ${VAULT_DATABASE_SCHEMA} \ | ||
--skip-seed \ | ||
--force | ||
|
||
|
||
vault/test/type: | ||
make vault/db/generate-types | ||
npx tsc \ | ||
--project ${VAULT_PROJECT_DIR}/tsconfig.app.json \ | ||
--noEmit | ||
|
||
vault/test/unit: | ||
npx nx test:unit ${VAULT_PROJECT_NAME} -- ${ARGS} | ||
|
||
vault/test/unit/watch: | ||
make vault/test/unit ARGS=--watch | ||
|
||
vault/test/integration: | ||
npx nx test:integration ${VAULT_PROJECT_NAME} -- ${ARGS} | ||
|
||
vault/test/integration/watch: | ||
make vault/test/integration ARGS=--watch | ||
|
||
vault/test/e2e: | ||
npx nx test:e2e ${VAULT_PROJECT_NAME} -- ${ARGS} | ||
|
||
vault/test/e2e/watch: | ||
make vault/test/e2e ARGS=--watch | ||
|
||
vault/test: | ||
make vault/test/unit | ||
make vault/test/integration | ||
make vault/test/e2e | ||
|
||
# === CLI === | ||
|
||
vault/cli: | ||
npx dotenv -e ${VAULT_PROJECT_DIR}/.env -- \ | ||
ts-node -r tsconfig-paths/register \ | ||
--project ${VAULT_PROJECT_DIR}/tsconfig.app.json \ | ||
${VAULT_PROJECT_DIR}/src/cli.ts ${CMD} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Vault | ||
|
||
TBD | ||
|
||
## Requirements | ||
|
||
## Getting started | ||
|
||
```bash | ||
make vault/setup | ||
``` | ||
|
||
## Running | ||
|
||
```bash | ||
make vault/start/dev | ||
``` | ||
|
||
## Testing | ||
|
||
```bash | ||
make vault/test/type | ||
make vault/test/unit | ||
make vault/test/integration | ||
make vault/test/e2e | ||
``` | ||
|
||
## Formatting | ||
|
||
```bash | ||
make vault/format | ||
make vault/lint | ||
|
||
make vault/format/check | ||
make vault/lint/check | ||
``` | ||
|
||
## CLI | ||
|
||
```bash | ||
make vault/cli CMD=help | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { Config } from 'jest' | ||
|
||
const config: Config = { | ||
displayName: 'vault', | ||
moduleFileExtensions: ['ts', 'js', 'html'], | ||
preset: '../../jest.preset.js', | ||
setupFiles: ['<rootDir>/jest.setup.ts'], | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.[tj]s$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.spec.json' | ||
} | ||
] | ||
}, | ||
workerThreads: true // EXPERIMENTAL; lets BigInt serialization work | ||
} | ||
|
||
export default config |
Oops, something went wrong.