Skip to content
Snippets Groups Projects
Unverified Commit 18d9298c authored by Konstantin Tsabolov's avatar Konstantin Tsabolov
Browse files

chore: remove principal-manager service

parent be89b5b8
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
import { ecsFormat } from '@elastic/ecs-winston-format';
import { existsSync, mkdirSync } from 'fs';
import winston, { Logger } from 'winston';
import { LoggerConfig } from '../common/constants.js';
if (!existsSync(LoggerConfig.lOG_DIR)) {
mkdirSync(LoggerConfig.lOG_DIR);
}
const logger: Logger = winston.createLogger({
format: ecsFormat({ convertReqRes: true }),
transports: [new winston.transports.Console()],
});
logger.on('error', (error) => {
console.error('Error in logger caught', error);
});
export default logger;
import { connect, NatsConnection, StringCodec } from 'nats';
const sc = StringCodec();
export default class Nats {
private static nc: NatsConnection | null = null;
public static async initialize(natsConfig: {
servers: Array<string> | string;
name: string;
}): Promise<NatsConnection | null> {
this.nc = await connect(natsConfig);
return this.nc;
}
public static async publish(subject: string, payload: string) {
if (this.nc) {
this.nc.publish(subject, sc.encode(payload));
} else {
throw new Error('Initialize Nats First!!');
}
}
public static async subscribe(
subject: string,
cb: (...args: unknown[]) => unknown,
) {
if (this.nc) {
const sub = this.nc.subscribe(subject);
(async () => {
// airbnb rule for this lint is outdated
// eslint-disable-next-line
for await (const m of sub) {
cb(sc.decode(m.data));
}
})();
} else {
throw new Error('Initialize Nats First!!');
}
}
}
./node_modules/.bin/prisma db push --schema=./prisma/schema.prisma && node dist/src/main.js
\ No newline at end of file
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import AppModule from '@src/app.module';
describe('AppController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () =>
request(app.getHttpServer()).get('/').expect(200).expect('Hello World!'));
});
/** @type {import('jest').Config} */
import config from '../jest.config.js';
export default {
...config,
rootDir: '.',
testRegex: '.*\\.e2e-spec\\.ts$',
};
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"removeComments": false,
"declaration": true,
"sourceMap": true,
"incremental": true,
"outDir": "./dist",
"baseUrl": "./",
"rootDir": "./src"
},
"include": ["src"],
"exclude": ["node_modules", "./dist/**/*"]
}
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