@usesocial/cli 0.18.2 → 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)})`;
@@ -11283,12 +11423,19 @@ pgTable("proxy_call_logs", {
11283
11423
  retryAfterSeconds: integer("retry_after_seconds"),
11284
11424
  costBPS: integer("cost_bps").notNull().default(0),
11285
11425
  billedBPS: integer("billed_bps").notNull().default(0),
11426
+ usageUnits: integer("usage_units").notNull().default(0),
11427
+ entityId: text$1("entity_id"),
11428
+ meteringLockId: text$1("metering_lock_id"),
11429
+ meteringLockExpiresAt: timestamptz("metering_lock_expires_at"),
11430
+ meteredAt: timestamptz("metered_at"),
11286
11431
  latencyMs: integer("latency_ms").notNull(),
11287
11432
  createdAt: timestamptz("created_at").notNull().defaultNow()
11288
11433
  }, (table) => [
11289
11434
  index("proxy_call_logs_user_created_idx").on(table.userId, table.createdAt.desc()),
11290
11435
  index("proxy_call_logs_user_platform_created_idx").on(table.userId, table.platform, table.createdAt.desc()),
11291
11436
  index("proxy_call_logs_user_billing_period_idx").on(table.userId, table.createdAt).where(sql`${table.responseStatus} >= 200 and ${table.responseStatus} < 300`),
11437
+ uniqueIndex("proxy_call_logs_metering_lock_id_key").on(table.meteringLockId).where(sql`${table.meteringLockId} is not null`),
11438
+ index("proxy_call_logs_pending_metering_idx").on(table.createdAt).where(sql`${table.meteredAt} is null and ${table.billedBPS} > 0 and ${table.usageUnits} > 0`),
11292
11439
  check("proxy_call_logs_surface_check", sqlCheckIn(table.surface, PROXY_SURFACES)),
11293
11440
  check("proxy_call_logs_cache_status_check", sqlCheckIn(table.cacheStatus, PROXY_CACHE_STATUSES))
11294
11441
  ]);
@@ -11360,8 +11507,6 @@ pgTable("linkedin_connections", {
11360
11507
  connectedAt: timestamptz("connected_at"),
11361
11508
  createdAt: timestamptz("created_at").notNull().defaultNow()
11362
11509
  }, (table) => [uniqueIndex("linkedin_connections_of_profile_key").on(table.ofProfileId, table.profileId), index("linkedin_connections_profile_idx").on(table.profileId)]);
11363
- h("ProfileStoreUnavailable")();
11364
- h("InvalidProfileRow")();
11365
11510
  //#endregion
11366
11511
  //#region ../../packages/lib/src/url.ts
11367
11512
  const stripTrailingSlashes = (value) => value.replace(/\/+$/, "");
@@ -11372,7 +11517,7 @@ const absoluteURLPathPattern = /^[a-z][a-z0-9+.-]*:/i;
11372
11517
  const protocolRelativeURLPathPattern = /^\/\//;
11373
11518
  const unsafeRelativeURLPathMessage = "createURL: path must be relative, not absolute or protocol-relative";
11374
11519
  /** Returned when a URL path is absolute or protocol-relative instead of relative. */
11375
- var InvalidRelativeURLPath = class extends h("InvalidRelativeURLPath")() {
11520
+ var InvalidRelativeURLPath = class extends h("InvalidRelativeURLPath") {
11376
11521
  constructor({ path }) {
11377
11522
  super({
11378
11523
  path,
@@ -11380,7 +11525,7 @@ var InvalidRelativeURLPath = class extends h("InvalidRelativeURLPath")() {
11380
11525
  });
11381
11526
  }
11382
11527
  };
11383
- var InvalidBaseURL = class extends h("InvalidBaseURL")() {
11528
+ var InvalidBaseURL = class extends h("InvalidBaseURL") {
11384
11529
  constructor({ baseURL }) {
11385
11530
  super({
11386
11531
  baseURL,
@@ -11391,25 +11536,24 @@ var InvalidBaseURL = class extends h("InvalidBaseURL")() {
11391
11536
  /** Parse a path that is safe to resolve against a caller-provided base URL. */
11392
11537
  const parseRelativeURLPath = (path) => {
11393
11538
  const trimmedPath = path.trimStart();
11394
- if (absoluteURLPathPattern.test(trimmedPath) || protocolRelativeURLPathPattern.test(trimmedPath)) return G.err(new InvalidRelativeURLPath({ path }));
11395
- 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));
11396
11541
  };
11397
11542
  const createURLResult = (baseURL, path) => {
11398
11543
  const parsedPath = parseRelativeURLPath(path);
11399
- if (G.isError(parsedPath)) return G.err(parsedPath.error);
11544
+ if (ae.isError(parsedPath)) return ae.err(parsedPath.error);
11400
11545
  try {
11401
- return G.ok(new URL(parsedPath.value, ensureTrailingSlash(stripTrailingSlashes(baseURL.toString()))));
11546
+ return ae.ok(new URL(parsedPath.value, ensureTrailingSlash(stripTrailingSlashes(baseURL.toString()))));
11402
11547
  } catch {
11403
- return G.err(new InvalidBaseURL({ baseURL: baseURL.toString() }));
11548
+ return ae.err(new InvalidBaseURL({ baseURL: baseURL.toString() }));
11404
11549
  }
11405
11550
  };
11406
11551
  const createURL = (baseURL, path) => {
11407
11552
  const url = createURLResult(baseURL, path);
11408
- if (G.isError(url)) throw url.error;
11553
+ if (ae.isError(url)) throw url.error;
11409
11554
  return url.value;
11410
11555
  };
11411
11556
  const createAbsoluteURL = (baseURL, path) => createURL(baseURL, path).toString();
11412
- h("MissingPathTemplateParam")();
11413
11557
  //#endregion
11414
11558
  //#region ../../node_modules/.bun/ky@2.0.2/node_modules/ky/distribution/errors/KyError.js
11415
11559
  /**
@@ -12053,7 +12197,7 @@ const hasSearchParameters = (search) => {
12053
12197
  //#endregion
12054
12198
  //#region ../../node_modules/.bun/ky@2.0.2/node_modules/ky/distribution/utils/is-network-error.js
12055
12199
  const objectToString$2 = Object.prototype.toString;
12056
- const isError$1 = (value) => objectToString$2.call(value) === "[object Error]";
12200
+ const isError$2 = (value) => objectToString$2.call(value) === "[object Error]";
12057
12201
  const errorMessages = /* @__PURE__ */ new Set([
12058
12202
  "network error",
12059
12203
  "NetworkError when attempting to fetch resource.",
@@ -12065,7 +12209,7 @@ const errorMessages = /* @__PURE__ */ new Set([
12065
12209
  "Network connection lost"
12066
12210
  ]);
12067
12211
  function isRawNetworkError(error) {
12068
- 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;
12069
12213
  const { message, stack } = error;
12070
12214
  if (message === "Load failed") return stack === void 0 || "__sentry_captured__" in error;
12071
12215
  if (message.startsWith("error sending request for url")) return true;
@@ -12696,8 +12840,6 @@ object({
12696
12840
  status: number(),
12697
12841
  type: string()
12698
12842
  });
12699
- h("UnipileAPIError")();
12700
- h("UnipileHostedAuthURLMissingError")();
12701
12843
  looseObject({
12702
12844
  object: literal("HostedAuthLink"),
12703
12845
  link: string()
@@ -12733,7 +12875,7 @@ const SocialTargetPrefixes = {
12733
12875
  company_id: "company",
12734
12876
  request_id: "request"
12735
12877
  };
12736
- var InvalidSocialSelector = class extends h("InvalidSocialSelector")() {
12878
+ var InvalidSocialSelector = class extends h("InvalidSocialSelector") {
12737
12879
  constructor({ value, reason }) {
12738
12880
  super({
12739
12881
  value,
@@ -12794,42 +12936,40 @@ const linkedInURNKindFrom = (value) => {
12794
12936
  };
12795
12937
  const parseTypedSocialSelector = (value, options = {}) => {
12796
12938
  const parsed = parseTypedSocialSelectorResult(value, options);
12797
- return G.isOk(parsed) ? parsed.value : void 0;
12939
+ return ae.isOk(parsed) ? parsed.value : void 0;
12798
12940
  };
12799
12941
  const parseTypedSocialSelectorResult = (value, options = {}) => {
12800
12942
  const trimmed = value.trim();
12801
12943
  const colon = trimmed.indexOf(":");
12802
- if (colon <= 0) return G.err(new InvalidSocialSelector({
12944
+ if (colon <= 0) return ae.err(new InvalidSocialSelector({
12803
12945
  value,
12804
12946
  reason: "missing-prefix"
12805
12947
  }));
12806
12948
  const prefix = trimmed.slice(0, colon);
12807
- if (!isSocialTargetPrefix(prefix)) return G.err(new InvalidSocialSelector({
12949
+ if (!isSocialTargetPrefix(prefix)) return ae.err(new InvalidSocialSelector({
12808
12950
  value,
12809
12951
  reason: "unsupported-prefix"
12810
12952
  }));
12811
- 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({
12812
12954
  value,
12813
12955
  reason: "disallowed-prefix"
12814
12956
  }));
12815
12957
  const id = trimmed.slice(colon + 1).trim();
12816
- if (options.idMode === "lenient") return G.ok({
12958
+ if (options.idMode === "lenient") return ae.ok({
12817
12959
  prefix,
12818
12960
  kind: SocialTargetPrefixes[prefix],
12819
12961
  id
12820
12962
  });
12821
12963
  const parsed = plainResourceIdSchema(prefix).safeParse(id);
12822
- return parsed.success ? G.ok({
12964
+ return parsed.success ? ae.ok({
12823
12965
  prefix,
12824
12966
  kind: SocialTargetPrefixes[prefix],
12825
12967
  id: parsed.data
12826
- }) : G.err(new InvalidSocialSelector({
12968
+ }) : ae.err(new InvalidSocialSelector({
12827
12969
  value,
12828
12970
  reason: "invalid-id"
12829
12971
  }));
12830
12972
  };
12831
- h("InvalidLinkedinUpstreamPlanInput")();
12832
- h("InvalidUnipileCredentials")();
12833
12973
  //#endregion
12834
12974
  //#region ../../packages/linkedin/src/profiles.ts
12835
12975
  const displayNameFrom = (firstName, lastName, username) => [firstName, lastName].filter(Boolean).join(" ").trim() || username || "";
@@ -12948,8 +13088,6 @@ looseObject({
12948
13088
  data: array(GroupParticipant),
12949
13089
  next_cursor: string().nullish()
12950
13090
  });
12951
- h("ChatListParseError")();
12952
- h("ChatParticipantsFetchError")();
12953
13091
  const dropLinkedinInmailEligibility = (value) => {
12954
13092
  if (Array.isArray(value)) {
12955
13093
  let changed = false;
@@ -14956,7 +15094,7 @@ const isoDatePattern = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
14956
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)?$/;
14957
15095
  const timezonePattern = /(Z|[+-]\d{2}:\d{2})$/;
14958
15096
  const invalidSinceMessage = "Invalid --since value. Use an ISO 8601 date like 2026-05-04 or datetime like 2026-05-04T00:00:00Z.";
14959
- var InvalidSince = class extends h("InvalidSince")() {
15097
+ var InvalidSince = class extends h("InvalidSince") {
14960
15098
  constructor(input) {
14961
15099
  super({
14962
15100
  input,
@@ -14984,23 +15122,23 @@ const parseSinceResult = (input) => {
14984
15122
  const isISODateTime = isoDateTimePattern.test(value);
14985
15123
  const normalized = isISODateTime && !timezonePattern.test(value) ? `${value}Z` : value;
14986
15124
  const parsed = (isISODate || isISODateTime) && hasValidDate(value) ? Date.parse(normalized) : NaN;
14987
- if (Number.isNaN(parsed)) return G.err(new InvalidSince(input));
14988
- return G.ok(parsed);
15125
+ if (Number.isNaN(parsed)) return ae.err(new InvalidSince(input));
15126
+ return ae.ok(parsed);
14989
15127
  };
14990
15128
  //#endregion
14991
15129
  //#region ../../packages/linkedin/src/cli/sync-plan.ts
14992
- var UnknownLinkedinSyncCollection = class extends h("UnknownLinkedinSyncCollection")() {};
14993
- var LinkedinSyncResetRequiresCollection = class extends h("LinkedinSyncResetRequiresCollection")() {
15130
+ var UnknownLinkedinSyncCollection = class extends h("UnknownLinkedinSyncCollection") {};
15131
+ var LinkedinSyncResetRequiresCollection = class extends h("LinkedinSyncResetRequiresCollection") {
14994
15132
  constructor() {
14995
15133
  super({ message: "--reset requires a collection" });
14996
15134
  }
14997
15135
  };
14998
- var LinkedinSyncResetWithSince = class extends h("LinkedinSyncResetWithSince")() {
15136
+ var LinkedinSyncResetWithSince = class extends h("LinkedinSyncResetWithSince") {
14999
15137
  constructor() {
15000
15138
  super({ message: "--reset cannot be combined with --since" });
15001
15139
  }
15002
15140
  };
15003
- var LinkedinSyncUnsupportedSince = class extends h("LinkedinSyncUnsupportedSince")() {
15141
+ var LinkedinSyncUnsupportedSince = class extends h("LinkedinSyncUnsupportedSince") {
15004
15142
  constructor(collection) {
15005
15143
  super({
15006
15144
  collection,
@@ -15008,7 +15146,7 @@ var LinkedinSyncUnsupportedSince = class extends h("LinkedinSyncUnsupportedSince
15008
15146
  });
15009
15147
  }
15010
15148
  };
15011
- var LinkedinSyncMissingInitialFullSync = class extends h("LinkedinSyncMissingInitialFullSync")() {
15149
+ var LinkedinSyncMissingInitialFullSync = class extends h("LinkedinSyncMissingInitialFullSync") {
15012
15150
  constructor(collection) {
15013
15151
  super({
15014
15152
  collection,
@@ -15016,36 +15154,36 @@ var LinkedinSyncMissingInitialFullSync = class extends h("LinkedinSyncMissingIni
15016
15154
  });
15017
15155
  }
15018
15156
  };
15019
- var InvalidLinkedinSyncSince = class extends h("InvalidLinkedinSyncSince")() {};
15157
+ var InvalidLinkedinSyncSince = class extends h("InvalidLinkedinSyncSince") {};
15020
15158
  const linkedinSyncCollectionShortName = (collection) => collection.key.replace(/^(x|li)_/, "");
15021
15159
  const linkedinSyncCollectionFor = (collections, collection) => {
15022
15160
  const found = collections.find((candidate) => linkedinSyncCollectionShortName(candidate) === collection || candidate.key === collection);
15023
- if (found) return G.ok(found);
15161
+ if (found) return ae.ok(found);
15024
15162
  const available = collections.map(linkedinSyncCollectionShortName);
15025
- return G.err(new UnknownLinkedinSyncCollection({
15163
+ return ae.err(new UnknownLinkedinSyncCollection({
15026
15164
  collection,
15027
15165
  available,
15028
15166
  message: `Unknown collection "${collection}". Available: ${available.join(", ")}`
15029
15167
  }));
15030
15168
  };
15031
15169
  const planLinkedinSyncCommand = ({ args, collections, cursorState }) => {
15032
- 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" });
15033
15171
  const collection = linkedinSyncCollectionFor(collections, String(args.collection));
15034
- if (G.isError(collection)) return G.err(collection.error);
15035
- 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({
15036
15174
  mode: "reset",
15037
15175
  collection: collection.value
15038
- }) : G.err(new LinkedinSyncResetWithSince());
15039
- if (args.since == null) return G.ok({
15176
+ }) : ae.err(new LinkedinSyncResetWithSince());
15177
+ if (args.since == null) return ae.ok({
15040
15178
  mode: "run",
15041
15179
  collection: collection.value
15042
15180
  });
15043
15181
  const shortName = linkedinSyncCollectionShortName(collection.value);
15044
- if (!collection.value.sinceField) return G.err(new LinkedinSyncUnsupportedSince(shortName));
15045
- 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));
15046
15184
  const parsedSince = parseSinceResult(String(args.since));
15047
- if (G.isError(parsedSince)) return G.err(new InvalidLinkedinSyncSince({ message: parsedSince.error.message }));
15048
- return G.ok({
15185
+ if (ae.isError(parsedSince)) return ae.err(new InvalidLinkedinSyncSince({ message: parsedSince.error.message }));
15186
+ return ae.ok({
15049
15187
  mode: "run",
15050
15188
  collection: collection.value,
15051
15189
  since: parsedSince.value
@@ -15476,7 +15614,7 @@ const buildSync$1 = (deps, platform) => defineCommand({
15476
15614
  }
15477
15615
  })() : void 0
15478
15616
  });
15479
- if (G.isError(plan)) throw new UsageError(plan.error.message);
15617
+ if (ae.isError(plan)) throw new UsageError(plan.error.message);
15480
15618
  if (plan.value.mode === "list") {
15481
15619
  const cache = openLinkedinCache({
15482
15620
  platform,
@@ -15553,7 +15691,7 @@ const buildSync$1 = (deps, platform) => defineCommand({
15553
15691
  if (rateLimitError) throw rateLimitError;
15554
15692
  throw error;
15555
15693
  }
15556
- if (G.isError(result)) {
15694
+ if (ae.isError(result)) {
15557
15695
  progress.error();
15558
15696
  const rateLimitError = enrichRateLimitSyncError$1({
15559
15697
  error: result.error,
@@ -15662,7 +15800,7 @@ const buildSql$1 = (deps, platform) => defineCommand({
15662
15800
  } catch (error) {
15663
15801
  throw new UsageError(`Query failed (cache is read-only): ${error instanceof Error ? error.message : String(error)}`);
15664
15802
  }
15665
- 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}`);
15666
15804
  await deps.printResult({
15667
15805
  account: res.account,
15668
15806
  contract,
@@ -19722,7 +19860,7 @@ const contractFor$1 = (op, commandName, group) => buildRuntimeContract(xRuntimeA
19722
19860
  const defineOperationCommand = (op, deps) => defineRuntimeOperationCommand(xRuntimeAdapter, op, deps);
19723
19861
  //#endregion
19724
19862
  //#region ../../packages/x/src/cli/sync-plan.ts
19725
- var XSyncPlanError = class extends h("XSyncPlanError")() {
19863
+ var XSyncPlanError = class extends h("XSyncPlanError") {
19726
19864
  constructor(args) {
19727
19865
  super(args);
19728
19866
  this.name = "XSyncPlanError";
@@ -19731,30 +19869,30 @@ var XSyncPlanError = class extends h("XSyncPlanError")() {
19731
19869
  const shortSyncCollectionName = (collection) => collection.key.replace(/^(x|li)_/, "");
19732
19870
  const findSyncCollection = (collections, input) => collections.find((collection) => shortSyncCollectionName(collection) === input || collection.key === input);
19733
19871
  const parseTimeoutSeconds = (value) => {
19734
- if (value == null) return G.ok(void 0);
19872
+ if (value == null) return ae.ok(void 0);
19735
19873
  const timeoutSeconds = Number(value);
19736
- if (!Number.isInteger(timeoutSeconds) || timeoutSeconds < 1) return G.err(new XSyncPlanError({
19874
+ if (!Number.isInteger(timeoutSeconds) || timeoutSeconds < 1) return ae.err(new XSyncPlanError({
19737
19875
  kind: "invalid-timeout",
19738
19876
  message: "--timeout must be at least 1."
19739
19877
  }));
19740
- return G.ok(timeoutSeconds);
19878
+ return ae.ok(timeoutSeconds);
19741
19879
  };
19742
19880
  const planXSync = (input) => {
19743
19881
  const accountSelector = input.accountSelector;
19744
- 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({
19745
19883
  kind: "missing-account-selector",
19746
19884
  message: "Selected X account is missing an account selector."
19747
19885
  }));
19748
19886
  const timeout = parseTimeoutSeconds(input.timeout);
19749
- if (G.isError(timeout)) return G.err(timeout.error);
19887
+ if (ae.isError(timeout)) return ae.err(timeout.error);
19750
19888
  const accountHeaders = { "x-social-account-id": accountSelector };
19751
19889
  const collectionInput = typeof input.collection === "string" && input.collection.length > 0 ? input.collection : void 0;
19752
19890
  if (collectionInput === void 0) {
19753
- if (input.reset === true) return G.err(new XSyncPlanError({
19891
+ if (input.reset === true) return ae.err(new XSyncPlanError({
19754
19892
  kind: "reset-without-collection",
19755
19893
  message: "--reset requires a collection"
19756
19894
  }));
19757
- return G.ok({
19895
+ return ae.ok({
19758
19896
  kind: "list",
19759
19897
  accountHeaders,
19760
19898
  accountSelector,
@@ -19762,19 +19900,19 @@ const planXSync = (input) => {
19762
19900
  });
19763
19901
  }
19764
19902
  const collection = findSyncCollection(input.collections, collectionInput);
19765
- if (collection === void 0) return G.err(new XSyncPlanError({
19903
+ if (collection === void 0) return ae.err(new XSyncPlanError({
19766
19904
  kind: "unknown-collection",
19767
19905
  collection: collectionInput,
19768
19906
  message: `Unknown collection "${collectionInput}". Available: ${input.collections.map(shortSyncCollectionName).join(", ")}`
19769
19907
  }));
19770
19908
  if (input.reset === true) {
19771
- if (input.since != null) return G.err(new XSyncPlanError({
19909
+ if (input.since != null) return ae.err(new XSyncPlanError({
19772
19910
  kind: "reset-with-since",
19773
19911
  collection: collection.key,
19774
19912
  message: "--reset cannot be combined with --since"
19775
19913
  }));
19776
19914
  const resetCollections = resetTablesFor(collection);
19777
- return G.ok({
19915
+ return ae.ok({
19778
19916
  kind: "reset",
19779
19917
  accountHeaders,
19780
19918
  accountSelector,
@@ -19785,20 +19923,20 @@ const planXSync = (input) => {
19785
19923
  }
19786
19924
  let since;
19787
19925
  if (input.since != null) {
19788
- if (!collection.sinceField) return G.err(new XSyncPlanError({
19926
+ if (!collection.sinceField) return ae.err(new XSyncPlanError({
19789
19927
  kind: "since-unsupported",
19790
19928
  collection: collection.key,
19791
19929
  message: `${shortSyncCollectionName(collection)} does not support --since`
19792
19930
  }));
19793
19931
  const parsedSince = parseSinceResult(String(input.since));
19794
- if (G.isError(parsedSince)) return G.err(new XSyncPlanError({
19932
+ if (ae.isError(parsedSince)) return ae.err(new XSyncPlanError({
19795
19933
  kind: "since-unsupported",
19796
19934
  collection: collection.key,
19797
19935
  message: parsedSince.error.message
19798
19936
  }));
19799
19937
  since = parsedSince.value;
19800
19938
  }
19801
- return G.ok({
19939
+ return ae.ok({
19802
19940
  kind: "run",
19803
19941
  accountHeaders,
19804
19942
  accountSelector,
@@ -19809,7 +19947,7 @@ const planXSync = (input) => {
19809
19947
  };
19810
19948
  //#endregion
19811
19949
  //#region ../../packages/x/src/cli/write-plan.ts
19812
- var XWritePlanError = class extends h("XWritePlanError")() {
19950
+ var XWritePlanError = class extends h("XWritePlanError") {
19813
19951
  constructor(args) {
19814
19952
  super(args);
19815
19953
  this.name = "XWritePlanError";
@@ -19831,16 +19969,16 @@ const responseString = (data, keys) => {
19831
19969
  const responseMediaIdResult = (data) => {
19832
19970
  const root = isObjectRecord$1(data) ? data : void 0;
19833
19971
  const id = (isObjectRecord$1(root?.data) ? root.data : void 0)?.id ?? root?.id;
19834
- 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({
19835
19973
  kind: "missing-media-id",
19836
19974
  message: "Media upload did not return a media id."
19837
19975
  }));
19838
- return G.ok(String(id));
19976
+ return ae.ok(String(id));
19839
19977
  };
19840
- const requiredTargetResult = (target) => target === void 0 ? G.err(new XWritePlanError({
19978
+ const requiredTargetResult = (target) => target === void 0 ? ae.err(new XWritePlanError({
19841
19979
  kind: "missing-target",
19842
19980
  message: "target is required."
19843
- })) : G.ok(target);
19981
+ })) : ae.ok(target);
19844
19982
  const postMediaByExtension = {
19845
19983
  ".gif": {
19846
19984
  mediaType: "image/gif",
@@ -19873,22 +20011,22 @@ const postMediaByExtension = {
19873
20011
  };
19874
20012
  const parsePostMediaFileResult = (path) => {
19875
20013
  const media = postMediaByExtension[extname(path).toLowerCase()];
19876
- if (media === void 0) return G.err(new XWritePlanError({
20014
+ if (media === void 0) return ae.err(new XWritePlanError({
19877
20015
  kind: "invalid-media-type",
19878
20016
  message: `Unsupported media type for ${path}. Supported types: jpg, jpeg, png, webp, gif, mp4, mov.`
19879
20017
  }));
19880
- return G.ok({
20018
+ return ae.ok({
19881
20019
  ...media,
19882
20020
  path
19883
20021
  });
19884
20022
  };
19885
20023
  const parsePostMediaIdResult = (value) => {
19886
20024
  const mediaId = value.trim();
19887
- if (mediaId.length === 0) return G.err(new XWritePlanError({
20025
+ if (mediaId.length === 0) return ae.err(new XWritePlanError({
19888
20026
  kind: "empty-media-id",
19889
20027
  message: "--media-id cannot be empty."
19890
20028
  }));
19891
- return G.ok(mediaId);
20029
+ return ae.ok(mediaId);
19892
20030
  };
19893
20031
  const postBodyHasText = (body) => {
19894
20032
  const text = body?.text;
@@ -19900,7 +20038,7 @@ const postBodyMediaIds = (body) => {
19900
20038
  };
19901
20039
  const postBodyHasPoll = (body) => isObjectRecord$1(body?.poll);
19902
20040
  const validatePostMediaResult = (mediaFiles, mediaIds) => {
19903
- if (mediaFiles.length + mediaIds.length > 4) return G.err(new XWritePlanError({
20041
+ if (mediaFiles.length + mediaIds.length > 4) return ae.err(new XWritePlanError({
19904
20042
  kind: "invalid-media-mix",
19905
20043
  message: "Attach at most 4 media items."
19906
20044
  }));
@@ -19912,35 +20050,35 @@ const validatePostMediaResult = (mediaFiles, mediaIds) => {
19912
20050
  gifCount > 0,
19913
20051
  videoCount > 0
19914
20052
  ].filter(Boolean).length;
19915
- if (imageCount > 4) return G.err(new XWritePlanError({
20053
+ if (imageCount > 4) return ae.err(new XWritePlanError({
19916
20054
  kind: "invalid-media-mix",
19917
20055
  message: "Attach at most 4 images."
19918
20056
  }));
19919
- if (gifCount > 1) return G.err(new XWritePlanError({
20057
+ if (gifCount > 1) return ae.err(new XWritePlanError({
19920
20058
  kind: "invalid-media-mix",
19921
20059
  message: "Attach at most 1 GIF."
19922
20060
  }));
19923
- if (videoCount > 1) return G.err(new XWritePlanError({
20061
+ if (videoCount > 1) return ae.err(new XWritePlanError({
19924
20062
  kind: "invalid-media-mix",
19925
20063
  message: "Attach at most 1 video."
19926
20064
  }));
19927
- if (localCategoryCount > 1) return G.err(new XWritePlanError({
20065
+ if (localCategoryCount > 1) return ae.err(new XWritePlanError({
19928
20066
  kind: "invalid-media-mix",
19929
20067
  message: "Do not mix images, GIFs, and videos in one post."
19930
20068
  }));
19931
- return G.ok();
20069
+ return ae.ok();
19932
20070
  };
19933
20071
  const validatePostPollMediaResult = (args) => {
19934
20072
  const explicitMediaCount = args.mediaFiles.length + args.mediaIds.length;
19935
20073
  const bodyMediaIds = explicitMediaCount > 0 ? [] : postBodyMediaIds(args.bodyFields);
19936
20074
  const hasMedia = explicitMediaCount + bodyMediaIds.length > 0;
19937
20075
  const hasPoll = args.poll !== void 0 || postBodyHasPoll(args.bodyFields);
19938
- if (hasPoll && hasMedia) return G.err(new XWritePlanError({
20076
+ if (hasPoll && hasMedia) return ae.err(new XWritePlanError({
19939
20077
  kind: "invalid-media-mix",
19940
20078
  message: "--poll-option cannot be combined with media attachments."
19941
20079
  }));
19942
20080
  const media = validatePostMediaResult(args.mediaFiles, [...args.mediaIds, ...bodyMediaIds]);
19943
- return G.isError(media) ? G.err(media.error) : G.ok({
20081
+ return ae.isError(media) ? ae.err(media.error) : ae.ok({
19944
20082
  bodyMediaIds,
19945
20083
  hasMedia,
19946
20084
  hasPoll
@@ -20010,12 +20148,12 @@ const planPostRequest = (args) => {
20010
20148
  };
20011
20149
  };
20012
20150
  const planMessageRequestResult = (args) => {
20013
- if (args.body === void 0) return G.err(new XWritePlanError({
20151
+ if (args.body === void 0) return ae.err(new XWritePlanError({
20014
20152
  kind: "missing-message-body",
20015
20153
  message: "Message body is required."
20016
20154
  }));
20017
20155
  const text = typeof args.body.text === "string" ? args.body.text : void 0;
20018
- if (args.threadResolution !== void 0) return G.ok({
20156
+ if (args.threadResolution !== void 0) return ae.ok({
20019
20157
  method: "POST",
20020
20158
  path: `x/dm_conversations/${encodeURIComponent(args.threadResolution.id)}/messages`,
20021
20159
  headers: args.headers,
@@ -20027,11 +20165,11 @@ const planMessageRequestResult = (args) => {
20027
20165
  });
20028
20166
  if (args.recipients.length === 1) {
20029
20167
  const [participant] = args.participantResolutions;
20030
- if (participant === void 0) return G.err(new XWritePlanError({
20168
+ if (participant === void 0) return ae.err(new XWritePlanError({
20031
20169
  kind: "missing-target",
20032
20170
  message: "Pass at least one recipient."
20033
20171
  }));
20034
- return G.ok({
20172
+ return ae.ok({
20035
20173
  method: "POST",
20036
20174
  path: `x/dm_conversations/with/${encodeURIComponent(participant.id)}/messages`,
20037
20175
  headers: args.headers,
@@ -20044,7 +20182,7 @@ const planMessageRequestResult = (args) => {
20044
20182
  }
20045
20183
  const participantIds = args.participantResolutions.map((resolution) => resolution.id);
20046
20184
  const { text: bodyText, ...bodyFields } = args.body;
20047
- return G.ok({
20185
+ return ae.ok({
20048
20186
  method: "POST",
20049
20187
  path: "x/dm_conversations",
20050
20188
  headers: args.headers,
@@ -20526,7 +20664,7 @@ const buildSync = (deps, platform) => defineCommand({
20526
20664
  since: args.since,
20527
20665
  timeout: args.timeout
20528
20666
  });
20529
- 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));
20530
20668
  const plan = planned.value;
20531
20669
  if (plan.kind === "list") {
20532
20670
  const cache = openXCacheFor(deps, {
@@ -20594,7 +20732,7 @@ const buildSync = (deps, platform) => defineCommand({
20594
20732
  if (rateLimitError) throw rateLimitError;
20595
20733
  throw error;
20596
20734
  }
20597
- if (G.isError(result)) {
20735
+ if (ae.isError(result)) {
20598
20736
  const rateLimitError = enrichRateLimitSyncError({
20599
20737
  error: result.error,
20600
20738
  platform,
@@ -20701,7 +20839,7 @@ const buildSql = (deps, platform) => {
20701
20839
  } catch (error) {
20702
20840
  throw new UsageError(`Query failed (cache is read-only): ${errorMessageFrom(error)}`);
20703
20841
  }
20704
- 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}`);
20705
20843
  await deps.printResult({
20706
20844
  account: account.account,
20707
20845
  contract: schemaContract,
@@ -20786,7 +20924,7 @@ const throwWritePlanError = (error) => {
20786
20924
  };
20787
20925
  const requireWriteTarget = (target) => {
20788
20926
  const required = requiredTargetResult(target);
20789
- if (G.isError(required)) return throwWritePlanError(required.error);
20927
+ if (ae.isError(required)) return throwWritePlanError(required.error);
20790
20928
  return required.value;
20791
20929
  };
20792
20930
  const executeWriteRequest = (deps, plan) => plan.method === "POST" ? deps.api.post(plan.path, {
@@ -20839,7 +20977,7 @@ const repeatableValues = (name, value, rawArgs) => {
20839
20977
  };
20840
20978
  const parsePostMediaId = (deps, value) => {
20841
20979
  const mediaId = parsePostMediaIdResult(value);
20842
- if (G.isError(mediaId)) throw new UsageError(mediaId.error.message);
20980
+ if (ae.isError(mediaId)) throw new UsageError(mediaId.error.message);
20843
20981
  return deps.parseResourceId("--media-id", mediaId.value);
20844
20982
  };
20845
20983
  const parsePostPoll = (deps, args, rawArgs) => {
@@ -20924,7 +21062,7 @@ const uploadPostMedia = async (deps, headers, media, timeoutSeconds) => {
20924
21062
  initBody.set("total_bytes", String(file.byteLength));
20925
21063
  initBody.set("media_category", media.category);
20926
21064
  const mediaId = responseMediaIdResult(await (await postMediaForm(deps, "x/media/upload/init", headers, initBody)).json());
20927
- if (G.isError(mediaId)) throw new UsageError(mediaId.error.message);
21065
+ if (ae.isError(mediaId)) throw new UsageError(mediaId.error.message);
20928
21066
  for (let segmentIndex = 0, offset = 0; offset < file.byteLength; segmentIndex += 1, offset += postMediaChunkSize) {
20929
21067
  const chunk = file.subarray(offset, offset + postMediaChunkSize);
20930
21068
  const appendBody = new FormData();
@@ -21186,7 +21324,7 @@ const buildPost = (deps) => {
21186
21324
  const commandArgs = args;
21187
21325
  const mediaFiles = repeatableValues("media", commandArgs.media, rawArgs).map((path) => {
21188
21326
  const media = parsePostMediaFileResult(path);
21189
- if (G.isError(media)) throw new UsageError(media.error.message);
21327
+ if (ae.isError(media)) throw new UsageError(media.error.message);
21190
21328
  return media.value;
21191
21329
  });
21192
21330
  const mediaIds = repeatableValues("media-id", commandArgs["media-id"], rawArgs).map((mediaId) => parsePostMediaId(deps, mediaId));
@@ -21198,7 +21336,7 @@ const buildPost = (deps) => {
21198
21336
  mediaIds,
21199
21337
  poll
21200
21338
  });
21201
- if (G.isError(postInputs)) throw new UsageError(postInputs.error.message);
21339
+ if (ae.isError(postInputs)) throw new UsageError(postInputs.error.message);
21202
21340
  const timeoutSeconds = commandArgs.timeout === void 0 ? postMediaProcessingTimeoutSeconds : deps.parseIntegerString("--timeout", commandArgs.timeout, { min: 1 });
21203
21341
  const stdinBody = await readPostStdinBody(deps, postInputs.value.hasMedia, bodyFields);
21204
21342
  const account = typeof commandArgs.account === "string" ? commandArgs.account : void 0;
@@ -22240,7 +22378,7 @@ const buildMessage = (deps) => {
22240
22378
  recipients,
22241
22379
  threadResolution
22242
22380
  });
22243
- if (G.isError(request)) throw new UsageError(request.error.message);
22381
+ if (ae.isError(request)) throw new UsageError(request.error.message);
22244
22382
  const response = await deps.api.post(request.value.path, {
22245
22383
  headers: request.value.headers,
22246
22384
  json: request.value.body
@@ -22533,10 +22671,10 @@ createXCommands({
22533
22671
  //#endregion
22534
22672
  //#region ../../packages/linkedin/src/cli/lifecycle-plan.ts
22535
22673
  const LINKEDIN_CONNECTED_STATUS = "connected";
22536
- var InvalidLinkedinLifecycleTarget = class extends h("InvalidLinkedinLifecycleTarget")() {};
22537
- var LinkedinLifecycleNoAccountMatch = class extends h("LinkedinLifecycleNoAccountMatch")() {};
22538
- var LinkedinLifecycleAmbiguousAccount = class extends h("LinkedinLifecycleAmbiguousAccount")() {};
22539
- 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") {
22540
22678
  constructor() {
22541
22679
  super({ message: "billing_seat_timed_out" });
22542
22680
  }
@@ -22546,22 +22684,22 @@ const parseLinkedinReconnectTarget = (value) => {
22546
22684
  const trimmed = value.trim();
22547
22685
  if (trimmed.startsWith("@")) {
22548
22686
  const username = normalizeSocialIdentifier(trimmed);
22549
- if (username) return G.ok({
22687
+ if (username) return ae.ok({
22550
22688
  type: "username",
22551
22689
  value: username
22552
22690
  });
22553
22691
  }
22554
22692
  const profileSelector = parseTypedSocialSelector(trimmed, { prefixes: ["profile_id"] });
22555
- if (profileSelector) return G.ok({
22693
+ if (profileSelector) return ae.ok({
22556
22694
  type: "profileId",
22557
22695
  value: profileSelector.id.toLowerCase()
22558
22696
  });
22559
22697
  const publicIdentifier = linkedInProfileIdentifierFromURL(trimmed);
22560
- if (publicIdentifier) return G.ok({
22698
+ if (publicIdentifier) return ae.ok({
22561
22699
  type: "username",
22562
22700
  value: publicIdentifier
22563
22701
  });
22564
- return G.err(new InvalidLinkedinLifecycleTarget({
22702
+ return ae.err(new InvalidLinkedinLifecycleTarget({
22565
22703
  value,
22566
22704
  message: "LinkedIn reconnect account must be @username, a LinkedIn profile URL, or profile_id:<id>."
22567
22705
  }));
@@ -22577,14 +22715,14 @@ const reconnectCommandTargetFor = (account) => {
22577
22715
  const connectedLinkedinLifecycleAccounts = (accounts) => accounts.filter((account) => account.status === LINKEDIN_CONNECTED_STATUS);
22578
22716
  const resolveLinkedinLifecycleAccount = (accounts, identifier) => {
22579
22717
  const target = parseLinkedinReconnectTarget(identifier);
22580
- if (G.isError(target)) return G.err(target.error);
22718
+ if (ae.isError(target)) return ae.err(target.error);
22581
22719
  const matches = accounts.filter((candidate) => linkedinLifecycleAccountMatchesTarget(candidate, target.value));
22582
- if (matches.length === 1 && matches[0]) return G.ok(matches[0]);
22583
- 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({
22584
22722
  value: identifier,
22585
22723
  message: `No LinkedIn account matches "${identifier}".`
22586
22724
  }));
22587
- return G.err(new LinkedinLifecycleAmbiguousAccount({
22725
+ return ae.err(new LinkedinLifecycleAmbiguousAccount({
22588
22726
  value: identifier,
22589
22727
  message: `Multiple LinkedIn accounts match "${identifier}". Pass profile_id:<id>.`
22590
22728
  }));
@@ -22592,9 +22730,9 @@ const resolveLinkedinLifecycleAccount = (accounts, identifier) => {
22592
22730
  const resolveLinkedinDisconnectAccount = (accounts, identifier) => {
22593
22731
  if (identifier) return resolveLinkedinLifecycleAccount(accounts, identifier);
22594
22732
  const connected = connectedLinkedinLifecycleAccounts(accounts);
22595
- if (connected.length === 1 && connected[0]) return G.ok(connected[0]);
22596
- if (connected.length === 0) return G.err(new LinkedinLifecycleNoAccountMatch({ message: "No connected LinkedIn accounts found." }));
22597
- 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." }));
22598
22736
  };
22599
22737
  //#endregion
22600
22738
  //#region ../../packages/linkedin/src/cli/lifecycle.ts
@@ -22654,12 +22792,12 @@ const authURLFor$1 = async (deps, operation) => ({
22654
22792
  });
22655
22793
  const reconnectAccountForIdentifier = async (deps, identifier) => {
22656
22794
  const account = resolveLinkedinLifecycleAccount(await listLinkedinLifecycleAccounts(deps), identifier);
22657
- if (G.isError(account)) throw account.error;
22795
+ if (ae.isError(account)) throw account.error;
22658
22796
  return account.value;
22659
22797
  };
22660
22798
  const resolveDisconnectTarget = async (deps, identifier) => {
22661
22799
  const account = resolveLinkedinDisconnectAccount(await listLinkedinLifecycleAccounts(deps, Boolean(identifier)), identifier);
22662
- if (G.isError(account)) throw account.error;
22800
+ if (ae.isError(account)) throw account.error;
22663
22801
  return account.value;
22664
22802
  };
22665
22803
  const connectLinkedinAccount = async (deps) => {
@@ -22710,7 +22848,7 @@ const disconnectLinkedinAccount = async (deps, identifier) => {
22710
22848
  const CONNECT_TIMEOUT_MS = 300 * 1e3;
22711
22849
  const SEAT_POLL_TIMEOUT_MS = 600 * 1e3;
22712
22850
  const POLL_INTERVAL_MS = 2 * 1e3;
22713
- var XConnectTimedOut = class extends h("XConnectTimedOut")() {
22851
+ var XConnectTimedOut = class extends h("XConnectTimedOut") {
22714
22852
  constructor(args) {
22715
22853
  super({
22716
22854
  ...args,
@@ -22719,7 +22857,7 @@ var XConnectTimedOut = class extends h("XConnectTimedOut")() {
22719
22857
  this.name = "XConnectTimedOut";
22720
22858
  }
22721
22859
  };
22722
- var XBillingSeatTimedOut = class extends h("XBillingSeatTimedOut")() {
22860
+ var XBillingSeatTimedOut = class extends h("XBillingSeatTimedOut") {
22723
22861
  constructor() {
22724
22862
  super({
22725
22863
  operation: "prepareAccountConnect",
@@ -22729,7 +22867,7 @@ var XBillingSeatTimedOut = class extends h("XBillingSeatTimedOut")() {
22729
22867
  this.name = "XBillingSeatTimedOut";
22730
22868
  }
22731
22869
  };
22732
- var XAccountNotFound = class extends h("XAccountNotFound")() {
22870
+ var XAccountNotFound = class extends h("XAccountNotFound") {
22733
22871
  constructor(args) {
22734
22872
  super({
22735
22873
  ...args,
@@ -22738,9 +22876,7 @@ var XAccountNotFound = class extends h("XAccountNotFound")() {
22738
22876
  this.name = "XAccountNotFound";
22739
22877
  }
22740
22878
  };
22741
- h("XAccountNotConnected")();
22742
- h("XAccountRequired")();
22743
- var XInvalidSelector = class extends h("XInvalidSelector")() {
22879
+ var XInvalidSelector = class extends h("XInvalidSelector") {
22744
22880
  constructor(args) {
22745
22881
  super({
22746
22882
  ...args,
@@ -22779,10 +22915,10 @@ const pollForAccount = async (deps, operation, matches) => {
22779
22915
  platform: "x",
22780
22916
  includeDisconnected: true
22781
22917
  })).find(matches);
22782
- if (account) return G.ok(account);
22918
+ if (account) return ae.ok(account);
22783
22919
  await sleep(POLL_INTERVAL_MS);
22784
22920
  }
22785
- return G.err(new XConnectTimedOut({
22921
+ return ae.err(new XConnectTimedOut({
22786
22922
  operation,
22787
22923
  timeoutMS: CONNECT_TIMEOUT_MS
22788
22924
  }));
@@ -22796,15 +22932,15 @@ const pollForSeat = async (deps) => {
22796
22932
  const now = deps.now ?? Date.now;
22797
22933
  const startedAt = now();
22798
22934
  while (now() - startedAt < SEAT_POLL_TIMEOUT_MS) {
22799
- if ((await deps.client.billing.status()).canConnect) return G.ok();
22935
+ if ((await deps.client.billing.status()).canConnect) return ae.ok();
22800
22936
  await sleep(POLL_INTERVAL_MS);
22801
22937
  }
22802
- return G.err(new XBillingSeatTimedOut());
22938
+ return ae.err(new XBillingSeatTimedOut());
22803
22939
  };
22804
22940
  const prepareAccountConnect = async (deps) => {
22805
- if ((await deps.client.billing.status()).canConnect) return G.ok();
22941
+ if ((await deps.client.billing.status()).canConnect) return ae.ok();
22806
22942
  const status = await deps.client.billing.prepareAccountConnect();
22807
- if (status.canConnect) return G.ok();
22943
+ if (status.canConnect) return ae.ok();
22808
22944
  if (status.paymentURL) surfaceURL(deps, status.paymentURL);
22809
22945
  return pollForSeat(deps);
22810
22946
  };
@@ -22816,18 +22952,18 @@ const parseXAccountSelector = (target, operation) => {
22816
22952
  const trimmed = target.trim();
22817
22953
  if (trimmed.startsWith("profile_id:")) {
22818
22954
  const profileId = trimmed.slice(11).trim();
22819
- if (profileId && !/[/?#%]/.test(profileId)) return G.ok({
22955
+ if (profileId && !/[/?#%]/.test(profileId)) return ae.ok({
22820
22956
  kind: "profileId",
22821
22957
  normalized: profileId.toLowerCase(),
22822
22958
  raw: target
22823
22959
  });
22824
22960
  }
22825
- if (trimmed.startsWith("@") && !/[/?#%]/.test(trimmed)) return G.ok({
22961
+ if (trimmed.startsWith("@") && !/[/?#%]/.test(trimmed)) return ae.ok({
22826
22962
  kind: "username",
22827
22963
  normalized: normalizeIdentifier(trimmed),
22828
22964
  raw: target
22829
22965
  });
22830
- return G.err(new XInvalidSelector({
22966
+ return ae.err(new XInvalidSelector({
22831
22967
  operation,
22832
22968
  account: target
22833
22969
  }));
@@ -22836,7 +22972,7 @@ const findXLifecycleAccount = (accounts, selector) => {
22836
22972
  if (selector.kind === "profileId") return accounts.find((account) => account.profileId.toLowerCase() === selector.normalized);
22837
22973
  return accounts.find((account) => normalizeIdentifier(account.username) === selector.normalized);
22838
22974
  };
22839
- 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({
22840
22976
  platform: "x",
22841
22977
  includeDisconnected
22842
22978
  }));
@@ -22847,12 +22983,12 @@ const listXLifecycleAccounts = async (deps, includeDisconnected) => G.ok(await d
22847
22983
  const createXConnectURL = (deps, reconnectProfileId) => connectURLFor(deps, reconnectProfileId);
22848
22984
  const connectXAccount = async (deps) => {
22849
22985
  const beforeResult = await listXLifecycleAccounts(deps, true);
22850
- if (G.isError(beforeResult)) return G.err(beforeResult.error);
22986
+ if (ae.isError(beforeResult)) return ae.err(beforeResult.error);
22851
22987
  const before = beforeResult.value;
22852
22988
  const connectedBefore = new Set(before.filter((account) => account.status === "connected").map(accountKey));
22853
22989
  const lastSeenBefore = new Map(before.filter((account) => account.status === "connected").map((account) => [accountKey(account), timestampMS(account.lastSeenAt)]));
22854
22990
  const prepared = await prepareAccountConnect(deps);
22855
- if (G.isError(prepared)) return G.err(prepared.error);
22991
+ if (ae.isError(prepared)) return ae.err(prepared.error);
22856
22992
  const authURL = await authURLFor(deps, () => connectURLFor(deps));
22857
22993
  surfaceURL(deps, authURL.url, { log: !authURL.openingLogged });
22858
22994
  const account = await pollForAccount(deps, "connect", (candidate) => {
@@ -22862,8 +22998,8 @@ const connectXAccount = async (deps) => {
22862
22998
  const currentLastSeen = timestampMS(candidate.lastSeenAt);
22863
22999
  return previousLastSeen !== void 0 && currentLastSeen !== void 0 && currentLastSeen > previousLastSeen;
22864
23000
  });
22865
- if (G.isError(account)) return G.err(account.error);
22866
- return G.ok({
23001
+ if (ae.isError(account)) return ae.err(account.error);
23002
+ return ae.ok({
22867
23003
  platform: "x",
22868
23004
  status: "connected",
22869
23005
  account: account.value
@@ -22871,20 +23007,20 @@ const connectXAccount = async (deps) => {
22871
23007
  };
22872
23008
  const reconnectXAccount = async (deps, args) => {
22873
23009
  const selector = parseXAccountSelector(args.account, "reconnect");
22874
- if (G.isError(selector)) return G.err(selector.error);
23010
+ if (ae.isError(selector)) return ae.err(selector.error);
22875
23011
  const accountsResult = await listXLifecycleAccounts(deps, true);
22876
- if (G.isError(accountsResult)) return G.err(accountsResult.error);
23012
+ if (ae.isError(accountsResult)) return ae.err(accountsResult.error);
22877
23013
  const accounts = accountsResult.value;
22878
23014
  const existing = findXLifecycleAccount(accounts, selector.value);
22879
- if (!existing) return G.err(new XAccountNotFound({
23015
+ if (!existing) return ae.err(new XAccountNotFound({
22880
23016
  operation: "reconnect",
22881
23017
  account: args.account
22882
23018
  }));
22883
23019
  const authURL = await authURLFor(deps, () => connectURLFor(deps, existing.profileId));
22884
23020
  surfaceURL(deps, authURL.url, { log: !authURL.openingLogged });
22885
23021
  const account = await pollForAccount(deps, "reconnect", (candidate) => candidate.profileId === existing.profileId && candidate.status === "connected");
22886
- if (G.isError(account)) return G.err(account.error);
22887
- return G.ok({
23022
+ if (ae.isError(account)) return ae.err(account.error);
23023
+ return ae.ok({
22888
23024
  platform: "x",
22889
23025
  status: "connected",
22890
23026
  account: account.value
@@ -22892,12 +23028,12 @@ const reconnectXAccount = async (deps, args) => {
22892
23028
  };
22893
23029
  const disconnectXAccount = async (deps, target) => {
22894
23030
  const selector = parseXAccountSelector(target, "disconnect");
22895
- if (G.isError(selector)) return G.err(selector.error);
23031
+ if (ae.isError(selector)) return ae.err(selector.error);
22896
23032
  const accountsResult = await listXLifecycleAccounts(deps);
22897
- if (G.isError(accountsResult)) return G.err(accountsResult.error);
23033
+ if (ae.isError(accountsResult)) return ae.err(accountsResult.error);
22898
23034
  const accounts = accountsResult.value;
22899
23035
  const account = findXLifecycleAccount(accounts, selector.value);
22900
- if (!account) return G.err(new XAccountNotFound({
23036
+ if (!account) return ae.err(new XAccountNotFound({
22901
23037
  operation: "disconnect",
22902
23038
  account: target
22903
23039
  }));
@@ -22905,14 +23041,14 @@ const disconnectXAccount = async (deps, target) => {
22905
23041
  platform: "x",
22906
23042
  account: accountSelectorFor$1(account)
22907
23043
  });
22908
- return G.ok({
23044
+ return ae.ok({
22909
23045
  platform: "x",
22910
23046
  account,
22911
23047
  result
22912
23048
  });
22913
23049
  };
22914
23050
  //#endregion
22915
- //#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
22916
23052
  function resolveMaybeOptionalOptions(rest) {
22917
23053
  return rest[0] ?? {};
22918
23054
  }
@@ -22921,7 +23057,7 @@ function toArray(value) {
22921
23057
  }
22922
23058
  const ORPC_NAME = "orpc";
22923
23059
  const ORPC_SHARED_PACKAGE_NAME = "@orpc/shared";
22924
- const ORPC_SHARED_PACKAGE_VERSION = "1.14.8";
23060
+ const ORPC_SHARED_PACKAGE_VERSION = "1.14.14";
22925
23061
  var AbortError$1 = class extends Error {
22926
23062
  constructor(...rest) {
22927
23063
  super(...rest);
@@ -23150,9 +23286,9 @@ function tryDecodeURIComponent(value) {
23150
23286
  }
23151
23287
  }
23152
23288
  //#endregion
23153
- //#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
23154
23290
  const ORPC_CLIENT_PACKAGE_NAME = "@orpc/client";
23155
- const ORPC_CLIENT_PACKAGE_VERSION = "1.14.8";
23291
+ const ORPC_CLIENT_PACKAGE_VERSION = "1.14.14";
23156
23292
  const COMMON_ORPC_ERROR_DEFS = {
23157
23293
  BAD_REQUEST: {
23158
23294
  status: 400,
@@ -23316,7 +23452,7 @@ function createORPCErrorFromJson(json, options = {}) {
23316
23452
  });
23317
23453
  }
23318
23454
  //#endregion
23319
- //#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
23320
23456
  var EventEncoderError = class extends TypeError {};
23321
23457
  var EventDecoderError = class extends TypeError {};
23322
23458
  var ErrorEvent = class extends Error {
@@ -23326,8 +23462,13 @@ var ErrorEvent = class extends Error {
23326
23462
  this.data = options?.data;
23327
23463
  }
23328
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;
23329
23471
  function decodeEventMessage(encoded) {
23330
- const lines = encoded.replace(/\n+$/, "").split(/\n/);
23331
23472
  const message = {
23332
23473
  data: void 0,
23333
23474
  event: void 0,
@@ -23335,45 +23476,77 @@ function decodeEventMessage(encoded) {
23335
23476
  retry: void 0,
23336
23477
  comments: []
23337
23478
  };
23338
- for (const line of lines) {
23479
+ for (const line of encoded.split(LINE_ENDING_REGEX$1)) {
23480
+ if (line === "") continue;
23339
23481
  const index = line.indexOf(":");
23340
- const key = index === -1 ? line : line.slice(0, index);
23341
- const value = index === -1 ? "" : line.slice(index + 1).replace(/^\s/, "");
23342
- if (index === 0) message.comments.push(value);
23343
- else if (key === "data") {
23344
- message.data ??= "";
23345
- message.data += `${value}
23346
- `;
23347
- } else if (key === "event") message.event = value;
23348
- else if (key === "id") message.id = value;
23349
- else if (key === "retry") {
23350
- const maybeInteger = Number.parseInt(value);
23351
- 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
+ }
23352
23503
  }
23353
23504
  }
23354
- message.data = message.data?.replace(/\n$/, "");
23355
23505
  return message;
23356
23506
  }
23357
23507
  var EventDecoder = class {
23358
23508
  constructor(options = {}) {
23359
23509
  this.options = options;
23360
23510
  }
23361
- incomplete = "";
23511
+ pending = [];
23512
+ tail = "";
23513
+ discardLeadingLF = false;
23362
23514
  feed(chunk) {
23363
- this.incomplete += chunk;
23364
- const lastCompleteIndex = this.incomplete.lastIndexOf("\n\n");
23365
- if (lastCompleteIndex === -1) return;
23366
- const completes = this.incomplete.slice(0, lastCompleteIndex).split(/\n\n/);
23367
- this.incomplete = this.incomplete.slice(lastCompleteIndex + 2);
23368
- for (const encoded of completes) {
23369
- const message = decodeEventMessage(`${encoded}
23370
-
23371
- `);
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);
23372
23545
  if (this.options.onEvent) this.options.onEvent(message);
23373
23546
  }
23374
23547
  }
23375
23548
  end() {
23376
- 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");
23377
23550
  }
23378
23551
  };
23379
23552
  var EventDecoderStream = class extends TransformStream {
@@ -23394,24 +23567,27 @@ var EventDecoderStream = class extends TransformStream {
23394
23567
  });
23395
23568
  }
23396
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
+ }
23397
23575
  function assertEventId(id) {
23398
- 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");
23399
23577
  }
23400
23578
  function assertEventName(event) {
23401
- 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");
23402
23580
  }
23403
23581
  function assertEventRetry(retry) {
23404
23582
  if (!Number.isInteger(retry) || retry < 0) throw new EventEncoderError("Event's retry must be a integer and >= 0");
23405
23583
  }
23406
23584
  function assertEventComment(comment) {
23407
- 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");
23408
23586
  }
23409
23587
  function encodeEventData(data) {
23410
- const lines = data?.split(/\n/) ?? [];
23411
- let output = "";
23412
- for (const line of lines) output += `data: ${line}
23588
+ if (data === void 0) return "";
23589
+ return `data: ${data.replace(LINE_ENDING_GLOBAL_REGEX, "\ndata: ")}
23413
23590
  `;
23414
- return output;
23415
23591
  }
23416
23592
  function encodeEventComments(comments) {
23417
23593
  let output = "";
@@ -23476,7 +23652,7 @@ function mergeStandardHeaders(a, b) {
23476
23652
  return merged;
23477
23653
  }
23478
23654
  //#endregion
23479
- //#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
23480
23656
  function mapEventIterator(iterator, maps) {
23481
23657
  const mapError = async (error) => {
23482
23658
  let mappedError = await maps.error(error);
@@ -23512,7 +23688,7 @@ function mapEventIterator(iterator, maps) {
23512
23688
  });
23513
23689
  }
23514
23690
  //#endregion
23515
- //#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
23516
23692
  function resolveFriendlyClientOptions(options) {
23517
23693
  return {
23518
23694
  ...options,
@@ -23533,7 +23709,7 @@ function createORPCClient(link, options = {}) {
23533
23709
  } }));
23534
23710
  }
23535
23711
  //#endregion
23536
- //#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
23537
23713
  function toEventIterator(stream, options = {}) {
23538
23714
  const reader = (stream?.pipeThrough(new TextDecoderStream()).pipeThrough(new EventDecoderStream()))?.getReader();
23539
23715
  let span;
@@ -23760,7 +23936,7 @@ function toStandardLazyResponse(response, options = {}) {
23760
23936
  };
23761
23937
  }
23762
23938
  //#endregion
23763
- //#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
23764
23940
  var CompositeStandardLinkPlugin = class {
23765
23941
  plugins;
23766
23942
  constructor(plugins = []) {
@@ -24156,7 +24332,7 @@ var StandardRPCLink = class extends StandardLink {
24156
24332
  }
24157
24333
  };
24158
24334
  //#endregion
24159
- //#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
24160
24336
  var CompositeLinkFetchPlugin = class extends CompositeStandardLinkPlugin {
24161
24337
  initRuntimeAdapter(options) {
24162
24338
  for (const plugin of this.plugins) plugin.initRuntimeAdapter?.(options);
@@ -24272,7 +24448,7 @@ function createEnv(opts) {
24272
24448
  }
24273
24449
  //#endregion
24274
24450
  //#region package.json
24275
- var version$1 = "0.18.2";
24451
+ var version$1 = "0.18.4";
24276
24452
  //#endregion
24277
24453
  //#region src/lib/env.ts
24278
24454
  const URLWithTrailingSlash = url().transform(ensureTrailingSlash);
@@ -25475,16 +25651,16 @@ const CLI_SCOPE_ALIASES = ["read", "read,write"];
25475
25651
  `${productBrand.name}`, `${productBrand.name}`;
25476
25652
  const isCLIScopeAlias = (scope) => CLI_SCOPE_ALIASES.some((alias) => alias === scope);
25477
25653
  const parseDeviceScopeAlias = (scope) => {
25478
- if (!isCLIScopeAlias(scope)) return G.err({
25654
+ if (!isCLIScopeAlias(scope)) return ae.err({
25479
25655
  code: "invalid_device_authorization_scope",
25480
25656
  scope
25481
25657
  });
25482
- return G.ok(scope);
25658
+ return ae.ok(scope);
25483
25659
  };
25484
25660
  const parseCLIScopeAlias = parseDeviceScopeAlias;
25485
25661
  const scopeAliasFromAccessChoices$1 = (choices) => choices.includes("write") ? "read,write" : "read";
25486
25662
  //#endregion
25487
- //#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
25488
25664
  function createModulerModifier() {
25489
25665
  const getModuleFromFileName = createGetModuleFromFilename();
25490
25666
  return async (frames) => {
@@ -25514,7 +25690,7 @@ function normalizeWindowsPath(path) {
25514
25690
  return path.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
25515
25691
  }
25516
25692
  //#endregion
25517
- //#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
25518
25694
  const normalizeFlagsResponse = (flagsResponse) => {
25519
25695
  if ("flags" in flagsResponse) {
25520
25696
  const featureFlags = getFlagValuesFromFlags(flagsResponse.flags);
@@ -25571,8 +25747,67 @@ const parsePayload = (response) => {
25571
25747
  return response;
25572
25748
  }
25573
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
+ };
25574
25809
  //#endregion
25575
- //#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
25576
25811
  var types_PostHogPersistedProperty = /*#__PURE__*/ function(PostHogPersistedProperty) {
25577
25812
  PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
25578
25813
  PostHogPersistedProperty["DistinctId"] = "distinct_id";
@@ -25608,7 +25843,7 @@ var types_PostHogPersistedProperty = /*#__PURE__*/ function(PostHogPersistedProp
25608
25843
  return PostHogPersistedProperty;
25609
25844
  }({});
25610
25845
  //#endregion
25611
- //#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
25612
25847
  function isGzipSupported() {
25613
25848
  return "CompressionStream" in globalThis && "TextEncoder" in globalThis && "Response" in globalThis && "function" == typeof Response.prototype.blob;
25614
25849
  }
@@ -25670,7 +25905,7 @@ async function gzipCompress(input, isDebug = true, options) {
25670
25905
  }
25671
25906
  }
25672
25907
  //#endregion
25673
- //#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
25674
25909
  const DEFAULT_BLOCKED_UA_STRS = [
25675
25910
  "amazonbot",
25676
25911
  "amazonproductbot",
@@ -25759,7 +25994,7 @@ const isBlockedUA = function(ua, customBlockedUserAgents = []) {
25759
25994
  });
25760
25995
  };
25761
25996
  //#endregion
25762
- //#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
25763
25998
  function safeJsonStringify(value) {
25764
25999
  const ancestors = [];
25765
26000
  return JSON.stringify(value, function(_key, replacementValue) {
@@ -25779,7 +26014,7 @@ function safeJsonStringify(value) {
25779
26014
  }) ?? "null";
25780
26015
  }
25781
26016
  //#endregion
25782
- //#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
25783
26018
  const nativeIsArray = Array.isArray;
25784
26019
  const ObjProto = Object.prototype;
25785
26020
  ObjProto.hasOwnProperty;
@@ -25794,13 +26029,22 @@ const isEmptyString = (x) => isString$1(x) && 0 === x.trim().length;
25794
26029
  const isNull = (x) => null === x;
25795
26030
  const isNumber = (x) => "[object Number]" == type_utils_toString.call(x) && x === x;
25796
26031
  const isBoolean = (x) => "[object Boolean]" === type_utils_toString.call(x);
25797
- const isPlainError = (x) => x instanceof Error;
25798
26032
  function isPrimitive(value) {
25799
26033
  return null === value || "object" != typeof value;
25800
26034
  }
25801
26035
  function isBuiltin(candidate, className) {
25802
26036
  return Object.prototype.toString.call(candidate) === `[object ${className}]`;
25803
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
+ }
25804
26048
  function isEvent(candidate) {
25805
26049
  return "undefined" != typeof Event && isInstanceOf(candidate, Event);
25806
26050
  }
@@ -25815,7 +26059,7 @@ function isInstanceOf(candidate, base) {
25815
26059
  }
25816
26060
  }
25817
26061
  //#endregion
25818
- //#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
25819
26063
  function clampToRange(value, min, max, logger, fallbackValue) {
25820
26064
  if (min > max) {
25821
26065
  logger.warn("min cannot be greater than max.");
@@ -25833,7 +26077,7 @@ function clampToRange(value, min, max, logger, fallbackValue) {
25833
26077
  return clampToRange(fallbackValue || max, min, max, logger);
25834
26078
  }
25835
26079
  //#endregion
25836
- //#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
25837
26081
  const ONE_DAY_IN_MS = 864e5;
25838
26082
  function resolveExceptionRateLimiterConfig(config = {}) {
25839
26083
  return {
@@ -25879,8 +26123,10 @@ var BucketedRateLimiter = class {
25879
26123
  this._buckets = {};
25880
26124
  }
25881
26125
  };
26126
+ Date.prototype.getTime;
26127
+ Date.prototype.toISOString;
25882
26128
  //#endregion
25883
- //#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
25884
26130
  /*! For license information please see uuidv7.mjs.LICENSE.txt */
25885
26131
  /**
25886
26132
  * uuidv7: An experimental implementation of the proposed UUID Version 7
@@ -26046,7 +26292,7 @@ let defaultGenerator;
26046
26292
  const uuidv7 = () => uuidv7obj().toString();
26047
26293
  const uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator())).generate();
26048
26294
  //#endregion
26049
- //#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
26050
26296
  var PromiseQueue = class {
26051
26297
  add(promise) {
26052
26298
  const promiseUUID = uuidv7();
@@ -26085,7 +26331,7 @@ var PromiseQueue = class {
26085
26331
  }
26086
26332
  };
26087
26333
  //#endregion
26088
- //#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
26089
26335
  function createConsole(consoleLike = console) {
26090
26336
  return {
26091
26337
  log: consoleLike.log.bind(consoleLike),
@@ -26125,7 +26371,7 @@ function createLogger(prefix, maybeCall = passThrough) {
26125
26371
  return _createLogger(prefix, maybeCall, createConsole());
26126
26372
  }
26127
26373
  //#endregion
26128
- //#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
26129
26375
  const MOBILE = "Mobile";
26130
26376
  const TABLET = "Tablet";
26131
26377
  const NINTENDO = "Nintendo";
@@ -26137,7 +26383,7 @@ const WINDOWS = "Windows";
26137
26383
  new RegExp(XBOX, "i");
26138
26384
  new RegExp(NINTENDO, "i"), new RegExp(PLAYSTATION, "i"), new RegExp(WINDOWS, "i");
26139
26385
  //#endregion
26140
- //#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
26141
26387
  const STRING_FORMAT = "utf8";
26142
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;
26143
26389
  function isValidUUID(value) {
@@ -26170,6 +26416,23 @@ function safeSetTimeout(fn, timeout) {
26170
26416
  t?.unref && t?.unref();
26171
26417
  return t;
26172
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
+ }
26173
26436
  const isError = (x) => x instanceof Error;
26174
26437
  function allSettled(promises) {
26175
26438
  return Promise.all(promises.map((p) => (p ?? Promise.resolve()).then((value) => ({
@@ -26233,7 +26496,7 @@ function toOtlpKeyValueList(attrs) {
26233
26496
  return result;
26234
26497
  }
26235
26498
  //#endregion
26236
- //#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
26237
26500
  const DEFAULT_HISTOGRAM_BOUNDS = [
26238
26501
  0,
26239
26502
  5,
@@ -26286,7 +26549,7 @@ function buildOtlpMetricsPayload(metrics, resourceAttributes, scopeName, scopeVe
26286
26549
  }] };
26287
26550
  }
26288
26551
  //#endregion
26289
- //#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
26290
26553
  const DEFAULT_FLUSH_INTERVAL_MS = 1e4;
26291
26554
  const DEFAULT_MAX_SERIES_PER_FLUSH = 1e3;
26292
26555
  function resolveMetricsConfig(config) {
@@ -26302,7 +26565,7 @@ function resolveMetricsConfig(config) {
26302
26565
  };
26303
26566
  }
26304
26567
  //#endregion
26305
- //#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
26306
26569
  const OTLP_TEMPORALITY_DELTA = 1;
26307
26570
  var PostHogMetrics = class {
26308
26571
  constructor(_instance, _config, _logger) {
@@ -26588,7 +26851,7 @@ var PostHogMetrics = class {
26588
26851
  }
26589
26852
  };
26590
26853
  //#endregion
26591
- //#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
26592
26855
  var SimpleEventEmitter = class {
26593
26856
  constructor() {
26594
26857
  this.events = {};
@@ -26607,7 +26870,7 @@ var SimpleEventEmitter = class {
26607
26870
  }
26608
26871
  };
26609
26872
  //#endregion
26610
- //#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
26611
26874
  let parsedStackResults;
26612
26875
  let lastKeysCount;
26613
26876
  let cachedFilenameChunkIds;
@@ -26638,7 +26901,7 @@ function getFilenameToChunkIdMap(stackParser) {
26638
26901
  return cachedFilenameChunkIds;
26639
26902
  }
26640
26903
  //#endregion
26641
- //#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
26642
26905
  const MAX_CAUSE_RECURSION = 4;
26643
26906
  var ErrorPropertiesBuilder = class {
26644
26907
  constructor(coercers, stackParser, modifiers = []) {
@@ -26753,14 +27016,14 @@ function createFrame(platform, filename, func, lineno, colno) {
26753
27016
  return frame;
26754
27017
  }
26755
27018
  //#endregion
26756
- //#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
26757
27020
  const extractSafariExtensionDetails = (func, filename) => {
26758
27021
  const isSafariExtension = -1 !== func.indexOf("safari-extension");
26759
27022
  const isSafariWebExtension = -1 !== func.indexOf("safari-web-extension");
26760
27023
  return isSafariExtension || isSafariWebExtension ? [-1 !== func.indexOf("@") ? func.split("@")[0] : "?", isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`] : [func, filename];
26761
27024
  };
26762
27025
  //#endregion
26763
- //#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
26764
27027
  const chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
26765
27028
  const chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
26766
27029
  const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
@@ -26785,7 +27048,7 @@ const chromeStackLineParser = (line, platform) => {
26785
27048
  }
26786
27049
  };
26787
27050
  //#endregion
26788
- //#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
26789
27052
  const geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
26790
27053
  const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
26791
27054
  const geckoStackLineParser = (line, platform) => {
@@ -26807,9 +27070,12 @@ const geckoStackLineParser = (line, platform) => {
26807
27070
  }
26808
27071
  };
26809
27072
  //#endregion
26810
- //#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
26811
27074
  const FILENAME_MATCH = /^\s*[-]{4,}$/;
26812
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";
26813
27079
  const nodeStackLineParser = (line, platform) => {
26814
27080
  const lineMatch = line.match(FULL_MATCH);
26815
27081
  if (lineMatch) {
@@ -26849,6 +27115,7 @@ const nodeStackLineParser = (line, platform) => {
26849
27115
  const isNative = "native" === lineMatch[5];
26850
27116
  if (filename?.match(/\/[A-Z]:/)) filename = filename.slice(1);
26851
27117
  if (!filename && lineMatch[5] && !isNative) filename = lineMatch[5];
27118
+ if (PROMISE_COMBINATOR.test(functionName) && PROMISE_INDEX.test(filename || "")) filename = PROMISE_FRAME_FILENAME;
26852
27119
  return {
26853
27120
  filename: filename ? decodeURI(filename) : void 0,
26854
27121
  module: void 0,
@@ -26871,7 +27138,7 @@ function _parseIntOrUndefined(input) {
26871
27138
  return parseInt(input || "", 10) || void 0;
26872
27139
  }
26873
27140
  //#endregion
26874
- //#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
26875
27142
  const WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
26876
27143
  const STACKTRACE_FRAME_LIMIT = 50;
26877
27144
  function reverseAndStripFrames(stack) {
@@ -26913,10 +27180,10 @@ function createStackParser(platform, ...parsers) {
26913
27180
  };
26914
27181
  }
26915
27182
  //#endregion
26916
- //#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
26917
27184
  var ErrorCoercer = class {
26918
27185
  match(err) {
26919
- return isPlainError(err);
27186
+ return isError$1(err);
26920
27187
  }
26921
27188
  coerce(err, ctx) {
26922
27189
  return {
@@ -26940,7 +27207,7 @@ var ErrorCoercer = class {
26940
27207
  }
26941
27208
  };
26942
27209
  //#endregion
26943
- //#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
26944
27211
  const ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
26945
27212
  var StringCoercer = class {
26946
27213
  match(input) {
@@ -26967,7 +27234,7 @@ var StringCoercer = class {
26967
27234
  }
26968
27235
  };
26969
27236
  //#endregion
26970
- //#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
26971
27238
  const severityLevels = [
26972
27239
  "fatal",
26973
27240
  "error",
@@ -26977,7 +27244,7 @@ const severityLevels = [
26977
27244
  "debug"
26978
27245
  ];
26979
27246
  //#endregion
26980
- //#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
26981
27248
  function extractExceptionKeysForMessage(err, maxLength = 40) {
26982
27249
  const keys = Object.keys(err);
26983
27250
  keys.sort();
@@ -26992,7 +27259,7 @@ function extractExceptionKeysForMessage(err, maxLength = 40) {
26992
27259
  return "";
26993
27260
  }
26994
27261
  //#endregion
26995
- //#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
26996
27263
  var ObjectCoercer = class {
26997
27264
  match(candidate) {
26998
27265
  return "object" == typeof candidate && null !== candidate;
@@ -27003,7 +27270,7 @@ var ObjectCoercer = class {
27003
27270
  return {
27004
27271
  type: this.getType(candidate),
27005
27272
  value: this.getValue(candidate),
27006
- stack: ctx.syntheticException?.stack,
27273
+ stack: this.getStack(candidate) ?? ctx.syntheticException?.stack,
27007
27274
  level: this.isSeverityLevel(candidate.level) ? candidate.level : "error",
27008
27275
  synthetic: true
27009
27276
  };
@@ -27025,6 +27292,14 @@ var ObjectCoercer = class {
27025
27292
  isSeverityLevel(x) {
27026
27293
  return isString$1(x) && !isEmptyString(x) && severityLevels.indexOf(x) >= 0;
27027
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
+ }
27028
27303
  getErrorPropertyFromObject(obj) {
27029
27304
  for (const prop in obj) if (Object.prototype.hasOwnProperty.call(obj, prop)) {
27030
27305
  const value = obj[prop];
@@ -27041,7 +27316,7 @@ var ObjectCoercer = class {
27041
27316
  }
27042
27317
  };
27043
27318
  //#endregion
27044
- //#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
27045
27320
  var EventCoercer = class {
27046
27321
  match(err) {
27047
27322
  return isEvent(err);
@@ -27057,7 +27332,7 @@ var EventCoercer = class {
27057
27332
  }
27058
27333
  };
27059
27334
  //#endregion
27060
- //#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
27061
27336
  var PrimitiveCoercer = class {
27062
27337
  match(candidate) {
27063
27338
  return isPrimitive(candidate);
@@ -27072,7 +27347,7 @@ var PrimitiveCoercer = class {
27072
27347
  }
27073
27348
  };
27074
27349
  //#endregion
27075
- //#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
27076
27351
  var ReduceableCache = class {
27077
27352
  constructor(_maxSize) {
27078
27353
  this._maxSize = _maxSize;
@@ -27096,14 +27371,20 @@ var ReduceableCache = class {
27096
27371
  }
27097
27372
  };
27098
27373
  //#endregion
27099
- //#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
27100
27375
  const EXCEPTION_STEP_INTERNAL_FIELDS = {
27101
27376
  MESSAGE: "$message",
27102
27377
  TIMESTAMP: "$timestamp"
27103
27378
  };
27104
27379
  EXCEPTION_STEP_INTERNAL_FIELDS.MESSAGE, EXCEPTION_STEP_INTERNAL_FIELDS.TIMESTAMP;
27105
27380
  //#endregion
27106
- //#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
27107
27388
  var PostHogFetchHttpError = class extends Error {
27108
27389
  constructor(response, reqByteLength) {
27109
27390
  super("HTTP error while fetching PostHog: status=" + response.status + ", reqByteLength=" + reqByteLength), this.response = response, this.reqByteLength = reqByteLength, this.name = "PostHogFetchHttpError";
@@ -27261,17 +27542,21 @@ var PostHogCoreStateless = class {
27261
27542
  }
27262
27543
  buildPayload(payload) {
27263
27544
  const userProperties = payload.properties || {};
27264
- const properties = {
27545
+ let properties = {
27265
27546
  ...userProperties,
27266
27547
  ...this.getCommonEventProperties()
27267
27548
  };
27268
27549
  applyCallerFeatureFlagOverrides(properties, userProperties);
27550
+ if ("$feature_flag_called" === payload.event && false === properties.$feature_flag_has_experiment && this.isMinimalFlagCalledEventsEnabled()) properties = minimizeFlagCalledEventProperties(properties);
27269
27551
  return {
27270
27552
  distinct_id: payload.distinct_id,
27271
27553
  event: payload.event,
27272
27554
  properties
27273
27555
  };
27274
27556
  }
27557
+ isMinimalFlagCalledEventsEnabled() {
27558
+ return false;
27559
+ }
27275
27560
  addPendingPromise(promise) {
27276
27561
  return this.promiseQueue.add(promise);
27277
27562
  }
@@ -27743,7 +28028,15 @@ var PostHogCoreStateless = class {
27743
28028
  const batchItems = queue.slice(0, this.maxBatchSize);
27744
28029
  const batchMessages = batchItems.map((item) => void 0 === item.message ? item.message : this.normalizeMessage(item.message));
27745
28030
  const persistQueueChange = async () => {
27746
- 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
+ });
27747
28040
  this.setPersistedProperty(queueKey, newQueue);
27748
28041
  queue = newQueue;
27749
28042
  this._dequeuedMessagesCount += batchItems.length;
@@ -27893,18 +28186,11 @@ var PostHogCoreStateless = class {
27893
28186
  await logFlushError(e);
27894
28187
  }
27895
28188
  };
27896
- let timeoutHandle;
27897
- try {
27898
- return await Promise.race([new Promise((_, reject) => {
27899
- timeoutHandle = safeSetTimeout(() => {
27900
- this._logger.error("Timed out while shutting down PostHog");
27901
- hasTimedOut = true;
27902
- reject("Timeout while shutting down PostHog. Some events may not have been sent.");
27903
- }, shutdownTimeoutMs);
27904
- }), doShutdown()]);
27905
- } finally {
27906
- clearTimeout(timeoutHandle);
27907
- }
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
+ });
27908
28194
  }
27909
28195
  async shutdown(shutdownTimeoutMs = 3e4) {
27910
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");
@@ -27915,16 +28201,22 @@ var PostHogCoreStateless = class {
27915
28201
  }
27916
28202
  };
27917
28203
  //#endregion
27918
- //#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
27919
28205
  const LRU_FILE_CONTENTS_CACHE = new ReduceableCache(25);
27920
28206
  const LRU_FILE_CONTENTS_FS_READ_FAILED = new ReduceableCache(20);
27921
28207
  const DEFAULT_LINES_OF_CONTEXT = 7;
27922
- async function addSourceContext(frames) {
28208
+ const MAX_CONTEXTLINES_FILE_SIZE = 10485760;
28209
+ async function addSourceContext(frames, openSourceFile = open, logger) {
27923
28210
  const filesToLines = {};
28211
+ let basePath;
28212
+ try {
28213
+ basePath = process.cwd();
28214
+ } catch {}
27924
28215
  for (let i = frames.length - 1; i >= 0; i--) {
27925
28216
  const frame = frames[i];
27926
28217
  const filename = frame?.filename;
27927
28218
  if (!frame || "string" != typeof filename || "number" != typeof frame.lineno || shouldSkipContextLinesForFile(filename) || shouldSkipContextLinesForFrame(frame)) continue;
28219
+ if (!isAbsolute(filename) && void 0 === basePath) continue;
27928
28220
  if (!filesToLines[filename]) filesToLines[filename] = [];
27929
28221
  filesToLines[filename].push(frame.lineno);
27930
28222
  }
@@ -27932,43 +28224,85 @@ async function addSourceContext(frames) {
27932
28224
  if (0 == files.length) return frames;
27933
28225
  const readlinePromises = [];
27934
28226
  for (const file of files) {
27935
- 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;
27936
28230
  const filesToLineRanges = filesToLines[file];
27937
28231
  if (!filesToLineRanges) continue;
27938
28232
  filesToLineRanges.sort((a, b) => a - b);
27939
28233
  const ranges = makeLineReaderRanges(filesToLineRanges);
27940
- if (ranges.every((r) => rangeExistsInContentCache(file, r))) continue;
27941
- const cache = emplace(LRU_FILE_CONTENTS_CACHE, file, {});
27942
- 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));
27943
28237
  }
27944
28238
  await Promise.all(readlinePromises).catch(() => {});
27945
- if (frames && frames.length > 0) addSourceContextToFrames(frames, LRU_FILE_CONTENTS_CACHE);
28239
+ if (frames && frames.length > 0) addSourceContextToFrames(frames, LRU_FILE_CONTENTS_CACHE, basePath);
27946
28240
  LRU_FILE_CONTENTS_CACHE.reduce();
27947
28241
  return frames;
27948
28242
  }
27949
- 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;
27950
28263
  return new Promise((resolve) => {
27951
- const stream = createReadStream(path);
27952
- const lineReaded = createInterface({ input: stream });
27953
- function destroyStreamAndResolve() {
27954
- stream.destroy();
27955
- 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;
27956
28290
  }
27957
28291
  let lineNumber = 0;
27958
28292
  let currentRangeIndex = 0;
27959
28293
  const range = ranges[currentRangeIndex];
27960
- if (void 0 === range) return void destroyStreamAndResolve();
28294
+ if (void 0 === range) return void destroyStreamAndResolve(stream);
27961
28295
  let rangeStart = range[0];
27962
28296
  let rangeEnd = range[1];
27963
28297
  function onStreamError() {
27964
- LRU_FILE_CONTENTS_FS_READ_FAILED.set(path, 1);
28298
+ LRU_FILE_CONTENTS_FS_READ_FAILED.set(cacheKey, 1);
27965
28299
  lineReaded.close();
27966
28300
  lineReaded.removeAllListeners();
27967
- destroyStreamAndResolve();
28301
+ destroyStreamAndResolve(stream);
27968
28302
  }
27969
28303
  stream.on("error", onStreamError);
27970
28304
  lineReaded.on("error", onStreamError);
27971
- lineReaded.on("close", destroyStreamAndResolve);
28305
+ lineReaded.on("close", () => destroyStreamAndResolve(stream));
27972
28306
  lineReaded.on("line", (line) => {
27973
28307
  lineNumber++;
27974
28308
  if (lineNumber < rangeStart) return;
@@ -27992,9 +28326,10 @@ function getContextLinesFromFile(path, ranges, output) {
27992
28326
  });
27993
28327
  });
27994
28328
  }
27995
- function addSourceContextToFrames(frames, cache) {
28329
+ function addSourceContextToFrames(frames, cache, basePath) {
27996
28330
  for (const frame of frames) if (frame.filename && void 0 === frame.context_line && "number" == typeof frame.lineno) {
27997
- const contents = cache.get(frame.filename);
28331
+ const cacheKey = makeSourceCacheKey(frame.filename, basePath);
28332
+ const contents = void 0 === cacheKey ? void 0 : cache.get(cacheKey);
27998
28333
  if (void 0 === contents) continue;
27999
28334
  addContextToFrame(frame.lineno, frame, contents);
28000
28335
  }
@@ -28030,8 +28365,12 @@ function shouldSkipContextLinesForFrame(frame) {
28030
28365
  if (void 0 !== frame.colno && frame.colno > 1e3) return true;
28031
28366
  return false;
28032
28367
  }
28033
- function rangeExistsInContentCache(file, range) {
28034
- 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);
28035
28374
  if (void 0 === contents) return false;
28036
28375
  for (let i = range[0]; i <= range[1]; i++) if (void 0 === contents[i]) return false;
28037
28376
  return true;
@@ -28092,23 +28431,23 @@ function snipLine(line, colno) {
28092
28431
  return newLine;
28093
28432
  }
28094
28433
  //#endregion
28095
- //#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
28096
28435
  function createRelativePathModifier(basePath = process.cwd()) {
28097
28436
  const isWindows = "\\" === sep;
28098
28437
  const toUnix = (p) => isWindows ? p.replace(/\\/g, "/") : p;
28099
28438
  const normalizedBase = toUnix(basePath);
28100
28439
  return async (frames) => {
28101
28440
  for (const frame of frames) if (!(!frame.filename || frame.filename.startsWith("node:") || frame.filename.startsWith("data:"))) {
28102
- 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)));
28103
28442
  }
28104
28443
  return frames;
28105
28444
  };
28106
28445
  }
28107
28446
  //#endregion
28108
- //#region ../../node_modules/.bun/posthog-node@5.45.2+63120419cc93e79b/node_modules/posthog-node/dist/version.mjs
28109
- 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";
28110
28449
  //#endregion
28111
- //#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
28112
28451
  const FeatureFlagError = {
28113
28452
  ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
28114
28453
  FLAG_MISSING: "flag_missing",
@@ -28116,7 +28455,7 @@ const FeatureFlagError = {
28116
28455
  UNKNOWN_ERROR: "unknown_error"
28117
28456
  };
28118
28457
  //#endregion
28119
- //#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
28120
28459
  var FeatureFlagEvaluations = class FeatureFlagEvaluations {
28121
28460
  constructor(init) {
28122
28461
  this._host = init.host;
@@ -28234,7 +28573,7 @@ var FeatureFlagEvaluations = class FeatureFlagEvaluations {
28234
28573
  }
28235
28574
  };
28236
28575
  //#endregion
28237
- //#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
28238
28577
  async function hashSHA1(text) {
28239
28578
  const subtle = globalThis.crypto?.subtle;
28240
28579
  if (!subtle) throw new Error("SubtleCrypto API not available");
@@ -28242,7 +28581,7 @@ async function hashSHA1(text) {
28242
28581
  return Array.from(new Uint8Array(hashBuffer)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
28243
28582
  }
28244
28583
  //#endregion
28245
- //#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
28246
28585
  const SIXTY_SECONDS = 6e4;
28247
28586
  const LONG_SCALE = 0x1000000000000000;
28248
28587
  const NULL_VALUES_ALLOWED_OPERATORS = ["is_not", "is_set"];
@@ -28277,6 +28616,7 @@ var FeatureFlagsPoller = class {
28277
28616
  this.debugMode = false;
28278
28617
  this.shouldBeginExponentialBackoff = false;
28279
28618
  this.backOffCount = 0;
28619
+ this.pollerStopped = false;
28280
28620
  this.pollingInterval = pollingInterval;
28281
28621
  this.personalApiKey = personalApiKey;
28282
28622
  this.featureFlags = [];
@@ -28292,6 +28632,7 @@ var FeatureFlagsPoller = class {
28292
28632
  this.onError = options.onError;
28293
28633
  this.customHeaders = customHeaders;
28294
28634
  this.onLoad = options.onLoad;
28635
+ this.onMinimalFlagCalledEvents = options.onMinimalFlagCalledEvents;
28295
28636
  this.cacheProvider = options.cacheProvider;
28296
28637
  this.strictLocalEvaluation = options.strictLocalEvaluation ?? false;
28297
28638
  this.loadFeatureFlags();
@@ -28542,6 +28883,7 @@ var FeatureFlagsPoller = class {
28542
28883
  this.groupTypeMapping = flagData.groupTypeMapping;
28543
28884
  this.cohorts = flagData.cohorts;
28544
28885
  this.loadedSuccessfullyOnce = true;
28886
+ this.onMinimalFlagCalledEvents?.(true === flagData.minimalFlagCalledEvents);
28545
28887
  }
28546
28888
  warnAboutExperienceContinuityFlags(flags) {
28547
28889
  if (this.strictLocalEvaluation) return;
@@ -28598,7 +28940,6 @@ var FeatureFlagsPoller = class {
28598
28940
  clearTimeout(this.poller);
28599
28941
  this.poller = void 0;
28600
28942
  }
28601
- this.poller = setTimeout(() => this.loadFeatureFlags(true), this.getPollingInterval());
28602
28943
  try {
28603
28944
  let shouldFetch = true;
28604
28945
  if (this.cacheProvider) try {
@@ -28628,6 +28969,7 @@ var FeatureFlagsPoller = class {
28628
28969
  this.featureFlagsByKey = {};
28629
28970
  this.groupTypeMapping = {};
28630
28971
  this.cohorts = {};
28972
+ this.onMinimalFlagCalledEvents?.(false);
28631
28973
  return;
28632
28974
  case 403:
28633
28975
  this.beginBackoff();
@@ -28642,7 +28984,8 @@ var FeatureFlagsPoller = class {
28642
28984
  const flagData = {
28643
28985
  flags: responseJson.flags ?? [],
28644
28986
  groupTypeMapping: responseJson.group_type_mapping || {},
28645
- cohorts: responseJson.cohorts || {}
28987
+ cohorts: responseJson.cohorts || {},
28988
+ minimalFlagCalledEvents: true === responseJson.minimal_flag_called_events
28646
28989
  };
28647
28990
  this.updateFlagState(flagData);
28648
28991
  this.flagDefinitionsLoadedAt = Date.now();
@@ -28660,6 +29003,8 @@ var FeatureFlagsPoller = class {
28660
29003
  }
28661
29004
  } catch (err) {
28662
29005
  if (err instanceof ClientError) this.onError?.(err);
29006
+ } finally {
29007
+ if (!this.pollerStopped) this.poller = setTimeout(() => this.loadFeatureFlags(true), this.getPollingInterval());
28663
29008
  }
28664
29009
  }
28665
29010
  getPersonalApiKeyRequestOptions(method = "GET", etag) {
@@ -28674,7 +29019,7 @@ var FeatureFlagsPoller = class {
28674
29019
  headers
28675
29020
  };
28676
29021
  }
28677
- _requestFeatureFlagDefinitions() {
29022
+ async _requestFeatureFlagDefinitions() {
28678
29023
  const url = `${this.host}/flags/definitions?token=${this.projectApiKey}&send_cohorts`;
28679
29024
  const options = this.getPersonalApiKeyRequestOptions("GET", this.flagsEtag);
28680
29025
  let abortTimeout = null;
@@ -28685,18 +29030,47 @@ var FeatureFlagsPoller = class {
28685
29030
  }, this.timeout);
28686
29031
  options.signal = controller.signal;
28687
29032
  }
29033
+ const clearAbortTimeout = () => clearTimeout(abortTimeout);
28688
29034
  try {
28689
29035
  const fetch1 = this.fetch;
28690
- return fetch1(url, options);
28691
- } finally {
28692
- 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;
28693
29063
  }
28694
29064
  }
28695
29065
  async stopPoller(timeoutMs = 3e4) {
29066
+ this.pollerStopped = true;
28696
29067
  clearTimeout(this.poller);
29068
+ this.poller = void 0;
28697
29069
  if (this.cacheProvider) try {
28698
29070
  const shutdownResult = this.cacheProvider.shutdown();
28699
- 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
+ });
28700
29074
  } catch (err) {
28701
29075
  this.onError?.(/* @__PURE__ */ new Error(`Error during cache shutdown: ${err}`));
28702
29076
  }
@@ -28988,34 +29362,86 @@ function relativeDateParseForFeatureFlagMatching(value) {
28988
29362
  }
28989
29363
  }
28990
29364
  //#endregion
28991
- //#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
+ }
28992
29414
  function makeUncaughtExceptionHandler(captureFn, onFatalFn) {
28993
29415
  let calledFatalError = false;
28994
- return Object.assign((error) => {
28995
- const processWouldExit = 0 === global.process.listeners("uncaughtException").filter((listener) => "domainUncaughtExceptionClear" !== listener.name && true !== listener._posthogErrorHandler).length;
28996
- captureFn(error, { mechanism: {
28997
- type: "onuncaughtexception",
28998
- handled: false
28999
- } });
29000
- 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) {
29001
29420
  calledFatalError = true;
29002
29421
  onFatalFn(error);
29003
29422
  }
29004
29423
  }, { _posthogErrorHandler: true });
29005
29424
  }
29006
- function addUncaughtExceptionListener(captureFn, onFatalFn) {
29007
- 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));
29008
29430
  }
29009
- function addUnhandledRejectionListener(captureFn) {
29010
- globalThis.process?.on("unhandledRejection", (reason) => captureFn(reason, { mechanism: {
29011
- type: "onunhandledrejection",
29012
- handled: false
29013
- } }));
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
+ });
29014
29440
  }
29015
29441
  //#endregion
29016
- //#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
29017
29443
  const SHUTDOWN_TIMEOUT = 2e3;
29018
- var ErrorTracking = class ErrorTracking {
29444
+ var error_tracking_ErrorTracking = class error_tracking_ErrorTracking {
29019
29445
  constructor(client, options, _logger) {
29020
29446
  this.client = client;
29021
29447
  this._exceptionAutocaptureEnabled = options.enableExceptionAutocapture || false;
@@ -29034,6 +29460,8 @@ var ErrorTracking = class ErrorTracking {
29034
29460
  const properties = { ...additionalProperties };
29035
29461
  const exceptionProperties = builder.buildFromUnknown(error, hint);
29036
29462
  exceptionProperties.$exception_list = await builder.modifyFrames(exceptionProperties.$exception_list);
29463
+ const injectedReleaseId = getInjectedReleaseId();
29464
+ if (injectedReleaseId) properties.$release_id = injectedReleaseId;
29037
29465
  return {
29038
29466
  event: "$exception",
29039
29467
  distinctId,
@@ -29052,8 +29480,8 @@ var ErrorTracking = class ErrorTracking {
29052
29480
  }
29053
29481
  onException(exception, hint) {
29054
29482
  this.client.addPendingPromise((async () => {
29055
- if (!ErrorTracking.isPreviouslyCapturedError(exception)) {
29056
- 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);
29057
29485
  const exceptionType = eventMessage.properties?.$exception_list[0]?.type ?? "Exception";
29058
29486
  if (this._rateLimiter.consumeRateLimit(exceptionType)) return void this._logger.info("Skipping exception capture because of client rate limiting.", { exception: exceptionType });
29059
29487
  return this.client._capturePreparedEvent(eventMessage, false);
@@ -29073,7 +29501,7 @@ var ErrorTracking = class ErrorTracking {
29073
29501
  }
29074
29502
  };
29075
29503
  //#endregion
29076
- //#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
29077
29505
  var PostHogMemoryStorage = class {
29078
29506
  getProperty(key) {
29079
29507
  return this._memoryStorage[key];
@@ -29086,7 +29514,7 @@ var PostHogMemoryStorage = class {
29086
29514
  }
29087
29515
  };
29088
29516
  //#endregion
29089
- //#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
29090
29518
  function isCaptureMode(value) {
29091
29519
  return "v0" === value || "v1" === value;
29092
29520
  }
@@ -29095,14 +29523,14 @@ function resolveCaptureMode() {
29095
29523
  return isCaptureMode(envMode) ? envMode : "v0";
29096
29524
  }
29097
29525
  //#endregion
29098
- //#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
29099
29527
  const AI_EVENT_PREFIX = "$ai_";
29100
29528
  const ANALYTICS_ROUTE = "analytics";
29101
29529
  function isLegacyOnlyEvent(message) {
29102
29530
  return "string" == typeof message.event && message.event.startsWith(AI_EVENT_PREFIX);
29103
29531
  }
29104
29532
  //#endregion
29105
- //#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
29106
29534
  var CaptureV1Error = class CaptureV1Error extends Error {
29107
29535
  constructor({ requestId, drops, retryExhausted, cause }) {
29108
29536
  super(CaptureV1Error.buildMessage(requestId, drops, retryExhausted, cause)), this.name = "CaptureV1Error";
@@ -29118,7 +29546,7 @@ var CaptureV1Error = class CaptureV1Error extends Error {
29118
29546
  }
29119
29547
  };
29120
29548
  //#endregion
29121
- //#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
29122
29550
  function coerceBool(value) {
29123
29551
  if ("boolean" == typeof value) return value;
29124
29552
  if ("number" == typeof value) return 0 !== value;
@@ -29212,7 +29640,7 @@ function buildV1Batch(messages, { createdAt, historicalMigration }) {
29212
29640
  return batch;
29213
29641
  }
29214
29642
  //#endregion
29215
- //#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
29216
29644
  const V1_ANALYTICS_PATH = "/i/v1/analytics/events";
29217
29645
  const DEFAULT_MAX_BACKOFF_MS = 3e4;
29218
29646
  const RETRYABLE_STATUSES = /* @__PURE__ */ new Set([
@@ -29394,7 +29822,7 @@ var V1CaptureSender = class {
29394
29822
  }
29395
29823
  };
29396
29824
  //#endregion
29397
- //#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
29398
29826
  const MINIMUM_POLLING_INTERVAL = 100;
29399
29827
  const THIRTY_SECONDS = 3e4;
29400
29828
  const MAX_CACHE_SIZE = 5e4;
@@ -29437,7 +29865,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
29437
29865
  host: normalizeHost(options.host),
29438
29866
  personalApiKey: normalizePersonalApiKey(options.secretKey ?? options.personalApiKey)
29439
29867
  };
29440
- super(normalizedApiKey, normalizedOptions), this._memoryStorage = new PostHogMemoryStorage();
29868
+ super(normalizedApiKey, normalizedOptions), this._memoryStorage = new PostHogMemoryStorage(), this._minimalFlagCalledEvents = false;
29441
29869
  this.options = normalizedOptions;
29442
29870
  this.captureMode = resolveCaptureMode();
29443
29871
  this.context = this.initializeContext();
@@ -29459,12 +29887,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
29459
29887
  onLoad: (count) => {
29460
29888
  this._events.emit("localEvaluationFlagsLoaded", count);
29461
29889
  },
29890
+ onMinimalFlagCalledEvents: (enabled) => {
29891
+ this._minimalFlagCalledEvents = enabled;
29892
+ },
29462
29893
  customHeaders: this.getCustomHeaders(),
29463
29894
  cacheProvider: normalizedOptions.flagDefinitionCacheProvider,
29464
29895
  strictLocalEvaluation: normalizedOptions.strictLocalEvaluation
29465
29896
  });
29466
29897
  }
29467
- this.errorTracking = new ErrorTracking(this, normalizedOptions, this._logger);
29898
+ this.errorTracking = new error_tracking_ErrorTracking(this, normalizedOptions, this._logger);
29468
29899
  this.distinctIdHasSentFlagCalls = {};
29469
29900
  this.maxCacheSize = normalizedOptions.maxCacheSize || MAX_CACHE_SIZE;
29470
29901
  }
@@ -29781,6 +30212,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
29781
30212
  const flagsResponse = await super.getFeatureFlagDetailsStateless(evaluationContext.distinctId, evaluationContext.groups, personProperties, groupProperties, disableGeoip, [key]);
29782
30213
  if (void 0 === flagsResponse) featureFlagError = FeatureFlagError.UNKNOWN_ERROR;
29783
30214
  else {
30215
+ this._minimalFlagCalledEvents = true === flagsResponse.minimalFlagCalledEvents;
29784
30216
  requestId = flagsResponse.requestId;
29785
30217
  evaluatedAt = flagsResponse.evaluatedAt;
29786
30218
  const errors = [];
@@ -30006,6 +30438,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30006
30438
  if ((localResult ? localResult.fallbackToFlags : true) && !onlyEvaluateLocally) {
30007
30439
  const details = await super.getFeatureFlagDetailsStateless(evaluationContext.distinctId, evaluationContext.groups, personProperties, groupProperties, disableGeoip, flagKeys);
30008
30440
  if (details) {
30441
+ this._minimalFlagCalledEvents = true === details.minimalFlagCalledEvents;
30009
30442
  requestId = details.requestId;
30010
30443
  evaluatedAt = details.evaluatedAt;
30011
30444
  errorsWhileComputing = Boolean(details.errorsWhileComputingFlags);
@@ -30070,6 +30503,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30070
30503
  quotaLimited
30071
30504
  });
30072
30505
  }
30506
+ _shouldSendMinimalFlagCalledEvent(event, properties) {
30507
+ return "$feature_flag_called" === event && this._minimalFlagCalledEvents && false === properties.$feature_flag_has_experiment;
30508
+ }
30073
30509
  _captureFlagCalledEventIfNeeded(params) {
30074
30510
  const { distinctId, key, response, groups, disableGeoip, properties } = params;
30075
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))}` : ""}`;
@@ -30175,7 +30611,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30175
30611
  await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
30176
30612
  this.errorTracking.shutdown();
30177
30613
  if (this._metrics) {
30178
- 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()));
30179
30615
  this._metrics.reset();
30180
30616
  }
30181
30617
  try {
@@ -30290,9 +30726,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30290
30726
  };
30291
30727
  }
30292
30728
  captureException(error, distinctId, additionalProperties, uuid, flags) {
30293
- if (!ErrorTracking.isPreviouslyCapturedError(error)) {
30729
+ if (!error_tracking_ErrorTracking.isPreviouslyCapturedError(error)) {
30294
30730
  const syntheticException = /* @__PURE__ */ new Error("PostHog syntheticException");
30295
- 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({
30296
30732
  ...msg,
30297
30733
  uuid,
30298
30734
  flags
@@ -30300,9 +30736,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30300
30736
  }
30301
30737
  }
30302
30738
  async captureExceptionImmediate(error, distinctId, additionalProperties, flags) {
30303
- if (!ErrorTracking.isPreviouslyCapturedError(error)) {
30739
+ if (!error_tracking_ErrorTracking.isPreviouslyCapturedError(error)) {
30304
30740
  const syntheticException = /* @__PURE__ */ new Error("PostHog syntheticException");
30305
- 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({
30306
30742
  ...msg,
30307
30743
  flags
30308
30744
  })));
@@ -30326,10 +30762,11 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30326
30762
  mergedProperties.$process_person_profile = false;
30327
30763
  }
30328
30764
  if (includeContextProperties && contextData?.sessionId && !mergedProperties.$session_id) mergedProperties.$session_id = contextData.sessionId;
30765
+ const finalProperties = this._shouldSendMinimalFlagCalledEvent(event, mergedProperties) ? minimizeFlagCalledEventProperties(mergedProperties) : mergedProperties;
30329
30766
  const eventMessage = this._runBeforeSend({
30330
30767
  distinctId: mergedDistinctId,
30331
30768
  event,
30332
- properties: mergedProperties,
30769
+ properties: finalProperties,
30333
30770
  groups,
30334
30771
  flags,
30335
30772
  sendFeatureFlags,
@@ -30394,7 +30831,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
30394
30831
  }
30395
30832
  };
30396
30833
  //#endregion
30397
- //#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
30398
30835
  var PostHogContext = class {
30399
30836
  constructor() {
30400
30837
  this.storage = new AsyncLocalStorage();
@@ -30422,7 +30859,7 @@ var PostHogContext = class {
30422
30859
  }
30423
30860
  };
30424
30861
  //#endregion
30425
- //#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
30426
30863
  const NAME = "posthog-node";
30427
30864
  function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = ["error"], sendExceptionsToPostHog = true } = {}) {
30428
30865
  return (event) => {
@@ -30456,6 +30893,8 @@ function createEventProcessor(_posthog, { organization, projectId, prefix, sever
30456
30893
  $sentry_exception_type: exceptions[0]?.type,
30457
30894
  $sentry_tags: event.tags
30458
30895
  };
30896
+ const injectedReleaseId = getInjectedReleaseId();
30897
+ if (injectedReleaseId) properties.$release_id = injectedReleaseId;
30459
30898
  if (organization && projectId) properties["$sentry_url"] = (prefix || "https://sentry.io/organizations/") + organization + "/issues/?project=" + projectId + "&query=" + event.event_id;
30460
30899
  if (sendExceptionsToPostHog) _posthog.capture({
30461
30900
  event: "$exception",
@@ -30483,7 +30922,7 @@ var PostHogSentryIntegration = class {
30483
30922
  }
30484
30923
  };
30485
30924
  //#endregion
30486
- //#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
30487
30926
  var PostHog = class extends PostHogBackendClient {
30488
30927
  getLibraryId() {
30489
30928
  return "posthog-node";
@@ -30500,7 +30939,7 @@ var PostHog = class extends PostHogBackendClient {
30500
30939
  new PrimitiveCoercer()
30501
30940
  ], createStackParser("node:javascript", nodeStackLineParser), [
30502
30941
  createModulerModifier(),
30503
- addSourceContext,
30942
+ (frames) => addSourceContext(frames, void 0, this._logger),
30504
30943
  createRelativePathModifier()
30505
30944
  ]);
30506
30945
  }
@@ -32321,7 +32760,6 @@ const accessPhase = async (ctx) => {
32321
32760
  data: { scopeAlias }
32322
32761
  };
32323
32762
  };
32324
- h("InvalidEmailHint")();
32325
32763
  const base64URLFromText = (value) => {
32326
32764
  const bytes = new TextEncoder().encode(value);
32327
32765
  let binary = "";
@@ -32481,7 +32919,7 @@ const resolvePhoneNumber = async (ctx) => {
32481
32919
  };
32482
32920
  //#endregion
32483
32921
  //#region src/lib/expected-errors.ts
32484
- var InvalidScope = class extends h("InvalidScope")() {
32922
+ var InvalidScope = class extends h("InvalidScope") {
32485
32923
  constructor(scope) {
32486
32924
  super({
32487
32925
  scope,
@@ -32489,7 +32927,7 @@ var InvalidScope = class extends h("InvalidScope")() {
32489
32927
  });
32490
32928
  }
32491
32929
  };
32492
- var AccountNotFound = class extends h("AccountNotFound")() {
32930
+ var AccountNotFound = class extends h("AccountNotFound") {
32493
32931
  constructor({ account, platform }) {
32494
32932
  super({
32495
32933
  account,
@@ -32498,7 +32936,7 @@ var AccountNotFound = class extends h("AccountNotFound")() {
32498
32936
  });
32499
32937
  }
32500
32938
  };
32501
- var NoConnectedAccount = class extends h("NoConnectedAccount")() {
32939
+ var NoConnectedAccount = class extends h("NoConnectedAccount") {
32502
32940
  constructor(platform) {
32503
32941
  super({
32504
32942
  platform,
@@ -32506,7 +32944,7 @@ var NoConnectedAccount = class extends h("NoConnectedAccount")() {
32506
32944
  });
32507
32945
  }
32508
32946
  };
32509
- var LookupPayloadInvalid = class extends h("LookupPayloadInvalid")() {
32947
+ var LookupPayloadInvalid = class extends h("LookupPayloadInvalid") {
32510
32948
  constructor({ input, platform }) {
32511
32949
  super({
32512
32950
  input,
@@ -32515,7 +32953,7 @@ var LookupPayloadInvalid = class extends h("LookupPayloadInvalid")() {
32515
32953
  });
32516
32954
  }
32517
32955
  };
32518
- var SchemaPathUnknown = class extends h("SchemaPathUnknown")() {
32956
+ var SchemaPathUnknown = class extends h("SchemaPathUnknown") {
32519
32957
  constructor({ message, path }) {
32520
32958
  super({
32521
32959
  message,
@@ -32523,7 +32961,7 @@ var SchemaPathUnknown = class extends h("SchemaPathUnknown")() {
32523
32961
  });
32524
32962
  }
32525
32963
  };
32526
- var SchemaContractInvalid = class extends h("SchemaContractInvalid")() {
32964
+ var SchemaContractInvalid = class extends h("SchemaContractInvalid") {
32527
32965
  constructor({ label, message }) {
32528
32966
  super({
32529
32967
  label,
@@ -32531,7 +32969,7 @@ var SchemaContractInvalid = class extends h("SchemaContractInvalid")() {
32531
32969
  });
32532
32970
  }
32533
32971
  };
32534
- var UsagePaginationLimit = class extends h("UsagePaginationLimit")() {
32972
+ var UsagePaginationLimit = class extends h("UsagePaginationLimit") {
32535
32973
  constructor(limit) {
32536
32974
  super({
32537
32975
  limit,
@@ -32539,7 +32977,7 @@ var UsagePaginationLimit = class extends h("UsagePaginationLimit")() {
32539
32977
  });
32540
32978
  }
32541
32979
  };
32542
- var LogoutRevocationFailed = class extends h("LogoutRevocationFailed")() {
32980
+ var LogoutRevocationFailed = class extends h("LogoutRevocationFailed") {
32543
32981
  constructor() {
32544
32982
  super({ message: "Could not revoke the server-side session; local credentials were cleared." });
32545
32983
  }
@@ -32548,16 +32986,16 @@ var LogoutRevocationFailed = class extends h("LogoutRevocationFailed")() {
32548
32986
  //#region src/login/phases/1.scope.ts
32549
32987
  const DEFAULT_SCOPE_ALIAS = "read,write";
32550
32988
  const parseScopeAliasResult = (value) => {
32551
- if (value === void 0 || value === null || value === "") return G.ok(DEFAULT_SCOPE_ALIAS);
32552
- 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)));
32553
32991
  const scope = value === "write" ? DEFAULT_SCOPE_ALIAS : value;
32554
32992
  const parsed = parseCLIScopeAlias(scope);
32555
- if (G.isError(parsed)) return G.err(new InvalidScope(scope));
32556
- return G.ok(parsed.value);
32993
+ if (ae.isError(parsed)) return ae.err(new InvalidScope(scope));
32994
+ return ae.ok(parsed.value);
32557
32995
  };
32558
32996
  const parseScopeAlias = (value) => {
32559
32997
  const parsed = parseScopeAliasResult(value);
32560
- if (G.isOk(parsed)) return parsed.value;
32998
+ if (ae.isOk(parsed)) return parsed.value;
32561
32999
  throw new Error(parsed.error.message);
32562
33000
  };
32563
33001
  //#endregion
@@ -32843,7 +33281,7 @@ const revokeServerSide = async (accessToken) => {
32843
33281
  return false;
32844
33282
  }
32845
33283
  };
32846
- const logoutRevocationResult = (revoked) => revoked ? G.ok(null) : G.err(new LogoutRevocationFailed());
33284
+ const logoutRevocationResult = (revoked) => revoked ? ae.ok(null) : ae.err(new LogoutRevocationFailed());
32847
33285
  const logoutCommand = defineCommand({
32848
33286
  meta: commandMeta({
32849
33287
  name: "logout",
@@ -32872,7 +33310,7 @@ const logoutCommand = defineCommand({
32872
33310
  const revoked = await revokeServerSide(credentials.accessToken);
32873
33311
  await clearCredentials();
32874
33312
  const revocation = logoutRevocationResult(revoked);
32875
- if (G.isError(revocation)) throw new Error(revocation.error.message);
33313
+ if (ae.isError(revocation)) throw new Error(revocation.error.message);
32876
33314
  analytics.capture("logout");
32877
33315
  analytics.reset();
32878
33316
  }
@@ -33011,7 +33449,7 @@ const fetchUsageLogs = async (client, input) => {
33011
33449
  let nextCursor = null;
33012
33450
  let pages = 0;
33013
33451
  do {
33014
- 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));
33015
33453
  const remaining = input.limit === void 0 ? USAGE_LOG_PAGE_LIMIT : input.limit - items.length;
33016
33454
  const usage = await client.usage.list({
33017
33455
  platform: input.platform,
@@ -33025,7 +33463,7 @@ const fetchUsageLogs = async (client, input) => {
33025
33463
  cursor = nextCursor ?? void 0;
33026
33464
  pages += 1;
33027
33465
  } while (nextCursor && (input.limit === void 0 || items.length < input.limit));
33028
- return G.ok({
33466
+ return ae.ok({
33029
33467
  items: input.limit === void 0 ? items : items.slice(0, input.limit),
33030
33468
  cursor: nextCursor
33031
33469
  });
@@ -33093,7 +33531,7 @@ const createUsageLogsCommand = (deps = {}) => defineCommand({
33093
33531
  from,
33094
33532
  to
33095
33533
  });
33096
- if (G.isError(usage)) throw new UsageError(usage.error.message);
33534
+ if (ae.isError(usage)) throw new UsageError(usage.error.message);
33097
33535
  await writeOutput$1(deps, {
33098
33536
  items: aggregateLogs(usage.value.items, sumBy),
33099
33537
  meta: {
@@ -33112,7 +33550,7 @@ const createUsageLogsCommand = (deps = {}) => defineCommand({
33112
33550
  from,
33113
33551
  to
33114
33552
  });
33115
- if (G.isError(usage)) throw new UsageError(usage.error.message);
33553
+ if (ae.isError(usage)) throw new UsageError(usage.error.message);
33116
33554
  await writeOutput$1(deps, {
33117
33555
  items: usage.value.items,
33118
33556
  meta: { cursor: usage.value.cursor }
@@ -33439,14 +33877,14 @@ const createAccountCommand = (deps, accountSetupCommand = setupCommand) => {
33439
33877
  if (isInteractiveConnect(deps)) {
33440
33878
  await runConnectOutput(deps, async (connectDeps) => {
33441
33879
  const result = await connectXAccount(connectDeps);
33442
- if (G.isError(result)) throwXLifecycleError(result.error);
33880
+ if (ae.isError(result)) throwXLifecycleError(result.error);
33443
33881
  return result.value;
33444
33882
  });
33445
33883
  return;
33446
33884
  }
33447
33885
  await runConnectStep(deps, "x", async () => {
33448
33886
  const result = await listXLifecycleAccounts(deps, true);
33449
- if (G.isError(result)) throwXLifecycleError(result.error);
33887
+ if (ae.isError(result)) throwXLifecycleError(result.error);
33450
33888
  return result.value;
33451
33889
  }, () => createXConnectURL(deps));
33452
33890
  })
@@ -33464,7 +33902,7 @@ const createAccountCommand = (deps, accountSetupCommand = setupCommand) => {
33464
33902
  x: createAccountPlatformCommand("x", "Reconnect an X account.", async (args) => {
33465
33903
  await runConnectOutput(deps, async (connectDeps) => {
33466
33904
  const result = await reconnectXAccount(connectDeps, { account: String(args.account) });
33467
- if (G.isError(result)) throwXLifecycleError(result.error);
33905
+ if (ae.isError(result)) throwXLifecycleError(result.error);
33468
33906
  return result.value;
33469
33907
  });
33470
33908
  }, { accountArg: xAccountArg })
@@ -33490,7 +33928,7 @@ const createAccountCommand = (deps, accountSetupCommand = setupCommand) => {
33490
33928
  }) }),
33491
33929
  x: createAccountPlatformCommand("x", "Disconnect an X account.", async (args) => {
33492
33930
  const result = await disconnectXAccount(deps, String(args.account));
33493
- if (G.isError(result)) throwXLifecycleError(result.error);
33931
+ if (ae.isError(result)) throwXLifecycleError(result.error);
33494
33932
  await writeOutput(deps, result.value);
33495
33933
  }, {
33496
33934
  accountArg: xAccountArg,
@@ -33715,12 +34153,12 @@ const selectAccountOutcome = ({ accounts, defaultAccount, explicitAccount }) =>
33715
34153
  };
33716
34154
  };
33717
34155
  const requireSelectedAccount = (outcome, platform) => {
33718
- if (outcome.status === "selected") return G.ok(outcome);
33719
- 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({
33720
34158
  account: outcome.account,
33721
34159
  platform
33722
34160
  }));
33723
- return G.err(new NoConnectedAccount(platform));
34161
+ return ae.err(new NoConnectedAccount(platform));
33724
34162
  };
33725
34163
  const isRecord$1 = (value) => Boolean(value && typeof value === "object" && !Array.isArray(value));
33726
34164
  const stringField = (value, key) => {
@@ -33733,35 +34171,35 @@ const stringOrNumberField = (value, key) => {
33733
34171
  return typeof field === "number" && Number.isFinite(field) ? String(field) : void 0;
33734
34172
  };
33735
34173
  const parseXLookupResponse = (data, input) => {
33736
- 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({
33737
34175
  input,
33738
34176
  platform: "x"
33739
34177
  }));
33740
34178
  const id = stringOrNumberField(data.data, "id");
33741
- if (!id) return G.err(new LookupPayloadInvalid({
34179
+ if (!id) return ae.err(new LookupPayloadInvalid({
33742
34180
  input,
33743
34181
  platform: "x"
33744
34182
  }));
33745
34183
  const inputUsername = input.replace(/^@+/, "");
33746
34184
  const resolvedUsername = stringField(data.data, "username") ?? inputUsername;
33747
- return G.ok({
34185
+ return ae.ok({
33748
34186
  id,
33749
34187
  url: `https://x.com/${resolvedUsername}`
33750
34188
  });
33751
34189
  };
33752
34190
  const parseLinkedinProfileLookupResponse = (data, input) => {
33753
34191
  const profile = isRecord$1(data) && isRecord$1(data.data) ? data.data : data;
33754
- if (!isRecord$1(profile)) return G.err(new LookupPayloadInvalid({
34192
+ if (!isRecord$1(profile)) return ae.err(new LookupPayloadInvalid({
33755
34193
  input,
33756
34194
  platform: "linkedin"
33757
34195
  }));
33758
34196
  const id = stringOrNumberField(profile, "provider_id") ?? stringOrNumberField(profile, "providerId") ?? stringOrNumberField(profile, "id");
33759
- if (!id) return G.err(new LookupPayloadInvalid({
34197
+ if (!id) return ae.err(new LookupPayloadInvalid({
33760
34198
  input,
33761
34199
  platform: "linkedin"
33762
34200
  }));
33763
34201
  const publicIdentifier = stringField(profile, "public_identifier") ?? stringField(profile, "publicIdentifier");
33764
- return G.ok({
34202
+ return ae.ok({
33765
34203
  id,
33766
34204
  ...publicIdentifier ? { url: `https://www.linkedin.com/in/${encodeURIComponent(publicIdentifier)}` } : {}
33767
34205
  });
@@ -33779,7 +34217,7 @@ const headerValuesFromRawArgs = (rawArgs = []) => {
33779
34217
  if (arg === "--") break;
33780
34218
  if (arg === "--header" || arg === "-H") {
33781
34219
  const value = rawArgs[index + 1];
33782
- 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}.`));
33783
34221
  values.push(value);
33784
34222
  index += 1;
33785
34223
  continue;
@@ -33790,25 +34228,25 @@ const headerValuesFromRawArgs = (rawArgs = []) => {
33790
34228
  }
33791
34229
  if (arg?.startsWith("-H=")) values.push(arg.slice(3));
33792
34230
  }
33793
- return G.ok(values);
34231
+ return ae.ok(values);
33794
34232
  };
33795
34233
  const commandHeaderValuesFrom = ({ headers, rawArgs }) => {
33796
34234
  const rawValues = headerValuesFromRawArgs(rawArgs);
33797
- if (G.isError(rawValues)) return rawValues;
34235
+ if (ae.isError(rawValues)) return rawValues;
33798
34236
  if (rawValues.value.length > 0) return rawValues;
33799
- if (headers === void 0) return G.ok([]);
33800
- if (typeof headers === "string") return G.ok([headers]);
33801
- if (Array.isArray(headers) && headers.every((header) => typeof header === "string")) return G.ok(headers);
33802
- 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."));
33803
34241
  };
33804
34242
  const parsedHeaderFrom = (header) => {
33805
34243
  const colon = header.indexOf(":");
33806
- 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."));
33807
34245
  const name = header.slice(0, colon).trim();
33808
34246
  const value = header.slice(colon + 1).trim();
33809
34247
  const normalized = name.toLowerCase();
33810
- 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.`));
33811
- 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({
33812
34250
  name,
33813
34251
  value
33814
34252
  });
@@ -33816,17 +34254,17 @@ const parsedHeaderFrom = (header) => {
33816
34254
  const commandHeadersFrom = (defaults, args = {}) => {
33817
34255
  const headers = new Headers(defaults);
33818
34256
  const rawHeaders = commandHeaderValuesFrom(args);
33819
- if (G.isError(rawHeaders)) return G.err(rawHeaders.error);
34257
+ if (ae.isError(rawHeaders)) return ae.err(rawHeaders.error);
33820
34258
  for (const rawHeader of rawHeaders.value) {
33821
34259
  const parsed = parsedHeaderFrom(rawHeader);
33822
- if (G.isError(parsed)) return G.err(parsed.error);
34260
+ if (ae.isError(parsed)) return ae.err(parsed.error);
33823
34261
  try {
33824
34262
  headers.set(parsed.value.name, parsed.value.value);
33825
34263
  } catch {
33826
- return G.err(headerError("invalidHeader", `Invalid header ${parsed.value.name}.`));
34264
+ return ae.err(headerError("invalidHeader", `Invalid header ${parsed.value.name}.`));
33827
34265
  }
33828
34266
  }
33829
- return G.ok(Object.fromEntries(headers.entries()));
34267
+ return ae.ok(Object.fromEntries(headers.entries()));
33830
34268
  };
33831
34269
  //#endregion
33832
34270
  //#region ../../node_modules/.bun/@borewit+text-codec@0.2.2/node_modules/@borewit/text-codec/lib/index.js
@@ -38764,7 +39202,7 @@ const createCLIDeps = () => {
38764
39202
  platform
38765
39203
  });
38766
39204
  const selected = requireSelectedAccount(outcome, platform);
38767
- if (G.isOk(selected)) return selected.value;
39205
+ if (ae.isOk(selected)) return selected.value;
38768
39206
  if (outcome.status === "missingExplicitAccount") throw new NotFoundError(`${platform}_account_not_found`);
38769
39207
  throw new Error(`${platform}_account_not_connected`);
38770
39208
  };
@@ -38779,7 +39217,7 @@ const createCLIDeps = () => {
38779
39217
  ...selectedAccount.selector === void 0 ? {} : { "x-social-account-id": selectedAccount.selector }
38780
39218
  };
38781
39219
  const parsed = parseXLookupResponse(await api.get(`x/users/by/username/${encodeURIComponent(inputUsername)}`, { headers }).json(), input);
38782
- 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}.`);
38783
39221
  return parsed.value;
38784
39222
  };
38785
39223
  const lookupLinkedinProfile = async (input, account, selectedAccount) => {
@@ -38792,7 +39230,7 @@ const createCLIDeps = () => {
38792
39230
  ...resolvedAccount.selector === void 0 ? {} : { "x-social-account-id": resolvedAccount.selector }
38793
39231
  };
38794
39232
  const parsed = parseLinkedinProfileLookupResponse(await api.get(`linkedin/users/${encodeURIComponent(input)}`, { headers }).json(), input);
38795
- 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}.`);
38796
39234
  return parsed.value;
38797
39235
  };
38798
39236
  return {
@@ -38857,7 +39295,7 @@ const createCLIDeps = () => {
38857
39295
  }),
38858
39296
  commandHeaders: async (args) => {
38859
39297
  const headers = commandHeadersFrom({ "Cache-Control": await cacheControlHeaderFromConfig() }, args);
38860
- if (G.isError(headers)) throw new UsageError(headers.error.message);
39298
+ if (ae.isError(headers)) throw new UsageError(headers.error.message);
38861
39299
  return headers.value;
38862
39300
  },
38863
39301
  printData,
@@ -39342,7 +39780,7 @@ const schemaAtPath = (command, commandPathInput, options = {}) => {
39342
39780
  command,
39343
39781
  path: []
39344
39782
  } : commandAtPath(command, parts);
39345
- return G.ok({
39783
+ return ae.ok({
39346
39784
  schemaVersion: "2.0",
39347
39785
  commands: Object.fromEntries(leafSchemasForCommand(selectedCommand, path))
39348
39786
  });
@@ -39352,31 +39790,31 @@ const schemaAtPath = (command, commandPathInput, options = {}) => {
39352
39790
  command,
39353
39791
  path: []
39354
39792
  } : commandAtPath(command, parts);
39355
- return G.ok({
39793
+ return ae.ok({
39356
39794
  schemaVersion: "2.0",
39357
39795
  commands: Object.fromEntries(compactLeafSchemasForCommand(selectedCommand, path))
39358
39796
  });
39359
39797
  }
39360
- if (parts.length === 0) return G.ok({
39798
+ if (parts.length === 0) return ae.ok({
39361
39799
  schemaVersion: "2.0",
39362
39800
  ...schemaTreeForCommand(command)
39363
39801
  });
39364
39802
  const { command: selectedCommand, path, positionalMatch } = commandAtPath(command, parts);
39365
- if (positionalMatch) return G.ok({
39803
+ if (positionalMatch) return ae.ok({
39366
39804
  schemaVersion: "2.0",
39367
39805
  ...schemaForCommand(selectedCommand, path),
39368
39806
  ...positionalMatch
39369
39807
  });
39370
- if (selectedCommand.subCommands && typeof selectedCommand.run !== "function") return G.ok({
39808
+ if (selectedCommand.subCommands && typeof selectedCommand.run !== "function") return ae.ok({
39371
39809
  schemaVersion: "2.0",
39372
39810
  ...schemaTreeForCommand(selectedCommand, path)
39373
39811
  });
39374
- return G.ok({
39812
+ return ae.ok({
39375
39813
  schemaVersion: "2.0",
39376
39814
  ...schemaForCommand(selectedCommand, path)
39377
39815
  });
39378
39816
  } catch (error) {
39379
- return G.err(schemaErrorFor(error, parts));
39817
+ return ae.err(schemaErrorFor(error, parts));
39380
39818
  }
39381
39819
  };
39382
39820
  const schemaCommand = defineCommand({
@@ -39411,7 +39849,7 @@ const schemaCommand = defineCommand({
39411
39849
  if (!rootCommand) throw new Error("schema_root_command_unconfigured");
39412
39850
  const commandPathInput = Array.isArray(args._) && args._.length > 1 ? args._ : args.commandPath;
39413
39851
  const schema = schemaAtPath(rootCommand, commandPathInput, { mode: args.leaves === true ? "leaves" : args.list === true ? "list" : "leaf" });
39414
- if (G.isError(schema)) throw new Error(schema.error.message);
39852
+ if (ae.isError(schema)) throw new Error(schema.error.message);
39415
39853
  printData(schema.value);
39416
39854
  }
39417
39855
  });