@usesocial/cli 0.18.3 → 0.18.4

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/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from "node:module";
3
3
  import * as fs from "node:fs";
4
- import { createReadStream, existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
5
- import { basename, delimiter, dirname, extname, join, resolve } from "node:path";
4
+ import { constants, existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
5
+ import { basename, delimiter, dirname, extname, isAbsolute, join, resolve } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { homedir } from "node:os";
8
8
  import { parseArgs, styleText } from "node:util";
9
- import { chmod, lstat, mkdir, readFile, readdir, readlink, rm, writeFile } from "node:fs/promises";
9
+ import { chmod, lstat, mkdir, open, readFile, readdir, readlink, rm, writeFile } from "node:fs/promises";
10
10
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
11
11
  import { createHash } from "node:crypto";
12
- import { dirname as dirname$1, isAbsolute, posix, relative, sep } from "path";
12
+ import { dirname as dirname$1, isAbsolute as isAbsolute$1, posix, relative, sep } from "path";
13
13
  import * as l from "node:readline";
14
14
  import l__default, { createInterface } from "node:readline";
15
15
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -40,7 +40,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
40
40
  }) : target, mod));
41
41
  var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
42
42
  //#endregion
43
- //#region ../../node_modules/.bun/better-result@2.10.0/node_modules/better-result/dist/index.mjs
43
+ //#region ../../node_modules/.bun/better-result@3.0.0/node_modules/better-result/dist/index.mjs
44
44
  function e(e, t) {
45
45
  return e === 2 ? ((...e) => e.length >= 2 ? t(e[0], e[1]) : (n) => t(n, e[0])) : e === 3 ? ((...e) => e.length >= 3 ? t(e[0], e[1], e[2]) : (n) => t(n, e[0], e[1])) : e === 4 ? ((...e) => e.length >= 4 ? t(e[0], e[1], e[2], e[3]) : (n) => t(n, e[0], e[1], e[2])) : ((...n) => n.length >= e ? t(...n) : (e) => t(e, ...n));
46
46
  }
@@ -227,12 +227,9 @@ const p = (e) => e instanceof Error ? {
227
227
  stack: e.stack
228
228
  } : e;
229
229
  const m$1 = (e) => e instanceof Error && `_tag` in e && typeof e._tag == `string` && `toJSON` in e && typeof e.toJSON == `function`;
