Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • eclipse/xfsc/ocm/ocm-engine
  • zdravko61/ocm-engine
  • mjuergenscg/ocm-engine
  • tsabolov/ocm-engine
  • mikesell/ocm-engine
5 results
Show changes
Showing
with 267 additions and 252 deletions
...@@ -3,4 +3,4 @@ appVersion: v1.0.4-rc ...@@ -3,4 +3,4 @@ appVersion: v1.0.4-rc
description: attestation-manager deployment description: attestation-manager deployment
name: attestation-manager name: attestation-manager
version: 1.0.4 version: 1.0.4
icon: "https://www.vereign.com/wp-content/themes/vereign2020/images/vereign-logo.svg" icon: 'https://www.vereign.com/wp-content/themes/vereign2020/images/vereign-logo.svg'
...@@ -6,62 +6,63 @@ attestation-manager deployment ...@@ -6,62 +6,63 @@ attestation-manager deployment
## Values ## Values
| Key | Type | Default | Description | | Key | Type | Default | Description |
|-----|------|---------|-------------| | ----------------------------------------------------------------- | ------ | ------------------------------------------------------- | -------------------------------------------------------------- |
| attestationManager.acceptMembershipCredentialsConfig | string | `"AUTO"` | | | attestationManager.acceptMembershipCredentialsConfig | string | `"AUTO"` | |
| attestationManager.agent.host | string | `"ssi-abstraction"` | | | attestationManager.agent.host | string | `"ssi-abstraction"` | |
| attestationManager.agent.port | int | `3010` | | | attestationManager.agent.port | int | `3010` | |
| attestationManager.agent.protocol | string | `"http"` | | | attestationManager.agent.protocol | string | `"http"` | |
| attestationManager.database.db | string | `"ocm_attestation_manager"` | | | attestationManager.database.db | string | `"ocm_attestation_manager"` | |
| attestationManager.database.host | string | `"postgresql-postgresql-ha-postgresql.infra"` | | | attestationManager.database.host | string | `"postgresql-postgresql-ha-postgresql.infra"` | |
| attestationManager.database.password | string | `"ocm_attestation_manager"` | | | attestationManager.database.password | string | `"ocm_attestation_manager"` | |
| attestationManager.database.port | int | `5432` | | | attestationManager.database.port | int | `5432` | |
| attestationManager.database.schema | string | `"attestation"` | | | attestationManager.database.schema | string | `"attestation"` | |
| attestationManager.database.user | string | `"ocm_attestation_manager"` | | | attestationManager.database.user | string | `"ocm_attestation_manager"` | |
| attestationManager.elastic.port | int | `9200` | | | attestationManager.elastic.port | int | `9200` | |
| attestationManager.elastic.protocol | string | `"http"` | | | attestationManager.elastic.protocol | string | `"http"` | |
| attestationManager.elastic.url | string | `"elasticsearch"` | | | attestationManager.elastic.url | string | `"elasticsearch"` | |
| attestationManager.nats.port | int | `4222` | | | attestationManager.nats.port | int | `4222` | |
| attestationManager.nats.protocol | string | `"nats"` | | | attestationManager.nats.protocol | string | `"nats"` | |
| attestationManager.nats.url | string | `"nats"` | | | attestationManager.nats.url | string | `"nats"` | |
| attestationManager.url.attestationManager | string | `"https://gaiax.vereign.com/ocm/attestation"` | | | attestationManager.url.attestationManager | string | `"https://gaiax.vereign.com/ocm/attestation"` | |
| attestationManager.url.connectionManager | string | `"https://gaiax.vereign.com/ocm/connection"` | | | attestationManager.url.connectionManager | string | `"https://gaiax.vereign.com/ocm/connection"` | |
| attestationManager.url.tsa | string | `"https://gaiax.vereign.com/tsa/policy/policy/example"` | | | attestationManager.url.tsa | string | `"https://gaiax.vereign.com/tsa/policy/policy/example"` | |
| autoscaling.enabled | bool | `false` | Enable autoscaling | | autoscaling.enabled | bool | `false` | Enable autoscaling |
| autoscaling.maxReplicas | int | `3` | Maximum replicas | | autoscaling.maxReplicas | int | `3` | Maximum replicas |
| autoscaling.minReplicas | int | `1` | Minimum replicas | | autoscaling.minReplicas | int | `1` | Minimum replicas |
| autoscaling.targetCPUUtilizationPercentage | int | `70` | CPU target for autoscaling trigger | | autoscaling.targetCPUUtilizationPercentage | int | `70` | CPU target for autoscaling trigger |
| autoscaling.targetMemoryUtilizationPercentage | int | `70` | Memory target for autoscaling trigger | | autoscaling.targetMemoryUtilizationPercentage | int | `70` | Memory target for autoscaling trigger |
| image.name | string | `"gaiax/attestation-manager"` | Image name | | image.name | string | `"gaiax/attestation-manager"` | Image name |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy | | image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| image.pullSecrets | string | `"deployment-key-light"` | Image pull secret when internal image is used | | image.pullSecrets | string | `"deployment-key-light"` | Image pull secret when internal image is used |
| image.repository | string | `"eu.gcr.io/vrgn-infra-prj"` | | | image.repository | string | `"eu.gcr.io/vrgn-infra-prj"` | |
| image.sha | string | `""` | Image sha, usually generated by the CI Uses image.tag if empty | | image.sha | string | `""` | Image sha, usually generated by the CI Uses image.tag if empty |
| image.tag | string | `""` | Image tag Uses .Chart.AppVersion if empty | | image.tag | string | `""` | Image tag Uses .Chart.AppVersion if empty |
| ingress.annotations."cert-manager.io/cluster-issuer" | string | `"letsencrypt-production-http"` | | | ingress.annotations."cert-manager.io/cluster-issuer" | string | `"letsencrypt-production-http"` | |
| ingress.annotations."kubernetes.io/ingress.class" | string | `"nginx"` | | | ingress.annotations."kubernetes.io/ingress.class" | string | `"nginx"` | |
| ingress.annotations."kubernetes.io/ingress.global-static-ip-name" | string | `"dev-light-public"` | | | ingress.annotations."kubernetes.io/ingress.global-static-ip-name" | string | `"dev-light-public"` | |
| ingress.annotations."nginx.ingress.kubernetes.io/rewrite-target" | string | `"/$2"` | | | ingress.annotations."nginx.ingress.kubernetes.io/rewrite-target" | string | `"/$2"` | |
| ingress.enabled | bool | `true` | | | ingress.enabled | bool | `true` | |
| ingress.frontendDomain | string | `"gaiax.vereign.com"` | | | ingress.frontendDomain | string | `"gaiax.vereign.com"` | |
| ingress.frontendTlsSecretName | string | `"cert-manager-tls"` | | | ingress.frontendTlsSecretName | string | `"cert-manager-tls"` | |
| ingress.tlsEnabled | bool | `true` | | | ingress.tlsEnabled | bool | `true` | |
| log.encoding | string | `"json"` | | | log.encoding | string | `"json"` | |
| log.level | string | `"INFO"` | | | log.level | string | `"INFO"` | |
| metrics.enabled | bool | `true` | Enable prometheus metrics | | metrics.enabled | bool | `true` | Enable prometheus metrics |
| metrics.port | int | `2112` | Port for prometheus metrics | | metrics.port | int | `2112` | Port for prometheus metrics |
| name | string | `"ssi-abstraction"` | Application name | | name | string | `"ssi-abstraction"` | Application name |
| nameOverride | string | `""` | Ovverwrites application name | | nameOverride | string | `""` | Ovverwrites application name |
| podAnnotations | object | `{}` | | | podAnnotations | object | `{}` | |
| replicaCount | int | `1` | Default number of instances to start | | replicaCount | int | `1` | Default number of instances to start |
| resources.limits.cpu | string | `"150m"` | | | resources.limits.cpu | string | `"150m"` | |
| resources.limits.memory | string | `"128Mi"` | | | resources.limits.memory | string | `"128Mi"` | |
| resources.requests.cpu | string | `"25m"` | | | resources.requests.cpu | string | `"25m"` | |
| resources.requests.memory | string | `"64Mi"` | | | resources.requests.memory | string | `"64Mi"` | |
| security.runAsGid | int | `0` | Group used by the apps | | security.runAsGid | int | `0` | Group used by the apps |
| security.runAsNonRoot | bool | `false` | by default, apps run as non-root | | security.runAsNonRoot | bool | `false` | by default, apps run as non-root |
| security.runAsUid | int | `0` | User used by the apps | | security.runAsUid | int | `0` | User used by the apps |
| service.port | int | `3005` | | | service.port | int | `3005` | |
---
----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.10.0](https://github.com/norwoodj/helm-docs/releases/v1.10.0) Autogenerated from chart metadata using [helm-docs v1.10.0](https://github.com/norwoodj/helm-docs/releases/v1.10.0)
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "app.name" . }} name: { { template "app.name" . } }
namespace: {{ .Release.Namespace }} namespace: { { .Release.Namespace } }
labels: labels: { { - include "app.labels" . | nindent 4 } }
{{- include "app.labels" . | nindent 4 }}
spec: spec:
clusterIP: None clusterIP: None
ports: ports:
- name: http - name: http
port: {{ .Values.service.port }} port: { { .Values.service.port } }
targetPort: {{ .Values.service.port }} targetPort: { { .Values.service.port } }
selector: selector: { { - include "app.selectorLabels" . | nindent 4 } }
{{- include "app.selectorLabels" . | nindent 4 }}
image: image:
repository: registry.gitlab.com/gaia-x/data-infrastructure-federation-services/ocm repository: registry.gitlab.com/gaia-x/data-infrastructure-federation-services/ocm
# -- Image name # -- Image name
name: attestation-manager name: attestation-manager
attestationManager: attestationManager:
url: url:
tsa: https://tsa.gxfs.dev/policy/policy/example tsa: https://tsa.gxfs.dev/policy/policy/example
connectionManager: https://ocm.gxfs.dev/connection connectionManager: https://ocm.gxfs.dev/connection
attestationManager: https://ocm.gxfs.dev/attestation attestationManager: https://ocm.gxfs.dev/attestation
database: database:
host: vereign-database1-postgres.gxfs-vereign host: vereign-database1-postgres.gxfs-vereign
user: ENC[AES256_GCM,data:mk+oOKURENM=,iv:COwKJMsdTq5rk0L6bgooO2ZfTUlc1s16KWfPOGlJ1lo=,tag:5OXJ6l8DCvOUhinh922IAw==,type:str] user: ENC[AES256_GCM,data:mk+oOKURENM=,iv:COwKJMsdTq5rk0L6bgooO2ZfTUlc1s16KWfPOGlJ1lo=,tag:5OXJ6l8DCvOUhinh922IAw==,type:str]
password: ENC[AES256_GCM,data:2DRvp3NP2KWDABEjRFqlfVPwtxsooDJW357jmJ7KEFURlubs3DGbce+5wLLhG8XbpdFZhCFEoNZivREa4LwhIw==,iv:3hqOlGqAT5/g52nSnqa8/ydUprOtWThT4lcoysmy11Q=,tag:0ZWS2zf5/huwhq9KO2HjoQ==,type:str] password: ENC[AES256_GCM,data:2DRvp3NP2KWDABEjRFqlfVPwtxsooDJW357jmJ7KEFURlubs3DGbce+5wLLhG8XbpdFZhCFEoNZivREa4LwhIw==,iv:3hqOlGqAT5/g52nSnqa8/ydUprOtWThT4lcoysmy11Q=,tag:0ZWS2zf5/huwhq9KO2HjoQ==,type:str]
db: vereign-database1-postgres db: vereign-database1-postgres
ingress: ingress:
frontendDomain: ocm.gxfs.dev frontendDomain: ocm.gxfs.dev
frontendTlsSecretName: wildcard-gxfs-dev frontendTlsSecretName: wildcard-gxfs-dev
sops: sops:
kms: [] kms: []
gcp_kms: [] gcp_kms: []
azure_kv: [] azure_kv: []
hc_vault: [] hc_vault: []
age: age:
- recipient: age1nrk70nevtmrcgzjunsed43ar6dk3e06qt7tryqqprj9axv4e0djqa0n0cg - recipient: age1nrk70nevtmrcgzjunsed43ar6dk3e06qt7tryqqprj9axv4e0djqa0n0cg
enc: | enc: |
-----BEGIN AGE ENCRYPTED FILE----- -----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBySXY3dzljdWdyamFLNkFW YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBySXY3dzljdWdyamFLNkFW
WHNqeGY3Q09WNnd2blJiTDhhVzdKQ0hjalgwCjR3RGZMdHFyM1lhQXdhcnN5SVE0 WHNqeGY3Q09WNnd2blJiTDhhVzdKQ0hjalgwCjR3RGZMdHFyM1lhQXdhcnN5SVE0
NnBwMzlVY2xwTzFQNE5VR3QybnpLb28KLS0tIHU4QVZZRWViNlVKQzg0YVBQWVI5 NnBwMzlVY2xwTzFQNE5VR3QybnpLb28KLS0tIHU4QVZZRWViNlVKQzg0YVBQWVI5
S3J1amdkVGhBUzhHOEJmWThSbVFNdm8KsBA7cO4f2Zmym8SoIXAzNw0uxaxfDWg9 S3J1amdkVGhBUzhHOEJmWThSbVFNdm8KsBA7cO4f2Zmym8SoIXAzNw0uxaxfDWg9
ryyxpwCjSQD2kuOw9epK/J7DpCkpAmipQSNvmU5ZiNnq9VzdQ8WGEA== ryyxpwCjSQD2kuOw9epK/J7DpCkpAmipQSNvmU5ZiNnq9VzdQ8WGEA==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2022-08-04T11:06:04Z" lastmodified: '2022-08-04T11:06:04Z'
mac: ENC[AES256_GCM,data:MdbVIQyR5s4efjMB1MIiOJZOueS0R1F4xvoaHEUoWaQ/bIWa3Km/CBijCI4+zqM54tZ3Zs+kMLK0FdHd+TpSujY2Jg6U8JqRHnA4cUEcr1el5pnhqo3lLiSmZXhGJaO9mlPoE/IVDdlrDXgRwexnznvyJn5RUpK1KdTsAU02wBI=,iv:EdCTlV7CDJikksz0HoiShKhKCO6LsOGsTk6GQalw6QA=,tag:QCbYT1Wr3KwcgmR70Qxlvg==,type:str] mac: ENC[AES256_GCM,data:MdbVIQyR5s4efjMB1MIiOJZOueS0R1F4xvoaHEUoWaQ/bIWa3Km/CBijCI4+zqM54tZ3Zs+kMLK0FdHd+TpSujY2Jg6U8JqRHnA4cUEcr1el5pnhqo3lLiSmZXhGJaO9mlPoE/IVDdlrDXgRwexnznvyJn5RUpK1KdTsAU02wBI=,iv:EdCTlV7CDJikksz0HoiShKhKCO6LsOGsTk6GQalw6QA=,tag:QCbYT1Wr3KwcgmR70Qxlvg==,type:str]
pgp: [] pgp: []
encrypted_regex: ^(password|user)$ encrypted_regex: ^(password|user)$
version: 3.7.3 version: 3.7.3
# -- Default number of instances to start # -- Default number of instances to start
replicaCount: 1 replicaCount: 1
# -- Application name # -- Application name
name: ssi-abstraction name: ssi-abstraction
# -- Ovverwrites application name # -- Ovverwrites application name
nameOverride: "" nameOverride: ''
image: image:
repository: eu.gcr.io/vrgn-infra-prj repository: eu.gcr.io/vrgn-infra-prj
...@@ -11,16 +11,15 @@ image: ...@@ -11,16 +11,15 @@ image:
name: gaiax/attestation-manager name: gaiax/attestation-manager
# -- Image tag # -- Image tag
# Uses .Chart.AppVersion if empty # Uses .Chart.AppVersion if empty
tag: "" tag: ''
# -- Image sha, usually generated by the CI # -- Image sha, usually generated by the CI
# Uses image.tag if empty # Uses image.tag if empty
sha: "" sha: ''
# -- Image pull policy # -- Image pull policy
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
# -- Image pull secret when internal image is used # -- Image pull secret when internal image is used
pullSecrets: deployment-key-light pullSecrets: deployment-key-light
podAnnotations: {} podAnnotations: {}
## ##
## Pass extra environment variables to the container. ## Pass extra environment variables to the container.
...@@ -67,7 +66,7 @@ metrics: ...@@ -67,7 +66,7 @@ metrics:
port: 2112 port: 2112
log: log:
level: "INFO" level: 'INFO'
encoding: json encoding: json
## ##
......
import { readFileSync } from 'node:fs';
const swcConfig = JSON.parse(readFileSync('../../.swcrc', 'utf8'));
/** @type {import('jest').Config} */
export default {
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
transform: {
'^.+\\.(js|ts)$': [
'@swc/jest',
{
...swcConfig,
sourceMaps: false,
exclude: [],
swcrc: false,
},
],
},
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
// ESM modules require `.js` extension to be specified, but Jest doesn't work with them
// Removing `.js` extension from module imports
'^uuid$': 'uuid',
'^(.*)/(.*)\\.js$': '$1/$2',
},
collectCoverageFrom: ['src/**/*.(t|j)s'],
coverageReporters:
process.env.CI === 'true'
? ['text-summary', 'json-summary']
: ['text-summary', 'html'],
coveragePathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/test/',
'<rootDir>/coverage/',
'<rootDir>/dist/',
'<rootDir>/**/test',
'@types',
'.dto.(t|j)s',
'.enum.ts',
'.interface.ts',
'.type.ts',
'.spec.ts',
],
coverageDirectory: './coverage',
// With v8 coverage provider it's much faster, but
// with this enabled it's not possible to ignore whole files' coverage
coverageProvider: 'v8',
};
{ {
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics", "collection": "@nestjs/schematics",
"sourceRoot": "src" "sourceRoot": "src",
"compilerOptions": {
"typeCheck": true,
"builder": {
"type": "swc",
"options": {
"swcrcPath": "../../.swcrc"
}
}
}
} }
{ {
"name": "attestation-manager", "name": "@ocm/attestation-manager",
"version": "0.0.1", "version": "0.0.1",
"description": "", "description": "",
"author": "Shirdhar", "author": "Shirdhar",
"private": true, "private": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"type": "module",
"scripts": { "scripts": {
"clean": "rm -r dist", "clean": "rimraf dist coverage *.tsbuildinfo",
"prebuild": "rimraf dist", "prebuild": "pnpm clean",
"build": "nest build", "build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "prebuild:production": "pnpm clean",
"dbSchema": "npx prisma db push --schema=./src/prisma/schema.prisma", "build:production": "pnpm prisma:generate && nest build -p tsconfig.production.json",
"prisma:dbpush": "prisma db push --schema=./src/prisma/schema.prisma",
"prisma:generate": "prisma generate --schema=./src/prisma/schema.prisma", "prisma:generate": "prisma generate --schema=./src/prisma/schema.prisma",
"prisma:migrate": "npx prisma migrate deploy --schema=./src/prisma/schema.prisma", "prisma:migrate": "prisma migrate deploy --schema=./src/prisma/schema.prisma",
"prismaStudio": "npx prisma studio", "prisma:studio": "prisma studio",
"start": "nest start", "start": "nest start",
"start:docker": "yarn prisma:generate && yarn dbSchema && yarn start", "start:dev": "nest start --watch --preserveWatchOutput",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest", "test": "jest",
"test:watch": "jest --watch", "test:watch": "jest --watch",
"test:cov": "jest --coverage", "test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json" "test:e2e": "jest --config ./test/jest.config.js"
}, },
"dependencies": { "dependencies": {
"@elastic/ecs-winston-format": "^1.3.1", "@elastic/ecs-winston-format": "^1.5.0",
"@nestjs/axios": "0.0.5", "@nestjs/axios": "^3.0.1",
"@nestjs/common": "^8.0.0", "@nestjs/common": "^10.2.8",
"@nestjs/config": "^1.1.6", "@nestjs/config": "^3.1.1",
"@nestjs/core": "^8.0.0", "@nestjs/core": "^10.2.8",
"@nestjs/mapped-types": "*", "@nestjs/mapped-types": "^2.0.3",
"@nestjs/microservices": "^8.2.6", "@nestjs/microservices": "^10.2.8",
"@nestjs/platform-express": "^8.0.0", "@nestjs/platform-express": "^10.2.8",
"@nestjs/swagger": "^5.2.0", "@nestjs/swagger": "^7.1.15",
"@nestjs/terminus": "^8.0.4", "@nestjs/terminus": "^10.1.1",
"@prisma/client": "^3.9.2", "@prisma/client": "^5.6.0",
"@types/express": "^4.17.13",
"@types/jest": "27.0.2",
"@types/jsonwebtoken": "^8.5.9",
"@types/node": "^16.0.0",
"class-transformer": "^0.5.1", "class-transformer": "^0.5.1",
"class-validator": "^0.13.2", "class-validator": "^0.14.0",
"express": "^4.17.3", "express": "^4.17.3",
"husky": "^7.0.4", "joi": "^17.11.0",
"joi": "^17.6.0", "jsonwebtoken": "^9.0.2",
"jsonwebtoken": "^8.5.1", "jwks-rsa": "^3.1.0",
"jwks-rsa": "^3.0.0",
"liquibase": "^4.4.0", "liquibase": "^4.4.0",
"moment": "^2.29.1", "moment": "^2.29.4",
"nats": "^2.6.0", "nats": "^2.18.0",
"pg": "^8.7.3", "pg": "^8.11.3",
"prisma": "^3.9.2",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2", "rxjs": "^7.8.1",
"rxjs": "^7.2.0", "swagger-ui-express": "^5.0.0",
"swagger-ui-express": "^4.3.0", "winston": "^3.11.0",
"winston": "^3.6.0", "winston-elasticsearch": "^0.17.4"
"winston-elasticsearch": "^0.16.1"
}, },
"devDependencies": { "devDependencies": {
"@nestjs/cli": "^8.0.0", "@nestjs/cli": "^10.2.1",
"@nestjs/schematics": "^8.0.0", "@nestjs/schematics": "^10.0.3",
"@nestjs/testing": "^8.0.0", "@nestjs/testing": "^10.2.8",
"@types/supertest": "^2.0.11", "@swc/cli": "^0.1.62",
"@typescript-eslint/eslint-plugin": "^5.0.0", "@swc/core": "^1.3.96",
"@typescript-eslint/parser": "^5.0.0", "@swc/jest": "^0.2.29",
"dotenv-cli": "^4.1.1", "@types/express": "^4.17.21",
"eslint": "^8.0.1", "@types/jest": "^29.5.8",
"eslint-config-airbnb-typescript": "^16.1.0", "@types/jsonwebtoken": "^9.0.5",
"eslint-config-prettier": "^8.3.0", "@types/node": "^20.9.0",
"eslint-plugin-import": "^2.25.4", "@types/supertest": "^2.0.16",
"eslint-plugin-prettier": "^4.0.0", "dotenv-cli": "^7.3.0",
"jest": "^27.2.5", "eslint": "^8.53.0",
"node-mocks-http": "^1.11.0", "jest": "^29.7.0",
"prettier": "^2.3.2", "node-mocks-http": "^1.13.0",
"source-map-support": "^0.5.20", "prisma": "^5.6.0",
"supertest": "^6.1.3", "rimraf": "^5.0.5",
"ts-jest": "^27.0.3", "source-map-support": "^0.5.21",
"ts-loader": "^9.2.3", "supertest": "^6.3.3",
"ts-node": "^10.0.0", "ts-node": "^10.9.1",
"tsconfig-paths": "^3.10.1", "typescript": "^5.2.2"
"typescript": "^4.3.5"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"setupFiles": [
"<rootDir>/../setup.js"
],
"coveragePathIgnorePatterns": [
"<rootDir>/main",
"<rootDir>/client/",
"<rootDir>/common/"
],
"moduleNameMapper": {
"^@config/(.*)$": [
"<rootDir>/../config/$1"
],
"^@credentialDef/(.*)$": "<rootDir>/credentialDef/$1",
"^@issueCredential/(.*)$": "<rootDir>/issue-credential/$1",
"^@schemas/(.*)$": "<rootDir>/schemas/$1",
"^@userInfo/(.*)$": "<rootDir>/userInfo/$1",
"^@src/(.*)$": "<rootDir>/$1",
"^@DB/(.*)$": "<rootDir>/prisma/$1",
"^@common/(.*)$": "<rootDir>/common/$1",
"^@utils/(.*)$": "<rootDir>/utils/$1",
"^@health/(.*)$": "<rootDir>/health/$1"
},
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
} }
} }
process.env.PORT=3005
process.env.NODE_ENV='development'
\ No newline at end of file
import { APP_FILTER } from '@nestjs/core';
import { import {
MiddlewareConsumer,
Module, Module,
NestModule,
RequestMethod, RequestMethod,
type MiddlewareConsumer,
type NestModule,
} from '@nestjs/common'; } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config'; import { ConfigModule } from '@nestjs/config';
import { APP_FILTER } from '@nestjs/core';
import { TerminusModule } from '@nestjs/terminus'; import { TerminusModule } from '@nestjs/terminus';
import config from '@config/config';
import validationSchema from '@config/validation'; import ExceptionHandler from './common/exception.handler.js';
import HealthController from '@src/health/health.controller'; import config from './config/config.js';
import ExceptionHandler from '@src/common/exception.handler'; import validationSchema from './config/validation.js';
import SchemasModule from '@src/schemas/module'; import CredentialDefModule from './credentialDef/module.js';
import CredentialDefModule from '@src/credentialDef/module'; import HealthController from './health/health.controller.js';
import UserInfoModule from '@userInfo/module'; import AttestationModule from './issue-credential/module.js';
import AttestationModule from './issue-credential/module'; import { AuthMiddleware } from './middleware/auth.middleware.js';
import { AuthMiddleware } from './middleware/auth.middleware'; import SchemasModule from './schemas/module.js';
import UserInfoModule from './userInfo/module.js';
@Module({ @Module({
imports: [ imports: [
...@@ -39,8 +40,7 @@ import { AuthMiddleware } from './middleware/auth.middleware'; ...@@ -39,8 +40,7 @@ import { AuthMiddleware } from './middleware/auth.middleware';
], ],
}) })
export default class AppModule implements NestModule { export default class AppModule implements NestModule {
// eslint-disable-next-line class-methods-use-this public configure(consumer: MiddlewareConsumer) {
configure(consumer: MiddlewareConsumer) {
// eslint-disable-line // eslint-disable-line
consumer consumer
.apply(AuthMiddleware) .apply(AuthMiddleware)
......
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import { ClientProxy } from '@nestjs/microservices'; import { ClientProxy } from '@nestjs/microservices';
import { lastValueFrom } from 'rxjs'; import { lastValueFrom } from 'rxjs';
import { Connection, NATSServices } from '@common/constants';
import { Connection, NATSServices } from '../common/constants.js';
@Injectable() @Injectable()
export default class NatsClientService { export default class NatsClientService {
constructor( public constructor(
@Inject(NATSServices.SERVICE_NAME) private natsClient: ClientProxy, @Inject(NATSServices.SERVICE_NAME) private natsClient: ClientProxy,
) {} ) {}
getConnectionById(connectionId: string) { public getConnectionById(connectionId: string) {
const pattern = { const pattern = {
endpoint: `${Connection.NATS_ENDPOINT}/${Connection.GET_CONNECTION_BY_ID}`, endpoint: `${Connection.NATS_ENDPOINT}/${Connection.GET_CONNECTION_BY_ID}`,
}; };
...@@ -17,7 +18,7 @@ export default class NatsClientService { ...@@ -17,7 +18,7 @@ export default class NatsClientService {
return lastValueFrom(this.natsClient.send(pattern, payload)); return lastValueFrom(this.natsClient.send(pattern, payload));
} }
connectionTrusted(connectionId: string) { public connectionTrusted(connectionId: string) {
const pattern = { const pattern = {
endpoint: `${Connection.NATS_ENDPOINT}/${Connection.MAKE_CONNECTION_TRUSTED}`, endpoint: `${Connection.NATS_ENDPOINT}/${Connection.MAKE_CONNECTION_TRUSTED}`,
}; };
...@@ -25,7 +26,7 @@ export default class NatsClientService { ...@@ -25,7 +26,7 @@ export default class NatsClientService {
return lastValueFrom(this.natsClient.send(pattern, payload)); return lastValueFrom(this.natsClient.send(pattern, payload));
} }
getReceivedConnections() { public getReceivedConnections() {
const pattern = { const pattern = {
endpoint: `${Connection.NATS_ENDPOINT}/${Connection.GET_RECEIVED_CONNECTIONS}`, endpoint: `${Connection.NATS_ENDPOINT}/${Connection.GET_RECEIVED_CONNECTIONS}`,
}; };
......
import { HttpService } from '@nestjs/axios';
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { lastValueFrom, map } from 'rxjs'; import { lastValueFrom, map } from 'rxjs';
import { HttpService } from '@nestjs/axios';
@Injectable() @Injectable()
export default class RestClientService { export default class RestClientService {
constructor(private readonly httpService: HttpService) {} public constructor(private readonly httpService: HttpService) {}
async delete(url: string) { public async delete(url: string) {
return lastValueFrom( return lastValueFrom(
this.httpService.delete(url).pipe(map((response) => response.data)), this.httpService.delete(url).pipe(map((response) => response.data)),
); );
} }
async post(url: string, payload: object) { public async post(url: string, payload: object) {
return lastValueFrom( return lastValueFrom(
this.httpService this.httpService
.post(url, payload) .post(url, payload)
...@@ -20,7 +20,7 @@ export default class RestClientService { ...@@ -20,7 +20,7 @@ export default class RestClientService {
); );
} }
async get(url: string) { public async get(url: string) {
return lastValueFrom( return lastValueFrom(
this.httpService.get(url).pipe(map((response) => response.data)), this.httpService.get(url).pipe(map((response) => response.data)),
); );
......
import { import {
natsAgentResponse, natsAgentResponse,
natsConnectionResponse, natsConnectionResponse,
} from '../stubs/nats-response'; } from '../stubs/nats-response.js';
const NatsClientServiceMock = jest.fn().mockReturnValue({ const NatsClientServiceMock = jest.fn().mockReturnValue({
getAgentByParticipantId: jest.fn().mockReturnValue(natsAgentResponse), getAgentByParticipantId: jest.fn().mockReturnValue(natsAgentResponse),
......
import schemaAgentDto from '@src/schemas/tests/stubs/schema-from-agent-dto'; import schemaAgentDto from '../../../schemas/tests/stubs/schema-from-agent-dto.js';
const RestClientServiceMock = jest.fn().mockReturnValue({ const RestClientServiceMock = jest.fn().mockReturnValue({
post: jest.fn().mockReturnValue({ agent: 'response' }), post: jest.fn().mockReturnValue({ agent: 'response' }),
......
import { PolicyReturnType } from '@src/client/tsa.client'; import type { PolicyReturnType } from '../../tsa.client.js';
import { TSAService } from '@src/common/constants';
import { TSAService } from '../../../common/constants.js';
const TSAClientServiceMock = jest.fn().mockReturnValue({ const TSAClientServiceMock = jest.fn().mockReturnValue({
getPolicy: jest.fn().mockImplementation((url: string) => { getPolicy: jest.fn().mockImplementation((url: string) => {
......
import type { TestingModule } from '@nestjs/testing';
import { HttpModule, HttpService } from '@nestjs/axios'; import { HttpModule, HttpService } from '@nestjs/axios';
import { Test, TestingModule } from '@nestjs/testing'; import { Test } from '@nestjs/testing';
import HttpServiceMock from '@src/tests/__mocks__/http-service';
import RestClientService from '../rest.client'; import HttpServiceMock from '../../tests/__mocks__/http-service.js';
import RestClientService from '../rest.client.js';
describe('RestClientService', () => { describe('RestClientService', () => {
let restClient: RestClientService; let restClient: RestClientService;
...@@ -25,7 +28,7 @@ describe('RestClientService', () => { ...@@ -25,7 +28,7 @@ describe('RestClientService', () => {
}); });
describe('post()', () => { describe('post()', () => {
let restClientResponse: any; let restClientResponse: unknown;
beforeEach(async () => { beforeEach(async () => {
restClientResponse = await restClient.post('test_url', {}); restClientResponse = await restClient.post('test_url', {});
......
import { ResponseType } from '@src/common/response'; import type { ResponseType } from '../../../common/response.js';
import AttestationService from '@src/issue-credential/services/service';
import AttestationService from '../../../issue-credential/services/service.js';
const natsAgentResponse: ResponseType = { const natsAgentResponse: ResponseType = {
statusCode: 200, statusCode: 200,
......
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import RestClientService from '@src/client/rest.client';
import RestClientService from './rest.client.js';
export interface PolicyReturnType { export interface PolicyReturnType {
success: boolean; success: boolean;
returnData?: any; // replace with actual structure when ready returnData?: unknown; // replace with actual structure when ready
} }
export interface PolicyResult { export interface PolicyResult {
allow: boolean; allow: boolean;
data?: any; data?: unknown;
} }
@Injectable() @Injectable()
export default class TSAClientService { export default class TSAClientService {
constructor(private readonly restClient: RestClientService) {} public constructor(private readonly restClient: RestClientService) {}
async getPolicy(policyUrl: string) { public async getPolicy(policyUrl: string) {
try { try {
const policyResponse: PolicyResult = await this.restClient.get(policyUrl); const policyResponse: PolicyResult = await this.restClient.get(policyUrl);
...@@ -35,7 +36,7 @@ export default class TSAClientService { ...@@ -35,7 +36,7 @@ export default class TSAClientService {
success: false, success: false,
returnData: 'Unable to fetch policy data.', returnData: 'Unable to fetch policy data.',
} as PolicyReturnType; } as PolicyReturnType;
} catch (error: any) { } catch (error: any /* eslint-disable-line @typescript-eslint/no-explicit-any */) {
let returnData = 'Something went wrong!'; let returnData = 'Something went wrong!';
if (error?.isAxiosError) { if (error?.isAxiosError) {
......
export enum LoggerConfig { export enum LoggerConfig {
FILE_PATH = 'logs/log.json', FILE_PATH = 'logs/log.json',
lOG_DIR = './logs', LOG_DIR = './logs',
} }
export enum Connection { export enum Connection {
......
import moment = require('moment'); import moment from 'moment';
const getDate = () => moment().format('MM-DD-YYYY, h:mm:ss a'); const getDate = () => moment().format('MM-DD-YYYY, h:mm:ss a');
......