@stacksjs/actions 0.70.0 → 0.70.2

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.
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-fxan91t8.js";
5
5
  import {
6
6
  require_lib
7
- } from "./chunk-nm3scdc6.js";
7
+ } from "./chunk-w6fdq4hk.js";
8
8
  import {
9
9
  camelCase,
10
10
  kebabCase,
@@ -6023,10 +6023,10 @@ ${errors.join(`
6023
6023
  return (type, opts = {}) => {
6024
6024
  let defined = opts.aliases;
6025
6025
  if (!defined) {
6026
- var _store$opts$inherits$, _defined;
6026
+ var _store$opts$inherits$;
6027
6027
  if (opts.inherits)
6028
6028
  defined = (_store$opts$inherits$ = store[opts.inherits].aliases) == null ? undefined : _store$opts$inherits$.slice();
6029
- (_defined = defined) != null || (defined = []);
6029
+ defined != null || (defined = []);
6030
6030
  opts.aliases = defined;
6031
6031
  }
6032
6032
  const additional = aliases.filter((a) => !defined.includes(a));
@@ -21461,7 +21461,7 @@ var require_typescript2 = __commonJS((exports) => {
21461
21461
  this.word("static");
21462
21462
  this.space();
21463
21463
  }
21464
- printModifiersList(this, node, [!isPrivateField && node.override && "override", !isPrivateField && node.abstract && "abstract", (isPublicField || isPrivateField) && node.readonly && "readonly"]);
21464
+ printModifiersList(this, node, [!isPrivateField && node.abstract && "abstract", !isPrivateField && node.override && "override", (isPublicField || isPrivateField) && node.readonly && "readonly"]);
21465
21465
  }
21466
21466
  function printBraced(printer, node, cb) {
21467
21467
  printer.token("{");
@@ -23669,7 +23669,7 @@ var require_visitors = __commonJS((exports) => {
23669
23669
  if (shouldIgnoreKey(nodeType))
23670
23670
  continue;
23671
23671
  if (!TYPES.includes(nodeType)) {
23672
- throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.26.9"}`);
23672
+ throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.26.10"}`);
23673
23673
  }
23674
23674
  const visitors = visitor[nodeType];
23675
23675
  if (typeof visitors === "object") {
@@ -27080,20 +27080,19 @@ var require_cache = __commonJS((exports) => {
27080
27080
  }
27081
27081
  var nullHub = Object.freeze({});
27082
27082
  function getCachedPaths(hub, parent) {
27083
- var _pathsCache$get, _hub;
27083
+ var _pathsCache$get;
27084
27084
  {
27085
27085
  hub = null;
27086
27086
  }
27087
- return (_pathsCache$get = pathsCache.get((_hub = hub) != null ? _hub : nullHub)) == null ? undefined : _pathsCache$get.get(parent);
27087
+ return (_pathsCache$get = pathsCache.get(hub != null ? hub : nullHub)) == null ? undefined : _pathsCache$get.get(parent);
27088
27088
  }
27089
27089
  function getOrCreateCachedPaths(hub, parent) {
27090
- var _hub2, _hub3;
27091
27090
  {
27092
27091
  hub = null;
27093
27092
  }
27094
- let parents = pathsCache.get((_hub2 = hub) != null ? _hub2 : nullHub);
27093
+ let parents = pathsCache.get(hub != null ? hub : nullHub);
27095
27094
  if (!parents)
27096
- pathsCache.set((_hub3 = hub) != null ? _hub3 : nullHub, parents = new WeakMap);
27095
+ pathsCache.set(hub != null ? hub : nullHub, parents = new WeakMap);
27097
27096
  let paths = parents.get(parent);
27098
27097
  if (!paths)
27099
27098
  parents.set(parent, paths = new Map);
@@ -28017,8 +28016,7 @@ var require_scope = __commonJS((exports) => {
28017
28016
  let firstId;
28018
28017
  const init = [];
28019
28018
  for (const decl of parent.declarations) {
28020
- var _firstId;
28021
- (_firstId = firstId) != null || (firstId = decl.id);
28019
+ firstId != null || (firstId = decl.id);
28022
28020
  if (decl.init) {
28023
28021
  init.push(assignmentExpression("=", decl.id, decl.init));
28024
28022
  }
@@ -30060,6 +30058,23 @@ var require_evaluation = __commonJS((exports) => {
30060
30058
  deopt(binding.path, state);
30061
30059
  return;
30062
30060
  }
30061
+ const bindingPathScope = binding.path.scope;
30062
+ if (binding.kind === "var" && bindingPathScope !== binding.scope) {
30063
+ let hasUnsafeBlock = !bindingPathScope.path.parentPath.isBlockStatement();
30064
+ for (let scope = bindingPathScope.parent;scope; scope = scope.parent) {
30065
+ var _scope$path$parentPat;
30066
+ if (scope === path.scope) {
30067
+ if (hasUnsafeBlock) {
30068
+ deopt(binding.path, state);
30069
+ return;
30070
+ }
30071
+ break;
30072
+ }
30073
+ if ((_scope$path$parentPat = scope.path.parentPath) != null && _scope$path$parentPat.isBlockStatement()) {
30074
+ hasUnsafeBlock = true;
30075
+ }
30076
+ }
30077
+ }
30063
30078
  if (binding.hasValue) {
30064
30079
  return binding.value;
30065
30080
  }
@@ -31094,8 +31109,7 @@ var require_conversion = __commonJS((exports) => {
31094
31109
  let arrowParent;
31095
31110
  let thisEnvFn = fnPath.findParent((p) => {
31096
31111
  if (p.isArrowFunctionExpression()) {
31097
- var _arrowParent;
31098
- (_arrowParent = arrowParent) != null || (arrowParent = p);
31112
+ arrowParent != null || (arrowParent = p);
31099
31113
  return false;
31100
31114
  }
31101
31115
  return p.isFunction() || p.isProgram() || p.isClassProperty({
@@ -39387,13 +39401,14 @@ var require_lib10 = __commonJS((exports) => {
39387
39401
  Object.defineProperty(exports, "__esModule", { value: true });
39388
39402
  exports.createLRU = undefined;
39389
39403
  var createLRU = (options) => {
39390
- let { max, onEviction } = options;
39404
+ let { max } = options;
39391
39405
  if (!(Number.isInteger(max) && max > 0))
39392
39406
  throw new TypeError("`max` must be a positive integer");
39393
39407
  let size = 0;
39394
39408
  let head = 0;
39395
39409
  let tail = 0;
39396
39410
  let free = [];
39411
+ const { onEviction } = options;
39397
39412
  const keyMap = new Map;
39398
39413
  const keyList = new Array(max).fill(undefined);
39399
39414
  const valList = new Array(max).fill(undefined);
@@ -56836,238 +56851,361 @@ var require_mysql2 = __commonJS((exports) => {
56836
56851
  };
56837
56852
  });
56838
56853
 
56839
- // ../../../../node_modules/pg/node_modules/pg-types/node_modules/postgres-array/index.js
56854
+ // ../../../../node_modules/postgres-array/index.js
56840
56855
  var require_postgres_array = __commonJS((exports) => {
56841
- exports.parse = function(source, transform) {
56842
- return new ArrayParser(source, transform).parse();
56843
- };
56844
-
56845
- class ArrayParser {
56846
- constructor(source, transform) {
56847
- this.source = source;
56848
- this.transform = transform || identity;
56849
- this.position = 0;
56850
- this.entries = [];
56851
- this.recorded = [];
56852
- this.dimension = 0;
56853
- }
56854
- isEof() {
56855
- return this.position >= this.source.length;
56856
- }
56857
- nextCharacter() {
56858
- var character = this.source[this.position++];
56859
- if (character === "\\") {
56860
- return {
56861
- value: this.source[this.position++],
56862
- escaped: true
56863
- };
56856
+ var BACKSLASH = "\\";
56857
+ var DQUOT = '"';
56858
+ var LBRACE = "{";
56859
+ var RBRACE = "}";
56860
+ var LBRACKET = "[";
56861
+ var EQUALS = "=";
56862
+ var COMMA = ",";
56863
+ var NULL_STRING = "NULL";
56864
+ function makeParseArrayWithTransform(transform) {
56865
+ const haveTransform = transform != null;
56866
+ return function parseArray(str) {
56867
+ const rbraceIndex = str.length - 1;
56868
+ if (rbraceIndex === 1) {
56869
+ return [];
56864
56870
  }
56865
- return {
56866
- value: character,
56867
- escaped: false
56868
- };
56869
- }
56870
- record(character) {
56871
- this.recorded.push(character);
56872
- }
56873
- newEntry(includeEmpty) {
56874
- var entry;
56875
- if (this.recorded.length > 0 || includeEmpty) {
56876
- entry = this.recorded.join("");
56877
- if (entry === "NULL" && !includeEmpty) {
56878
- entry = null;
56879
- }
56880
- if (entry !== null)
56881
- entry = this.transform(entry);
56882
- this.entries.push(entry);
56883
- this.recorded = [];
56871
+ if (str[rbraceIndex] !== RBRACE) {
56872
+ throw new Error("Invalid array text - must end with }");
56884
56873
  }
56885
- }
56886
- consumeDimensions() {
56887
- if (this.source[0] === "[") {
56888
- while (!this.isEof()) {
56889
- var char = this.nextCharacter();
56890
- if (char.value === "=")
56891
- break;
56892
- }
56874
+ let position = 0;
56875
+ if (str[position] === LBRACKET) {
56876
+ position = str.indexOf(EQUALS) + 1;
56893
56877
  }
56894
- }
56895
- parse(nested) {
56896
- var character, parser, quote;
56897
- this.consumeDimensions();
56898
- while (!this.isEof()) {
56899
- character = this.nextCharacter();
56900
- if (character.value === "{" && !quote) {
56901
- this.dimension++;
56902
- if (this.dimension > 1) {
56903
- parser = new ArrayParser(this.source.substr(this.position - 1), this.transform);
56904
- this.entries.push(parser.parse(true));
56905
- this.position += parser.position - 2;
56878
+ if (str[position++] !== LBRACE) {
56879
+ throw new Error("Invalid array text - must start with {");
56880
+ }
56881
+ const output = [];
56882
+ let current = output;
56883
+ const stack = [];
56884
+ let currentStringStart = position;
56885
+ let currentString = "";
56886
+ let expectValue = true;
56887
+ for (;position < rbraceIndex; ++position) {
56888
+ let char = str[position];
56889
+ if (char === DQUOT) {
56890
+ currentStringStart = ++position;
56891
+ let dquot = str.indexOf(DQUOT, currentStringStart);
56892
+ let backSlash = str.indexOf(BACKSLASH, currentStringStart);
56893
+ while (backSlash !== -1 && backSlash < dquot) {
56894
+ position = backSlash;
56895
+ const part2 = str.slice(currentStringStart, position);
56896
+ currentString += part2;
56897
+ currentStringStart = ++position;
56898
+ if (dquot === position++) {
56899
+ dquot = str.indexOf(DQUOT, position);
56900
+ }
56901
+ backSlash = str.indexOf(BACKSLASH, position);
56906
56902
  }
56907
- } else if (character.value === "}" && !quote) {
56908
- this.dimension--;
56909
- if (!this.dimension) {
56910
- this.newEntry();
56911
- if (nested)
56912
- return this.entries;
56903
+ position = dquot;
56904
+ const part = str.slice(currentStringStart, position);
56905
+ currentString += part;
56906
+ current.push(haveTransform ? transform(currentString) : currentString);
56907
+ currentString = "";
56908
+ expectValue = false;
56909
+ } else if (char === LBRACE) {
56910
+ const newArray = [];
56911
+ current.push(newArray);
56912
+ stack.push(current);
56913
+ current = newArray;
56914
+ currentStringStart = position + 1;
56915
+ expectValue = true;
56916
+ } else if (char === COMMA) {
56917
+ expectValue = true;
56918
+ } else if (char === RBRACE) {
56919
+ expectValue = false;
56920
+ const arr = stack.pop();
56921
+ if (arr === undefined) {
56922
+ throw new Error("Invalid array text - too many '}'");
56913
56923
  }
56914
- } else if (character.value === '"' && !character.escaped) {
56915
- if (quote)
56916
- this.newEntry(true);
56917
- quote = !quote;
56918
- } else if (character.value === "," && !quote) {
56919
- this.newEntry();
56924
+ current = arr;
56925
+ } else if (expectValue) {
56926
+ currentStringStart = position;
56927
+ while ((char = str[position]) !== COMMA && char !== RBRACE && position < rbraceIndex) {
56928
+ ++position;
56929
+ }
56930
+ const part = str.slice(currentStringStart, position--);
56931
+ current.push(part === NULL_STRING ? null : haveTransform ? transform(part) : part);
56932
+ expectValue = false;
56920
56933
  } else {
56921
- this.record(character.value);
56934
+ throw new Error("Was expecting delimeter");
56922
56935
  }
56923
56936
  }
56924
- if (this.dimension !== 0) {
56925
- throw new Error("array dimension not balanced");
56926
- }
56927
- return this.entries;
56928
- }
56929
- }
56930
- function identity(value) {
56931
- return value;
56937
+ return output;
56938
+ };
56932
56939
  }
56940
+ var parseArray = makeParseArrayWithTransform();
56941
+ exports.parse = (source, transform) => transform != null ? makeParseArrayWithTransform(transform)(source) : parseArray(source);
56933
56942
  });
56934
56943
 
56935
- // ../../../../node_modules/pg/node_modules/pg-types/lib/arrayParser.js
56936
- var require_arrayParser = __commonJS((exports, module) => {
56937
- var array = require_postgres_array();
56938
- module.exports = {
56939
- create: function(source, transform) {
56940
- return {
56941
- parse: function() {
56942
- return array.parse(source, transform);
56944
+ // ../../../../node_modules/postgres-date/index.js
56945
+ var require_postgres_date = __commonJS((exports, module) => {
56946
+ var CHAR_CODE_0 = 48;
56947
+ var CHAR_CODE_9 = 57;
56948
+ var CHAR_CODE_DASH = 45;
56949
+ var CHAR_CODE_COLON = 58;
56950
+ var CHAR_CODE_SPACE = 32;
56951
+ var CHAR_CODE_DOT = 46;
56952
+ var CHAR_CODE_Z = 90;
56953
+ var CHAR_CODE_MINUS = 45;
56954
+ var CHAR_CODE_PLUS = 43;
56955
+
56956
+ class PGDateParser {
56957
+ constructor(dateString) {
56958
+ this.dateString = dateString;
56959
+ this.pos = 0;
56960
+ this.stringLen = dateString.length;
56961
+ }
56962
+ isDigit(c) {
56963
+ return c >= CHAR_CODE_0 && c <= CHAR_CODE_9;
56964
+ }
56965
+ readInteger() {
56966
+ let val = 0;
56967
+ const start = this.pos;
56968
+ while (this.pos < this.stringLen) {
56969
+ const chr = this.dateString.charCodeAt(this.pos);
56970
+ if (this.isDigit(chr)) {
56971
+ val = val * 10;
56972
+ this.pos += 1;
56973
+ val += chr - CHAR_CODE_0;
56974
+ } else {
56975
+ break;
56943
56976
  }
56944
- };
56977
+ }
56978
+ if (start === this.pos) {
56979
+ return null;
56980
+ }
56981
+ return val;
56945
56982
  }
56946
- };
56947
- });
56948
-
56949
- // ../../../../node_modules/pg/node_modules/pg-types/node_modules/postgres-date/index.js
56950
- var require_postgres_date = __commonJS((exports, module) => {
56951
- var DATE_TIME = /(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/;
56952
- var DATE = /^(\d{1,})-(\d{2})-(\d{2})( BC)?$/;
56953
- var TIME_ZONE = /([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/;
56954
- var INFINITY = /^-?infinity$/;
56955
- module.exports = function parseDate(isoDate) {
56956
- if (INFINITY.test(isoDate)) {
56957
- return Number(isoDate.replace("i", "I"));
56983
+ readInteger2() {
56984
+ const chr1 = this.dateString.charCodeAt(this.pos);
56985
+ const chr2 = this.dateString.charCodeAt(this.pos + 1);
56986
+ if (this.isDigit(chr1) && this.isDigit(chr2)) {
56987
+ this.pos += 2;
56988
+ return (chr1 - CHAR_CODE_0) * 10 + (chr2 - CHAR_CODE_0);
56989
+ }
56990
+ return -1;
56958
56991
  }
56959
- var matches = DATE_TIME.exec(isoDate);
56960
- if (!matches) {
56961
- return getDate(isoDate) || null;
56962
- }
56963
- var isBC = !!matches[8];
56964
- var year = parseInt(matches[1], 10);
56965
- if (isBC) {
56966
- year = bcYearToNegativeYear(year);
56967
- }
56968
- var month = parseInt(matches[2], 10) - 1;
56969
- var day = matches[3];
56970
- var hour = parseInt(matches[4], 10);
56971
- var minute = parseInt(matches[5], 10);
56972
- var second = parseInt(matches[6], 10);
56973
- var ms = matches[7];
56974
- ms = ms ? 1000 * parseFloat(ms) : 0;
56975
- var date;
56976
- var offset = timeZoneOffset(isoDate);
56977
- if (offset != null) {
56978
- date = new Date(Date.UTC(year, month, day, hour, minute, second, ms));
56979
- if (is0To99(year)) {
56980
- date.setUTCFullYear(year);
56981
- }
56982
- if (offset !== 0) {
56983
- date.setTime(date.getTime() - offset);
56992
+ skipChar(char) {
56993
+ if (this.pos === this.stringLen) {
56994
+ return false;
56984
56995
  }
56985
- } else {
56986
- date = new Date(year, month, day, hour, minute, second, ms);
56987
- if (is0To99(year)) {
56988
- date.setFullYear(year);
56996
+ if (this.dateString.charCodeAt(this.pos) === char) {
56997
+ this.pos += 1;
56998
+ return true;
56989
56999
  }
57000
+ return false;
56990
57001
  }
56991
- return date;
56992
- };
56993
- function getDate(isoDate) {
56994
- var matches = DATE.exec(isoDate);
56995
- if (!matches) {
56996
- return;
57002
+ readBC() {
57003
+ if (this.pos === this.stringLen) {
57004
+ return false;
57005
+ }
57006
+ if (this.dateString.slice(this.pos, this.pos + 3) === " BC") {
57007
+ this.pos += 3;
57008
+ return true;
57009
+ }
57010
+ return false;
56997
57011
  }
56998
- var year = parseInt(matches[1], 10);
56999
- var isBC = !!matches[4];
57000
- if (isBC) {
57001
- year = bcYearToNegativeYear(year);
57012
+ checkEnd() {
57013
+ return this.pos === this.stringLen;
57002
57014
  }
57003
- var month = parseInt(matches[2], 10) - 1;
57004
- var day = matches[3];
57005
- var date = new Date(year, month, day);
57006
- if (is0To99(year)) {
57007
- date.setFullYear(year);
57015
+ getUTC() {
57016
+ return this.skipChar(CHAR_CODE_Z);
57008
57017
  }
57009
- return date;
57010
- }
57011
- function timeZoneOffset(isoDate) {
57012
- if (isoDate.endsWith("+00")) {
57013
- return 0;
57018
+ readSign() {
57019
+ if (this.pos >= this.stringLen) {
57020
+ return null;
57021
+ }
57022
+ const char = this.dateString.charCodeAt(this.pos);
57023
+ if (char === CHAR_CODE_PLUS) {
57024
+ this.pos += 1;
57025
+ return 1;
57026
+ }
57027
+ if (char === CHAR_CODE_MINUS) {
57028
+ this.pos += 1;
57029
+ return -1;
57030
+ }
57031
+ return null;
57014
57032
  }
57015
- var zone = TIME_ZONE.exec(isoDate.split(" ")[1]);
57016
- if (!zone)
57017
- return;
57018
- var type = zone[1];
57019
- if (type === "Z") {
57033
+ getTZOffset() {
57034
+ if (this.pos === this.stringLen - 3 && this.dateString.slice(this.pos, this.pos + 3) === "+00") {
57035
+ this.pos += 3;
57036
+ return 0;
57037
+ }
57038
+ if (this.stringLen === this.pos) {
57039
+ return;
57040
+ }
57041
+ const sign = this.readSign();
57042
+ if (sign === null) {
57043
+ if (this.getUTC()) {
57044
+ return 0;
57045
+ }
57046
+ return;
57047
+ }
57048
+ const hours = this.readInteger2();
57049
+ if (hours === null) {
57050
+ return null;
57051
+ }
57052
+ let offset = hours * 3600;
57053
+ if (!this.skipChar(CHAR_CODE_COLON)) {
57054
+ return offset * sign * 1000;
57055
+ }
57056
+ const minutes = this.readInteger2();
57057
+ if (minutes === null) {
57058
+ return null;
57059
+ }
57060
+ offset += minutes * 60;
57061
+ if (!this.skipChar(CHAR_CODE_COLON)) {
57062
+ return offset * sign * 1000;
57063
+ }
57064
+ const seconds = this.readInteger2();
57065
+ if (seconds == null) {
57066
+ return null;
57067
+ }
57068
+ return (offset + seconds) * sign * 1000;
57069
+ }
57070
+ readMilliseconds() {
57071
+ if (this.skipChar(CHAR_CODE_DOT)) {
57072
+ let i = 2;
57073
+ let val = 0;
57074
+ const start = this.pos;
57075
+ while (this.pos < this.stringLen) {
57076
+ const chr = this.dateString.charCodeAt(this.pos);
57077
+ if (this.isDigit(chr)) {
57078
+ this.pos += 1;
57079
+ if (i >= 0) {
57080
+ val += (chr - CHAR_CODE_0) * 10 ** i;
57081
+ }
57082
+ i -= 1;
57083
+ } else {
57084
+ break;
57085
+ }
57086
+ }
57087
+ if (start === this.pos) {
57088
+ return null;
57089
+ }
57090
+ return val;
57091
+ }
57020
57092
  return 0;
57021
57093
  }
57022
- var sign = type === "-" ? -1 : 1;
57023
- var offset = parseInt(zone[2], 10) * 3600 + parseInt(zone[3] || 0, 10) * 60 + parseInt(zone[4] || 0, 10);
57024
- return offset * sign * 1000;
57025
- }
57026
- function bcYearToNegativeYear(year) {
57027
- return -(year - 1);
57028
- }
57029
- function is0To99(num) {
57030
- return num >= 0 && num < 100;
57031
- }
57032
- });
57033
-
57034
- // ../../../../node_modules/xtend/mutable.js
57035
- var require_mutable = __commonJS((exports, module) => {
57036
- module.exports = extend;
57037
- var hasOwnProperty2 = Object.prototype.hasOwnProperty;
57038
- function extend(target) {
57039
- for (var i = 1;i < arguments.length; i++) {
57040
- var source = arguments[i];
57041
- for (var key in source) {
57042
- if (hasOwnProperty2.call(source, key)) {
57043
- target[key] = source[key];
57094
+ readDate() {
57095
+ const year = this.readInteger();
57096
+ if (!this.skipChar(CHAR_CODE_DASH)) {
57097
+ return null;
57098
+ }
57099
+ let month = this.readInteger2();
57100
+ if (!this.skipChar(CHAR_CODE_DASH)) {
57101
+ return null;
57102
+ }
57103
+ const day = this.readInteger2();
57104
+ if (year === null || month === null || day === null) {
57105
+ return null;
57106
+ }
57107
+ month = month - 1;
57108
+ return { year, month, day };
57109
+ }
57110
+ readTime() {
57111
+ if (this.stringLen - this.pos < 9 || !this.skipChar(CHAR_CODE_SPACE)) {
57112
+ return { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 };
57113
+ }
57114
+ const hours = this.readInteger2();
57115
+ if (hours === null || !this.skipChar(CHAR_CODE_COLON)) {
57116
+ return null;
57117
+ }
57118
+ const minutes = this.readInteger2();
57119
+ if (minutes === null || !this.skipChar(CHAR_CODE_COLON)) {
57120
+ return null;
57121
+ }
57122
+ const seconds = this.readInteger2();
57123
+ if (seconds === null) {
57124
+ return null;
57125
+ }
57126
+ const milliseconds = this.readMilliseconds();
57127
+ if (milliseconds === null) {
57128
+ return null;
57129
+ }
57130
+ return { hours, minutes, seconds, milliseconds };
57131
+ }
57132
+ getJSDate() {
57133
+ const date = this.readDate();
57134
+ if (date === null) {
57135
+ return null;
57136
+ }
57137
+ const time = this.readTime();
57138
+ if (time === null) {
57139
+ return null;
57140
+ }
57141
+ const tzOffset = this.getTZOffset();
57142
+ if (tzOffset === null) {
57143
+ return null;
57144
+ }
57145
+ const isBC = this.readBC();
57146
+ if (isBC) {
57147
+ date.year = -(date.year - 1);
57148
+ }
57149
+ if (!this.checkEnd()) {
57150
+ return null;
57151
+ }
57152
+ let jsDate;
57153
+ if (tzOffset !== undefined) {
57154
+ jsDate = new Date(Date.UTC(date.year, date.month, date.day, time.hours, time.minutes, time.seconds, time.milliseconds));
57155
+ if (date.year <= 99 && date.year >= -99) {
57156
+ jsDate.setUTCFullYear(date.year);
57157
+ }
57158
+ if (tzOffset !== 0) {
57159
+ jsDate.setTime(jsDate.getTime() - tzOffset);
57160
+ }
57161
+ } else {
57162
+ jsDate = new Date(date.year, date.month, date.day, time.hours, time.minutes, time.seconds, time.milliseconds);
57163
+ if (date.year <= 99 && date.year >= -99) {
57164
+ jsDate.setFullYear(date.year);
57044
57165
  }
57045
57166
  }
57167
+ return jsDate;
57168
+ }
57169
+ static parse(dateString) {
57170
+ return new PGDateParser(dateString).getJSDate();
57046
57171
  }
57047
- return target;
57048
57172
  }
57173
+ module.exports = function parseDate(isoDate) {
57174
+ if (isoDate === null || isoDate === undefined) {
57175
+ return null;
57176
+ }
57177
+ const date = PGDateParser.parse(isoDate);
57178
+ if (date === null) {
57179
+ if (isoDate === "infinity") {
57180
+ return Infinity;
57181
+ }
57182
+ if (isoDate === "-infinity") {
57183
+ return -Infinity;
57184
+ }
57185
+ }
57186
+ return date;
57187
+ };
57049
57188
  });
57050
57189
 
57051
- // ../../../../node_modules/pg/node_modules/pg-types/node_modules/postgres-interval/index.js
57190
+ // ../../../../node_modules/postgres-interval/index.js
57052
57191
  var require_postgres_interval = __commonJS((exports, module) => {
57053
- var extend = require_mutable();
57054
57192
  module.exports = PostgresInterval;
57055
57193
  function PostgresInterval(raw) {
57056
57194
  if (!(this instanceof PostgresInterval)) {
57057
57195
  return new PostgresInterval(raw);
57058
57196
  }
57059
- extend(this, parse(raw));
57197
+ Object.assign(this, parse(raw));
57060
57198
  }
57061
57199
  var properties = ["seconds", "minutes", "hours", "days", "months", "years"];
57062
57200
  PostgresInterval.prototype.toPostgres = function() {
57063
- var filtered = properties.filter(this.hasOwnProperty, this);
57201
+ const filtered = properties.filter((key) => Object.prototype.hasOwnProperty.call(this, key) && this[key] !== 0);
57064
57202
  if (this.milliseconds && filtered.indexOf("seconds") < 0) {
57065
57203
  filtered.push("seconds");
57066
57204
  }
57067
57205
  if (filtered.length === 0)
57068
57206
  return "0";
57069
57207
  return filtered.map(function(property) {
57070
- var value = this[property] || 0;
57208
+ let value = this[property] || 0;
57071
57209
  if (property === "seconds" && this.milliseconds) {
57072
57210
  value = (value + this.milliseconds / 1000).toFixed(6).replace(/\.?0+$/, "");
57073
57211
  }
@@ -57085,69 +57223,97 @@ var require_postgres_interval = __commonJS((exports, module) => {
57085
57223
  var dateProperties = ["years", "months", "days"];
57086
57224
  var timeProperties = ["hours", "minutes", "seconds"];
57087
57225
  PostgresInterval.prototype.toISOString = PostgresInterval.prototype.toISO = function() {
57088
- var datePart = dateProperties.map(buildProperty, this).join("");
57089
- var timePart = timeProperties.map(buildProperty, this).join("");
57090
- return "P" + datePart + "T" + timePart;
57226
+ return toISOString.call(this, { short: false });
57227
+ };
57228
+ PostgresInterval.prototype.toISOStringShort = function() {
57229
+ return toISOString.call(this, { short: true });
57230
+ };
57231
+ function toISOString({ short = false }) {
57232
+ const datePart = dateProperties.map(buildProperty, this).join("");
57233
+ const timePart = timeProperties.map(buildProperty, this).join("");
57234
+ if (!timePart.length && !datePart.length)
57235
+ return "PT0S";
57236
+ if (!timePart.length)
57237
+ return `P${datePart}`;
57238
+ return `P${datePart}T${timePart}`;
57091
57239
  function buildProperty(property) {
57092
- var value = this[property] || 0;
57240
+ let value = this[property] || 0;
57093
57241
  if (property === "seconds" && this.milliseconds) {
57094
57242
  value = (value + this.milliseconds / 1000).toFixed(6).replace(/0+$/, "");
57095
57243
  }
57244
+ if (short && !value)
57245
+ return "";
57096
57246
  return value + propertiesISOEquivalent[property];
57097
57247
  }
57098
- };
57099
- var NUMBER = "([+-]?\\d+)";
57100
- var YEAR = NUMBER + "\\s+years?";
57101
- var MONTH = NUMBER + "\\s+mons?";
57102
- var DAY = NUMBER + "\\s+days?";
57103
- var TIME = "([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?";
57104
- var INTERVAL = new RegExp([YEAR, MONTH, DAY, TIME].map(function(regexString) {
57105
- return "(" + regexString + ")?";
57106
- }).join("\\s*"));
57107
- var positions = {
57108
- years: 2,
57109
- months: 4,
57110
- days: 6,
57111
- hours: 9,
57112
- minutes: 10,
57113
- seconds: 11,
57114
- milliseconds: 12
57115
- };
57116
- var negatives = ["hours", "minutes", "seconds", "milliseconds"];
57117
- function parseMilliseconds(fraction) {
57118
- var microseconds = fraction + "000000".slice(fraction.length);
57119
- return parseInt(microseconds, 10) / 1000;
57120
57248
  }
57249
+ var NUMBER = "([+-]?\\d+)";
57250
+ var YEAR = `${NUMBER}\\s+years?`;
57251
+ var MONTH = `${NUMBER}\\s+mons?`;
57252
+ var DAY = `${NUMBER}\\s+days?`;
57253
+ var TIME = "([+-])?(\\d+):(\\d\\d):(\\d\\d(?:\\.\\d{1,6})?)";
57254
+ var INTERVAL = new RegExp("^\\s*" + [YEAR, MONTH, DAY, TIME].map((str) => "(?:" + str + ")?").join("\\s*") + "\\s*$");
57255
+ var ZERO_INTERVAL = Object.freeze({
57256
+ years: 0,
57257
+ months: 0,
57258
+ days: 0,
57259
+ hours: 0,
57260
+ minutes: 0,
57261
+ seconds: 0,
57262
+ milliseconds: 0
57263
+ });
57121
57264
  function parse(interval) {
57122
- if (!interval)
57123
- return {};
57124
- var matches = INTERVAL.exec(interval);
57125
- var isNegative = matches[8] === "-";
57126
- return Object.keys(positions).reduce(function(parsed, property) {
57127
- var position = positions[property];
57128
- var value = matches[position];
57129
- if (!value)
57130
- return parsed;
57131
- value = property === "milliseconds" ? parseMilliseconds(value) : parseInt(value, 10);
57132
- if (!value)
57133
- return parsed;
57134
- if (isNegative && ~negatives.indexOf(property)) {
57135
- value *= -1;
57136
- }
57137
- parsed[property] = value;
57138
- return parsed;
57139
- }, {});
57265
+ if (!interval) {
57266
+ return ZERO_INTERVAL;
57267
+ }
57268
+ const matches = INTERVAL.exec(interval) || [];
57269
+ const [
57270
+ ,
57271
+ yearsString,
57272
+ monthsString,
57273
+ daysString,
57274
+ plusMinusTime,
57275
+ hoursString,
57276
+ minutesString,
57277
+ secondsString
57278
+ ] = matches;
57279
+ const timeMultiplier = plusMinusTime === "-" ? -1 : 1;
57280
+ const years = yearsString ? parseInt(yearsString, 10) : 0;
57281
+ const months = monthsString ? parseInt(monthsString, 10) : 0;
57282
+ const days = daysString ? parseInt(daysString, 10) : 0;
57283
+ const hours = hoursString ? timeMultiplier * parseInt(hoursString, 10) : 0;
57284
+ const minutes = minutesString ? timeMultiplier * parseInt(minutesString, 10) : 0;
57285
+ const secondsFloat = parseFloat(secondsString) || 0;
57286
+ const absSeconds = Math.floor(secondsFloat);
57287
+ const seconds = timeMultiplier * absSeconds;
57288
+ const milliseconds = Math.round(timeMultiplier * (secondsFloat - absSeconds) * 1e6) / 1000;
57289
+ return {
57290
+ years,
57291
+ months,
57292
+ days,
57293
+ hours,
57294
+ minutes,
57295
+ seconds,
57296
+ milliseconds
57297
+ };
57140
57298
  }
57299
+ PostgresInterval.parse = parse;
57141
57300
  });
57142
57301
 
57143
- // ../../../../node_modules/pg/node_modules/pg-types/node_modules/postgres-bytea/index.js
57144
- var require_postgres_bytea = __commonJS((exports, module) => {
57145
- module.exports = function parseBytea(input) {
57302
+ // ../../../../node_modules/postgres-bytea/decode.js
57303
+ var require_decode = __commonJS((exports, module) => {
57304
+ module.exports = byteaToBinary;
57305
+ function byteaToBinary(input) {
57146
57306
  if (/^\\x/.test(input)) {
57147
- return new Buffer(input.substr(2), "hex");
57307
+ return byteaHexFormatToBinary(input);
57148
57308
  }
57149
- var output = "";
57150
- var i = 0;
57309
+ return byteaEscapeFormatToBinary(input);
57310
+ }
57311
+ function byteaHexFormatToBinary(input) {
57312
+ return Buffer.from(input.substr(2), "hex");
57313
+ }
57314
+ function byteaEscapeFormatToBinary(input) {
57315
+ let output = "";
57316
+ let i = 0;
57151
57317
  while (i < input.length) {
57152
57318
  if (input[i] !== "\\") {
57153
57319
  output += input[i];
@@ -57157,136 +57323,679 @@ var require_postgres_bytea = __commonJS((exports, module) => {
57157
57323
  output += String.fromCharCode(parseInt(input.substr(i + 1, 3), 8));
57158
57324
  i += 4;
57159
57325
  } else {
57160
- var backslashes = 1;
57326
+ let backslashes = 1;
57161
57327
  while (i + backslashes < input.length && input[i + backslashes] === "\\") {
57162
57328
  backslashes++;
57163
57329
  }
57164
- for (var k = 0;k < Math.floor(backslashes / 2); ++k) {
57330
+ for (let k = 0;k < Math.floor(backslashes / 2); ++k) {
57165
57331
  output += "\\";
57166
57332
  }
57167
57333
  i += Math.floor(backslashes / 2) * 2;
57168
57334
  }
57169
57335
  }
57170
57336
  }
57171
- return new Buffer(output, "binary");
57337
+ return Buffer.from(output, "binary");
57338
+ }
57339
+ });
57340
+
57341
+ // ../../../../node_modules/postgres-bytea/encoder.js
57342
+ var require_encoder = __commonJS((exports, module) => {
57343
+ var { Transform } = __require("stream");
57344
+
57345
+ class ByteaEncoder extends Transform {
57346
+ constructor() {
57347
+ super();
57348
+ this.push("\\\\x");
57349
+ }
57350
+ _transform(chunk, encoding, callback) {
57351
+ this.push(chunk.toString("hex"));
57352
+ callback();
57353
+ }
57354
+ }
57355
+ module.exports = ByteaEncoder;
57356
+ });
57357
+
57358
+ // ../../../../node_modules/obuf/index.js
57359
+ var require_obuf = __commonJS((exports, module) => {
57360
+ var Buffer2 = __require("buffer").Buffer;
57361
+ function OffsetBuffer() {
57362
+ this.offset = 0;
57363
+ this.size = 0;
57364
+ this.buffers = [];
57365
+ }
57366
+ module.exports = OffsetBuffer;
57367
+ OffsetBuffer.prototype.isEmpty = function isEmpty() {
57368
+ return this.size === 0;
57369
+ };
57370
+ OffsetBuffer.prototype.clone = function clone(size) {
57371
+ var r = new OffsetBuffer;
57372
+ r.offset = this.offset;
57373
+ r.size = size;
57374
+ r.buffers = this.buffers.slice();
57375
+ return r;
57376
+ };
57377
+ OffsetBuffer.prototype.toChunks = function toChunks() {
57378
+ if (this.size === 0)
57379
+ return [];
57380
+ if (this.offset !== 0) {
57381
+ this.buffers[0] = this.buffers[0].slice(this.offset);
57382
+ this.offset = 0;
57383
+ }
57384
+ var chunks = [];
57385
+ var off = 0;
57386
+ for (var i = 0;off <= this.size && i < this.buffers.length; i++) {
57387
+ var buf = this.buffers[i];
57388
+ off += buf.length;
57389
+ if (off > this.size) {
57390
+ buf = buf.slice(0, buf.length - (off - this.size));
57391
+ this.buffers[i] = buf;
57392
+ }
57393
+ chunks.push(buf);
57394
+ }
57395
+ if (i < this.buffers.length)
57396
+ this.buffers.length = i;
57397
+ return chunks;
57398
+ };
57399
+ OffsetBuffer.prototype.toString = function toString(enc) {
57400
+ return this.toChunks().map(function(c) {
57401
+ return c.toString(enc);
57402
+ }).join("");
57403
+ };
57404
+ OffsetBuffer.prototype.use = function use(buf, off, n) {
57405
+ this.buffers = [buf];
57406
+ this.offset = off;
57407
+ this.size = n;
57408
+ };
57409
+ OffsetBuffer.prototype.push = function push(data) {
57410
+ if (data.length === 0)
57411
+ return;
57412
+ this.size += data.length;
57413
+ this.buffers.push(data);
57414
+ };
57415
+ OffsetBuffer.prototype.has = function has(n) {
57416
+ return this.size >= n;
57417
+ };
57418
+ OffsetBuffer.prototype.skip = function skip(n) {
57419
+ if (this.size === 0)
57420
+ return;
57421
+ this.size -= n;
57422
+ if (this.offset + n < this.buffers[0].length) {
57423
+ this.offset += n;
57424
+ return;
57425
+ }
57426
+ var left = n - (this.buffers[0].length - this.offset);
57427
+ this.offset = 0;
57428
+ for (var shift = 1;left > 0 && shift < this.buffers.length; shift++) {
57429
+ var buf = this.buffers[shift];
57430
+ if (buf.length > left) {
57431
+ this.offset = left;
57432
+ break;
57433
+ }
57434
+ left -= buf.length;
57435
+ }
57436
+ this.buffers = this.buffers.slice(shift);
57437
+ };
57438
+ OffsetBuffer.prototype.copy = function copy(target, targetOff, off, n) {
57439
+ if (this.size === 0)
57440
+ return;
57441
+ if (off !== 0)
57442
+ throw new Error("Unsupported offset in .copy()");
57443
+ var toff = targetOff;
57444
+ var first = this.buffers[0];
57445
+ var toCopy = Math.min(n, first.length - this.offset);
57446
+ first.copy(target, toff, this.offset, this.offset + toCopy);
57447
+ toff += toCopy;
57448
+ var left = n - toCopy;
57449
+ for (var i = 1;left > 0 && i < this.buffers.length; i++) {
57450
+ var buf = this.buffers[i];
57451
+ var toCopy = Math.min(left, buf.length);
57452
+ buf.copy(target, toff, 0, toCopy);
57453
+ toff += toCopy;
57454
+ left -= toCopy;
57455
+ }
57456
+ };
57457
+ OffsetBuffer.prototype.take = function take(n) {
57458
+ if (n === 0)
57459
+ return new Buffer2(0);
57460
+ this.size -= n;
57461
+ var first = this.buffers[0].length - this.offset;
57462
+ if (first === n) {
57463
+ var r = this.buffers.shift();
57464
+ if (this.offset !== 0) {
57465
+ r = r.slice(this.offset);
57466
+ this.offset = 0;
57467
+ }
57468
+ return r;
57469
+ } else if (first > n) {
57470
+ var r = this.buffers[0].slice(this.offset, this.offset + n);
57471
+ this.offset += n;
57472
+ return r;
57473
+ }
57474
+ var out = new Buffer2(n);
57475
+ var toOff = 0;
57476
+ var startOff = this.offset;
57477
+ for (var i = 0;toOff !== n && i < this.buffers.length; i++) {
57478
+ var buf = this.buffers[i];
57479
+ var toCopy = Math.min(buf.length - startOff, n - toOff);
57480
+ buf.copy(out, toOff, startOff, startOff + toCopy);
57481
+ if (startOff + toCopy < buf.length) {
57482
+ this.offset = startOff + toCopy;
57483
+ break;
57484
+ } else {
57485
+ toOff += toCopy;
57486
+ startOff = 0;
57487
+ }
57488
+ }
57489
+ this.buffers = this.buffers.slice(i);
57490
+ if (this.buffers.length === 0)
57491
+ this.offset = 0;
57492
+ return out;
57493
+ };
57494
+ OffsetBuffer.prototype.peekUInt8 = function peekUInt8() {
57495
+ return this.buffers[0][this.offset];
57496
+ };
57497
+ OffsetBuffer.prototype.readUInt8 = function readUInt8() {
57498
+ this.size -= 1;
57499
+ var first = this.buffers[0];
57500
+ var r = first[this.offset];
57501
+ if (++this.offset === first.length) {
57502
+ this.offset = 0;
57503
+ this.buffers.shift();
57504
+ }
57505
+ return r;
57506
+ };
57507
+ OffsetBuffer.prototype.readUInt16LE = function readUInt16LE() {
57508
+ var first = this.buffers[0];
57509
+ this.size -= 2;
57510
+ var r;
57511
+ var shift;
57512
+ if (first.length - this.offset >= 2) {
57513
+ r = first.readUInt16LE(this.offset);
57514
+ shift = 0;
57515
+ this.offset += 2;
57516
+ } else {
57517
+ r = first[this.offset] | this.buffers[1][0] << 8;
57518
+ shift = 1;
57519
+ this.offset = 1;
57520
+ }
57521
+ if (this.offset === this.buffers[shift].length) {
57522
+ this.offset = 0;
57523
+ shift++;
57524
+ }
57525
+ if (shift !== 0)
57526
+ this.buffers = this.buffers.slice(shift);
57527
+ return r;
57528
+ };
57529
+ OffsetBuffer.prototype.readUInt24LE = function readUInt24LE() {
57530
+ var first = this.buffers[0];
57531
+ var r;
57532
+ var shift;
57533
+ var firstHas = first.length - this.offset;
57534
+ if (firstHas >= 3) {
57535
+ r = first.readUInt16LE(this.offset) | first[this.offset + 2] << 16;
57536
+ shift = 0;
57537
+ this.offset += 3;
57538
+ } else if (firstHas >= 2) {
57539
+ r = first.readUInt16LE(this.offset) | this.buffers[1][0] << 16;
57540
+ shift = 1;
57541
+ this.offset = 1;
57542
+ } else {
57543
+ r = first[this.offset];
57544
+ this.offset = 0;
57545
+ this.buffers.shift();
57546
+ this.size -= 1;
57547
+ r |= this.readUInt16LE() << 8;
57548
+ return r;
57549
+ }
57550
+ this.size -= 3;
57551
+ if (this.offset === this.buffers[shift].length) {
57552
+ this.offset = 0;
57553
+ shift++;
57554
+ }
57555
+ if (shift !== 0)
57556
+ this.buffers = this.buffers.slice(shift);
57557
+ return r;
57558
+ };
57559
+ OffsetBuffer.prototype.readUInt32LE = function readUInt32LE() {
57560
+ var first = this.buffers[0];
57561
+ var r;
57562
+ var shift;
57563
+ var firstHas = first.length - this.offset;
57564
+ if (firstHas >= 4) {
57565
+ r = first.readUInt32LE(this.offset);
57566
+ shift = 0;
57567
+ this.offset += 4;
57568
+ } else if (firstHas >= 3) {
57569
+ r = (first.readUInt16LE(this.offset) | first[this.offset + 2] << 16) + this.buffers[1][0] * 16777216;
57570
+ shift = 1;
57571
+ this.offset = 1;
57572
+ } else if (firstHas >= 2) {
57573
+ r = first.readUInt16LE(this.offset);
57574
+ this.offset = 0;
57575
+ this.buffers.shift();
57576
+ this.size -= 2;
57577
+ r += this.readUInt16LE() * 65536;
57578
+ return r;
57579
+ } else {
57580
+ r = first[this.offset];
57581
+ this.offset = 0;
57582
+ this.buffers.shift();
57583
+ this.size -= 1;
57584
+ r += this.readUInt24LE() * 256;
57585
+ return r;
57586
+ }
57587
+ this.size -= 4;
57588
+ if (this.offset === this.buffers[shift].length) {
57589
+ this.offset = 0;
57590
+ shift++;
57591
+ }
57592
+ if (shift !== 0)
57593
+ this.buffers = this.buffers.slice(shift);
57594
+ return r;
57595
+ };
57596
+ OffsetBuffer.prototype.readUInt16BE = function readUInt16BE() {
57597
+ var r = this.readUInt16LE();
57598
+ return (r & 255) << 8 | r >> 8;
57599
+ };
57600
+ OffsetBuffer.prototype.readUInt24BE = function readUInt24BE() {
57601
+ var r = this.readUInt24LE();
57602
+ return (r & 255) << 16 | (r >> 8 & 255) << 8 | r >> 16;
57603
+ };
57604
+ OffsetBuffer.prototype.readUInt32BE = function readUInt32BE() {
57605
+ var r = this.readUInt32LE();
57606
+ return ((r & 255) << 24 | (r >>> 8 & 255) << 16 | (r >>> 16 & 255) << 8 | r >>> 24) >>> 0;
57607
+ };
57608
+ function signedInt8(num) {
57609
+ if (num >= 128)
57610
+ return -(255 ^ num) - 1;
57611
+ else
57612
+ return num;
57613
+ }
57614
+ OffsetBuffer.prototype.peekInt8 = function peekInt8() {
57615
+ return signedInt8(this.peekUInt8());
57616
+ };
57617
+ OffsetBuffer.prototype.readInt8 = function readInt8() {
57618
+ return signedInt8(this.readUInt8());
57619
+ };
57620
+ function signedInt16(num) {
57621
+ if (num >= 32768)
57622
+ return -(65535 ^ num) - 1;
57623
+ else
57624
+ return num;
57625
+ }
57626
+ OffsetBuffer.prototype.readInt16BE = function readInt16BE() {
57627
+ return signedInt16(this.readUInt16BE());
57628
+ };
57629
+ OffsetBuffer.prototype.readInt16LE = function readInt16LE() {
57630
+ return signedInt16(this.readUInt16LE());
57631
+ };
57632
+ function signedInt24(num) {
57633
+ if (num >= 8388608)
57634
+ return -(16777215 ^ num) - 1;
57635
+ else
57636
+ return num;
57637
+ }
57638
+ OffsetBuffer.prototype.readInt24BE = function readInt24BE() {
57639
+ return signedInt24(this.readUInt24BE());
57640
+ };
57641
+ OffsetBuffer.prototype.readInt24LE = function readInt24LE() {
57642
+ return signedInt24(this.readUInt24LE());
57643
+ };
57644
+ function signedInt32(num) {
57645
+ if (num >= 2147483648)
57646
+ return -(4294967295 ^ num) - 1;
57647
+ else
57648
+ return num;
57649
+ }
57650
+ OffsetBuffer.prototype.readInt32BE = function readInt32BE() {
57651
+ return signedInt32(this.readUInt32BE());
57652
+ };
57653
+ OffsetBuffer.prototype.readInt32LE = function readInt32LE() {
57654
+ return signedInt32(this.readUInt32LE());
57655
+ };
57656
+ });
57657
+
57658
+ // ../../../../node_modules/postgres-bytea/decoder.js
57659
+ var require_decoder = __commonJS((exports, module) => {
57660
+ var BufferList = require_obuf();
57661
+ var { Transform } = __require("stream");
57662
+ var State = {
57663
+ READ_PREFIX: 1,
57664
+ READ_DATA: 2
57665
+ };
57666
+
57667
+ class ByteaDecoder extends Transform {
57668
+ constructor() {
57669
+ super();
57670
+ this._incomingChunks = new BufferList;
57671
+ this._state = State.READ_PREFIX;
57672
+ }
57673
+ _transform(chunk, encoding, callback) {
57674
+ this._incomingChunks.push(chunk);
57675
+ while (true) {
57676
+ if (this._state === State.READ_PREFIX) {
57677
+ if (this._incomingChunks.has(3)) {
57678
+ const prefix = this._incomingChunks.take(3);
57679
+ const prefixString = prefix.toString();
57680
+ if (prefixString !== "\\\\x") {
57681
+ return this.emit("error", new Error(`Expected double-escaped postgres bytea hex format prefix, received: '${prefixString}'`));
57682
+ }
57683
+ this._state = State.READ_DATA;
57684
+ continue;
57685
+ } else {
57686
+ break;
57687
+ }
57688
+ }
57689
+ if (this._state === State.READ_DATA) {
57690
+ if (this._incomingChunks.size >= 2) {
57691
+ let evenChunk;
57692
+ const isEvenLength = this._incomingChunks.size % 2 === 0;
57693
+ if (isEvenLength) {
57694
+ evenChunk = this._incomingChunks.take(this._incomingChunks.size);
57695
+ } else {
57696
+ evenChunk = this._incomingChunks.take(this._incomingChunks.size - 1);
57697
+ }
57698
+ this.push(Buffer.from(evenChunk.toString(), "hex"));
57699
+ }
57700
+ break;
57701
+ }
57702
+ }
57703
+ callback();
57704
+ }
57705
+ }
57706
+ module.exports = ByteaDecoder;
57707
+ });
57708
+
57709
+ // ../../../../node_modules/postgres-bytea/index.js
57710
+ var require_postgres_bytea = __commonJS((exports, module) => {
57711
+ exports = module.exports = require_decode();
57712
+ exports.Encoder = require_encoder();
57713
+ exports.Decoder = require_decoder();
57714
+ });
57715
+
57716
+ // ../../../../node_modules/postgres-range/index.js
57717
+ var require_postgres_range = __commonJS((exports, module) => {
57718
+ var RANGE_EMPTY = 1 << 1;
57719
+ var RANGE_LB_INC = 1 << 2;
57720
+ var RANGE_UB_INC = 1 << 3;
57721
+ var RANGE_LB_INF = 1 << 4;
57722
+ var RANGE_UB_INF = 1 << 5;
57723
+ var EMPTY = "empty";
57724
+ var INFINITY = "infinity";
57725
+
57726
+ class RangeError2 extends Error {
57727
+ }
57728
+
57729
+ class Range {
57730
+ constructor(lower, upper, mask = 0) {
57731
+ this.lower = lower;
57732
+ this.upper = upper;
57733
+ this.mask = mask;
57734
+ }
57735
+ hasMask(flag) {
57736
+ return (this.mask & flag) === flag;
57737
+ }
57738
+ isEmpty() {
57739
+ return this.hasMask(RANGE_EMPTY);
57740
+ }
57741
+ isBounded() {
57742
+ return !this.hasMask(RANGE_LB_INF) && !this.hasMask(RANGE_UB_INF);
57743
+ }
57744
+ isLowerBoundClosed() {
57745
+ return this.hasLowerBound() && this.hasMask(RANGE_LB_INC);
57746
+ }
57747
+ isUpperBoundClosed() {
57748
+ return this.hasUpperBound() && this.hasMask(RANGE_UB_INC);
57749
+ }
57750
+ hasLowerBound() {
57751
+ return !this.hasMask(RANGE_LB_INF);
57752
+ }
57753
+ hasUpperBound() {
57754
+ return !this.hasMask(RANGE_UB_INF);
57755
+ }
57756
+ containsPoint(point) {
57757
+ const l = this.hasLowerBound();
57758
+ const u = this.hasUpperBound();
57759
+ if (l && u) {
57760
+ const inLower = this.hasMask(RANGE_LB_INC) ? this.lower <= point : this.lower < point;
57761
+ const inUpper = this.hasMask(RANGE_UB_INC) ? this.upper >= point : this.upper > point;
57762
+ return inLower && inUpper;
57763
+ } else if (l) {
57764
+ return this.hasMask(RANGE_LB_INC) ? this.lower <= point : this.lower < point;
57765
+ } else if (u) {
57766
+ return this.hasMask(RANGE_UB_INC) ? this.upper >= point : this.upper > point;
57767
+ }
57768
+ return true;
57769
+ }
57770
+ containsRange(range) {
57771
+ return (!range.hasLowerBound() || this.containsPoint(range.lower)) && (!range.hasUpperBound() || this.containsPoint(range.upper));
57772
+ }
57773
+ toPostgres(prepareValue) {
57774
+ return serialize(this, prepareValue);
57775
+ }
57776
+ }
57777
+ function parse(input, transform = (x) => x) {
57778
+ input = input.trim();
57779
+ if (input === EMPTY) {
57780
+ return new Range(null, null, RANGE_EMPTY);
57781
+ }
57782
+ let ptr = 0;
57783
+ let mask = 0;
57784
+ if (input[ptr] === "[") {
57785
+ mask |= RANGE_LB_INC;
57786
+ ptr += 1;
57787
+ } else if (input[ptr] === "(") {
57788
+ ptr += 1;
57789
+ } else {
57790
+ throw new RangeError2(`Unexpected character '${input[ptr]}'. Position: ${ptr}`);
57791
+ }
57792
+ const lb = parseBound(input, ptr);
57793
+ if (lb.infinite) {
57794
+ mask |= RANGE_LB_INF;
57795
+ }
57796
+ ptr = lb.ptr;
57797
+ if (input[ptr] === ",") {
57798
+ ptr += 1;
57799
+ } else {
57800
+ throw new RangeError2(`Expected comma as the delimiter, got '${input[ptr]}'. Position: ${ptr}`);
57801
+ }
57802
+ const ub = parseBound(input, ptr);
57803
+ if (ub.infinite) {
57804
+ mask |= RANGE_UB_INF;
57805
+ }
57806
+ ptr = ub.ptr;
57807
+ if (input[ptr] === "]") {
57808
+ mask |= RANGE_UB_INC;
57809
+ ptr += 1;
57810
+ } else if (input[ptr] === ")") {
57811
+ ptr += 1;
57812
+ } else {
57813
+ throw new RangeError2(`Unexpected character '${input[ptr]}'. Position: ${ptr}`);
57814
+ }
57815
+ let lower = null;
57816
+ let upper = null;
57817
+ if ((mask & RANGE_LB_INF) !== RANGE_LB_INF) {
57818
+ lower = transform(lb.value);
57819
+ }
57820
+ if ((mask & RANGE_UB_INF) !== RANGE_UB_INF) {
57821
+ upper = transform(ub.value);
57822
+ }
57823
+ return new Range(lower, upper, mask);
57824
+ }
57825
+ function parseBound(input, ptr) {
57826
+ if (input[ptr] === "," || input[ptr] === ")" || input[ptr] === "]") {
57827
+ return {
57828
+ infinite: true,
57829
+ value: null,
57830
+ ptr
57831
+ };
57832
+ } else {
57833
+ let inQuote = false;
57834
+ let value = "";
57835
+ let pos = ptr;
57836
+ while (inQuote || !(input[ptr] === "," || input[ptr] === ")" || input[ptr] === "]")) {
57837
+ const ch = input[ptr++];
57838
+ if (ch === undefined) {
57839
+ throw new RangeError2(`Unexpected end of input. Position: ${ptr}`);
57840
+ }
57841
+ if (ch === "\\") {
57842
+ if (input[ptr] === undefined) {
57843
+ throw new RangeError2(`Unexpected end of input. Position: ${ptr}`);
57844
+ }
57845
+ value += input.slice(pos, ptr - 1) + input[ptr];
57846
+ ptr += 1;
57847
+ pos = ptr;
57848
+ } else if (ch === '"') {
57849
+ if (!inQuote) {
57850
+ inQuote = true;
57851
+ pos += 1;
57852
+ } else if (input[ptr] === '"') {
57853
+ value += input.slice(pos, ptr - 1) + input[ptr];
57854
+ ptr += 1;
57855
+ pos = ptr;
57856
+ } else {
57857
+ inQuote = false;
57858
+ value += input.slice(pos, ptr - 1);
57859
+ pos = ptr + 1;
57860
+ }
57861
+ }
57862
+ }
57863
+ if (ptr > pos) {
57864
+ value += input.slice(pos, ptr);
57865
+ }
57866
+ if (value.endsWith(INFINITY)) {
57867
+ return {
57868
+ infinite: true,
57869
+ value: null,
57870
+ ptr
57871
+ };
57872
+ }
57873
+ return {
57874
+ infinite: false,
57875
+ value,
57876
+ ptr
57877
+ };
57878
+ }
57879
+ }
57880
+ function serialize(range, format = (x) => x) {
57881
+ if (range.hasMask(RANGE_EMPTY)) {
57882
+ return EMPTY;
57883
+ }
57884
+ let s = "";
57885
+ s += range.isLowerBoundClosed() ? "[" : "(";
57886
+ s += range.hasLowerBound() ? serializeBound(format(range.lower)) : "";
57887
+ s += ",";
57888
+ s += range.hasUpperBound() ? serializeBound(format(range.upper)) : "";
57889
+ s += range.isUpperBoundClosed() ? "]" : ")";
57890
+ return s;
57891
+ }
57892
+ function serializeBound(bnd) {
57893
+ let needsQuotes = false;
57894
+ let pos = 0;
57895
+ let value = "";
57896
+ if (typeof bnd !== "string") {
57897
+ if (typeof bnd === "number" || typeof bnd === "bigint")
57898
+ return bnd.toString();
57899
+ bnd = String(bnd);
57900
+ }
57901
+ if (bnd === null || bnd.length === 0) {
57902
+ return '""';
57903
+ }
57904
+ bnd = bnd.trim();
57905
+ for (let i = 0;i < bnd.length; i++) {
57906
+ const ch = bnd[i];
57907
+ if (ch === '"' || ch === "\\" || ch === "(" || ch === ")" || ch === "[" || ch === "]" || ch === "," || ch === " ") {
57908
+ needsQuotes = true;
57909
+ break;
57910
+ }
57911
+ }
57912
+ if (needsQuotes) {
57913
+ value += '"';
57914
+ }
57915
+ let ptr = 0;
57916
+ for (;ptr < bnd.length; ptr++) {
57917
+ const ch = bnd[ptr];
57918
+ if (ch === '"' || ch === "\\") {
57919
+ value += bnd.slice(pos, ptr + 1) + ch;
57920
+ pos = ptr + 1;
57921
+ }
57922
+ }
57923
+ if (ptr > pos) {
57924
+ value += bnd.slice(pos, ptr);
57925
+ }
57926
+ if (needsQuotes) {
57927
+ value += '"';
57928
+ }
57929
+ return value;
57930
+ }
57931
+ module.exports = {
57932
+ Range,
57933
+ RangeError: RangeError2,
57934
+ RANGE_EMPTY,
57935
+ RANGE_LB_INC,
57936
+ RANGE_UB_INC,
57937
+ RANGE_LB_INF,
57938
+ RANGE_UB_INF,
57939
+ parse,
57940
+ serialize
57172
57941
  };
57173
57942
  });
57174
57943
 
57175
- // ../../../../node_modules/pg/node_modules/pg-types/lib/textParsers.js
57944
+ // ../../../../node_modules/pg-types/lib/textParsers.js
57176
57945
  var require_textParsers = __commonJS((exports, module) => {
57177
57946
  var array = require_postgres_array();
57178
- var arrayParser = require_arrayParser();
57179
- var parseDate = require_postgres_date();
57947
+ var parseTimestampTz = require_postgres_date();
57180
57948
  var parseInterval = require_postgres_interval();
57181
57949
  var parseByteA = require_postgres_bytea();
57182
- function allowNull(fn) {
57183
- return function nullAllowed(value) {
57184
- if (value === null)
57185
- return value;
57186
- return fn(value);
57187
- };
57188
- }
57950
+ var range = require_postgres_range();
57189
57951
  function parseBool(value) {
57190
- if (value === null)
57191
- return value;
57192
57952
  return value === "TRUE" || value === "t" || value === "true" || value === "y" || value === "yes" || value === "on" || value === "1";
57193
57953
  }
57194
57954
  function parseBoolArray(value) {
57195
- if (!value)
57196
- return null;
57197
57955
  return array.parse(value, parseBool);
57198
57956
  }
57199
- function parseBaseTenInt(string) {
57200
- return parseInt(string, 10);
57201
- }
57202
57957
  function parseIntegerArray(value) {
57203
- if (!value)
57204
- return null;
57205
- return array.parse(value, allowNull(parseBaseTenInt));
57958
+ return array.parse(value, Number);
57206
57959
  }
57207
57960
  function parseBigIntegerArray(value) {
57208
- if (!value)
57209
- return null;
57210
- return array.parse(value, allowNull(function(entry) {
57961
+ return array.parse(value, function(entry) {
57211
57962
  return parseBigInteger(entry).trim();
57212
- }));
57963
+ });
57213
57964
  }
57214
57965
  var parsePointArray = function(value) {
57215
- if (!value) {
57216
- return null;
57217
- }
57218
- var p2 = arrayParser.create(value, function(entry) {
57219
- if (entry !== null) {
57220
- entry = parsePoint(entry);
57221
- }
57222
- return entry;
57223
- });
57224
- return p2.parse();
57966
+ return array.parse(value, parsePoint);
57225
57967
  };
57226
57968
  var parseFloatArray = function(value) {
57227
- if (!value) {
57228
- return null;
57229
- }
57230
- var p2 = arrayParser.create(value, function(entry) {
57231
- if (entry !== null) {
57232
- entry = parseFloat(entry);
57233
- }
57234
- return entry;
57235
- });
57236
- return p2.parse();
57969
+ return array.parse(value, parseFloat);
57237
57970
  };
57238
57971
  var parseStringArray = function(value) {
57239
- if (!value) {
57240
- return null;
57241
- }
57242
- var p2 = arrayParser.create(value);
57243
- return p2.parse();
57972
+ return array.parse(value, undefined);
57244
57973
  };
57245
- var parseDateArray = function(value) {
57246
- if (!value) {
57247
- return null;
57248
- }
57249
- var p2 = arrayParser.create(value, function(entry) {
57250
- if (entry !== null) {
57251
- entry = parseDate(entry);
57252
- }
57253
- return entry;
57254
- });
57255
- return p2.parse();
57974
+ var parseTimestamp = function(value) {
57975
+ const utc = value.endsWith(" BC") ? value.slice(0, -3) + "Z BC" : value + "Z";
57976
+ return parseTimestampTz(utc);
57977
+ };
57978
+ var parseTimestampArray = function(value) {
57979
+ return array.parse(value, parseTimestamp);
57980
+ };
57981
+ var parseTimestampTzArray = function(value) {
57982
+ return array.parse(value, parseTimestampTz);
57256
57983
  };
57257
57984
  var parseIntervalArray = function(value) {
57258
- if (!value) {
57259
- return null;
57260
- }
57261
- var p2 = arrayParser.create(value, function(entry) {
57262
- if (entry !== null) {
57263
- entry = parseInterval(entry);
57264
- }
57265
- return entry;
57266
- });
57267
- return p2.parse();
57985
+ return array.parse(value, parseInterval);
57268
57986
  };
57269
57987
  var parseByteAArray = function(value) {
57270
- if (!value) {
57271
- return null;
57272
- }
57273
- return array.parse(value, allowNull(parseByteA));
57274
- };
57275
- var parseInteger = function(value) {
57276
- return parseInt(value, 10);
57988
+ return array.parse(value, parseByteA);
57277
57989
  };
57278
57990
  var parseBigInteger = function(value) {
57279
- var valStr = String(value);
57991
+ const valStr = String(value);
57280
57992
  if (/^\d+$/.test(valStr)) {
57281
57993
  return valStr;
57282
57994
  }
57283
57995
  return value;
57284
57996
  };
57285
57997
  var parseJsonArray = function(value) {
57286
- if (!value) {
57287
- return null;
57288
- }
57289
- return array.parse(value, allowNull(JSON.parse));
57998
+ return array.parse(value, JSON.parse);
57290
57999
  };
57291
58000
  var parsePoint = function(value) {
57292
58001
  if (value[0] !== "(") {
@@ -57302,10 +58011,10 @@ var require_textParsers = __commonJS((exports, module) => {
57302
58011
  if (value[0] !== "<" && value[1] !== "(") {
57303
58012
  return null;
57304
58013
  }
57305
- var point = "(";
57306
- var radius = "";
57307
- var pointParsed = false;
57308
- for (var i = 2;i < value.length - 1; i++) {
58014
+ let point = "(";
58015
+ let radius = "";
58016
+ let pointParsed = false;
58017
+ for (let i = 2;i < value.length - 1; i++) {
57309
58018
  if (!pointParsed) {
57310
58019
  point += value[i];
57311
58020
  }
@@ -57320,21 +58029,35 @@ var require_textParsers = __commonJS((exports, module) => {
57320
58029
  }
57321
58030
  radius += value[i];
57322
58031
  }
57323
- var result = parsePoint(point);
58032
+ const result = parsePoint(point);
57324
58033
  result.radius = parseFloat(radius);
57325
58034
  return result;
57326
58035
  };
58036
+ function parseInt4Range(raw) {
58037
+ return range.parse(raw, Number);
58038
+ }
58039
+ function parseNumRange(raw) {
58040
+ return range.parse(raw, parseFloat);
58041
+ }
58042
+ function parseInt8Range(raw) {
58043
+ return range.parse(raw, parseBigInteger);
58044
+ }
58045
+ function parseTimestampRange(raw) {
58046
+ return range.parse(raw, parseTimestamp);
58047
+ }
58048
+ function parseTimestampTzRange(raw) {
58049
+ return range.parse(raw, parseTimestampTz);
58050
+ }
57327
58051
  var init = function(register) {
57328
58052
  register(20, parseBigInteger);
57329
- register(21, parseInteger);
57330
- register(23, parseInteger);
57331
- register(26, parseInteger);
58053
+ register(21, Number);
58054
+ register(23, Number);
58055
+ register(26, Number);
57332
58056
  register(700, parseFloat);
57333
58057
  register(701, parseFloat);
57334
58058
  register(16, parseBool);
57335
- register(1082, parseDate);
57336
- register(1114, parseDate);
57337
- register(1184, parseDate);
58059
+ register(1114, parseTimestamp);
58060
+ register(1184, parseTimestampTz);
57338
58061
  register(600, parsePoint);
57339
58062
  register(651, parseStringArray);
57340
58063
  register(718, parseCircle);
@@ -57347,24 +58070,30 @@ var require_textParsers = __commonJS((exports, module) => {
57347
58070
  register(1017, parsePointArray);
57348
58071
  register(1021, parseFloatArray);
57349
58072
  register(1022, parseFloatArray);
57350
- register(1231, parseFloatArray);
58073
+ register(1231, parseStringArray);
57351
58074
  register(1014, parseStringArray);
57352
58075
  register(1015, parseStringArray);
57353
58076
  register(1008, parseStringArray);
57354
58077
  register(1009, parseStringArray);
57355
58078
  register(1040, parseStringArray);
57356
58079
  register(1041, parseStringArray);
57357
- register(1115, parseDateArray);
57358
- register(1182, parseDateArray);
57359
- register(1185, parseDateArray);
58080
+ register(1115, parseTimestampArray);
58081
+ register(1182, parseStringArray);
58082
+ register(1185, parseTimestampTzArray);
57360
58083
  register(1186, parseInterval);
57361
58084
  register(1187, parseIntervalArray);
57362
58085
  register(17, parseByteA);
57363
- register(114, JSON.parse.bind(JSON));
57364
- register(3802, JSON.parse.bind(JSON));
58086
+ register(114, JSON.parse);
58087
+ register(3802, JSON.parse);
57365
58088
  register(199, parseJsonArray);
57366
58089
  register(3807, parseJsonArray);
58090
+ register(3904, parseInt4Range);
58091
+ register(3906, parseNumRange);
57367
58092
  register(3907, parseStringArray);
58093
+ register(3908, parseTimestampRange);
58094
+ register(3910, parseTimestampTzRange);
58095
+ register(3912, range.parse);
58096
+ register(3926, parseInt8Range);
57368
58097
  register(2951, parseStringArray);
57369
58098
  register(791, parseStringArray);
57370
58099
  register(1183, parseStringArray);
@@ -57452,168 +58181,170 @@ var require_pg_int8 = __commonJS((exports, module) => {
57452
58181
  module.exports = readInt8;
57453
58182
  });
57454
58183
 
57455
- // ../../../../node_modules/pg/node_modules/pg-types/lib/binaryParsers.js
57456
- var require_binaryParsers = __commonJS((exports, module) => {
57457
- var parseInt64 = require_pg_int8();
57458
- var parseBits = function(data, bits, offset, invert, callback) {
57459
- offset = offset || 0;
57460
- invert = invert || false;
57461
- callback = callback || function(lastValue, newValue, bits2) {
57462
- return lastValue * Math.pow(2, bits2) + newValue;
57463
- };
57464
- var offsetBytes = offset >> 3;
57465
- var inv = function(value) {
57466
- if (invert) {
57467
- return ~value & 255;
57468
- }
57469
- return value;
57470
- };
57471
- var mask = 255;
57472
- var firstBits = 8 - offset % 8;
57473
- if (bits < firstBits) {
57474
- mask = 255 << 8 - bits & 255;
57475
- firstBits = bits;
57476
- }
57477
- if (offset) {
57478
- mask = mask >> offset % 8;
57479
- }
57480
- var result = 0;
57481
- if (offset % 8 + bits >= 8) {
57482
- result = callback(0, inv(data[offsetBytes]) & mask, firstBits);
58184
+ // ../../../../node_modules/pg-numeric/index.js
58185
+ var require_pg_numeric = __commonJS((exports, module) => {
58186
+ var readDigit = (buffer, index) => {
58187
+ const digit = buffer.readUInt16BE(8 + 2 * index);
58188
+ if (digit > 9999) {
58189
+ throw new RangeError("Invalid numeric digit: " + digit);
57483
58190
  }
57484
- var bytes = bits + offset >> 3;
57485
- for (var i = offsetBytes + 1;i < bytes; i++) {
57486
- result = callback(result, inv(data[i]), 8);
58191
+ return digit;
58192
+ };
58193
+ var readNumeric = (buffer) => {
58194
+ const ndigits = buffer.readUInt16BE(0);
58195
+ let weight = buffer.readInt16BE(2);
58196
+ const sign = buffer.readUInt16BE(4);
58197
+ const dscale = buffer.readUInt16BE(6);
58198
+ let signText;
58199
+ let isNegativeZero;
58200
+ switch (sign) {
58201
+ case 0:
58202
+ signText = "";
58203
+ isNegativeZero = false;
58204
+ break;
58205
+ case 16384:
58206
+ signText = "-";
58207
+ isNegativeZero = true;
58208
+ break;
58209
+ case 49152:
58210
+ return "NaN";
58211
+ default:
58212
+ throw new RangeError("Invalid numeric sign: 0x" + sign.toString(16));
57487
58213
  }
57488
- var lastBits = (bits + offset) % 8;
57489
- if (lastBits > 0) {
57490
- result = callback(result, inv(data[bytes]) >> 8 - lastBits, lastBits);
58214
+ if (2 * ndigits !== buffer.length - 8) {
58215
+ throw new RangeError("Invalid numeric length: " + buffer.length + " bytes of data representing " + ndigits + " digits");
57491
58216
  }
57492
- return result;
57493
- };
57494
- var parseFloatFromBits = function(data, precisionBits, exponentBits) {
57495
- var bias = Math.pow(2, exponentBits - 1) - 1;
57496
- var sign = parseBits(data, 1);
57497
- var exponent = parseBits(data, exponentBits, 1);
57498
- if (exponent === 0) {
57499
- return 0;
58217
+ if (dscale > 16383) {
58218
+ throw new RangeError("Invalid numeric dscale: 0x" + dscale.toString(16));
57500
58219
  }
57501
- var precisionBitsCounter = 1;
57502
- var parsePrecisionBits = function(lastValue, newValue, bits) {
57503
- if (lastValue === 0) {
57504
- lastValue = 1;
57505
- }
57506
- for (var i = 1;i <= bits; i++) {
57507
- precisionBitsCounter /= 2;
57508
- if ((newValue & 1 << bits - i) > 0) {
57509
- lastValue += precisionBitsCounter;
58220
+ let result = signText;
58221
+ let i = 0;
58222
+ integerPart: {
58223
+ for (;; ) {
58224
+ if (i >= ndigits) {
58225
+ weight = -1;
58226
+ }
58227
+ if (weight < 0) {
58228
+ result += "0";
58229
+ break integerPart;
58230
+ }
58231
+ const digit = readDigit(buffer, i);
58232
+ i++;
58233
+ weight--;
58234
+ if (digit !== 0) {
58235
+ isNegativeZero = false;
58236
+ result += String(digit);
58237
+ break;
57510
58238
  }
57511
58239
  }
57512
- return lastValue;
57513
- };
57514
- var mantissa = parseBits(data, precisionBits, exponentBits + 1, false, parsePrecisionBits);
57515
- if (exponent == Math.pow(2, exponentBits + 1) - 1) {
57516
- if (mantissa === 0) {
57517
- return sign === 0 ? Infinity : -Infinity;
58240
+ while (weight >= 0 && i < ndigits) {
58241
+ const digit = readDigit(buffer, i);
58242
+ i++;
58243
+ weight--;
58244
+ result += String(1e4 + digit).substring(1);
58245
+ }
58246
+ while (weight >= 0) {
58247
+ result += "0000";
58248
+ weight--;
58249
+ }
58250
+ }
58251
+ fractionalPart:
58252
+ if (dscale !== 0) {
58253
+ result += ".";
58254
+ const omitted = -1 - weight;
58255
+ if (omitted > 0) {
58256
+ if (4 * omitted > dscale) {
58257
+ result += "0".repeat(dscale);
58258
+ break fractionalPart;
58259
+ }
58260
+ result += "0".repeat(4 * omitted);
58261
+ }
58262
+ while (-4 * weight <= dscale) {
58263
+ const digit = i < ndigits ? readDigit(buffer, i) : 0;
58264
+ i++;
58265
+ weight--;
58266
+ if (isNegativeZero && digit !== 0) {
58267
+ isNegativeZero = false;
58268
+ }
58269
+ result += String(1e4 + digit).substring(1);
58270
+ }
58271
+ {
58272
+ const digit = i < ndigits ? readDigit(buffer, i) : 0;
58273
+ result += String(1e4 + digit).substr(1, dscale % 4);
58274
+ if (isNegativeZero && digit >= Math.pow(10, 4 - dscale % 4)) {
58275
+ isNegativeZero = false;
58276
+ }
58277
+ }
57518
58278
  }
57519
- return NaN;
57520
- }
57521
- return (sign === 0 ? 1 : -1) * Math.pow(2, exponent - bias) * mantissa;
58279
+ return isNegativeZero ? result.substring(1) : result;
57522
58280
  };
58281
+ module.exports = readNumeric;
58282
+ });
58283
+
58284
+ // ../../../../node_modules/pg-types/lib/binaryParsers.js
58285
+ var require_binaryParsers = __commonJS((exports, module) => {
58286
+ var parseInt64 = require_pg_int8();
58287
+ var parseNumeric = require_pg_numeric();
57523
58288
  var parseInt16 = function(value) {
57524
- if (parseBits(value, 1) == 1) {
57525
- return -1 * (parseBits(value, 15, 1, true) + 1);
57526
- }
57527
- return parseBits(value, 15, 1);
58289
+ return value.readInt16BE(0);
57528
58290
  };
57529
58291
  var parseInt32 = function(value) {
57530
- if (parseBits(value, 1) == 1) {
57531
- return -1 * (parseBits(value, 31, 1, true) + 1);
57532
- }
57533
- return parseBits(value, 31, 1);
58292
+ return value.readInt32BE(0);
57534
58293
  };
57535
58294
  var parseFloat32 = function(value) {
57536
- return parseFloatFromBits(value, 23, 8);
58295
+ return value.readFloatBE(0);
57537
58296
  };
57538
58297
  var parseFloat64 = function(value) {
57539
- return parseFloatFromBits(value, 52, 11);
57540
- };
57541
- var parseNumeric = function(value) {
57542
- var sign = parseBits(value, 16, 32);
57543
- if (sign == 49152) {
57544
- return NaN;
57545
- }
57546
- var weight = Math.pow(1e4, parseBits(value, 16, 16));
57547
- var result = 0;
57548
- var digits = [];
57549
- var ndigits = parseBits(value, 16);
57550
- for (var i = 0;i < ndigits; i++) {
57551
- result += parseBits(value, 16, 64 + 16 * i) * weight;
57552
- weight /= 1e4;
57553
- }
57554
- var scale = Math.pow(10, parseBits(value, 16, 48));
57555
- return (sign === 0 ? 1 : -1) * Math.round(result * scale) / scale;
58298
+ return value.readDoubleBE(0);
57556
58299
  };
57557
- var parseDate = function(isUTC, value) {
57558
- var sign = parseBits(value, 1);
57559
- var rawValue = parseBits(value, 63, 1);
57560
- var result = new Date((sign === 0 ? 1 : -1) * rawValue / 1000 + 946684800000);
57561
- if (!isUTC) {
57562
- result.setTime(result.getTime() + result.getTimezoneOffset() * 60000);
57563
- }
57564
- result.usec = rawValue % 1000;
57565
- result.getMicroSeconds = function() {
57566
- return this.usec;
57567
- };
57568
- result.setMicroSeconds = function(value2) {
57569
- this.usec = value2;
57570
- };
57571
- result.getUTCMicroSeconds = function() {
57572
- return this.usec;
57573
- };
58300
+ var parseTimestampUTC = function(value) {
58301
+ const rawValue = 4294967296 * value.readInt32BE(0) + value.readUInt32BE(4);
58302
+ const result = new Date(Math.round(rawValue / 1000) + 946684800000);
57574
58303
  return result;
57575
58304
  };
57576
58305
  var parseArray = function(value) {
57577
- var dim2 = parseBits(value, 32);
57578
- var flags = parseBits(value, 32, 32);
57579
- var elementType = parseBits(value, 32, 64);
57580
- var offset = 96;
57581
- var dims = [];
57582
- for (var i = 0;i < dim2; i++) {
57583
- dims[i] = parseBits(value, 32, offset);
57584
- offset += 32;
57585
- offset += 32;
57586
- }
57587
- var parseElement = function(elementType2) {
57588
- var length = parseBits(value, 32, offset);
57589
- offset += 32;
57590
- if (length == 4294967295) {
58306
+ const dim2 = value.readInt32BE(0);
58307
+ const elementType = value.readUInt32BE(8);
58308
+ let offset = 12;
58309
+ const dims = [];
58310
+ for (let i = 0;i < dim2; i++) {
58311
+ dims[i] = value.readInt32BE(offset);
58312
+ offset += 4;
58313
+ offset += 4;
58314
+ }
58315
+ const parseElement = function(elementType2) {
58316
+ const length = value.readInt32BE(offset);
58317
+ offset += 4;
58318
+ if (length === -1) {
57591
58319
  return null;
57592
58320
  }
57593
- var result;
57594
- if (elementType2 == 23 || elementType2 == 20) {
57595
- result = parseBits(value, length * 8, offset);
57596
- offset += length * 8;
58321
+ let result;
58322
+ if (elementType2 === 23) {
58323
+ result = value.readInt32BE(offset);
58324
+ offset += length;
58325
+ return result;
58326
+ } else if (elementType2 === 20) {
58327
+ result = parseInt64(value.slice(offset, offset += length));
57597
58328
  return result;
57598
- } else if (elementType2 == 25) {
57599
- result = value.toString(this.encoding, offset >> 3, (offset += length << 3) >> 3);
58329
+ } else if (elementType2 === 25) {
58330
+ result = value.toString("utf8", offset, offset += length);
57600
58331
  return result;
57601
58332
  } else {
57602
- console.log("ERROR: ElementType not implemented: " + elementType2);
58333
+ throw new Error("ElementType not implemented: " + elementType2);
57603
58334
  }
57604
58335
  };
57605
- var parse = function(dimension, elementType2) {
57606
- var array = [];
57607
- var i2;
58336
+ const parse = function(dimension, elementType2) {
58337
+ const array = [];
58338
+ let i;
57608
58339
  if (dimension.length > 1) {
57609
- var count = dimension.shift();
57610
- for (i2 = 0;i2 < count; i2++) {
57611
- array[i2] = parse(dimension, elementType2);
58340
+ const count = dimension.shift();
58341
+ for (i = 0;i < count; i++) {
58342
+ array[i] = parse(dimension, elementType2);
57612
58343
  }
57613
58344
  dimension.unshift(count);
57614
58345
  } else {
57615
- for (i2 = 0;i2 < dimension[0]; i2++) {
57616
- array[i2] = parseElement(elementType2);
58346
+ for (i = 0;i < dimension[0]; i++) {
58347
+ array[i] = parseElement(elementType2);
57617
58348
  }
57618
58349
  }
57619
58350
  return array;
@@ -57624,9 +58355,7 @@ var require_binaryParsers = __commonJS((exports, module) => {
57624
58355
  return value.toString("utf8");
57625
58356
  };
57626
58357
  var parseBool = function(value) {
57627
- if (value === null)
57628
- return null;
57629
- return parseBits(value, 8) > 0;
58358
+ return value[0] !== 0;
57630
58359
  };
57631
58360
  var init = function(register) {
57632
58361
  register(20, parseInt64);
@@ -57637,8 +58366,8 @@ var require_binaryParsers = __commonJS((exports, module) => {
57637
58366
  register(700, parseFloat32);
57638
58367
  register(701, parseFloat64);
57639
58368
  register(16, parseBool);
57640
- register(1114, parseDate.bind(null, false));
57641
- register(1184, parseDate.bind(null, true));
58369
+ register(1114, parseTimestampUTC);
58370
+ register(1184, parseTimestampUTC);
57642
58371
  register(1000, parseArray);
57643
58372
  register(1007, parseArray);
57644
58373
  register(1016, parseArray);
@@ -57651,7 +58380,7 @@ var require_binaryParsers = __commonJS((exports, module) => {
57651
58380
  };
57652
58381
  });
57653
58382
 
57654
- // ../../../../node_modules/pg/node_modules/pg-types/lib/builtins.js
58383
+ // ../../../../node_modules/pg-types/lib/builtins.js
57655
58384
  var require_builtins = __commonJS((exports, module) => {
57656
58385
  module.exports = {
57657
58386
  BOOL: 16,
@@ -57717,15 +58446,13 @@ var require_builtins = __commonJS((exports, module) => {
57717
58446
  };
57718
58447
  });
57719
58448
 
57720
- // ../../../../node_modules/pg/node_modules/pg-types/index.js
58449
+ // ../../../../node_modules/pg-types/index.js
57721
58450
  var require_pg_types = __commonJS((exports) => {
57722
58451
  var textParsers = require_textParsers();
57723
58452
  var binaryParsers = require_binaryParsers();
57724
- var arrayParser = require_arrayParser();
57725
58453
  var builtinTypes = require_builtins();
57726
58454
  exports.getTypeParser = getTypeParser;
57727
58455
  exports.setTypeParser = setTypeParser;
57728
- exports.arrayParser = arrayParser;
57729
58456
  exports.builtins = builtinTypes;
57730
58457
  var typeParsers = {
57731
58458
  text: {},
@@ -57742,10 +58469,13 @@ var require_pg_types = __commonJS((exports) => {
57742
58469
  return typeParsers[format][oid] || noParse;
57743
58470
  }
57744
58471
  function setTypeParser(oid, format, parseFn) {
57745
- if (typeof format == "function") {
58472
+ if (typeof format === "function") {
57746
58473
  parseFn = format;
57747
58474
  format = "text";
57748
58475
  }
58476
+ if (!Number.isInteger(oid)) {
58477
+ throw new TypeError("oid must be an integer: " + oid);
58478
+ }
57749
58479
  typeParsers[format][oid] = parseFn;
57750
58480
  }
57751
58481
  textParsers.init(function(oid, converter) {
@@ -58835,7 +59565,7 @@ var require_query3 = __commonJS((exports, module) => {
58835
59565
  module.exports = Query;
58836
59566
  });
58837
59567
 
58838
- // ../../../../node_modules/pg/node_modules/pg-protocol/dist/messages.js
59568
+ // ../../../../node_modules/pg-protocol/dist/messages.js
58839
59569
  var require_messages = __commonJS((exports) => {
58840
59570
  Object.defineProperty(exports, "__esModule", { value: true });
58841
59571
  exports.NoticeMessage = exports.DataRowMessage = exports.CommandCompleteMessage = exports.ReadyForQueryMessage = exports.NotificationResponseMessage = exports.BackendKeyDataMessage = exports.AuthenticationMD5Password = exports.ParameterStatusMessage = exports.ParameterDescriptionMessage = exports.RowDescriptionMessage = exports.Field = exports.CopyResponse = exports.CopyDataMessage = exports.DatabaseError = exports.copyDone = exports.emptyQuery = exports.replicationStart = exports.portalSuspended = exports.noData = exports.closeComplete = exports.bindComplete = exports.parseComplete = undefined;
@@ -59011,7 +59741,7 @@ var require_messages = __commonJS((exports) => {
59011
59741
  exports.NoticeMessage = NoticeMessage;
59012
59742
  });
59013
59743
 
59014
- // ../../../../node_modules/pg/node_modules/pg-protocol/dist/buffer-writer.js
59744
+ // ../../../../node_modules/pg-protocol/dist/buffer-writer.js
59015
59745
  var require_buffer_writer = __commonJS((exports) => {
59016
59746
  Object.defineProperty(exports, "__esModule", { value: true });
59017
59747
  exports.Writer = undefined;
@@ -59090,7 +59820,7 @@ var require_buffer_writer = __commonJS((exports) => {
59090
59820
  exports.Writer = Writer;
59091
59821
  });
59092
59822
 
59093
- // ../../../../node_modules/pg/node_modules/pg-protocol/dist/serializer.js
59823
+ // ../../../../node_modules/pg-protocol/dist/serializer.js
59094
59824
  var require_serializer = __commonJS((exports) => {
59095
59825
  Object.defineProperty(exports, "__esModule", { value: true });
59096
59826
  exports.serialize = undefined;
@@ -59252,7 +59982,7 @@ var require_serializer = __commonJS((exports) => {
59252
59982
  exports.serialize = serialize;
59253
59983
  });
59254
59984
 
59255
- // ../../../../node_modules/pg/node_modules/pg-protocol/dist/buffer-reader.js
59985
+ // ../../../../node_modules/pg-protocol/dist/buffer-reader.js
59256
59986
  var require_buffer_reader = __commonJS((exports) => {
59257
59987
  Object.defineProperty(exports, "__esModule", { value: true });
59258
59988
  exports.BufferReader = undefined;
@@ -59309,7 +60039,7 @@ var require_buffer_reader = __commonJS((exports) => {
59309
60039
  exports.BufferReader = BufferReader;
59310
60040
  });
59311
60041
 
59312
- // ../../../../node_modules/pg/node_modules/pg-protocol/dist/parser.js
60042
+ // ../../../../node_modules/pg-protocol/dist/parser.js
59313
60043
  var require_parser = __commonJS((exports) => {
59314
60044
  Object.defineProperty(exports, "__esModule", { value: true });
59315
60045
  exports.Parser = undefined;
@@ -59598,7 +60328,7 @@ var require_parser = __commonJS((exports) => {
59598
60328
  exports.Parser = Parser;
59599
60329
  });
59600
60330
 
59601
- // ../../../../node_modules/pg/node_modules/pg-protocol/dist/index.js
60331
+ // ../../../../node_modules/pg-protocol/dist/index.js
59602
60332
  var require_dist2 = __commonJS((exports) => {
59603
60333
  Object.defineProperty(exports, "__esModule", { value: true });
59604
60334
  exports.DatabaseError = exports.serialize = exports.parse = undefined;