canopycms-cdk 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canopycms-cdk",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "AWS CDK constructs and EC2 worker for CanopyCMS deployment",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -34,7 +34,7 @@
34
34
  "peerDependencies": {
35
35
  "aws-cdk-lib": "^2.260.0",
36
36
  "constructs": "^10.0.0",
37
- "canopycms": "0.13.0"
37
+ "canopycms": "0.14.0"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "aws-cdk-lib": {
@@ -60,8 +60,8 @@
60
60
  "tsx": "^4.19.0",
61
61
  "typescript": "^5.6.3",
62
62
  "vitest": "^4.1.0",
63
- "canopycms-auth-clerk": "0.13.0",
64
- "canopycms": "0.13.0"
63
+ "canopycms": "0.14.0",
64
+ "canopycms-auth-clerk": "0.14.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "rm -rf dist && tsc && node ../../scripts/add-js-extensions.mjs dist",
@@ -5633,8 +5633,8 @@ var init_types = __esm({
5633
5633
  });
5634
5634
  return INVALID;
5635
5635
  }
5636
- const rest = this._def.rest;
5637
- if (!rest && ctx.data.length > this._def.items.length) {
5636
+ const rest2 = this._def.rest;
5637
+ if (!rest2 && ctx.data.length > this._def.items.length) {
5638
5638
  addIssueToContext(ctx, {
5639
5639
  code: ZodIssueCode.too_big,
5640
5640
  maximum: this._def.items.length,
@@ -5661,10 +5661,10 @@ var init_types = __esm({
5661
5661
  get items() {
5662
5662
  return this._def.items;
5663
5663
  }
5664
- rest(rest) {
5664
+ rest(rest2) {
5665
5665
  return new _ZodTuple({
5666
5666
  ...this._def,
5667
- rest
5667
+ rest: rest2
5668
5668
  });
5669
5669
  }
5670
5670
  };
@@ -13741,14 +13741,14 @@ var require_Collection = __commonJS({
13741
13741
  if (isEmptyPath(path44))
13742
13742
  this.add(value);
13743
13743
  else {
13744
- const [key, ...rest] = path44;
13744
+ const [key, ...rest2] = path44;
13745
13745
  const node2 = this.get(key, true);
13746
13746
  if (identity.isCollection(node2))
13747
- node2.addIn(rest, value);
13747
+ node2.addIn(rest2, value);
13748
13748
  else if (node2 === void 0 && this.schema)
13749
- this.set(key, collectionFromPath(this.schema, rest, value));
13749
+ this.set(key, collectionFromPath(this.schema, rest2, value));
13750
13750
  else
13751
- throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
13751
+ throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest2}`);
13752
13752
  }
13753
13753
  }
13754
13754
  /**
@@ -13756,14 +13756,14 @@ var require_Collection = __commonJS({
13756
13756
  * @returns `true` if the item was found and removed.
13757
13757
  */
13758
13758
  deleteIn(path44) {
13759
- const [key, ...rest] = path44;
13760
- if (rest.length === 0)
13759
+ const [key, ...rest2] = path44;
13760
+ if (rest2.length === 0)
13761
13761
  return this.delete(key);
13762
13762
  const node2 = this.get(key, true);
13763
13763
  if (identity.isCollection(node2))
13764
- return node2.deleteIn(rest);
13764
+ return node2.deleteIn(rest2);
13765
13765
  else
13766
- throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
13766
+ throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest2}`);
13767
13767
  }
13768
13768
  /**
13769
13769
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -13771,12 +13771,12 @@ var require_Collection = __commonJS({
13771
13771
  * `true` (collections are always returned intact).
13772
13772
  */
13773
13773
  getIn(path44, keepScalar) {
13774
- const [key, ...rest] = path44;
13774
+ const [key, ...rest2] = path44;
13775
13775
  const node2 = this.get(key, true);
13776
- if (rest.length === 0)
13776
+ if (rest2.length === 0)
13777
13777
  return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
13778
13778
  else
13779
- return identity.isCollection(node2) ? node2.getIn(rest, keepScalar) : void 0;
13779
+ return identity.isCollection(node2) ? node2.getIn(rest2, keepScalar) : void 0;
13780
13780
  }
13781
13781
  hasAllNullValues(allowScalar) {
13782
13782
  return this.items.every((node2) => {
@@ -13790,28 +13790,28 @@ var require_Collection = __commonJS({
13790
13790
  * Checks if the collection includes a value with the key `key`.
13791
13791
  */
13792
13792
  hasIn(path44) {
13793
- const [key, ...rest] = path44;
13794
- if (rest.length === 0)
13793
+ const [key, ...rest2] = path44;
13794
+ if (rest2.length === 0)
13795
13795
  return this.has(key);
13796
13796
  const node2 = this.get(key, true);
13797
- return identity.isCollection(node2) ? node2.hasIn(rest) : false;
13797
+ return identity.isCollection(node2) ? node2.hasIn(rest2) : false;
13798
13798
  }
13799
13799
  /**
13800
13800
  * Sets a value in this collection. For `!!set`, `value` needs to be a
13801
13801
  * boolean to add/remove the item from the set.
13802
13802
  */
13803
13803
  setIn(path44, value) {
13804
- const [key, ...rest] = path44;
13805
- if (rest.length === 0) {
13804
+ const [key, ...rest2] = path44;
13805
+ if (rest2.length === 0) {
13806
13806
  this.set(key, value);
13807
13807
  } else {
13808
13808
  const node2 = this.get(key, true);
13809
13809
  if (identity.isCollection(node2))
13810
- node2.setIn(rest, value);
13810
+ node2.setIn(rest2, value);
13811
13811
  else if (node2 === void 0 && this.schema)
13812
- this.set(key, collectionFromPath(this.schema, rest, value));
13812
+ this.set(key, collectionFromPath(this.schema, rest2, value));
13813
13813
  else
13814
- throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
13814
+ throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest2}`);
13815
13815
  }
13816
13816
  }
13817
13817
  };
@@ -26045,9 +26045,9 @@ var require_acorn = __commonJS({
26045
26045
  } else if (allowTrailingComma && this.afterTrailingComma(close)) {
26046
26046
  break;
26047
26047
  } else if (this.type === types$12.ellipsis) {
26048
- var rest = this.parseRestBinding();
26049
- this.parseBindingListItem(rest);
26050
- elts.push(rest);
26048
+ var rest2 = this.parseRestBinding();
26049
+ this.parseBindingListItem(rest2);
26050
+ elts.push(rest2);
26051
26051
  if (this.type === types$12.comma) {
26052
26052
  this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
26053
26053
  }
@@ -30648,8 +30648,8 @@ var require_recursionDetectionMiddleware = __commonJS({
30648
30648
  const invokeStore = await lambda_invoke_store_1.InvokeStore.getInstanceAsync();
30649
30649
  const traceIdFromInvokeStore = invokeStore?.getXRayTraceId();
30650
30650
  const traceId = traceIdFromInvokeStore ?? traceIdFromEnv;
30651
- const nonEmptyString = (str2) => typeof str2 === "string" && str2.length > 0;
30652
- if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
30651
+ const nonEmptyString2 = (str2) => typeof str2 === "string" && str2.length > 0;
30652
+ if (nonEmptyString2(functionName) && nonEmptyString2(traceId)) {
30653
30653
  request.headers[TRACE_ID_HEADER_NAME] = traceId;
30654
30654
  }
30655
30655
  return next({
@@ -40061,17 +40061,17 @@ var require_dist_cjs25 = __commonJS({
40061
40061
  const { paginators = {}, waiters = {} } = options2 ?? {};
40062
40062
  for (const [paginatorName, paginatorFn] of Object.entries(paginators)) {
40063
40063
  if (Client5.prototype[paginatorName] === void 0) {
40064
- Client5.prototype[paginatorName] = function(commandInput = {}, paginationConfiguration, ...rest) {
40064
+ Client5.prototype[paginatorName] = function(commandInput = {}, paginationConfiguration, ...rest2) {
40065
40065
  return paginatorFn({
40066
40066
  ...paginationConfiguration,
40067
40067
  client: this
40068
- }, commandInput, ...rest);
40068
+ }, commandInput, ...rest2);
40069
40069
  };
40070
40070
  }
40071
40071
  }
40072
40072
  for (const [waiterName, waiterFn] of Object.entries(waiters)) {
40073
40073
  if (Client5.prototype[waiterName] === void 0) {
40074
- Client5.prototype[waiterName] = async function(commandInput = {}, waiterConfiguration, ...rest) {
40074
+ Client5.prototype[waiterName] = async function(commandInput = {}, waiterConfiguration, ...rest2) {
40075
40075
  let config = waiterConfiguration;
40076
40076
  if (typeof waiterConfiguration === "number") {
40077
40077
  config = {
@@ -40081,7 +40081,7 @@ var require_dist_cjs25 = __commonJS({
40081
40081
  return waiterFn({
40082
40082
  ...config,
40083
40083
  client: this
40084
- }, commandInput, ...rest);
40084
+ }, commandInput, ...rest2);
40085
40085
  };
40086
40086
  }
40087
40087
  }
@@ -57514,17 +57514,17 @@ var init_create_aggregated_client = __esm({
57514
57514
  const { paginators = {}, waiters = {} } = options2 ?? {};
57515
57515
  for (const [paginatorName, paginatorFn] of Object.entries(paginators)) {
57516
57516
  if (Client4.prototype[paginatorName] === void 0) {
57517
- Client4.prototype[paginatorName] = function(commandInput = {}, paginationConfiguration, ...rest) {
57517
+ Client4.prototype[paginatorName] = function(commandInput = {}, paginationConfiguration, ...rest2) {
57518
57518
  return paginatorFn({
57519
57519
  ...paginationConfiguration,
57520
57520
  client: this
57521
- }, commandInput, ...rest);
57521
+ }, commandInput, ...rest2);
57522
57522
  };
57523
57523
  }
57524
57524
  }
57525
57525
  for (const [waiterName, waiterFn] of Object.entries(waiters)) {
57526
57526
  if (Client4.prototype[waiterName] === void 0) {
57527
- Client4.prototype[waiterName] = async function(commandInput = {}, waiterConfiguration, ...rest) {
57527
+ Client4.prototype[waiterName] = async function(commandInput = {}, waiterConfiguration, ...rest2) {
57528
57528
  let config = waiterConfiguration;
57529
57529
  if (typeof waiterConfiguration === "number") {
57530
57530
  config = {
@@ -57534,7 +57534,7 @@ var init_create_aggregated_client = __esm({
57534
57534
  return waiterFn({
57535
57535
  ...config,
57536
57536
  client: this
57537
- }, commandInput, ...rest);
57537
+ }, commandInput, ...rest2);
57538
57538
  };
57539
57539
  }
57540
57540
  }
@@ -64739,8 +64739,8 @@ var init_recursionDetectionMiddleware = __esm({
64739
64739
  invokeStore ??= await InvokeStore2.getInstanceAsync();
64740
64740
  const traceIdFromInvokeStore = invokeStore?.getXRayTraceId();
64741
64741
  const traceId = traceIdFromInvokeStore ?? traceIdFromEnv;
64742
- const nonEmptyString = (str2) => typeof str2 === "string" && str2.length > 0;
64743
- if (nonEmptyString(functionName) && nonEmptyString(traceId)) {
64742
+ const nonEmptyString2 = (str2) => typeof str2 === "string" && str2.length > 0;
64743
+ if (nonEmptyString2(functionName) && nonEmptyString2(traceId)) {
64744
64744
  request.headers[X_AMZN_TRACE_ID] = traceId;
64745
64745
  }
64746
64746
  }
@@ -75145,7 +75145,7 @@ var init_httpAuthSchemeProvider7 = __esm({
75145
75145
  }
75146
75146
  const options2 = [];
75147
75147
  for (const scheme of authSchemes) {
75148
- const { name: resolvedName, properties = {}, ...rest } = scheme;
75148
+ const { name: resolvedName, properties = {}, ...rest2 } = scheme;
75149
75149
  const name3 = resolvedName.toLowerCase();
75150
75150
  if (resolvedName !== name3) {
75151
75151
  console.warn(`HttpAuthScheme has been normalized with lowercasing: '${resolvedName}' to '${name3}'`);
@@ -75171,7 +75171,7 @@ var init_httpAuthSchemeProvider7 = __esm({
75171
75171
  }
75172
75172
  const option = createOption(authParameters);
75173
75173
  option.schemeId = schemeId;
75174
- option.signingProperties = { ...option.signingProperties || {}, ...rest, ...properties };
75174
+ option.signingProperties = { ...option.signingProperties || {}, ...rest2, ...properties };
75175
75175
  options2.push(option);
75176
75176
  }
75177
75177
  return options2;
@@ -82550,17 +82550,17 @@ var init_create_aggregated_client2 = __esm({
82550
82550
  const { paginators = {}, waiters = {} } = options2 ?? {};
82551
82551
  for (const [paginatorName, paginatorFn] of Object.entries(paginators)) {
82552
82552
  if (Client4.prototype[paginatorName] === void 0) {
82553
- Client4.prototype[paginatorName] = function(commandInput = {}, paginationConfiguration, ...rest) {
82553
+ Client4.prototype[paginatorName] = function(commandInput = {}, paginationConfiguration, ...rest2) {
82554
82554
  return paginatorFn({
82555
82555
  ...paginationConfiguration,
82556
82556
  client: this
82557
- }, commandInput, ...rest);
82557
+ }, commandInput, ...rest2);
82558
82558
  };
82559
82559
  }
82560
82560
  }
82561
82561
  for (const [waiterName, waiterFn] of Object.entries(waiters)) {
82562
82562
  if (Client4.prototype[waiterName] === void 0) {
82563
- Client4.prototype[waiterName] = async function(commandInput = {}, waiterConfiguration, ...rest) {
82563
+ Client4.prototype[waiterName] = async function(commandInput = {}, waiterConfiguration, ...rest2) {
82564
82564
  let config = waiterConfiguration;
82565
82565
  if (typeof waiterConfiguration === "number") {
82566
82566
  config = {
@@ -82570,7 +82570,7 @@ var init_create_aggregated_client2 = __esm({
82570
82570
  return waiterFn({
82571
82571
  ...config,
82572
82572
  client: this
82573
- }, commandInput, ...rest);
82573
+ }, commandInput, ...rest2);
82574
82574
  };
82575
82575
  }
82576
82576
  }
@@ -92688,14 +92688,14 @@ function listConfigTask(scope) {
92688
92688
  }
92689
92689
  function config_default() {
92690
92690
  return {
92691
- addConfig(key, value, ...rest) {
92691
+ addConfig(key, value, ...rest2) {
92692
92692
  return this._runTask(
92693
92693
  addConfigTask(
92694
92694
  key,
92695
92695
  value,
92696
- rest[0] === true,
92696
+ rest2[0] === true,
92697
92697
  asConfigScope(
92698
- rest[1],
92698
+ rest2[1],
92699
92699
  "local"
92700
92700
  /* local */
92701
92701
  )
@@ -92709,9 +92709,9 @@ function config_default() {
92709
92709
  trailingFunctionArgument(arguments)
92710
92710
  );
92711
92711
  },
92712
- listConfig(...rest) {
92712
+ listConfig(...rest2) {
92713
92713
  return this._runTask(
92714
- listConfigTask(asConfigScope(rest[0], void 0)),
92714
+ listConfigTask(asConfigScope(rest2[0], void 0)),
92715
92715
  trailingFunctionArgument(arguments)
92716
92716
  );
92717
92717
  }
@@ -93473,13 +93473,13 @@ function commitTask(message2, files, customArgs) {
93473
93473
  }
93474
93474
  function commit_default() {
93475
93475
  return {
93476
- commit(message2, ...rest) {
93476
+ commit(message2, ...rest2) {
93477
93477
  const next = trailingFunctionArgument(arguments);
93478
93478
  const task = rejectDeprecatedSignatures(message2) || commitTask(
93479
93479
  asArray(message2),
93480
- asArray(filterType(rest[0], filterStringOrStringArray, [])),
93480
+ asArray(filterType(rest2[0], filterStringOrStringArray, [])),
93481
93481
  [
93482
- ...asStringArray(filterType(rest[1], filterArray, [])),
93482
+ ...asStringArray(filterType(rest2[1], filterArray, [])),
93483
93483
  ...getTrailingOptions(arguments, 0, true)
93484
93484
  ]
93485
93485
  );
@@ -93907,13 +93907,13 @@ function logTask(splitter, fields, customArgs) {
93907
93907
  }
93908
93908
  function log_default() {
93909
93909
  return {
93910
- log(...rest) {
93910
+ log(...rest2) {
93911
93911
  const next = trailingFunctionArgument(arguments);
93912
93912
  const options2 = parseLogOptions(
93913
93913
  trailingOptionsArgument(arguments),
93914
93914
  asStringArray(filterType(arguments[0], filterArray, []))
93915
93915
  );
93916
- const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options2.commands) || createLogTask(options2);
93916
+ const task = rejectDeprecatedSignatures(...rest2) || validateLogFormatConfig(options2.commands) || createLogTask(options2);
93917
93917
  return this._runTask(task, next);
93918
93918
  }
93919
93919
  };
@@ -94688,15 +94688,15 @@ function createCloneTask(api, task, repoPath, ...args) {
94688
94688
  }
94689
94689
  function clone_default() {
94690
94690
  return {
94691
- clone(repo, ...rest) {
94691
+ clone(repo, ...rest2) {
94692
94692
  return this._runTask(
94693
- createCloneTask("clone", cloneTask, filterType(repo, filterString), ...rest),
94693
+ createCloneTask("clone", cloneTask, filterType(repo, filterString), ...rest2),
94694
94694
  trailingFunctionArgument(arguments)
94695
94695
  );
94696
94696
  },
94697
- mirror(repo, ...rest) {
94697
+ mirror(repo, ...rest2) {
94698
94698
  return this._runTask(
94699
- createCloneTask("mirror", cloneMirrorTask, filterType(repo, filterString), ...rest),
94699
+ createCloneTask("mirror", cloneMirrorTask, filterType(repo, filterString), ...rest2),
94700
94700
  trailingFunctionArgument(arguments)
94701
94701
  );
94702
94702
  }
@@ -100524,12 +100524,12 @@ async function unreachableFrom(ctx, gitDir, ids, tips) {
100524
100524
  return unreachable;
100525
100525
  }
100526
100526
  async function pushToGitHub(ctx, request, readSha, signal) {
100527
- const { prerequisiteBranches, readSeen, ...rest } = request;
100527
+ const { prerequisiteBranches, readSeen, ...rest2 } = request;
100528
100528
  for (let restarts = 0; ; restarts++) {
100529
100529
  const sha = await readSha();
100530
100530
  const seen = await readSeen?.();
100531
100531
  const prerequisites = await trackingTips(ctx.remoteGitPath, prerequisiteBranches);
100532
- const ask = { ...rest, sha, ...seen ? { seen } : {}, prerequisites };
100532
+ const ask = { ...rest2, sha, ...seen ? { seen } : {}, prerequisites };
100533
100533
  const first2 = await ctx.github().push(ask, void 0, signal);
100534
100534
  if (first2.kind === "pushed") return { sha, outcome: outcomeOf(first2) };
100535
100535
  const bundle = await startBundle(ctx, request.branch, sha, first2.usable, signal);
@@ -100565,7 +100565,7 @@ async function startBundle(ctx, branch, sha, usable, signal) {
100565
100565
  );
100566
100566
  const chunks = proc.stdout[Symbol.asyncIterator]();
100567
100567
  const reader = new BundleHeaderReader("shorten");
100568
- let unreadable = null;
100568
+ let unreadable2 = null;
100569
100569
  try {
100570
100570
  for (; ; ) {
100571
100571
  const next = await chunks.next();
@@ -100574,7 +100574,7 @@ async function startBundle(ctx, branch, sha, usable, signal) {
100574
100574
  try {
100575
100575
  read = reader.push(next.value);
100576
100576
  } catch (err) {
100577
- unreadable = err;
100577
+ unreadable2 = err;
100578
100578
  break;
100579
100579
  }
100580
100580
  if (read === null) continue;
@@ -100588,9 +100588,9 @@ async function startBundle(ctx, branch, sha, usable, signal) {
100588
100588
  yield bytes;
100589
100589
  if (first2.length > 0) yield first2;
100590
100590
  for (; ; ) {
100591
- const rest = await chunks.next();
100592
- if (rest.done) return;
100593
- yield rest.value;
100591
+ const rest2 = await chunks.next();
100592
+ if (rest2.done) return;
100593
+ yield rest2.value;
100594
100594
  }
100595
100595
  })()
100596
100596
  );
@@ -100599,10 +100599,10 @@ async function startBundle(ctx, branch, sha, usable, signal) {
100599
100599
  } catch (err) {
100600
100600
  throw await causeOf(proc, err, "its header could not be read");
100601
100601
  }
100602
- if (unreadable !== null) {
100602
+ if (unreadable2 !== null) {
100603
100603
  proc.stdout.destroy();
100604
100604
  if (await refusedAsEmpty(proc).catch(() => false)) return "empty";
100605
- throw unreadable;
100605
+ throw unreadable2;
100606
100606
  }
100607
100607
  if (await refusedAsEmpty(proc)) return "empty";
100608
100608
  throw new Error(`git bundle create printed no header for ${branch}`);
@@ -100649,9 +100649,9 @@ async function unbundle(ctx, gitDir, bundleId, signal) {
100649
100649
  (async function* () {
100650
100650
  if (first2.length > 0) yield first2;
100651
100651
  for (; ; ) {
100652
- const rest = await chunks.next();
100653
- if (rest.done) return;
100654
- yield rest.value;
100652
+ const rest2 = await chunks.next();
100653
+ if (rest2.done) return;
100654
+ yield rest2.value;
100655
100655
  }
100656
100656
  })()
100657
100657
  );
@@ -100828,7 +100828,7 @@ init_error();
100828
100828
  init_worker_status();
100829
100829
 
100830
100830
  // ../canopycms/src/version.ts
100831
- var CANOPYCMS_VERSION = "0.13.0";
100831
+ var CANOPYCMS_VERSION = "0.14.0";
100832
100832
 
100833
100833
  // ../canopycms/src/worker/schema-gate.ts
100834
100834
  import fs15 from "node:fs/promises";
@@ -101112,6 +101112,21 @@ var BRANCH_META_FILE = "branch.json";
101112
101112
  var branchMetadataFilePath = (branchRoot) => path17.join(path17.resolve(branchRoot), BRANCH_META_DIR, BRANCH_META_FILE);
101113
101113
  var UNKNOWN_TIME = (/* @__PURE__ */ new Date(0)).toISOString();
101114
101114
  var enumOf = (values) => external_exports.nativeEnum(values);
101115
+ var exclusionSchema = external_exports.object({ by: external_exports.string(), at: external_exports.string(), byAdmin: external_exports.boolean() }).passthrough();
101116
+ var branchAccessSchema = external_exports.object({
101117
+ allowedUsers: external_exports.array(external_exports.string()).optional(),
101118
+ allowedGroups: external_exports.array(external_exports.string()).optional(),
101119
+ managerOrAdminAllowed: external_exports.boolean().optional(),
101120
+ restricted: external_exports.boolean().optional(),
101121
+ excluded: external_exports.record(external_exports.string(), exclusionSchema).optional(),
101122
+ excludedGroups: external_exports.record(external_exports.string(), exclusionSchema).optional(),
101123
+ addBy: enumOf({
101124
+ members: "members",
101125
+ owner: "owner",
101126
+ admins: "admins"
101127
+ }).optional(),
101128
+ entryMeta: external_exports.record(external_exports.string(), external_exports.object({ addedBy: external_exports.string(), addedAt: external_exports.string() }).passthrough()).optional()
101129
+ }).passthrough();
101115
101130
  var branchMetadataShape = {
101116
101131
  name: external_exports.string().min(1),
101117
101132
  title: external_exports.string().optional(),
@@ -101122,11 +101137,7 @@ var branchMetadataShape = {
101122
101137
  approved: "approved",
101123
101138
  archived: "archived"
101124
101139
  }),
101125
- access: external_exports.object({
101126
- allowedUsers: external_exports.array(external_exports.string()).optional(),
101127
- allowedGroups: external_exports.array(external_exports.string()).optional(),
101128
- managerOrAdminAllowed: external_exports.boolean().optional()
101129
- }).passthrough(),
101140
+ access: branchAccessSchema,
101130
101141
  createdBy: external_exports.string().default("unknown"),
101131
101142
  createdAt: external_exports.string().default(UNKNOWN_TIME),
101132
101143
  updatedAt: external_exports.string().default(UNKNOWN_TIME),
@@ -101235,6 +101246,17 @@ function parseBranchMetadataFile(branchRoot, raw) {
101235
101246
  const file = result.data;
101236
101247
  return file;
101237
101248
  }
101249
+ var unreadable = Symbol("unreadable");
101250
+ var nonEmptyString = external_exports.string().min(1).optional();
101251
+ var {
101252
+ name: _name,
101253
+ access: _access,
101254
+ createdAt: _createdAt,
101255
+ updatedAt: _updatedAt,
101256
+ ...rest
101257
+ } = branchMetadataShape;
101258
+ var salvagedFieldShape = { ...rest, createdBy: nonEmptyString, baseBranch: nonEmptyString };
101259
+ var salvagedFieldsSchema = external_exports.object(salvagedFieldShape).partial().strip();
101238
101260
 
101239
101261
  // ../canopycms/src/branch-registry.ts
101240
101262
  init_error();
@@ -101557,7 +101579,7 @@ async function withOccRetry(operation3, options2) {
101557
101579
  }
101558
101580
  throw new Error("Unreachable");
101559
101581
  }
101560
- async function withOccFileLock(filePath, fn) {
101582
+ async function withOccFileLock(filePath, fn, options2) {
101561
101583
  try {
101562
101584
  await fs18.mkdir(path19.dirname(filePath));
101563
101585
  } catch (err) {
@@ -101565,7 +101587,7 @@ async function withOccFileLock(filePath, fn) {
101565
101587
  throw new OccWriteConflictError(`Could not acquire file lock: ${getErrorMessage(err)}`);
101566
101588
  }
101567
101589
  }
101568
- const MAX_ATTEMPTS = 14;
101590
+ const MAX_ATTEMPTS = options2?.tryOnce ? 1 : 14;
101569
101591
  let release2 = null;
101570
101592
  for (let attempt = 1; release2 === null; attempt++) {
101571
101593
  try {
@@ -101811,7 +101833,7 @@ function mergeBranchMetadata(existing, version2, incoming, now = (/* @__PURE__ *
101811
101833
  },
101812
101834
  // Immutable after creation
101813
101835
  createdBy: existing?.branch.createdBy ?? incoming.branch?.createdBy ?? defaults.createdBy,
101814
- createdAt: existing?.branch.createdAt ?? defaults.createdAt,
101836
+ createdAt: existing?.branch.createdAt ?? incoming.createdAt ?? defaults.createdAt,
101815
101837
  // Fork point is recorded once at creation; later saves must not move it
101816
101838
  baseBranch: existing?.branch.baseBranch ?? incoming.branch?.baseBranch,
101817
101839
  // Always stamped fresh; the spreads above would otherwise let the creation-time value win
@@ -115148,9 +115170,9 @@ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowMod
115148
115170
  } else if (allowTrailingComma && this.afterTrailingComma(close)) {
115149
115171
  break;
115150
115172
  } else if (this.type === types$1.ellipsis) {
115151
- var rest = this.parseRestBinding();
115152
- this.parseBindingListItem(rest);
115153
- elts.push(rest);
115173
+ var rest2 = this.parseRestBinding();
115174
+ this.parseBindingListItem(rest2);
115175
+ elts.push(rest2);
115154
115176
  if (this.type === types$1.comma) {
115155
115177
  this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
115156
115178
  }
@@ -119096,11 +119118,11 @@ function relativeToPoint(stops, relative) {
119096
119118
  return void 0;
119097
119119
  }
119098
119120
  const [stopRelative, stopAbsolute] = stops[index2 - 1];
119099
- const rest = relative - stopRelative;
119121
+ const rest2 = relative - stopRelative;
119100
119122
  return {
119101
119123
  line: stopAbsolute.line,
119102
- column: stopAbsolute.column + rest,
119103
- offset: stopAbsolute.offset + rest
119124
+ column: stopAbsolute.column + rest2,
119125
+ offset: stopAbsolute.offset + rest2
119104
119126
  };
119105
119127
  }
119106
119128
  function serializeChunks2(chunks) {
@@ -122216,8 +122238,8 @@ function mergeOrder(ancestorIds, baseIds, branchIds) {
122216
122238
  // ../canopycms/src/merge/text-merge.ts
122217
122239
  var split = (text4) => {
122218
122240
  const endBreak = text4.endsWith("\n");
122219
- const rest = endBreak ? text4.slice(0, -1) : text4;
122220
- return { lines: rest === "" && !endBreak ? [] : rest.split("\n"), endBreak };
122241
+ const rest2 = endBreak ? text4.slice(0, -1) : text4;
122242
+ return { lines: rest2 === "" && !endBreak ? [] : rest2.split("\n"), endBreak };
122221
122243
  };
122222
122244
  var sameLines = (x6, y3) => x6.length === y3.length && x6.every((line, i10) => line === y3[i10]);
122223
122245
  function mergeText(ancestor, base, branch) {
@@ -122420,13 +122442,13 @@ function insertedByBoth(aPart, aTokens, bPart, bTokens) {
122420
122442
  if (isSubsequence(bTokens, aTokens)) return [...aPart];
122421
122443
  const fromBase = /* @__PURE__ */ new Map();
122422
122444
  for (const token of aTokens) fromBase.set(token, (fromBase.get(token) ?? 0) + 1);
122423
- const rest = bPart.filter((_3, n7) => {
122445
+ const rest2 = bPart.filter((_3, n7) => {
122424
122446
  const left = fromBase.get(bTokens[n7]) ?? 0;
122425
122447
  if (left === 0) return true;
122426
122448
  fromBase.set(bTokens[n7], left - 1);
122427
122449
  return false;
122428
122450
  });
122429
- return [...aPart, ...rest];
122451
+ return [...aPart, ...rest2];
122430
122452
  }
122431
122453
  function mergeRecord(o8, a9, b10, at2, walk2) {
122432
122454
  const ancestor = isPlainRecord(o8) ? o8 : {};
@@ -122803,7 +122825,7 @@ function named(conflicts2, fields, read, sides) {
122803
122825
  const out = [];
122804
122826
  const asRead = (side) => fields && isPlainRecord(side) ? entryAsRead(fields, side) : side;
122805
122827
  const reads = { o: asRead(sides.o), a: asRead(sides.a), b: asRead(sides.b) };
122806
- for (const { at: at2, places, placeTrail, trail: trail2, ...rest } of conflicts2) {
122828
+ for (const { at: at2, places, placeTrail, trail: trail2, ...rest2 } of conflicts2) {
122807
122829
  const { key, dataPath, depth } = describePath(fields, read, at2);
122808
122830
  if (seen.has(key)) continue;
122809
122831
  seen.add(key);
@@ -122817,7 +122839,7 @@ function named(conflicts2, fields, read, sides) {
122817
122839
  const sidePath = (side) => {
122818
122840
  const place = placeOf(side);
122819
122841
  if (place) return describe(side, place);
122820
- const list5 = depth === at2.length && rest.item ? placeTrail?.[at2.length - 2]?.[side] : void 0;
122842
+ const list5 = depth === at2.length && rest2.item ? placeTrail?.[at2.length - 2]?.[side] : void 0;
122821
122843
  const holder = list5 && describe(side, list5);
122822
122844
  const missing = dataPath.at(-1);
122823
122845
  return holder && missing && "item" in missing ? holder : void 0;
@@ -122829,7 +122851,7 @@ function named(conflicts2, fields, read, sides) {
122829
122851
  ...branch && { branch }
122830
122852
  };
122831
122853
  if (depth === at2.length) {
122832
- out.push({ key, dataPath, sidePaths, ...rest });
122854
+ out.push({ key, dataPath, sidePaths, ...rest2 });
122833
122855
  continue;
122834
122856
  }
122835
122857
  const whole = trail2?.[depth - 1] ?? (byName ? { o: valueAt(sides.o, prefix), a: valueAt(sides.a, prefix), b: valueAt(sides.b, prefix) } : void 0);
@@ -123704,9 +123726,9 @@ function keptVersions(kept, stages, contentRoot, named2) {
123704
123726
  return found;
123705
123727
  }
123706
123728
  async function commitMerge(git, plan, { head, other, message: message2 }) {
123707
- const { tree, gitTree: _gitTree, kind: _kind, ...rest } = plan;
123729
+ const { tree, gitTree: _gitTree, kind: _kind, ...rest2 } = plan;
123708
123730
  const sha = (await git.raw(["commit-tree", "-p", head, "-p", other, "-m", message2, "--end-of-options", tree])).trim();
123709
- return { kind: "built", sha, ...rest };
123731
+ return { kind: "built", sha, ...rest2 };
123710
123732
  }
123711
123733
  var mergesAsGitDoes = (plan) => plan.kind === "planned" && plan.asGitDoes;
123712
123734
  async function isCleanMergeOf(git, merged, from, other, contentRoot) {
@@ -123872,6 +123894,7 @@ async function decidePublish(git, { head, published }) {
123872
123894
  var COMMIT_ID2 = /^[0-9a-f]{40}([0-9a-f]{24})?$/;
123873
123895
  var MAX_LISTED_PATH_LENGTH = 200;
123874
123896
  var REWRITTEN_PUSH_REFUSAL = "This branch was changed on GitHub in a way CanopyCMS can't combine with the work here, so nothing was pushed. Nothing is lost.";
123897
+ var refusesPushAsRewritten = (branch) => branch.rewrittenOnGitHub !== void 0;
123875
123898
  var SEEN_COMMIT_GONE_PUSH_REFUSAL = "A commit this branch had on GitHub is no longer there, so nothing was pushed. Nothing is lost.";
123876
123899
  function rewriteCleared(branch) {
123877
123900
  const reason = branch.syncFailureReason;
@@ -123908,7 +123931,7 @@ async function bringInGitHubCommits(ctx, args) {
123908
123931
  const { branch } = metaFile;
123909
123932
  if (branch.name !== branchRef) return { kind: "in-step" };
123910
123933
  const gitHubTip = args.gitHub?.tips.get(branchRef);
123911
- if (args.gitHub !== void 0 && gitHubTip === void 0 && branch.rewrittenOnGitHub) {
123934
+ if (args.gitHub !== void 0 && gitHubTip === void 0 && refusesPushAsRewritten(branch)) {
123912
123935
  await clearRewritten(ctx, args);
123913
123936
  }
123914
123937
  if (!isPublished(metaFile)) return { kind: "in-step" };
@@ -123987,19 +124010,19 @@ async function pushedSinceFetch({ branchPath }, fetchedAt) {
123987
124010
  return pushedAt !== void 0 && Date.parse(pushedAt) >= fetchedAt;
123988
124011
  }
123989
124012
  async function rewrittenFrom({ git, metaFile }, tip, head, published) {
123990
- const { lastGitHubTip, historyRewrittenFrom } = metaFile.branch;
124013
+ const { lastGitHubTip, historyRewrittenFrom, rewrittenOnGitHub } = metaFile.branch;
123991
124014
  const unrecorded = lastGitHubTip === void 0 && published !== null && published !== head && await contains(git, published, head) && !await contains(git, published, tip) ? published : void 0;
123992
- const known = [historyRewrittenFrom, lastGitHubTip ?? unrecorded].filter(
124015
+ const known = [historyRewrittenFrom, lastGitHubTip ?? unrecorded, rewrittenOnGitHub].filter(
123993
124016
  (sha) => sha !== void 0 && COMMIT_ID2.test(sha)
123994
124017
  );
123995
- if (known.length === 0) return null;
124018
+ if (known.length === 0 && rewrittenOnGitHub === void 0) return null;
123996
124019
  if (await contains(git, tip, head) && (published === null || await contains(git, tip, published))) {
123997
124020
  return null;
123998
124021
  }
123999
124022
  for (const sha of known) if (await contains(git, tip, sha)) return null;
124000
124023
  const walked = await git.raw(["rev-list", "--count", "--end-of-options", tip]);
124001
124024
  if (walked.trim() === "") throw new Error(`No answer reading the history of ${tip}`);
124002
- return known[0];
124025
+ return known[0] ?? rewrittenOnGitHub ?? null;
124003
124026
  }
124004
124027
  async function blockAsRewritten(ctx, { branchPath, branchRef, metaFile }, lastSeen) {
124005
124028
  if (metaFile.branch.rewrittenOnGitHub !== lastSeen) {
@@ -124010,7 +124033,7 @@ async function blockAsRewritten(ctx, { branchPath, branchRef, metaFile }, lastSe
124010
124033
  }
124011
124034
  return {
124012
124035
  kind: "blocked",
124013
- reason: `GitHub's ${branchRef} no longer contains ${lastSeen}, the last commit this deployment saw there: it was force-pushed or rewritten. Nothing was merged or pushed, so the rewrite stands, and this branch's changes cannot reach GitHub. To continue, a developer merges that commit back into the branch on GitHub.`
124036
+ reason: COMMIT_ID2.test(lastSeen) ? `GitHub's ${branchRef} no longer contains ${lastSeen}, the last commit this deployment saw there: it was force-pushed or rewritten. Nothing was merged or pushed, so the rewrite stands, and this branch's changes cannot reach GitHub. To continue, a developer merges that commit back into the branch on GitHub.` : `CanopyCMS can't confirm that GitHub's ${branchRef} holds this branch's commits, as its record of that branch was lost, so nothing was merged or pushed. To continue, a developer merges this branch's commits into the branch on GitHub. If they exist only here, delete the branch on GitHub instead: with no pull request recorded, the next sync clears this; with one, withdraw the branch once CanopyCMS has seen that pull request closed. A branch being edited with a pull request still recorded needs an admin to remove rewrittenOnGitHub from its branch.json by hand.`
124014
124037
  };
124015
124038
  }
124016
124039
  async function clearRewritten(ctx, { branchPath, branchRef }) {
@@ -124314,8 +124337,8 @@ async function landed(ctx, {
124314
124337
  await noteKeptOverGitHub(ctx, { branchPath, branchRef, metaFile }, landing.keptOverGitHub ?? []);
124315
124338
  await store.update((now) => {
124316
124339
  if (now?.landing?.mergeSha !== sha) return null;
124317
- const { landing: _done, ...rest } = now;
124318
- return rest;
124340
+ const { landing: _done, ...rest2 } = now;
124341
+ return rest2;
124319
124342
  });
124320
124343
  }
124321
124344
  async function noteKeptOverGitHub(ctx, {
@@ -124432,12 +124455,12 @@ async function reconcileMergeConflicts(ctx, {
124432
124455
  const entries = (await store.update((now) => {
124433
124456
  if (now === null) return null;
124434
124457
  const kept = withoutMergesGone(now.entries, held);
124435
- const { landing, ...rest } = now;
124458
+ const { landing, ...rest2 } = now;
124436
124459
  const stays = landing !== void 0 && (branchRef === null || held(landing.mergeSha));
124437
124460
  if (JSON.stringify(kept) === JSON.stringify(now.entries) && (stays || !landing)) {
124438
124461
  return null;
124439
124462
  }
124440
- return { ...rest, entries: kept, ...stays && { landing } };
124463
+ return { ...rest2, entries: kept, ...stays && { landing } };
124441
124464
  }))?.entries ?? current2.entries;
124442
124465
  await followRecord(ctx, branchPath, branchDir, branchRef, entries);
124443
124466
  await applyRemaps(
@@ -124722,14 +124745,14 @@ async function executeTask(ctx, task, signal) {
124722
124745
  const deletedPr = typeof payload3.pullRequestNumber === "number" ? payload3.pullRequestNumber : void 0;
124723
124746
  const deletedPushedAt = typeof payload3.pushedToGitHubAt === "string" ? payload3.pushedToGitHubAt : void 0;
124724
124747
  let live = null;
124725
- let unreadable = false;
124748
+ let unreadable2 = false;
124726
124749
  try {
124727
124750
  live = await BranchMetadataFileManager.loadOnly(ctx.branchWorkspacePath(branch));
124728
124751
  } catch (err) {
124729
124752
  if (!(err instanceof BranchMetadataCorruptError)) throw err;
124730
- unreadable = true;
124753
+ unreadable2 = true;
124731
124754
  }
124732
- if (unreadable) {
124755
+ if (unreadable2) {
124733
124756
  workerLog(
124734
124757
  `Not deleting GitHub branch ${branch}: the branch now under that name is unreadable`
124735
124758
  );
@@ -124970,9 +124993,9 @@ async function pushBranchToGitHub(ctx, branch, signal) {
124970
124993
  });
124971
124994
  const metaFile = await readMetadata();
124972
124995
  const marker = metaFile?.branch.historyRewrittenFrom;
124973
- if (metaFile?.branch.rewrittenOnGitHub !== void 0) {
124996
+ if (metaFile && refusesPushAsRewritten(metaFile.branch)) {
124974
124997
  workerLogWarn(
124975
- `Not pushing ${branch}: GitHub's branch no longer contains ${metaFile.branch.rewrittenOnGitHub}`
124998
+ `Not pushing ${branch}: GitHub's branch no longer contains ${metaFile.branch.rewrittenOnGitHub || "a commit it held"}`
124976
124999
  );
124977
125000
  throw new PermanentTaskError(REWRITTEN_PUSH_REFUSAL);
124978
125001
  }
@@ -126569,10 +126592,10 @@ async function conflictsStatusOf(branchRoot) {
126569
126592
  }
126570
126593
  async function setConflictsStatuses(ctx, githubTips) {
126571
126594
  let due;
126572
- let unreadable;
126595
+ let unreadable2;
126573
126596
  try {
126574
126597
  ;
126575
- ({ due, unreadable } = await dueStatuses(ctx, githubTips));
126598
+ ({ due, unreadable: unreadable2 } = await dueStatuses(ctx, githubTips));
126576
126599
  } catch (err) {
126577
126600
  workerLogWarn(
126578
126601
  `Could not read the branches' conflicts for their status: ${getErrorMessage(err)}`
@@ -126614,8 +126637,8 @@ async function setConflictsStatuses(ctx, githubTips) {
126614
126637
  }
126615
126638
  }
126616
126639
  }
126617
- for (const u5 of unreadable) failed.push(u5.branch);
126618
- failure ??= unreadable[0] && { reason: "other", message: unreadable[0].message };
126640
+ for (const u5 of unreadable2) failed.push(u5.branch);
126641
+ failure ??= unreadable2[0] && { reason: "other", message: unreadable2[0].message };
126619
126642
  if (!failure) return void 0;
126620
126643
  return {
126621
126644
  ...failure,
@@ -126638,11 +126661,11 @@ async function dueStatuses(ctx, githubTips) {
126638
126661
  }
126639
126662
  const set = ctx.conflictsStatusesSet();
126640
126663
  const due = [];
126641
- const unreadable = [];
126664
+ const unreadable2 = [];
126642
126665
  const cannotRead = (branch, err) => {
126643
126666
  const message2 = sanitizeErrorMessage(getErrorMessage(err));
126644
126667
  workerLogWarn(`Could not read ${escapeForLog(branch)} for its conflicts status: ${message2}`);
126645
- unreadable.push({ branch, message: message2 });
126668
+ unreadable2.push({ branch, message: message2 });
126646
126669
  };
126647
126670
  for (const entry of entries.sort((a9, b10) => a9.name.localeCompare(b10.name))) {
126648
126671
  const dir = entry.name;
@@ -126682,7 +126705,7 @@ async function dueStatuses(ctx, githubTips) {
126682
126705
  const key = JSON.stringify(status);
126683
126706
  if (set.get(branch.name) !== key) due.push({ branch: branch.name, status, key });
126684
126707
  }
126685
- return { due, unreadable };
126708
+ return { due, unreadable: unreadable2 };
126686
126709
  }
126687
126710
 
126688
126711
  // ../canopycms/src/worker/git-sync.ts
@@ -130685,7 +130708,7 @@ var _MachineTokenVerificationError = class _MachineTokenVerificationError2 exten
130685
130708
  this.action = action;
130686
130709
  }
130687
130710
  // Keep message unformatted, matching ClerkAPIResponseError's approach
130688
- static formatMessage(_name, msg, _code, _docsUrl) {
130711
+ static formatMessage(_name2, msg, _code, _docsUrl) {
130689
130712
  return msg;
130690
130713
  }
130691
130714
  getFullMessage() {
@@ -131780,8 +131803,8 @@ var require_dist5 = __commonJS3({
131780
131803
  }
131781
131804
  return cookieStrings.join("; ");
131782
131805
  }
131783
- function stringifySetCookie(_name, _val, _opts) {
131784
- const cookie = typeof _name === "object" ? _name : { ..._opts, name: _name, value: String(_val) };
131806
+ function stringifySetCookie(_name2, _val, _opts) {
131807
+ const cookie = typeof _name2 === "object" ? _name2 : { ..._opts, name: _name2, value: String(_val) };
131785
131808
  const options2 = typeof _val === "object" ? _val : _opts;
131786
131809
  const enc = options2?.encode || encodeURIComponent;
131787
131810
  if (!cookieNameRegExp.test(cookie.name)) {
@@ -133714,9 +133737,9 @@ var OrganizationAPI = class extends AbstractAPI {
133714
133737
  */
133715
133738
  async updateOrganization(organizationId, params) {
133716
133739
  this.requireId(organizationId);
133717
- const { publicMetadata, privateMetadata, ...rest } = params;
133740
+ const { publicMetadata, privateMetadata, ...rest2 } = params;
133718
133741
  const hasMetadata = publicMetadata !== void 0 || privateMetadata !== void 0;
133719
- const hasRest = Object.keys(rest).length > 0;
133742
+ const hasRest = Object.keys(rest2).length > 0;
133720
133743
  if (hasMetadata) {
133721
133744
  deprecated(
133722
133745
  "updateOrganization(organizationId, { publicMetadata | privateMetadata })",
@@ -133727,14 +133750,14 @@ var OrganizationAPI = class extends AbstractAPI {
133727
133750
  return this.request({
133728
133751
  method: "PATCH",
133729
133752
  path: joinPaths(basePath20, organizationId),
133730
- bodyParams: rest
133753
+ bodyParams: rest2
133731
133754
  });
133732
133755
  }
133733
133756
  if (hasRest) {
133734
133757
  await this.request({
133735
133758
  method: "PATCH",
133736
133759
  path: joinPaths(basePath20, organizationId),
133737
- bodyParams: rest
133760
+ bodyParams: rest2
133738
133761
  });
133739
133762
  }
133740
133763
  return this.request({
@@ -134632,9 +134655,9 @@ var UserAPI = class extends AbstractAPI {
134632
134655
  */
134633
134656
  async updateUser(userId, params = {}) {
134634
134657
  this.requireId(userId);
134635
- const { publicMetadata, privateMetadata, unsafeMetadata, ...rest } = params;
134658
+ const { publicMetadata, privateMetadata, unsafeMetadata, ...rest2 } = params;
134636
134659
  const hasMetadata = publicMetadata !== void 0 || privateMetadata !== void 0 || unsafeMetadata !== void 0;
134637
- const hasRest = Object.keys(rest).length > 0;
134660
+ const hasRest = Object.keys(rest2).length > 0;
134638
134661
  if (hasMetadata) {
134639
134662
  deprecated(
134640
134663
  "updateUser(userId, { publicMetadata | privateMetadata | unsafeMetadata })",
@@ -134645,14 +134668,14 @@ var UserAPI = class extends AbstractAPI {
134645
134668
  return this.request({
134646
134669
  method: "PATCH",
134647
134670
  path: joinPaths(basePath33, userId),
134648
- bodyParams: rest
134671
+ bodyParams: rest2
134649
134672
  });
134650
134673
  }
134651
134674
  if (hasRest) {
134652
134675
  await this.request({
134653
134676
  method: "PATCH",
134654
134677
  path: joinPaths(basePath33, userId),
134655
- bodyParams: rest
134678
+ bodyParams: rest2
134656
134679
  });
134657
134680
  }
134658
134681
  return this.request({
@@ -139121,14 +139144,14 @@ var TelemetryEventThrottler = class {
139121
139144
  * This ensures that payloads with identical content in different orders produce the same key.
139122
139145
  */
139123
139146
  #generateKey(event) {
139124
- const { sk: _sk, pk: _pk, payload: payload3, ...rest } = event;
139147
+ const { sk: _sk, pk: _pk, payload: payload3, ...rest2 } = event;
139125
139148
  const sanitizedEvent = {
139126
139149
  ...payload3,
139127
- ...rest
139150
+ ...rest2
139128
139151
  };
139129
139152
  return JSON.stringify(Object.keys({
139130
139153
  ...payload3,
139131
- ...rest
139154
+ ...rest2
139132
139155
  }).sort().map((key) => sanitizedEvent[key]));
139133
139156
  }
139134
139157
  };
@@ -139446,11 +139469,17 @@ function clerkDisplayName(user) {
139446
139469
  }
139447
139470
  return void 0;
139448
139471
  }
139472
+ function snakeCasePrimaryEmail(user) {
139473
+ const addresses = user.email_addresses ?? [];
139474
+ const primaryId = user.primary_email_address_id;
139475
+ if (!primaryId) return addresses[0]?.email_address;
139476
+ return addresses.find((address) => address.id === primaryId)?.email_address;
139477
+ }
139449
139478
  function toUserSearchResult(user) {
139450
139479
  return {
139451
139480
  id: user.id,
139452
139481
  name: clerkDisplayName(user) ?? "",
139453
- email: user.primaryEmailAddress?.emailAddress ?? user.email_addresses?.[0]?.email_address ?? "",
139482
+ email: user.primaryEmailAddress?.emailAddress ?? snakeCasePrimaryEmail(user) ?? "",
139454
139483
  avatarUrl: user.imageUrl ?? user.image_url ?? void 0
139455
139484
  };
139456
139485
  }
@@ -1 +1 @@
1
- 16cbef2a1f1652a7f24816fcace83277f60f42dc08ff5025e0ce031c22ddb69f index.js
1
+ a9fb763c70bf927c6ef390bd72a7c1b7952e85f2e2b1e92c0b1c425407b9b674 index.js