@cerefox/memory 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cerefox.js +792 -174
- package/dist/frontend/assets/{index-sef54G6W.js → index-P1F2Ldl9.js} +25 -25
- package/dist/frontend/assets/index-P1F2Ldl9.js.map +1 -0
- package/dist/frontend/index.html +1 -1
- package/dist/server-assets/_shared/ef-meta/index.ts +2 -2
- package/docs/guides/access-paths.md +1 -1
- package/docs/guides/configuration.md +2 -0
- package/package.json +1 -1
- package/dist/frontend/assets/index-sef54G6W.js.map +0 -1
package/dist/bin/cerefox.js
CHANGED
|
@@ -7440,7 +7440,7 @@ var exports_meta = {};
|
|
|
7440
7440
|
__export(exports_meta, {
|
|
7441
7441
|
PKG_VERSION: () => PKG_VERSION
|
|
7442
7442
|
});
|
|
7443
|
-
var PKG_VERSION = "1.
|
|
7443
|
+
var PKG_VERSION = "1.12.0";
|
|
7444
7444
|
var init_meta = () => {};
|
|
7445
7445
|
|
|
7446
7446
|
// ../../_shared/config/paths.ts
|
|
@@ -7520,11 +7520,11 @@ function parseDotenv(content) {
|
|
|
7520
7520
|
return result;
|
|
7521
7521
|
}
|
|
7522
7522
|
function loadEnv(opts = {}) {
|
|
7523
|
-
|
|
7523
|
+
const envPath = resolveEnvFile(opts);
|
|
7524
|
+
if (_loadedPath === envPath) {
|
|
7524
7525
|
return { path: "(already loaded)", vars: 0 };
|
|
7525
7526
|
}
|
|
7526
|
-
|
|
7527
|
-
const envPath = resolveEnvFile(opts);
|
|
7527
|
+
_loadedPath = envPath;
|
|
7528
7528
|
let content;
|
|
7529
7529
|
try {
|
|
7530
7530
|
content = readFileSync2(envPath, "utf8");
|
|
@@ -7555,7 +7555,7 @@ function loadSettings(opts = {}) {
|
|
|
7555
7555
|
fireworksApiKey: env2.CEREFOX_FIREWORKS_API_KEY ?? ""
|
|
7556
7556
|
};
|
|
7557
7557
|
}
|
|
7558
|
-
var KV_LINE,
|
|
7558
|
+
var KV_LINE, _loadedPath = null;
|
|
7559
7559
|
var init_env = __esm(() => {
|
|
7560
7560
|
init_paths();
|
|
7561
7561
|
KV_LINE = /^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*?)\s*$/;
|
|
@@ -26003,7 +26003,7 @@ var init_bundled_docs = __esm(() => {
|
|
|
26003
26003
|
});
|
|
26004
26004
|
|
|
26005
26005
|
// ../../_shared/ef-meta/index.ts
|
|
26006
|
-
var EF_VERSION = "1.
|
|
26006
|
+
var EF_VERSION = "1.12.0", CEREFOX_VERSION = "1.12.0", EF_LAST_CHANGED = "1.11.0";
|
|
26007
26007
|
var init_ef_meta = () => {};
|
|
26008
26008
|
|
|
26009
26009
|
// ../../_shared/compatibility/index.ts
|
|
@@ -43254,7 +43254,7 @@ var require_nodes = __commonJS(function(exports) {
|
|
|
43254
43254
|
}
|
|
43255
43255
|
});
|
|
43256
43256
|
|
|
43257
|
-
// ../../node_modules/.bun/@xmldom+xmldom@0.8.
|
|
43257
|
+
// ../../node_modules/.bun/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/conventions.js
|
|
43258
43258
|
var require_conventions = __commonJS(function(exports) {
|
|
43259
43259
|
function find(list, predicate, ac) {
|
|
43260
43260
|
if (ac === undefined) {
|
|
@@ -43308,18 +43308,25 @@ var require_conventions = __commonJS(function(exports) {
|
|
|
43308
43308
|
XML: "http://www.w3.org/XML/1998/namespace",
|
|
43309
43309
|
XMLNS: "http://www.w3.org/2000/xmlns/"
|
|
43310
43310
|
});
|
|
43311
|
+
var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
|
|
43312
|
+
var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
|
|
43313
|
+
var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$");
|
|
43311
43314
|
exports.assign = assign;
|
|
43312
43315
|
exports.find = find;
|
|
43313
43316
|
exports.freeze = freeze;
|
|
43314
43317
|
exports.MIME_TYPE = MIME_TYPE;
|
|
43315
43318
|
exports.NAMESPACE = NAMESPACE;
|
|
43319
|
+
exports.nameStartChar = nameStartChar;
|
|
43320
|
+
exports.nameChar = nameChar;
|
|
43321
|
+
exports.tagNamePattern = tagNamePattern;
|
|
43316
43322
|
});
|
|
43317
43323
|
|
|
43318
|
-
// ../../node_modules/.bun/@xmldom+xmldom@0.8.
|
|
43324
|
+
// ../../node_modules/.bun/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/dom.js
|
|
43319
43325
|
var require_dom = __commonJS(function(exports) {
|
|
43320
43326
|
var conventions = require_conventions();
|
|
43321
43327
|
var find = conventions.find;
|
|
43322
43328
|
var NAMESPACE = conventions.NAMESPACE;
|
|
43329
|
+
var tagNamePattern = conventions.tagNamePattern;
|
|
43323
43330
|
function notEmptyString(input) {
|
|
43324
43331
|
return input !== "";
|
|
43325
43332
|
}
|
|
@@ -43460,7 +43467,9 @@ var require_dom = __commonJS(function(exports) {
|
|
|
43460
43467
|
return this[i] || null;
|
|
43461
43468
|
};
|
|
43462
43469
|
_extends(LiveNodeList, NodeList);
|
|
43463
|
-
function NamedNodeMap() {
|
|
43470
|
+
function NamedNodeMap() {
|
|
43471
|
+
this._nameIndex = Object.create(null);
|
|
43472
|
+
}
|
|
43464
43473
|
function _findNodeIndex(list, node) {
|
|
43465
43474
|
var i = list.length;
|
|
43466
43475
|
while (i--) {
|
|
@@ -43469,12 +43478,22 @@ var require_dom = __commonJS(function(exports) {
|
|
|
43469
43478
|
}
|
|
43470
43479
|
}
|
|
43471
43480
|
}
|
|
43481
|
+
function _nnmIndexAdd(list, attr) {
|
|
43482
|
+
list._nameIndex[attr.nodeName] = attr;
|
|
43483
|
+
}
|
|
43484
|
+
function _nnmIndexRemove(list, attr) {
|
|
43485
|
+
if (list._nameIndex[attr.nodeName] === attr) {
|
|
43486
|
+
delete list._nameIndex[attr.nodeName];
|
|
43487
|
+
}
|
|
43488
|
+
}
|
|
43472
43489
|
function _addNamedNode(el, list, newAttr, oldAttr) {
|
|
43473
43490
|
if (oldAttr) {
|
|
43474
43491
|
list[_findNodeIndex(list, oldAttr)] = newAttr;
|
|
43492
|
+
_nnmIndexRemove(list, oldAttr);
|
|
43475
43493
|
} else {
|
|
43476
43494
|
list[list.length++] = newAttr;
|
|
43477
43495
|
}
|
|
43496
|
+
_nnmIndexAdd(list, newAttr);
|
|
43478
43497
|
if (el) {
|
|
43479
43498
|
newAttr.ownerElement = el;
|
|
43480
43499
|
var doc = el.ownerDocument;
|
|
@@ -43492,6 +43511,7 @@ var require_dom = __commonJS(function(exports) {
|
|
|
43492
43511
|
list[i] = list[++i];
|
|
43493
43512
|
}
|
|
43494
43513
|
list.length = lastIndex;
|
|
43514
|
+
_nnmIndexRemove(list, attr);
|
|
43495
43515
|
if (el) {
|
|
43496
43516
|
var doc = el.ownerDocument;
|
|
43497
43517
|
if (doc) {
|
|
@@ -43520,7 +43540,7 @@ var require_dom = __commonJS(function(exports) {
|
|
|
43520
43540
|
if (el && el != this._ownerElement) {
|
|
43521
43541
|
throw new DOMException(INUSE_ATTRIBUTE_ERR);
|
|
43522
43542
|
}
|
|
43523
|
-
var oldAttr = this.
|
|
43543
|
+
var oldAttr = this._nameIndex[attr.nodeName];
|
|
43524
43544
|
_addNamedNode(this._ownerElement, this, attr, oldAttr);
|
|
43525
43545
|
return oldAttr;
|
|
43526
43546
|
},
|
|
@@ -43624,8 +43644,29 @@ var require_dom = __commonJS(function(exports) {
|
|
|
43624
43644
|
while (child) {
|
|
43625
43645
|
var next = child.nextSibling;
|
|
43626
43646
|
if (next !== null && next.nodeType === TEXT_NODE && child.nodeType === TEXT_NODE) {
|
|
43627
|
-
|
|
43628
|
-
|
|
43647
|
+
var tail = [];
|
|
43648
|
+
var sibling = next;
|
|
43649
|
+
while (sibling !== null && sibling.nodeType === TEXT_NODE) {
|
|
43650
|
+
tail.push(sibling.data);
|
|
43651
|
+
sibling = sibling.nextSibling;
|
|
43652
|
+
}
|
|
43653
|
+
var removed = child.nextSibling;
|
|
43654
|
+
while (removed !== sibling) {
|
|
43655
|
+
var following = removed.nextSibling;
|
|
43656
|
+
removed.parentNode = null;
|
|
43657
|
+
removed.previousSibling = null;
|
|
43658
|
+
removed.nextSibling = null;
|
|
43659
|
+
removed = following;
|
|
43660
|
+
}
|
|
43661
|
+
child.nextSibling = sibling;
|
|
43662
|
+
if (sibling !== null) {
|
|
43663
|
+
sibling.previousSibling = child;
|
|
43664
|
+
} else {
|
|
43665
|
+
node.lastChild = child;
|
|
43666
|
+
}
|
|
43667
|
+
child.appendData(tail.join(""));
|
|
43668
|
+
_onUpdateChild(node.ownerDocument, node);
|
|
43669
|
+
child = sibling;
|
|
43629
43670
|
} else {
|
|
43630
43671
|
child = next;
|
|
43631
43672
|
}
|
|
@@ -44083,6 +44124,9 @@ var require_dom = __commonJS(function(exports) {
|
|
|
44083
44124
|
return node;
|
|
44084
44125
|
},
|
|
44085
44126
|
createEntityReference: function(name) {
|
|
44127
|
+
if (!tagNamePattern.test(name)) {
|
|
44128
|
+
throw new DOMException(INVALID_CHARACTER_ERR, 'not a valid xml name "' + name + '"');
|
|
44129
|
+
}
|
|
44086
44130
|
var node = new EntityReference;
|
|
44087
44131
|
node.ownerDocument = this;
|
|
44088
44132
|
node.nodeName = name;
|
|
@@ -44330,7 +44374,10 @@ var require_dom = __commonJS(function(exports) {
|
|
|
44330
44374
|
}
|
|
44331
44375
|
return true;
|
|
44332
44376
|
}
|
|
44333
|
-
function addSerializedAttribute(buf, qualifiedName, value) {
|
|
44377
|
+
function addSerializedAttribute(buf, qualifiedName, value, requireWellFormed) {
|
|
44378
|
+
if (requireWellFormed && !tagNamePattern.test(qualifiedName)) {
|
|
44379
|
+
throw new DOMException(INVALID_STATE_ERR, 'The attribute name "' + qualifiedName + '" is not a valid XML QName');
|
|
44380
|
+
}
|
|
44334
44381
|
buf.push(" ", qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
|
|
44335
44382
|
}
|
|
44336
44383
|
function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces, requireWellFormed) {
|
|
@@ -44388,6 +44435,9 @@ var require_dom = __commonJS(function(exports) {
|
|
|
44388
44435
|
}
|
|
44389
44436
|
}
|
|
44390
44437
|
}
|
|
44438
|
+
if (requireWellFormed && !tagNamePattern.test(prefixedNodeName)) {
|
|
44439
|
+
throw new DOMException(INVALID_STATE_ERR, 'The element name "' + prefixedNodeName + '" is not a valid XML QName');
|
|
44440
|
+
}
|
|
44391
44441
|
buf.push("<", prefixedNodeName);
|
|
44392
44442
|
var childNs = ns.slice();
|
|
44393
44443
|
for (var i = 0;i < len; i++) {
|
|
@@ -44403,7 +44453,7 @@ var require_dom = __commonJS(function(exports) {
|
|
|
44403
44453
|
if (needNamespaceDefine(attr, html, childNs)) {
|
|
44404
44454
|
var attrPrefix = attr.prefix || "";
|
|
44405
44455
|
var uri = attr.namespaceURI;
|
|
44406
|
-
addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", uri);
|
|
44456
|
+
addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", uri, requireWellFormed);
|
|
44407
44457
|
childNs.push({ prefix: attrPrefix, namespace: uri });
|
|
44408
44458
|
}
|
|
44409
44459
|
var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
|
|
@@ -44411,14 +44461,14 @@ var require_dom = __commonJS(function(exports) {
|
|
|
44411
44461
|
if (typeof filteredAttr === "string") {
|
|
44412
44462
|
buf.push(filteredAttr);
|
|
44413
44463
|
} else {
|
|
44414
|
-
addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value);
|
|
44464
|
+
addSerializedAttribute(buf, filteredAttr.name, filteredAttr.value, requireWellFormed);
|
|
44415
44465
|
}
|
|
44416
44466
|
}
|
|
44417
44467
|
}
|
|
44418
44468
|
if (nodeName === prefixedNodeName && needNamespaceDefine(n, html, childNs)) {
|
|
44419
44469
|
var nodePrefix = n.prefix || "";
|
|
44420
44470
|
var uri = n.namespaceURI;
|
|
44421
|
-
addSerializedAttribute(buf, nodePrefix ? "xmlns:" + nodePrefix : "xmlns", uri);
|
|
44471
|
+
addSerializedAttribute(buf, nodePrefix ? "xmlns:" + nodePrefix : "xmlns", uri, requireWellFormed);
|
|
44422
44472
|
childNs.push({ prefix: nodePrefix, namespace: uri });
|
|
44423
44473
|
}
|
|
44424
44474
|
var child = n.firstChild;
|
|
@@ -44445,7 +44495,7 @@ var require_dom = __commonJS(function(exports) {
|
|
|
44445
44495
|
case DOCUMENT_FRAGMENT_NODE:
|
|
44446
44496
|
return { ns: ns.slice(), isHTML: html, tag: null };
|
|
44447
44497
|
case ATTRIBUTE_NODE:
|
|
44448
|
-
addSerializedAttribute(buf, n.name, n.value);
|
|
44498
|
+
addSerializedAttribute(buf, n.name, n.value, requireWellFormed);
|
|
44449
44499
|
return null;
|
|
44450
44500
|
case TEXT_NODE:
|
|
44451
44501
|
buf.push(n.data.replace(/[<&>]/g, _xmlEncoder));
|
|
@@ -44464,6 +44514,9 @@ var require_dom = __commonJS(function(exports) {
|
|
|
44464
44514
|
return null;
|
|
44465
44515
|
case DOCUMENT_TYPE_NODE:
|
|
44466
44516
|
if (requireWellFormed) {
|
|
44517
|
+
if (!tagNamePattern.test(n.name)) {
|
|
44518
|
+
throw new DOMException(INVALID_STATE_ERR, 'The doctype name "' + n.name + '" is not a valid XML Name');
|
|
44519
|
+
}
|
|
44467
44520
|
if (n.publicId && !/^("[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%']*"|'[\x20\r\na-zA-Z0-9\-()+,.\/:=?;!*#@$_%'"]*')$/.test(n.publicId)) {
|
|
44468
44521
|
throw new DOMException(INVALID_STATE_ERR, "DocumentType publicId is not a valid PubidLiteral");
|
|
44469
44522
|
}
|
|
@@ -44494,12 +44547,20 @@ var require_dom = __commonJS(function(exports) {
|
|
|
44494
44547
|
}
|
|
44495
44548
|
return null;
|
|
44496
44549
|
case PROCESSING_INSTRUCTION_NODE:
|
|
44497
|
-
if (requireWellFormed
|
|
44498
|
-
|
|
44550
|
+
if (requireWellFormed) {
|
|
44551
|
+
if (!tagNamePattern.test(n.target) || n.target.indexOf(":") !== -1 || n.target.toLowerCase() === "xml") {
|
|
44552
|
+
throw new DOMException(INVALID_STATE_ERR, 'The processing instruction target "' + n.target + '" is not a valid XML NCName or is reserved');
|
|
44553
|
+
}
|
|
44554
|
+
if (n.data.indexOf("?>") !== -1) {
|
|
44555
|
+
throw new DOMException(INVALID_STATE_ERR, 'The ProcessingInstruction data contains "?>"');
|
|
44556
|
+
}
|
|
44499
44557
|
}
|
|
44500
44558
|
buf.push("<?", n.target, " ", n.data, "?>");
|
|
44501
44559
|
return null;
|
|
44502
44560
|
case ENTITY_REFERENCE_NODE:
|
|
44561
|
+
if (requireWellFormed && !tagNamePattern.test(n.nodeName)) {
|
|
44562
|
+
throw new DOMException(INVALID_STATE_ERR, 'The entity reference name "' + n.nodeName + '" is not a valid XML Name');
|
|
44563
|
+
}
|
|
44503
44564
|
buf.push("&", n.nodeName, ";");
|
|
44504
44565
|
return null;
|
|
44505
44566
|
default:
|
|
@@ -44638,7 +44699,7 @@ var require_dom = __commonJS(function(exports) {
|
|
|
44638
44699
|
exports.XMLSerializer = XMLSerializer;
|
|
44639
44700
|
});
|
|
44640
44701
|
|
|
44641
|
-
// ../../node_modules/.bun/@xmldom+xmldom@0.8.
|
|
44702
|
+
// ../../node_modules/.bun/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/entities.js
|
|
44642
44703
|
var require_entities = __commonJS(function(exports) {
|
|
44643
44704
|
var freeze = require_conventions().freeze;
|
|
44644
44705
|
exports.XML_ENTITIES = freeze({
|
|
@@ -46779,12 +46840,10 @@ var require_entities = __commonJS(function(exports) {
|
|
|
46779
46840
|
exports.entityMap = exports.HTML_ENTITIES;
|
|
46780
46841
|
});
|
|
46781
46842
|
|
|
46782
|
-
// ../../node_modules/.bun/@xmldom+xmldom@0.8.
|
|
46843
|
+
// ../../node_modules/.bun/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/sax.js
|
|
46783
46844
|
var require_sax = __commonJS(function(exports) {
|
|
46784
46845
|
var NAMESPACE = require_conventions().NAMESPACE;
|
|
46785
|
-
var
|
|
46786
|
-
var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
|
|
46787
|
-
var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$");
|
|
46846
|
+
var tagNamePattern = require_conventions().tagNamePattern;
|
|
46788
46847
|
var S_TAG = 0;
|
|
46789
46848
|
var S_ATTR = 1;
|
|
46790
46849
|
var S_ATTR_SPACE = 2;
|
|
@@ -46873,7 +46932,7 @@ var require_sax = __commonJS(function(exports) {
|
|
|
46873
46932
|
switch (source.charAt(tagStart + 1)) {
|
|
46874
46933
|
case "/":
|
|
46875
46934
|
var end = source.indexOf(">", tagStart + 3);
|
|
46876
|
-
var tagName = source.substring(tagStart + 2, end).replace(
|
|
46935
|
+
var tagName = source.substring(tagStart + 2, end).replace(/^([\s\S]*?[^ \t\n\r])?[ \t\n\r]*$/, "$1");
|
|
46877
46936
|
var config = parseStack.pop();
|
|
46878
46937
|
if (end < 0) {
|
|
46879
46938
|
tagName = source.substring(tagStart + 2).replace(/[\s<].*/, "");
|
|
@@ -46883,6 +46942,8 @@ var require_sax = __commonJS(function(exports) {
|
|
|
46883
46942
|
tagName = tagName.replace(/[\s<].*/, "");
|
|
46884
46943
|
errorHandler.error("end tag name: " + tagName + " maybe not complete");
|
|
46885
46944
|
end = tagStart + 1 + tagName.length;
|
|
46945
|
+
} else if (/[ \t\n\r]/.test(tagName) && tagNamePattern.test(tagName.split(/[ \t\n\r]/)[0])) {
|
|
46946
|
+
errorHandler.error('end tag name is followed by whitespace and trailing content: "' + tagName + '"');
|
|
46886
46947
|
}
|
|
46887
46948
|
var localNSMap = config.localNSMap;
|
|
46888
46949
|
var endMatch = config.tagName == tagName;
|
|
@@ -46979,6 +47040,9 @@ var require_sax = __commonJS(function(exports) {
|
|
|
46979
47040
|
var s = S_TAG;
|
|
46980
47041
|
while (true) {
|
|
46981
47042
|
var c2 = source.charAt(p);
|
|
47043
|
+
if (s === S_TAG && c2 === "<") {
|
|
47044
|
+
throw new Error("unexpected < in tag name: " + source.slice(start, p));
|
|
47045
|
+
}
|
|
46982
47046
|
switch (c2) {
|
|
46983
47047
|
case "=":
|
|
46984
47048
|
if (s === S_ATTR) {
|
|
@@ -47146,7 +47210,7 @@ var require_sax = __commonJS(function(exports) {
|
|
|
47146
47210
|
if (nsPrefix !== false) {
|
|
47147
47211
|
if (localNSMap == null) {
|
|
47148
47212
|
localNSMap = {};
|
|
47149
|
-
|
|
47213
|
+
currentNSMap = Object.create(currentNSMap);
|
|
47150
47214
|
}
|
|
47151
47215
|
currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
|
|
47152
47216
|
a.uri = NAMESPACE.XMLNS;
|
|
@@ -47335,7 +47399,7 @@ var require_sax = __commonJS(function(exports) {
|
|
|
47335
47399
|
exports.ParseError = ParseError;
|
|
47336
47400
|
});
|
|
47337
47401
|
|
|
47338
|
-
// ../../node_modules/.bun/@xmldom+xmldom@0.8.
|
|
47402
|
+
// ../../node_modules/.bun/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/dom-parser.js
|
|
47339
47403
|
var require_dom_parser = __commonJS(function(exports) {
|
|
47340
47404
|
var conventions = require_conventions();
|
|
47341
47405
|
var dom = require_dom();
|
|
@@ -47538,7 +47602,7 @@ var require_dom_parser = __commonJS(function(exports) {
|
|
|
47538
47602
|
exports.DOMParser = DOMParser;
|
|
47539
47603
|
});
|
|
47540
47604
|
|
|
47541
|
-
// ../../node_modules/.bun/@xmldom+xmldom@0.8.
|
|
47605
|
+
// ../../node_modules/.bun/@xmldom+xmldom@0.8.15/node_modules/@xmldom/xmldom/lib/index.js
|
|
47542
47606
|
var require_lib5 = __commonJS(function(exports) {
|
|
47543
47607
|
var dom = require_dom();
|
|
47544
47608
|
exports.DOMImplementation = dom.DOMImplementation;
|
|
@@ -66868,13 +66932,32 @@ var require_data = __commonJS(function(exports, module) {
|
|
|
66868
66932
|
};
|
|
66869
66933
|
});
|
|
66870
66934
|
|
|
66871
|
-
// ../../node_modules/.bun/fast-uri@3.1.
|
|
66935
|
+
// ../../node_modules/.bun/fast-uri@3.1.7/node_modules/fast-uri/lib/utils.js
|
|
66872
66936
|
var require_utils2 = __commonJS(function(exports, module) {
|
|
66873
66937
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
66874
66938
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
66939
|
+
var isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
66875
66940
|
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
66876
66941
|
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
66877
|
-
var isPathCharacter = RegExp.prototype.test.bind(/^[
|
|
66942
|
+
var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
66943
|
+
var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
|
|
66944
|
+
var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
|
|
66945
|
+
var BYTE_HEX = new Array(256);
|
|
66946
|
+
{
|
|
66947
|
+
const HEX_DIGITS = "0123456789ABCDEF";
|
|
66948
|
+
for (let i = 0;i < 256; i++) {
|
|
66949
|
+
BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
|
|
66950
|
+
}
|
|
66951
|
+
}
|
|
66952
|
+
function percentEncodeNonAscii(cp) {
|
|
66953
|
+
if (cp < 2048) {
|
|
66954
|
+
return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
|
|
66955
|
+
}
|
|
66956
|
+
if (cp < 65536) {
|
|
66957
|
+
return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
66958
|
+
}
|
|
66959
|
+
return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
|
|
66960
|
+
}
|
|
66878
66961
|
function stringArrayToHexStripped(input) {
|
|
66879
66962
|
let acc = "";
|
|
66880
66963
|
let code = 0;
|
|
@@ -66899,91 +66982,122 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
66899
66982
|
}
|
|
66900
66983
|
return acc;
|
|
66901
66984
|
}
|
|
66985
|
+
var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
|
|
66986
|
+
var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
|
|
66987
|
+
var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
|
|
66902
66988
|
var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
66903
|
-
function
|
|
66904
|
-
|
|
66905
|
-
|
|
66906
|
-
|
|
66907
|
-
|
|
66908
|
-
|
|
66909
|
-
|
|
66910
|
-
|
|
66911
|
-
|
|
66912
|
-
} else {
|
|
66913
|
-
output.error = true;
|
|
66914
|
-
return false;
|
|
66989
|
+
function isZoneIdentifier(zone) {
|
|
66990
|
+
if (zone.length === 0)
|
|
66991
|
+
return false;
|
|
66992
|
+
for (let i = 0;i < zone.length; i++) {
|
|
66993
|
+
if (isZoneCharacter(zone[i]))
|
|
66994
|
+
continue;
|
|
66995
|
+
if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
|
|
66996
|
+
i += 2;
|
|
66997
|
+
continue;
|
|
66915
66998
|
}
|
|
66916
|
-
|
|
66999
|
+
return false;
|
|
66917
67000
|
}
|
|
66918
67001
|
return true;
|
|
66919
67002
|
}
|
|
66920
|
-
function
|
|
66921
|
-
let
|
|
66922
|
-
|
|
66923
|
-
|
|
66924
|
-
|
|
66925
|
-
let
|
|
66926
|
-
|
|
66927
|
-
|
|
66928
|
-
|
|
66929
|
-
|
|
66930
|
-
|
|
66931
|
-
|
|
66932
|
-
|
|
66933
|
-
if (cursor === ":") {
|
|
66934
|
-
if (endipv6Encountered === true) {
|
|
66935
|
-
endIpv6 = true;
|
|
67003
|
+
function compressIPv6ZeroRun(hextets) {
|
|
67004
|
+
let bestStart = -1;
|
|
67005
|
+
let bestLength = 0;
|
|
67006
|
+
let runStart = -1;
|
|
67007
|
+
let runLength = 0;
|
|
67008
|
+
for (let i = 0;i < hextets.length; i++) {
|
|
67009
|
+
if (hextets[i] === "0") {
|
|
67010
|
+
if (runStart === -1)
|
|
67011
|
+
runStart = i;
|
|
67012
|
+
runLength++;
|
|
67013
|
+
if (runLength > bestLength) {
|
|
67014
|
+
bestLength = runLength;
|
|
67015
|
+
bestStart = runStart;
|
|
66936
67016
|
}
|
|
66937
|
-
if (!consume(buffer2, address, output)) {
|
|
66938
|
-
break;
|
|
66939
|
-
}
|
|
66940
|
-
if (++tokenCount > 7) {
|
|
66941
|
-
output.error = true;
|
|
66942
|
-
break;
|
|
66943
|
-
}
|
|
66944
|
-
if (i > 0 && input[i - 1] === ":") {
|
|
66945
|
-
endipv6Encountered = true;
|
|
66946
|
-
}
|
|
66947
|
-
address.push(":");
|
|
66948
|
-
continue;
|
|
66949
|
-
} else if (cursor === "%") {
|
|
66950
|
-
if (!consume(buffer2, address, output)) {
|
|
66951
|
-
break;
|
|
66952
|
-
}
|
|
66953
|
-
consume = consumeIsZone;
|
|
66954
67017
|
} else {
|
|
66955
|
-
|
|
66956
|
-
|
|
67018
|
+
runStart = -1;
|
|
67019
|
+
runLength = 0;
|
|
66957
67020
|
}
|
|
66958
67021
|
}
|
|
66959
|
-
if (
|
|
66960
|
-
|
|
66961
|
-
|
|
66962
|
-
|
|
66963
|
-
|
|
66964
|
-
|
|
66965
|
-
|
|
67022
|
+
if (bestLength < 2)
|
|
67023
|
+
return hextets.join(":");
|
|
67024
|
+
const head2 = hextets.slice(0, bestStart).join(":");
|
|
67025
|
+
const tail = hextets.slice(bestStart + bestLength).join(":");
|
|
67026
|
+
return head2 + "::" + tail;
|
|
67027
|
+
}
|
|
67028
|
+
function normalizeIPv6Address(input) {
|
|
67029
|
+
const compression = input.indexOf("::");
|
|
67030
|
+
if (compression !== -1 && input.indexOf("::", compression + 1) !== -1)
|
|
67031
|
+
return;
|
|
67032
|
+
const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
|
|
67033
|
+
const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
|
|
67034
|
+
if (compression !== -1) {
|
|
67035
|
+
if (left.length === 1 && left[0] === "")
|
|
67036
|
+
left.length = 0;
|
|
67037
|
+
if (right.length === 1 && right[0] === "")
|
|
67038
|
+
right.length = 0;
|
|
67039
|
+
}
|
|
67040
|
+
const parts = left.concat(right);
|
|
67041
|
+
let hextetCount = 0;
|
|
67042
|
+
for (let i = 0;i < parts.length; i++) {
|
|
67043
|
+
const part = parts[i];
|
|
67044
|
+
if (part === "")
|
|
67045
|
+
return;
|
|
67046
|
+
if (part.indexOf(".") !== -1) {
|
|
67047
|
+
if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part))
|
|
67048
|
+
return;
|
|
67049
|
+
hextetCount += 2;
|
|
67050
|
+
continue;
|
|
66966
67051
|
}
|
|
67052
|
+
if (!isHextet(part))
|
|
67053
|
+
return;
|
|
67054
|
+
parts[i] = parseInt(part, 16).toString(16);
|
|
67055
|
+
hextetCount++;
|
|
66967
67056
|
}
|
|
66968
|
-
|
|
66969
|
-
|
|
67057
|
+
if (compression === -1) {
|
|
67058
|
+
if (hextetCount !== 8)
|
|
67059
|
+
return;
|
|
67060
|
+
return compressIPv6ZeroRun(parts);
|
|
67061
|
+
}
|
|
67062
|
+
if (hextetCount >= 8)
|
|
67063
|
+
return;
|
|
67064
|
+
const expanded = parts.slice(0, left.length);
|
|
67065
|
+
for (let i = hextetCount;i < 8; i++)
|
|
67066
|
+
expanded.push("0");
|
|
67067
|
+
for (let i = left.length;i < parts.length; i++)
|
|
67068
|
+
expanded.push(parts[i]);
|
|
67069
|
+
return compressIPv6ZeroRun(expanded);
|
|
66970
67070
|
}
|
|
66971
67071
|
function normalizeIPv6(host) {
|
|
66972
|
-
|
|
66973
|
-
|
|
66974
|
-
|
|
66975
|
-
|
|
66976
|
-
|
|
66977
|
-
|
|
66978
|
-
|
|
66979
|
-
|
|
66980
|
-
|
|
66981
|
-
|
|
66982
|
-
}
|
|
66983
|
-
|
|
66984
|
-
|
|
66985
|
-
|
|
66986
|
-
|
|
67072
|
+
const bracketed = host[0] === "[" && host[host.length - 1] === "]";
|
|
67073
|
+
const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
|
|
67074
|
+
if (hasBracket && !bracketed)
|
|
67075
|
+
return { host, isIPV6: false, error: true };
|
|
67076
|
+
let input = bracketed ? host.slice(1, -1) : host;
|
|
67077
|
+
if (bracketed && isIPvFuture(input)) {
|
|
67078
|
+
input = input.toLowerCase();
|
|
67079
|
+
return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
|
|
67080
|
+
}
|
|
67081
|
+
if (findToken(input, ":") < 2) {
|
|
67082
|
+
return { host, isIPV6: false, error: bracketed };
|
|
67083
|
+
}
|
|
67084
|
+
let zoneIdentifier = "";
|
|
67085
|
+
const zoneSeparator = input.indexOf("%");
|
|
67086
|
+
if (zoneSeparator !== -1) {
|
|
67087
|
+
const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
|
|
67088
|
+
zoneIdentifier = input.slice(zoneSeparator + separatorLength);
|
|
67089
|
+
if (!isZoneIdentifier(zoneIdentifier))
|
|
67090
|
+
return { host, isIPV6: false, error: true };
|
|
67091
|
+
input = input.slice(0, zoneSeparator);
|
|
67092
|
+
}
|
|
67093
|
+
const address = normalizeIPv6Address(input);
|
|
67094
|
+
if (address === undefined)
|
|
67095
|
+
return { host, isIPV6: false, error: true };
|
|
67096
|
+
return {
|
|
67097
|
+
host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
|
|
67098
|
+
escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
|
|
67099
|
+
isIPV6: true
|
|
67100
|
+
};
|
|
66987
67101
|
}
|
|
66988
67102
|
function findToken(str, token) {
|
|
66989
67103
|
let ind = 0;
|
|
@@ -67103,7 +67217,8 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
67103
67217
|
function normalizePathEncoding(input) {
|
|
67104
67218
|
let output = "";
|
|
67105
67219
|
for (let i = 0;i < input.length; i++) {
|
|
67106
|
-
|
|
67220
|
+
const ch = input[i];
|
|
67221
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
67107
67222
|
const hex = input.slice(i + 1, i + 3);
|
|
67108
67223
|
if (isHexPair(hex)) {
|
|
67109
67224
|
const normalizedHex = hex.toUpperCase();
|
|
@@ -67117,10 +67232,152 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
67117
67232
|
continue;
|
|
67118
67233
|
}
|
|
67119
67234
|
}
|
|
67120
|
-
if (isPathCharacter(
|
|
67121
|
-
output +=
|
|
67235
|
+
if (isPathCharacter(ch)) {
|
|
67236
|
+
output += ch;
|
|
67237
|
+
} else {
|
|
67238
|
+
const code = input.charCodeAt(i);
|
|
67239
|
+
if (code < 128) {
|
|
67240
|
+
output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
67241
|
+
} else if (code < 55296 || code > 57343) {
|
|
67242
|
+
output += percentEncodeNonAscii(code);
|
|
67243
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
67244
|
+
const low = input.charCodeAt(i + 1);
|
|
67245
|
+
if (low >= 56320 && low <= 57343) {
|
|
67246
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
67247
|
+
i++;
|
|
67248
|
+
} else {
|
|
67249
|
+
output += percentEncodeNonAscii(65533);
|
|
67250
|
+
}
|
|
67251
|
+
} else {
|
|
67252
|
+
output += percentEncodeNonAscii(65533);
|
|
67253
|
+
}
|
|
67254
|
+
}
|
|
67255
|
+
}
|
|
67256
|
+
return output;
|
|
67257
|
+
}
|
|
67258
|
+
function serializePathEncoding(input, pathNoScheme = false) {
|
|
67259
|
+
let output = "";
|
|
67260
|
+
let firstSegment = pathNoScheme && input[0] !== "/";
|
|
67261
|
+
for (let i = 0;i < input.length; i++) {
|
|
67262
|
+
const ch = input[i];
|
|
67263
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
67264
|
+
const hex = input.slice(i + 1, i + 3);
|
|
67265
|
+
if (isHexPair(hex)) {
|
|
67266
|
+
output += "%" + hex.toUpperCase();
|
|
67267
|
+
i += 2;
|
|
67268
|
+
continue;
|
|
67269
|
+
}
|
|
67270
|
+
}
|
|
67271
|
+
if (ch === "/") {
|
|
67272
|
+
firstSegment = false;
|
|
67273
|
+
}
|
|
67274
|
+
if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
|
|
67275
|
+
output += ch;
|
|
67122
67276
|
} else {
|
|
67123
|
-
|
|
67277
|
+
const code = input.charCodeAt(i);
|
|
67278
|
+
if (code < 128) {
|
|
67279
|
+
output += BYTE_HEX[code];
|
|
67280
|
+
} else if (code < 55296 || code > 57343) {
|
|
67281
|
+
output += percentEncodeNonAscii(code);
|
|
67282
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
67283
|
+
const low = input.charCodeAt(i + 1);
|
|
67284
|
+
if (low >= 56320 && low <= 57343) {
|
|
67285
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
67286
|
+
i++;
|
|
67287
|
+
} else {
|
|
67288
|
+
output += percentEncodeNonAscii(65533);
|
|
67289
|
+
}
|
|
67290
|
+
} else {
|
|
67291
|
+
output += percentEncodeNonAscii(65533);
|
|
67292
|
+
}
|
|
67293
|
+
}
|
|
67294
|
+
}
|
|
67295
|
+
return output;
|
|
67296
|
+
}
|
|
67297
|
+
function encodeComponent(input, isAllowed) {
|
|
67298
|
+
let output = "";
|
|
67299
|
+
for (let i = 0;i < input.length; i++) {
|
|
67300
|
+
const ch = input[i];
|
|
67301
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
67302
|
+
const hex = input.slice(i + 1, i + 3);
|
|
67303
|
+
if (isHexPair(hex)) {
|
|
67304
|
+
output += "%" + hex.toUpperCase();
|
|
67305
|
+
i += 2;
|
|
67306
|
+
continue;
|
|
67307
|
+
}
|
|
67308
|
+
}
|
|
67309
|
+
if (isAllowed(ch)) {
|
|
67310
|
+
output += ch;
|
|
67311
|
+
} else {
|
|
67312
|
+
const code = input.charCodeAt(i);
|
|
67313
|
+
if (code < 128) {
|
|
67314
|
+
output += BYTE_HEX[code];
|
|
67315
|
+
} else if (code < 55296 || code > 57343) {
|
|
67316
|
+
output += percentEncodeNonAscii(code);
|
|
67317
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
67318
|
+
const low = input.charCodeAt(i + 1);
|
|
67319
|
+
if (low >= 56320 && low <= 57343) {
|
|
67320
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
67321
|
+
i++;
|
|
67322
|
+
} else {
|
|
67323
|
+
output += percentEncodeNonAscii(65533);
|
|
67324
|
+
}
|
|
67325
|
+
} else {
|
|
67326
|
+
output += percentEncodeNonAscii(65533);
|
|
67327
|
+
}
|
|
67328
|
+
}
|
|
67329
|
+
}
|
|
67330
|
+
return output;
|
|
67331
|
+
}
|
|
67332
|
+
function encodeUserinfo(input) {
|
|
67333
|
+
return encodeComponent(input, isUserinfoCharacter);
|
|
67334
|
+
}
|
|
67335
|
+
function encodeQuery(input) {
|
|
67336
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
67337
|
+
}
|
|
67338
|
+
function encodeFragment(input) {
|
|
67339
|
+
return encodeComponent(input, isQueryFragmentCharacter);
|
|
67340
|
+
}
|
|
67341
|
+
function isEscapeSafe(cp) {
|
|
67342
|
+
return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95;
|
|
67343
|
+
}
|
|
67344
|
+
function normalizeQueryFragmentEncoding(input) {
|
|
67345
|
+
let output = "";
|
|
67346
|
+
for (let i = 0;i < input.length; i++) {
|
|
67347
|
+
const ch = input[i];
|
|
67348
|
+
if (ch === "%" && i + 2 < input.length) {
|
|
67349
|
+
const hex = input.slice(i + 1, i + 3);
|
|
67350
|
+
if (isHexPair(hex)) {
|
|
67351
|
+
const normalizedHex = hex.toUpperCase();
|
|
67352
|
+
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
67353
|
+
if (isUnreserved(decoded)) {
|
|
67354
|
+
output += decoded;
|
|
67355
|
+
} else {
|
|
67356
|
+
output += "%" + normalizedHex;
|
|
67357
|
+
}
|
|
67358
|
+
i += 2;
|
|
67359
|
+
continue;
|
|
67360
|
+
}
|
|
67361
|
+
}
|
|
67362
|
+
if (isQueryFragmentCharacter(ch)) {
|
|
67363
|
+
output += ch;
|
|
67364
|
+
} else {
|
|
67365
|
+
const code = input.charCodeAt(i);
|
|
67366
|
+
if (code < 128) {
|
|
67367
|
+
output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
|
|
67368
|
+
} else if (code < 55296 || code > 57343) {
|
|
67369
|
+
output += percentEncodeNonAscii(code);
|
|
67370
|
+
} else if (code <= 56319 && i + 1 < input.length) {
|
|
67371
|
+
const low = input.charCodeAt(i + 1);
|
|
67372
|
+
if (low >= 56320 && low <= 57343) {
|
|
67373
|
+
output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
|
|
67374
|
+
i++;
|
|
67375
|
+
} else {
|
|
67376
|
+
output += percentEncodeNonAscii(65533);
|
|
67377
|
+
}
|
|
67378
|
+
} else {
|
|
67379
|
+
output += percentEncodeNonAscii(65533);
|
|
67380
|
+
}
|
|
67124
67381
|
}
|
|
67125
67382
|
}
|
|
67126
67383
|
return output;
|
|
@@ -67143,14 +67400,18 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
67143
67400
|
function recomposeAuthority(component) {
|
|
67144
67401
|
const uriTokens = [];
|
|
67145
67402
|
if (component.userinfo !== undefined) {
|
|
67146
|
-
uriTokens.push(component.userinfo);
|
|
67403
|
+
uriTokens.push(encodeUserinfo(component.userinfo));
|
|
67147
67404
|
uriTokens.push("@");
|
|
67148
67405
|
}
|
|
67149
67406
|
if (component.host !== undefined) {
|
|
67150
|
-
let host =
|
|
67407
|
+
let host = component.host;
|
|
67151
67408
|
if (!isIPv4(host)) {
|
|
67152
|
-
|
|
67153
|
-
if (ipV6res.isIPV6
|
|
67409
|
+
let ipV6res = normalizeIPv6(host);
|
|
67410
|
+
if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
|
|
67411
|
+
host = normalizePercentEncoding(host, true);
|
|
67412
|
+
ipV6res = normalizeIPv6(host);
|
|
67413
|
+
}
|
|
67414
|
+
if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
|
|
67154
67415
|
host = `[${ipV6res.escapedHost}]`;
|
|
67155
67416
|
} else {
|
|
67156
67417
|
host = reescapeHostDelimiters(host, false);
|
|
@@ -67159,8 +67420,12 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
67159
67420
|
uriTokens.push(host);
|
|
67160
67421
|
}
|
|
67161
67422
|
if (typeof component.port === "number" || typeof component.port === "string") {
|
|
67423
|
+
const port = String(component.port);
|
|
67424
|
+
if (!isPort(port)) {
|
|
67425
|
+
throw new TypeError("URI port is malformed.");
|
|
67426
|
+
}
|
|
67162
67427
|
uriTokens.push(":");
|
|
67163
|
-
uriTokens.push(
|
|
67428
|
+
uriTokens.push(port);
|
|
67164
67429
|
}
|
|
67165
67430
|
return uriTokens.length ? uriTokens.join("") : undefined;
|
|
67166
67431
|
}
|
|
@@ -67170,6 +67435,11 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
67170
67435
|
reescapeHostDelimiters,
|
|
67171
67436
|
normalizePercentEncoding,
|
|
67172
67437
|
normalizePathEncoding,
|
|
67438
|
+
serializePathEncoding,
|
|
67439
|
+
normalizeQueryFragmentEncoding,
|
|
67440
|
+
encodeUserinfo,
|
|
67441
|
+
encodeQuery,
|
|
67442
|
+
encodeFragment,
|
|
67173
67443
|
escapePreservingEscapes,
|
|
67174
67444
|
removeDotSegments,
|
|
67175
67445
|
isIPv4,
|
|
@@ -67179,10 +67449,10 @@ var require_utils2 = __commonJS(function(exports, module) {
|
|
|
67179
67449
|
};
|
|
67180
67450
|
});
|
|
67181
67451
|
|
|
67182
|
-
// ../../node_modules/.bun/fast-uri@3.1.
|
|
67452
|
+
// ../../node_modules/.bun/fast-uri@3.1.7/node_modules/fast-uri/lib/schemes.js
|
|
67183
67453
|
var require_schemes = __commonJS(function(exports, module) {
|
|
67184
67454
|
var { isUUID } = require_utils2();
|
|
67185
|
-
var URN_REG =
|
|
67455
|
+
var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
|
|
67186
67456
|
var supportedSchemeNames = [
|
|
67187
67457
|
"http",
|
|
67188
67458
|
"https",
|
|
@@ -67237,9 +67507,10 @@ var require_schemes = __commonJS(function(exports, module) {
|
|
|
67237
67507
|
wsComponent.secure = undefined;
|
|
67238
67508
|
}
|
|
67239
67509
|
if (wsComponent.resourceName) {
|
|
67240
|
-
const
|
|
67510
|
+
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
67511
|
+
const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
67241
67512
|
wsComponent.path = path && path !== "/" ? path : undefined;
|
|
67242
|
-
wsComponent.query =
|
|
67513
|
+
wsComponent.query = queryIndex === -1 ? undefined : wsComponent.resourceName.slice(queryIndex + 1);
|
|
67243
67514
|
wsComponent.resourceName = undefined;
|
|
67244
67515
|
}
|
|
67245
67516
|
wsComponent.fragment = undefined;
|
|
@@ -67251,7 +67522,7 @@ var require_schemes = __commonJS(function(exports, module) {
|
|
|
67251
67522
|
return urnComponent;
|
|
67252
67523
|
}
|
|
67253
67524
|
const matches = urnComponent.path.match(URN_REG);
|
|
67254
|
-
if (matches) {
|
|
67525
|
+
if (matches && matches[0] === urnComponent.path) {
|
|
67255
67526
|
const scheme = options.scheme || urnComponent.scheme || "urn";
|
|
67256
67527
|
urnComponent.nid = matches[1].toLowerCase();
|
|
67257
67528
|
urnComponent.nss = matches[2];
|
|
@@ -67353,10 +67624,19 @@ var require_schemes = __commonJS(function(exports, module) {
|
|
|
67353
67624
|
};
|
|
67354
67625
|
});
|
|
67355
67626
|
|
|
67356
|
-
// ../../node_modules/.bun/fast-uri@3.1.
|
|
67627
|
+
// ../../node_modules/.bun/fast-uri@3.1.7/node_modules/fast-uri/index.js
|
|
67357
67628
|
var require_fast_uri = __commonJS(function(exports, module) {
|
|
67358
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding,
|
|
67629
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils2();
|
|
67359
67630
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
67631
|
+
var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
67632
|
+
var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
67633
|
+
function decodeValidScheme(scheme) {
|
|
67634
|
+
const decodedScheme = unescape(String(scheme));
|
|
67635
|
+
if (!VALID_SCHEME.test(decodedScheme)) {
|
|
67636
|
+
throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
67637
|
+
}
|
|
67638
|
+
return decodedScheme;
|
|
67639
|
+
}
|
|
67360
67640
|
function normalize(uri, options) {
|
|
67361
67641
|
if (typeof uri === "string") {
|
|
67362
67642
|
uri = normalizeString(uri, options);
|
|
@@ -67367,12 +67647,34 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
67367
67647
|
}
|
|
67368
67648
|
function resolve4(baseURI, relativeURI, options) {
|
|
67369
67649
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
67370
|
-
const {
|
|
67371
|
-
|
|
67372
|
-
|
|
67650
|
+
const {
|
|
67651
|
+
parsed: baseParsed,
|
|
67652
|
+
malformedAuthorityOrPort: baseMalformed,
|
|
67653
|
+
malformedPercentEncoding: baseMalformedPercentEncoding,
|
|
67654
|
+
malformedSchemeSpecific: baseMalformedSchemeSpecific,
|
|
67655
|
+
malformedHost: baseMalformedHost,
|
|
67656
|
+
malformedScheme: baseMalformedScheme
|
|
67657
|
+
} = parseWithStatus(baseURI, schemelessOptions);
|
|
67658
|
+
const {
|
|
67659
|
+
parsed: relativeParsed,
|
|
67660
|
+
malformedAuthorityOrPort: relativeMalformed,
|
|
67661
|
+
malformedPercentEncoding: relativeMalformedPercentEncoding,
|
|
67662
|
+
malformedSchemeSpecific: relativeMalformedSchemeSpecific,
|
|
67663
|
+
malformedHost: relativeMalformedHost,
|
|
67664
|
+
malformedScheme: relativeMalformedScheme
|
|
67665
|
+
} = parseWithStatus(relativeURI, schemelessOptions);
|
|
67666
|
+
if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
|
|
67373
67667
|
throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
|
|
67374
67668
|
}
|
|
67375
67669
|
const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
|
|
67670
|
+
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
67671
|
+
const resolvedHost = resolved.host;
|
|
67672
|
+
const resolvedHostIsIP = resolvedHost !== undefined && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
67673
|
+
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
67674
|
+
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
|
|
67675
|
+
if (resolved.error && !encodedASCIIHost) {
|
|
67676
|
+
throw new Error(resolved.error);
|
|
67677
|
+
}
|
|
67376
67678
|
schemelessOptions.skipEscape = true;
|
|
67377
67679
|
return serialize(resolved, schemelessOptions);
|
|
67378
67680
|
}
|
|
@@ -67432,7 +67734,7 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
67432
67734
|
function equal(uriA, uriB, options) {
|
|
67433
67735
|
const normalizedA = normalizeComparableURI(uriA, options);
|
|
67434
67736
|
const normalizedB = normalizeComparableURI(uriB, options);
|
|
67435
|
-
return normalizedA !== undefined && normalizedB !== undefined && normalizedA
|
|
67737
|
+
return normalizedA !== undefined && normalizedB !== undefined && normalizedA === normalizedB;
|
|
67436
67738
|
}
|
|
67437
67739
|
function serialize(cmpts, opts) {
|
|
67438
67740
|
const component = {
|
|
@@ -67453,20 +67755,23 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
67453
67755
|
};
|
|
67454
67756
|
const options = Object.assign({}, opts);
|
|
67455
67757
|
const uriTokens = [];
|
|
67758
|
+
if (component.scheme) {
|
|
67759
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
67760
|
+
}
|
|
67456
67761
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
67457
67762
|
if (schemeHandler && schemeHandler.serialize)
|
|
67458
67763
|
schemeHandler.serialize(component, options);
|
|
67764
|
+
const hasAuthority = component.userinfo !== undefined || component.host !== undefined || component.port !== undefined;
|
|
67765
|
+
const pathNoScheme = !options.skipEscape && component.scheme === undefined && !hasAuthority;
|
|
67459
67766
|
if (component.path !== undefined) {
|
|
67460
67767
|
if (!options.skipEscape) {
|
|
67461
|
-
component.path =
|
|
67462
|
-
if (component.scheme !== undefined) {
|
|
67463
|
-
component.path = component.path.split("%3A").join(":");
|
|
67464
|
-
}
|
|
67768
|
+
component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
67465
67769
|
} else {
|
|
67466
67770
|
component.path = normalizePercentEncoding(component.path);
|
|
67467
67771
|
}
|
|
67468
67772
|
}
|
|
67469
67773
|
if (options.reference !== "suffix" && component.scheme) {
|
|
67774
|
+
component.scheme = decodeValidScheme(component.scheme);
|
|
67470
67775
|
uriTokens.push(component.scheme, ":");
|
|
67471
67776
|
}
|
|
67472
67777
|
const authority = recomposeAuthority(component);
|
|
@@ -67484,16 +67789,19 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
67484
67789
|
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
67485
67790
|
s = removeDotSegments(s);
|
|
67486
67791
|
}
|
|
67792
|
+
if (pathNoScheme) {
|
|
67793
|
+
s = serializePathEncoding(s, true);
|
|
67794
|
+
}
|
|
67487
67795
|
if (authority === undefined && s[0] === "/" && s[1] === "/") {
|
|
67488
67796
|
s = "/%2F" + s.slice(2);
|
|
67489
67797
|
}
|
|
67490
67798
|
uriTokens.push(s);
|
|
67491
67799
|
}
|
|
67492
67800
|
if (component.query !== undefined) {
|
|
67493
|
-
uriTokens.push("?", component.query);
|
|
67801
|
+
uriTokens.push("?", encodeQuery(component.query));
|
|
67494
67802
|
}
|
|
67495
67803
|
if (component.fragment !== undefined) {
|
|
67496
|
-
uriTokens.push("#", component.fragment);
|
|
67804
|
+
uriTokens.push("#", encodeFragment(component.fragment));
|
|
67497
67805
|
}
|
|
67498
67806
|
return uriTokens.join("");
|
|
67499
67807
|
}
|
|
@@ -67509,6 +67817,36 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
67509
67817
|
}
|
|
67510
67818
|
return;
|
|
67511
67819
|
}
|
|
67820
|
+
function hasMalformedPercentEncoding(component) {
|
|
67821
|
+
if (component === undefined)
|
|
67822
|
+
return false;
|
|
67823
|
+
let percent = component.indexOf("%");
|
|
67824
|
+
while (percent !== -1) {
|
|
67825
|
+
if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
|
|
67826
|
+
return true;
|
|
67827
|
+
}
|
|
67828
|
+
percent = component.indexOf("%", percent + 3);
|
|
67829
|
+
}
|
|
67830
|
+
return false;
|
|
67831
|
+
}
|
|
67832
|
+
function isIPLiteral(host) {
|
|
67833
|
+
return host[0] === "[" && host[host.length - 1] === "]";
|
|
67834
|
+
}
|
|
67835
|
+
function hasMalformedComponentPercentEncoding(matches) {
|
|
67836
|
+
const host = matches[4];
|
|
67837
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== undefined && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
67838
|
+
}
|
|
67839
|
+
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
67840
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
67841
|
+
try {
|
|
67842
|
+
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
67843
|
+
} catch (e) {
|
|
67844
|
+
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
67845
|
+
return true;
|
|
67846
|
+
}
|
|
67847
|
+
}
|
|
67848
|
+
return false;
|
|
67849
|
+
}
|
|
67512
67850
|
function parseWithStatus(uri, opts) {
|
|
67513
67851
|
const options = Object.assign({}, opts);
|
|
67514
67852
|
const parsed = {
|
|
@@ -67521,6 +67859,11 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
67521
67859
|
fragment: undefined
|
|
67522
67860
|
};
|
|
67523
67861
|
let malformedAuthorityOrPort = false;
|
|
67862
|
+
let malformedPercentEncoding = false;
|
|
67863
|
+
let malformedSchemeSpecific = false;
|
|
67864
|
+
let malformedHost = false;
|
|
67865
|
+
let malformedIPLiteral = false;
|
|
67866
|
+
let malformedScheme = false;
|
|
67524
67867
|
let isIP = false;
|
|
67525
67868
|
if (options.reference === "suffix") {
|
|
67526
67869
|
if (options.scheme) {
|
|
@@ -67557,6 +67900,19 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
67557
67900
|
parsed.path = matches[6] || "";
|
|
67558
67901
|
parsed.query = matches[7];
|
|
67559
67902
|
parsed.fragment = matches[8];
|
|
67903
|
+
if (parsed.scheme !== undefined) {
|
|
67904
|
+
const decodedScheme = unescape(parsed.scheme);
|
|
67905
|
+
if (VALID_SCHEME.test(decodedScheme)) {
|
|
67906
|
+
parsed.scheme = decodedScheme.toLowerCase();
|
|
67907
|
+
} else {
|
|
67908
|
+
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
67909
|
+
malformedScheme = true;
|
|
67910
|
+
}
|
|
67911
|
+
}
|
|
67912
|
+
malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
|
|
67913
|
+
if (malformedPercentEncoding) {
|
|
67914
|
+
parsed.error = parsed.error || "URI contains malformed percent-encoding.";
|
|
67915
|
+
}
|
|
67560
67916
|
if (isNaN(parsed.port)) {
|
|
67561
67917
|
parsed.port = matches[5];
|
|
67562
67918
|
}
|
|
@@ -67568,9 +67924,16 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
67568
67924
|
if (parsed.host) {
|
|
67569
67925
|
const ipv4result = isIPv4(parsed.host);
|
|
67570
67926
|
if (ipv4result === false) {
|
|
67927
|
+
const bracketedIPLiteral = isIPLiteral(parsed.host);
|
|
67928
|
+
const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
|
|
67571
67929
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
67572
|
-
|
|
67573
|
-
|
|
67930
|
+
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
67931
|
+
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
67932
|
+
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
67933
|
+
if (malformedIPLiteral) {
|
|
67934
|
+
parsed.error = parsed.error || "URI host is malformed.";
|
|
67935
|
+
malformedAuthorityOrPort = true;
|
|
67936
|
+
}
|
|
67574
67937
|
} else {
|
|
67575
67938
|
isIP = true;
|
|
67576
67939
|
}
|
|
@@ -67588,42 +67951,36 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
67588
67951
|
parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
|
|
67589
67952
|
}
|
|
67590
67953
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
|
|
67591
|
-
if (!
|
|
67592
|
-
|
|
67593
|
-
try {
|
|
67594
|
-
parsed.host = new URL("http://" + parsed.host).hostname;
|
|
67595
|
-
} catch (e) {
|
|
67596
|
-
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
67597
|
-
}
|
|
67598
|
-
}
|
|
67954
|
+
if (!malformedIPLiteral) {
|
|
67955
|
+
malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
|
|
67599
67956
|
}
|
|
67600
67957
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
67601
67958
|
if (uri.indexOf("%") !== -1) {
|
|
67602
|
-
if (parsed.
|
|
67603
|
-
parsed.
|
|
67604
|
-
|
|
67605
|
-
if (parsed.host !== undefined) {
|
|
67606
|
-
parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
|
|
67959
|
+
if (parsed.host !== undefined && !malformedIPLiteral) {
|
|
67960
|
+
const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
67961
|
+
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
67607
67962
|
}
|
|
67608
67963
|
}
|
|
67609
67964
|
if (parsed.path) {
|
|
67610
67965
|
parsed.path = normalizePathEncoding(parsed.path);
|
|
67611
67966
|
}
|
|
67967
|
+
if (parsed.query) {
|
|
67968
|
+
parsed.query = normalizeQueryFragmentEncoding(parsed.query);
|
|
67969
|
+
}
|
|
67612
67970
|
if (parsed.fragment) {
|
|
67613
|
-
|
|
67614
|
-
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
67615
|
-
} catch {
|
|
67616
|
-
parsed.error = parsed.error || "URI malformed";
|
|
67617
|
-
}
|
|
67971
|
+
parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
|
|
67618
67972
|
}
|
|
67619
67973
|
}
|
|
67620
67974
|
if (schemeHandler && schemeHandler.parse) {
|
|
67621
67975
|
schemeHandler.parse(parsed, options);
|
|
67976
|
+
if (schemeHandler === SCHEMES.urn && parsed.nid === undefined) {
|
|
67977
|
+
malformedSchemeSpecific = true;
|
|
67978
|
+
}
|
|
67622
67979
|
}
|
|
67623
67980
|
} else {
|
|
67624
67981
|
parsed.error = parsed.error || "URI can not be parsed.";
|
|
67625
67982
|
}
|
|
67626
|
-
return { parsed, malformedAuthorityOrPort };
|
|
67983
|
+
return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
|
|
67627
67984
|
}
|
|
67628
67985
|
function parse8(uri, opts) {
|
|
67629
67986
|
return parseWithStatus(uri, opts).parsed;
|
|
@@ -67632,20 +67989,28 @@ var require_fast_uri = __commonJS(function(exports, module) {
|
|
|
67632
67989
|
return normalizeStringWithStatus(uri, opts).normalized;
|
|
67633
67990
|
}
|
|
67634
67991
|
function normalizeStringWithStatus(uri, opts) {
|
|
67635
|
-
const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
67992
|
+
const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
|
|
67636
67993
|
return {
|
|
67637
|
-
normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
|
|
67638
|
-
malformedAuthorityOrPort
|
|
67994
|
+
normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
|
|
67995
|
+
malformedAuthorityOrPort,
|
|
67996
|
+
malformedPercentEncoding,
|
|
67997
|
+
malformedSchemeSpecific,
|
|
67998
|
+
malformedHost,
|
|
67999
|
+
malformedScheme
|
|
67639
68000
|
};
|
|
67640
68001
|
}
|
|
67641
68002
|
function normalizeComparableURI(uri, opts) {
|
|
67642
|
-
if (typeof uri
|
|
67643
|
-
|
|
67644
|
-
return malformedAuthorityOrPort ? undefined : normalized;
|
|
68003
|
+
if (typeof uri !== "string" && typeof uri !== "object") {
|
|
68004
|
+
return;
|
|
67645
68005
|
}
|
|
67646
|
-
|
|
67647
|
-
|
|
68006
|
+
let value;
|
|
68007
|
+
try {
|
|
68008
|
+
value = typeof uri === "string" ? uri : serialize(uri, opts);
|
|
68009
|
+
} catch {
|
|
68010
|
+
return;
|
|
67648
68011
|
}
|
|
68012
|
+
const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
|
|
68013
|
+
return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? undefined : normalized;
|
|
67649
68014
|
}
|
|
67650
68015
|
var fastUri = {
|
|
67651
68016
|
SCHEMES,
|
|
@@ -73592,6 +73957,7 @@ Proceed with deployment to Supabase?`, true);
|
|
|
73592
73957
|
▶ Deploying ${efNames.length} Edge Function(s)…`));
|
|
73593
73958
|
let efOk = 0;
|
|
73594
73959
|
const efFailed = [];
|
|
73960
|
+
const efOutput = [];
|
|
73595
73961
|
for (const ef of efNames) {
|
|
73596
73962
|
info(` deploying ${ef}…`);
|
|
73597
73963
|
const workdir = assets.functionsDir.replace(/\/functions$/, "").replace(/\/supabase$/, "");
|
|
@@ -73604,19 +73970,40 @@ Proceed with deployment to Supabase?`, true);
|
|
|
73604
73970
|
}
|
|
73605
73971
|
const r = spawnSync2("npx", args, {
|
|
73606
73972
|
encoding: "utf8",
|
|
73607
|
-
stdio: "inherit",
|
|
73973
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
73608
73974
|
cwd: workdir,
|
|
73609
73975
|
timeout: 120000
|
|
73610
73976
|
});
|
|
73977
|
+
if (r.stdout)
|
|
73978
|
+
process.stdout.write(r.stdout);
|
|
73979
|
+
if (r.stderr)
|
|
73980
|
+
process.stderr.write(r.stderr);
|
|
73611
73981
|
if (r.status === 0)
|
|
73612
73982
|
efOk++;
|
|
73613
|
-
else
|
|
73983
|
+
else {
|
|
73614
73984
|
efFailed.push(ef);
|
|
73985
|
+
efOutput.push(`${r.stdout ?? ""}
|
|
73986
|
+
${r.stderr ?? ""}`);
|
|
73987
|
+
}
|
|
73615
73988
|
}
|
|
73616
73989
|
if (efFailed.length > 0) {
|
|
73617
73990
|
eprintln(c.red(`
|
|
73618
73991
|
✗ ${efFailed.length} Edge Function(s) failed: ${efFailed.join(", ")}`));
|
|
73619
|
-
|
|
73992
|
+
if (upstreamRegistryRace(efOutput.join(`
|
|
73993
|
+
`))) {
|
|
73994
|
+
eprintln("");
|
|
73995
|
+
eprintln(c.yellow(" This looks like an UPSTREAM package-registry race, not a problem"));
|
|
73996
|
+
eprintln(c.yellow(" with your Cerefox install:"));
|
|
73997
|
+
eprintln(c.dim(" The Edge Functions import `jsr:@supabase/supabase-js@2`. When Supabase"));
|
|
73998
|
+
eprintln(c.dim(" publishes a new version, JSR and npm do not land at the same instant;"));
|
|
73999
|
+
eprintln(c.dim(" a deploy in that gap resolves a JSR package whose npm dependency is not"));
|
|
74000
|
+
eprintln(c.dim(" published yet, and bundling fails."));
|
|
74001
|
+
eprintln(c.dim(" Your deployed functions were NOT changed — the previous version is"));
|
|
74002
|
+
eprintln(c.dim(" still serving, so nothing is down."));
|
|
74003
|
+
eprintln(c.cyan(" → Wait a few minutes, then re-run: cerefox server deploy --functions-only"));
|
|
74004
|
+
} else {
|
|
74005
|
+
eprintln(c.dim(" Re-run `cerefox server deploy --functions-only` after fixing the cause."));
|
|
74006
|
+
}
|
|
73620
74007
|
process.exit(1);
|
|
73621
74008
|
}
|
|
73622
74009
|
println(c.green(` ✓ Deployed ${efOk} Edge Function(s).`));
|
|
@@ -73644,6 +74031,9 @@ Proceed with deployment to Supabase?`, true);
|
|
|
73644
74031
|
println(c.dim("Verify with: cerefox doctor"));
|
|
73645
74032
|
println(c.dim("Refresh the bundled guides: cerefox guides ingest"));
|
|
73646
74033
|
}
|
|
74034
|
+
function upstreamRegistryRace(output) {
|
|
74035
|
+
return /Failed to bundle the function/i.test(output) && /Could not find npm package/i.test(output);
|
|
74036
|
+
}
|
|
73647
74037
|
function registerDeployServer(program2) {
|
|
73648
74038
|
program2.command("deploy-server").description("Deploy/update the Cerefox server side (schema + RPCs + Edge Functions) on Supabase.").option("--dry-run", "Print the plan + pre-flight without deploying.").option("--schema-only", "Deploy/update only the schema + RPCs (skip Edge Functions).").option("--functions-only", "Deploy only the Edge Functions (skip the schema/RPCs).").option("--project-ref <ref>", "Supabase project ref for Edge Function deploys (default: derived from CEREFOX_SUPABASE_URL).").option("--yes", "Non-interactive (skip the deployment confirmation).").action(action10);
|
|
73649
74039
|
}
|
|
@@ -80935,11 +81325,10 @@ function registerStatus(program2) {
|
|
|
80935
81325
|
program2.command("status").description("Quick sanity check (fast subset of `cerefox doctor`).").option("--json", "Emit machine-readable JSON.").action(action34);
|
|
80936
81326
|
}
|
|
80937
81327
|
|
|
80938
|
-
// src/cli/commands/
|
|
81328
|
+
// src/cli/commands/api-key.ts
|
|
80939
81329
|
init_cli_core();
|
|
80940
81330
|
init_config();
|
|
80941
81331
|
import { randomBytes } from "node:crypto";
|
|
80942
|
-
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
80943
81332
|
|
|
80944
81333
|
// src/cli/util/env-file.ts
|
|
80945
81334
|
import { copyFileSync as copyFileSync3, existsSync as existsSync14, readFileSync as readFileSync15, writeFileSync as writeFileSync5 } from "node:fs";
|
|
@@ -81004,14 +81393,214 @@ function envGitignoreWarning(path) {
|
|
|
81004
81393
|
}
|
|
81005
81394
|
}
|
|
81006
81395
|
|
|
81396
|
+
// ../../node_modules/.bun/@hono+node-server@2.0.12+19b9adbcbc3b652f/node_modules/@hono/node-server/dist/conninfo.mjs
|
|
81397
|
+
var getConnInfo = (c2) => {
|
|
81398
|
+
const bindings = c2.env.server ? c2.env.server : c2.env;
|
|
81399
|
+
const address = bindings.incoming.socket.remoteAddress;
|
|
81400
|
+
const port = bindings.incoming.socket.remotePort;
|
|
81401
|
+
const family = bindings.incoming.socket.remoteFamily;
|
|
81402
|
+
return { remote: {
|
|
81403
|
+
address,
|
|
81404
|
+
port,
|
|
81405
|
+
addressType: family === "IPv4" ? "IPv4" : family === "IPv6" ? "IPv6" : undefined
|
|
81406
|
+
} };
|
|
81407
|
+
};
|
|
81408
|
+
|
|
81409
|
+
// ../../_shared/mcp-auth/index.ts
|
|
81410
|
+
function constantTimeEqual(a, b2) {
|
|
81411
|
+
const ab = new TextEncoder().encode(a);
|
|
81412
|
+
const bb = new TextEncoder().encode(b2);
|
|
81413
|
+
const len = Math.max(ab.length, bb.length);
|
|
81414
|
+
let diff = ab.length ^ bb.length;
|
|
81415
|
+
for (let i = 0;i < len; i++) {
|
|
81416
|
+
diff |= (ab[i] ?? 0) ^ (bb[i] ?? 0);
|
|
81417
|
+
}
|
|
81418
|
+
return diff === 0;
|
|
81419
|
+
}
|
|
81420
|
+
|
|
81421
|
+
// ../../_shared/ef-auth/index.ts
|
|
81422
|
+
function parseAccessTokens(raw) {
|
|
81423
|
+
if (!raw)
|
|
81424
|
+
return [];
|
|
81425
|
+
return raw.split(",").map((t) => t.trim()).filter((t) => t.length > 0);
|
|
81426
|
+
}
|
|
81427
|
+
var BEARER_PREFIX = "Bearer ";
|
|
81428
|
+
function checkAccessToken(authorizationHeader, config2) {
|
|
81429
|
+
if (!authorizationHeader || !authorizationHeader.startsWith(BEARER_PREFIX)) {
|
|
81430
|
+
return { ok: false, reason: "no_token" };
|
|
81431
|
+
}
|
|
81432
|
+
const token = authorizationHeader.slice(BEARER_PREFIX.length).trim();
|
|
81433
|
+
if (!token)
|
|
81434
|
+
return { ok: false, reason: "no_token" };
|
|
81435
|
+
if (config2.tokens.length === 0) {
|
|
81436
|
+
return {
|
|
81437
|
+
ok: false,
|
|
81438
|
+
reason: "no_tokens_configured",
|
|
81439
|
+
detail: "CEREFOX_ACCESS_TOKENS is unset/empty; refusing to accept-all"
|
|
81440
|
+
};
|
|
81441
|
+
}
|
|
81442
|
+
let matched = false;
|
|
81443
|
+
for (const accepted of config2.tokens) {
|
|
81444
|
+
if (constantTimeEqual(token, accepted))
|
|
81445
|
+
matched = true;
|
|
81446
|
+
}
|
|
81447
|
+
return matched ? { ok: true } : { ok: false, reason: "bad_token" };
|
|
81448
|
+
}
|
|
81449
|
+
|
|
81450
|
+
// src/web/auth.ts
|
|
81451
|
+
var API_KEY_PREFIX = "cfx_lak_";
|
|
81452
|
+
var LOOPBACK_ADDRESSES = new Set([
|
|
81453
|
+
"127.0.0.1",
|
|
81454
|
+
"::1",
|
|
81455
|
+
"::ffff:127.0.0.1"
|
|
81456
|
+
]);
|
|
81457
|
+
function isLoopbackAddress(address) {
|
|
81458
|
+
if (!address)
|
|
81459
|
+
return false;
|
|
81460
|
+
return LOOPBACK_ADDRESSES.has(address.trim().toLowerCase());
|
|
81461
|
+
}
|
|
81462
|
+
function decideAuth(input) {
|
|
81463
|
+
const keys = input.configuredKeys.trim();
|
|
81464
|
+
if (!keys)
|
|
81465
|
+
return { allow: true, reason: "disabled" };
|
|
81466
|
+
const local = isLoopbackAddress(input.remoteAddress);
|
|
81467
|
+
if (local && !input.requireKeyEverywhere) {
|
|
81468
|
+
return { allow: true, reason: "loopback" };
|
|
81469
|
+
}
|
|
81470
|
+
const result = checkAccessToken(input.authorization, {
|
|
81471
|
+
tokens: parseAccessTokens(keys)
|
|
81472
|
+
});
|
|
81473
|
+
if (result.ok)
|
|
81474
|
+
return { allow: true, reason: "valid_key" };
|
|
81475
|
+
if (result.reason === "no_token") {
|
|
81476
|
+
return {
|
|
81477
|
+
allow: false,
|
|
81478
|
+
reason: "no_key",
|
|
81479
|
+
message: local ? "This server requires an API key on every request (CEREFOX_API_REQUIRE_KEY is set). " + "Send it as `Authorization: Bearer <key>`." : "This request did not come from the local machine, so it needs the server's API key " + "as `Authorization: Bearer <key>`. Print it with `cerefox api-key show` " + "(or `cerefox-local api-key` for a container install)."
|
|
81480
|
+
};
|
|
81481
|
+
}
|
|
81482
|
+
return {
|
|
81483
|
+
allow: false,
|
|
81484
|
+
reason: "bad_key",
|
|
81485
|
+
message: "The API key presented is not valid for this server."
|
|
81486
|
+
};
|
|
81487
|
+
}
|
|
81488
|
+
function apiAuth() {
|
|
81489
|
+
return async (c2, next) => {
|
|
81490
|
+
const decision = decideAuth({
|
|
81491
|
+
remoteAddress: remoteAddressOf(c2),
|
|
81492
|
+
authorization: c2.req.header("Authorization") ?? null,
|
|
81493
|
+
configuredKeys: process.env.CEREFOX_API_KEY ?? "",
|
|
81494
|
+
requireKeyEverywhere: (process.env.CEREFOX_API_REQUIRE_KEY ?? "") === "1"
|
|
81495
|
+
});
|
|
81496
|
+
if (decision.allow)
|
|
81497
|
+
return next();
|
|
81498
|
+
return c2.json({ detail: decision.message }, 401, {
|
|
81499
|
+
"WWW-Authenticate": 'Bearer realm="cerefox"'
|
|
81500
|
+
});
|
|
81501
|
+
};
|
|
81502
|
+
}
|
|
81503
|
+
function remoteAddressOf(c2) {
|
|
81504
|
+
try {
|
|
81505
|
+
return getConnInfo(c2).remote.address;
|
|
81506
|
+
} catch {
|
|
81507
|
+
return;
|
|
81508
|
+
}
|
|
81509
|
+
}
|
|
81510
|
+
|
|
81511
|
+
// src/cli/commands/api-key.ts
|
|
81512
|
+
var ENV_NAME = "CEREFOX_API_KEY";
|
|
81513
|
+
function mint() {
|
|
81514
|
+
return API_KEY_PREFIX + randomBytes(32).toString("base64url");
|
|
81515
|
+
}
|
|
81516
|
+
function mask(key) {
|
|
81517
|
+
const body = key.startsWith(API_KEY_PREFIX) ? key.slice(API_KEY_PREFIX.length) : key;
|
|
81518
|
+
if (body.length <= 8)
|
|
81519
|
+
return `${API_KEY_PREFIX}****`;
|
|
81520
|
+
return `${API_KEY_PREFIX}${body.slice(0, 4)}…${body.slice(-4)}`;
|
|
81521
|
+
}
|
|
81522
|
+
function containerHint() {
|
|
81523
|
+
eprintln(c.dim(` Running Cerefox Local (Docker)? This is not the command you want — the
|
|
81524
|
+
` + " container mints its own key at boot. Read it with: cerefox-local api-key"));
|
|
81525
|
+
}
|
|
81526
|
+
function writeKey(key, opts, verb) {
|
|
81527
|
+
const envPath = resolveEnvFile();
|
|
81528
|
+
if (opts.dryRun) {
|
|
81529
|
+
println(c.dim(`DRY-RUN: would ${verb} ${ENV_NAME} in ${envPath}`));
|
|
81530
|
+
return;
|
|
81531
|
+
}
|
|
81532
|
+
const result = upsertEnvVar(envPath, ENV_NAME, key, {
|
|
81533
|
+
noBackup: !opts.backup,
|
|
81534
|
+
comment: "Local API key for /api/v1 + /rest/v1 (cerefox api-key). Never sent to Supabase."
|
|
81535
|
+
});
|
|
81536
|
+
println(` ${result.action} ${c.bold(ENV_NAME)} in ${envPath}`);
|
|
81537
|
+
if (result.backupPath)
|
|
81538
|
+
println(c.dim(` backup: ${result.backupPath}`));
|
|
81539
|
+
println("");
|
|
81540
|
+
println(c.bold(" Your API key (shown once, in full):"));
|
|
81541
|
+
println(` ${c.green(key)}`);
|
|
81542
|
+
println("");
|
|
81543
|
+
println(c.dim(` A caller that is NOT on this machine sends it as:
|
|
81544
|
+
` + ` Authorization: Bearer <key>
|
|
81545
|
+
` + " Callers on this machine (the web UI, local agents) need nothing."));
|
|
81546
|
+
envGitignoreWarning(envPath);
|
|
81547
|
+
}
|
|
81548
|
+
function generateAction(opts) {
|
|
81549
|
+
const envPath = resolveEnvFile();
|
|
81550
|
+
const existing = readEnvVar(envPath, ENV_NAME);
|
|
81551
|
+
if (existing) {
|
|
81552
|
+
throw userError(`${ENV_NAME} is already set in ${envPath} (${mask(existing)}).`, "Use `cerefox api-key show` to see it, or `cerefox api-key rotate` to replace it. " + "Refusing to overwrite silently: any client already configured with the old key " + "would start getting 401s with no indication why.");
|
|
81553
|
+
}
|
|
81554
|
+
println(c.bold("Minting a local API key"));
|
|
81555
|
+
writeKey(mint(), opts, "write");
|
|
81556
|
+
containerHint();
|
|
81557
|
+
}
|
|
81558
|
+
function rotateAction(opts) {
|
|
81559
|
+
const envPath = resolveEnvFile();
|
|
81560
|
+
const existing = readEnvVar(envPath, ENV_NAME);
|
|
81561
|
+
if (!existing) {
|
|
81562
|
+
throw userError(`No ${ENV_NAME} in ${envPath} — nothing to rotate.`, "Run `cerefox api-key generate` first.");
|
|
81563
|
+
}
|
|
81564
|
+
println(c.bold("Rotating the local API key"));
|
|
81565
|
+
println(c.dim(` replacing ${mask(existing)}`));
|
|
81566
|
+
writeKey(mint(), opts, "replace");
|
|
81567
|
+
println(c.yellow(` The previous key stops working as soon as the server restarts.
|
|
81568
|
+
` + " Update every remote client, then: cerefox web restart"));
|
|
81569
|
+
}
|
|
81570
|
+
function showAction2() {
|
|
81571
|
+
const envPath = resolveEnvFile();
|
|
81572
|
+
const key = readEnvVar(envPath, ENV_NAME);
|
|
81573
|
+
println(c.bold("Local API key"));
|
|
81574
|
+
if (!key) {
|
|
81575
|
+
println(c.dim(` none set in ${envPath}`));
|
|
81576
|
+
println(c.dim(` The server is not gated: callers from any interface it is bound to can
|
|
81577
|
+
` + ` reach it without a credential. That is fine while it binds 127.0.0.1.
|
|
81578
|
+
` + " Mint one with: cerefox api-key generate"));
|
|
81579
|
+
containerHint();
|
|
81580
|
+
return;
|
|
81581
|
+
}
|
|
81582
|
+
println(` ${c.green(key)} ${c.dim(`(${ENV_NAME} in ${envPath})`)}`);
|
|
81583
|
+
println(c.dim(" Remote callers send: Authorization: Bearer <key>"));
|
|
81584
|
+
}
|
|
81585
|
+
function registerApiKey(program2) {
|
|
81586
|
+
const group = program2.command("api-key").description("Manage the local API key for /api/v1 (loopback callers need none).");
|
|
81587
|
+
group.command("generate").description("Mint a local API key and write it to .env. Refuses if one exists.").option("--no-backup", "Skip the .pre-cerefox.bak backup of an existing .env.").option("--dry-run", "Print the plan without minting or writing anything.").action(generateAction);
|
|
81588
|
+
group.command("rotate").description("Replace the existing key. Remote clients must be updated.").option("--no-backup", "Skip the .pre-cerefox.bak backup of an existing .env.").option("--dry-run", "Print the plan without minting or writing anything.").action(rotateAction);
|
|
81589
|
+
group.command("show").description("Print the local API key, in full, for pasting into a client.").action(showAction2);
|
|
81590
|
+
}
|
|
81591
|
+
|
|
81007
81592
|
// src/cli/commands/token.ts
|
|
81593
|
+
init_cli_core();
|
|
81594
|
+
init_config();
|
|
81595
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
81596
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
81008
81597
|
var SECRET_NAME = "CEREFOX_ACCESS_TOKENS";
|
|
81009
81598
|
var LOCAL_NAME = "CEREFOX_ACCESS_TOKEN";
|
|
81010
81599
|
var PREFIX = "cfx_pat_";
|
|
81011
81600
|
function mintToken() {
|
|
81012
|
-
return PREFIX +
|
|
81601
|
+
return PREFIX + randomBytes2(32).toString("base64url");
|
|
81013
81602
|
}
|
|
81014
|
-
function
|
|
81603
|
+
function mask2(token) {
|
|
81015
81604
|
return token.length <= 16 ? "…" : `${token.slice(0, PREFIX.length + 4)}…${token.slice(-4)}`;
|
|
81016
81605
|
}
|
|
81017
81606
|
function parseProjectRef2(supabaseUrl) {
|
|
@@ -81029,7 +81618,7 @@ function setSecret(setValue, projectRef, dryRun) {
|
|
|
81029
81618
|
if (projectRef)
|
|
81030
81619
|
args.push("--project-ref", projectRef);
|
|
81031
81620
|
if (dryRun) {
|
|
81032
|
-
const shown = setValue.split(",").map(
|
|
81621
|
+
const shown = setValue.split(",").map(mask2).join(",");
|
|
81033
81622
|
println(c.dim(` (dry-run) npx supabase secrets set ${SECRET_NAME}=${shown}` + (projectRef ? ` --project-ref ${projectRef}` : "")));
|
|
81034
81623
|
return;
|
|
81035
81624
|
}
|
|
@@ -81069,7 +81658,7 @@ function printTokenOnce(token) {
|
|
|
81069
81658
|
println(c.dim(" If the GPT Actions schema changed this release, re-paste it too"));
|
|
81070
81659
|
println(c.dim(" (see docs/guides/connect-agents.md). Lose the token → `cerefox token rotate`."));
|
|
81071
81660
|
}
|
|
81072
|
-
function
|
|
81661
|
+
function generateAction2(opts) {
|
|
81073
81662
|
const projectRef = opts.projectRef ?? parseProjectRef2(loadSettings().supabaseUrl);
|
|
81074
81663
|
const token = mintToken();
|
|
81075
81664
|
println(c.bold("Generating a Cerefox access token…"));
|
|
@@ -81078,7 +81667,7 @@ function generateAction(opts) {
|
|
|
81078
81667
|
if (!opts.dryRun)
|
|
81079
81668
|
printTokenOnce(token);
|
|
81080
81669
|
}
|
|
81081
|
-
function
|
|
81670
|
+
function rotateAction2(opts) {
|
|
81082
81671
|
const projectRef = opts.projectRef ?? parseProjectRef2(loadSettings().supabaseUrl);
|
|
81083
81672
|
const envPath = resolveEnvFile();
|
|
81084
81673
|
const current = readEnvVar(envPath, LOCAL_NAME);
|
|
@@ -81108,14 +81697,14 @@ function listAction2() {
|
|
|
81108
81697
|
const envPath = resolveEnvFile();
|
|
81109
81698
|
const local = readEnvVar(envPath, LOCAL_NAME);
|
|
81110
81699
|
println(c.bold("Cerefox access token"));
|
|
81111
|
-
println(local ? ` local (${LOCAL_NAME} in ${envPath}): ${c.green(
|
|
81700
|
+
println(local ? ` local (${LOCAL_NAME} in ${envPath}): ${c.green(mask2(local))}` : c.dim(` no ${LOCAL_NAME} in ${envPath} — run \`cerefox token generate\``));
|
|
81112
81701
|
println(c.dim(` The server-side accepted set (${SECRET_NAME}) is write-only; list names/digests
|
|
81113
81702
|
` + " with: npx supabase secrets list"));
|
|
81114
81703
|
}
|
|
81115
81704
|
function registerToken(program2) {
|
|
81116
81705
|
const token = program2.command("token").description("Manage the Cerefox Edge Function access token(s).");
|
|
81117
|
-
token.command("generate").description("Mint a token, set the Supabase secret, and write it to .env.").option("--project-ref <ref>", "Supabase project ref (default: derived from CEREFOX_SUPABASE_URL).").option("--no-env", "Do not write CEREFOX_ACCESS_TOKEN to .env.").option("--no-backup", "Skip the .pre-cerefox.bak backup of an existing .env.").option("--dry-run", "Print the plan without minting or writing anything.").action(
|
|
81118
|
-
token.command("rotate").description("Mint a new token accepted alongside the old (zero-downtime); --finalize drops the old.").option("--finalize", "Stop accepting the previous token (run after clients migrate).").option("--project-ref <ref>", "Supabase project ref (default: derived from CEREFOX_SUPABASE_URL).").option("--no-env", "Do not write CEREFOX_ACCESS_TOKEN to .env.").option("--no-backup", "Skip the .pre-cerefox.bak backup of an existing .env.").option("--dry-run", "Print the plan without minting or writing anything.").action(
|
|
81706
|
+
token.command("generate").description("Mint a token, set the Supabase secret, and write it to .env.").option("--project-ref <ref>", "Supabase project ref (default: derived from CEREFOX_SUPABASE_URL).").option("--no-env", "Do not write CEREFOX_ACCESS_TOKEN to .env.").option("--no-backup", "Skip the .pre-cerefox.bak backup of an existing .env.").option("--dry-run", "Print the plan without minting or writing anything.").action(generateAction2);
|
|
81707
|
+
token.command("rotate").description("Mint a new token accepted alongside the old (zero-downtime); --finalize drops the old.").option("--finalize", "Stop accepting the previous token (run after clients migrate).").option("--project-ref <ref>", "Supabase project ref (default: derived from CEREFOX_SUPABASE_URL).").option("--no-env", "Do not write CEREFOX_ACCESS_TOKEN to .env.").option("--no-backup", "Skip the .pre-cerefox.bak backup of an existing .env.").option("--dry-run", "Print the plan without minting or writing anything.").action(rotateAction2);
|
|
81119
81708
|
token.command("list").description("Show the local token (masked) and where the server-side set lives.").action(listAction2);
|
|
81120
81709
|
}
|
|
81121
81710
|
|
|
@@ -85777,7 +86366,22 @@ function registerDocumentWriteRoutes(app, ctx) {
|
|
|
85777
86366
|
}
|
|
85778
86367
|
// src/web/routes/ingest.ts
|
|
85779
86368
|
function notReady(error3) {
|
|
85780
|
-
return { success: false, error: error3 };
|
|
86369
|
+
return { success: false, error: error3, detail: error3 };
|
|
86370
|
+
}
|
|
86371
|
+
function ingestFailure(err) {
|
|
86372
|
+
if (err instanceof ConcurrencyConflictError) {
|
|
86373
|
+
return [
|
|
86374
|
+
{
|
|
86375
|
+
...notReady(err.message),
|
|
86376
|
+
...err.currentHash ? { current_hash: err.currentHash } : {}
|
|
86377
|
+
},
|
|
86378
|
+
409
|
|
86379
|
+
];
|
|
86380
|
+
}
|
|
86381
|
+
if (err instanceof ConcurrencyTokenRequiredError) {
|
|
86382
|
+
return [notReady(err.message), 400];
|
|
86383
|
+
}
|
|
86384
|
+
return [notReady(err instanceof Error ? err.message : String(err)), 500];
|
|
85781
86385
|
}
|
|
85782
86386
|
function registerIngestRoutes(app, ctx) {
|
|
85783
86387
|
app.post("/api/v1/ingest", async (c2) => {
|
|
@@ -85833,7 +86437,8 @@ function registerIngestRoutes(app, ctx) {
|
|
|
85833
86437
|
});
|
|
85834
86438
|
return c2.json(resp, 200);
|
|
85835
86439
|
} catch (err) {
|
|
85836
|
-
|
|
86440
|
+
const [body2, status] = ingestFailure(err);
|
|
86441
|
+
return c2.json(body2, status);
|
|
85837
86442
|
}
|
|
85838
86443
|
});
|
|
85839
86444
|
app.post("/api/v1/ingest/file", async (c2) => {
|
|
@@ -85904,7 +86509,8 @@ function registerIngestRoutes(app, ctx) {
|
|
|
85904
86509
|
...result.note ? { note: result.note } : {}
|
|
85905
86510
|
}, 200);
|
|
85906
86511
|
} catch (err) {
|
|
85907
|
-
|
|
86512
|
+
const [body, status] = ingestFailure(err);
|
|
86513
|
+
return c2.json(body, status);
|
|
85908
86514
|
}
|
|
85909
86515
|
});
|
|
85910
86516
|
app.post("/api/v1/documents/:document_id/upload", async (c2) => {
|
|
@@ -85962,7 +86568,8 @@ function registerIngestRoutes(app, ctx) {
|
|
|
85962
86568
|
updated: result.reindexed
|
|
85963
86569
|
}, 200);
|
|
85964
86570
|
} catch (err) {
|
|
85965
|
-
|
|
86571
|
+
const [body, status] = ingestFailure(err);
|
|
86572
|
+
return c2.json(body, status);
|
|
85966
86573
|
}
|
|
85967
86574
|
});
|
|
85968
86575
|
}
|
|
@@ -86473,6 +87080,8 @@ function buildApp(ctx = buildWebContext()) {
|
|
|
86473
87080
|
if (true) {
|
|
86474
87081
|
app.use(logger((message, ...rest) => console.log(`${localTimestamp()} ${message}`, ...rest)));
|
|
86475
87082
|
}
|
|
87083
|
+
app.use("/api/v1/*", apiAuth());
|
|
87084
|
+
app.use("/rest/v1/*", apiAuth());
|
|
86476
87085
|
registerMetaRoutes(app, ctx);
|
|
86477
87086
|
registerPreferencesRoutes(app);
|
|
86478
87087
|
if (ctx) {
|
|
@@ -86555,6 +87164,14 @@ async function buildWebServer(options = {}) {
|
|
|
86555
87164
|
const host = options.host ?? "127.0.0.1";
|
|
86556
87165
|
const port = options.port ?? 8000;
|
|
86557
87166
|
await assertServerCompatible();
|
|
87167
|
+
if (!isLoopbackAddress(host) && !(process.env.CEREFOX_API_KEY ?? "").trim()) {
|
|
87168
|
+
console.warn(`
|
|
87169
|
+
⚠ Binding ${host} with NO API key configured.
|
|
87170
|
+
` + ` Every read, write, delete and purge on this server is reachable by
|
|
87171
|
+
` + ` anything that can connect to port ${port}, with no credential.
|
|
87172
|
+
` + ` Mint one: cerefox api-key generate
|
|
87173
|
+
`);
|
|
87174
|
+
}
|
|
86558
87175
|
const app = buildApp();
|
|
86559
87176
|
const server = serve({ fetch: app.fetch, hostname: host, port });
|
|
86560
87177
|
return {
|
|
@@ -86929,6 +87546,7 @@ Learn more:
|
|
|
86929
87546
|
registerWeb(program2);
|
|
86930
87547
|
registerCompletion(program2);
|
|
86931
87548
|
registerToken(program2);
|
|
87549
|
+
registerApiKey(program2);
|
|
86932
87550
|
const document2 = program2.command("document").description("Documents: get, list, edit, delete, restore, ingest, ingest-dir, version.");
|
|
86933
87551
|
moveInto(document2, registerGetDoc, "get");
|
|
86934
87552
|
moveInto(document2, registerListDocs, "list");
|