@webtypen/webframez-core 0.3.40 → 0.3.42
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.
|
@@ -54,6 +54,8 @@ export declare class BuildApplication {
|
|
|
54
54
|
private readonly buildId;
|
|
55
55
|
constructor(projectRoot: string, config: WebframezAppConfig, options: BuildApplicationOptions);
|
|
56
56
|
run(): Promise<void>;
|
|
57
|
+
private logBuildStep;
|
|
58
|
+
private runStep;
|
|
57
59
|
private createContext;
|
|
58
60
|
private callHook;
|
|
59
61
|
private runTypescriptBuild;
|
package/dist/BuildApplication.js
CHANGED
|
@@ -20,6 +20,9 @@ const node_child_process_1 = require("node:child_process");
|
|
|
20
20
|
function timestamp() {
|
|
21
21
|
return new Date().toISOString().replace(/[-:TZ.]/g, "");
|
|
22
22
|
}
|
|
23
|
+
function logTimestamp() {
|
|
24
|
+
return new Date().toISOString();
|
|
25
|
+
}
|
|
23
26
|
function normalizePackageWebframezPlugins(value) {
|
|
24
27
|
if (!value) {
|
|
25
28
|
return [];
|
|
@@ -52,19 +55,21 @@ class BuildApplication {
|
|
|
52
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
56
|
const context = this.createContext();
|
|
54
57
|
const plugins = this.loadPlugins();
|
|
58
|
+
const startedAt = Date.now();
|
|
59
|
+
this.logBuildStep("start", `outDir=${this.outDir}`);
|
|
55
60
|
yield promises_1.default.rm(this.stagingDir, { recursive: true, force: true });
|
|
56
61
|
yield promises_1.default.mkdir(this.stagingDir, { recursive: true });
|
|
57
62
|
try {
|
|
58
63
|
yield this.callHook(plugins, "beforeBuild", context);
|
|
59
|
-
yield this.runTypescriptBuild(context);
|
|
64
|
+
yield this.runStep("typescript", () => this.runTypescriptBuild(context));
|
|
60
65
|
yield this.callHook(plugins, "afterTypescriptBuild", context);
|
|
61
|
-
yield this.copyRuntimeFiles();
|
|
66
|
+
yield this.runStep("runtime files", () => this.copyRuntimeFiles());
|
|
62
67
|
yield this.callHook(plugins, "afterRuntimeFilesCopied", context);
|
|
63
68
|
yield this.callHook(plugins, "buildAssets", context);
|
|
64
|
-
yield this.validateCoreBuild();
|
|
69
|
+
yield this.runStep("core validation", () => this.validateCoreBuild());
|
|
65
70
|
yield this.callHook(plugins, "validateBuild", context);
|
|
66
|
-
yield this.promoteBuild();
|
|
67
|
-
console.log(`[webframez] Build ready: ${node_path_1.default.relative(this.projectRoot, this.outDir) || this.outDir}`);
|
|
71
|
+
yield this.runStep("promote", () => this.promoteBuild());
|
|
72
|
+
console.log(`[webframez] Build ready: ${node_path_1.default.relative(this.projectRoot, this.outDir) || this.outDir} (${Math.round((Date.now() - startedAt) / 1000)}s)`);
|
|
68
73
|
}
|
|
69
74
|
catch (error) {
|
|
70
75
|
yield promises_1.default.rm(this.stagingDir, { recursive: true, force: true });
|
|
@@ -72,6 +77,24 @@ class BuildApplication {
|
|
|
72
77
|
}
|
|
73
78
|
});
|
|
74
79
|
}
|
|
80
|
+
logBuildStep(label, details = "") {
|
|
81
|
+
console.log(`[webframez] [${logTimestamp()}] ${label}${details ? `: ${details}` : ""}`);
|
|
82
|
+
}
|
|
83
|
+
runStep(label, callback) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const startedAt = Date.now();
|
|
86
|
+
this.logBuildStep(`${label}:start`);
|
|
87
|
+
try {
|
|
88
|
+
const result = yield callback();
|
|
89
|
+
this.logBuildStep(`${label}:done`, `${Math.round((Date.now() - startedAt) / 1000)}s`);
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
this.logBuildStep(`${label}:failed`, `${Math.round((Date.now() - startedAt) / 1000)}s`);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
75
98
|
createContext() {
|
|
76
99
|
return {
|
|
77
100
|
projectRoot: this.projectRoot,
|
|
@@ -236,7 +259,13 @@ class BuildApplication {
|
|
|
236
259
|
env: Object.assign(Object.assign({}, process.env), envAdditions),
|
|
237
260
|
});
|
|
238
261
|
child.on("error", reject);
|
|
239
|
-
child.on("close", (code) =>
|
|
262
|
+
child.on("close", (code, signal) => {
|
|
263
|
+
if (signal) {
|
|
264
|
+
reject(new Error(`${binaryName} exited with signal ${signal}`));
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
resolve(code !== null && code !== void 0 ? code : 0);
|
|
268
|
+
});
|
|
240
269
|
});
|
|
241
270
|
}
|
|
242
271
|
resolveBinary(name) {
|
|
@@ -57,6 +57,11 @@ export declare class Datatable {
|
|
|
57
57
|
entries: any;
|
|
58
58
|
sums: any;
|
|
59
59
|
}>;
|
|
60
|
+
stats(req: Request): Promise<Array<{
|
|
61
|
+
label: string;
|
|
62
|
+
type: string;
|
|
63
|
+
value: any;
|
|
64
|
+
}>>;
|
|
60
65
|
getTotalData(req: Request): Promise<any>;
|
|
61
66
|
getFilter(req: Request): Promise<any>;
|
|
62
67
|
getColumns(req: Request): Promise<any>;
|
|
@@ -312,6 +312,11 @@ class Datatable {
|
|
|
312
312
|
return data;
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
|
+
stats(req) {
|
|
316
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
317
|
+
return [];
|
|
318
|
+
});
|
|
319
|
+
}
|
|
315
320
|
getTotalData(req) {
|
|
316
321
|
return __awaiter(this, void 0, void 0, function* () {
|
|
317
322
|
const aggregation = [];
|
|
@@ -43,6 +43,12 @@ class DatatableController extends Controller_1.Controller {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
const table = new tableClass();
|
|
46
|
+
if (req.body.type === "stats" || req.body.mode === "stats") {
|
|
47
|
+
return res.send({
|
|
48
|
+
status: "success",
|
|
49
|
+
data: yield table.stats(req),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
46
52
|
if (req.body.apiFunction && typeof req.body.apiFunction === "string" && req.body.apiFunction.trim() !== "") {
|
|
47
53
|
const func = (_a = table.selectableFunctions) === null || _a === void 0 ? void 0 : _a[req.body.apiFunction];
|
|
48
54
|
if (!func || !func.handle) {
|
package/package.json
CHANGED