Skip to content
Snippets Groups Projects
Commit 3688dcb7 authored by Konstantin Tsabolov's avatar Konstantin Tsabolov
Browse files

Merge branch 'shared-utility' into 'main'

formatted code and created shared utility package

See merge request !1
parents 8045186e d074342b
No related branches found
No related tags found
2 merge requests!9feat(ssi): Establish a trusted connection with yourself,!8Project house-keeping, refactoring and reorganizing
Showing
with 181 additions and 21 deletions
......@@ -28,7 +28,10 @@ module.exports = {
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: false, variables: true }],
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false, classes: false, variables: true },
],
'@typescript-eslint/explicit-member-accessibility': 'error',
'no-console': 'error',
'@typescript-eslint/ban-ts-comment': 'warn',
......@@ -72,14 +75,10 @@ module.exports = {
},
overrides: [
{
files: [
'*.spec.ts',
'*.e2e-spec.ts',
'**/tests/**',
],
files: ['*.spec.ts', '*.e2e-spec.ts', '**/tests/**'],
env: {
jest: true,
node: false,
node: true,
},
rules: {
'import/no-extraneous-dependencies': [
......@@ -89,6 +88,6 @@ module.exports = {
},
],
},
}
]
}
},
],
};
{
"name": "attestation-manager",
"name": "@ocm/attestation-manager",
"version": "0.0.1",
"description": "",
"author": "Shirdhar",
......
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.json"
}
{
"name": "connection-manager",
"name": "@ocm/connection-manager",
"version": "0.0.1",
"description": "",
"author": "Sagar",
......
{
"name": "proof-manager",
"name": "@ocm/proof-manager",
"version": "0.0.1",
"description": "The Proof Manager provides an endpoint to request a presentation over an existing connection",
"author": "Sagar",
......
{
"jsc": {
"preserveAllComments": true,
"parser": {
"syntax": "typescript",
"tsx": false,
"decorators": true
},
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
},
"target": "es2022"
},
"module": {
"type": "es6"
},
"sourceMaps": true,
"exclude": [".spec.ts", ".e2e-spec.ts"]
}
/** @type {import('jest').Config} */
import { readFileSync } from 'node:fs';
const swcConfig = JSON.parse(readFileSync('./.swcrc', 'utf8'));
export default {
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
transform: {
'^.+\\.ts$': [
'@swc/jest',
{
...swcConfig,
sourceMaps: false,
exclude: [],
swcrc: false,
},
],
},
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
// ESM modules require `.js` extension to be specified, but Jest doesn't work with them
// Removing `.js` extension from module imports
'^uuid$': 'uuid',
'^(.*)/(.*)\\.js$': '$1/$2',
},
collectCoverageFrom: ['src/**/*.(t|j)s'],
coverageReporters:
process.env.CI === 'true'
? ['text-summary', 'json-summary']
: ['text-summary', 'html'],
coveragePathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/test/',
'<rootDir>/coverage/',
'<rootDir>/dist/',
'<rootDir>/**/test',
'@types',
'.dto.(t|j)s',
'.enum.ts',
'.interface.ts',
'.type.ts',
'.spec.ts',
],
coverageDirectory: './coverage',
// With v8 coverage provider it's much faster, but
// with this enabled it's not possible to ignore whole files' coverage
coverageProvider: 'v8',
};
{
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"builder": "swc",
"typeCheck": true
}
}
{
"name": "@ocm/shared",
"version": "0.0.1",
"description": "Shared functionality that can be reused between the services",
"author": "Spherity",
"private": true,
"type": "module",
"license": "Apache-2.0",
"main": "dist/index.js",
"scripts": {
"clean": "rimraf dist *.tsbuildinfo",
"prebuild": "rimraf dist",
"build": "nest build",
"build:production": "nest build -p tsconfig.production.json",
"start": "nest start",
"start:dev": "nest start --watch --preserveWatchOutput",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest.config.js"
},
"dependencies": {
"@aries-framework/core": "0.4.2",
"@elastic/ecs-winston-format": "^1.5.0",
"@nestjs/common": "^10.2.10",
"@nestjs/microservices": "^10.2.10",
"axios": "^1.6.2",
"joi": "^17.6.0",
"nats": "^2.18.0",
"rxjs": "^7.2.0",
"winston": "^3.11.0"
},
"devDependencies": {
"@types/jest": "^29.5.9",
"@types/node": "^20.9.3",
"@nestjs/cli": "^10.2.1",
"@nestjs/testing": "^10.2.10",
"rimraf": "^5.0.5",
"supertest": "^6.1.3",
"ts-jest": "^29.1.1",
"ts-node": "^10.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "~5.3.2"
}
}
......@@ -4,7 +4,6 @@ import type { RpcException } from '@nestjs/microservices';
import { Catch } from '@nestjs/common';
import { throwError } from 'rxjs';
@Catch()
export class ExceptionHandler implements RpcExceptionFilter<RpcException> {
public catch(exception: RpcException) {
......
export * from './exceptions/rpcExceptionHandler.js';
export * from './health/health.controller.js';
export * from './logging/logger.js';
export * from './logging/logAxiosError.js';
import type { AxiosError } from 'axios';
import { logger } from '../../globalUtils/logger.js';
import { logger } from './logger.js';
export function logAxiosError(err: AxiosError) {
if (err.response) {
......
describe('check logger', () => {
it('should return module', async () => {
it('should return module', () => {
jest.requireActual('./logger');
});
});
......@@ -8,6 +8,9 @@ export const logger: Logger = createLogger({
transports: [new transports.Console()],
});
/**
* @todo: disable in production
*/
logger.on('error', (error: Error) => {
// eslint-disable-next-line no-console
console.error('Error in logger caught', error);
......
{
"extends": "./tsconfig.json",
"compilerOptions": {
"removeComments": false,
"declaration": true,
"sourceMap": true,
"incremental": true,
"baseUrl": ".",
"outDir": "./dist",
"rootDir": "./src"
},
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}
{
"extends": "../../tsconfig.json"
}
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": false,
"removeComments": true,
"declaration": false,
"sourceMap": false,
"baseUrl": ".",
"outDir": "./dist",
"rootDir": "./src"
},
"exclude": ["node_modules", "dist", "**/*spec.ts"]
}
......@@ -3,8 +3,6 @@
"sourceRoot": "src",
"compilerOptions": {
"builder": "swc",
"typeCheck": true,
"assets": ["**/*.prisma"]
"typeCheck": true
}
}
{
"name": "ssi-abstraction",
"name": "@ocm/ssi-abstraction",
"version": "0.0.1",
"description": "A core OCM service that provides the SSI interface through REST endpoints and events.",
"author": "Vereign",
......@@ -36,6 +36,7 @@
"@nestjs/core": "^10.2.10",
"@nestjs/microservices": "^10.2.10",
"@nestjs/terminus": "^10.1.1",
"@ocm/shared": "workspace:*",
"axios": "^1.6.2",
"express": "^4.17.3",
"joi": "^17.6.0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment