├── .editorconfig ├── .eslintignore ├── .eslintrc.json ├── .github ├── actions │ ├── affected-projects │ │ ├── action.yml │ │ ├── index.js │ │ ├── node_modules │ │ │ ├── .bin │ │ │ │ └── uuid │ │ │ ├── .package-lock.json │ │ │ ├── @actions │ │ │ │ ├── core │ │ │ │ │ ├── LICENSE.md │ │ │ │ │ ├── README.md │ │ │ │ │ ├── lib │ │ │ │ │ │ ├── command.d.ts │ │ │ │ │ │ ├── command.js │ │ │ │ │ │ ├── command.js.map │ │ │ │ │ │ ├── core.d.ts │ │ │ │ │ │ ├── core.js │ │ │ │ │ │ ├── core.js.map │ │ │ │ │ │ ├── file-command.d.ts │ │ │ │ │ │ ├── file-command.js │ │ │ │ │ │ ├── file-command.js.map │ │ │ │ │ │ ├── oidc-utils.d.ts │ │ │ │ │ │ ├── oidc-utils.js │ │ │ │ │ │ ├── oidc-utils.js.map │ │ │ │ │ │ ├── path-utils.d.ts │ │ │ │ │ │ ├── path-utils.js │ │ │ │ │ │ ├── path-utils.js.map │ │ │ │ │ │ ├── summary.d.ts │ │ │ │ │ │ ├── summary.js │ │ │ │ │ │ ├── summary.js.map │ │ │ │ │ │ ├── utils.d.ts │ │ │ │ │ │ ├── utils.js │ │ │ │ │ │ └── utils.js.map │ │ │ │ │ └── package.json │ │ │ │ └── http-client │ │ │ │ │ ├── LICENSE │ │ │ │ │ ├── README.md │ │ │ │ │ ├── lib │ │ │ │ │ ├── auth.d.ts │ │ │ │ │ ├── auth.js │ │ │ │ │ ├── auth.js.map │ │ │ │ │ ├── index.d.ts │ │ │ │ │ ├── index.js │ │ │ │ │ ├── index.js.map │ │ │ │ │ ├── interfaces.d.ts │ │ │ │ │ ├── interfaces.js │ │ │ │ │ ├── interfaces.js.map │ │ │ │ │ ├── proxy.d.ts │ │ │ │ │ ├── proxy.js │ │ │ │ │ └── proxy.js.map │ │ │ │ │ └── package.json │ │ │ ├── tunnel │ │ │ │ ├── .idea │ │ │ │ │ ├── encodings.xml │ │ │ │ │ ├── modules.xml │ │ │ │ │ ├── node-tunnel.iml │ │ │ │ │ ├── vcs.xml │ │ │ │ │ └── workspace.xml │ │ │ │ ├── .travis.yml │ │ │ │ ├── CHANGELOG.md │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── index.js │ │ │ │ ├── lib │ │ │ │ │ └── tunnel.js │ │ │ │ └── package.json │ │ │ └── uuid │ │ │ │ ├── CHANGELOG.md │ │ │ │ ├── CONTRIBUTING.md │ │ │ │ ├── LICENSE.md │ │ │ │ ├── README.md │ │ │ │ ├── dist │ │ │ │ ├── bin │ │ │ │ │ └── uuid │ │ │ │ ├── esm-browser │ │ │ │ │ ├── index.js │ │ │ │ │ ├── md5.js │ │ │ │ │ ├── nil.js │ │ │ │ │ ├── parse.js │ │ │ │ │ ├── regex.js │ │ │ │ │ ├── rng.js │ │ │ │ │ ├── sha1.js │ │ │ │ │ ├── stringify.js │ │ │ │ │ ├── v1.js │ │ │ │ │ ├── v3.js │ │ │ │ │ ├── v35.js │ │ │ │ │ ├── v4.js │ │ │ │ │ ├── v5.js │ │ │ │ │ ├── validate.js │ │ │ │ │ └── version.js │ │ │ │ ├── esm-node │ │ │ │ │ ├── index.js │ │ │ │ │ ├── md5.js │ │ │ │ │ ├── nil.js │ │ │ │ │ ├── parse.js │ │ │ │ │ ├── regex.js │ │ │ │ │ ├── rng.js │ │ │ │ │ ├── sha1.js │ │ │ │ │ ├── stringify.js │ │ │ │ │ ├── v1.js │ │ │ │ │ ├── v3.js │ │ │ │ │ ├── v35.js │ │ │ │ │ ├── v4.js │ │ │ │ │ ├── v5.js │ │ │ │ │ ├── validate.js │ │ │ │ │ └── version.js │ │ │ │ ├── index.js │ │ │ │ ├── md5-browser.js │ │ │ │ ├── md5.js │ │ │ │ ├── nil.js │ │ │ │ ├── parse.js │ │ │ │ ├── regex.js │ │ │ │ ├── rng-browser.js │ │ │ │ ├── rng.js │ │ │ │ ├── sha1-browser.js │ │ │ │ ├── sha1.js │ │ │ │ ├── stringify.js │ │ │ │ ├── umd │ │ │ │ │ ├── uuid.min.js │ │ │ │ │ ├── uuidNIL.min.js │ │ │ │ │ ├── uuidParse.min.js │ │ │ │ │ ├── uuidStringify.min.js │ │ │ │ │ ├── uuidValidate.min.js │ │ │ │ │ ├── uuidVersion.min.js │ │ │ │ │ ├── uuidv1.min.js │ │ │ │ │ ├── uuidv3.min.js │ │ │ │ │ ├── uuidv4.min.js │ │ │ │ │ └── uuidv5.min.js │ │ │ │ ├── uuid-bin.js │ │ │ │ ├── v1.js │ │ │ │ ├── v3.js │ │ │ │ ├── v35.js │ │ │ │ ├── v4.js │ │ │ │ ├── v5.js │ │ │ │ ├── validate.js │ │ │ │ └── version.js │ │ │ │ ├── package.json │ │ │ │ └── wrapper.mjs │ │ ├── package-lock.json │ │ └── package.json │ ├── deploy-api │ │ └── action.yml │ ├── docker-build │ │ └── action.yml │ ├── docker-prebuild │ │ └── action.yml │ └── install-dependencies │ │ └── action.yml └── workflows │ ├── check.yml │ └── publish.yml ├── .gitignore ├── .prettierignore ├── .prettierrc ├── .vscode ├── extensions.json └── settings.json ├── LICENSE ├── README.md ├── jest.config.ts ├── jest.preset.js ├── libs ├── local-deployment │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ │ ├── check-deployment-requirements.ts │ │ ├── deploy-ingress-controller.ts │ │ ├── deploy-services.ts │ │ ├── index.ts │ │ └── setup-cluster.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── nest-application │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.ts │ │ └── lib │ │ │ └── service.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── nest-config │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.ts │ │ └── lib │ │ │ ├── config.interfaces.ts │ │ │ ├── config.module.ts │ │ │ └── config.service.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── nest-health │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.ts │ │ └── lib │ │ │ ├── health.controller.ts │ │ │ └── health.module.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── nest-rabbitmq │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.ts │ │ └── lib │ │ │ ├── decorators │ │ │ ├── index.ts │ │ │ ├── interfaces.ts │ │ │ ├── rpc.ts │ │ │ └── subscribe.ts │ │ │ ├── event │ │ │ └── event.ts │ │ │ ├── rabbitmq-exchange.util.ts │ │ │ ├── rabbitmq.interfaces.ts │ │ │ ├── rabbitmq.module.ts │ │ │ └── rabbitmq.service.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── nest-redis │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.ts │ │ └── lib │ │ │ ├── connection │ │ │ └── connection.ts │ │ │ ├── redis.interfaces.ts │ │ │ ├── redis.module.ts │ │ │ └── redis.service.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── nest-typeorm-migrations │ ├── .eslintrc.json │ ├── README.md │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.ts │ │ └── lib │ │ │ ├── migration-generator.module.ts │ │ │ └── migration-generator.service.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── npx-build │ ├── .eslintrc.json │ ├── README.md │ ├── executors.json │ ├── generators.json │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ │ ├── executors │ │ │ └── build │ │ │ │ ├── executor.ts │ │ │ │ ├── schema.d.ts │ │ │ │ └── schema.json │ │ └── index.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json └── workspace │ ├── .eslintrc.json │ ├── README.md │ ├── executors.json │ ├── generators.json │ ├── jest.config.ts │ ├── package.json │ ├── project.json │ ├── src │ ├── generators │ │ ├── app-generator │ │ │ ├── files │ │ │ │ ├── application │ │ │ │ │ ├── deployment │ │ │ │ │ │ ├── Dockerfile.ci │ │ │ │ │ │ ├── Dockerfile.local │ │ │ │ │ │ └── deployment-values.yaml │ │ │ │ │ ├── env │ │ │ │ │ │ └── .env │ │ │ │ │ └── src │ │ │ │ │ │ ├── app.module.ts__tmpl__ │ │ │ │ │ │ ├── assets │ │ │ │ │ │ └── .gitkeep │ │ │ │ │ │ ├── main.ts__tmpl__ │ │ │ │ │ │ └── migrations.ts__tmpl__ │ │ │ │ ├── library-constants │ │ │ │ │ └── index.ts__tmpl__ │ │ │ │ ├── library-data-transfer-objects │ │ │ │ │ ├── index.ts__tmpl__ │ │ │ │ │ ├── lib │ │ │ │ │ │ ├── example.dto.ts__tmpl__ │ │ │ │ │ │ └── example.interfaces.ts__tmpl__ │ │ │ │ │ └── types.ts__tmpl__ │ │ │ │ └── library-service │ │ │ │ │ ├── index.ts__tmpl__ │ │ │ │ │ └── lib │ │ │ │ │ ├── __name__.controller.ts__tmpl__ │ │ │ │ │ ├── __name__.module.ts__tmpl__ │ │ │ │ │ └── __name__.service.ts__tmpl__ │ │ │ ├── generator.spec.ts │ │ │ ├── generator.ts │ │ │ ├── lib │ │ │ │ ├── add-migration-generation-target.ts │ │ │ │ ├── create-application-files.ts │ │ │ │ ├── create-constants-library-files.ts │ │ │ │ ├── create-dto-library-files.ts │ │ │ │ └── create-service-library-files.ts │ │ │ ├── schema.d.ts │ │ │ └── schema.json │ │ ├── app-library-generator │ │ │ ├── generator.spec.ts │ │ │ ├── generator.ts │ │ │ ├── schema.d.ts │ │ │ └── schema.json │ │ ├── configuration-generator │ │ │ ├── files │ │ │ │ ├── .github │ │ │ │ │ └── workflows │ │ │ │ │ │ ├── check.yaml │ │ │ │ │ │ └── deploy.yaml │ │ │ │ └── infrastructure │ │ │ │ │ ├── Dockerfile.prebuild │ │ │ │ │ ├── charts │ │ │ │ │ ├── ingress-controller │ │ │ │ │ │ ├── .helmignore │ │ │ │ │ │ ├── Chart.yaml │ │ │ │ │ │ ├── templates │ │ │ │ │ │ │ └── ingress-controller.yaml │ │ │ │ │ │ └── values.yaml │ │ │ │ │ └── node-service │ │ │ │ │ │ ├── .helmignore │ │ │ │ │ │ ├── Chart.yaml │ │ │ │ │ │ ├── templates │ │ │ │ │ │ └── deployment.yaml │ │ │ │ │ │ └── values.yaml │ │ │ │ │ ├── cloud │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── main.tf │ │ │ │ │ ├── modules │ │ │ │ │ │ ├── certificate_manager │ │ │ │ │ │ │ ├── main.tf │ │ │ │ │ │ │ ├── outputs.tf │ │ │ │ │ │ │ └── variables.tf │ │ │ │ │ │ ├── container_repository │ │ │ │ │ │ │ ├── main.tf │ │ │ │ │ │ │ ├── outputs.tf │ │ │ │ │ │ │ └── variables.tf │ │ │ │ │ │ ├── eks │ │ │ │ │ │ │ ├── main.tf │ │ │ │ │ │ │ ├── outputs.tf │ │ │ │ │ │ │ └── variables.tf │ │ │ │ │ │ ├── helm │ │ │ │ │ │ │ ├── main.tf │ │ │ │ │ │ │ └── variables.tf │ │ │ │ │ │ ├── iam │ │ │ │ │ │ │ ├── main.tf │ │ │ │ │ │ │ ├── outputs.tf │ │ │ │ │ │ │ └── variables.tf │ │ │ │ │ │ ├── rds │ │ │ │ │ │ │ ├── main.tf │ │ │ │ │ │ │ ├── outputs.tf │ │ │ │ │ │ │ └── variables.tf │ │ │ │ │ │ └── vpc │ │ │ │ │ │ │ ├── main.tf │ │ │ │ │ │ │ ├── outputs.tf │ │ │ │ │ │ │ └── variables.tf │ │ │ │ │ └── variables.tf │ │ │ │ │ ├── ingress-values.yaml │ │ │ │ │ └── local │ │ │ │ │ ├── Dockerfile.prebuild │ │ │ │ │ ├── postgresql-values.yml │ │ │ │ │ ├── rabbitmq-values.yml │ │ │ │ │ └── redis-values.yml │ │ │ ├── generator.spec.ts │ │ │ ├── generator.ts │ │ │ ├── lib │ │ │ │ └── create-deployment-files.ts │ │ │ └── schema.json │ │ ├── library-generator │ │ │ ├── files │ │ │ │ └── index.ts__tmpl__ │ │ │ ├── generator.spec.ts │ │ │ ├── generator.ts │ │ │ ├── lib │ │ │ │ └── create-files.ts │ │ │ └── schema.d.ts │ │ ├── migration-generator │ │ │ ├── files │ │ │ │ └── src │ │ │ │ │ └── migrations.ts.template │ │ │ ├── generator.ts │ │ │ ├── schema.d.ts │ │ │ └── schema.json │ │ └── util-library-generator │ │ │ ├── generator.spec.ts │ │ │ ├── generator.ts │ │ │ ├── schema.d.ts │ │ │ └── schema.json │ ├── index.ts │ └── utils │ │ ├── delete-files.ts │ │ └── package-versions.ts │ ├── tsconfig.json │ ├── tsconfig.lib.json │ └── tsconfig.spec.json ├── migrations.json ├── nx.json ├── package-lock.json ├── package.json ├── tools ├── scripts │ └── publish.mjs └── tsconfig.tools.json └── tsconfig.base.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "ignorePatterns": ["**/*"], 4 | "plugins": ["@nx"], 5 | "overrides": [ 6 | { 7 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 8 | "rules": { 9 | "@nx/enforce-module-boundaries": [ 10 | "error", 11 | { 12 | "enforceBuildableLibDependency": true, 13 | "allow": [], 14 | "depConstraints": [ 15 | { 16 | "sourceTag": "*", 17 | "onlyDependOnLibsWithTags": ["*"] 18 | } 19 | ] 20 | } 21 | ] 22 | } 23 | }, 24 | { 25 | "files": ["*.ts", "*.tsx"], 26 | "extends": ["plugin:@nx/typescript"], 27 | "rules": {} 28 | }, 29 | { 30 | "files": ["*.js", "*.jsx"], 31 | "extends": ["plugin:@nx/javascript"], 32 | "rules": {} 33 | }, 34 | { 35 | "files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"], 36 | "env": { 37 | "jest": true 38 | }, 39 | "rules": {} 40 | }, 41 | { 42 | "files": "*.json", 43 | "parser": "jsonc-eslint-parser", 44 | "rules": {} 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/action.yml: -------------------------------------------------------------------------------- 1 | name: microservice-stack-affected-projects 2 | description: 'Nx get affected project names' 3 | 4 | inputs: 5 | base: 6 | description: 'Base branch for affected:apps command' 7 | required: false 8 | 9 | outputs: 10 | isAffected: 11 | description: 'Indicates if any project is affected' 12 | affectedProjects: 13 | description: Affected projects matrix 14 | 15 | runs: 16 | using: 'node16' 17 | main: 'index.js' 18 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/index.js: -------------------------------------------------------------------------------- 1 | const { execSync } = require('child_process'); 2 | const core = require('@actions/core'); 3 | 4 | function getAffectedProjects() { 5 | const base = core.getInput('base'); 6 | const printAffectedCommand = `npx nx affected:apps ${ 7 | base ? `--base=${base}` : '' 8 | } --plain`; 9 | const affectedOutput = execSync(printAffectedCommand).toString().trim(); 10 | 11 | return affectedOutput ? affectedOutput.split(' ') : []; 12 | } 13 | 14 | const run = () => { 15 | const affectedProjects = getAffectedProjects().map((project) => 16 | project.replace('api-', '') 17 | ); 18 | 19 | core.setOutput('affectedProjects', affectedProjects); 20 | core.notice(`affectedProjects: ${affectedProjects}`); 21 | 22 | core.setOutput('isAffected', affectedProjects.length > 0); 23 | core.notice(`isAffected: ${affectedProjects.length > 0}`); 24 | }; 25 | 26 | run(); 27 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/.bin/uuid: -------------------------------------------------------------------------------- 1 | ../uuid/dist/bin/uuid -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/.package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "affected-projects", 3 | "version": "1.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "node_modules/@actions/core": { 8 | "version": "1.10.0", 9 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", 10 | "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", 11 | "dependencies": { 12 | "@actions/http-client": "^2.0.1", 13 | "uuid": "^8.3.2" 14 | } 15 | }, 16 | "node_modules/@actions/http-client": { 17 | "version": "2.0.1", 18 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", 19 | "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", 20 | "dependencies": { 21 | "tunnel": "^0.0.6" 22 | } 23 | }, 24 | "node_modules/tunnel": { 25 | "version": "0.0.6", 26 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 27 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", 28 | "engines": { 29 | "node": ">=0.6.11 <=0.7.0 || >=0.7.3" 30 | } 31 | }, 32 | "node_modules/uuid": { 33 | "version": "8.3.2", 34 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", 35 | "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", 36 | "bin": { 37 | "uuid": "dist/bin/uuid" 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright 2019 GitHub 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/lib/command.d.ts: -------------------------------------------------------------------------------- 1 | export interface CommandProperties { 2 | [key: string]: any; 3 | } 4 | /** 5 | * Commands 6 | * 7 | * Command Format: 8 | * ::name key=value,key=value::message 9 | * 10 | * Examples: 11 | * ::warning::This is the message 12 | * ::set-env name=MY_VAR::some value 13 | */ 14 | export declare function issueCommand(command: string, properties: CommandProperties, message: any): void; 15 | export declare function issue(name: string, message?: string): void; 16 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/lib/command.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,mCAAsC;AAWtC;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,OAAO,GAAG,EAAE;IAC9C,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"} -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/lib/file-command.d.ts: -------------------------------------------------------------------------------- 1 | export declare function issueFileCommand(command: string, message: any): void; 2 | export declare function prepareKeyValueMessage(key: string, value: any): string; 3 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/lib/file-command.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;;;;;;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,+BAAiC;AACjC,mCAAsC;AAEtC,SAAgB,gBAAgB,CAAC,OAAe,EAAE,OAAY;IAC5D,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,4CAcC;AAED,SAAgB,sBAAsB,CAAC,GAAW,EAAE,KAAU;IAC5D,MAAM,SAAS,GAAG,gBAAgB,SAAM,EAAE,EAAE,CAAA;IAC5C,MAAM,cAAc,GAAG,sBAAc,CAAC,KAAK,CAAC,CAAA;IAE5C,4EAA4E;IAC5E,6EAA6E;IAC7E,iBAAiB;IACjB,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CACb,4DAA4D,SAAS,GAAG,CACzE,CAAA;KACF;IAED,IAAI,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;QACtC,MAAM,IAAI,KAAK,CACb,6DAA6D,SAAS,GAAG,CAC1E,CAAA;KACF;IAED,OAAO,GAAG,GAAG,KAAK,SAAS,GAAG,EAAE,CAAC,GAAG,GAAG,cAAc,GAAG,EAAE,CAAC,GAAG,GAAG,SAAS,EAAE,CAAA;AAC9E,CAAC;AApBD,wDAoBC"} -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/lib/oidc-utils.d.ts: -------------------------------------------------------------------------------- 1 | export declare class OidcClient { 2 | private static createHttpClient; 3 | private static getRequestToken; 4 | private static getIDTokenUrl; 5 | private static getCall; 6 | static getIDToken(audience?: string): Promise; 7 | } 8 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/lib/oidc-utils.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"oidc-utils.js","sourceRoot":"","sources":["../src/oidc-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,sDAA+C;AAC/C,wDAAqE;AACrE,iCAAuC;AAKvC,MAAa,UAAU;IACb,MAAM,CAAC,gBAAgB,CAC7B,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,EAAE;QAEb,MAAM,cAAc,GAAmB;YACrC,YAAY,EAAE,UAAU;YACxB,UAAU,EAAE,QAAQ;SACrB,CAAA;QAED,OAAO,IAAI,wBAAU,CACnB,qBAAqB,EACrB,CAAC,IAAI,8BAAuB,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,CAAC,EAC3D,cAAc,CACf,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,eAAe;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;QAC3D,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAA;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAEO,MAAM,CAAC,aAAa;QAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;QAC9D,IAAI,CAAC,UAAU,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;SAC3E;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;IAEO,MAAM,CAAO,OAAO,CAAC,YAAoB;;;YAC/C,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;YAEhD,MAAM,GAAG,GAAG,MAAM,UAAU;iBACzB,OAAO,CAAgB,YAAY,CAAC;iBACpC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACb,MAAM,IAAI,KAAK,CACb;uBACa,KAAK,CAAC,UAAU;yBACd,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CACtC,CAAA;YACH,CAAC,CAAC,CAAA;YAEJ,MAAM,QAAQ,SAAG,GAAG,CAAC,MAAM,0CAAE,KAAK,CAAA;YAClC,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;aACjE;YACD,OAAO,QAAQ,CAAA;;KAChB;IAED,MAAM,CAAO,UAAU,CAAC,QAAiB;;YACvC,IAAI;gBACF,gDAAgD;gBAChD,IAAI,YAAY,GAAW,UAAU,CAAC,aAAa,EAAE,CAAA;gBACrD,IAAI,QAAQ,EAAE;oBACZ,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;oBACpD,YAAY,GAAG,GAAG,YAAY,aAAa,eAAe,EAAE,CAAA;iBAC7D;gBAED,YAAK,CAAC,mBAAmB,YAAY,EAAE,CAAC,CAAA;gBAExC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBACvD,gBAAS,CAAC,QAAQ,CAAC,CAAA;gBACnB,OAAO,QAAQ,CAAA;aAChB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;aACnD;QACH,CAAC;KAAA;CACF;AAzED,gCAyEC"} -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/lib/path-utils.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * toPosixPath converts the given path to the posix form. On Windows, \\ will be 3 | * replaced with /. 4 | * 5 | * @param pth. Path to transform. 6 | * @return string Posix path. 7 | */ 8 | export declare function toPosixPath(pth: string): string; 9 | /** 10 | * toWin32Path converts the given path to the win32 form. On Linux, / will be 11 | * replaced with \\. 12 | * 13 | * @param pth. Path to transform. 14 | * @return string Win32 path. 15 | */ 16 | export declare function toWin32Path(pth: string): string; 17 | /** 18 | * toPlatformPath converts the given path to a platform-specific path. It does 19 | * this by replacing instances of / and \ with the platform-specific path 20 | * separator. 21 | * 22 | * @param pth The path to platformize. 23 | * @return string The platform-specific path. 24 | */ 25 | export declare function toPlatformPath(pth: string): string; 26 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/lib/path-utils.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../src/path-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAE5B;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;AAClC,CAAC;AAFD,kCAEC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAClC,CAAC;AAFD,kCAEC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,wCAEC"} -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/lib/utils.d.ts: -------------------------------------------------------------------------------- 1 | import { AnnotationProperties } from './core'; 2 | import { CommandProperties } from './command'; 3 | /** 4 | * Sanitizes an input into a string so it can be passed into issueCommand safely 5 | * @param input input to sanitize into a string 6 | */ 7 | export declare function toCommandValue(input: any): string; 8 | /** 9 | * 10 | * @param annotationProperties 11 | * @returns The command properties to send with the actual annotation command 12 | * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 13 | */ 14 | export declare function toCommandProperties(annotationProperties: AnnotationProperties): CommandProperties; 15 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/lib/utils.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | // We use any as a valid input type 3 | /* eslint-disable @typescript-eslint/no-explicit-any */ 4 | Object.defineProperty(exports, "__esModule", { value: true }); 5 | exports.toCommandProperties = exports.toCommandValue = void 0; 6 | /** 7 | * Sanitizes an input into a string so it can be passed into issueCommand safely 8 | * @param input input to sanitize into a string 9 | */ 10 | function toCommandValue(input) { 11 | if (input === null || input === undefined) { 12 | return ''; 13 | } 14 | else if (typeof input === 'string' || input instanceof String) { 15 | return input; 16 | } 17 | return JSON.stringify(input); 18 | } 19 | exports.toCommandValue = toCommandValue; 20 | /** 21 | * 22 | * @param annotationProperties 23 | * @returns The command properties to send with the actual annotation command 24 | * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646 25 | */ 26 | function toCommandProperties(annotationProperties) { 27 | if (!Object.keys(annotationProperties).length) { 28 | return {}; 29 | } 30 | return { 31 | title: annotationProperties.title, 32 | file: annotationProperties.file, 33 | line: annotationProperties.startLine, 34 | endLine: annotationProperties.endLine, 35 | col: annotationProperties.startColumn, 36 | endColumn: annotationProperties.endColumn 37 | }; 38 | } 39 | exports.toCommandProperties = toCommandProperties; 40 | //# sourceMappingURL=utils.js.map -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/lib/utils.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;;AAKvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,oBAA0C;IAE1C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,EAAE;QAC7C,OAAO,EAAE,CAAA;KACV;IAED,OAAO;QACL,KAAK,EAAE,oBAAoB,CAAC,KAAK;QACjC,IAAI,EAAE,oBAAoB,CAAC,IAAI;QAC/B,IAAI,EAAE,oBAAoB,CAAC,SAAS;QACpC,OAAO,EAAE,oBAAoB,CAAC,OAAO;QACrC,GAAG,EAAE,oBAAoB,CAAC,WAAW;QACrC,SAAS,EAAE,oBAAoB,CAAC,SAAS;KAC1C,CAAA;AACH,CAAC;AAfD,kDAeC"} -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@actions/core", 3 | "version": "1.10.0", 4 | "description": "Actions core lib", 5 | "keywords": [ 6 | "github", 7 | "actions", 8 | "core" 9 | ], 10 | "homepage": "https://github.com/actions/toolkit/tree/main/packages/core", 11 | "license": "MIT", 12 | "main": "lib/core.js", 13 | "types": "lib/core.d.ts", 14 | "directories": { 15 | "lib": "lib", 16 | "test": "__tests__" 17 | }, 18 | "files": [ 19 | "lib", 20 | "!.DS_Store" 21 | ], 22 | "publishConfig": { 23 | "access": "public" 24 | }, 25 | "repository": { 26 | "type": "git", 27 | "url": "git+https://github.com/actions/toolkit.git", 28 | "directory": "packages/core" 29 | }, 30 | "scripts": { 31 | "audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json", 32 | "test": "echo \"Error: run tests from root\" && exit 1", 33 | "tsc": "tsc" 34 | }, 35 | "bugs": { 36 | "url": "https://github.com/actions/toolkit/issues" 37 | }, 38 | "dependencies": { 39 | "@actions/http-client": "^2.0.1", 40 | "uuid": "^8.3.2" 41 | }, 42 | "devDependencies": { 43 | "@types/node": "^12.0.2", 44 | "@types/uuid": "^8.3.4" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/http-client/LICENSE: -------------------------------------------------------------------------------- 1 | Actions Http Client for Node.js 2 | 3 | Copyright (c) GitHub, Inc. 4 | 5 | All rights reserved. 6 | 7 | MIT License 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 10 | associated documentation files (the "Software"), to deal in the Software without restriction, 11 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 18 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 19 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/http-client/lib/auth.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import * as http from 'http'; 3 | import * as ifm from './interfaces'; 4 | import { HttpClientResponse } from './index'; 5 | export declare class BasicCredentialHandler implements ifm.RequestHandler { 6 | username: string; 7 | password: string; 8 | constructor(username: string, password: string); 9 | prepareRequest(options: http.RequestOptions): void; 10 | canHandleAuthentication(): boolean; 11 | handleAuthentication(): Promise; 12 | } 13 | export declare class BearerCredentialHandler implements ifm.RequestHandler { 14 | token: string; 15 | constructor(token: string); 16 | prepareRequest(options: http.RequestOptions): void; 17 | canHandleAuthentication(): boolean; 18 | handleAuthentication(): Promise; 19 | } 20 | export declare class PersonalAccessTokenCredentialHandler implements ifm.RequestHandler { 21 | token: string; 22 | constructor(token: string); 23 | prepareRequest(options: http.RequestOptions): void; 24 | canHandleAuthentication(): boolean; 25 | handleAuthentication(): Promise; 26 | } 27 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/http-client/lib/auth.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,MAAa,sBAAsB;IAIjC,YAAY,QAAgB,EAAE,QAAgB;QAC5C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CACpC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA1BD,wDA0BC;AAED,MAAa,uBAAuB;IAGlC,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,IAAI,CAAC,KAAK,EAAE,CAAA;IAC3D,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AAxBD,0DAwBC;AAED,MAAa,oCAAoC;IAI/C,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,yCAAyC;IACzC,sDAAsD;IACtD,cAAc,CAAC,OAA4B;QACzC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YACpB,MAAM,KAAK,CAAC,4BAA4B,CAAC,CAAA;SAC1C;QACD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,MAAM,CAAC,IAAI,CACrD,OAAO,IAAI,CAAC,KAAK,EAAE,CACpB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,iCAAiC;IACjC,uBAAuB;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAEK,oBAAoB;;YACxB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAA;QACpC,CAAC;KAAA;CACF;AA3BD,oFA2BC"} -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/http-client/lib/interfaces.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=interfaces.js.map -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/http-client/lib/interfaces.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/http-client/lib/proxy.d.ts: -------------------------------------------------------------------------------- 1 | export declare function getProxyUrl(reqUrl: URL): URL | undefined; 2 | export declare function checkBypass(reqUrl: URL): boolean; 3 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/http-client/lib/proxy.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.checkBypass = exports.getProxyUrl = void 0; 4 | function getProxyUrl(reqUrl) { 5 | const usingSsl = reqUrl.protocol === 'https:'; 6 | if (checkBypass(reqUrl)) { 7 | return undefined; 8 | } 9 | const proxyVar = (() => { 10 | if (usingSsl) { 11 | return process.env['https_proxy'] || process.env['HTTPS_PROXY']; 12 | } 13 | else { 14 | return process.env['http_proxy'] || process.env['HTTP_PROXY']; 15 | } 16 | })(); 17 | if (proxyVar) { 18 | return new URL(proxyVar); 19 | } 20 | else { 21 | return undefined; 22 | } 23 | } 24 | exports.getProxyUrl = getProxyUrl; 25 | function checkBypass(reqUrl) { 26 | if (!reqUrl.hostname) { 27 | return false; 28 | } 29 | const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || ''; 30 | if (!noProxy) { 31 | return false; 32 | } 33 | // Determine the request port 34 | let reqPort; 35 | if (reqUrl.port) { 36 | reqPort = Number(reqUrl.port); 37 | } 38 | else if (reqUrl.protocol === 'http:') { 39 | reqPort = 80; 40 | } 41 | else if (reqUrl.protocol === 'https:') { 42 | reqPort = 443; 43 | } 44 | // Format the request hostname and hostname with port 45 | const upperReqHosts = [reqUrl.hostname.toUpperCase()]; 46 | if (typeof reqPort === 'number') { 47 | upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`); 48 | } 49 | // Compare request host against noproxy 50 | for (const upperNoProxyItem of noProxy 51 | .split(',') 52 | .map(x => x.trim().toUpperCase()) 53 | .filter(x => x)) { 54 | if (upperReqHosts.some(x => x === upperNoProxyItem)) { 55 | return true; 56 | } 57 | } 58 | return false; 59 | } 60 | exports.checkBypass = checkBypass; 61 | //# sourceMappingURL=proxy.js.map -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/http-client/lib/proxy.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,MAAW;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAA;IAE7C,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACvB,OAAO,SAAS,CAAA;KACjB;IAED,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE;QACrB,IAAI,QAAQ,EAAE;YACZ,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;SAChE;aAAM;YACL,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;SAC9D;IACH,CAAC,CAAC,EAAE,CAAA;IAEJ,IAAI,QAAQ,EAAE;QACZ,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAA;KACzB;SAAM;QACL,OAAO,SAAS,CAAA;KACjB;AACH,CAAC;AApBD,kCAoBC;AAED,SAAgB,WAAW,CAAC,MAAW;IACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACpB,OAAO,KAAK,CAAA;KACb;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAA;IACxE,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;IAED,6BAA6B;IAC7B,IAAI,OAA2B,CAAA;IAC/B,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;KAC9B;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,EAAE;QACtC,OAAO,GAAG,EAAE,CAAA;KACb;SAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE;QACvC,OAAO,GAAG,GAAG,CAAA;KACd;IAED,qDAAqD;IACrD,MAAM,aAAa,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAA;IACrD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC,CAAA;KACrD;IAED,uCAAuC;IACvC,KAAK,MAAM,gBAAgB,IAAI,OAAO;SACnC,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;SAChC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;QACjB,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,gBAAgB,CAAC,EAAE;YACnD,OAAO,IAAI,CAAA;SACZ;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AArCD,kCAqCC"} -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/@actions/http-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@actions/http-client", 3 | "version": "2.0.1", 4 | "description": "Actions Http Client", 5 | "keywords": [ 6 | "github", 7 | "actions", 8 | "http" 9 | ], 10 | "homepage": "https://github.com/actions/toolkit/tree/main/packages/http-client", 11 | "license": "MIT", 12 | "main": "lib/index.js", 13 | "types": "lib/index.d.ts", 14 | "directories": { 15 | "lib": "lib", 16 | "test": "__tests__" 17 | }, 18 | "files": [ 19 | "lib", 20 | "!.DS_Store" 21 | ], 22 | "publishConfig": { 23 | "access": "public" 24 | }, 25 | "repository": { 26 | "type": "git", 27 | "url": "git+https://github.com/actions/toolkit.git", 28 | "directory": "packages/http-client" 29 | }, 30 | "scripts": { 31 | "audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json", 32 | "test": "echo \"Error: run tests from root\" && exit 1", 33 | "build": "tsc", 34 | "format": "prettier --write **/*.ts", 35 | "format-check": "prettier --check **/*.ts", 36 | "tsc": "tsc" 37 | }, 38 | "bugs": { 39 | "url": "https://github.com/actions/toolkit/issues" 40 | }, 41 | "devDependencies": { 42 | "@types/tunnel": "0.0.3", 43 | "proxy": "^1.0.1" 44 | }, 45 | "dependencies": { 46 | "tunnel": "^0.0.6" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/tunnel/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/tunnel/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/tunnel/.idea/node-tunnel.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/tunnel/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/tunnel/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "4" 4 | - "6" 5 | - "8" 6 | - "10" 7 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/tunnel/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | - 0.0.6 (2018/09/11) 4 | - Fix `localAddress` not working (#25) 5 | - Fix `Host:` header for CONNECT method by @tmurakam (#29, #30) 6 | - Fix default port for https (#32) 7 | - Fix error handling when the proxy send illegal response body (#33) 8 | 9 | - 0.0.5 (2017/06/12) 10 | - Fix socket leak. 11 | 12 | - 0.0.4 (2016/01/23) 13 | - supported Node v0.12 or later. 14 | 15 | - 0.0.3 (2014/01/20) 16 | - fixed package.json 17 | 18 | - 0.0.1 (2012/02/18) 19 | - supported Node v0.6.x (0.6.11 or later). 20 | 21 | - 0.0.0 (2012/02/11) 22 | - first release. 23 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/tunnel/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012 Koichi Kobayashi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/tunnel/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/tunnel'); 2 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/tunnel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tunnel", 3 | "version": "0.0.6", 4 | "description": "Node HTTP/HTTPS Agents for tunneling proxies", 5 | "keywords": [ 6 | "http", 7 | "https", 8 | "agent", 9 | "proxy", 10 | "tunnel" 11 | ], 12 | "homepage": "https://github.com/koichik/node-tunnel/", 13 | "bugs": "https://github.com/koichik/node-tunnel/issues", 14 | "license": "MIT", 15 | "author": "Koichi Kobayashi ", 16 | "main": "./index.js", 17 | "directories": { 18 | "lib": "./lib" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "https://github.com/koichik/node-tunnel.git" 23 | }, 24 | "scripts": { 25 | "test": "mocha" 26 | }, 27 | "devDependencies": { 28 | "mocha": "^5.2.0", 29 | "should": "^13.2.3" 30 | }, 31 | "engines": { 32 | "node": ">=0.6.11 <=0.7.0 || >=0.7.3" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Please feel free to file GitHub Issues or propose Pull Requests. We're always happy to discuss improvements to this library! 4 | 5 | ## Testing 6 | 7 | ```shell 8 | npm test 9 | ``` 10 | 11 | ## Releasing 12 | 13 | Releases are supposed to be done from master, version bumping is automated through [`standard-version`](https://github.com/conventional-changelog/standard-version): 14 | 15 | ```shell 16 | npm run release -- --dry-run # verify output manually 17 | npm run release # follow the instructions from the output of this command 18 | ``` 19 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2010-2020 Robert Kieffer and other contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/bin/uuid: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../uuid-bin'); 3 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/index.js: -------------------------------------------------------------------------------- 1 | export { default as v1 } from './v1.js'; 2 | export { default as v3 } from './v3.js'; 3 | export { default as v4 } from './v4.js'; 4 | export { default as v5 } from './v5.js'; 5 | export { default as NIL } from './nil.js'; 6 | export { default as version } from './version.js'; 7 | export { default as validate } from './validate.js'; 8 | export { default as stringify } from './stringify.js'; 9 | export { default as parse } from './parse.js'; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/nil.js: -------------------------------------------------------------------------------- 1 | export default '00000000-0000-0000-0000-000000000000'; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/parse.js: -------------------------------------------------------------------------------- 1 | import validate from './validate.js'; 2 | 3 | function parse(uuid) { 4 | if (!validate(uuid)) { 5 | throw TypeError('Invalid UUID'); 6 | } 7 | 8 | var v; 9 | var arr = new Uint8Array(16); // Parse ########-....-....-....-............ 10 | 11 | arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; 12 | arr[1] = v >>> 16 & 0xff; 13 | arr[2] = v >>> 8 & 0xff; 14 | arr[3] = v & 0xff; // Parse ........-####-....-....-............ 15 | 16 | arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; 17 | arr[5] = v & 0xff; // Parse ........-....-####-....-............ 18 | 19 | arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; 20 | arr[7] = v & 0xff; // Parse ........-....-....-####-............ 21 | 22 | arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; 23 | arr[9] = v & 0xff; // Parse ........-....-....-....-############ 24 | // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) 25 | 26 | arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; 27 | arr[11] = v / 0x100000000 & 0xff; 28 | arr[12] = v >>> 24 & 0xff; 29 | arr[13] = v >>> 16 & 0xff; 30 | arr[14] = v >>> 8 & 0xff; 31 | arr[15] = v & 0xff; 32 | return arr; 33 | } 34 | 35 | export default parse; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/regex.js: -------------------------------------------------------------------------------- 1 | export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/rng.js: -------------------------------------------------------------------------------- 1 | // Unique ID creation requires a high quality random # generator. In the browser we therefore 2 | // require the crypto API and do not support built-in fallback to lower quality random number 3 | // generators (like Math.random()). 4 | var getRandomValues; 5 | var rnds8 = new Uint8Array(16); 6 | export default function rng() { 7 | // lazy load so that environments that need to polyfill have a chance to do so 8 | if (!getRandomValues) { 9 | // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, 10 | // find the complete implementation of crypto (msCrypto) on IE11. 11 | getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto); 12 | 13 | if (!getRandomValues) { 14 | throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); 15 | } 16 | } 17 | 18 | return getRandomValues(rnds8); 19 | } -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/stringify.js: -------------------------------------------------------------------------------- 1 | import validate from './validate.js'; 2 | /** 3 | * Convert array of 16 byte values to UUID string format of the form: 4 | * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 5 | */ 6 | 7 | var byteToHex = []; 8 | 9 | for (var i = 0; i < 256; ++i) { 10 | byteToHex.push((i + 0x100).toString(16).substr(1)); 11 | } 12 | 13 | function stringify(arr) { 14 | var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 15 | // Note: Be careful editing this code! It's been tuned for performance 16 | // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 17 | var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one 18 | // of the following: 19 | // - One or more input array values don't map to a hex octet (leading to 20 | // "undefined" in the uuid) 21 | // - Invalid input values for the RFC `version` or `variant` fields 22 | 23 | if (!validate(uuid)) { 24 | throw TypeError('Stringified UUID is invalid'); 25 | } 26 | 27 | return uuid; 28 | } 29 | 30 | export default stringify; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/v3.js: -------------------------------------------------------------------------------- 1 | import v35 from './v35.js'; 2 | import md5 from './md5.js'; 3 | var v3 = v35('v3', 0x30, md5); 4 | export default v3; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/v35.js: -------------------------------------------------------------------------------- 1 | import stringify from './stringify.js'; 2 | import parse from './parse.js'; 3 | 4 | function stringToBytes(str) { 5 | str = unescape(encodeURIComponent(str)); // UTF8 escape 6 | 7 | var bytes = []; 8 | 9 | for (var i = 0; i < str.length; ++i) { 10 | bytes.push(str.charCodeAt(i)); 11 | } 12 | 13 | return bytes; 14 | } 15 | 16 | export var DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; 17 | export var URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; 18 | export default function (name, version, hashfunc) { 19 | function generateUUID(value, namespace, buf, offset) { 20 | if (typeof value === 'string') { 21 | value = stringToBytes(value); 22 | } 23 | 24 | if (typeof namespace === 'string') { 25 | namespace = parse(namespace); 26 | } 27 | 28 | if (namespace.length !== 16) { 29 | throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); 30 | } // Compute hash of namespace and value, Per 4.3 31 | // Future: Use spread syntax when supported on all platforms, e.g. `bytes = 32 | // hashfunc([...namespace, ... value])` 33 | 34 | 35 | var bytes = new Uint8Array(16 + value.length); 36 | bytes.set(namespace); 37 | bytes.set(value, namespace.length); 38 | bytes = hashfunc(bytes); 39 | bytes[6] = bytes[6] & 0x0f | version; 40 | bytes[8] = bytes[8] & 0x3f | 0x80; 41 | 42 | if (buf) { 43 | offset = offset || 0; 44 | 45 | for (var i = 0; i < 16; ++i) { 46 | buf[offset + i] = bytes[i]; 47 | } 48 | 49 | return buf; 50 | } 51 | 52 | return stringify(bytes); 53 | } // Function#name is not settable on some platforms (#270) 54 | 55 | 56 | try { 57 | generateUUID.name = name; // eslint-disable-next-line no-empty 58 | } catch (err) {} // For CommonJS default export support 59 | 60 | 61 | generateUUID.DNS = DNS; 62 | generateUUID.URL = URL; 63 | return generateUUID; 64 | } -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/v4.js: -------------------------------------------------------------------------------- 1 | import rng from './rng.js'; 2 | import stringify from './stringify.js'; 3 | 4 | function v4(options, buf, offset) { 5 | options = options || {}; 6 | var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` 7 | 8 | rnds[6] = rnds[6] & 0x0f | 0x40; 9 | rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided 10 | 11 | if (buf) { 12 | offset = offset || 0; 13 | 14 | for (var i = 0; i < 16; ++i) { 15 | buf[offset + i] = rnds[i]; 16 | } 17 | 18 | return buf; 19 | } 20 | 21 | return stringify(rnds); 22 | } 23 | 24 | export default v4; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/v5.js: -------------------------------------------------------------------------------- 1 | import v35 from './v35.js'; 2 | import sha1 from './sha1.js'; 3 | var v5 = v35('v5', 0x50, sha1); 4 | export default v5; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/validate.js: -------------------------------------------------------------------------------- 1 | import REGEX from './regex.js'; 2 | 3 | function validate(uuid) { 4 | return typeof uuid === 'string' && REGEX.test(uuid); 5 | } 6 | 7 | export default validate; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-browser/version.js: -------------------------------------------------------------------------------- 1 | import validate from './validate.js'; 2 | 3 | function version(uuid) { 4 | if (!validate(uuid)) { 5 | throw TypeError('Invalid UUID'); 6 | } 7 | 8 | return parseInt(uuid.substr(14, 1), 16); 9 | } 10 | 11 | export default version; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/index.js: -------------------------------------------------------------------------------- 1 | export { default as v1 } from './v1.js'; 2 | export { default as v3 } from './v3.js'; 3 | export { default as v4 } from './v4.js'; 4 | export { default as v5 } from './v5.js'; 5 | export { default as NIL } from './nil.js'; 6 | export { default as version } from './version.js'; 7 | export { default as validate } from './validate.js'; 8 | export { default as stringify } from './stringify.js'; 9 | export { default as parse } from './parse.js'; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/md5.js: -------------------------------------------------------------------------------- 1 | import crypto from 'crypto'; 2 | 3 | function md5(bytes) { 4 | if (Array.isArray(bytes)) { 5 | bytes = Buffer.from(bytes); 6 | } else if (typeof bytes === 'string') { 7 | bytes = Buffer.from(bytes, 'utf8'); 8 | } 9 | 10 | return crypto.createHash('md5').update(bytes).digest(); 11 | } 12 | 13 | export default md5; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/nil.js: -------------------------------------------------------------------------------- 1 | export default '00000000-0000-0000-0000-000000000000'; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/parse.js: -------------------------------------------------------------------------------- 1 | import validate from './validate.js'; 2 | 3 | function parse(uuid) { 4 | if (!validate(uuid)) { 5 | throw TypeError('Invalid UUID'); 6 | } 7 | 8 | let v; 9 | const arr = new Uint8Array(16); // Parse ########-....-....-....-............ 10 | 11 | arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; 12 | arr[1] = v >>> 16 & 0xff; 13 | arr[2] = v >>> 8 & 0xff; 14 | arr[3] = v & 0xff; // Parse ........-####-....-....-............ 15 | 16 | arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; 17 | arr[5] = v & 0xff; // Parse ........-....-####-....-............ 18 | 19 | arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; 20 | arr[7] = v & 0xff; // Parse ........-....-....-####-............ 21 | 22 | arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; 23 | arr[9] = v & 0xff; // Parse ........-....-....-....-############ 24 | // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) 25 | 26 | arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; 27 | arr[11] = v / 0x100000000 & 0xff; 28 | arr[12] = v >>> 24 & 0xff; 29 | arr[13] = v >>> 16 & 0xff; 30 | arr[14] = v >>> 8 & 0xff; 31 | arr[15] = v & 0xff; 32 | return arr; 33 | } 34 | 35 | export default parse; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/regex.js: -------------------------------------------------------------------------------- 1 | export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/rng.js: -------------------------------------------------------------------------------- 1 | import crypto from 'crypto'; 2 | const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate 3 | 4 | let poolPtr = rnds8Pool.length; 5 | export default function rng() { 6 | if (poolPtr > rnds8Pool.length - 16) { 7 | crypto.randomFillSync(rnds8Pool); 8 | poolPtr = 0; 9 | } 10 | 11 | return rnds8Pool.slice(poolPtr, poolPtr += 16); 12 | } -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/sha1.js: -------------------------------------------------------------------------------- 1 | import crypto from 'crypto'; 2 | 3 | function sha1(bytes) { 4 | if (Array.isArray(bytes)) { 5 | bytes = Buffer.from(bytes); 6 | } else if (typeof bytes === 'string') { 7 | bytes = Buffer.from(bytes, 'utf8'); 8 | } 9 | 10 | return crypto.createHash('sha1').update(bytes).digest(); 11 | } 12 | 13 | export default sha1; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/stringify.js: -------------------------------------------------------------------------------- 1 | import validate from './validate.js'; 2 | /** 3 | * Convert array of 16 byte values to UUID string format of the form: 4 | * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 5 | */ 6 | 7 | const byteToHex = []; 8 | 9 | for (let i = 0; i < 256; ++i) { 10 | byteToHex.push((i + 0x100).toString(16).substr(1)); 11 | } 12 | 13 | function stringify(arr, offset = 0) { 14 | // Note: Be careful editing this code! It's been tuned for performance 15 | // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 16 | const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one 17 | // of the following: 18 | // - One or more input array values don't map to a hex octet (leading to 19 | // "undefined" in the uuid) 20 | // - Invalid input values for the RFC `version` or `variant` fields 21 | 22 | if (!validate(uuid)) { 23 | throw TypeError('Stringified UUID is invalid'); 24 | } 25 | 26 | return uuid; 27 | } 28 | 29 | export default stringify; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/v3.js: -------------------------------------------------------------------------------- 1 | import v35 from './v35.js'; 2 | import md5 from './md5.js'; 3 | const v3 = v35('v3', 0x30, md5); 4 | export default v3; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/v35.js: -------------------------------------------------------------------------------- 1 | import stringify from './stringify.js'; 2 | import parse from './parse.js'; 3 | 4 | function stringToBytes(str) { 5 | str = unescape(encodeURIComponent(str)); // UTF8 escape 6 | 7 | const bytes = []; 8 | 9 | for (let i = 0; i < str.length; ++i) { 10 | bytes.push(str.charCodeAt(i)); 11 | } 12 | 13 | return bytes; 14 | } 15 | 16 | export const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; 17 | export const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; 18 | export default function (name, version, hashfunc) { 19 | function generateUUID(value, namespace, buf, offset) { 20 | if (typeof value === 'string') { 21 | value = stringToBytes(value); 22 | } 23 | 24 | if (typeof namespace === 'string') { 25 | namespace = parse(namespace); 26 | } 27 | 28 | if (namespace.length !== 16) { 29 | throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); 30 | } // Compute hash of namespace and value, Per 4.3 31 | // Future: Use spread syntax when supported on all platforms, e.g. `bytes = 32 | // hashfunc([...namespace, ... value])` 33 | 34 | 35 | let bytes = new Uint8Array(16 + value.length); 36 | bytes.set(namespace); 37 | bytes.set(value, namespace.length); 38 | bytes = hashfunc(bytes); 39 | bytes[6] = bytes[6] & 0x0f | version; 40 | bytes[8] = bytes[8] & 0x3f | 0x80; 41 | 42 | if (buf) { 43 | offset = offset || 0; 44 | 45 | for (let i = 0; i < 16; ++i) { 46 | buf[offset + i] = bytes[i]; 47 | } 48 | 49 | return buf; 50 | } 51 | 52 | return stringify(bytes); 53 | } // Function#name is not settable on some platforms (#270) 54 | 55 | 56 | try { 57 | generateUUID.name = name; // eslint-disable-next-line no-empty 58 | } catch (err) {} // For CommonJS default export support 59 | 60 | 61 | generateUUID.DNS = DNS; 62 | generateUUID.URL = URL; 63 | return generateUUID; 64 | } -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/v4.js: -------------------------------------------------------------------------------- 1 | import rng from './rng.js'; 2 | import stringify from './stringify.js'; 3 | 4 | function v4(options, buf, offset) { 5 | options = options || {}; 6 | const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` 7 | 8 | rnds[6] = rnds[6] & 0x0f | 0x40; 9 | rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided 10 | 11 | if (buf) { 12 | offset = offset || 0; 13 | 14 | for (let i = 0; i < 16; ++i) { 15 | buf[offset + i] = rnds[i]; 16 | } 17 | 18 | return buf; 19 | } 20 | 21 | return stringify(rnds); 22 | } 23 | 24 | export default v4; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/v5.js: -------------------------------------------------------------------------------- 1 | import v35 from './v35.js'; 2 | import sha1 from './sha1.js'; 3 | const v5 = v35('v5', 0x50, sha1); 4 | export default v5; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/validate.js: -------------------------------------------------------------------------------- 1 | import REGEX from './regex.js'; 2 | 3 | function validate(uuid) { 4 | return typeof uuid === 'string' && REGEX.test(uuid); 5 | } 6 | 7 | export default validate; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/esm-node/version.js: -------------------------------------------------------------------------------- 1 | import validate from './validate.js'; 2 | 3 | function version(uuid) { 4 | if (!validate(uuid)) { 5 | throw TypeError('Invalid UUID'); 6 | } 7 | 8 | return parseInt(uuid.substr(14, 1), 16); 9 | } 10 | 11 | export default version; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | Object.defineProperty(exports, "v1", { 7 | enumerable: true, 8 | get: function () { 9 | return _v.default; 10 | } 11 | }); 12 | Object.defineProperty(exports, "v3", { 13 | enumerable: true, 14 | get: function () { 15 | return _v2.default; 16 | } 17 | }); 18 | Object.defineProperty(exports, "v4", { 19 | enumerable: true, 20 | get: function () { 21 | return _v3.default; 22 | } 23 | }); 24 | Object.defineProperty(exports, "v5", { 25 | enumerable: true, 26 | get: function () { 27 | return _v4.default; 28 | } 29 | }); 30 | Object.defineProperty(exports, "NIL", { 31 | enumerable: true, 32 | get: function () { 33 | return _nil.default; 34 | } 35 | }); 36 | Object.defineProperty(exports, "version", { 37 | enumerable: true, 38 | get: function () { 39 | return _version.default; 40 | } 41 | }); 42 | Object.defineProperty(exports, "validate", { 43 | enumerable: true, 44 | get: function () { 45 | return _validate.default; 46 | } 47 | }); 48 | Object.defineProperty(exports, "stringify", { 49 | enumerable: true, 50 | get: function () { 51 | return _stringify.default; 52 | } 53 | }); 54 | Object.defineProperty(exports, "parse", { 55 | enumerable: true, 56 | get: function () { 57 | return _parse.default; 58 | } 59 | }); 60 | 61 | var _v = _interopRequireDefault(require("./v1.js")); 62 | 63 | var _v2 = _interopRequireDefault(require("./v3.js")); 64 | 65 | var _v3 = _interopRequireDefault(require("./v4.js")); 66 | 67 | var _v4 = _interopRequireDefault(require("./v5.js")); 68 | 69 | var _nil = _interopRequireDefault(require("./nil.js")); 70 | 71 | var _version = _interopRequireDefault(require("./version.js")); 72 | 73 | var _validate = _interopRequireDefault(require("./validate.js")); 74 | 75 | var _stringify = _interopRequireDefault(require("./stringify.js")); 76 | 77 | var _parse = _interopRequireDefault(require("./parse.js")); 78 | 79 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/md5.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | 8 | var _crypto = _interopRequireDefault(require("crypto")); 9 | 10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11 | 12 | function md5(bytes) { 13 | if (Array.isArray(bytes)) { 14 | bytes = Buffer.from(bytes); 15 | } else if (typeof bytes === 'string') { 16 | bytes = Buffer.from(bytes, 'utf8'); 17 | } 18 | 19 | return _crypto.default.createHash('md5').update(bytes).digest(); 20 | } 21 | 22 | var _default = md5; 23 | exports.default = _default; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/nil.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | var _default = '00000000-0000-0000-0000-000000000000'; 8 | exports.default = _default; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/parse.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | 8 | var _validate = _interopRequireDefault(require("./validate.js")); 9 | 10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11 | 12 | function parse(uuid) { 13 | if (!(0, _validate.default)(uuid)) { 14 | throw TypeError('Invalid UUID'); 15 | } 16 | 17 | let v; 18 | const arr = new Uint8Array(16); // Parse ########-....-....-....-............ 19 | 20 | arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; 21 | arr[1] = v >>> 16 & 0xff; 22 | arr[2] = v >>> 8 & 0xff; 23 | arr[3] = v & 0xff; // Parse ........-####-....-....-............ 24 | 25 | arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; 26 | arr[5] = v & 0xff; // Parse ........-....-####-....-............ 27 | 28 | arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; 29 | arr[7] = v & 0xff; // Parse ........-....-....-####-............ 30 | 31 | arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; 32 | arr[9] = v & 0xff; // Parse ........-....-....-....-############ 33 | // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) 34 | 35 | arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; 36 | arr[11] = v / 0x100000000 & 0xff; 37 | arr[12] = v >>> 24 & 0xff; 38 | arr[13] = v >>> 16 & 0xff; 39 | arr[14] = v >>> 8 & 0xff; 40 | arr[15] = v & 0xff; 41 | return arr; 42 | } 43 | 44 | var _default = parse; 45 | exports.default = _default; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/regex.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; 8 | exports.default = _default; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/rng-browser.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = rng; 7 | // Unique ID creation requires a high quality random # generator. In the browser we therefore 8 | // require the crypto API and do not support built-in fallback to lower quality random number 9 | // generators (like Math.random()). 10 | let getRandomValues; 11 | const rnds8 = new Uint8Array(16); 12 | 13 | function rng() { 14 | // lazy load so that environments that need to polyfill have a chance to do so 15 | if (!getRandomValues) { 16 | // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, 17 | // find the complete implementation of crypto (msCrypto) on IE11. 18 | getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto); 19 | 20 | if (!getRandomValues) { 21 | throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); 22 | } 23 | } 24 | 25 | return getRandomValues(rnds8); 26 | } -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/rng.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = rng; 7 | 8 | var _crypto = _interopRequireDefault(require("crypto")); 9 | 10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11 | 12 | const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate 13 | 14 | let poolPtr = rnds8Pool.length; 15 | 16 | function rng() { 17 | if (poolPtr > rnds8Pool.length - 16) { 18 | _crypto.default.randomFillSync(rnds8Pool); 19 | 20 | poolPtr = 0; 21 | } 22 | 23 | return rnds8Pool.slice(poolPtr, poolPtr += 16); 24 | } -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/sha1.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | 8 | var _crypto = _interopRequireDefault(require("crypto")); 9 | 10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11 | 12 | function sha1(bytes) { 13 | if (Array.isArray(bytes)) { 14 | bytes = Buffer.from(bytes); 15 | } else if (typeof bytes === 'string') { 16 | bytes = Buffer.from(bytes, 'utf8'); 17 | } 18 | 19 | return _crypto.default.createHash('sha1').update(bytes).digest(); 20 | } 21 | 22 | var _default = sha1; 23 | exports.default = _default; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/stringify.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | 8 | var _validate = _interopRequireDefault(require("./validate.js")); 9 | 10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11 | 12 | /** 13 | * Convert array of 16 byte values to UUID string format of the form: 14 | * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 15 | */ 16 | const byteToHex = []; 17 | 18 | for (let i = 0; i < 256; ++i) { 19 | byteToHex.push((i + 0x100).toString(16).substr(1)); 20 | } 21 | 22 | function stringify(arr, offset = 0) { 23 | // Note: Be careful editing this code! It's been tuned for performance 24 | // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 25 | const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one 26 | // of the following: 27 | // - One or more input array values don't map to a hex octet (leading to 28 | // "undefined" in the uuid) 29 | // - Invalid input values for the RFC `version` or `variant` fields 30 | 31 | if (!(0, _validate.default)(uuid)) { 32 | throw TypeError('Stringified UUID is invalid'); 33 | } 34 | 35 | return uuid; 36 | } 37 | 38 | var _default = stringify; 39 | exports.default = _default; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/umd/uuidNIL.min.js: -------------------------------------------------------------------------------- 1 | !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidNIL=n()}(this,(function(){"use strict";return"00000000-0000-0000-0000-000000000000"})); -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/umd/uuidParse.min.js: -------------------------------------------------------------------------------- 1 | !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidParse=n()}(this,(function(){"use strict";var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;return function(n){if(!function(n){return"string"==typeof n&&e.test(n)}(n))throw TypeError("Invalid UUID");var t,i=new Uint8Array(16);return i[0]=(t=parseInt(n.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(n.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(n.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(n.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(n.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i}})); -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/umd/uuidStringify.min.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidStringify=t()}(this,(function(){"use strict";var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function t(t){return"string"==typeof t&&e.test(t)}for(var i=[],n=0;n<256;++n)i.push((n+256).toString(16).substr(1));return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,f=(i[e[n+0]]+i[e[n+1]]+i[e[n+2]]+i[e[n+3]]+"-"+i[e[n+4]]+i[e[n+5]]+"-"+i[e[n+6]]+i[e[n+7]]+"-"+i[e[n+8]]+i[e[n+9]]+"-"+i[e[n+10]]+i[e[n+11]]+i[e[n+12]]+i[e[n+13]]+i[e[n+14]]+i[e[n+15]]).toLowerCase();if(!t(f))throw TypeError("Stringified UUID is invalid");return f}})); -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/umd/uuidValidate.min.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidValidate=t()}(this,(function(){"use strict";var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;return function(t){return"string"==typeof t&&e.test(t)}})); -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/umd/uuidVersion.min.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidVersion=t()}(this,(function(){"use strict";var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;return function(t){if(!function(t){return"string"==typeof t&&e.test(t)}(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}})); -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/umd/uuidv1.min.js: -------------------------------------------------------------------------------- 1 | !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):(e="undefined"!=typeof globalThis?globalThis:e||self).uuidv1=o()}(this,(function(){"use strict";var e,o=new Uint8Array(16);function t(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(o)}var n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function r(e){return"string"==typeof e&&n.test(e)}for(var i,u,s=[],a=0;a<256;++a)s.push((a+256).toString(16).substr(1));var d=0,f=0;return function(e,o,n){var a=o&&n||0,c=o||new Array(16),l=(e=e||{}).node||i,p=void 0!==e.clockseq?e.clockseq:u;if(null==l||null==p){var v=e.random||(e.rng||t)();null==l&&(l=i=[1|v[0],v[1],v[2],v[3],v[4],v[5]]),null==p&&(p=u=16383&(v[6]<<8|v[7]))}var y=void 0!==e.msecs?e.msecs:Date.now(),m=void 0!==e.nsecs?e.nsecs:f+1,g=y-d+(m-f)/1e4;if(g<0&&void 0===e.clockseq&&(p=p+1&16383),(g<0||y>d)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");d=y,f=m,u=p;var h=(1e4*(268435455&(y+=122192928e5))+m)%4294967296;c[a++]=h>>>24&255,c[a++]=h>>>16&255,c[a++]=h>>>8&255,c[a++]=255&h;var w=y/4294967296*1e4&268435455;c[a++]=w>>>8&255,c[a++]=255&w,c[a++]=w>>>24&15|16,c[a++]=w>>>16&255,c[a++]=p>>>8|128,c[a++]=255&p;for(var b=0;b<6;++b)c[a+b]=l[b];return o||function(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=(s[e[o+0]]+s[e[o+1]]+s[e[o+2]]+s[e[o+3]]+"-"+s[e[o+4]]+s[e[o+5]]+"-"+s[e[o+6]]+s[e[o+7]]+"-"+s[e[o+8]]+s[e[o+9]]+"-"+s[e[o+10]]+s[e[o+11]]+s[e[o+12]]+s[e[o+13]]+s[e[o+14]]+s[e[o+15]]).toLowerCase();if(!r(t))throw TypeError("Stringified UUID is invalid");return t}(c)}})); -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/umd/uuidv4.min.js: -------------------------------------------------------------------------------- 1 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).uuidv4=e()}(this,(function(){"use strict";var t,e=new Uint8Array(16);function o(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(e)}var n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function r(t){return"string"==typeof t&&n.test(t)}for(var i=[],u=0;u<256;++u)i.push((u+256).toString(16).substr(1));return function(t,e,n){var u=(t=t||{}).random||(t.rng||o)();if(u[6]=15&u[6]|64,u[8]=63&u[8]|128,e){n=n||0;for(var f=0;f<16;++f)e[n+f]=u[f];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=(i[t[e+0]]+i[t[e+1]]+i[t[e+2]]+i[t[e+3]]+"-"+i[t[e+4]]+i[t[e+5]]+"-"+i[t[e+6]]+i[t[e+7]]+"-"+i[t[e+8]]+i[t[e+9]]+"-"+i[t[e+10]]+i[t[e+11]]+i[t[e+12]]+i[t[e+13]]+i[t[e+14]]+i[t[e+15]]).toLowerCase();if(!r(o))throw TypeError("Stringified UUID is invalid");return o}(u)}})); -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/v3.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | 8 | var _v = _interopRequireDefault(require("./v35.js")); 9 | 10 | var _md = _interopRequireDefault(require("./md5.js")); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | const v3 = (0, _v.default)('v3', 0x30, _md.default); 15 | var _default = v3; 16 | exports.default = _default; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/v4.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | 8 | var _rng = _interopRequireDefault(require("./rng.js")); 9 | 10 | var _stringify = _interopRequireDefault(require("./stringify.js")); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | function v4(options, buf, offset) { 15 | options = options || {}; 16 | 17 | const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` 18 | 19 | 20 | rnds[6] = rnds[6] & 0x0f | 0x40; 21 | rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided 22 | 23 | if (buf) { 24 | offset = offset || 0; 25 | 26 | for (let i = 0; i < 16; ++i) { 27 | buf[offset + i] = rnds[i]; 28 | } 29 | 30 | return buf; 31 | } 32 | 33 | return (0, _stringify.default)(rnds); 34 | } 35 | 36 | var _default = v4; 37 | exports.default = _default; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/v5.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | 8 | var _v = _interopRequireDefault(require("./v35.js")); 9 | 10 | var _sha = _interopRequireDefault(require("./sha1.js")); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | const v5 = (0, _v.default)('v5', 0x50, _sha.default); 15 | var _default = v5; 16 | exports.default = _default; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/validate.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | 8 | var _regex = _interopRequireDefault(require("./regex.js")); 9 | 10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11 | 12 | function validate(uuid) { 13 | return typeof uuid === 'string' && _regex.default.test(uuid); 14 | } 15 | 16 | var _default = validate; 17 | exports.default = _default; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/dist/version.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = void 0; 7 | 8 | var _validate = _interopRequireDefault(require("./validate.js")); 9 | 10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 11 | 12 | function version(uuid) { 13 | if (!(0, _validate.default)(uuid)) { 14 | throw TypeError('Invalid UUID'); 15 | } 16 | 17 | return parseInt(uuid.substr(14, 1), 16); 18 | } 19 | 20 | var _default = version; 21 | exports.default = _default; -------------------------------------------------------------------------------- /.github/actions/affected-projects/node_modules/uuid/wrapper.mjs: -------------------------------------------------------------------------------- 1 | import uuid from './dist/index.js'; 2 | export const v1 = uuid.v1; 3 | export const v3 = uuid.v3; 4 | export const v4 = uuid.v4; 5 | export const v5 = uuid.v5; 6 | export const NIL = uuid.NIL; 7 | export const version = uuid.version; 8 | export const validate = uuid.validate; 9 | export const stringify = uuid.stringify; 10 | export const parse = uuid.parse; 11 | -------------------------------------------------------------------------------- /.github/actions/affected-projects/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "affected-projects", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "@actions/core": "^1.10.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.github/actions/docker-build/action.yml: -------------------------------------------------------------------------------- 1 | name: microservice-stack-build-docker 2 | description: Build and publish docker image 3 | 4 | inputs: 5 | app-name: 6 | description: 'Application name' 7 | required: true 8 | app-dockerfile: 9 | description: 'App dockerfile path' 10 | required: true 11 | aws-access-key-id: 12 | description: 'AWS access key id' 13 | required: true 14 | aws-secret-access-key: 15 | description: 'AWS secret access key' 16 | required: true 17 | aws-region: 18 | description: 'AWS region' 19 | required: true 20 | ecr-repository: 21 | description: 'ECR repository name' 22 | required: true 23 | image-tag: 24 | description: 'Image tag name' 25 | required: true 26 | 27 | runs: 28 | using: composite 29 | steps: 30 | - name: Set up Docker Buildx 31 | uses: docker/setup-buildx-action@v1 32 | - name: Build app 33 | shell: bash 34 | run: npx nx run api-${{ inputs.app-name }}:build 35 | - name: Configure AWS credentials 36 | uses: aws-actions/configure-aws-credentials@v1 37 | with: 38 | aws-access-key-id: ${{ inputs.aws-access-key-id }} 39 | aws-secret-access-key: ${{ inputs.aws-secret-access-key }} 40 | aws-region: ${{ inputs.aws-region }} 41 | - name: Login to Amazon ECR 42 | id: login-ecr 43 | uses: aws-actions/amazon-ecr-login@v1 44 | - name: Build 45 | uses: docker/build-push-action@v2 46 | with: 47 | context: ./ 48 | push: true 49 | file: ${{ inputs.app-dockerfile }} 50 | cache-from: type=gha,scope=${{ github.sha }} 51 | build-args: BASE_IMAGE=${{ steps.login-ecr.outputs.registry }}/${{ inputs.ecr-repository }}:prebuild-${{ github.sha }} 52 | cache-to: type=gha,scope=${{ github.sha }} 53 | tags: ${{ steps.login-ecr.outputs.registry }}/${{ inputs.ecr-repository }}:${{ inputs.app-name }}-${{ inputs.image-tag }} 54 | -------------------------------------------------------------------------------- /.github/actions/docker-prebuild/action.yml: -------------------------------------------------------------------------------- 1 | name: microservice-stack-prebuild-docker 2 | description: Prebuild docker image and cache layers 3 | 4 | inputs: 5 | aws-access-key-id: 6 | description: 'AWS access key id' 7 | required: true 8 | aws-secret-access-key: 9 | description: 'AWS secret access key' 10 | required: true 11 | aws-region: 12 | description: 'AWS region' 13 | required: true 14 | ecr-repository: 15 | description: 'ECR repository name' 16 | required: true 17 | dockerfile: 18 | description: 'Location to prebuild dockerfile' 19 | required: true 20 | 21 | runs: 22 | using: composite 23 | steps: 24 | - name: Set up Docker Buildx 25 | uses: docker/setup-buildx-action@v1 26 | - name: Configure AWS credentials 27 | uses: aws-actions/configure-aws-credentials@v1 28 | with: 29 | aws-access-key-id: ${{ inputs.aws-access-key-id }} 30 | aws-secret-access-key: ${{ inputs.aws-secret-access-key }} 31 | aws-region: ${{ inputs.aws-region }} 32 | - name: Login to Amazon ECR 33 | id: login-ecr 34 | uses: aws-actions/amazon-ecr-login@v1 35 | - name: Prebuild dockerfile 36 | uses: docker/build-push-action@v2 37 | with: 38 | context: ./ 39 | push: true 40 | tags: ${{ steps.login-ecr.outputs.registry }}/${{ inputs.ecr-repository }}:prebuild-${{ github.sha }} 41 | file: ${{ inputs.dockerfile }} 42 | cache-from: type=gha, scope=${{ github.sha }} 43 | cache-to: type=gha, scope=${{ github.sha }}, mode=max 44 | -------------------------------------------------------------------------------- /.github/actions/install-dependencies/action.yml: -------------------------------------------------------------------------------- 1 | name: microservice-stack-install-dependencies 2 | description: Install node modules or pull them from cache 3 | 4 | runs: 5 | using: composite 6 | steps: 7 | - name: Cache dependencies 8 | id: cache 9 | uses: actions/cache@v2 10 | with: 11 | path: ./node_modules 12 | key: ${{ inputs.environment }}-dependencies-${{ hashFiles('package-lock.json') }} 13 | - name: Install dependencies 14 | shell: bash 15 | run: npm ci 16 | -------------------------------------------------------------------------------- /.github/workflows/check.yml: -------------------------------------------------------------------------------- 1 | name: Check 2 | 3 | on: 4 | pull_request: 5 | types: 6 | - 'ready_for_review' 7 | 8 | jobs: 9 | check: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | with: 14 | fetch-depth: 0 15 | - uses: nrwl/nx-set-shas@v3 16 | - run: npm ci 17 | - run: npx nx workspace-lint 18 | - run: npx nx affected --target=lint --parallel=3 19 | - run: npx nx affected --target=test --parallel=3 --ci --code-coverage 20 | - run: npx nx affected --target=build --parallel=3 21 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | tags: 6 | - v* 7 | jobs: 8 | extract_metadata: 9 | runs-on: ubuntu-latest 10 | outputs: 11 | imageTag: ${{ steps.extract.outputs.IMAGE_TAG }} 12 | steps: 13 | - id: extract 14 | run: | 15 | export TAG=${GITHUB_REF#refs/tags/} 16 | echo "IMAGE_TAG=${TAG#v}" >> $GITHUB_OUTPUT 17 | check: 18 | runs-on: ubuntu-latest 19 | needs: [extract_metadata] 20 | steps: 21 | - uses: actions/checkout@v2 22 | with: 23 | fetch-depth: 0 24 | - uses: nrwl/nx-set-shas@v3 25 | - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc 26 | - run: npm ci 27 | - run: npx nx workspace-lint 28 | - run: npx nx run-many --target=lint --all --parallel=3 29 | - run: npx nx run-many --target=test --all --parallel=3 --ci --code-coverage 30 | - run: npx nx run-many --target=build --all --parallel=3 31 | - run: npx nx run-many --target=publish --all --parallel=3 --args="--ver=${{ needs.extract_metadata.outputs.imageTag }} --tag=latest" 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | yarn-error.log 34 | testem.log 35 | /typings 36 | 37 | # System Files 38 | .DS_Store 39 | Thumbs.db 40 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Add files here to ignore them from prettier formatting 2 | 3 | /dist 4 | /coverage 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "nrwl.angular-console", 4 | "esbenp.prettier-vscode", 5 | "dbaeumer.vscode-eslint", 6 | "firsttris.vscode-jest-runner" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "eslint.validate": ["json"] 3 | } 4 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | import { getJestProjects } from '@nx/jest'; 2 | 3 | export default { 4 | projects: getJestProjects(), 5 | }; 6 | -------------------------------------------------------------------------------- /jest.preset.js: -------------------------------------------------------------------------------- 1 | const nxPreset = require('@nx/jest/preset').default; 2 | 3 | module.exports = { 4 | ...nxPreset, 5 | /* TODO: Update to latest Jest snapshotFormat 6 | * By default Nx has kept the older style of Jest Snapshot formats 7 | * to prevent breaking of any existing tests with snapshots. 8 | * It's recommend you update to the latest format. 9 | * You can do this by removing snapshotFormat property 10 | * and running tests with --update-snapshot flag. 11 | * Example: "nx affected --targets= --update-snapshot" 12 | * More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format 13 | */ 14 | snapshotFormat: { escapeString: true, printBasicPrototype: true }, 15 | }; 16 | -------------------------------------------------------------------------------- /libs/local-deployment/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /libs/local-deployment/README.md: -------------------------------------------------------------------------------- 1 | # local-deployment 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Building 6 | 7 | Run `nx build local-deployment` to build the library. 8 | 9 | ## Running unit tests 10 | 11 | Run `nx test local-deployment` to execute the unit tests via [Jest](https://jestjs.io). 12 | -------------------------------------------------------------------------------- /libs/local-deployment/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'local-deployment', 4 | preset: '../../jest.preset.js', 5 | globals: {}, 6 | testEnvironment: 'node', 7 | transform: { 8 | '^.+\\.[tj]s$': [ 9 | 'ts-jest', 10 | { 11 | tsconfig: '/tsconfig.spec.json', 12 | }, 13 | ], 14 | }, 15 | moduleFileExtensions: ['ts', 'js', 'html'], 16 | coverageDirectory: '../../coverage/libs/local-deployment', 17 | }; 18 | -------------------------------------------------------------------------------- /libs/local-deployment/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@microservice-stack/local-deployment", 3 | "version": "0.0.9", 4 | "type": "commonjs", 5 | "publishConfig": { 6 | "access": "public" 7 | }, 8 | "bin": { 9 | "deploy": "src/index.js" 10 | }, 11 | "dependencies": { 12 | "util": "^0.12.5", 13 | "chalk": "4.1.2", 14 | "clear": "^0.1.0", 15 | "commander": "^11.0.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/local-deployment/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "local-deployment", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "libs/local-deployment/src", 5 | "projectType": "library", 6 | "targets": { 7 | "build": { 8 | "executor": "@microservice-stack/npx-build:build", 9 | "options": { 10 | "applicationName": "local-deployment", 11 | "outputPath": "dist/libs/local-deployment" 12 | } 13 | }, 14 | "build-npx": { 15 | "executor": "@nx/js:tsc", 16 | "outputs": ["{options.outputPath}"], 17 | "options": { 18 | "outputPath": "dist/libs/local-deployment", 19 | "tsConfig": "libs/local-deployment/tsconfig.lib.json", 20 | "packageJson": "libs/local-deployment/package.json", 21 | "main": "libs/local-deployment/src/index.ts", 22 | "assets": ["libs/local-deployment/*.md"] 23 | } 24 | }, 25 | "publish": { 26 | "executor": "nx:run-commands", 27 | "options": { 28 | "command": "node tools/scripts/publish.mjs local-deployment {args.ver} {args.tag}" 29 | }, 30 | "dependsOn": ["build"] 31 | }, 32 | "lint": { 33 | "executor": "@nx/linter:eslint", 34 | "outputs": ["{options.outputFile}"], 35 | "options": { 36 | "lintFilePatterns": ["libs/local-deployment/**/*.ts"] 37 | } 38 | }, 39 | "test": { 40 | "executor": "@nx/jest:jest", 41 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 42 | "options": { 43 | "jestConfig": "libs/local-deployment/jest.config.ts", 44 | "passWithNoTests": true 45 | } 46 | } 47 | }, 48 | "tags": [] 49 | } 50 | -------------------------------------------------------------------------------- /libs/local-deployment/src/check-deployment-requirements.ts: -------------------------------------------------------------------------------- 1 | import { exec } from 'child_process'; 2 | import { promisify } from 'util'; 3 | 4 | const execAsync = promisify(exec); 5 | 6 | export async function checkRequirements() { 7 | try { 8 | await execAsync('minikube'); 9 | } catch { 10 | throw new Error('Minikube is required'); 11 | } 12 | 13 | try { 14 | await execAsync('eval $(minikube -u minikube docker-env)'); 15 | await execAsync('docker info'); 16 | } catch { 17 | throw new Error('Docker is required'); 18 | } 19 | 20 | try { 21 | await execAsync('helm'); 22 | } catch { 23 | throw new Error('Helm is required'); 24 | } 25 | 26 | try { 27 | await execAsync('kubectl'); 28 | } catch { 29 | throw new Error('Kubectl is required'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /libs/local-deployment/src/deploy-ingress-controller.ts: -------------------------------------------------------------------------------- 1 | import { exec } from 'child_process'; 2 | import { promisify } from 'util'; 3 | 4 | const execAsync = promisify(exec); 5 | 6 | export async function enableIngressController(debugEnabled: boolean) { 7 | try { 8 | console.log('Enabling ingress controller...'); 9 | await execAsync('minikube addons enable ingress'); 10 | console.log('Ingress controller enabled ✅'); 11 | } catch (error) { 12 | if (debugEnabled) { 13 | console.error(error); 14 | } 15 | throw new Error('Error while enabling ingress controller'); 16 | } 17 | } 18 | 19 | export async function deployIngressController(debugEnabled: boolean) { 20 | try { 21 | console.log('Installing ingress controller'); 22 | await execAsync( 23 | 'helm upgrade --install ingress infrastructure/charts/ingress-controller --values infrastructure/ingress-values.yaml --set environment=local' 24 | ); 25 | console.log('Installing ingress controller deployed ✅'); 26 | } catch (error) { 27 | if (debugEnabled) { 28 | console.error(error); 29 | } 30 | throw new Error('Error while deploying ingress controller'); 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /libs/local-deployment/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as chalk from 'chalk'; 2 | import { program } from 'commander'; 3 | import { checkRequirements } from './check-deployment-requirements'; 4 | import { setupCluster } from './setup-cluster'; 5 | import { deployService, deployServices } from './deploy-services'; 6 | import { 7 | deployIngressController, 8 | enableIngressController, 9 | } from './deploy-ingress-controller'; 10 | 11 | program 12 | .command('install') 13 | .alias('i') 14 | .option('-d, --debug') 15 | .action(async ({ debug = false }) => { 16 | console.log(chalk.bold('Starting local microservice deployment...')); 17 | 18 | try { 19 | await checkRequirements(); 20 | await setupCluster(debug); 21 | await deployServices(debug); 22 | await enableIngressController(debug); 23 | } catch (error) { 24 | console.log(chalk.bold.red(error.message)); 25 | } 26 | }); 27 | 28 | program 29 | .command('update') 30 | .alias('u') 31 | .requiredOption('-s, --service ', 'service that should be upgraded') 32 | .option('-d, --debug') 33 | .action(async ({ service, debug = false }) => { 34 | console.log(chalk.bold('Starting local microservice deployment...')); 35 | 36 | try { 37 | await checkRequirements(); 38 | await deployService(service, debug); 39 | } catch (error) { 40 | console.log(chalk.bold.red(error.message)); 41 | } 42 | }); 43 | 44 | program 45 | .command('update-ingress') 46 | .alias('ui') 47 | .option('-d, --debug') 48 | .action(async ({ debug = false }) => { 49 | console.log(chalk.bold('Starting local microservice deployment...')); 50 | 51 | try { 52 | await checkRequirements(); 53 | await deployIngressController(debug); 54 | } catch (error) { 55 | console.log(chalk.bold.red(error.message)); 56 | } 57 | }); 58 | 59 | program.parse(); 60 | -------------------------------------------------------------------------------- /libs/local-deployment/src/setup-cluster.ts: -------------------------------------------------------------------------------- 1 | import { exec } from 'child_process'; 2 | import { promisify } from 'util'; 3 | 4 | const execAsync = promisify(exec); 5 | 6 | export async function setupCluster(debugEnabled: boolean) { 7 | try { 8 | console.log('Deleting old cluster...'); 9 | await execAsync('minikube delete'); 10 | console.log('Cluster deleted ✅'); 11 | 12 | console.log('Setting up fresh cluster...'); 13 | await execAsync('minikube start'); 14 | console.log('Cluster created ✅'); 15 | 16 | console.log('Setting up helm repositories...'); 17 | await execAsync('helm repo add datadog https://helm.datadoghq.com'); 18 | await execAsync('helm repo add bitnami https://charts.bitnami.com/bitnami'); 19 | await execAsync('helm repo update'); 20 | 21 | console.log('Starting RabbitMQ...'); 22 | await execAsync( 23 | `helm install rabbitmq -f infrastructure/local/rabbitmq-values.yml bitnami/rabbitmq` 24 | ); 25 | console.log('RabbitMQ Started ✅'); 26 | 27 | console.log('Starting PostgresSQL...'); 28 | await execAsync( 29 | `helm install postgresql -f infrastructure/local/postgresql-values.yml bitnami/postgresql` 30 | ); 31 | console.log('PostgreSQL Started ✅'); 32 | 33 | console.log('Starting Redis'); 34 | await execAsync( 35 | `helm install redis -f infrastructure/local/redis-values.yml bitnami/redis` 36 | ); 37 | console.log('Redis Started ✅'); 38 | } catch (error) { 39 | if (debugEnabled) { 40 | console.error(error); 41 | } 42 | throw new Error('Issue while setting up cluster, is your docker running?'); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /libs/local-deployment/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | }, 6 | "files": [], 7 | "include": [], 8 | "references": [ 9 | { 10 | "path": "./tsconfig.lib.json" 11 | }, 12 | { 13 | "path": "./tsconfig.spec.json" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /libs/local-deployment/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "declaration": true, 6 | "types": ["node"], 7 | "target": "es6" 8 | }, 9 | "include": ["src/**/*.ts"], 10 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /libs/local-deployment/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "src/**/*.test.ts", 11 | "src/**/*.spec.ts", 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /libs/nest-application/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /libs/nest-application/README.md: -------------------------------------------------------------------------------- 1 | # Application 2 | 3 | This library streamlines the nest service start configuration by providing default nest configuration including 4 | 5 | * Fastify framework instead of Express because of its superior performance 6 | * Winston logger formatted to raw JSON, so your service logs can easily be connected to services such as Datadog 7 | * Enabled global Validation pipe for the use of class validator decorators 8 | * Enabled cors 9 | 10 | ```typescript 11 | import { AppModule } from './app.module'; 12 | import { startService } from '@microservice-stack/nest-application'; 13 | 14 | async function bootstrap(): Promise { 15 | await startService('Service Name', AppModule); 16 | } 17 | 18 | bootstrap(); 19 | ``` -------------------------------------------------------------------------------- /libs/nest-application/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'nest-application', 4 | preset: '../../jest.preset.js', 5 | globals: {}, 6 | testEnvironment: 'node', 7 | transform: { 8 | '^.+\\.[tj]s$': [ 9 | 'ts-jest', 10 | { 11 | tsconfig: '/tsconfig.spec.json', 12 | }, 13 | ], 14 | }, 15 | moduleFileExtensions: ['ts', 'js', 'html'], 16 | coverageDirectory: '../../coverage/libs/nest-application', 17 | }; 18 | -------------------------------------------------------------------------------- /libs/nest-application/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@microservice-stack/nest-application", 3 | "version": "0.0.5", 4 | "type": "commonjs", 5 | "dependencies": { 6 | "@nestjs/common": "^10.0.4", 7 | "@nestjs/core": "^10.0.4", 8 | "@nestjs/platform-fastify": "^10.0.4", 9 | "nest-winston": "^1.9.3", 10 | "winston": "^3.9.0" 11 | }, 12 | "devDependencies": { 13 | "@types/winston": "^2.4.4" 14 | }, 15 | "publishConfig": { 16 | "access": "public" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /libs/nest-application/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nest-application", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "libs/nest-application/src", 5 | "projectType": "library", 6 | "targets": { 7 | "build": { 8 | "executor": "@nx/js:tsc", 9 | "outputs": ["{options.outputPath}"], 10 | "options": { 11 | "outputPath": "dist/libs/nest-application", 12 | "tsConfig": "libs/nest-application/tsconfig.lib.json", 13 | "packageJson": "libs/nest-application/package.json", 14 | "main": "libs/nest-application/src/index.ts", 15 | "assets": ["libs/nest-application/*.md"] 16 | } 17 | }, 18 | "publish": { 19 | "executor": "nx:run-commands", 20 | "options": { 21 | "command": "node tools/scripts/publish.mjs nest-application {args.ver} {args.tag}" 22 | }, 23 | "dependsOn": ["build"] 24 | }, 25 | "lint": { 26 | "executor": "@nx/linter:eslint", 27 | "outputs": ["{options.outputFile}"], 28 | "options": { 29 | "lintFilePatterns": ["libs/nest-application/**/*.ts"] 30 | } 31 | }, 32 | "test": { 33 | "executor": "@nx/jest:jest", 34 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 35 | "options": { 36 | "jestConfig": "libs/nest-application/jest.config.ts", 37 | "passWithNoTests": true 38 | } 39 | } 40 | }, 41 | "tags": [] 42 | } 43 | -------------------------------------------------------------------------------- /libs/nest-application/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/service'; 2 | -------------------------------------------------------------------------------- /libs/nest-application/src/lib/service.ts: -------------------------------------------------------------------------------- 1 | import { INestApplication, ValidationPipe } from '@nestjs/common'; 2 | import { NestFactory } from '@nestjs/core'; 3 | import { FastifyAdapter } from '@nestjs/platform-fastify'; 4 | import { WinstonModule } from 'nest-winston'; 5 | import * as winston from 'winston'; 6 | 7 | export async function startService( 8 | _name: string, 9 | module: unknown 10 | ): Promise { 11 | const app = await NestFactory.create(module, new FastifyAdapter(), { 12 | logger: WinstonModule.createLogger({ 13 | transports: [ 14 | new winston.transports.Console({ 15 | format: winston.format.combine( 16 | winston.format.timestamp(), 17 | winston.format.ms(), 18 | winston.format.json() 19 | ), 20 | }), 21 | ], 22 | }), 23 | rawBody: true, 24 | }); 25 | 26 | app.useGlobalPipes(new ValidationPipe({ whitelist: true })); 27 | app.enableCors(); 28 | 29 | await app.listen(process.env.PORT ?? 80, '0.0.0.0'); 30 | 31 | return app; 32 | } 33 | -------------------------------------------------------------------------------- /libs/nest-application/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | }, 6 | "files": [], 7 | "include": [], 8 | "references": [ 9 | { 10 | "path": "./tsconfig.lib.json" 11 | }, 12 | { 13 | "path": "./tsconfig.spec.json" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /libs/nest-application/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "declaration": true, 6 | "types": ["node"], 7 | "target": "es2021" 8 | }, 9 | "include": ["src/**/*.ts"], 10 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /libs/nest-application/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "src/**/*.test.ts", 11 | "src/**/*.spec.ts", 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /libs/nest-config/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /libs/nest-config/README.md: -------------------------------------------------------------------------------- 1 | # Config 2 | This library wraps the default `@nestjs/config` library and adds the ability to define variables that are required for the service to launch and the ability to parse environment variables. 3 | 4 | ```typescript 5 | import { Module } from '@nestjs/common'; 6 | import { ConfigModule } from '@microservice-stack/nest-config'; 7 | 8 | @Module({ 9 | imports: [ 10 | ConfigModule.register({ 11 | requiredEnvironmentVariables: [ 12 | 'STRING_VARIABLE', 13 | 'JSON_VARIABLE', 14 | ], 15 | parse: (configVariable, value) => { 16 | if (configVariable === 'JSON_VARIABLE') { 17 | return JSON.parse(value); 18 | } 19 | 20 | return value; 21 | }), 22 | ], 23 | controllers: [], 24 | providers: [], 25 | }) 26 | export class AppModule {} 27 | 28 | ``` 29 | 30 | The `ConfigModule` is registered globally, so you can inject it as you wish 31 | 32 | ```typescript 33 | import { ConfigService } from '@microservice-stack/nest-config'; 34 | 35 | export class AppService { 36 | constructor(private configService: ConfigService) {} 37 | 38 | public hello(): string { 39 | return this.configService.get('STRING_VARIABLE'); 40 | } 41 | } 42 | ``` -------------------------------------------------------------------------------- /libs/nest-config/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'nest-config', 4 | preset: '../../jest.preset.js', 5 | globals: {}, 6 | testEnvironment: 'node', 7 | transform: { 8 | '^.+\\.[tj]s$': [ 9 | 'ts-jest', 10 | { 11 | tsconfig: '/tsconfig.spec.json', 12 | }, 13 | ], 14 | }, 15 | moduleFileExtensions: ['ts', 'js', 'html'], 16 | coverageDirectory: '../../coverage/libs/nest-config', 17 | }; 18 | -------------------------------------------------------------------------------- /libs/nest-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@microservice-stack/nest-config", 3 | "version": "0.0.5", 4 | "type": "commonjs", 5 | "dependencies": { 6 | "@nestjs/common": "^10.0.4", 7 | "@nestjs/config": "^3.0.0" 8 | }, 9 | "publishConfig": { 10 | "access": "public" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /libs/nest-config/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nest-config", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "libs/nest-config/src", 5 | "projectType": "library", 6 | "targets": { 7 | "build": { 8 | "executor": "@nx/js:tsc", 9 | "outputs": ["{options.outputPath}"], 10 | "options": { 11 | "outputPath": "dist/libs/nest-config", 12 | "tsConfig": "libs/nest-config/tsconfig.lib.json", 13 | "packageJson": "libs/nest-config/package.json", 14 | "main": "libs/nest-config/src/index.ts", 15 | "assets": ["libs/nest-config/*.md"] 16 | } 17 | }, 18 | "publish": { 19 | "executor": "nx:run-commands", 20 | "options": { 21 | "command": "node tools/scripts/publish.mjs nest-config {args.ver} {args.tag}" 22 | }, 23 | "dependsOn": ["build"] 24 | }, 25 | "lint": { 26 | "executor": "@nx/linter:eslint", 27 | "outputs": ["{options.outputFile}"], 28 | "options": { 29 | "lintFilePatterns": ["libs/nest-config/**/*.ts"] 30 | } 31 | }, 32 | "test": { 33 | "executor": "@nx/jest:jest", 34 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 35 | "options": { 36 | "jestConfig": "libs/nest-config/jest.config.ts", 37 | "passWithNoTests": true 38 | } 39 | } 40 | }, 41 | "tags": [] 42 | } 43 | -------------------------------------------------------------------------------- /libs/nest-config/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/config.module'; 2 | export * from './lib/config.service'; 3 | -------------------------------------------------------------------------------- /libs/nest-config/src/lib/config.interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface ConfigOptions { 2 | requiredEnvironmentVariables: string[]; 3 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 4 | parse?: (configVariable: string, value: any) => any; 5 | } 6 | -------------------------------------------------------------------------------- /libs/nest-config/src/lib/config.module.ts: -------------------------------------------------------------------------------- 1 | import { DynamicModule, Global, Module } from '@nestjs/common'; 2 | import { ConfigModule as OriginalConfigModule } from '@nestjs/config'; 3 | import { ConfigOptions } from './config.interfaces'; 4 | import { ConfigService } from './config.service'; 5 | 6 | @Global() 7 | @Module({}) 8 | export class ConfigModule { 9 | static register(options: ConfigOptions): DynamicModule { 10 | return { 11 | module: ConfigModule, 12 | providers: [ 13 | { 14 | provide: 'CONFIG_OPTIONS', 15 | useValue: options, 16 | }, 17 | ConfigService, 18 | ], 19 | exports: [ConfigService], 20 | imports: [OriginalConfigModule.forRoot({ cache: true })], 21 | global: true, 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libs/nest-config/src/lib/config.service.ts: -------------------------------------------------------------------------------- 1 | import { Inject, Injectable } from '@nestjs/common'; 2 | import { ConfigOptions } from './config.interfaces'; 3 | import { ConfigService as OriginalConfigService } from '@nestjs/config'; 4 | 5 | @Injectable() 6 | export class ConfigService { 7 | constructor( 8 | private configService: OriginalConfigService, 9 | @Inject('CONFIG_OPTIONS') private options: ConfigOptions 10 | ) { 11 | options.requiredEnvironmentVariables.forEach((variableName: string) => { 12 | if (this.configService.get(variableName) === undefined) { 13 | throw new Error(`INVALID_CONFIG_${variableName}_MISSING`); 14 | } 15 | }); 16 | } 17 | 18 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 19 | public get(configVariable: string): T { 20 | const value = this.configService.get(configVariable); 21 | 22 | if (this.options.parse) { 23 | return this.options.parse(configVariable, value); 24 | } 25 | 26 | return value; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /libs/nest-config/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | }, 6 | "files": [], 7 | "include": [], 8 | "references": [ 9 | { 10 | "path": "./tsconfig.lib.json" 11 | }, 12 | { 13 | "path": "./tsconfig.spec.json" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /libs/nest-config/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "declaration": true, 6 | "types": ["node"], 7 | "target": "es2021" 8 | }, 9 | "include": ["src/**/*.ts"], 10 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /libs/nest-config/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "src/**/*.test.ts", 11 | "src/**/*.spec.ts", 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /libs/nest-health/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /libs/nest-health/README.md: -------------------------------------------------------------------------------- 1 | # Health 2 | 3 | This library provides a module that adds a `/health` endpoint to your nest service. This endpoint can be used for Kubernetes health checks. 4 | 5 | ```typescript 6 | import { Module } from '@nestjs/common'; 7 | import { HealthModule } from '@microservice-stack/nest-health'; 8 | 9 | @Module({ 10 | imports: [HealthModule], 11 | }) 12 | export class AppModule {} 13 | ``` -------------------------------------------------------------------------------- /libs/nest-health/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'nest-health', 4 | preset: '../../jest.preset.js', 5 | globals: {}, 6 | testEnvironment: 'node', 7 | transform: { 8 | '^.+\\.[tj]s$': [ 9 | 'ts-jest', 10 | { 11 | tsconfig: '/tsconfig.spec.json', 12 | }, 13 | ], 14 | }, 15 | moduleFileExtensions: ['ts', 'js', 'html'], 16 | coverageDirectory: '../../coverage/libs/nest-health', 17 | }; 18 | -------------------------------------------------------------------------------- /libs/nest-health/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@microservice-stack/nest-health", 3 | "version": "0.0.5", 4 | "type": "commonjs", 5 | "dependencies": { 6 | "@nestjs/common": "^10.0.4" 7 | }, 8 | "publishConfig": { 9 | "access": "public" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /libs/nest-health/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nest-health", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "libs/nest-health/src", 5 | "projectType": "library", 6 | "targets": { 7 | "build": { 8 | "executor": "@nx/js:tsc", 9 | "outputs": ["{options.outputPath}"], 10 | "options": { 11 | "outputPath": "dist/libs/nest-health", 12 | "tsConfig": "libs/nest-health/tsconfig.lib.json", 13 | "packageJson": "libs/nest-health/package.json", 14 | "main": "libs/nest-health/src/index.ts", 15 | "assets": ["libs/nest-health/*.md"] 16 | } 17 | }, 18 | "publish": { 19 | "executor": "nx:run-commands", 20 | "options": { 21 | "command": "node tools/scripts/publish.mjs nest-health {args.ver} {args.tag}" 22 | }, 23 | "dependsOn": ["build"] 24 | }, 25 | "lint": { 26 | "executor": "@nx/linter:eslint", 27 | "outputs": ["{options.outputFile}"], 28 | "options": { 29 | "lintFilePatterns": ["libs/nest-health/**/*.ts"] 30 | } 31 | }, 32 | "test": { 33 | "executor": "@nx/jest:jest", 34 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 35 | "options": { 36 | "jestConfig": "libs/nest-health/jest.config.ts", 37 | "passWithNoTests": true 38 | } 39 | } 40 | }, 41 | "tags": [] 42 | } 43 | -------------------------------------------------------------------------------- /libs/nest-health/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/health.module'; 2 | -------------------------------------------------------------------------------- /libs/nest-health/src/lib/health.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from '@nestjs/common'; 2 | 3 | @Controller('health') 4 | export class HealthController { 5 | @Get() 6 | getHealth(): string { 7 | return 'ok'; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /libs/nest-health/src/lib/health.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { HealthController } from './health.controller'; 3 | 4 | @Module({ 5 | imports: [], 6 | controllers: [HealthController], 7 | providers: [], 8 | }) 9 | export class HealthModule {} 10 | -------------------------------------------------------------------------------- /libs/nest-health/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | }, 6 | "files": [], 7 | "include": [], 8 | "references": [ 9 | { 10 | "path": "./tsconfig.lib.json" 11 | }, 12 | { 13 | "path": "./tsconfig.spec.json" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /libs/nest-health/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "declaration": true, 6 | "types": ["node"], 7 | "target": "es2021" 8 | }, 9 | "include": ["src/**/*.ts"], 10 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /libs/nest-health/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "src/**/*.test.ts", 11 | "src/**/*.spec.ts", 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/README.md: -------------------------------------------------------------------------------- 1 | # RabbitMQ 2 | 3 | This library provides a module that enables the usage of RabbitMQ inside your project. It comes with support for publishing events as well as subscribing to them 4 | 5 | ### Import 6 | 7 | ```typescript 8 | import { Module } from '@nestjs/common'; 9 | import { RabbitmqModule } from '@microservice-stack/nest-rabbitmq'; 10 | import { ConfigModule, ConfigService } from '@microservice-stack/nest-config'; 11 | 12 | @Module({ 13 | imports: [ 14 | RabbitmqModule.register({ 15 | imports: [ConfigModule], 16 | inject: [ConfigService], 17 | useFactory: (configService: ConfigService) => ({ 18 | uri: configService.get('QUEUE_URL'), 19 | }), 20 | }), 21 | ], 22 | }) 23 | export class AppModule {} 24 | ``` 25 | 26 | ### Publish 27 | 28 | ```typescript 29 | export interface HelloWorldEventPayload { 30 | hello: string; 31 | } 32 | 33 | export const HELLO_WORLD_EVENT = new Event('hello.world', 1); 34 | ``` 35 | 36 | ```typescript 37 | import { RabbitmqService } from '@microservice-stack/nest-rabbitmq'; 38 | import { HELLO_WORLD_EVENT } from './constants'; 39 | 40 | export class HelloService { 41 | constructor(private queueService: RabbitmqService) {} 42 | 43 | public sayHello(): void { 44 | this.queueService.publishEvent(HELLO_WORLD_EVENT, { hello: 'world' }); 45 | } 46 | } 47 | ``` 48 | 49 | ### Subscribe 50 | 51 | Queue controllers should be defined separately from Rest controllers as any Rest endpoints defined in them will not work. 52 | 53 | ```typescript 54 | import { Controller } from "@nestjs/common"; 55 | import { Subscribe } from "@microservice-stack/nest-rabbitmq"; 56 | import { HELLO_WORLD_EVENT, HelloWorldEventPayload } from './constants'; 57 | 58 | @Controller() 59 | export class HelloQueueController { 60 | static CONTROLLER_QUEUE_NAME = 'hello-queue'; 61 | 62 | @Subscribe(HELLO_WORLD_EVENT, HelloQueueController.CONTROLLER_QUEUE_NAME) 63 | public hello(payload: HelloWorldEventPayload): void { 64 | console.log(payload.hello); 65 | } 66 | } 67 | ``` 68 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'nest-rabbitmq', 4 | preset: '../../jest.preset.js', 5 | globals: {}, 6 | testEnvironment: 'node', 7 | transform: { 8 | '^.+\\.[tj]s$': [ 9 | 'ts-jest', 10 | { 11 | tsconfig: '/tsconfig.spec.json', 12 | }, 13 | ], 14 | }, 15 | moduleFileExtensions: ['ts', 'js', 'html'], 16 | coverageDirectory: '../../coverage/libs/nest-rabbitmq', 17 | }; 18 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@microservice-stack/nest-rabbitmq", 3 | "version": "0.0.5", 4 | "type": "commonjs", 5 | "dependencies": { 6 | "@golevelup/nestjs-rabbitmq": "^3.6.1", 7 | "@nestjs/common": "^10.0.4", 8 | "@nestjs/core": "^10.0.4", 9 | "uuid": "9.0.0" 10 | }, 11 | "publishConfig": { 12 | "access": "public" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nest-rabbitmq", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "libs/nest-rabbitmq/src", 5 | "projectType": "library", 6 | "targets": { 7 | "build": { 8 | "executor": "@nx/js:tsc", 9 | "outputs": ["{options.outputPath}"], 10 | "options": { 11 | "outputPath": "dist/libs/nest-rabbitmq", 12 | "tsConfig": "libs/nest-rabbitmq/tsconfig.lib.json", 13 | "packageJson": "libs/nest-rabbitmq/package.json", 14 | "main": "libs/nest-rabbitmq/src/index.ts", 15 | "assets": ["libs/nest-rabbitmq/*.md"] 16 | } 17 | }, 18 | "publish": { 19 | "executor": "nx:run-commands", 20 | "options": { 21 | "command": "node tools/scripts/publish.mjs nest-rabbitmq {args.ver} {args.tag}" 22 | }, 23 | "dependsOn": ["build"] 24 | }, 25 | "lint": { 26 | "executor": "@nx/linter:eslint", 27 | "outputs": ["{options.outputFile}"], 28 | "options": { 29 | "lintFilePatterns": ["libs/nest-rabbitmq/**/*.ts"] 30 | } 31 | }, 32 | "test": { 33 | "executor": "@nx/jest:jest", 34 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 35 | "options": { 36 | "jestConfig": "libs/nest-rabbitmq/jest.config.ts", 37 | "passWithNoTests": true 38 | } 39 | } 40 | }, 41 | "tags": [] 42 | } 43 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/src/index.ts: -------------------------------------------------------------------------------- 1 | import { RabbitMQExchangeConfig } from '@golevelup/nestjs-rabbitmq'; 2 | 3 | export * from './lib/decorators'; 4 | export * from './lib/rabbitmq-exchange.util'; 5 | export * from './lib/rabbitmq.interfaces'; 6 | export * from './lib/rabbitmq.module'; 7 | export * from './lib/rabbitmq.service'; 8 | export * from './lib/event/event'; 9 | 10 | export const DEFAULT_EXCHANGE: RabbitMQExchangeConfig = { 11 | name: 'default', 12 | type: 'topic', 13 | }; 14 | 15 | /** 16 | * @author Andraz Cuderman - https://github.com/acuderman 17 | */ 18 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/src/lib/decorators/index.ts: -------------------------------------------------------------------------------- 1 | export * from './rpc' 2 | export * from './subscribe' 3 | export * from './interfaces' -------------------------------------------------------------------------------- /libs/nest-rabbitmq/src/lib/decorators/interfaces.ts: -------------------------------------------------------------------------------- 1 | import { QueueOptions } from '@golevelup/nestjs-rabbitmq'; 2 | import { RabbitMQExchange } from '../rabbitmq.interfaces'; 3 | 4 | // eslint-disable-next-line @typescript-eslint/ban-types 5 | export type Decorators = ( 6 | target: object | TFunction, 7 | propertyKey?: string | symbol, 8 | descriptor?: TypedPropertyDescriptor 9 | ) => void; 10 | 11 | export interface SubscriptionOptions { 12 | requeueOnError?: RequeueOnErrorOptions; 13 | exchange?: RabbitMQExchange; 14 | queue?: QueueOptions; 15 | } 16 | 17 | export interface RequeueOnErrorOptions { 18 | retry: boolean; 19 | deadLetter: boolean; 20 | retryInitialDelayInMs: number; 21 | maxRetries: number; 22 | retryBackoffMultiplier: number; 23 | } 24 | 25 | export { QueueOptions }; 26 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/src/lib/decorators/rpc.ts: -------------------------------------------------------------------------------- 1 | import { 2 | QueueOptions, 3 | RabbitMQExchangeConfig, 4 | RabbitRPC, 5 | } from '@golevelup/nestjs-rabbitmq'; 6 | import { Decorators } from './interfaces'; 7 | import { DEFAULT_EXCHANGE } from '../..'; 8 | 9 | export function Rpc( 10 | routingKey: string, 11 | queueName: string, 12 | exchange: RabbitMQExchangeConfig = DEFAULT_EXCHANGE, 13 | queueOptions: QueueOptions 14 | ): Decorators { 15 | const fullQueueName = `${queueName}-${exchange.name}_${routingKey}`; 16 | 17 | return RabbitRPC({ 18 | exchange: exchange.name, 19 | createQueueIfNotExists: true, 20 | queue: fullQueueName, 21 | routingKey: routingKey, 22 | queueOptions: { 23 | durable: true, 24 | ...queueOptions, 25 | }, 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/src/lib/event/event.ts: -------------------------------------------------------------------------------- 1 | export class Event { 2 | constructor( 3 | private routingKey: string, 4 | public version: number, 5 | public isSensitive?: boolean 6 | ) {} 7 | 8 | public getRoutingKey(): string { 9 | return `${this.routingKey}.v${this.version}`; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/src/lib/rabbitmq-exchange.util.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { RabbitMQExchange } from './rabbitmq.interfaces'; 3 | import { RabbitMQExchangeConfig } from '@golevelup/nestjs-rabbitmq'; 4 | 5 | @Injectable() 6 | export class RabbitMQExhangeUtil { 7 | public static createExchanges( 8 | exchanges: RabbitMQExchange[] 9 | ): RabbitMQExchangeConfig[] { 10 | return exchanges.flatMap((exchange: RabbitMQExchange) => { 11 | const retryExchange: RabbitMQExchangeConfig = { 12 | name: RabbitMQExhangeUtil.getRetryExchangeName(exchange.name), 13 | type: 'x-delayed-message', 14 | options: { 15 | arguments: { 16 | 'x-delayed-type': 'direct', 17 | }, 18 | }, 19 | }; 20 | 21 | const deadLetterExchange: RabbitMQExchangeConfig = { 22 | name: RabbitMQExhangeUtil.getDeadLetterExchangeName(exchange.name), 23 | type: 'direct', 24 | }; 25 | 26 | return [exchange, retryExchange, deadLetterExchange]; 27 | }); 28 | } 29 | 30 | public static getRetryExchangeName(exchange: string): string { 31 | return `${exchange}.retry`; 32 | } 33 | 34 | public static getDeadLetterExchangeName(exchange: string): string { 35 | return `${exchange}.dead`; 36 | } 37 | 38 | public static getDeadLetterQueueName(queueName: string): string { 39 | return `${queueName}.dead`; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/src/lib/rabbitmq.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { 2 | RabbitMQConfig, 3 | RabbitMQExchangeConfig, 4 | } from '@golevelup/nestjs-rabbitmq'; 5 | import { 6 | DynamicModule, 7 | ForwardReference, 8 | InjectionToken, 9 | OptionalFactoryDependency, 10 | Type, 11 | } from '@nestjs/common'; 12 | 13 | export interface RabbitMQExchange extends RabbitMQExchangeConfig { 14 | initRetryExchange?: boolean; 15 | initDeadLetterExchange?: boolean; 16 | } 17 | 18 | export interface RabbitMQModuleConfig { 19 | imports: Array< 20 | Type | DynamicModule | Promise | ForwardReference 21 | >; 22 | inject: (InjectionToken | OptionalFactoryDependency)[]; 23 | useFactory: (...args: unknown[]) => RabbitMQConfig; 24 | } 25 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/src/lib/rabbitmq.module.ts: -------------------------------------------------------------------------------- 1 | import { DynamicModule, Logger, Module, Provider } from '@nestjs/common'; 2 | import { RabbitMQConfig, RabbitMQModule } from '@golevelup/nestjs-rabbitmq'; 3 | import { RabbitMQExhangeUtil } from './rabbitmq-exchange.util'; 4 | import { RabbitmqService } from './rabbitmq.service'; 5 | import { RabbitMQModuleConfig } from './rabbitmq.interfaces'; 6 | import { DEFAULT_EXCHANGE } from '..'; 7 | 8 | @Module({}) 9 | export class RabbitmqModule { 10 | static register(options: RabbitMQModuleConfig): DynamicModule { 11 | const imports = [ 12 | RabbitMQModule.forRootAsync(RabbitMQModule, { 13 | imports: options.imports, 14 | inject: options.inject, 15 | useFactory: (...args): RabbitMQConfig => { 16 | const config = options.useFactory(...args); 17 | 18 | return { 19 | ...config, 20 | exchanges: RabbitMQExhangeUtil.createExchanges([ 21 | DEFAULT_EXCHANGE, 22 | ...(config.exchanges ? config.exchanges : []), 23 | ]), 24 | prefetchCount: 250, 25 | enableControllerDiscovery: true, 26 | connectionInitOptions: { wait: false }, 27 | logger: new Logger(), 28 | }; 29 | }, 30 | }), 31 | ]; 32 | 33 | const exports: Provider[] = [RabbitMQModule, RabbitmqService]; 34 | const providers: Provider[] = [RabbitmqService]; 35 | 36 | return { 37 | module: RabbitmqModule, 38 | providers, 39 | imports, 40 | exports, 41 | global: true, 42 | }; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | }, 6 | "files": [], 7 | "include": [], 8 | "references": [ 9 | { 10 | "path": "./tsconfig.lib.json" 11 | }, 12 | { 13 | "path": "./tsconfig.spec.json" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "declaration": true, 6 | "types": ["node"], 7 | "target": "es2021" 8 | }, 9 | "include": ["src/**/*.ts"], 10 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /libs/nest-rabbitmq/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "src/**/*.test.ts", 11 | "src/**/*.spec.ts", 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /libs/nest-redis/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /libs/nest-redis/README.md: -------------------------------------------------------------------------------- 1 | # nest-redis 2 | 3 | [Microservice-Stack](https://docs.microservice-stack.com) 4 | -------------------------------------------------------------------------------- /libs/nest-redis/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'nest-redis', 4 | preset: '../../jest.preset.js', 5 | globals: {}, 6 | testEnvironment: 'node', 7 | transform: { 8 | '^.+\\.[tj]s$': [ 9 | 'ts-jest', 10 | { 11 | tsconfig: '/tsconfig.spec.json', 12 | }, 13 | ], 14 | }, 15 | moduleFileExtensions: ['ts', 'js', 'html'], 16 | coverageDirectory: '../../coverage/libs/nest-redis', 17 | }; 18 | -------------------------------------------------------------------------------- /libs/nest-redis/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@microservice-stack/nest-redis", 3 | "version": "0.0.1", 4 | "type": "commonjs", 5 | "dependencies": { 6 | "@nestjs/common": "^10.0.4", 7 | "ioredis": "^5.3.2" 8 | }, 9 | "publishConfig": { 10 | "access": "public" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /libs/nest-redis/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nest-redis", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "libs/nest-redis/src", 5 | "projectType": "library", 6 | "targets": { 7 | "build": { 8 | "executor": "@nx/js:tsc", 9 | "outputs": ["{options.outputPath}"], 10 | "options": { 11 | "outputPath": "dist/libs/nest-redis", 12 | "tsConfig": "libs/nest-redis/tsconfig.lib.json", 13 | "packageJson": "libs/nest-redis/package.json", 14 | "main": "libs/nest-redis/src/index.ts", 15 | "assets": ["libs/nest-redis/*.md"] 16 | } 17 | }, 18 | "publish": { 19 | "executor": "nx:run-commands", 20 | "options": { 21 | "command": "node tools/scripts/publish.mjs nest-redis {args.ver} {args.tag}" 22 | }, 23 | "dependsOn": ["build"] 24 | }, 25 | "lint": { 26 | "executor": "@nx/linter:eslint", 27 | "outputs": ["{options.outputFile}"], 28 | "options": { 29 | "lintFilePatterns": ["libs/nest-redis/**/*.ts"] 30 | } 31 | }, 32 | "test": { 33 | "executor": "@nx/jest:jest", 34 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 35 | "options": { 36 | "jestConfig": "libs/nest-redis/jest.config.ts", 37 | "passWithNoTests": true 38 | } 39 | } 40 | }, 41 | "tags": [] 42 | } 43 | -------------------------------------------------------------------------------- /libs/nest-redis/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/redis.module'; 2 | export * from './lib/redis.service'; 3 | -------------------------------------------------------------------------------- /libs/nest-redis/src/lib/connection/connection.ts: -------------------------------------------------------------------------------- 1 | import RedisClient from 'ioredis'; 2 | 3 | export class Connection { 4 | private client: RedisClient; 5 | 6 | constructor(connectionUrl: string, private keyPrefix: string | undefined) { 7 | this.client = new RedisClient(connectionUrl); 8 | } 9 | 10 | public getClient(): RedisClient { 11 | return this.client; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /libs/nest-redis/src/lib/redis.interfaces.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Type, 3 | DynamicModule, 4 | ForwardReference, 5 | InjectionToken, 6 | OptionalFactoryDependency, 7 | } from '@nestjs/common'; 8 | 9 | export interface ConnectionOptions { 10 | connectionName: string; 11 | connectionUrl: string; 12 | keyPrefix?: string; 13 | } 14 | 15 | export type RedisConfig = { 16 | connections: ConnectionOptions[]; 17 | }; 18 | 19 | export interface RedisOptions { 20 | imports: Array< 21 | Type | DynamicModule | Promise | ForwardReference 22 | >; 23 | inject: (InjectionToken | OptionalFactoryDependency)[]; 24 | useFactory: (...args: unknown[]) => RedisConfig; 25 | } 26 | -------------------------------------------------------------------------------- /libs/nest-redis/src/lib/redis.module.ts: -------------------------------------------------------------------------------- 1 | import { DynamicModule, Module } from '@nestjs/common'; 2 | import { RedisOptions } from './redis.interfaces'; 3 | import { RedisService } from './redis.service'; 4 | 5 | @Module({}) 6 | export class RedisModule { 7 | static register(options: RedisOptions): DynamicModule { 8 | return { 9 | module: RedisModule, 10 | imports: options.imports, 11 | providers: [ 12 | { 13 | inject: options.inject, 14 | provide: 'CONFIG_OPTIONS', 15 | useFactory: options.useFactory, 16 | }, 17 | RedisService, 18 | ], 19 | exports: [RedisService], 20 | global: true, 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /libs/nest-redis/src/lib/redis.service.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Inject, 3 | Injectable, 4 | InternalServerErrorException, 5 | OnModuleInit, 6 | } from '@nestjs/common'; 7 | import { RedisConfig } from './redis.interfaces'; 8 | import { Connection } from './connection/connection'; 9 | 10 | @Injectable() 11 | export class RedisService implements OnModuleInit { 12 | private connections: Map = new Map(); 13 | 14 | constructor(@Inject('CONFIG_OPTIONS') private options: RedisConfig) {} 15 | 16 | onModuleInit() { 17 | this.options.connections.forEach((connection) => { 18 | this.connections.set( 19 | connection.connectionName, 20 | new Connection(connection.connectionUrl, connection.keyPrefix) 21 | ); 22 | }); 23 | } 24 | 25 | forConnection(connectionName: string): Connection { 26 | if (this.connections.has(connectionName)) { 27 | return this.connections.get(connectionName); 28 | } 29 | 30 | throw new InternalServerErrorException( 31 | `CONNECTION - ${connectionName} - not available.` 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /libs/nest-redis/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | }, 6 | "files": [], 7 | "include": [], 8 | "references": [ 9 | { 10 | "path": "./tsconfig.lib.json" 11 | }, 12 | { 13 | "path": "./tsconfig.spec.json" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /libs/nest-redis/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "declaration": true, 6 | "types": ["node"], 7 | "target": "es2021" 8 | }, 9 | "include": ["src/**/*.ts"], 10 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /libs/nest-redis/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "src/**/*.test.ts", 11 | "src/**/*.spec.ts", 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /libs/nest-typeorm-migrations/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /libs/nest-typeorm-migrations/README.md: -------------------------------------------------------------------------------- 1 | # TypeORM migrations 2 | 3 | [Microservice-Stack](https://docs.microservice-stack.com) 4 | -------------------------------------------------------------------------------- /libs/nest-typeorm-migrations/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'nest-typeorm-migrations', 4 | preset: '../../jest.preset.js', 5 | globals: {}, 6 | testEnvironment: 'node', 7 | transform: { 8 | '^.+\\.[tj]s$': [ 9 | 'ts-jest', 10 | { 11 | tsconfig: '/tsconfig.spec.json', 12 | }, 13 | ], 14 | }, 15 | moduleFileExtensions: ['ts', 'js', 'html'], 16 | coverageDirectory: '../../coverage/libs/nest-typeorm-migrations', 17 | }; 18 | -------------------------------------------------------------------------------- /libs/nest-typeorm-migrations/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@microservice-stack/nest-typeorm-migrations", 3 | "version": "0.0.5", 4 | "type": "commonjs", 5 | "dependencies": { 6 | "@nestjs/common": "^10.0.4", 7 | "@nestjs/core": "^10.0.4", 8 | "typeorm": "^0.3.17" 9 | }, 10 | "devDependencies": { 11 | "@sqltools/formatter": "^1.2.5" 12 | }, 13 | "publishConfig": { 14 | "access": "public" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /libs/nest-typeorm-migrations/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nest-typeorm-migrations", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "libs/nest-typeorm-migrations/src", 5 | "projectType": "library", 6 | "targets": { 7 | "build": { 8 | "executor": "@nx/js:tsc", 9 | "outputs": ["{options.outputPath}"], 10 | "options": { 11 | "outputPath": "dist/libs/nest-typeorm-migrations", 12 | "tsConfig": "libs/nest-typeorm-migrations/tsconfig.lib.json", 13 | "packageJson": "libs/nest-typeorm-migrations/package.json", 14 | "main": "libs/nest-typeorm-migrations/src/index.ts", 15 | "assets": ["libs/nest-typeorm-migrations/*.md"] 16 | } 17 | }, 18 | "publish": { 19 | "executor": "nx:run-commands", 20 | "options": { 21 | "command": "node tools/scripts/publish.mjs nest-typeorm-migrations {args.ver} {args.tag}" 22 | }, 23 | "dependsOn": ["build"] 24 | }, 25 | "lint": { 26 | "executor": "@nx/linter:eslint", 27 | "outputs": ["{options.outputFile}"], 28 | "options": { 29 | "lintFilePatterns": ["libs/nest-typeorm-migrations/**/*.ts"] 30 | } 31 | }, 32 | "test": { 33 | "executor": "@nx/jest:jest", 34 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 35 | "options": { 36 | "jestConfig": "libs/nest-typeorm-migrations/jest.config.ts", 37 | "passWithNoTests": true 38 | } 39 | } 40 | }, 41 | "tags": [] 42 | } 43 | -------------------------------------------------------------------------------- /libs/nest-typeorm-migrations/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Type, DynamicModule, ForwardReference } from '@nestjs/common'; 2 | import { NestFactory } from '@nestjs/core'; 3 | import { MigrationGeneratorModule } from './lib/migration-generator.module'; 4 | import { MigrationGeneratorService } from './lib/migration-generator.service'; 5 | 6 | export async function generateMigration( 7 | appName: string, 8 | appModule: Type | DynamicModule | Promise | ForwardReference 9 | ): Promise { 10 | const app = await NestFactory.create( 11 | MigrationGeneratorModule.register(appModule) 12 | ); 13 | 14 | const migrationGeneratorService = app.get(MigrationGeneratorService); 15 | 16 | await migrationGeneratorService.generateMigration(appName); 17 | await app.close(); 18 | 19 | process.exit(0); 20 | } 21 | -------------------------------------------------------------------------------- /libs/nest-typeorm-migrations/src/lib/migration-generator.module.ts: -------------------------------------------------------------------------------- 1 | import { DynamicModule, Module } from '@nestjs/common'; 2 | import { MigrationGeneratorService } from './migration-generator.service'; 3 | import { Type } from '@nestjs/common/interfaces/type.interface'; 4 | import { ForwardReference } from '@nestjs/common/interfaces/modules/forward-reference.interface'; 5 | 6 | @Module({}) 7 | export class MigrationGeneratorModule { 8 | static register( 9 | appModule: Type | DynamicModule | Promise | ForwardReference, 10 | ): DynamicModule { 11 | return { 12 | providers: [MigrationGeneratorService], 13 | imports: [appModule], 14 | module: MigrationGeneratorModule, 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /libs/nest-typeorm-migrations/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | }, 6 | "files": [], 7 | "include": [], 8 | "references": [ 9 | { 10 | "path": "./tsconfig.lib.json" 11 | }, 12 | { 13 | "path": "./tsconfig.spec.json" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /libs/nest-typeorm-migrations/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "declaration": true, 6 | "types": ["node"], 7 | "target": "es2021" 8 | }, 9 | "include": ["src/**/*.ts"], 10 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /libs/nest-typeorm-migrations/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "src/**/*.test.ts", 11 | "src/**/*.spec.ts", 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /libs/npx-build/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | }, 17 | { 18 | "files": ["./package.json", "./generators.json", "./executors.json"], 19 | "parser": "jsonc-eslint-parser", 20 | "rules": { 21 | "@nx/nx-plugin-checks": "error" 22 | } 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /libs/npx-build/README.md: -------------------------------------------------------------------------------- 1 | # workspace 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Building 6 | 7 | Run `nx build workspace` to build the library. 8 | 9 | ## Running unit tests 10 | 11 | Run `nx test workspace` to execute the unit tests via [Jest](https://jestjs.io). 12 | -------------------------------------------------------------------------------- /libs/npx-build/executors.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema", 3 | "name": "npx-build", 4 | "version": "0.0.1", 5 | "executors": { 6 | "build": { 7 | "implementation": "./src/executors/build/executor", 8 | "schema": "./src/executors/build/schema.json", 9 | "description": "build executor" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /libs/npx-build/generators.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema", 3 | "name": "npx-build", 4 | "version": "0.0.1", 5 | "generators": {} 6 | } 7 | -------------------------------------------------------------------------------- /libs/npx-build/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'npx-build', 4 | preset: '../../jest.preset.js', 5 | globals: {}, 6 | transform: { 7 | '^.+\\.[tj]s$': [ 8 | 'ts-jest', 9 | { 10 | tsconfig: '/tsconfig.spec.json', 11 | }, 12 | ], 13 | }, 14 | moduleFileExtensions: ['ts', 'js', 'html'], 15 | coverageDirectory: '../../coverage/libs/npx-build', 16 | }; 17 | -------------------------------------------------------------------------------- /libs/npx-build/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@microservice-stack/npx-build", 3 | "version": "0.0.1", 4 | "main": "src/index.js", 5 | "generators": "./generators.json", 6 | "executors": "./executors.json" 7 | } 8 | -------------------------------------------------------------------------------- /libs/npx-build/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "npx-build", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "libs/npx-build/src", 5 | "projectType": "library", 6 | "targets": { 7 | "build": { 8 | "executor": "@nx/js:tsc", 9 | "outputs": ["{options.outputPath}"], 10 | "options": { 11 | "outputPath": "dist/libs/npx-build", 12 | "main": "libs/npx-build/src/index.ts", 13 | "tsConfig": "libs/npx-build/tsconfig.lib.json", 14 | "assets": [ 15 | "libs/npx-build/*.md", 16 | { 17 | "input": "./libs/npx-build/src", 18 | "glob": "**/!(*.ts)", 19 | "output": "./src" 20 | }, 21 | { 22 | "input": "./libs/npx-build/src", 23 | "glob": "**/*.d.ts", 24 | "output": "./src" 25 | }, 26 | { 27 | "input": "./libs/npx-build", 28 | "glob": "generators.json", 29 | "output": "." 30 | }, 31 | { 32 | "input": "./libs/npx-build", 33 | "glob": "executors.json", 34 | "output": "." 35 | } 36 | ] 37 | } 38 | }, 39 | "lint": { 40 | "executor": "@nx/linter:eslint", 41 | "outputs": ["{options.outputFile}"], 42 | "options": { 43 | "lintFilePatterns": [ 44 | "libs/npx-build/**/*.ts", 45 | "libs/npx-build/generators.json", 46 | "libs/npx-build/executors.json", 47 | "libs/npx-build/package.json" 48 | ] 49 | } 50 | }, 51 | "test": { 52 | "executor": "@nx/jest:jest", 53 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 54 | "options": { 55 | "jestConfig": "libs/npx-build/jest.config.ts", 56 | "passWithNoTests": true 57 | } 58 | } 59 | }, 60 | "tags": [] 61 | } 62 | -------------------------------------------------------------------------------- /libs/npx-build/src/executors/build/executor.ts: -------------------------------------------------------------------------------- 1 | import { exec } from 'child_process'; 2 | import { promisify } from 'util'; 3 | import { BuildExecutorSchema } from './schema'; 4 | import * as fs from 'fs'; 5 | 6 | export default async function runExecutor(options: BuildExecutorSchema) { 7 | const { stdout, stderr } = await promisify(exec)( 8 | `nx run ${options.applicationName}:build-npx` 9 | ); 10 | 11 | console.log(stdout); 12 | console.log(stderr); 13 | 14 | if (stderr) { 15 | return { 16 | success: false, 17 | }; 18 | } 19 | 20 | const filePath = `${options.outputPath}/src/index.js`; 21 | 22 | const file = fs.readFileSync(filePath, 'utf8'); 23 | fs.writeFileSync(filePath, `#!/usr/bin/env node\n\n${file}`); 24 | 25 | console.log('Executor ran for Build', options); 26 | return { 27 | success: true, 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /libs/npx-build/src/executors/build/schema.d.ts: -------------------------------------------------------------------------------- 1 | export interface BuildExecutorSchema { 2 | applicationName: string; 3 | outputPath: string; 4 | } 5 | -------------------------------------------------------------------------------- /libs/npx-build/src/executors/build/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema", 3 | "version": 2, 4 | "title": "Build executor", 5 | "description": "", 6 | "type": "object", 7 | "properties": { 8 | "outputPath": { 9 | "type": "string", 10 | "description": "The output path of the generated files.", 11 | "x-completion-type": "directory" 12 | } 13 | }, 14 | "required": [ 15 | "outputPath" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /libs/npx-build/src/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FurlanLuka/microservice-stack/994591d35ef9460f919f2d001a99cad539853798/libs/npx-build/src/index.ts -------------------------------------------------------------------------------- /libs/npx-build/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | }, 6 | "files": [], 7 | "include": [], 8 | "references": [ 9 | { 10 | "path": "./tsconfig.lib.json" 11 | }, 12 | { 13 | "path": "./tsconfig.spec.json" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /libs/npx-build/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "declaration": true, 6 | "types": ["node"] 7 | }, 8 | "include": ["src/**/*.ts", "src/generators/app-generator/files/library-data-transfer-objects/index.ts__tmpl__"], 9 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /libs/npx-build/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "src/**/*.test.ts", 11 | "src/**/*.spec.ts", 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /libs/workspace/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | }, 17 | { 18 | "files": ["./package.json", "./generators.json", "./executors.json"], 19 | "parser": "jsonc-eslint-parser", 20 | "rules": { 21 | "@nx/nx-plugin-checks": "error" 22 | } 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /libs/workspace/README.md: -------------------------------------------------------------------------------- 1 | # workspace 2 | 3 | This library was generated with [Nx](https://nx.dev). 4 | 5 | ## Building 6 | 7 | Run `nx build workspace` to build the library. 8 | 9 | ## Running unit tests 10 | 11 | Run `nx test workspace` to execute the unit tests via [Jest](https://jestjs.io). 12 | -------------------------------------------------------------------------------- /libs/workspace/executors.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema", 3 | "executors": { 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /libs/workspace/generators.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema", 3 | "name": "workspace", 4 | "version": "0.0.4", 5 | "generators": { 6 | "configuration-generator": { 7 | "factory": "./src/generators/configuration-generator/generator", 8 | "schema": "./src/generators/configuration-generator/schema.json", 9 | "description": "Microservice stack configuration generator" 10 | }, 11 | "application-generator": { 12 | "factory": "./src/generators/app-generator/generator", 13 | "schema": "./src/generators/app-generator/schema.json", 14 | "description": "Application generator" 15 | }, 16 | "application-library-generator": { 17 | "factory": "./src/generators/app-library-generator/generator", 18 | "schema": "./src/generators/app-library-generator/schema.json", 19 | "description": "Application library generator" 20 | }, 21 | "util-library-generator": { 22 | "factory": "./src/generators/util-library-generator/generator", 23 | "schema": "./src/generators/util-library-generator/schema.json", 24 | "description": "Util library generator" 25 | }, 26 | "migration-generator": { 27 | "factory": "./src/generators/migration-generator/generator", 28 | "schema": "./src/generators/migration-generator/schema.json", 29 | "description": "Migration generator" 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /libs/workspace/jest.config.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | export default { 3 | displayName: 'workspace', 4 | preset: '../../jest.preset.js', 5 | globals: {}, 6 | transform: { 7 | '^.+\\.[tj]s$': [ 8 | 'ts-jest', 9 | { 10 | tsconfig: '/tsconfig.spec.json', 11 | }, 12 | ], 13 | }, 14 | moduleFileExtensions: ['ts', 'js', 'html'], 15 | coverageDirectory: '../../coverage/libs/workspace', 16 | }; 17 | -------------------------------------------------------------------------------- /libs/workspace/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@microservice-stack/workspace", 3 | "version": "0.0.8", 4 | "main": "src/index.js", 5 | "generators": "./generators.json", 6 | "executors": "./executors.json", 7 | "publishConfig": { 8 | "access": "public" 9 | }, 10 | "dependencies": { 11 | "@nrwl/node": "16.4.1", 12 | "@nx/devkit": "16.4.1", 13 | "@nx/workspace": "16.4.1", 14 | "@nx/linter": "16.4.1", 15 | "@nx/js": "16.4.1", 16 | "@nx/nest": "16.4.1" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /libs/workspace/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "workspace", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "libs/workspace/src", 5 | "projectType": "library", 6 | "targets": { 7 | "build": { 8 | "executor": "@nx/js:tsc", 9 | "outputs": ["{options.outputPath}"], 10 | "options": { 11 | "outputPath": "dist/libs/workspace", 12 | "main": "libs/workspace/src/index.ts", 13 | "tsConfig": "libs/workspace/tsconfig.lib.json", 14 | "assets": [ 15 | "libs/workspace/*.md", 16 | { 17 | "input": "./libs/workspace/src", 18 | "glob": "**/!(*.ts)", 19 | "output": "./src" 20 | }, 21 | { 22 | "input": "./libs/workspace/src", 23 | "glob": "**/*.d.ts", 24 | "output": "./src" 25 | }, 26 | { 27 | "input": "./libs/workspace", 28 | "glob": "generators.json", 29 | "output": "." 30 | }, 31 | { 32 | "input": "./libs/workspace", 33 | "glob": "executors.json", 34 | "output": "." 35 | } 36 | ] 37 | } 38 | }, 39 | "publish": { 40 | "executor": "nx:run-commands", 41 | "options": { 42 | "command": "node tools/scripts/publish.mjs workspace {args.ver} {args.tag}" 43 | }, 44 | "dependsOn": ["build"] 45 | }, 46 | "lint": { 47 | "executor": "@nx/linter:eslint", 48 | "outputs": ["{options.outputFile}"], 49 | "options": { 50 | "lintFilePatterns": [ 51 | "libs/workspace/**/*.ts", 52 | "libs/workspace/generators.json", 53 | "libs/workspace/executors.json", 54 | "libs/workspace/package.json" 55 | ] 56 | } 57 | }, 58 | "test": { 59 | "executor": "@nx/jest:jest", 60 | "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], 61 | "options": { 62 | "jestConfig": "libs/workspace/jest.config.ts", 63 | "passWithNoTests": true 64 | } 65 | } 66 | }, 67 | "tags": [] 68 | } 69 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/application/deployment/Dockerfile.ci: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE 2 | FROM ${BASE_IMAGE} 3 | 4 | WORKDIR /service 5 | 6 | COPY dist/apps/api/<%= applicationName %>/ /service/ 7 | 8 | USER root 9 | 10 | WORKDIR / 11 | 12 | CMD ["/bin/sh"] 13 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/application/deployment/Dockerfile.local: -------------------------------------------------------------------------------- 1 | ARG BASE_IMAGE 2 | FROM ${BASE_IMAGE} 3 | 4 | WORKDIR /service 5 | 6 | COPY dist/apps/api/<%= applicationName %>/ /service/ 7 | COPY apps/api/<%= applicationName %>/.env / 8 | 9 | USER node 10 | 11 | WORKDIR / 12 | 13 | CMD ["/bin/sh"] 14 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/application/deployment/deployment-values.yaml: -------------------------------------------------------------------------------- 1 | ## Environment name. Set per environment (production | development) 2 | # enviroment: '' 3 | service: 4 | ## Service name. Service name MUST be specified by each service 5 | name: "<%= applicationName %>" 6 | 7 | ## Minimum number of replicas 8 | # replicas: 1 9 | 10 | ## Resource request/limits 11 | # resources: 12 | # request: 13 | # memory: "256Mi" 14 | # cpu: '250m' 15 | # limits: 16 | # memory: "292Mi" 17 | 18 | ## Autoscaling configuration 19 | # autoscaling: 20 | ## Enable autoscaling. In case this is set as false, no autoscaling rules will be applied 21 | # enabled: true 22 | ## Autoscaling when memory consumption hits 80% 23 | # memory: true 24 | ## Autoscaling when cpu consumption hits 80% 25 | # cpu: true 26 | ## Autoscaling maximum replicas. Minimum replicas equals to the initial amount of replicas 27 | # maxReplicas: 3 28 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/application/env/.env: -------------------------------------------------------------------------------- 1 | REQUIRED_ENVIRONMENT_VARIABLE='Hello world' 2 | <% if(includeQueue) { %>QUEUE_URL='amqp://guest:guest@rabbitmq.default.svc.cluster.local:5672/'<% } %> 3 | <% if(includeRedis) { %>REDIS_URL='redis://redis-master.default.svc.cluster.local:6379/'<% } %> 4 | <% if(includeDatabase) { %>TYPEORM_DATABASE=postgres 5 | TYPEORM_HOST=postgresql.default.svc.cluster.local 6 | TYPEORM_PASSWORD=postgres 7 | TYPEORM_PORT=5432 8 | TYPEORM_USERNAME=postgres 9 | <% } %> -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/application/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FurlanLuka/microservice-stack/994591d35ef9460f919f2d001a99cad539853798/libs/workspace/src/generators/app-generator/files/application/src/assets/.gitkeep -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/application/src/main.ts__tmpl__: -------------------------------------------------------------------------------- 1 | import { AppModule } from './app.module'; 2 | import { startService } from '@microservice-stack/nest-application'; 3 | import { SERVICE_NAME } from '@<%= organisationName %>/api/<%= applicationName %>/constants'; 4 | import { Logger } from '@nestjs/common'; 5 | <% if(includeDatabase) { %> 6 | import { generateMigration } from '@microservice-stack/nest-typeorm-migrations'; 7 | <% } %> 8 | 9 | async function bootstrap(): Promise { 10 | <% if(includeDatabase) { %> 11 | const shouldGenerateMigrations: boolean = process.argv.some( 12 | (arg) => arg === 'generate-migrations', 13 | ); 14 | 15 | if (shouldGenerateMigrations) { 16 | await generateMigration(SERVICE_NAME, AppModule); 17 | } else { 18 | await startService(SERVICE_NAME, AppModule); 19 | } 20 | <% } else { %> 21 | await startService(SERVICE_NAME, AppModule); 22 | <% } %> 23 | } 24 | 25 | bootstrap().catch((error) => { 26 | Logger.error(error); 27 | throw error; 28 | }); 29 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/application/src/migrations.ts__tmpl__: -------------------------------------------------------------------------------- 1 | export const migrations = []; 2 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/library-constants/index.ts__tmpl__: -------------------------------------------------------------------------------- 1 | export const SERVICE_NAME = '<%= applicationName %>'; 2 | 3 | <% if(includeQueue) { %> 4 | export const SERVICE_QUEUE_NAME = `${SERVICE_NAME}-queue`; 5 | <% } %> 6 | 7 | export enum ConfigVariables { 8 | REQUIRED_ENVIRONMENT_VARIABLE = 'REQUIRED_ENVIRONMENT_VARIABLE', 9 | <% if(includeQueue) { %> QUEUE_URL = 'QUEUE_URL',<% } if(includeDatabase) { %> 10 | TYPEORM_HOST = 'TYPEORM_HOST', 11 | TYPEORM_USERNAME = 'TYPEORM_USERNAME', 12 | TYPEORM_PASSWORD = 'TYPEORM_PASSWORD', 13 | TYPEORM_DATABASE = 'TYPEORM_DATABASE', 14 | TYPEORM_PORT = 'TYPEORM_PORT',<% } if (includeRedis) { %> 15 | REDIS_URL = 'REDIS_URL',<% } %> 16 | } -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/library-data-transfer-objects/index.ts__tmpl__: -------------------------------------------------------------------------------- 1 | export * from './lib/example.dto'; 2 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/library-data-transfer-objects/lib/example.dto.ts__tmpl__: -------------------------------------------------------------------------------- 1 | import { ExamplePayload } from './example.interfaces'; 2 | 3 | export class ExamplePayloadDto implements ExamplePayload { 4 | firstName: string; 5 | lastName: string; 6 | } 7 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/library-data-transfer-objects/lib/example.interfaces.ts__tmpl__: -------------------------------------------------------------------------------- 1 | export interface ExamplePayload { 2 | firstName: string; 3 | lastName: string; 4 | } 5 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/library-data-transfer-objects/types.ts__tmpl__: -------------------------------------------------------------------------------- 1 | export * from './lib/example.interfaces'; 2 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/library-service/index.ts__tmpl__: -------------------------------------------------------------------------------- 1 | export * from './lib/<%= name %>.module'; -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/library-service/lib/__name__.controller.ts__tmpl__: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from "@nestjs/common"; 2 | import { <%= capitalName %>Service } from "./<%= name %>.service"; 3 | 4 | @Controller('v1/<%= name %>') 5 | export class <%= capitalName %>Controller { 6 | 7 | constructor(private <%= name %>Service: <%= capitalName %>Service) {} 8 | 9 | @Get() 10 | public hello(): string { 11 | return this.<%= name %>Service.hello(); 12 | } 13 | } -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/library-service/lib/__name__.module.ts__tmpl__: -------------------------------------------------------------------------------- 1 | import { Module } from "@nestjs/common"; 2 | import { <%= capitalName %>Controller } from "./<%= name %>.controller"; 3 | import { <%= capitalName %>Service } from "./<%= name %>.service"; 4 | 5 | @Module({ 6 | controllers: [<%= capitalName %>Controller], 7 | providers: [<%= capitalName %>Service], 8 | }) 9 | export class <%= capitalName %>Module {} -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/files/library-service/lib/__name__.service.ts__tmpl__: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@nestjs/common'; 2 | import { ConfigService } from '@microservice-stack/nest-config'; 3 | import { ConfigVariables } from '@<%= organisationName %>/api/<%= name %>/constants'; 4 | 5 | @Injectable() 6 | export class <%= capitalName %>Service { 7 | constructor(private configService: ConfigService) {} 8 | 9 | public hello(): string { 10 | return this.configService.get(ConfigVariables.REQUIRED_ENVIRONMENT_VARIABLE); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/lib/add-migration-generation-target.ts: -------------------------------------------------------------------------------- 1 | import { 2 | readProjectConfiguration, 3 | Tree, 4 | updateProjectConfiguration, 5 | } from '@nx/devkit'; 6 | 7 | export function addMigrationGenerationTarget(tree: Tree, projectName: string) { 8 | const projectConfig = readProjectConfiguration(tree, projectName); 9 | 10 | updateProjectConfiguration(tree, projectName, { 11 | ...projectConfig, 12 | targets: { 13 | ...projectConfig.targets, 14 | 'generate-migrations': { 15 | executor: 'nx:run-commands', 16 | options: { 17 | command: `nx run ${projectName}:build && node dist/apps/${projectName.replace( 18 | '-', 19 | '/' 20 | )}/main generate-migrations`, 21 | }, 22 | }, 23 | }, 24 | }); 25 | } 26 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/lib/create-application-files.ts: -------------------------------------------------------------------------------- 1 | import { generateFiles, joinPathFragments, Tree } from '@nx/devkit'; 2 | 3 | interface Options { 4 | includeQueue: boolean; 5 | includeDatabase: boolean; 6 | includeRedis: boolean; 7 | organisationName: string; 8 | applicationName: string; 9 | capitalApplicationName: string; 10 | } 11 | 12 | export function createApplicationFiles( 13 | tree: Tree, 14 | applicationRoot: string, 15 | options: Options 16 | ) { 17 | generateFiles( 18 | tree, 19 | joinPathFragments(__dirname, '..', 'files/application/src'), 20 | joinPathFragments(applicationRoot, 'src'), 21 | { 22 | tmpl: '', 23 | ...options, 24 | } 25 | ); 26 | generateFiles( 27 | tree, 28 | joinPathFragments(__dirname, '..', 'files/application/env'), 29 | joinPathFragments(applicationRoot), 30 | { 31 | tmpl: '', 32 | ...options, 33 | } 34 | ); 35 | 36 | generateFiles( 37 | tree, 38 | joinPathFragments(__dirname, '..', 'files/application/deployment'), 39 | applicationRoot, 40 | { 41 | tmpl: '', 42 | ...options, 43 | } 44 | ); 45 | } 46 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/lib/create-constants-library-files.ts: -------------------------------------------------------------------------------- 1 | import { generateFiles, joinPathFragments, Tree } from '@nx/devkit'; 2 | 3 | interface Options { 4 | includeQueue: boolean; 5 | includeDatabase: boolean; 6 | includeRedis: boolean; 7 | applicationName: string; 8 | } 9 | 10 | export function createConstantsLibraryFiles( 11 | tree: Tree, 12 | libraryRoot: string, 13 | options: Options 14 | ) { 15 | generateFiles( 16 | tree, 17 | joinPathFragments(__dirname, '..', 'files/library-constants'), 18 | joinPathFragments(libraryRoot, 'src'), 19 | { 20 | tmpl: '', 21 | ...options, 22 | } 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/lib/create-dto-library-files.ts: -------------------------------------------------------------------------------- 1 | import { generateFiles, joinPathFragments, Tree } from '@nx/devkit'; 2 | 3 | export function createDtoLibraryFiles(tree: Tree, libraryRoot: string) { 4 | generateFiles( 5 | tree, 6 | joinPathFragments(__dirname, '..', 'files/library-data-transfer-objects'), 7 | joinPathFragments(libraryRoot, 'src'), 8 | { 9 | tmpl: '', 10 | } 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/lib/create-service-library-files.ts: -------------------------------------------------------------------------------- 1 | import { generateFiles, joinPathFragments, Tree } from '@nx/devkit'; 2 | 3 | interface Options { 4 | name: string; 5 | capitalName: string; 6 | organisationName: string; 7 | } 8 | 9 | export function createServiceLibraryFiles( 10 | tree: Tree, 11 | libraryRoot: string, 12 | options: Options 13 | ) { 14 | generateFiles( 15 | tree, 16 | joinPathFragments(__dirname, '..', 'files/library-service'), 17 | joinPathFragments(libraryRoot, 'src'), 18 | { 19 | tmpl: '', 20 | ...options, 21 | } 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/schema.d.ts: -------------------------------------------------------------------------------- 1 | export interface ApplicationGeneratorSchema { 2 | applicationName: string; 3 | includeQueue?: boolean; 4 | includeRedis?: boolean; 5 | includeDatabase?: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-generator/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema", 3 | "$id": "ApplicationGeneratorPlugin", 4 | "title": "", 5 | "type": "object", 6 | "properties": { 7 | "applicationName": { 8 | "description": "The name of the application", 9 | "type": "string", 10 | "x-prompt": "What apllication name would you like to pick?" 11 | }, 12 | "includeQueue": { 13 | "type": "boolean", 14 | "description": "Enable queue configuration? (only with deployment enabled)", 15 | "x-prompt": "Enable queue configuration? (only with deployment enabled)" 16 | }, 17 | "includeRedis": { 18 | "type": "boolean", 19 | "description": "Enable redis configuration? (only with deployment enabled)", 20 | "x-prompt": "Enable redis configuration? (only with deployment enabled)" 21 | }, 22 | "includeDatabase": { 23 | "type": "boolean", 24 | "description": "Enable database configuration? (only with deployment enabled)", 25 | "x-prompt": "Enable database configuration? (only with deployment enabled)" 26 | } 27 | }, 28 | "required": [ 29 | "applicationName" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-library-generator/generator.spec.ts: -------------------------------------------------------------------------------- 1 | import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; 2 | import { Tree, readProjectConfiguration } from '@nx/devkit'; 3 | 4 | import appLibraryGenerator from './generator'; 5 | import applicationGenerator from '../app-generator/generator'; 6 | import { AppLibraryGeneratorSchema } from './schema'; 7 | 8 | const defaultAppLibrarySchema: AppLibraryGeneratorSchema = { 9 | applicationName: 'api-test', 10 | libraryName: 'lib', 11 | }; 12 | 13 | describe('Application library generator', () => { 14 | let tree: Tree; 15 | 16 | beforeEach(() => { 17 | tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); 18 | }); 19 | 20 | it('should fail generating lib because application does not exist', async () => { 21 | expect( 22 | appLibraryGenerator(tree, defaultAppLibrarySchema) 23 | ).rejects.toThrowError(); 24 | }); 25 | 26 | it('should generate application library', async () => { 27 | await applicationGenerator(tree, { 28 | applicationName: 'test', 29 | includeDatabase: false, 30 | includeQueue: false, 31 | }); 32 | 33 | await appLibraryGenerator(tree, defaultAppLibrarySchema); 34 | 35 | const config = readProjectConfiguration( 36 | tree, 37 | `${defaultAppLibrarySchema.applicationName}-${defaultAppLibrarySchema.libraryName}` 38 | ); 39 | 40 | expect(config).toBeDefined(); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-library-generator/generator.ts: -------------------------------------------------------------------------------- 1 | import { GeneratorCallback, readProjectConfiguration, Tree } from '@nx/devkit'; 2 | import { AppLibraryGeneratorSchema } from './schema'; 3 | import { libraryGenerator } from '../library-generator/generator'; 4 | 5 | export default async function appLibraryGenerator( 6 | tree: Tree, 7 | { applicationName, libraryName }: AppLibraryGeneratorSchema 8 | ): Promise { 9 | const config = readProjectConfiguration(tree, applicationName); 10 | 11 | if (config.projectType !== 'application') { 12 | throw new Error('Selected application does not exist.'); 13 | } 14 | 15 | return libraryGenerator(tree, { 16 | libraryName: libraryName, 17 | libraryType: 'API', 18 | projectName: applicationName.replace('api-', ''), 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-library-generator/schema.d.ts: -------------------------------------------------------------------------------- 1 | export interface AppLibraryGeneratorSchema { 2 | applicationName: string; 3 | libraryName: string; 4 | } 5 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/app-library-generator/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema", 3 | "$id": "AppLibraryGeneratorPlugin", 4 | "title": "", 5 | "type": "object", 6 | "properties": { 7 | "applicationName": { 8 | "description": "The application project to target", 9 | "type": "string", 10 | "$default": { 11 | "$source": "projectName" 12 | }, 13 | "x-prompt": "What apllication would you like to target?" 14 | }, 15 | "libraryName": { 16 | "type": "string", 17 | "description": "", 18 | "x-prompt": "What util name would you like to use?" 19 | } 20 | }, 21 | "required": [ 22 | "applicationName", 23 | "libraryName" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/.github/workflows/check.yaml: -------------------------------------------------------------------------------- 1 | name: Check 2 | 3 | on: 4 | pull_request: 5 | types: 6 | - 'ready_for_review' 7 | 8 | env: 9 | BASE_BRANCH_NAME: main 10 | 11 | jobs: 12 | check: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | with: 17 | fetch-depth: 0 18 | - uses: nrwl/nx-set-shas@v3 19 | with: 20 | main-branch-name: ${{ env.BASE_BRANCH_NAME }} 21 | - uses: FurlanLuka/microservice-stack/.github/actions/install-dependencies@main 22 | name: Install dependencies 23 | - run: npx nx workspace-lint 24 | - run: npx nx affected --target=lint --parallel=3 --base=origin/${{ env.BASE_BRANCH_NAME }} 25 | - run: npx nx affected --target=test --parallel=3 --ci --code-coverage --base=origin/${{ env.BASE_BRANCH_NAME }} 26 | - run: npx nx affected --target=build --parallel=3 --base=origin/${{ env.BASE_BRANCH_NAME }} 27 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/Dockerfile.prebuild: -------------------------------------------------------------------------------- 1 | FROM node:18-alpine 2 | 3 | WORKDIR /service 4 | 5 | COPY node_modules/ /service/node_modules 6 | COPY package-lock.json package.json /service/ 7 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/charts/ingress-controller/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/charts/ingress-controller/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: ingress-controller 3 | description: Base chart for ingress controller 4 | type: application 5 | version: 0.0.1 6 | appVersion: '0.0.1' 7 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/charts/ingress-controller/templates/ingress-controller.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | namespace: default 5 | name: ingress-controller 6 | annotations: 7 | {{- if eq .Values.environment "local" }} 8 | kubernetes.io/ingress.class: nginx 9 | {{- else }} 10 | alb.ingress.kubernetes.io/group.name: ingress-controller 11 | kubernetes.io/ingress.class: alb 12 | alb.ingress.kubernetes.io/scheme: internet-facing 13 | alb.ingress.kubernetes.io/ssl-redirect: '443' 14 | alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS": 443}]' 15 | alb.ingress.kubernetes.io/healthcheck-path: /health 16 | alb.ingress.kubernetes.io/healthcheck-interval-seconds: '10' 17 | alb.ingress.kubernetes.io/certificate-arn: {{ .Values.productionConfig.sslCertificateArn }} 18 | {{- end }} 19 | spec: 20 | rules: 21 | {{- if eq .Values.environment "local"}} 22 | - http: 23 | {{- else }} 24 | - host: {{ .Values.productionConfig.domain }} 25 | http: 26 | {{- end }} 27 | paths: 28 | {{- range $endpoints := .Values.endpoints }} 29 | - path: {{ $endpoints.path }} 30 | pathType: Prefix 31 | backend: 32 | service: 33 | name: {{ $endpoints.serviceName }} 34 | port: 35 | number: 80 36 | {{- end }} 37 | {{- if .Values.websocketConfig.enabled }} 38 | {{- if eq .Values.environment "local"}} 39 | - http: 40 | {{- else }} 41 | - host: {{ .Values.websocketConfig.domain }} 42 | http: 43 | {{- end }} 44 | paths: 45 | - path: '/ws' 46 | pathType: Prefix 47 | backend: 48 | service: {{ .Values.websocketConfig.websocketServiceName }} 49 | port: 50 | number: 80 51 | {{- end}} -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/charts/ingress-controller/values.yaml: -------------------------------------------------------------------------------- 1 | ## Environment name 2 | environment: "local" 3 | 4 | productionConfig: 5 | ## Api domain name used in production (api.example.com) 6 | domain: '' 7 | ## SSL certificate arn 8 | sslCertificateArn: '' 9 | 10 | websocketConfig: 11 | ## Is websocket enabled 12 | enabled: false 13 | ## Websocket domain name (ws.example.com) 14 | domain: '' 15 | ## Name of the service that handles websocket connections 16 | websocketServiceName: '' 17 | 18 | # List of endpoints mapped to the service name 19 | endpoints: 20 | - serviceName: 'override' 21 | path: '/' -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/charts/node-service/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/charts/node-service/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: node-service-deployment 3 | description: Base chart for node service deployment 4 | type: application 5 | version: 0.0.1 6 | appVersion: '0.0.1' 7 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/charts/node-service/values.yaml: -------------------------------------------------------------------------------- 1 | ## Environment name 2 | environment: "local" 3 | 4 | ## Docker image name set in CI 5 | image: '' 6 | ## Docker image version set in CI 7 | version: '' 8 | 9 | service: 10 | ## Service name. Service name MUST be specified by each service 11 | name: '' 12 | ## Service start / entrypoint command 13 | command: "node service/main.js" 14 | 15 | ## Minimum number of replicas 16 | replicas: 1 17 | 18 | resources: 19 | request: 20 | memory: "256Mi" 21 | cpu: '250m' 22 | limits: 23 | memory: "292Mi" 24 | 25 | autoscaling: 26 | ## Enable autoscaling. In case this is set as false, no autoscaling rules will be applied 27 | enabled: true 28 | ## Autoscaling when memory consumption hits 80% 29 | memory: true 30 | ## Autoscaling when cpu consumption hits 80% 31 | cpu: true 32 | ## Maximum number of replicas 33 | maxReplicas: 3 34 | 35 | secrets: 36 | enabled: false 37 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/cloud/.gitignore: -------------------------------------------------------------------------------- 1 | .terraform* 2 | terraform* 3 | outputs/ -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/cloud/modules/certificate_manager/main.tf: -------------------------------------------------------------------------------- 1 | module "acm" { 2 | source = "terraform-aws-modules/acm/aws" 3 | version = "~> 4.0" 4 | 5 | domain_name = var.domain 6 | zone_id = var.zone_id 7 | 8 | subject_alternative_names = [ 9 | "*.${var.domain}", 10 | ] 11 | 12 | wait_for_validation = true 13 | 14 | tags = { 15 | Name = var.domain 16 | } 17 | } -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/cloud/modules/certificate_manager/outputs.tf: -------------------------------------------------------------------------------- 1 | output "acm_certificate_arn" { 2 | value = module.acm.acm_certificate_arn 3 | } -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/cloud/modules/certificate_manager/variables.tf: -------------------------------------------------------------------------------- 1 | variable "domain" { 2 | type = string 3 | } 4 | 5 | variable "zone_id" { 6 | type = string 7 | } -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/cloud/modules/container_repository/main.tf: -------------------------------------------------------------------------------- 1 | resource "aws_ecr_repository" "container_repository" { 2 | name = "${var.environment_name}_container_repository" 3 | 4 | image_tag_mutability = "IMMUTABLE" 5 | } 6 | 7 | resource "aws_ecr_lifecycle_policy" "container_repository_lifecycle_policy" { 8 | repository = aws_ecr_repository.container_repository.name 9 | 10 | policy = jsonencode({ 11 | rules : [ 12 | { 13 | rulePriority : 1, 14 | description : "Lifecycle policy", 15 | selection : { 16 | tagStatus : "any", 17 | countType : "sinceImagePushed", 18 | countUnit : "days", 19 | countNumber : 14 20 | }, 21 | action : { 22 | type : "expire" 23 | } 24 | } 25 | ] 26 | }) 27 | } 28 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/cloud/modules/container_repository/outputs.tf: -------------------------------------------------------------------------------- 1 | output "container_repository_arn" { 2 | value = aws_ecr_repository.container_repository.arn 3 | } -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/cloud/modules/container_repository/variables.tf: -------------------------------------------------------------------------------- 1 | variable "environment_name" { 2 | type = string 3 | } 4 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/cloud/modules/eks/outputs.tf: -------------------------------------------------------------------------------- 1 | output "host" { 2 | value = module.eks.cluster_endpoint 3 | } 4 | 5 | output "cluster_ca_certificate" { 6 | value = base64decode(module.eks.cluster_certificate_authority_data) 7 | } 8 | 9 | output "name" { 10 | value = module.eks.cluster_name 11 | } 12 | 13 | output "cluster_arn" { 14 | value = module.eks.cluster_arn 15 | } -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/cloud/modules/eks/variables.tf: -------------------------------------------------------------------------------- 1 | variable "cluster_name" { 2 | type = string 3 | } 4 | 5 | variable "acm_certificate_arn" { 6 | type = string 7 | } 8 | 9 | variable "vpc_id" { 10 | type = string 11 | } 12 | 13 | variable "vpc_private_subnets" {} 14 | 15 | variable "aws_auth_users" { 16 | default = [] 17 | } 18 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/cloud/modules/helm/variables.tf: -------------------------------------------------------------------------------- 1 | variable "host" { 2 | type = string 3 | } 4 | 5 | variable "cluster_ca_certificate" { 6 | type = string 7 | } 8 | 9 | variable "name" { 10 | type = string 11 | } 12 | 13 | variable "environment_name" { 14 | type = string 15 | } 16 | 17 | variable "domain" { 18 | type = string 19 | } 20 | 21 | variable "acm_certificate_arn" { 22 | type = string 23 | } 24 | 25 | variable "deploy_rabbitmq" { 26 | type = bool 27 | } 28 | 29 | variable "deploy_redis" { 30 | type = bool 31 | } -------------------------------------------------------------------------------- /libs/workspace/src/generators/configuration-generator/files/infrastructure/cloud/modules/iam/outputs.tf: -------------------------------------------------------------------------------- 1 | resource "local_file" "iam_user_credentials" { 2 | count = var.output_secrets ? 1 : 0 3 | 4 | filename = "${path.root}/outputs/iam_user_credentials.json" 5 | content = < { 18 | const workspace = getWorkspaceLayout(tree); 19 | 20 | const tags: string[] = []; 21 | 22 | if (libraryType === 'API') { 23 | tags.push(`scope:api:lib:${projectName}`); 24 | } else if (libraryType === 'UTIL') { 25 | tags.push(`scope:api:lib:util:${libraryName}`, `scope:api:lib:util`); 26 | } 27 | 28 | const nestLibraryGeneratorTask = await nestLibraryGenerator(tree, { 29 | name: libraryName, 30 | standaloneConfig: true, 31 | buildable: false, 32 | controller: false, 33 | directory: `api/${projectName}`, 34 | importPath: `@${workspace.npmScope}/api/${projectName}/${libraryName}`, 35 | linter: Linter.EsLint, 36 | service: false, 37 | publishable: false, 38 | tags: tags.join(','), 39 | }); 40 | 41 | const libraryRoot: string = joinPathFragments( 42 | workspace.libsDir, 43 | `api/${projectName}/${libraryName}` 44 | ); 45 | 46 | deleteFiles(tree, `${libraryRoot}/src/lib`); 47 | createFiles(tree, libraryRoot, libraryName); 48 | 49 | return runTasksInSerial(nestLibraryGeneratorTask); 50 | } 51 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/library-generator/lib/create-files.ts: -------------------------------------------------------------------------------- 1 | import { generateFiles, joinPathFragments, Tree } from '@nx/devkit'; 2 | 3 | export function createFiles( 4 | tree: Tree, 5 | libraryRoot: string, 6 | libraryName: string 7 | ) { 8 | generateFiles( 9 | tree, 10 | joinPathFragments(__dirname, '..', 'files'), 11 | joinPathFragments(libraryRoot, 'src'), 12 | { 13 | tmpl: '', 14 | libraryName, 15 | } 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/library-generator/schema.d.ts: -------------------------------------------------------------------------------- 1 | export interface LibraryGeneratorSchema { 2 | projectName: string; 3 | libraryName: string; 4 | libraryType: 'API' | 'UTIL'; 5 | } 6 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/migration-generator/files/src/migrations.ts.template: -------------------------------------------------------------------------------- 1 | <% for(let x = 0; x < migrations.length; x++) { %>import { <%= migrations[x] %> } from './migrations/<%= migrations[x] %>'; 2 | <% } %> 3 | export const migrations = [ 4 | <% for(let x = 0; x < migrations.length; x++) { %><%= migrations[x] %>, 5 | <% } %>] -------------------------------------------------------------------------------- /libs/workspace/src/generators/migration-generator/schema.d.ts: -------------------------------------------------------------------------------- 1 | export interface TypeormMigrationGeneratorSchema { 2 | applicationName: string; 3 | migrations?: string[]; 4 | } 5 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/migration-generator/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema", 3 | "$id": "TypeormMigrationGenerator", 4 | "title": "", 5 | "type": "object", 6 | "properties": { 7 | "applicationName": { 8 | "description": "The application to target", 9 | "type": "string", 10 | "$default": { 11 | "$source": "projectName" 12 | }, 13 | "x-prompt": "What application would you like to target?" 14 | } 15 | }, 16 | "required": [ 17 | "applicationName" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/util-library-generator/generator.spec.ts: -------------------------------------------------------------------------------- 1 | import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; 2 | import { Tree, readProjectConfiguration } from '@nx/devkit'; 3 | 4 | import utilLibraryGenerator from './generator'; 5 | import { UtilLibraryGeneratorSchema } from './schema'; 6 | 7 | const defaultSchema: UtilLibraryGeneratorSchema = { 8 | libraryName: 'test', 9 | }; 10 | 11 | describe('Util library generator', () => { 12 | let tree: Tree; 13 | 14 | beforeEach(() => { 15 | tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); 16 | }); 17 | 18 | it('should generate util type lib', async () => { 19 | await utilLibraryGenerator(tree, defaultSchema); 20 | 21 | const config = readProjectConfiguration( 22 | tree, 23 | `api-utils-${defaultSchema.libraryName}` 24 | ); 25 | 26 | expect(config).toBeDefined(); 27 | 28 | expect(config.tags).toStrictEqual([ 29 | `scope:api:lib:util:${defaultSchema.libraryName}`, 30 | `scope:api:lib:util`, 31 | ]); 32 | 33 | expect( 34 | tree.exists(`libs/api/utils/${defaultSchema.libraryName}/src/index.ts`) 35 | ).toBeTruthy(); 36 | 37 | expect( 38 | tree.children(`libs/api/utils/${defaultSchema.libraryName}/src`).length 39 | ).toStrictEqual(1); 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/util-library-generator/generator.ts: -------------------------------------------------------------------------------- 1 | import { GeneratorCallback, Tree } from '@nx/devkit'; 2 | import { UtilLibraryGeneratorSchema } from './schema'; 3 | import { libraryGenerator } from '../library-generator/generator'; 4 | 5 | export default async function utilLibraryGenerator( 6 | tree: Tree, 7 | { libraryName }: UtilLibraryGeneratorSchema 8 | ): Promise { 9 | return libraryGenerator(tree, { 10 | libraryName, 11 | libraryType: 'UTIL', 12 | projectName: 'utils', 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/util-library-generator/schema.d.ts: -------------------------------------------------------------------------------- 1 | export interface UtilLibraryGeneratorSchema { 2 | libraryName: string; 3 | } 4 | -------------------------------------------------------------------------------- /libs/workspace/src/generators/util-library-generator/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/schema", 3 | "$id": "UtilLibraryGeneratorPlugin", 4 | "title": "", 5 | "type": "object", 6 | "properties": { 7 | "libraryName": { 8 | "type": "string", 9 | "description": "", 10 | "$default": { 11 | "$source": "argv", 12 | "index": 0 13 | }, 14 | "x-prompt": "What util name would you like to use?" 15 | } 16 | }, 17 | "required": [ 18 | "libraryName" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /libs/workspace/src/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FurlanLuka/microservice-stack/994591d35ef9460f919f2d001a99cad539853798/libs/workspace/src/index.ts -------------------------------------------------------------------------------- /libs/workspace/src/utils/delete-files.ts: -------------------------------------------------------------------------------- 1 | import { Tree } from '@nx/devkit'; 2 | 3 | export function deleteFiles(tree: Tree, path: string): void { 4 | const files = tree.children(path); 5 | 6 | files.forEach((file) => tree.delete(`${path}/${file}`)); 7 | } 8 | -------------------------------------------------------------------------------- /libs/workspace/src/utils/package-versions.ts: -------------------------------------------------------------------------------- 1 | export const TYPEORM_VERSION = '0.3.17'; 2 | export const PG_VERSION = '8.11.1'; 3 | export const NESTJS_TYPEORM_VERSION = '10.0.0'; 4 | export const MICROSERVICE_STACK_VERSION = '0.1.56'; 5 | export const CLASS_TRANSFORMER_VERSION = '0.5.1'; 6 | export const CLASS_VALIDATOR_VERSION = '0.14.0'; 7 | -------------------------------------------------------------------------------- /libs/workspace/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | }, 6 | "files": [], 7 | "include": [], 8 | "references": [ 9 | { 10 | "path": "./tsconfig.lib.json" 11 | }, 12 | { 13 | "path": "./tsconfig.spec.json" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /libs/workspace/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "declaration": true, 6 | "types": ["node"] 7 | }, 8 | "include": ["src/**/*.ts"], 9 | "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /libs/workspace/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"] 7 | }, 8 | "include": [ 9 | "jest.config.ts", 10 | "src/**/*.test.ts", 11 | "src/**/*.spec.ts", 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /nx.json: -------------------------------------------------------------------------------- 1 | { 2 | "tasksRunnerOptions": { 3 | "default": { 4 | "runner": "nx-cloud", 5 | "options": { 6 | "cacheableOperations": ["build", "lint", "test", "e2e"], 7 | "accessToken": "ZTA2MjM1MjgtZjgwOS00MWYyLWI2MWQtYjFlODFhNDdkZTE0fHJlYWQtd3JpdGU=" 8 | } 9 | } 10 | }, 11 | "extends": "nx/presets/core.json", 12 | "$schema": "./node_modules/nx/schemas/nx-schema.json", 13 | "npmScope": "microservice-stack", 14 | "affected": { 15 | "defaultBase": "main" 16 | }, 17 | "cli": { 18 | "defaultCollection": "@nx/workspace" 19 | }, 20 | "targetDefaults": { 21 | "lint": { 22 | "inputs": ["default", "{workspaceRoot}/.eslintrc.json"] 23 | }, 24 | "test": { 25 | "inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"] 26 | }, 27 | "build": { 28 | "inputs": ["production", "^production"] 29 | } 30 | }, 31 | "namedInputs": { 32 | "default": ["{projectRoot}/**/*", "sharedGlobals"], 33 | "sharedGlobals": [], 34 | "production": ["default"] 35 | }, 36 | "workspaceLayout": { 37 | "libsDir": "libs", 38 | "appsDir": "apps" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "microservice-stack", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "scripts": {}, 6 | "private": true, 7 | "devDependencies": { 8 | "@nestjs/schematics": "10.0.1", 9 | "@nestjs/testing": "10.0.4", 10 | "@nrwl/devkit": "16.4.0", 11 | "@nrwl/eslint-plugin-nx": "16.4.0", 12 | "@nrwl/jest": "16.4.0", 13 | "@nrwl/js": "16.4.0", 14 | "@nrwl/linter": "16.4.0", 15 | "@nrwl/nest": "16.4.0", 16 | "@nrwl/nx-plugin": "16.4.0", 17 | "@nrwl/workspace": "16.4.0", 18 | "@swc-node/register": "^1.5.5", 19 | "@swc/cli": "0.1.62", 20 | "@swc/core": "^1.3.28", 21 | "@types/jest": "29.5.2", 22 | "@types/node": "20.3.2", 23 | "@types/winston": "^2.4.4", 24 | "@typescript-eslint/eslint-plugin": "5.60.1", 25 | "@typescript-eslint/parser": "5.60.1", 26 | "chalk": "4.1.2", 27 | "clear": "^0.1.0", 28 | "commander": "^11.0.0", 29 | "eslint": "~8.43.0", 30 | "eslint-config-prettier": "8.8.0", 31 | "jest": "29.5.0", 32 | "jest-environment-jsdom": "29.5.0", 33 | "jsonc-eslint-parser": "^2.3.0", 34 | "nx": "16.4.0", 35 | "prettier": "^2.8.8", 36 | "ts-jest": "29.1.0", 37 | "ts-node": "10.9.1", 38 | "typescript": "~5.1.6", 39 | "util": "^0.12.5", 40 | "nx-cloud": "16.0.5" 41 | }, 42 | "dependencies": { 43 | "@golevelup/nestjs-discovery": "^3.0.0", 44 | "@golevelup/nestjs-rabbitmq": "^3.6.1", 45 | "@nestjs/common": "10.0.4", 46 | "@nestjs/config": "^3.0.0", 47 | "@nestjs/core": "10.0.4", 48 | "@nestjs/platform-express": "10.0.4", 49 | "@nestjs/platform-fastify": "^10.0.4", 50 | "@swc/helpers": "0.5.1", 51 | "amqp-connection-manager": "^4.1.13", 52 | "amqplib": "^0.10.3", 53 | "class-transformer": "^0.5.1", 54 | "class-validator": "^0.14.0", 55 | "ioredis": "^5.3.0", 56 | "nest-winston": "^1.8.0", 57 | "reflect-metadata": "^0.1.13", 58 | "rxjs": "^7.8.1", 59 | "tslib": "^2.6.0", 60 | "typeorm": "^0.3.17", 61 | "uuid": "^9.0.0", 62 | "winston": "^3.8.2" 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /tools/tsconfig.tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "../dist/out-tsc/tools", 5 | "rootDir": ".", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": ["node"], 9 | "importHelpers": false 10 | }, 11 | "include": ["**/*.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "rootDir": ".", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "importHelpers": true, 11 | "target": "es2015", 12 | "module": "esnext", 13 | "lib": ["es2017", "dom"], 14 | "skipLibCheck": true, 15 | "skipDefaultLibCheck": true, 16 | "baseUrl": ".", 17 | "paths": { 18 | "@microservice-stack/local-deployment": [ 19 | "libs/local-deployment/src/index.ts" 20 | ], 21 | "@microservice-stack/nest-application": [ 22 | "libs/nest-application/src/index.ts" 23 | ], 24 | "@microservice-stack/nest-config": ["libs/nest-config/src/index.ts"], 25 | "@microservice-stack/nest-health": ["libs/nest-health/src/index.ts"], 26 | "@microservice-stack/nest-rabbitmq": ["libs/nest-rabbitmq/src/index.ts"], 27 | "@microservice-stack/nest-redis": ["libs/nest-redis/src/index.ts"], 28 | "@microservice-stack/nest-typeorm-migrations": [ 29 | "libs/nest-typeorm-migrations/src/index.ts" 30 | ], 31 | "@microservice-stack/npx-build": ["libs/npx-build/src/index.ts"], 32 | "@microservice-stack/workspace": ["libs/workspace/src/index.ts"] 33 | } 34 | }, 35 | "exclude": ["node_modules", "tmp"] 36 | } 37 | --------------------------------------------------------------------------------