cc-core-cli 1.0.150 → 1.0.153

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,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-core-cli",
3
- "version": "1.0.150",
3
+ "version": "1.0.153",
4
4
  "description": "Command Line Interface tool for generating project templates for the (Your Platform's Name) platform.",
5
5
  "main": "bin/index.js",
6
6
  "scripts": {
@@ -23,17 +23,17 @@
23
23
  "sonar:coverage": "jest --coverage --coverageReporters=lcov --coverageDirectory=coverage"
24
24
  },
25
25
  "dependencies": {
26
- "@shopstack/cc-core-lib": "2.5.328",
26
+ "@shopstack/cc-core-lib": "^2.6.0",
27
27
  "reflect-metadata": "^0.1.14"
28
28
  },
29
29
  "devDependencies": {
30
- "@nestjs/testing": "^10.3.5",
30
+ "@nestjs/testing": "^11.1.11",
31
31
  "@types/bcrypt": "^5.0.2",
32
32
  "@types/bull": "^3.14.4",
33
33
  "@types/chroma-js": "^2.4.0",
34
34
  "@types/express": "^4.17.8",
35
35
  "@types/jest": "^29.5.14",
36
- "@types/node": "^13.13.27",
36
+ "@types/node": "^24.10.4",
37
37
  "@types/numeral": "^2.0.2",
38
38
  "@types/supertest": "^2.0.10",
39
39
  "@typescript-eslint/eslint-plugin": "^6.1.0",
@@ -1,6 +1,7 @@
1
1
  import * as _ from "lodash";
2
2
  import { Module } from "@nestjs/common";
3
3
  import { MongooseModule } from "@nestjs/mongoose";
4
+ import * as mongoose from "mongoose";
4
5
  import { ClsModule } from "nestjs-cls";
5
6
  import * as dotenv from "dotenv";
6
7
 
@@ -56,6 +57,7 @@ const RUN_CUSTOM_MODULES =
56
57
  ? CUSTOM_MODULES.map((c) => c.module)
57
58
  : CUSTOM_MODULES.filter((c) => SPECIFY_CUSTOM_MODULES.includes(c.module.name)).map((c) => c.module);
58
59
 
60
+ mongoose.set('strictQuery', false);
59
61
  const mongoConfig = {};
60
62
 
61
63
  if (+process.env.MONGODB_MIN_POOL_SIZE) {
@@ -92,7 +94,7 @@ if (+process.env.MONGODB_MAX_POOL_SIZE) {
92
94
  headers: _.get(req, "headers", {}),
93
95
  ip: _.get(req, "ip"),
94
96
  protocol: _.get(req, "protocol"),
95
- hostname: _.get(req, "hostname"),
97
+ hostname: req.host || req.headers.host || _.get(req, "hostname"),
96
98
  url: _.get(req, "url"),
97
99
  method: _.get(req, "method"),
98
100
  body: _.get(req, "body", {}),
@@ -113,9 +115,11 @@ if (+process.env.MONGODB_MAX_POOL_SIZE) {
113
115
  roles: _.get(req, "roles", []),
114
116
  headers: _.get(req, "headers", {}),
115
117
  // ip: req.connection.remoteAddress,
116
- ip: _.get(req, "socket.remoteAddress") || _.get(req, "connection.remoteAddress"),
118
+ ip:
119
+ _.get(req, "socket.remoteAddress") ||
120
+ _.get(req, "connection.remoteAddress"),
117
121
  protocol: _.get(req, "protocol"),
118
- hostname: _.get(req, "hostname"),
122
+ hostname: req.host || req.headers.host || _.get(req, "hostname"),
119
123
  url: _.get(req, "url"),
120
124
  method: _.get(req, "method"),
121
125
  body: _.get(req, "body", {}),
@@ -1,9 +1,9 @@
1
1
  import * as _ from "lodash";
2
- import * as cluster from "cluster";
3
2
  import * as os from "os";
4
3
  import { Injectable } from "@nestjs/common";
5
4
  import axios, { AxiosInstance } from "axios";
6
5
  import { CONST } from '@shopstack/cc-core-lib/core'
6
+ const cluster = require('node:cluster') as any
7
7
 
8
8
  CONST.INTERNAL_DOMAIN = `http://${process.env.LOOP_BACK_IP}:${process.env
9
9
  .PORT || 3000}/api/v1`;
@@ -11,8 +11,8 @@ CONST.INTERNAL_DOMAIN = `http://${process.env.LOOP_BACK_IP}:${process.env
11
11
  const numCPUs = _.isEmpty(process.env.MAX_WORKER)
12
12
  ? os.cpus().length
13
13
  : parseInt(process.env.MAX_WORKER, 10) === 0
14
- ? os.cpus().length
15
- : parseInt(process.env.MAX_WORKER, 10);
14
+ ? os.cpus().length
15
+ : parseInt(process.env.MAX_WORKER, 10);
16
16
  console.log("MAXIMUM WORKER PROCESS: " + numCPUs);
17
17
  // const numCPUs = 2;
18
18
  let checkInit = false;
@@ -21,7 +21,7 @@ let mainPID = 0;
21
21
  @Injectable()
22
22
  export class AppClusterService {
23
23
  static async clusterize(callback: Function): Promise<void> {
24
- if (cluster.isMaster) {
24
+ if (cluster.isPrimary) {
25
25
  console.log(`Master server started on ${process.pid}`);
26
26
  CONST.MAIN_PROCESS = true;
27
27
  for (let i = 0; i < numCPUs; i++) {
@@ -233,7 +233,7 @@ async function bootstrap() {
233
233
  const app = await NestFactory.create<NestFastifyApplication>(AppModule, fastify);
234
234
 
235
235
  app.useStaticAssets({
236
- root: `${process.cwd()}/storage/public`,
236
+ root: path.resolve(process.cwd(), "storage/public"),
237
237
  prefix: `/public`,
238
238
  });
239
239
 
@@ -266,9 +266,16 @@ async function bootstrap() {
266
266
  .getInstance()
267
267
  .addHook("onRoute", (route) => {
268
268
  if (!ignoreRouteRegex.test(route.path)) {
269
+ let method = route.method;
270
+ if (_.isArray(method)) {
271
+ method = method[0] || "GET";
272
+ } else if (_.isObject(method)) {
273
+ method = Object.keys(method)[0] || "GET";
274
+ }
275
+ method = String(method).toUpperCase();
269
276
  routes.push({
270
277
  path: route.path.replace("/api/v1/", ""),
271
- method: route.method,
278
+ method: method
272
279
  });
273
280
  }
274
281
  });
@@ -27,13 +27,13 @@
27
27
  "reflect-metadata": "^0.1.14"
28
28
  },
29
29
  "devDependencies": {
30
- "@nestjs/testing": "^10.3.5",
30
+ "@nestjs/testing": "^11.1.11",
31
31
  "@types/bcrypt": "^5.0.2",
32
32
  "@types/bull": "^3.14.4",
33
33
  "@types/chroma-js": "^2.4.0",
34
34
  "@types/express": "^4.17.8",
35
35
  "@types/jest": "^29.5.14",
36
- "@types/node": "^13.13.27",
36
+ "@types/node": "^24.10.4",
37
37
  "@types/numeral": "^2.0.2",
38
38
  "@types/supertest": "^2.0.10",
39
39
  "@typescript-eslint/eslint-plugin": "^6.1.0",
@@ -1,8 +1,7 @@
1
1
  import * as _ from "lodash";
2
- import {
3
- Module,
4
- } from "@nestjs/common";
2
+ import { Module } from "@nestjs/common";
5
3
  import { MongooseModule } from "@nestjs/mongoose";
4
+ import * as mongoose from "mongoose";
6
5
  import { ClsModule } from "nestjs-cls";
7
6
  import * as dotenv from "dotenv";
8
7
 
@@ -42,26 +41,23 @@ import {
42
41
  CacheModule,
43
42
  PipelineModule,
44
43
  RewriteUrlModule,
45
- ExternalProviderModule
46
- } from '@shopstack/cc-core-lib/core'
44
+ SearchTextModule,
45
+ ExternalProviderModule,
46
+ } from "@shopstack/cc-core-lib/core";
47
47
 
48
- import { CoreModule } from './core/core.module'
48
+ import { CoreModule } from "./core/core.module";
49
49
 
50
50
  // const { CoreModule } = core
51
51
 
52
52
  dotenv.config();
53
53
 
54
- const SPECIFY_CUSTOM_MODULES =
55
- process.env.CUSTOM_MODULES === "" || process.env.CUSTOM_MODULES === undefined
56
- ? []
57
- : process.env.CUSTOM_MODULES.split(",");
54
+ const SPECIFY_CUSTOM_MODULES = process.env.CUSTOM_MODULES === "" || process.env.CUSTOM_MODULES === undefined ? [] : process.env.CUSTOM_MODULES.split(",");
58
55
  const RUN_CUSTOM_MODULES =
59
56
  SPECIFY_CUSTOM_MODULES.length === 0
60
- ? CUSTOM_MODULES.map(c => c.module)
61
- : CUSTOM_MODULES.filter(c =>
62
- SPECIFY_CUSTOM_MODULES.includes(c.module.name)
63
- ).map(c => c.module);
57
+ ? CUSTOM_MODULES.map((c) => c.module)
58
+ : CUSTOM_MODULES.filter((c) => SPECIFY_CUSTOM_MODULES.includes(c.module.name)).map((c) => c.module);
64
59
 
60
+ mongoose.set('strictQuery', false);
65
61
  const mongoConfig = {};
66
62
 
67
63
  if (+process.env.MONGODB_MIN_POOL_SIZE) {
@@ -98,15 +94,15 @@ if (+process.env.MONGODB_MAX_POOL_SIZE) {
98
94
  headers: _.get(req, "headers", {}),
99
95
  ip: _.get(req, "ip"),
100
96
  protocol: _.get(req, "protocol"),
101
- hostname: _.get(req, "hostname"),
97
+ hostname: req.host || req.headers.host || _.get(req, "hostname"),
102
98
  url: _.get(req, "url"),
103
99
  method: _.get(req, "method"),
104
100
  body: _.get(req, "body", {}),
105
101
  action_profile: _.get(req, "action_profile", {}),
106
102
  permisson_entities: _.get(req, "permisson_entities", {}),
107
- permisson_tab: _.get(req, "permisson_tab", {})
103
+ permisson_tab: _.get(req, "permisson_tab", {}),
108
104
  });
109
- }
105
+ },
110
106
  },
111
107
  interceptor: {
112
108
  mount: true,
@@ -123,16 +119,16 @@ if (+process.env.MONGODB_MAX_POOL_SIZE) {
123
119
  _.get(req, "socket.remoteAddress") ||
124
120
  _.get(req, "connection.remoteAddress"),
125
121
  protocol: _.get(req, "protocol"),
126
- hostname: _.get(req, "hostname"),
122
+ hostname: req.host || req.headers.host || _.get(req, "hostname"),
127
123
  url: _.get(req, "url"),
128
124
  method: _.get(req, "method"),
129
125
  body: _.get(req, "body", {}),
130
126
  action_profile: _.get(req, "action_profile", {}),
131
127
  permisson_entities: _.get(req, "permisson_entities", {}),
132
- permisson_tab: _.get(req, "permisson_tab", {})
128
+ permisson_tab: _.get(req, "permisson_tab", {}),
133
129
  });
134
- }
135
- }
130
+ },
131
+ },
136
132
  }),
137
133
 
138
134
  EntitiesModule,
@@ -164,12 +160,13 @@ if (+process.env.MONGODB_MAX_POOL_SIZE) {
164
160
  PipelineModule,
165
161
  LayoutModule,
166
162
  RewriteUrlModule,
163
+ SearchTextModule,
167
164
  ExternalProviderModule,
168
165
  // ...RUN_CUSTOM_MODULES,
169
166
 
170
- CoreModule
167
+ CoreModule,
171
168
  ],
172
169
  controllers: [AppController, StoragePrivateController],
173
- providers: [AppService]
170
+ providers: [AppService],
174
171
  })
175
- export class AppModule { }
172
+ export class AppModule {}
@@ -1,9 +1,9 @@
1
1
  import * as _ from "lodash";
2
- import * as cluster from "cluster";
3
2
  import * as os from "os";
4
3
  import { Injectable } from "@nestjs/common";
5
4
  import axios, { AxiosInstance } from "axios";
6
5
  import { CONST } from '@shopstack/cc-core-lib/core'
6
+ const cluster = require('node:cluster') as any
7
7
 
8
8
  CONST.INTERNAL_DOMAIN = `http://${process.env.LOOP_BACK_IP}:${process.env
9
9
  .PORT || 3000}/api/v1`;
@@ -11,8 +11,8 @@ CONST.INTERNAL_DOMAIN = `http://${process.env.LOOP_BACK_IP}:${process.env
11
11
  const numCPUs = _.isEmpty(process.env.MAX_WORKER)
12
12
  ? os.cpus().length
13
13
  : parseInt(process.env.MAX_WORKER, 10) === 0
14
- ? os.cpus().length
15
- : parseInt(process.env.MAX_WORKER, 10);
14
+ ? os.cpus().length
15
+ : parseInt(process.env.MAX_WORKER, 10);
16
16
  console.log("MAXIMUM WORKER PROCESS: " + numCPUs);
17
17
  // const numCPUs = 2;
18
18
  let checkInit = false;
@@ -21,7 +21,7 @@ let mainPID = 0;
21
21
  @Injectable()
22
22
  export class AppClusterService {
23
23
  static async clusterize(callback: Function): Promise<void> {
24
- if (cluster.isMaster) {
24
+ if (cluster.isPrimary) {
25
25
  console.log(`Master server started on ${process.pid}`);
26
26
  CONST.MAIN_PROCESS = true;
27
27
  for (let i = 0; i < numCPUs; i++) {
@@ -249,7 +249,7 @@ async function bootstrap() {
249
249
  );
250
250
 
251
251
  app.useStaticAssets({
252
- root: `${process.cwd()}/storage/public`,
252
+ root: path.resolve(process.cwd(), "storage/public"),
253
253
  prefix: `/public`
254
254
  });
255
255
 
@@ -284,9 +284,16 @@ async function bootstrap() {
284
284
  .getInstance()
285
285
  .addHook("onRoute", route => {
286
286
  if (!ignoreRouteRegex.test(route.path)) {
287
+ let method = route.method;
288
+ if (_.isArray(method)) {
289
+ method = method[0] || "GET";
290
+ } else if (_.isObject(method)) {
291
+ method = Object.keys(method)[0] || "GET";
292
+ }
293
+ method = String(method).toUpperCase();
287
294
  routes.push({
288
295
  path: route.path.replace("/api/v1/", ""),
289
- method: route.method
296
+ method: method
290
297
  });
291
298
  }
292
299
  });