@typicalday/firegraph 0.5.0 → 0.7.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.
@@ -1295,8 +1295,8 @@ var require_node = __commonJS({
1295
1295
  }
1296
1296
  break;
1297
1297
  case "FILE":
1298
- var fs2 = __require("fs");
1299
- stream2 = new fs2.SyncWriteStream(fd2, { autoClose: false });
1298
+ var fs3 = __require("fs");
1299
+ stream2 = new fs3.SyncWriteStream(fd2, { autoClose: false });
1300
1300
  stream2._type = "fs";
1301
1301
  break;
1302
1302
  case "PIPE":
@@ -14083,11 +14083,11 @@ var require_mime_types = __commonJS({
14083
14083
  }
14084
14084
  return exts[0];
14085
14085
  }
14086
- function lookup(path4) {
14087
- if (!path4 || typeof path4 !== "string") {
14086
+ function lookup(path5) {
14087
+ if (!path5 || typeof path5 !== "string") {
14088
14088
  return false;
14089
14089
  }
14090
- var extension2 = extname("x." + path4).toLowerCase().substr(1);
14090
+ var extension2 = extname("x." + path5).toLowerCase().substr(1);
14091
14091
  if (!extension2) {
14092
14092
  return false;
14093
14093
  }
@@ -17602,7 +17602,7 @@ var require_path_to_regexp = __commonJS({
17602
17602
  "editor/node_modules/.pnpm/path-to-regexp@0.1.12/node_modules/path-to-regexp/index.js"(exports, module) {
17603
17603
  module.exports = pathToRegexp;
17604
17604
  var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
17605
- function pathToRegexp(path4, keys, options) {
17605
+ function pathToRegexp(path5, keys, options) {
17606
17606
  options = options || {};
17607
17607
  keys = keys || [];
17608
17608
  var strict = options.strict;
@@ -17616,8 +17616,8 @@ var require_path_to_regexp = __commonJS({
17616
17616
  var pos = 0;
17617
17617
  var backtrack = "";
17618
17618
  var m;
17619
- if (path4 instanceof RegExp) {
17620
- while (m = MATCHING_GROUP_REGEXP.exec(path4.source)) {
17619
+ if (path5 instanceof RegExp) {
17620
+ while (m = MATCHING_GROUP_REGEXP.exec(path5.source)) {
17621
17621
  if (m[0][0] === "\\") continue;
17622
17622
  keys.push({
17623
17623
  name: m[1] || name++,
@@ -17625,18 +17625,18 @@ var require_path_to_regexp = __commonJS({
17625
17625
  offset: m.index
17626
17626
  });
17627
17627
  }
17628
- return path4;
17628
+ return path5;
17629
17629
  }
17630
- if (Array.isArray(path4)) {
17631
- path4 = path4.map(function(value) {
17630
+ if (Array.isArray(path5)) {
17631
+ path5 = path5.map(function(value) {
17632
17632
  return pathToRegexp(value, keys, options).source;
17633
17633
  });
17634
- return new RegExp(path4.join("|"), flags);
17634
+ return new RegExp(path5.join("|"), flags);
17635
17635
  }
17636
- if (typeof path4 !== "string") {
17636
+ if (typeof path5 !== "string") {
17637
17637
  throw new TypeError("path must be a string, array of strings, or regular expression");
17638
17638
  }
17639
- path4 = path4.replace(
17639
+ path5 = path5.replace(
17640
17640
  /\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
17641
17641
  function(match, slash, format, key, capture, star, optional2, offset) {
17642
17642
  if (match[0] === "\\") {
@@ -17653,7 +17653,7 @@ var require_path_to_regexp = __commonJS({
17653
17653
  if (slash || format) {
17654
17654
  backtrack = "";
17655
17655
  } else {
17656
- backtrack += path4.slice(pos, offset);
17656
+ backtrack += path5.slice(pos, offset);
17657
17657
  }
17658
17658
  pos = offset + match.length;
17659
17659
  if (match === "*") {
@@ -17681,7 +17681,7 @@ var require_path_to_regexp = __commonJS({
17681
17681
  return result;
17682
17682
  }
17683
17683
  );
17684
- while (m = MATCHING_GROUP_REGEXP.exec(path4)) {
17684
+ while (m = MATCHING_GROUP_REGEXP.exec(path5)) {
17685
17685
  if (m[0][0] === "\\") continue;
17686
17686
  if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
17687
17687
  keys.splice(keysOffset + i, 0, {
@@ -17693,13 +17693,13 @@ var require_path_to_regexp = __commonJS({
17693
17693
  }
17694
17694
  i++;
17695
17695
  }
17696
- path4 += strict ? "" : path4[path4.length - 1] === "/" ? "?" : "/?";
17696
+ path5 += strict ? "" : path5[path5.length - 1] === "/" ? "?" : "/?";
17697
17697
  if (end) {
17698
- path4 += "$";
17699
- } else if (path4[path4.length - 1] !== "/") {
17700
- path4 += lookahead ? "(?=/|$)" : "(?:/|$)";
17698
+ path5 += "$";
17699
+ } else if (path5[path5.length - 1] !== "/") {
17700
+ path5 += lookahead ? "(?=/|$)" : "(?:/|$)";
17701
17701
  }
17702
- return new RegExp("^" + path4, flags);
17702
+ return new RegExp("^" + path5, flags);
17703
17703
  }
17704
17704
  }
17705
17705
  });
@@ -17712,19 +17712,19 @@ var require_layer = __commonJS({
17712
17712
  var debug = require_src()("express:router:layer");
17713
17713
  var hasOwnProperty = Object.prototype.hasOwnProperty;
17714
17714
  module.exports = Layer;
17715
- function Layer(path4, options, fn) {
17715
+ function Layer(path5, options, fn) {
17716
17716
  if (!(this instanceof Layer)) {
17717
- return new Layer(path4, options, fn);
17717
+ return new Layer(path5, options, fn);
17718
17718
  }
17719
- debug("new %o", path4);
17719
+ debug("new %o", path5);
17720
17720
  var opts = options || {};
17721
17721
  this.handle = fn;
17722
17722
  this.name = fn.name || "<anonymous>";
17723
17723
  this.params = void 0;
17724
17724
  this.path = void 0;
17725
- this.regexp = pathRegexp(path4, this.keys = [], opts);
17726
- this.regexp.fast_star = path4 === "*";
17727
- this.regexp.fast_slash = path4 === "/" && opts.end === false;
17725
+ this.regexp = pathRegexp(path5, this.keys = [], opts);
17726
+ this.regexp.fast_star = path5 === "*";
17727
+ this.regexp.fast_slash = path5 === "/" && opts.end === false;
17728
17728
  }
17729
17729
  Layer.prototype.handle_error = function handle_error(error48, req, res, next) {
17730
17730
  var fn = this.handle;
@@ -17748,20 +17748,20 @@ var require_layer = __commonJS({
17748
17748
  next(err);
17749
17749
  }
17750
17750
  };
17751
- Layer.prototype.match = function match(path4) {
17751
+ Layer.prototype.match = function match(path5) {
17752
17752
  var match2;
17753
- if (path4 != null) {
17753
+ if (path5 != null) {
17754
17754
  if (this.regexp.fast_slash) {
17755
17755
  this.params = {};
17756
17756
  this.path = "";
17757
17757
  return true;
17758
17758
  }
17759
17759
  if (this.regexp.fast_star) {
17760
- this.params = { "0": decode_param(path4) };
17761
- this.path = path4;
17760
+ this.params = { "0": decode_param(path5) };
17761
+ this.path = path5;
17762
17762
  return true;
17763
17763
  }
17764
- match2 = this.regexp.exec(path4);
17764
+ match2 = this.regexp.exec(path5);
17765
17765
  }
17766
17766
  if (!match2) {
17767
17767
  this.params = void 0;
@@ -17854,10 +17854,10 @@ var require_route = __commonJS({
17854
17854
  var slice = Array.prototype.slice;
17855
17855
  var toString = Object.prototype.toString;
17856
17856
  module.exports = Route;
17857
- function Route(path4) {
17858
- this.path = path4;
17857
+ function Route(path5) {
17858
+ this.path = path5;
17859
17859
  this.stack = [];
17860
- debug("new %o", path4);
17860
+ debug("new %o", path5);
17861
17861
  this.methods = {};
17862
17862
  }
17863
17863
  Route.prototype._handles_method = function _handles_method(method) {
@@ -18069,8 +18069,8 @@ var require_router = __commonJS({
18069
18069
  if (++sync > 100) {
18070
18070
  return setImmediate(next, err);
18071
18071
  }
18072
- var path4 = getPathname(req);
18073
- if (path4 == null) {
18072
+ var path5 = getPathname(req);
18073
+ if (path5 == null) {
18074
18074
  return done(layerError);
18075
18075
  }
18076
18076
  var layer;
@@ -18078,7 +18078,7 @@ var require_router = __commonJS({
18078
18078
  var route;
18079
18079
  while (match !== true && idx < stack.length) {
18080
18080
  layer = stack[idx++];
18081
- match = matchLayer(layer, path4);
18081
+ match = matchLayer(layer, path5);
18082
18082
  route = layer.route;
18083
18083
  if (typeof match !== "boolean") {
18084
18084
  layerError = layerError || match;
@@ -18116,18 +18116,18 @@ var require_router = __commonJS({
18116
18116
  } else if (route) {
18117
18117
  layer.handle_request(req, res, next);
18118
18118
  } else {
18119
- trim_prefix(layer, layerError, layerPath, path4);
18119
+ trim_prefix(layer, layerError, layerPath, path5);
18120
18120
  }
18121
18121
  sync = 0;
18122
18122
  });
18123
18123
  }
18124
- function trim_prefix(layer, layerError, layerPath, path4) {
18124
+ function trim_prefix(layer, layerError, layerPath, path5) {
18125
18125
  if (layerPath.length !== 0) {
18126
- if (layerPath !== path4.slice(0, layerPath.length)) {
18126
+ if (layerPath !== path5.slice(0, layerPath.length)) {
18127
18127
  next(layerError);
18128
18128
  return;
18129
18129
  }
18130
- var c = path4[layerPath.length];
18130
+ var c = path5[layerPath.length];
18131
18131
  if (c && c !== "/" && c !== ".") return next(layerError);
18132
18132
  debug("trim prefix (%s) from url %s", layerPath, req.url);
18133
18133
  removed = layerPath;
@@ -18205,7 +18205,7 @@ var require_router = __commonJS({
18205
18205
  };
18206
18206
  proto.use = function use(fn) {
18207
18207
  var offset = 0;
18208
- var path4 = "/";
18208
+ var path5 = "/";
18209
18209
  if (typeof fn !== "function") {
18210
18210
  var arg = fn;
18211
18211
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -18213,7 +18213,7 @@ var require_router = __commonJS({
18213
18213
  }
18214
18214
  if (typeof arg !== "function") {
18215
18215
  offset = 1;
18216
- path4 = fn;
18216
+ path5 = fn;
18217
18217
  }
18218
18218
  }
18219
18219
  var callbacks = flatten(slice.call(arguments, offset));
@@ -18225,8 +18225,8 @@ var require_router = __commonJS({
18225
18225
  if (typeof fn !== "function") {
18226
18226
  throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
18227
18227
  }
18228
- debug("use %o %s", path4, fn.name || "<anonymous>");
18229
- var layer = new Layer(path4, {
18228
+ debug("use %o %s", path5, fn.name || "<anonymous>");
18229
+ var layer = new Layer(path5, {
18230
18230
  sensitive: this.caseSensitive,
18231
18231
  strict: false,
18232
18232
  end: false
@@ -18236,9 +18236,9 @@ var require_router = __commonJS({
18236
18236
  }
18237
18237
  return this;
18238
18238
  };
18239
- proto.route = function route(path4) {
18240
- var route2 = new Route(path4);
18241
- var layer = new Layer(path4, {
18239
+ proto.route = function route(path5) {
18240
+ var route2 = new Route(path5);
18241
+ var layer = new Layer(path5, {
18242
18242
  sensitive: this.caseSensitive,
18243
18243
  strict: this.strict,
18244
18244
  end: true
@@ -18248,8 +18248,8 @@ var require_router = __commonJS({
18248
18248
  return route2;
18249
18249
  };
18250
18250
  methods.concat("all").forEach(function(method) {
18251
- proto[method] = function(path4) {
18252
- var route = this.route(path4);
18251
+ proto[method] = function(path5) {
18252
+ var route = this.route(path5);
18253
18253
  route[method].apply(route, slice.call(arguments, 1));
18254
18254
  return this;
18255
18255
  };
@@ -18285,9 +18285,9 @@ var require_router = __commonJS({
18285
18285
  }
18286
18286
  return toString.call(obj).replace(objectRegExp, "$1");
18287
18287
  }
18288
- function matchLayer(layer, path4) {
18288
+ function matchLayer(layer, path5) {
18289
18289
  try {
18290
- return layer.match(path4);
18290
+ return layer.match(path5);
18291
18291
  } catch (err) {
18292
18292
  return err;
18293
18293
  }
@@ -18405,13 +18405,13 @@ var require_view = __commonJS({
18405
18405
  "editor/node_modules/.pnpm/express@4.22.1/node_modules/express/lib/view.js"(exports, module) {
18406
18406
  "use strict";
18407
18407
  var debug = require_src()("express:view");
18408
- var path4 = __require("path");
18409
- var fs2 = __require("fs");
18410
- var dirname = path4.dirname;
18411
- var basename = path4.basename;
18412
- var extname = path4.extname;
18413
- var join3 = path4.join;
18414
- var resolve2 = path4.resolve;
18408
+ var path5 = __require("path");
18409
+ var fs3 = __require("fs");
18410
+ var dirname = path5.dirname;
18411
+ var basename = path5.basename;
18412
+ var extname = path5.extname;
18413
+ var join3 = path5.join;
18414
+ var resolve2 = path5.resolve;
18415
18415
  module.exports = View;
18416
18416
  function View(name, options) {
18417
18417
  var opts = options || {};
@@ -18440,17 +18440,17 @@ var require_view = __commonJS({
18440
18440
  this.path = this.lookup(fileName);
18441
18441
  }
18442
18442
  View.prototype.lookup = function lookup(name) {
18443
- var path5;
18443
+ var path6;
18444
18444
  var roots = [].concat(this.root);
18445
18445
  debug('lookup "%s"', name);
18446
- for (var i = 0; i < roots.length && !path5; i++) {
18446
+ for (var i = 0; i < roots.length && !path6; i++) {
18447
18447
  var root = roots[i];
18448
18448
  var loc = resolve2(root, name);
18449
18449
  var dir = dirname(loc);
18450
18450
  var file2 = basename(loc);
18451
- path5 = this.resolve(dir, file2);
18451
+ path6 = this.resolve(dir, file2);
18452
18452
  }
18453
- return path5;
18453
+ return path6;
18454
18454
  };
18455
18455
  View.prototype.render = function render(options, callback) {
18456
18456
  debug('render "%s"', this.path);
@@ -18458,21 +18458,21 @@ var require_view = __commonJS({
18458
18458
  };
18459
18459
  View.prototype.resolve = function resolve3(dir, file2) {
18460
18460
  var ext = this.ext;
18461
- var path5 = join3(dir, file2);
18462
- var stat = tryStat(path5);
18461
+ var path6 = join3(dir, file2);
18462
+ var stat = tryStat(path6);
18463
18463
  if (stat && stat.isFile()) {
18464
- return path5;
18464
+ return path6;
18465
18465
  }
18466
- path5 = join3(dir, basename(file2, ext), "index" + ext);
18467
- stat = tryStat(path5);
18466
+ path6 = join3(dir, basename(file2, ext), "index" + ext);
18467
+ stat = tryStat(path6);
18468
18468
  if (stat && stat.isFile()) {
18469
- return path5;
18469
+ return path6;
18470
18470
  }
18471
18471
  };
18472
- function tryStat(path5) {
18473
- debug('stat "%s"', path5);
18472
+ function tryStat(path6) {
18473
+ debug('stat "%s"', path6);
18474
18474
  try {
18475
- return fs2.statSync(path5);
18475
+ return fs3.statSync(path6);
18476
18476
  } catch (e) {
18477
18477
  return void 0;
18478
18478
  }
@@ -18826,8 +18826,8 @@ var require_types = __commonJS({
18826
18826
  // editor/node_modules/.pnpm/mime@1.6.0/node_modules/mime/mime.js
18827
18827
  var require_mime = __commonJS({
18828
18828
  "editor/node_modules/.pnpm/mime@1.6.0/node_modules/mime/mime.js"(exports, module) {
18829
- var path4 = __require("path");
18830
- var fs2 = __require("fs");
18829
+ var path5 = __require("path");
18830
+ var fs3 = __require("fs");
18831
18831
  function Mime() {
18832
18832
  this.types = /* @__PURE__ */ Object.create(null);
18833
18833
  this.extensions = /* @__PURE__ */ Object.create(null);
@@ -18848,7 +18848,7 @@ var require_mime = __commonJS({
18848
18848
  };
18849
18849
  Mime.prototype.load = function(file2) {
18850
18850
  this._loading = file2;
18851
- var map2 = {}, content = fs2.readFileSync(file2, "ascii"), lines = content.split(/[\r\n]+/);
18851
+ var map2 = {}, content = fs3.readFileSync(file2, "ascii"), lines = content.split(/[\r\n]+/);
18852
18852
  lines.forEach(function(line) {
18853
18853
  var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
18854
18854
  map2[fields.shift()] = fields;
@@ -18856,8 +18856,8 @@ var require_mime = __commonJS({
18856
18856
  this.define(map2);
18857
18857
  this._loading = null;
18858
18858
  };
18859
- Mime.prototype.lookup = function(path5, fallback) {
18860
- var ext = path5.replace(/^.*[\.\/\\]/, "").toLowerCase();
18859
+ Mime.prototype.lookup = function(path6, fallback) {
18860
+ var ext = path6.replace(/^.*[\.\/\\]/, "").toLowerCase();
18861
18861
  return this.types[ext] || fallback || this.default_type;
18862
18862
  };
18863
18863
  Mime.prototype.extension = function(mimeType) {
@@ -19086,33 +19086,33 @@ var require_send = __commonJS({
19086
19086
  var escapeHtml = require_escape_html();
19087
19087
  var etag = require_etag();
19088
19088
  var fresh = require_fresh();
19089
- var fs2 = __require("fs");
19089
+ var fs3 = __require("fs");
19090
19090
  var mime = require_mime();
19091
19091
  var ms = require_ms2();
19092
19092
  var onFinished = require_on_finished();
19093
19093
  var parseRange = require_range_parser();
19094
- var path4 = __require("path");
19094
+ var path5 = __require("path");
19095
19095
  var statuses = require_statuses();
19096
19096
  var Stream = __require("stream");
19097
19097
  var util = __require("util");
19098
- var extname = path4.extname;
19099
- var join3 = path4.join;
19100
- var normalize = path4.normalize;
19101
- var resolve2 = path4.resolve;
19102
- var sep = path4.sep;
19098
+ var extname = path5.extname;
19099
+ var join3 = path5.join;
19100
+ var normalize = path5.normalize;
19101
+ var resolve2 = path5.resolve;
19102
+ var sep = path5.sep;
19103
19103
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
19104
19104
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
19105
19105
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
19106
19106
  module.exports = send;
19107
19107
  module.exports.mime = mime;
19108
- function send(req, path5, options) {
19109
- return new SendStream(req, path5, options);
19108
+ function send(req, path6, options) {
19109
+ return new SendStream(req, path6, options);
19110
19110
  }
19111
- function SendStream(req, path5, options) {
19111
+ function SendStream(req, path6, options) {
19112
19112
  Stream.call(this);
19113
19113
  var opts = options || {};
19114
19114
  this.options = opts;
19115
- this.path = path5;
19115
+ this.path = path6;
19116
19116
  this.req = req;
19117
19117
  this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
19118
19118
  this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
@@ -19158,8 +19158,8 @@ var require_send = __commonJS({
19158
19158
  this._index = index2;
19159
19159
  return this;
19160
19160
  }, "send.index: pass index as option");
19161
- SendStream.prototype.root = function root(path5) {
19162
- this._root = resolve2(String(path5));
19161
+ SendStream.prototype.root = function root(path6) {
19162
+ this._root = resolve2(String(path6));
19163
19163
  debug("root %s", this._root);
19164
19164
  return this;
19165
19165
  };
@@ -19272,10 +19272,10 @@ var require_send = __commonJS({
19272
19272
  var lastModified = this.res.getHeader("Last-Modified");
19273
19273
  return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
19274
19274
  };
19275
- SendStream.prototype.redirect = function redirect(path5) {
19275
+ SendStream.prototype.redirect = function redirect(path6) {
19276
19276
  var res = this.res;
19277
19277
  if (hasListeners(this, "directory")) {
19278
- this.emit("directory", res, path5);
19278
+ this.emit("directory", res, path6);
19279
19279
  return;
19280
19280
  }
19281
19281
  if (this.hasTrailingSlash()) {
@@ -19295,42 +19295,42 @@ var require_send = __commonJS({
19295
19295
  SendStream.prototype.pipe = function pipe2(res) {
19296
19296
  var root = this._root;
19297
19297
  this.res = res;
19298
- var path5 = decode3(this.path);
19299
- if (path5 === -1) {
19298
+ var path6 = decode3(this.path);
19299
+ if (path6 === -1) {
19300
19300
  this.error(400);
19301
19301
  return res;
19302
19302
  }
19303
- if (~path5.indexOf("\0")) {
19303
+ if (~path6.indexOf("\0")) {
19304
19304
  this.error(400);
19305
19305
  return res;
19306
19306
  }
19307
19307
  var parts;
19308
19308
  if (root !== null) {
19309
- if (path5) {
19310
- path5 = normalize("." + sep + path5);
19309
+ if (path6) {
19310
+ path6 = normalize("." + sep + path6);
19311
19311
  }
19312
- if (UP_PATH_REGEXP.test(path5)) {
19313
- debug('malicious path "%s"', path5);
19312
+ if (UP_PATH_REGEXP.test(path6)) {
19313
+ debug('malicious path "%s"', path6);
19314
19314
  this.error(403);
19315
19315
  return res;
19316
19316
  }
19317
- parts = path5.split(sep);
19318
- path5 = normalize(join3(root, path5));
19317
+ parts = path6.split(sep);
19318
+ path6 = normalize(join3(root, path6));
19319
19319
  } else {
19320
- if (UP_PATH_REGEXP.test(path5)) {
19321
- debug('malicious path "%s"', path5);
19320
+ if (UP_PATH_REGEXP.test(path6)) {
19321
+ debug('malicious path "%s"', path6);
19322
19322
  this.error(403);
19323
19323
  return res;
19324
19324
  }
19325
- parts = normalize(path5).split(sep);
19326
- path5 = resolve2(path5);
19325
+ parts = normalize(path6).split(sep);
19326
+ path6 = resolve2(path6);
19327
19327
  }
19328
19328
  if (containsDotFile(parts)) {
19329
19329
  var access = this._dotfiles;
19330
19330
  if (access === void 0) {
19331
19331
  access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
19332
19332
  }
19333
- debug('%s dotfile "%s"', access, path5);
19333
+ debug('%s dotfile "%s"', access, path6);
19334
19334
  switch (access) {
19335
19335
  case "allow":
19336
19336
  break;
@@ -19344,13 +19344,13 @@ var require_send = __commonJS({
19344
19344
  }
19345
19345
  }
19346
19346
  if (this._index.length && this.hasTrailingSlash()) {
19347
- this.sendIndex(path5);
19347
+ this.sendIndex(path6);
19348
19348
  return res;
19349
19349
  }
19350
- this.sendFile(path5);
19350
+ this.sendFile(path6);
19351
19351
  return res;
19352
19352
  };
19353
- SendStream.prototype.send = function send2(path5, stat) {
19353
+ SendStream.prototype.send = function send2(path6, stat) {
19354
19354
  var len = stat.size;
19355
19355
  var options = this.options;
19356
19356
  var opts = {};
@@ -19362,9 +19362,9 @@ var require_send = __commonJS({
19362
19362
  this.headersAlreadySent();
19363
19363
  return;
19364
19364
  }
19365
- debug('pipe "%s"', path5);
19366
- this.setHeader(path5, stat);
19367
- this.type(path5);
19365
+ debug('pipe "%s"', path6);
19366
+ this.setHeader(path6, stat);
19367
+ this.type(path6);
19368
19368
  if (this.isConditionalGET()) {
19369
19369
  if (this.isPreconditionFailure()) {
19370
19370
  this.error(412);
@@ -19413,28 +19413,28 @@ var require_send = __commonJS({
19413
19413
  res.end();
19414
19414
  return;
19415
19415
  }
19416
- this.stream(path5, opts);
19416
+ this.stream(path6, opts);
19417
19417
  };
19418
- SendStream.prototype.sendFile = function sendFile(path5) {
19418
+ SendStream.prototype.sendFile = function sendFile(path6) {
19419
19419
  var i = 0;
19420
19420
  var self = this;
19421
- debug('stat "%s"', path5);
19422
- fs2.stat(path5, function onstat(err, stat) {
19423
- if (err && err.code === "ENOENT" && !extname(path5) && path5[path5.length - 1] !== sep) {
19421
+ debug('stat "%s"', path6);
19422
+ fs3.stat(path6, function onstat(err, stat) {
19423
+ if (err && err.code === "ENOENT" && !extname(path6) && path6[path6.length - 1] !== sep) {
19424
19424
  return next(err);
19425
19425
  }
19426
19426
  if (err) return self.onStatError(err);
19427
- if (stat.isDirectory()) return self.redirect(path5);
19428
- self.emit("file", path5, stat);
19429
- self.send(path5, stat);
19427
+ if (stat.isDirectory()) return self.redirect(path6);
19428
+ self.emit("file", path6, stat);
19429
+ self.send(path6, stat);
19430
19430
  });
19431
19431
  function next(err) {
19432
19432
  if (self._extensions.length <= i) {
19433
19433
  return err ? self.onStatError(err) : self.error(404);
19434
19434
  }
19435
- var p = path5 + "." + self._extensions[i++];
19435
+ var p = path6 + "." + self._extensions[i++];
19436
19436
  debug('stat "%s"', p);
19437
- fs2.stat(p, function(err2, stat) {
19437
+ fs3.stat(p, function(err2, stat) {
19438
19438
  if (err2) return next(err2);
19439
19439
  if (stat.isDirectory()) return next();
19440
19440
  self.emit("file", p, stat);
@@ -19442,7 +19442,7 @@ var require_send = __commonJS({
19442
19442
  });
19443
19443
  }
19444
19444
  };
19445
- SendStream.prototype.sendIndex = function sendIndex(path5) {
19445
+ SendStream.prototype.sendIndex = function sendIndex(path6) {
19446
19446
  var i = -1;
19447
19447
  var self = this;
19448
19448
  function next(err) {
@@ -19450,9 +19450,9 @@ var require_send = __commonJS({
19450
19450
  if (err) return self.onStatError(err);
19451
19451
  return self.error(404);
19452
19452
  }
19453
- var p = join3(path5, self._index[i]);
19453
+ var p = join3(path6, self._index[i]);
19454
19454
  debug('stat "%s"', p);
19455
- fs2.stat(p, function(err2, stat) {
19455
+ fs3.stat(p, function(err2, stat) {
19456
19456
  if (err2) return next(err2);
19457
19457
  if (stat.isDirectory()) return next();
19458
19458
  self.emit("file", p, stat);
@@ -19461,10 +19461,10 @@ var require_send = __commonJS({
19461
19461
  }
19462
19462
  next();
19463
19463
  };
19464
- SendStream.prototype.stream = function stream(path5, options) {
19464
+ SendStream.prototype.stream = function stream(path6, options) {
19465
19465
  var self = this;
19466
19466
  var res = this.res;
19467
- var stream2 = fs2.createReadStream(path5, options);
19467
+ var stream2 = fs3.createReadStream(path6, options);
19468
19468
  this.emit("stream", stream2);
19469
19469
  stream2.pipe(res);
19470
19470
  function cleanup2() {
@@ -19479,10 +19479,10 @@ var require_send = __commonJS({
19479
19479
  self.emit("end");
19480
19480
  });
19481
19481
  };
19482
- SendStream.prototype.type = function type(path5) {
19482
+ SendStream.prototype.type = function type(path6) {
19483
19483
  var res = this.res;
19484
19484
  if (res.getHeader("Content-Type")) return;
19485
- var type2 = mime.lookup(path5);
19485
+ var type2 = mime.lookup(path6);
19486
19486
  if (!type2) {
19487
19487
  debug("no content-type");
19488
19488
  return;
@@ -19491,9 +19491,9 @@ var require_send = __commonJS({
19491
19491
  debug("content-type %s", type2);
19492
19492
  res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
19493
19493
  };
19494
- SendStream.prototype.setHeader = function setHeader(path5, stat) {
19494
+ SendStream.prototype.setHeader = function setHeader(path6, stat) {
19495
19495
  var res = this.res;
19496
- this.emit("headers", res, path5, stat);
19496
+ this.emit("headers", res, path6, stat);
19497
19497
  if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
19498
19498
  debug("accept ranges");
19499
19499
  res.setHeader("Accept-Ranges", "bytes");
@@ -19552,9 +19552,9 @@ var require_send = __commonJS({
19552
19552
  }
19553
19553
  return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
19554
19554
  }
19555
- function decode3(path5) {
19555
+ function decode3(path6) {
19556
19556
  try {
19557
- return decodeURIComponent(path5);
19557
+ return decodeURIComponent(path6);
19558
19558
  } catch (err) {
19559
19559
  return -1;
19560
19560
  }
@@ -20463,10 +20463,10 @@ var require_utils2 = __commonJS({
20463
20463
  var querystring = __require("querystring");
20464
20464
  exports.etag = createETagGenerator({ weak: false });
20465
20465
  exports.wetag = createETagGenerator({ weak: true });
20466
- exports.isAbsolute = function(path4) {
20467
- if ("/" === path4[0]) return true;
20468
- if (":" === path4[1] && ("\\" === path4[2] || "/" === path4[2])) return true;
20469
- if ("\\\\" === path4.substring(0, 2)) return true;
20466
+ exports.isAbsolute = function(path5) {
20467
+ if ("/" === path5[0]) return true;
20468
+ if (":" === path5[1] && ("\\" === path5[2] || "/" === path5[2])) return true;
20469
+ if ("\\\\" === path5.substring(0, 2)) return true;
20470
20470
  };
20471
20471
  exports.flatten = deprecate.function(
20472
20472
  flatten,
@@ -20677,7 +20677,7 @@ var require_application = __commonJS({
20677
20677
  };
20678
20678
  app2.use = function use(fn) {
20679
20679
  var offset = 0;
20680
- var path4 = "/";
20680
+ var path5 = "/";
20681
20681
  if (typeof fn !== "function") {
20682
20682
  var arg = fn;
20683
20683
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -20685,7 +20685,7 @@ var require_application = __commonJS({
20685
20685
  }
20686
20686
  if (typeof arg !== "function") {
20687
20687
  offset = 1;
20688
- path4 = fn;
20688
+ path5 = fn;
20689
20689
  }
20690
20690
  }
20691
20691
  var fns = flatten(slice.call(arguments, offset));
@@ -20696,12 +20696,12 @@ var require_application = __commonJS({
20696
20696
  var router = this._router;
20697
20697
  fns.forEach(function(fn2) {
20698
20698
  if (!fn2 || !fn2.handle || !fn2.set) {
20699
- return router.use(path4, fn2);
20699
+ return router.use(path5, fn2);
20700
20700
  }
20701
- debug(".use app under %s", path4);
20702
- fn2.mountpath = path4;
20701
+ debug(".use app under %s", path5);
20702
+ fn2.mountpath = path5;
20703
20703
  fn2.parent = this;
20704
- router.use(path4, function mounted_app(req, res, next) {
20704
+ router.use(path5, function mounted_app(req, res, next) {
20705
20705
  var orig = req.app;
20706
20706
  fn2.handle(req, res, function(err) {
20707
20707
  setPrototypeOf(req, orig.request);
@@ -20713,9 +20713,9 @@ var require_application = __commonJS({
20713
20713
  }, this);
20714
20714
  return this;
20715
20715
  };
20716
- app2.route = function route(path4) {
20716
+ app2.route = function route(path5) {
20717
20717
  this.lazyrouter();
20718
- return this._router.route(path4);
20718
+ return this._router.route(path5);
20719
20719
  };
20720
20720
  app2.engine = function engine(ext, fn) {
20721
20721
  if (typeof fn !== "function") {
@@ -20766,7 +20766,7 @@ var require_application = __commonJS({
20766
20766
  }
20767
20767
  return this;
20768
20768
  };
20769
- app2.path = function path4() {
20769
+ app2.path = function path5() {
20770
20770
  return this.parent ? this.parent.path() + this.mountpath : "";
20771
20771
  };
20772
20772
  app2.enabled = function enabled(setting) {
@@ -20782,19 +20782,19 @@ var require_application = __commonJS({
20782
20782
  return this.set(setting, false);
20783
20783
  };
20784
20784
  methods.forEach(function(method) {
20785
- app2[method] = function(path4) {
20785
+ app2[method] = function(path5) {
20786
20786
  if (method === "get" && arguments.length === 1) {
20787
- return this.set(path4);
20787
+ return this.set(path5);
20788
20788
  }
20789
20789
  this.lazyrouter();
20790
- var route = this._router.route(path4);
20790
+ var route = this._router.route(path5);
20791
20791
  route[method].apply(route, slice.call(arguments, 1));
20792
20792
  return this;
20793
20793
  };
20794
20794
  });
20795
- app2.all = function all(path4) {
20795
+ app2.all = function all(path5) {
20796
20796
  this.lazyrouter();
20797
- var route = this._router.route(path4);
20797
+ var route = this._router.route(path5);
20798
20798
  var args = slice.call(arguments, 1);
20799
20799
  for (var i = 0; i < methods.length; i++) {
20800
20800
  route[methods[i]].apply(route, args);
@@ -21553,7 +21553,7 @@ var require_request = __commonJS({
21553
21553
  var subdomains2 = !isIP(hostname3) ? hostname3.split(".").reverse() : [hostname3];
21554
21554
  return subdomains2.slice(offset);
21555
21555
  });
21556
- defineGetter(req, "path", function path4() {
21556
+ defineGetter(req, "path", function path5() {
21557
21557
  return parse3(this).pathname;
21558
21558
  });
21559
21559
  defineGetter(req, "hostname", function hostname3() {
@@ -21875,7 +21875,7 @@ var require_response = __commonJS({
21875
21875
  var http = __require("http");
21876
21876
  var isAbsolute = require_utils2().isAbsolute;
21877
21877
  var onFinished = require_on_finished();
21878
- var path4 = __require("path");
21878
+ var path5 = __require("path");
21879
21879
  var statuses = require_statuses();
21880
21880
  var merge2 = require_utils_merge();
21881
21881
  var sign = require_cookie_signature().sign;
@@ -21884,9 +21884,9 @@ var require_response = __commonJS({
21884
21884
  var setCharset = require_utils2().setCharset;
21885
21885
  var cookie = require_cookie();
21886
21886
  var send = require_send();
21887
- var extname = path4.extname;
21887
+ var extname = path5.extname;
21888
21888
  var mime = send.mime;
21889
- var resolve2 = path4.resolve;
21889
+ var resolve2 = path5.resolve;
21890
21890
  var vary = require_vary();
21891
21891
  var res = Object.create(http.ServerResponse.prototype);
21892
21892
  module.exports = res;
@@ -22063,26 +22063,26 @@ var require_response = __commonJS({
22063
22063
  this.type("txt");
22064
22064
  return this.send(body);
22065
22065
  };
22066
- res.sendFile = function sendFile(path5, options, callback) {
22066
+ res.sendFile = function sendFile(path6, options, callback) {
22067
22067
  var done = callback;
22068
22068
  var req = this.req;
22069
22069
  var res2 = this;
22070
22070
  var next = req.next;
22071
22071
  var opts = options || {};
22072
- if (!path5) {
22072
+ if (!path6) {
22073
22073
  throw new TypeError("path argument is required to res.sendFile");
22074
22074
  }
22075
- if (typeof path5 !== "string") {
22075
+ if (typeof path6 !== "string") {
22076
22076
  throw new TypeError("path must be a string to res.sendFile");
22077
22077
  }
22078
22078
  if (typeof options === "function") {
22079
22079
  done = options;
22080
22080
  opts = {};
22081
22081
  }
22082
- if (!opts.root && !isAbsolute(path5)) {
22082
+ if (!opts.root && !isAbsolute(path6)) {
22083
22083
  throw new TypeError("path must be absolute or specify root to res.sendFile");
22084
22084
  }
22085
- var pathname = encodeURI(path5);
22085
+ var pathname = encodeURI(path6);
22086
22086
  var file2 = send(req, pathname, opts);
22087
22087
  sendfile(res2, file2, opts, function(err) {
22088
22088
  if (done) return done(err);
@@ -22092,7 +22092,7 @@ var require_response = __commonJS({
22092
22092
  }
22093
22093
  });
22094
22094
  };
22095
- res.sendfile = function(path5, options, callback) {
22095
+ res.sendfile = function(path6, options, callback) {
22096
22096
  var done = callback;
22097
22097
  var req = this.req;
22098
22098
  var res2 = this;
@@ -22102,7 +22102,7 @@ var require_response = __commonJS({
22102
22102
  done = options;
22103
22103
  opts = {};
22104
22104
  }
22105
- var file2 = send(req, path5, opts);
22105
+ var file2 = send(req, path6, opts);
22106
22106
  sendfile(res2, file2, opts, function(err) {
22107
22107
  if (done) return done(err);
22108
22108
  if (err && err.code === "EISDIR") return next();
@@ -22115,7 +22115,7 @@ var require_response = __commonJS({
22115
22115
  res.sendfile,
22116
22116
  "res.sendfile: Use res.sendFile instead"
22117
22117
  );
22118
- res.download = function download(path5, filename, options, callback) {
22118
+ res.download = function download(path6, filename, options, callback) {
22119
22119
  var done = callback;
22120
22120
  var name = filename;
22121
22121
  var opts = options || null;
@@ -22132,7 +22132,7 @@ var require_response = __commonJS({
22132
22132
  opts = filename;
22133
22133
  }
22134
22134
  var headers = {
22135
- "Content-Disposition": contentDisposition(name || path5)
22135
+ "Content-Disposition": contentDisposition(name || path6)
22136
22136
  };
22137
22137
  if (opts && opts.headers) {
22138
22138
  var keys = Object.keys(opts.headers);
@@ -22145,7 +22145,7 @@ var require_response = __commonJS({
22145
22145
  }
22146
22146
  opts = Object.create(opts);
22147
22147
  opts.headers = headers;
22148
- var fullPath = !opts.root ? resolve2(path5) : path5;
22148
+ var fullPath = !opts.root ? resolve2(path6) : path6;
22149
22149
  return this.sendFile(fullPath, opts, done);
22150
22150
  };
22151
22151
  res.contentType = res.type = function contentType(type) {
@@ -22446,11 +22446,11 @@ var require_serve_static = __commonJS({
22446
22446
  }
22447
22447
  var forwardError = !fallthrough;
22448
22448
  var originalUrl = parseUrl.original(req);
22449
- var path4 = parseUrl(req).pathname;
22450
- if (path4 === "/" && originalUrl.pathname.substr(-1) !== "/") {
22451
- path4 = "";
22449
+ var path5 = parseUrl(req).pathname;
22450
+ if (path5 === "/" && originalUrl.pathname.substr(-1) !== "/") {
22451
+ path5 = "";
22452
22452
  }
22453
- var stream = send(req, path4, opts);
22453
+ var stream = send(req, path5, opts);
22454
22454
  stream.on("directory", onDirectory);
22455
22455
  if (setHeaders) {
22456
22456
  stream.on("headers", setHeaders);
@@ -26057,8 +26057,8 @@ var require_utils3 = __commonJS({
26057
26057
  }
26058
26058
  return ind;
26059
26059
  }
26060
- function removeDotSegments(path4) {
26061
- let input = path4;
26060
+ function removeDotSegments(path5) {
26061
+ let input = path5;
26062
26062
  const output = [];
26063
26063
  let nextSlash = -1;
26064
26064
  let len = 0;
@@ -26257,8 +26257,8 @@ var require_schemes = __commonJS({
26257
26257
  wsComponent.secure = void 0;
26258
26258
  }
26259
26259
  if (wsComponent.resourceName) {
26260
- const [path4, query] = wsComponent.resourceName.split("?");
26261
- wsComponent.path = path4 && path4 !== "/" ? path4 : void 0;
26260
+ const [path5, query] = wsComponent.resourceName.split("?");
26261
+ wsComponent.path = path5 && path5 !== "/" ? path5 : void 0;
26262
26262
  wsComponent.query = query;
26263
26263
  wsComponent.resourceName = void 0;
26264
26264
  }
@@ -29316,10 +29316,327 @@ var require_ajv = __commonJS({
29316
29316
  }
29317
29317
  });
29318
29318
 
29319
+ // node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js
29320
+ var require_formats2 = __commonJS({
29321
+ "node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js"(exports) {
29322
+ "use strict";
29323
+ Object.defineProperty(exports, "__esModule", { value: true });
29324
+ exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
29325
+ function fmtDef(validate, compare) {
29326
+ return { validate, compare };
29327
+ }
29328
+ exports.fullFormats = {
29329
+ // date: http://tools.ietf.org/html/rfc3339#section-5.6
29330
+ date: fmtDef(date5, compareDate),
29331
+ // date-time: http://tools.ietf.org/html/rfc3339#section-5.6
29332
+ time: fmtDef(getTime(true), compareTime),
29333
+ "date-time": fmtDef(getDateTime(true), compareDateTime),
29334
+ "iso-time": fmtDef(getTime(), compareIsoTime),
29335
+ "iso-date-time": fmtDef(getDateTime(), compareIsoDateTime),
29336
+ // duration: https://tools.ietf.org/html/rfc3339#appendix-A
29337
+ duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,
29338
+ uri,
29339
+ "uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,
29340
+ // uri-template: https://tools.ietf.org/html/rfc6570
29341
+ "uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,
29342
+ // For the source: https://gist.github.com/dperini/729294
29343
+ // For test cases: https://mathiasbynens.be/demo/url-regex
29344
+ url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,
29345
+ email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
29346
+ hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,
29347
+ // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
29348
+ ipv4: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,
29349
+ ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,
29350
+ regex,
29351
+ // uuid: http://tools.ietf.org/html/rfc4122
29352
+ uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,
29353
+ // JSON-pointer: https://tools.ietf.org/html/rfc6901
29354
+ // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
29355
+ "json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/,
29356
+ "json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,
29357
+ // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
29358
+ "relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,
29359
+ // the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types
29360
+ // byte: https://github.com/miguelmota/is-base64
29361
+ byte,
29362
+ // signed 32 bit integer
29363
+ int32: { type: "number", validate: validateInt32 },
29364
+ // signed 64 bit integer
29365
+ int64: { type: "number", validate: validateInt64 },
29366
+ // C-type float
29367
+ float: { type: "number", validate: validateNumber },
29368
+ // C-type double
29369
+ double: { type: "number", validate: validateNumber },
29370
+ // hint to the UI to hide input strings
29371
+ password: true,
29372
+ // unchecked string payload
29373
+ binary: true
29374
+ };
29375
+ exports.fastFormats = {
29376
+ ...exports.fullFormats,
29377
+ date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate),
29378
+ time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareTime),
29379
+ "date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime),
29380
+ "iso-time": fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoTime),
29381
+ "iso-date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareIsoDateTime),
29382
+ // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
29383
+ uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
29384
+ "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
29385
+ // email (sources from jsen validator):
29386
+ // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
29387
+ // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation')
29388
+ email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i
29389
+ };
29390
+ exports.formatNames = Object.keys(exports.fullFormats);
29391
+ function isLeapYear(year) {
29392
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
29393
+ }
29394
+ var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
29395
+ var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
29396
+ function date5(str) {
29397
+ const matches = DATE.exec(str);
29398
+ if (!matches)
29399
+ return false;
29400
+ const year = +matches[1];
29401
+ const month = +matches[2];
29402
+ const day = +matches[3];
29403
+ return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]);
29404
+ }
29405
+ function compareDate(d1, d2) {
29406
+ if (!(d1 && d2))
29407
+ return void 0;
29408
+ if (d1 > d2)
29409
+ return 1;
29410
+ if (d1 < d2)
29411
+ return -1;
29412
+ return 0;
29413
+ }
29414
+ var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
29415
+ function getTime(strictTimeZone) {
29416
+ return function time3(str) {
29417
+ const matches = TIME.exec(str);
29418
+ if (!matches)
29419
+ return false;
29420
+ const hr = +matches[1];
29421
+ const min = +matches[2];
29422
+ const sec = +matches[3];
29423
+ const tz = matches[4];
29424
+ const tzSign = matches[5] === "-" ? -1 : 1;
29425
+ const tzH = +(matches[6] || 0);
29426
+ const tzM = +(matches[7] || 0);
29427
+ if (tzH > 23 || tzM > 59 || strictTimeZone && !tz)
29428
+ return false;
29429
+ if (hr <= 23 && min <= 59 && sec < 60)
29430
+ return true;
29431
+ const utcMin = min - tzM * tzSign;
29432
+ const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
29433
+ return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
29434
+ };
29435
+ }
29436
+ function compareTime(s1, s2) {
29437
+ if (!(s1 && s2))
29438
+ return void 0;
29439
+ const t1 = (/* @__PURE__ */ new Date("2020-01-01T" + s1)).valueOf();
29440
+ const t2 = (/* @__PURE__ */ new Date("2020-01-01T" + s2)).valueOf();
29441
+ if (!(t1 && t2))
29442
+ return void 0;
29443
+ return t1 - t2;
29444
+ }
29445
+ function compareIsoTime(t1, t2) {
29446
+ if (!(t1 && t2))
29447
+ return void 0;
29448
+ const a1 = TIME.exec(t1);
29449
+ const a2 = TIME.exec(t2);
29450
+ if (!(a1 && a2))
29451
+ return void 0;
29452
+ t1 = a1[1] + a1[2] + a1[3];
29453
+ t2 = a2[1] + a2[2] + a2[3];
29454
+ if (t1 > t2)
29455
+ return 1;
29456
+ if (t1 < t2)
29457
+ return -1;
29458
+ return 0;
29459
+ }
29460
+ var DATE_TIME_SEPARATOR = /t|\s/i;
29461
+ function getDateTime(strictTimeZone) {
29462
+ const time3 = getTime(strictTimeZone);
29463
+ return function date_time(str) {
29464
+ const dateTime = str.split(DATE_TIME_SEPARATOR);
29465
+ return dateTime.length === 2 && date5(dateTime[0]) && time3(dateTime[1]);
29466
+ };
29467
+ }
29468
+ function compareDateTime(dt1, dt2) {
29469
+ if (!(dt1 && dt2))
29470
+ return void 0;
29471
+ const d1 = new Date(dt1).valueOf();
29472
+ const d2 = new Date(dt2).valueOf();
29473
+ if (!(d1 && d2))
29474
+ return void 0;
29475
+ return d1 - d2;
29476
+ }
29477
+ function compareIsoDateTime(dt1, dt2) {
29478
+ if (!(dt1 && dt2))
29479
+ return void 0;
29480
+ const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR);
29481
+ const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR);
29482
+ const res = compareDate(d1, d2);
29483
+ if (res === void 0)
29484
+ return void 0;
29485
+ return res || compareTime(t1, t2);
29486
+ }
29487
+ var NOT_URI_FRAGMENT = /\/|:/;
29488
+ var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
29489
+ function uri(str) {
29490
+ return NOT_URI_FRAGMENT.test(str) && URI.test(str);
29491
+ }
29492
+ var BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;
29493
+ function byte(str) {
29494
+ BYTE.lastIndex = 0;
29495
+ return BYTE.test(str);
29496
+ }
29497
+ var MIN_INT32 = -(2 ** 31);
29498
+ var MAX_INT32 = 2 ** 31 - 1;
29499
+ function validateInt32(value) {
29500
+ return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32;
29501
+ }
29502
+ function validateInt64(value) {
29503
+ return Number.isInteger(value);
29504
+ }
29505
+ function validateNumber() {
29506
+ return true;
29507
+ }
29508
+ var Z_ANCHOR = /[^\\]\\Z/;
29509
+ function regex(str) {
29510
+ if (Z_ANCHOR.test(str))
29511
+ return false;
29512
+ try {
29513
+ new RegExp(str);
29514
+ return true;
29515
+ } catch (e) {
29516
+ return false;
29517
+ }
29518
+ }
29519
+ }
29520
+ });
29521
+
29522
+ // node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js
29523
+ var require_limit = __commonJS({
29524
+ "node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js"(exports) {
29525
+ "use strict";
29526
+ Object.defineProperty(exports, "__esModule", { value: true });
29527
+ exports.formatLimitDefinition = void 0;
29528
+ var ajv_1 = require_ajv();
29529
+ var codegen_1 = require_codegen();
29530
+ var ops = codegen_1.operators;
29531
+ var KWDs = {
29532
+ formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
29533
+ formatMinimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT },
29534
+ formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
29535
+ formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
29536
+ };
29537
+ var error48 = {
29538
+ message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`,
29539
+ params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
29540
+ };
29541
+ exports.formatLimitDefinition = {
29542
+ keyword: Object.keys(KWDs),
29543
+ type: "string",
29544
+ schemaType: "string",
29545
+ $data: true,
29546
+ error: error48,
29547
+ code(cxt) {
29548
+ const { gen, data, schemaCode, keyword, it } = cxt;
29549
+ const { opts, self } = it;
29550
+ if (!opts.validateFormats)
29551
+ return;
29552
+ const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, "format");
29553
+ if (fCxt.$data)
29554
+ validate$DataFormat();
29555
+ else
29556
+ validateFormat();
29557
+ function validate$DataFormat() {
29558
+ const fmts = gen.scopeValue("formats", {
29559
+ ref: self.formats,
29560
+ code: opts.code.formats
29561
+ });
29562
+ const fmt = gen.const("fmt", (0, codegen_1._)`${fmts}[${fCxt.schemaCode}]`);
29563
+ cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${fmt} != "object"`, (0, codegen_1._)`${fmt} instanceof RegExp`, (0, codegen_1._)`typeof ${fmt}.compare != "function"`, compareCode(fmt)));
29564
+ }
29565
+ function validateFormat() {
29566
+ const format = fCxt.schema;
29567
+ const fmtDef = self.formats[format];
29568
+ if (!fmtDef || fmtDef === true)
29569
+ return;
29570
+ if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") {
29571
+ throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);
29572
+ }
29573
+ const fmt = gen.scopeValue("formats", {
29574
+ key: format,
29575
+ ref: fmtDef,
29576
+ code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format)}` : void 0
29577
+ });
29578
+ cxt.fail$data(compareCode(fmt));
29579
+ }
29580
+ function compareCode(fmt) {
29581
+ return (0, codegen_1._)`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`;
29582
+ }
29583
+ },
29584
+ dependencies: ["format"]
29585
+ };
29586
+ var formatLimitPlugin = (ajv2) => {
29587
+ ajv2.addKeyword(exports.formatLimitDefinition);
29588
+ return ajv2;
29589
+ };
29590
+ exports.default = formatLimitPlugin;
29591
+ }
29592
+ });
29593
+
29594
+ // node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js
29595
+ var require_dist = __commonJS({
29596
+ "node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js"(exports, module) {
29597
+ "use strict";
29598
+ Object.defineProperty(exports, "__esModule", { value: true });
29599
+ var formats_1 = require_formats2();
29600
+ var limit_1 = require_limit();
29601
+ var codegen_1 = require_codegen();
29602
+ var fullName = new codegen_1.Name("fullFormats");
29603
+ var fastName = new codegen_1.Name("fastFormats");
29604
+ var formatsPlugin = (ajv2, opts = { keywords: true }) => {
29605
+ if (Array.isArray(opts)) {
29606
+ addFormats2(ajv2, opts, formats_1.fullFormats, fullName);
29607
+ return ajv2;
29608
+ }
29609
+ const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName];
29610
+ const list = opts.formats || formats_1.formatNames;
29611
+ addFormats2(ajv2, list, formats, exportName);
29612
+ if (opts.keywords)
29613
+ (0, limit_1.default)(ajv2);
29614
+ return ajv2;
29615
+ };
29616
+ formatsPlugin.get = (name, mode = "full") => {
29617
+ const formats = mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats;
29618
+ const f = formats[name];
29619
+ if (!f)
29620
+ throw new Error(`Unknown format "${name}"`);
29621
+ return f;
29622
+ };
29623
+ function addFormats2(ajv2, list, fs3, exportName) {
29624
+ var _a2;
29625
+ var _b;
29626
+ (_a2 = (_b = ajv2.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
29627
+ for (const f of list)
29628
+ ajv2.addFormat(f, fs3[f]);
29629
+ }
29630
+ module.exports = exports = formatsPlugin;
29631
+ Object.defineProperty(exports, "__esModule", { value: true });
29632
+ exports.default = formatsPlugin;
29633
+ }
29634
+ });
29635
+
29319
29636
  // editor/server/index.ts
29320
29637
  var import_express = __toESM(require_express2(), 1);
29321
29638
  var import_cors = __toESM(require_lib3(), 1);
29322
- import path3 from "path";
29639
+ import path4 from "path";
29323
29640
  import { fileURLToPath } from "url";
29324
29641
  import { Firestore } from "@google-cloud/firestore";
29325
29642
 
@@ -30005,10 +30322,13 @@ var GraphTransactionImpl = class {
30005
30322
  }
30006
30323
  async updateNode(uid, data) {
30007
30324
  const docId = computeNodeDocId(uid);
30008
- this.adapter.updateDoc(docId, {
30009
- ...data,
30325
+ const update = {
30010
30326
  updatedAt: FieldValue3.serverTimestamp()
30011
- });
30327
+ };
30328
+ for (const [k, v] of Object.entries(data)) {
30329
+ update[`data.${k}`] = v;
30330
+ }
30331
+ this.adapter.updateDoc(docId, update);
30012
30332
  }
30013
30333
  async removeNode(uid) {
30014
30334
  const docId = computeNodeDocId(uid);
@@ -30058,10 +30378,13 @@ var GraphBatchImpl = class {
30058
30378
  }
30059
30379
  async updateNode(uid, data) {
30060
30380
  const docId = computeNodeDocId(uid);
30061
- this.adapter.updateDoc(docId, {
30062
- ...data,
30381
+ const update = {
30063
30382
  updatedAt: FieldValue4.serverTimestamp()
30064
- });
30383
+ };
30384
+ for (const [k, v] of Object.entries(data)) {
30385
+ update[`data.${k}`] = v;
30386
+ }
30387
+ this.adapter.updateDoc(docId, update);
30065
30388
  }
30066
30389
  async removeNode(uid) {
30067
30390
  const docId = computeNodeDocId(uid);
@@ -30223,7 +30546,9 @@ import { createHash as createHash3 } from "node:crypto";
30223
30546
 
30224
30547
  // src/json-schema.ts
30225
30548
  var import_ajv = __toESM(require_ajv(), 1);
30549
+ var import_ajv_formats = __toESM(require_dist(), 1);
30226
30550
  var ajv = new import_ajv.default({ allErrors: true, strict: false });
30551
+ (0, import_ajv_formats.default)(ajv);
30227
30552
  function compileSchema(schema, label) {
30228
30553
  const validate = ajv.compile(schema);
30229
30554
  return (data) => {
@@ -30325,23 +30650,23 @@ function matchScopeAny(scopePath, patterns) {
30325
30650
  if (!patterns || patterns.length === 0) return true;
30326
30651
  return patterns.some((p) => matchScope(scopePath, p));
30327
30652
  }
30328
- function matchSegments(path4, pi, pattern, qi) {
30329
- if (pi === path4.length && qi === pattern.length) return true;
30653
+ function matchSegments(path5, pi, pattern, qi) {
30654
+ if (pi === path5.length && qi === pattern.length) return true;
30330
30655
  if (qi === pattern.length) return false;
30331
30656
  const seg = pattern[qi];
30332
30657
  if (seg === "**") {
30333
30658
  if (qi === pattern.length - 1) return true;
30334
- for (let skip = 0; skip <= path4.length - pi; skip++) {
30335
- if (matchSegments(path4, pi + skip, pattern, qi + 1)) return true;
30659
+ for (let skip = 0; skip <= path5.length - pi; skip++) {
30660
+ if (matchSegments(path5, pi + skip, pattern, qi + 1)) return true;
30336
30661
  }
30337
30662
  return false;
30338
30663
  }
30339
- if (pi === path4.length) return false;
30664
+ if (pi === path5.length) return false;
30340
30665
  if (seg === "*") {
30341
- return matchSegments(path4, pi + 1, pattern, qi + 1);
30666
+ return matchSegments(path5, pi + 1, pattern, qi + 1);
30342
30667
  }
30343
- if (path4[pi] === seg) {
30344
- return matchSegments(path4, pi + 1, pattern, qi + 1);
30668
+ if (path5[pi] === seg) {
30669
+ return matchSegments(path5, pi + 1, pattern, qi + 1);
30345
30670
  }
30346
30671
  return false;
30347
30672
  }
@@ -31174,10 +31499,13 @@ var GraphClientImpl = class _GraphClientImpl {
31174
31499
  }
31175
31500
  async updateNode(uid, data) {
31176
31501
  const docId = computeNodeDocId(uid);
31177
- await this.adapter.updateDoc(docId, {
31178
- ...data,
31502
+ const update = {
31179
31503
  updatedAt: FieldValue5.serverTimestamp()
31180
- });
31504
+ };
31505
+ for (const [k, v] of Object.entries(data)) {
31506
+ update[`data.${k}`] = v;
31507
+ }
31508
+ await this.adapter.updateDoc(docId, update);
31181
31509
  }
31182
31510
  async removeNode(uid) {
31183
31511
  const docId = computeNodeDocId(uid);
@@ -31686,7 +32014,9 @@ function introspectRegistry(registry2, dynamicNames) {
31686
32014
  hasDataSchema: !!entry.jsonSchema,
31687
32015
  fields,
31688
32016
  isNodeEntry: isNode,
31689
- isDynamic
32017
+ isDynamic,
32018
+ targetGraph: entry.targetGraph,
32019
+ allowedIn: entry.allowedIn
31690
32020
  };
31691
32021
  if (meta3.isNodeEntry) {
31692
32022
  nodeTypes.push(meta3);
@@ -31767,6 +32097,7 @@ function resilientView(ViewClass, tagName) {
31767
32097
  export function defineViews(input) {
31768
32098
  const nodes = {};
31769
32099
  const edges = {};
32100
+ const collections = {};
31770
32101
  const registry = (typeof customElements !== 'undefined' && typeof customElements.define === 'function')
31771
32102
  ? customElements : null;
31772
32103
 
@@ -31790,7 +32121,17 @@ export function defineViews(input) {
31790
32121
  edges[axbType] = { views: viewMetas, sampleData: config.sampleData };
31791
32122
  }
31792
32123
 
31793
- return { nodes, edges };
32124
+ for (const [colName, config] of Object.entries(input.collections ?? {})) {
32125
+ const viewMetas = [];
32126
+ for (const ViewClass of config.views) {
32127
+ const tagName = 'fg-col-' + sanitizeTagPart(colName) + '-' + sanitizeTagPart(ViewClass.viewName);
32128
+ viewMetas.push({ tagName, viewName: ViewClass.viewName, description: ViewClass.description });
32129
+ if (registry && !registry.get(tagName)) registry.define(tagName, resilientView(ViewClass, tagName));
32130
+ }
32131
+ collections[colName] = { views: viewMetas, sampleData: config.sampleData };
32132
+ }
32133
+
32134
+ return { nodes, edges, collections };
31794
32135
  }
31795
32136
  `;
31796
32137
  var REACT_ADAPTER_SHIM = `
@@ -31882,9 +32223,10 @@ async function loadSveltePlugin() {
31882
32223
  return null;
31883
32224
  }
31884
32225
  }
31885
- async function bundleEntityViews(discovery) {
32226
+ async function bundleEntityViews(discovery, collectionViewPaths) {
31886
32227
  const nodeViews = [];
31887
32228
  const edgeViews = [];
32229
+ const colViews = collectionViewPaths ?? [];
31888
32230
  for (const [name, entity] of discovery.nodes) {
31889
32231
  if (entity.viewsPath) {
31890
32232
  nodeViews.push({ name, absPath: path.resolve(entity.viewsPath) });
@@ -31895,10 +32237,11 @@ async function bundleEntityViews(discovery) {
31895
32237
  edgeViews.push({ name, absPath: path.resolve(entity.viewsPath) });
31896
32238
  }
31897
32239
  }
31898
- if (nodeViews.length === 0 && edgeViews.length === 0) return null;
32240
+ if (nodeViews.length === 0 && edgeViews.length === 0 && colViews.length === 0) return null;
31899
32241
  const imports = [];
31900
32242
  const nodeEntries = [];
31901
32243
  const edgeEntries = [];
32244
+ const colEntries = [];
31902
32245
  nodeViews.forEach(({ name, absPath }, i) => {
31903
32246
  const varName = `nodeViews_${i}`;
31904
32247
  imports.push(`import ${varName} from '${absPath.replace(/\\/g, "/")}';`);
@@ -31909,6 +32252,11 @@ async function bundleEntityViews(discovery) {
31909
32252
  imports.push(`import ${varName} from '${absPath.replace(/\\/g, "/")}';`);
31910
32253
  edgeEntries.push(` '${name}': { views: Array.isArray(${varName}) ? ${varName} : ${varName}.default || [] }`);
31911
32254
  });
32255
+ colViews.forEach(({ name, absPath }, i) => {
32256
+ const varName = `colViews_${i}`;
32257
+ imports.push(`import ${varName} from '${absPath.replace(/\\/g, "/")}';`);
32258
+ colEntries.push(` '${name}': { views: Array.isArray(${varName}) ? ${varName} : ${varName}.default || [] }`);
32259
+ });
31912
32260
  const syntheticEntry = `
31913
32261
  ${imports.join("\n")}
31914
32262
  import { defineViews } from 'firegraph';
@@ -31919,6 +32267,9 @@ ${nodeEntries.join(",\n")}
31919
32267
  },
31920
32268
  edges: {
31921
32269
  ${edgeEntries.join(",\n")}
32270
+ },
32271
+ collections: {
32272
+ ${colEntries.join(",\n")}
31922
32273
  }
31923
32274
  });
31924
32275
  `;
@@ -32219,6 +32570,113 @@ function mergeViewDefaults(discovery, configDefaults) {
32219
32570
  return { nodes, edges };
32220
32571
  }
32221
32572
 
32573
+ // editor/server/collections-loader.ts
32574
+ import path3 from "path";
32575
+ import fs2 from "fs";
32576
+ function extractPathParams(pathTemplate) {
32577
+ const params = [];
32578
+ const re = /\{([^}]+)\}/g;
32579
+ let m;
32580
+ while ((m = re.exec(pathTemplate)) !== null) {
32581
+ params.push(m[1]);
32582
+ }
32583
+ return params;
32584
+ }
32585
+ function discoverCollections(entitiesDir) {
32586
+ const collectionsDir = path3.join(entitiesDir, "collections");
32587
+ if (!fs2.existsSync(collectionsDir)) return [];
32588
+ let entries;
32589
+ try {
32590
+ entries = fs2.readdirSync(collectionsDir, { withFileTypes: true });
32591
+ } catch {
32592
+ return [];
32593
+ }
32594
+ const results = [];
32595
+ for (const entry of entries) {
32596
+ if (!entry.isDirectory()) continue;
32597
+ const name = entry.name;
32598
+ const dir = path3.join(collectionsDir, name);
32599
+ const collectionJsonPath = path3.join(dir, "collection.json");
32600
+ if (!fs2.existsSync(collectionJsonPath)) continue;
32601
+ let collectionJson;
32602
+ try {
32603
+ const raw = fs2.readFileSync(collectionJsonPath, "utf-8");
32604
+ collectionJson = JSON.parse(raw);
32605
+ } catch (err) {
32606
+ console.warn(`[firegraph] Skipping collection "${name}": invalid collection.json \u2014 ${err.message}`);
32607
+ continue;
32608
+ }
32609
+ if (!collectionJson.path || typeof collectionJson.path !== "string") continue;
32610
+ let fields = [];
32611
+ let hasSchema = false;
32612
+ const schemaJsonPath = path3.join(dir, "schema.json");
32613
+ if (fs2.existsSync(schemaJsonPath)) {
32614
+ try {
32615
+ const raw = fs2.readFileSync(schemaJsonPath, "utf-8");
32616
+ const schema = JSON.parse(raw);
32617
+ fields = jsonSchemaToFieldMeta(schema);
32618
+ hasSchema = true;
32619
+ } catch {
32620
+ }
32621
+ }
32622
+ const pathParams = extractPathParams(collectionJson.path);
32623
+ const defaultOrderBy = collectionJson.orderBy ? {
32624
+ field: collectionJson.orderBy.field,
32625
+ direction: collectionJson.orderBy.direction ?? "asc"
32626
+ } : void 0;
32627
+ let viewsPath;
32628
+ for (const ext of ["ts", "js", "mts", "mjs"]) {
32629
+ const candidate = path3.join(dir, `views.${ext}`);
32630
+ if (fs2.existsSync(candidate)) {
32631
+ viewsPath = candidate;
32632
+ break;
32633
+ }
32634
+ }
32635
+ let sampleData;
32636
+ const sampleJsonPath = path3.join(dir, "sample.json");
32637
+ if (fs2.existsSync(sampleJsonPath)) {
32638
+ try {
32639
+ sampleData = JSON.parse(fs2.readFileSync(sampleJsonPath, "utf-8"));
32640
+ } catch {
32641
+ }
32642
+ }
32643
+ results.push({
32644
+ name,
32645
+ path: collectionJson.path,
32646
+ description: collectionJson.description,
32647
+ typeField: collectionJson.typeField,
32648
+ typeValue: collectionJson.typeValue,
32649
+ parentNodeType: collectionJson.parentNodeType,
32650
+ fields,
32651
+ hasSchema,
32652
+ pathParams,
32653
+ defaultOrderBy,
32654
+ viewsPath,
32655
+ sampleData
32656
+ });
32657
+ }
32658
+ return results;
32659
+ }
32660
+ async function buildCollectionViewRegistry(collections) {
32661
+ const result = {};
32662
+ for (const col of collections) {
32663
+ if (!col.viewsPath) continue;
32664
+ try {
32665
+ const viewClasses = await loadViewClasses(col.viewsPath);
32666
+ if (viewClasses.length === 0) continue;
32667
+ const views = viewClasses.map((vc) => ({
32668
+ tagName: `fg-col-${sanitizeTagPart(col.name)}-${sanitizeTagPart(vc.viewName)}`,
32669
+ viewName: vc.viewName,
32670
+ description: vc.description
32671
+ }));
32672
+ result[col.name] = { views, sampleData: col.sampleData };
32673
+ } catch (err) {
32674
+ console.warn(`[firegraph] Failed to load views for collection "${col.name}": ${err.message}`);
32675
+ }
32676
+ }
32677
+ return result;
32678
+ }
32679
+
32222
32680
  // editor/node_modules/.pnpm/@trpc+server@11.10.0_typescript@5.9.3/node_modules/@trpc/server/dist/codes-DagpWZLc.mjs
32223
32681
  function mergeWithoutOverrides(obj1, ...objs) {
32224
32682
  const newObj = Object.assign(emptyObject(), obj1);
@@ -32339,27 +32797,27 @@ var noop = () => {
32339
32797
  var freezeIfAvailable = (obj) => {
32340
32798
  if (Object.freeze) Object.freeze(obj);
32341
32799
  };
32342
- function createInnerProxy(callback, path4, memo2) {
32800
+ function createInnerProxy(callback, path5, memo2) {
32343
32801
  var _memo$cacheKey;
32344
- const cacheKey = path4.join(".");
32802
+ const cacheKey = path5.join(".");
32345
32803
  (_memo$cacheKey = memo2[cacheKey]) !== null && _memo$cacheKey !== void 0 || (memo2[cacheKey] = new Proxy(noop, {
32346
32804
  get(_obj, key) {
32347
32805
  if (typeof key !== "string" || key === "then") return void 0;
32348
- return createInnerProxy(callback, [...path4, key], memo2);
32806
+ return createInnerProxy(callback, [...path5, key], memo2);
32349
32807
  },
32350
32808
  apply(_1, _2, args) {
32351
- const lastOfPath = path4[path4.length - 1];
32809
+ const lastOfPath = path5[path5.length - 1];
32352
32810
  let opts = {
32353
32811
  args,
32354
- path: path4
32812
+ path: path5
32355
32813
  };
32356
32814
  if (lastOfPath === "call") opts = {
32357
32815
  args: args.length >= 2 ? [args[1]] : [],
32358
- path: path4.slice(0, -1)
32816
+ path: path5.slice(0, -1)
32359
32817
  };
32360
32818
  else if (lastOfPath === "apply") opts = {
32361
32819
  args: args.length >= 2 ? args[1] : [],
32362
- path: path4.slice(0, -1)
32820
+ path: path5.slice(0, -1)
32363
32821
  };
32364
32822
  freezeIfAvailable(opts.args);
32365
32823
  freezeIfAvailable(opts.path);
@@ -32487,7 +32945,7 @@ var require_objectSpread2 = __commonJS2({ "../../node_modules/.pnpm/@oxc-project
32487
32945
  } });
32488
32946
  var import_objectSpread2 = __toESM2(require_objectSpread2(), 1);
32489
32947
  function getErrorShape(opts) {
32490
- const { path: path4, error: error48, config: config2 } = opts;
32948
+ const { path: path5, error: error48, config: config2 } = opts;
32491
32949
  const { code } = opts.error;
32492
32950
  const shape = {
32493
32951
  message: error48.message,
@@ -32498,7 +32956,7 @@ function getErrorShape(opts) {
32498
32956
  }
32499
32957
  };
32500
32958
  if (config2.isDev && typeof opts.error.stack === "string") shape.data.stack = opts.error.stack;
32501
- if (typeof path4 === "string") shape.data.path = path4;
32959
+ if (typeof path5 === "string") shape.data.path = path5;
32502
32960
  return config2.errorFormatter((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, { shape }));
32503
32961
  }
32504
32962
 
@@ -32624,12 +33082,12 @@ function createRouterFactory(config2) {
32624
33082
  })
32625
33083
  };
32626
33084
  }
32627
- function step(from, path4 = []) {
33085
+ function step(from, path5 = []) {
32628
33086
  const aggregate = emptyObject();
32629
33087
  for (const [key, item] of Object.entries(from !== null && from !== void 0 ? from : {})) {
32630
33088
  if (isLazy(item)) {
32631
- lazy$1[[...path4, key].join(".")] = createLazyLoader({
32632
- path: path4,
33089
+ lazy$1[[...path5, key].join(".")] = createLazyLoader({
33090
+ path: path5,
32633
33091
  ref: item,
32634
33092
  key,
32635
33093
  aggregate
@@ -32637,14 +33095,14 @@ function createRouterFactory(config2) {
32637
33095
  continue;
32638
33096
  }
32639
33097
  if (isRouter(item)) {
32640
- aggregate[key] = step(item._def.record, [...path4, key]);
33098
+ aggregate[key] = step(item._def.record, [...path5, key]);
32641
33099
  continue;
32642
33100
  }
32643
33101
  if (!isProcedure(item)) {
32644
- aggregate[key] = step(item, [...path4, key]);
33102
+ aggregate[key] = step(item, [...path5, key]);
32645
33103
  continue;
32646
33104
  }
32647
- const newPath = [...path4, key].join(".");
33105
+ const newPath = [...path5, key].join(".");
32648
33106
  if (procedures[newPath]) throw new Error(`Duplicate key: ${newPath}`);
32649
33107
  procedures[newPath] = item;
32650
33108
  aggregate[key] = item;
@@ -32669,15 +33127,15 @@ function createRouterFactory(config2) {
32669
33127
  function isProcedure(procedureOrRouter) {
32670
33128
  return typeof procedureOrRouter === "function";
32671
33129
  }
32672
- async function getProcedureAtPath(router, path4) {
33130
+ async function getProcedureAtPath(router, path5) {
32673
33131
  const { _def } = router;
32674
- let procedure = _def.procedures[path4];
33132
+ let procedure = _def.procedures[path5];
32675
33133
  while (!procedure) {
32676
- const key = Object.keys(_def.lazy).find((key$1) => path4.startsWith(key$1));
33134
+ const key = Object.keys(_def.lazy).find((key$1) => path5.startsWith(key$1));
32677
33135
  if (!key) return null;
32678
33136
  const lazyRouter = _def.lazy[key];
32679
33137
  await lazyRouter.load();
32680
- procedure = _def.procedures[path4];
33138
+ procedure = _def.procedures[path5];
32681
33139
  }
32682
33140
  return procedure;
32683
33141
  }
@@ -32686,15 +33144,15 @@ function createCallerFactory() {
32686
33144
  const { _def } = router;
32687
33145
  return function createCaller(ctxOrCallback, opts) {
32688
33146
  return createRecursiveProxy(async (innerOpts) => {
32689
- const { path: path4, args } = innerOpts;
32690
- const fullPath = path4.join(".");
32691
- if (path4.length === 1 && path4[0] === "_def") return _def;
33147
+ const { path: path5, args } = innerOpts;
33148
+ const fullPath = path5.join(".");
33149
+ if (path5.length === 1 && path5[0] === "_def") return _def;
32692
33150
  const procedure = await getProcedureAtPath(router, fullPath);
32693
33151
  let ctx = void 0;
32694
33152
  try {
32695
33153
  if (!procedure) throw new TRPCError({
32696
33154
  code: "NOT_FOUND",
32697
- message: `No procedure found on path "${path4}"`
33155
+ message: `No procedure found on path "${path5}"`
32698
33156
  });
32699
33157
  ctx = isFunction(ctxOrCallback) ? await Promise.resolve(ctxOrCallback()) : ctxOrCallback;
32700
33158
  return await procedure({
@@ -32910,11 +33368,11 @@ var jsonContentTypeHandler = {
32910
33368
  }
32911
33369
  return acc;
32912
33370
  });
32913
- const calls = await Promise.all(paths.map(async (path4, index) => {
32914
- const procedure = await getProcedureAtPath(opts.router, path4);
33371
+ const calls = await Promise.all(paths.map(async (path5, index) => {
33372
+ const procedure = await getProcedureAtPath(opts.router, path5);
32915
33373
  return {
32916
33374
  batchIndex: index,
32917
- path: path4,
33375
+ path: path5,
32918
33376
  procedure,
32919
33377
  getRawInput: async () => {
32920
33378
  const inputs = await getInputs.read();
@@ -33722,9 +34180,9 @@ function isPromise(value) {
33722
34180
  return (isObject(value) || isFunction(value)) && typeof (value === null || value === void 0 ? void 0 : value["then"]) === "function" && typeof (value === null || value === void 0 ? void 0 : value["catch"]) === "function";
33723
34181
  }
33724
34182
  var MaxDepthError = class extends Error {
33725
- constructor(path4) {
33726
- super("Max depth reached at path: " + path4.join("."));
33727
- this.path = path4;
34183
+ constructor(path5) {
34184
+ super("Max depth reached at path: " + path5.join("."));
34185
+ this.path = path5;
33728
34186
  }
33729
34187
  };
33730
34188
  function createBatchStreamProducer(_x3) {
@@ -33742,16 +34200,16 @@ function _createBatchStreamProducer() {
33742
34200
  mergedIterables.add(iterable$1);
33743
34201
  return idx;
33744
34202
  }
33745
- function encodePromise(promise2, path4) {
34203
+ function encodePromise(promise2, path5) {
33746
34204
  return registerAsync(/* @__PURE__ */ function() {
33747
34205
  var _ref = (0, import_wrapAsyncGenerator$2.default)(function* (idx) {
33748
- const error48 = checkMaxDepth(path4);
34206
+ const error48 = checkMaxDepth(path5);
33749
34207
  if (error48) {
33750
34208
  promise2.catch((cause) => {
33751
34209
  var _opts$onError;
33752
34210
  (_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, {
33753
34211
  error: cause,
33754
- path: path4
34212
+ path: path5
33755
34213
  });
33756
34214
  });
33757
34215
  promise2 = Promise.reject(error48);
@@ -33761,20 +34219,20 @@ function _createBatchStreamProducer() {
33761
34219
  yield [
33762
34220
  idx,
33763
34221
  PROMISE_STATUS_FULFILLED,
33764
- encode3(next, path4)
34222
+ encode3(next, path5)
33765
34223
  ];
33766
34224
  } catch (cause) {
33767
34225
  var _opts$onError2, _opts$formatError;
33768
34226
  (_opts$onError2 = opts.onError) === null || _opts$onError2 === void 0 || _opts$onError2.call(opts, {
33769
34227
  error: cause,
33770
- path: path4
34228
+ path: path5
33771
34229
  });
33772
34230
  yield [
33773
34231
  idx,
33774
34232
  PROMISE_STATUS_REJECTED,
33775
34233
  (_opts$formatError = opts.formatError) === null || _opts$formatError === void 0 ? void 0 : _opts$formatError.call(opts, {
33776
34234
  error: cause,
33777
- path: path4
34235
+ path: path5
33778
34236
  })
33779
34237
  ];
33780
34238
  }
@@ -33784,12 +34242,12 @@ function _createBatchStreamProducer() {
33784
34242
  };
33785
34243
  }());
33786
34244
  }
33787
- function encodeAsyncIterable(iterable$1, path4) {
34245
+ function encodeAsyncIterable(iterable$1, path5) {
33788
34246
  return registerAsync(/* @__PURE__ */ function() {
33789
34247
  var _ref2 = (0, import_wrapAsyncGenerator$2.default)(function* (idx) {
33790
34248
  try {
33791
34249
  var _usingCtx$1 = (0, import_usingCtx$1.default)();
33792
- const error48 = checkMaxDepth(path4);
34250
+ const error48 = checkMaxDepth(path5);
33793
34251
  if (error48) throw error48;
33794
34252
  const iterator = _usingCtx$1.a(iteratorResource(iterable$1));
33795
34253
  try {
@@ -33799,28 +34257,28 @@ function _createBatchStreamProducer() {
33799
34257
  yield [
33800
34258
  idx,
33801
34259
  ASYNC_ITERABLE_STATUS_RETURN,
33802
- encode3(next.value, path4)
34260
+ encode3(next.value, path5)
33803
34261
  ];
33804
34262
  break;
33805
34263
  }
33806
34264
  yield [
33807
34265
  idx,
33808
34266
  ASYNC_ITERABLE_STATUS_YIELD,
33809
- encode3(next.value, path4)
34267
+ encode3(next.value, path5)
33810
34268
  ];
33811
34269
  }
33812
34270
  } catch (cause) {
33813
34271
  var _opts$onError3, _opts$formatError2;
33814
34272
  (_opts$onError3 = opts.onError) === null || _opts$onError3 === void 0 || _opts$onError3.call(opts, {
33815
34273
  error: cause,
33816
- path: path4
34274
+ path: path5
33817
34275
  });
33818
34276
  yield [
33819
34277
  idx,
33820
34278
  ASYNC_ITERABLE_STATUS_ERROR,
33821
34279
  (_opts$formatError2 = opts.formatError) === null || _opts$formatError2 === void 0 ? void 0 : _opts$formatError2.call(opts, {
33822
34280
  error: cause,
33823
- path: path4
34281
+ path: path5
33824
34282
  })
33825
34283
  ];
33826
34284
  }
@@ -33835,27 +34293,27 @@ function _createBatchStreamProducer() {
33835
34293
  };
33836
34294
  }());
33837
34295
  }
33838
- function checkMaxDepth(path4) {
33839
- if (opts.maxDepth && path4.length > opts.maxDepth) return new MaxDepthError(path4);
34296
+ function checkMaxDepth(path5) {
34297
+ if (opts.maxDepth && path5.length > opts.maxDepth) return new MaxDepthError(path5);
33840
34298
  return null;
33841
34299
  }
33842
- function encodeAsync3(value, path4) {
33843
- if (isPromise(value)) return [CHUNK_VALUE_TYPE_PROMISE, encodePromise(value, path4)];
34300
+ function encodeAsync3(value, path5) {
34301
+ if (isPromise(value)) return [CHUNK_VALUE_TYPE_PROMISE, encodePromise(value, path5)];
33844
34302
  if (isAsyncIterable(value)) {
33845
- if (opts.maxDepth && path4.length >= opts.maxDepth) throw new Error("Max depth reached");
33846
- return [CHUNK_VALUE_TYPE_ASYNC_ITERABLE, encodeAsyncIterable(value, path4)];
34303
+ if (opts.maxDepth && path5.length >= opts.maxDepth) throw new Error("Max depth reached");
34304
+ return [CHUNK_VALUE_TYPE_ASYNC_ITERABLE, encodeAsyncIterable(value, path5)];
33847
34305
  }
33848
34306
  return null;
33849
34307
  }
33850
- function encode3(value, path4) {
34308
+ function encode3(value, path5) {
33851
34309
  if (value === void 0) return [[]];
33852
- const reg = encodeAsync3(value, path4);
34310
+ const reg = encodeAsync3(value, path5);
33853
34311
  if (reg) return [[placeholder], [null, ...reg]];
33854
34312
  if (!isPlainObject(value)) return [[value]];
33855
34313
  const newObj = emptyObject();
33856
34314
  const asyncValues = [];
33857
34315
  for (const [key, item] of Object.entries(value)) {
33858
- const transformed = encodeAsync3(item, [...path4, key]);
34316
+ const transformed = encodeAsync3(item, [...path5, key]);
33859
34317
  if (!transformed) {
33860
34318
  newObj[key] = item;
33861
34319
  continue;
@@ -34295,11 +34753,11 @@ async function resolveResponse(opts) {
34295
34753
  var _call$procedure$_def$2, _call$procedure3, _opts$onError2;
34296
34754
  const error$1 = getTRPCErrorFromUnknown(errorOpts.error);
34297
34755
  const input = call === null || call === void 0 ? void 0 : call.result();
34298
- const path4 = call === null || call === void 0 ? void 0 : call.path;
34756
+ const path5 = call === null || call === void 0 ? void 0 : call.path;
34299
34757
  const type = (_call$procedure$_def$2 = call === null || call === void 0 || (_call$procedure3 = call.procedure) === null || _call$procedure3 === void 0 ? void 0 : _call$procedure3._def.type) !== null && _call$procedure$_def$2 !== void 0 ? _call$procedure$_def$2 : "unknown";
34300
34758
  (_opts$onError2 = opts.onError) === null || _opts$onError2 === void 0 || _opts$onError2.call(opts, {
34301
34759
  error: error$1,
34302
- path: path4,
34760
+ path: path5,
34303
34761
  input,
34304
34762
  ctx: ctxManager.valueOrUndefined(),
34305
34763
  req: opts.req,
@@ -34310,7 +34768,7 @@ async function resolveResponse(opts) {
34310
34768
  ctx: ctxManager.valueOrUndefined(),
34311
34769
  error: error$1,
34312
34770
  input,
34313
- path: path4,
34771
+ path: path5,
34314
34772
  type
34315
34773
  });
34316
34774
  return shape;
@@ -34379,14 +34837,14 @@ async function resolveResponse(opts) {
34379
34837
  const call = info === null || info === void 0 ? void 0 : info.calls[errorOpts.path[0]];
34380
34838
  const error48 = getTRPCErrorFromUnknown(errorOpts.error);
34381
34839
  const input = call === null || call === void 0 ? void 0 : call.result();
34382
- const path4 = call === null || call === void 0 ? void 0 : call.path;
34840
+ const path5 = call === null || call === void 0 ? void 0 : call.path;
34383
34841
  const type = (_call$procedure$_def$3 = call === null || call === void 0 || (_call$procedure4 = call.procedure) === null || _call$procedure4 === void 0 ? void 0 : _call$procedure4._def.type) !== null && _call$procedure$_def$3 !== void 0 ? _call$procedure$_def$3 : "unknown";
34384
34842
  const shape = getErrorShape({
34385
34843
  config: config2,
34386
34844
  ctx: ctxManager.valueOrUndefined(),
34387
34845
  error: error48,
34388
34846
  input,
34389
- path: path4,
34847
+ path: path5,
34390
34848
  type
34391
34849
  });
34392
34850
  return shape;
@@ -34965,24 +35423,24 @@ async function nodeHTTPRequestHandler(opts) {
34965
35423
  var import_objectSpread26 = __toESM2(require_objectSpread2(), 1);
34966
35424
  function createExpressMiddleware(opts) {
34967
35425
  return (req, res) => {
34968
- let path4 = "";
35426
+ let path5 = "";
34969
35427
  run(async () => {
34970
- path4 = req.path.slice(req.path.lastIndexOf("/") + 1);
35428
+ path5 = req.path.slice(req.path.lastIndexOf("/") + 1);
34971
35429
  await nodeHTTPRequestHandler((0, import_objectSpread26.default)((0, import_objectSpread26.default)({}, opts), {}, {
34972
35430
  req,
34973
35431
  res,
34974
- path: path4
35432
+ path: path5
34975
35433
  }));
34976
35434
  }).catch(internal_exceptionHandler((0, import_objectSpread26.default)({
34977
35435
  req,
34978
35436
  res,
34979
- path: path4
35437
+ path: path5
34980
35438
  }, opts)));
34981
35439
  };
34982
35440
  }
34983
35441
 
34984
35442
  // editor/server/trpc.ts
34985
- import { Timestamp as Timestamp2 } from "@google-cloud/firestore";
35443
+ import { Timestamp as Timestamp2, FieldPath } from "@google-cloud/firestore";
34986
35444
 
34987
35445
  // editor/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
34988
35446
  var external_exports = {};
@@ -35751,10 +36209,10 @@ function mergeDefs(...defs) {
35751
36209
  function cloneDef(schema) {
35752
36210
  return mergeDefs(schema._zod.def);
35753
36211
  }
35754
- function getElementAtPath(obj, path4) {
35755
- if (!path4)
36212
+ function getElementAtPath(obj, path5) {
36213
+ if (!path5)
35756
36214
  return obj;
35757
- return path4.reduce((acc, key) => acc?.[key], obj);
36215
+ return path5.reduce((acc, key) => acc?.[key], obj);
35758
36216
  }
35759
36217
  function promiseAllObject(promisesObj) {
35760
36218
  const keys = Object.keys(promisesObj);
@@ -36137,11 +36595,11 @@ function aborted(x, startIndex = 0) {
36137
36595
  }
36138
36596
  return false;
36139
36597
  }
36140
- function prefixIssues(path4, issues) {
36598
+ function prefixIssues(path5, issues) {
36141
36599
  return issues.map((iss) => {
36142
36600
  var _a2;
36143
36601
  (_a2 = iss).path ?? (_a2.path = []);
36144
- iss.path.unshift(path4);
36602
+ iss.path.unshift(path5);
36145
36603
  return iss;
36146
36604
  });
36147
36605
  }
@@ -36324,7 +36782,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
36324
36782
  }
36325
36783
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
36326
36784
  const result = { errors: [] };
36327
- const processError = (error49, path4 = []) => {
36785
+ const processError = (error49, path5 = []) => {
36328
36786
  var _a2, _b;
36329
36787
  for (const issue2 of error49.issues) {
36330
36788
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -36334,7 +36792,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
36334
36792
  } else if (issue2.code === "invalid_element") {
36335
36793
  processError({ issues: issue2.issues }, issue2.path);
36336
36794
  } else {
36337
- const fullpath = [...path4, ...issue2.path];
36795
+ const fullpath = [...path5, ...issue2.path];
36338
36796
  if (fullpath.length === 0) {
36339
36797
  result.errors.push(mapper(issue2));
36340
36798
  continue;
@@ -36366,8 +36824,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
36366
36824
  }
36367
36825
  function toDotPath(_path) {
36368
36826
  const segs = [];
36369
- const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
36370
- for (const seg of path4) {
36827
+ const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
36828
+ for (const seg of path5) {
36371
36829
  if (typeof seg === "number")
36372
36830
  segs.push(`[${seg}]`);
36373
36831
  else if (typeof seg === "symbol")
@@ -48344,13 +48802,13 @@ function resolveRef(ref, ctx) {
48344
48802
  if (!ref.startsWith("#")) {
48345
48803
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
48346
48804
  }
48347
- const path4 = ref.slice(1).split("/").filter(Boolean);
48348
- if (path4.length === 0) {
48805
+ const path5 = ref.slice(1).split("/").filter(Boolean);
48806
+ if (path5.length === 0) {
48349
48807
  return ctx.rootSchema;
48350
48808
  }
48351
48809
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
48352
- if (path4[0] === defsKey) {
48353
- const key = path4[1];
48810
+ if (path5[0] === defsKey) {
48811
+ const key = path5[1];
48354
48812
  if (!key || !ctx.defs[key]) {
48355
48813
  throw new Error(`Reference not found: ${ref}`);
48356
48814
  }
@@ -48778,16 +49236,16 @@ var writeProcedure = t.procedure.use(async ({ ctx, next }) => {
48778
49236
  return next();
48779
49237
  });
48780
49238
  var NODE_RELATION2 = "is";
49239
+ function serializeValue2(value) {
49240
+ if (value instanceof Timestamp2) return value.toDate().toISOString();
49241
+ if (Array.isArray(value)) return value.map(serializeValue2);
49242
+ if (value && typeof value === "object") return serializeRecord(value);
49243
+ return value;
49244
+ }
48781
49245
  function serializeRecord(doc) {
48782
49246
  const result = {};
48783
49247
  for (const [key, value] of Object.entries(doc)) {
48784
- if (value instanceof Timestamp2) {
48785
- result[key] = value.toDate().toISOString();
48786
- } else if (value && typeof value === "object" && !Array.isArray(value)) {
48787
- result[key] = serializeRecord(value);
48788
- } else {
48789
- result[key] = value;
48790
- }
49248
+ result[key] = serializeValue2(value);
48791
49249
  }
48792
49250
  return result;
48793
49251
  }
@@ -48800,6 +49258,55 @@ function stripTypePrefix(raw) {
48800
49258
  }
48801
49259
  return raw;
48802
49260
  }
49261
+ function resolveCollectionPath(rootCollection, scope) {
49262
+ if (!scope) return rootCollection;
49263
+ const segments = scope.split("/");
49264
+ if (segments.length % 2 !== 0) {
49265
+ throw new TRPCError({
49266
+ code: "BAD_REQUEST",
49267
+ message: `Invalid scope path: "${scope}". Must be pairs of parentUid/subgraphName.`
49268
+ });
49269
+ }
49270
+ return `${rootCollection}/${scope}`;
49271
+ }
49272
+ function getScopedClient(rootClient, scope) {
49273
+ if (!scope) return rootClient;
49274
+ const segments = scope.split("/");
49275
+ if (segments.length % 2 !== 0) {
49276
+ throw new TRPCError({
49277
+ code: "BAD_REQUEST",
49278
+ message: `Invalid scope path: "${scope}". Must be pairs of parentUid/subgraphName.`
49279
+ });
49280
+ }
49281
+ let client = rootClient;
49282
+ for (let i = 0; i < segments.length; i += 2) {
49283
+ client = client.subgraph(segments[i], segments[i + 1]);
49284
+ }
49285
+ return client;
49286
+ }
49287
+ var scopeSchema = external_exports.string().optional();
49288
+ function substitutePathTemplate(template, params = {}) {
49289
+ return template.replace(/\{([^}]+)\}/g, (_, key) => {
49290
+ if (!(key in params)) {
49291
+ throw new TRPCError({ code: "BAD_REQUEST", message: `Missing required path parameter: "${key}"` });
49292
+ }
49293
+ const val = params[key];
49294
+ if (!val) {
49295
+ throw new TRPCError({ code: "BAD_REQUEST", message: `Path parameter "${key}" must not be empty` });
49296
+ }
49297
+ if (val.includes("/")) {
49298
+ throw new TRPCError({ code: "BAD_REQUEST", message: `Path parameter "${key}" must not contain "/"` });
49299
+ }
49300
+ return val;
49301
+ });
49302
+ }
49303
+ function getCollectionDef(ctx, name) {
49304
+ const def = ctx.collectionDefs.find((c) => c.name === name);
49305
+ if (!def) {
49306
+ throw new TRPCError({ code: "NOT_FOUND", message: `Collection "${name}" not found.` });
49307
+ }
49308
+ return def;
49309
+ }
48803
49310
  var appRouter = t.router({
48804
49311
  // --- Config ---
48805
49312
  getConfig: publicProcedure.query(({ ctx }) => ({
@@ -48827,7 +49334,8 @@ var appRouter = t.router({
48827
49334
  inverseLabel: e.inverseLabel,
48828
49335
  titleField: e.titleField,
48829
49336
  subtitleField: e.subtitleField,
48830
- isDynamic: e.isDynamic
49337
+ isDynamic: e.isDynamic,
49338
+ targetGraph: e.targetGraph
48831
49339
  }));
48832
49340
  return {
48833
49341
  nodeTypes,
@@ -48835,13 +49343,26 @@ var appRouter = t.router({
48835
49343
  readonly: ctx.readonly,
48836
49344
  nodeSchemas: ctx.schemaMetadata.nodeTypes,
48837
49345
  edgeSchemas: ctx.schemaMetadata.edgeTypes,
48838
- dynamicMode: ctx.reloadFn !== null
49346
+ dynamicMode: ctx.reloadFn !== null,
49347
+ collections: ctx.collectionDefs.map((c) => ({
49348
+ name: c.name,
49349
+ path: c.path,
49350
+ description: c.description,
49351
+ typeField: c.typeField,
49352
+ typeValue: c.typeValue,
49353
+ parentNodeType: c.parentNodeType,
49354
+ fields: c.fields,
49355
+ hasSchema: c.hasSchema,
49356
+ pathParams: c.pathParams,
49357
+ defaultOrderBy: c.defaultOrderBy
49358
+ }))
48839
49359
  };
48840
49360
  }),
48841
49361
  // --- Views ---
48842
49362
  getViews: publicProcedure.query(({ ctx }) => {
48843
49363
  const nodes = ctx.viewRegistry?.nodes ? { ...ctx.viewRegistry.nodes } : {};
48844
49364
  const edges = ctx.viewRegistry?.edges ? { ...ctx.viewRegistry.edges } : {};
49365
+ const collections = { ...ctx.collectionViewRegistry };
48845
49366
  if (ctx.dynamicTypeMeta) {
48846
49367
  for (const [name, meta3] of Object.entries(ctx.dynamicTypeMeta.nodes)) {
48847
49368
  if (!meta3.viewTemplate) continue;
@@ -48866,8 +49387,8 @@ var appRouter = t.router({
48866
49387
  }
48867
49388
  }
48868
49389
  }
48869
- const hasViews = Object.keys(nodes).length > 0 || Object.keys(edges).length > 0;
48870
- return { nodes, edges, hasViews };
49390
+ const hasViews = Object.keys(nodes).length > 0 || Object.keys(edges).length > 0 || Object.keys(collections).length > 0;
49391
+ return { nodes, edges, collections, hasViews };
48871
49392
  }),
48872
49393
  // --- Reload Schema (dynamic registry) ---
48873
49394
  reloadSchema: writeProcedure.mutation(async ({ ctx }) => {
@@ -48886,6 +49407,7 @@ var appRouter = t.router({
48886
49407
  })),
48887
49408
  // --- Browse Nodes ---
48888
49409
  getNodes: publicProcedure.input(external_exports.object({
49410
+ scope: scopeSchema,
48889
49411
  type: external_exports.string().optional(),
48890
49412
  limit: external_exports.number().min(1).max(200).default(25),
48891
49413
  startAfter: external_exports.string().optional(),
@@ -48902,7 +49424,7 @@ var appRouter = t.router({
48902
49424
  value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])
48903
49425
  })).optional()
48904
49426
  })).query(async ({ ctx, input }) => {
48905
- const col = ctx.db.collection(ctx.collection);
49427
+ const col = ctx.db.collection(resolveCollectionPath(ctx.collection, input.scope));
48906
49428
  const builtinSortFields = ["aUid", "createdAt", "updatedAt"];
48907
49429
  let effectiveSortBy;
48908
49430
  if (builtinSortFields.includes(input.sortBy)) {
@@ -48950,8 +49472,8 @@ var appRouter = t.router({
48950
49472
  return { nodes, hasMore, nextCursor };
48951
49473
  }),
48952
49474
  // --- Get Single Node ---
48953
- getNodeDetail: publicProcedure.input(external_exports.object({ uid: external_exports.string() })).query(async ({ ctx, input }) => {
48954
- const col = ctx.db.collection(ctx.collection);
49475
+ getNodeDetail: publicProcedure.input(external_exports.object({ scope: scopeSchema, uid: external_exports.string() })).query(async ({ ctx, input }) => {
49476
+ const col = ctx.db.collection(resolveCollectionPath(ctx.collection, input.scope));
48955
49477
  const edgeLimit = 50;
48956
49478
  const uid = stripTypePrefix(input.uid);
48957
49479
  const nodeDoc = await col.doc(uid).get();
@@ -48963,8 +49485,8 @@ var appRouter = t.router({
48963
49485
  return { node, outEdges, inEdges };
48964
49486
  }),
48965
49487
  // --- Batch Get Nodes ---
48966
- getNodesBatch: publicProcedure.input(external_exports.object({ uids: external_exports.array(external_exports.string()).min(1).max(100) })).query(async ({ ctx, input }) => {
48967
- const col = ctx.db.collection(ctx.collection);
49488
+ getNodesBatch: publicProcedure.input(external_exports.object({ scope: scopeSchema, uids: external_exports.array(external_exports.string()).min(1).max(100) })).query(async ({ ctx, input }) => {
49489
+ const col = ctx.db.collection(resolveCollectionPath(ctx.collection, input.scope));
48968
49490
  const cleanUids = input.uids.map(stripTypePrefix);
48969
49491
  const refs = cleanUids.map((uid) => col.doc(uid));
48970
49492
  const snapshots = await ctx.db.getAll(...refs);
@@ -48976,6 +49498,7 @@ var appRouter = t.router({
48976
49498
  }),
48977
49499
  // --- Query Edges ---
48978
49500
  getEdges: publicProcedure.input(external_exports.object({
49501
+ scope: scopeSchema,
48979
49502
  aType: external_exports.string().optional(),
48980
49503
  aUid: external_exports.string().optional(),
48981
49504
  axbType: external_exports.string().optional(),
@@ -48991,7 +49514,7 @@ var appRouter = t.router({
48991
49514
  value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])
48992
49515
  })).optional()
48993
49516
  })).query(async ({ ctx, input }) => {
48994
- const col = ctx.db.collection(ctx.collection);
49517
+ const col = ctx.db.collection(resolveCollectionPath(ctx.collection, input.scope));
48995
49518
  let query = col;
48996
49519
  if (input.aType) query = query.where("aType", "==", input.aType);
48997
49520
  if (input.aUid) query = query.where("aUid", "==", input.aUid);
@@ -49037,6 +49560,7 @@ var appRouter = t.router({
49037
49560
  }),
49038
49561
  // --- Traversal ---
49039
49562
  traverse: publicProcedure.input(external_exports.object({
49563
+ scope: scopeSchema,
49040
49564
  startUid: external_exports.string().min(1),
49041
49565
  hops: external_exports.array(external_exports.object({
49042
49566
  axbType: external_exports.string(),
@@ -49057,7 +49581,7 @@ var appRouter = t.router({
49057
49581
  maxReads: external_exports.number().default(100),
49058
49582
  concurrency: external_exports.number().default(5)
49059
49583
  })).mutation(async ({ ctx, input }) => {
49060
- const col = ctx.db.collection(ctx.collection);
49584
+ const col = ctx.db.collection(resolveCollectionPath(ctx.collection, input.scope));
49061
49585
  let totalReads = 0;
49062
49586
  let truncated = false;
49063
49587
  let sourceUids = [input.startUid];
@@ -49144,12 +49668,13 @@ var appRouter = t.router({
49144
49668
  }),
49145
49669
  // --- Search ---
49146
49670
  search: publicProcedure.input(external_exports.object({
49671
+ scope: scopeSchema,
49147
49672
  q: external_exports.string(),
49148
49673
  limit: external_exports.number().min(1).max(50).default(20)
49149
49674
  })).query(async ({ ctx, input }) => {
49150
49675
  const q = input.q.trim();
49151
49676
  if (!q) return { results: [] };
49152
- const col = ctx.db.collection(ctx.collection);
49677
+ const col = ctx.db.collection(resolveCollectionPath(ctx.collection, input.scope));
49153
49678
  const strippedQ = stripTypePrefix(q);
49154
49679
  const nodeDoc = await col.doc(strippedQ).get();
49155
49680
  const results = [];
@@ -49173,8 +49698,8 @@ var appRouter = t.router({
49173
49698
  return { results: results.slice(0, input.limit) };
49174
49699
  }),
49175
49700
  // --- Check Node Exists ---
49176
- checkNode: publicProcedure.input(external_exports.object({ uid: external_exports.string().min(1) })).query(async ({ ctx, input }) => {
49177
- const doc = await ctx.db.collection(ctx.collection).doc(stripTypePrefix(input.uid)).get();
49701
+ checkNode: publicProcedure.input(external_exports.object({ scope: scopeSchema, uid: external_exports.string().min(1) })).query(async ({ ctx, input }) => {
49702
+ const doc = await ctx.db.collection(resolveCollectionPath(ctx.collection, input.scope)).doc(stripTypePrefix(input.uid)).get();
49178
49703
  if (!doc.exists) return { exists: false, node: null };
49179
49704
  const data = serializeRecord(doc.data());
49180
49705
  return {
@@ -49184,23 +49709,26 @@ var appRouter = t.router({
49184
49709
  }),
49185
49710
  // --- Check Edge Exists ---
49186
49711
  checkEdge: publicProcedure.input(external_exports.object({
49712
+ scope: scopeSchema,
49187
49713
  aUid: external_exports.string().min(1),
49188
49714
  axbType: external_exports.string().min(1),
49189
49715
  bUid: external_exports.string().min(1)
49190
49716
  })).query(async ({ ctx, input }) => {
49191
49717
  const docId = computeEdgeDocId(input.aUid, input.axbType, input.bUid);
49192
- const doc = await ctx.db.collection(ctx.collection).doc(docId).get();
49718
+ const doc = await ctx.db.collection(resolveCollectionPath(ctx.collection, input.scope)).doc(docId).get();
49193
49719
  return { exists: doc.exists };
49194
49720
  }),
49195
49721
  // --- Write: Create Node ---
49196
49722
  createNode: writeProcedure.input(external_exports.object({
49723
+ scope: scopeSchema,
49197
49724
  aType: external_exports.string(),
49198
49725
  uid: external_exports.string().optional(),
49199
49726
  data: external_exports.record(external_exports.string(), external_exports.unknown())
49200
49727
  })).mutation(async ({ ctx, input }) => {
49201
49728
  try {
49729
+ const client = getScopedClient(ctx.graphClient, input.scope);
49202
49730
  const nodeUid = input.uid || generateId();
49203
- await ctx.graphClient.putNode(input.aType, nodeUid, input.data);
49731
+ await client.putNode(input.aType, nodeUid, input.data);
49204
49732
  return { success: true, uid: nodeUid };
49205
49733
  } catch (err) {
49206
49734
  if (err instanceof ValidationError || err instanceof RegistryViolationError) {
@@ -49211,15 +49739,17 @@ var appRouter = t.router({
49211
49739
  }),
49212
49740
  // --- Write: Update Node ---
49213
49741
  updateNode: writeProcedure.input(external_exports.object({
49742
+ scope: scopeSchema,
49214
49743
  uid: external_exports.string(),
49215
49744
  data: external_exports.record(external_exports.string(), external_exports.unknown())
49216
49745
  })).mutation(async ({ ctx, input }) => {
49217
49746
  try {
49218
- const existing = await ctx.graphClient.getNode(input.uid);
49747
+ const client = getScopedClient(ctx.graphClient, input.scope);
49748
+ const existing = await client.getNode(input.uid);
49219
49749
  if (!existing) {
49220
49750
  throw new TRPCError({ code: "NOT_FOUND", message: "Node not found" });
49221
49751
  }
49222
- await ctx.graphClient.putNode(existing.aType, input.uid, input.data);
49752
+ await client.putNode(existing.aType, input.uid, input.data);
49223
49753
  return { success: true };
49224
49754
  } catch (err) {
49225
49755
  if (err instanceof TRPCError) throw err;
@@ -49230,13 +49760,15 @@ var appRouter = t.router({
49230
49760
  }
49231
49761
  }),
49232
49762
  // --- Write: Delete Node ---
49233
- deleteNode: writeProcedure.input(external_exports.object({ uid: external_exports.string() })).mutation(async ({ ctx, input }) => {
49234
- await ctx.graphClient.removeNode(input.uid);
49763
+ deleteNode: writeProcedure.input(external_exports.object({ scope: scopeSchema, uid: external_exports.string() })).mutation(async ({ ctx, input }) => {
49764
+ const client = getScopedClient(ctx.graphClient, input.scope);
49765
+ await client.removeNode(input.uid);
49235
49766
  return { success: true };
49236
49767
  }),
49237
49768
  // --- Write: Delete Node + Cascade (all edges) ---
49238
- deleteNodeCascade: writeProcedure.input(external_exports.object({ uid: external_exports.string() })).mutation(async ({ ctx, input }) => {
49239
- const result = await ctx.graphClient.removeNodeCascade(input.uid);
49769
+ deleteNodeCascade: writeProcedure.input(external_exports.object({ scope: scopeSchema, uid: external_exports.string() })).mutation(async ({ ctx, input }) => {
49770
+ const client = getScopedClient(ctx.graphClient, input.scope);
49771
+ const result = await client.removeNodeCascade(input.uid);
49240
49772
  return {
49241
49773
  success: result.nodeDeleted,
49242
49774
  edgesDeleted: result.edgesDeleted,
@@ -49250,6 +49782,7 @@ var appRouter = t.router({
49250
49782
  }),
49251
49783
  // --- Write: Create Edge ---
49252
49784
  createEdge: writeProcedure.input(external_exports.object({
49785
+ scope: scopeSchema,
49253
49786
  aType: external_exports.string(),
49254
49787
  aUid: external_exports.string(),
49255
49788
  axbType: external_exports.string(),
@@ -49258,7 +49791,8 @@ var appRouter = t.router({
49258
49791
  data: external_exports.record(external_exports.string(), external_exports.unknown())
49259
49792
  })).mutation(async ({ ctx, input }) => {
49260
49793
  try {
49261
- await ctx.graphClient.putEdge(
49794
+ const client = getScopedClient(ctx.graphClient, input.scope);
49795
+ await client.putEdge(
49262
49796
  input.aType,
49263
49797
  input.aUid,
49264
49798
  input.axbType,
@@ -49276,6 +49810,7 @@ var appRouter = t.router({
49276
49810
  }),
49277
49811
  // --- Write: Create Edge + Target Node atomically ---
49278
49812
  createEdgeWithNode: writeProcedure.input(external_exports.object({
49813
+ scope: scopeSchema,
49279
49814
  aType: external_exports.string(),
49280
49815
  axbType: external_exports.string(),
49281
49816
  bType: external_exports.string(),
@@ -49289,13 +49824,14 @@ var appRouter = t.router({
49289
49824
  nodeData: external_exports.record(external_exports.string(), external_exports.unknown())
49290
49825
  })).mutation(async ({ ctx, input }) => {
49291
49826
  try {
49827
+ const client = getScopedClient(ctx.graphClient, input.scope);
49292
49828
  const newUid = input.newNodeUid || generateId();
49293
49829
  const newNodeType = input.newNodeSide === "b" ? input.bType : input.aType;
49294
49830
  const aUid = input.newNodeSide === "a" ? newUid : input.existingUid;
49295
49831
  const bUid = input.newNodeSide === "b" ? newUid : input.existingUid;
49296
49832
  const [existingNode, existingEdge] = await Promise.all([
49297
- ctx.graphClient.getNode(newUid),
49298
- ctx.graphClient.getEdge(aUid, input.axbType, bUid)
49833
+ client.getNode(newUid),
49834
+ client.getEdge(aUid, input.axbType, bUid)
49299
49835
  ]);
49300
49836
  if (existingNode && existingEdge) {
49301
49837
  throw new TRPCError({
@@ -49303,7 +49839,7 @@ var appRouter = t.router({
49303
49839
  message: `Both node "${newUid}" and edge ${aUid} \u2014[${input.axbType}]\u2192 ${bUid} already exist.`
49304
49840
  });
49305
49841
  }
49306
- await ctx.graphClient.runTransaction(async (tx) => {
49842
+ await client.runTransaction(async (tx) => {
49307
49843
  if (!existingNode) {
49308
49844
  await tx.putNode(newNodeType, newUid, input.nodeData);
49309
49845
  }
@@ -49327,15 +49863,18 @@ var appRouter = t.router({
49327
49863
  }),
49328
49864
  // --- Write: Delete Edge ---
49329
49865
  deleteEdge: writeProcedure.input(external_exports.object({
49866
+ scope: scopeSchema,
49330
49867
  aUid: external_exports.string(),
49331
49868
  axbType: external_exports.string(),
49332
49869
  bUid: external_exports.string()
49333
49870
  })).mutation(async ({ ctx, input }) => {
49334
- await ctx.graphClient.removeEdge(input.aUid, input.axbType, input.bUid);
49871
+ const client = getScopedClient(ctx.graphClient, input.scope);
49872
+ await client.removeEdge(input.aUid, input.axbType, input.bUid);
49335
49873
  return { success: true };
49336
49874
  }),
49337
49875
  // --- Write: Bulk Delete Edges (by query) ---
49338
49876
  bulkDeleteEdges: writeProcedure.input(external_exports.object({
49877
+ scope: scopeSchema,
49339
49878
  aUid: external_exports.string().optional(),
49340
49879
  axbType: external_exports.string().optional(),
49341
49880
  bUid: external_exports.string().optional(),
@@ -49347,12 +49886,13 @@ var appRouter = t.router({
49347
49886
  value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])
49348
49887
  })).optional()
49349
49888
  })).mutation(async ({ ctx, input }) => {
49350
- const { where: whereClauses, ...params } = input;
49889
+ const client = getScopedClient(ctx.graphClient, input.scope);
49890
+ const { where: whereClauses, scope: _scope, ...params } = input;
49351
49891
  const findParams = { ...params };
49352
49892
  if (whereClauses && whereClauses.length > 0) {
49353
49893
  findParams.where = whereClauses;
49354
49894
  }
49355
- const result = await ctx.graphClient.bulkRemoveEdges(findParams);
49895
+ const result = await client.bulkRemoveEdges(findParams);
49356
49896
  return {
49357
49897
  success: true,
49358
49898
  deleted: result.deleted,
@@ -49366,18 +49906,147 @@ var appRouter = t.router({
49366
49906
  }),
49367
49907
  // --- Write: Delete specific edges by ID ---
49368
49908
  deleteEdgesBatch: writeProcedure.input(external_exports.object({
49909
+ scope: scopeSchema,
49369
49910
  edges: external_exports.array(external_exports.object({
49370
49911
  aUid: external_exports.string(),
49371
49912
  axbType: external_exports.string(),
49372
49913
  bUid: external_exports.string()
49373
49914
  })).min(1).max(500)
49374
49915
  })).mutation(async ({ ctx, input }) => {
49375
- const batch = ctx.graphClient.batch();
49916
+ const client = getScopedClient(ctx.graphClient, input.scope);
49917
+ const batch = client.batch();
49376
49918
  for (const e of input.edges) {
49377
49919
  await batch.removeEdge(e.aUid, e.axbType, e.bUid);
49378
49920
  }
49379
49921
  await batch.commit();
49380
49922
  return { success: true, deleted: input.edges.length };
49923
+ }),
49924
+ // --- Plain Collection Procedures ---
49925
+ getCollectionDocs: publicProcedure.input(external_exports.object({
49926
+ collectionName: external_exports.string(),
49927
+ params: external_exports.record(external_exports.string(), external_exports.string()).optional(),
49928
+ cursor: external_exports.string().optional(),
49929
+ limit: external_exports.number().int().min(1).max(100).default(50),
49930
+ where: external_exports.array(external_exports.object({
49931
+ field: external_exports.string(),
49932
+ op: external_exports.string(),
49933
+ value: external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean()])
49934
+ })).optional()
49935
+ })).query(async ({ ctx, input }) => {
49936
+ const def = getCollectionDef(ctx, input.collectionName);
49937
+ const colPath = substitutePathTemplate(def.path, input.params ?? {});
49938
+ const col = ctx.db.collection(colPath);
49939
+ const allowedOps = ["==", "!=", "<", "<=", ">", ">="];
49940
+ const schemaFieldNames = def.fields.length > 0 ? new Set(def.fields.map((f) => f.name)) : null;
49941
+ const safeFieldNameRe = /^[a-zA-Z_][a-zA-Z0-9_.]*$/;
49942
+ let query = col;
49943
+ if (def.typeField && def.typeValue !== void 0) {
49944
+ query = query.where(def.typeField, "==", def.typeValue);
49945
+ }
49946
+ if (input.where?.length) {
49947
+ for (const clause of input.where) {
49948
+ if (!allowedOps.includes(clause.op)) continue;
49949
+ if (schemaFieldNames ? !schemaFieldNames.has(clause.field) : !safeFieldNameRe.test(clause.field)) continue;
49950
+ query = query.where(clause.field, clause.op, clause.value);
49951
+ }
49952
+ }
49953
+ if (def.defaultOrderBy) {
49954
+ query = query.orderBy(def.defaultOrderBy.field, def.defaultOrderBy.direction);
49955
+ } else {
49956
+ query = query.orderBy(FieldPath.documentId());
49957
+ }
49958
+ query = query.limit(input.limit + 1);
49959
+ if (input.cursor) {
49960
+ const cursorSnap = await col.doc(input.cursor).get();
49961
+ if (!cursorSnap.exists) {
49962
+ throw new TRPCError({
49963
+ code: "NOT_FOUND",
49964
+ message: `Cursor document "${input.cursor}" no longer exists. Refresh to start from the first page.`
49965
+ });
49966
+ }
49967
+ query = query.startAfter(cursorSnap);
49968
+ }
49969
+ const snapshot = await query.get();
49970
+ const docs = snapshot.docs.slice(0, input.limit);
49971
+ const hasMore = snapshot.docs.length > input.limit;
49972
+ const documents = docs.map((doc) => ({
49973
+ id: doc.id,
49974
+ data: serializeRecord(doc.data())
49975
+ }));
49976
+ const nextCursor = hasMore && docs.length > 0 ? docs[docs.length - 1].id : null;
49977
+ return {
49978
+ documents,
49979
+ hasMore,
49980
+ nextCursor
49981
+ };
49982
+ }),
49983
+ getCollectionDoc: publicProcedure.input(external_exports.object({
49984
+ collectionName: external_exports.string(),
49985
+ params: external_exports.record(external_exports.string(), external_exports.string()).optional(),
49986
+ docId: external_exports.string()
49987
+ })).query(async ({ ctx, input }) => {
49988
+ const def = getCollectionDef(ctx, input.collectionName);
49989
+ const colPath = substitutePathTemplate(def.path, input.params ?? {});
49990
+ const snap = await ctx.db.collection(colPath).doc(input.docId).get();
49991
+ if (!snap.exists) {
49992
+ throw new TRPCError({ code: "NOT_FOUND", message: `Document "${input.docId}" not found.` });
49993
+ }
49994
+ const docData = snap.data();
49995
+ if (def.typeField && def.typeValue !== void 0 && docData[def.typeField] !== def.typeValue) {
49996
+ throw new TRPCError({ code: "NOT_FOUND", message: `Document "${input.docId}" not found.` });
49997
+ }
49998
+ return { id: snap.id, data: serializeRecord(docData) };
49999
+ }),
50000
+ createCollectionDoc: writeProcedure.input(external_exports.object({
50001
+ collectionName: external_exports.string(),
50002
+ params: external_exports.record(external_exports.string(), external_exports.string()).optional(),
50003
+ data: external_exports.record(external_exports.string(), external_exports.unknown())
50004
+ })).mutation(async ({ ctx, input }) => {
50005
+ const def = getCollectionDef(ctx, input.collectionName);
50006
+ const colPath = substitutePathTemplate(def.path, input.params ?? {});
50007
+ const docData = { ...input.data };
50008
+ if (def.typeField && def.typeValue !== void 0) {
50009
+ docData[def.typeField] = def.typeValue;
50010
+ }
50011
+ const docRef = await ctx.db.collection(colPath).add(docData);
50012
+ return { success: true, id: docRef.id };
50013
+ }),
50014
+ updateCollectionDoc: writeProcedure.input(external_exports.object({
50015
+ collectionName: external_exports.string(),
50016
+ params: external_exports.record(external_exports.string(), external_exports.string()).optional(),
50017
+ docId: external_exports.string(),
50018
+ data: external_exports.record(external_exports.string(), external_exports.unknown())
50019
+ })).mutation(async ({ ctx, input }) => {
50020
+ const def = getCollectionDef(ctx, input.collectionName);
50021
+ const colPath = substitutePathTemplate(def.path, input.params ?? {});
50022
+ if (def.typeField && def.typeValue !== void 0) {
50023
+ const snap = await ctx.db.collection(colPath).doc(input.docId).get();
50024
+ if (!snap.exists || snap.data()[def.typeField] !== def.typeValue) {
50025
+ throw new TRPCError({ code: "NOT_FOUND", message: `Document "${input.docId}" not found.` });
50026
+ }
50027
+ }
50028
+ const docData = { ...input.data };
50029
+ if (def.typeField && def.typeValue !== void 0) {
50030
+ docData[def.typeField] = def.typeValue;
50031
+ }
50032
+ await ctx.db.collection(colPath).doc(input.docId).set(docData, { merge: true });
50033
+ return { success: true };
50034
+ }),
50035
+ deleteCollectionDoc: writeProcedure.input(external_exports.object({
50036
+ collectionName: external_exports.string(),
50037
+ params: external_exports.record(external_exports.string(), external_exports.string()).optional(),
50038
+ docId: external_exports.string()
50039
+ })).mutation(async ({ ctx, input }) => {
50040
+ const def = getCollectionDef(ctx, input.collectionName);
50041
+ const colPath = substitutePathTemplate(def.path, input.params ?? {});
50042
+ if (def.typeField && def.typeValue !== void 0) {
50043
+ const snap = await ctx.db.collection(colPath).doc(input.docId).get();
50044
+ if (!snap.exists || snap.data()[def.typeField] !== def.typeValue) {
50045
+ throw new TRPCError({ code: "NOT_FOUND", message: `Document "${input.docId}" not found.` });
50046
+ }
50047
+ }
50048
+ await ctx.db.collection(colPath).doc(input.docId).delete();
50049
+ return { success: true };
49381
50050
  })
49382
50051
  });
49383
50052
 
@@ -49869,7 +50538,7 @@ ${elements.join("\n")}`;
49869
50538
  }
49870
50539
 
49871
50540
  // editor/server/index.ts
49872
- var __dirname = path3.dirname(fileURLToPath(import.meta.url));
50541
+ var __dirname = path4.dirname(fileURLToPath(import.meta.url));
49873
50542
  function parseArgs() {
49874
50543
  const args = process.argv.slice(2);
49875
50544
  let configPath;
@@ -49929,6 +50598,8 @@ var resolvedChatEnabled = false;
49929
50598
  var resolvedChatModel = "sonnet";
49930
50599
  var resolvedChatMaxConcurrency = 2;
49931
50600
  var viewDefaultsData = null;
50601
+ var resolvedCollectionDefs = [];
50602
+ var collectionViewRegistry = {};
49932
50603
  var resolvedRegistryMode;
49933
50604
  var db;
49934
50605
  var state = {
@@ -49951,7 +50622,7 @@ async function init() {
49951
50622
  const fileConfig = loaded?.config ?? {};
49952
50623
  if (loaded) {
49953
50624
  resolvedConfigPath = loaded.configPath;
49954
- console.log(` Config loaded from ${path3.relative(process.cwd(), loaded.configPath)}`);
50625
+ console.log(` Config loaded from ${path4.relative(process.cwd(), loaded.configPath)}`);
49955
50626
  }
49956
50627
  resolvedProject = cliArgs.project ?? fileConfig.project;
49957
50628
  resolvedCollection = cliArgs.collection ?? fileConfig.collection ?? "graph";
@@ -50074,6 +50745,11 @@ async function reloadDynamicSchema() {
50074
50745
  async function initEntitiesMode(fileConfig) {
50075
50746
  console.log(` Discovering entities from ${resolvedEntitiesPath}...`);
50076
50747
  const { result: discovery, warnings } = discoverEntities(resolvedEntitiesPath);
50748
+ resolvedCollectionDefs = discoverCollections(resolvedEntitiesPath);
50749
+ if (resolvedCollectionDefs.length > 0) {
50750
+ console.log(` Collections loaded: ${resolvedCollectionDefs.length} collection(s)`);
50751
+ }
50752
+ collectionViewRegistry = await buildCollectionViewRegistry(resolvedCollectionDefs);
50077
50753
  if (warnings.length > 0) {
50078
50754
  for (const w of warnings) {
50079
50755
  console.log(` [warn] ${w.message}`);
@@ -50097,8 +50773,11 @@ async function initEntitiesMode(fileConfig) {
50097
50773
  const nodeViewCount = Object.values(state.viewRegistry.nodes).reduce((sum, m) => sum + m.views.length, 0);
50098
50774
  const edgeViewCount = Object.values(state.viewRegistry.edges).reduce((sum, m) => sum + m.views.length, 0);
50099
50775
  console.log(` Views loaded: ${nodeViewCount} node views, ${edgeViewCount} edge views`);
50776
+ }
50777
+ const colViewPaths = resolvedCollectionDefs.filter((c) => c.viewsPath).map((c) => ({ name: c.name, absPath: path4.resolve(c.viewsPath) }));
50778
+ if (state.viewRegistry || colViewPaths.length > 0) {
50100
50779
  console.log(` Bundling views for browser...`);
50101
- state.viewBundle = await bundleEntityViews(discovery);
50780
+ state.viewBundle = await bundleEntityViews(discovery, colViewPaths);
50102
50781
  if (state.viewBundle) {
50103
50782
  console.log(` Views bundled (${(state.viewBundle.code.length / 1024).toFixed(1)} KB)`);
50104
50783
  }
@@ -50159,7 +50838,9 @@ async function start() {
50159
50838
  projectId: resolvedProject,
50160
50839
  viewDefaults: viewDefaultsData,
50161
50840
  chatEnabled: resolvedChatEnabled,
50162
- chatModel: resolvedChatModel
50841
+ chatModel: resolvedChatModel,
50842
+ collectionDefs: resolvedCollectionDefs,
50843
+ collectionViewRegistry
50163
50844
  },
50164
50845
  state,
50165
50846
  resolvedRegistryMode ? reloadDynamicSchema : void 0
@@ -50175,17 +50856,17 @@ async function start() {
50175
50856
  }
50176
50857
  const isProduction = process.env.NODE_ENV === "production";
50177
50858
  if (isProduction) {
50178
- const clientDir = path3.join(__dirname, "..", "client");
50859
+ const clientDir = path4.join(__dirname, "..", "client");
50179
50860
  app.use(import_express.default.static(clientDir));
50180
50861
  app.get("*", (_req, res) => {
50181
- res.sendFile(path3.join(clientDir, "index.html"));
50862
+ res.sendFile(path4.join(clientDir, "index.html"));
50182
50863
  });
50183
50864
  }
50184
50865
  const server = app.listen(resolvedPort, () => {
50185
50866
  console.log("");
50186
50867
  console.log(" Firegraph Editor");
50187
50868
  if (resolvedConfigPath) {
50188
- console.log(` Config: ${path3.relative(process.cwd(), resolvedConfigPath)}`);
50869
+ console.log(` Config: ${path4.relative(process.cwd(), resolvedConfigPath)}`);
50189
50870
  }
50190
50871
  console.log(` Project: ${resolvedProject || "(auto-detected via ADC)"}`);
50191
50872
  console.log(` Collection: ${resolvedCollection}`);