230
- const h = Object.assign((e) => () => {
230
+ const h = (e) => {
231
231
  class t extends Error {
232
232
  _tag = e;
233
- static is(e) {
234
- return e instanceof t;
235
- }
236
233
  constructor(t) {
237
234
  let n = t && `message` in t && typeof t.message == `string` ? t.message : void 0, r = t && `cause` in t ? t.cause : void 0;
238
235
  if (super(n, r === void 0 ? void 0 : { cause: r }), t && Object.assign(this, t), Object.setPrototypeOf(this, new.target.prototype), this.name = e, r instanceof Error && r.stack) {
@@ -251,13 +248,28 @@ const h = Object.assign((e) => () => {
251
248
  stack: this.stack
252
249
  };
253
250
  }
251
+ match(e) {
252
+ return g(this, e);
253
+ }
254
254
  *[Symbol.iterator]() {
255
255
  return yield* d(this), i$1(`Unreachable: Err yielded in TaggedError but generator continued`, this);
256
256
  }
257
+ static is(e) {
258
+ return e instanceof this;
259
+ }
257
260
  }
258
261
  return t;
259
- }, { is: m$1 });
260
- var y = class extends h(`UnhandledException`)() {
262
+ };
263
+ h.is = m$1;
264
+ const g = e(2, (e, t) => {
265
+ let n = t[e._tag];
266
+ try {
267
+ return n(e);
268
+ } catch (e) {
269
+ return i$1(`matchError handler threw`, e);
270
+ }
271
+ });
272
+ var x = class extends h(`UnhandledException`) {
261
273
  constructor(e) {
262
274
  let t = e.cause instanceof Error ? `Unhandled exception: ${e.cause.message}` : `Unhandled exception: ${String(e.cause)}`;
263
275
  super({
@@ -266,27 +278,37 @@ var y = class extends h(`UnhandledException`)() {
266
278
  });
267
279
  }
268
280
  };
269
- var b = class extends h(`ResultDeserializationError`)() {
281
+ var S = class extends h(`ResultDeserializationError`) {
270
282
  constructor(e) {
271
283
  super({
272
- message: `Failed to deserialize value as Result: expected { status: "ok", value } or { status: "error", error }`,
273
- value: e.value
284
+ message: e.issues ? `Failed to deserialize Result payload` : `Failed to deserialize value as Result: expected { status: "ok", value } or { status: "error", error }`,
285
+ value: e.value,
286
+ issues: e.issues
274
287
  });
275
288
  }
276
289
  };
277
- const x = (e, t) => {
290
+ var C$1 = class extends h(`ResultSerializationError`) {
291
+ constructor(e) {
292
+ super({
293
+ message: `Failed to serialize Result payload`,
294
+ value: e.value,
295
+ issues: e.issues
296
+ });
297
+ }
298
+ };
299
+ const w = (e, t) => {
278
300
  try {
279
301
  return e();
280
302
  } catch (e) {
281
303
  throw i$1(t, e);
282
304
  }
283
305
  };
284
- const S = (e, t) => {
306
+ const T = (e, t) => {
285
307
  let n = (t) => {
286
308
  if (typeof e == `function`) try {
287
309
  return l$1(e(t));
288
310
  } catch (e) {
289
- return d(new y({ cause: e }));
311
+ return d(new x({ cause: e }));
290
312
  }
291
313
  try {
292
314
  return l$1(e.try(t));
@@ -301,12 +323,12 @@ const S = (e, t) => {
301
323
  for (let e = 0; e < r && o.status === `error`; e++) a++, o = n({ attempt: a });
302
324
  return o;
303
325
  };
304
- const C$1 = async (e, t) => {
326
+ const E = async (e, t) => {
305
327
  let n = async (t) => {
306
328
  if (typeof e == `function`) try {
307
329
  return l$1(await e(t));
308
330
  } catch (e) {
309
- return d(new y({ cause: e }));
331
+ return d(new x({ cause: e }));
310
332
  }
311
333
  try {
312
334
  return l$1(await e.try(t));
@@ -318,28 +340,59 @@ const C$1 = async (e, t) => {
318
340
  }
319
341
  }
320
342
  }, r = t?.retry;
321
- if (!r) return n({ attempt: 1 });
322
- let a = (e) => {
323
- switch (r.backoff) {
324
- case `constant`: return r.delayMs;
325
- case `linear`: return r.delayMs * (e + 1);
326
- case `exponential`: return r.delayMs * 2 ** e;
327
- }
328
- }, o = (e) => new Promise((t) => setTimeout(t, e)), s = 1, c = await n({ attempt: s }), u = r.shouldRetry ?? (() => !0);
329
- for (let e = 0; e < r.times && c.status === `error`; e++) {
330
- let t = c.error;
331
- if (!x(() => u(t), `shouldRetry predicate threw`)) break;
332
- await o(a(e)), s++, c = await n({ attempt: s });
333
- }
334
- return c;
335
- };
336
- const w = e(2, (e, t) => e.map(t));
337
- const T = e(2, (e, t) => e.mapError(t));
338
- const E = e(2, (e, t) => e.tryRecover(t));
339
- const D = e(2, (e, t) => e.andThen(t));
340
- const O = e(2, (e, t) => e.tryRecoverAsync(t));
341
- const k = e(2, (e, t) => e.andThenAsync(t));
342
- const A = e(2, (e, t) => e.match(t));
343
+ if (!r) return n({
344
+ attempt: 1,
345
+ signal: t?.signal
346
+ });
347
+ let a = (e, t, n) => {
348
+ switch (t) {
349
+ case `constant`: return e;
350
+ case `linear`: return e * (n + 1);
351
+ case `exponential`: return e * 2 ** n;
352
+ }
353
+ }, o = r.jitter ?? !1;
354
+ if (typeof o == `number` && (!Number.isFinite(o) || o < 0 || o > 1)) throw i$1(`Result.tryPromise retry jitter must be a finite number between 0 and 1`);
355
+ let s = o === !0 ? 1 : o === !1 ? 0 : o, c = (e) => s === 0 ? e : e * (1 - s + Math.random() * s), u = (e, t) => new Promise((n) => {
356
+ if (t?.aborted) {
357
+ n(!1);
358
+ return;
359
+ }
360
+ let r = () => {
361
+ clearTimeout(i), n(!1);
362
+ }, i = setTimeout(() => {
363
+ t?.removeEventListener(`abort`, r), n(!0);
364
+ }, e);
365
+ t?.addEventListener(`abort`, r, { once: !0 });
366
+ }), f = {
367
+ attempt: 1,
368
+ signal: t.signal
369
+ }, p = await n(f), m = r.shouldRetry ?? (() => !0);
370
+ for (let e = 0; e < r.times && !(p.status !== `error` || f.signal?.aborted); e++) {
371
+ let o = p.error;
372
+ if (!w(() => m(o, f), `shouldRetry predicate threw`)) break;
373
+ let s;
374
+ if (typeof r.delayMs == `function`) {
375
+ let e = r.delayMs;
376
+ s = w(() => e(o, f), `Result.tryPromise delayMs callback threw`);
377
+ } else {
378
+ if (r.backoff === void 0) throw i$1(`Result.tryPromise static retry delay requires backoff`);
379
+ s = c(a(r.delayMs, r.backoff, e));
380
+ }
381
+ if (!await u(s, f.signal) || f.signal?.aborted) break;
382
+ f = {
383
+ attempt: f.attempt + 1,
384
+ signal: t.signal
385
+ }, p = await n(f);
386
+ }
387
+ return p;
388
+ };
389
+ const D = e(2, (e, t) => e.map(t));
390
+ const O = e(2, (e, t) => e.mapError(t));
391
+ const k = e(2, (e, t) => e.tryRecover(t));
392
+ const A = e(2, (e, t) => e.andThen(t));
393
+ const ee = e(2, (e, t) => e.tryRecoverAsync(t));
394
+ const te = e(2, (e, t) => e.andThenAsync(t));
395
+ const ne = e(2, (e, t) => e.match(t));
343
396
  const j = e(2, (e, t) => e.tap(t));
344
397
  const M = e(2, (e, t) => e.tapAsync(t));
345
398
  const N = e(2, (e, t) => e.tapError(t));
@@ -384,30 +437,101 @@ async function* V$1(e) {
384
437
  return yield* await e;
385
438
  }
386
439
  function H(e) {
387
- return typeof e == `object` && !!e && `status` in e && (e.status === `ok` && `value` in e || e.status === `error` && `error` in e);
388
- }
389
- const U = (e) => e.status === `ok` ? {
390
- status: `ok`,
391
- value: e.value
392
- } : {
393
- status: `error`,
394
- error: e.error
440
+ return typeof e == `object` && !!e && `status` in e && (e.status === `ok` || e.status === `error`);
441
+ }
442
+ const U = (e) => typeof e == `object` && !!e && `then` in e && typeof e.then == `function`;
443
+ const W$2 = (e, t) => w(e, t);
444
+ const G = (e, t, n) => U(e) ? Promise.resolve(e).catch((e) => {
445
+ throw i$1(t, e);
446
+ }).then(n) : n(e);
447
+ const K = (e, t) => `issues` in e && e.issues ? d(t(e.issues)) : l$1(e.value);
448
+ const q = (e, t) => G(W$2(() => e[`~standard`].validate(t), `Result.codec serialize schema threw`), `Result.codec serialize schema threw`, (e) => K(e, (e) => new C$1({
449
+ value: t,
450
+ issues: e
451
+ })));
452
+ const J = (e, t) => G(W$2(() => e[`~standard`].validate(t), `Result.codec deserialize schema threw`), `Result.codec deserialize schema threw`, (e) => K(e, (e) => new S({
453
+ value: t,
454
+ issues: e
455
+ })));
456
+ const Y = (e, t) => U(e) ? Promise.resolve(e).then((e) => e.unwrap(t)) : e.unwrap(t);
457
+ const X = (e) => {
458
+ let t = (e) => e.status === `ok` ? l$1(e.value) : S.is(e.error) ? e.unwrap(`Result.codec deserializeUnsafe failed`) : d(e.error);
459
+ return U(e) ? Promise.resolve(e).then(t) : t(e);
460
+ };
461
+ const re = (e) => {
462
+ let t = (e) => e.status === `error` ? d(e.error) : l$1({
463
+ status: `ok`,
464
+ value: e.value
465
+ }), n = (e) => e.status === `error` ? d(e.error) : l$1({
466
+ status: `error`,
467
+ error: e.value
468
+ });
469
+ function r(r) {
470
+ if (r.status === `ok`) {
471
+ let n = q(e.serialize.ok, r.value);
472
+ return U(n) ? Promise.resolve(n).then(t) : t(n);
473
+ }
474
+ let i = q(e.serialize.err, r.error);
475
+ return U(i) ? Promise.resolve(i).then(n) : n(i);
476
+ }
477
+ let i = (e) => e.status === `error` ? d(e.error) : l$1(e.value), a = (e) => e.status === `error` ? d(e.error) : d(e.value);
478
+ function o(t) {
479
+ if (!H(t)) return d(new S({ value: t }));
480
+ if (t.status === `ok`) {
481
+ let n = J(e.deserialize.ok, t.value);
482
+ return U(n) ? Promise.resolve(n).then(i) : i(n);
483
+ }
484
+ let n = J(e.deserialize.err, t.error);
485
+ return U(n) ? Promise.resolve(n).then(a) : a(n);
486
+ }
487
+ function s(e) {
488
+ return Y(r(e), `Result.codec serializeUnsafe failed`);
489
+ }
490
+ function c(e) {
491
+ return X(o(e));
492
+ }
493
+ return {
494
+ serialize: r,
495
+ serializeUnsafe: s,
496
+ deserialize: o,
497
+ deserializeUnsafe: c
498
+ };
499
+ };
500
+ const Z = async (e, t) => {
501
+ try {
502
+ return await Promise.all(e);
503
+ } catch (e) {
504
+ return i$1(t, e);
505
+ }
506
+ };
507
+ const Q = (e) => {
508
+ let t = [];
509
+ for (let n of e) {
510
+ if (n.status === `error`) return n;
511
+ t.push(n.value);
512
+ }
513
+ return l$1(t);
514
+ };
515
+ const ie = async (e) => Q(await Z(e, `Result.allAsync input promise rejected`));
516
+ const $ = (e) => {
517
+ let t = [], n = [];
518
+ for (let r of e) r.status === `ok` ? t.push(r.value) : n.push(r.error);
519
+ return [t, n];
395
520
  };
396
- const W$2 = (e) => H(e) ? e.status === `ok` ? new s(e.value) : new c(e.error) : d(new b({ value: e }));
397
- const G = {
521
+ const ae = {
398
522
  ok: l$1,
399
523
  isOk: u$1,
400
524
  err: d,
401
525
  isError: f,
402
- try: S,
403
- tryPromise: C$1,
404
- map: w,
405
- mapError: T,
406
- tryRecover: E,
407
- andThen: D,
408
- tryRecoverAsync: O,
409
- andThenAsync: k,
410
- match: A,
526
+ try: T,
527
+ tryPromise: E,
528
+ map: D,
529
+ mapError: O,
530
+ tryRecover: k,
531
+ andThen: A,
532
+ tryRecoverAsync: ee,
533
+ andThenAsync: te,
534
+ match: ne,
411
535
  tap: j,
412
536
  tapAsync: M,
413
537
  tapError: N,
@@ -418,14 +542,11 @@ const G = {
418
542
  unwrapOr: z,
419
543
  gen: B,
420
544
  await: V$1,
421
- serialize: U,
422
- deserialize: W$2,
423
- hydrate: (e) => W$2(e),
424
- partition: (e) => {
425
- let t = [], n = [];
426
- for (let r of e) r.status === `ok` ? t.push(r.value) : n.push(r.error);
427
- return [t, n];
428
- },
545
+ codec: re,
546
+ all: Q,
547
+ allAsync: ie,
548
+ partition: $,
549
+ partitionAsync: async (e) => $(await Z(e, `Result.partitionAsync input promise rejected`)),
429
550
  flatten: (e) => e.status === `ok` ? e.value : e
430
551
  };
431
552
  //#endregion
@@ -477,8 +598,6 @@ const cliBrand = {
477
598
  }
478
599
  };
479
600
  `${cliBrand.installCommands.npm}${cliBrand.installCommands.skill}`;
480
- h("InvalidPublicBaseURL")();
481
- h("InvalidPublicRoute")();
482
601
  const publicURLForLiteral = (route) => new URL(route, brandURLs.publicWebURL).toString();
483
602
  const publicRouteURLs = {
484
603
  pricing: publicURLForLiteral(publicLinks.pricing),
@@ -548,7 +667,7 @@ const priceUsage = (costBPS) => {
548
667
  };
549
668
  const creditsToUsageUSD = (credits) => credits * 10 / 1e4;
550
669
  //#endregion
551
- //#region ../../node_modules/.bun/es-toolkit@1.49.0/node_modules/es-toolkit/dist/string/words.mjs
670
+ //#region ../../node_modules/.bun/es-toolkit@1.50.0/node_modules/es-toolkit/dist/string/words.mjs
552
671
  /**
553
672
  * Regular expression pattern to split strings into words for various case conversions
554
673
  *
@@ -588,7 +707,7 @@ function words(str) {
588
707
  return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
589
708
  }
590
709
  //#endregion
591
- //#region ../../node_modules/.bun/es-toolkit@1.49.0/node_modules/es-toolkit/dist/string/kebabCase.mjs
710
+ //#region ../../node_modules/.bun/es-toolkit@1.50.0/node_modules/es-toolkit/dist/string/kebabCase.mjs
592
711
  /**
593
712
  * Converts a string to kebab case.
594
713
  *
@@ -611,7 +730,7 @@ function kebabCase$1(str) {
611
730
  const flagName = (name) => kebabCase$1(name.replace(/[._]/g, "-"));
612
731
  //#endregion
613
732
  //#region ../../packages/codegen/src/runtime/index.ts
614
- var RuntimeUsageProblem = class extends h("RuntimeUsageProblem")() {
733
+ var RuntimeUsageProblem = class extends h("RuntimeUsageProblem") {
615
734
  constructor(input) {
616
735
  super({
617
736
  ...input,
@@ -619,12 +738,12 @@ var RuntimeUsageProblem = class extends h("RuntimeUsageProblem")() {
619
738
  });
620
739
  }
621
740
  };
622
- var RuntimeBodyProblem = class extends h("RuntimeBodyProblem")() {
741
+ var RuntimeBodyProblem = class extends h("RuntimeBodyProblem") {
623
742
  constructor(input) {
624
743
  super(input);
625
744
  }
626
745
  };
627
- var RuntimeMediaProblem = class extends h("RuntimeMediaProblem")() {
746
+ var RuntimeMediaProblem = class extends h("RuntimeMediaProblem") {
628
747
  constructor(input) {
629
748
  super(input);
630
749
  }
@@ -651,19 +770,19 @@ const resolvePathTemplateResult = (template, values) => {
651
770
  continue;
652
771
  }
653
772
  const value = values[name];
654
- if (value === void 0) return G.err(new RuntimeUsageProblem({
773
+ if (value === void 0) return ae.err(new RuntimeUsageProblem({
655
774
  kind: "missing_path_parameter",
656
775
  paramName: name
657
776
  }));
658
777
  resolvedSegments.push(safePathSegment(value));
659
778
  }
660
779
  const resolvedPath = resolvedSegments.join("/");
661
- if (!resolvedPath) return G.ok(template.startsWith("/") ? "/" : "");
662
- return G.ok(`${template.startsWith("/") ? "/" : ""}${resolvedPath}`);
780
+ if (!resolvedPath) return ae.ok(template.startsWith("/") ? "/" : "");
781
+ return ae.ok(`${template.startsWith("/") ? "/" : ""}${resolvedPath}`);
663
782
  };
664
783
  const resolvePathTemplate = (template, values) => {
665
784
  const resolved = resolvePathTemplateResult(template, values);
666
- if (G.isError(resolved)) throw new Error(resolved.error.message);
785
+ if (ae.isError(resolved)) throw new Error(resolved.error.message);
667
786
  return resolved.value;
668
787
  };
669
788
  const cliFlagNameFor$1 = (adapter, name) => adapter.cliFlagName?.(name) ?? flagName(name);
@@ -695,7 +814,7 @@ const validateMediaAttachmentsResult = (attachments, opts) => {
695
814
  if (opts.rule === "post") {
696
815
  const images = attachments.filter((attachment) => attachment.content_type.startsWith("image/")).length;
697
816
  const others = attachments.length - images;
698
- if (others > 0 && attachments.length > 1) return G.err(new RuntimeMediaProblem({
817
+ if (others > 0 && attachments.length > 1) return ae.err(new RuntimeMediaProblem({
699
818
  kind: "post_attachment_mix",
700
819
  imageCount: images,
701
820
  otherCount: others,
@@ -703,13 +822,13 @@ const validateMediaAttachmentsResult = (attachments, opts) => {
703
822
  }));
704
823
  } else {
705
824
  const total = attachments.reduce((sum, attachment) => sum + attachment.byteLength, 0);
706
- if (total > 20 * 1024 * 1024) return G.err(new RuntimeMediaProblem({
825
+ if (total > 20 * 1024 * 1024) return ae.err(new RuntimeMediaProblem({
707
826
  kind: "message_attachments_too_large",
708
827
  totalBytes: total,
709
828
  message: `LinkedIn message attachments cap at 20 MB combined; yours total ${(total / (1024 * 1024)).toFixed(1)} MB.`
710
829
  }));
711
830
  }
712
- return G.ok(attachments.map(({ content, content_type, filename }) => ({
831
+ return ae.ok(attachments.map(({ content, content_type, filename }) => ({
713
832
  content,
714
833
  content_type,
715
834
  filename
@@ -720,7 +839,7 @@ const mediaAttachmentsFrom = async (deps, paths, opts) => {
720
839
  const attachments = [];
721
840
  for (const path of paths) attachments.push(await deps.readMedia(path));
722
841
  const validated = validateMediaAttachmentsResult(attachments, opts);
723
- if (G.isError(validated)) throw opts.usageError(validated.error.message);
842
+ if (ae.isError(validated)) throw opts.usageError(validated.error.message);
724
843
  return validated.value;
725
844
  };
726
845
  const trimTrailingNewline$1 = (value) => value.endsWith("\r\n") ? value.slice(0, -2) : value.endsWith("\n") ? value.slice(0, -1) : value;
@@ -729,9 +848,9 @@ const parseStdinBodyResult = (deps, bodyTextName, bodyTextKey, value) => {
729
848
  JSON.parse(value);
730
849
  } catch {
731
850
  try {
732
- return G.ok({ [bodyTextKey]: deps.parseBodyText(`<${bodyTextName}>`, value) });
851
+ return ae.ok({ [bodyTextKey]: deps.parseBodyText(`<${bodyTextName}>`, value) });
733
852
  } catch (error) {
734
- return G.err(new RuntimeBodyProblem({
853
+ return ae.err(new RuntimeBodyProblem({
735
854
  kind: "body_parse_failed",
736
855
  message: error instanceof Error ? error.message : "Could not parse stdin body text.",
737
856
  cause: error
@@ -739,9 +858,9 @@ const parseStdinBodyResult = (deps, bodyTextName, bodyTextKey, value) => {
739
858
  }
740
859
  }
741
860
  try {
742
- return G.ok(deps.parseJSONObject("stdin", value));
861
+ return ae.ok(deps.parseJSONObject("stdin", value));
743
862
  } catch (error) {
744
- return G.err(new RuntimeBodyProblem({
863
+ return ae.err(new RuntimeBodyProblem({
745
864
  kind: "body_parse_failed",
746
865
  message: error instanceof Error ? error.message : "Could not parse stdin JSON body.",
747
866
  cause: error
@@ -750,7 +869,7 @@ const parseStdinBodyResult = (deps, bodyTextName, bodyTextKey, value) => {
750
869
  };
751
870
  const parseStdinBody$2 = (deps, bodyTextName, bodyTextKey, value) => {
752
871
  const parsed = parseStdinBodyResult(deps, bodyTextName, bodyTextKey, value);
753
- if (G.isError(parsed)) throw parsed.error.cause ?? parsed.error;
872
+ if (ae.isError(parsed)) throw parsed.error.cause ?? parsed.error;
754
873
  return parsed.value;
755
874
  };
756
875
  const hasStdinBodyText = (adapter, op) => op.config.bodyTextArg !== void 0 && adapter.bodyTextResolvesTarget?.(op) !== true;
@@ -838,16 +957,16 @@ const defaultArgAliases = (name) => /* @__PURE__ */ new Set([name, flagName(name
838
957
  const rejectUnsupportedRuntimeArgsResult = (adapter, op, args, allowedArgNames = Object.keys(buildRuntimeArgs(adapter, op))) => {
839
958
  const allowed = /* @__PURE__ */ new Set(["_"]);
840
959
  for (const name of allowedArgNames) for (const alias of adapter.argAliases?.(name) ?? defaultArgAliases(name)) allowed.add(alias);
841
- for (const [name, value] of Object.entries(args)) if (!allowed.has(name) && (adapter.ignoreUndefinedUnsupportedArgs !== true || value !== void 0)) return G.err(new RuntimeUsageProblem({
960
+ for (const [name, value] of Object.entries(args)) if (!allowed.has(name) && (adapter.ignoreUndefinedUnsupportedArgs !== true || value !== void 0)) return ae.err(new RuntimeUsageProblem({
842
961
  kind: "unsupported_arg",
843
962
  argName: name,
844
963
  value
845
964
  }));
846
- return G.ok();
965
+ return ae.ok();
847
966
  };
848
967
  const rejectUnsupportedRuntimeArgs = (adapter, op, args, allowedArgNames = Object.keys(buildRuntimeArgs(adapter, op))) => {
849
968
  const rejected = rejectUnsupportedRuntimeArgsResult(adapter, op, args, allowedArgNames);
850
- if (G.isError(rejected)) {
969
+ if (ae.isError(rejected)) {
851
970
  if (rejected.error.kind === "unsupported_arg" && rejected.error.argName !== void 0) throw adapter.unsupportedArgError(rejected.error.argName, rejected.error.value, op);
852
971
  throw adapter.usageError(rejected.error.message);
853
972
  }
@@ -924,8 +1043,8 @@ const bodyRequiredPreparseProblem = (adapter, op) => new RuntimeBodyProblem({
924
1043
  message: op.config.bodyTextArg && Object.keys(op.config.bodyParams ?? {}).length === 0 ? `Pass <${bodyTextDisplayKeyFor(op) ?? op.config.bodyTextArg}>.` : "Pass required body positional arguments or --body."
925
1044
  });
926
1045
  const checkBodyRequiredResult = (adapter, op, args, bodyTextOptional) => {
927
- if (!op.hasBody || adapter.checkBodyRequiredBeforeInput !== true) return G.ok();
928
- if (bodyTextOptional) return G.ok();
1046
+ if (!op.hasBody || adapter.checkBodyRequiredBeforeInput !== true) return ae.ok();
1047
+ if (bodyTextOptional) return ae.ok();
929
1048
  const expressions = [];
930
1049
  const bodyTextArg = op.config.bodyTextArg;
931
1050
  if (bodyTextArg && op.config.bodyTextRequired !== false) expressions.push(args[bodyTextDisplayKeyFor(op) ?? bodyTextArg] === void 0);
@@ -933,25 +1052,25 @@ const checkBodyRequiredResult = (adapter, op, args, bodyTextOptional) => {
933
1052
  const positionalValuePresent = param.positional && Array.isArray(args._) && args._.length > 0;
934
1053
  expressions.push(args[flagName(bodyParamArgFor(adapter, name, param))] === void 0 && !positionalValuePresent);
935
1054
  }
936
- if (expressions.length > 0 && typeof args.body !== "string" && expressions.some(Boolean)) return G.err(bodyRequiredPreparseProblem(adapter, op));
937
- return G.ok();
1055
+ if (expressions.length > 0 && typeof args.body !== "string" && expressions.some(Boolean)) return ae.err(bodyRequiredPreparseProblem(adapter, op));
1056
+ return ae.ok();
938
1057
  };
939
1058
  const throwRuntimeBodyProblem = (adapter, problem) => {
940
1059
  throw problem.cause ?? adapter.usageError(problem.message);
941
1060
  };
942
1061
  const checkBodyRequired = (adapter, op, args, bodyTextOptional) => {
943
1062
  const checked = checkBodyRequiredResult(adapter, op, args, bodyTextOptional);
944
- if (G.isError(checked)) throwRuntimeBodyProblem(adapter, checked.error);
1063
+ if (ae.isError(checked)) throwRuntimeBodyProblem(adapter, checked.error);
945
1064
  };
946
1065
  const buildBodyResult = (adapter, deps, op, input, bodyTextOptional) => {
947
1066
  const bodyTextArg = op.config.bodyTextArg;
948
1067
  const bodyParamEntries = Object.entries(op.config.bodyParams ?? {});
949
1068
  if (!bodyTextArg && bodyParamEntries.length === 0) {
950
- if (input.body === void 0) return G.ok(void 0);
1069
+ if (input.body === void 0) return ae.ok(void 0);
951
1070
  try {
952
- return G.ok(deps.parseJSONObject("--body", input.body));
1071
+ return ae.ok(deps.parseJSONObject("--body", input.body));
953
1072
  } catch (error) {
954
- return G.err(new RuntimeBodyProblem({
1073
+ return ae.err(new RuntimeBodyProblem({
955
1074
  kind: "body_parse_failed",
956
1075
  message: error instanceof Error ? error.message : "Could not parse --body JSON.",
957
1076
  cause: error
@@ -962,7 +1081,7 @@ const buildBodyResult = (adapter, deps, op, input, bodyTextOptional) => {
962
1081
  if (input.body !== void 0) try {
963
1082
  bodyFromJSON = deps.parseJSONObject(hasStdinBodyText(adapter, op) ? "stdin" : "--body", input.body);
964
1083
  } catch (error) {
965
- return G.err(new RuntimeBodyProblem({
1084
+ return ae.err(new RuntimeBodyProblem({
966
1085
  kind: "body_parse_failed",
967
1086
  message: error instanceof Error ? error.message : "Could not parse request body JSON.",
968
1087
  cause: error
@@ -973,7 +1092,7 @@ const buildBodyResult = (adapter, deps, op, input, bodyTextOptional) => {
973
1092
  if (bodyTextArg && input[bodyTextArg] !== void 0) try {
974
1093
  bodyText = deps.parseBodyText(`<${displayTextArg}>`, input[bodyTextArg]);
975
1094
  } catch (error) {
976
- return G.err(new RuntimeBodyProblem({
1095
+ return ae.err(new RuntimeBodyProblem({
977
1096
  kind: "body_parse_failed",
978
1097
  message: error instanceof Error ? error.message : "Could not parse body text.",
979
1098
  cause: error
@@ -986,7 +1105,7 @@ const buildBodyResult = (adapter, deps, op, input, bodyTextOptional) => {
986
1105
  try {
987
1106
  bodyParamValues.set(name, value === void 0 ? param.default : param.kind === "array" ? deps.parseResourceIdList(displayName, Array.isArray(value) ? value : [value]) : deps.parseQueryString(displayName, value));
988
1107
  } catch (error) {
989
- return G.err(new RuntimeBodyProblem({
1108
+ return ae.err(new RuntimeBodyProblem({
990
1109
  kind: "body_parse_failed",
991
1110
  message: error instanceof Error ? error.message : `Could not parse ${displayName}.`,
992
1111
  cause: error
@@ -1012,45 +1131,45 @@ const buildBodyResult = (adapter, deps, op, input, bodyTextOptional) => {
1012
1131
  input,
1013
1132
  op
1014
1133
  });
1015
- if (error) return G.err(new RuntimeBodyProblem({
1134
+ if (error) return ae.err(new RuntimeBodyProblem({
1016
1135
  kind: "body_validation_failed",
1017
1136
  message: error.message,
1018
1137
  cause: error
1019
1138
  }));
1020
- return G.ok(resolvedBody);
1139
+ return ae.ok(resolvedBody);
1021
1140
  };
1022
1141
  const buildBody = (adapter, deps, op, input, bodyTextOptional) => {
1023
1142
  const built = buildBodyResult(adapter, deps, op, input, bodyTextOptional);
1024
- if (G.isOk(built)) return built.value;
1143
+ if (ae.isOk(built)) return built.value;
1025
1144
  throwRuntimeBodyProblem(adapter, built.error);
1026
1145
  };
1027
1146
  const resolveBodyTextFromStdinResult = async (adapter, op, deps, args, commandLabel, bodyTextOptional) => {
1028
- if (!hasStdinBodyText(adapter, op)) return G.ok();
1147
+ if (!hasStdinBodyText(adapter, op)) return ae.ok();
1029
1148
  const bodyTextArg = op.config.bodyTextArg;
1030
- if (bodyTextArg === void 0) return G.ok();
1149
+ if (bodyTextArg === void 0) return ae.ok();
1031
1150
  const displayTextArg = bodyTextDisplayKeyFor(op) ?? bodyTextArg;
1032
1151
  const required = stdinBodyTextRequired(adapter, op) && !bodyTextOptional;
1033
1152
  if (deps.isStdinTTY()) {
1034
- if (required) return G.err(new RuntimeBodyProblem({
1153
+ if (required) return ae.err(new RuntimeBodyProblem({
1035
1154
  kind: "stdin_body_required",
1036
1155
  message: bodyTextPipeMessage(commandLabel)
1037
1156
  }));
1038
- return G.ok();
1157
+ return ae.ok();
1039
1158
  }
1040
1159
  const piped = trimTrailingNewline$1(await deps.readStdin());
1041
1160
  if (piped.length > 0) {
1042
1161
  const parsed = parseStdinBodyResult(deps, displayTextArg, bodyTextArg, piped);
1043
- if (G.isError(parsed)) return G.err(parsed.error);
1162
+ if (ae.isError(parsed)) return ae.err(parsed.error);
1044
1163
  args.body = JSON.stringify(parsed.value);
1045
- } else if (required) return G.err(new RuntimeBodyProblem({
1164
+ } else if (required) return ae.err(new RuntimeBodyProblem({
1046
1165
  kind: "stdin_body_required",
1047
1166
  message: bodyTextPipeMessage(commandLabel)
1048
1167
  }));
1049
- return G.ok();
1168
+ return ae.ok();
1050
1169
  };
1051
1170
  const resolveBodyTextFromStdin = async (adapter, op, deps, args, commandLabel, bodyTextOptional) => {
1052
1171
  const resolved = await resolveBodyTextFromStdinResult(adapter, op, deps, args, commandLabel, bodyTextOptional);
1053
- if (G.isError(resolved)) throwRuntimeBodyProblem(adapter, resolved.error);
1172
+ if (ae.isError(resolved)) throwRuntimeBodyProblem(adapter, resolved.error);
1054
1173
  };
1055
1174
  const maximumItemsHintFor$2 = (adapter, op) => adapter.maximumItemsHintFor?.(op);
1056
1175
  const costFor = (adapter, op) => {
@@ -1382,32 +1501,32 @@ const normalizeLiftedRow = (collection, row) => {
1382
1501
  const columns = collectionColumns(collection);
1383
1502
  const columnSet = new Set(columns);
1384
1503
  const normalized = {};
1385
- for (const column of Object.keys(row)) if (!columnSet.has(column)) return G.err({
1504
+ for (const column of Object.keys(row)) if (!columnSet.has(column)) return ae.err({
1386
1505
  kind: "unsupportedValue",
1387
1506
  column,
1388
1507
  message: `${collection.key} produced unexpected column ${column}`
1389
1508
  });
1390
1509
  for (const column of columns) {
1391
1510
  const value = row[column];
1392
- if (unsupportedRowValue(value)) return G.err({
1511
+ if (unsupportedRowValue(value)) return ae.err({
1393
1512
  kind: "unsupportedValue",
1394
1513
  column,
1395
1514
  message: `${collection.key} produced unsupported value for ${column}`
1396
1515
  });
1397
1516
  normalized[column] = value ?? null;
1398
1517
  }
1399
- if (normalized.id === null || normalized.id === "") return G.err({
1518
+ if (normalized.id === null || normalized.id === "") return ae.err({
1400
1519
  kind: "missingId",
1401
1520
  column: "id",
1402
1521
  message: `${collection.key} row is missing id`
1403
1522
  });
1404
- return G.ok(normalized);
1523
+ return ae.ok(normalized);
1405
1524
  };
1406
1525
  const liftCollectionRow = (collection, item) => {
1407
1526
  try {
1408
1527
  return normalizeLiftedRow(collection, collection.lift(item));
1409
1528
  } catch (error) {
1410
- return G.err(normalizationErrorFrom(error));
1529
+ return ae.err(normalizationErrorFrom(error));
1411
1530
  }
1412
1531
  };
1413
1532
  const withCollectionColumns = (collection) => ({
@@ -2219,7 +2338,7 @@ const metadataForPlatform = (platform) => {
2219
2338
  //#endregion
2220
2339
  //#region ../../packages/sqlsync/src/cursor.ts
2221
2340
  const PARTIAL_SYNC_CURSOR_PREFIX = "partial-sync-v1:";
2222
- var CorruptPartialSyncCursor = class extends h("CorruptPartialSyncCursor")() {
2341
+ var CorruptPartialSyncCursor = class extends h("CorruptPartialSyncCursor") {
2223
2342
  constructor(args) {
2224
2343
  super({
2225
2344
  cursor: args.cursor,
@@ -2232,19 +2351,19 @@ const isRecord$13 = (value) => value !== null && typeof value === "object" && !A
2232
2351
  const validPartialSyncCursor = (value) => value.version === 1 && Number.isInteger(value.requestIndex) && typeof value.requestIndex === "number" && value.requestIndex >= 0 && typeof value.cursor === "string" && (typeof value.checkpoint === "string" || value.checkpoint === null) && (typeof value.newestId === "string" || value.newestId === null) && (typeof value.since === "number" || value.since === null) && (value.phase === void 0 || value.phase === "collection" || value.phase === "parent" || value.phase === "child") && (value.parentId === void 0 || typeof value.parentId === "string" || value.parentId === null);
2233
2352
  const encodePartialSyncCursor = (cursor) => `${PARTIAL_SYNC_CURSOR_PREFIX}${JSON.stringify(cursor)}`;
2234
2353
  const parsePartialSyncCursor = (value) => {
2235
- if (!value.startsWith("partial-sync-v1:")) return G.err(new CorruptPartialSyncCursor({
2354
+ if (!value.startsWith("partial-sync-v1:")) return ae.err(new CorruptPartialSyncCursor({
2236
2355
  cursor: value,
2237
2356
  reason: "missing partial-sync-v1 prefix"
2238
2357
  }));
2239
2358
  try {
2240
2359
  const parsed = JSON.parse(value.slice(16));
2241
- if (isRecord$13(parsed) && validPartialSyncCursor(parsed)) return G.ok(parsed);
2242
- return G.err(new CorruptPartialSyncCursor({
2360
+ if (isRecord$13(parsed) && validPartialSyncCursor(parsed)) return ae.ok(parsed);
2361
+ return ae.err(new CorruptPartialSyncCursor({
2243
2362
  cursor: value,
2244
2363
  reason: "payload does not match the partial cursor shape"
2245
2364
  }));
2246
2365
  } catch (error) {
2247
- return G.err(new CorruptPartialSyncCursor({
2366
+ return ae.err(new CorruptPartialSyncCursor({
2248
2367
  cursor: value,
2249
2368
  reason: "payload is not valid JSON",
2250
2369
  cause: error
@@ -2252,12 +2371,12 @@ const parsePartialSyncCursor = (value) => {
2252
2371
  }
2253
2372
  };
2254
2373
  const readPartialSyncCursorResult = (value) => {
2255
- if (!value?.startsWith("partial-sync-v1:")) return G.ok(void 0);
2374
+ if (!value?.startsWith("partial-sync-v1:")) return ae.ok(void 0);
2256
2375
  return parsePartialSyncCursor(value);
2257
2376
  };
2258
2377
  const readPartialSyncCursor = (value) => {
2259
2378
  const parsed = readPartialSyncCursorResult(value);
2260
- return G.isError(parsed) ? void 0 : parsed.value;
2379
+ return ae.isError(parsed) ? void 0 : parsed.value;
2261
2380
  };
2262
2381
  const partialCursorMatchesSince = (cursor, since) => {
2263
2382
  const requestedSince = since ?? null;
@@ -2322,7 +2441,7 @@ const readUserVersion = (db) => {
2322
2441
  const setUserVersion = (db, version) => {
2323
2442
  db.exec(`PRAGMA user_version = ${version}`);
2324
2443
  };
2325
- var MissingMigration = class extends h("MissingMigration")() {
2444
+ var MissingMigration = class extends h("MissingMigration") {
2326
2445
  constructor(index) {
2327
2446
  super({
2328
2447
  index,
@@ -2330,7 +2449,7 @@ var MissingMigration = class extends h("MissingMigration")() {
2330
2449
  });
2331
2450
  }
2332
2451
  };
2333
- var StaleMigrationSchema = class extends h("StaleMigrationSchema")() {
2452
+ var StaleMigrationSchema = class extends h("StaleMigrationSchema") {
2334
2453
  constructor(currentVersion, finalVersion) {
2335
2454
  super({
2336
2455
  currentVersion,
@@ -2341,20 +2460,20 @@ var StaleMigrationSchema = class extends h("StaleMigrationSchema")() {
2341
2460
  };
2342
2461
  const migrateResult = (db) => {
2343
2462
  const currentVersion = readUserVersion(db);
2344
- if (currentVersion >= MIGRATIONS.length) return G.ok({
2463
+ if (currentVersion >= MIGRATIONS.length) return ae.ok({
2345
2464
  fromVersion: currentVersion,
2346
2465
  toVersion: currentVersion,
2347
2466
  applied: 0
2348
2467
  });
2349
2468
  for (let index = currentVersion; index < MIGRATIONS.length; index += 1) {
2350
2469
  const migration = MIGRATIONS[index];
2351
- if (!migration) return G.err(new MissingMigration(index));
2470
+ if (!migration) return ae.err(new MissingMigration(index));
2352
2471
  db.transaction(() => {
2353
2472
  db.exec(migration.sql);
2354
2473
  setUserVersion(db, index + 1);
2355
2474
  });
2356
2475
  }
2357
- return G.ok({
2476
+ return ae.ok({
2358
2477
  fromVersion: currentVersion,
2359
2478
  toVersion: MIGRATIONS.length,
2360
2479
  applied: MIGRATIONS.length - currentVersion
@@ -2363,8 +2482,8 @@ const migrateResult = (db) => {
2363
2482
  const migrate = (db) => migrateResult(db).unwrap();
2364
2483
  const assertAtLatestResult = (db) => {
2365
2484
  const currentVersion = readUserVersion(db);
2366
- if (currentVersion < MIGRATIONS.length) return G.err(new StaleMigrationSchema(currentVersion, MIGRATIONS.length));
2367
- return G.ok(void 0);
2485
+ if (currentVersion < MIGRATIONS.length) return ae.err(new StaleMigrationSchema(currentVersion, MIGRATIONS.length));
2486
+ return ae.ok(void 0);
2368
2487
  };
2369
2488
  const assertAtLatest = (db) => {
2370
2489
  assertAtLatestResult(db).unwrap();
@@ -2482,7 +2601,7 @@ const applyWriteThrough = (db, args) => {
2482
2601
  };
2483
2602
  //#endregion
2484
2603
  //#region ../../packages/sqlsync/src/cache.ts
2485
- var UnknownCacheTable = class extends h("UnknownCacheTable")() {
2604
+ var UnknownCacheTable = class extends h("UnknownCacheTable") {
2486
2605
  constructor(args) {
2487
2606
  super({
2488
2607
  table: args.table,
@@ -2490,7 +2609,7 @@ var UnknownCacheTable = class extends h("UnknownCacheTable")() {
2490
2609
  });
2491
2610
  }
2492
2611
  };
2493
- var ForbiddenCacheTableRead = class extends h("ForbiddenCacheTableRead")() {
2612
+ var ForbiddenCacheTableRead = class extends h("ForbiddenCacheTableRead") {
2494
2613
  constructor(args) {
2495
2614
  const tables = [...args.tables].sort();
2496
2615
  super({
@@ -2500,7 +2619,7 @@ var ForbiddenCacheTableRead = class extends h("ForbiddenCacheTableRead")() {
2500
2619
  });
2501
2620
  }
2502
2621
  };
2503
- var UnknownCachePlatform = class extends h("UnknownCachePlatform")() {
2622
+ var UnknownCachePlatform = class extends h("UnknownCachePlatform") {
2504
2623
  constructor(platform) {
2505
2624
  super({
2506
2625
  platform,
@@ -2513,40 +2632,40 @@ const resolveCachePath = (path) => path === ":memory:" ? path : resolve(path);
2513
2632
  const stringOrNull = (value) => typeof value === "string" ? value : null;
2514
2633
  const numberOrNull = (value) => typeof value === "number" ? value : null;
2515
2634
  const parseCachePlatform = (platform) => {
2516
- if (platform === "linkedin" || platform === "x") return G.ok(platform);
2517
- return G.err(new UnknownCachePlatform(platform));
2635
+ if (platform === "linkedin" || platform === "x") return ae.ok(platform);
2636
+ return ae.err(new UnknownCachePlatform(platform));
2518
2637
  };
2519
2638
  const requireCachePlatform = (platform) => {
2520
2639
  const parsed = parseCachePlatform(platform);
2521
- if (G.isError(parsed)) throw parsed.error;
2640
+ if (ae.isError(parsed)) throw parsed.error;
2522
2641
  return parsed.value;
2523
2642
  };
2524
2643
  const parseCacheTable = (table) => {
2525
- if (!cacheTableNames.has(table)) return G.err(new UnknownCacheTable({ table }));
2526
- return G.ok(table);
2644
+ if (!cacheTableNames.has(table)) return ae.err(new UnknownCacheTable({ table }));
2645
+ return ae.ok(table);
2527
2646
  };
2528
2647
  const requireCacheTable = (table) => {
2529
2648
  const parsed = parseCacheTable(table);
2530
- if (G.isError(parsed)) throw parsed.error;
2649
+ if (ae.isError(parsed)) throw parsed.error;
2531
2650
  return parsed.value;
2532
2651
  };
2533
2652
  const checkPlatformQuery = (sql, platform) => {
2534
2653
  const allowedTables = tablesForPlatform(platform);
2535
2654
  const rejectedTables = new Set(knownTableTokens(sql).filter((table) => !allowedTables.has(table)));
2536
- if (rejectedTables.size > 0) return G.err(new ForbiddenCacheTableRead({
2655
+ if (rejectedTables.size > 0) return ae.err(new ForbiddenCacheTableRead({
2537
2656
  platform,
2538
2657
  tables: rejectedTables
2539
2658
  }));
2540
- return G.ok();
2659
+ return ae.ok();
2541
2660
  };
2542
2661
  const assertPlatformQuery = (sql, platform) => {
2543
2662
  const checked = checkPlatformQuery(sql, platform);
2544
- if (G.isError(checked)) throw checked.error;
2663
+ if (ae.isError(checked)) throw checked.error;
2545
2664
  };
2546
2665
  const classifyCacheRead = (sql, platform) => {
2547
2666
  const checked = checkPlatformQuery(sql, platform);
2548
- if (G.isError(checked)) return G.err(checked.error);
2549
- return G.ok({ tables: referencedTablesForRead(sql, platform) });
2667
+ if (ae.isError(checked)) return ae.err(checked.error);
2668
+ return ae.ok({ tables: referencedTablesForRead(sql, platform) });
2550
2669
  };
2551
2670
  const unknownTableFromSQLiteError = (error) => {
2552
2671
  return (error instanceof Error ? error.message : String(error)).match(/\bno such table: ([^\s]+)/)?.[1]?.replace(/^["'`]|["'`]$/g, "");
@@ -2692,7 +2811,7 @@ const createCache = (path, db) => ({
2692
2811
  },
2693
2812
  read: (sql, opts) => {
2694
2813
  const classification = classifyCacheRead(sql, opts.platform);
2695
- if (G.isError(classification)) return G.err(classification.error);
2814
+ if (ae.isError(classification)) return ae.err(classification.error);
2696
2815
  const tables = classification.value.tables.map((name) => {
2697
2816
  const policy = freshnessPolicyForTable(name);
2698
2817
  return {
@@ -2705,10 +2824,10 @@ const createCache = (path, db) => ({
2705
2824
  rows = db.prepare(sql).all();
2706
2825
  } catch (error) {
2707
2826
  const table = unknownTableFromSQLiteError(error);
2708
- if (table) return G.err(new UnknownCacheTable({ table }));
2827
+ if (table) return ae.err(new UnknownCacheTable({ table }));
2709
2828
  throw error;
2710
2829
  }
2711
- return G.ok({
2830
+ return ae.ok({
2712
2831
  rows,
2713
2832
  tables
2714
2833
  });
@@ -7494,7 +7613,7 @@ const planPagePersistence = (state, page, opts) => {
7494
7613
  const profileTableFor = (platform) => platform === "x" ? "x_profiles_raw" : "li_profiles_raw";
7495
7614
  //#endregion
7496
7615
  //#region ../../packages/sqlsync/src/sync-plan.ts
7497
- var SinceUnsupported = class extends h("SinceUnsupported")() {
7616
+ var SinceUnsupported = class extends h("SinceUnsupported") {
7498
7617
  constructor(collectionKey) {
7499
7618
  super({
7500
7619
  collectionKey,
@@ -7502,7 +7621,7 @@ var SinceUnsupported = class extends h("SinceUnsupported")() {
7502
7621
  });
7503
7622
  }
7504
7623
  };
7505
- var FullInitialSyncRequired = class extends h("FullInitialSyncRequired")() {
7624
+ var FullInitialSyncRequired = class extends h("FullInitialSyncRequired") {
7506
7625
  constructor(collectionKey) {
7507
7626
  super({
7508
7627
  collectionKey,
@@ -7510,7 +7629,7 @@ var FullInitialSyncRequired = class extends h("FullInitialSyncRequired")() {
7510
7629
  });
7511
7630
  }
7512
7631
  };
7513
- var MissingParentCollection = class extends h("MissingParentCollection")() {
7632
+ var MissingParentCollection = class extends h("MissingParentCollection") {
7514
7633
  constructor(collectionKey, parentCollectionKey) {
7515
7634
  super({
7516
7635
  collectionKey,
@@ -7519,7 +7638,7 @@ var MissingParentCollection = class extends h("MissingParentCollection")() {
7519
7638
  });
7520
7639
  }
7521
7640
  };
7522
- var InvalidPartialCursor = class extends h("InvalidPartialCursor")() {
7641
+ var InvalidPartialCursor = class extends h("InvalidPartialCursor") {
7523
7642
  constructor(collectionKey, cursor, cause) {
7524
7643
  super({
7525
7644
  collectionKey,
@@ -7531,19 +7650,19 @@ var InvalidPartialCursor = class extends h("InvalidPartialCursor")() {
7531
7650
  };
7532
7651
  const parseStoredPartialCursor = (collectionKey, cursor) => {
7533
7652
  const parsed = readPartialSyncCursorResult(cursor);
7534
- if (G.isError(parsed)) return G.err(new InvalidPartialCursor(collectionKey, cursor ?? "", parsed.error));
7535
- return G.ok(parsed.value);
7653
+ if (ae.isError(parsed)) return ae.err(new InvalidPartialCursor(collectionKey, cursor ?? "", parsed.error));
7654
+ return ae.ok(parsed.value);
7536
7655
  };
7537
7656
  const validateSyncOptions = (deps, opts) => {
7538
7657
  const { collection } = opts;
7539
- if (opts.since != null && collection.sinceField === void 0) return G.err(new SinceUnsupported(collection.key));
7658
+ if (opts.since != null && collection.sinceField === void 0) return ae.err(new SinceUnsupported(collection.key));
7540
7659
  const storedState = deps.cache.getCursor(collection.key);
7541
7660
  const storedPartialCursor = parseStoredPartialCursor(collection.key, storedState?.cursor);
7542
- if (G.isError(storedPartialCursor)) return G.err(storedPartialCursor.error);
7543
- if (opts.since != null && collection.requiresFullInitialSync && (storedState?.lastSynced == null || storedPartialCursor.value !== void 0)) return G.err(new FullInitialSyncRequired(collection.key));
7661
+ if (ae.isError(storedPartialCursor)) return ae.err(storedPartialCursor.error);
7662
+ if (opts.since != null && collection.requiresFullInitialSync && (storedState?.lastSynced == null || storedPartialCursor.value !== void 0)) return ae.err(new FullInitialSyncRequired(collection.key));
7544
7663
  const parentCollection = collection.parentCollection === void 0 ? void 0 : collectionByKey(collection.parentCollection);
7545
- if (collection.parentCollection && !parentCollection) return G.err(new MissingParentCollection(collection.key, collection.parentCollection));
7546
- return G.ok({
7664
+ if (collection.parentCollection && !parentCollection) return ae.err(new MissingParentCollection(collection.key, collection.parentCollection));
7665
+ return ae.ok({
7547
7666
  collection,
7548
7667
  since: opts.since,
7549
7668
  storedState,
@@ -7577,7 +7696,7 @@ const planCompletedCollectionCursor = (args) => ({
7577
7696
  //#region ../../packages/sqlsync/src/sync.ts
7578
7697
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
7579
7698
  const pageDelayFor = (pageDelayMs, pagesCompleted) => typeof pageDelayMs === "function" ? pageDelayMs(pagesCompleted) : pageDelayMs;
7580
- var UnsupportedSinceCollection = class extends h("UnsupportedSinceCollection")() {
7699
+ var UnsupportedSinceCollection = class extends h("UnsupportedSinceCollection") {
7581
7700
  constructor(collectionKey) {
7582
7701
  super({
7583
7702
  collectionKey,
@@ -7585,7 +7704,7 @@ var UnsupportedSinceCollection = class extends h("UnsupportedSinceCollection")()
7585
7704
  });
7586
7705
  }
7587
7706
  };
7588
- var InitialSyncRequired = class extends h("InitialSyncRequired")() {
7707
+ var InitialSyncRequired = class extends h("InitialSyncRequired") {
7589
7708
  constructor(collectionKey) {
7590
7709
  super({
7591
7710
  collectionKey,
@@ -7742,7 +7861,7 @@ const walkRequest = async (args) => {
7742
7861
  break;
7743
7862
  } catch (error) {
7744
7863
  if (await waitForRateLimit(error)) continue;
7745
- return G.err(pageError({
7864
+ return ae.err(pageError({
7746
7865
  ...pageContext,
7747
7866
  cursorPersisted: persistPartialCursor() || partialCursorPersisted || void 0
7748
7867
  }, error));
@@ -7753,7 +7872,7 @@ const walkRequest = async (args) => {
7753
7872
  try {
7754
7873
  json = await response.json();
7755
7874
  } catch (error) {
7756
- return G.err(pageError({
7875
+ return ae.err(pageError({
7757
7876
  ...pageContext,
7758
7877
  creditsSpent: args.credits.spent
7759
7878
  }, error));
@@ -7794,7 +7913,7 @@ const walkRequest = async (args) => {
7794
7913
  break;
7795
7914
  }
7796
7915
  }
7797
- return G.ok({
7916
+ return ae.ok({
7798
7917
  ids,
7799
7918
  newestId: state.newestId,
7800
7919
  pages,
@@ -7818,10 +7937,10 @@ const parentIdsFromCache = (deps, collection, since) => {
7818
7937
  };
7819
7938
  const runSync = async (deps, opts) => {
7820
7939
  const syncPlan = validateSyncOptions(deps, opts);
7821
- if (G.isError(syncPlan)) {
7822
- if (syncPlan.error instanceof SinceUnsupported) return G.err(new UnsupportedSinceCollection(syncPlan.error.collectionKey));
7823
- if (syncPlan.error instanceof FullInitialSyncRequired) return G.err(new InitialSyncRequired(syncPlan.error.collectionKey));
7824
- return G.err(syncPlan.error);
7940
+ if (ae.isError(syncPlan)) {
7941
+ if (syncPlan.error instanceof SinceUnsupported) return ae.err(new UnsupportedSinceCollection(syncPlan.error.collectionKey));
7942
+ if (syncPlan.error instanceof FullInitialSyncRequired) return ae.err(new InitialSyncRequired(syncPlan.error.collectionKey));
7943
+ return ae.err(syncPlan.error);
7825
7944
  }
7826
7945
  const { collection, parentCollection, storedPartialCursor } = syncPlan.value;
7827
7946
  const credits = { spent: 0 };
@@ -7846,7 +7965,7 @@ const runSync = async (deps, opts) => {
7846
7965
  deps.cache.setCursor(pending.collection, pending.cursor, pending.objectCount, pending.lastSynced);
7847
7966
  };
7848
7967
  if (collection.parentCollection) {
7849
- if (!parentCollection) return G.err(new MissingParentCollection(collection.key, collection.parentCollection));
7968
+ if (!parentCollection) return ae.err(new MissingParentCollection(collection.key, collection.parentCollection));
7850
7969
  let activePartialCursor = activeParentedPartialCursor({
7851
7970
  storedPartialCursor,
7852
7971
  since: opts.since
@@ -7886,7 +8005,7 @@ const runSync = async (deps, opts) => {
7886
8005
  onPage: opts.onPage,
7887
8006
  onProgress: opts.onProgress
7888
8007
  });
7889
- if (G.isError(result)) return G.err(result.error);
8008
+ if (ae.isError(result)) return ae.err(result.error);
7890
8009
  addResult(result.value);
7891
8010
  parentIds.push(...result.value.ids);
7892
8011
  if (parentPersistsCheckpoint) parentCheckpoint = singleRequestCheckpoint({
@@ -7933,7 +8052,7 @@ const runSync = async (deps, opts) => {
7933
8052
  onPage: opts.onPage,
7934
8053
  onProgress: opts.onProgress
7935
8054
  });
7936
- if (G.isError(result)) return G.err(result.error);
8055
+ if (ae.isError(result)) return ae.err(result.error);
7937
8056
  addResult(result.value);
7938
8057
  if (activePartialCursor?.phase === "child" && activePartialCursor.parentId === parentId) activePartialCursor = void 0;
7939
8058
  }
@@ -7971,7 +8090,7 @@ const runSync = async (deps, opts) => {
7971
8090
  onPage: opts.onPage,
7972
8091
  onProgress: opts.onProgress
7973
8092
  });
7974
- if (G.isError(result)) return G.err(result.error);
8093
+ if (ae.isError(result)) return ae.err(result.error);
7975
8094
  addResult(result.value);
7976
8095
  if (!preservesBroaderPartialOnSince(activePartialCursor, opts.since, result.value.stoppedReason) && useCheckpoint) pendingCursors.push(singleRequestCheckpoint({
7977
8096
  collection,
@@ -7984,7 +8103,7 @@ const runSync = async (deps, opts) => {
7984
8103
  })));
7985
8104
  }
7986
8105
  for (const pending of pendingCursors) writePendingCursor(pending);
7987
- return G.ok({
8106
+ return ae.ok({
7988
8107
  collection: collection.key,
7989
8108
  objectsUpserted: upserted,
7990
8109
  pages,
@@ -8411,14 +8530,14 @@ function renderDescription(arg, required) {
8411
8530
  }
8412
8531
  //#endregion
8413
8532
  //#region ../../packages/billing/src/pricing.ts
8414
- var UnknownPricingCategory = class extends h("pricing_category_unknown")() {};
8533
+ var UnknownPricingCategory = class extends h("pricing_category_unknown") {};
8415
8534
  const lookupCostBPSForCategoryResult = (table, category) => {
8416
8535
  const costBPS = table.get(category);
8417
- if (costBPS === void 0) return G.err(new UnknownPricingCategory({
8536
+ if (costBPS === void 0) return ae.err(new UnknownPricingCategory({
8418
8537
  category,
8419
8538
  message: `Unknown pricing category: ${category}`
8420
8539
  }));
8421
- return G.ok(costBPS);
8540
+ return ae.ok(costBPS);
8422
8541
  };
8423
8542
  const createPricing = (resources) => {
8424
8543
  const table = new Map(resources.map((resource) => [resource.key, Math.round(resource.unitPriceUSD * 1e4)]));
@@ -8541,7 +8660,7 @@ const costBPSForCategory$1 = (category) => {
8541
8660
  return costBPS.value;
8542
8661
  };
8543
8662
  //#endregion
8544
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/entity.js
8663
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/entity.js
8545
8664
  const entityKind = Symbol.for("drizzle:entityKind");
8546
8665
  function is(value, type) {
8547
8666
  if (!value || typeof value !== "object") return false;
@@ -8555,7 +8674,7 @@ function is(value, type) {
8555
8674
  return false;
8556
8675
  }
8557
8676
  //#endregion
8558
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/column.js
8677
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/column.js
8559
8678
  var Column = class {
8560
8679
  constructor(table, config) {
8561
8680
  this.table = table;
@@ -8605,7 +8724,7 @@ var Column = class {
8605
8724
  }
8606
8725
  };
8607
8726
  //#endregion
8608
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/column-builder.js
8727
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/column-builder.js
8609
8728
  var ColumnBuilder = class {
8610
8729
  static [entityKind] = "ColumnBuilder";
8611
8730
  config;
@@ -8708,10 +8827,10 @@ var ColumnBuilder = class {
8708
8827
  }
8709
8828
  };
8710
8829
  //#endregion
8711
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/table.utils.js
8830
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/table.utils.js
8712
8831
  const TableName = Symbol.for("drizzle:Name");
8713
8832
  //#endregion
8714
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/foreign-keys.js
8833
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/foreign-keys.js
8715
8834
  var ForeignKeyBuilder = class {
8716
8835
  static [entityKind] = "PgForeignKeyBuilder";
8717
8836
  /** @internal */
@@ -8784,17 +8903,17 @@ function foreignKey(config) {
8784
8903
  return new ForeignKeyBuilder(mappedConfig);
8785
8904
  }
8786
8905
  //#endregion
8787
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/tracing-utils.js
8906
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/tracing-utils.js
8788
8907
  function iife(fn, ...args) {
8789
8908
  return fn(...args);
8790
8909
  }
8791
8910
  //#endregion
8792
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/unique-constraint.js
8911
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/unique-constraint.js
8793
8912
  function uniqueKeyName(table, columns) {
8794
8913
  return `${table[TableName]}_${columns.join("_")}_unique`;
8795
8914
  }
8796
8915
  //#endregion
8797
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/utils/array.js
8916
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/utils/array.js
8798
8917
  function parsePgArrayValue(arrayString, startFrom, inQuotes) {
8799
8918
  for (let i = startFrom; i < arrayString.length; i++) {
8800
8919
  const char = arrayString[i];
@@ -8856,7 +8975,7 @@ function makePgArray(array) {
8856
8975
  }).join(",")}}`;
8857
8976
  }
8858
8977
  //#endregion
8859
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/common.js
8978
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/common.js
8860
8979
  var PgColumnBuilder = class extends ColumnBuilder {
8861
8980
  foreignKeyConfigs = [];
8862
8981
  static [entityKind] = "PgColumnBuilder";
@@ -9028,35 +9147,36 @@ var PgArray = class PgArray extends PgColumn {
9028
9147
  }
9029
9148
  };
9030
9149
  //#endregion
9031
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/enum.js
9150
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/enum.js
9032
9151
  const isPgEnumSym = Symbol.for("drizzle:isPgEnum");
9033
9152
  function isPgEnum(obj) {
9034
9153
  return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
9035
9154
  }
9036
9155
  //#endregion
9037
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/subquery.js
9156
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/subquery.js
9038
9157
  var Subquery = class {
9039
9158
  static [entityKind] = "Subquery";
9040
- constructor(sql, selection, alias, isWith = false) {
9159
+ constructor(sql, fields, alias, isWith = false, usedTables = []) {
9041
9160
  this._ = {
9042
9161
  brand: "Subquery",
9043
9162
  sql,
9044
- selectedFields: selection,
9163
+ selectedFields: fields,
9045
9164
  alias,
9046
- isWith
9165
+ isWith,
9166
+ usedTables
9047
9167
  };
9048
9168
  }
9049
9169
  };
9050
9170
  //#endregion
9051
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/tracing.js
9171
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/tracing.js
9052
9172
  const tracer = { startActiveSpan(name, fn) {
9053
9173
  return fn();
9054
9174
  } };
9055
9175
  //#endregion
9056
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/view-common.js
9176
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/view-common.js
9057
9177
  const ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
9058
9178
  //#endregion
9059
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/table.js
9179
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/table.js
9060
9180
  const Schema = Symbol.for("drizzle:Schema");
9061
9181
  const Columns = Symbol.for("drizzle:Columns");
9062
9182
  const ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
@@ -9112,7 +9232,7 @@ var Table = class {
9112
9232
  }
9113
9233
  };
9114
9234
  //#endregion
9115
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/sql/sql.js
9235
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/sql/sql.js
9116
9236
  function isSQLWrapper(value) {
9117
9237
  return value !== null && value !== void 0 && typeof value.getSQL === "function";
9118
9238
  }
@@ -9144,11 +9264,17 @@ var StringChunk = class {
9144
9264
  var SQL = class SQL {
9145
9265
  constructor(queryChunks) {
9146
9266
  this.queryChunks = queryChunks;
9267
+ for (const chunk of queryChunks) if (is(chunk, Table)) {
9268
+ const schemaName = chunk[Table.Symbol.Schema];
9269
+ this.usedTables.push(schemaName === void 0 ? chunk[Table.Symbol.Name] : schemaName + "." + chunk[Table.Symbol.Name]);
9270
+ }
9147
9271
  }
9148
9272
  static [entityKind] = "SQL";
9149
9273
  /** @internal */
9150
9274
  decoder = noopDecoder;
9151
9275
  shouldInlineParams = false;
9276
+ /** @internal */
9277
+ usedTables = [];
9152
9278
  append(query) {
9153
9279
  this.queryChunks.push(...query.queryChunks);
9154
9280
  return this;
@@ -9461,15 +9587,16 @@ Subquery.prototype.getSQL = function() {
9461
9587
  return new SQL([this]);
9462
9588
  };
9463
9589
  //#endregion
9464
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/utils.js
9590
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/utils.js
9465
9591
  function getColumnNameAndConfig(a, b) {
9466
9592
  return {
9467
9593
  name: typeof a === "string" && a.length > 0 ? a : "",
9468
9594
  config: typeof a === "object" ? a : b
9469
9595
  };
9470
9596
  }
9597
+ typeof TextDecoder === "undefined" || new TextDecoder();
9471
9598
  //#endregion
9472
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/int.common.js
9599
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/int.common.js
9473
9600
  var PgIntColumnBaseBuilder = class extends PgColumnBuilder {
9474
9601
  static [entityKind] = "PgIntColumnBaseBuilder";
9475
9602
  generatedAlwaysAsIdentity(sequence) {
@@ -9500,7 +9627,7 @@ var PgIntColumnBaseBuilder = class extends PgColumnBuilder {
9500
9627
  }
9501
9628
  };
9502
9629
  //#endregion
9503
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/bigint.js
9630
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/bigint.js
9504
9631
  var PgBigInt53Builder = class extends PgIntColumnBaseBuilder {
9505
9632
  static [entityKind] = "PgBigInt53Builder";
9506
9633
  constructor(name) {
@@ -9546,7 +9673,7 @@ function bigint(a, b) {
9546
9673
  return new PgBigInt64Builder(name);
9547
9674
  }
9548
9675
  //#endregion
9549
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/bigserial.js
9676
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/bigserial.js
9550
9677
  var PgBigSerial53Builder = class extends PgColumnBuilder {
9551
9678
  static [entityKind] = "PgBigSerial53Builder";
9552
9679
  constructor(name) {
@@ -9595,7 +9722,7 @@ function bigserial(a, b) {
9595
9722
  return new PgBigSerial64Builder(name);
9596
9723
  }
9597
9724
  //#endregion
9598
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/boolean.js
9725
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/boolean.js
9599
9726
  var PgBooleanBuilder = class extends PgColumnBuilder {
9600
9727
  static [entityKind] = "PgBooleanBuilder";
9601
9728
  constructor(name) {
@@ -9616,7 +9743,7 @@ function boolean(name) {
9616
9743
  return new PgBooleanBuilder(name ?? "");
9617
9744
  }
9618
9745
  //#endregion
9619
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/char.js
9746
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/char.js
9620
9747
  var PgCharBuilder = class extends PgColumnBuilder {
9621
9748
  static [entityKind] = "PgCharBuilder";
9622
9749
  constructor(name, config) {
@@ -9642,7 +9769,7 @@ function char(a, b = {}) {
9642
9769
  return new PgCharBuilder(name, config);
9643
9770
  }
9644
9771
  //#endregion
9645
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/cidr.js
9772
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/cidr.js
9646
9773
  var PgCidrBuilder = class extends PgColumnBuilder {
9647
9774
  static [entityKind] = "PgCidrBuilder";
9648
9775
  constructor(name) {
@@ -9663,7 +9790,7 @@ function cidr(name) {
9663
9790
  return new PgCidrBuilder(name ?? "");
9664
9791
  }
9665
9792
  //#endregion
9666
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/custom.js
9793
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/custom.js
9667
9794
  var PgCustomColumnBuilder = class extends PgColumnBuilder {
9668
9795
  static [entityKind] = "PgCustomColumnBuilder";
9669
9796
  constructor(name, fieldConfig, customTypeParams) {
@@ -9704,7 +9831,7 @@ function customType(customTypeParams) {
9704
9831
  };
9705
9832
  }
9706
9833
  //#endregion
9707
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/date.common.js
9834
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/date.common.js
9708
9835
  var PgDateColumnBaseBuilder = class extends PgColumnBuilder {
9709
9836
  static [entityKind] = "PgDateColumnBaseBuilder";
9710
9837
  defaultNow() {
@@ -9712,7 +9839,7 @@ var PgDateColumnBaseBuilder = class extends PgColumnBuilder {
9712
9839
  }
9713
9840
  };
9714
9841
  //#endregion
9715
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/date.js
9842
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/date.js
9716
9843
  var PgDateBuilder = class extends PgDateColumnBaseBuilder {
9717
9844
  static [entityKind] = "PgDateBuilder";
9718
9845
  constructor(name) {
@@ -9729,7 +9856,8 @@ var PgDate = class extends PgColumn {
9729
9856
  return "date";
9730
9857
  }
9731
9858
  mapFromDriverValue(value) {
9732
- return new Date(value);
9859
+ if (typeof value === "string") return new Date(value);
9860
+ return value;
9733
9861
  }
9734
9862
  mapToDriverValue(value) {
9735
9863
  return value.toISOString();
@@ -9750,6 +9878,10 @@ var PgDateString = class extends PgColumn {
9750
9878
  getSQLType() {
9751
9879
  return "date";
9752
9880
  }
9881
+ mapFromDriverValue(value) {
9882
+ if (typeof value === "string") return value;
9883
+ return value.toISOString().slice(0, -14);
9884
+ }
9753
9885
  };
9754
9886
  function date(a, b) {
9755
9887
  const { name, config } = getColumnNameAndConfig(a, b);
@@ -9757,7 +9889,7 @@ function date(a, b) {
9757
9889
  return new PgDateStringBuilder(name);
9758
9890
  }
9759
9891
  //#endregion
9760
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/double-precision.js
9892
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/double-precision.js
9761
9893
  var PgDoublePrecisionBuilder = class extends PgColumnBuilder {
9762
9894
  static [entityKind] = "PgDoublePrecisionBuilder";
9763
9895
  constructor(name) {
@@ -9782,7 +9914,7 @@ function doublePrecision(name) {
9782
9914
  return new PgDoublePrecisionBuilder(name ?? "");
9783
9915
  }
9784
9916
  //#endregion
9785
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/inet.js
9917
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/inet.js
9786
9918
  var PgInetBuilder = class extends PgColumnBuilder {
9787
9919
  static [entityKind] = "PgInetBuilder";
9788
9920
  constructor(name) {
@@ -9803,7 +9935,7 @@ function inet(name) {
9803
9935
  return new PgInetBuilder(name ?? "");
9804
9936
  }
9805
9937
  //#endregion
9806
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/integer.js
9938
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/integer.js
9807
9939
  var PgIntegerBuilder = class extends PgIntColumnBaseBuilder {
9808
9940
  static [entityKind] = "PgIntegerBuilder";
9809
9941
  constructor(name) {
@@ -9828,7 +9960,7 @@ function integer(name) {
9828
9960
  return new PgIntegerBuilder(name ?? "");
9829
9961
  }
9830
9962
  //#endregion
9831
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/interval.js
9963
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/interval.js
9832
9964
  var PgIntervalBuilder = class extends PgColumnBuilder {
9833
9965
  static [entityKind] = "PgIntervalBuilder";
9834
9966
  constructor(name, intervalConfig) {
@@ -9853,7 +9985,7 @@ function interval(a, b = {}) {
9853
9985
  return new PgIntervalBuilder(name, config);
9854
9986
  }
9855
9987
  //#endregion
9856
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/json.js
9988
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/json.js
9857
9989
  var PgJsonBuilder = class extends PgColumnBuilder {
9858
9990
  static [entityKind] = "PgJsonBuilder";
9859
9991
  constructor(name) {
@@ -9888,7 +10020,7 @@ function json(name) {
9888
10020
  return new PgJsonBuilder(name ?? "");
9889
10021
  }
9890
10022
  //#endregion
9891
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/jsonb.js
10023
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/jsonb.js
9892
10024
  var PgJsonbBuilder = class extends PgColumnBuilder {
9893
10025
  static [entityKind] = "PgJsonbBuilder";
9894
10026
  constructor(name) {
@@ -9923,7 +10055,7 @@ function jsonb(name) {
9923
10055
  return new PgJsonbBuilder(name ?? "");
9924
10056
  }
9925
10057
  //#endregion
9926
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/line.js
10058
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/line.js
9927
10059
  var PgLineBuilder = class extends PgColumnBuilder {
9928
10060
  static [entityKind] = "PgLineBuilder";
9929
10061
  constructor(name) {
@@ -9984,7 +10116,7 @@ function line(a, b) {
9984
10116
  return new PgLineABCBuilder(name);
9985
10117
  }
9986
10118
  //#endregion
9987
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/macaddr.js
10119
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/macaddr.js
9988
10120
  var PgMacaddrBuilder = class extends PgColumnBuilder {
9989
10121
  static [entityKind] = "PgMacaddrBuilder";
9990
10122
  constructor(name) {
@@ -10005,7 +10137,7 @@ function macaddr(name) {
10005
10137
  return new PgMacaddrBuilder(name ?? "");
10006
10138
  }
10007
10139
  //#endregion
10008
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/macaddr8.js
10140
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/macaddr8.js
10009
10141
  var PgMacaddr8Builder = class extends PgColumnBuilder {
10010
10142
  static [entityKind] = "PgMacaddr8Builder";
10011
10143
  constructor(name) {
@@ -10026,7 +10158,7 @@ function macaddr8(name) {
10026
10158
  return new PgMacaddr8Builder(name ?? "");
10027
10159
  }
10028
10160
  //#endregion
10029
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/numeric.js
10161
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/numeric.js
10030
10162
  var PgNumericBuilder = class extends PgColumnBuilder {
10031
10163
  static [entityKind] = "PgNumericBuilder";
10032
10164
  constructor(name, precision, scale) {
@@ -10125,7 +10257,7 @@ function numeric(a, b) {
10125
10257
  return mode === "number" ? new PgNumericNumberBuilder(name, config?.precision, config?.scale) : mode === "bigint" ? new PgNumericBigIntBuilder(name, config?.precision, config?.scale) : new PgNumericBuilder(name, config?.precision, config?.scale);
10126
10258
  }
10127
10259
  //#endregion
10128
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/point.js
10260
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/point.js
10129
10261
  var PgPointTupleBuilder = class extends PgColumnBuilder {
10130
10262
  static [entityKind] = "PgPointTupleBuilder";
10131
10263
  constructor(name) {
@@ -10187,7 +10319,7 @@ function point(a, b) {
10187
10319
  return new PgPointObjectBuilder(name);
10188
10320
  }
10189
10321
  //#endregion
10190
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
10322
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
10191
10323
  function hexToBytes(hex) {
10192
10324
  const bytes = [];
10193
10325
  for (let c = 0; c < hex.length; c += 2) bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
@@ -10220,7 +10352,7 @@ function parseEWKB(hex) {
10220
10352
  throw new Error("Unsupported geometry type");
10221
10353
  }
10222
10354
  //#endregion
10223
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/postgis_extension/geometry.js
10355
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/postgis_extension/geometry.js
10224
10356
  var PgGeometryBuilder = class extends PgColumnBuilder {
10225
10357
  static [entityKind] = "PgGeometryBuilder";
10226
10358
  constructor(name) {
@@ -10275,7 +10407,7 @@ function geometry(a, b) {
10275
10407
  return new PgGeometryObjectBuilder(name);
10276
10408
  }
10277
10409
  //#endregion
10278
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/real.js
10410
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/real.js
10279
10411
  var PgRealBuilder = class extends PgColumnBuilder {
10280
10412
  static [entityKind] = "PgRealBuilder";
10281
10413
  constructor(name, length) {
@@ -10304,7 +10436,7 @@ function real(name) {
10304
10436
  return new PgRealBuilder(name ?? "");
10305
10437
  }
10306
10438
  //#endregion
10307
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/serial.js
10439
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/serial.js
10308
10440
  var PgSerialBuilder = class extends PgColumnBuilder {
10309
10441
  static [entityKind] = "PgSerialBuilder";
10310
10442
  constructor(name) {
@@ -10327,7 +10459,7 @@ function serial(name) {
10327
10459
  return new PgSerialBuilder(name ?? "");
10328
10460
  }
10329
10461
  //#endregion
10330
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/smallint.js
10462
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/smallint.js
10331
10463
  var PgSmallIntBuilder = class extends PgIntColumnBaseBuilder {
10332
10464
  static [entityKind] = "PgSmallIntBuilder";
10333
10465
  constructor(name) {
@@ -10352,7 +10484,7 @@ function smallint(name) {
10352
10484
  return new PgSmallIntBuilder(name ?? "");
10353
10485
  }
10354
10486
  //#endregion
10355
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/smallserial.js
10487
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/smallserial.js
10356
10488
  var PgSmallSerialBuilder = class extends PgColumnBuilder {
10357
10489
  static [entityKind] = "PgSmallSerialBuilder";
10358
10490
  constructor(name) {
@@ -10375,7 +10507,7 @@ function smallserial(name) {
10375
10507
  return new PgSmallSerialBuilder(name ?? "");
10376
10508
  }
10377
10509
  //#endregion
10378
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/text.js
10510
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/text.js
10379
10511
  var PgTextBuilder = class extends PgColumnBuilder {
10380
10512
  static [entityKind] = "PgTextBuilder";
10381
10513
  constructor(name, config) {
@@ -10399,7 +10531,7 @@ function text$1(a, b = {}) {
10399
10531
  return new PgTextBuilder(name, config);
10400
10532
  }
10401
10533
  //#endregion
10402
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/time.js
10534
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/time.js
10403
10535
  var PgTimeBuilder = class extends PgDateColumnBaseBuilder {
10404
10536
  constructor(name, withTimezone, precision) {
10405
10537
  super(name, "string", "PgTime");
@@ -10432,7 +10564,7 @@ function time(a, b = {}) {
10432
10564
  return new PgTimeBuilder(name, config.withTimezone ?? false, config.precision);
10433
10565
  }
10434
10566
  //#endregion
10435
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/timestamp.js
10567
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/timestamp.js
10436
10568
  var PgTimestampBuilder = class extends PgDateColumnBaseBuilder {
10437
10569
  static [entityKind] = "PgTimestampBuilder";
10438
10570
  constructor(name, withTimezone, precision) {
@@ -10457,9 +10589,10 @@ var PgTimestamp = class extends PgColumn {
10457
10589
  getSQLType() {
10458
10590
  return `timestamp${this.precision === void 0 ? "" : ` (${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
10459
10591
  }
10460
- mapFromDriverValue = (value) => {
10461
- return new Date(this.withTimezone ? value : value + "+0000");
10462
- };
10592
+ mapFromDriverValue(value) {
10593
+ if (typeof value === "string") return new Date(this.withTimezone ? value : value + "+0000");
10594
+ return value;
10595
+ }
10463
10596
  mapToDriverValue = (value) => {
10464
10597
  return value.toISOString();
10465
10598
  };
@@ -10488,6 +10621,15 @@ var PgTimestampString = class extends PgColumn {
10488
10621
  getSQLType() {
10489
10622
  return `timestamp${this.precision === void 0 ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
10490
10623
  }
10624
+ mapFromDriverValue(value) {
10625
+ if (typeof value === "string") return value;
10626
+ const shortened = value.toISOString().slice(0, -1).replace("T", " ");
10627
+ if (this.withTimezone) {
10628
+ const offset = value.getTimezoneOffset();
10629
+ return `${shortened}${offset <= 0 ? "+" : "-"}${Math.floor(Math.abs(offset) / 60).toString().padStart(2, "0")}`;
10630
+ }
10631
+ return shortened;
10632
+ }
10491
10633
  };
10492
10634
  function timestamp(a, b = {}) {
10493
10635
  const { name, config } = getColumnNameAndConfig(a, b);
@@ -10495,7 +10637,7 @@ function timestamp(a, b = {}) {
10495
10637
  return new PgTimestampBuilder(name, config?.withTimezone ?? false, config?.precision);
10496
10638
  }
10497
10639
  //#endregion
10498
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/uuid.js
10640
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/uuid.js
10499
10641
  var PgUUIDBuilder = class extends PgColumnBuilder {
10500
10642
  static [entityKind] = "PgUUIDBuilder";
10501
10643
  constructor(name) {
@@ -10522,7 +10664,7 @@ function uuid(name) {
10522
10664
  return new PgUUIDBuilder(name ?? "");
10523
10665
  }
10524
10666
  //#endregion
10525
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/varchar.js
10667
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/varchar.js
10526
10668
  var PgVarcharBuilder = class extends PgColumnBuilder {
10527
10669
  static [entityKind] = "PgVarcharBuilder";
10528
10670
  constructor(name, config) {
@@ -10548,7 +10690,7 @@ function varchar(a, b = {}) {
10548
10690
  return new PgVarcharBuilder(name, config);
10549
10691
  }
10550
10692
  //#endregion
10551
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/vector_extension/bit.js
10693
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/vector_extension/bit.js
10552
10694
  var PgBinaryVectorBuilder = class extends PgColumnBuilder {
10553
10695
  static [entityKind] = "PgBinaryVectorBuilder";
10554
10696
  constructor(name, config) {
@@ -10572,7 +10714,7 @@ function bit(a, b) {
10572
10714
  return new PgBinaryVectorBuilder(name, config);
10573
10715
  }
10574
10716
  //#endregion
10575
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/vector_extension/halfvec.js
10717
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/vector_extension/halfvec.js
10576
10718
  var PgHalfVectorBuilder = class extends PgColumnBuilder {
10577
10719
  static [entityKind] = "PgHalfVectorBuilder";
10578
10720
  constructor(name, config) {
@@ -10602,7 +10744,7 @@ function halfvec(a, b) {
10602
10744
  return new PgHalfVectorBuilder(name, config);
10603
10745
  }
10604
10746
  //#endregion
10605
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/vector_extension/sparsevec.js
10747
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/vector_extension/sparsevec.js
10606
10748
  var PgSparseVectorBuilder = class extends PgColumnBuilder {
10607
10749
  static [entityKind] = "PgSparseVectorBuilder";
10608
10750
  constructor(name, config) {
@@ -10626,7 +10768,7 @@ function sparsevec(a, b) {
10626
10768
  return new PgSparseVectorBuilder(name, config);
10627
10769
  }
10628
10770
  //#endregion
10629
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/vector_extension/vector.js
10771
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/vector_extension/vector.js
10630
10772
  var PgVectorBuilder = class extends PgColumnBuilder {
10631
10773
  static [entityKind] = "PgVectorBuilder";
10632
10774
  constructor(name, config) {
@@ -10656,7 +10798,7 @@ function vector(a, b) {
10656
10798
  return new PgVectorBuilder(name, config);
10657
10799
  }
10658
10800
  //#endregion
10659
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/columns/all.js
10801
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/columns/all.js
10660
10802
  function getPgColumnBuilders() {
10661
10803
  return {
10662
10804
  bigint,
@@ -10694,7 +10836,7 @@ function getPgColumnBuilders() {
10694
10836
  };
10695
10837
  }
10696
10838
  //#endregion
10697
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/table.js
10839
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/table.js
10698
10840
  const InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
10699
10841
  const EnableRLS = Symbol.for("drizzle:EnableRLS");
10700
10842
  var PgTable = class extends Table {
@@ -10741,7 +10883,7 @@ const pgTable = (name, columns, extraConfig) => {
10741
10883
  return pgTableWithSchema(name, columns, extraConfig, void 0);
10742
10884
  };
10743
10885
  //#endregion
10744
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/primary-keys.js
10886
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/primary-keys.js
10745
10887
  function primaryKey(...config) {
10746
10888
  if (config[0].columns) return new PrimaryKeyBuilder(config[0].columns, config[0].name);
10747
10889
  return new PrimaryKeyBuilder(config);
@@ -10775,7 +10917,7 @@ var PrimaryKey = class {
10775
10917
  }
10776
10918
  };
10777
10919
  //#endregion
10778
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/checks.js
10920
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/checks.js
10779
10921
  var CheckBuilder = class {
10780
10922
  constructor(name, value) {
10781
10923
  this.name = name;
@@ -10802,7 +10944,7 @@ function check(name, value) {
10802
10944
  return new CheckBuilder(name, value);
10803
10945
  }
10804
10946
  //#endregion
10805
- //#region ../../node_modules/.bun/drizzle-orm@0.43.1+b353dece7074011f/node_modules/drizzle-orm/pg-core/indexes.js
10947
+ //#region ../../node_modules/.bun/drizzle-orm@0.45.2+68d1edb702579b07/node_modules/drizzle-orm/pg-core/indexes.js
10806
10948
  var IndexBuilderOn = class {
10807
10949
  constructor(unique, name) {
10808
10950
  this.unique = unique;
@@ -10973,8 +11115,6 @@ _enum(WEBHOOK_OPERATION_KINDS);
10973
11115
  _enum(WEBHOOK_OPERATION_STATES);
10974
11116
  string().trim().min(1).transform((email) => email.toLowerCase()).brand();
10975
11117
  union([number(), string().trim().min(1)]).transform((value) => Number(value)).pipe(number().int().nonnegative()).brand();
10976
- h("InvalidBillingOverrideEmail")();
10977
- h("InvalidNonnegativeAllowance")();
10978
11118
  const sqlStringLiteral = (value) => `'${value.replaceAll("'", "''")}'`;
10979
11119
  const sqlStringList = (values) => sql.raw(values.map(sqlStringLiteral).join(", "));
10980
11120
  const sqlCheckIn = (column, values) => sql`${column} in (${sqlStringList(values)})`;
@@ -11367,8 +11507,6 @@ pgTable("linkedin_connections", {
11367
11507
  connectedAt: timestamptz("connected_at"),
11368
11508
  createdAt: timestamptz("created_at").notNull().defaultNow()
11369
11509
  }, (table) => [uniqueIndex("linkedin_connections_of_profile_key").on(table.ofProfileId, table.profileId), index("linkedin_connections_profile_idx").on(table.profileId)]);
11370
- h("ProfileStoreUnavailable")();
11371
- h("InvalidProfileRow")();
11372
11510
  //#endregion
11373
11511
  //#region ../../packages/lib/src/url.ts
11374
11512
  const stripTrailingSlashes = (value) => value.replace(/\/+$/, "");
@@ -11379,7 +11517,7 @@ const absoluteURLPathPattern = /^[a-z][a-z0-9+.-]*:/i;
11379
11517
  const protocolRelativeURLPathPattern = /^\/\//;
11380
11518
  const unsafeRelativeURLPathMessage = "createURL: path must be relative, not absolute or protocol-relative";
11381
11519
  /** Returned when a URL path is absolute or protocol-relative instead of relative. */
11382
- var InvalidRelativeURLPath = class extends h("InvalidRelativeURLPath")() {
11520
+ var InvalidRelativeURLPath = class extends h("InvalidRelativeURLPath") {
11383
11521
  constructor({ path }) {
11384
11522
  super({
11385
11523
  path,
@@ -11387,7 +11525,7 @@ var InvalidRelativeURLPath = class extends h("InvalidRelativeURLPath")() {
11387
11525
  });
11388
11526
  }
11389
11527
  };
11390
- var InvalidBaseURL = class extends h("InvalidBaseURL")() {
11528
+ var InvalidBaseURL = class extends h("InvalidBaseURL") {
11391
11529
  constructor({ baseURL }) {
11392
11530
  super({
11393
11531
  baseURL,
@@ -11398,25 +11536,24 @@ var InvalidBaseURL = class extends h("InvalidBaseURL")() {
11398
11536
  /** Parse a path that is safe to resolve against a caller-provided base URL. */
11399
11537
  const parseRelativeURLPath = (path) => {
11400
11538
  const trimmedPath = path.trimStart();
11401
- if (absoluteURLPathPattern.test(trimmedPath) || protocolRelativeURLPathPattern.test(trimmedPath)) return G.err(new InvalidRelativeURLPath({ path }));
11402
- return G.ok(stripLeadingSlashes(path));
11539
+ if (absoluteURLPathPattern.test(trimmedPath) || protocolRelativeURLPathPattern.test(trimmedPath)) return ae.err(new InvalidRelativeURLPath({ path }));
11540
+ return ae.ok(stripLeadingSlashes(path));
11403
11541
  };
11404
11542
  const createURLResult = (baseURL, path) => {
11405
11543
  const parsedPath = parseRelativeURLPath(path);
11406
- if (G.isError(parsedPath)) return G.err(parsedPath.error);
11544
+ if (ae.isError(parsedPath)) return ae.err(parsedPath.error);
11407
11545
  try {
11408
- return G.ok(new URL(parsedPath.value, ensureTrailingSlash(stripTrailingSlashes(baseURL.toString()))));
11546
+ return ae.ok(new URL(parsedPath.value, ensureTrailingSlash(stripTrailingSlashes(baseURL.toString()))));
11409
11547
  } catch {
11410
- return G.err(new InvalidBaseURL({ baseURL: baseURL.toString() }));
11548
+ return ae.err(new InvalidBaseURL({ baseURL: baseURL.toString() }));
11411
11549
  }
11412
11550
  };
11413
11551
  const createURL = (baseURL, path) => {
11414
11552
  const url = createURLResult(baseURL, path);
11415
- if (G.isError(url)) throw url.error;
11553
+ if (ae.isError(url)) throw url.error;
11416
11554
  return url.value;
11417
11555
  };
11418
11556
  const createAbsoluteURL = (baseURL, path) => createURL(baseURL, path).toString();
11419
- h("MissingPathTemplateParam")();
11420
11557
  //#endregion
11421
11558
  //#region ../../node_modules/.bun/ky@2.0.2/node_modules/ky/distribution/errors/KyError.js
11422
11559
  /**
@@ -12060,7 +12197,7 @@ const hasSearchParameters = (search) => {
12060
12197
  //#endregion
12061
12198
  //#region ../../node_modules/.bun/ky@2.0.2/node_modules/ky/distribution/utils/is-network-error.js
12062
12199
  const objectToString$2 = Object.prototype.toString;
12063
- const isError$1 = (value) => objectToString$2.call(value) === "[object Error]";
12200
+ const isError$2 = (value) => objectToString$2.call(value) === "[object Error]";
12064
12201
  const errorMessages = /* @__PURE__ */ new Set([
12065
12202
  "network error",
12066
12203
  "NetworkError when attempting to fetch resource.",
@@ -12072,7 +12209,7 @@ const errorMessages = /* @__PURE__ */ new Set([
12072
12209
  "Network connection lost"
12073
12210
  ]);
12074
12211
  function isRawNetworkError(error) {
12075
- if (!(error && isError$1(error) && error.name === "TypeError" && typeof error.message === "string")) return false;
12212
+ if (!(error && isError$2(error) && error.name === "TypeError" && typeof error.message === "string")) return false;
12076
12213
  const { message, stack } = error;
12077
12214
  if (message === "Load failed") return stack === void 0 || "__sentry_captured__" in error;
12078
12215
  if (message.startsWith("error sending request for url")) return true;
@@ -12703,8 +12840,6 @@ object({
12703
12840
  status: number(),
12704
12841
  type: string()
12705
12842
  });
12706
- h("UnipileAPIError")();
12707
- h("UnipileHostedAuthURLMissingError")();
12708
12843
  looseObject({
12709
12844
  object: literal("HostedAuthLink"),
12710
12845
  link: string()
@@ -12740,7 +12875,7 @@ const SocialTargetPrefixes = {
12740
12875
  company_id: "company",
12741
12876
  request_id: "request"
12742
12877
  };
12743
- var InvalidSocialSelector = class extends h("InvalidSocialSelector")() {
12878
+ var InvalidSocialSelector = class extends h("InvalidSocialSelector") {
12744
12879
  constructor({ value, reason }) {
12745
12880
  super({
12746
12881
  value,
@@ -12801,42 +12936,40 @@ const linkedInURNKindFrom = (value) => {
12801
12936
  };
12802
12937
  const parseTypedSocialSelector = (value, options = {}) => {
12803
12938
  const parsed = parseTypedSocialSelectorResult(value, options);
12804
- return G.isOk(parsed) ? parsed.value : void 0;
12939
+ return ae.isOk(parsed) ? parsed.value : void 0;
12805
12940
  };
12806
12941
  const parseTypedSocialSelectorResult = (value, options = {}) => {
12807
12942
  const trimmed = value.trim();
12808
12943
  const colon = trimmed.indexOf(":");
12809
- if (colon <= 0) return G.err(new InvalidSocialSelector({
12944
+ if (colon <= 0) return ae.err(new InvalidSocialSelector({
12810
12945
  value,
12811
12946
  reason: "missing-prefix"
12812
12947
  }));
12813
12948
  const prefix = trimmed.slice(0, colon);
12814
- if (!isSocialTargetPrefix(prefix)) return G.err(new InvalidSocialSelector({
12949
+ if (!isSocialTargetPrefix(prefix)) return ae.err(new InvalidSocialSelector({
12815
12950
  value,
12816
12951
  reason: "unsupported-prefix"
12817
12952
  }));
12818
- if (options.prefixes && !options.prefixes.includes(prefix)) return G.err(new InvalidSocialSelector({
12953
+ if (options.prefixes && !options.prefixes.includes(prefix)) return ae.err(new InvalidSocialSelector({
12819
12954
  value,
12820
12955
  reason: "disallowed-prefix"
12821
12956
  }));
12822
12957
  const id = trimmed.slice(colon + 1).trim();
12823
- if (options.idMode === "lenient") return G.ok({
12958
+ if (options.idMode === "lenient") return ae.ok({
12824
12959
  prefix,
12825
12960
  kind: SocialTargetPrefixes[prefix],
12826
12961
  id
12827
12962
  });
12828
12963
  const parsed = plainResourceIdSchema(prefix).safeParse(id);
12829
- return parsed.success ? G.ok({
12964
+ return parsed.success ? ae.ok({
12830
12965
  prefix,
12831
12966
  kind: SocialTargetPrefixes[prefix],
12832
12967
  id: parsed.data
12833
- }) : G.err(new InvalidSocialSelector({
12968
+ }) : ae.err(new InvalidSocialSelector({
12834
12969
  value,
12835
12970
  reason: "invalid-id"
12836
12971
  }));
12837
12972
  };
12838
- h("InvalidLinkedinUpstreamPlanInput")();
12839
- h("InvalidUnipileCredentials")();
12840
12973
  //#endregion
12841
12974
  //#region ../../packages/linkedin/src/profiles.ts
12842
12975
  const displayNameFrom = (firstName, lastName, username) => [firstName, lastName].filter(Boolean).join(" ").trim() || username || "";
@@ -12955,8 +13088,6 @@ looseObject({
12955
13088
  data: array(GroupParticipant),
12956
13089
  next_cursor: string().nullish()
12957
13090
  });
12958
- h("ChatListParseError")();
12959
- h("ChatParticipantsFetchError")();
12960
13091
  const dropLinkedinInmailEligibility = (value) => {
12961
13092
  if (Array.isArray(value)) {
12962
13093
  let changed = false;
@@ -14963,7 +15094,7 @@ const isoDatePattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
14963
15094
  const isoDateTimePattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])T([01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d{1,3})?)?(?:Z|[+-]([01]\d|2[0-3]):[0-5]\d)?$/;
14964
15095
  const timezonePattern = /(Z|[+-]\d{2}:\d{2})$/;
14965
15096
  const invalidSinceMessage = "Invalid --since value. Use an ISO 8601 date like 2026-05-04 or datetime like 2026-05-04T00:00:00Z.";
14966
- var InvalidSince = class extends h("InvalidSince")() {
15097
+ var InvalidSince = class extends h("InvalidSince") {
14967
15098
  constructor(input) {
14968
15099
  super({
14969
15100
  input,
@@ -14991,23 +15122,23 @@ const parseSinceResult = (input) => {
14991
15122
  const isISODateTime = isoDateTimePattern.test(value);
14992
15123
  const normalized = isISODateTime && !timezonePattern.test(value) ? `${value}Z` : value;
14993
15124
  const parsed = (isISODate || isISODateTime) && hasValidDate(value) ? Date.parse(normalized) : NaN;
14994
- if (Number.isNaN(parsed)) return G.err(new InvalidSince(input));
14995
- return G.ok(parsed);
15125
+ if (Number.isNaN(parsed)) return ae.err(new InvalidSince(input));
15126
+ return ae.ok(parsed);
14996
15127
  };
14997
15128
  //#endregion
14998
15129
  //#region ../../packages/linkedin/src/cli/sync-plan.ts
14999
- var UnknownLinkedinSyncCollection = class extends h("UnknownLinkedinSyncCollection")() {};
15000
- var LinkedinSyncResetRequiresCollection = class extends h("LinkedinSyncResetRequiresCollection")() {
15130
+ var UnknownLinkedinSyncCollection = class extends h("UnknownLinkedinSyncCollection") {};
15131
+ var LinkedinSyncResetRequiresCollection = class extends h("LinkedinSyncResetRequiresCollection") {
15001
15132
  constructor() {
15002
15133
  super({ message: "--reset requires a collection" });
15003
15134
  }
15004
15135
  };
15005
- var LinkedinSyncResetWithSince = class extends h("LinkedinSyncResetWithSince")() {
15136
+ var LinkedinSyncResetWithSince = class extends h("LinkedinSyncResetWithSince") {
15006
15137
  constructor() {
15007
15138
  super({ message: "--reset cannot be combined with --since" });
15008
15139
  }
15009
15140
  };
15010
- var LinkedinSyncUnsupportedSince = class extends h("LinkedinSyncUnsupportedSince")() {
15141
+ var LinkedinSyncUnsupportedSince = class extends h("LinkedinSyncUnsupportedSince") {
15011
15142
  constructor(collection) {
15012
15143
  super({
15013
15144
  collection,
@@ -15015,7 +15146,7 @@ var LinkedinSyncUnsupportedSince = class extends h("LinkedinSyncUnsupportedSince
15015
15146
  });
15016
15147
  }
15017
15148
  };
15018
- var LinkedinSyncMissingInitialFullSync = class extends h("LinkedinSyncMissingInitialFullSync")() {
15149
+ var LinkedinSyncMissingInitialFullSync = class extends h("LinkedinSyncMissingInitialFullSync") {
15019
15150
  constructor(collection) {
15020
15151
  super({
15021
15152
  collection,
@@ -15023,36 +15154,36 @@ var LinkedinSyncMissingInitialFullSync = class extends h("LinkedinSyncMissingIni
15023
15154
  });
15024
15155
  }
15025
15156
  };
15026
- var InvalidLinkedinSyncSince = class extends h("InvalidLinkedinSyncSince")() {};
15157
+ var InvalidLinkedinSyncSince = class extends h("InvalidLinkedinSyncSince") {};
15027
15158
  const linkedinSyncCollectionShortName = (collection) => collection.key.replace(/^(x|li)_/, "");
15028
15159
  const linkedinSyncCollectionFor = (collections, collection) => {
15029
15160
  const found = collections.find((candidate) => linkedinSyncCollectionShortName(candidate) === collection || candidate.key === collection);
15030
- if (found) return G.ok(found);
15161
+ if (found) return ae.ok(found);
15031
15162
  const available = collections.map(linkedinSyncCollectionShortName);
15032
- return G.err(new UnknownLinkedinSyncCollection({
15163
+ return ae.err(new UnknownLinkedinSyncCollection({
15033
15164
  collection,
15034
15165
  available,
15035
15166
  message: `Unknown collection "${collection}". Available: ${available.join(", ")}`
15036
15167
  }));
15037
15168
  };
15038
15169
  const planLinkedinSyncCommand = ({ args, collections, cursorState }) => {
15039
- if (!args.collection) return args.reset === true ? G.err(new LinkedinSyncResetRequiresCollection()) : G.ok({ mode: "list" });
15170
+ if (!args.collection) return args.reset === true ? ae.err(new LinkedinSyncResetRequiresCollection()) : ae.ok({ mode: "list" });
15040
15171
  const collection = linkedinSyncCollectionFor(collections, String(args.collection));
15041
- if (G.isError(collection)) return G.err(collection.error);
15042
- if (args.reset === true) return args.since == null ? G.ok({
15172
+ if (ae.isError(collection)) return ae.err(collection.error);
15173
+ if (args.reset === true) return args.since == null ? ae.ok({
15043
15174
  mode: "reset",
15044
15175
  collection: collection.value
15045
- }) : G.err(new LinkedinSyncResetWithSince());
15046
- if (args.since == null) return G.ok({
15176
+ }) : ae.err(new LinkedinSyncResetWithSince());
15177
+ if (args.since == null) return ae.ok({
15047
15178
  mode: "run",
15048
15179
  collection: collection.value
15049
15180
  });
15050
15181
  const shortName = linkedinSyncCollectionShortName(collection.value);
15051
- if (!collection.value.sinceField) return G.err(new LinkedinSyncUnsupportedSince(shortName));
15052
- if (collection.value.requiresFullInitialSync && cursorState?.lastSynced == null) return G.err(new LinkedinSyncMissingInitialFullSync(shortName));
15182
+ if (!collection.value.sinceField) return ae.err(new LinkedinSyncUnsupportedSince(shortName));
15183
+ if (collection.value.requiresFullInitialSync && cursorState?.lastSynced == null) return ae.err(new LinkedinSyncMissingInitialFullSync(shortName));
15053
15184
  const parsedSince = parseSinceResult(String(args.since));
15054
- if (G.isError(parsedSince)) return G.err(new InvalidLinkedinSyncSince({ message: parsedSince.error.message }));
15055
- return G.ok({
15185
+ if (ae.isError(parsedSince)) return ae.err(new InvalidLinkedinSyncSince({ message: parsedSince.error.message }));
15186
+ return ae.ok({
15056
15187
  mode: "run",
15057
15188
  collection: collection.value,
15058
15189
  since: parsedSince.value
@@ -15483,7 +15614,7 @@ const buildSync$1 = (deps, platform) => defineCommand({
15483
15614
  }
15484
15615
  })() : void 0
15485
15616
  });
15486
- if (G.isError(plan)) throw new UsageError(plan.error.message);
15617
+ if (ae.isError(plan)) throw new UsageError(plan.error.message);
15487
15618
  if (plan.value.mode === "list") {
15488
15619
  const cache = openLinkedinCache({
15489
15620
  platform,
@@ -15560,7 +15691,7 @@ const buildSync$1 = (deps, platform) => defineCommand({
15560
15691
  if (rateLimitError) throw rateLimitError;
15561
15692
  throw error;
15562
15693
  }
15563
- if (G.isError(result)) {
15694
+ if (ae.isError(result)) {
15564
15695
  progress.error();
15565
15696
  const rateLimitError = enrichRateLimitSyncError$1({
15566
15697
  error: result.error,
@@ -15669,7 +15800,7 @@ const buildSql$1 = (deps, platform) => defineCommand({
15669
15800
  } catch (error) {
15670
15801
  throw new UsageError(`Query failed (cache is read-only): ${error instanceof Error ? error.message : String(error)}`);
15671
15802
  }
15672
- if (G.isError(result)) throw new UsageError(`Query failed (cache is read-only): ${result.error.message}`);
15803
+ if (ae.isError(result)) throw new UsageError(`Query failed (cache is read-only): ${result.error.message}`);
15673
15804
  await deps.printResult({
15674
15805
  account: res.account,
15675
15806
  contract,
@@ -19729,7 +19860,7 @@ const contractFor$1 = (op, commandName, group) => buildRuntimeContract(xRuntimeA
19729
19860
  const defineOperationCommand = (op, deps) => defineRuntimeOperationCommand(xRuntimeAdapter, op, deps);
19730
19861
  //#endregion
19731
19862
  //#region ../../packages/x/src/cli/sync-plan.ts
19732
- var XSyncPlanError = class extends h("XSyncPlanError")() {
19863
+ var XSyncPlanError = class extends h("XSyncPlanError") {
19733
19864
  constructor(args) {
19734
19865
  super(args);
19735
19866
  this.name = "XSyncPlanError";
@@ -19738,30 +19869,30 @@ var XSyncPlanError = class extends h("XSyncPlanError")() {
19738
19869
  const shortSyncCollectionName = (collection) => collection.key.replace(/^(x|li)_/, "");
19739
19870
  const findSyncCollection = (collections, input) => collections.find((collection) => shortSyncCollectionName(collection) === input || collection.key === input);
19740
19871
  const parseTimeoutSeconds = (value) => {
19741
- if (value == null) return G.ok(void 0);
19872
+ if (value == null) return ae.ok(void 0);
19742
19873
  const timeoutSeconds = Number(value);
19743
- if (!Number.isInteger(timeoutSeconds) || timeoutSeconds < 1) return G.err(new XSyncPlanError({
19874
+ if (!Number.isInteger(timeoutSeconds) || timeoutSeconds < 1) return ae.err(new XSyncPlanError({
19744
19875
  kind: "invalid-timeout",
19745
19876
  message: "--timeout must be at least 1."
19746
19877
  }));
19747
- return G.ok(timeoutSeconds);
19878
+ return ae.ok(timeoutSeconds);
19748
19879
  };
19749
19880
  const planXSync = (input) => {
19750
19881
  const accountSelector = input.accountSelector;
19751
- if (accountSelector === void 0 || accountSelector.length === 0) return G.err(new XSyncPlanError({
19882
+ if (accountSelector === void 0 || accountSelector.length === 0) return ae.err(new XSyncPlanError({
19752
19883
  kind: "missing-account-selector",
19753
19884
  message: "Selected X account is missing an account selector."
19754
19885
  }));
19755
19886
  const timeout = parseTimeoutSeconds(input.timeout);
19756
- if (G.isError(timeout)) return G.err(timeout.error);
19887
+ if (ae.isError(timeout)) return ae.err(timeout.error);
19757
19888
  const accountHeaders = { "x-social-account-id": accountSelector };
19758
19889
  const collectionInput = typeof input.collection === "string" && input.collection.length > 0 ? input.collection : void 0;
19759
19890
  if (collectionInput === void 0) {
19760
- if (input.reset === true) return G.err(new XSyncPlanError({
19891
+ if (input.reset === true) return ae.err(new XSyncPlanError({
19761
19892
  kind: "reset-without-collection",
19762
19893
  message: "--reset requires a collection"
19763
19894
  }));
19764
- return G.ok({
19895
+ return ae.ok({
19765
19896
  kind: "list",
19766
19897
  accountHeaders,
19767
19898
  accountSelector,
@@ -19769,19 +19900,19 @@ const planXSync = (input) => {
19769
19900
  });
19770
19901
  }
19771
19902
  const collection = findSyncCollection(input.collections, collectionInput);
19772
- if (collection === void 0) return G.err(new XSyncPlanError({
19903
+ if (collection === void 0) return ae.err(new XSyncPlanError({
19773
19904
  kind: "unknown-collection",
19774
19905
  collection: collectionInput,
19775
19906
  message: `Unknown collection "${collectionInput}". Available: ${input.collections.map(shortSyncCollectionName).join(", ")}`
19776
19907
  }));
19777
19908
  if (input.reset === true) {
19778
- if (input.since != null) return G.err(new XSyncPlanError({
19909
+ if (input.since != null) return ae.err(new XSyncPlanError({
19779
19910
  kind: "reset-with-since",
19780
19911
  collection: collection.key,
19781
19912
  message: "--reset cannot be combined with --since"
19782
19913
  }));
19783
19914
  const resetCollections = resetTablesFor(collection);
19784
- return G.ok({
19915
+ return ae.ok({
19785
19916
  kind: "reset",
19786
19917
  accountHeaders,
19787
19918
  accountSelector,
@@ -19792,20 +19923,20 @@ const planXSync = (input) => {
19792
19923
  }
19793
19924
  let since;
19794
19925
  if (input.since != null) {
19795
- if (!collection.sinceField) return G.err(new XSyncPlanError({
19926
+ if (!collection.sinceField) return ae.err(new XSyncPlanError({
19796
19927
  kind: "since-unsupported",
19797
19928
  collection: collection.key,
19798
19929
  message: `${shortSyncCollectionName(collection)} does not support --since`
19799
19930
  }));
19800
19931
  const parsedSince = parseSinceResult(String(input.since));
19801
- if (G.isError(parsedSince)) return G.err(new XSyncPlanError({
19932
+ if (ae.isError(parsedSince)) return ae.err(new XSyncPlanError({
19802
19933
  kind: "since-unsupported",
19803
19934
  collection: collection.key,
19804
19935
  message: parsedSince.error.message
19805
19936
  }));
19806
19937
  since = parsedSince.value;
19807
19938
  }
19808
- return G.ok({
19939
+ return ae.ok({
19809
19940
  kind: "run",
19810
19941
  accountHeaders,
19811
19942
  accountSelector,
@@ -19816,7 +19947,7 @@ const planXSync = (input) => {
19816
19947
  };
19817
19948
  //#endregion
19818
19949
  //#region ../../packages/x/src/cli/write-plan.ts
19819
- var XWritePlanError = class extends h("XWritePlanError")() {
19950
+ var XWritePlanError = class extends h("XWritePlanError") {
19820
19951
  constructor(args) {
19821
19952
  super(args);
19822
19953
  this.name = "XWritePlanError";
@@ -19838,16 +19969,16 @@ const responseString = (data, keys) => {
19838
19969
  const responseMediaIdResult = (data) => {
19839
19970
  const root = isObjectRecord$1(data) ? data : void 0;
19840
19971
  const id = (isObjectRecord$1(root?.data) ? root.data : void 0)?.id ?? root?.id;
19841
- if (typeof id !== "string" && typeof id !== "number") return G.err(new XWritePlanError({
19972
+ if (typeof id !== "string" && typeof id !== "number") return ae.err(new XWritePlanError({
19842
19973
  kind: "missing-media-id",
19843
19974
  message: "Media upload did not return a media id."
19844
19975
  }));
19845
- return G.ok(String(id));
19976
+ return ae.ok(String(id));
19846
19977
  };
19847
- const requiredTargetResult = (target) => target === void 0 ? G.err(new XWritePlanError({
19978
+ const requiredTargetResult = (target) => target === void 0 ? ae.err(new XWritePlanError({
19848
19979
  kind: "missing-target",
19849
19980
  message: "target is required."
19850
- })) : G.ok(target);
19981
+ })) : ae.ok(target);
19851
19982
  const postMediaByExtension = {
19852
19983
  ".gif": {
19853
19984
  mediaType: "image/gif",
@@ -19880,22 +20011,22 @@ const postMediaByExtension = {
19880
20011
  };
19881
20012
  const parsePostMediaFileResult = (path) => {
19882
20013
  const media = postMediaByExtension[extname(path).toLowerCase()];
19883
- if (media === void 0) return G.err(new XWritePlanError({
20014
+ if (media === void 0) return ae.err(new XWritePlanError({
19884
20015
  kind: "invalid-media-type",
19885
20016
  message: `Unsupported media type for ${path}. Supported types: jpg, jpeg, png, webp, gif, mp4, mov.`
19886
20017
  }));
19887
- return G.ok({
20018
+ return ae.ok({
19888
20019
  ...media,
19889
20020
  path
19890
20021
  });
19891
20022
  };
19892
20023
  const parsePostMediaIdResult = (value) => {
19893
20024
  const mediaId = value.trim();
19894
- if (mediaId.length === 0) return G.err(new XWritePlanError({
20025
+ if (mediaId.length === 0) return ae.err(new XWritePlanError({
19895
20026
  kind: "empty-media-id",
19896
20027
  message: "--media-id cannot be empty."
19897
20028
  }));
19898
- return G.ok(mediaId);
20029
+ return ae.ok(mediaId);
19899
20030
  };
19900
20031
  const postBodyHasText = (body) => {
19901
20032
  const text = body?.text;
@@ -19907,7 +20038,7 @@ const postBodyMediaIds = (body) => {
19907
20038
  };
19908
20039
  const postBodyHasPoll = (body) => isObjectRecord$1(body?.poll);
19909
20040
  const validatePostMediaResult = (mediaFiles, mediaIds) => {
19910
- if (mediaFiles.length + mediaIds.length > 4) return G.err(new XWritePlanError({
20041
+ if (mediaFiles.length + mediaIds.length > 4) return ae.err(new XWritePlanError({
19911
20042
  kind: "invalid-media-mix",
19912
20043
  message: "Attach at most 4 media items."
19913
20044
  }));
@@ -19919,35 +20050,35 @@ const validatePostMediaResult = (mediaFiles, mediaIds) => {
19919
20050
  gifCount > 0,
19920
20051
  videoCount > 0
19921
20052
  ].filter(Boolean).length;
19922
- if (imageCount > 4) return G.err(new XWritePlanError({
20053
+ if (imageCount > 4) return ae.err(new XWritePlanError({
19923
20054
  kind: "invalid-media-mix",
19924
20055
  message: "Attach at most 4 images."
19925
20056
  }));
19926
- if (gifCount > 1) return G.err(new XWritePlanError({
20057
+ if (gifCount > 1) return ae.err(new XWritePlanError({
19927
20058
  kind: "invalid-media-mix",
19928
20059
  message: "Attach at most 1 GIF."
19929
20060
  }));
19930
- if (videoCount > 1) return G.err(new XWritePlanError({
20061
+ if (videoCount > 1) return ae.err(new XWritePlanError({
19931
20062
  kind: "invalid-media-mix",
19932
20063
  message: "Attach at most 1 video."
19933
20064
  }));
19934
- if (localCategoryCount > 1) return G.err(new XWritePlanError({
20065
+ if (localCategoryCount > 1) return ae.err(new XWritePlanError({
19935
20066
  kind: "invalid-media-mix",
19936
20067
  message: "Do not mix images, GIFs, and videos in one post."
19937
20068
  }));
19938
- return G.ok();
20069
+ return ae.ok();
19939
20070
  };
19940
20071
  const validatePostPollMediaResult = (args) => {
19941
20072
  const explicitMediaCount = args.mediaFiles.length + args.mediaIds.length;
19942
20073
  const bodyMediaIds = explicitMediaCount > 0 ? [] : postBodyMediaIds(args.bodyFields);
19943
20074
  const hasMedia = explicitMediaCount + bodyMediaIds.length > 0;
19944
20075
  const hasPoll = args.poll !== void 0 || postBodyHasPoll(args.bodyFields);
19945
- if (hasPoll && hasMedia) return G.err(new XWritePlanError({
20076
+ if (hasPoll && hasMedia) return ae.err(new XWritePlanError({
19946
20077
  kind: "invalid-media-mix",
19947
20078
  message: "--poll-option cannot be combined with media attachments."
19948
20079
  }));
19949
20080
  const media = validatePostMediaResult(args.mediaFiles, [...args.mediaIds, ...bodyMediaIds]);
19950
- return G.isError(media) ? G.err(media.error) : G.ok({
20081
+ return ae.isError(media) ? ae.err(media.error) : ae.ok({
19951
20082
  bodyMediaIds,
19952
20083
  hasMedia,
19953
20084
  hasPoll
@@ -20017,12 +20148,12 @@ const planPostRequest = (args) => {
20017
20148
  };
20018
20149
  };
20019
20150
  const planMessageRequestResult = (args) => {
20020
- if (args.body === void 0) return G.err(new XWritePlanError({
20151
+ if (args.body === void 0) return ae.err(new XWritePlanError({
20021
20152
  kind: "missing-message-body",
20022
20153
  message: "Message body is required."
20023
20154
  }));
20024
20155
  const text = typeof args.body.text === "string" ? args.body.text : void 0;
20025
- if (args.threadResolution !== void 0) return G.ok({
20156
+ if (args.threadResolution !== void 0) return ae.ok({
20026
20157
  method: "POST",
20027
20158
  path: `x/dm_conversations/${encodeURIComponent(args.threadResolution.id)}/messages`,
20028
20159
  headers: args.headers,
@@ -20034,11 +20165,11 @@ const planMessageRequestResult = (args) => {
20034
20165
  });
20035
20166
  if (args.recipients.length === 1) {
20036
20167
  const [participant] = args.participantResolutions;
20037
- if (participant === void 0) return G.err(new XWritePlanError({
20168
+ if (participant === void 0) return ae.err(new XWritePlanError({
20038
20169
  kind: "missing-target",
20039
20170
  message: "Pass at least one recipient."
20040
20171
  }));
20041
- return G.ok({
20172
+ return ae.ok({
20042
20173
  method: "POST",
20043
20174
  path: `x/dm_conversations/with/${encodeURIComponent(participant.id)}/messages`,
20044
20175
  headers: args.headers,
@@ -20051,7 +20182,7 @@ const planMessageRequestResult = (args) => {
20051
20182
  }
20052
20183
  const participantIds = args.participantResolutions.map((resolution) => resolution.id);
20053
20184
  const { text: bodyText, ...bodyFields } = args.body;
20054
- return G.ok({
20185
+ return ae.ok({
20055
20186
  method: "POST",
20056
20187
  path: "x/dm_conversations",
20057
20188
  headers: args.headers,
@@ -20533,7 +20664,7 @@ const buildSync = (deps, platform) => defineCommand({
20533
20664
  since: args.since,
20534
20665
  timeout: args.timeout
20535
20666
  });
20536
- if (G.isError(planned)) throw new UsageError(planned.error instanceof XSyncPlanError ? planned.error.message : String(planned.error));
20667
+ if (ae.isError(planned)) throw new UsageError(planned.error instanceof XSyncPlanError ? planned.error.message : String(planned.error));
20537
20668
  const plan = planned.value;
20538
20669
  if (plan.kind === "list") {
20539
20670
  const cache = openXCacheFor(deps, {
@@ -20601,7 +20732,7 @@ const buildSync = (deps, platform) => defineCommand({
20601
20732
  if (rateLimitError) throw rateLimitError;
20602
20733
  throw error;
20603
20734
  }
20604
- if (G.isError(result)) {
20735
+ if (ae.isError(result)) {
20605
20736
  const rateLimitError = enrichRateLimitSyncError({
20606
20737
  error: result.error,
20607
20738
  platform,
@@ -20708,7 +20839,7 @@ const buildSql = (deps, platform) => {
20708
20839
  } catch (error) {
20709
20840
  throw new UsageError(`Query failed (cache is read-only): ${errorMessageFrom(error)}`);
20710
20841
  }
20711
- if (G.isError(result)) throw new UsageError(`Query failed (cache is read-only): ${result.error.message}`);
20842
+ if (ae.isError(result)) throw new UsageError(`Query failed (cache is read-only): ${result.error.message}`);
20712
20843
  await deps.printResult({
20713
20844
  account: account.account,
20714
20845
  contract: schemaContract,
@@ -20793,7 +20924,7 @@ const throwWritePlanError = (error) => {
20793
20924
  };
20794
20925
  const requireWriteTarget = (target) => {
20795
20926
  const required = requiredTargetResult(target);
20796
- if (G.isError(required)) return throwWritePlanError(required.error);
20927
+ if (ae.isError(required)) return throwWritePlanError(required.error);
20797
20928
  return required.value;
20798
20929
  };
20799
20930
  const executeWriteRequest = (deps, plan) => plan.method === "POST" ? deps.api.post(plan.path, {
@@ -20846,7 +20977,7 @@ const repeatableValues = (name, value, rawArgs) => {
20846
20977
  };
20847
20978
  const parsePostMediaId = (deps, value) => {
20848
20979
  const mediaId = parsePostMediaIdResult(value);
20849
- if (G.isError(mediaId)) throw new UsageError(mediaId.error.message);
20980
+ if (ae.isError(mediaId)) throw new UsageError(mediaId.error.message);
20850
20981
  return deps.parseResourceId("--media-id", mediaId.value);
20851
20982
  };
20852
20983
  const parsePostPoll = (deps, args, rawArgs) => {
@@ -20931,7 +21062,7 @@ const uploadPostMedia = async (deps, headers, media, timeoutSeconds) => {
20931
21062
  initBody.set("total_bytes", String(file.byteLength));
20932
21063
  initBody.set("media_category", media.category);
20933
21064
  const mediaId = responseMediaIdResult(await (await postMediaForm(deps, "x/media/upload/init", headers, initBody)).json());
20934
- if (G.isError(mediaId)) throw new UsageError(mediaId.error.message);
21065
+ if (ae.isError(mediaId)) throw new UsageError(mediaId.error.message);
20935
21066
  for (let segmentIndex = 0, offset = 0; offset < file.byteLength; segmentIndex += 1, offset += postMediaChunkSize) {
20936
21067
  const chunk = file.subarray(offset, offset + postMediaChunkSize);
20937
21068
  const appendBody = new FormData();
@@ -21193,7 +21324,7 @@ const buildPost = (deps) => {
21193
21324
  const commandArgs = args;
21194
21325
  const mediaFiles = repeatableValues("media", commandArgs.media, rawArgs).map((path) => {
21195
21326
  const media = parsePostMediaFileResult(path);
21196
- if (G.isError(media)) throw new UsageError(media.error.message);
21327
+ if (ae.isError(media)) throw new UsageError(media.error.message);
21197
21328
  return media.value;
21198
21329
  });
21199
21330
  const mediaIds = repeatableValues("media-id", commandArgs["media-id"], rawArgs).map((mediaId) => parsePostMediaId(deps, mediaId));
@@ -21205,7 +21336,7 @@ const buildPost = (deps) => {
21205
21336
  mediaIds,
21206
21337
  poll
21207
21338
  });
21208
- if (G.isError(postInputs)) throw new UsageError(postInputs.error.message);
21339
+ if (ae.isError(postInputs)) throw new UsageError(postInputs.error.message);
21209
21340
  const timeoutSeconds = commandArgs.timeout === void 0 ? postMediaProcessingTimeoutSeconds : deps.parseIntegerString("--timeout", commandArgs.timeout, { min: 1 });
21210
21341
  const stdinBody = await readPostStdinBody(deps, postInputs.value.hasMedia, bodyFields);
21211
21342
  const account = typeof commandArgs.account === "string" ? commandArgs.account : void 0;
@@ -22247,7 +22378,7 @@ const buildMessage = (deps) => {
22247
22378
  recipients,
22248
22379
  threadResolution
22249
22380
  });
22250
- if (G.isError(request)) throw new UsageError(request.error.message);
22381
+ if (ae.isError(request)) throw new UsageError(request.error.message);
22251
22382
  const response = await deps.api.post(request.value.path, {
22252
22383
  headers: request.value.headers,
22253
22384
  json: request.value.body
@@ -22540,10 +22671,10 @@ createXCommands({
22540
22671
  //#endregion
22541
22672
  //#region ../../packages/linkedin/src/cli/lifecycle-plan.ts
22542
22673
  const LINKEDIN_CONNECTED_STATUS = "connected";
22543
- var InvalidLinkedinLifecycleTarget = class extends h("InvalidLinkedinLifecycleTarget")() {};
22544
- var LinkedinLifecycleNoAccountMatch = class extends h("LinkedinLifecycleNoAccountMatch")() {};
22545
- var LinkedinLifecycleAmbiguousAccount = class extends h("LinkedinLifecycleAmbiguousAccount")() {};
22546
- var LinkedinLifecycleSeatTimeout = class extends h("LinkedinLifecycleSeatTimeout")() {
22674
+ var InvalidLinkedinLifecycleTarget = class extends h("InvalidLinkedinLifecycleTarget") {};
22675
+ var LinkedinLifecycleNoAccountMatch = class extends h("LinkedinLifecycleNoAccountMatch") {};
22676
+ var LinkedinLifecycleAmbiguousAccount = class extends h("LinkedinLifecycleAmbiguousAccount") {};
22677
+ var LinkedinLifecycleSeatTimeout = class extends h("LinkedinLifecycleSeatTimeout") {
22547
22678
  constructor() {
22548
22679
  super({ message: "billing_seat_timed_out" });
22549
22680
  }
@@ -22553,22 +22684,22 @@ const parseLinkedinReconnectTarget = (value) => {
22553
22684
  const trimmed = value.trim();
22554
22685
  if (trimmed.startsWith("@")) {
22555
22686
  const username = normalizeSocialIdentifier(trimmed);
22556
- if (username) return G.ok({
22687
+ if (username) return ae.ok({
22557
22688
  type: "username",
22558
22689
  value: username
22559
22690
  });
22560
22691
  }
22561
22692
  const profileSelector = parseTypedSocialSelector(trimmed, { prefixes: ["profile_id"] });
22562
- if (profileSelector) return G.ok({
22693
+ if (profileSelector) return ae.ok({
22563
22694
  type: "profileId",
22564
22695
  value: profileSelector.id.toLowerCase()
22565
22696
  });
22566
22697
  const publicIdentifier = linkedInProfileIdentifierFromURL(trimmed);
22567
- if (publicIdentifier) return G.ok({
22698
+ if (publicIdentifier) return ae.ok({
22568
22699
  type: "username",
22569
22700
  value: publicIdentifier
22570
22701
  });
22571
- return G.err(new InvalidLinkedinLifecycleTarget({
22702
+ return ae.err(new InvalidLinkedinLifecycleTarget({
22572
22703
  value,
22573
22704
  message: "LinkedIn reconnect account must be @username, a LinkedIn profile URL, or profile_id:<id>."
22574
22705
  }));
@@ -22584,14 +22715,14 @@ const reconnectCommandTargetFor = (account) => {
22584
22715
  const connectedLinkedinLifecycleAccounts = (accounts) => accounts.filter((account) => account.status === LINKEDIN_CONNECTED_STATUS);
22585
22716
  const resolveLinkedinLifecycleAccount = (accounts, identifier) => {
22586
22717
  const target = parseLinkedinReconnectTarget(identifier);
22587
- if (G.isError(target)) return G.err(target.error);
22718
+ if (ae.isError(target)) return ae.err(target.error);
22588
22719
  const matches = accounts.filter((candidate) => linkedinLifecycleAccountMatchesTarget(candidate, target.value));
22589
- if (matches.length === 1 && matches[0]) return G.ok(matches[0]);
22590
- if (matches.length === 0) return G.err(new LinkedinLifecycleNoAccountMatch({
22720
+ if (matches.length === 1 && matches[0]) return ae.ok(matches[0]);
22721
+ if (matches.length === 0) return ae.err(new LinkedinLifecycleNoAccountMatch({
22591
22722
  value: identifier,
22592
22723
  message: `No LinkedIn account matches "${identifier}".`
22593
22724
  }));
22594
- return G.err(new LinkedinLifecycleAmbiguousAccount({
22725
+ return ae.err(new LinkedinLifecycleAmbiguousAccount({
22595
22726
  value: identifier,
22596
22727
  message: `Multiple LinkedIn accounts match "${identifier}". Pass profile_id:<id>.`
22597
22728
  }));
@@ -22599,9 +22730,9 @@ const resolveLinkedinLifecycleAccount = (accounts, identifier) => {
22599
22730
  const resolveLinkedinDisconnectAccount = (accounts, identifier) => {
22600
22731
  if (identifier) return resolveLinkedinLifecycleAccount(accounts, identifier);
22601
22732
  const connected = connectedLinkedinLifecycleAccounts(accounts);
22602
- if (connected.length === 1 && connected[0]) return G.ok(connected[0]);
22603
- if (connected.length === 0) return G.err(new LinkedinLifecycleNoAccountMatch({ message: "No connected LinkedIn accounts found." }));
22604
- return G.err(new LinkedinLifecycleAmbiguousAccount({ message: "Multiple LinkedIn accounts are connected. Pass a public identifier." }));
22733
+ if (connected.length === 1 && connected[0]) return ae.ok(connected[0]);
22734
+ if (connected.length === 0) return ae.err(new LinkedinLifecycleNoAccountMatch({ message: "No connected LinkedIn accounts found." }));
22735
+ return ae.err(new LinkedinLifecycleAmbiguousAccount({ message: "Multiple LinkedIn accounts are connected. Pass a public identifier." }));
22605
22736
  };
22606
22737
  //#endregion
22607
22738
  //#region ../../packages/linkedin/src/cli/lifecycle.ts
@@ -22661,12 +22792,12 @@ const authURLFor$1 = async (deps, operation) => ({
22661
22792
  });
22662
22793
  const reconnectAccountForIdentifier = async (deps, identifier) => {
22663
22794
  const account = resolveLinkedinLifecycleAccount(await listLinkedinLifecycleAccounts(deps), identifier);
22664
- if (G.isError(account)) throw account.error;
22795
+ if (ae.isError(account)) throw account.error;
22665
22796
  return account.value;
22666
22797
  };
22667
22798
  const resolveDisconnectTarget = async (deps, identifier) => {
22668
22799
  const account = resolveLinkedinDisconnectAccount(await listLinkedinLifecycleAccounts(deps, Boolean(identifier)), identifier);
22669
- if (G.isError(account)) throw account.error;
22800
+ if (ae.isError(account)) throw account.error;
22670
22801
  return account.value;
22671
22802
  };
22672
22803
  const connectLinkedinAccount = async (deps) => {
@@ -22717,7 +22848,7 @@ const disconnectLinkedinAccount = async (deps, identifier) => {
22717
22848
  const CONNECT_TIMEOUT_MS = 300 * 1e3;
22718
22849
  const SEAT_POLL_TIMEOUT_MS = 600 * 1e3;
22719
22850
  const POLL_INTERVAL_MS = 2 * 1e3;
22720
- var XConnectTimedOut = class extends h("XConnectTimedOut")() {
22851
+ var XConnectTimedOut = class extends h("XConnectTimedOut") {
22721
22852
  constructor(args) {
22722
22853
  super({
22723
22854
  ...args,
@@ -22726,7 +22857,7 @@ var XConnectTimedOut = class extends h("XConnectTimedOut")() {
22726
22857
  this.name = "XConnectTimedOut";
22727
22858
  }
22728
22859
  };
22729
- var XBillingSeatTimedOut = class extends h("XBillingSeatTimedOut")() {
22860
+ var XBillingSeatTimedOut = class extends h("XBillingSeatTimedOut") {
22730
22861
  constructor() {
22731
22862
  super({
22732
22863
  operation: "prepareAccountConnect",
@@ -22736,7 +22867,7 @@ var XBillingSeatTimedOut = class extends h("XBillingSeatTimedOut")() {
22736
22867
  this.name = "XBillingSeatTimedOut";
22737
22868
  }
22738
22869
  };
22739
- var XAccountNotFound = class extends h("XAccountNotFound")() {
22870
+ var XAccountNotFound = class extends h("XAccountNotFound") {
22740
22871
  constructor(args) {
22741
22872
  super({
22742
22873
  ...args,
@@ -22745,9 +22876,7 @@ var XAccountNotFound = class extends h("XAccountNotFound")() {
22745
22876
  this.name = "XAccountNotFound";
22746
22877
  }
22747
22878
  };
22748
- h("XAccountNotConnected")();
22749
- h("XAccountRequired")();
22750
- var XInvalidSelector = class extends h("XInvalidSelector")() {
22879
+ var XInvalidSelector = class extends h("XInvalidSelector") {
22751
22880
  constructor(args) {
22752
22881
  super({
22753
22882
  ...args,
@@ -22786,10 +22915,10 @@ const pollForAccount = async (deps, operation, matches) => {
22786
22915
  platform: "x",
22787
22916
  includeDisconnected: true
22788
22917
  })).find(matches);
22789
- if (account) return G.ok(account);
22918
+ if (account) return ae.ok(account);
22790
22919
  await sleep(POLL_INTERVAL_MS);
22791
22920
  }
22792
- return G.err(new XConnectTimedOut({
22921
+ return ae.err(new XConnectTimedOut({
22793
22922
  operation,
22794
22923
  timeoutMS: CONNECT_TIMEOUT_MS
22795
22924
  }));
@@ -22803,15 +22932,15 @@ const pollForSeat = async (deps) => {
22803
22932
  const now = deps.now ?? Date.now;
22804
22933
  const startedAt = now();
22805
22934
  while (now() - startedAt < SEAT_POLL_TIMEOUT_MS) {
22806
- if ((await deps.client.billing.status()).canConnect) return G.ok();
22935
+ if ((await deps.client.billing.status()).canConnect) return ae.ok();
22807
22936
  await sleep(POLL_INTERVAL_MS);
22808
22937
  }
22809
- return G.err(new XBillingSeatTimedOut());
22938
+ return ae.err(new XBillingSeatTimedOut());
22810
22939
  };
22811
22940
  const prepareAccountConnect = async (deps) => {
22812
- if ((await deps.client.billing.status()).canConnect) return G.ok();
22941
+ if ((await deps.client.billing.status()).canConnect) return ae.ok();
22813
22942
  const status = await deps.client.billing.prepareAccountConnect();
22814
- if (status.canConnect) return G.ok();
22943
+ if (status.canConnect) return ae.ok();
22815
22944
  if (status.paymentURL) surfaceURL(deps, status.paymentURL);
22816
22945
  return pollForSeat(deps);
22817
22946
  };
@@ -22823,18 +22952,18 @@ const parseXAccountSelector = (target, operation) => {
22823
22952
  const trimmed = target.trim();
22824
22953
  if (trimmed.startsWith("profile_id:")) {
22825
22954
  const profileId = trimmed.slice(11).trim();
22826
- if (profileId && !/[/?#%]/.test(profileId)) return G.ok({
22955
+ if (profileId && !/[/?#%]/.test(profileId)) return ae.ok({
22827
22956
  kind: "profileId",
22828
22957
  normalized: profileId.toLowerCase(),
22829
22958
  raw: target
22830
22959
  });
22831
22960
  }
22832
- if (trimmed.startsWith("@") && !/[/?#%]/.test(trimmed)) return G.ok({
22961
+ if (trimmed.startsWith("@") && !/[/?#%]/.test(trimmed)) return ae.ok({
22833
22962
  kind: "username",
22834
22963
  normalized: normalizeIdentifier(trimmed),
22835
22964
  raw: target
22836
22965
  });
22837
- return G.err(new XInvalidSelector({
22966
+ return ae.err(new XInvalidSelector({
22838
22967
  operation,
22839
22968
  account: target
22840
22969
  }));
@@ -22843,7 +22972,7 @@ const findXLifecycleAccount = (accounts, selector) => {
22843
22972
  if (selector.kind === "profileId") return accounts.find((account) => account.profileId.toLowerCase() === selector.normalized);
22844
22973
  return accounts.find((account) => normalizeIdentifier(account.username) === selector.normalized);
22845
22974
  };
22846
- const listXLifecycleAccounts = async (deps, includeDisconnected) => G.ok(await deps.client.accounts.list({
22975
+ const listXLifecycleAccounts = async (deps, includeDisconnected) => ae.ok(await deps.client.accounts.list({
22847
22976
  platform: "x",
22848
22977
  includeDisconnected
22849
22978
  }));
@@ -22854,12 +22983,12 @@ const listXLifecycleAccounts = async (deps, includeDisconnected) => G.ok(await d
22854
22983
  const createXConnectURL = (deps, reconnectProfileId) => connectURLFor(deps, reconnectProfileId);
22855
22984
  const connectXAccount = async (deps) => {
22856
22985
  const beforeResult = await listXLifecycleAccounts(deps, true);
22857
- if (G.isError(beforeResult)) return G.err(beforeResult.error);
22986
+ if (ae.isError(beforeResult)) return ae.err(beforeResult.error);
22858
22987
  const before = beforeResult.value;
22859
22988
  const connectedBefore = new Set(before.filter((account) => account.status === "connected").map(accountKey));
22860
22989
  const lastSeenBefore = new Map(before.filter((account) => account.status === "connected").map((account) => [accountKey(account), timestampMS(account.lastSeenAt)]));
22861
22990
  const prepared = await prepareAccountConnect(deps);
22862
- if (G.isError(prepared)) return G.err(prepared.error);
22991
+ if (ae.isError(prepared)) return ae.err(prepared.error);
22863
22992
  const authURL = await authURLFor(deps, () => connectURLFor(deps));
22864
22993
  surfaceURL(deps, authURL.url, { log: !authURL.openingLogged });
22865
22994
  const account = await pollForAccount(deps, "connect", (candidate) => {
@@ -22869,8 +22998,8 @@ const connectXAccount = async (deps) => {
22869
22998
  const currentLastSeen = timestampMS(candidate.lastSeenAt);
22870
22999
  return previousLastSeen !== void 0 && currentLastSeen !== void 0 && currentLastSeen > previousLastSeen;
22871
23000
  });
22872
- if (G.isError(account)) return G.err(account.error);
22873
- return G.ok({
23001
+ if (ae.isError(account)) return ae.err(account.error);
23002
+ return ae.ok({
22874
23003
  platform: "x",
22875
23004
  status: "connected",
22876
23005
  account: account.value
@@ -22878,20 +23007,20 @@ const connectXAccount = async (deps) => {
22878
23007
  };
22879
23008
  const reconnectXAccount = async (deps, args) => {
22880
23009
  const selector = parseXAccountSelector(args.account, "reconnect");
22881
- if (G.isError(selector)) return G.err(selector.error);
23010
+ if (ae.isError(selector)) return ae.err(selector.error);
22882
23011
  const accountsResult = await listXLifecycleAccounts(deps, true);
22883
- if (G.isError(accountsResult)) return G.err(accountsResult.error);
23012
+ if (ae.isError(accountsResult)) return ae.err(accountsResult.error);
22884
23013
  const accounts = accountsResult.value;
22885
23014
  const existing = findXLifecycleAccount(accounts, selector.value);
22886
- if (!existing) return G.err(new XAccountNotFound({
23015
+ if (!existing) return ae.err(new XAccountNotFound({
22887
23016
  operation: "reconnect",
22888
23017
  account: args.account
22889
23018
  }));
22890
23019
  const authURL = await authURLFor(deps, () => connectURLFor(deps, existing.profileId));
22891
23020
  surfaceURL(deps, authURL.url, { log: !authURL.openingLogged });
22892
23021
  const account = await pollForAccount(deps, "reconnect", (candidate) => candidate.profileId === existing.profileId && candidate.status === "connected");
22893
- if (G.isError(account)) return G.err(account.error);
22894
- return G.ok({
23022
+ if (ae.isError(account)) return ae.err(account.error);
23023
+ return ae.ok({
22895
23024
  platform: "x",
22896
23025
  status: "connected",
22897
23026
  account: account.value
@@ -22899,12 +23028,12 @@ const reconnectXAccount = async (deps, args) => {
22899
23028
  };
22900
23029
  const disconnectXAccount = async (deps, target) => {
22901
23030
  const selector = parseXAccountSelector(target, "disconnect");
22902
- if (G.isError(selector)) return G.err(selector.error);
23031
+ if (ae.isError(selector)) return ae.err(selector.error);
22903
23032
  const accountsResult = await listXLifecycleAccounts(deps);
22904
- if (G.isError(accountsResult)) return G.err(accountsResult.error);
23033
+ if (ae.isError(accountsResult)) return ae.err(accountsResult.error);
22905
23034
  const accounts = accountsResult.value;
22906
23035
  const account = findXLifecycleAccount(accounts, selector.value);
22907
- if (!account) return G.err(new XAccountNotFound({
23036
+ if (!account) return ae.err(new XAccountNotFound({
22908
23037
  operation: "disconnect",
22909
23038
  account: target
22910
23039
  }));
@@ -22912,14 +23041,14 @@ const disconnectXAccount = async (deps, target) => {
22912
23041
  platform: "x",
22913
23042
  account: accountSelectorFor$1(account)
22914
23043
  });
22915
- return G.ok({
23044
+ return ae.ok({
22916
23045
  platform: "x",
22917
23046
  account,
22918
23047
  result
22919
23048
  });
22920
23049
  };
22921
23050
  //#endregion
22922
- //#region ../../node_modules/.bun/@orpc+shared@1.14.8+e40b0dfdd726a224/node_modules/@orpc/shared/dist/index.mjs
23051
+ //#region ../../node_modules/.bun/@orpc+shared@1.14.14+e40b0dfdd726a224/node_modules/@orpc/shared/dist/index.mjs
22923
23052
  function resolveMaybeOptionalOptions(rest) {
22924
23053
  return rest[0] ?? {};
22925
23054
  }
@@ -22928,7 +23057,7 @@ function toArray(value) {
22928
23057
  }
22929
23058
  const ORPC_NAME = "orpc";
22930
23059
  const ORPC_SHARED_PACKAGE_NAME = "@orpc/shared";
22931
- const ORPC_SHARED_PACKAGE_VERSION = "1.14.8";
23060
+ const ORPC_SHARED_PACKAGE_VERSION = "1.14.14";
22932
23061
  var AbortError$1 = class extends Error {
22933
23062
  constructor(...rest) {
22934
23063
  super(...rest);
@@ -23157,9 +23286,9 @@ function tryDecodeURIComponent(value) {
23157
23286
  }
23158
23287
  }
23159
23288
  //#endregion
23160
- //#region ../../node_modules/.bun/@orpc+client@1.14.8+e40b0dfdd726a224/node_modules/@orpc/client/dist/shared/client.DTC9NNUo.mjs
23289
+ //#region ../../node_modules/.bun/@orpc+client@1.14.14+e40b0dfdd726a224/node_modules/@orpc/client/dist/shared/client.RnCVAXCj.mjs
23161
23290
  const ORPC_CLIENT_PACKAGE_NAME = "@orpc/client";
23162
- const ORPC_CLIENT_PACKAGE_VERSION = "1.14.8";
23291
+ const ORPC_CLIENT_PACKAGE_VERSION = "1.14.14";
23163
23292
  const COMMON_ORPC_ERROR_DEFS = {
23164
23293
  BAD_REQUEST: {
23165
23294
  status: 400,
@@ -23323,7 +23452,7 @@ function createORPCErrorFromJson(json, options = {}) {
23323
23452
  });
23324
23453
  }
23325
23454
  //#endregion
23326
- //#region ../../node_modules/.bun/@orpc+standard-server@1.14.8+e40b0dfdd726a224/node_modules/@orpc/standard-server/dist/index.mjs
23455
+ //#region ../../node_modules/.bun/@orpc+standard-server@1.14.14+e40b0dfdd726a224/node_modules/@orpc/standard-server/dist/index.mjs
23327
23456
  var EventEncoderError = class extends TypeError {};
23328
23457
  var EventDecoderError = class extends TypeError {};
23329
23458
  var ErrorEvent = class extends Error {
@@ -23333,8 +23462,13 @@ var ErrorEvent = class extends Error {
23333
23462
  this.data = options?.data;
23334
23463
  }
23335
23464
  };
23465
+ const LINE_ENDING_REGEX$1 = /\r\n|\r(?!\n)|\n/;
23466
+ const MESSAGE_DELIMITER_REGEX = /(?:\r\n|\r(?!\n)|\n){2}/;
23467
+ const MESSAGE_DELIMITER_GLOBAL_REGEX = /(?:\r\n|\r(?!\n)|\n){2}/g;
23468
+ const CR = 13;
23469
+ const LF = 10;
23470
+ const SPACE = 32;
23336
23471
  function decodeEventMessage(encoded) {
23337
- const lines = encoded.replace(/\n+$/, "").split(/\n/);
23338
23472
  const message = {
23339
23473
  data: void 0,
23340
23474
  event: void 0,
@@ -23342,45 +23476,77 @@ function decodeEventMessage(encoded) {
23342
23476
  retry: void 0,
23343
23477
  comments: []
23344
23478
  };
23345
- for (const line of lines) {
23479
+ for (const line of encoded.split(LINE_ENDING_REGEX$1)) {
23480
+ if (line === "") continue;
23346
23481
  const index = line.indexOf(":");
23347
- const key = index === -1 ? line : line.slice(0, index);
23348
- const value = index === -1 ? "" : line.slice(index + 1).replace(/^\s/, "");
23349
- if (index === 0) message.comments.push(value);
23350
- else if (key === "data") {
23351
- message.data ??= "";
23352
- message.data += `${value}
23353
- `;
23354
- } else if (key === "event") message.event = value;
23355
- else if (key === "id") message.id = value;
23356
- else if (key === "retry") {
23357
- const maybeInteger = Number.parseInt(value);
23358
- if (Number.isInteger(maybeInteger) && maybeInteger >= 0 && maybeInteger.toString() === value) message.retry = maybeInteger;
23482
+ const value = index === -1 ? "" : line.slice(line.charCodeAt(index + 1) === SPACE ? index + 2 : index + 1);
23483
+ if (index === 0) {
23484
+ message.comments.push(value);
23485
+ continue;
23486
+ }
23487
+ switch (index === -1 ? line : line.slice(0, index)) {
23488
+ case "data":
23489
+ message.data = message.data === void 0 ? value : `${message.data}
23490
+ ${value}`;
23491
+ break;
23492
+ case "event":
23493
+ message.event = value;
23494
+ break;
23495
+ case "id":
23496
+ message.id = value;
23497
+ break;
23498
+ case "retry": {
23499
+ const maybeInteger = Number.parseInt(value, 10);
23500
+ if (maybeInteger >= 0 && maybeInteger.toString() === value) message.retry = maybeInteger;
23501
+ break;
23502
+ }
23359
23503
  }
23360
23504
  }
23361
- message.data = message.data?.replace(/\n$/, "");
23362
23505
  return message;
23363
23506
  }
23364
23507
  var EventDecoder = class {
23365
23508
  constructor(options = {}) {
23366
23509
  this.options = options;
23367
23510
  }
23368
- incomplete = "";
23511
+ pending = [];
23512
+ tail = "";
23513
+ discardLeadingLF = false;
23369
23514
  feed(chunk) {
23370
- this.incomplete += chunk;
23371
- const lastCompleteIndex = this.incomplete.lastIndexOf("\n\n");
23372
- if (lastCompleteIndex === -1) return;
23373
- const completes = this.incomplete.slice(0, lastCompleteIndex).split(/\n\n/);
23374
- this.incomplete = this.incomplete.slice(lastCompleteIndex + 2);
23375
- for (const encoded of completes) {
23376
- const message = decodeEventMessage(`${encoded}
23377
-
23378
- `);
23515
+ if (chunk === "") return;
23516
+ if (this.discardLeadingLF) {
23517
+ this.discardLeadingLF = false;
23518
+ if (chunk.charCodeAt(0) === LF) {
23519
+ chunk = chunk.slice(1);
23520
+ if (chunk === "") return;
23521
+ }
23522
+ }
23523
+ const scan = this.tail + chunk;
23524
+ if (!MESSAGE_DELIMITER_REGEX.test(scan)) {
23525
+ this.pending.push(chunk);
23526
+ this.tail = scan.slice(-3);
23527
+ return;
23528
+ }
23529
+ this.pending.push(chunk);
23530
+ const buffered = this.pending.length === 1 ? chunk : this.pending.join("");
23531
+ const offset = buffered.length - scan.length;
23532
+ const parts = [];
23533
+ let start = 0;
23534
+ for (const match of scan.matchAll(MESSAGE_DELIMITER_GLOBAL_REGEX)) {
23535
+ parts.push(buffered.slice(start, offset + match.index));
23536
+ start = offset + match.index + match[0].length;
23537
+ }
23538
+ const incomplete = buffered.slice(start);
23539
+ this.pending.length = 0;
23540
+ this.tail = incomplete.slice(-3);
23541
+ if (incomplete === "") this.discardLeadingLF = chunk.charCodeAt(chunk.length - 1) === CR;
23542
+ else this.pending.push(incomplete);
23543
+ for (const encoded of parts) {
23544
+ const message = decodeEventMessage(encoded);
23379
23545
  if (this.options.onEvent) this.options.onEvent(message);
23380
23546
  }
23381
23547
  }
23382
23548
  end() {
23383
- if (this.incomplete) throw new EventDecoderError("Event Iterator ended before complete");
23549
+ if (this.pending.length !== 0) throw new EventDecoderError("Event Iterator ended before complete");
23384
23550
  }
23385
23551
  };
23386
23552
  var EventDecoderStream = class extends TransformStream {
@@ -23401,24 +23567,27 @@ var EventDecoderStream = class extends TransformStream {
23401
23567
  });
23402
23568
  }
23403
23569
  };
23570
+ const LINE_ENDING_REGEX = /\r\n|[\n\r]/;
23571
+ const LINE_ENDING_GLOBAL_REGEX = /\r\n|[\n\r]/g;
23572
+ function containsLineBreak(value) {
23573
+ return LINE_ENDING_REGEX.test(value);
23574
+ }
23404
23575
  function assertEventId(id) {
23405
- if (id.includes("\n")) throw new EventEncoderError("Event's id must not contain a newline character");
23576
+ if (containsLineBreak(id)) throw new EventEncoderError("Event's id must not contain a carriage return or newline character");
23406
23577
  }
23407
23578
  function assertEventName(event) {
23408
- if (event.includes("\n")) throw new EventEncoderError("Event's event must not contain a newline character");
23579
+ if (containsLineBreak(event)) throw new EventEncoderError("Event's event must not contain a carriage return or newline character");
23409
23580
  }
23410
23581
  function assertEventRetry(retry) {
23411
23582
  if (!Number.isInteger(retry) || retry < 0) throw new EventEncoderError("Event's retry must be a integer and >= 0");
23412
23583
  }
23413
23584
  function assertEventComment(comment) {
23414
- if (comment.includes("\n")) throw new EventEncoderError("Event's comment must not contain a newline character");
23585
+ if (containsLineBreak(comment)) throw new EventEncoderError("Event's comment must not contain a carriage return or newline character");
23415
23586
  }
23416
23587
  function encodeEventData(data) {
23417
- const lines = data?.split(/\n/) ?? [];
23418
- let output = "";
23419
- for (const line of lines) output += `data: ${line}
23588
+ if (data === void 0) return "";
23589
+ return `data: ${data.replace(LINE_ENDING_GLOBAL_REGEX, "\ndata: ")}
23420
23590
  `;
23421
- return output;
23422
23591
  }
23423
23592
  function encodeEventComments(comments) {
23424
23593
  let output = "";
@@ -23483,7 +23652,7 @@ function mergeStandardHeaders(a, b) {
23483
23652
  return merged;
23484
23653
  }
23485
23654
  //#endregion
23486
- //#region ../../node_modules/.bun/@orpc+client@1.14.8+e40b0dfdd726a224/node_modules/@orpc/client/dist/shared/client.BLtwTQUg.mjs
23655
+ //#region ../../node_modules/.bun/@orpc+client@1.14.14+e40b0dfdd726a224/node_modules/@orpc/client/dist/shared/client.BLtwTQUg.mjs
23487
23656
  function mapEventIterator(iterator, maps) {
23488
23657
  const mapError = async (error) => {
23489
23658
  let mappedError = await maps.error(error);
@@ -23519,7 +23688,7 @@ function mapEventIterator(iterator, maps) {
23519
23688
  });
23520
23689
  }
23521
23690
  //#endregion
23522
- //#region ../../node_modules/.bun/@orpc+client@1.14.8+e40b0dfdd726a224/node_modules/@orpc/client/dist/index.mjs
23691
+ //#region ../../node_modules/.bun/@orpc+client@1.14.14+e40b0dfdd726a224/node_modules/@orpc/client/dist/index.mjs
23523
23692
  function resolveFriendlyClientOptions(options) {
23524
23693
  return {
23525
23694
  ...options,
@@ -23540,7 +23709,7 @@ function createORPCClient(link, options = {}) {
23540
23709
  } }));
23541
23710
  }
23542
23711
  //#endregion
23543
- //#region ../../node_modules/.bun/@orpc+standard-server-fetch@1.14.8+e40b0dfdd726a224/node_modules/@orpc/standard-server-fetch/dist/index.mjs
23712
+ //#region ../../node_modules/.bun/@orpc+standard-server-fetch@1.14.14+e40b0dfdd726a224/node_modules/@orpc/standard-server-fetch/dist/index.mjs
23544
23713
  function toEventIterator(stream, options = {}) {
23545
23714
  const reader = (stream?.pipeThrough(new TextDecoderStream()).pipeThrough(new EventDecoderStream()))?.getReader();
23546
23715
  let span;
@@ -23767,7 +23936,7 @@ function toStandardLazyResponse(response, options = {}) {
23767
23936
  };
23768
23937
  }
23769
23938
  //#endregion
23770
- //#region ../../node_modules/.bun/@orpc+client@1.14.8+e40b0dfdd726a224/node_modules/@orpc/client/dist/shared/client.BtFSa_yX.mjs
23939
+ //#region ../../node_modules/.bun/@orpc+client@1.14.14+e40b0dfdd726a224/node_modules/@orpc/client/dist/shared/client.Neryp5z6.mjs
23771
23940
  var CompositeStandardLinkPlugin = class {
23772
23941
  plugins;
23773
23942
  constructor(plugins = []) {
@@ -24163,7 +24332,7 @@ var StandardRPCLink = class extends StandardLink {
24163
24332
  }
24164
24333
  };
24165
24334
  //#endregion
24166
- //#region ../../node_modules/.bun/@orpc+client@1.14.8+e40b0dfdd726a224/node_modules/@orpc/client/dist/adapters/fetch/index.mjs
24335
+ //#region ../../node_modules/.bun/@orpc+client@1.14.14+e40b0dfdd726a224/node_modules/@orpc/client/dist/adapters/fetch/index.mjs
24167
24336
  var CompositeLinkFetchPlugin = class extends CompositeStandardLinkPlugin {
24168
24337
  initRuntimeAdapter(options) {
24169
24338
  for (const plugin of this.plugins) plugin.initRuntimeAdapter?.(options);
@@ -24279,7 +24448,7 @@ function createEnv(opts) {
24279
24448
  }
24280
24449
  //#endregion
24281
24450
  //#region package.json
24282
- var version$1 = "0.18.3";
24451
+ var version$1 = "0.18.4";
24283
24452
  //#endregion
24284
24453
  //#region src/lib/env.ts
24285
24454
  const URLWithTrailingSlash = url().transform(ensureTrailingSlash);
@@ -25482,16 +25651,16 @@ const CLI_SCOPE_ALIASES = ["read", "read,write"];
25482
25651
  `${productBrand.name}`, `${productBrand.name}`;
25483
25652
  const isCLIScopeAlias = (scope) => CLI_SCOPE_ALIASES.some((alias) => alias === scope);
25484
25653
  const parseDeviceScopeAlias = (scope) => {
25485
- if (!isCLIScopeAlias(scope)) return G.err({
25654
+ if (!isCLIScopeAlias(scope)) return ae.err({
25486
25655
  code: "invalid_device_authorization_scope",
25487
25656
  scope
25488
25657
  });
25489
- return G.ok(scope);
25658
+ return ae.ok(scope);
25490
25659
  };
25491
25660
  const parseCLIScopeAlias = parseDeviceScopeAlias;
25492
25661
  const scopeAliasFromAccessChoices$1 = (choices) => choices.includes("write") ? "read,write" : "read";
25493
25662
  //#endregion
25494
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
25663
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
25495
25664
  function createModulerModifier() {
25496
25665
  const getModuleFromFileName = createGetModuleFromFilename();
25497
25666
  return async (frames) => {
@@ -25521,7 +25690,7 @@ function normalizeWindowsPath(path) {
25521
25690
  return path.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
25522
25691
  }
25523
25692
  //#endregion
25524
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/featureFlagUtils.mjs
25693
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/featureFlagUtils.mjs
25525
25694
  const normalizeFlagsResponse = (flagsResponse) => {
25526
25695
  if ("flags" in flagsResponse) {
25527
25696
  const featureFlags = getFlagValuesFromFlags(flagsResponse.flags);
@@ -25578,8 +25747,67 @@ const parsePayload = (response) => {
25578
25747
  return response;
25579
25748
  }
25580
25749
  };
25750
+ const MINIMAL_FLAG_CALLED_EVENT_PROPERTIES = [
25751
+ "$feature_flag",
25752
+ "$feature_flag_response",
25753
+ "$feature_flag_has_experiment",
25754
+ "$feature_flag_id",
25755
+ "$feature_flag_version",
25756
+ "$feature_flag_reason",
25757
+ "$feature_flag_request_id",
25758
+ "$feature_flag_evaluated_at",
25759
+ "$feature_flag_error",
25760
+ "locally_evaluated",
25761
+ "$groups",
25762
+ "$process_person_profile",
25763
+ "$geoip_disable",
25764
+ "$current_url",
25765
+ "$pathname",
25766
+ "$referring_domain",
25767
+ ...[
25768
+ "utm_source",
25769
+ "utm_medium",
25770
+ "utm_campaign",
25771
+ "utm_content",
25772
+ "utm_term",
25773
+ "gad_source",
25774
+ "mc_cid",
25775
+ "gclid",
25776
+ "gclsrc",
25777
+ "dclid",
25778
+ "gbraid",
25779
+ "wbraid",
25780
+ "fbclid",
25781
+ "msclkid",
25782
+ "twclid",
25783
+ "li_fat_id",
25784
+ "igshid",
25785
+ "ttclid",
25786
+ "rdt_cid",
25787
+ "epik",
25788
+ "qclid",
25789
+ "sccid",
25790
+ "irclid",
25791
+ "_kx"
25792
+ ],
25793
+ "$session_id",
25794
+ "$window_id",
25795
+ "$lib",
25796
+ "$lib_version",
25797
+ "$device_id",
25798
+ "$is_server"
25799
+ ];
25800
+ const minimizeFlagCalledEventProperties = (properties, transportKeys = []) => {
25801
+ const minimal = {};
25802
+ const copyKey = (key) => {
25803
+ if (void 0 !== properties[key]) minimal[key] = properties[key];
25804
+ };
25805
+ MINIMAL_FLAG_CALLED_EVENT_PROPERTIES.forEach(copyKey);
25806
+ transportKeys.forEach(copyKey);
25807
+ return minimal;
25808
+ };
25581
25809
  //#endregion
25582
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/types.mjs
25810
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/types.mjs
25583
25811
  var types_PostHogPersistedProperty = /*#__PURE__*/ function(PostHogPersistedProperty) {
25584
25812
  PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
25585
25813
  PostHogPersistedProperty["DistinctId"] = "distinct_id";
@@ -25615,7 +25843,7 @@ var types_PostHogPersistedProperty = /*#__PURE__*/ function(PostHogPersistedProp
25615
25843
  return PostHogPersistedProperty;
25616
25844
  }({});
25617
25845
  //#endregion
25618
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/gzip.mjs
25846
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/gzip.mjs
25619
25847
  function isGzipSupported() {
25620
25848
  return "CompressionStream" in globalThis && "TextEncoder" in globalThis && "Response" in globalThis && "function" == typeof Response.prototype.blob;
25621
25849
  }
@@ -25677,7 +25905,7 @@ async function gzipCompress(input, isDebug = true, options) {
25677
25905
  }
25678
25906
  }
25679
25907
  //#endregion
25680
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/utils/bot-detection.mjs
25908
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/utils/bot-detection.mjs
25681
25909
  const DEFAULT_BLOCKED_UA_STRS = [
25682
25910
  "amazonbot",
25683
25911
  "amazonproductbot",
@@ -25766,7 +25994,7 @@ const isBlockedUA = function(ua, customBlockedUserAgents = []) {
25766
25994
  });
25767
25995
  };
25768
25996
  //#endregion
25769
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/utils/string-utils.mjs
25997
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/utils/string-utils.mjs
25770
25998
  function safeJsonStringify(value) {
25771
25999
  const ancestors = [];
25772
26000
  return JSON.stringify(value, function(_key, replacementValue) {
@@ -25786,7 +26014,7 @@ function safeJsonStringify(value) {
25786
26014
  }) ?? "null";
25787
26015
  }
25788
26016
  //#endregion
25789
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/utils/type-utils.mjs
26017
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/utils/type-utils.mjs
25790
26018
  const nativeIsArray = Array.isArray;
25791
26019
  const ObjProto = Object.prototype;
25792
26020
  ObjProto.hasOwnProperty;
@@ -25801,13 +26029,22 @@ const isEmptyString = (x) => isString$1(x) && 0 === x.trim().length;
25801
26029
  const isNull = (x) => null === x;
25802
26030
  const isNumber = (x) => "[object Number]" == type_utils_toString.call(x) && x === x;
25803
26031
  const isBoolean = (x) => "[object Boolean]" === type_utils_toString.call(x);
25804
- const isPlainError = (x) => x instanceof Error;
25805
26032
  function isPrimitive(value) {
25806
26033
  return null === value || "object" != typeof value;
25807
26034
  }
25808
26035
  function isBuiltin(candidate, className) {
25809
26036
  return Object.prototype.toString.call(candidate) === `[object ${className}]`;
25810
26037
  }
26038
+ function isError$1(candidate) {
26039
+ switch (Object.prototype.toString.call(candidate)) {
26040
+ case "[object Error]":
26041
+ case "[object Exception]":
26042
+ case "[object DOMException]":
26043
+ case "[object DOMError]":
26044
+ case "[object WebAssembly.Exception]": return true;
26045
+ default: return isInstanceOf(candidate, Error);
26046
+ }
26047
+ }
25811
26048
  function isEvent(candidate) {
25812
26049
  return "undefined" != typeof Event && isInstanceOf(candidate, Event);
25813
26050
  }
@@ -25822,7 +26059,7 @@ function isInstanceOf(candidate, base) {
25822
26059
  }
25823
26060
  }
25824
26061
  //#endregion
25825
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/utils/number-utils.mjs
26062
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/utils/number-utils.mjs
25826
26063
  function clampToRange(value, min, max, logger, fallbackValue) {
25827
26064
  if (min > max) {
25828
26065
  logger.warn("min cannot be greater than max.");
@@ -25840,7 +26077,7 @@ function clampToRange(value, min, max, logger, fallbackValue) {
25840
26077
  return clampToRange(fallbackValue || max, min, max, logger);
25841
26078
  }
25842
26079
  //#endregion
25843
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
26080
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
25844
26081
  const ONE_DAY_IN_MS = 864e5;
25845
26082
  function resolveExceptionRateLimiterConfig(config = {}) {
25846
26083
  return {
@@ -25886,8 +26123,10 @@ var BucketedRateLimiter = class {
25886
26123
  this._buckets = {};
25887
26124
  }
25888
26125
  };
26126
+ Date.prototype.getTime;
26127
+ Date.prototype.toISOString;
25889
26128
  //#endregion
25890
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
26129
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
25891
26130
  /*! For license information please see uuidv7.mjs.LICENSE.txt */
25892
26131
  /**
25893
26132
  * uuidv7: An experimental implementation of the proposed UUID Version 7
@@ -26053,7 +26292,7 @@ let defaultGenerator;
26053
26292
  const uuidv7 = () => uuidv7obj().toString();
26054
26293
  const uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator())).generate();
26055
26294
  //#endregion
26056
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/utils/promise-queue.mjs
26295
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/utils/promise-queue.mjs
26057
26296
  var PromiseQueue = class {
26058
26297
  add(promise) {
26059
26298
  const promiseUUID = uuidv7();
@@ -26092,7 +26331,7 @@ var PromiseQueue = class {
26092
26331
  }
26093
26332
  };
26094
26333
  //#endregion
26095
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/utils/logger.mjs
26334
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/utils/logger.mjs
26096
26335
  function createConsole(consoleLike = console) {
26097
26336
  return {
26098
26337
  log: consoleLike.log.bind(consoleLike),
@@ -26132,7 +26371,7 @@ function createLogger(prefix, maybeCall = passThrough) {
26132
26371
  return _createLogger(prefix, maybeCall, createConsole());
26133
26372
  }
26134
26373
  //#endregion
26135
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
26374
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
26136
26375
  const MOBILE = "Mobile";
26137
26376
  const TABLET = "Tablet";
26138
26377
  const NINTENDO = "Nintendo";
@@ -26144,7 +26383,7 @@ const WINDOWS = "Windows";
26144
26383
  new RegExp(XBOX, "i");
26145
26384
  new RegExp(NINTENDO, "i"), new RegExp(PLAYSTATION, "i"), new RegExp(WINDOWS, "i");
26146
26385
  //#endregion
26147
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/utils/index.mjs
26386
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/utils/index.mjs
26148
26387
  const STRING_FORMAT = "utf8";
26149
26388
  const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
26150
26389
  function isValidUUID(value) {
@@ -26177,6 +26416,23 @@ function safeSetTimeout(fn, timeout) {
26177
26416
  t?.unref && t?.unref();
26178
26417
  return t;
26179
26418
  }
26419
+ async function raceWithTimeout(promise, timeoutMs, onTimeout) {
26420
+ let timeoutHandle;
26421
+ try {
26422
+ return await Promise.race([promise, new Promise((resolve, reject) => {
26423
+ timeoutHandle = safeSetTimeout(() => {
26424
+ try {
26425
+ onTimeout?.();
26426
+ resolve();
26427
+ } catch (error) {
26428
+ reject(error);
26429
+ }
26430
+ }, timeoutMs);
26431
+ })]);
26432
+ } finally {
26433
+ clearTimeout(timeoutHandle);
26434
+ }
26435
+ }
26180
26436
  const isError = (x) => x instanceof Error;
26181
26437
  function allSettled(promises) {
26182
26438
  return Promise.all(promises.map((p) => (p ?? Promise.resolve()).then((value) => ({
@@ -26240,7 +26496,7 @@ function toOtlpKeyValueList(attrs) {
26240
26496
  return result;
26241
26497
  }
26242
26498
  //#endregion
26243
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/metrics/metrics-utils.mjs
26499
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/metrics/metrics-utils.mjs
26244
26500
  const DEFAULT_HISTOGRAM_BOUNDS = [
26245
26501
  0,
26246
26502
  5,
@@ -26293,7 +26549,7 @@ function buildOtlpMetricsPayload(metrics, resourceAttributes, scopeName, scopeVe
26293
26549
  }] };
26294
26550
  }
26295
26551
  //#endregion
26296
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/metrics/config.mjs
26552
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/metrics/config.mjs
26297
26553
  const DEFAULT_FLUSH_INTERVAL_MS = 1e4;
26298
26554
  const DEFAULT_MAX_SERIES_PER_FLUSH = 1e3;
26299
26555
  function resolveMetricsConfig(config) {
@@ -26309,7 +26565,7 @@ function resolveMetricsConfig(config) {
26309
26565
  };
26310
26566
  }
26311
26567
  //#endregion
26312
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/metrics/index.mjs
26568
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/metrics/index.mjs
26313
26569
  const OTLP_TEMPORALITY_DELTA = 1;
26314
26570
  var PostHogMetrics = class {
26315
26571
  constructor(_instance, _config, _logger) {
@@ -26595,7 +26851,7 @@ var PostHogMetrics = class {
26595
26851
  }
26596
26852
  };
26597
26853
  //#endregion
26598
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/eventemitter.mjs
26854
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/eventemitter.mjs
26599
26855
  var SimpleEventEmitter = class {
26600
26856
  constructor() {
26601
26857
  this.events = {};
@@ -26614,7 +26870,7 @@ var SimpleEventEmitter = class {
26614
26870
  }
26615
26871
  };
26616
26872
  //#endregion
26617
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
26873
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
26618
26874
  let parsedStackResults;
26619
26875
  let lastKeysCount;
26620
26876
  let cachedFilenameChunkIds;
@@ -26645,7 +26901,7 @@ function getFilenameToChunkIdMap(stackParser) {
26645
26901
  return cachedFilenameChunkIds;
26646
26902
  }
26647
26903
  //#endregion
26648
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
26904
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
26649
26905
  const MAX_CAUSE_RECURSION = 4;
26650
26906
  var ErrorPropertiesBuilder = class {
26651
26907
  constructor(coercers, stackParser, modifiers = []) {
@@ -26760,14 +27016,14 @@ function createFrame(platform, filename, func, lineno, colno) {
26760
27016
  return frame;
26761
27017
  }
26762
27018
  //#endregion
26763
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
27019
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
26764
27020
  const extractSafariExtensionDetails = (func, filename) => {
26765
27021
  const isSafariExtension = -1 !== func.indexOf("safari-extension");
26766
27022
  const isSafariWebExtension = -1 !== func.indexOf("safari-web-extension");
26767
27023
  return isSafariExtension || isSafariWebExtension ? [-1 !== func.indexOf("@") ? func.split("@")[0] : "?", isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`] : [func, filename];
26768
27024
  };
26769
27025
  //#endregion
26770
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
27026
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
26771
27027
  const chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
26772
27028
  const chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
26773
27029
  const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
@@ -26792,7 +27048,7 @@ const chromeStackLineParser = (line, platform) => {
26792
27048
  }
26793
27049
  };
26794
27050
  //#endregion
26795
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
27051
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
26796
27052
  const geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
26797
27053
  const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
26798
27054
  const geckoStackLineParser = (line, platform) => {
@@ -26814,9 +27070,12 @@ const geckoStackLineParser = (line, platform) => {
26814
27070
  }
26815
27071
  };
26816
27072
  //#endregion
26817
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
27073
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
26818
27074
  const FILENAME_MATCH = /^\s*[-]{4,}$/;
26819
27075
  const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
27076
+ const PROMISE_COMBINATOR = /^Promise\.(?:all|any)$/;
27077
+ const PROMISE_INDEX = /^index \d+$/;
27078
+ const PROMISE_FRAME_FILENAME = "node:internal/promise";
26820
27079
  const nodeStackLineParser = (line, platform) => {
26821
27080
  const lineMatch = line.match(FULL_MATCH);
26822
27081
  if (lineMatch) {
@@ -26856,6 +27115,7 @@ const nodeStackLineParser = (line, platform) => {
26856
27115
  const isNative = "native" === lineMatch[5];
26857
27116
  if (filename?.match(/\/[A-Z]:/)) filename = filename.slice(1);
26858
27117
  if (!filename && lineMatch[5] && !isNative) filename = lineMatch[5];
27118
+ if (PROMISE_COMBINATOR.test(functionName) && PROMISE_INDEX.test(filename || "")) filename = PROMISE_FRAME_FILENAME;
26859
27119
  return {
26860
27120
  filename: filename ? decodeURI(filename) : void 0,
26861
27121
  module: void 0,
@@ -26878,7 +27138,7 @@ function _parseIntOrUndefined(input) {
26878
27138
  return parseInt(input || "", 10) || void 0;
26879
27139
  }
26880
27140
  //#endregion
26881
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
27141
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
26882
27142
  const WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
26883
27143
  const STACKTRACE_FRAME_LIMIT = 50;
26884
27144
  function reverseAndStripFrames(stack) {
@@ -26920,10 +27180,10 @@ function createStackParser(platform, ...parsers) {
26920
27180
  };
26921
27181
  }
26922
27182
  //#endregion
26923
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
27183
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
26924
27184
  var ErrorCoercer = class {
26925
27185
  match(err) {
26926
- return isPlainError(err);
27186
+ return isError$1(err);
26927
27187
  }
26928
27188
  coerce(err, ctx) {
26929
27189
  return {
@@ -26947,7 +27207,7 @@ var ErrorCoercer = class {
26947
27207
  }
26948
27208
  };
26949
27209
  //#endregion
26950
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
27210
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
26951
27211
  const ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
26952
27212
  var StringCoercer = class {
26953
27213
  match(input) {
@@ -26974,7 +27234,7 @@ var StringCoercer = class {
26974
27234
  }
26975
27235
  };
26976
27236
  //#endregion
26977
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/types.mjs
27237
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/types.mjs
26978
27238
  const severityLevels = [
26979
27239
  "fatal",
26980
27240
  "error",
@@ -26984,7 +27244,7 @@ const severityLevels = [
26984
27244
  "debug"
26985
27245
  ];
26986
27246
  //#endregion
26987
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
27247
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
26988
27248
  function extractExceptionKeysForMessage(err, maxLength = 40) {
26989
27249
  const keys = Object.keys(err);
26990
27250
  keys.sort();
@@ -26999,7 +27259,7 @@ function extractExceptionKeysForMessage(err, maxLength = 40) {
26999
27259
  return "";
27000
27260
  }
27001
27261
  //#endregion
27002
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
27262
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
27003
27263
  var ObjectCoercer = class {
27004
27264
  match(candidate) {
27005
27265
  return "object" == typeof candidate && null !== candidate;
@@ -27010,7 +27270,7 @@ var ObjectCoercer = class {
27010
27270
  return {
27011
27271
  type: this.getType(candidate),
27012
27272
  value: this.getValue(candidate),
27013
- stack: ctx.syntheticException?.stack,
27273
+ stack: this.getStack(candidate) ?? ctx.syntheticException?.stack,
27014
27274
  level: this.isSeverityLevel(candidate.level) ? candidate.level : "error",
27015
27275
  synthetic: true
27016
27276
  };
@@ -27032,6 +27292,14 @@ var ObjectCoercer = class {
27032
27292
  isSeverityLevel(x) {
27033
27293
  return isString$1(x) && !isEmptyString(x) && severityLevels.indexOf(x) >= 0;
27034
27294
  }
27295
+ getStack(candidate) {
27296
+ try {
27297
+ if (isString$1(candidate.stacktrace) && candidate.stacktrace.length > 0) return candidate.stacktrace;
27298
+ return isString$1(candidate.stack) && candidate.stack.length > 0 ? candidate.stack : void 0;
27299
+ } catch {
27300
+ return;
27301
+ }
27302
+ }
27035
27303
  getErrorPropertyFromObject(obj) {
27036
27304
  for (const prop in obj) if (Object.prototype.hasOwnProperty.call(obj, prop)) {
27037
27305
  const value = obj[prop];
@@ -27048,7 +27316,7 @@ var ObjectCoercer = class {
27048
27316
  }
27049
27317
  };
27050
27318
  //#endregion
27051
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
27319
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
27052
27320
  var EventCoercer = class {
27053
27321
  match(err) {
27054
27322
  return isEvent(err);
@@ -27064,7 +27332,7 @@ var EventCoercer = class {
27064
27332
  }
27065
27333
  };
27066
27334
  //#endregion
27067
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
27335
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
27068
27336
  var PrimitiveCoercer = class {
27069
27337
  match(candidate) {
27070
27338
  return isPrimitive(candidate);
@@ -27079,7 +27347,7 @@ var PrimitiveCoercer = class {
27079
27347
  }
27080
27348
  };
27081
27349
  //#endregion
27082
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/utils.mjs
27350
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/utils.mjs
27083
27351
  var ReduceableCache = class {
27084
27352
  constructor(_maxSize) {
27085
27353
  this._maxSize = _maxSize;
@@ -27103,14 +27371,20 @@ var ReduceableCache = class {
27103
27371
  }
27104
27372
  };
27105
27373
  //#endregion
27106
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/error-tracking/exception-steps.mjs
27374
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/exception-steps.mjs
27107
27375
  const EXCEPTION_STEP_INTERNAL_FIELDS = {
27108
27376
  MESSAGE: "$message",
27109
27377
  TIMESTAMP: "$timestamp"
27110
27378
  };
27111
27379
  EXCEPTION_STEP_INTERNAL_FIELDS.MESSAGE, EXCEPTION_STEP_INTERNAL_FIELDS.TIMESTAMP;
27112
27380
  //#endregion
27113
- //#region ../../node_modules/.bun/@posthog+core@1.43.1/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
27381
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/error-tracking/release.mjs
27382
+ function getInjectedReleaseId() {
27383
+ const injected = globalThis._posthogReleaseId;
27384
+ return "string" == typeof injected && injected.length > 0 ? injected : void 0;
27385
+ }
27386
+ //#endregion
27387
+ //#region ../../node_modules/.bun/@posthog+core@1.46.7/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
27114
27388
  var PostHogFetchHttpError = class extends Error {
27115
27389
  constructor(response, reqByteLength) {
27116
27390
  super("HTTP error while fetching PostHog: status=" + response.status + ", reqByteLength=" + reqByteLength), this.response = response, this.reqByteLength = reqByteLength, this.name = "PostHogFetchHttpError";
@@ -27268,17 +27542,21 @@ var PostHogCoreStateless = class {
27268
27542
  }
27269
27543
  buildPayload(payload) {
27270
27544
  const userProperties = payload.properties || {};
27271
- const properties = {
27545
+ let properties = {
27272
27546
  ...userProperties,
27273
27547
  ...this.getCommonEventProperties()
27274
27548
  };
27275
27549
  applyCallerFeatureFlagOverrides(properties, userProperties);
27550
+ if ("$feature_flag_called" === payload.event && false === properties.$feature_flag_has_experiment && this.isMinimalFlagCalledEventsEnabled()) properties = minimizeFlagCalledEventProperties(properties);
27276
27551
  return {
27277
27552
  distinct_id: payload.distinct_id,
27278
27553
  event: payload.event,
27279
27554
  properties
27280
27555
  };
27281
27556
  }
27557
+ isMinimalFlagCalledEventsEnabled() {
27558
+ return false;
27559
+ }
27282
27560
  addPendingPromise(promise) {
27283
27561
  return this.promiseQueue.add(promise);
27284
27562
  }
@@ -27750,7 +28028,15 @@ var PostHogCoreStateless = class {
27750
28028
  const batchItems = queue.slice(0, this.maxBatchSize);
27751
28029
  const batchMessages = batchItems.map((item) => void 0 === item.message ? item.message : this.normalizeMessage(item.message));
27752
28030
  const persistQueueChange = async () => {
27753
- const newQueue = (this.getPersistedProperty(queueKey) || []).slice(batchItems.length);
28031
+ const refreshedQueue = this.getPersistedProperty(queueKey) || [];
28032
+ const remainingBatchItems = [...batchItems];
28033
+ const newQueue = refreshedQueue.filter((item) => {
28034
+ const itemUuid = item.message?.uuid;
28035
+ const batchItemIndex = remainingBatchItems.findIndex((batchItem) => batchItem === item || "string" == typeof itemUuid && itemUuid.length > 0 && batchItem.message?.uuid === itemUuid);
28036
+ if (-1 === batchItemIndex) return true;
28037
+ remainingBatchItems.splice(batchItemIndex, 1);
28038
+ return false;
28039
+ });
27754
28040
  this.setPersistedProperty(queueKey, newQueue);
27755
28041
  queue = newQueue;
27756
28042
  this._dequeuedMessagesCount += batchItems.length;
@@ -27900,18 +28186,11 @@ var PostHogCoreStateless = class {
27900
28186
  await logFlushError(e);
27901
28187
  }
27902
28188
  };
27903
- let timeoutHandle;
27904
- try {
27905
- return await Promise.race([new Promise((_, reject) => {
27906
- timeoutHandle = safeSetTimeout(() => {
27907
- this._logger.error("Timed out while shutting down PostHog");
27908
- hasTimedOut = true;
27909
- reject("Timeout while shutting down PostHog. Some events may not have been sent.");
27910
- }, shutdownTimeoutMs);
27911
- }), doShutdown()]);
27912
- } finally {
27913
- clearTimeout(timeoutHandle);
27914
- }
28189
+ return raceWithTimeout(doShutdown(), shutdownTimeoutMs, () => {
28190
+ this._logger.error("Timed out while shutting down PostHog");
28191
+ hasTimedOut = true;
28192
+ throw "Timeout while shutting down PostHog. Some events may not have been sent.";
28193
+ });
27915
28194
  }
27916
28195
  async shutdown(shutdownTimeoutMs = 3e4) {
27917
28196
  if (this.shutdownPromise) this._logger.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup");
@@ -27922,16 +28201,22 @@ var PostHogCoreStateless = class {
27922
28201
  }
27923
28202
  };
27924
28203
  //#endregion
27925
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
28204
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs
27926
28205
  const LRU_FILE_CONTENTS_CACHE = new ReduceableCache(25);
27927
28206
  const LRU_FILE_CONTENTS_FS_READ_FAILED = new ReduceableCache(20);
27928
28207
  const DEFAULT_LINES_OF_CONTEXT = 7;
27929
- async function addSourceContext(frames) {
28208
+ const MAX_CONTEXTLINES_FILE_SIZE = 10485760;
28209
+ async function addSourceContext(frames, openSourceFile = open, logger) {
27930
28210
  const filesToLines = {};
28211
+ let basePath;
28212
+ try {
28213
+ basePath = process.cwd();
28214
+ } catch {}
27931
28215
  for (let i = frames.length - 1; i >= 0; i--) {
27932
28216
  const frame = frames[i];
27933
28217
  const filename = frame?.filename;
27934
28218
  if (!frame || "string" != typeof filename || "number" != typeof frame.lineno || shouldSkipContextLinesForFile(filename) || shouldSkipContextLinesForFrame(frame)) continue;
28219
+ if (!isAbsolute(filename) && void 0 === basePath) continue;
27935
28220
  if (!filesToLines[filename]) filesToLines[filename] = [];
27936
28221
  filesToLines[filename].push(frame.lineno);
27937
28222
  }
@@ -27939,43 +28224,85 @@ async function addSourceContext(frames) {
27939
28224
  if (0 == files.length) return frames;
27940
28225
  const readlinePromises = [];
27941
28226
  for (const file of files) {
27942
- if (LRU_FILE_CONTENTS_FS_READ_FAILED.get(file)) continue;
28227
+ const cacheKey = makeSourceCacheKey(file, basePath);
28228
+ if (void 0 === cacheKey) continue;
28229
+ if (LRU_FILE_CONTENTS_FS_READ_FAILED.get(cacheKey)) continue;
27943
28230
  const filesToLineRanges = filesToLines[file];
27944
28231
  if (!filesToLineRanges) continue;
27945
28232
  filesToLineRanges.sort((a, b) => a - b);
27946
28233
  const ranges = makeLineReaderRanges(filesToLineRanges);
27947
- if (ranges.every((r) => rangeExistsInContentCache(file, r))) continue;
27948
- const cache = emplace(LRU_FILE_CONTENTS_CACHE, file, {});
27949
- readlinePromises.push(getContextLinesFromFile(file, ranges, cache));
28234
+ if (ranges.every((r) => rangeExistsInContentCache(cacheKey, r))) continue;
28235
+ const cache = emplace(LRU_FILE_CONTENTS_CACHE, cacheKey, {});
28236
+ readlinePromises.push(getContextLinesFromFile(file, ranges, cache, cacheKey, openSourceFile, logger));
27950
28237
  }
27951
28238
  await Promise.all(readlinePromises).catch(() => {});
27952
- if (frames && frames.length > 0) addSourceContextToFrames(frames, LRU_FILE_CONTENTS_CACHE);
28239
+ if (frames && frames.length > 0) addSourceContextToFrames(frames, LRU_FILE_CONTENTS_CACHE, basePath);
27953
28240
  LRU_FILE_CONTENTS_CACHE.reduce();
27954
28241
  return frames;
27955
28242
  }
27956
- function getContextLinesFromFile(path, ranges, output) {
28243
+ async function openRegularSourceFile(path, openSourceFile, logger) {
28244
+ let fileHandle;
28245
+ let isValid = false;
28246
+ try {
28247
+ fileHandle = await openSourceFile(path, constants.O_RDONLY | constants.O_NONBLOCK);
28248
+ const fileStat = await fileHandle.stat();
28249
+ if (!fileStat.isFile()) return;
28250
+ if (fileStat.size > 10485760) return void logger?.debug(`Skipping source context for oversized file ${path}: ${fileStat.size} bytes exceeds ${MAX_CONTEXTLINES_FILE_SIZE}`);
28251
+ isValid = true;
28252
+ return fileHandle;
28253
+ } catch {
28254
+ return;
28255
+ } finally {
28256
+ if (fileHandle && !isValid) await fileHandle.close().catch(() => {});
28257
+ }
28258
+ }
28259
+ async function getContextLinesFromFile(path, ranges, output, cacheKey, openSourceFile, logger) {
28260
+ const fileHandle = await openRegularSourceFile(path, openSourceFile, logger);
28261
+ if (void 0 === fileHandle) return void LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
28262
+ const openedFileHandle = fileHandle;
27957
28263
  return new Promise((resolve) => {
27958
- const stream = createReadStream(path);
27959
- const lineReaded = createInterface({ input: stream });
27960
- function destroyStreamAndResolve() {
27961
- stream.destroy();
27962
- resolve();
28264
+ let finished = false;
28265
+ function destroyStreamAndResolve(stream) {
28266
+ if (finished) return;
28267
+ finished = true;
28268
+ stream?.destroy();
28269
+ openedFileHandle.close().then(resolve, resolve);
28270
+ }
28271
+ let stream;
28272
+ try {
28273
+ stream = openedFileHandle.createReadStream({
28274
+ autoClose: false,
28275
+ start: 0,
28276
+ end: MAX_CONTEXTLINES_FILE_SIZE - 1
28277
+ });
28278
+ } catch {
28279
+ LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
28280
+ destroyStreamAndResolve();
28281
+ return;
28282
+ }
28283
+ let lineReaded;
28284
+ try {
28285
+ lineReaded = createInterface({ input: stream });
28286
+ } catch {
28287
+ LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
28288
+ destroyStreamAndResolve(stream);
28289
+ return;
27963
28290
  }
27964
28291
  let lineNumber = 0;
27965
28292
  let currentRangeIndex = 0;
27966
28293
  const range = ranges[currentRangeIndex];
27967
- if (void 0 === range) return void destroyStreamAndResolve();
28294
+ if (void 0 === range) return void destroyStreamAndResolve(stream);
27968
28295
  let rangeStart = range[0];
27969
28296
  let rangeEnd = range[1];
27970
28297
  function onStreamError() {
27971
- LRU_FILE_CONTENTS_FS_READ_FAILED.set(path, 1);
28298
+ LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
27972
28299
  lineReaded.close();
27973
28300
  lineReaded.removeAllListeners();
27974
- destroyStreamAndResolve();
28301
+ destroyStreamAndResolve(stream);
27975
28302
  }
27976
28303
  stream.on("error", onStreamError);
27977
28304
  lineReaded.on("error", onStreamError);
27978
- lineReaded.on("close", destroyStreamAndResolve);
28305
+ lineReaded.on("close", () => destroyStreamAndResolve(stream));
27979
28306
  lineReaded.on("line", (line) => {
27980
28307
  lineNumber++;
27981
28308
  if (lineNumber < rangeStart) return;
@@ -27999,9 +28326,10 @@ function getContextLinesFromFile(path, ranges, output) {
27999
28326
  });
28000
28327
  });
28001
28328
  }
28002
- function addSourceContextToFrames(frames, cache) {
28329
+ function addSourceContextToFrames(frames, cache, basePath) {
28003
28330
  for (const frame of frames) if (frame.filename && void 0 === frame.context_line && "number" == typeof frame.lineno) {
28004
- const contents = cache.get(frame.filename);
28331
+ const cacheKey = makeSourceCacheKey(frame.filename, basePath);
28332
+ const contents = void 0 === cacheKey ? void 0 : cache.get(cacheKey);
28005
28333
  if (void 0 === contents) continue;
28006
28334
  addContextToFrame(frame.lineno, frame, contents);
28007
28335
  }
@@ -28037,8 +28365,12 @@ function shouldSkipContextLinesForFrame(frame) {
28037
28365
  if (void 0 !== frame.colno && frame.colno > 1e3) return true;
28038
28366
  return false;
28039
28367
  }
28040
- function rangeExistsInContentCache(file, range) {
28041
- const contents = LRU_FILE_CONTENTS_CACHE.get(file);
28368
+ function makeSourceCacheKey(path, basePath) {
28369
+ if (isAbsolute(path)) return JSON.stringify([null, path]);
28370
+ return void 0 === basePath ? void 0 : JSON.stringify([basePath, path]);
28371
+ }
28372
+ function rangeExistsInContentCache(cacheKey, range) {
28373
+ const contents = LRU_FILE_CONTENTS_CACHE.get(cacheKey);
28042
28374
  if (void 0 === contents) return false;
28043
28375
  for (let i = range[0]; i <= range[1]; i++) if (void 0 === contents[i]) return false;
28044
28376
  return true;
@@ -28099,23 +28431,23 @@ function snipLine(line, colno) {
28099
28431
  return newLine;
28100
28432
  }
28101
28433
  //#endregion
28102
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
28434
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/relative-path.node.mjs
28103
28435
  function createRelativePathModifier(basePath = process.cwd()) {
28104
28436
  const isWindows = "\\" === sep;
28105
28437
  const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
28106
28438
  const normalizedBase = toUnix(basePath);
28107
28439
  return async (frames) => {
28108
28440
  for (const frame of frames) if (!(!frame.filename || frame.filename.startsWith("node:") || frame.filename.startsWith("data:"))) {
28109
- if (isAbsolute(frame.filename)) frame.filename = toUnix(relative(normalizedBase, toUnix(frame.filename)));
28441
+ if (isAbsolute$1(frame.filename)) frame.filename = toUnix(relative(normalizedBase, toUnix(frame.filename)));
28110
28442
  }
28111
28443
  return frames;
28112
28444
  };
28113
28445
  }
28114
28446
  //#endregion
28115
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/version.mjs
28116
- const version = "5.45.2";
28447
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/version.mjs
28448
+ const version = "5.47.10";
28117
28449
  //#endregion
28118
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/types.mjs
28450
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/types.mjs
28119
28451
  const FeatureFlagError = {
28120
28452
  ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
28121
28453
  FLAG_MISSING: "flag_missing",
@@ -28123,7 +28455,7 @@ const FeatureFlagError = {
28123
28455
  UNKNOWN_ERROR: "unknown_error"
28124
28456
  };
28125
28457
  //#endregion
28126
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/feature-flag-evaluations.mjs
28458
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/feature-flag-evaluations.mjs
28127
28459
  var FeatureFlagEvaluations = class FeatureFlagEvaluations {
28128
28460
  constructor(init) {
28129
28461
  this._host = init.host;
@@ -28241,7 +28573,7 @@ var FeatureFlagEvaluations = class FeatureFlagEvaluations {
28241
28573
  }
28242
28574
  };
28243
28575
  //#endregion
28244
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
28576
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
28245
28577
  async function hashSHA1(text) {
28246
28578
  const subtle = globalThis.crypto?.subtle;
28247
28579
  if (!subtle) throw new Error("SubtleCrypto API not available");
@@ -28249,7 +28581,7 @@ async function hashSHA1(text) {
28249
28581
  return Array.from(new Uint8Array(hashBuffer)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
28250
28582
  }
28251
28583
  //#endregion
28252
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
28584
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
28253
28585
  const SIXTY_SECONDS = 6e4;
28254
28586
  const LONG_SCALE = 0x1000000000000000;
28255
28587
  const NULL_VALUES_ALLOWED_OPERATORS = ["is_not", "is_set"];
@@ -28284,6 +28616,7 @@ var FeatureFlagsPoller = class {
28284
28616
  this.debugMode = false;
28285
28617
  this.shouldBeginExponentialBackoff = false;
28286
28618
  this.backOffCount = 0;
28619
+ this.pollerStopped = false;
28287
28620
  this.pollingInterval = pollingInterval;
28288
28621
  this.personalApiKey = personalApiKey;
28289
28622
  this.featureFlags = [];
@@ -28299,6 +28632,7 @@ var FeatureFlagsPoller = class {
28299
28632
  this.onError = options.onError;
28300
28633
  this.customHeaders = customHeaders;
28301
28634
  this.onLoad = options.onLoad;
28635
+ this.onMinimalFlagCalledEvents = options.onMinimalFlagCalledEvents;
28302
28636
  this.cacheProvider = options.cacheProvider;
28303
28637
  this.strictLocalEvaluation = options.strictLocalEvaluation ?? false;
28304
28638
  this.loadFeatureFlags();
@@ -28549,6 +28883,7 @@ var FeatureFlagsPoller = class {
28549
28883
  this.groupTypeMapping = flagData.groupTypeMapping;
28550
28884
  this.cohorts = flagData.cohorts;
28551
28885
  this.loadedSuccessfullyOnce = true;
28886
+ this.onMinimalFlagCalledEvents?.(true === flagData.minimalFlagCalledEvents);
28552
28887
  }
28553
28888
  warnAboutExperienceContinuityFlags(flags) {
28554
28889
  if (this.strictLocalEvaluation) return;
@@ -28605,7 +28940,6 @@ var FeatureFlagsPoller = class {
28605
28940
  clearTimeout(this.poller);
28606
28941
  this.poller = void 0;
28607
28942
  }
28608
- this.poller = setTimeout(() => this.loadFeatureFlags(true), this.getPollingInterval());
28609
28943
  try {
28610
28944
  let shouldFetch = true;
28611
28945
  if (this.cacheProvider) try {
@@ -28635,6 +28969,7 @@ var FeatureFlagsPoller = class {
28635
28969
  this.featureFlagsByKey = {};
28636
28970
  this.groupTypeMapping = {};
28637
28971
  this.cohorts = {};
28972
+ this.onMinimalFlagCalledEvents?.(false);
28638
28973
  return;
28639
28974
  case 403:
28640
28975
  this.beginBackoff();
@@ -28649,7 +28984,8 @@ var FeatureFlagsPoller = class {
28649
28984
  const flagData = {
28650
28985
  flags: responseJson.flags ?? [],
28651
28986
  groupTypeMapping: responseJson.group_type_mapping || {},
28652
- cohorts: responseJson.cohorts || {}
28987
+ cohorts: responseJson.cohorts || {},
28988
+ minimalFlagCalledEvents: true === responseJson.minimal_flag_called_events
28653
28989
  };
28654
28990
  this.updateFlagState(flagData);
28655
28991
  this.flagDefinitionsLoadedAt = Date.now();
@@ -28667,6 +29003,8 @@ var FeatureFlagsPoller = class {
28667
29003
  }
28668
29004
  } catch (err) {
28669
29005
  if (err instanceof ClientError) this.onError?.(err);
29006
+ } finally {
29007
+ if (!this.pollerStopped) this.poller = setTimeout(() => this.loadFeatureFlags(true), this.getPollingInterval());
28670
29008
  }
28671
29009
  }
28672
29010
  getPersonalApiKeyRequestOptions(method = "GET", etag) {
@@ -28681,7 +29019,7 @@ var FeatureFlagsPoller = class {
28681
29019
  headers
28682
29020
  };
28683
29021
  }
28684
- _requestFeatureFlagDefinitions() {
29022
+ async _requestFeatureFlagDefinitions() {
28685
29023
  const url = `${this.host}/flags/definitions?token=${this.projectApiKey}&send_cohorts`;
28686
29024
  const options = this.getPersonalApiKeyRequestOptions("GET", this.flagsEtag);
28687
29025
  let abortTimeout = null;
@@ -28692,18 +29030,47 @@ var FeatureFlagsPoller = class {
28692
29030
  }, this.timeout);
28693
29031
  options.signal = controller.signal;
28694
29032
  }
29033
+ const clearAbortTimeout = () => clearTimeout(abortTimeout);
28695
29034
  try {
28696
29035
  const fetch1 = this.fetch;
28697
- return fetch1(url, options);
28698
- } finally {
28699
- clearTimeout(abortTimeout);
29036
+ const res = await fetch1(url, options);
29037
+ if (200 !== res.status) {
29038
+ clearAbortTimeout();
29039
+ return res;
29040
+ }
29041
+ return {
29042
+ status: res.status,
29043
+ headers: res.headers,
29044
+ body: res.body,
29045
+ text: async () => {
29046
+ try {
29047
+ return await res.text();
29048
+ } finally {
29049
+ clearAbortTimeout();
29050
+ }
29051
+ },
29052
+ json: async () => {
29053
+ try {
29054
+ return await res.json();
29055
+ } finally {
29056
+ clearAbortTimeout();
29057
+ }
29058
+ }
29059
+ };
29060
+ } catch (err) {
29061
+ clearAbortTimeout();
29062
+ throw err;
28700
29063
  }
28701
29064
  }
28702
29065
  async stopPoller(timeoutMs = 3e4) {
29066
+ this.pollerStopped = true;
28703
29067
  clearTimeout(this.poller);
29068
+ this.poller = void 0;
28704
29069
  if (this.cacheProvider) try {
28705
29070
  const shutdownResult = this.cacheProvider.shutdown();
28706
- if (shutdownResult instanceof Promise) await Promise.race([shutdownResult, new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error(`Cache shutdown timeout after ${timeoutMs}ms`)), timeoutMs))]);
29071
+ if (shutdownResult instanceof Promise) await raceWithTimeout(shutdownResult, timeoutMs, () => {
29072
+ throw new Error(`Cache shutdown timeout after ${timeoutMs}ms`);
29073
+ });
28707
29074
  } catch (err) {
28708
29075
  this.onError?.(/* @__PURE__ */ new Error(`Error during cache shutdown: ${err}`));
28709
29076
  }
@@ -28995,34 +29362,86 @@ function relativeDateParseForFeatureFlagMatching(value) {
28995
29362
  }
28996
29363
  }
28997
29364
  //#endregion
28998
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
29365
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
29366
+ const UNHANDLED_REJECTION_OPTION_NAMES = ["--unhandled-rejections", "--unhandled_rejections"];
29367
+ const UNHANDLED_REJECTION_MODES = /* @__PURE__ */ new Set([
29368
+ "throw",
29369
+ "strict",
29370
+ "warn",
29371
+ "warn-with-error-code",
29372
+ "none"
29373
+ ]);
29374
+ const STARTUP_EXEC_ARGV = [...globalThis.process?.execArgv ?? []];
29375
+ const STARTUP_NODE_OPTIONS = globalThis.process?.env?.NODE_OPTIONS;
29376
+ function splitNodeOptions(nodeOptions) {
29377
+ const args = [];
29378
+ let current = "";
29379
+ let isInString = false;
29380
+ for (let index = 0; index < nodeOptions.length; index++) {
29381
+ const character = nodeOptions[index];
29382
+ if ("\\" === character && isInString && index + 1 < nodeOptions.length) current += nodeOptions[++index];
29383
+ else if (" " !== character || isInString) if ("\"" === character) isInString = !isInString;
29384
+ else current += character;
29385
+ else if (current) {
29386
+ args.push(current);
29387
+ current = "";
29388
+ }
29389
+ }
29390
+ if (current) args.push(current);
29391
+ return args;
29392
+ }
29393
+ function findUnhandledRejectionMode(args) {
29394
+ let mode;
29395
+ for (let index = 0; index < args.length; index++) {
29396
+ const argument = args[index];
29397
+ const optionName = UNHANDLED_REJECTION_OPTION_NAMES.find((name) => argument === name || argument.startsWith(`${name}=`));
29398
+ if (!optionName) continue;
29399
+ const value = argument === optionName ? args[++index] : argument.slice(optionName.length + 1);
29400
+ if (UNHANDLED_REJECTION_MODES.has(value)) mode = value;
29401
+ }
29402
+ return mode;
29403
+ }
29404
+ function getUnhandledRejectionMode(execArgv = STARTUP_EXEC_ARGV, nodeOptions = STARTUP_NODE_OPTIONS) {
29405
+ return findUnhandledRejectionMode(execArgv) ?? findUnhandledRejectionMode(splitNodeOptions(nodeOptions ?? "")) ?? "throw";
29406
+ }
29407
+ const STARTUP_UNHANDLED_REJECTION_MODE = getUnhandledRejectionMode();
29408
+ function captureUncaughtException(captureFn, error, origin) {
29409
+ captureFn(error, { mechanism: {
29410
+ type: "unhandledRejection" === origin ? "onunhandledrejection" : "onuncaughtexception",
29411
+ handled: false
29412
+ } });
29413
+ }
28999
29414
  function makeUncaughtExceptionHandler(captureFn, onFatalFn) {
29000
29415
  let calledFatalError = false;
29001
- return Object.assign((error) => {
29002
- const processWouldExit = 0 === global.process.listeners("uncaughtException").filter((listener) => "domainUncaughtExceptionClear" !== listener.name && true !== listener._posthogErrorHandler).length;
29003
- captureFn(error, { mechanism: {
29004
- type: "onuncaughtexception",
29005
- handled: false
29006
- } });
29007
- if (!calledFatalError && processWouldExit) {
29416
+ return Object.assign((error, origin) => {
29417
+ const userProvidedListenersCount = global.process.listeners("uncaughtException").filter((listener) => "domainUncaughtExceptionClear" !== listener.name && true !== listener._posthogErrorHandler).length;
29418
+ captureUncaughtException(captureFn, error, origin);
29419
+ if (!calledFatalError && 0 === userProvidedListenersCount) {
29008
29420
  calledFatalError = true;
29009
29421
  onFatalFn(error);
29010
29422
  }
29011
29423
  }, { _posthogErrorHandler: true });
29012
29424
  }
29013
- function addUncaughtExceptionListener(captureFn, onFatalFn) {
29014
- globalThis.process?.on("uncaughtException", makeUncaughtExceptionHandler(captureFn, onFatalFn));
29425
+ function addUncaughtExceptionListener(captureFn, onFatalFn, mode = STARTUP_UNHANDLED_REJECTION_MODE) {
29426
+ const process = globalThis.process;
29427
+ if (!process) return;
29428
+ if ("strict" === mode) return void process.on("uncaughtExceptionMonitor", (error, origin) => captureUncaughtException(captureFn, error, origin));
29429
+ process.on("uncaughtException", makeUncaughtExceptionHandler(captureFn, onFatalFn));
29015
29430
  }
29016
- function addUnhandledRejectionListener(captureFn) {
29017
- globalThis.process?.on("unhandledRejection", (reason) => captureFn(reason, { mechanism: {
29018
- type: "onunhandledrejection",
29019
- handled: false
29020
- } }));
29431
+ function addUnhandledRejectionListener(captureFn, mode = STARTUP_UNHANDLED_REJECTION_MODE) {
29432
+ const process = globalThis.process;
29433
+ if (!process || "throw" === mode || "strict" === mode || "warn-with-error-code" === mode) return;
29434
+ process.on("unhandledRejection", (reason) => {
29435
+ captureFn(reason, { mechanism: {
29436
+ type: "onunhandledrejection",
29437
+ handled: false
29438
+ } });
29439
+ });
29021
29440
  }
29022
29441
  //#endregion
29023
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
29442
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
29024
29443
  const SHUTDOWN_TIMEOUT = 2e3;
29025
- var ErrorTracking = class ErrorTracking {
29444
+ var error_tracking_ErrorTracking = class error_tracking_ErrorTracking {
29026
29445
  constructor(client, options, _logger) {
29027
29446
  this.client = client;
29028
29447
  this._exceptionAutocaptureEnabled = options.enableExceptionAutocapture || false;
@@ -29041,6 +29460,8 @@ var ErrorTracking = class ErrorTracking {
29041
29460
  const properties = { ...additionalProperties };
29042
29461
  const exceptionProperties = builder.buildFromUnknown(error, hint);
29043
29462
  exceptionProperties.$exception_list = await builder.modifyFrames(exceptionProperties.$exception_list);
29463
+ const injectedReleaseId = getInjectedReleaseId();
29464
+ if (injectedReleaseId) properties.$release_id = injectedReleaseId;
29044
29465
  return {
29045
29466
  event: "$exception",
29046
29467
  distinctId,
@@ -29059,8 +29480,8 @@ var ErrorTracking = class ErrorTracking {
29059
29480
  }
29060
29481
  onException(exception, hint) {
29061
29482
  this.client.addPendingPromise((async () => {
29062
- if (!ErrorTracking.isPreviouslyCapturedError(exception)) {
29063
- const eventMessage = await ErrorTracking.buildEventMessage(this.client.getErrorPropertiesBuilder(), exception, hint);
29483
+ if (!error_tracking_ErrorTracking.isPreviouslyCapturedError(exception)) {
29484
+ const eventMessage = await error_tracking_ErrorTracking.buildEventMessage(this.client.getErrorPropertiesBuilder(), exception, hint);
29064
29485
  const exceptionType = eventMessage.properties?.$exception_list[0]?.type ?? "Exception";
29065
29486
  if (this._rateLimiter.consumeRateLimit(exceptionType)) return void this._logger.info("Skipping exception capture because of client rate limiting.", { exception: exceptionType });
29066
29487
  return this.client._capturePreparedEvent(eventMessage, false);
@@ -29080,7 +29501,7 @@ var ErrorTracking = class ErrorTracking {
29080
29501
  }
29081
29502
  };
29082
29503
  //#endregion
29083
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/storage-memory.mjs
29504
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/storage-memory.mjs
29084
29505
  var PostHogMemoryStorage = class {
29085
29506
  getProperty(key) {
29086
29507
  return this._memoryStorage[key];
@@ -29093,7 +29514,7 @@ var PostHogMemoryStorage = class {
29093
29514
  }
29094
29515
  };
29095
29516
  //#endregion
29096
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/capture-v1/config.mjs
29517
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/capture-v1/config.mjs
29097
29518
  function isCaptureMode(value) {
29098
29519
  return "v0" === value || "v1" === value;
29099
29520
  }
@@ -29102,14 +29523,14 @@ function resolveCaptureMode() {
29102
29523
  return isCaptureMode(envMode) ? envMode : "v0";
29103
29524
  }
29104
29525
  //#endregion
29105
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/capture-v1/routing.mjs
29526
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/capture-v1/routing.mjs
29106
29527
  const AI_EVENT_PREFIX = "$ai_";
29107
29528
  const ANALYTICS_ROUTE = "analytics";
29108
29529
  function isLegacyOnlyEvent(message) {
29109
29530
  return "string" == typeof message.event && message.event.startsWith(AI_EVENT_PREFIX);
29110
29531
  }
29111
29532
  //#endregion
29112
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/capture-v1/errors.mjs
29533
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/capture-v1/errors.mjs
29113
29534
  var CaptureV1Error = class CaptureV1Error extends Error {
29114
29535
  constructor({ requestId, drops, retryExhausted, cause }) {
29115
29536
  super(CaptureV1Error.buildMessage(requestId, drops, retryExhausted, cause)), this.name = "CaptureV1Error";
@@ -29125,7 +29546,7 @@ var CaptureV1Error = class CaptureV1Error extends Error {
29125
29546
  }
29126
29547
  };
29127
29548
  //#endregion
29128
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/capture-v1/transform.mjs
29549
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/capture-v1/transform.mjs
29129
29550
  function coerceBool(value) {
29130
29551
  if ("boolean" == typeof value) return value;
29131
29552
  if ("number" == typeof value) return 0 !== value;
@@ -29219,7 +29640,7 @@ function buildV1Batch(messages, { createdAt, historicalMigration }) {
29219
29640
  return batch;
29220
29641
  }
29221
29642
  //#endregion
29222
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/capture-v1/sender.mjs
29643
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/capture-v1/sender.mjs
29223
29644
  const V1_ANALYTICS_PATH = "/i/v1/analytics/events";
29224
29645
  const DEFAULT_MAX_BACKOFF_MS = 3e4;
29225
29646
  const RETRYABLE_STATUSES = /* @__PURE__ */ new Set([
@@ -29401,7 +29822,7 @@ var V1CaptureSender = class {
29401
29822
  }
29402
29823
  };
29403
29824
  //#endregion
29404
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/client.mjs
29825
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/client.mjs
29405
29826
  const MINIMUM_POLLING_INTERVAL = 100;
29406
29827
  const THIRTY_SECONDS = 3e4;
29407
29828
  const MAX_CACHE_SIZE = 5e4;
@@ -29444,7 +29865,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
29444
29865
  host: normalizeHost(options.host),
29445
29866
  personalApiKey: normalizePersonalApiKey(options.secretKey ?? options.personalApiKey)
29446
29867
  };
29447
- super(normalizedApiKey, normalizedOptions), this._memoryStorage = new PostHogMemoryStorage();
29868
+ super(normalizedApiKey, normalizedOptions), this._memoryStorage = new PostHogMemoryStorage(), this._minimalFlagCalledEvents = false;
29448
29869
  this.options = normalizedOptions;
29449
29870
  this.captureMode = resolveCaptureMode();
29450
29871
  this.context = this.initializeContext();
@@ -29466,12 +29887,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
29466
29887
  onLoad: (count) => {
29467
29888
  this._events.emit("localEvaluationFlagsLoaded", count);
29468
29889
  },
29890
+ onMinimalFlagCalledEvents: (enabled) => {
29891
+ this._minimalFlagCalledEvents = enabled;
29892
+ },
29469
29893
  customHeaders: this.getCustomHeaders(),
29470
29894
  cacheProvider: normalizedOptions.flagDefinitionCacheProvider,
29471
29895
  strictLocalEvaluation: normalizedOptions.strictLocalEvaluation
29472
29896
  });
29473
29897
  }
29474
- this.errorTracking = new ErrorTracking(this, normalizedOptions, this._logger);
29898
+ this.errorTracking = new error_tracking_ErrorTracking(this, normalizedOptions, this._logger);
29475
29899
  this.distinctIdHasSentFlagCalls = {};
29476
29900
  this.maxCacheSize = normalizedOptions.maxCacheSize || MAX_CACHE_SIZE;
29477
29901
  }
@@ -29788,6 +30212,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
29788
30212
  const flagsResponse = await super.getFeatureFlagDetailsStateless(evaluationContext.distinctId, evaluationContext.groups, personProperties, groupProperties, disableGeoip, [key]);
29789
30213
  if (void 0 === flagsResponse) featureFlagError = FeatureFlagError.UNKNOWN_ERROR;
29790
30214
  else {
30215
+ this._minimalFlagCalledEvents = true === flagsResponse.minimalFlagCalledEvents;
29791
30216
  requestId = flagsResponse.requestId;
29792
30217
  evaluatedAt = flagsResponse.evaluatedAt;
29793
30218
  const errors = [];
@@ -30013,6 +30438,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30013
30438
  if ((localResult ? localResult.fallbackToFlags : true) && !onlyEvaluateLocally) {
30014
30439
  const details = await super.getFeatureFlagDetailsStateless(evaluationContext.distinctId, evaluationContext.groups, personProperties, groupProperties, disableGeoip, flagKeys);
30015
30440
  if (details) {
30441
+ this._minimalFlagCalledEvents = true === details.minimalFlagCalledEvents;
30016
30442
  requestId = details.requestId;
30017
30443
  evaluatedAt = details.evaluatedAt;
30018
30444
  errorsWhileComputing = Boolean(details.errorsWhileComputingFlags);
@@ -30077,6 +30503,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30077
30503
  quotaLimited
30078
30504
  });
30079
30505
  }
30506
+ _shouldSendMinimalFlagCalledEvent(event, properties) {
30507
+ return "$feature_flag_called" === event && this._minimalFlagCalledEvents && false === properties.$feature_flag_has_experiment;
30508
+ }
30080
30509
  _captureFlagCalledEventIfNeeded(params) {
30081
30510
  const { distinctId, key, response, groups, disableGeoip, properties } = params;
30082
30511
  const featureFlagReportedKey = `${key}_${response}${groups && Object.keys(groups).length > 0 ? `_${JSON.stringify(Object.entries(groups).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0))}` : ""}`;
@@ -30182,7 +30611,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30182
30611
  await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
30183
30612
  this.errorTracking.shutdown();
30184
30613
  if (this._metrics) {
30185
- await Promise.race([this._metrics.flush().catch(() => {}), new Promise((resolve) => safeSetTimeout(resolve, Math.max(0, shutdownDeadlineMs - Date.now())))]);
30614
+ await raceWithTimeout(this._metrics.flush().catch(() => {}), Math.max(0, shutdownDeadlineMs - Date.now()));
30186
30615
  this._metrics.reset();
30187
30616
  }
30188
30617
  try {
@@ -30297,9 +30726,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30297
30726
  };
30298
30727
  }
30299
30728
  captureException(error, distinctId, additionalProperties, uuid, flags) {
30300
- if (!ErrorTracking.isPreviouslyCapturedError(error)) {
30729
+ if (!error_tracking_ErrorTracking.isPreviouslyCapturedError(error)) {
30301
30730
  const syntheticException = /* @__PURE__ */ new Error("PostHog syntheticException");
30302
- this.addPendingPromise(ErrorTracking.buildEventMessage(this.getErrorPropertiesBuilder(), error, { syntheticException }, distinctId, additionalProperties).then((msg) => this._capturePreparedEvent({
30731
+ this.addPendingPromise(error_tracking_ErrorTracking.buildEventMessage(this.getErrorPropertiesBuilder(), error, { syntheticException }, distinctId, additionalProperties).then((msg) => this._capturePreparedEvent({
30303
30732
  ...msg,
30304
30733
  uuid,
30305
30734
  flags
@@ -30307,9 +30736,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30307
30736
  }
30308
30737
  }
30309
30738
  async captureExceptionImmediate(error, distinctId, additionalProperties, flags) {
30310
- if (!ErrorTracking.isPreviouslyCapturedError(error)) {
30739
+ if (!error_tracking_ErrorTracking.isPreviouslyCapturedError(error)) {
30311
30740
  const syntheticException = /* @__PURE__ */ new Error("PostHog syntheticException");
30312
- return this.addPendingPromise(ErrorTracking.buildEventMessage(this.getErrorPropertiesBuilder(), error, { syntheticException }, distinctId, additionalProperties).then((msg) => this.captureImmediate({
30741
+ return this.addPendingPromise(error_tracking_ErrorTracking.buildEventMessage(this.getErrorPropertiesBuilder(), error, { syntheticException }, distinctId, additionalProperties).then((msg) => this.captureImmediate({
30313
30742
  ...msg,
30314
30743
  flags
30315
30744
  })));
@@ -30333,10 +30762,11 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30333
30762
  mergedProperties.$process_person_profile = false;
30334
30763
  }
30335
30764
  if (includeContextProperties && contextData?.sessionId && !mergedProperties.$session_id) mergedProperties.$session_id = contextData.sessionId;
30765
+ const finalProperties = this._shouldSendMinimalFlagCalledEvent(event, mergedProperties) ? minimizeFlagCalledEventProperties(mergedProperties) : mergedProperties;
30336
30766
  const eventMessage = this._runBeforeSend({
30337
30767
  distinctId: mergedDistinctId,
30338
30768
  event,
30339
- properties: mergedProperties,
30769
+ properties: finalProperties,
30340
30770
  groups,
30341
30771
  flags,
30342
30772
  sendFeatureFlags,
@@ -30401,7 +30831,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30401
30831
  }
30402
30832
  };
30403
30833
  //#endregion
30404
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/extensions/context/context.mjs
30834
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/extensions/context/context.mjs
30405
30835
  var PostHogContext = class {
30406
30836
  constructor() {
30407
30837
  this.storage = new AsyncLocalStorage();
@@ -30429,7 +30859,7 @@ var PostHogContext = class {
30429
30859
  }
30430
30860
  };
30431
30861
  //#endregion
30432
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
30862
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
30433
30863
  const NAME = "posthog-node";
30434
30864
  function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = ["error"], sendExceptionsToPostHog = true } = {}) {
30435
30865
  return (event) => {
@@ -30463,6 +30893,8 @@ function createEventProcessor(_posthog, { organization, projectId, prefix, sever
30463
30893
  $sentry_exception_type: exceptions[0]?.type,
30464
30894
  $sentry_tags: event.tags
30465
30895
  };
30896
+ const injectedReleaseId = getInjectedReleaseId();
30897
+ if (injectedReleaseId) properties.$release_id = injectedReleaseId;
30466
30898
  if (organization && projectId) properties["$sentry_url"] = (prefix || "https://sentry.io/organizations/") + organization + "/issues/?project=" + projectId + "&query=" + event.event_id;
30467
30899
  if (sendExceptionsToPostHog) _posthog.capture({
30468
30900
  event: "$exception",
@@ -30490,7 +30922,7 @@ var PostHogSentryIntegration = class {
30490
30922
  }
30491
30923
  };
30492
30924
  //#endregion
30493
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/entrypoints/index.node.mjs
30925
+ //#region ../../node_modules/.bun/posthog-node@5.47.10+63120419cc93e79b/node_modules/posthog-node/dist/entrypoints/index.node.mjs
30494
30926
  var PostHog = class extends PostHogBackendClient {
30495
30927
  getLibraryId() {
30496
30928
  return "posthog-node";
@@ -30507,7 +30939,7 @@ var PostHog = class extends PostHogBackendClient {
30507
30939
  new PrimitiveCoercer()
30508
30940
  ], createStackParser("node:javascript", nodeStackLineParser), [
30509
30941
  createModulerModifier(),
30510
- addSourceContext,
30942
+ (frames) => addSourceContext(frames, void 0, this._logger),
30511
30943
  createRelativePathModifier()
30512
30944
  ]);
30513
30945
  }
@@ -32328,7 +32760,6 @@ const accessPhase = async (ctx) => {
32328
32760
  data: { scopeAlias }
32329
32761
  };
32330
32762
  };
32331
- h("InvalidEmailHint")();
32332
32763
  const base64URLFromText = (value) => {
32333
32764
  const bytes = new TextEncoder().encode(value);
32334
32765
  let binary = "";
@@ -32488,7 +32919,7 @@ const resolvePhoneNumber = async (ctx) => {
32488
32919
  };
32489
32920
  //#endregion
32490
32921
  //#region src/lib/expected-errors.ts
32491
- var InvalidScope = class extends h("InvalidScope")() {
32922
+ var InvalidScope = class extends h("InvalidScope") {
32492
32923
  constructor(scope) {
32493
32924
  super({
32494
32925
  scope,
@@ -32496,7 +32927,7 @@ var InvalidScope = class extends h("InvalidScope")() {
32496
32927
  });
32497
32928
  }
32498
32929
  };
32499
- var AccountNotFound = class extends h("AccountNotFound")() {
32930
+ var AccountNotFound = class extends h("AccountNotFound") {
32500
32931
  constructor({ account, platform }) {
32501
32932
  super({
32502
32933
  account,
@@ -32505,7 +32936,7 @@ var AccountNotFound = class extends h("AccountNotFound")() {
32505
32936
  });
32506
32937
  }
32507
32938
  };
32508
- var NoConnectedAccount = class extends h("NoConnectedAccount")() {
32939
+ var NoConnectedAccount = class extends h("NoConnectedAccount") {
32509
32940
  constructor(platform) {
32510
32941
  super({
32511
32942
  platform,
@@ -32513,7 +32944,7 @@ var NoConnectedAccount = class extends h("NoConnectedAccount")() {
32513
32944
  });
32514
32945
  }
32515
32946
  };
32516
- var LookupPayloadInvalid = class extends h("LookupPayloadInvalid")() {
32947
+ var LookupPayloadInvalid = class extends h("LookupPayloadInvalid") {
32517
32948
  constructor({ input, platform }) {
32518
32949
  super({
32519
32950
  input,
@@ -32522,7 +32953,7 @@ var LookupPayloadInvalid = class extends h("LookupPayloadInvalid")() {
32522
32953
  });
32523
32954
  }
32524
32955
  };
32525
- var SchemaPathUnknown = class extends h("SchemaPathUnknown")() {
32956
+ var SchemaPathUnknown = class extends h("SchemaPathUnknown") {
32526
32957
  constructor({ message, path }) {
32527
32958
  super({
32528
32959
  message,
@@ -32530,7 +32961,7 @@ var SchemaPathUnknown = class extends h("SchemaPathUnknown")() {
32530
32961
  });
32531
32962
  }
32532
32963
  };
32533
- var SchemaContractInvalid = class extends h("SchemaContractInvalid")() {
32964
+ var SchemaContractInvalid = class extends h("SchemaContractInvalid") {
32534
32965
  constructor({ label, message }) {
32535
32966
  super({
32536
32967
  label,
@@ -32538,7 +32969,7 @@ var SchemaContractInvalid = class extends h("SchemaContractInvalid")() {
32538
32969
  });
32539
32970
  }
32540
32971
  };
32541
- var UsagePaginationLimit = class extends h("UsagePaginationLimit")() {
32972
+ var UsagePaginationLimit = class extends h("UsagePaginationLimit") {
32542
32973
  constructor(limit) {
32543
32974
  super({
32544
32975
  limit,
@@ -32546,7 +32977,7 @@ var UsagePaginationLimit = class extends h("UsagePaginationLimit")() {
32546
32977
  });
32547
32978
  }
32548
32979
  };
32549
- var LogoutRevocationFailed = class extends h("LogoutRevocationFailed")() {
32980
+ var LogoutRevocationFailed = class extends h("LogoutRevocationFailed") {
32550
32981
  constructor() {
32551
32982
  super({ message: "Could not revoke the server-side session; local credentials were cleared." });
32552
32983
  }
@@ -32555,16 +32986,16 @@ var LogoutRevocationFailed = class extends h("LogoutRevocationFailed")() {
32555
32986
  //#region src/login/phases/1.scope.ts
32556
32987
  const DEFAULT_SCOPE_ALIAS = "read,write";
32557
32988
  const parseScopeAliasResult = (value) => {
32558
- if (value === void 0 || value === null || value === "") return G.ok(DEFAULT_SCOPE_ALIAS);
32559
- if (typeof value !== "string") return G.err(new InvalidScope(String(value)));
32989
+ if (value === void 0 || value === null || value === "") return ae.ok(DEFAULT_SCOPE_ALIAS);
32990
+ if (typeof value !== "string") return ae.err(new InvalidScope(String(value)));
32560
32991
  const scope = value === "write" ? DEFAULT_SCOPE_ALIAS : value;
32561
32992
  const parsed = parseCLIScopeAlias(scope);
32562
- if (G.isError(parsed)) return G.err(new InvalidScope(scope));
32563
- return G.ok(parsed.value);
32993
+ if (ae.isError(parsed)) return ae.err(new InvalidScope(scope));
32994
+ return ae.ok(parsed.value);
32564
32995
  };
32565
32996
  const parseScopeAlias = (value) => {
32566
32997
  const parsed = parseScopeAliasResult(value);
32567
- if (G.isOk(parsed)) return parsed.value;
32998
+ if (ae.isOk(parsed)) return parsed.value;
32568
32999
  throw new Error(parsed.error.message);
32569
33000
  };
32570
33001
  //#endregion
@@ -32850,7 +33281,7 @@ const revokeServerSide = async (accessToken) => {
32850
33281
  return false;
32851
33282
  }
32852
33283
  };
32853
- const logoutRevocationResult = (revoked) => revoked ? G.ok(null) : G.err(new LogoutRevocationFailed());
33284
+ const logoutRevocationResult = (revoked) => revoked ? ae.ok(null) : ae.err(new LogoutRevocationFailed());
32854
33285
  const logoutCommand = defineCommand({
32855
33286
  meta: commandMeta({
32856
33287
  name: "logout",
@@ -32879,7 +33310,7 @@ const logoutCommand = defineCommand({
32879
33310
  const revoked = await revokeServerSide(credentials.accessToken);
32880
33311
  await clearCredentials();
32881
33312
  const revocation = logoutRevocationResult(revoked);
32882
- if (G.isError(revocation)) throw new Error(revocation.error.message);
33313
+ if (ae.isError(revocation)) throw new Error(revocation.error.message);
32883
33314
  analytics.capture("logout");
32884
33315
  analytics.reset();
32885
33316
  }
@@ -33018,7 +33449,7 @@ const fetchUsageLogs = async (client, input) => {
33018
33449
  let nextCursor = null;
33019
33450
  let pages = 0;
33020
33451
  do {
33021
- if (pages >= USAGE_LOG_MAX_AUTO_PAGES) return G.err(new UsagePaginationLimit(USAGE_LOG_MAX_AUTO_PAGES));
33452
+ if (pages >= USAGE_LOG_MAX_AUTO_PAGES) return ae.err(new UsagePaginationLimit(USAGE_LOG_MAX_AUTO_PAGES));
33022
33453
  const remaining = input.limit === void 0 ? USAGE_LOG_PAGE_LIMIT : input.limit - items.length;
33023
33454
  const usage = await client.usage.list({
33024
33455
  platform: input.platform,
@@ -33032,7 +33463,7 @@ const fetchUsageLogs = async (client, input) => {
33032
33463
  cursor = nextCursor ?? void 0;
33033
33464
  pages += 1;
33034
33465
  } while (nextCursor && (input.limit === void 0 || items.length < input.limit));
33035
- return G.ok({
33466
+ return ae.ok({
33036
33467
  items: input.limit === void 0 ? items : items.slice(0, input.limit),
33037
33468
  cursor: nextCursor
33038
33469
  });
@@ -33100,7 +33531,7 @@ const createUsageLogsCommand = (deps = {}) => defineCommand({
33100
33531
  from,
33101
33532
  to
33102
33533
  });
33103
- if (G.isError(usage)) throw new UsageError(usage.error.message);
33534
+ if (ae.isError(usage)) throw new UsageError(usage.error.message);
33104
33535
  await writeOutput$1(deps, {
33105
33536
  items: aggregateLogs(usage.value.items, sumBy),
33106
33537
  meta: {
@@ -33119,7 +33550,7 @@ const createUsageLogsCommand = (deps = {}) => defineCommand({
33119
33550
  from,
33120
33551
  to
33121
33552
  });
33122
- if (G.isError(usage)) throw new UsageError(usage.error.message);
33553
+ if (ae.isError(usage)) throw new UsageError(usage.error.message);
33123
33554
  await writeOutput$1(deps, {
33124
33555
  items: usage.value.items,
33125
33556
  meta: { cursor: usage.value.cursor }
@@ -33446,14 +33877,14 @@ const createAccountCommand = (deps, accountSetupCommand = setupCommand) => {
33446
33877
  if (isInteractiveConnect(deps)) {
33447
33878
  await runConnectOutput(deps, async (connectDeps) => {
33448
33879
  const result = await connectXAccount(connectDeps);
33449
- if (G.isError(result)) throwXLifecycleError(result.error);
33880
+ if (ae.isError(result)) throwXLifecycleError(result.error);
33450
33881
  return result.value;
33451
33882
  });
33452
33883
  return;
33453
33884
  }
33454
33885
  await runConnectStep(deps, "x", async () => {
33455
33886
  const result = await listXLifecycleAccounts(deps, true);
33456
- if (G.isError(result)) throwXLifecycleError(result.error);
33887
+ if (ae.isError(result)) throwXLifecycleError(result.error);
33457
33888
  return result.value;
33458
33889
  }, () => createXConnectURL(deps));
33459
33890
  })
@@ -33471,7 +33902,7 @@ const createAccountCommand = (deps, accountSetupCommand = setupCommand) => {
33471
33902
  x: createAccountPlatformCommand("x", "Reconnect an X account.", async (args) => {
33472
33903
  await runConnectOutput(deps, async (connectDeps) => {
33473
33904
  const result = await reconnectXAccount(connectDeps, { account: String(args.account) });
33474
- if (G.isError(result)) throwXLifecycleError(result.error);
33905
+ if (ae.isError(result)) throwXLifecycleError(result.error);
33475
33906
  return result.value;
33476
33907
  });
33477
33908
  }, { accountArg: xAccountArg })
@@ -33497,7 +33928,7 @@ const createAccountCommand = (deps, accountSetupCommand = setupCommand) => {
33497
33928
  }) }),
33498
33929
  x: createAccountPlatformCommand("x", "Disconnect an X account.", async (args) => {
33499
33930
  const result = await disconnectXAccount(deps, String(args.account));
33500
- if (G.isError(result)) throwXLifecycleError(result.error);
33931
+ if (ae.isError(result)) throwXLifecycleError(result.error);
33501
33932
  await writeOutput(deps, result.value);
33502
33933
  }, {
33503
33934
  accountArg: xAccountArg,
@@ -33722,12 +34153,12 @@ const selectAccountOutcome = ({ accounts, defaultAccount, explicitAccount }) =>
33722
34153
  };
33723
34154
  };
33724
34155
  const requireSelectedAccount = (outcome, platform) => {
33725
- if (outcome.status === "selected") return G.ok(outcome);
33726
- if (outcome.status === "missingExplicitAccount") return G.err(new AccountNotFound({
34156
+ if (outcome.status === "selected") return ae.ok(outcome);
34157
+ if (outcome.status === "missingExplicitAccount") return ae.err(new AccountNotFound({
33727
34158
  account: outcome.account,
33728
34159
  platform
33729
34160
  }));
33730
- return G.err(new NoConnectedAccount(platform));
34161
+ return ae.err(new NoConnectedAccount(platform));
33731
34162
  };
33732
34163
  const isRecord$1 = (value) => Boolean(value && typeof value === "object" && !Array.isArray(value));
33733
34164
  const stringField = (value, key) => {
@@ -33740,35 +34171,35 @@ const stringOrNumberField = (value, key) => {
33740
34171
  return typeof field === "number" && Number.isFinite(field) ? String(field) : void 0;
33741
34172
  };
33742
34173
  const parseXLookupResponse = (data, input) => {
33743
- if (!(isRecord$1(data) && isRecord$1(data.data))) return G.err(new LookupPayloadInvalid({
34174
+ if (!(isRecord$1(data) && isRecord$1(data.data))) return ae.err(new LookupPayloadInvalid({
33744
34175
  input,
33745
34176
  platform: "x"
33746
34177
  }));
33747
34178
  const id = stringOrNumberField(data.data, "id");
33748
- if (!id) return G.err(new LookupPayloadInvalid({
34179
+ if (!id) return ae.err(new LookupPayloadInvalid({
33749
34180
  input,
33750
34181
  platform: "x"
33751
34182
  }));
33752
34183
  const inputUsername = input.replace(/^@+/, "");
33753
34184
  const resolvedUsername = stringField(data.data, "username") ?? inputUsername;
33754
- return G.ok({
34185
+ return ae.ok({
33755
34186
  id,
33756
34187
  url: `https://x.com/${resolvedUsername}`
33757
34188
  });
33758
34189
  };
33759
34190
  const parseLinkedinProfileLookupResponse = (data, input) => {
33760
34191
  const profile = isRecord$1(data) && isRecord$1(data.data) ? data.data : data;
33761
- if (!isRecord$1(profile)) return G.err(new LookupPayloadInvalid({
34192
+ if (!isRecord$1(profile)) return ae.err(new LookupPayloadInvalid({
33762
34193
  input,
33763
34194
  platform: "linkedin"
33764
34195
  }));
33765
34196
  const id = stringOrNumberField(profile, "provider_id") ?? stringOrNumberField(profile, "providerId") ?? stringOrNumberField(profile, "id");
33766
- if (!id) return G.err(new LookupPayloadInvalid({
34197
+ if (!id) return ae.err(new LookupPayloadInvalid({
33767
34198
  input,
33768
34199
  platform: "linkedin"
33769
34200
  }));
33770
34201
  const publicIdentifier = stringField(profile, "public_identifier") ?? stringField(profile, "publicIdentifier");
33771
- return G.ok({
34202
+ return ae.ok({
33772
34203
  id,
33773
34204
  ...publicIdentifier ? { url: `https://www.linkedin.com/in/${encodeURIComponent(publicIdentifier)}` } : {}
33774
34205
  });
@@ -33786,7 +34217,7 @@ const headerValuesFromRawArgs = (rawArgs = []) => {
33786
34217
  if (arg === "--") break;
33787
34218
  if (arg === "--header" || arg === "-H") {
33788
34219
  const value = rawArgs[index + 1];
33789
- if (value === void 0) return G.err(headerError("missingHeaderValue", `Pass a value for ${arg}.`));
34220
+ if (value === void 0) return ae.err(headerError("missingHeaderValue", `Pass a value for ${arg}.`));
33790
34221
  values.push(value);
33791
34222
  index += 1;
33792
34223
  continue;
@@ -33797,25 +34228,25 @@ const headerValuesFromRawArgs = (rawArgs = []) => {
33797
34228
  }
33798
34229
  if (arg?.startsWith("-H=")) values.push(arg.slice(3));
33799
34230
  }
33800
- return G.ok(values);
34231
+ return ae.ok(values);
33801
34232
  };
33802
34233
  const commandHeaderValuesFrom = ({ headers, rawArgs }) => {
33803
34234
  const rawValues = headerValuesFromRawArgs(rawArgs);
33804
- if (G.isError(rawValues)) return rawValues;
34235
+ if (ae.isError(rawValues)) return rawValues;
33805
34236
  if (rawValues.value.length > 0) return rawValues;
33806
- if (headers === void 0) return G.ok([]);
33807
- if (typeof headers === "string") return G.ok([headers]);
33808
- if (Array.isArray(headers) && headers.every((header) => typeof header === "string")) return G.ok(headers);
33809
- return G.err(headerError("invalidHeaderList", "Pass --header as Name: value."));
34237
+ if (headers === void 0) return ae.ok([]);
34238
+ if (typeof headers === "string") return ae.ok([headers]);
34239
+ if (Array.isArray(headers) && headers.every((header) => typeof header === "string")) return ae.ok(headers);
34240
+ return ae.err(headerError("invalidHeaderList", "Pass --header as Name: value."));
33810
34241
  };
33811
34242
  const parsedHeaderFrom = (header) => {
33812
34243
  const colon = header.indexOf(":");
33813
- if (colon <= 0) return G.err(headerError("malformedHeader", "Pass --header as Name: value."));
34244
+ if (colon <= 0) return ae.err(headerError("malformedHeader", "Pass --header as Name: value."));
33814
34245
  const name = header.slice(0, colon).trim();
33815
34246
  const value = header.slice(colon + 1).trim();
33816
34247
  const normalized = name.toLowerCase();
33817
- if (normalized === "authorization" || normalized === "content-type" || normalized.startsWith("x-social-")) return G.err(headerError("reservedHeader", `Header ${name} is reserved and cannot be set with --header.`));
33818
- return G.ok({
34248
+ if (normalized === "authorization" || normalized === "content-type" || normalized.startsWith("x-social-")) return ae.err(headerError("reservedHeader", `Header ${name} is reserved and cannot be set with --header.`));
34249
+ return ae.ok({
33819
34250
  name,
33820
34251
  value
33821
34252
  });
@@ -33823,17 +34254,17 @@ const parsedHeaderFrom = (header) => {
33823
34254
  const commandHeadersFrom = (defaults, args = {}) => {
33824
34255
  const headers = new Headers(defaults);
33825
34256
  const rawHeaders = commandHeaderValuesFrom(args);
33826
- if (G.isError(rawHeaders)) return G.err(rawHeaders.error);
34257
+ if (ae.isError(rawHeaders)) return ae.err(rawHeaders.error);
33827
34258
  for (const rawHeader of rawHeaders.value) {
33828
34259
  const parsed = parsedHeaderFrom(rawHeader);
33829
- if (G.isError(parsed)) return G.err(parsed.error);
34260
+ if (ae.isError(parsed)) return ae.err(parsed.error);
33830
34261
  try {
33831
34262
  headers.set(parsed.value.name, parsed.value.value);
33832
34263
  } catch {
33833
- return G.err(headerError("invalidHeader", `Invalid header ${parsed.value.name}.`));
34264
+ return ae.err(headerError("invalidHeader", `Invalid header ${parsed.value.name}.`));
33834
34265
  }
33835
34266
  }
33836
- return G.ok(Object.fromEntries(headers.entries()));
34267
+ return ae.ok(Object.fromEntries(headers.entries()));
33837
34268
  };
33838
34269
  //#endregion
33839
34270
  //#region ../../node_modules/.bun/@borewit+text-codec@0.2.2/node_modules/@borewit/text-codec/lib/index.js
@@ -38771,7 +39202,7 @@ const createCLIDeps = () => {
38771
39202
  platform
38772
39203
  });
38773
39204
  const selected = requireSelectedAccount(outcome, platform);
38774
- if (G.isOk(selected)) return selected.value;
39205
+ if (ae.isOk(selected)) return selected.value;
38775
39206
  if (outcome.status === "missingExplicitAccount") throw new NotFoundError(`${platform}_account_not_found`);
38776
39207
  throw new Error(`${platform}_account_not_connected`);
38777
39208
  };
@@ -38786,7 +39217,7 @@ const createCLIDeps = () => {
38786
39217
  ...selectedAccount.selector === void 0 ? {} : { "x-social-account-id": selectedAccount.selector }
38787
39218
  };
38788
39219
  const parsed = parseXLookupResponse(await api.get(`x/users/by/username/${encodeURIComponent(inputUsername)}`, { headers }).json(), input);
38789
- if (G.isError(parsed)) throw new Error(`Could not resolve X username ${input}.`);
39220
+ if (ae.isError(parsed)) throw new Error(`Could not resolve X username ${input}.`);
38790
39221
  return parsed.value;
38791
39222
  };
38792
39223
  const lookupLinkedinProfile = async (input, account, selectedAccount) => {
@@ -38799,7 +39230,7 @@ const createCLIDeps = () => {
38799
39230
  ...resolvedAccount.selector === void 0 ? {} : { "x-social-account-id": resolvedAccount.selector }
38800
39231
  };
38801
39232
  const parsed = parseLinkedinProfileLookupResponse(await api.get(`linkedin/users/${encodeURIComponent(input)}`, { headers }).json(), input);
38802
- if (G.isError(parsed)) throw new Error(`Could not resolve LinkedIn profile ${input}.`);
39233
+ if (ae.isError(parsed)) throw new Error(`Could not resolve LinkedIn profile ${input}.`);
38803
39234
  return parsed.value;
38804
39235
  };
38805
39236
  return {
@@ -38864,7 +39295,7 @@ const createCLIDeps = () => {
38864
39295
  }),
38865
39296
  commandHeaders: async (args) => {
38866
39297
  const headers = commandHeadersFrom({ "Cache-Control": await cacheControlHeaderFromConfig() }, args);
38867
- if (G.isError(headers)) throw new UsageError(headers.error.message);
39298
+ if (ae.isError(headers)) throw new UsageError(headers.error.message);
38868
39299
  return headers.value;
38869
39300
  },
38870
39301
  printData,
@@ -39349,7 +39780,7 @@ const schemaAtPath = (command, commandPathInput, options = {}) => {
39349
39780
  command,
39350
39781
  path: []
39351
39782
  } : commandAtPath(command, parts);
39352
- return G.ok({
39783
+ return ae.ok({
39353
39784
  schemaVersion: "2.0",
39354
39785
  commands: Object.fromEntries(leafSchemasForCommand(selectedCommand, path))
39355
39786
  });
@@ -39359,31 +39790,31 @@ const schemaAtPath = (command, commandPathInput, options = {}) => {
39359
39790
  command,
39360
39791
  path: []
39361
39792
  } : commandAtPath(command, parts);
39362
- return G.ok({
39793
+ return ae.ok({
39363
39794
  schemaVersion: "2.0",
39364
39795
  commands: Object.fromEntries(compactLeafSchemasForCommand(selectedCommand, path))
39365
39796
  });
39366
39797
  }
39367
- if (parts.length === 0) return G.ok({
39798
+ if (parts.length === 0) return ae.ok({
39368
39799
  schemaVersion: "2.0",
39369
39800
  ...schemaTreeForCommand(command)
39370
39801
  });
39371
39802
  const { command: selectedCommand, path, positionalMatch } = commandAtPath(command, parts);
39372
- if (positionalMatch) return G.ok({
39803
+ if (positionalMatch) return ae.ok({
39373
39804
  schemaVersion: "2.0",
39374
39805
  ...schemaForCommand(selectedCommand, path),
39375
39806
  ...positionalMatch
39376
39807
  });
39377
- if (selectedCommand.subCommands && typeof selectedCommand.run !== "function") return G.ok({
39808
+ if (selectedCommand.subCommands && typeof selectedCommand.run !== "function") return ae.ok({
39378
39809
  schemaVersion: "2.0",
39379
39810
  ...schemaTreeForCommand(selectedCommand, path)
39380
39811
  });
39381
- return G.ok({
39812
+ return ae.ok({
39382
39813
  schemaVersion: "2.0",
39383
39814
  ...schemaForCommand(selectedCommand, path)
39384
39815
  });
39385
39816
  } catch (error) {
39386
- return G.err(schemaErrorFor(error, parts));
39817
+ return ae.err(schemaErrorFor(error, parts));
39387
39818
  }
39388
39819
  };
39389
39820
  const schemaCommand = defineCommand({
@@ -39418,7 +39849,7 @@ const schemaCommand = defineCommand({
39418
39849
  if (!rootCommand) throw new Error("schema_root_command_unconfigured");
39419
39850
  const commandPathInput = Array.isArray(args._) && args._.length > 1 ? args._ : args.commandPath;
39420
39851
  const schema = schemaAtPath(rootCommand, commandPathInput, { mode: args.leaves === true ? "leaves" : args.list === true ? "list" : "leaf" });
39421
- if (G.isError(schema)) throw new Error(schema.error.message);
39852
+ if (ae.isError(schema)) throw new Error(schema.error.message);
39422
39853
  printData(schema.value);
39423
39854
  }
39424
39855
  });