From 87ecce0e3d8b2104c42e1d8869d34d26b004c4be Mon Sep 17 00:00:00 2001 From: KDwevedi Date: Wed, 19 Apr 2023 10:00:41 +0530 Subject: [PATCH 01/58] Feat: Added Credential Schema Service --- services/credential-schema/Dockerfile | 6 + services/credential-schema/README.md | 86 + services/credential-schema/build/Jenkinsfile | 45 + .../dist/samples/marksheet.json | 99 + .../samples/proof_of_academic_evaluation.json | 52 + .../dist/samples/proof_of_alumni.json | 46 + .../dist/samples/proof_of_marks.json | 52 + .../dist/samples/proof_of_training.json | 43 + services/credential-schema/dist/schema.json | 74 + .../dist/src/app.controller.d.ts | 6 + .../dist/src/app.controller.js | 34 + .../dist/src/app.controller.js.map | 1 + .../dist/src/app.module.d.ts | 2 + .../credential-schema/dist/src/app.module.js | 38 + .../dist/src/app.module.js.map | 1 + .../dist/src/app.service.d.ts | 3 + .../credential-schema/dist/src/app.service.js | 20 + .../dist/src/app.service.js.map | 1 + .../dist/src/auth/auth-basic.strategy.d.ts | 6 + .../dist/src/auth/auth-basic.strategy.js | 35 + .../dist/src/auth/auth-basic.strategy.js.map | 1 + .../dist/src/auth/auth-jwt.strategy.d.ts | 8 + .../dist/src/auth/auth-jwt.strategy.js | 33 + .../dist/src/auth/auth-jwt.strategy.js.map | 1 + .../dist/src/auth/auth.guard.d.ts | 11 + .../dist/src/auth/auth.guard.js | 61 + .../dist/src/auth/auth.guard.js.map | 1 + services/credential-schema/dist/src/main.d.ts | 1 + services/credential-schema/dist/src/main.js | 22 + .../credential-schema/dist/src/main.js.map | 1 + .../dist/src/prisma.service.d.ts | 6 + .../dist/src/prisma.service.js | 26 + .../dist/src/prisma.service.js.map | 1 + .../dto/addTemplate.dto.d.ts | 5 + .../dto/addTemplate.dto.js | 7 + .../dto/addTemplate.dto.js.map | 1 + .../dto/updateTemplate.dto.d.ts | 5 + .../dto/updateTemplate.dto.js | 7 + .../dto/updateTemplate.dto.js.map | 1 + .../enums/templateStatus.enum.d.ts | 4 + .../enums/templateStatus.enum.js | 9 + .../enums/templateStatus.enum.js.map | 1 + .../rendering-templates.controller.d.ts | 44 + .../rendering-templates.controller.js | 99 + .../rendering-templates.controller.js.map | 1 + .../rendering-templates.module.d.ts | 2 + .../rendering-templates.module.js | 27 + .../rendering-templates.module.js.map | 1 + .../rendering-templates.service.d.ts | 24 + .../rendering-templates.service.js | 164 + .../rendering-templates.service.js.map | 1 + .../validate-template.service.d.ts | 7 + .../validate-template.service.js | 57 + .../validate-template.service.js.map | 1 + .../verify-template.service.d.ts | 7 + .../verify-template.service.js | 58 + .../verify-template.service.js.map | 1 + .../schema/dto/create-credentials.dto.d.ts | 7 + .../src/schema/dto/create-credentials.dto.js | 7 + .../schema/dto/create-credentials.dto.js.map | 1 + .../src/schema/entities/VCItem.entity.d.ts | 19 + .../dist/src/schema/entities/VCItem.entity.js | 82 + .../src/schema/entities/VCItem.entity.js.map | 1 + .../schema/entities/VCModelSchema.entity.d.ts | 27 + .../schema/entities/VCModelSchema.entity.js | 30 + .../entities/VCModelSchema.entity.js.map | 1 + .../src/schema/entities/VCSchema.entity.d.ts | 13 + .../src/schema/entities/VCSchema.entity.js | 55 + .../schema/entities/VCSchema.entity.js.map | 1 + .../src/schema/enum/schemaStatus.enum.d.ts | 4 + .../dist/src/schema/enum/schemaStatus.enum.js | 9 + .../src/schema/enum/schemaStatus.enum.js.map | 1 + .../dist/src/schema/schema.controller.d.ts | 48 + .../dist/src/schema/schema.controller.js | 134 + .../dist/src/schema/schema.controller.js.map | 1 + .../dist/src/schema/schema.module.d.ts | 2 + .../dist/src/schema/schema.module.js | 23 + .../dist/src/schema/schema.module.js.map | 1 + .../dist/src/schema/schema.service.d.ts | 25 + .../dist/src/schema/schema.service.js | 189 + .../dist/src/schema/schema.service.js.map | 1 + .../dist/src/schema/schemas.d.ts | 246 + .../dist/src/schema/schemas.js | 16 + .../dist/src/schema/schemas.js.map | 1 + .../credential-schema/dist/src/script.d.ts | 0 services/credential-schema/dist/src/script.js | 1 + .../credential-schema/dist/src/script.js.map | 1 + .../create-cred-schema/CredSchemaBuilder.d.ts | 0 .../create-cred-schema/CredSchemaBuilder.js | 1 + .../CredSchemaBuilder.js.map | 1 + .../credential-schema/dist/src/sdk/index.d.ts | 0 .../credential-schema/dist/src/sdk/index.js | 1 + .../dist/src/sdk/index.js.map | 1 + .../src/types/VCModelSchema.interface.d.ts | 25 + .../dist/src/types/VCModelSchema.interface.js | 3 + .../src/types/VCModelSchema.interface.js.map | 1 + .../dist/src/utils/schema.validator.d.ts | 1 + .../dist/src/utils/schema.validator.js | 8 + .../dist/src/utils/schema.validator.js.map | 1 + .../dist/src/utils/test-samples.d.ts | 363 ++ .../dist/src/utils/test-samples.js | 338 + .../dist/src/utils/test-samples.js.map | 1 + .../dist/tsconfig.build.tsbuildinfo | 1 + services/credential-schema/nest-cli.json | 5 + services/credential-schema/package.json | 91 + .../20221129080801_initial/migration.sql | 43 + .../migration.sql | 14 + .../migration.sql | 24 + .../migration.sql | 2 + .../20230207115608_cred_schema/migration.sql | 9 + .../migration.sql | 9 + .../prisma/migrations/migration_lock.toml | 3 + .../credential-schema/prisma/schema.prisma | 69 + .../credential-schema/samples/marksheet.json | 99 + .../samples/proof_of_academic_evaluation.json | 52 + .../samples/proof_of_alumni.json | 46 + .../samples/proof_of_marks.json | 52 + .../samples/proof_of_training.json | 43 + services/credential-schema/schema.json | 74 + .../src/app.controller.spec.ts | 23 + .../credential-schema/src/app.controller.ts | 12 + services/credential-schema/src/app.module.ts | 25 + services/credential-schema/src/app.service.ts | 9 + .../src/auth/auth-basic.strategy.ts | 22 + .../src/auth/auth-jwt.strategy.ts | 31 + .../credential-schema/src/auth/auth.guard.ts | 50 + services/credential-schema/src/main.ts | 33 + .../credential-schema/src/prisma.service.ts | 15 + .../dto/addTemplate.dto.ts | 5 + .../dto/updateTemplate.dto.ts | 5 + .../rendering-templates.controller.spec.ts | 71 + .../rendering-templates.controller.ts | 71 + .../rendering-templates.module.ts | 15 + .../rendering-templates.service.spec.ts | 105 + .../rendering-templates.service.ts | 171 + .../validate-template.service.ts | 57 + .../src/schema/dto/create-credentials.dto.ts | 8 + .../src/schema/entities/VCItem.entity.ts | 38 + .../schema/entities/VCModelSchema.entity.ts | 74 + .../src/schema/entities/VCSchema.entity.ts | 29 + .../src/schema/schema.controller.spec.ts | 18 + .../src/schema/schema.controller.ts | 173 + .../src/schema/schema.module.ts | 10 + .../src/schema/schema.service.spec.ts | 18 + .../src/schema/schema.service.ts | 258 + .../credential-schema/src/schema/schemas.ts | 15 + services/credential-schema/src/script.ts | 0 .../create-cred-schema/CredSchemaBuilder.ts | 11 + services/credential-schema/src/sdk/index.ts | 0 .../src/types/VCModelSchema.interface.ts | 55 + .../src/utils/schema.validator.spec.ts | 10 + .../src/utils/schema.validator.ts | 6 + .../src/utils/test-samples.ts | 350 + .../credential-schema/test/app.e2e-spec.ts | 84 + services/credential-schema/test/jest-e2e.json | 9 + .../credential-schema/tsconfig.build.json | 4 + services/credential-schema/tsconfig.json | 22 + services/credential-schema/yarn.lock | 5742 +++++++++++++++++ 158 files changed, 11339 insertions(+) create mode 100644 services/credential-schema/Dockerfile create mode 100644 services/credential-schema/README.md create mode 100644 services/credential-schema/build/Jenkinsfile create mode 100644 services/credential-schema/dist/samples/marksheet.json create mode 100644 services/credential-schema/dist/samples/proof_of_academic_evaluation.json create mode 100644 services/credential-schema/dist/samples/proof_of_alumni.json create mode 100644 services/credential-schema/dist/samples/proof_of_marks.json create mode 100644 services/credential-schema/dist/samples/proof_of_training.json create mode 100644 services/credential-schema/dist/schema.json create mode 100644 services/credential-schema/dist/src/app.controller.d.ts create mode 100644 services/credential-schema/dist/src/app.controller.js create mode 100644 services/credential-schema/dist/src/app.controller.js.map create mode 100644 services/credential-schema/dist/src/app.module.d.ts create mode 100644 services/credential-schema/dist/src/app.module.js create mode 100644 services/credential-schema/dist/src/app.module.js.map create mode 100644 services/credential-schema/dist/src/app.service.d.ts create mode 100644 services/credential-schema/dist/src/app.service.js create mode 100644 services/credential-schema/dist/src/app.service.js.map create mode 100644 services/credential-schema/dist/src/auth/auth-basic.strategy.d.ts create mode 100644 services/credential-schema/dist/src/auth/auth-basic.strategy.js create mode 100644 services/credential-schema/dist/src/auth/auth-basic.strategy.js.map create mode 100644 services/credential-schema/dist/src/auth/auth-jwt.strategy.d.ts create mode 100644 services/credential-schema/dist/src/auth/auth-jwt.strategy.js create mode 100644 services/credential-schema/dist/src/auth/auth-jwt.strategy.js.map create mode 100644 services/credential-schema/dist/src/auth/auth.guard.d.ts create mode 100644 services/credential-schema/dist/src/auth/auth.guard.js create mode 100644 services/credential-schema/dist/src/auth/auth.guard.js.map create mode 100644 services/credential-schema/dist/src/main.d.ts create mode 100644 services/credential-schema/dist/src/main.js create mode 100644 services/credential-schema/dist/src/main.js.map create mode 100644 services/credential-schema/dist/src/prisma.service.d.ts create mode 100644 services/credential-schema/dist/src/prisma.service.js create mode 100644 services/credential-schema/dist/src/prisma.service.js.map create mode 100644 services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.d.ts create mode 100644 services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.js create mode 100644 services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.js.map create mode 100644 services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.d.ts create mode 100644 services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.js create mode 100644 services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.js.map create mode 100644 services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.d.ts create mode 100644 services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.js create mode 100644 services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.js.map create mode 100644 services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.d.ts create mode 100644 services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.js create mode 100644 services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.js.map create mode 100644 services/credential-schema/dist/src/rendering-templates/rendering-templates.module.d.ts create mode 100644 services/credential-schema/dist/src/rendering-templates/rendering-templates.module.js create mode 100644 services/credential-schema/dist/src/rendering-templates/rendering-templates.module.js.map create mode 100644 services/credential-schema/dist/src/rendering-templates/rendering-templates.service.d.ts create mode 100644 services/credential-schema/dist/src/rendering-templates/rendering-templates.service.js create mode 100644 services/credential-schema/dist/src/rendering-templates/rendering-templates.service.js.map create mode 100644 services/credential-schema/dist/src/rendering-templates/validate-template.service.d.ts create mode 100644 services/credential-schema/dist/src/rendering-templates/validate-template.service.js create mode 100644 services/credential-schema/dist/src/rendering-templates/validate-template.service.js.map create mode 100644 services/credential-schema/dist/src/rendering-templates/verify-template.service.d.ts create mode 100644 services/credential-schema/dist/src/rendering-templates/verify-template.service.js create mode 100644 services/credential-schema/dist/src/rendering-templates/verify-template.service.js.map create mode 100644 services/credential-schema/dist/src/schema/dto/create-credentials.dto.d.ts create mode 100644 services/credential-schema/dist/src/schema/dto/create-credentials.dto.js create mode 100644 services/credential-schema/dist/src/schema/dto/create-credentials.dto.js.map create mode 100644 services/credential-schema/dist/src/schema/entities/VCItem.entity.d.ts create mode 100644 services/credential-schema/dist/src/schema/entities/VCItem.entity.js create mode 100644 services/credential-schema/dist/src/schema/entities/VCItem.entity.js.map create mode 100644 services/credential-schema/dist/src/schema/entities/VCModelSchema.entity.d.ts create mode 100644 services/credential-schema/dist/src/schema/entities/VCModelSchema.entity.js create mode 100644 services/credential-schema/dist/src/schema/entities/VCModelSchema.entity.js.map create mode 100644 services/credential-schema/dist/src/schema/entities/VCSchema.entity.d.ts create mode 100644 services/credential-schema/dist/src/schema/entities/VCSchema.entity.js create mode 100644 services/credential-schema/dist/src/schema/entities/VCSchema.entity.js.map create mode 100644 services/credential-schema/dist/src/schema/enum/schemaStatus.enum.d.ts create mode 100644 services/credential-schema/dist/src/schema/enum/schemaStatus.enum.js create mode 100644 services/credential-schema/dist/src/schema/enum/schemaStatus.enum.js.map create mode 100644 services/credential-schema/dist/src/schema/schema.controller.d.ts create mode 100644 services/credential-schema/dist/src/schema/schema.controller.js create mode 100644 services/credential-schema/dist/src/schema/schema.controller.js.map create mode 100644 services/credential-schema/dist/src/schema/schema.module.d.ts create mode 100644 services/credential-schema/dist/src/schema/schema.module.js create mode 100644 services/credential-schema/dist/src/schema/schema.module.js.map create mode 100644 services/credential-schema/dist/src/schema/schema.service.d.ts create mode 100644 services/credential-schema/dist/src/schema/schema.service.js create mode 100644 services/credential-schema/dist/src/schema/schema.service.js.map create mode 100644 services/credential-schema/dist/src/schema/schemas.d.ts create mode 100644 services/credential-schema/dist/src/schema/schemas.js create mode 100644 services/credential-schema/dist/src/schema/schemas.js.map create mode 100644 services/credential-schema/dist/src/script.d.ts create mode 100644 services/credential-schema/dist/src/script.js create mode 100644 services/credential-schema/dist/src/script.js.map create mode 100644 services/credential-schema/dist/src/sdk/create-cred-schema/CredSchemaBuilder.d.ts create mode 100644 services/credential-schema/dist/src/sdk/create-cred-schema/CredSchemaBuilder.js create mode 100644 services/credential-schema/dist/src/sdk/create-cred-schema/CredSchemaBuilder.js.map create mode 100644 services/credential-schema/dist/src/sdk/index.d.ts create mode 100644 services/credential-schema/dist/src/sdk/index.js create mode 100644 services/credential-schema/dist/src/sdk/index.js.map create mode 100644 services/credential-schema/dist/src/types/VCModelSchema.interface.d.ts create mode 100644 services/credential-schema/dist/src/types/VCModelSchema.interface.js create mode 100644 services/credential-schema/dist/src/types/VCModelSchema.interface.js.map create mode 100644 services/credential-schema/dist/src/utils/schema.validator.d.ts create mode 100644 services/credential-schema/dist/src/utils/schema.validator.js create mode 100644 services/credential-schema/dist/src/utils/schema.validator.js.map create mode 100644 services/credential-schema/dist/src/utils/test-samples.d.ts create mode 100644 services/credential-schema/dist/src/utils/test-samples.js create mode 100644 services/credential-schema/dist/src/utils/test-samples.js.map create mode 100644 services/credential-schema/dist/tsconfig.build.tsbuildinfo create mode 100644 services/credential-schema/nest-cli.json create mode 100644 services/credential-schema/package.json create mode 100644 services/credential-schema/prisma/migrations/20221129080801_initial/migration.sql create mode 100644 services/credential-schema/prisma/migrations/20221129084416_update_version_type/migration.sql create mode 100644 services/credential-schema/prisma/migrations/20221227191932_update_schemas_to_v2/migration.sql create mode 100644 services/credential-schema/prisma/migrations/20221227192117_update_version_data_type/migration.sql create mode 100644 services/credential-schema/prisma/migrations/20230207115608_cred_schema/migration.sql create mode 100644 services/credential-schema/prisma/migrations/20230214060951_rendering_templates/migration.sql create mode 100644 services/credential-schema/prisma/migrations/migration_lock.toml create mode 100644 services/credential-schema/prisma/schema.prisma create mode 100644 services/credential-schema/samples/marksheet.json create mode 100644 services/credential-schema/samples/proof_of_academic_evaluation.json create mode 100644 services/credential-schema/samples/proof_of_alumni.json create mode 100644 services/credential-schema/samples/proof_of_marks.json create mode 100644 services/credential-schema/samples/proof_of_training.json create mode 100644 services/credential-schema/schema.json create mode 100644 services/credential-schema/src/app.controller.spec.ts create mode 100644 services/credential-schema/src/app.controller.ts create mode 100644 services/credential-schema/src/app.module.ts create mode 100644 services/credential-schema/src/app.service.ts create mode 100644 services/credential-schema/src/auth/auth-basic.strategy.ts create mode 100644 services/credential-schema/src/auth/auth-jwt.strategy.ts create mode 100644 services/credential-schema/src/auth/auth.guard.ts create mode 100644 services/credential-schema/src/main.ts create mode 100644 services/credential-schema/src/prisma.service.ts create mode 100644 services/credential-schema/src/rendering-templates/dto/addTemplate.dto.ts create mode 100644 services/credential-schema/src/rendering-templates/dto/updateTemplate.dto.ts create mode 100644 services/credential-schema/src/rendering-templates/rendering-templates.controller.spec.ts create mode 100644 services/credential-schema/src/rendering-templates/rendering-templates.controller.ts create mode 100644 services/credential-schema/src/rendering-templates/rendering-templates.module.ts create mode 100644 services/credential-schema/src/rendering-templates/rendering-templates.service.spec.ts create mode 100644 services/credential-schema/src/rendering-templates/rendering-templates.service.ts create mode 100644 services/credential-schema/src/rendering-templates/validate-template.service.ts create mode 100644 services/credential-schema/src/schema/dto/create-credentials.dto.ts create mode 100644 services/credential-schema/src/schema/entities/VCItem.entity.ts create mode 100644 services/credential-schema/src/schema/entities/VCModelSchema.entity.ts create mode 100644 services/credential-schema/src/schema/entities/VCSchema.entity.ts create mode 100644 services/credential-schema/src/schema/schema.controller.spec.ts create mode 100644 services/credential-schema/src/schema/schema.controller.ts create mode 100644 services/credential-schema/src/schema/schema.module.ts create mode 100644 services/credential-schema/src/schema/schema.service.spec.ts create mode 100644 services/credential-schema/src/schema/schema.service.ts create mode 100644 services/credential-schema/src/schema/schemas.ts create mode 100644 services/credential-schema/src/script.ts create mode 100644 services/credential-schema/src/sdk/create-cred-schema/CredSchemaBuilder.ts create mode 100644 services/credential-schema/src/sdk/index.ts create mode 100644 services/credential-schema/src/types/VCModelSchema.interface.ts create mode 100644 services/credential-schema/src/utils/schema.validator.spec.ts create mode 100644 services/credential-schema/src/utils/schema.validator.ts create mode 100644 services/credential-schema/src/utils/test-samples.ts create mode 100644 services/credential-schema/test/app.e2e-spec.ts create mode 100644 services/credential-schema/test/jest-e2e.json create mode 100644 services/credential-schema/tsconfig.build.json create mode 100644 services/credential-schema/tsconfig.json create mode 100644 services/credential-schema/yarn.lock diff --git a/services/credential-schema/Dockerfile b/services/credential-schema/Dockerfile new file mode 100644 index 000000000..26545cb00 --- /dev/null +++ b/services/credential-schema/Dockerfile @@ -0,0 +1,6 @@ +FROM node:16 as dependencies +WORKDIR /app +COPY . ./ +RUN yarn +EXPOSE 3000 +CMD ["yarn", "start"] \ No newline at end of file diff --git a/services/credential-schema/README.md b/services/credential-schema/README.md new file mode 100644 index 000000000..c7a18f1e7 --- /dev/null +++ b/services/credential-schema/README.md @@ -0,0 +1,86 @@ +# Credential Schema Microservice + +## Description + +[Nest](https://github.com/nestjs/nest) based CRUD APIs for handling the schemas of different verifiable credentials used for implementing the [Unified Learner's Passbook](https://github.com/Unified-Learners-Passbook) in the state of Uttar Pradesh, India. + +## Installation + +```bash + +$ npm install + +``` +OR +```bash + +$ npx yarn + +``` +## Running the app + +```bash +# development +$ npm run start + +# watch mode +$ npm run start:dev + +# production mode +$ npm run start:prod +``` + +OR + +```bash +# development +$ npx yarn run start + +# watch mode +$ npx yarn run start:dev + +# production mode +$ npx yarn run start:prod +``` + +## Test + +```bash +# unit tests +$ npm run test + +# e2e tests +$ npm run test:e2e + +# test coverage +$ npm run test:cov +``` + +OR + +```bash +# unit tests +$ npx yarn run test + +# e2e tests +$ npx yarn run test:e2e + +# test coverage +$ npx yarn run test:cov +``` + +## Stay in touch + +- Authors - [Yash Mittal](https://github.com/techsavvyash) and [Chakshu Gautam](https://github.com/ChakshuGautam) +- Website - [https://nestjs.com](https://nestjs.com/) + +## License + +Nest is [MIT licensed](LICENSE). + +## Reference Links + +- [W3C Credential Schema (Currently being used)](https://w3c-ccg.github.io/vc-json-schemas/schema/2.0/schema.json) +- [W3C Credential Schema (initially used)](https://w3c-ccg.github.io/vc-json-schemas/schema/1.0/schema.json) +- [W3C JSON Schemas Website](https://w3c-ccg.github.io/vc-json-schemas/) +- [API Documentation](https://github.com/Sunbird-RC/sunbird-rc-core/tree/main/api-documentation) diff --git a/services/credential-schema/build/Jenkinsfile b/services/credential-schema/build/Jenkinsfile new file mode 100644 index 000000000..eb072fd89 --- /dev/null +++ b/services/credential-schema/build/Jenkinsfile @@ -0,0 +1,45 @@ +node() { + withCredentials([string(credentialsId: 'docker_server', variable: 'docker_server')]) { + properties([ + parameters([ + string(name: 'docker_repo', defaultValue: 'samagragovernance/cred-schema-ms', description: 'Docker Image Name'), + string(name: 'docker_server', defaultValue: "$docker_server", description: 'Docker Registry URL'), + + ]) + ]) + } + stage('Checkout') { + cleanWs() + checkout scm + env.commit_id = env.BRANCH_NAME + echo "${env.commit_id}" + } + + stage('docker-build') { + sh ''' + docker build -f Dockerfile -t $docker_server/$docker_repo:$commit_id . + ''' + if (env.BRANCH_NAME == 'main' || env.BRANCH_NAME == 'master') { + sh ''' + docker build -f Dockerfile -t $docker_server/$docker_repo:latest . + ''' + } + } + + stage('docker-push') { + sh ''' + docker push $docker_server/$docker_repo:$commit_id + ''' + if (env.BRANCH_NAME == 'main' || env.BRANCH_NAME == 'master') { + sh ''' + docker push $docker_server/$docker_repo:latest + ''' + } + } + + stage('Start deploy job with latest tag') { + if (env.BRANCH_NAME == 'main' || env.BRANCH_NAME == 'master') { + build job: 'ULP/deploy-staging/cred-schema-ms/', parameters: [string(name: 'tag', value: 'latest')] + } + } +} diff --git a/services/credential-schema/dist/samples/marksheet.json b/services/credential-schema/dist/samples/marksheet.json new file mode 100644 index 000000000..a4dfd0e17 --- /dev/null +++ b/services/credential-schema/dist/samples/marksheet.json @@ -0,0 +1,99 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + "https://playground.chapi.io/examples/alumni/alumni-v1.json", + "https://w3id.org/security/suites/ed25519-2020/v1" + ], + "type": "https://w3c-ccg.github.io/vc-json-schemas/", + "version": "1.0", + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "name": "UP Board of Secondary school Education class 12th Marksheet", + "author": "did:example:c276e12ec21ebfeb1f712ebc6f1", + "authored": "2022-12-19T09:22:23.064Z", + "schema": { + "$id": "UP-Board-Class-12-Marksheet-Credential-1.0", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "description": "The holder has scored the in UP Board 12 exams.", + "type": "object", + "properties": { + "roll_number": { + "type": "string", + "description": "Roll number of the holder in the examination." + }, + "name": { + "type": "string", + "description": "Name of the holder." + }, + "fathers_name": { + "type": "string", + "description": "Name of the father of the holder." + }, + "mothers_name": { + "type": "string", + "description": "Name of the mother of the holder." + }, + "DOB": { + "type": "date-time", + "description": "date of birth of the holder" + }, + "result": { + "type": "string", + "description": "Result of the holder in the examination" + }, + "score_details": { + "type": "array", + "description": "Marks scored by the holder in various subjects.", + "items": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Name of the subject" + }, + "theory_score": { + "type": "number", + "description": "Marks scored by the holder in the subject" + }, + "practical_score": { + "type": "number", + "description": "Marks scored by the holder in the practicals of the subject" + }, + "total_score": { + "type": "number", + "description": "Total marks scored by the holder in the subject" + }, + "grade": { + "type": "string", + "description": "Grade scored by the holder in the subject" + } + }, + "required": [ + "subject", + "theory_score", + "practical_score", + "total_score", + "grade" + ] + } + } + }, + "required": [ + "roll_number", + "name", + "fathers_name", + "mothers_name", + "DOB", + "result", + "score_details" + ], + "additionalProperties": false + }, + "proof": { + "type": "Ed25519Signature2020", + "created": "2022-12-19T09:22:23Z", + "verificationMethod": "did:key:z6MkqYDbJ5yVgg5UvfRt5DAsk5dvPTgo6H9CZcenziWdHTqN#z6MkqYDbJ5yVgg5UvfRt5DAsk5dvPTgo6H9CZcenziWdHTqN", + "proofPurpose": "assertionMethod", + "proofValue": "z5iBktnPCr3hPqN7FViY948ds5yMhrL1qujMmVD1GmzsbtXw5RUCdu4GKrQZw8U9c4G78SUNmPLTS87tz6kGAHgXB" + } +} diff --git a/services/credential-schema/dist/samples/proof_of_academic_evaluation.json b/services/credential-schema/dist/samples/proof_of_academic_evaluation.json new file mode 100644 index 000000000..23b9ffdae --- /dev/null +++ b/services/credential-schema/dist/samples/proof_of_academic_evaluation.json @@ -0,0 +1,52 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + "https://playground.chapi.io/examples/alumni/alumni-v1.json", + "https://w3id.org/security/suites/ed25519-2020/v1" + ], + "type": "https://w3c-ccg.github.io/vc-json-schemas/", + "version": "1.0", + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "name": "Proof of Academic Evaluation Credential", + "author": "did:example:c276e12ec21ebfeb1f712ebc6f1", + "authored": "2022-12-19T09:22:23.064Z", + "schema": { + "$id": "Proof-of-Academic-Evaluation-Credential-1.0", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "description": "The holder has secured the in from .", + "type": "object", + "properties": { + "grade": { + "type": "string", + "description": "Grade (%age, GPA, etc.) secured by the holder." + }, + "programme": { + "type": "string", + "description": "Name of the programme pursed by the holder." + }, + "certifyingInstitute": { + "type": "string", + "description": "Name of the instute which certified the said grade in the said skill" + }, + "evaluatingInstitute": { + "type": "string", + "description": "Name of the institute which ran the programme and evaluated the holder." + } + }, + "required": [ + "grade", + "programme", + "certifyingInstitute", + "evaluatingInstitute" + ], + "additionalProperties": false + }, + "proof": { + "type": "Ed25519Signature2020", + "created": "2022-12-19T09:22:23Z", + "verificationMethod": "did:key:z6MkqYDbJ5yVgg5UvfRt5DAsk5dvPTgo6H9CZcenziWdHTqN#z6MkqYDbJ5yVgg5UvfRt5DAsk5dvPTgo6H9CZcenziWdHTqN", + "proofPurpose": "assertionMethod", + "proofValue": "z5iBktnPCr3hPqN7FViY948ds5yMhrL1qujMmVD1GmzsbtXw5RUCdu4GKrQZw8U9c4G78SUNmPLTS87tz6kGAHgXB" + } +} diff --git a/services/credential-schema/dist/samples/proof_of_alumni.json b/services/credential-schema/dist/samples/proof_of_alumni.json new file mode 100644 index 000000000..f6a13b771 --- /dev/null +++ b/services/credential-schema/dist/samples/proof_of_alumni.json @@ -0,0 +1,46 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + "https://playground.chapi.io/examples/alumni/alumni-v1.json", + "https://w3id.org/security/suites/ed25519-2020/v1" + ], + "type": "https://w3c-ccg.github.io/vc-json-schemas/", + "version": "1.0", + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "name": "Alumni Credential", + "author": "did:example:c276e12ec21ebfeb1f712ebc6f1", + "authored": "2022-12-19T09:22:23.064Z", + "schema": { + "$id": "Alumni-Credential-1.0", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "description": "The holder is an alumni of Example University.", + "type": "object", + "properties": { + "alumniOf": { + "type": "object", + "properties": { + "identifier": { + "type": "string", + "format": "did", + "description": "The did for the issuing university (issuer)." + }, + "name": { + "type": "string", + "description": "Name of the issuing university (issuer)." + } + }, + "required": ["identifier", "name"] + } + }, + "required": ["alumniOf"], + "additionalProperties": false + }, + "proof": { + "type": "Ed25519Signature2020", + "created": "2022-12-19T09:22:23Z", + "verificationMethod": "did:key:z6MkqYDbJ5yVgg5UvfRt5DAsk5dvPTgo6H9CZcenziWdHTqN#z6MkqYDbJ5yVgg5UvfRt5DAsk5dvPTgo6H9CZcenziWdHTqN", + "proofPurpose": "assertionMethod", + "proofValue": "z5iBktnPCr3hPqN7FViY948ds5yMhrL1qujMmVD1GmzsbtXw5RUCdu4GKrQZw8U9c4G78SUNmPLTS87tz6kGAHgXB" + } +} diff --git a/services/credential-schema/dist/samples/proof_of_marks.json b/services/credential-schema/dist/samples/proof_of_marks.json new file mode 100644 index 000000000..0dcaefa98 --- /dev/null +++ b/services/credential-schema/dist/samples/proof_of_marks.json @@ -0,0 +1,52 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + "https://playground.chapi.io/examples/alumni/alumni-v1.json", + "https://w3id.org/security/suites/ed25519-2020/v1" + ], + "type": "https://w3c-ccg.github.io/vc-json-schemas/", + "version": "1.0", + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "name": "Marks Credential", + "author": "did:example:c276e12ec21ebfeb1f712ebc6f1", + "authored": "2022-12-19T09:22:23.064Z", + "schema": { + "$id": "Marks-Credential-1.0", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "description": "The holder has scored the in ABC Examination.", + "type": "object", + "properties": { + "score": { + "type": "number", + "description": "Marks scored by the holder in ABC Examination." + }, + "examinationName": { + "type": "string", + "description": "Name of the examination taken" + }, + "releasingInstitution": { + "type": "string", + "description": "Name of the instute which released the score" + }, + "organisingInstitute": { + "type": "string", + "description": "Name of the institute which organised the examination." + } + }, + "required": [ + "score", + "examinationName", + "releasingInstitution", + "organisingInstitute" + ], + "additionalProperties": false + }, + "proof": { + "type": "Ed25519Signature2020", + "created": "2022-12-19T09:22:23Z", + "verificationMethod": "did:key:z6MkqYDbJ5yVgg5UvfRt5DAsk5dvPTgo6H9CZcenziWdHTqN#z6MkqYDbJ5yVgg5UvfRt5DAsk5dvPTgo6H9CZcenziWdHTqN", + "proofPurpose": "assertionMethod", + "proofValue": "z5iBktnPCr3hPqN7FViY948ds5yMhrL1qujMmVD1GmzsbtXw5RUCdu4GKrQZw8U9c4G78SUNmPLTS87tz6kGAHgXB" + } +} diff --git a/services/credential-schema/dist/samples/proof_of_training.json b/services/credential-schema/dist/samples/proof_of_training.json new file mode 100644 index 000000000..b97ded71a --- /dev/null +++ b/services/credential-schema/dist/samples/proof_of_training.json @@ -0,0 +1,43 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://www.w3.org/2018/credentials/examples/v1", + "https://playground.chapi.io/examples/alumni/alumni-v1.json", + "https://w3id.org/security/suites/ed25519-2020/v1" + ], + "type": "https://w3c-ccg.github.io/vc-json-schemas/", + "version": "1.0", + "id": "did:example:ebfeb1f712ebc6f1c276e12ec21", + "name": "Proof of Training Credential", + "author": "did:example:c276e12ec21ebfeb1f712ebc6f1", + "authored": "2022-12-19T09:22:23.064Z", + "schema": { + "$id": "Proof-of-Training-Credential-1.0", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "description": "The holder has completed training for in .", + "type": "object", + "properties": { + "skill": { + "type": "string", + "description": "The skill for which the holder was trained." + }, + "certifyingInstitute": { + "type": "string", + "description": "Name of the instute which certified the holder being skilled in the said skill" + }, + "trainingInstitute": { + "type": "string", + "description": "Name of the institute which organised the training." + } + }, + "required": ["skill", "releasingInstitute", "trainingInstitute"], + "additionalProperties": false + }, + "proof": { + "type": "Ed25519Signature2020", + "created": "2022-12-19T09:22:23Z", + "verificationMethod": "did:key:z6MkqYDbJ5yVgg5UvfRt5DAsk5dvPTgo6H9CZcenziWdHTqN#z6MkqYDbJ5yVgg5UvfRt5DAsk5dvPTgo6H9CZcenziWdHTqN", + "proofPurpose": "assertionMethod", + "proofValue": "z5iBktnPCr3hPqN7FViY948ds5yMhrL1qujMmVD1GmzsbtXw5RUCdu4GKrQZw8U9c4G78SUNmPLTS87tz6kGAHgXB" + } +} diff --git a/services/credential-schema/dist/schema.json b/services/credential-schema/dist/schema.json new file mode 100644 index 000000000..37ad0838b --- /dev/null +++ b/services/credential-schema/dist/schema.json @@ -0,0 +1,74 @@ +{ + "$id": "credential-schema-2.0", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "description": "JSON Schema for W3C Verifiable Credential JSON Schema", + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "version": { + "type": "string", + "pattern": "^\\d+\\.\\d+$" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "author": { + "type": "string" + }, + "authored": { + "type": "string" + }, + "schema": { + "type": "object", + "properties": { + "$id": { + "type": "string" + }, + "$schema": { + "type": "string" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "properties": { + "type": "object" + }, + "required": { + "type": "array", + "items": [ + { + "type": "string" + } + ] + }, + "additionalProperties": { + "type": "boolean" + } + }, + "required": [ + "$id", + "$schema", + "description", + "type", + "properties", + "required", + "additionalProperties" + ] + }, + "proof": { + "type": "object" + } + }, + "required": ["type", "version", "id", "name", "author", "authored", "schema"] +} diff --git a/services/credential-schema/dist/src/app.controller.d.ts b/services/credential-schema/dist/src/app.controller.d.ts new file mode 100644 index 000000000..3859d69c3 --- /dev/null +++ b/services/credential-schema/dist/src/app.controller.d.ts @@ -0,0 +1,6 @@ +import { AppService } from './app.service'; +export declare class AppController { + private readonly appService; + constructor(appService: AppService); + getHello(): string; +} diff --git a/services/credential-schema/dist/src/app.controller.js b/services/credential-schema/dist/src/app.controller.js new file mode 100644 index 000000000..dcf0f7731 --- /dev/null +++ b/services/credential-schema/dist/src/app.controller.js @@ -0,0 +1,34 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AppController = void 0; +const common_1 = require("@nestjs/common"); +const app_service_1 = require("./app.service"); +let AppController = class AppController { + constructor(appService) { + this.appService = appService; + } + getHello() { + return this.appService.getHello(); + } +}; +__decorate([ + (0, common_1.Get)(), + __metadata("design:type", Function), + __metadata("design:paramtypes", []), + __metadata("design:returntype", String) +], AppController.prototype, "getHello", null); +AppController = __decorate([ + (0, common_1.Controller)(), + __metadata("design:paramtypes", [app_service_1.AppService]) +], AppController); +exports.AppController = AppController; +//# sourceMappingURL=app.controller.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/app.controller.js.map b/services/credential-schema/dist/src/app.controller.js.map new file mode 100644 index 000000000..4ef7e47d8 --- /dev/null +++ b/services/credential-schema/dist/src/app.controller.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiD;AACjD,+CAA2C;AAGpC,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAGvD,QAAQ;QACN,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IACpC,CAAC;CACF,CAAA;AAJC;IAAC,IAAA,YAAG,GAAE;;;;6CAGL;AANU,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAE8B,wBAAU;GADxC,aAAa,CAOzB;AAPY,sCAAa"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/app.module.d.ts b/services/credential-schema/dist/src/app.module.d.ts new file mode 100644 index 000000000..09cdb35c8 --- /dev/null +++ b/services/credential-schema/dist/src/app.module.d.ts @@ -0,0 +1,2 @@ +export declare class AppModule { +} diff --git a/services/credential-schema/dist/src/app.module.js b/services/credential-schema/dist/src/app.module.js new file mode 100644 index 000000000..ef2018d22 --- /dev/null +++ b/services/credential-schema/dist/src/app.module.js @@ -0,0 +1,38 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AppModule = void 0; +const common_1 = require("@nestjs/common"); +const app_controller_1 = require("./app.controller"); +const app_service_1 = require("./app.service"); +const schema_service_1 = require("./schema/schema.service"); +const schema_module_1 = require("./schema/schema.module"); +const prisma_service_1 = require("./prisma.service"); +const config_1 = require("@nestjs/config"); +const rendering_templates_module_1 = require("./rendering-templates/rendering-templates.module"); +let AppModule = class AppModule { +}; +AppModule = __decorate([ + (0, common_1.Module)({ + imports: [ + schema_module_1.SchemaModule, + config_1.ConfigModule.forRoot({ + isGlobal: true, + }), + common_1.CacheModule.register({ + isGlobal: true, + max: 1000, + }), + rendering_templates_module_1.RenderingTemplatesModule, + ], + controllers: [app_controller_1.AppController], + providers: [app_service_1.AppService, prisma_service_1.PrismaService, schema_service_1.SchemaService], + }) +], AppModule); +exports.AppModule = AppModule; +//# sourceMappingURL=app.module.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/app.module.js.map b/services/credential-schema/dist/src/app.module.js.map new file mode 100644 index 000000000..bae6b94fd --- /dev/null +++ b/services/credential-schema/dist/src/app.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAqD;AACrD,qDAAiD;AACjD,+CAA2C;AAC3C,4DAAwD;AACxD,0DAAsD;AACtD,qDAAiD;AACjD,2CAA8C;AAC9C,iGAA4F;AAiBrF,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,SAAS;IAfrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,4BAAY;YACZ,qBAAY,CAAC,OAAO,CAAC;gBACnB,QAAQ,EAAE,IAAI;aACf,CAAC;YACF,oBAAW,CAAC,QAAQ,CAAC;gBACnB,QAAQ,EAAE,IAAI;gBACd,GAAG,EAAE,IAAI;aACV,CAAC;YACF,qDAAwB;SACzB;QACD,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,wBAAU,EAAE,8BAAa,EAAE,8BAAa,CAAC;KACtD,CAAC;GACW,SAAS,CAAG;AAAZ,8BAAS"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/app.service.d.ts b/services/credential-schema/dist/src/app.service.d.ts new file mode 100644 index 000000000..0496e7902 --- /dev/null +++ b/services/credential-schema/dist/src/app.service.d.ts @@ -0,0 +1,3 @@ +export declare class AppService { + getHello(): string; +} diff --git a/services/credential-schema/dist/src/app.service.js b/services/credential-schema/dist/src/app.service.js new file mode 100644 index 000000000..2b0168628 --- /dev/null +++ b/services/credential-schema/dist/src/app.service.js @@ -0,0 +1,20 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AppService = void 0; +const common_1 = require("@nestjs/common"); +let AppService = class AppService { + getHello() { + return 'Hello World!'; + } +}; +AppService = __decorate([ + (0, common_1.Injectable)() +], AppService); +exports.AppService = AppService; +//# sourceMappingURL=app.service.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/app.service.js.map b/services/credential-schema/dist/src/app.service.js.map new file mode 100644 index 000000000..4a140c613 --- /dev/null +++ b/services/credential-schema/dist/src/app.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.service.js","sourceRoot":"","sources":["../../src/app.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAIrC,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,QAAQ;QACN,OAAO,cAAc,CAAC;IACxB,CAAC;CACF,CAAA;AAJY,UAAU;IADtB,IAAA,mBAAU,GAAE;GACA,UAAU,CAItB;AAJY,gCAAU"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/auth/auth-basic.strategy.d.ts b/services/credential-schema/dist/src/auth/auth-basic.strategy.d.ts new file mode 100644 index 000000000..2b8b676fb --- /dev/null +++ b/services/credential-schema/dist/src/auth/auth-basic.strategy.d.ts @@ -0,0 +1,6 @@ +declare const BasicStrategy_base: new (...args: any[]) => any; +export declare class BasicStrategy extends BasicStrategy_base { + constructor(); + validate: (req: any, username: any, password: any) => Promise; +} +export {}; diff --git a/services/credential-schema/dist/src/auth/auth-basic.strategy.js b/services/credential-schema/dist/src/auth/auth-basic.strategy.js new file mode 100644 index 000000000..b48b3c645 --- /dev/null +++ b/services/credential-schema/dist/src/auth/auth-basic.strategy.js @@ -0,0 +1,35 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BasicStrategy = void 0; +const passport_http_1 = require("passport-http"); +const common_1 = require("@nestjs/common"); +const passport_1 = require("@nestjs/passport"); +let BasicStrategy = class BasicStrategy extends (0, passport_1.PassportStrategy)(passport_http_1.BasicStrategy) { + constructor() { + super({ + passReqToCallback: true, + }); + this.validate = async (req, username, password) => { + if (process.env.HTTP_BASIC_USER === username && + process.env.HTTP_BASIC_PASS === password) { + return true; + } + throw new common_1.UnauthorizedException(); + }; + } +}; +BasicStrategy = __decorate([ + (0, common_1.Injectable)(), + __metadata("design:paramtypes", []) +], BasicStrategy); +exports.BasicStrategy = BasicStrategy; +//# sourceMappingURL=auth-basic.strategy.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/auth/auth-basic.strategy.js.map b/services/credential-schema/dist/src/auth/auth-basic.strategy.js.map new file mode 100644 index 000000000..1486862fb --- /dev/null +++ b/services/credential-schema/dist/src/auth/auth-basic.strategy.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-basic.strategy.js","sourceRoot":"","sources":["../../../src/auth/auth-basic.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA0D;AAC1D,2CAAmE;AACnE,+CAAoD;AAG7C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,IAAA,2BAAgB,EAAC,6BAAQ,CAAC;IAC3D;QACE,KAAK,CAAC;YACJ,iBAAiB,EAAE,IAAI;SACxB,CAAC,CAAC;QAGE,aAAQ,GAAG,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAoB,EAAE;YACpE,IACE,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,QAAQ;gBACxC,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,QAAQ,EACxC;gBACA,OAAO,IAAI,CAAC;aACb;YACD,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACpC,CAAC,CAAC;IAVF,CAAC;CAWF,CAAA;AAhBY,aAAa;IADzB,IAAA,mBAAU,GAAE;;GACA,aAAa,CAgBzB;AAhBY,sCAAa"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/auth/auth-jwt.strategy.d.ts b/services/credential-schema/dist/src/auth/auth-jwt.strategy.d.ts new file mode 100644 index 000000000..2678a13bb --- /dev/null +++ b/services/credential-schema/dist/src/auth/auth-jwt.strategy.d.ts @@ -0,0 +1,8 @@ +declare const JwtStrategy_base: new (...args: any[]) => any; +export declare class JwtStrategy extends JwtStrategy_base { + constructor(); + validate(payload: any): Promise<{ + roles: any; + }>; +} +export {}; diff --git a/services/credential-schema/dist/src/auth/auth-jwt.strategy.js b/services/credential-schema/dist/src/auth/auth-jwt.strategy.js new file mode 100644 index 000000000..e8bd41002 --- /dev/null +++ b/services/credential-schema/dist/src/auth/auth-jwt.strategy.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JwtStrategy = void 0; +const common_1 = require("@nestjs/common"); +const passport_1 = require("@nestjs/passport"); +const jwks_rsa_1 = require("jwks-rsa"); +const passport_jwt_1 = require("passport-jwt"); +class JwtStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy) { + constructor() { + console.log('process.env.JWKS_URI : ', process.env.JWKS_URI); + super({ + jwtFromRequest: passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(), + ignoreExpiration: false, + secretOrKeyProvider: (0, jwks_rsa_1.passportJwtSecret)({ + cache: true, + rateLimit: true, + jwksRequestsPerMinute: 5, + jwksUri: process.env.JWKS_URI, + }), + algorithms: ['RS256'], + }); + } + async validate(payload) { + console.log('in validate: ', payload); + if (!payload) { + throw new common_1.UnauthorizedException(); + } + console.log('VALID'); + return { roles: payload.roles }; + } +} +exports.JwtStrategy = JwtStrategy; +//# sourceMappingURL=auth-jwt.strategy.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/auth/auth-jwt.strategy.js.map b/services/credential-schema/dist/src/auth/auth-jwt.strategy.js.map new file mode 100644 index 000000000..123b5ec18 --- /dev/null +++ b/services/credential-schema/dist/src/auth/auth-jwt.strategy.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-jwt.strategy.js","sourceRoot":"","sources":["../../../src/auth/auth-jwt.strategy.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AACvD,+CAAoD;AACpD,uCAA6C;AAC7C,+CAAoD;AAEpD,MAAa,WAAY,SAAQ,IAAA,2BAAgB,EAAC,uBAAQ,CAAC;IACzD;QACE,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7D,KAAK,CAAC;YACJ,cAAc,EAAE,yBAAU,CAAC,2BAA2B,EAAE;YACxD,gBAAgB,EAAE,KAAK;YACvB,mBAAmB,EAAE,IAAA,4BAAiB,EAAC;gBACrC,KAAK,EAAE,IAAI;gBACX,SAAS,EAAE,IAAI;gBACf,qBAAqB,EAAE,CAAC;gBACxB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;aAC9B,CAAC;YACF,UAAU,EAAE,CAAC,OAAO,CAAC;SACtB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAY;QACzB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QAEtC,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,8BAAqB,EAAE,CAAC;SACnC;QACD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;CACF;AAzBD,kCAyBC"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/auth/auth.guard.d.ts b/services/credential-schema/dist/src/auth/auth.guard.d.ts new file mode 100644 index 000000000..36dbace11 --- /dev/null +++ b/services/credential-schema/dist/src/auth/auth.guard.d.ts @@ -0,0 +1,11 @@ +import { ExecutionContext } from '@nestjs/common'; +import { IAuthGuard } from '@nestjs/passport'; +import { Reflector } from '@nestjs/core'; +declare const JwtAuthGuard_base: import("@nestjs/passport").Type; +export declare class JwtAuthGuard extends JwtAuthGuard_base implements IAuthGuard { + private reflector; + constructor(reflector: Reflector); + canActivate(context: ExecutionContext): Promise; + handleRequest(err: any, user: any, info: any): any; +} +export {}; diff --git a/services/credential-schema/dist/src/auth/auth.guard.js b/services/credential-schema/dist/src/auth/auth.guard.js new file mode 100644 index 000000000..1e5de3914 --- /dev/null +++ b/services/credential-schema/dist/src/auth/auth.guard.js @@ -0,0 +1,61 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JwtAuthGuard = void 0; +const common_1 = require("@nestjs/common"); +const passport_1 = require("@nestjs/passport"); +const core_1 = require("@nestjs/core"); +let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') { + constructor(reflector) { + super(); + this.reflector = reflector; + } + async canActivate(context) { + await super.canActivate(context); + console.log('context: ', context.getHandler()); + console.log('context.switchToHttp().getRequest(): ', context.switchToHttp().getRequest()['user']['roles']); + const roles = this.reflector.get('roles', context.getHandler()); + console.log('roles: ', roles); + if (!roles) { + return true; + } + let isAllowed = false; + const request = context.switchToHttp().getRequest(); + try { + const tokenRoles = request['user']['roles']; + for (const role of roles) { + if (tokenRoles.indexOf(role) > -1) { + isAllowed = true; + break; + } + } + if (tokenRoles.indexOf('Student') > -1) { + isAllowed = true; + } + } + catch (error) { + console.log({ err: error }); + isAllowed = false; + } + return isAllowed; + } + handleRequest(err, user, info) { + console.log('in handle request!'); + console.log({ handleRequest: info, err: err, user: user }); + return user; + } +}; +JwtAuthGuard = __decorate([ + (0, common_1.Injectable)(), + __metadata("design:paramtypes", [core_1.Reflector]) +], JwtAuthGuard); +exports.JwtAuthGuard = JwtAuthGuard; +//# sourceMappingURL=auth.guard.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/auth/auth.guard.js.map b/services/credential-schema/dist/src/auth/auth.guard.js.map new file mode 100644 index 000000000..fcaf153f8 --- /dev/null +++ b/services/credential-schema/dist/src/auth/auth.guard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../../../src/auth/auth.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA8D;AAC9D,+CAAyD;AACzD,uCAAyC;AAGlC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,IAAA,oBAAS,EAAC,KAAK,CAAC;IAChD,YAAoB,SAAoB;QACtC,KAAK,EAAE,CAAC;QADU,cAAS,GAAT,SAAS,CAAW;IAExC,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,OAAyB;QAChD,MAAM,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CACT,uCAAuC,EACvC,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CACrD,CAAC;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAW,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QAC1E,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,EAAE;YAEV,OAAO,IAAI,CAAC;SACb;QAED,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,MAAM,OAAO,GAAY,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QAC7D,IAAI;YACF,MAAM,UAAU,GAAa,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;YACtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBACxB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;oBACjC,SAAS,GAAG,IAAI,CAAC;oBACjB,MAAM;iBACP;aACF;YACD,IAAI,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE;gBACtC,SAAS,GAAG,IAAI,CAAC;aAClB;SACF;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;YAC5B,SAAS,GAAG,KAAK,CAAC;SACnB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI;QAC3B,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AA5CY,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAEoB,gBAAS;GAD7B,YAAY,CA4CxB;AA5CY,oCAAY"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/main.d.ts b/services/credential-schema/dist/src/main.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/services/credential-schema/dist/src/main.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/services/credential-schema/dist/src/main.js b/services/credential-schema/dist/src/main.js new file mode 100644 index 000000000..e0ad4d384 --- /dev/null +++ b/services/credential-schema/dist/src/main.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const common_1 = require("@nestjs/common"); +const core_1 = require("@nestjs/core"); +const platform_fastify_1 = require("@nestjs/platform-fastify"); +const swagger_1 = require("@nestjs/swagger"); +const app_module_1 = require("./app.module"); +async function bootstrap() { + const app = await core_1.NestFactory.create(app_module_1.AppModule, new platform_fastify_1.FastifyAdapter()); + const config = new swagger_1.DocumentBuilder() + .setTitle('Credential Schema API') + .setDescription('APIs for creating and managing Verifiable Credential Schemas') + .setVersion('1.0') + .addTag('VC-Schemas') + .build(); + const document = swagger_1.SwaggerModule.createDocument(app, config); + swagger_1.SwaggerModule.setup('api', app, document); + await app.listen(3000, '0.0.0.0'); + common_1.Logger.log('Listening at http://localhost:3000'); +} +bootstrap(); +//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/main.js.map b/services/credential-schema/dist/src/main.js.map new file mode 100644 index 000000000..9c526ebcb --- /dev/null +++ b/services/credential-schema/dist/src/main.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":";;AAAA,2CAAwC;AACxC,uCAA2C;AAC3C,+DAGkC;AAClC,6CAAiE;AACjE,6CAAyC;AAEzC,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAClC,sBAAS,EACT,IAAI,iCAAc,EAAE,CACrB,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,yBAAe,EAAE;SACjC,QAAQ,CAAC,uBAAuB,CAAC;SACjC,cAAc,CACb,8DAA8D,CAC/D;SACA,UAAU,CAAC,KAAK,CAAC;SACjB,MAAM,CAAC,YAAY,CAAC;SACpB,KAAK,EAAE,CAAC;IAEX,MAAM,QAAQ,GAAG,uBAAa,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3D,uBAAa,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAE1C,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAClC,eAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AACnD,CAAC;AACD,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/prisma.service.d.ts b/services/credential-schema/dist/src/prisma.service.d.ts new file mode 100644 index 000000000..dd914b78b --- /dev/null +++ b/services/credential-schema/dist/src/prisma.service.d.ts @@ -0,0 +1,6 @@ +import { INestApplication, OnModuleInit } from '@nestjs/common'; +import { PrismaClient } from '@prisma/client'; +export declare class PrismaService extends PrismaClient implements OnModuleInit { + onModuleInit(): Promise; + enableShutdownHooks(app: INestApplication): Promise; +} diff --git a/services/credential-schema/dist/src/prisma.service.js b/services/credential-schema/dist/src/prisma.service.js new file mode 100644 index 000000000..e190e84eb --- /dev/null +++ b/services/credential-schema/dist/src/prisma.service.js @@ -0,0 +1,26 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PrismaService = void 0; +const common_1 = require("@nestjs/common"); +const client_1 = require("@prisma/client"); +let PrismaService = class PrismaService extends client_1.PrismaClient { + async onModuleInit() { + await this.$connect(); + } + async enableShutdownHooks(app) { + this.$on('beforeExit', async () => { + await app.close(); + }); + } +}; +PrismaService = __decorate([ + (0, common_1.Injectable)() +], PrismaService); +exports.PrismaService = PrismaService; +//# sourceMappingURL=prisma.service.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/prisma.service.js.map b/services/credential-schema/dist/src/prisma.service.js.map new file mode 100644 index 000000000..16fffc0db --- /dev/null +++ b/services/credential-schema/dist/src/prisma.service.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prisma.service.js","sourceRoot":"","sources":["../../src/prisma.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4E;AAC5E,2CAA8C;AAGvC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qBAAY;IAC7C,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,GAAqB;QAC7C,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;YAChC,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAVY,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAUzB;AAVY,sCAAa"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.d.ts b/services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.d.ts new file mode 100644 index 000000000..26b7530ab --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.d.ts @@ -0,0 +1,5 @@ +export declare class AddTemplateDTO { + schema: string; + template: string; + type: string; +} diff --git a/services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.js b/services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.js new file mode 100644 index 000000000..3c37c7c11 --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AddTemplateDTO = void 0; +class AddTemplateDTO { +} +exports.AddTemplateDTO = AddTemplateDTO; +//# sourceMappingURL=addTemplate.dto.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.js.map b/services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.js.map new file mode 100644 index 000000000..b25b5ed05 --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/dto/addTemplate.dto.js.map @@ -0,0 +1 @@ +{"version":3,"file":"addTemplate.dto.js","sourceRoot":"","sources":["../../../../src/rendering-templates/dto/addTemplate.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;CAI1B;AAJD,wCAIC"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.d.ts b/services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.d.ts new file mode 100644 index 000000000..45a54897b --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.d.ts @@ -0,0 +1,5 @@ +export declare class UpdateTemplateDTO { + schema: string; + template: string; + type: string; +} diff --git a/services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.js b/services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.js new file mode 100644 index 000000000..9c46b9933 --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UpdateTemplateDTO = void 0; +class UpdateTemplateDTO { +} +exports.UpdateTemplateDTO = UpdateTemplateDTO; +//# sourceMappingURL=updateTemplate.dto.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.js.map b/services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.js.map new file mode 100644 index 000000000..290c71372 --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/dto/updateTemplate.dto.js.map @@ -0,0 +1 @@ +{"version":3,"file":"updateTemplate.dto.js","sourceRoot":"","sources":["../../../../src/rendering-templates/dto/updateTemplate.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,iBAAiB;CAI7B;AAJD,8CAIC"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.d.ts b/services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.d.ts new file mode 100644 index 000000000..7c146f81d --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.d.ts @@ -0,0 +1,4 @@ +export declare enum TEMPLATE_STATUS { + VALID = "VALID", + DELETED = "DELETED" +} diff --git a/services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.js b/services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.js new file mode 100644 index 000000000..42ee9edbc --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TEMPLATE_STATUS = void 0; +var TEMPLATE_STATUS; +(function (TEMPLATE_STATUS) { + TEMPLATE_STATUS["VALID"] = "VALID"; + TEMPLATE_STATUS["DELETED"] = "DELETED"; +})(TEMPLATE_STATUS = exports.TEMPLATE_STATUS || (exports.TEMPLATE_STATUS = {})); +//# sourceMappingURL=templateStatus.enum.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.js.map b/services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.js.map new file mode 100644 index 000000000..0cba6e941 --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/enums/templateStatus.enum.js.map @@ -0,0 +1 @@ +{"version":3,"file":"templateStatus.enum.js","sourceRoot":"","sources":["../../../../src/rendering-templates/enums/templateStatus.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAGX;AAHD,WAAY,eAAe;IACvB,kCAAe,CAAA;IACf,sCAAmB,CAAA;AACvB,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.d.ts b/services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.d.ts new file mode 100644 index 000000000..867e60311 --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.d.ts @@ -0,0 +1,44 @@ +import { AddTemplateDTO } from './dto/addTemplate.dto'; +import { UpdateTemplateDTO } from './dto/updateTemplate.dto'; +import { RenderingTemplatesService } from './rendering-templates.service'; +export declare class RenderingTemplatesController { + private readonly renderingTemplateService; + constructor(renderingTemplateService: RenderingTemplatesService); + getTemplateBySchemaID(schemaId: string): Promise<{ + template: string; + schemaId: string; + templateId: string; + createdBy: string; + updatedBy: string; + createdAt: string; + updatedAt: string; + }[]>; + getTemplateById(id: string): Promise<{ + template: string; + schemaId: string; + templateId: string; + createdBy: string; + updatedBy: string; + createdAt: string; + updatedAt: string; + }>; + addTemplate(addTemplateDto: AddTemplateDTO): Promise<{ + template: string; + schemaId: string; + templateId: string; + createdBy: string; + updatedBy: string; + createdAt: string; + updatedAt: string; + }>; + updateTemplate(id: string, updateTemplateDto: UpdateTemplateDTO): Promise<{ + template: string; + schemaId: string; + templateId: string; + createdBy: string; + updatedBy: string; + createdAt: string; + updatedAt: string; + }>; + deleteTemplate(id: string): string; +} diff --git a/services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.js b/services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.js new file mode 100644 index 000000000..280b41f47 --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.js @@ -0,0 +1,99 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RenderingTemplatesController = void 0; +const common_1 = require("@nestjs/common"); +const swagger_1 = require("@nestjs/swagger"); +const addTemplate_dto_1 = require("./dto/addTemplate.dto"); +const updateTemplate_dto_1 = require("./dto/updateTemplate.dto"); +const rendering_templates_service_1 = require("./rendering-templates.service"); +let RenderingTemplatesController = class RenderingTemplatesController { + constructor(renderingTemplateService) { + this.renderingTemplateService = renderingTemplateService; + } + getTemplateBySchemaID(schemaId) { + return this.renderingTemplateService.getTemplateBySchemaID(schemaId); + } + getTemplateById(id) { + return this.renderingTemplateService.getTemplateById(id); + } + addTemplate(addTemplateDto) { + return this.renderingTemplateService.addTemplate(addTemplateDto); + } + updateTemplate(id, updateTemplateDto) { + return this.renderingTemplateService.updateTemplate(id, updateTemplateDto); + } + deleteTemplate(id) { + if (this.renderingTemplateService.deleteTemplate(id)) { + return "Credential Schema successfully deleted!"; + } + ; + } +}; +__decorate([ + (0, common_1.Get)(), + (0, swagger_1.ApiOperation)({ summary: "GET Templates by schema ID" }), + (0, swagger_1.ApiOkResponse)({ status: 200 }), + __param(0, (0, common_1.Query)('schemaId')), + __metadata("design:type", Function), + __metadata("design:paramtypes", [String]), + __metadata("design:returntype", void 0) +], RenderingTemplatesController.prototype, "getTemplateBySchemaID", null); +__decorate([ + (0, common_1.Get)(':id'), + (0, swagger_1.ApiOperation)({ summary: "GET Template by TemplateID" }), + (0, swagger_1.ApiOkResponse)({ status: 200 }), + __param(0, (0, common_1.Param)('id')), + __metadata("design:type", Function), + __metadata("design:paramtypes", [String]), + __metadata("design:returntype", void 0) +], RenderingTemplatesController.prototype, "getTemplateById", null); +__decorate([ + (0, common_1.Post)(), + (0, swagger_1.ApiOperation)({ summary: "Add new Template" }), + (0, swagger_1.ApiOkResponse)({ + status: 201, + description: "Rendering template successfully created!" + }), + __param(0, (0, common_1.Body)()), + __metadata("design:type", Function), + __metadata("design:paramtypes", [addTemplate_dto_1.AddTemplateDTO]), + __metadata("design:returntype", void 0) +], RenderingTemplatesController.prototype, "addTemplate", null); +__decorate([ + (0, common_1.Put)(':id'), + (0, swagger_1.ApiOperation)({ summary: "Update Template" }), + (0, swagger_1.ApiOkResponse)({ + status: 200, + description: "rendering template updated successfully" + }), + __param(0, (0, common_1.Param)('id')), + __param(1, (0, common_1.Body)()), + __metadata("design:type", Function), + __metadata("design:paramtypes", [String, updateTemplate_dto_1.UpdateTemplateDTO]), + __metadata("design:returntype", void 0) +], RenderingTemplatesController.prototype, "updateTemplate", null); +__decorate([ + (0, common_1.Delete)(':id'), + __param(0, (0, common_1.Param)('id')), + __metadata("design:type", Function), + __metadata("design:paramtypes", [String]), + __metadata("design:returntype", void 0) +], RenderingTemplatesController.prototype, "deleteTemplate", null); +RenderingTemplatesController = __decorate([ + (0, common_1.Controller)('template'), + __metadata("design:paramtypes", [rendering_templates_service_1.RenderingTemplatesService]) +], RenderingTemplatesController); +exports.RenderingTemplatesController = RenderingTemplatesController; +//# sourceMappingURL=rendering-templates.controller.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.js.map b/services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.js.map new file mode 100644 index 000000000..c1e996ac2 --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/rendering-templates.controller.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rendering-templates.controller.js","sourceRoot":"","sources":["../../../src/rendering-templates/rendering-templates.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuG;AACvG,6CAA8D;AAC9D,2DAAuD;AACvD,iEAA6D;AAC7D,+EAA0E;AAGnE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YACmB,wBAAmD;QAAnD,6BAAwB,GAAxB,wBAAwB,CAA2B;IACnE,CAAC;IASJ,qBAAqB,CAAoB,QAAgB;QACvD,OAAO,IAAI,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACvE,CAAC;IASD,eAAe,CAAc,EAAU;QACrC,OAAO,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC3D,CAAC;IAYD,WAAW,CAAS,cAA8B;QAChD,OAAO,IAAI,CAAC,wBAAwB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACnE,CAAC;IAYD,cAAc,CAAc,EAAU,EAAU,iBAAoC;QAClF,OAAO,IAAI,CAAC,wBAAwB,CAAC,cAAc,CACjD,EAAE,EACF,iBAAiB,CAClB,CAAC;IACJ,CAAC;IAED,cAAc,CAAc,EAAS;QACnC,IAAG,IAAI,CAAC,wBAAwB,CAAC,cAAc,CAAC,EAAE,CAAC,EAAC;YAClD,OAAO,yCAAyC,CAAC;SAClD;QAAA,CAAC;IACJ,CAAC;CACF,CAAA;AA1DC;IAAC,IAAA,YAAG,GAAE;IACL,IAAA,sBAAY,EACX,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAC1C;IACA,IAAA,uBAAa,EACZ,EAAE,MAAM,EAAE,GAAG,EAAE,CAChB;IACsB,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;;;;yEAEvC;AAED;IAAC,IAAA,YAAG,EAAC,KAAK,CAAC;IACV,IAAA,sBAAY,EACX,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAC1C;IACA,IAAA,uBAAa,EACZ,EAAE,MAAM,EAAE,GAAG,EAAE,CAChB;IACgB,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;mEAE3B;AAED;IAAC,IAAA,aAAI,GAAE;IACN,IAAA,sBAAY,EACX,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAChC;IACA,IAAA,uBAAa,EACZ;QACE,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,0CAA0C;KACxD,CACF;IACY,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAiB,gCAAc;;+DAEjD;AAED;IAAC,IAAA,YAAG,EAAC,KAAK,CAAC;IACV,IAAA,sBAAY,EACX,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAC/B;IACA,IAAA,uBAAa,EACZ;QACE,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,yCAAyC;KACvD,CACF;IACe,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;IAAc,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAoB,sCAAiB;;kEAKnF;AACD;IAAC,IAAA,eAAM,EAAC,KAAK,CAAC;IACE,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;kEAI1B;AA9DU,4BAA4B;IADxC,IAAA,mBAAU,EAAC,UAAU,CAAC;qCAGwB,uDAAyB;GAF3D,4BAA4B,CA+DxC;AA/DY,oEAA4B"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/rendering-templates/rendering-templates.module.d.ts b/services/credential-schema/dist/src/rendering-templates/rendering-templates.module.d.ts new file mode 100644 index 000000000..6bb99a14b --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/rendering-templates.module.d.ts @@ -0,0 +1,2 @@ +export declare class RenderingTemplatesModule { +} diff --git a/services/credential-schema/dist/src/rendering-templates/rendering-templates.module.js b/services/credential-schema/dist/src/rendering-templates/rendering-templates.module.js new file mode 100644 index 000000000..89f51ef26 --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/rendering-templates.module.js @@ -0,0 +1,27 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RenderingTemplatesModule = void 0; +const common_1 = require("@nestjs/common"); +const rendering_templates_service_1 = require("./rendering-templates.service"); +const rendering_templates_controller_1 = require("./rendering-templates.controller"); +const prisma_service_1 = require("../prisma.service"); +const validate_template_service_1 = require("./validate-template.service"); +const schema_module_1 = require("../schema/schema.module"); +const schema_service_1 = require("../schema/schema.service"); +let RenderingTemplatesModule = class RenderingTemplatesModule { +}; +RenderingTemplatesModule = __decorate([ + (0, common_1.Module)({ + imports: [schema_module_1.SchemaModule], + providers: [rendering_templates_service_1.RenderingTemplatesService, prisma_service_1.PrismaService, validate_template_service_1.ValidateTemplateService, schema_service_1.SchemaService], + controllers: [rendering_templates_controller_1.RenderingTemplatesController], + }) +], RenderingTemplatesModule); +exports.RenderingTemplatesModule = RenderingTemplatesModule; +//# sourceMappingURL=rendering-templates.module.js.map \ No newline at end of file diff --git a/services/credential-schema/dist/src/rendering-templates/rendering-templates.module.js.map b/services/credential-schema/dist/src/rendering-templates/rendering-templates.module.js.map new file mode 100644 index 000000000..6ef30a805 --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/rendering-templates.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rendering-templates.module.js","sourceRoot":"","sources":["../../../src/rendering-templates/rendering-templates.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,+EAA0E;AAC1E,qFAAgF;AAChF,sDAAkD;AAClD,2EAAsE;AACtE,2DAAuD;AACvD,6DAAyD;AAQlD,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAAG,CAAA;AAA3B,wBAAwB;IANpC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,4BAAY,CAAC;QACvB,SAAS,EAAE,CAAC,uDAAyB,EAAE,8BAAa,EAAE,mDAAuB,EAAE,8BAAa,CAAC;QAC7F,WAAW,EAAE,CAAC,6DAA4B,CAAC;KAE5C,CAAC;GACW,wBAAwB,CAAG;AAA3B,4DAAwB"} \ No newline at end of file diff --git a/services/credential-schema/dist/src/rendering-templates/rendering-templates.service.d.ts b/services/credential-schema/dist/src/rendering-templates/rendering-templates.service.d.ts new file mode 100644 index 000000000..eedb89887 --- /dev/null +++ b/services/credential-schema/dist/src/rendering-templates/rendering-templates.service.d.ts @@ -0,0 +1,24 @@ +import { Template } from '@prisma/client'; +import { PrismaService } from '../prisma.service'; +import { AddTemplateDTO } from './dto/addTemplate.dto'; +import { ValidateTemplateService } from './validate-template.service'; +type templateResponse = { + template: string; + schemaId: string; + templateId: string; + createdBy: string; + updatedBy: string; + createdAt: string; + updatedAt: string; +}; +export declare class RenderingTemplatesService { + private prisma; + private readonly verifier; + constructor(prisma: PrismaService, verifier: ValidateTemplateService); + getTemplateBySchemaID(schemaID: string): Promise; + getTemplateById(id: string): Promise; + addTemplate(addTemplateDto: AddTemplateDTO): Promise; + updateTemplate(id: string, updateTemplateDto: AddTemplateDTO): Promise; + deleteTemplate(id: string): Promise