@squiz/render-runtime-lib 1.2.1-alpha.82 → 1.2.1-alpha.83

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 CHANGED
@@ -5,6 +5,7 @@ import { definitionRouteTests } from './webserver/controllers/test/definition-ro
5
5
  import { staticRouteTests } from './webserver/controllers/test/static-route-tests';
6
6
  import { renderRouteTests } from './webserver/controllers/test/render-route-tests';
7
7
  export interface RenderRuntimeConfig {
8
+ compiledConfig?: Record<string, string>;
8
9
  webserver: WebserverConfig;
9
10
  componentRunner: ComponentRunnerConfig;
10
11
  dbConnection?: {
package/lib/index.js CHANGED
@@ -26743,11 +26743,11 @@ var require_codegen = __commonJS({
26743
26743
  const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
26744
26744
  return `${varKind} ${this.name}${rhs};` + _n;
26745
26745
  }
26746
- optimizeNames(names, constants) {
26746
+ optimizeNames(names, constants2) {
26747
26747
  if (!names[this.name.str])
26748
26748
  return;
26749
26749
  if (this.rhs)
26750
- this.rhs = optimizeExpr(this.rhs, names, constants);
26750
+ this.rhs = optimizeExpr(this.rhs, names, constants2);
26751
26751
  return this;
26752
26752
  }
26753
26753
  get names() {
@@ -26764,10 +26764,10 @@ var require_codegen = __commonJS({
26764
26764
  render({ _n }) {
26765
26765
  return `${this.lhs} = ${this.rhs};` + _n;
26766
26766
  }
26767
- optimizeNames(names, constants) {
26767
+ optimizeNames(names, constants2) {
26768
26768
  if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
26769
26769
  return;
26770
- this.rhs = optimizeExpr(this.rhs, names, constants);
26770
+ this.rhs = optimizeExpr(this.rhs, names, constants2);
26771
26771
  return this;
26772
26772
  }
26773
26773
  get names() {
@@ -26828,8 +26828,8 @@ var require_codegen = __commonJS({
26828
26828
  optimizeNodes() {
26829
26829
  return `${this.code}` ? this : void 0;
26830
26830
  }
26831
- optimizeNames(names, constants) {
26832
- this.code = optimizeExpr(this.code, names, constants);
26831
+ optimizeNames(names, constants2) {
26832
+ this.code = optimizeExpr(this.code, names, constants2);
26833
26833
  return this;
26834
26834
  }
26835
26835
  get names() {
@@ -26858,12 +26858,12 @@ var require_codegen = __commonJS({
26858
26858
  }
26859
26859
  return nodes.length > 0 ? this : void 0;
26860
26860
  }
26861
- optimizeNames(names, constants) {
26861
+ optimizeNames(names, constants2) {
26862
26862
  const { nodes } = this;
26863
26863
  let i = nodes.length;
26864
26864
  while (i--) {
26865
26865
  const n = nodes[i];
26866
- if (n.optimizeNames(names, constants))
26866
+ if (n.optimizeNames(names, constants2))
26867
26867
  continue;
26868
26868
  subtractNames(names, n.names);
26869
26869
  nodes.splice(i, 1);
@@ -26916,12 +26916,12 @@ var require_codegen = __commonJS({
26916
26916
  return void 0;
26917
26917
  return this;
26918
26918
  }
26919
- optimizeNames(names, constants) {
26919
+ optimizeNames(names, constants2) {
26920
26920
  var _a;
26921
- this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
26922
- if (!(super.optimizeNames(names, constants) || this.else))
26921
+ this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants2);
26922
+ if (!(super.optimizeNames(names, constants2) || this.else))
26923
26923
  return;
26924
- this.condition = optimizeExpr(this.condition, names, constants);
26924
+ this.condition = optimizeExpr(this.condition, names, constants2);
26925
26925
  return this;
26926
26926
  }
26927
26927
  get names() {
@@ -26944,10 +26944,10 @@ var require_codegen = __commonJS({
26944
26944
  render(opts) {
26945
26945
  return `for(${this.iteration})` + super.render(opts);
26946
26946
  }
26947
- optimizeNames(names, constants) {
26948
- if (!super.optimizeNames(names, constants))
26947
+ optimizeNames(names, constants2) {
26948
+ if (!super.optimizeNames(names, constants2))
26949
26949
  return;
26950
- this.iteration = optimizeExpr(this.iteration, names, constants);
26950
+ this.iteration = optimizeExpr(this.iteration, names, constants2);
26951
26951
  return this;
26952
26952
  }
26953
26953
  get names() {
@@ -26983,10 +26983,10 @@ var require_codegen = __commonJS({
26983
26983
  render(opts) {
26984
26984
  return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
26985
26985
  }
26986
- optimizeNames(names, constants) {
26987
- if (!super.optimizeNames(names, constants))
26986
+ optimizeNames(names, constants2) {
26987
+ if (!super.optimizeNames(names, constants2))
26988
26988
  return;
26989
- this.iterable = optimizeExpr(this.iterable, names, constants);
26989
+ this.iterable = optimizeExpr(this.iterable, names, constants2);
26990
26990
  return this;
26991
26991
  }
26992
26992
  get names() {
@@ -27028,11 +27028,11 @@ var require_codegen = __commonJS({
27028
27028
  (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
27029
27029
  return this;
27030
27030
  }
27031
- optimizeNames(names, constants) {
27031
+ optimizeNames(names, constants2) {
27032
27032
  var _a, _b;
27033
- super.optimizeNames(names, constants);
27034
- (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
27035
- (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
27033
+ super.optimizeNames(names, constants2);
27034
+ (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants2);
27035
+ (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants2);
27036
27036
  return this;
27037
27037
  }
27038
27038
  get names() {
@@ -27302,7 +27302,7 @@ var require_codegen = __commonJS({
27302
27302
  function addExprNames(names, from) {
27303
27303
  return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
27304
27304
  }
27305
- function optimizeExpr(expr, names, constants) {
27305
+ function optimizeExpr(expr, names, constants2) {
27306
27306
  if (expr instanceof code_1.Name)
27307
27307
  return replaceName(expr);
27308
27308
  if (!canOptimize(expr))
@@ -27317,14 +27317,14 @@ var require_codegen = __commonJS({
27317
27317
  return items;
27318
27318
  }, []));
27319
27319
  function replaceName(n) {
27320
- const c = constants[n.str];
27320
+ const c = constants2[n.str];
27321
27321
  if (c === void 0 || names[n.str] !== 1)
27322
27322
  return n;
27323
27323
  delete names[n.str];
27324
27324
  return c;
27325
27325
  }
27326
27326
  function canOptimize(e) {
27327
- return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== void 0);
27327
+ return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants2[c.str] !== void 0);
27328
27328
  }
27329
27329
  }
27330
27330
  function subtractNames(names, from) {
@@ -38441,7 +38441,7 @@ var require_universalify = __commonJS({
38441
38441
  // ../component-lib/node_modules/graceful-fs/polyfills.js
38442
38442
  var require_polyfills = __commonJS({
38443
38443
  "../component-lib/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
38444
- var constants = require("constants");
38444
+ var constants2 = require("constants");
38445
38445
  var origCwd = process.cwd;
38446
38446
  var cwd = null;
38447
38447
  var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
@@ -38466,7 +38466,7 @@ var require_polyfills = __commonJS({
38466
38466
  var chdir;
38467
38467
  module2.exports = patch;
38468
38468
  function patch(fs) {
38469
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
38469
+ if (constants2.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
38470
38470
  patchLchmod(fs);
38471
38471
  }
38472
38472
  if (!fs.lutimes) {
@@ -38571,7 +38571,7 @@ var require_polyfills = __commonJS({
38571
38571
  }(fs.readSync);
38572
38572
  function patchLchmod(fs2) {
38573
38573
  fs2.lchmod = function(path7, mode, callback) {
38574
- fs2.open(path7, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
38574
+ fs2.open(path7, constants2.O_WRONLY | constants2.O_SYMLINK, mode, function(err, fd) {
38575
38575
  if (err) {
38576
38576
  if (callback)
38577
38577
  callback(err);
@@ -38586,7 +38586,7 @@ var require_polyfills = __commonJS({
38586
38586
  });
38587
38587
  };
38588
38588
  fs2.lchmodSync = function(path7, mode) {
38589
- var fd = fs2.openSync(path7, constants.O_WRONLY | constants.O_SYMLINK, mode);
38589
+ var fd = fs2.openSync(path7, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
38590
38590
  var threw = true;
38591
38591
  var ret;
38592
38592
  try {
@@ -38606,9 +38606,9 @@ var require_polyfills = __commonJS({
38606
38606
  };
38607
38607
  }
38608
38608
  function patchLutimes(fs2) {
38609
- if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
38609
+ if (constants2.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
38610
38610
  fs2.lutimes = function(path7, at, mt, cb) {
38611
- fs2.open(path7, constants.O_SYMLINK, function(er, fd) {
38611
+ fs2.open(path7, constants2.O_SYMLINK, function(er, fd) {
38612
38612
  if (er) {
38613
38613
  if (cb)
38614
38614
  cb(er);
@@ -38623,7 +38623,7 @@ var require_polyfills = __commonJS({
38623
38623
  });
38624
38624
  };
38625
38625
  fs2.lutimesSync = function(path7, at, mt) {
38626
- var fd = fs2.openSync(path7, constants.O_SYMLINK);
38626
+ var fd = fs2.openSync(path7, constants2.O_SYMLINK);
38627
38627
  var ret;
38628
38628
  var threw = true;
38629
38629
  try {
@@ -55654,14 +55654,14 @@ var require_zip_archive_entry = __commonJS({
55654
55654
  var ArchiveEntry = require_archive_entry();
55655
55655
  var GeneralPurposeBit = require_general_purpose_bit();
55656
55656
  var UnixStat = require_unix_stat();
55657
- var constants = require_constants();
55657
+ var constants2 = require_constants();
55658
55658
  var zipUtil = require_util5();
55659
55659
  var ZipArchiveEntry = module2.exports = function(name) {
55660
55660
  if (!(this instanceof ZipArchiveEntry)) {
55661
55661
  return new ZipArchiveEntry(name);
55662
55662
  }
55663
55663
  ArchiveEntry.call(this);
55664
- this.platform = constants.PLATFORM_FAT;
55664
+ this.platform = constants2.PLATFORM_FAT;
55665
55665
  this.method = -1;
55666
55666
  this.name = null;
55667
55667
  this.size = 0;
@@ -55669,7 +55669,7 @@ var require_zip_archive_entry = __commonJS({
55669
55669
  this.gpb = new GeneralPurposeBit();
55670
55670
  this.crc = 0;
55671
55671
  this.time = -1;
55672
- this.minver = constants.MIN_VERSION_INITIAL;
55672
+ this.minver = constants2.MIN_VERSION_INITIAL;
55673
55673
  this.mode = -1;
55674
55674
  this.extra = null;
55675
55675
  this.exattr = 0;
@@ -55696,7 +55696,7 @@ var require_zip_archive_entry = __commonJS({
55696
55696
  return this.exattr;
55697
55697
  };
55698
55698
  ZipArchiveEntry.prototype.getExtra = function() {
55699
- return this.extra !== null ? this.extra : constants.EMPTY;
55699
+ return this.extra !== null ? this.extra : constants2.EMPTY;
55700
55700
  };
55701
55701
  ZipArchiveEntry.prototype.getGeneralPurposeBit = function() {
55702
55702
  return this.gpb;
@@ -55729,7 +55729,7 @@ var require_zip_archive_entry = __commonJS({
55729
55729
  return this.time !== -1 ? this.time : 0;
55730
55730
  };
55731
55731
  ZipArchiveEntry.prototype.getUnixMode = function() {
55732
- return this.platform !== constants.PLATFORM_UNIX ? 0 : this.getExternalAttributes() >> constants.SHORT_SHIFT & constants.SHORT_MASK;
55732
+ return this.platform !== constants2.PLATFORM_UNIX ? 0 : this.getExternalAttributes() >> constants2.SHORT_SHIFT & constants2.SHORT_MASK;
55733
55733
  };
55734
55734
  ZipArchiveEntry.prototype.getVersionNeededToExtract = function() {
55735
55735
  return this.minver;
@@ -55799,12 +55799,12 @@ var require_zip_archive_entry = __commonJS({
55799
55799
  this.time = zipUtil.dateToDos(time, forceLocalTime);
55800
55800
  };
55801
55801
  ZipArchiveEntry.prototype.setUnixMode = function(mode) {
55802
- mode |= this.isDirectory() ? constants.S_IFDIR : constants.S_IFREG;
55802
+ mode |= this.isDirectory() ? constants2.S_IFDIR : constants2.S_IFREG;
55803
55803
  var extattr = 0;
55804
- extattr |= mode << constants.SHORT_SHIFT | (this.isDirectory() ? constants.S_DOS_D : constants.S_DOS_A);
55804
+ extattr |= mode << constants2.SHORT_SHIFT | (this.isDirectory() ? constants2.S_DOS_D : constants2.S_DOS_A);
55805
55805
  this.setExternalAttributes(extattr);
55806
- this.mode = mode & constants.MODE_MASK;
55807
- this.platform = constants.PLATFORM_UNIX;
55806
+ this.mode = mode & constants2.MODE_MASK;
55807
+ this.platform = constants2.PLATFORM_UNIX;
55808
55808
  };
55809
55809
  ZipArchiveEntry.prototype.setVersionNeededToExtract = function(minver) {
55810
55810
  this.minver = minver;
@@ -55816,7 +55816,7 @@ var require_zip_archive_entry = __commonJS({
55816
55816
  return (this.getUnixMode() & UnixStat.FILE_TYPE_FLAG) === UnixStat.LINK_FLAG;
55817
55817
  };
55818
55818
  ZipArchiveEntry.prototype.isZip64 = function() {
55819
- return this.csize > constants.ZIP64_MAGIC || this.size > constants.ZIP64_MAGIC;
55819
+ return this.csize > constants2.ZIP64_MAGIC || this.size > constants2.ZIP64_MAGIC;
55820
55820
  };
55821
55821
  }
55822
55822
  });
@@ -56447,7 +56447,7 @@ var require_zip_archive_output_stream = __commonJS({
56447
56447
  var ArchiveOutputStream = require_archive_output_stream();
56448
56448
  var ZipArchiveEntry = require_zip_archive_entry();
56449
56449
  var GeneralPurposeBit = require_general_purpose_bit();
56450
- var constants = require_constants();
56450
+ var constants2 = require_constants();
56451
56451
  var util = require_util6();
56452
56452
  var zipUtil = require_util5();
56453
56453
  var ZipArchiveOutputStream = module2.exports = function(options) {
@@ -56483,21 +56483,21 @@ var require_zip_archive_output_stream = __commonJS({
56483
56483
  };
56484
56484
  ZipArchiveOutputStream.prototype._appendBuffer = function(ae, source, callback) {
56485
56485
  if (source.length === 0) {
56486
- ae.setMethod(constants.METHOD_STORED);
56486
+ ae.setMethod(constants2.METHOD_STORED);
56487
56487
  }
56488
56488
  var method = ae.getMethod();
56489
- if (method === constants.METHOD_STORED) {
56489
+ if (method === constants2.METHOD_STORED) {
56490
56490
  ae.setSize(source.length);
56491
56491
  ae.setCompressedSize(source.length);
56492
56492
  ae.setCrc(crc32.unsigned(source));
56493
56493
  }
56494
56494
  this._writeLocalFileHeader(ae);
56495
- if (method === constants.METHOD_STORED) {
56495
+ if (method === constants2.METHOD_STORED) {
56496
56496
  this.write(source);
56497
56497
  this._afterAppend(ae);
56498
56498
  callback(null, ae);
56499
56499
  return;
56500
- } else if (method === constants.METHOD_DEFLATED) {
56500
+ } else if (method === constants2.METHOD_DEFLATED) {
56501
56501
  this._smartStream(ae, callback).end(source);
56502
56502
  return;
56503
56503
  } else {
@@ -56507,7 +56507,7 @@ var require_zip_archive_output_stream = __commonJS({
56507
56507
  };
56508
56508
  ZipArchiveOutputStream.prototype._appendStream = function(ae, source, callback) {
56509
56509
  ae.getGeneralPurposeBit().useDataDescriptor(true);
56510
- ae.setVersionNeededToExtract(constants.MIN_VERSION_DATA_DESCRIPTOR);
56510
+ ae.setVersionNeededToExtract(constants2.MIN_VERSION_DATA_DESCRIPTOR);
56511
56511
  this._writeLocalFileHeader(ae);
56512
56512
  var smart = this._smartStream(ae, callback);
56513
56513
  source.once("error", function(err) {
@@ -56524,7 +56524,7 @@ var require_zip_archive_output_stream = __commonJS({
56524
56524
  o.zlib = {};
56525
56525
  }
56526
56526
  if (typeof o.zlib.level !== "number") {
56527
- o.zlib.level = constants.ZLIB_BEST_SPEED;
56527
+ o.zlib.level = constants2.ZLIB_BEST_SPEED;
56528
56528
  }
56529
56529
  o.forceZip64 = !!o.forceZip64;
56530
56530
  o.forceLocalTime = !!o.forceLocalTime;
@@ -56547,11 +56547,11 @@ var require_zip_archive_output_stream = __commonJS({
56547
56547
  };
56548
56548
  ZipArchiveOutputStream.prototype._normalizeEntry = function(ae) {
56549
56549
  if (ae.getMethod() === -1) {
56550
- ae.setMethod(constants.METHOD_DEFLATED);
56550
+ ae.setMethod(constants2.METHOD_DEFLATED);
56551
56551
  }
56552
- if (ae.getMethod() === constants.METHOD_DEFLATED) {
56552
+ if (ae.getMethod() === constants2.METHOD_DEFLATED) {
56553
56553
  ae.getGeneralPurposeBit().useDataDescriptor(true);
56554
- ae.setVersionNeededToExtract(constants.MIN_VERSION_DATA_DESCRIPTOR);
56554
+ ae.setVersionNeededToExtract(constants2.MIN_VERSION_DATA_DESCRIPTOR);
56555
56555
  }
56556
56556
  if (ae.getTime() === -1) {
56557
56557
  ae.setTime(new Date(), this._archive.forceLocalTime);
@@ -56563,7 +56563,7 @@ var require_zip_archive_output_stream = __commonJS({
56563
56563
  };
56564
56564
  };
56565
56565
  ZipArchiveOutputStream.prototype._smartStream = function(ae, callback) {
56566
- var deflate = ae.getMethod() === constants.METHOD_DEFLATED;
56566
+ var deflate = ae.getMethod() === constants2.METHOD_DEFLATED;
56567
56567
  var process2 = deflate ? new DeflateCRC32Stream(this.options.zlib) : new CRC32Stream();
56568
56568
  var error = null;
56569
56569
  function handleStuff() {
@@ -56586,13 +56586,13 @@ var require_zip_archive_output_stream = __commonJS({
56586
56586
  var size = this._archive.centralLength;
56587
56587
  var offset = this._archive.centralOffset;
56588
56588
  if (this.isZip64()) {
56589
- records = constants.ZIP64_MAGIC_SHORT;
56590
- size = constants.ZIP64_MAGIC;
56591
- offset = constants.ZIP64_MAGIC;
56589
+ records = constants2.ZIP64_MAGIC_SHORT;
56590
+ size = constants2.ZIP64_MAGIC;
56591
+ offset = constants2.ZIP64_MAGIC;
56592
56592
  }
56593
- this.write(zipUtil.getLongBytes(constants.SIG_EOCD));
56594
- this.write(constants.SHORT_ZERO);
56595
- this.write(constants.SHORT_ZERO);
56593
+ this.write(zipUtil.getLongBytes(constants2.SIG_EOCD));
56594
+ this.write(constants2.SHORT_ZERO);
56595
+ this.write(constants2.SHORT_ZERO);
56596
56596
  this.write(zipUtil.getShortBytes(records));
56597
56597
  this.write(zipUtil.getShortBytes(records));
56598
56598
  this.write(zipUtil.getLongBytes(size));
@@ -56603,18 +56603,18 @@ var require_zip_archive_output_stream = __commonJS({
56603
56603
  this.write(comment);
56604
56604
  };
56605
56605
  ZipArchiveOutputStream.prototype._writeCentralDirectoryZip64 = function() {
56606
- this.write(zipUtil.getLongBytes(constants.SIG_ZIP64_EOCD));
56606
+ this.write(zipUtil.getLongBytes(constants2.SIG_ZIP64_EOCD));
56607
56607
  this.write(zipUtil.getEightBytes(44));
56608
- this.write(zipUtil.getShortBytes(constants.MIN_VERSION_ZIP64));
56609
- this.write(zipUtil.getShortBytes(constants.MIN_VERSION_ZIP64));
56610
- this.write(constants.LONG_ZERO);
56611
- this.write(constants.LONG_ZERO);
56608
+ this.write(zipUtil.getShortBytes(constants2.MIN_VERSION_ZIP64));
56609
+ this.write(zipUtil.getShortBytes(constants2.MIN_VERSION_ZIP64));
56610
+ this.write(constants2.LONG_ZERO);
56611
+ this.write(constants2.LONG_ZERO);
56612
56612
  this.write(zipUtil.getEightBytes(this._entries.length));
56613
56613
  this.write(zipUtil.getEightBytes(this._entries.length));
56614
56614
  this.write(zipUtil.getEightBytes(this._archive.centralLength));
56615
56615
  this.write(zipUtil.getEightBytes(this._archive.centralOffset));
56616
- this.write(zipUtil.getLongBytes(constants.SIG_ZIP64_EOCD_LOC));
56617
- this.write(constants.LONG_ZERO);
56616
+ this.write(zipUtil.getLongBytes(constants2.SIG_ZIP64_EOCD_LOC));
56617
+ this.write(constants2.LONG_ZERO);
56618
56618
  this.write(zipUtil.getEightBytes(this._archive.centralOffset + this._archive.centralLength));
56619
56619
  this.write(zipUtil.getLongBytes(1));
56620
56620
  };
@@ -56624,12 +56624,12 @@ var require_zip_archive_output_stream = __commonJS({
56624
56624
  var offsets = ae._offsets;
56625
56625
  var size = ae.getSize();
56626
56626
  var compressedSize = ae.getCompressedSize();
56627
- if (ae.isZip64() || offsets.file > constants.ZIP64_MAGIC) {
56628
- size = constants.ZIP64_MAGIC;
56629
- compressedSize = constants.ZIP64_MAGIC;
56630
- ae.setVersionNeededToExtract(constants.MIN_VERSION_ZIP64);
56627
+ if (ae.isZip64() || offsets.file > constants2.ZIP64_MAGIC) {
56628
+ size = constants2.ZIP64_MAGIC;
56629
+ compressedSize = constants2.ZIP64_MAGIC;
56630
+ ae.setVersionNeededToExtract(constants2.MIN_VERSION_ZIP64);
56631
56631
  var extraBuf = Buffer.concat([
56632
- zipUtil.getShortBytes(constants.ZIP64_EXTRA_ID),
56632
+ zipUtil.getShortBytes(constants2.ZIP64_EXTRA_ID),
56633
56633
  zipUtil.getShortBytes(24),
56634
56634
  zipUtil.getEightBytes(ae.getSize()),
56635
56635
  zipUtil.getEightBytes(ae.getCompressedSize()),
@@ -56637,8 +56637,8 @@ var require_zip_archive_output_stream = __commonJS({
56637
56637
  ], 28);
56638
56638
  ae.setExtra(extraBuf);
56639
56639
  }
56640
- this.write(zipUtil.getLongBytes(constants.SIG_CFH));
56641
- this.write(zipUtil.getShortBytes(ae.getPlatform() << 8 | constants.VERSION_MADEBY));
56640
+ this.write(zipUtil.getLongBytes(constants2.SIG_CFH));
56641
+ this.write(zipUtil.getShortBytes(ae.getPlatform() << 8 | constants2.VERSION_MADEBY));
56642
56642
  this.write(zipUtil.getShortBytes(ae.getVersionNeededToExtract()));
56643
56643
  this.write(gpb.encode());
56644
56644
  this.write(zipUtil.getShortBytes(method));
@@ -56656,11 +56656,11 @@ var require_zip_archive_output_stream = __commonJS({
56656
56656
  this.write(zipUtil.getShortBytes(name.length));
56657
56657
  this.write(zipUtil.getShortBytes(extra.length));
56658
56658
  this.write(zipUtil.getShortBytes(comment.length));
56659
- this.write(constants.SHORT_ZERO);
56659
+ this.write(constants2.SHORT_ZERO);
56660
56660
  this.write(zipUtil.getShortBytes(ae.getInternalAttributes()));
56661
56661
  this.write(zipUtil.getLongBytes(ae.getExternalAttributes()));
56662
- if (offsets.file > constants.ZIP64_MAGIC) {
56663
- this.write(zipUtil.getLongBytes(constants.ZIP64_MAGIC));
56662
+ if (offsets.file > constants2.ZIP64_MAGIC) {
56663
+ this.write(zipUtil.getLongBytes(constants2.ZIP64_MAGIC));
56664
56664
  } else {
56665
56665
  this.write(zipUtil.getLongBytes(offsets.file));
56666
56666
  }
@@ -56669,7 +56669,7 @@ var require_zip_archive_output_stream = __commonJS({
56669
56669
  this.write(comment);
56670
56670
  };
56671
56671
  ZipArchiveOutputStream.prototype._writeDataDescriptor = function(ae) {
56672
- this.write(zipUtil.getLongBytes(constants.SIG_DD));
56672
+ this.write(zipUtil.getLongBytes(constants2.SIG_DD));
56673
56673
  this.write(zipUtil.getLongBytes(ae.getCrc()));
56674
56674
  if (ae.isZip64()) {
56675
56675
  this.write(zipUtil.getEightBytes(ae.getCompressedSize()));
@@ -56686,22 +56686,22 @@ var require_zip_archive_output_stream = __commonJS({
56686
56686
  var extra = ae.getLocalFileDataExtra();
56687
56687
  if (ae.isZip64()) {
56688
56688
  gpb.useDataDescriptor(true);
56689
- ae.setVersionNeededToExtract(constants.MIN_VERSION_ZIP64);
56689
+ ae.setVersionNeededToExtract(constants2.MIN_VERSION_ZIP64);
56690
56690
  }
56691
56691
  if (gpb.usesUTF8ForNames()) {
56692
56692
  name = Buffer.from(name);
56693
56693
  }
56694
56694
  ae._offsets.file = this.offset;
56695
- this.write(zipUtil.getLongBytes(constants.SIG_LFH));
56695
+ this.write(zipUtil.getLongBytes(constants2.SIG_LFH));
56696
56696
  this.write(zipUtil.getShortBytes(ae.getVersionNeededToExtract()));
56697
56697
  this.write(gpb.encode());
56698
56698
  this.write(zipUtil.getShortBytes(method));
56699
56699
  this.write(zipUtil.getLongBytes(ae.getTimeDos()));
56700
56700
  ae._offsets.data = this.offset;
56701
56701
  if (gpb.usesDataDescriptor()) {
56702
- this.write(constants.LONG_ZERO);
56703
- this.write(constants.LONG_ZERO);
56704
- this.write(constants.LONG_ZERO);
56702
+ this.write(constants2.LONG_ZERO);
56703
+ this.write(constants2.LONG_ZERO);
56704
+ this.write(constants2.LONG_ZERO);
56705
56705
  } else {
56706
56706
  this.write(zipUtil.getLongBytes(ae.getCrc()));
56707
56707
  this.write(zipUtil.getLongBytes(ae.getCompressedSize()));
@@ -56717,7 +56717,7 @@ var require_zip_archive_output_stream = __commonJS({
56717
56717
  return this._archive.comment !== null ? this._archive.comment : "";
56718
56718
  };
56719
56719
  ZipArchiveOutputStream.prototype.isZip64 = function() {
56720
- return this._archive.forceZip64 || this._entries.length > constants.ZIP64_MAGIC_SHORT || this._archive.centralLength > constants.ZIP64_MAGIC || this._archive.centralOffset > constants.ZIP64_MAGIC;
56720
+ return this._archive.forceZip64 || this._entries.length > constants2.ZIP64_MAGIC_SHORT || this._archive.centralLength > constants2.ZIP64_MAGIC || this._archive.centralOffset > constants2.ZIP64_MAGIC;
56721
56721
  };
56722
56722
  ZipArchiveOutputStream.prototype.setComment = function(comment) {
56723
56723
  this._archive.comment = comment;
@@ -57875,7 +57875,7 @@ var require_end_of_stream2 = __commonJS({
57875
57875
  // ../component-lib/node_modules/tar-stream/pack.js
57876
57876
  var require_pack = __commonJS({
57877
57877
  "../component-lib/node_modules/tar-stream/pack.js"(exports2, module2) {
57878
- var constants = require_fs_constants();
57878
+ var constants2 = require_fs_constants();
57879
57879
  var eos = require_end_of_stream2();
57880
57880
  var inherits = require_inherits2();
57881
57881
  var alloc = Buffer.alloc;
@@ -57894,16 +57894,16 @@ var require_pack = __commonJS({
57894
57894
  self2.push(END_OF_TAR.slice(0, 512 - size));
57895
57895
  };
57896
57896
  function modeToType(mode) {
57897
- switch (mode & constants.S_IFMT) {
57898
- case constants.S_IFBLK:
57897
+ switch (mode & constants2.S_IFMT) {
57898
+ case constants2.S_IFBLK:
57899
57899
  return "block-device";
57900
- case constants.S_IFCHR:
57900
+ case constants2.S_IFCHR:
57901
57901
  return "character-device";
57902
- case constants.S_IFDIR:
57902
+ case constants2.S_IFDIR:
57903
57903
  return "directory";
57904
- case constants.S_IFIFO:
57904
+ case constants2.S_IFIFO:
57905
57905
  return "fifo";
57906
- case constants.S_IFLNK:
57906
+ case constants2.S_IFLNK:
57907
57907
  return "symlink";
57908
57908
  }
57909
57909
  return "file";
@@ -81007,7 +81007,7 @@ var require_universalify2 = __commonJS({
81007
81007
  // node_modules/graceful-fs/polyfills.js
81008
81008
  var require_polyfills2 = __commonJS({
81009
81009
  "node_modules/graceful-fs/polyfills.js"(exports2, module2) {
81010
- var constants = require("constants");
81010
+ var constants2 = require("constants");
81011
81011
  var origCwd = process.cwd;
81012
81012
  var cwd = null;
81013
81013
  var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
@@ -81032,7 +81032,7 @@ var require_polyfills2 = __commonJS({
81032
81032
  var chdir;
81033
81033
  module2.exports = patch;
81034
81034
  function patch(fs) {
81035
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
81035
+ if (constants2.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
81036
81036
  patchLchmod(fs);
81037
81037
  }
81038
81038
  if (!fs.lutimes) {
@@ -81137,7 +81137,7 @@ var require_polyfills2 = __commonJS({
81137
81137
  }(fs.readSync);
81138
81138
  function patchLchmod(fs2) {
81139
81139
  fs2.lchmod = function(path7, mode, callback) {
81140
- fs2.open(path7, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
81140
+ fs2.open(path7, constants2.O_WRONLY | constants2.O_SYMLINK, mode, function(err, fd) {
81141
81141
  if (err) {
81142
81142
  if (callback)
81143
81143
  callback(err);
@@ -81152,7 +81152,7 @@ var require_polyfills2 = __commonJS({
81152
81152
  });
81153
81153
  };
81154
81154
  fs2.lchmodSync = function(path7, mode) {
81155
- var fd = fs2.openSync(path7, constants.O_WRONLY | constants.O_SYMLINK, mode);
81155
+ var fd = fs2.openSync(path7, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
81156
81156
  var threw = true;
81157
81157
  var ret;
81158
81158
  try {
@@ -81172,9 +81172,9 @@ var require_polyfills2 = __commonJS({
81172
81172
  };
81173
81173
  }
81174
81174
  function patchLutimes(fs2) {
81175
- if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
81175
+ if (constants2.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
81176
81176
  fs2.lutimes = function(path7, at, mt, cb) {
81177
- fs2.open(path7, constants.O_SYMLINK, function(er, fd) {
81177
+ fs2.open(path7, constants2.O_SYMLINK, function(er, fd) {
81178
81178
  if (er) {
81179
81179
  if (cb)
81180
81180
  cb(er);
@@ -81189,7 +81189,7 @@ var require_polyfills2 = __commonJS({
81189
81189
  });
81190
81190
  };
81191
81191
  fs2.lutimesSync = function(path7, at, mt) {
81192
- var fd = fs2.openSync(path7, constants.O_SYMLINK);
81192
+ var fd = fs2.openSync(path7, constants2.O_SYMLINK);
81193
81193
  var ret;
81194
81194
  var threw = true;
81195
81195
  try {
@@ -94873,10 +94873,11 @@ var static_default = router3;
94873
94873
  // src/webserver/controllers/core.ts
94874
94874
  var import_component_lib8 = __toESM(require_lib7());
94875
94875
  var import_express4 = __toESM(require_express2());
94876
- var import_path4 = __toESM(require("path"));
94876
+ var import_fs = require("fs");
94877
94877
  var import_fs_extra = __toESM(require_lib10());
94878
94878
  var import_promises = __toESM(require("fs/promises"));
94879
94879
  var import_os2 = __toESM(require("os"));
94880
+ var import_path4 = __toESM(require("path"));
94880
94881
  var router4 = import_express4.default.Router();
94881
94882
  router4.get("/schemas/:version.json", async (req, res, _next) => {
94882
94883
  const schema = import_component_lib8.schemaVersions[req.params.version];
@@ -94886,22 +94887,32 @@ router4.get("/schemas/:version.json", async (req, res, _next) => {
94886
94887
  res.status(200).json(schema);
94887
94888
  });
94888
94889
  router4.get("/health", async (req, res, _next) => {
94890
+ var _a, _b, _c, _d, _e;
94889
94891
  try {
94890
94892
  const packagePath = import_path4.default.resolve("package.json");
94891
94893
  const pkg = JSON.parse(await import_promises.default.readFile(packagePath, { encoding: "utf-8" }));
94892
94894
  if (!pkg.version) {
94893
94895
  throw new import_component_lib8.BadRequestError(`package could not be loaded from ../package.json`);
94894
94896
  }
94895
- const config = ComponentRunner.getConfig();
94896
- if (!await import_fs_extra.default.pathExists(config.dataMountPoint)) {
94897
- throw new import_component_lib8.BadRequestError(`${config.dataMountPoint} does not exist`);
94897
+ const crConfig = ComponentRunner.getConfig();
94898
+ const webConfig = Webserver.getConfig();
94899
+ if (!await import_fs_extra.default.pathExists(crConfig.dataMountPoint)) {
94900
+ throw new import_component_lib8.BadRequestError(`${crConfig.dataMountPoint} does not exist`);
94898
94901
  }
94902
+ 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 };
94903
+ if (req.db && req.db.pool.totalCount === 0) {
94904
+ throw new Error("Database has no listeners");
94905
+ }
94906
+ await import_promises.default.access(crConfig.dataMountPoint, import_fs.constants.R_OK);
94899
94907
  res.status(200).send({
94900
94908
  status: "healthy",
94901
94909
  version: pkg.version,
94910
+ buildVersion: (_d = webConfig.compiledConfig) == null ? void 0 : _d.buildVersion,
94911
+ buildBranch: (_e = webConfig.compiledConfig) == null ? void 0 : _e.buildBranch,
94902
94912
  name: pkg.name,
94903
94913
  "number-of-cpus": import_os2.default.cpus().length,
94904
- "number-of-workers": ComponentRunner.get().healthCheck()
94914
+ "number-of-workers": ComponentRunner.get().healthCheck(),
94915
+ db: dbHealth
94905
94916
  });
94906
94917
  } catch (error) {
94907
94918
  req.log.error(error);
@@ -94994,7 +95005,7 @@ var Webserver = class {
94994
95005
  (0, import_strict2.default)(Webserver.config);
94995
95006
  return Webserver.config;
94996
95007
  }
94997
- static async start(config, db) {
95008
+ static async start(config, db, compiledConfig) {
94998
95009
  (0, import_strict2.default)(!Webserver.singleton);
94999
95010
  (0, import_strict2.default)(ComponentRunner.get());
95000
95011
  if (config.shouldRunMigrations === true) {
@@ -95007,7 +95018,7 @@ var Webserver = class {
95007
95018
  throw e;
95008
95019
  }
95009
95020
  }
95010
- config = Webserver.mergeConfig(config);
95021
+ config = Webserver.mergeConfig(config, compiledConfig);
95011
95022
  const app = setupApp(db);
95012
95023
  const server = await new Promise((resolve) => {
95013
95024
  const server2 = app.listen(config.port);
@@ -95026,10 +95037,11 @@ var Webserver = class {
95026
95037
  this.singleton.close();
95027
95038
  this.singleton = void 0;
95028
95039
  }
95029
- static mergeConfig(config) {
95040
+ static mergeConfig(config, compiledConfig = {}) {
95030
95041
  return {
95031
95042
  port: 3e3,
95032
- ...config
95043
+ ...config,
95044
+ compiledConfig
95033
95045
  };
95034
95046
  }
95035
95047
  };
@@ -95054,6 +95066,10 @@ var import_path5 = __toESM(require("path"));
95054
95066
  function getTestConfig(port) {
95055
95067
  const rootDir = (0, import_child_process.execSync)("git rev-parse --show-toplevel", { encoding: "utf-8" }).replace(/\n$/, "");
95056
95068
  return {
95069
+ compiledConfig: {
95070
+ buildVersion: "v1.0.0",
95071
+ buildBranch: "develop"
95072
+ },
95057
95073
  dbConnection: {
95058
95074
  databaseConnectionString: "postgresql://root:root@localhost:5432/cmp_db?schema=public",
95059
95075
  databaseConnectionSecret: false
@@ -95869,7 +95885,7 @@ async function startRenderStack(config) {
95869
95885
  db = new import_component_db_lib.ConnectionManager("render-runtime", connection, "../lib/migrations");
95870
95886
  }
95871
95887
  ComponentRunner.start(config.componentRunner);
95872
- await Webserver.start(config.webserver, db);
95888
+ await Webserver.start(config.webserver, db, config.compiledConfig);
95873
95889
  }
95874
95890
  async function stopRenderStack() {
95875
95891
  Webserver.stop();