xcally-nest-library 0.0.21 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,32 +1,11 @@
1
1
  {
2
2
  "name": "xcally-nest-library",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "author": "",
8
8
  "license": "UNLICENSED",
9
- "scripts": {
10
- "bump:patch": "npm version patch -m \"Bump version to %s\"",
11
- "prepublishOnly": "npm run build",
12
- "build": "tsc",
13
- "build:watch": "rimraf dist && tsc-watch -b -v",
14
- "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
15
- "prettier:check": "prettier --check ./**/*.{ts,js,json,*rc}",
16
- "prettier:write": "prettier --write ./**/*.{ts,js,json,*rc}",
17
- "start": "nest start",
18
- "start:dev": "nest start --watch",
19
- "start:debug": "nest start --debug --watch",
20
- "start:prod": "node dist/main",
21
- "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
22
- "test": "jest",
23
- "test:watch": "jest --watch",
24
- "test:cov": "jest --coverage",
25
- "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
26
- "test:e2e": "jest --config ./test/jest-e2e.json",
27
- "lib:link": "pnpm link --global",
28
- "lib:unlink": "pnpm unlink xcally-nest-libs --global"
29
- },
30
9
  "dependencies": {
31
10
  "@nestjs/axios": "^3.0.2",
32
11
  "@nestjs/common": "^10.3.7",
@@ -91,5 +70,25 @@
91
70
  ],
92
71
  "coverageDirectory": "../coverage",
93
72
  "testEnvironment": "node"
73
+ },
74
+ "scripts": {
75
+ "bump:patch": "npm version patch -m \"Bump version to %s\"",
76
+ "build": "tsc",
77
+ "build:watch": "rimraf dist && tsc-watch -b -v",
78
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
79
+ "prettier:check": "prettier --check ./**/*.{ts,js,json,*rc}",
80
+ "prettier:write": "prettier --write ./**/*.{ts,js,json,*rc}",
81
+ "start": "nest start",
82
+ "start:dev": "nest start --watch",
83
+ "start:debug": "nest start --debug --watch",
84
+ "start:prod": "node dist/main",
85
+ "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
86
+ "test": "jest",
87
+ "test:watch": "jest --watch",
88
+ "test:cov": "jest --coverage",
89
+ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
90
+ "test:e2e": "jest --config ./test/jest-e2e.json",
91
+ "lib:link": "pnpm link --global",
92
+ "lib:unlink": "pnpm unlink xcally-nest-libs --global"
94
93
  }
95
- }
94
+ }
@@ -51,7 +51,7 @@ import { LoggerService } from './logger.service';
51
51
  // },
52
52
  // },
