@lark-apaas/fullstack-nestjs-core 1.1.12-alpha.1 → 1.1.12-alpha.10
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/dist/index.cjs +77 -30
- package/dist/index.js +77 -30
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -170,6 +170,47 @@ CsrfMiddleware = _ts_decorate2([
|
|
|
170
170
|
// src/middlewares/view-context/index.ts
|
|
171
171
|
var import_common3 = require("@nestjs/common");
|
|
172
172
|
var import_nestjs_common = require("@lark-apaas/nestjs-common");
|
|
173
|
+
|
|
174
|
+
// src/utils/safe-stringify.ts
|
|
175
|
+
function escapeChar(c) {
|
|
176
|
+
switch (c.charCodeAt(0)) {
|
|
177
|
+
case 60:
|
|
178
|
+
return "\\u003c";
|
|
179
|
+
case 62:
|
|
180
|
+
return "\\u003e";
|
|
181
|
+
case 38:
|
|
182
|
+
return "\\u0026";
|
|
183
|
+
case 61:
|
|
184
|
+
return "\\u003d";
|
|
185
|
+
case 39:
|
|
186
|
+
return "\\u0027";
|
|
187
|
+
case 34:
|
|
188
|
+
return "\\u0022";
|
|
189
|
+
case 123:
|
|
190
|
+
return "\\u007b";
|
|
191
|
+
case 125:
|
|
192
|
+
return "\\u007d";
|
|
193
|
+
case 40:
|
|
194
|
+
return "\\u0028";
|
|
195
|
+
case 41:
|
|
196
|
+
return "\\u0029";
|
|
197
|
+
case 10:
|
|
198
|
+
return "\\n";
|
|
199
|
+
case 8232:
|
|
200
|
+
return "\\u2028";
|
|
201
|
+
case 8233:
|
|
202
|
+
return "\\u2029";
|
|
203
|
+
default:
|
|
204
|
+
return c;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
__name(escapeChar, "escapeChar");
|
|
208
|
+
function safeEscape(s) {
|
|
209
|
+
return s.replace(/[<>&='"{}()\n\u2028\u2029]/g, escapeChar);
|
|
210
|
+
}
|
|
211
|
+
__name(safeEscape, "safeEscape");
|
|
212
|
+
|
|
213
|
+
// src/middlewares/view-context/index.ts
|
|
173
214
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
174
215
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
175
216
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -225,9 +266,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
225
266
|
csrfToken: csrfToken ?? "",
|
|
226
267
|
userId: userId ?? "",
|
|
227
268
|
appId: appId ?? "",
|
|
228
|
-
appName: appInfo?.app_name ?? "",
|
|
269
|
+
appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
229
270
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
230
|
-
appDescription: appInfo?.app_description ?? "",
|
|
271
|
+
appDescription: safeEscape(appInfo?.app_description ?? ""),
|
|
231
272
|
tenantId
|
|
232
273
|
};
|
|
233
274
|
res.locals = {
|
|
@@ -236,9 +277,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
236
277
|
userId: userId ?? "",
|
|
237
278
|
tenantId: tenantId ?? "",
|
|
238
279
|
appId: appId ?? "",
|
|
239
|
-
appName: appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528",
|
|
280
|
+
appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
240
281
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
241
|
-
appDescription: appInfo?.app_description ?? ""
|
|
282
|
+
appDescription: safeEscape(appInfo?.app_description ?? "")
|
|
242
283
|
};
|
|
243
284
|
next();
|
|
244
285
|
}
|
|
@@ -716,6 +757,9 @@ PlatformHttpClientService = _ts_decorate8([
|
|
|
716
757
|
_ts_metadata5("design:paramtypes", [])
|
|
717
758
|
], PlatformHttpClientService);
|
|
718
759
|
|
|
760
|
+
// src/modules/platform/config/feature-switch.ts
|
|
761
|
+
var DISABLE_DATAPASS = process.env.FORCE_FRAMEWORK_DISABLE_DATAPASS === "true";
|
|
762
|
+
|
|
719
763
|
// src/modules/platform/module.ts
|
|
720
764
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
721
765
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -752,32 +796,35 @@ var PlatformModule = class _PlatformModule {
|
|
|
752
796
|
timeout: 5e3,
|
|
753
797
|
maxRedirects: 5
|
|
754
798
|
}),
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
799
|
+
// 读取环境变量判断是否启用 DataPaasModule
|
|
800
|
+
...DISABLE_DATAPASS ? [] : [
|
|
801
|
+
import_nestjs_datapaas.DataPaasModule.forRootAsync({
|
|
802
|
+
imports: [
|
|
803
|
+
import_config2.ConfigModule,
|
|
804
|
+
import_nestjs_logger2.LoggerModule
|
|
805
|
+
],
|
|
806
|
+
inject: [
|
|
807
|
+
import_config2.ConfigService,
|
|
808
|
+
import_nestjs_logger2.AppLogger
|
|
809
|
+
],
|
|
810
|
+
useFactory: /* @__PURE__ */ __name(async (...args) => {
|
|
811
|
+
const configService = args[0];
|
|
812
|
+
const appLogger = args[1];
|
|
813
|
+
const drizzleLogger = {
|
|
814
|
+
logQuery(query, params) {
|
|
815
|
+
appLogger.log?.("SQL Query " + JSON.stringify({
|
|
816
|
+
query,
|
|
817
|
+
params
|
|
818
|
+
}), "Database");
|
|
819
|
+
}
|
|
820
|
+
};
|
|
821
|
+
return {
|
|
822
|
+
connectionString: configService.get("app.databaseUrl") ?? "",
|
|
823
|
+
logger: drizzleLogger
|
|
824
|
+
};
|
|
825
|
+
}, "useFactory")
|
|
826
|
+
})
|
|
827
|
+
],
|
|
781
828
|
import_nestjs_authnpaas.AuthNPaasModule.forRoot(),
|
|
782
829
|
import_nestjs_trigger.AutomationModule.forRoot()
|
|
783
830
|
],
|
package/dist/index.js
CHANGED
|
@@ -128,6 +128,47 @@ CsrfMiddleware = _ts_decorate2([
|
|
|
128
128
|
// src/middlewares/view-context/index.ts
|
|
129
129
|
import { Inject, Injectable as Injectable3, Logger } from "@nestjs/common";
|
|
130
130
|
import { PLATFORM_HTTP_CLIENT } from "@lark-apaas/nestjs-common";
|
|
131
|
+
|
|
132
|
+
// src/utils/safe-stringify.ts
|
|
133
|
+
function escapeChar(c) {
|
|
134
|
+
switch (c.charCodeAt(0)) {
|
|
135
|
+
case 60:
|
|
136
|
+
return "\\u003c";
|
|
137
|
+
case 62:
|
|
138
|
+
return "\\u003e";
|
|
139
|
+
case 38:
|
|
140
|
+
return "\\u0026";
|
|
141
|
+
case 61:
|
|
142
|
+
return "\\u003d";
|
|
143
|
+
case 39:
|
|
144
|
+
return "\\u0027";
|
|
145
|
+
case 34:
|
|
146
|
+
return "\\u0022";
|
|
147
|
+
case 123:
|
|
148
|
+
return "\\u007b";
|
|
149
|
+
case 125:
|
|
150
|
+
return "\\u007d";
|
|
151
|
+
case 40:
|
|
152
|
+
return "\\u0028";
|
|
153
|
+
case 41:
|
|
154
|
+
return "\\u0029";
|
|
155
|
+
case 10:
|
|
156
|
+
return "\\n";
|
|
157
|
+
case 8232:
|
|
158
|
+
return "\\u2028";
|
|
159
|
+
case 8233:
|
|
160
|
+
return "\\u2029";
|
|
161
|
+
default:
|
|
162
|
+
return c;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
__name(escapeChar, "escapeChar");
|
|
166
|
+
function safeEscape(s) {
|
|
167
|
+
return s.replace(/[<>&='"{}()\n\u2028\u2029]/g, escapeChar);
|
|
168
|
+
}
|
|
169
|
+
__name(safeEscape, "safeEscape");
|
|
170
|
+
|
|
171
|
+
// src/middlewares/view-context/index.ts
|
|
131
172
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
132
173
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
133
174
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -183,9 +224,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
183
224
|
csrfToken: csrfToken ?? "",
|
|
184
225
|
userId: userId ?? "",
|
|
185
226
|
appId: appId ?? "",
|
|
186
|
-
appName: appInfo?.app_name ?? "",
|
|
227
|
+
appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
187
228
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
188
|
-
appDescription: appInfo?.app_description ?? "",
|
|
229
|
+
appDescription: safeEscape(appInfo?.app_description ?? ""),
|
|
189
230
|
tenantId
|
|
190
231
|
};
|
|
191
232
|
res.locals = {
|
|
@@ -194,9 +235,9 @@ var ViewContextMiddleware = class _ViewContextMiddleware {
|
|
|
194
235
|
userId: userId ?? "",
|
|
195
236
|
tenantId: tenantId ?? "",
|
|
196
237
|
appId: appId ?? "",
|
|
197
|
-
appName: appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528",
|
|
238
|
+
appName: safeEscape(appInfo?.app_name ?? "\u5999\u642D\u5E94\u7528"),
|
|
198
239
|
appAvatar: appInfo?.app_avatar ?? "",
|
|
199
|
-
appDescription: appInfo?.app_description ?? ""
|
|
240
|
+
appDescription: safeEscape(appInfo?.app_description ?? "")
|
|
200
241
|
};
|
|
201
242
|
next();
|
|
202
243
|
}
|
|
@@ -674,6 +715,9 @@ PlatformHttpClientService = _ts_decorate8([
|
|
|
674
715
|
_ts_metadata5("design:paramtypes", [])
|
|
675
716
|
], PlatformHttpClientService);
|
|
676
717
|
|
|
718
|
+
// src/modules/platform/config/feature-switch.ts
|
|
719
|
+
var DISABLE_DATAPASS = process.env.FORCE_FRAMEWORK_DISABLE_DATAPASS === "true";
|
|
720
|
+
|
|
677
721
|
// src/modules/platform/module.ts
|
|
678
722
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
679
723
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -710,32 +754,35 @@ var PlatformModule = class _PlatformModule {
|
|
|
710
754
|
timeout: 5e3,
|
|
711
755
|
maxRedirects: 5
|
|
712
756
|
}),
|
|
713
|
-
DataPaasModule
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
757
|
+
// 读取环境变量判断是否启用 DataPaasModule
|
|
758
|
+
...DISABLE_DATAPASS ? [] : [
|
|
759
|
+
DataPaasModule.forRootAsync({
|
|
760
|
+
imports: [
|
|
761
|
+
ConfigModule,
|
|
762
|
+
LoggerModule
|
|
763
|
+
],
|
|
764
|
+
inject: [
|
|
765
|
+
ConfigService,
|
|
766
|
+
AppLogger2
|
|
767
|
+
],
|
|
768
|
+
useFactory: /* @__PURE__ */ __name(async (...args) => {
|
|
769
|
+
const configService = args[0];
|
|
770
|
+
const appLogger = args[1];
|
|
771
|
+
const drizzleLogger = {
|
|
772
|
+
logQuery(query, params) {
|
|
773
|
+
appLogger.log?.("SQL Query " + JSON.stringify({
|
|
774
|
+
query,
|
|
775
|
+
params
|
|
776
|
+
}), "Database");
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
return {
|
|
780
|
+
connectionString: configService.get("app.databaseUrl") ?? "",
|
|
781
|
+
logger: drizzleLogger
|
|
782
|
+
};
|
|
783
|
+
}, "useFactory")
|
|
784
|
+
})
|
|
785
|
+
],
|
|
739
786
|
AuthNPaasModule.forRoot(),
|
|
740
787
|
AutomationModule.forRoot()
|
|
741
788
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-nestjs-core",
|
|
3
|
-
"version": "1.1.12-alpha.
|
|
3
|
+
"version": "1.1.12-alpha.10",
|
|
4
4
|
"description": "FullStack Nestjs Core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@lark-apaas/http-client": "0.1.2",
|
|
43
43
|
"@lark-apaas/nestjs-authnpaas": "^1.0.2",
|
|
44
44
|
"@lark-apaas/nestjs-common": "^0.1.0",
|
|
45
|
-
"@lark-apaas/nestjs-datapaas": "^1.0.
|
|
45
|
+
"@lark-apaas/nestjs-datapaas": "^1.0.7",
|
|
46
46
|
"@lark-apaas/nestjs-logger": "^1.0.4",
|
|
47
47
|
"@lark-apaas/nestjs-observable": "^0.0.1",
|
|
48
48
|
"@lark-apaas/nestjs-openapi-devtools": "^1.0.9",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"@nestjs/swagger": "^7.4.2",
|
|
58
58
|
"@types/cookie-parser": "^1.4.9",
|
|
59
59
|
"@types/express": "^5.0.3",
|
|
60
|
+
"@types/serialize-javascript": "^5.0.4",
|
|
60
61
|
"class-transformer": "^0.5.1",
|
|
61
62
|
"class-validator": "^0.14.2",
|
|
62
63
|
"drizzle-orm": "0.44.6",
|