cc-core-cli 1.0.148 → 1.0.152
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 +1 -1
- package/template/admin/public/static/styles/entities.css +3 -3
- package/template/admin/public/static/styles/layout.css +52 -0
- package/template/core/src/app.module.ts +7 -3
- package/template/core/src/app_cluster.service.ts +5 -5
- package/template/core/src/main.ts +9 -2
- package/template/core_v3/src/app.module.ts +21 -24
- package/template/core_v3/src/app_cluster.service.ts +5 -5
- package/template/core_v3/src/main.ts +9 -2
package/package.json
CHANGED
|
@@ -1580,4 +1580,56 @@ html body.ant-scrolling-effect {
|
|
|
1580
1580
|
|
|
1581
1581
|
.ant-collapse-content-box {
|
|
1582
1582
|
background-color: var(--white-color) !important;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
.summary-box-component.layout_1 .text.sum .ant-typography {
|
|
1586
|
+
font-size: 40px;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
.summary-box-component.layout_1 .text.description .ant-typography{
|
|
1590
|
+
font-size: 32px;
|
|
1591
|
+
line-height: 1;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
.summary-box-component.layout_1 .text.description {
|
|
1595
|
+
height: auto !important;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
.summary-box-component.layout_3 .text.sum .ant-typography,
|
|
1599
|
+
.summary-box-component.layout_4 .text.sum .ant-typography {
|
|
1600
|
+
font-size: 27px;
|
|
1601
|
+
line-height: 1.2;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
.summary-box-component.layout_3 .summary-box-component,
|
|
1605
|
+
.summary-box-component.layout_4 .summary-box-component {
|
|
1606
|
+
display: flex;
|
|
1607
|
+
flex-direction: column;
|
|
1608
|
+
justify-content: center;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
.summary-box-component.layout_3 .text.description .ant-typography,
|
|
1612
|
+
.summary-box-component.layout_4 .text.description .ant-typography {
|
|
1613
|
+
font-size: 18px;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
.summary-box-component .has-icon {
|
|
1617
|
+
margin-top: 30px;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
.summary-box-component .no-icon {
|
|
1621
|
+
margin-top: 0;
|
|
1622
|
+
height: 100%;
|
|
1623
|
+
justify-content: center;
|
|
1624
|
+
align-content: center;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
.summary-box-component .no-icon .icon {
|
|
1628
|
+
display: none;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
.summary-box-component .no-icon .text-content {
|
|
1632
|
+
flex: 0 0 100% !important;
|
|
1633
|
+
max-width: 100% !important;
|
|
1634
|
+
text-align: center;
|
|
1583
1635
|
}
|
|
@@ -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:
|
|
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
|
-
import { CONST } from
|
|
5
|
+
import { CONST } from "src/core/common/constants";
|
|
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
|
-
|
|
15
|
-
|
|
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.
|
|
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:
|
|
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:
|
|
278
|
+
method: method
|
|
272
279
|
});
|
|
273
280
|
}
|
|
274
281
|
});
|
|
@@ -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
|
-
|
|
46
|
-
|
|
44
|
+
SearchTextModule,
|
|
45
|
+
ExternalProviderModule,
|
|
46
|
+
} from "@shopstack/cc-core-lib/core";
|
|
47
47
|
|
|
48
|
-
import { CoreModule } from
|
|
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
|
-
import { CONST } from
|
|
5
|
+
import { CONST } from "src/core/common/constants";
|
|
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
|
-
|
|
15
|
-
|
|
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.
|
|
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:
|
|
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:
|
|
296
|
+
method: method
|
|
290
297
|
});
|
|
291
298
|
}
|
|
292
299
|
});
|