casualos 3.3.11-alpha.11349749950 → 3.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -9817,8 +9817,8 @@ var require_keyword = __commonJS({
9817
9817
  var _a4;
9818
9818
  const { gen, keyword, schema, parentSchema, $data, it: it2 } = cxt;
9819
9819
  checkAsyncKeyword(it2, def);
9820
- const validate = !$data && def.compile ? def.compile.call(it2.self, schema, parentSchema, it2) : def.validate;
9821
- const validateRef = useKeyword(gen, keyword, validate);
9820
+ const validate2 = !$data && def.compile ? def.compile.call(it2.self, schema, parentSchema, it2) : def.validate;
9821
+ const validateRef = useKeyword(gen, keyword, validate2);
9822
9822
  const valid = gen.let("valid");
9823
9823
  cxt.block$data(valid, validateKeyword);
9824
9824
  cxt.ok((_a4 = def.valid) !== null && _a4 !== void 0 ? _a4 : valid);
@@ -10900,28 +10900,28 @@ var require_compile = __commonJS({
10900
10900
  if (this.opts.code.process)
10901
10901
  sourceCode = this.opts.code.process(sourceCode, sch);
10902
10902
  const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
10903
- const validate = makeValidate(this, this.scope.get());
10904
- this.scope.value(validateName, { ref: validate });
10905
- validate.errors = null;
10906
- validate.schema = sch.schema;
10907
- validate.schemaEnv = sch;
10903
+ const validate2 = makeValidate(this, this.scope.get());
10904
+ this.scope.value(validateName, { ref: validate2 });
10905
+ validate2.errors = null;
10906
+ validate2.schema = sch.schema;
10907
+ validate2.schemaEnv = sch;
10908
10908
  if (sch.$async)
10909
- validate.$async = true;
10909
+ validate2.$async = true;
10910
10910
  if (this.opts.code.source === true) {
10911
- validate.source = { validateName, validateCode, scopeValues: gen._values };
10911
+ validate2.source = { validateName, validateCode, scopeValues: gen._values };
10912
10912
  }
10913
10913
  if (this.opts.unevaluated) {
10914
10914
  const { props, items } = schemaCxt;
10915
- validate.evaluated = {
10915
+ validate2.evaluated = {
10916
10916
  props: props instanceof codegen_1.Name ? void 0 : props,
10917
10917
  items: items instanceof codegen_1.Name ? void 0 : items,
10918
10918
  dynamicProps: props instanceof codegen_1.Name,
10919
10919
  dynamicItems: items instanceof codegen_1.Name
10920
10920
  };
10921
- if (validate.source)
10922
- validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);
10921
+ if (validate2.source)
10922
+ validate2.source.evaluated = (0, codegen_1.stringify)(validate2.evaluated);
10923
10923
  }
10924
- sch.validate = validate;
10924
+ sch.validate = validate2;
10925
10925
  return sch;
10926
10926
  } catch (e2) {
10927
10927
  delete sch.validate;
@@ -11596,7 +11596,7 @@ var require_uri_all = __commonJS({
11596
11596
  }
11597
11597
  var URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
11598
11598
  var NO_MATCH_IS_UNDEFINED = "".match(/(){0}/)[1] === void 0;
11599
- function parse3(uriString) {
11599
+ function parse4(uriString) {
11600
11600
  var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
11601
11601
  var components = {};
11602
11602
  var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL;
@@ -11767,8 +11767,8 @@ var require_uri_all = __commonJS({
11767
11767
  var skipNormalization = arguments[3];
11768
11768
  var target = {};
11769
11769
  if (!skipNormalization) {
11770
- base2 = parse3(serialize(base2, options), options);
11771
- relative = parse3(serialize(relative, options), options);
11770
+ base2 = parse4(serialize(base2, options), options);
11771
+ relative = parse4(serialize(relative, options), options);
11772
11772
  }
11773
11773
  options = options || {};
11774
11774
  if (!options.tolerant && relative.scheme) {
@@ -11819,24 +11819,24 @@ var require_uri_all = __commonJS({
11819
11819
  }
11820
11820
  function resolve2(baseURI, relativeURI, options) {
11821
11821
  var schemelessOptions = assign2({ scheme: "null" }, options);
11822
- return serialize(resolveComponents(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
11822
+ return serialize(resolveComponents(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
11823
11823
  }
11824
11824
  function normalize(uri, options) {
11825
11825
  if (typeof uri === "string") {
11826
- uri = serialize(parse3(uri, options), options);
11826
+ uri = serialize(parse4(uri, options), options);
11827
11827
  } else if (typeOf(uri) === "object") {
11828
- uri = parse3(serialize(uri, options), options);
11828
+ uri = parse4(serialize(uri, options), options);
11829
11829
  }
11830
11830
  return uri;
11831
11831
  }
11832
11832
  function equal(uriA, uriB, options) {
11833
11833
  if (typeof uriA === "string") {
11834
- uriA = serialize(parse3(uriA, options), options);
11834
+ uriA = serialize(parse4(uriA, options), options);
11835
11835
  } else if (typeOf(uriA) === "object") {
11836
11836
  uriA = serialize(uriA, options);
11837
11837
  }
11838
11838
  if (typeof uriB === "string") {
11839
- uriB = serialize(parse3(uriB, options), options);
11839
+ uriB = serialize(parse4(uriB, options), options);
11840
11840
  } else if (typeOf(uriB) === "object") {
11841
11841
  uriB = serialize(uriB, options);
11842
11842
  }
@@ -11851,7 +11851,7 @@ var require_uri_all = __commonJS({
11851
11851
  var handler2 = {
11852
11852
  scheme: "http",
11853
11853
  domainHost: true,
11854
- parse: function parse4(components, options) {
11854
+ parse: function parse5(components, options) {
11855
11855
  if (!components.host) {
11856
11856
  components.error = components.error || "HTTP URIs must have a host.";
11857
11857
  }
@@ -11880,7 +11880,7 @@ var require_uri_all = __commonJS({
11880
11880
  var handler$2 = {
11881
11881
  scheme: "ws",
11882
11882
  domainHost: true,
11883
- parse: function parse4(components, options) {
11883
+ parse: function parse5(components, options) {
11884
11884
  var wsComponents = components;
11885
11885
  wsComponents.secure = isSecure(wsComponents);
11886
11886
  wsComponents.resourceName = (wsComponents.path || "/") + (wsComponents.query ? "?" + wsComponents.query : "");
@@ -12056,7 +12056,7 @@ var require_uri_all = __commonJS({
12056
12056
  var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/;
12057
12057
  var handler$6 = {
12058
12058
  scheme: "urn:uuid",
12059
- parse: function parse4(urnComponents, options) {
12059
+ parse: function parse5(urnComponents, options) {
12060
12060
  var uuidComponents = urnComponents;
12061
12061
  uuidComponents.uuid = uuidComponents.nss;
12062
12062
  uuidComponents.nss = void 0;
@@ -12081,7 +12081,7 @@ var require_uri_all = __commonJS({
12081
12081
  exports2.SCHEMES = SCHEMES;
12082
12082
  exports2.pctEncChar = pctEncChar;
12083
12083
  exports2.pctDecChars = pctDecChars;
12084
- exports2.parse = parse3;
12084
+ exports2.parse = parse4;
12085
12085
  exports2.removeDotSegments = removeDotSegments;
12086
12086
  exports2.serialize = serialize;
12087
12087
  exports2.resolveComponents = resolveComponents;
@@ -14746,8 +14746,8 @@ var require_formats = __commonJS({
14746
14746
  "use strict";
14747
14747
  Object.defineProperty(exports, "__esModule", { value: true });
14748
14748
  exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
14749
- function fmtDef(validate, compare) {
14750
- return { validate, compare };
14749
+ function fmtDef(validate2, compare) {
14750
+ return { validate: validate2, compare };
14751
14751
  }
14752
14752
  exports.fullFormats = {
14753
14753
  // date: http://tools.ietf.org/html/rfc3339#section-5.6
@@ -15428,7 +15428,7 @@ var require_semver = __commonJS({
15428
15428
  var require_parse = __commonJS({
15429
15429
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/parse.js"(exports, module2) {
15430
15430
  var SemVer = require_semver();
15431
- var parse3 = (version, options, throwErrors = false) => {
15431
+ var parse4 = (version, options, throwErrors = false) => {
15432
15432
  if (version instanceof SemVer) {
15433
15433
  return version;
15434
15434
  }
@@ -15441,16 +15441,16 @@ var require_parse = __commonJS({
15441
15441
  throw er2;
15442
15442
  }
15443
15443
  };
15444
- module2.exports = parse3;
15444
+ module2.exports = parse4;
15445
15445
  }
15446
15446
  });
15447
15447
 
15448
15448
  // ../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/valid.js
15449
15449
  var require_valid = __commonJS({
15450
15450
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/valid.js"(exports, module2) {
15451
- var parse3 = require_parse();
15451
+ var parse4 = require_parse();
15452
15452
  var valid = (version, options) => {
15453
- const v2 = parse3(version, options);
15453
+ const v2 = parse4(version, options);
15454
15454
  return v2 ? v2.version : null;
15455
15455
  };
15456
15456
  module2.exports = valid;
@@ -15460,9 +15460,9 @@ var require_valid = __commonJS({
15460
15460
  // ../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/clean.js
15461
15461
  var require_clean = __commonJS({
15462
15462
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/clean.js"(exports, module2) {
15463
- var parse3 = require_parse();
15463
+ var parse4 = require_parse();
15464
15464
  var clean = (version, options) => {
15465
- const s3 = parse3(version.trim().replace(/^[=v]+/, ""), options);
15465
+ const s3 = parse4(version.trim().replace(/^[=v]+/, ""), options);
15466
15466
  return s3 ? s3.version : null;
15467
15467
  };
15468
15468
  module2.exports = clean;
@@ -15495,10 +15495,10 @@ var require_inc = __commonJS({
15495
15495
  // ../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/diff.js
15496
15496
  var require_diff = __commonJS({
15497
15497
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/diff.js"(exports, module2) {
15498
- var parse3 = require_parse();
15498
+ var parse4 = require_parse();
15499
15499
  var diff = (version1, version2) => {
15500
- const v1 = parse3(version1, null, true);
15501
- const v2 = parse3(version2, null, true);
15500
+ const v1 = parse4(version1, null, true);
15501
+ const v2 = parse4(version2, null, true);
15502
15502
  const comparison = v1.compare(v2);
15503
15503
  if (comparison === 0) {
15504
15504
  return null;
@@ -15566,9 +15566,9 @@ var require_patch = __commonJS({
15566
15566
  // ../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/prerelease.js
15567
15567
  var require_prerelease = __commonJS({
15568
15568
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/prerelease.js"(exports, module2) {
15569
- var parse3 = require_parse();
15569
+ var parse4 = require_parse();
15570
15570
  var prerelease = (version, options) => {
15571
- const parsed = parse3(version, options);
15571
+ const parsed = parse4(version, options);
15572
15572
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
15573
15573
  };
15574
15574
  module2.exports = prerelease;
@@ -15740,7 +15740,7 @@ var require_cmp = __commonJS({
15740
15740
  var require_coerce = __commonJS({
15741
15741
  "../../node_modules/.pnpm/semver@7.5.4/node_modules/semver/functions/coerce.js"(exports, module2) {
15742
15742
  var SemVer = require_semver();
15743
- var parse3 = require_parse();
15743
+ var parse4 = require_parse();
15744
15744
  var { safeRe: re3, t: t2 } = require_re();
15745
15745
  var coerce2 = (version, options) => {
15746
15746
  if (version instanceof SemVer) {
@@ -15769,7 +15769,7 @@ var require_coerce = __commonJS({
15769
15769
  if (match2 === null) {
15770
15770
  return null;
15771
15771
  }
15772
- return parse3(`${match2[2]}.${match2[3] || "0"}.${match2[4] || "0"}`, options);
15772
+ return parse4(`${match2[2]}.${match2[3] || "0"}.${match2[4] || "0"}`, options);
15773
15773
  };
15774
15774
  module2.exports = coerce2;
15775
15775
  }
@@ -17366,7 +17366,7 @@ var require_semver2 = __commonJS({
17366
17366
  var constants3 = require_constants();
17367
17367
  var SemVer = require_semver();
17368
17368
  var identifiers = require_identifiers();
17369
- var parse3 = require_parse();
17369
+ var parse4 = require_parse();
17370
17370
  var valid = require_valid();
17371
17371
  var clean = require_clean();
17372
17372
  var inc = require_inc();
@@ -17404,7 +17404,7 @@ var require_semver2 = __commonJS({
17404
17404
  var simplifyRange = require_simplify();
17405
17405
  var subset = require_subset();
17406
17406
  module2.exports = {
17407
- parse: parse3,
17407
+ parse: parse4,
17408
17408
  valid,
17409
17409
  clean,
17410
17410
  inc,
@@ -20912,7 +20912,7 @@ var require_lodash = __commonJS({
20912
20912
  function uniq2(array) {
20913
20913
  return array && array.length ? baseUniq(array) : [];
20914
20914
  }
20915
- function uniqBy(array, iteratee2) {
20915
+ function uniqBy2(array, iteratee2) {
20916
20916
  return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : [];
20917
20917
  }
20918
20918
  function uniqWith(array, comparator) {
@@ -22572,7 +22572,7 @@ var require_lodash = __commonJS({
22572
22572
  lodash.unionBy = unionBy2;
22573
22573
  lodash.unionWith = unionWith;
22574
22574
  lodash.uniq = uniq2;
22575
- lodash.uniqBy = uniqBy;
22575
+ lodash.uniqBy = uniqBy2;
22576
22576
  lodash.uniqWith = uniqWith;
22577
22577
  lodash.unset = unset;
22578
22578
  lodash.unzip = unzip;
@@ -25206,23 +25206,23 @@ var require_nacl_fast = __commonJS({
25206
25206
  randombytes = fn;
25207
25207
  };
25208
25208
  (function() {
25209
- var crypto7 = typeof self !== "undefined" ? self.crypto || self.msCrypto : null;
25210
- if (crypto7 && crypto7.getRandomValues) {
25209
+ var crypto8 = typeof self !== "undefined" ? self.crypto || self.msCrypto : null;
25210
+ if (crypto8 && crypto8.getRandomValues) {
25211
25211
  var QUOTA = 65536;
25212
25212
  nacl.setPRNG(function(x2, n3) {
25213
25213
  var i2, v2 = new Uint8Array(n3);
25214
25214
  for (i2 = 0; i2 < n3; i2 += QUOTA) {
25215
- crypto7.getRandomValues(v2.subarray(i2, i2 + Math.min(n3 - i2, QUOTA)));
25215
+ crypto8.getRandomValues(v2.subarray(i2, i2 + Math.min(n3 - i2, QUOTA)));
25216
25216
  }
25217
25217
  for (i2 = 0; i2 < n3; i2++)
25218
25218
  x2[i2] = v2[i2];
25219
25219
  cleanup(v2);
25220
25220
  });
25221
25221
  } else if (typeof require !== "undefined") {
25222
- crypto7 = require("crypto");
25223
- if (crypto7 && crypto7.randomBytes) {
25222
+ crypto8 = require("crypto");
25223
+ if (crypto8 && crypto8.randomBytes) {
25224
25224
  nacl.setPRNG(function(x2, n3) {
25225
- var i2, v2 = crypto7.randomBytes(n3);
25225
+ var i2, v2 = crypto8.randomBytes(n3);
25226
25226
  for (i2 = 0; i2 < n3; i2++)
25227
25227
  x2[i2] = v2[i2];
25228
25228
  cleanup(v2);
@@ -44689,7 +44689,7 @@ var require_ms = __commonJS({
44689
44689
  options = options || {};
44690
44690
  var type = typeof val;
44691
44691
  if (type === "string" && val.length > 0) {
44692
- return parse3(val);
44692
+ return parse4(val);
44693
44693
  } else if (type === "number" && isFinite(val)) {
44694
44694
  return options.long ? fmtLong(val) : fmtShort(val);
44695
44695
  }
@@ -44697,7 +44697,7 @@ var require_ms = __commonJS({
44697
44697
  "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
44698
44698
  );
44699
44699
  };
44700
- function parse3(str2) {
44700
+ function parse4(str2) {
44701
44701
  str2 = String(str2);
44702
44702
  if (str2.length > 100) {
44703
44703
  return;
@@ -45448,7 +45448,7 @@ var require_debug2 = __commonJS({
45448
45448
  var require_follow_redirects = __commonJS({
45449
45449
  "../../node_modules/.pnpm/follow-redirects@1.15.3/node_modules/follow-redirects/index.js"(exports, module2) {
45450
45450
  var url2 = require("url");
45451
- var URL2 = url2.URL;
45451
+ var URL3 = url2.URL;
45452
45452
  var http2 = require("http");
45453
45453
  var https2 = require("https");
45454
45454
  var Writable = require("stream").Writable;
@@ -45791,7 +45791,7 @@ var require_follow_redirects = __commonJS({
45791
45791
  if (isString4(input2)) {
45792
45792
  var parsed;
45793
45793
  try {
45794
- parsed = urlToOptions(new URL2(input2));
45794
+ parsed = urlToOptions(new URL3(input2));
45795
45795
  } catch (err) {
45796
45796
  parsed = url2.parse(input2);
45797
45797
  }
@@ -45799,7 +45799,7 @@ var require_follow_redirects = __commonJS({
45799
45799
  throw new InvalidUrlError({ input: input2 });
45800
45800
  }
45801
45801
  input2 = parsed;
45802
- } else if (URL2 && input2 instanceof URL2) {
45802
+ } else if (URL3 && input2 instanceof URL3) {
45803
45803
  input2 = urlToOptions(input2);
45804
45804
  } else {
45805
45805
  callback = options;
@@ -47486,8 +47486,8 @@ var require_URL = __commonJS({
47486
47486
  var utils = require_utils2();
47487
47487
  var Impl = require_URL_impl();
47488
47488
  var impl = utils.implSymbol;
47489
- function URL2(url2) {
47490
- if (!this || this[impl] || !(this instanceof URL2)) {
47489
+ function URL3(url2) {
47490
+ if (!this || this[impl] || !(this instanceof URL3)) {
47491
47491
  throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");
47492
47492
  }
47493
47493
  if (arguments.length < 1) {
@@ -47503,7 +47503,7 @@ var require_URL = __commonJS({
47503
47503
  }
47504
47504
  module2.exports.setup(this, args2);
47505
47505
  }
47506
- URL2.prototype.toJSON = function toJSON2() {
47506
+ URL3.prototype.toJSON = function toJSON2() {
47507
47507
  if (!this || !module2.exports.is(this)) {
47508
47508
  throw new TypeError("Illegal invocation");
47509
47509
  }
@@ -47513,7 +47513,7 @@ var require_URL = __commonJS({
47513
47513
  }
47514
47514
  return this[impl].toJSON.apply(this[impl], args2);
47515
47515
  };
47516
- Object.defineProperty(URL2.prototype, "href", {
47516
+ Object.defineProperty(URL3.prototype, "href", {
47517
47517
  get() {
47518
47518
  return this[impl].href;
47519
47519
  },
@@ -47524,20 +47524,20 @@ var require_URL = __commonJS({
47524
47524
  enumerable: true,
47525
47525
  configurable: true
47526
47526
  });
47527
- URL2.prototype.toString = function() {
47527
+ URL3.prototype.toString = function() {
47528
47528
  if (!this || !module2.exports.is(this)) {
47529
47529
  throw new TypeError("Illegal invocation");
47530
47530
  }
47531
47531
  return this.href;
47532
47532
  };
47533
- Object.defineProperty(URL2.prototype, "origin", {
47533
+ Object.defineProperty(URL3.prototype, "origin", {
47534
47534
  get() {
47535
47535
  return this[impl].origin;
47536
47536
  },
47537
47537
  enumerable: true,
47538
47538
  configurable: true
47539
47539
  });
47540
- Object.defineProperty(URL2.prototype, "protocol", {
47540
+ Object.defineProperty(URL3.prototype, "protocol", {
47541
47541
  get() {
47542
47542
  return this[impl].protocol;
47543
47543
  },
@@ -47548,7 +47548,7 @@ var require_URL = __commonJS({
47548
47548
  enumerable: true,
47549
47549
  configurable: true
47550
47550
  });
47551
- Object.defineProperty(URL2.prototype, "username", {
47551
+ Object.defineProperty(URL3.prototype, "username", {
47552
47552
  get() {
47553
47553
  return this[impl].username;
47554
47554
  },
@@ -47559,7 +47559,7 @@ var require_URL = __commonJS({
47559
47559
  enumerable: true,
47560
47560
  configurable: true
47561
47561
  });
47562
- Object.defineProperty(URL2.prototype, "password", {
47562
+ Object.defineProperty(URL3.prototype, "password", {
47563
47563
  get() {
47564
47564
  return this[impl].password;
47565
47565
  },
@@ -47570,7 +47570,7 @@ var require_URL = __commonJS({
47570
47570
  enumerable: true,
47571
47571
  configurable: true
47572
47572
  });
47573
- Object.defineProperty(URL2.prototype, "host", {
47573
+ Object.defineProperty(URL3.prototype, "host", {
47574
47574
  get() {
47575
47575
  return this[impl].host;
47576
47576
  },
@@ -47581,7 +47581,7 @@ var require_URL = __commonJS({
47581
47581
  enumerable: true,
47582
47582
  configurable: true
47583
47583
  });
47584
- Object.defineProperty(URL2.prototype, "hostname", {
47584
+ Object.defineProperty(URL3.prototype, "hostname", {
47585
47585
  get() {
47586
47586
  return this[impl].hostname;
47587
47587
  },
@@ -47592,7 +47592,7 @@ var require_URL = __commonJS({
47592
47592
  enumerable: true,
47593
47593
  configurable: true
47594
47594
  });
47595
- Object.defineProperty(URL2.prototype, "port", {
47595
+ Object.defineProperty(URL3.prototype, "port", {
47596
47596
  get() {
47597
47597
  return this[impl].port;
47598
47598
  },
@@ -47603,7 +47603,7 @@ var require_URL = __commonJS({
47603
47603
  enumerable: true,
47604
47604
  configurable: true
47605
47605
  });
47606
- Object.defineProperty(URL2.prototype, "pathname", {
47606
+ Object.defineProperty(URL3.prototype, "pathname", {
47607
47607
  get() {
47608
47608
  return this[impl].pathname;
47609
47609
  },
@@ -47614,7 +47614,7 @@ var require_URL = __commonJS({
47614
47614
  enumerable: true,
47615
47615
  configurable: true
47616
47616
  });
47617
- Object.defineProperty(URL2.prototype, "search", {
47617
+ Object.defineProperty(URL3.prototype, "search", {
47618
47618
  get() {
47619
47619
  return this[impl].search;
47620
47620
  },
@@ -47625,7 +47625,7 @@ var require_URL = __commonJS({
47625
47625
  enumerable: true,
47626
47626
  configurable: true
47627
47627
  });
47628
- Object.defineProperty(URL2.prototype, "hash", {
47628
+ Object.defineProperty(URL3.prototype, "hash", {
47629
47629
  get() {
47630
47630
  return this[impl].hash;
47631
47631
  },
@@ -47641,7 +47641,7 @@ var require_URL = __commonJS({
47641
47641
  return !!obj && obj[impl] instanceof Impl.implementation;
47642
47642
  },
47643
47643
  create(constructorArgs, privateData) {
47644
- let obj = Object.create(URL2.prototype);
47644
+ let obj = Object.create(URL3.prototype);
47645
47645
  this.setup(obj, constructorArgs, privateData);
47646
47646
  return obj;
47647
47647
  },
@@ -47652,10 +47652,10 @@ var require_URL = __commonJS({
47652
47652
  obj[impl] = new Impl.implementation(constructorArgs, privateData);
47653
47653
  obj[impl][utils.wrapperSymbol] = obj;
47654
47654
  },
47655
- interface: URL2,
47655
+ interface: URL3,
47656
47656
  expose: {
47657
- Window: { URL: URL2 },
47658
- Worker: { URL: URL2 }
47657
+ Window: { URL: URL3 },
47658
+ Worker: { URL: URL3 }
47659
47659
  }
47660
47660
  };
47661
47661
  }
@@ -52214,12 +52214,12 @@ var require_lib4 = __commonJS({
52214
52214
  configurable: true
52215
52215
  });
52216
52216
  var INTERNALS$2 = Symbol("Request internals");
52217
- var URL2 = Url.URL || whatwgUrl.URL;
52217
+ var URL3 = Url.URL || whatwgUrl.URL;
52218
52218
  var parse_url = Url.parse;
52219
52219
  var format_url = Url.format;
52220
52220
  function parseURL(urlStr) {
52221
52221
  if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) {
52222
- urlStr = new URL2(urlStr).toString();
52222
+ urlStr = new URL3(urlStr).toString();
52223
52223
  }
52224
52224
  return parse_url(urlStr);
52225
52225
  }
@@ -64928,7 +64928,7 @@ var require_ms2 = __commonJS({
64928
64928
  options = options || {};
64929
64929
  var type = typeof val;
64930
64930
  if (type === "string" && val.length > 0) {
64931
- return parse3(val);
64931
+ return parse4(val);
64932
64932
  } else if (type === "number" && isFinite(val)) {
64933
64933
  return options.long ? fmtLong(val) : fmtShort(val);
64934
64934
  }
@@ -64936,7 +64936,7 @@ var require_ms2 = __commonJS({
64936
64936
  "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
64937
64937
  );
64938
64938
  };
64939
- function parse3(str2) {
64939
+ function parse4(str2) {
64940
64940
  str2 = String(str2);
64941
64941
  if (str2.length > 100) {
64942
64942
  return;
@@ -72908,33 +72908,51 @@ async function askForRecordInputs(inputs, name, repl2) {
72908
72908
  return result;
72909
72909
  }
72910
72910
  async function askForDiscriminatedUnionInputs(inputs, name, repl2) {
72911
- const kind3 = await (0, import_prompts.default)({
72912
- type: "select",
72913
- name: "kind",
72914
- message: `Select a ${inputs.discriminator} for ${name}.`,
72915
- choices: inputs.options.map((option) => {
72916
- const prop = option.schema[inputs.discriminator];
72917
- if (prop.type === "enum") {
72918
- return {
72919
- title: prop.values.join(", "),
72920
- description: option.description,
72921
- value: option
72922
- };
72923
- } else if (prop.type !== "literal") {
72924
- return {
72925
- title: option.type,
72926
- description: option.description,
72927
- value: option
72928
- };
72929
- }
72911
+ let choices = inputs.options.map((option) => {
72912
+ const prop = option.schema[inputs.discriminator];
72913
+ if (prop.type === "enum") {
72930
72914
  return {
72931
- title: prop.value,
72915
+ title: prop.values.join(", "),
72932
72916
  description: option.description,
72933
72917
  value: option
72934
72918
  };
72935
- }),
72919
+ } else if (prop.type !== "literal") {
72920
+ return {
72921
+ title: option.type,
72922
+ description: option.description,
72923
+ value: option
72924
+ };
72925
+ }
72926
+ return {
72927
+ title: prop.value,
72928
+ description: option.description,
72929
+ value: option
72930
+ };
72931
+ });
72932
+ if (inputs.nullable) {
72933
+ choices.unshift({
72934
+ title: "(null)",
72935
+ description: "A null value.",
72936
+ value: null
72937
+ });
72938
+ }
72939
+ if (inputs.optional) {
72940
+ choices.unshift({
72941
+ title: "(undefined)",
72942
+ description: "An undefined value.",
72943
+ value: void 0
72944
+ });
72945
+ }
72946
+ const kind3 = await (0, import_prompts.default)({
72947
+ type: "select",
72948
+ name: "kind",
72949
+ message: `Select a ${inputs.discriminator} for ${name}.`,
72950
+ choices,
72936
72951
  onState
72937
72952
  });
72953
+ if (kind3.kind === null || kind3.kind === void 0) {
72954
+ return kind3.kind;
72955
+ }
72938
72956
  return await askForInputs(kind3.kind, name, repl2);
72939
72957
  }
72940
72958
  async function askForAnyInputs(name, repl2) {
@@ -74322,6 +74340,42 @@ if (!globalThis.Blob) {
74322
74340
  var import_base64_js = __toESM(require_base64_js());
74323
74341
  var import_lodash = __toESM(require_lodash());
74324
74342
 
74343
+ // ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/regex.js
74344
+ var regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
74345
+
74346
+ // ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/validate.js
74347
+ function validate(uuid) {
74348
+ return typeof uuid === "string" && regex_default.test(uuid);
74349
+ }
74350
+ var validate_default = validate;
74351
+
74352
+ // ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/parse.js
74353
+ function parse(uuid) {
74354
+ if (!validate_default(uuid)) {
74355
+ throw TypeError("Invalid UUID");
74356
+ }
74357
+ let v2;
74358
+ const arr = new Uint8Array(16);
74359
+ arr[0] = (v2 = parseInt(uuid.slice(0, 8), 16)) >>> 24;
74360
+ arr[1] = v2 >>> 16 & 255;
74361
+ arr[2] = v2 >>> 8 & 255;
74362
+ arr[3] = v2 & 255;
74363
+ arr[4] = (v2 = parseInt(uuid.slice(9, 13), 16)) >>> 8;
74364
+ arr[5] = v2 & 255;
74365
+ arr[6] = (v2 = parseInt(uuid.slice(14, 18), 16)) >>> 8;
74366
+ arr[7] = v2 & 255;
74367
+ arr[8] = (v2 = parseInt(uuid.slice(19, 23), 16)) >>> 8;
74368
+ arr[9] = v2 & 255;
74369
+ arr[10] = (v2 = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255;
74370
+ arr[11] = v2 / 4294967296 & 255;
74371
+ arr[12] = v2 >>> 24 & 255;
74372
+ arr[13] = v2 >>> 16 & 255;
74373
+ arr[14] = v2 >>> 8 & 255;
74374
+ arr[15] = v2 & 255;
74375
+ return arr;
74376
+ }
74377
+ var parse_default = parse;
74378
+
74325
74379
  // ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/stringify.js
74326
74380
  var byteToHex = [];
74327
74381
  for (let i2 = 0; i2 < 256; ++i2) {
@@ -74343,6 +74397,53 @@ function rng() {
74343
74397
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
74344
74398
  }
74345
74399
 
74400
+ // ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v35.js
74401
+ function stringToBytes(str2) {
74402
+ str2 = unescape(encodeURIComponent(str2));
74403
+ const bytes = [];
74404
+ for (let i2 = 0; i2 < str2.length; ++i2) {
74405
+ bytes.push(str2.charCodeAt(i2));
74406
+ }
74407
+ return bytes;
74408
+ }
74409
+ var DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
74410
+ var URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
74411
+ function v35(name, version, hashfunc) {
74412
+ function generateUUID(value, namespace, buf, offset2) {
74413
+ var _namespace;
74414
+ if (typeof value === "string") {
74415
+ value = stringToBytes(value);
74416
+ }
74417
+ if (typeof namespace === "string") {
74418
+ namespace = parse_default(namespace);
74419
+ }
74420
+ if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
74421
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
74422
+ }
74423
+ let bytes = new Uint8Array(16 + value.length);
74424
+ bytes.set(namespace);
74425
+ bytes.set(value, namespace.length);
74426
+ bytes = hashfunc(bytes);
74427
+ bytes[6] = bytes[6] & 15 | version;
74428
+ bytes[8] = bytes[8] & 63 | 128;
74429
+ if (buf) {
74430
+ offset2 = offset2 || 0;
74431
+ for (let i2 = 0; i2 < 16; ++i2) {
74432
+ buf[offset2 + i2] = bytes[i2];
74433
+ }
74434
+ return buf;
74435
+ }
74436
+ return unsafeStringify(bytes);
74437
+ }
74438
+ try {
74439
+ generateUUID.name = name;
74440
+ } catch (err) {
74441
+ }
74442
+ generateUUID.DNS = DNS;
74443
+ generateUUID.URL = URL2;
74444
+ return generateUUID;
74445
+ }
74446
+
74346
74447
  // ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/native.js
74347
74448
  var import_node_crypto3 = __toESM(require("node:crypto"));
74348
74449
  var native_default = {
@@ -74369,6 +74470,22 @@ function v4(options, buf, offset2) {
74369
74470
  }
74370
74471
  var v4_default = v4;
74371
74472
 
74473
+ // ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/sha1.js
74474
+ var import_node_crypto4 = __toESM(require("node:crypto"));
74475
+ function sha1(bytes) {
74476
+ if (Array.isArray(bytes)) {
74477
+ bytes = Buffer.from(bytes);
74478
+ } else if (typeof bytes === "string") {
74479
+ bytes = Buffer.from(bytes, "utf8");
74480
+ }
74481
+ return import_node_crypto4.default.createHash("sha1").update(bytes).digest();
74482
+ }
74483
+ var sha1_default = sha1;
74484
+
74485
+ // ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v5.js
74486
+ var v5 = v35("v5", 80, sha1_default);
74487
+ var v5_default = v5;
74488
+
74372
74489
  // ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v7.js
74373
74490
  var _seqLow = null;
74374
74491
  var _seqHigh = null;
@@ -76475,7 +76592,7 @@ function combineExtractors(...extractors) {
76475
76592
  [{}, null, 1]
76476
76593
  ).slice(0, 2);
76477
76594
  }
76478
- function parse(s3, ...patterns) {
76595
+ function parse2(s3, ...patterns) {
76479
76596
  if (s3 == null) {
76480
76597
  return [null, null];
76481
76598
  }
@@ -76655,7 +76772,7 @@ var extractISOTimeAndOffset = combineExtractors(
76655
76772
  extractIANAZone
76656
76773
  );
76657
76774
  function parseISODate(s3) {
76658
- return parse(
76775
+ return parse2(
76659
76776
  s3,
76660
76777
  [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],
76661
76778
  [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],
@@ -76664,10 +76781,10 @@ function parseISODate(s3) {
76664
76781
  );
76665
76782
  }
76666
76783
  function parseRFC2822Date(s3) {
76667
- return parse(preprocessRFC2822(s3), [rfc2822, extractRFC2822]);
76784
+ return parse2(preprocessRFC2822(s3), [rfc2822, extractRFC2822]);
76668
76785
  }
76669
76786
  function parseHTTPDate(s3) {
76670
- return parse(
76787
+ return parse2(
76671
76788
  s3,
76672
76789
  [rfc1123, extractRFC1123Or850],
76673
76790
  [rfc850, extractRFC1123Or850],
@@ -76675,11 +76792,11 @@ function parseHTTPDate(s3) {
76675
76792
  );
76676
76793
  }
76677
76794
  function parseISODuration(s3) {
76678
- return parse(s3, [isoDuration, extractISODuration]);
76795
+ return parse2(s3, [isoDuration, extractISODuration]);
76679
76796
  }
76680
76797
  var extractISOTimeOnly = combineExtractors(extractISOTime);
76681
76798
  function parseISOTimeOnly(s3) {
76682
- return parse(s3, [isoTimeOnly, extractISOTimeOnly]);
76799
+ return parse2(s3, [isoTimeOnly, extractISOTimeOnly]);
76683
76800
  }
76684
76801
  var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
76685
76802
  var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
@@ -76689,7 +76806,7 @@ var extractISOTimeOffsetAndIANAZone = combineExtractors(
76689
76806
  extractIANAZone
76690
76807
  );
76691
76808
  function parseSQL(s3) {
76692
- return parse(
76809
+ return parse2(
76693
76810
  s3,
76694
76811
  [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],
76695
76812
  [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]
@@ -85800,6 +85917,7 @@ var LOOM_RESOURCE_KIND = "loom";
85800
85917
  var SLOYD_RESOURCE_KIND = "ai.sloyd";
85801
85918
  var HUME_RESOURCE_KIND = "ai.hume";
85802
85919
  var WEBHOOK_RESOURCE_KIND = "webhook";
85920
+ var NOTIFICATION_RESOURCE_KIND = "notification";
85803
85921
  var READ_ACTION = "read";
85804
85922
  var CREATE_ACTION = "create";
85805
85923
  var UPDATE_ACTION = "update";
@@ -85816,6 +85934,10 @@ var REVOKE_ACTION = "revoke";
85816
85934
  var SEND_ACTION_ACTION = "sendAction";
85817
85935
  var UPDATE_DATA_ACTION = "updateData";
85818
85936
  var RUN_ACTION = "run";
85937
+ var SEND_ACTION = "send";
85938
+ var SUBSCRIBE_ACTION = "subscribe";
85939
+ var UNSUBSCRIBE_ACTION = "unsubscribe";
85940
+ var LIST_SUBSCRIPTIONS_ACTION = "listSubscriptions";
85819
85941
  var SUBJECT_TYPE_VALIDATION = z.enum(["user", "inst", "role"]);
85820
85942
  var DATA_ACTION_KINDS_VALIDATION = z.enum([
85821
85943
  READ_ACTION,
@@ -85871,6 +85993,17 @@ var WEBHOOK_ACTION_KINDS_VALIDATION = z.enum([
85871
85993
  LIST_ACTION,
85872
85994
  RUN_ACTION
85873
85995
  ]);
85996
+ var NOTIFICATION_ACTION_KINDS_VALIDATION = z.enum([
85997
+ CREATE_ACTION,
85998
+ READ_ACTION,
85999
+ UPDATE_ACTION,
86000
+ DELETE_ACTION,
86001
+ LIST_ACTION,
86002
+ SEND_ACTION,
86003
+ SUBSCRIBE_ACTION,
86004
+ UNSUBSCRIBE_ACTION,
86005
+ LIST_SUBSCRIPTIONS_ACTION
86006
+ ]);
85874
86007
  var RESOURCE_KIND_VALIDATION = z.enum([
85875
86008
  DATA_RESOURCE_KIND,
85876
86009
  FILE_RESOURCE_KIND,
@@ -85881,7 +86014,8 @@ var RESOURCE_KIND_VALIDATION = z.enum([
85881
86014
  LOOM_RESOURCE_KIND,
85882
86015
  SLOYD_RESOURCE_KIND,
85883
86016
  HUME_RESOURCE_KIND,
85884
- WEBHOOK_RESOURCE_KIND
86017
+ WEBHOOK_RESOURCE_KIND,
86018
+ NOTIFICATION_RESOURCE_KIND
85885
86019
  ]);
85886
86020
  var ACTION_KINDS_VALIDATION = z.enum([
85887
86021
  CREATE_ACTION,
@@ -85899,7 +86033,11 @@ var ACTION_KINDS_VALIDATION = z.enum([
85899
86033
  COUNT_ACTION,
85900
86034
  GRANT_PERMISSION_ACTION,
85901
86035
  REVOKE_PERMISSION_ACTION,
85902
- RUN_ACTION
86036
+ RUN_ACTION,
86037
+ SEND_ACTION,
86038
+ SUBSCRIBE_ACTION,
86039
+ UNSUBSCRIBE_ACTION,
86040
+ LIST_SUBSCRIPTIONS_ACTION
85903
86041
  ]);
85904
86042
  var PERMISSION_VALIDATION = z.object({
85905
86043
  subjectType: SUBJECT_TYPE_VALIDATION,
@@ -85958,6 +86096,10 @@ var WEBHOOK_PERMISSION_VALIDATION = PERMISSION_VALIDATION.extend({
85958
86096
  resourceKind: z.literal(WEBHOOK_RESOURCE_KIND),
85959
86097
  action: WEBHOOK_ACTION_KINDS_VALIDATION.nullable()
85960
86098
  });
86099
+ var NOTIFICATION_PERMISSION_VALIDATION = PERMISSION_VALIDATION.extend({
86100
+ resourceKind: z.literal(NOTIFICATION_RESOURCE_KIND),
86101
+ action: NOTIFICATION_ACTION_KINDS_VALIDATION.nullable()
86102
+ });
85961
86103
  var AVAILABLE_PERMISSIONS_VALIDATION = z.discriminatedUnion(
85962
86104
  "resourceKind",
85963
86105
  [
@@ -85970,7 +86112,8 @@ var AVAILABLE_PERMISSIONS_VALIDATION = z.discriminatedUnion(
85970
86112
  LOOM_PERMISSION_VALIDATION,
85971
86113
  SLOYD_PERMISSION_VALIDATION,
85972
86114
  HUME_PERMISSION_VALIDATION,
85973
- WEBHOOK_PERMISSION_VALIDATION
86115
+ WEBHOOK_PERMISSION_VALIDATION,
86116
+ NOTIFICATION_PERMISSION_VALIDATION
85974
86117
  ]
85975
86118
  );
85976
86119
  var ADMIN_ROLE_NAME = "admin";
@@ -86924,14 +87067,14 @@ var StringDecoder = class {
86924
87067
  };
86925
87068
 
86926
87069
  // ../../node_modules/.pnpm/lib0@0.2.88/node_modules/lib0/webcrypto.node.js
86927
- var import_node_crypto4 = require("node:crypto");
87070
+ var import_node_crypto5 = require("node:crypto");
86928
87071
  var subtle = (
86929
87072
  /** @type {any} */
86930
- import_node_crypto4.webcrypto.subtle
87073
+ import_node_crypto5.webcrypto.subtle
86931
87074
  );
86932
87075
  var getRandomValues = (
86933
87076
  /** @type {any} */
86934
- import_node_crypto4.webcrypto.getRandomValues.bind(import_node_crypto4.webcrypto)
87077
+ import_node_crypto5.webcrypto.getRandomValues.bind(import_node_crypto5.webcrypto)
86935
87078
  );
86936
87079
 
86937
87080
  // ../../node_modules/.pnpm/lib0@0.2.88/node_modules/lib0/random.js
@@ -96760,7 +96903,7 @@ var trace = TraceAPI.getInstance();
96760
96903
  function hashLowEntropyPasswordWithSalt2(password, salt) {
96761
96904
  const tracer = trace.getTracer(
96762
96905
  "InstrumentedHashHelpers",
96763
- false ? void 0 : "v3.3.11-alpha.11349749950"
96906
+ false ? void 0 : "v3.3.11"
96764
96907
  );
96765
96908
  return tracer.startActiveSpan(
96766
96909
  "hashLowEntropyPasswordWithSalt",
@@ -96778,7 +96921,7 @@ function hashLowEntropyPasswordWithSalt2(password, salt) {
96778
96921
  function hashHighEntropyPasswordWithSalt2(password, salt) {
96779
96922
  const tracer = trace.getTracer(
96780
96923
  "InstrumentedHashHelpers",
96781
- false ? void 0 : "v3.3.11-alpha.11349749950"
96924
+ false ? void 0 : "v3.3.11"
96782
96925
  );
96783
96926
  return tracer.startActiveSpan(
96784
96927
  "hashHighEntropyPasswordWithSalt",
@@ -96796,7 +96939,7 @@ function hashHighEntropyPasswordWithSalt2(password, salt) {
96796
96939
  function verifyPasswordAgainstHashes2(password, salt, hashes) {
96797
96940
  const tracer = trace.getTracer(
96798
96941
  "InstrumentedHashHelpers",
96799
- false ? void 0 : "v3.3.11-alpha.11349749950"
96942
+ false ? void 0 : "v3.3.11"
96800
96943
  );
96801
96944
  return tracer.startActiveSpan(
96802
96945
  "verifyPasswordAgainstHashes",
@@ -103397,7 +103540,7 @@ var import_semantic_conventions = __toESM(require_src3());
103397
103540
  function traced(tracerName, options = {}, metricOptions = {}) {
103398
103541
  const tracer = trace.getTracer(
103399
103542
  tracerName,
103400
- false ? void 0 : "v3.3.11-alpha.11349749950"
103543
+ false ? void 0 : "v3.3.11"
103401
103544
  );
103402
103545
  return function(target, propertyKey, descriptor) {
103403
103546
  const originalMethod = descriptor.value;
@@ -103475,7 +103618,7 @@ function getHistogram(meter) {
103475
103618
  }
103476
103619
  return metrics.getMeter(
103477
103620
  meter.meter,
103478
- false ? void 0 : "v3.3.11-alpha.11349749950"
103621
+ false ? void 0 : "v3.3.11"
103479
103622
  ).createHistogram(meter.name, meter.options);
103480
103623
  }
103481
103624
  function getCounter(meter) {
@@ -103484,7 +103627,7 @@ function getCounter(meter) {
103484
103627
  }
103485
103628
  return metrics.getMeter(
103486
103629
  meter.meter,
103487
- false ? void 0 : "v3.3.11-alpha.11349749950"
103630
+ false ? void 0 : "v3.3.11"
103488
103631
  ).createCounter(meter.name, meter.options);
103489
103632
  }
103490
103633
  function traceHttpResponse(options = {}) {
@@ -103592,7 +103735,13 @@ var AuthController = class {
103592
103735
  userId: newUser.id,
103593
103736
  sessionKey: null,
103594
103737
  connectionKey: null,
103595
- expireTimeMs: null
103738
+ expireTimeMs: null,
103739
+ metadata: {
103740
+ hasUserAuthenticator: false,
103741
+ userAuthenticatorCredentialIds: [],
103742
+ hasPushSubscription: false,
103743
+ pushSubscriptionIds: []
103744
+ }
103596
103745
  };
103597
103746
  }
103598
103747
  } catch (err) {
@@ -105877,6 +106026,7 @@ var AuthController = class {
105877
106026
  } else {
105878
106027
  await this._store.saveSession(newSession);
105879
106028
  }
106029
+ const metadata = await this._store.findUserLoginMetadata(userId);
105880
106030
  const info = {
105881
106031
  userId,
105882
106032
  sessionKey: formatV1SessionKey(
@@ -105891,7 +106041,13 @@ var AuthController = class {
105891
106041
  newConnectionSecret,
105892
106042
  newSession.expireTimeMs
105893
106043
  ),
105894
- expireTimeMs: newSession.expireTimeMs
106044
+ expireTimeMs: newSession.expireTimeMs,
106045
+ metadata: {
106046
+ hasUserAuthenticator: metadata?.hasUserAuthenticator ?? false,
106047
+ userAuthenticatorCredentialIds: metadata?.userAuthenticatorCredentialIds ?? [],
106048
+ hasPushSubscription: metadata?.hasPushSubscription ?? false,
106049
+ pushSubscriptionIds: metadata?.pushSubscriptionIds ?? []
106050
+ }
105895
106051
  };
105896
106052
  return {
105897
106053
  newSession,
@@ -106225,6 +106381,27 @@ var subscriptionFeaturesSchema = z.object({
106225
106381
  "The configuration for webhook features. Defaults to not allowed."
106226
106382
  ).optional().default({
106227
106383
  allowed: false
106384
+ }),
106385
+ notifications: z.object({
106386
+ allowed: z.boolean().describe(
106387
+ "Whether notifications are allowed for the subscription."
106388
+ ),
106389
+ maxItems: z.number().describe(
106390
+ "The maximum number of notification items that are allowed for the subscription. If not specified, then there is no limit."
106391
+ ).int().positive().optional(),
106392
+ maxSubscribersPerItem: z.number().describe(
106393
+ "The maximum number of subscribers that a notification can have in the subscription. If not specified, then there is no limit."
106394
+ ).int().positive().optional(),
106395
+ maxSentNotificationsPerPeriod: z.number().describe(
106396
+ 'The maximum number of notifications that can be sent per subscription period. This tracks the number of times the "sendNotification" operation was called. If not specified, then there is no limit.'
106397
+ ).int().positive().optional(),
106398
+ maxSentPushNotificationsPerPeriod: z.number().describe(
106399
+ "The maximum number of push notifications that can be sent per subscription period. This tracks the actual number of push notifications that were sent to users. If not specified, then there is no limit."
106400
+ ).int().positive().optional()
106401
+ }).describe(
106402
+ "The configuration for notification features. Defaults to not allowed."
106403
+ ).optional().default({
106404
+ allowed: false
106228
106405
  })
106229
106406
  });
106230
106407
  var subscriptionConfigSchema = z.object({
@@ -106354,45 +106531,72 @@ function allowAllFeatures() {
106354
106531
  },
106355
106532
  insts: {
106356
106533
  allowed: true
106534
+ },
106535
+ notifications: {
106536
+ allowed: true
106357
106537
  }
106358
106538
  };
106359
106539
  }
106360
- function getWebhookFeatures(config2, subscriptionStatus, subscriptionId, type) {
106540
+ function getNotificationFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
106541
+ const features = getSubscriptionFeatures(
106542
+ config2,
106543
+ subscriptionStatus,
106544
+ subscriptionId,
106545
+ type,
106546
+ periodStartMs,
106547
+ periodEndMs,
106548
+ nowMs
106549
+ );
106550
+ return features.notifications ?? { allowed: false };
106551
+ }
106552
+ function getWebhookFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
106361
106553
  const features = getSubscriptionFeatures(
106362
106554
  config2,
106363
106555
  subscriptionStatus,
106364
106556
  subscriptionId,
106365
- type
106557
+ type,
106558
+ periodStartMs,
106559
+ periodEndMs,
106560
+ nowMs
106366
106561
  );
106367
106562
  return features.webhooks ?? { allowed: false };
106368
106563
  }
106369
- function getComIdFeatures(config2, subscriptionStatus, subscriptionId) {
106564
+ function getComIdFeatures(config2, subscriptionStatus, subscriptionId, periodStartMs, periodEndMs, nowMs = Date.now()) {
106370
106565
  const features = getSubscriptionFeatures(
106371
106566
  config2,
106372
106567
  subscriptionStatus,
106373
106568
  subscriptionId,
106374
- "studio"
106569
+ "studio",
106570
+ periodStartMs,
106571
+ periodEndMs,
106572
+ nowMs
106375
106573
  );
106376
106574
  return features.comId ?? {
106377
106575
  allowed: false
106378
106576
  // allowCustomComId: false,
106379
106577
  };
106380
106578
  }
106381
- function getLoomFeatures(config2, subscriptionStatus, subscriptionId) {
106579
+ function getLoomFeatures(config2, subscriptionStatus, subscriptionId, periodStartMs, periodEndMs, nowMs = Date.now()) {
106382
106580
  const features = getSubscriptionFeatures(
106383
106581
  config2,
106384
106582
  subscriptionStatus,
106385
106583
  subscriptionId,
106386
- "studio"
106584
+ "studio",
106585
+ periodStartMs,
106586
+ periodEndMs,
106587
+ nowMs
106387
106588
  );
106388
106589
  return features.loom ?? { allowed: false };
106389
106590
  }
106390
- function getHumeAiFeatures(config2, subscriptionStatus, subscriptionId, type) {
106591
+ function getHumeAiFeatures(config2, subscriptionStatus, subscriptionId, type, periodStartMs, periodEndMs, nowMs = Date.now()) {
106391
106592
  const features = getSubscriptionFeatures(
106392
106593
  config2,
106393
106594
  subscriptionStatus,
106394
106595
  subscriptionId,
106395
- type
106596
+ type,
106597
+ periodStartMs,
106598
+ periodEndMs,
106599
+ nowMs
106396
106600
  );
106397
106601
  return features.ai.hume ?? { allowed: false };
106398
106602
  }
@@ -107926,6 +108130,13 @@ function getPublicReadPermission(resourceKind, action2) {
107926
108130
  action: action2
107927
108131
  };
107928
108132
  }
108133
+ } else if (resourceKind === "notification") {
108134
+ if (action2 === "read" || action2 === "list" || action2 === "subscribe") {
108135
+ return {
108136
+ resourceKind,
108137
+ action: action2
108138
+ };
108139
+ }
107929
108140
  }
107930
108141
  return null;
107931
108142
  }
@@ -107965,6 +108176,13 @@ function getPublicWritePermission(resourceKind, action2) {
107965
108176
  action: action2
107966
108177
  };
107967
108178
  }
108179
+ } else if (resourceKind === "notification") {
108180
+ if (action2 === "read" || action2 === "list" || action2 === "subscribe") {
108181
+ return {
108182
+ resourceKind,
108183
+ action: action2
108184
+ };
108185
+ }
107968
108186
  }
107969
108187
  return null;
107970
108188
  }
@@ -114157,7 +114375,1062 @@ function eraseItemProcedure(auth7, controller, builder) {
114157
114375
  }
114158
114376
 
114159
114377
  // ../aux-records/RecordsServer.ts
114378
+ var import_lodash23 = __toESM(require_lodash());
114379
+
114380
+ // ../aux-records/crud/CrudRecordsController.ts
114381
+ var TRACE_NAME8 = "CrudRecordsController";
114382
+ var CrudRecordsController = class {
114383
+ get config() {
114384
+ return this._config;
114385
+ }
114386
+ /**
114387
+ * Gets the name of the controller.
114388
+ */
114389
+ get name() {
114390
+ return this._name;
114391
+ }
114392
+ get policies() {
114393
+ return this._policies;
114394
+ }
114395
+ get store() {
114396
+ return this._store;
114397
+ }
114398
+ /**
114399
+ * Gets the kind of resources that this controller is for.
114400
+ */
114401
+ get resourceKind() {
114402
+ return this._resourceKind;
114403
+ }
114404
+ constructor(config2) {
114405
+ this._name = config2.name;
114406
+ this._store = config2.store;
114407
+ this._policies = config2.policies;
114408
+ this._config = config2.config;
114409
+ this._resourceKind = config2.resourceKind;
114410
+ }
114411
+ async recordItem(request2) {
114412
+ try {
114413
+ const contextResult = await this._policies.constructAuthorizationContext({
114414
+ recordKeyOrRecordName: request2.recordKeyOrRecordName,
114415
+ userId: request2.userId
114416
+ });
114417
+ if (contextResult.success === false) {
114418
+ return contextResult;
114419
+ }
114420
+ const recordName = contextResult.context.recordName;
114421
+ const existingItem = await this._store.getItemByAddress(
114422
+ recordName,
114423
+ request2.item.address
114424
+ );
114425
+ let resourceMarkers;
114426
+ let action2 = existingItem ? "update" : "create";
114427
+ let authorization;
114428
+ if (action2 === "update") {
114429
+ const existingMarkers = existingItem.markers;
114430
+ resourceMarkers = request2.item.markers ?? existingMarkers;
114431
+ action2 = "update";
114432
+ authorization = await this._policies.authorizeUserAndInstancesForResources(
114433
+ contextResult.context,
114434
+ {
114435
+ userId: request2.userId,
114436
+ instances: request2.instances,
114437
+ resources: [
114438
+ {
114439
+ resourceKind: this._resourceKind,
114440
+ resourceId: existingItem.address,
114441
+ action: action2,
114442
+ markers: resourceMarkers
114443
+ },
114444
+ ...getMarkerResourcesForUpdate(
114445
+ existingMarkers,
114446
+ request2.item.markers
114447
+ )
114448
+ ]
114449
+ }
114450
+ );
114451
+ if (authorization.success === false) {
114452
+ return authorization;
114453
+ }
114454
+ } else {
114455
+ resourceMarkers = request2.item.markers;
114456
+ authorization = await this._policies.authorizeUserAndInstancesForResources(
114457
+ contextResult.context,
114458
+ {
114459
+ userId: request2.userId,
114460
+ instances: request2.instances,
114461
+ resources: [
114462
+ {
114463
+ resourceKind: this._resourceKind,
114464
+ resourceId: request2.item.address,
114465
+ action: action2,
114466
+ markers: resourceMarkers
114467
+ },
114468
+ ...getMarkerResourcesForCreation(
114469
+ resourceMarkers
114470
+ )
114471
+ ]
114472
+ }
114473
+ );
114474
+ if (authorization.success === false) {
114475
+ return authorization;
114476
+ }
114477
+ }
114478
+ if (!resourceMarkers) {
114479
+ return {
114480
+ success: false,
114481
+ errorCode: "invalid_request",
114482
+ errorMessage: "The item must have markers."
114483
+ };
114484
+ }
114485
+ const item = this._transformInputItem(request2.item);
114486
+ const subscriptionResult = await this._checkSubscriptionMetrics(
114487
+ action2,
114488
+ contextResult.context,
114489
+ authorization,
114490
+ item
114491
+ );
114492
+ if (subscriptionResult.success === false) {
114493
+ return subscriptionResult;
114494
+ }
114495
+ await this._store.putItem(recordName, item);
114496
+ return {
114497
+ success: true,
114498
+ recordName,
114499
+ address: item.address
114500
+ };
114501
+ } catch (err) {
114502
+ const span = trace.getActiveSpan();
114503
+ span?.recordException(err);
114504
+ span?.setStatus({ code: SpanStatusCode.ERROR });
114505
+ console.error(`[${this._name}] Error recording item:`, err);
114506
+ return {
114507
+ success: false,
114508
+ errorCode: "server_error",
114509
+ errorMessage: "A server error occurred."
114510
+ };
114511
+ }
114512
+ }
114513
+ async getItem(request2) {
114514
+ try {
114515
+ const baseRequest = {
114516
+ recordKeyOrRecordName: request2.recordName,
114517
+ userId: request2.userId,
114518
+ instances: request2.instances
114519
+ };
114520
+ const context = await this._policies.constructAuthorizationContext(
114521
+ baseRequest
114522
+ );
114523
+ if (context.success === false) {
114524
+ return context;
114525
+ }
114526
+ const result = await this._store.getItemByAddress(
114527
+ context.context.recordName,
114528
+ request2.address
114529
+ );
114530
+ if (!result) {
114531
+ return {
114532
+ success: false,
114533
+ errorCode: "data_not_found",
114534
+ errorMessage: "The item was not found."
114535
+ };
114536
+ }
114537
+ const markers = result.markers;
114538
+ const authorization = await this._policies.authorizeUserAndInstances(
114539
+ context.context,
114540
+ {
114541
+ userId: request2.userId,
114542
+ instances: request2.instances,
114543
+ resourceKind: this._resourceKind,
114544
+ resourceId: request2.address,
114545
+ action: "read",
114546
+ markers
114547
+ }
114548
+ );
114549
+ if (authorization.success === false) {
114550
+ return authorization;
114551
+ }
114552
+ return {
114553
+ success: true,
114554
+ item: this._convertItemToResult(result, context.context)
114555
+ };
114556
+ } catch (err) {
114557
+ const span = trace.getActiveSpan();
114558
+ span?.recordException(err);
114559
+ span?.setStatus({ code: SpanStatusCode.ERROR });
114560
+ console.error(`[${this._name}] Error getting item:`, err);
114561
+ return {
114562
+ success: false,
114563
+ errorCode: "server_error",
114564
+ errorMessage: "A server error occurred."
114565
+ };
114566
+ }
114567
+ }
114568
+ async eraseItem(request2) {
114569
+ try {
114570
+ const context = await this._policies.constructAuthorizationContext({
114571
+ recordKeyOrRecordName: request2.recordName,
114572
+ userId: request2.userId
114573
+ });
114574
+ if (context.success === false) {
114575
+ return context;
114576
+ }
114577
+ const result = await this._store.getItemByAddress(
114578
+ context.context.recordName,
114579
+ request2.address
114580
+ );
114581
+ if (!result) {
114582
+ return {
114583
+ success: false,
114584
+ errorCode: "data_not_found",
114585
+ errorMessage: "The item was not found."
114586
+ };
114587
+ }
114588
+ const markers = result.markers;
114589
+ const authorization = await this._policies.authorizeUserAndInstances(
114590
+ context.context,
114591
+ {
114592
+ userId: request2.userId,
114593
+ instances: request2.instances,
114594
+ resourceKind: this._resourceKind,
114595
+ resourceId: request2.address,
114596
+ action: "delete",
114597
+ markers
114598
+ }
114599
+ );
114600
+ if (authorization.success === false) {
114601
+ return authorization;
114602
+ }
114603
+ const recordName = context.context.recordName;
114604
+ const subscriptionResult = await this._checkSubscriptionMetrics(
114605
+ "delete",
114606
+ context.context,
114607
+ authorization
114608
+ );
114609
+ if (subscriptionResult.success === false) {
114610
+ return subscriptionResult;
114611
+ }
114612
+ await this._store.deleteItem(recordName, request2.address);
114613
+ return {
114614
+ success: true
114615
+ };
114616
+ } catch (err) {
114617
+ const span = trace.getActiveSpan();
114618
+ span?.recordException(err);
114619
+ span?.setStatus({ code: SpanStatusCode.ERROR });
114620
+ console.error(`[${this._name}] Error erasing item:`, err);
114621
+ return {
114622
+ success: false,
114623
+ errorCode: "server_error",
114624
+ errorMessage: "A server error occurred."
114625
+ };
114626
+ }
114627
+ }
114628
+ async listItems(request2) {
114629
+ try {
114630
+ const baseRequest = {
114631
+ recordKeyOrRecordName: request2.recordName,
114632
+ userId: request2.userId,
114633
+ instances: request2.instances
114634
+ };
114635
+ const context = await this._policies.constructAuthorizationContext(
114636
+ baseRequest
114637
+ );
114638
+ if (context.success === false) {
114639
+ return context;
114640
+ }
114641
+ const authorization = await this._policies.authorizeUserAndInstances(
114642
+ context.context,
114643
+ {
114644
+ userId: request2.userId,
114645
+ instances: request2.instances,
114646
+ resourceKind: this._resourceKind,
114647
+ action: "list",
114648
+ markers: [ACCOUNT_MARKER]
114649
+ }
114650
+ );
114651
+ if (authorization.success === false) {
114652
+ return authorization;
114653
+ }
114654
+ const result2 = await this._store.listItems(
114655
+ context.context.recordName,
114656
+ request2.startingAddress
114657
+ );
114658
+ return {
114659
+ success: true,
114660
+ recordName: context.context.recordName,
114661
+ items: result2.items.map(
114662
+ (item) => this._convertItemToResult(item, context.context)
114663
+ ),
114664
+ totalCount: result2.totalCount
114665
+ };
114666
+ } catch (err) {
114667
+ const span = trace.getActiveSpan();
114668
+ span?.recordException(err);
114669
+ span?.setStatus({ code: SpanStatusCode.ERROR });
114670
+ console.error(`[${this._name}] Error listing items:`, err);
114671
+ return {
114672
+ success: false,
114673
+ errorCode: "server_error",
114674
+ errorMessage: "A server error occurred."
114675
+ };
114676
+ }
114677
+ }
114678
+ async listItemsByMarker(request2) {
114679
+ try {
114680
+ const baseRequest = {
114681
+ recordKeyOrRecordName: request2.recordName,
114682
+ userId: request2.userId,
114683
+ instances: request2.instances
114684
+ };
114685
+ const context = await this._policies.constructAuthorizationContext(
114686
+ baseRequest
114687
+ );
114688
+ if (context.success === false) {
114689
+ return context;
114690
+ }
114691
+ const authorization = await this._policies.authorizeUserAndInstances(
114692
+ context.context,
114693
+ {
114694
+ userId: request2.userId,
114695
+ instances: request2.instances,
114696
+ resourceKind: this._resourceKind,
114697
+ action: "list",
114698
+ markers: [request2.marker]
114699
+ }
114700
+ );
114701
+ if (authorization.success === false) {
114702
+ return authorization;
114703
+ }
114704
+ const result2 = await this._store.listItemsByMarker({
114705
+ recordName: context.context.recordName,
114706
+ startingAddress: request2.startingAddress,
114707
+ marker: request2.marker,
114708
+ sort: request2.sort
114709
+ });
114710
+ return {
114711
+ success: true,
114712
+ recordName: context.context.recordName,
114713
+ items: result2.items.map(
114714
+ (item) => this._convertItemToResult(item, context.context)
114715
+ ),
114716
+ totalCount: result2.totalCount
114717
+ };
114718
+ } catch (err) {
114719
+ const span = trace.getActiveSpan();
114720
+ span?.recordException(err);
114721
+ span?.setStatus({ code: SpanStatusCode.ERROR });
114722
+ console.error(`[${this._name}] Error listing items:`, err);
114723
+ return {
114724
+ success: false,
114725
+ errorCode: "server_error",
114726
+ errorMessage: "A server error occurred."
114727
+ };
114728
+ }
114729
+ }
114730
+ /**
114731
+ * Converts the given item to a version that is able to be returned to clients.
114732
+ * Can be overriden to ensure that some fields are not returned.
114733
+ * @param item The item that should be converted.
114734
+ * @param context The authorization context.
114735
+ * @returns The converted item.
114736
+ */
114737
+ _convertItemToResult(item, context) {
114738
+ return item;
114739
+ }
114740
+ /**
114741
+ * Transforms the given input item and returns the transformed item.
114742
+ * Useful for transforming items before they are stored.
114743
+ * @param item The item that should be transformed.
114744
+ */
114745
+ _transformInputItem(item) {
114746
+ return item;
114747
+ }
114748
+ };
114749
+ __decorateClass([
114750
+ traced(TRACE_NAME8)
114751
+ ], CrudRecordsController.prototype, "recordItem", 1);
114752
+ __decorateClass([
114753
+ traced(TRACE_NAME8)
114754
+ ], CrudRecordsController.prototype, "getItem", 1);
114755
+ __decorateClass([
114756
+ traced(TRACE_NAME8)
114757
+ ], CrudRecordsController.prototype, "eraseItem", 1);
114758
+ __decorateClass([
114759
+ traced(TRACE_NAME8)
114760
+ ], CrudRecordsController.prototype, "listItems", 1);
114761
+ __decorateClass([
114762
+ traced(TRACE_NAME8)
114763
+ ], CrudRecordsController.prototype, "listItemsByMarker", 1);
114764
+
114765
+ // ../aux-records/notifications/WebPushInterface.ts
114766
+ var SUBSCRIPTION_ID_NAMESPACE = "f12953a9-21e2-47d4-b7b7-f699bd9a5550";
114767
+ var PUSH_SUBSCRIPTION_SCHEMA = z.object({
114768
+ endpoint: z.string(),
114769
+ expirationTime: z.number().optional().nullable(),
114770
+ keys: z.record(z.string())
114771
+ });
114772
+ var PUSH_NOTIFICATION_PAYLOAD_ACTION = z.discriminatedUnion("type", [
114773
+ z.object({
114774
+ type: z.literal("open_url"),
114775
+ url: z.string()
114776
+ }),
114777
+ z.object({
114778
+ type: z.literal("webhook"),
114779
+ method: z.enum(["GET", "POST"]),
114780
+ url: z.string(),
114781
+ headers: z.record(z.string()).optional().nullable()
114782
+ })
114783
+ ]);
114784
+ var PUSH_NOTIFICATION_PAYLOAD = z.object({
114785
+ title: z.string().min(1),
114786
+ body: z.string().min(2),
114787
+ icon: z.string().min(1).optional().nullable(),
114788
+ badge: z.string().min(1).optional().nullable(),
114789
+ silent: z.boolean().optional().nullable(),
114790
+ tag: z.string().min(1).optional().nullable(),
114791
+ timestamp: z.number().optional().nullable(),
114792
+ action: PUSH_NOTIFICATION_PAYLOAD_ACTION.optional().nullable(),
114793
+ actions: z.array(
114794
+ z.object({
114795
+ title: z.string().min(1),
114796
+ icon: z.string().min(1).optional().nullable(),
114797
+ action: PUSH_NOTIFICATION_PAYLOAD_ACTION
114798
+ })
114799
+ ).optional().nullable()
114800
+ });
114801
+
114802
+ // ../aux-records/notifications/NotificationRecordsController.ts
114803
+ var TRACE_NAME9 = "NotificationRecordsController";
114804
+ var NotificationRecordsController = class extends CrudRecordsController {
114805
+ constructor(config2) {
114806
+ super({
114807
+ ...config2,
114808
+ name: "NotificationRecordsController",
114809
+ resourceKind: "notification"
114810
+ });
114811
+ this._pushInterface = config2.pushInterface;
114812
+ }
114813
+ async getApplicationServerKey() {
114814
+ try {
114815
+ const key = this._pushInterface.getServerApplicationKey();
114816
+ return {
114817
+ success: true,
114818
+ key
114819
+ };
114820
+ } catch (err) {
114821
+ const span = trace.getActiveSpan();
114822
+ span?.recordException(err);
114823
+ span?.setStatus({ code: SpanStatusCode.ERROR });
114824
+ console.error(
114825
+ "[NotificationRecordsController] Error subscribing to notification:",
114826
+ err
114827
+ );
114828
+ return {
114829
+ success: false,
114830
+ errorCode: "server_error",
114831
+ errorMessage: "A server error occurred."
114832
+ };
114833
+ }
114834
+ }
114835
+ async subscribeToNotification(request2) {
114836
+ try {
114837
+ const context = await this.policies.constructAuthorizationContext({
114838
+ userId: request2.userId,
114839
+ recordKeyOrRecordName: request2.recordName
114840
+ });
114841
+ if (context.success === false) {
114842
+ return context;
114843
+ }
114844
+ const recordName = context.context.recordName;
114845
+ const userId = context.context.userId;
114846
+ const notification = await this.store.getItemByAddress(
114847
+ recordName,
114848
+ request2.address
114849
+ );
114850
+ if (!notification) {
114851
+ return {
114852
+ success: false,
114853
+ errorCode: "data_not_found",
114854
+ errorMessage: "Notification not found."
114855
+ };
114856
+ }
114857
+ const authorization = await this.policies.authorizeUserAndInstances(
114858
+ context.context,
114859
+ {
114860
+ action: "subscribe",
114861
+ resourceKind: "notification",
114862
+ resourceId: notification.address,
114863
+ markers: notification.markers,
114864
+ userId,
114865
+ instances: request2.instances
114866
+ }
114867
+ );
114868
+ if (authorization.success === false) {
114869
+ return authorization;
114870
+ }
114871
+ const metrics3 = await this._checkSubscriptionMetrics(
114872
+ "subscribe",
114873
+ context.context,
114874
+ authorization,
114875
+ notification
114876
+ );
114877
+ if (metrics3.success === false) {
114878
+ return metrics3;
114879
+ }
114880
+ const pushSubscriptionId = this._getPushSubscriptionId(
114881
+ request2.pushSubscription.endpoint
114882
+ );
114883
+ await this.store.savePushSubscription({
114884
+ id: pushSubscriptionId,
114885
+ active: true,
114886
+ endpoint: request2.pushSubscription.endpoint,
114887
+ keys: request2.pushSubscription.keys
114888
+ });
114889
+ await this.store.savePushSubscriptionUser({
114890
+ pushSubscriptionId,
114891
+ userId
114892
+ });
114893
+ let subscriptionId = null;
114894
+ if (userId) {
114895
+ const sub = await this.store.getSubscriptionByRecordAddressAndUserId(
114896
+ recordName,
114897
+ notification.address,
114898
+ userId
114899
+ );
114900
+ if (sub) {
114901
+ subscriptionId = sub.id;
114902
+ }
114903
+ } else {
114904
+ const sub = await this.store.getSubscriptionByRecordAddressAndPushSubscriptionId(
114905
+ recordName,
114906
+ notification.address,
114907
+ pushSubscriptionId
114908
+ );
114909
+ if (sub) {
114910
+ subscriptionId = sub.id;
114911
+ }
114912
+ }
114913
+ if (!subscriptionId) {
114914
+ subscriptionId = v7_default();
114915
+ await this.store.saveSubscription({
114916
+ id: subscriptionId,
114917
+ recordName,
114918
+ notificationAddress: notification.address,
114919
+ userId,
114920
+ pushSubscriptionId: !userId ? pushSubscriptionId : null
114921
+ });
114922
+ }
114923
+ console.log(
114924
+ `[NotificationRecordsController] [userId: ${userId} pushSubscriptionId: ${pushSubscriptionId} subscriptionId: ${subscriptionId}] Subscribed to notification`
114925
+ );
114926
+ return {
114927
+ success: true,
114928
+ subscriptionId
114929
+ };
114930
+ } catch (err) {
114931
+ const span = trace.getActiveSpan();
114932
+ span?.recordException(err);
114933
+ span?.setStatus({ code: SpanStatusCode.ERROR });
114934
+ console.error(
114935
+ "[NotificationRecordsController] Error subscribing to notification:",
114936
+ err
114937
+ );
114938
+ return {
114939
+ success: false,
114940
+ errorCode: "server_error",
114941
+ errorMessage: "A server error occurred."
114942
+ };
114943
+ }
114944
+ }
114945
+ _getPushSubscriptionId(endpoint2) {
114946
+ return v5_default(endpoint2, SUBSCRIPTION_ID_NAMESPACE);
114947
+ }
114948
+ async unsubscribeFromNotification(request2) {
114949
+ try {
114950
+ const subscription = await this.store.getSubscriptionById(
114951
+ request2.subscriptionId
114952
+ );
114953
+ if (!subscription) {
114954
+ return {
114955
+ success: false,
114956
+ errorCode: "data_not_found",
114957
+ errorMessage: "Subscription not found."
114958
+ };
114959
+ }
114960
+ const context = await this.policies.constructAuthorizationContext({
114961
+ userId: request2.userId,
114962
+ recordKeyOrRecordName: subscription.recordName
114963
+ });
114964
+ if (context.success === false) {
114965
+ return context;
114966
+ }
114967
+ let successfulAuthorization = false;
114968
+ if (subscription.userId) {
114969
+ const userContext = await this.policies.constructAuthorizationContext({
114970
+ userId: request2.userId,
114971
+ recordKeyOrRecordName: subscription.userId
114972
+ });
114973
+ if (userContext.success === true) {
114974
+ const userAuthorization = await this.policies.authorizeUserAndInstances(
114975
+ userContext.context,
114976
+ {
114977
+ userId: request2.userId,
114978
+ action: "unsubscribe",
114979
+ resourceKind: "notification",
114980
+ resourceId: subscription.id,
114981
+ instances: request2.instances,
114982
+ markers: [PRIVATE_MARKER]
114983
+ }
114984
+ );
114985
+ if (userAuthorization.success === true) {
114986
+ successfulAuthorization = true;
114987
+ }
114988
+ }
114989
+ }
114990
+ const userId = context.context.userId;
114991
+ const recordName = context.context.recordName;
114992
+ if (!successfulAuthorization) {
114993
+ const notification = await this.store.getItemByAddress(
114994
+ recordName,
114995
+ subscription.notificationAddress
114996
+ );
114997
+ if (!notification) {
114998
+ return {
114999
+ success: false,
115000
+ errorCode: "data_not_found",
115001
+ errorMessage: "Notification not found."
115002
+ };
115003
+ }
115004
+ const authorization = await this.policies.authorizeUserAndInstances(
115005
+ context.context,
115006
+ {
115007
+ userId,
115008
+ action: "unsubscribe",
115009
+ resourceKind: "notification",
115010
+ resourceId: notification.address,
115011
+ instances: request2.instances,
115012
+ markers: notification.markers
115013
+ }
115014
+ );
115015
+ if (authorization.success === false) {
115016
+ return authorization;
115017
+ }
115018
+ }
115019
+ await this.store.deleteSubscription(request2.subscriptionId);
115020
+ console.log(
115021
+ `[NotificationRecordsController] [userId: ${userId} subscriptionId: ${request2.subscriptionId}] Unsubscribed from notification`
115022
+ );
115023
+ return {
115024
+ success: true
115025
+ };
115026
+ } catch (err) {
115027
+ const span = trace.getActiveSpan();
115028
+ span?.recordException(err);
115029
+ span?.setStatus({ code: SpanStatusCode.ERROR });
115030
+ console.error(
115031
+ "[NotificationRecordsController] Error subscribing to notification:",
115032
+ err
115033
+ );
115034
+ return {
115035
+ success: false,
115036
+ errorCode: "server_error",
115037
+ errorMessage: "A server error occurred."
115038
+ };
115039
+ }
115040
+ }
115041
+ async registerPushSubscription(request2) {
115042
+ try {
115043
+ if (!request2.userId) {
115044
+ return {
115045
+ success: false,
115046
+ errorCode: "not_logged_in",
115047
+ errorMessage: "The user must be logged in. Please provide a sessionKey or a recordKey."
115048
+ };
115049
+ }
115050
+ const pushSubscriptionId = this._getPushSubscriptionId(
115051
+ request2.pushSubscription.endpoint
115052
+ );
115053
+ await this.store.savePushSubscription({
115054
+ id: pushSubscriptionId,
115055
+ active: true,
115056
+ endpoint: request2.pushSubscription.endpoint,
115057
+ keys: request2.pushSubscription.keys
115058
+ });
115059
+ await this.store.savePushSubscriptionUser({
115060
+ pushSubscriptionId,
115061
+ userId: request2.userId
115062
+ });
115063
+ console.log(
115064
+ `[NotificationRecordsController] [userId: ${request2.userId} pushSubscriptionId: ${pushSubscriptionId}] Registered push subscription`
115065
+ );
115066
+ return {
115067
+ success: true
115068
+ };
115069
+ } catch (err) {
115070
+ const span = trace.getActiveSpan();
115071
+ span?.recordException(err);
115072
+ span?.setStatus({ code: SpanStatusCode.ERROR });
115073
+ console.error(
115074
+ "[NotificationRecordsController] Error registering push subscription:",
115075
+ err
115076
+ );
115077
+ return {
115078
+ success: false,
115079
+ errorCode: "server_error",
115080
+ errorMessage: "A server error occurred."
115081
+ };
115082
+ }
115083
+ }
115084
+ async sendNotification(request2) {
115085
+ try {
115086
+ const context = await this.policies.constructAuthorizationContext({
115087
+ userId: request2.userId,
115088
+ recordKeyOrRecordName: request2.recordName
115089
+ });
115090
+ if (context.success === false) {
115091
+ return context;
115092
+ }
115093
+ const recordName = context.context.recordName;
115094
+ const userId = context.context.userId;
115095
+ const notification = await this.store.getItemByAddress(
115096
+ recordName,
115097
+ request2.address
115098
+ );
115099
+ if (!notification) {
115100
+ return {
115101
+ success: false,
115102
+ errorCode: "data_not_found",
115103
+ errorMessage: "Notification not found."
115104
+ };
115105
+ }
115106
+ const authorization = await this.policies.authorizeUserAndInstances(
115107
+ context.context,
115108
+ {
115109
+ action: "send",
115110
+ resourceKind: "notification",
115111
+ resourceId: notification.address,
115112
+ markers: notification.markers,
115113
+ userId,
115114
+ instances: request2.instances
115115
+ }
115116
+ );
115117
+ if (authorization.success === false) {
115118
+ return authorization;
115119
+ }
115120
+ const metrics3 = await this._checkSubscriptionMetrics(
115121
+ "send",
115122
+ context.context,
115123
+ authorization,
115124
+ notification
115125
+ );
115126
+ if (metrics3.success === false) {
115127
+ return metrics3;
115128
+ }
115129
+ const pushSubs = await this.store.listActivePushSubscriptionsForNotification(
115130
+ recordName,
115131
+ notification.address
115132
+ );
115133
+ if (typeof metrics3.features.maxSentPushNotificationsPerPeriod === "number") {
115134
+ if (metrics3.metrics.totalSentNotificationsInPeriod + pushSubs.length >= metrics3.features.maxSentPushNotificationsPerPeriod) {
115135
+ return {
115136
+ success: false,
115137
+ errorCode: "subscription_limit_reached",
115138
+ errorMessage: "The maximum number of sent push notifications has been reached for this period."
115139
+ };
115140
+ }
115141
+ }
115142
+ let promises = [];
115143
+ const sentTimeMs = Date.now();
115144
+ for (let push of pushSubs) {
115145
+ promises.push(
115146
+ this._pushInterface.sendNotification(
115147
+ {
115148
+ endpoint: push.endpoint,
115149
+ keys: push.keys
115150
+ },
115151
+ request2.payload,
115152
+ request2.topic
115153
+ ).then((result) => {
115154
+ return [push, result];
115155
+ })
115156
+ );
115157
+ }
115158
+ const results = await Promise.allSettled(promises);
115159
+ const notificationId = v7_default();
115160
+ await this.store.saveSentNotification({
115161
+ id: notificationId,
115162
+ recordName,
115163
+ notificationAddress: notification.address,
115164
+ title: request2.payload.title,
115165
+ body: request2.payload.body,
115166
+ icon: request2.payload.icon,
115167
+ badge: request2.payload.badge,
115168
+ defaultAction: request2.payload.action,
115169
+ actions: request2.payload.actions,
115170
+ silent: request2.payload.silent,
115171
+ tag: request2.payload.tag,
115172
+ timestamp: request2.payload.timestamp,
115173
+ sentTimeMs,
115174
+ topic: request2.topic
115175
+ });
115176
+ let sentPushNotifications = [];
115177
+ let failedPushSubscriptions = [];
115178
+ for (let promiseResult of results) {
115179
+ if (promiseResult.status === "rejected") {
115180
+ console.error(
115181
+ "[NotificationRecordsController] Error sending notification:",
115182
+ promiseResult.reason
115183
+ );
115184
+ } else {
115185
+ const [push, result] = promiseResult.value;
115186
+ sentPushNotifications.push({
115187
+ id: v7_default(),
115188
+ pushSubscriptionId: push.id,
115189
+ sentNotificationId: notificationId,
115190
+ userId: push.userId,
115191
+ subscriptionId: push.subscriptionId,
115192
+ success: result.success,
115193
+ errorCode: result.success === false ? result.errorCode : null
115194
+ });
115195
+ if (result.success === false) {
115196
+ console.error(
115197
+ `[NotificationRecordsController] Error sending notification for ${push.id}:`,
115198
+ result.errorCode
115199
+ );
115200
+ if (result.errorCode === "subscription_gone" || result.errorCode === "subscription_not_found") {
115201
+ failedPushSubscriptions.push(push.id);
115202
+ }
115203
+ }
115204
+ }
115205
+ }
115206
+ if (sentPushNotifications.length > 0) {
115207
+ await this.store.createSentPushNotifications(
115208
+ sentPushNotifications
115209
+ );
115210
+ }
115211
+ if (failedPushSubscriptions.length > 0) {
115212
+ await this.store.markPushSubscriptionsInactiveAndDeleteUserRelations(
115213
+ failedPushSubscriptions
115214
+ );
115215
+ }
115216
+ console.log(
115217
+ `[NotificationRecordsController] [userId: ${userId} notificationId: ${notificationId} sent: ${sentPushNotifications.length} failed: ${failedPushSubscriptions.length}] Sent notification`
115218
+ );
115219
+ return {
115220
+ success: true
115221
+ };
115222
+ } catch (err) {
115223
+ const span = trace.getActiveSpan();
115224
+ span?.recordException(err);
115225
+ span?.setStatus({ code: SpanStatusCode.ERROR });
115226
+ console.error(
115227
+ "[NotificationRecordsController] Error sending notification:",
115228
+ err
115229
+ );
115230
+ return {
115231
+ success: false,
115232
+ errorCode: "server_error",
115233
+ errorMessage: "A server error occurred."
115234
+ };
115235
+ }
115236
+ }
115237
+ async listSubscriptionsForUser(request2) {
115238
+ try {
115239
+ if (!request2.userId) {
115240
+ return {
115241
+ success: false,
115242
+ errorCode: "not_logged_in",
115243
+ errorMessage: "The user must be logged in. Please provide a sessionKey or a recordKey."
115244
+ };
115245
+ }
115246
+ const subscriptions = await this.store.listSubscriptionsForUser(
115247
+ request2.userId
115248
+ );
115249
+ return {
115250
+ success: true,
115251
+ subscriptions: subscriptions.map((sub) => ({
115252
+ id: sub.id,
115253
+ userId: sub.userId,
115254
+ recordName: sub.recordName,
115255
+ notificationAddress: sub.notificationAddress,
115256
+ pushSubscriptionId: sub.pushSubscriptionId
115257
+ }))
115258
+ };
115259
+ } catch (err) {
115260
+ const span = trace.getActiveSpan();
115261
+ span?.recordException(err);
115262
+ span?.setStatus({ code: SpanStatusCode.ERROR });
115263
+ console.error(
115264
+ "[NotificationRecordsController] Error listing subscriptions for user:",
115265
+ err
115266
+ );
115267
+ return {
115268
+ success: false,
115269
+ errorCode: "server_error",
115270
+ errorMessage: "A server error occurred."
115271
+ };
115272
+ }
115273
+ }
115274
+ async listSubscriptions(request2) {
115275
+ try {
115276
+ if (!request2.userId) {
115277
+ return {
115278
+ success: false,
115279
+ errorCode: "not_logged_in",
115280
+ errorMessage: "The user must be logged in. Please provide a sessionKey or a recordKey."
115281
+ };
115282
+ }
115283
+ const context = await this.policies.constructAuthorizationContext({
115284
+ recordKeyOrRecordName: request2.recordName,
115285
+ userId: request2.userId
115286
+ });
115287
+ if (context.success === false) {
115288
+ return context;
115289
+ }
115290
+ const recordName = context.context.recordName;
115291
+ const notification = await this.store.getItemByAddress(
115292
+ recordName,
115293
+ request2.address
115294
+ );
115295
+ if (!notification) {
115296
+ return {
115297
+ success: false,
115298
+ errorCode: "data_not_found",
115299
+ errorMessage: "Notification not found."
115300
+ };
115301
+ }
115302
+ const authorization = await this.policies.authorizeUserAndInstances(
115303
+ context.context,
115304
+ {
115305
+ userId: request2.userId,
115306
+ resourceKind: "notification",
115307
+ markers: notification.markers,
115308
+ resourceId: notification.address,
115309
+ action: "listSubscriptions",
115310
+ instances: request2.instances
115311
+ }
115312
+ );
115313
+ if (authorization.success === false) {
115314
+ return authorization;
115315
+ }
115316
+ const subscriptions = await this.store.listSubscriptionsForNotification(
115317
+ recordName,
115318
+ request2.address
115319
+ );
115320
+ return {
115321
+ success: true,
115322
+ subscriptions: subscriptions.map((sub) => ({
115323
+ id: sub.id,
115324
+ userId: sub.userId,
115325
+ recordName: sub.recordName,
115326
+ notificationAddress: sub.notificationAddress,
115327
+ pushSubscriptionId: sub.pushSubscriptionId
115328
+ }))
115329
+ };
115330
+ } catch (err) {
115331
+ const span = trace.getActiveSpan();
115332
+ span?.recordException(err);
115333
+ span?.setStatus({ code: SpanStatusCode.ERROR });
115334
+ console.error(
115335
+ "[NotificationRecordsController] Error listing subscriptions for notification:",
115336
+ err
115337
+ );
115338
+ return {
115339
+ success: false,
115340
+ errorCode: "server_error",
115341
+ errorMessage: "A server error occurred."
115342
+ };
115343
+ }
115344
+ }
115345
+ async _checkSubscriptionMetrics(action2, context, authorization, item) {
115346
+ const config2 = await this.config.getSubscriptionConfiguration();
115347
+ const metrics3 = await this.store.getSubscriptionMetrics({
115348
+ ownerId: context.recordOwnerId,
115349
+ studioId: context.recordStudioId
115350
+ });
115351
+ const features = getNotificationFeatures(
115352
+ config2,
115353
+ metrics3.subscriptionStatus,
115354
+ metrics3.subscriptionId,
115355
+ metrics3.subscriptionType,
115356
+ metrics3.currentPeriodStartMs,
115357
+ metrics3.currentPeriodEndMs
115358
+ );
115359
+ if (!features.allowed) {
115360
+ return {
115361
+ success: false,
115362
+ errorCode: "not_authorized",
115363
+ errorMessage: "Notifications are not allowed for this subscription."
115364
+ };
115365
+ }
115366
+ if (action2 === "create" && typeof features.maxItems === "number") {
115367
+ if (metrics3.totalItems >= features.maxItems) {
115368
+ return {
115369
+ success: false,
115370
+ errorCode: "subscription_limit_reached",
115371
+ errorMessage: "The maximum number of notification items has been reached for your subscription."
115372
+ };
115373
+ }
115374
+ }
115375
+ if (action2 === "subscribe" && typeof features.maxSubscribersPerItem === "number") {
115376
+ const totalSubscriptions = await this.store.countSubscriptionsForNotification(
115377
+ context.recordName,
115378
+ item.address
115379
+ );
115380
+ if (totalSubscriptions >= features.maxSubscribersPerItem) {
115381
+ return {
115382
+ success: false,
115383
+ errorCode: "subscription_limit_reached",
115384
+ errorMessage: "The maximum number of subscriptions has been reached for this notification."
115385
+ };
115386
+ }
115387
+ }
115388
+ if (action2 === "send") {
115389
+ if (typeof features.maxSentNotificationsPerPeriod === "number" && metrics3.totalSentNotificationsInPeriod >= features.maxSentNotificationsPerPeriod) {
115390
+ return {
115391
+ success: false,
115392
+ errorCode: "subscription_limit_reached",
115393
+ errorMessage: "The maximum number of sent notifications has been reached for this period."
115394
+ };
115395
+ }
115396
+ }
115397
+ return {
115398
+ success: true,
115399
+ config: config2,
115400
+ metrics: metrics3,
115401
+ features
115402
+ };
115403
+ }
115404
+ };
115405
+ __decorateClass([
115406
+ traced(TRACE_NAME9)
115407
+ ], NotificationRecordsController.prototype, "getApplicationServerKey", 1);
115408
+ __decorateClass([
115409
+ traced(TRACE_NAME9)
115410
+ ], NotificationRecordsController.prototype, "subscribeToNotification", 1);
115411
+ __decorateClass([
115412
+ traced(TRACE_NAME9)
115413
+ ], NotificationRecordsController.prototype, "unsubscribeFromNotification", 1);
115414
+ __decorateClass([
115415
+ traced(TRACE_NAME9)
115416
+ ], NotificationRecordsController.prototype, "registerPushSubscription", 1);
115417
+ __decorateClass([
115418
+ traced(TRACE_NAME9)
115419
+ ], NotificationRecordsController.prototype, "sendNotification", 1);
115420
+ __decorateClass([
115421
+ traced(TRACE_NAME9)
115422
+ ], NotificationRecordsController.prototype, "listSubscriptionsForUser", 1);
115423
+ __decorateClass([
115424
+ traced(TRACE_NAME9)
115425
+ ], NotificationRecordsController.prototype, "listSubscriptions", 1);
115426
+
115427
+ // ../aux-records/crud/MemoryCrudRecordsStore.ts
114160
115428
  var import_lodash21 = __toESM(require_lodash());
115429
+
115430
+ // ../aux-records/notifications/MemoryNotificationRecordsStore.ts
115431
+ var import_lodash22 = __toESM(require_lodash());
115432
+
115433
+ // ../aux-records/RecordsServer.ts
114161
115434
  var NOT_LOGGED_IN_RESULT = {
114162
115435
  success: false,
114163
115436
  errorCode: "not_logged_in",
@@ -114233,7 +115506,8 @@ var RecordsServer = class {
114233
115506
  aiController,
114234
115507
  moderationController,
114235
115508
  loomController,
114236
- webhooksController
115509
+ webhooksController,
115510
+ notificationsController
114237
115511
  }) {
114238
115512
  /**
114239
115513
  * The map of paths to routes that they match.
@@ -114257,9 +115531,10 @@ var RecordsServer = class {
114257
115531
  this._moderationController = moderationController;
114258
115532
  this._loomController = loomController;
114259
115533
  this._webhooksController = webhooksController;
115534
+ this._notificationsController = notificationsController;
114260
115535
  this._tracer = trace.getTracer(
114261
115536
  "RecordsServer",
114262
- false ? void 0 : "v3.3.11-alpha.11349749950"
115537
+ false ? void 0 : "v3.3.11"
114263
115538
  );
114264
115539
  this._procedures = this._createProcedures();
114265
115540
  this._setupRoutes();
@@ -115032,7 +116307,7 @@ var RecordsServer = class {
115032
116307
  ipAddress: context.httpRequest.ipAddress,
115033
116308
  path: "/api/v2/records/webhook/run",
115034
116309
  body: JSON.stringify(data),
115035
- headers: (0, import_lodash21.omit)(
116310
+ headers: (0, import_lodash23.omit)(
115036
116311
  context.httpRequest.headers,
115037
116312
  ...bannedHeaders
115038
116313
  ),
@@ -115141,6 +116416,246 @@ var RecordsServer = class {
115141
116416
  );
115142
116417
  return result;
115143
116418
  }),
116419
+ recordNotification: recordItemProcedure(
116420
+ this._auth,
116421
+ this._notificationsController,
116422
+ z.object({
116423
+ address: ADDRESS_VALIDATION,
116424
+ description: z.string().min(1),
116425
+ markers: MARKERS_VALIDATION.optional().default([
116426
+ PRIVATE_MARKER
116427
+ ])
116428
+ }),
116429
+ procedure().origins("api").http("POST", "/api/v2/records/notification")
116430
+ ),
116431
+ getNotification: getItemProcedure(
116432
+ this._auth,
116433
+ this._notificationsController,
116434
+ procedure().origins("api").http("GET", "/api/v2/records/notification")
116435
+ ),
116436
+ listNotifications: listItemsProcedure(
116437
+ this._auth,
116438
+ this._notificationsController,
116439
+ procedure().origins("api").http("GET", "/api/v2/records/notification/list")
116440
+ ),
116441
+ listNotificationSubscriptions: procedure().origins("api").http("GET", "/api/v2/records/notification/list/subscriptions").inputs(
116442
+ z.object({
116443
+ recordName: RECORD_NAME_VALIDATION,
116444
+ address: ADDRESS_VALIDATION,
116445
+ instances: INSTANCES_ARRAY_VALIDATION.optional()
116446
+ })
116447
+ ).handler(
116448
+ async ({ recordName, address, instances }, context) => {
116449
+ if (!this._notificationsController) {
116450
+ return {
116451
+ success: false,
116452
+ errorCode: "not_supported",
116453
+ errorMessage: "This feature is not supported."
116454
+ };
116455
+ }
116456
+ const validation = await this._validateSessionKey(
116457
+ context.sessionKey
116458
+ );
116459
+ if (validation.success === false) {
116460
+ if (validation.errorCode === "no_session_key") {
116461
+ return NOT_LOGGED_IN_RESULT;
116462
+ }
116463
+ return validation;
116464
+ }
116465
+ const result = await this._notificationsController.listSubscriptions(
116466
+ {
116467
+ recordName,
116468
+ address,
116469
+ userId: validation.userId,
116470
+ instances
116471
+ }
116472
+ );
116473
+ return result;
116474
+ }
116475
+ ),
116476
+ listUserNotificationSubscriptions: procedure().origins("api").http(
116477
+ "GET",
116478
+ "/api/v2/records/notification/list/user/subscriptions"
116479
+ ).inputs(
116480
+ z.object({
116481
+ instances: INSTANCES_ARRAY_VALIDATION.optional()
116482
+ })
116483
+ ).handler(async ({ instances }, context) => {
116484
+ if (!this._notificationsController) {
116485
+ return {
116486
+ success: false,
116487
+ errorCode: "not_supported",
116488
+ errorMessage: "This feature is not supported."
116489
+ };
116490
+ }
116491
+ const validation = await this._validateSessionKey(
116492
+ context.sessionKey
116493
+ );
116494
+ if (validation.success === false) {
116495
+ if (validation.errorCode === "no_session_key") {
116496
+ return NOT_LOGGED_IN_RESULT;
116497
+ }
116498
+ return validation;
116499
+ }
116500
+ const result = await this._notificationsController.listSubscriptionsForUser(
116501
+ {
116502
+ userId: validation.userId,
116503
+ instances
116504
+ }
116505
+ );
116506
+ return result;
116507
+ }),
116508
+ eraseNotification: eraseItemProcedure(
116509
+ this._auth,
116510
+ this._notificationsController,
116511
+ procedure().origins("api").http("DELETE", "/api/v2/records/notification")
116512
+ ),
116513
+ registerPushSubscription: procedure().origins("api").http("POST", "/api/v2/records/notification/register").inputs(
116514
+ z.object({
116515
+ pushSubscription: PUSH_SUBSCRIPTION_SCHEMA,
116516
+ instances: INSTANCES_ARRAY_VALIDATION.optional()
116517
+ })
116518
+ ).handler(async ({ pushSubscription, instances }, context) => {
116519
+ if (!this._notificationsController) {
116520
+ return {
116521
+ success: false,
116522
+ errorCode: "not_supported",
116523
+ errorMessage: "This feature is not supported."
116524
+ };
116525
+ }
116526
+ const validation = await this._validateSessionKey(
116527
+ context.sessionKey
116528
+ );
116529
+ if (validation.success === false && validation.errorCode !== "no_session_key") {
116530
+ return validation;
116531
+ }
116532
+ const result = await this._notificationsController.registerPushSubscription(
116533
+ {
116534
+ userId: validation.userId,
116535
+ pushSubscription,
116536
+ instances
116537
+ }
116538
+ );
116539
+ return result;
116540
+ }),
116541
+ subscribeToNotification: procedure().origins("api").http("POST", "/api/v2/records/notification/subscribe").inputs(
116542
+ z.object({
116543
+ recordName: RECORD_NAME_VALIDATION,
116544
+ address: ADDRESS_VALIDATION,
116545
+ instances: INSTANCES_ARRAY_VALIDATION.optional(),
116546
+ pushSubscription: PUSH_SUBSCRIPTION_SCHEMA
116547
+ })
116548
+ ).handler(
116549
+ async ({ recordName, address, instances, pushSubscription }, context) => {
116550
+ if (!this._notificationsController) {
116551
+ return {
116552
+ success: false,
116553
+ errorCode: "not_supported",
116554
+ errorMessage: "This feature is not supported."
116555
+ };
116556
+ }
116557
+ const validation = await this._validateSessionKey(
116558
+ context.sessionKey
116559
+ );
116560
+ if (validation.success === false && validation.errorCode !== "no_session_key") {
116561
+ return validation;
116562
+ }
116563
+ const result = await this._notificationsController.subscribeToNotification(
116564
+ {
116565
+ recordName,
116566
+ address,
116567
+ userId: validation.userId,
116568
+ pushSubscription,
116569
+ instances
116570
+ }
116571
+ );
116572
+ return result;
116573
+ }
116574
+ ),
116575
+ unsubscribeFromNotification: procedure().origins("api").http("POST", "/api/v2/records/notification/unsubscribe").inputs(
116576
+ z.object({
116577
+ subscriptionId: z.string(),
116578
+ instances: INSTANCES_ARRAY_VALIDATION.optional()
116579
+ })
116580
+ ).handler(async ({ subscriptionId, instances }, context) => {
116581
+ if (!this._notificationsController) {
116582
+ return {
116583
+ success: false,
116584
+ errorCode: "not_supported",
116585
+ errorMessage: "This feature is not supported."
116586
+ };
116587
+ }
116588
+ const validation = await this._validateSessionKey(
116589
+ context.sessionKey
116590
+ );
116591
+ if (validation.success === false) {
116592
+ if (validation.errorCode === "no_session_key") {
116593
+ return NOT_LOGGED_IN_RESULT;
116594
+ }
116595
+ return validation;
116596
+ }
116597
+ const result = await this._notificationsController.unsubscribeFromNotification(
116598
+ {
116599
+ subscriptionId,
116600
+ userId: validation.userId,
116601
+ instances
116602
+ }
116603
+ );
116604
+ return result;
116605
+ }),
116606
+ sendNotification: procedure().origins("api").http("POST", "/api/v2/records/notification/send").inputs(
116607
+ z.object({
116608
+ recordName: RECORD_NAME_VALIDATION,
116609
+ address: ADDRESS_VALIDATION,
116610
+ instances: INSTANCES_ARRAY_VALIDATION.optional(),
116611
+ payload: PUSH_NOTIFICATION_PAYLOAD,
116612
+ topic: z.string().optional()
116613
+ })
116614
+ ).handler(
116615
+ async ({ recordName, address, instances, payload, topic }, context) => {
116616
+ if (!this._notificationsController) {
116617
+ return {
116618
+ success: false,
116619
+ errorCode: "not_supported",
116620
+ errorMessage: "This feature is not supported."
116621
+ };
116622
+ }
116623
+ const validation = await this._validateSessionKey(
116624
+ context.sessionKey
116625
+ );
116626
+ if (validation.success === false) {
116627
+ if (validation.errorCode === "no_session_key") {
116628
+ return NOT_LOGGED_IN_RESULT;
116629
+ }
116630
+ return validation;
116631
+ }
116632
+ const result = await this._notificationsController.sendNotification(
116633
+ {
116634
+ recordName,
116635
+ address,
116636
+ userId: validation.userId,
116637
+ payload,
116638
+ topic,
116639
+ instances
116640
+ }
116641
+ );
116642
+ return result;
116643
+ }
116644
+ ),
116645
+ getNotificationsApplicationServerKey: procedure().origins("api").http(
116646
+ "GET",
116647
+ "/api/v2/records/notification/applicationServerKey"
116648
+ ).handler(async () => {
116649
+ if (!this._notificationsController) {
116650
+ return {
116651
+ success: false,
116652
+ errorCode: "not_supported",
116653
+ errorMessage: "This feature is not supported."
116654
+ };
116655
+ }
116656
+ const result = await this._notificationsController.getApplicationServerKey();
116657
+ return result;
116658
+ }),
115144
116659
  listRecords: procedure().origins("api").http("GET", "/api/v2/records/list").inputs(
115145
116660
  z.object({
115146
116661
  studioId: z.string().nonempty().optional(),
@@ -116353,8 +117868,8 @@ var RecordsServer = class {
116353
117868
  return {
116354
117869
  success: true,
116355
117870
  ...metadata,
116356
- version: true ? "v3.3.11-alpha.11349749950" : void 0,
116357
- versionHash: true ? "619e0c7640cc4279dc1423c3bc0025ab5716b398" : void 0
117871
+ version: true ? "v3.3.11" : void 0,
117872
+ versionHash: true ? "8e5ee8f33c196328a1c90dbbd799d2ddf248f31d" : void 0
116358
117873
  };
116359
117874
  })
116360
117875
  };
@@ -116500,7 +118015,7 @@ var RecordsServer = class {
116500
118015
  result,
116501
118016
  context
116502
118017
  );
116503
- return (0, import_lodash21.merge)(response, procedureResponse);
118018
+ return (0, import_lodash23.merge)(response, procedureResponse);
116504
118019
  }
116505
118020
  return response;
116506
118021
  },
@@ -119723,7 +121238,7 @@ var STRIPE_EVENT_INVOICE_PAID_SCHEMA = z.object({
119723
121238
  });
119724
121239
 
119725
121240
  // ../aux-records/SubscriptionController.ts
119726
- var TRACE_NAME8 = "SubscriptionController";
121241
+ var TRACE_NAME10 = "SubscriptionController";
119727
121242
  var SubscriptionController = class {
119728
121243
  constructor(stripe, auth7, authStore, recordsStore, config2) {
119729
121244
  this._stripe = stripe;
@@ -120601,19 +122116,19 @@ var SubscriptionController = class {
120601
122116
  }
120602
122117
  };
120603
122118
  __decorateClass([
120604
- traced(TRACE_NAME8)
122119
+ traced(TRACE_NAME10)
120605
122120
  ], SubscriptionController.prototype, "getSubscriptionStatus", 1);
120606
122121
  __decorateClass([
120607
- traced(TRACE_NAME8)
122122
+ traced(TRACE_NAME10)
120608
122123
  ], SubscriptionController.prototype, "updateSubscription", 1);
120609
122124
  __decorateClass([
120610
- traced(TRACE_NAME8)
122125
+ traced(TRACE_NAME10)
120611
122126
  ], SubscriptionController.prototype, "createManageSubscriptionLink", 1);
120612
122127
  __decorateClass([
120613
- traced(TRACE_NAME8)
122128
+ traced(TRACE_NAME10)
120614
122129
  ], SubscriptionController.prototype, "_createCheckoutSession", 1);
120615
122130
  __decorateClass([
120616
- traced(TRACE_NAME8)
122131
+ traced(TRACE_NAME10)
120617
122132
  ], SubscriptionController.prototype, "handleStripeWebhook", 1);
120618
122133
  function returnRoute(basePath, user, studio) {
120619
122134
  if (user) {
@@ -120632,7 +122147,7 @@ function studiosRoute(basePath, studioId, studioName) {
120632
122147
  }
120633
122148
 
120634
122149
  // ../aux-records/RateLimitController.ts
120635
- var TRACE_NAME9 = "RateLimitController";
122150
+ var TRACE_NAME11 = "RateLimitController";
120636
122151
  var RateLimitController = class {
120637
122152
  constructor(rateLimiter, config2) {
120638
122153
  this._rateLimiter = rateLimiter;
@@ -120679,7 +122194,7 @@ var RateLimitController = class {
120679
122194
  }
120680
122195
  };
120681
122196
  __decorateClass([
120682
- traced(TRACE_NAME9)
122197
+ traced(TRACE_NAME11)
120683
122198
  ], RateLimitController.prototype, "checkRateLimit", 1);
120684
122199
 
120685
122200
  // ../../node_modules/.pnpm/openai@4.47.1/node_modules/openai/version.mjs
@@ -125299,7 +126814,7 @@ var { OpenAIError: OpenAIError2, APIError: APIError2, APIConnectionError: APICon
125299
126814
  var openai_default = OpenAI;
125300
126815
 
125301
126816
  // ../aux-records/OpenAIChatInterface.ts
125302
- var TRACE_NAME10 = "OpenAIChatInterface";
126817
+ var TRACE_NAME12 = "OpenAIChatInterface";
125303
126818
  var SPAN_OPTIONS = {
125304
126819
  kind: SpanKind.CLIENT,
125305
126820
  attributes: {
@@ -125436,14 +126951,14 @@ var OpenAIChatInterface = class {
125436
126951
  }
125437
126952
  };
125438
126953
  __decorateClass([
125439
- traced(TRACE_NAME10, SPAN_OPTIONS)
126954
+ traced(TRACE_NAME12, SPAN_OPTIONS)
125440
126955
  ], OpenAIChatInterface.prototype, "chat", 1);
125441
126956
  __decorateClass([
125442
- traced(TRACE_NAME10, SPAN_OPTIONS)
126957
+ traced(TRACE_NAME12, SPAN_OPTIONS)
125443
126958
  ], OpenAIChatInterface.prototype, "chatStream", 1);
125444
126959
 
125445
126960
  // ../aux-records/BlockadeLabsGenerateSkyboxInterface.ts
125446
- var TRACE_NAME11 = "BlockadeLabsGenerateSkyboxInterface";
126961
+ var TRACE_NAME13 = "BlockadeLabsGenerateSkyboxInterface";
125447
126962
  var SPAN_OPTIONS2 = {
125448
126963
  kind: SpanKind.CLIENT,
125449
126964
  attributes: {
@@ -125541,17 +127056,17 @@ var BlockadeLabsGenerateSkyboxInterface = class {
125541
127056
  }
125542
127057
  };
125543
127058
  __decorateClass([
125544
- traced(TRACE_NAME11, SPAN_OPTIONS2)
127059
+ traced(TRACE_NAME13, SPAN_OPTIONS2)
125545
127060
  ], BlockadeLabsGenerateSkyboxInterface.prototype, "generateSkybox", 1);
125546
127061
  __decorateClass([
125547
- traced(TRACE_NAME11, SPAN_OPTIONS2)
127062
+ traced(TRACE_NAME13, SPAN_OPTIONS2)
125548
127063
  ], BlockadeLabsGenerateSkyboxInterface.prototype, "getSkybox", 1);
125549
127064
  function isFinished(status) {
125550
127065
  return status.status === "complete" || status.status === "abort" || status.status === "error";
125551
127066
  }
125552
127067
 
125553
127068
  // ../aux-records/OpenAIImageInterface.ts
125554
- var TRACE_NAME12 = "OpenAIImageInterface";
127069
+ var TRACE_NAME14 = "OpenAIImageInterface";
125555
127070
  var SPAN_OPTIONS3 = {
125556
127071
  kind: SpanKind.CLIENT,
125557
127072
  attributes: {
@@ -125603,12 +127118,12 @@ var OpenAIImageInterface = class {
125603
127118
  }
125604
127119
  };
125605
127120
  __decorateClass([
125606
- traced(TRACE_NAME12, SPAN_OPTIONS3)
127121
+ traced(TRACE_NAME14, SPAN_OPTIONS3)
125607
127122
  ], OpenAIImageInterface.prototype, "generateImage", 1);
125608
127123
 
125609
127124
  // ../aux-records/StabilityAIImageInterface.ts
125610
- var import_lodash22 = __toESM(require_lodash());
125611
- var TRACE_NAME13 = "StabilityAIImageInterface";
127125
+ var import_lodash24 = __toESM(require_lodash());
127126
+ var TRACE_NAME15 = "StabilityAIImageInterface";
125612
127127
  var StabilityAIImageInterface = class {
125613
127128
  constructor(options) {
125614
127129
  this._options = options;
@@ -125664,7 +127179,7 @@ var StabilityAIImageInterface = class {
125664
127179
  console.log(
125665
127180
  `[StabilityAIImageInterface] [${request2.userId}] [generateImage]: Done!`
125666
127181
  );
125667
- const images = (0, import_lodash22.flatMap)(
127182
+ const images = (0, import_lodash24.flatMap)(
125668
127183
  result.data,
125669
127184
  (a3) => a3.map((d2) => ({
125670
127185
  base64: d2.base64,
@@ -125799,16 +127314,16 @@ var StabilityAIImageInterface = class {
125799
127314
  }
125800
127315
  };
125801
127316
  __decorateClass([
125802
- traced(TRACE_NAME13)
127317
+ traced(TRACE_NAME15)
125803
127318
  ], StabilityAIImageInterface.prototype, "generateImage", 1);
125804
127319
  __decorateClass([
125805
- traced(TRACE_NAME13)
127320
+ traced(TRACE_NAME15)
125806
127321
  ], StabilityAIImageInterface.prototype, "_stableImageUltra", 1);
125807
127322
  __decorateClass([
125808
- traced(TRACE_NAME13)
127323
+ traced(TRACE_NAME15)
125809
127324
  ], StabilityAIImageInterface.prototype, "_stableImageCore", 1);
125810
127325
  __decorateClass([
125811
- traced(TRACE_NAME13)
127326
+ traced(TRACE_NAME15)
125812
127327
  ], StabilityAIImageInterface.prototype, "_sd3", 1);
125813
127328
  function getStableImageAspectRatio(width, height) {
125814
127329
  if (!width || !height) {
@@ -126648,7 +128163,7 @@ var GoogleGenerativeAI = class {
126648
128163
  };
126649
128164
 
126650
128165
  // ../aux-records/GoogleAIChatInterface.ts
126651
- var TRACE_NAME14 = "GoogleAIChatInterface";
128166
+ var TRACE_NAME16 = "GoogleAIChatInterface";
126652
128167
  var SPAN_OPTIONS4 = {
126653
128168
  kind: SpanKind.CLIENT,
126654
128169
  attributes: {
@@ -126828,10 +128343,10 @@ var GoogleAIChatInterface = class {
126828
128343
  }
126829
128344
  };
126830
128345
  __decorateClass([
126831
- traced(TRACE_NAME14, SPAN_OPTIONS4)
128346
+ traced(TRACE_NAME16, SPAN_OPTIONS4)
126832
128347
  ], GoogleAIChatInterface.prototype, "chat", 1);
126833
128348
  __decorateClass([
126834
- traced(TRACE_NAME14, SPAN_OPTIONS4)
128349
+ traced(TRACE_NAME16, SPAN_OPTIONS4)
126835
128350
  ], GoogleAIChatInterface.prototype, "chatStream", 1);
126836
128351
  function mapMessage(message2) {
126837
128352
  return {
@@ -129002,7 +130517,7 @@ var { AnthropicError: AnthropicError2, APIError: APIError4, APIConnectionError:
129002
130517
  var sdk_default = Anthropic;
129003
130518
 
129004
130519
  // ../aux-records/AnthropicAIChatInterface.ts
129005
- var TRACE_NAME15 = "AnthropicAIChatInterface";
130520
+ var TRACE_NAME17 = "AnthropicAIChatInterface";
129006
130521
  var SPAN_OPTIONS5 = {
129007
130522
  kind: SpanKind.CLIENT,
129008
130523
  attributes: {
@@ -129122,10 +130637,10 @@ var AnthropicAIChatInterface = class {
129122
130637
  }
129123
130638
  };
129124
130639
  __decorateClass([
129125
- traced(TRACE_NAME15, SPAN_OPTIONS5)
130640
+ traced(TRACE_NAME17, SPAN_OPTIONS5)
129126
130641
  ], AnthropicAIChatInterface.prototype, "chat", 1);
129127
130642
  __decorateClass([
129128
- traced(TRACE_NAME15, SPAN_OPTIONS5)
130643
+ traced(TRACE_NAME17, SPAN_OPTIONS5)
129129
130644
  ], AnthropicAIChatInterface.prototype, "chatStream", 1);
129130
130645
  function mapMessage2(message2) {
129131
130646
  return {
@@ -129172,13 +130687,13 @@ function mapOutputContent(content) {
129172
130687
  }
129173
130688
 
129174
130689
  // ../aux-records/MemoryStore.ts
129175
- var import_lodash23 = __toESM(require_lodash());
130690
+ var import_lodash25 = __toESM(require_lodash());
129176
130691
 
129177
130692
  // ../aux-records/MemoryFileRecordsLookup.ts
129178
- var import_lodash24 = __toESM(require_lodash());
130693
+ var import_lodash26 = __toESM(require_lodash());
129179
130694
 
129180
130695
  // ../aux-records/CachingConfigStore.ts
129181
- var TRACE_NAME16 = "CachingConfigStore";
130696
+ var TRACE_NAME18 = "CachingConfigStore";
129182
130697
  var CachingConfigStore = class {
129183
130698
  /**
129184
130699
  * Creates a new CachingConfigStore.
@@ -129234,17 +130749,17 @@ var CachingConfigStore = class {
129234
130749
  }
129235
130750
  };
129236
130751
  __decorateClass([
129237
- traced(TRACE_NAME16)
130752
+ traced(TRACE_NAME18)
129238
130753
  ], CachingConfigStore.prototype, "getSubscriptionConfiguration", 1);
129239
130754
  __decorateClass([
129240
- traced(TRACE_NAME16)
130755
+ traced(TRACE_NAME18)
129241
130756
  ], CachingConfigStore.prototype, "getPrivoConfiguration", 1);
129242
130757
  __decorateClass([
129243
- traced(TRACE_NAME16)
130758
+ traced(TRACE_NAME18)
129244
130759
  ], CachingConfigStore.prototype, "getModerationConfig", 1);
129245
130760
 
129246
130761
  // ../aux-records/ModerationController.ts
129247
- var TRACE_NAME17 = "ModerationController";
130762
+ var TRACE_NAME19 = "ModerationController";
129248
130763
  var ModerationController = class {
129249
130764
  constructor(store, config2, messenger, jobProvider) {
129250
130765
  this._store = store;
@@ -129478,13 +130993,13 @@ var ModerationController = class {
129478
130993
  }
129479
130994
  };
129480
130995
  __decorateClass([
129481
- traced(TRACE_NAME17)
130996
+ traced(TRACE_NAME19)
129482
130997
  ], ModerationController.prototype, "reportInst", 1);
129483
130998
  __decorateClass([
129484
- traced(TRACE_NAME17)
130999
+ traced(TRACE_NAME19)
129485
131000
  ], ModerationController.prototype, "scheduleModerationScans", 1);
129486
131001
  __decorateClass([
129487
- traced(TRACE_NAME17)
131002
+ traced(TRACE_NAME19)
129488
131003
  ], ModerationController.prototype, "scanFile", 1);
129489
131004
 
129490
131005
  // ../aux-records/ModerationConfiguration.ts
@@ -129571,7 +131086,7 @@ var moderationSchema = z.object({
129571
131086
  }).describe("The moderation jobs that are enabled.").optional()
129572
131087
  });
129573
131088
 
129574
- // ../aux-records/NotificationMessenger.ts
131089
+ // ../aux-records/SystemNotificationMessenger.ts
129575
131090
  var slackSchema = z.object({
129576
131091
  webhookUrl: z.string().describe(
129577
131092
  "The Slack webhook URL that should be used to send records notification messages."
@@ -129670,9 +131185,9 @@ var util3 = __toESM(require("node:util"), 1);
129670
131185
  var is_key_object_default = (obj) => util3.types.isKeyObject(obj);
129671
131186
 
129672
131187
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/webcrypto.js
129673
- var crypto4 = __toESM(require("node:crypto"), 1);
131188
+ var crypto5 = __toESM(require("node:crypto"), 1);
129674
131189
  var util4 = __toESM(require("node:util"), 1);
129675
- var webcrypto3 = crypto4.webcrypto;
131190
+ var webcrypto3 = crypto5.webcrypto;
129676
131191
  var webcrypto_default = webcrypto3;
129677
131192
  var isCryptoKey = (key) => util4.types.isCryptoKey(key);
129678
131193
 
@@ -129848,11 +131363,11 @@ function isObject4(input2) {
129848
131363
  }
129849
131364
 
129850
131365
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/ecdhes.js
129851
- var import_node_crypto6 = require("node:crypto");
131366
+ var import_node_crypto7 = require("node:crypto");
129852
131367
  var import_node_util3 = require("node:util");
129853
131368
 
129854
131369
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.js
129855
- var import_node_crypto5 = require("node:crypto");
131370
+ var import_node_crypto6 = require("node:crypto");
129856
131371
  var namedCurveToJOSE = (namedCurve) => {
129857
131372
  switch (namedCurve) {
129858
131373
  case "prime256v1":
@@ -129870,7 +131385,7 @@ var namedCurveToJOSE = (namedCurve) => {
129870
131385
  var getNamedCurve2 = (kee, raw) => {
129871
131386
  let key;
129872
131387
  if (isCryptoKey(kee)) {
129873
- key = import_node_crypto5.KeyObject.from(kee);
131388
+ key = import_node_crypto6.KeyObject.from(kee);
129874
131389
  } else if (is_key_object_default(kee)) {
129875
131390
  key = kee;
129876
131391
  } else {
@@ -129900,15 +131415,15 @@ var getNamedCurve2 = (kee, raw) => {
129900
131415
  var get_named_curve_default = getNamedCurve2;
129901
131416
 
129902
131417
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/ecdhes.js
129903
- var generateKeyPair = (0, import_node_util3.promisify)(import_node_crypto6.generateKeyPair);
131418
+ var generateKeyPair = (0, import_node_util3.promisify)(import_node_crypto7.generateKeyPair);
129904
131419
 
129905
131420
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/pbes2kw.js
129906
131421
  var import_node_util4 = require("node:util");
129907
- var import_node_crypto7 = require("node:crypto");
129908
- var pbkdf2 = (0, import_node_util4.promisify)(import_node_crypto7.pbkdf2);
131422
+ var import_node_crypto8 = require("node:crypto");
131423
+ var pbkdf2 = (0, import_node_util4.promisify)(import_node_crypto8.pbkdf2);
129909
131424
 
129910
131425
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/rsaes.js
129911
- var import_node_crypto8 = require("node:crypto");
131426
+ var import_node_crypto9 = require("node:crypto");
129912
131427
  var import_node_util5 = require("node:util");
129913
131428
 
129914
131429
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/check_key_length.js
@@ -129920,12 +131435,12 @@ var check_key_length_default = (key, alg) => {
129920
131435
  };
129921
131436
 
129922
131437
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/rsaes.js
129923
- var RSA1_5 = (0, import_node_util5.deprecate)(() => import_node_crypto8.constants.RSA_PKCS1_PADDING, 'The RSA1_5 "alg" (JWE Algorithm) is deprecated and will be removed in the next major revision.');
131438
+ var RSA1_5 = (0, import_node_util5.deprecate)(() => import_node_crypto9.constants.RSA_PKCS1_PADDING, 'The RSA1_5 "alg" (JWE Algorithm) is deprecated and will be removed in the next major revision.');
129924
131439
 
129925
131440
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/asn1.js
129926
- var import_node_crypto9 = require("node:crypto");
131441
+ var import_node_crypto10 = require("node:crypto");
129927
131442
  var import_node_buffer2 = require("node:buffer");
129928
- var fromPKCS8 = (pem) => (0, import_node_crypto9.createPrivateKey)({
131443
+ var fromPKCS8 = (pem) => (0, import_node_crypto10.createPrivateKey)({
129929
131444
  key: import_node_buffer2.Buffer.from(pem.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, ""), "base64"),
129930
131445
  type: "pkcs8",
129931
131446
  format: "der"
@@ -130016,7 +131531,7 @@ var validate_crit_default = validateCrit;
130016
131531
  var unprotected = Symbol();
130017
131532
 
130018
131533
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/verify.js
130019
- var crypto6 = __toESM(require("node:crypto"), 1);
131534
+ var crypto7 = __toESM(require("node:crypto"), 1);
130020
131535
  var import_node_util7 = require("node:util");
130021
131536
 
130022
131537
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.js
@@ -130043,10 +131558,10 @@ function dsaDigest(alg) {
130043
131558
  }
130044
131559
 
130045
131560
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/node_key.js
130046
- var import_node_crypto10 = require("node:crypto");
131561
+ var import_node_crypto11 = require("node:crypto");
130047
131562
  var PSS = {
130048
- padding: import_node_crypto10.constants.RSA_PKCS1_PSS_PADDING,
130049
- saltLength: import_node_crypto10.constants.RSA_PSS_SALTLEN_DIGEST
131563
+ padding: import_node_crypto11.constants.RSA_PKCS1_PSS_PADDING,
131564
+ saltLength: import_node_crypto11.constants.RSA_PSS_SALTLEN_DIGEST
130050
131565
  };
130051
131566
  var ecCurveAlgMap = /* @__PURE__ */ new Map([
130052
131567
  ["ES256", "P-256"],
@@ -130106,7 +131621,7 @@ function keyForCrypto(alg, key) {
130106
131621
  }
130107
131622
 
130108
131623
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/sign.js
130109
- var crypto5 = __toESM(require("node:crypto"), 1);
131624
+ var crypto6 = __toESM(require("node:crypto"), 1);
130110
131625
  var import_node_util6 = require("node:util");
130111
131626
 
130112
131627
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.js
@@ -130124,30 +131639,30 @@ function hmacDigest(alg) {
130124
131639
  }
130125
131640
 
130126
131641
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.js
130127
- var import_node_crypto11 = require("node:crypto");
131642
+ var import_node_crypto12 = require("node:crypto");
130128
131643
  function getSignVerifyKey(alg, key, usage) {
130129
131644
  if (key instanceof Uint8Array) {
130130
131645
  if (!alg.startsWith("HS")) {
130131
131646
  throw new TypeError(invalid_key_input_default(key, ...types3));
130132
131647
  }
130133
- return (0, import_node_crypto11.createSecretKey)(key);
131648
+ return (0, import_node_crypto12.createSecretKey)(key);
130134
131649
  }
130135
- if (key instanceof import_node_crypto11.KeyObject) {
131650
+ if (key instanceof import_node_crypto12.KeyObject) {
130136
131651
  return key;
130137
131652
  }
130138
131653
  if (isCryptoKey(key)) {
130139
131654
  checkSigCryptoKey(key, alg, usage);
130140
- return import_node_crypto11.KeyObject.from(key);
131655
+ return import_node_crypto12.KeyObject.from(key);
130141
131656
  }
130142
131657
  throw new TypeError(invalid_key_input_default(key, ...types3, "Uint8Array"));
130143
131658
  }
130144
131659
 
130145
131660
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/sign.js
130146
- var oneShotSign = (0, import_node_util6.promisify)(crypto5.sign);
131661
+ var oneShotSign = (0, import_node_util6.promisify)(crypto6.sign);
130147
131662
  var sign2 = async (alg, key, data) => {
130148
131663
  const keyObject = getSignVerifyKey(alg, key, "sign");
130149
131664
  if (alg.startsWith("HS")) {
130150
- const hmac6 = crypto5.createHmac(hmacDigest(alg), keyObject);
131665
+ const hmac6 = crypto6.createHmac(hmacDigest(alg), keyObject);
130151
131666
  hmac6.update(data);
130152
131667
  return hmac6.digest();
130153
131668
  }
@@ -130156,7 +131671,7 @@ var sign2 = async (alg, key, data) => {
130156
131671
  var sign_default = sign2;
130157
131672
 
130158
131673
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/verify.js
130159
- var oneShotVerify = (0, import_node_util7.promisify)(crypto6.verify);
131674
+ var oneShotVerify = (0, import_node_util7.promisify)(crypto7.verify);
130160
131675
 
130161
131676
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/lib/epoch.js
130162
131677
  var epoch_default = (date) => Math.floor(date.getTime() / 1e3);
@@ -130409,12 +131924,12 @@ if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozi
130409
131924
  }
130410
131925
 
130411
131926
  // ../../node_modules/.pnpm/jose@5.4.0/node_modules/jose/dist/node/esm/runtime/generate.js
130412
- var import_node_crypto12 = require("node:crypto");
131927
+ var import_node_crypto13 = require("node:crypto");
130413
131928
  var import_node_util8 = require("node:util");
130414
- var generate2 = (0, import_node_util8.promisify)(import_node_crypto12.generateKeyPair);
131929
+ var generate2 = (0, import_node_util8.promisify)(import_node_crypto13.generateKeyPair);
130415
131930
 
130416
131931
  // ../aux-records/LoomController.ts
130417
- var TRACE_NAME18 = "LoomController";
131932
+ var TRACE_NAME20 = "LoomController";
130418
131933
  var LoomController = class {
130419
131934
  constructor(options) {
130420
131935
  this._policies = options.policies;
@@ -130499,7 +132014,7 @@ var LoomController = class {
130499
132014
  }
130500
132015
  };
130501
132016
  __decorateClass([
130502
- traced(TRACE_NAME18)
132017
+ traced(TRACE_NAME20)
130503
132018
  ], LoomController.prototype, "getToken", 1);
130504
132019
 
130505
132020
  // ../aux-records/PrivoConfiguration.ts
@@ -131046,10 +132561,6 @@ var serverConfigSchema = z.object({
131046
132561
  telemetry: telemetrySchema.describe(
131047
132562
  "Options for configuring telemetry. If omitted, then telemetry will not be enabled."
131048
132563
  ).optional(),
131049
- // auth: authSchema
131050
- // .describe('Authentication configuration options.')
131051
- // .optional()
131052
- // .default({}),
131053
132564
  subscriptions: subscriptionConfigSchema.describe(
131054
132565
  "The default subscription configuration. If omitted, then subscription features will be disabled."
131055
132566
  ).optional(),
@@ -131057,7 +132568,7 @@ var serverConfigSchema = z.object({
131057
132568
  "Stripe options. If omitted, then Stripe features will be disabled."
131058
132569
  ).optional(),
131059
132570
  notifications: notificationsSchema.describe(
131060
- "Notification configuration options. If omitted, then server notifications will be disabled."
132571
+ "System notification configuration options. Used to send messages for various events like user inst reports and com ID requests. If omitted, then server notifications will be disabled."
131061
132572
  ).optional(),
131062
132573
  moderation: moderationSchema.describe(
131063
132574
  "Moderation configuration options. If omitted, then moderation features will be disabled unless overridden in the database."
@@ -131065,6 +132576,19 @@ var serverConfigSchema = z.object({
131065
132576
  webhooks: webhooksSchema.describe(
131066
132577
  "Webhook configuration options. If omitted, then webhook features will be disabled."
131067
132578
  ).optional(),
132579
+ webPush: z.object({
132580
+ vapidSubject: z.string().describe(
132581
+ "The subject that should be used for sending web push notifications. You can generate VAPID keys using https://www.npmjs.com/package/web-push"
132582
+ ).min(1),
132583
+ vapidPublicKey: z.string().describe(
132584
+ "The public key that should be used for sending web push notifications. You can generate VAPID keys using https://www.npmjs.com/package/web-push"
132585
+ ).min(1),
132586
+ vapidPrivateKey: z.string().describe(
132587
+ "The private key that should be used for sending web push notifications. You can generate VAPID keys using https://www.npmjs.com/package/web-push"
132588
+ ).min(1)
132589
+ }).describe(
132590
+ "Web Push configuration options. If omitted, then web push notifications will be disabled."
132591
+ ).optional(),
131068
132592
  meta: z.object({
131069
132593
  apiOrigin: z.string().describe("The HTTP origin that the API is available at."),
131070
132594
  websocketOrigin: z.string().describe(
@@ -131078,391 +132602,6 @@ var serverConfigSchema = z.object({
131078
132602
  ).optional()
131079
132603
  });
131080
132604
 
131081
- // ../aux-records/crud/CrudRecordsController.ts
131082
- var TRACE_NAME19 = "CrudRecordsController";
131083
- var CrudRecordsController = class {
131084
- get config() {
131085
- return this._config;
131086
- }
131087
- /**
131088
- * Gets the name of the controller.
131089
- */
131090
- get name() {
131091
- return this._name;
131092
- }
131093
- get policies() {
131094
- return this._policies;
131095
- }
131096
- get store() {
131097
- return this._store;
131098
- }
131099
- /**
131100
- * Gets the kind of resources that this controller is for.
131101
- */
131102
- get resourceKind() {
131103
- return this._resourceKind;
131104
- }
131105
- constructor(config2) {
131106
- this._name = config2.name;
131107
- this._store = config2.store;
131108
- this._policies = config2.policies;
131109
- this._config = config2.config;
131110
- this._resourceKind = config2.resourceKind;
131111
- }
131112
- async recordItem(request2) {
131113
- try {
131114
- const contextResult = await this._policies.constructAuthorizationContext({
131115
- recordKeyOrRecordName: request2.recordKeyOrRecordName,
131116
- userId: request2.userId
131117
- });
131118
- if (contextResult.success === false) {
131119
- return contextResult;
131120
- }
131121
- const recordName = contextResult.context.recordName;
131122
- const existingItem = await this._store.getItemByAddress(
131123
- recordName,
131124
- request2.item.address
131125
- );
131126
- let resourceMarkers;
131127
- let action2 = existingItem ? "update" : "create";
131128
- let authorization;
131129
- if (action2 === "update") {
131130
- const existingMarkers = existingItem.markers;
131131
- resourceMarkers = request2.item.markers ?? existingMarkers;
131132
- action2 = "update";
131133
- authorization = await this._policies.authorizeUserAndInstancesForResources(
131134
- contextResult.context,
131135
- {
131136
- userId: request2.userId,
131137
- instances: request2.instances,
131138
- resources: [
131139
- {
131140
- resourceKind: this._resourceKind,
131141
- resourceId: existingItem.address,
131142
- action: action2,
131143
- markers: resourceMarkers
131144
- },
131145
- ...getMarkerResourcesForUpdate(
131146
- existingMarkers,
131147
- request2.item.markers
131148
- )
131149
- ]
131150
- }
131151
- );
131152
- if (authorization.success === false) {
131153
- return authorization;
131154
- }
131155
- } else {
131156
- resourceMarkers = request2.item.markers;
131157
- authorization = await this._policies.authorizeUserAndInstancesForResources(
131158
- contextResult.context,
131159
- {
131160
- userId: request2.userId,
131161
- instances: request2.instances,
131162
- resources: [
131163
- {
131164
- resourceKind: this._resourceKind,
131165
- resourceId: request2.item.address,
131166
- action: action2,
131167
- markers: resourceMarkers
131168
- },
131169
- ...getMarkerResourcesForCreation(
131170
- resourceMarkers
131171
- )
131172
- ]
131173
- }
131174
- );
131175
- if (authorization.success === false) {
131176
- return authorization;
131177
- }
131178
- }
131179
- if (!resourceMarkers) {
131180
- return {
131181
- success: false,
131182
- errorCode: "invalid_request",
131183
- errorMessage: "The item must have markers."
131184
- };
131185
- }
131186
- const item = this._transformInputItem(request2.item);
131187
- const subscriptionResult = await this._checkSubscriptionMetrics(
131188
- action2,
131189
- contextResult.context,
131190
- authorization,
131191
- item
131192
- );
131193
- if (subscriptionResult.success === false) {
131194
- return subscriptionResult;
131195
- }
131196
- await this._store.putItem(recordName, item);
131197
- return {
131198
- success: true,
131199
- recordName,
131200
- address: item.address
131201
- };
131202
- } catch (err) {
131203
- const span = trace.getActiveSpan();
131204
- span?.recordException(err);
131205
- span?.setStatus({ code: SpanStatusCode.ERROR });
131206
- console.error(`[${this._name}] Error recording item:`, err);
131207
- return {
131208
- success: false,
131209
- errorCode: "server_error",
131210
- errorMessage: "A server error occurred."
131211
- };
131212
- }
131213
- }
131214
- async getItem(request2) {
131215
- try {
131216
- const baseRequest = {
131217
- recordKeyOrRecordName: request2.recordName,
131218
- userId: request2.userId,
131219
- instances: request2.instances
131220
- };
131221
- const context = await this._policies.constructAuthorizationContext(
131222
- baseRequest
131223
- );
131224
- if (context.success === false) {
131225
- return context;
131226
- }
131227
- const result = await this._store.getItemByAddress(
131228
- context.context.recordName,
131229
- request2.address
131230
- );
131231
- if (!result) {
131232
- return {
131233
- success: false,
131234
- errorCode: "data_not_found",
131235
- errorMessage: "The item was not found."
131236
- };
131237
- }
131238
- const markers = result.markers;
131239
- const authorization = await this._policies.authorizeUserAndInstances(
131240
- context.context,
131241
- {
131242
- userId: request2.userId,
131243
- instances: request2.instances,
131244
- resourceKind: this._resourceKind,
131245
- resourceId: request2.address,
131246
- action: "read",
131247
- markers
131248
- }
131249
- );
131250
- if (authorization.success === false) {
131251
- return authorization;
131252
- }
131253
- return {
131254
- success: true,
131255
- item: this._convertItemToResult(result, context.context)
131256
- };
131257
- } catch (err) {
131258
- const span = trace.getActiveSpan();
131259
- span?.recordException(err);
131260
- span?.setStatus({ code: SpanStatusCode.ERROR });
131261
- console.error(`[${this._name}] Error getting item:`, err);
131262
- return {
131263
- success: false,
131264
- errorCode: "server_error",
131265
- errorMessage: "A server error occurred."
131266
- };
131267
- }
131268
- }
131269
- async eraseItem(request2) {
131270
- try {
131271
- const context = await this._policies.constructAuthorizationContext({
131272
- recordKeyOrRecordName: request2.recordName,
131273
- userId: request2.userId
131274
- });
131275
- if (context.success === false) {
131276
- return context;
131277
- }
131278
- const result = await this._store.getItemByAddress(
131279
- context.context.recordName,
131280
- request2.address
131281
- );
131282
- if (!result) {
131283
- return {
131284
- success: false,
131285
- errorCode: "data_not_found",
131286
- errorMessage: "The item was not found."
131287
- };
131288
- }
131289
- const markers = result.markers;
131290
- const authorization = await this._policies.authorizeUserAndInstances(
131291
- context.context,
131292
- {
131293
- userId: request2.userId,
131294
- instances: request2.instances,
131295
- resourceKind: this._resourceKind,
131296
- resourceId: request2.address,
131297
- action: "delete",
131298
- markers
131299
- }
131300
- );
131301
- if (authorization.success === false) {
131302
- return authorization;
131303
- }
131304
- const recordName = context.context.recordName;
131305
- const subscriptionResult = await this._checkSubscriptionMetrics(
131306
- "delete",
131307
- context.context,
131308
- authorization
131309
- );
131310
- if (subscriptionResult.success === false) {
131311
- return subscriptionResult;
131312
- }
131313
- await this._store.deleteItem(recordName, request2.address);
131314
- return {
131315
- success: true
131316
- };
131317
- } catch (err) {
131318
- const span = trace.getActiveSpan();
131319
- span?.recordException(err);
131320
- span?.setStatus({ code: SpanStatusCode.ERROR });
131321
- console.error(`[${this._name}] Error erasing item:`, err);
131322
- return {
131323
- success: false,
131324
- errorCode: "server_error",
131325
- errorMessage: "A server error occurred."
131326
- };
131327
- }
131328
- }
131329
- async listItems(request2) {
131330
- try {
131331
- const baseRequest = {
131332
- recordKeyOrRecordName: request2.recordName,
131333
- userId: request2.userId,
131334
- instances: request2.instances
131335
- };
131336
- const context = await this._policies.constructAuthorizationContext(
131337
- baseRequest
131338
- );
131339
- if (context.success === false) {
131340
- return context;
131341
- }
131342
- const authorization = await this._policies.authorizeUserAndInstances(
131343
- context.context,
131344
- {
131345
- userId: request2.userId,
131346
- instances: request2.instances,
131347
- resourceKind: this._resourceKind,
131348
- action: "list",
131349
- markers: [ACCOUNT_MARKER]
131350
- }
131351
- );
131352
- if (authorization.success === false) {
131353
- return authorization;
131354
- }
131355
- const result2 = await this._store.listItems(
131356
- context.context.recordName,
131357
- request2.startingAddress
131358
- );
131359
- return {
131360
- success: true,
131361
- recordName: context.context.recordName,
131362
- items: result2.items.map(
131363
- (item) => this._convertItemToResult(item, context.context)
131364
- ),
131365
- totalCount: result2.totalCount
131366
- };
131367
- } catch (err) {
131368
- const span = trace.getActiveSpan();
131369
- span?.recordException(err);
131370
- span?.setStatus({ code: SpanStatusCode.ERROR });
131371
- console.error(`[${this._name}] Error listing items:`, err);
131372
- return {
131373
- success: false,
131374
- errorCode: "server_error",
131375
- errorMessage: "A server error occurred."
131376
- };
131377
- }
131378
- }
131379
- async listItemsByMarker(request2) {
131380
- try {
131381
- const baseRequest = {
131382
- recordKeyOrRecordName: request2.recordName,
131383
- userId: request2.userId,
131384
- instances: request2.instances
131385
- };
131386
- const context = await this._policies.constructAuthorizationContext(
131387
- baseRequest
131388
- );
131389
- if (context.success === false) {
131390
- return context;
131391
- }
131392
- const authorization = await this._policies.authorizeUserAndInstances(
131393
- context.context,
131394
- {
131395
- userId: request2.userId,
131396
- instances: request2.instances,
131397
- resourceKind: this._resourceKind,
131398
- action: "list",
131399
- markers: [request2.marker]
131400
- }
131401
- );
131402
- if (authorization.success === false) {
131403
- return authorization;
131404
- }
131405
- const result2 = await this._store.listItemsByMarker({
131406
- recordName: context.context.recordName,
131407
- startingAddress: request2.startingAddress,
131408
- marker: request2.marker,
131409
- sort: request2.sort
131410
- });
131411
- return {
131412
- success: true,
131413
- recordName: context.context.recordName,
131414
- items: result2.items.map(
131415
- (item) => this._convertItemToResult(item, context.context)
131416
- ),
131417
- totalCount: result2.totalCount
131418
- };
131419
- } catch (err) {
131420
- const span = trace.getActiveSpan();
131421
- span?.recordException(err);
131422
- span?.setStatus({ code: SpanStatusCode.ERROR });
131423
- console.error(`[${this._name}] Error listing items:`, err);
131424
- return {
131425
- success: false,
131426
- errorCode: "server_error",
131427
- errorMessage: "A server error occurred."
131428
- };
131429
- }
131430
- }
131431
- /**
131432
- * Converts the given item to a version that is able to be returned to clients.
131433
- * Can be overriden to ensure that some fields are not returned.
131434
- * @param item The item that should be converted.
131435
- * @param context The authorization context.
131436
- * @returns The converted item.
131437
- */
131438
- _convertItemToResult(item, context) {
131439
- return item;
131440
- }
131441
- /**
131442
- * Transforms the given input item and returns the transformed item.
131443
- * Useful for transforming items before they are stored.
131444
- * @param item The item that should be transformed.
131445
- */
131446
- _transformInputItem(item) {
131447
- return item;
131448
- }
131449
- };
131450
- __decorateClass([
131451
- traced(TRACE_NAME19)
131452
- ], CrudRecordsController.prototype, "recordItem", 1);
131453
- __decorateClass([
131454
- traced(TRACE_NAME19)
131455
- ], CrudRecordsController.prototype, "getItem", 1);
131456
- __decorateClass([
131457
- traced(TRACE_NAME19)
131458
- ], CrudRecordsController.prototype, "eraseItem", 1);
131459
- __decorateClass([
131460
- traced(TRACE_NAME19)
131461
- ], CrudRecordsController.prototype, "listItems", 1);
131462
- __decorateClass([
131463
- traced(TRACE_NAME19)
131464
- ], CrudRecordsController.prototype, "listItemsByMarker", 1);
131465
-
131466
132605
  // ../aux-records/webhooks/WebhookEnvironment.ts
131467
132606
  var STORED_AUX_VERSION_1_SCHEMA = z.object({
131468
132607
  version: z.literal(1),
@@ -131526,7 +132665,7 @@ var import_tweetnacl8 = __toESM(require_nacl_fast());
131526
132665
  var import_base64_js14 = __toESM(require_base64_js());
131527
132666
 
131528
132667
  // ../aux-records/webhooks/WebhookRecordsController.ts
131529
- var TRACE_NAME20 = "WebhookRecordsController";
132668
+ var TRACE_NAME21 = "WebhookRecordsController";
131530
132669
  var WebhookRecordsController = class extends CrudRecordsController {
131531
132670
  constructor(config2) {
131532
132671
  super({
@@ -132026,23 +133165,20 @@ var WebhookRecordsController = class extends CrudRecordsController {
132026
133165
  }
132027
133166
  };
132028
133167
  __decorateClass([
132029
- traced(TRACE_NAME20)
133168
+ traced(TRACE_NAME21)
132030
133169
  ], WebhookRecordsController.prototype, "handleWebhook", 1);
132031
133170
  __decorateClass([
132032
- traced(TRACE_NAME20)
133171
+ traced(TRACE_NAME21)
132033
133172
  ], WebhookRecordsController.prototype, "listWebhookRuns", 1);
132034
133173
  __decorateClass([
132035
- traced(TRACE_NAME20)
133174
+ traced(TRACE_NAME21)
132036
133175
  ], WebhookRecordsController.prototype, "getWebhookRun", 1);
132037
133176
  __decorateClass([
132038
- traced(TRACE_NAME20)
133177
+ traced(TRACE_NAME21)
132039
133178
  ], WebhookRecordsController.prototype, "_checkSubscriptionMetrics", 1);
132040
133179
 
132041
- // ../aux-records/crud/MemoryCrudRecordsStore.ts
132042
- var import_lodash25 = __toESM(require_lodash());
132043
-
132044
133180
  // ../aux-records/webhooks/MemoryWebhookRecordsStore.ts
132045
- var import_lodash26 = __toESM(require_lodash());
133181
+ var import_lodash27 = __toESM(require_lodash());
132046
133182
 
132047
133183
  // cli.ts
132048
133184
  var import_node_stream3 = require("node:stream");
@@ -132305,7 +133441,7 @@ function expand(template, context) {
132305
133441
  return template.replace(/\/$/, "");
132306
133442
  }
132307
133443
  }
132308
- function parse2(options) {
133444
+ function parse3(options) {
132309
133445
  let method = options.method.toUpperCase();
132310
133446
  let url2 = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
132311
133447
  let headers = Object.assign({}, options.headers);
@@ -132369,7 +133505,7 @@ function parse2(options) {
132369
133505
  );
132370
133506
  }
132371
133507
  function endpointWithDefaults(defaults2, route, options) {
132372
- return parse2(merge5(defaults2, route, options));
133508
+ return parse3(merge5(defaults2, route, options));
132373
133509
  }
132374
133510
  function withDefaults(oldDefaults, newDefaults) {
132375
133511
  const DEFAULTS2 = merge5(oldDefaults, newDefaults);
@@ -132378,7 +133514,7 @@ function withDefaults(oldDefaults, newDefaults) {
132378
133514
  DEFAULTS: DEFAULTS2,
132379
133515
  defaults: withDefaults.bind(null, DEFAULTS2),
132380
133516
  merge: merge5.bind(null, DEFAULTS2),
132381
- parse: parse2
133517
+ parse: parse3
132382
133518
  });
132383
133519
  }
132384
133520
  var endpoint = withDefaults(null, DEFAULTS);
@@ -136347,11 +137483,11 @@ __export(crypto_node_exports, {
136347
137483
  convertPrivateKey: () => convertPrivateKey
136348
137484
  });
136349
137485
  __reExport(crypto_node_exports, require("node:crypto"));
136350
- var import_node_crypto13 = require("node:crypto");
137486
+ var import_node_crypto14 = require("node:crypto");
136351
137487
  function convertPrivateKey(privateKey) {
136352
137488
  if (!isPkcs1(privateKey))
136353
137489
  return privateKey;
136354
- return (0, import_node_crypto13.createPrivateKey)(privateKey).export({
137490
+ return (0, import_node_crypto14.createPrivateKey)(privateKey).export({
136355
137491
  type: "pkcs8",
136356
137492
  format: "pem"
136357
137493
  });
@@ -138553,8 +139689,8 @@ var OAuthApp = class {
138553
139689
  };
138554
139690
 
138555
139691
  // ../../node_modules/.pnpm/@octokit+webhooks-methods@5.1.0/node_modules/@octokit/webhooks-methods/dist-node/index.js
138556
- var import_node_crypto14 = require("node:crypto");
138557
139692
  var import_node_crypto15 = require("node:crypto");
139693
+ var import_node_crypto16 = require("node:crypto");
138558
139694
  var import_node_buffer3 = require("node:buffer");
138559
139695
  var VERSION19 = "5.1.0";
138560
139696
  async function sign3(secret, payload) {
@@ -138567,7 +139703,7 @@ async function sign3(secret, payload) {
138567
139703
  throw new TypeError("[@octokit/webhooks-methods] payload must be a string");
138568
139704
  }
138569
139705
  const algorithm = "sha256";
138570
- return `${algorithm}=${(0, import_node_crypto14.createHmac)(algorithm, secret).update(payload).digest("hex")}`;
139706
+ return `${algorithm}=${(0, import_node_crypto15.createHmac)(algorithm, secret).update(payload).digest("hex")}`;
138571
139707
  }
138572
139708
  sign3.VERSION = VERSION19;
138573
139709
  async function verify3(secret, eventPayload, signature) {
@@ -138586,7 +139722,7 @@ async function verify3(secret, eventPayload, signature) {
138586
139722
  if (signatureBuffer.length !== verificationBuffer.length) {
138587
139723
  return false;
138588
139724
  }
138589
- return (0, import_node_crypto15.timingSafeEqual)(signatureBuffer, verificationBuffer);
139725
+ return (0, import_node_crypto16.timingSafeEqual)(signatureBuffer, verificationBuffer);
138590
139726
  }
138591
139727
  verify3.VERSION = VERSION19;
138592
139728
 
@@ -139842,7 +140978,7 @@ function parseStringResponse(result, parsers12, texts, trim2 = true) {
139842
140978
  }
139843
140979
  return lines[i2 + offset2];
139844
140980
  };
139845
- parsers12.some(({ parse: parse3 }) => parse3(line, result));
140981
+ parsers12.some(({ parse: parse4 }) => parse4(line, result));
139846
140982
  }
139847
140983
  });
139848
140984
  return result;
@@ -144172,7 +145308,7 @@ var config = new Conf({
144172
145308
  projectName: "casualos-cli"
144173
145309
  });
144174
145310
  var program2 = new Command();
144175
- program2.name("casualos").description("A CLI for CasualOS").version("v3.3.11-alpha.11349749950").option(
145311
+ program2.name("casualos").description("A CLI for CasualOS").version("v3.3.11").option(
144176
145312
  "-e, --endpoint <url>",
144177
145313
  "The endpoint to use for queries. Can be used to override the current endpoint."
144178
145314
  );