53
53
  {
54
- level: 'info',
54
+ level: config.get('LOG_LEVEL') || 'info',
55
55
  target: 'pino/file',
56
56
  options: {
57
57
  destination: `./logs/${projectName}-info.log`,
@@ -41,4 +41,10 @@ export class LoggerService {
41
41
 
42
42
  this.logger.info({ meta }, msg);
43
43
  }
44
+
45
+ trace(msg: string, meta?: any): void {
46
+ const activeSpan = api.trace.getSpan(api.context.active());
47
+ activeSpan.addEvent(msg);
48
+ this.logger.trace({ meta }, msg);
49
+ }
44
50
  }
@@ -1,18 +0,0 @@
1
- import { Repository, EntityTarget, EntityManager, FindOptionsWhere, ObjectLiteral, DeepPartial } from 'typeorm';
2
- import { PaginateConfig, PaginateQuery, Paginated } from 'nestjs-paginate';
3
- import { IGenericRepository, IId } from './generic.repository.interface';
4
- export declare class GenericRepository<E extends ObjectLiteral> implements IGenericRepository<E> {
5
- private readonly entityManager;
6
- protected repository: Repository<E>;
7
- protected paginateConfig: PaginateConfig<E>;
8
- constructor(entityManager: EntityManager, entity: EntityTarget<E>, paginateConfig: PaginateConfig<E>);
9
- getMany(query: PaginateQuery): Promise<Paginated<E>>;
10
- save<T extends DeepPartial<E>>(entity: T): Promise<E>;
11
- update<T extends DeepPartial<E> & IId>(dto: T): Promise<E>;
12
- count(options: FindOptionsWhere<E>): Promise<number>;
13
- findAll(): Promise<E[]>;
14
- countAll(): Promise<number>;
15
- findById(id: number): Promise<E>;
16
- remove(id: number): Promise<void>;
17
- remove2(id: number): Promise<void>;
18
- }
@@ -1,15 +0,0 @@
1
- import { PaginateQuery, Paginated } from 'nestjs-paginate';
2
- import { DeepPartial, FindOptionsWhere } from 'typeorm';
3
- export interface IId {
4
- id: number;
5
- }
6
- export interface IGenericRepository<E> {
7
- getMany(query: PaginateQuery): Promise<Paginated<E>>;
8
- save<T extends DeepPartial<E>>(entity: T): Promise<E>;
9
- update<T extends DeepPartial<E> & IId>(dto: T): Promise<E>;
10
- count(options: FindOptionsWhere<E>): Promise<number>;
11
- findAll(): Promise<E[]>;
12
- countAll(): Promise<number>;
13
- findById(id: number): Promise<E>;
14
- remove(id: number): Promise<void>;
15
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generic.repository.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generic.repository.interface.js","sourceRoot":"","sources":["../../../../src/db/typeorm/generic.repository.interface.ts"],"names":[],"mappings":""}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GenericRepository = void 0;
4
- const typeorm_1 = require("typeorm");
5
- const nestjs_paginate_1 = require("nestjs-paginate");
6
- class GenericRepository {
7
- constructor(entityManager, entity, paginateConfig) {
8
- this.entityManager = entityManager;
9
- this.repository = this.entityManager.getRepository(entity);
10
- this.paginateConfig = paginateConfig;
11
- }
12
- getMany(query) {
13
- return (0, nestjs_paginate_1.paginate)(query, this.repository, this.paginateConfig);
14
- }
15
- save(entity) {
16
- const res = this.repository.create({ ...entity });
17
- return this.repository.save(res);
18
- }
19
- async update(dto) {
20
- const entityUpdated = await this.repository.update(dto.id, dto);
21
- if (!entityUpdated.affected) {
22
- return undefined;
23
- }
24
- return this.repository.findOneBy({ id: (0, typeorm_1.Equal)(dto.id) });
25
- }
26
- count(options) {
27
- return this.repository.count(options);
28
- }
29
- findAll() {
30
- return this.repository.find();
31
- }
32
- countAll() {
33
- return this.repository.count();
34
- }
35
- async findById(id) {
36
- return await this.repository.findOneBy({
37
- id: (0, typeorm_1.Equal)(id),
38
- });
39
- }
40
- async remove(id) {
41
- await this.repository.delete(id);
42
- }
43
- async remove2(id) {
44
- await this.repository.delete(id);
45
- }
46
- }
47
- exports.GenericRepository = GenericRepository;
48
- //# sourceMappingURL=generic.repository.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generic.repository.js","sourceRoot":"","sources":["../../../../src/db/typeorm/generic.repository.ts"],"names":[],"mappings":";;;AAAA,qCAAuH;AACvH,qDAAqF;AAMrF,MAAa,iBAAiB;IAI5B,YACmB,aAA4B,EAC7C,MAAuB,EACvB,cAAiC;QAFhB,kBAAa,GAAb,aAAa,CAAe;QAI7C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAOD,OAAO,CAAC,KAAoB;QAC1B,OAAO,IAAA,0BAAQ,EAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC/D,CAAC;IAOD,IAAI,CAA2B,MAAS;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IASD,KAAK,CAAC,MAAM,CAAiC,GAAM;QACjD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,GAAU,CAAC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