@squiz/render-runtime-lib 1.2.1-alpha.81 → 1.2.1-alpha.84
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/lib/index.d.ts +1 -0
- package/lib/index.js +215 -121
- package/lib/index.js.map +3 -3
- package/lib/migrations/20220718172237_adding_component_sets.sql +23 -0
- package/lib/migrations/20220728113941_add_env_vars_field.sql +1 -0
- package/lib/webserver/controllers/core.spec.d.ts +1 -0
- package/lib/webserver/index.d.ts +5 -1
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -19873,16 +19873,16 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
|
19873
19873
|
return prev;
|
|
19874
19874
|
}, {});
|
|
19875
19875
|
}
|
|
19876
|
-
getConnection() {
|
|
19877
|
-
return this.pool.connect();
|
|
19876
|
+
async getConnection() {
|
|
19877
|
+
return await this.pool.connect();
|
|
19878
19878
|
}
|
|
19879
|
-
async create(value) {
|
|
19879
|
+
async create(value, transactionClient = null) {
|
|
19880
19880
|
const columns = Object.keys(value).map((a) => `"${this.modelPropertyToSqlColumn[a]}"`).join(", ");
|
|
19881
19881
|
const values = Object.values(value).map((a, index) => `$${index + 1}`).join(", ");
|
|
19882
|
-
const result = await this.executeQuery(`INSERT INTO ${this.tableName} (${columns}) VALUES (${values}) RETURNING *`, Object.values(value));
|
|
19882
|
+
const result = await this.executeQuery(`INSERT INTO ${this.tableName} (${columns}) VALUES (${values}) RETURNING *`, Object.values(value), transactionClient);
|
|
19883
19883
|
return result[0];
|
|
19884
19884
|
}
|
|
19885
|
-
async update(where, newValue) {
|
|
19885
|
+
async update(where, newValue, transactionClient = null) {
|
|
19886
19886
|
const whereValues = Object.values(where);
|
|
19887
19887
|
const newValues = Object.values(newValue);
|
|
19888
19888
|
const setString = Object.keys(newValue).map((a, index) => `"${this.modelPropertyToSqlColumn[a]}" = $${index + 1}`).join(", ");
|
|
@@ -19890,17 +19890,19 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
|
19890
19890
|
const result = await this.executeQuery(`UPDATE ${this.tableName}
|
|
19891
19891
|
SET ${setString}
|
|
19892
19892
|
WHERE ${whereString}
|
|
19893
|
-
RETURNING *`, [...Object.values(newValues), ...Object.values(whereValues)]);
|
|
19893
|
+
RETURNING *`, [...Object.values(newValues), ...Object.values(whereValues)], transactionClient);
|
|
19894
19894
|
return result;
|
|
19895
19895
|
}
|
|
19896
|
-
async delete(where) {
|
|
19897
|
-
const client = await this.
|
|
19896
|
+
async delete(where, transactionClient = null) {
|
|
19897
|
+
const client = transactionClient ?? await this.getConnection();
|
|
19898
19898
|
try {
|
|
19899
19899
|
const whereString = this.createWhereStringFromPartialModel(where);
|
|
19900
19900
|
const result = await client.query(`DELETE FROM ${this.tableName} WHERE ${whereString}`, Object.values(where));
|
|
19901
19901
|
return result.rowCount;
|
|
19902
19902
|
} finally {
|
|
19903
|
-
client
|
|
19903
|
+
if (client && !transactionClient) {
|
|
19904
|
+
client.release();
|
|
19905
|
+
}
|
|
19904
19906
|
}
|
|
19905
19907
|
}
|
|
19906
19908
|
createWhereStringFromPartialModel(values, initialIndex = 0) {
|
|
@@ -19914,13 +19916,13 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
|
19914
19916
|
}, "");
|
|
19915
19917
|
return sql;
|
|
19916
19918
|
}
|
|
19917
|
-
async executeQuery(query, values) {
|
|
19918
|
-
const client = await this.
|
|
19919
|
+
async executeQuery(query, values, transactionClient = null) {
|
|
19920
|
+
const client = transactionClient ?? await this.getConnection();
|
|
19919
19921
|
try {
|
|
19920
19922
|
const result = await client.query(query, values);
|
|
19921
19923
|
return result.rows.map((a) => this.createAndHydrateModel(a));
|
|
19922
19924
|
} finally {
|
|
19923
|
-
if (client) {
|
|
19925
|
+
if (client && !transactionClient) {
|
|
19924
19926
|
client.release();
|
|
19925
19927
|
}
|
|
19926
19928
|
}
|
|
@@ -19945,6 +19947,11 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
|
19945
19947
|
WHERE ${this.createWhereStringFromPartialModel(item)}`, Object.values(item));
|
|
19946
19948
|
return result;
|
|
19947
19949
|
}
|
|
19950
|
+
async findAll() {
|
|
19951
|
+
const result = await this.executeQuery(`SELECT *
|
|
19952
|
+
FROM ${this.tableName}`, []);
|
|
19953
|
+
return result;
|
|
19954
|
+
}
|
|
19948
19955
|
};
|
|
19949
19956
|
var ComponentRepository = class extends AbstractRepository {
|
|
19950
19957
|
constructor(options) {
|
|
@@ -20111,7 +20118,60 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
|
20111
20118
|
setTimeout(resolve, timeMs);
|
|
20112
20119
|
});
|
|
20113
20120
|
}
|
|
20114
|
-
var migration_list_default = [
|
|
20121
|
+
var migration_list_default = [
|
|
20122
|
+
"20220704054051_initial.sql",
|
|
20123
|
+
"20220718172237_adding_component_sets.sql",
|
|
20124
|
+
"20220728113941_add_env_vars_field.sql"
|
|
20125
|
+
];
|
|
20126
|
+
var ComponentSet = class {
|
|
20127
|
+
constructor() {
|
|
20128
|
+
this.webPath = "";
|
|
20129
|
+
this.displayName = "";
|
|
20130
|
+
this.envVars = {};
|
|
20131
|
+
this.description = "";
|
|
20132
|
+
this.headers = {};
|
|
20133
|
+
}
|
|
20134
|
+
};
|
|
20135
|
+
var ComponentSetRepository = class extends AbstractRepository {
|
|
20136
|
+
constructor(options) {
|
|
20137
|
+
super(options.repositories, options.pool, "component_set", {
|
|
20138
|
+
webPath: "web_path",
|
|
20139
|
+
displayName: "display_name",
|
|
20140
|
+
description: "description",
|
|
20141
|
+
envVars: "env_vars",
|
|
20142
|
+
headers: "headers"
|
|
20143
|
+
}, ComponentSet);
|
|
20144
|
+
}
|
|
20145
|
+
async getComponentSetByWebPath(webPath) {
|
|
20146
|
+
return this.findOne({ webPath });
|
|
20147
|
+
}
|
|
20148
|
+
async componentSetExists(webPath) {
|
|
20149
|
+
const comp = await this.getComponentSetByWebPath(webPath);
|
|
20150
|
+
return comp != null;
|
|
20151
|
+
}
|
|
20152
|
+
};
|
|
20153
|
+
var ComponentSetComponentVersion = class {
|
|
20154
|
+
constructor() {
|
|
20155
|
+
this.componentSetWebPath = "";
|
|
20156
|
+
this.componentName = "";
|
|
20157
|
+
this.componentVersion = "";
|
|
20158
|
+
this.envVars = {};
|
|
20159
|
+
}
|
|
20160
|
+
};
|
|
20161
|
+
var ComponentSetComponentVersionRepository = class extends AbstractRepository {
|
|
20162
|
+
constructor(options) {
|
|
20163
|
+
super(options.repositories, options.pool, "component_set_component_version", {
|
|
20164
|
+
componentSetWebPath: "component_set_web_path",
|
|
20165
|
+
componentName: "component_name",
|
|
20166
|
+
componentVersion: "component_version",
|
|
20167
|
+
envVars: "env_vars"
|
|
20168
|
+
}, ComponentSetComponentVersion);
|
|
20169
|
+
}
|
|
20170
|
+
async componentSetComponentVersionExists(componentSetWebPath, componentName, componentVersion) {
|
|
20171
|
+
const row = await this.findOne({ componentSetWebPath, componentName, componentVersion });
|
|
20172
|
+
return row != null;
|
|
20173
|
+
}
|
|
20174
|
+
};
|
|
20115
20175
|
var ConnectionManager2 = class {
|
|
20116
20176
|
constructor(applicationName, connection, migrationDirectory) {
|
|
20117
20177
|
this.applicationName = applicationName;
|
|
@@ -20132,7 +20192,9 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
|
20132
20192
|
});
|
|
20133
20193
|
this.repositories = {
|
|
20134
20194
|
component: new ComponentRepository(this),
|
|
20135
|
-
componentVersion: new ComponentVersionRepository(this)
|
|
20195
|
+
componentVersion: new ComponentVersionRepository(this),
|
|
20196
|
+
componentSet: new ComponentSetRepository(this),
|
|
20197
|
+
componentSetComponentVersion: new ComponentSetComponentVersionRepository(this)
|
|
20136
20198
|
};
|
|
20137
20199
|
}
|
|
20138
20200
|
async applyMigrations() {
|
|
@@ -20144,6 +20206,22 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
|
|
|
20144
20206
|
await this.pool.end();
|
|
20145
20207
|
this.pool.removeAllListeners();
|
|
20146
20208
|
}
|
|
20209
|
+
async executeInTransaction(func) {
|
|
20210
|
+
const client = await this.pool.connect();
|
|
20211
|
+
try {
|
|
20212
|
+
await client.query("BEGIN");
|
|
20213
|
+
const value = await func(client);
|
|
20214
|
+
await client.query("COMMIT");
|
|
20215
|
+
return value;
|
|
20216
|
+
} catch (e) {
|
|
20217
|
+
await client.query("ROLLBACK");
|
|
20218
|
+
throw e;
|
|
20219
|
+
} finally {
|
|
20220
|
+
if (client) {
|
|
20221
|
+
client.release();
|
|
20222
|
+
}
|
|
20223
|
+
}
|
|
20224
|
+
}
|
|
20147
20225
|
};
|
|
20148
20226
|
var import_client_secrets_manager = __toESM2(require_dist_cjs44());
|
|
20149
20227
|
async function getConnectionInfo2(config) {
|
|
@@ -26671,11 +26749,11 @@ var require_codegen = __commonJS({
|
|
|
26671
26749
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
26672
26750
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
26673
26751
|
}
|
|
26674
|
-
optimizeNames(names,
|
|
26752
|
+
optimizeNames(names, constants2) {
|
|
26675
26753
|
if (!names[this.name.str])
|
|
26676
26754
|
return;
|
|
26677
26755
|
if (this.rhs)
|
|
26678
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
26756
|
+
this.rhs = optimizeExpr(this.rhs, names, constants2);
|
|
26679
26757
|
return this;
|
|
26680
26758
|
}
|
|
26681
26759
|
get names() {
|
|
@@ -26692,10 +26770,10 @@ var require_codegen = __commonJS({
|
|
|
26692
26770
|
render({ _n }) {
|
|
26693
26771
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
26694
26772
|
}
|
|
26695
|
-
optimizeNames(names,
|
|
26773
|
+
optimizeNames(names, constants2) {
|
|
26696
26774
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
26697
26775
|
return;
|
|
26698
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
26776
|
+
this.rhs = optimizeExpr(this.rhs, names, constants2);
|
|
26699
26777
|
return this;
|
|
26700
26778
|
}
|
|
26701
26779
|
get names() {
|
|
@@ -26756,8 +26834,8 @@ var require_codegen = __commonJS({
|
|
|
26756
26834
|
optimizeNodes() {
|
|
26757
26835
|
return `${this.code}` ? this : void 0;
|
|
26758
26836
|
}
|
|
26759
|
-
optimizeNames(names,
|
|
26760
|
-
this.code = optimizeExpr(this.code, names,
|
|
26837
|
+
optimizeNames(names, constants2) {
|
|
26838
|
+
this.code = optimizeExpr(this.code, names, constants2);
|
|
26761
26839
|
return this;
|
|
26762
26840
|
}
|
|
26763
26841
|
get names() {
|
|
@@ -26786,12 +26864,12 @@ var require_codegen = __commonJS({
|
|
|
26786
26864
|
}
|
|
26787
26865
|
return nodes.length > 0 ? this : void 0;
|
|
26788
26866
|
}
|
|
26789
|
-
optimizeNames(names,
|
|
26867
|
+
optimizeNames(names, constants2) {
|
|
26790
26868
|
const { nodes } = this;
|
|
26791
26869
|
let i = nodes.length;
|
|
26792
26870
|
while (i--) {
|
|
26793
26871
|
const n = nodes[i];
|
|
26794
|
-
if (n.optimizeNames(names,
|
|
26872
|
+
if (n.optimizeNames(names, constants2))
|
|
26795
26873
|
continue;
|
|
26796
26874
|
subtractNames(names, n.names);
|
|
26797
26875
|
nodes.splice(i, 1);
|
|
@@ -26844,12 +26922,12 @@ var require_codegen = __commonJS({
|
|
|
26844
26922
|
return void 0;
|
|
26845
26923
|
return this;
|
|
26846
26924
|
}
|
|
26847
|
-
optimizeNames(names,
|
|
26925
|
+
optimizeNames(names, constants2) {
|
|
26848
26926
|
var _a;
|
|
26849
|
-
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names,
|
|
26850
|
-
if (!(super.optimizeNames(names,
|
|
26927
|
+
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants2);
|
|
26928
|
+
if (!(super.optimizeNames(names, constants2) || this.else))
|
|
26851
26929
|
return;
|
|
26852
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
26930
|
+
this.condition = optimizeExpr(this.condition, names, constants2);
|
|
26853
26931
|
return this;
|
|
26854
26932
|
}
|
|
26855
26933
|
get names() {
|
|
@@ -26872,10 +26950,10 @@ var require_codegen = __commonJS({
|
|
|
26872
26950
|
render(opts) {
|
|
26873
26951
|
return `for(${this.iteration})` + super.render(opts);
|
|
26874
26952
|
}
|
|
26875
|
-
optimizeNames(names,
|
|
26876
|
-
if (!super.optimizeNames(names,
|
|
26953
|
+
optimizeNames(names, constants2) {
|
|
26954
|
+
if (!super.optimizeNames(names, constants2))
|
|
26877
26955
|
return;
|
|
26878
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
26956
|
+
this.iteration = optimizeExpr(this.iteration, names, constants2);
|
|
26879
26957
|
return this;
|
|
26880
26958
|
}
|
|
26881
26959
|
get names() {
|
|
@@ -26911,10 +26989,10 @@ var require_codegen = __commonJS({
|
|
|
26911
26989
|
render(opts) {
|
|
26912
26990
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
26913
26991
|
}
|
|
26914
|
-
optimizeNames(names,
|
|
26915
|
-
if (!super.optimizeNames(names,
|
|
26992
|
+
optimizeNames(names, constants2) {
|
|
26993
|
+
if (!super.optimizeNames(names, constants2))
|
|
26916
26994
|
return;
|
|
26917
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
26995
|
+
this.iterable = optimizeExpr(this.iterable, names, constants2);
|
|
26918
26996
|
return this;
|
|
26919
26997
|
}
|
|
26920
26998
|
get names() {
|
|
@@ -26956,11 +27034,11 @@ var require_codegen = __commonJS({
|
|
|
26956
27034
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
26957
27035
|
return this;
|
|
26958
27036
|
}
|
|
26959
|
-
optimizeNames(names,
|
|
27037
|
+
optimizeNames(names, constants2) {
|
|
26960
27038
|
var _a, _b;
|
|
26961
|
-
super.optimizeNames(names,
|
|
26962
|
-
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names,
|
|
26963
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names,
|
|
27039
|
+
super.optimizeNames(names, constants2);
|
|
27040
|
+
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants2);
|
|
27041
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants2);
|
|
26964
27042
|
return this;
|
|
26965
27043
|
}
|
|
26966
27044
|
get names() {
|
|
@@ -27230,7 +27308,7 @@ var require_codegen = __commonJS({
|
|
|
27230
27308
|
function addExprNames(names, from) {
|
|
27231
27309
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
27232
27310
|
}
|
|
27233
|
-
function optimizeExpr(expr, names,
|
|
27311
|
+
function optimizeExpr(expr, names, constants2) {
|
|
27234
27312
|
if (expr instanceof code_1.Name)
|
|
27235
27313
|
return replaceName(expr);
|
|
27236
27314
|
if (!canOptimize(expr))
|
|
@@ -27245,14 +27323,14 @@ var require_codegen = __commonJS({
|
|
|
27245
27323
|
return items;
|
|
27246
27324
|
}, []));
|
|
27247
27325
|
function replaceName(n) {
|
|
27248
|
-
const c =
|
|
27326
|
+
const c = constants2[n.str];
|
|
27249
27327
|
if (c === void 0 || names[n.str] !== 1)
|
|
27250
27328
|
return n;
|
|
27251
27329
|
delete names[n.str];
|
|
27252
27330
|
return c;
|
|
27253
27331
|
}
|
|
27254
27332
|
function canOptimize(e) {
|
|
27255
|
-
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
27333
|
+
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants2[c.str] !== void 0);
|
|
27256
27334
|
}
|
|
27257
27335
|
}
|
|
27258
27336
|
function subtractNames(names, from) {
|
|
@@ -38369,7 +38447,7 @@ var require_universalify = __commonJS({
|
|
|
38369
38447
|
// ../component-lib/node_modules/graceful-fs/polyfills.js
|
|
38370
38448
|
var require_polyfills = __commonJS({
|
|
38371
38449
|
"../component-lib/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
|
|
38372
|
-
var
|
|
38450
|
+
var constants2 = require("constants");
|
|
38373
38451
|
var origCwd = process.cwd;
|
|
38374
38452
|
var cwd = null;
|
|
38375
38453
|
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
@@ -38394,7 +38472,7 @@ var require_polyfills = __commonJS({
|
|
|
38394
38472
|
var chdir;
|
|
38395
38473
|
module2.exports = patch;
|
|
38396
38474
|
function patch(fs) {
|
|
38397
|
-
if (
|
|
38475
|
+
if (constants2.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
38398
38476
|
patchLchmod(fs);
|
|
38399
38477
|
}
|
|
38400
38478
|
if (!fs.lutimes) {
|
|
@@ -38499,7 +38577,7 @@ var require_polyfills = __commonJS({
|
|
|
38499
38577
|
}(fs.readSync);
|
|
38500
38578
|
function patchLchmod(fs2) {
|
|
38501
38579
|
fs2.lchmod = function(path7, mode, callback) {
|
|
38502
|
-
fs2.open(path7,
|
|
38580
|
+
fs2.open(path7, constants2.O_WRONLY | constants2.O_SYMLINK, mode, function(err, fd) {
|
|
38503
38581
|
if (err) {
|
|
38504
38582
|
if (callback)
|
|
38505
38583
|
callback(err);
|
|
@@ -38514,7 +38592,7 @@ var require_polyfills = __commonJS({
|
|
|
38514
38592
|
});
|
|
38515
38593
|
};
|
|
38516
38594
|
fs2.lchmodSync = function(path7, mode) {
|
|
38517
|
-
var fd = fs2.openSync(path7,
|
|
38595
|
+
var fd = fs2.openSync(path7, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
|
|
38518
38596
|
var threw = true;
|
|
38519
38597
|
var ret;
|
|
38520
38598
|
try {
|
|
@@ -38534,9 +38612,9 @@ var require_polyfills = __commonJS({
|
|
|
38534
38612
|
};
|
|
38535
38613
|
}
|
|
38536
38614
|
function patchLutimes(fs2) {
|
|
38537
|
-
if (
|
|
38615
|
+
if (constants2.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
|
|
38538
38616
|
fs2.lutimes = function(path7, at, mt, cb) {
|
|
38539
|
-
fs2.open(path7,
|
|
38617
|
+
fs2.open(path7, constants2.O_SYMLINK, function(er, fd) {
|
|
38540
38618
|
if (er) {
|
|
38541
38619
|
if (cb)
|
|
38542
38620
|
cb(er);
|
|
@@ -38551,7 +38629,7 @@ var require_polyfills = __commonJS({
|
|
|
38551
38629
|
});
|
|
38552
38630
|
};
|
|
38553
38631
|
fs2.lutimesSync = function(path7, at, mt) {
|
|
38554
|
-
var fd = fs2.openSync(path7,
|
|
38632
|
+
var fd = fs2.openSync(path7, constants2.O_SYMLINK);
|
|
38555
38633
|
var ret;
|
|
38556
38634
|
var threw = true;
|
|
38557
38635
|
try {
|
|
@@ -55582,14 +55660,14 @@ var require_zip_archive_entry = __commonJS({
|
|
|
55582
55660
|
var ArchiveEntry = require_archive_entry();
|
|
55583
55661
|
var GeneralPurposeBit = require_general_purpose_bit();
|
|
55584
55662
|
var UnixStat = require_unix_stat();
|
|
55585
|
-
var
|
|
55663
|
+
var constants2 = require_constants();
|
|
55586
55664
|
var zipUtil = require_util5();
|
|
55587
55665
|
var ZipArchiveEntry = module2.exports = function(name) {
|
|
55588
55666
|
if (!(this instanceof ZipArchiveEntry)) {
|
|
55589
55667
|
return new ZipArchiveEntry(name);
|
|
55590
55668
|
}
|
|
55591
55669
|
ArchiveEntry.call(this);
|
|
55592
|
-
this.platform =
|
|
55670
|
+
this.platform = constants2.PLATFORM_FAT;
|
|
55593
55671
|
this.method = -1;
|
|
55594
55672
|
this.name = null;
|
|
55595
55673
|
this.size = 0;
|
|
@@ -55597,7 +55675,7 @@ var require_zip_archive_entry = __commonJS({
|
|
|
55597
55675
|
this.gpb = new GeneralPurposeBit();
|
|
55598
55676
|
this.crc = 0;
|
|
55599
55677
|
this.time = -1;
|
|
55600
|
-
this.minver =
|
|
55678
|
+
this.minver = constants2.MIN_VERSION_INITIAL;
|
|
55601
55679
|
this.mode = -1;
|
|
55602
55680
|
this.extra = null;
|
|
55603
55681
|
this.exattr = 0;
|
|
@@ -55624,7 +55702,7 @@ var require_zip_archive_entry = __commonJS({
|
|
|
55624
55702
|
return this.exattr;
|
|
55625
55703
|
};
|
|
55626
55704
|
ZipArchiveEntry.prototype.getExtra = function() {
|
|
55627
|
-
return this.extra !== null ? this.extra :
|
|
55705
|
+
return this.extra !== null ? this.extra : constants2.EMPTY;
|
|
55628
55706
|
};
|
|
55629
55707
|
ZipArchiveEntry.prototype.getGeneralPurposeBit = function() {
|
|
55630
55708
|
return this.gpb;
|
|
@@ -55657,7 +55735,7 @@ var require_zip_archive_entry = __commonJS({
|
|
|
55657
55735
|
return this.time !== -1 ? this.time : 0;
|
|
55658
55736
|
};
|
|
55659
55737
|
ZipArchiveEntry.prototype.getUnixMode = function() {
|
|
55660
|
-
return this.platform !==
|
|
55738
|
+
return this.platform !== constants2.PLATFORM_UNIX ? 0 : this.getExternalAttributes() >> constants2.SHORT_SHIFT & constants2.SHORT_MASK;
|
|
55661
55739
|
};
|
|
55662
55740
|
ZipArchiveEntry.prototype.getVersionNeededToExtract = function() {
|
|
55663
55741
|
return this.minver;
|
|
@@ -55727,12 +55805,12 @@ var require_zip_archive_entry = __commonJS({
|
|
|
55727
55805
|
this.time = zipUtil.dateToDos(time, forceLocalTime);
|
|
55728
55806
|
};
|
|
55729
55807
|
ZipArchiveEntry.prototype.setUnixMode = function(mode) {
|
|
55730
|
-
mode |= this.isDirectory() ?
|
|
55808
|
+
mode |= this.isDirectory() ? constants2.S_IFDIR : constants2.S_IFREG;
|
|
55731
55809
|
var extattr = 0;
|
|
55732
|
-
extattr |= mode <<
|
|
55810
|
+
extattr |= mode << constants2.SHORT_SHIFT | (this.isDirectory() ? constants2.S_DOS_D : constants2.S_DOS_A);
|
|
55733
55811
|
this.setExternalAttributes(extattr);
|
|
55734
|
-
this.mode = mode &
|
|
55735
|
-
this.platform =
|
|
55812
|
+
this.mode = mode & constants2.MODE_MASK;
|
|
55813
|
+
this.platform = constants2.PLATFORM_UNIX;
|
|
55736
55814
|
};
|
|
55737
55815
|
ZipArchiveEntry.prototype.setVersionNeededToExtract = function(minver) {
|
|
55738
55816
|
this.minver = minver;
|
|
@@ -55744,7 +55822,7 @@ var require_zip_archive_entry = __commonJS({
|
|
|
55744
55822
|
return (this.getUnixMode() & UnixStat.FILE_TYPE_FLAG) === UnixStat.LINK_FLAG;
|
|
55745
55823
|
};
|
|
55746
55824
|
ZipArchiveEntry.prototype.isZip64 = function() {
|
|
55747
|
-
return this.csize >
|
|
55825
|
+
return this.csize > constants2.ZIP64_MAGIC || this.size > constants2.ZIP64_MAGIC;
|
|
55748
55826
|
};
|
|
55749
55827
|
}
|
|
55750
55828
|
});
|
|
@@ -56375,7 +56453,7 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56375
56453
|
var ArchiveOutputStream = require_archive_output_stream();
|
|
56376
56454
|
var ZipArchiveEntry = require_zip_archive_entry();
|
|
56377
56455
|
var GeneralPurposeBit = require_general_purpose_bit();
|
|
56378
|
-
var
|
|
56456
|
+
var constants2 = require_constants();
|
|
56379
56457
|
var util = require_util6();
|
|
56380
56458
|
var zipUtil = require_util5();
|
|
56381
56459
|
var ZipArchiveOutputStream = module2.exports = function(options) {
|
|
@@ -56411,21 +56489,21 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56411
56489
|
};
|
|
56412
56490
|
ZipArchiveOutputStream.prototype._appendBuffer = function(ae, source, callback) {
|
|
56413
56491
|
if (source.length === 0) {
|
|
56414
|
-
ae.setMethod(
|
|
56492
|
+
ae.setMethod(constants2.METHOD_STORED);
|
|
56415
56493
|
}
|
|
56416
56494
|
var method = ae.getMethod();
|
|
56417
|
-
if (method ===
|
|
56495
|
+
if (method === constants2.METHOD_STORED) {
|
|
56418
56496
|
ae.setSize(source.length);
|
|
56419
56497
|
ae.setCompressedSize(source.length);
|
|
56420
56498
|
ae.setCrc(crc32.unsigned(source));
|
|
56421
56499
|
}
|
|
56422
56500
|
this._writeLocalFileHeader(ae);
|
|
56423
|
-
if (method ===
|
|
56501
|
+
if (method === constants2.METHOD_STORED) {
|
|
56424
56502
|
this.write(source);
|
|
56425
56503
|
this._afterAppend(ae);
|
|
56426
56504
|
callback(null, ae);
|
|
56427
56505
|
return;
|
|
56428
|
-
} else if (method ===
|
|
56506
|
+
} else if (method === constants2.METHOD_DEFLATED) {
|
|
56429
56507
|
this._smartStream(ae, callback).end(source);
|
|
56430
56508
|
return;
|
|
56431
56509
|
} else {
|
|
@@ -56435,7 +56513,7 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56435
56513
|
};
|
|
56436
56514
|
ZipArchiveOutputStream.prototype._appendStream = function(ae, source, callback) {
|
|
56437
56515
|
ae.getGeneralPurposeBit().useDataDescriptor(true);
|
|
56438
|
-
ae.setVersionNeededToExtract(
|
|
56516
|
+
ae.setVersionNeededToExtract(constants2.MIN_VERSION_DATA_DESCRIPTOR);
|
|
56439
56517
|
this._writeLocalFileHeader(ae);
|
|
56440
56518
|
var smart = this._smartStream(ae, callback);
|
|
56441
56519
|
source.once("error", function(err) {
|
|
@@ -56452,7 +56530,7 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56452
56530
|
o.zlib = {};
|
|
56453
56531
|
}
|
|
56454
56532
|
if (typeof o.zlib.level !== "number") {
|
|
56455
|
-
o.zlib.level =
|
|
56533
|
+
o.zlib.level = constants2.ZLIB_BEST_SPEED;
|
|
56456
56534
|
}
|
|
56457
56535
|
o.forceZip64 = !!o.forceZip64;
|
|
56458
56536
|
o.forceLocalTime = !!o.forceLocalTime;
|
|
@@ -56475,11 +56553,11 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56475
56553
|
};
|
|
56476
56554
|
ZipArchiveOutputStream.prototype._normalizeEntry = function(ae) {
|
|
56477
56555
|
if (ae.getMethod() === -1) {
|
|
56478
|
-
ae.setMethod(
|
|
56556
|
+
ae.setMethod(constants2.METHOD_DEFLATED);
|
|
56479
56557
|
}
|
|
56480
|
-
if (ae.getMethod() ===
|
|
56558
|
+
if (ae.getMethod() === constants2.METHOD_DEFLATED) {
|
|
56481
56559
|
ae.getGeneralPurposeBit().useDataDescriptor(true);
|
|
56482
|
-
ae.setVersionNeededToExtract(
|
|
56560
|
+
ae.setVersionNeededToExtract(constants2.MIN_VERSION_DATA_DESCRIPTOR);
|
|
56483
56561
|
}
|
|
56484
56562
|
if (ae.getTime() === -1) {
|
|
56485
56563
|
ae.setTime(new Date(), this._archive.forceLocalTime);
|
|
@@ -56491,7 +56569,7 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56491
56569
|
};
|
|
56492
56570
|
};
|
|
56493
56571
|
ZipArchiveOutputStream.prototype._smartStream = function(ae, callback) {
|
|
56494
|
-
var deflate = ae.getMethod() ===
|
|
56572
|
+
var deflate = ae.getMethod() === constants2.METHOD_DEFLATED;
|
|
56495
56573
|
var process2 = deflate ? new DeflateCRC32Stream(this.options.zlib) : new CRC32Stream();
|
|
56496
56574
|
var error = null;
|
|
56497
56575
|
function handleStuff() {
|
|
@@ -56514,13 +56592,13 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56514
56592
|
var size = this._archive.centralLength;
|
|
56515
56593
|
var offset = this._archive.centralOffset;
|
|
56516
56594
|
if (this.isZip64()) {
|
|
56517
|
-
records =
|
|
56518
|
-
size =
|
|
56519
|
-
offset =
|
|
56595
|
+
records = constants2.ZIP64_MAGIC_SHORT;
|
|
56596
|
+
size = constants2.ZIP64_MAGIC;
|
|
56597
|
+
offset = constants2.ZIP64_MAGIC;
|
|
56520
56598
|
}
|
|
56521
|
-
this.write(zipUtil.getLongBytes(
|
|
56522
|
-
this.write(
|
|
56523
|
-
this.write(
|
|
56599
|
+
this.write(zipUtil.getLongBytes(constants2.SIG_EOCD));
|
|
56600
|
+
this.write(constants2.SHORT_ZERO);
|
|
56601
|
+
this.write(constants2.SHORT_ZERO);
|
|
56524
56602
|
this.write(zipUtil.getShortBytes(records));
|
|
56525
56603
|
this.write(zipUtil.getShortBytes(records));
|
|
56526
56604
|
this.write(zipUtil.getLongBytes(size));
|
|
@@ -56531,18 +56609,18 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56531
56609
|
this.write(comment);
|
|
56532
56610
|
};
|
|
56533
56611
|
ZipArchiveOutputStream.prototype._writeCentralDirectoryZip64 = function() {
|
|
56534
|
-
this.write(zipUtil.getLongBytes(
|
|
56612
|
+
this.write(zipUtil.getLongBytes(constants2.SIG_ZIP64_EOCD));
|
|
56535
56613
|
this.write(zipUtil.getEightBytes(44));
|
|
56536
|
-
this.write(zipUtil.getShortBytes(
|
|
56537
|
-
this.write(zipUtil.getShortBytes(
|
|
56538
|
-
this.write(
|
|
56539
|
-
this.write(
|
|
56614
|
+
this.write(zipUtil.getShortBytes(constants2.MIN_VERSION_ZIP64));
|
|
56615
|
+
this.write(zipUtil.getShortBytes(constants2.MIN_VERSION_ZIP64));
|
|
56616
|
+
this.write(constants2.LONG_ZERO);
|
|
56617
|
+
this.write(constants2.LONG_ZERO);
|
|
56540
56618
|
this.write(zipUtil.getEightBytes(this._entries.length));
|
|
56541
56619
|
this.write(zipUtil.getEightBytes(this._entries.length));
|
|
56542
56620
|
this.write(zipUtil.getEightBytes(this._archive.centralLength));
|
|
56543
56621
|
this.write(zipUtil.getEightBytes(this._archive.centralOffset));
|
|
56544
|
-
this.write(zipUtil.getLongBytes(
|
|
56545
|
-
this.write(
|
|
56622
|
+
this.write(zipUtil.getLongBytes(constants2.SIG_ZIP64_EOCD_LOC));
|
|
56623
|
+
this.write(constants2.LONG_ZERO);
|
|
56546
56624
|
this.write(zipUtil.getEightBytes(this._archive.centralOffset + this._archive.centralLength));
|
|
56547
56625
|
this.write(zipUtil.getLongBytes(1));
|
|
56548
56626
|
};
|
|
@@ -56552,12 +56630,12 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56552
56630
|
var offsets = ae._offsets;
|
|
56553
56631
|
var size = ae.getSize();
|
|
56554
56632
|
var compressedSize = ae.getCompressedSize();
|
|
56555
|
-
if (ae.isZip64() || offsets.file >
|
|
56556
|
-
size =
|
|
56557
|
-
compressedSize =
|
|
56558
|
-
ae.setVersionNeededToExtract(
|
|
56633
|
+
if (ae.isZip64() || offsets.file > constants2.ZIP64_MAGIC) {
|
|
56634
|
+
size = constants2.ZIP64_MAGIC;
|
|
56635
|
+
compressedSize = constants2.ZIP64_MAGIC;
|
|
56636
|
+
ae.setVersionNeededToExtract(constants2.MIN_VERSION_ZIP64);
|
|
56559
56637
|
var extraBuf = Buffer.concat([
|
|
56560
|
-
zipUtil.getShortBytes(
|
|
56638
|
+
zipUtil.getShortBytes(constants2.ZIP64_EXTRA_ID),
|
|
56561
56639
|
zipUtil.getShortBytes(24),
|
|
56562
56640
|
zipUtil.getEightBytes(ae.getSize()),
|
|
56563
56641
|
zipUtil.getEightBytes(ae.getCompressedSize()),
|
|
@@ -56565,8 +56643,8 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56565
56643
|
], 28);
|
|
56566
56644
|
ae.setExtra(extraBuf);
|
|
56567
56645
|
}
|
|
56568
|
-
this.write(zipUtil.getLongBytes(
|
|
56569
|
-
this.write(zipUtil.getShortBytes(ae.getPlatform() << 8 |
|
|
56646
|
+
this.write(zipUtil.getLongBytes(constants2.SIG_CFH));
|
|
56647
|
+
this.write(zipUtil.getShortBytes(ae.getPlatform() << 8 | constants2.VERSION_MADEBY));
|
|
56570
56648
|
this.write(zipUtil.getShortBytes(ae.getVersionNeededToExtract()));
|
|
56571
56649
|
this.write(gpb.encode());
|
|
56572
56650
|
this.write(zipUtil.getShortBytes(method));
|
|
@@ -56584,11 +56662,11 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56584
56662
|
this.write(zipUtil.getShortBytes(name.length));
|
|
56585
56663
|
this.write(zipUtil.getShortBytes(extra.length));
|
|
56586
56664
|
this.write(zipUtil.getShortBytes(comment.length));
|
|
56587
|
-
this.write(
|
|
56665
|
+
this.write(constants2.SHORT_ZERO);
|
|
56588
56666
|
this.write(zipUtil.getShortBytes(ae.getInternalAttributes()));
|
|
56589
56667
|
this.write(zipUtil.getLongBytes(ae.getExternalAttributes()));
|
|
56590
|
-
if (offsets.file >
|
|
56591
|
-
this.write(zipUtil.getLongBytes(
|
|
56668
|
+
if (offsets.file > constants2.ZIP64_MAGIC) {
|
|
56669
|
+
this.write(zipUtil.getLongBytes(constants2.ZIP64_MAGIC));
|
|
56592
56670
|
} else {
|
|
56593
56671
|
this.write(zipUtil.getLongBytes(offsets.file));
|
|
56594
56672
|
}
|
|
@@ -56597,7 +56675,7 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56597
56675
|
this.write(comment);
|
|
56598
56676
|
};
|
|
56599
56677
|
ZipArchiveOutputStream.prototype._writeDataDescriptor = function(ae) {
|
|
56600
|
-
this.write(zipUtil.getLongBytes(
|
|
56678
|
+
this.write(zipUtil.getLongBytes(constants2.SIG_DD));
|
|
56601
56679
|
this.write(zipUtil.getLongBytes(ae.getCrc()));
|
|
56602
56680
|
if (ae.isZip64()) {
|
|
56603
56681
|
this.write(zipUtil.getEightBytes(ae.getCompressedSize()));
|
|
@@ -56614,22 +56692,22 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56614
56692
|
var extra = ae.getLocalFileDataExtra();
|
|
56615
56693
|
if (ae.isZip64()) {
|
|
56616
56694
|
gpb.useDataDescriptor(true);
|
|
56617
|
-
ae.setVersionNeededToExtract(
|
|
56695
|
+
ae.setVersionNeededToExtract(constants2.MIN_VERSION_ZIP64);
|
|
56618
56696
|
}
|
|
56619
56697
|
if (gpb.usesUTF8ForNames()) {
|
|
56620
56698
|
name = Buffer.from(name);
|
|
56621
56699
|
}
|
|
56622
56700
|
ae._offsets.file = this.offset;
|
|
56623
|
-
this.write(zipUtil.getLongBytes(
|
|
56701
|
+
this.write(zipUtil.getLongBytes(constants2.SIG_LFH));
|
|
56624
56702
|
this.write(zipUtil.getShortBytes(ae.getVersionNeededToExtract()));
|
|
56625
56703
|
this.write(gpb.encode());
|
|
56626
56704
|
this.write(zipUtil.getShortBytes(method));
|
|
56627
56705
|
this.write(zipUtil.getLongBytes(ae.getTimeDos()));
|
|
56628
56706
|
ae._offsets.data = this.offset;
|
|
56629
56707
|
if (gpb.usesDataDescriptor()) {
|
|
56630
|
-
this.write(
|
|
56631
|
-
this.write(
|
|
56632
|
-
this.write(
|
|
56708
|
+
this.write(constants2.LONG_ZERO);
|
|
56709
|
+
this.write(constants2.LONG_ZERO);
|
|
56710
|
+
this.write(constants2.LONG_ZERO);
|
|
56633
56711
|
} else {
|
|
56634
56712
|
this.write(zipUtil.getLongBytes(ae.getCrc()));
|
|
56635
56713
|
this.write(zipUtil.getLongBytes(ae.getCompressedSize()));
|
|
@@ -56645,7 +56723,7 @@ var require_zip_archive_output_stream = __commonJS({
|
|
|
56645
56723
|
return this._archive.comment !== null ? this._archive.comment : "";
|
|
56646
56724
|
};
|
|
56647
56725
|
ZipArchiveOutputStream.prototype.isZip64 = function() {
|
|
56648
|
-
return this._archive.forceZip64 || this._entries.length >
|
|
56726
|
+
return this._archive.forceZip64 || this._entries.length > constants2.ZIP64_MAGIC_SHORT || this._archive.centralLength > constants2.ZIP64_MAGIC || this._archive.centralOffset > constants2.ZIP64_MAGIC;
|
|
56649
56727
|
};
|
|
56650
56728
|
ZipArchiveOutputStream.prototype.setComment = function(comment) {
|
|
56651
56729
|
this._archive.comment = comment;
|
|
@@ -57803,7 +57881,7 @@ var require_end_of_stream2 = __commonJS({
|
|
|
57803
57881
|
// ../component-lib/node_modules/tar-stream/pack.js
|
|
57804
57882
|
var require_pack = __commonJS({
|
|
57805
57883
|
"../component-lib/node_modules/tar-stream/pack.js"(exports2, module2) {
|
|
57806
|
-
var
|
|
57884
|
+
var constants2 = require_fs_constants();
|
|
57807
57885
|
var eos = require_end_of_stream2();
|
|
57808
57886
|
var inherits = require_inherits2();
|
|
57809
57887
|
var alloc = Buffer.alloc;
|
|
@@ -57822,16 +57900,16 @@ var require_pack = __commonJS({
|
|
|
57822
57900
|
self2.push(END_OF_TAR.slice(0, 512 - size));
|
|
57823
57901
|
};
|
|
57824
57902
|
function modeToType(mode) {
|
|
57825
|
-
switch (mode &
|
|
57826
|
-
case
|
|
57903
|
+
switch (mode & constants2.S_IFMT) {
|
|
57904
|
+
case constants2.S_IFBLK:
|
|
57827
57905
|
return "block-device";
|
|
57828
|
-
case
|
|
57906
|
+
case constants2.S_IFCHR:
|
|
57829
57907
|
return "character-device";
|
|
57830
|
-
case
|
|
57908
|
+
case constants2.S_IFDIR:
|
|
57831
57909
|
return "directory";
|
|
57832
|
-
case
|
|
57910
|
+
case constants2.S_IFIFO:
|
|
57833
57911
|
return "fifo";
|
|
57834
|
-
case
|
|
57912
|
+
case constants2.S_IFLNK:
|
|
57835
57913
|
return "symlink";
|
|
57836
57914
|
}
|
|
57837
57915
|
return "file";
|
|
@@ -80935,7 +81013,7 @@ var require_universalify2 = __commonJS({
|
|
|
80935
81013
|
// node_modules/graceful-fs/polyfills.js
|
|
80936
81014
|
var require_polyfills2 = __commonJS({
|
|
80937
81015
|
"node_modules/graceful-fs/polyfills.js"(exports2, module2) {
|
|
80938
|
-
var
|
|
81016
|
+
var constants2 = require("constants");
|
|
80939
81017
|
var origCwd = process.cwd;
|
|
80940
81018
|
var cwd = null;
|
|
80941
81019
|
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
|
|
@@ -80960,7 +81038,7 @@ var require_polyfills2 = __commonJS({
|
|
|
80960
81038
|
var chdir;
|
|
80961
81039
|
module2.exports = patch;
|
|
80962
81040
|
function patch(fs) {
|
|
80963
|
-
if (
|
|
81041
|
+
if (constants2.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
|
|
80964
81042
|
patchLchmod(fs);
|
|
80965
81043
|
}
|
|
80966
81044
|
if (!fs.lutimes) {
|
|
@@ -81065,7 +81143,7 @@ var require_polyfills2 = __commonJS({
|
|
|
81065
81143
|
}(fs.readSync);
|
|
81066
81144
|
function patchLchmod(fs2) {
|
|
81067
81145
|
fs2.lchmod = function(path7, mode, callback) {
|
|
81068
|
-
fs2.open(path7,
|
|
81146
|
+
fs2.open(path7, constants2.O_WRONLY | constants2.O_SYMLINK, mode, function(err, fd) {
|
|
81069
81147
|
if (err) {
|
|
81070
81148
|
if (callback)
|
|
81071
81149
|
callback(err);
|
|
@@ -81080,7 +81158,7 @@ var require_polyfills2 = __commonJS({
|
|
|
81080
81158
|
});
|
|
81081
81159
|
};
|
|
81082
81160
|
fs2.lchmodSync = function(path7, mode) {
|
|
81083
|
-
var fd = fs2.openSync(path7,
|
|
81161
|
+
var fd = fs2.openSync(path7, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
|
|
81084
81162
|
var threw = true;
|
|
81085
81163
|
var ret;
|
|
81086
81164
|
try {
|
|
@@ -81100,9 +81178,9 @@ var require_polyfills2 = __commonJS({
|
|
|
81100
81178
|
};
|
|
81101
81179
|
}
|
|
81102
81180
|
function patchLutimes(fs2) {
|
|
81103
|
-
if (
|
|
81181
|
+
if (constants2.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
|
|
81104
81182
|
fs2.lutimes = function(path7, at, mt, cb) {
|
|
81105
|
-
fs2.open(path7,
|
|
81183
|
+
fs2.open(path7, constants2.O_SYMLINK, function(er, fd) {
|
|
81106
81184
|
if (er) {
|
|
81107
81185
|
if (cb)
|
|
81108
81186
|
cb(er);
|
|
@@ -81117,7 +81195,7 @@ var require_polyfills2 = __commonJS({
|
|
|
81117
81195
|
});
|
|
81118
81196
|
};
|
|
81119
81197
|
fs2.lutimesSync = function(path7, at, mt) {
|
|
81120
|
-
var fd = fs2.openSync(path7,
|
|
81198
|
+
var fd = fs2.openSync(path7, constants2.O_SYMLINK);
|
|
81121
81199
|
var ret;
|
|
81122
81200
|
var threw = true;
|
|
81123
81201
|
try {
|
|
@@ -94801,10 +94879,11 @@ var static_default = router3;
|
|
|
94801
94879
|
// src/webserver/controllers/core.ts
|
|
94802
94880
|
var import_component_lib8 = __toESM(require_lib7());
|
|
94803
94881
|
var import_express4 = __toESM(require_express2());
|
|
94804
|
-
var
|
|
94882
|
+
var import_fs = require("fs");
|
|
94805
94883
|
var import_fs_extra = __toESM(require_lib10());
|
|
94806
94884
|
var import_promises = __toESM(require("fs/promises"));
|
|
94807
94885
|
var import_os2 = __toESM(require("os"));
|
|
94886
|
+
var import_path4 = __toESM(require("path"));
|
|
94808
94887
|
var router4 = import_express4.default.Router();
|
|
94809
94888
|
router4.get("/schemas/:version.json", async (req, res, _next) => {
|
|
94810
94889
|
const schema = import_component_lib8.schemaVersions[req.params.version];
|
|
@@ -94814,22 +94893,32 @@ router4.get("/schemas/:version.json", async (req, res, _next) => {
|
|
|
94814
94893
|
res.status(200).json(schema);
|
|
94815
94894
|
});
|
|
94816
94895
|
router4.get("/health", async (req, res, _next) => {
|
|
94896
|
+
var _a, _b, _c, _d, _e;
|
|
94817
94897
|
try {
|
|
94818
94898
|
const packagePath = import_path4.default.resolve("package.json");
|
|
94819
94899
|
const pkg = JSON.parse(await import_promises.default.readFile(packagePath, { encoding: "utf-8" }));
|
|
94820
94900
|
if (!pkg.version) {
|
|
94821
94901
|
throw new import_component_lib8.BadRequestError(`package could not be loaded from ../package.json`);
|
|
94822
94902
|
}
|
|
94823
|
-
const
|
|
94824
|
-
|
|
94825
|
-
|
|
94903
|
+
const crConfig = ComponentRunner.getConfig();
|
|
94904
|
+
const webConfig = Webserver.getConfig();
|
|
94905
|
+
if (!await import_fs_extra.default.pathExists(crConfig.dataMountPoint)) {
|
|
94906
|
+
throw new import_component_lib8.BadRequestError(`${crConfig.dataMountPoint} does not exist`);
|
|
94826
94907
|
}
|
|
94908
|
+
const dbHealth = { idle: (_a = req.db) == null ? void 0 : _a.pool.idleCount, max: (_b = req.db) == null ? void 0 : _b.pool.totalCount, waiting: (_c = req.db) == null ? void 0 : _c.pool.waitingCount };
|
|
94909
|
+
if (req.db && req.db.pool.totalCount === 0) {
|
|
94910
|
+
throw new Error("Database has no listeners");
|
|
94911
|
+
}
|
|
94912
|
+
await import_promises.default.access(crConfig.dataMountPoint, import_fs.constants.R_OK);
|
|
94827
94913
|
res.status(200).send({
|
|
94828
94914
|
status: "healthy",
|
|
94829
94915
|
version: pkg.version,
|
|
94916
|
+
buildVersion: (_d = webConfig.compiledConfig) == null ? void 0 : _d.buildVersion,
|
|
94917
|
+
buildBranch: (_e = webConfig.compiledConfig) == null ? void 0 : _e.buildBranch,
|
|
94830
94918
|
name: pkg.name,
|
|
94831
94919
|
"number-of-cpus": import_os2.default.cpus().length,
|
|
94832
|
-
"number-of-workers": ComponentRunner.get().healthCheck()
|
|
94920
|
+
"number-of-workers": ComponentRunner.get().healthCheck(),
|
|
94921
|
+
db: dbHealth
|
|
94833
94922
|
});
|
|
94834
94923
|
} catch (error) {
|
|
94835
94924
|
req.log.error(error);
|
|
@@ -94922,7 +95011,7 @@ var Webserver = class {
|
|
|
94922
95011
|
(0, import_strict2.default)(Webserver.config);
|
|
94923
95012
|
return Webserver.config;
|
|
94924
95013
|
}
|
|
94925
|
-
static async start(config, db) {
|
|
95014
|
+
static async start(config, db, compiledConfig) {
|
|
94926
95015
|
(0, import_strict2.default)(!Webserver.singleton);
|
|
94927
95016
|
(0, import_strict2.default)(ComponentRunner.get());
|
|
94928
95017
|
if (config.shouldRunMigrations === true) {
|
|
@@ -94935,7 +95024,7 @@ var Webserver = class {
|
|
|
94935
95024
|
throw e;
|
|
94936
95025
|
}
|
|
94937
95026
|
}
|
|
94938
|
-
config = Webserver.mergeConfig(config);
|
|
95027
|
+
config = Webserver.mergeConfig(config, compiledConfig);
|
|
94939
95028
|
const app = setupApp(db);
|
|
94940
95029
|
const server = await new Promise((resolve) => {
|
|
94941
95030
|
const server2 = app.listen(config.port);
|
|
@@ -94954,10 +95043,11 @@ var Webserver = class {
|
|
|
94954
95043
|
this.singleton.close();
|
|
94955
95044
|
this.singleton = void 0;
|
|
94956
95045
|
}
|
|
94957
|
-
static mergeConfig(config) {
|
|
95046
|
+
static mergeConfig(config, compiledConfig = {}) {
|
|
94958
95047
|
return {
|
|
94959
95048
|
port: 3e3,
|
|
94960
|
-
...config
|
|
95049
|
+
...config,
|
|
95050
|
+
compiledConfig
|
|
94961
95051
|
};
|
|
94962
95052
|
}
|
|
94963
95053
|
};
|
|
@@ -94982,6 +95072,10 @@ var import_path5 = __toESM(require("path"));
|
|
|
94982
95072
|
function getTestConfig(port) {
|
|
94983
95073
|
const rootDir = (0, import_child_process.execSync)("git rev-parse --show-toplevel", { encoding: "utf-8" }).replace(/\n$/, "");
|
|
94984
95074
|
return {
|
|
95075
|
+
compiledConfig: {
|
|
95076
|
+
buildVersion: "v1.0.0",
|
|
95077
|
+
buildBranch: "develop"
|
|
95078
|
+
},
|
|
94985
95079
|
dbConnection: {
|
|
94986
95080
|
databaseConnectionString: "postgresql://root:root@localhost:5432/cmp_db?schema=public",
|
|
94987
95081
|
databaseConnectionSecret: false
|
|
@@ -95797,7 +95891,7 @@ async function startRenderStack(config) {
|
|
|
95797
95891
|
db = new import_component_db_lib.ConnectionManager("render-runtime", connection, "../lib/migrations");
|
|
95798
95892
|
}
|
|
95799
95893
|
ComponentRunner.start(config.componentRunner);
|
|
95800
|
-
await Webserver.start(config.webserver, db);
|
|
95894
|
+
await Webserver.start(config.webserver, db, config.compiledConfig);
|
|
95801
95895
|
}
|
|
95802
95896
|
async function stopRenderStack() {
|
|
95803
95897
|
Webserver.stop();
|