@lark-apaas/fullstack-nestjs-core 1.1.34-alpha.0 → 1.1.34-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 +19 -15
- package/dist/index.js +20 -16
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -34818,6 +34818,8 @@ var RequestContextMiddleware = class {
|
|
|
34818
34818
|
const ttEnv = req.headers["x-tt-env"];
|
|
34819
34819
|
const rawPageRoute = req.get("X-Page-Route");
|
|
34820
34820
|
const pageRoute = (0, import_nestjs_common2.stripBasePath)(rawPageRoute, process.env.CLIENT_BASE_PATH) ?? void 0;
|
|
34821
|
+
const refererPath = req.headers["rpc-persist-apaas-observability-referer-path"];
|
|
34822
|
+
const observabilityApi = req.headers["rpc-persist-apaas-observability-api"];
|
|
34821
34823
|
this.requestContext.run({
|
|
34822
34824
|
path: path2,
|
|
34823
34825
|
method: req.method,
|
|
@@ -34826,7 +34828,9 @@ var RequestContextMiddleware = class {
|
|
|
34826
34828
|
appId: userContext.appId,
|
|
34827
34829
|
isSystemAccount: userContext.isSystemAccount,
|
|
34828
34830
|
ttEnv,
|
|
34829
|
-
pageRoute
|
|
34831
|
+
pageRoute,
|
|
34832
|
+
refererPath,
|
|
34833
|
+
observabilityApi
|
|
34830
34834
|
}, () => next());
|
|
34831
34835
|
}
|
|
34832
34836
|
};
|
|
@@ -36100,8 +36104,17 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36100
36104
|
}
|
|
36101
36105
|
getAppID() {
|
|
36102
36106
|
const basePath = process.env.CLIENT_BASE_PATH || "";
|
|
36103
|
-
const
|
|
36104
|
-
|
|
36107
|
+
const patterns = [
|
|
36108
|
+
/\/app\/([^/]+)/,
|
|
36109
|
+
/\/spark\/b\/([^/]+)/
|
|
36110
|
+
];
|
|
36111
|
+
for (const pattern of patterns) {
|
|
36112
|
+
const match = basePath.match(pattern);
|
|
36113
|
+
if (match?.[1]) {
|
|
36114
|
+
return match[1];
|
|
36115
|
+
}
|
|
36116
|
+
}
|
|
36117
|
+
return "";
|
|
36105
36118
|
}
|
|
36106
36119
|
};
|
|
36107
36120
|
HtmlHotUpdateService = _ts_decorate12([
|
|
@@ -36156,27 +36169,20 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
|
|
|
36156
36169
|
* 失败: { code: -1, msg: "update html failed: <error>" }
|
|
36157
36170
|
*/
|
|
36158
36171
|
async updateHtmlFiles(body) {
|
|
36159
|
-
this.logger.log(`[DEBUG] received request: ${JSON.stringify(body)}`);
|
|
36160
36172
|
const { commitID, appID } = body;
|
|
36161
36173
|
if (!commitID || !appID) {
|
|
36162
|
-
this.logger.warn(`[DEBUG] missing params: commitID=${commitID}, appID=${appID}`);
|
|
36163
36174
|
return {
|
|
36164
36175
|
code: -1,
|
|
36165
36176
|
msg: "commitID and appID are required"
|
|
36166
36177
|
};
|
|
36167
36178
|
}
|
|
36168
36179
|
try {
|
|
36169
|
-
const startTime = Date.now();
|
|
36170
36180
|
const result = await this.htmlHotUpdateService.updateFromRemote(appID, commitID);
|
|
36171
|
-
const elapsed = Date.now() - startTime;
|
|
36172
|
-
this.logger.log(`[DEBUG] update complete in ${elapsed}ms: updated=${result.updatedFiles.length}, failed=${result.failedFiles.length}`);
|
|
36173
36181
|
if (result.updatedFiles.length === 0 && result.failedFiles.length > 0) {
|
|
36174
|
-
|
|
36182
|
+
return {
|
|
36175
36183
|
code: -1,
|
|
36176
36184
|
msg: `update html failed: all ${result.failedFiles.length} files failed to write`
|
|
36177
36185
|
};
|
|
36178
|
-
this.logger.error(`[DEBUG] response: ${JSON.stringify(resp)}`);
|
|
36179
|
-
return resp;
|
|
36180
36186
|
}
|
|
36181
36187
|
return {
|
|
36182
36188
|
code: 0,
|
|
@@ -36184,7 +36190,7 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
|
|
|
36184
36190
|
};
|
|
36185
36191
|
} catch (error) {
|
|
36186
36192
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
36187
|
-
this.logger.error(`
|
|
36193
|
+
this.logger.error(`Update html failed: ${errorMsg}`);
|
|
36188
36194
|
return {
|
|
36189
36195
|
code: -1,
|
|
36190
36196
|
msg: `update html failed: ${errorMsg}`
|
|
@@ -36249,11 +36255,10 @@ function _ts_decorate15(decorators, target, key, desc) {
|
|
|
36249
36255
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36250
36256
|
}
|
|
36251
36257
|
__name(_ts_decorate15, "_ts_decorate");
|
|
36252
|
-
var HtmlHotUpdateViewMiddleware = class
|
|
36258
|
+
var HtmlHotUpdateViewMiddleware = class {
|
|
36253
36259
|
static {
|
|
36254
36260
|
__name(this, "HtmlHotUpdateViewMiddleware");
|
|
36255
36261
|
}
|
|
36256
|
-
logger = new import_common15.Logger(_HtmlHotUpdateViewMiddleware.name);
|
|
36257
36262
|
use(_req, res, next) {
|
|
36258
36263
|
if (process.env.NODE_ENV !== "production") {
|
|
36259
36264
|
return next();
|
|
@@ -36269,7 +36274,6 @@ var HtmlHotUpdateViewMiddleware = class _HtmlHotUpdateViewMiddleware {
|
|
|
36269
36274
|
const activeVersion = getActiveHtmlVersion();
|
|
36270
36275
|
const hotPath = activeVersion ? (0, import_node_path3.join)(getHotUpdateVersionDir(activeVersion), `${view}.html`) : "";
|
|
36271
36276
|
if (hotPath && (0, import_node_fs3.existsSync)(hotPath)) {
|
|
36272
|
-
this.logger.log(`Render hot-updated HTML: ${hotPath}`);
|
|
36273
36277
|
return originalRender(hotPath, renderOptions, renderCallback);
|
|
36274
36278
|
}
|
|
36275
36279
|
return originalRender(view, renderOptions, renderCallback);
|
package/dist/index.js
CHANGED
|
@@ -34795,6 +34795,8 @@ var RequestContextMiddleware = class {
|
|
|
34795
34795
|
const ttEnv = req.headers["x-tt-env"];
|
|
34796
34796
|
const rawPageRoute = req.get("X-Page-Route");
|
|
34797
34797
|
const pageRoute = stripBasePath(rawPageRoute, process.env.CLIENT_BASE_PATH) ?? void 0;
|
|
34798
|
+
const refererPath = req.headers["rpc-persist-apaas-observability-referer-path"];
|
|
34799
|
+
const observabilityApi = req.headers["rpc-persist-apaas-observability-api"];
|
|
34798
34800
|
this.requestContext.run({
|
|
34799
34801
|
path: path2,
|
|
34800
34802
|
method: req.method,
|
|
@@ -34803,7 +34805,9 @@ var RequestContextMiddleware = class {
|
|
|
34803
34805
|
appId: userContext.appId,
|
|
34804
34806
|
isSystemAccount: userContext.isSystemAccount,
|
|
34805
34807
|
ttEnv,
|
|
34806
|
-
pageRoute
|
|
34808
|
+
pageRoute,
|
|
34809
|
+
refererPath,
|
|
34810
|
+
observabilityApi
|
|
34807
34811
|
}, () => next());
|
|
34808
34812
|
}
|
|
34809
34813
|
};
|
|
@@ -36077,8 +36081,17 @@ var HtmlHotUpdateService = class _HtmlHotUpdateService {
|
|
|
36077
36081
|
}
|
|
36078
36082
|
getAppID() {
|
|
36079
36083
|
const basePath = process.env.CLIENT_BASE_PATH || "";
|
|
36080
|
-
const
|
|
36081
|
-
|
|
36084
|
+
const patterns = [
|
|
36085
|
+
/\/app\/([^/]+)/,
|
|
36086
|
+
/\/spark\/b\/([^/]+)/
|
|
36087
|
+
];
|
|
36088
|
+
for (const pattern of patterns) {
|
|
36089
|
+
const match = basePath.match(pattern);
|
|
36090
|
+
if (match?.[1]) {
|
|
36091
|
+
return match[1];
|
|
36092
|
+
}
|
|
36093
|
+
}
|
|
36094
|
+
return "";
|
|
36082
36095
|
}
|
|
36083
36096
|
};
|
|
36084
36097
|
HtmlHotUpdateService = _ts_decorate12([
|
|
@@ -36133,27 +36146,20 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
|
|
|
36133
36146
|
* 失败: { code: -1, msg: "update html failed: <error>" }
|
|
36134
36147
|
*/
|
|
36135
36148
|
async updateHtmlFiles(body) {
|
|
36136
|
-
this.logger.log(`[DEBUG] received request: ${JSON.stringify(body)}`);
|
|
36137
36149
|
const { commitID, appID } = body;
|
|
36138
36150
|
if (!commitID || !appID) {
|
|
36139
|
-
this.logger.warn(`[DEBUG] missing params: commitID=${commitID}, appID=${appID}`);
|
|
36140
36151
|
return {
|
|
36141
36152
|
code: -1,
|
|
36142
36153
|
msg: "commitID and appID are required"
|
|
36143
36154
|
};
|
|
36144
36155
|
}
|
|
36145
36156
|
try {
|
|
36146
|
-
const startTime = Date.now();
|
|
36147
36157
|
const result = await this.htmlHotUpdateService.updateFromRemote(appID, commitID);
|
|
36148
|
-
const elapsed = Date.now() - startTime;
|
|
36149
|
-
this.logger.log(`[DEBUG] update complete in ${elapsed}ms: updated=${result.updatedFiles.length}, failed=${result.failedFiles.length}`);
|
|
36150
36158
|
if (result.updatedFiles.length === 0 && result.failedFiles.length > 0) {
|
|
36151
|
-
|
|
36159
|
+
return {
|
|
36152
36160
|
code: -1,
|
|
36153
36161
|
msg: `update html failed: all ${result.failedFiles.length} files failed to write`
|
|
36154
36162
|
};
|
|
36155
|
-
this.logger.error(`[DEBUG] response: ${JSON.stringify(resp)}`);
|
|
36156
|
-
return resp;
|
|
36157
36163
|
}
|
|
36158
36164
|
return {
|
|
36159
36165
|
code: 0,
|
|
@@ -36161,7 +36167,7 @@ var HtmlHotUpdateController = class _HtmlHotUpdateController {
|
|
|
36161
36167
|
};
|
|
36162
36168
|
} catch (error) {
|
|
36163
36169
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
36164
|
-
this.logger.error(`
|
|
36170
|
+
this.logger.error(`Update html failed: ${errorMsg}`);
|
|
36165
36171
|
return {
|
|
36166
36172
|
code: -1,
|
|
36167
36173
|
msg: `update html failed: ${errorMsg}`
|
|
@@ -36216,7 +36222,7 @@ HtmlHotUpdateModule = _ts_decorate14([
|
|
|
36216
36222
|
], HtmlHotUpdateModule);
|
|
36217
36223
|
|
|
36218
36224
|
// src/middlewares/html-hot-update-view/index.ts
|
|
36219
|
-
import { Injectable as Injectable11
|
|
36225
|
+
import { Injectable as Injectable11 } from "@nestjs/common";
|
|
36220
36226
|
import { existsSync as existsSync3 } from "fs";
|
|
36221
36227
|
import { join as join4 } from "path";
|
|
36222
36228
|
function _ts_decorate15(decorators, target, key, desc) {
|
|
@@ -36226,11 +36232,10 @@ function _ts_decorate15(decorators, target, key, desc) {
|
|
|
36226
36232
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
36227
36233
|
}
|
|
36228
36234
|
__name(_ts_decorate15, "_ts_decorate");
|
|
36229
|
-
var HtmlHotUpdateViewMiddleware = class
|
|
36235
|
+
var HtmlHotUpdateViewMiddleware = class {
|
|
36230
36236
|
static {
|
|
36231
36237
|
__name(this, "HtmlHotUpdateViewMiddleware");
|
|
36232
36238
|
}
|
|
36233
|
-
logger = new Logger7(_HtmlHotUpdateViewMiddleware.name);
|
|
36234
36239
|
use(_req, res, next) {
|
|
36235
36240
|
if (process.env.NODE_ENV !== "production") {
|
|
36236
36241
|
return next();
|
|
@@ -36246,7 +36251,6 @@ var HtmlHotUpdateViewMiddleware = class _HtmlHotUpdateViewMiddleware {
|
|
|
36246
36251
|
const activeVersion = getActiveHtmlVersion();
|
|
36247
36252
|
const hotPath = activeVersion ? join4(getHotUpdateVersionDir(activeVersion), `${view}.html`) : "";
|
|
36248
36253
|
if (hotPath && existsSync3(hotPath)) {
|
|
36249
|
-
this.logger.log(`Render hot-updated HTML: ${hotPath}`);
|
|
36250
36254
|
return originalRender(hotPath, renderOptions, renderCallback);
|
|
36251
36255
|
}
|
|
36252
36256
|
return originalRender(view, renderOptions, renderCallback);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-nestjs-core",
|
|
3
|
-
"version": "1.1.34-alpha.
|
|
3
|
+
"version": "1.1.34-alpha.10",
|
|
4
4
|
"description": "FullStack Nestjs Core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"prepublishOnly": "npm run build"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@lark-apaas/file-service": "^0.1.
|
|
42
|
+
"@lark-apaas/file-service": "^0.1.2",
|
|
43
43
|
"@lark-apaas/http-client": "^0.1.2",
|
|
44
44
|
"@lark-apaas/nestjs-authnpaas": "^1.0.2",
|
|
45
|
-
"@lark-apaas/nestjs-authzpaas": "
|
|
46
|
-
"@lark-apaas/nestjs-capability": "
|
|
47
|
-
"@lark-apaas/nestjs-common": "
|
|
48
|
-
"@lark-apaas/nestjs-datapaas": "
|
|
49
|
-
"@lark-apaas/nestjs-logger": "
|
|
50
|
-
"@lark-apaas/nestjs-observable": "
|
|
45
|
+
"@lark-apaas/nestjs-authzpaas": "0.1.2-alpha.33",
|
|
46
|
+
"@lark-apaas/nestjs-capability": "0.1.5-alpha.50",
|
|
47
|
+
"@lark-apaas/nestjs-common": "0.1.4-alpha.33",
|
|
48
|
+
"@lark-apaas/nestjs-datapaas": "1.0.10-alpha.40",
|
|
49
|
+
"@lark-apaas/nestjs-logger": "1.0.10-alpha.53",
|
|
50
|
+
"@lark-apaas/nestjs-observable": "0.0.5-alpha.39",
|
|
51
51
|
"@lark-apaas/nestjs-openapi-devtools": "^1.0.10",
|
|
52
|
-
"@lark-apaas/nestjs-trigger": "
|
|
52
|
+
"@lark-apaas/nestjs-trigger": "0.0.2-alpha.10",
|
|
53
53
|
"@nestjs/axios": "^4.0.1",
|
|
54
54
|
"axios": "^1.13.2",
|
|
55
55
|
"cookie-parser": "^1.4.7"
|