@flusys/nestjs-shared 5.0.0 → 5.0.2

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.
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getJsonColumnType", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return getJsonColumnType;
9
+ }
10
+ });
11
+ const _nestjscore = require("@flusys/nestjs-core");
12
+ function getJsonColumnType() {
13
+ const driver = _nestjscore.envConfig.getTypeOrmConfig().type;
14
+ if (driver === 'postgres') return 'jsonb';
15
+ if (driver === 'mysql') return 'json';
16
+ return 'simple-json';
17
+ }
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  _export_star(require("./api-controller.class"), exports);
6
6
  _export_star(require("./api-service.class"), exports);
7
- _export_star(require("./request-scoped-api.service"), exports);
7
+ _export_star(require("./handle-custome-db-column-type"), exports);
8
8
  _export_star(require("./hybrid-cache.class"), exports);
9
+ _export_star(require("./request-scoped-api.service"), exports);
9
10
  _export_star(require("./winston.logger.class"), exports);
10
11
  _export_star(require("../constants/permissions"), exports);
11
12
  function _export_star(from, to) {
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "UserRoot", {
8
8
  return UserRoot;
9
9
  }
10
10
  });
11
+ const _nestjsshared = require("@flusys/nestjs-shared");
11
12
  const _typeorm = require("typeorm");
12
13
  function _define_property(obj, key, value) {
13
14
  if (key in obj) {
@@ -134,7 +135,7 @@ _ts_decorate([
134
135
  ], UserRoot.prototype, "lastLoginAt", void 0);
135
136
  _ts_decorate([
136
137
  (0, _typeorm.Column)({
137
- type: 'json',
138
+ type: (0, _nestjsshared.getJsonColumnType)(),
138
139
  nullable: true,
139
140
  name: 'additional_fields'
140
141
  }),
@@ -0,0 +1 @@
1
+ export declare function getJsonColumnType(): "simple-json" | "json" | "jsonb";
@@ -1,6 +1,7 @@
1
1
  export * from './api-controller.class';
2
2
  export * from './api-service.class';
3
- export * from './request-scoped-api.service';
3
+ export * from './handle-custome-db-column-type';
4
4
  export * from './hybrid-cache.class';
5
+ export * from './request-scoped-api.service';
5
6
  export * from './winston.logger.class';
6
7
  export * from '../constants/permissions';
@@ -0,0 +1,7 @@
1
+ import { envConfig } from '@flusys/nestjs-core';
2
+ export function getJsonColumnType() {
3
+ const driver = envConfig.getTypeOrmConfig().type;
4
+ if (driver === 'postgres') return 'jsonb';
5
+ if (driver === 'mysql') return 'json';
6
+ return 'simple-json';
7
+ }
@@ -1,7 +1,8 @@
1
1
  export * from './api-controller.class';
2
2
  export * from './api-service.class';
3
- export * from './request-scoped-api.service';
3
+ export * from './handle-custome-db-column-type';
4
4
  export * from './hybrid-cache.class';
5
+ export * from './request-scoped-api.service';
5
6
  export * from './winston.logger.class';
6
7
  // Re-export permission constants for convenience
7
8
  export * from '../constants/permissions';
@@ -20,6 +20,7 @@ function _ts_decorate(decorators, target, key, desc) {
20
20
  function _ts_metadata(k, v) {
21
21
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
22
  }
23
+ import { getJsonColumnType } from '@flusys/nestjs-shared';
23
24
  import { Column, CreateDateColumn, DeleteDateColumn, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
24
25
  export class UserRoot {
25
26
  constructor(){
@@ -124,7 +125,7 @@ _ts_decorate([
124
125
  ], UserRoot.prototype, "lastLoginAt", void 0);
125
126
  _ts_decorate([
126
127
  Column({
127
- type: 'json',
128
+ type: getJsonColumnType(),
128
129
  nullable: true,
129
130
  name: 'additional_fields'
130
131
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flusys/nestjs-shared",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "description": "Common shared utilities for Flusys NestJS applications",
5
5
  "main": "cjs/index.js",
6
6
  "module": "fesm/index.js",
@@ -93,7 +93,7 @@
93
93
  }
94
94
  },
95
95
  "peerDependencies": {
96
- "@keyv/redis": "^5.0.0",
96
+ "@keyv/redis": "^5.0.1",
97
97
  "@nestjs/common": "^10.0.0 || ^11.0.0",
98
98
  "@nestjs/config": "^3.0.0 || ^4.0.0",
99
99
  "@nestjs/core": "^10.0.0 || ^11.0.0",
@@ -104,7 +104,7 @@
104
104
  "cacheable": "^2.0.0",
105
105
  "class-transformer": "^0.5.0",
106
106
  "class-validator": "^0.14.0",
107
- "keyv": "^5.0.0",
107
+ "keyv": "^5.0.1",
108
108
  "typeorm": "^0.3.0",
109
109
  "winston": "^3.0.0",
110
110
  "winston-daily-rotate-file": "^5.0.0",
@@ -112,6 +112,6 @@
112
112
  "rxjs": "^7.8.0"
113
113
  },
114
114
  "dependencies": {
115
- "@flusys/nestjs-core": "5.0.0"
115
+ "@flusys/nestjs-core": "5.0.2"
116
116
  }
117
117
  }