@madewithremy/admin 0.1.7 → 0.1.8

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.js CHANGED
@@ -374,8 +374,11 @@ __export(dataSources_exports, {
374
374
  promote: () => promote,
375
375
  revectorize: () => revectorize,
376
376
  rm: () => rm,
377
+ rmWhere: () => rmWhere,
378
+ rmWhereAll: () => rmWhereAll,
377
379
  search: () => search,
378
380
  summarize: () => summarize,
381
+ waitForCandidate: () => waitForCandidate,
379
382
  waitForIngest: () => waitForIngest,
380
383
  waitForMove: () => waitForMove
381
384
  });
@@ -386,6 +389,48 @@ function sleep(ms) {
386
389
  return new Promise((r) => setTimeout(r, ms));
387
390
  }
388
391
 
392
+ // src/poll.ts
393
+ async function pollUntil(read, isSettled, options) {
394
+ const start2 = Date.now();
395
+ let transientSince = null;
396
+ while (true) {
397
+ let value;
398
+ try {
399
+ value = await read();
400
+ transientSince = null;
401
+ } catch (err) {
402
+ if (!isTransientError(err)) {
403
+ throw err;
404
+ }
405
+ transientSince ??= Date.now();
406
+ if (Date.now() - transientSince > TRANSIENT_GRACE_MS) {
407
+ throw err;
408
+ }
409
+ options.onProgress?.(
410
+ `retrying after a gateway error\u2026 (${elapsedSeconds(start2)}s)`
411
+ );
412
+ await sleep(options.pollMs);
413
+ continue;
414
+ }
415
+ if (isSettled(value)) {
416
+ return { settled: true, value };
417
+ }
418
+ if (Date.now() - start2 > options.timeoutMs) {
419
+ return { settled: false, value };
420
+ }
421
+ if (options.describe) {
422
+ options.onProgress?.(options.describe(value, start2));
423
+ }
424
+ await sleep(options.pollMs);
425
+ }
426
+ }
427
+ function elapsedSeconds(start2) {
428
+ return Math.round((Date.now() - start2) / 1e3);
429
+ }
430
+ function timedOut(timeoutMs, still) {
431
+ return `Timed out after ${Math.round(timeoutMs / 1e3)}s ${still}`;
432
+ }
433
+
389
434
  // src/upload.ts
390
435
  async function uploadDirect(upload, bytes, filename) {
391
436
  const form = new FormData();
@@ -437,7 +482,12 @@ async function addDocument(ctx, params) {
437
482
  );
438
483
  if (token.alreadyCurrent) {
439
484
  onProgress?.(`${filename}: unchanged, skipped`);
440
- return { filename, skipped: true, document: token.document };
485
+ return {
486
+ filename,
487
+ skipped: true,
488
+ document: token.document,
489
+ documents: token.documents ?? [token.document]
490
+ };
441
491
  }
442
492
  onProgress?.(
443
493
  `${filename}: uploading ${(content.length / 1024 / 1024).toFixed(1)}MB\u2026`
@@ -460,7 +510,9 @@ async function addDocument(ctx, params) {
460
510
  filename,
461
511
  skipped: false,
462
512
  queued: confirmed.queued,
463
- document: confirmed.document
513
+ document: confirmed.document,
514
+ documents: confirmed.documents ?? (confirmed.document ? [confirmed.document] : []),
515
+ outcome: confirmed.outcome
464
516
  };
465
517
  }
466
518
  async function waitForIngest(ctx, params) {
@@ -470,50 +522,64 @@ async function waitForIngest(ctx, params) {
470
522
  return { status: "up-to-date", documents: [] };
471
523
  }
472
524
  const wanted = new Set(documentIds);
473
- const start = Date.now();
474
- let transientSince = null;
475
- for (; ; ) {
476
- let docs;
477
- try {
478
- docs = await allDocuments(ctx, { slug, ids: documentIds });
479
- transientSince = null;
480
- } catch (err) {
481
- if (!isTransientError(err)) {
482
- throw err;
483
- }
484
- transientSince ??= Date.now();
485
- if (Date.now() - transientSince > TRANSIENT_GRACE_MS) {
486
- throw err;
487
- }
488
- onProgress?.(
489
- `retrying after a gateway error\u2026 (${Math.round((Date.now() - start) / 1e3)}s)`
490
- );
491
- await sleep(POLL_MS);
492
- continue;
493
- }
494
- const tracked = (docs ?? []).filter((d) => wanted.has(d.id));
495
- const pending = tracked.filter((d) => d.status === "processing");
496
- const failed = tracked.filter((d) => d.status === "error");
497
- if (pending.length === 0) {
498
- return {
499
- status: failed.length ? "error" : "done",
500
- documents: tracked.map(summarize)
501
- };
525
+ const pendingOf = (docs) => docs.filter((d) => d.status === "processing");
526
+ const outcome = await pollUntil(
527
+ async () => {
528
+ const docs = await allDocuments(ctx, { slug, ids: documentIds });
529
+ return (docs ?? []).filter((d) => wanted.has(d.id));
530
+ },
531
+ (tracked2) => pendingOf(tracked2).length === 0,
532
+ {
533
+ timeoutMs,
534
+ pollMs: POLL_MS,
535
+ describe: (tracked2, start2) => `ingesting\u2026 ${tracked2.length - pendingOf(tracked2).length}/${tracked2.length} done (${elapsedSeconds(start2)}s)`,
536
+ onProgress
502
537
  }
503
- if (Date.now() - start > timeoutMs) {
504
- return {
505
- status: "timeout",
506
- documents: tracked.map(summarize),
507
- error: `Timed out after ${Math.round(timeoutMs / 1e3)}s with ${pending.length} document(s) still processing`
508
- };
538
+ );
539
+ const tracked = outcome.value;
540
+ if (!outcome.settled) {
541
+ return {
542
+ status: "timeout",
543
+ documents: tracked.map(summarize),
544
+ error: timedOut(
545
+ timeoutMs,
546
+ `with ${pendingOf(tracked).length} document(s) still processing`
547
+ )
548
+ };
549
+ }
550
+ return {
551
+ status: tracked.some((d) => d.status === "error") ? "error" : "done",
552
+ documents: tracked.map(summarize)
553
+ };
554
+ }
555
+ async function waitForCandidate(ctx, params) {
556
+ const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;
557
+ const pendingOf = (docs2) => docs2.filter((d) => d.status === "processing");
558
+ const outcome = await pollUntil(
559
+ () => allDocuments(ctx, { slug: params.slug, candidate: true }),
560
+ (docs2) => pendingOf(docs2).length === 0,
561
+ {
562
+ timeoutMs,
563
+ pollMs: POLL_MS,
564
+ describe: (docs2, start2) => `rebuilding\u2026 ${docs2.length - pendingOf(docs2).length}/${docs2.length} done (${elapsedSeconds(start2)}s)`,
565
+ onProgress: params.onProgress
509
566
  }
510
- onProgress?.(
511
- `ingesting\u2026 ${tracked.length - pending.length}/${tracked.length} done (${Math.round(
512
- (Date.now() - start) / 1e3
513
- )}s)`
514
- );
515
- await sleep(POLL_MS);
567
+ );
568
+ const docs = outcome.value;
569
+ if (!outcome.settled) {
570
+ return {
571
+ status: "timeout",
572
+ documents: docs.map(summarize),
573
+ error: timedOut(
574
+ timeoutMs,
575
+ `with ${pendingOf(docs).length} document(s) still building`
576
+ )
577
+ };
516
578
  }
579
+ return {
580
+ status: docs.some((d) => d.status === "error") ? "error" : "ready",
581
+ documents: docs.map(summarize)
582
+ };
517
583
  }
518
584
  var DOCUMENTS_IDS_MAX = 200;
519
585
  function documents(ctx, params) {
@@ -621,52 +687,39 @@ function move(ctx, params) {
621
687
  }
622
688
  async function waitForMove(ctx, params) {
623
689
  const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;
624
- const start = Date.now();
625
- let transientSince = null;
626
- for (; ; ) {
627
- let source;
628
- try {
690
+ const outcome = await pollUntil(
691
+ async () => {
629
692
  const { dataSources } = await list3(ctx);
630
- source = dataSources.find((s) => s.slug === params.slug);
631
- transientSince = null;
632
- } catch (err) {
633
- if (!isTransientError(err)) {
634
- throw err;
635
- }
636
- transientSince ??= Date.now();
637
- if (Date.now() - transientSince > TRANSIENT_GRACE_MS) {
638
- throw err;
693
+ const source2 = dataSources.find((s) => s.slug === params.slug);
694
+ if (!source2) {
695
+ throw new Error(`Data source "${params.slug}" not found.`);
639
696
  }
640
- params.onProgress?.(
641
- `retrying after a gateway error\u2026 (${Math.round((Date.now() - start) / 1e3)}s)`
642
- );
643
- await sleep(POLL_MS);
644
- continue;
645
- }
646
- if (!source) {
647
- throw new Error(`Data source "${params.slug}" not found.`);
648
- }
649
- const migration = source.migration;
650
- if (!migration) {
651
- return { status: "done", source };
652
- }
653
- if (migration.error) {
654
- return { status: "failed", source, error: migration.error };
655
- }
656
- if (Date.now() - start > timeoutMs) {
657
- return {
658
- status: "timeout",
659
- source,
660
- error: `Timed out after ${Math.round(timeoutMs / 1e3)}s with ${migration.copied}/${migration.total} documents copied`
661
- };
697
+ return source2;
698
+ },
699
+ (source2) => !source2.migration || source2.migration.error !== null,
700
+ {
701
+ timeoutMs,
702
+ pollMs: POLL_MS,
703
+ describe: (source2, start2) => `moving\u2026 ${source2.migration.copied}/${source2.migration.total} documents (${elapsedSeconds(start2)}s)`,
704
+ onProgress: params.onProgress
662
705
  }
663
- params.onProgress?.(
664
- `moving\u2026 ${migration.copied}/${migration.total} documents (${Math.round(
665
- (Date.now() - start) / 1e3
666
- )}s)`
667
- );
668
- await sleep(POLL_MS);
706
+ );
707
+ const source = outcome.value;
708
+ const migration = source.migration;
709
+ if (!outcome.settled) {
710
+ return {
711
+ status: "timeout",
712
+ source,
713
+ error: timedOut(
714
+ timeoutMs,
715
+ `with ${migration.copied}/${migration.total} documents copied`
716
+ )
717
+ };
718
+ }
719
+ if (migration?.error) {
720
+ return { status: "failed", source, error: migration.error };
669
721
  }
722
+ return { status: "done", source };
670
723
  }
671
724
  function revectorize(ctx, params) {
672
725
  const { slug, ingest } = params;
@@ -713,6 +766,27 @@ function rm(ctx, params) {
713
766
  }
714
767
  );
715
768
  }
769
+ function rmWhere(ctx, params) {
770
+ return call(
771
+ ctx,
772
+ "POST",
773
+ `${base(ctx.appId)}/documents/delete-many`,
774
+ { slug: params.slug, filter: params.filter }
775
+ );
776
+ }
777
+ async function rmWhereAll(ctx, params) {
778
+ let deleted = 0;
779
+ while (true) {
780
+ const page = await rmWhere(ctx, params);
781
+ deleted += page.deleted;
782
+ if (page.remaining === 0 || page.deleted === 0) {
783
+ return { deleted };
784
+ }
785
+ params.onProgress?.(
786
+ `removed ${deleted.toLocaleString()} so far, ${page.remaining.toLocaleString()} remaining\u2026`
787
+ );
788
+ }
789
+ }
716
790
  function deleteSource(ctx, slug) {
717
791
  return call(
718
792
  ctx,
@@ -722,6 +796,526 @@ function deleteSource(ctx, slug) {
722
796
  );
723
797
  }
724
798
 
799
+ // src/ops/dataSourceJobs.ts
800
+ var dataSourceJobs_exports = {};
801
+ __export(dataSourceJobs_exports, {
802
+ DEFAULT_WAIT_TIMEOUT_MS: () => DEFAULT_WAIT_TIMEOUT_MS2,
803
+ approve: () => approve,
804
+ cancel: () => cancel,
805
+ describeProgress: () => describeProgress,
806
+ get: () => get2,
807
+ list: () => list4,
808
+ pause: () => pause,
809
+ resume: () => resume,
810
+ start: () => start,
811
+ uploadManifest: () => uploadManifest,
812
+ waitForJob: () => waitForJob,
813
+ waitForPlan: () => waitForPlan
814
+ });
815
+ var DEFAULT_WAIT_TIMEOUT_MS2 = 60 * 60 * 1e3;
816
+ var POLL_MS2 = 5e3;
817
+ function base2(appId) {
818
+ return `/_internal/v2/apps/${appId}/datasources/jobs`;
819
+ }
820
+ function start(ctx, params) {
821
+ const { slug, source, approve: approve2, budgetDollars, concurrency, limit } = params;
822
+ return call(ctx, "POST", base2(ctx.appId), {
823
+ slug,
824
+ source,
825
+ ...approve2 ? { approve: true } : {},
826
+ ...budgetDollars !== void 0 ? { budgetDollars } : {},
827
+ ...concurrency !== void 0 ? { concurrency } : {},
828
+ ...limit !== void 0 ? { limit } : {}
829
+ });
830
+ }
831
+ async function uploadManifest(ctx, params) {
832
+ const token = await call(
833
+ ctx,
834
+ "POST",
835
+ `${base2(ctx.appId)}/manifest-token`,
836
+ { slug: params.slug }
837
+ );
838
+ await uploadDirect(token.upload, params.content, "manifest.jsonl");
839
+ return { key: token.key };
840
+ }
841
+ function list4(ctx, params) {
842
+ return call(
843
+ ctx,
844
+ "GET",
845
+ `${base2(ctx.appId)}${qs({ slug: params?.slug })}`
846
+ );
847
+ }
848
+ function get2(ctx, params) {
849
+ return call(
850
+ ctx,
851
+ "GET",
852
+ `${base2(ctx.appId)}/${encodeURIComponent(params.id)}`
853
+ );
854
+ }
855
+ function approve(ctx, params) {
856
+ return call(
857
+ ctx,
858
+ "POST",
859
+ `${base2(ctx.appId)}/${encodeURIComponent(params.id)}/approve`
860
+ );
861
+ }
862
+ function pause(ctx, params) {
863
+ return call(
864
+ ctx,
865
+ "POST",
866
+ `${base2(ctx.appId)}/${encodeURIComponent(params.id)}/pause`
867
+ );
868
+ }
869
+ function resume(ctx, params) {
870
+ return call(
871
+ ctx,
872
+ "POST",
873
+ `${base2(ctx.appId)}/${encodeURIComponent(params.id)}/resume`
874
+ );
875
+ }
876
+ function cancel(ctx, params) {
877
+ return call(
878
+ ctx,
879
+ "POST",
880
+ `${base2(ctx.appId)}/${encodeURIComponent(params.id)}/cancel`
881
+ );
882
+ }
883
+ function waitForPlan(ctx, params) {
884
+ return settle(ctx, params, (job) => job.state !== "planning");
885
+ }
886
+ function waitForJob(ctx, params) {
887
+ return settle(
888
+ ctx,
889
+ params,
890
+ (job) => !["planning", "planned", "running"].includes(job.state) || job.state === "planned" && (job.error !== null || !job.autoApprove)
891
+ );
892
+ }
893
+ async function settle(ctx, params, isSettled) {
894
+ const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS2;
895
+ const outcome = await pollUntil(
896
+ async () => (await get2(ctx, { id: params.id })).job,
897
+ isSettled,
898
+ {
899
+ timeoutMs,
900
+ pollMs: POLL_MS2,
901
+ describe: describeProgress,
902
+ onProgress: params.onProgress
903
+ }
904
+ );
905
+ const job = outcome.value;
906
+ if (!outcome.settled) {
907
+ return {
908
+ status: "timeout",
909
+ job,
910
+ error: timedOut(timeoutMs, `; job is still ${job.state}`)
911
+ };
912
+ }
913
+ if (job.state === "failed" || job.state === "cancelled") {
914
+ return {
915
+ status: "failed",
916
+ job,
917
+ error: job.error ?? `The job was ${job.state}.`
918
+ };
919
+ }
920
+ if (job.state === "paused") {
921
+ return {
922
+ status: "failed",
923
+ job,
924
+ error: job.error ?? `The job paused (${job.pauseReason ?? "user"}). Resume it to continue.`
925
+ };
926
+ }
927
+ if (job.state === "planned" && (job.error !== null || job.autoApprove)) {
928
+ return {
929
+ status: "planned",
930
+ job,
931
+ error: job.error ?? "The plan is ready but the job did not start. Approve it once the cause is fixed."
932
+ };
933
+ }
934
+ return { status: "done", job };
935
+ }
936
+ function describeProgress(job, start2) {
937
+ const elapsed = `(${elapsedSeconds(start2)}s)`;
938
+ if (job.state === "planning") {
939
+ return job.enumerationDone ? `planning\u2026 reading a sample of ${job.counts.objectsSeen.toLocaleString()} objects ${elapsed}` : `planning\u2026 ${job.counts.objectsSeen.toLocaleString()} objects counted ${elapsed}`;
940
+ }
941
+ const total = job.plan?.projected.documents ?? job.counts.objectsSeen;
942
+ const processed = job.counts.documentsDone + job.counts.documentsSkipped + job.counts.documentsFailed;
943
+ const spend = `$${job.estimatedDollars.toFixed(2)}${job.budgetDollars !== null ? ` of $${job.budgetDollars.toFixed(2)}` : ""}`;
944
+ return `${job.state}\u2026 ${processed.toLocaleString()}/${total.toLocaleString()} documents \xB7 ${spend} ${elapsed}`;
945
+ }
946
+
947
+ // src/ops/dataSourceConnectors.ts
948
+ var dataSourceConnectors_exports = {};
949
+ __export(dataSourceConnectors_exports, {
950
+ connect: () => connect,
951
+ disconnect: () => disconnect,
952
+ get: () => get3,
953
+ sync: () => sync
954
+ });
955
+ function base3(appId) {
956
+ return `/_internal/v2/apps/${appId}/datasources`;
957
+ }
958
+ function connect(ctx, params) {
959
+ const {
960
+ slug,
961
+ bucket,
962
+ region,
963
+ prefix,
964
+ endpoint,
965
+ accessKeyIdSecret,
966
+ secretAccessKeySecret,
967
+ deletions,
968
+ budgetDollarsPerSync
969
+ } = params;
970
+ return call(
971
+ ctx,
972
+ "POST",
973
+ `${base3(ctx.appId)}/connector`,
974
+ {
975
+ slug,
976
+ bucket,
977
+ region,
978
+ ...prefix !== void 0 ? { prefix } : {},
979
+ ...endpoint !== void 0 ? { endpoint } : {},
980
+ accessKeyIdSecret,
981
+ secretAccessKeySecret,
982
+ ...deletions !== void 0 ? { deletions } : {},
983
+ ...budgetDollarsPerSync !== void 0 ? { budgetDollarsPerSync } : {}
984
+ }
985
+ );
986
+ }
987
+ function get3(ctx, params) {
988
+ return call(
989
+ ctx,
990
+ "GET",
991
+ `${base3(ctx.appId)}/connector${qs({ slug: params.slug })}`
992
+ );
993
+ }
994
+ function disconnect(ctx, params) {
995
+ return call(
996
+ ctx,
997
+ "POST",
998
+ `${base3(ctx.appId)}/connector/remove`,
999
+ { slug: params.slug }
1000
+ );
1001
+ }
1002
+ function sync(ctx, params) {
1003
+ return call(ctx, "POST", `${base3(ctx.appId)}/sync`, {
1004
+ slug: params.slug,
1005
+ ...params.budgetDollars !== void 0 ? { budgetDollars: params.budgetDollars } : {}
1006
+ });
1007
+ }
1008
+
1009
+ // src/ops/dataSourceEvals.ts
1010
+ var dataSourceEvals_exports = {};
1011
+ __export(dataSourceEvals_exports, {
1012
+ DEFAULT_WAIT_TIMEOUT_MS: () => DEFAULT_WAIT_TIMEOUT_MS3,
1013
+ addQueries: () => addQueries,
1014
+ compare: () => compare,
1015
+ createSet: () => createSet,
1016
+ deleteQuery: () => deleteQuery,
1017
+ deleteSet: () => deleteSet,
1018
+ getRun: () => getRun,
1019
+ getSet: () => getSet,
1020
+ hydrate: () => hydrate,
1021
+ listQueries: () => listQueries,
1022
+ listRuns: () => listRuns,
1023
+ listSets: () => listSets,
1024
+ run: () => run2,
1025
+ sample: () => sample,
1026
+ waitForHydration: () => waitForHydration,
1027
+ waitForRun: () => waitForRun,
1028
+ waitForSet: () => waitForSet
1029
+ });
1030
+ var DEFAULT_WAIT_TIMEOUT_MS3 = 30 * 60 * 1e3;
1031
+ var POLL_MS3 = 4e3;
1032
+ function base4(appId) {
1033
+ return `/_internal/v2/apps/${appId}/datasources`;
1034
+ }
1035
+ function hydrate(ctx, params) {
1036
+ return call(
1037
+ ctx,
1038
+ "POST",
1039
+ `${base4(ctx.appId)}/hydrate`,
1040
+ { slug: params.slug }
1041
+ );
1042
+ }
1043
+ async function waitForHydration(ctx, params) {
1044
+ const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS3;
1045
+ const outcome = await pollUntil(
1046
+ async () => {
1047
+ const { dataSources } = await list3(ctx);
1048
+ const source2 = dataSources.find((s) => s.slug === params.slug);
1049
+ if (!source2) {
1050
+ throw new Error(`Data source "${params.slug}" not found.`);
1051
+ }
1052
+ return source2;
1053
+ },
1054
+ (source2) => !source2.hydration || source2.hydration.error !== null,
1055
+ {
1056
+ timeoutMs,
1057
+ pollMs: POLL_MS3,
1058
+ describe: (source2, start2) => `loading\u2026 ${source2.hydration.copied}/${source2.hydration.total} documents (${elapsedSeconds(start2)}s)`,
1059
+ onProgress: params.onProgress
1060
+ }
1061
+ );
1062
+ const source = outcome.value;
1063
+ const hydration = source.hydration;
1064
+ if (!outcome.settled) {
1065
+ return {
1066
+ status: "timeout",
1067
+ source,
1068
+ error: timedOut(
1069
+ timeoutMs,
1070
+ `with ${hydration.copied}/${hydration.total} documents loaded`
1071
+ )
1072
+ };
1073
+ }
1074
+ if (hydration?.error) {
1075
+ return { status: "failed", source, error: hydration.error };
1076
+ }
1077
+ return { status: "done", source };
1078
+ }
1079
+ function sample(ctx, params) {
1080
+ const { slug, size, as, filter, stratify, placement } = params;
1081
+ return call(
1082
+ ctx,
1083
+ "POST",
1084
+ `${base4(ctx.appId)}/sample`,
1085
+ {
1086
+ slug,
1087
+ size,
1088
+ ...as ? { as } : {},
1089
+ ...filter ? { filter } : {},
1090
+ ...stratify ? { stratify } : {},
1091
+ ...placement !== void 0 ? { placement } : {}
1092
+ }
1093
+ );
1094
+ }
1095
+ function createSet(ctx, params) {
1096
+ const { slug, name, description, size, style, modelId, tags, seed } = params;
1097
+ return call(ctx, "POST", `${base4(ctx.appId)}/eval/sets`, {
1098
+ slug,
1099
+ name,
1100
+ ...description ? { description } : {},
1101
+ ...size !== void 0 ? { size } : {},
1102
+ ...style ? { style } : {},
1103
+ ...modelId ? { modelId } : {},
1104
+ ...tags?.length ? { tags } : {},
1105
+ ...seed !== void 0 ? { seed } : {}
1106
+ });
1107
+ }
1108
+ function listSets(ctx, params) {
1109
+ return call(
1110
+ ctx,
1111
+ "GET",
1112
+ `${base4(ctx.appId)}/eval/sets${qs({ slug: params?.slug })}`
1113
+ );
1114
+ }
1115
+ function getSet(ctx, params) {
1116
+ return call(
1117
+ ctx,
1118
+ "GET",
1119
+ `${base4(ctx.appId)}/eval/sets/${encodeURIComponent(params.id)}${qs({
1120
+ queries: params.queries ? "true" : void 0
1121
+ })}`
1122
+ );
1123
+ }
1124
+ function deleteSet(ctx, params) {
1125
+ return call(
1126
+ ctx,
1127
+ "POST",
1128
+ `${base4(ctx.appId)}/eval/sets/${encodeURIComponent(params.id)}/delete`
1129
+ );
1130
+ }
1131
+ function addQueries(ctx, params) {
1132
+ return call(
1133
+ ctx,
1134
+ "POST",
1135
+ `${base4(ctx.appId)}/eval/sets/${encodeURIComponent(params.id)}/queries`,
1136
+ { queries: params.queries }
1137
+ );
1138
+ }
1139
+ function listQueries(ctx, params) {
1140
+ return call(
1141
+ ctx,
1142
+ "GET",
1143
+ `${base4(ctx.appId)}/eval/sets/${encodeURIComponent(params.id)}/queries`
1144
+ );
1145
+ }
1146
+ function deleteQuery(ctx, params) {
1147
+ return call(
1148
+ ctx,
1149
+ "POST",
1150
+ `${base4(ctx.appId)}/eval/sets/${encodeURIComponent(params.id)}/queries/delete`,
1151
+ { queryId: params.queryId }
1152
+ );
1153
+ }
1154
+ function run2(ctx, params) {
1155
+ const { setId, slug, candidate, label, retrieval } = params;
1156
+ return call(ctx, "POST", `${base4(ctx.appId)}/eval/runs`, {
1157
+ setId,
1158
+ ...slug ? { slug } : {},
1159
+ ...candidate ? { candidate: true } : {},
1160
+ ...label ? { label } : {},
1161
+ ...retrieval && Object.keys(retrieval).length ? { retrieval } : {}
1162
+ });
1163
+ }
1164
+ function listRuns(ctx, params) {
1165
+ return call(
1166
+ ctx,
1167
+ "GET",
1168
+ `${base4(ctx.appId)}/eval/runs${qs({ setId: params?.setId, slug: params?.slug })}`
1169
+ );
1170
+ }
1171
+ function getRun(ctx, params) {
1172
+ return call(
1173
+ ctx,
1174
+ "GET",
1175
+ `${base4(ctx.appId)}/eval/runs/${encodeURIComponent(params.id)}${qs({
1176
+ queries: params.queries ? "true" : void 0,
1177
+ worst: params.worst
1178
+ })}`
1179
+ );
1180
+ }
1181
+ function compare(ctx, params) {
1182
+ return call(
1183
+ ctx,
1184
+ "GET",
1185
+ `${base4(ctx.appId)}/eval/runs/compare${qs({ a: params.a, b: params.b })}`
1186
+ );
1187
+ }
1188
+ async function waitForRun(ctx, params) {
1189
+ const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS3;
1190
+ const outcome = await pollUntil(
1191
+ async () => (await getRun(ctx, { id: params.id })).run,
1192
+ (run4) => run4.state === "done" || run4.state === "failed",
1193
+ {
1194
+ timeoutMs,
1195
+ pollMs: POLL_MS3,
1196
+ describe: (run4, start2) => `${run4.state}\u2026 ${run4.completed}/${run4.total} queries (${elapsedSeconds(start2)}s)`,
1197
+ onProgress: params.onProgress
1198
+ }
1199
+ );
1200
+ const run3 = outcome.value;
1201
+ if (!outcome.settled) {
1202
+ return {
1203
+ status: "timeout",
1204
+ run: run3,
1205
+ error: timedOut(
1206
+ timeoutMs,
1207
+ `; run is ${run3.state} (${run3.completed}/${run3.total})`
1208
+ )
1209
+ };
1210
+ }
1211
+ if (run3.state === "failed") {
1212
+ return { status: "failed", run: run3, error: run3.error ?? "The run failed." };
1213
+ }
1214
+ return { status: "done", run: run3 };
1215
+ }
1216
+ async function waitForSet(ctx, params) {
1217
+ const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS3;
1218
+ const outcome = await pollUntil(
1219
+ async () => (await getSet(ctx, { id: params.id })).set,
1220
+ (set4) => set4.state === "ready" || set4.state === "failed",
1221
+ {
1222
+ timeoutMs,
1223
+ pollMs: POLL_MS3,
1224
+ describe: (set4, start2) => `${set4.state}\u2026 (${elapsedSeconds(start2)}s)`,
1225
+ onProgress: params.onProgress
1226
+ }
1227
+ );
1228
+ const set3 = outcome.value;
1229
+ if (!outcome.settled) {
1230
+ return {
1231
+ status: "timeout",
1232
+ set: set3,
1233
+ error: timedOut(timeoutMs, `; set is still ${set3.state}`)
1234
+ };
1235
+ }
1236
+ if (set3.state === "failed") {
1237
+ return { status: "failed", set: set3, error: set3.error ?? "Generation failed." };
1238
+ }
1239
+ return { status: "done", set: set3 };
1240
+ }
1241
+
1242
+ // src/ops/dataSourceMappers.ts
1243
+ var dataSourceMappers_exports = {};
1244
+ __export(dataSourceMappers_exports, {
1245
+ inspect: () => inspect,
1246
+ mapTest: () => mapTest,
1247
+ quarantine: () => quarantine,
1248
+ remap: () => remap,
1249
+ replay: () => replay
1250
+ });
1251
+ function base5(appId) {
1252
+ return `/_internal/v2/apps/${appId}/datasources`;
1253
+ }
1254
+ function selectionBody(selection) {
1255
+ if ("connector" in selection) {
1256
+ return { connector: true };
1257
+ }
1258
+ return {
1259
+ store: selection.store,
1260
+ ...selection.access ? { access: selection.access } : {},
1261
+ ...selection.prefix !== void 0 ? { prefix: selection.prefix } : {}
1262
+ };
1263
+ }
1264
+ function inspect(ctx, params) {
1265
+ return call(
1266
+ ctx,
1267
+ "POST",
1268
+ `${base5(ctx.appId)}/inspect`,
1269
+ {
1270
+ ...params.slug ? { slug: params.slug } : {},
1271
+ ...selectionBody(params.selection),
1272
+ ...params.keys ? { keys: params.keys } : {},
1273
+ ...params.limit !== void 0 ? { limit: params.limit } : {}
1274
+ }
1275
+ );
1276
+ }
1277
+ function mapTest(ctx, params) {
1278
+ return call(
1279
+ ctx,
1280
+ "POST",
1281
+ `${base5(ctx.appId)}/map-test`,
1282
+ {
1283
+ slug: params.slug,
1284
+ ...selectionBody(params.selection),
1285
+ ...params.keys ? { keys: params.keys } : {},
1286
+ ...params.limit !== void 0 ? { limit: params.limit } : {},
1287
+ ...params.dev ? { dev: true } : {}
1288
+ }
1289
+ );
1290
+ }
1291
+ function remap(ctx, params) {
1292
+ return call(ctx, "POST", `${base5(ctx.appId)}/remap`, {
1293
+ slug: params.slug,
1294
+ ...params.budgetDollars !== void 0 ? { budgetDollars: params.budgetDollars } : {},
1295
+ ...params.limit !== void 0 ? { limit: params.limit } : {}
1296
+ });
1297
+ }
1298
+ function quarantine(ctx, params) {
1299
+ return call(
1300
+ ctx,
1301
+ "GET",
1302
+ `${base5(ctx.appId)}/jobs/${params.id}/quarantine${qs({
1303
+ ...params.kind ? { kind: params.kind } : {},
1304
+ ...params.reason ? { reason: params.reason } : {},
1305
+ ...params.cursor ? { cursor: params.cursor } : {},
1306
+ ...params.limit !== void 0 ? { limit: params.limit } : {}
1307
+ })}`
1308
+ );
1309
+ }
1310
+ function replay(ctx, params) {
1311
+ return call(
1312
+ ctx,
1313
+ "POST",
1314
+ `${base5(ctx.appId)}/jobs/${params.id}/replay`,
1315
+ params.kind ? { kind: params.kind } : {}
1316
+ );
1317
+ }
1318
+
725
1319
  // src/ops/db.ts
726
1320
  var db_exports = {};
727
1321
  __export(db_exports, {
@@ -749,18 +1343,18 @@ var releases_exports = {};
749
1343
  __export(releases_exports, {
750
1344
  byCommit: () => byCommit,
751
1345
  dashboardLive: () => dashboardLive,
752
- get: () => get2,
753
- list: () => list4,
1346
+ get: () => get4,
1347
+ list: () => list5,
754
1348
  waitForCommit: () => waitForCommit
755
1349
  });
756
- function list4(ctx, params = {}) {
1350
+ function list5(ctx, params = {}) {
757
1351
  return call(
758
1352
  ctx,
759
1353
  "GET",
760
1354
  `/_internal/v2/apps/${ctx.appId}/releases${qs({ limit: params.limit })}`
761
1355
  );
762
1356
  }
763
- function get2(ctx, releaseId) {
1357
+ function get4(ctx, releaseId) {
764
1358
  return call(
765
1359
  ctx,
766
1360
  "GET",
@@ -809,14 +1403,14 @@ function summarizeRelease(release) {
809
1403
  ...release.failurePhase ? { failurePhase: release.failurePhase } : {}
810
1404
  };
811
1405
  }
812
- var POLL_MS2 = 3e3;
1406
+ var POLL_MS4 = 3e3;
813
1407
  var RESOLVE_GRACE_MS = 3e4;
814
1408
  var DEFAULT_TIMEOUT_MS = 3e5;
815
1409
  async function waitForCommit(ctx, params) {
816
1410
  const { commitSha, onProgress } = params;
817
1411
  const timeoutMs = params.timeoutMs ?? DEFAULT_TIMEOUT_MS;
818
1412
  const shortSha = commitSha.slice(0, 8);
819
- const start = Date.now();
1413
+ const start2 = Date.now();
820
1414
  let release;
821
1415
  while (true) {
822
1416
  const r = await byCommit(ctx, commitSha);
@@ -829,14 +1423,14 @@ async function waitForCommit(ctx, params) {
829
1423
  `Failed to resolve release for ${shortSha}: HTTP ${r.status} ${JSON.stringify(r.body)}`
830
1424
  );
831
1425
  }
832
- if (Date.now() - start > RESOLVE_GRACE_MS) {
1426
+ if (Date.now() - start2 > RESOLVE_GRACE_MS) {
833
1427
  return {
834
1428
  outcome: "not_found",
835
1429
  error: `No release created for commit ${commitSha} within ${RESOLVE_GRACE_MS / 1e3}s \u2014 either the push hasn't registered yet or this SHA never produced a build`
836
1430
  };
837
1431
  }
838
1432
  onProgress?.(`waiting for release to be created for ${shortSha}\u2026`);
839
- await sleep(POLL_MS2);
1433
+ await sleep(POLL_MS4);
840
1434
  }
841
1435
  const SUCCESS = /* @__PURE__ */ new Set(["live", "preview"]);
842
1436
  while (true) {
@@ -857,7 +1451,7 @@ async function waitForCommit(ctx, params) {
857
1451
  summary: summarizeRelease(release)
858
1452
  };
859
1453
  }
860
- if (Date.now() - start > timeoutMs) {
1454
+ if (Date.now() - start2 > timeoutMs) {
861
1455
  return {
862
1456
  outcome: "timeout",
863
1457
  release,
@@ -866,9 +1460,9 @@ async function waitForCommit(ctx, params) {
866
1460
  };
867
1461
  }
868
1462
  onProgress?.(
869
- `${release.status}\u2026 (${Math.round((Date.now() - start) / 1e3)}s)`
1463
+ `${release.status}\u2026 (${Math.round((Date.now() - start2) / 1e3)}s)`
870
1464
  );
871
- await sleep(POLL_MS2);
1465
+ await sleep(POLL_MS4);
872
1466
  const r = await byCommit(ctx, commitSha);
873
1467
  if (r.ok) {
874
1468
  release = r.body;
@@ -911,10 +1505,10 @@ __export(domains_exports, {
911
1505
  customRemove: () => customRemove,
912
1506
  customRetry: () => customRetry,
913
1507
  findHostname: () => findHostname,
914
- get: () => get3,
1508
+ get: () => get5,
915
1509
  set: () => set
916
1510
  });
917
- function get3(ctx) {
1511
+ function get5(ctx) {
918
1512
  return call(
919
1513
  ctx,
920
1514
  "GET",
@@ -995,9 +1589,9 @@ __export(email_exports, {
995
1589
  batch: () => batch2,
996
1590
  batches: () => batches,
997
1591
  checkDomain: () => checkDomain,
998
- get: () => get4,
1592
+ get: () => get6,
999
1593
  inbox: () => inbox,
1000
- list: () => list5,
1594
+ list: () => list6,
1001
1595
  listDomains: () => listDomains,
1002
1596
  removeDomain: () => removeDomain,
1003
1597
  stats: () => stats2,
@@ -1032,14 +1626,14 @@ async function resolveDomainId(ctx, direction, domain) {
1032
1626
  }
1033
1627
  return match.id;
1034
1628
  }
1035
- function list5(ctx, params = {}) {
1629
+ function list6(ctx, params = {}) {
1036
1630
  return call(
1037
1631
  ctx,
1038
1632
  "GET",
1039
1633
  `/_internal/v2/apps/${ctx.appId}/outbound-email/messages${qs(params)}`
1040
1634
  );
1041
1635
  }
1042
- function get4(ctx, messageId) {
1636
+ function get6(ctx, messageId) {
1043
1637
  return call(
1044
1638
  ctx,
1045
1639
  "GET",
@@ -1229,38 +1823,38 @@ function remove(ctx, ref) {
1229
1823
  // src/ops/infra.ts
1230
1824
  var infra_exports = {};
1231
1825
  __export(infra_exports, {
1232
- DEFAULT_WAIT_TIMEOUT_MS: () => DEFAULT_WAIT_TIMEOUT_MS2,
1826
+ DEFAULT_WAIT_TIMEOUT_MS: () => DEFAULT_WAIT_TIMEOUT_MS4,
1233
1827
  destroy: () => destroy,
1234
- get: () => get5,
1828
+ get: () => get7,
1235
1829
  hibernate: () => hibernate,
1236
- list: () => list6,
1830
+ list: () => list7,
1237
1831
  provision: () => provision,
1238
1832
  rename: () => rename,
1239
1833
  resize: () => resize,
1240
- resume: () => resume,
1834
+ resume: () => resume2,
1241
1835
  waitForPhase: () => waitForPhase
1242
1836
  });
1243
- var DEFAULT_WAIT_TIMEOUT_MS2 = 10 * 60 * 1e3;
1244
- var POLL_MS3 = 3e3;
1245
- function base2(appId) {
1837
+ var DEFAULT_WAIT_TIMEOUT_MS4 = 10 * 60 * 1e3;
1838
+ var POLL_MS5 = 3e3;
1839
+ function base6(appId) {
1246
1840
  return `/_internal/v2/apps/${appId}/infra`;
1247
1841
  }
1248
- function list6(ctx, params) {
1842
+ function list7(ctx, params) {
1249
1843
  return call(
1250
1844
  ctx,
1251
1845
  "GET",
1252
- `${base2(ctx.appId)}${params?.includeDestroyed ? "?includeDestroyed=true" : ""}`
1846
+ `${base6(ctx.appId)}${params?.includeDestroyed ? "?includeDestroyed=true" : ""}`
1253
1847
  );
1254
1848
  }
1255
- function get5(ctx, params) {
1849
+ function get7(ctx, params) {
1256
1850
  return call(
1257
1851
  ctx,
1258
1852
  "GET",
1259
- `${base2(ctx.appId)}/${encodeURIComponent(params.id)}`
1853
+ `${base6(ctx.appId)}/${encodeURIComponent(params.id)}`
1260
1854
  );
1261
1855
  }
1262
1856
  function provision(ctx, params) {
1263
- return call(ctx, "POST", base2(ctx.appId), {
1857
+ return call(ctx, "POST", base6(ctx.appId), {
1264
1858
  offeringId: params.offeringId,
1265
1859
  ...params.name ? { name: params.name } : {}
1266
1860
  });
@@ -1269,28 +1863,28 @@ function hibernate(ctx, params) {
1269
1863
  return call(
1270
1864
  ctx,
1271
1865
  "POST",
1272
- `${base2(ctx.appId)}/${encodeURIComponent(params.id)}/hibernate`
1866
+ `${base6(ctx.appId)}/${encodeURIComponent(params.id)}/hibernate`
1273
1867
  );
1274
1868
  }
1275
- function resume(ctx, params) {
1869
+ function resume2(ctx, params) {
1276
1870
  return call(
1277
1871
  ctx,
1278
1872
  "POST",
1279
- `${base2(ctx.appId)}/${encodeURIComponent(params.id)}/resume`
1873
+ `${base6(ctx.appId)}/${encodeURIComponent(params.id)}/resume`
1280
1874
  );
1281
1875
  }
1282
1876
  function destroy(ctx, params) {
1283
1877
  return call(
1284
1878
  ctx,
1285
1879
  "POST",
1286
- `${base2(ctx.appId)}/${encodeURIComponent(params.id)}/destroy`
1880
+ `${base6(ctx.appId)}/${encodeURIComponent(params.id)}/destroy`
1287
1881
  );
1288
1882
  }
1289
1883
  function resize(ctx, params) {
1290
1884
  return call(
1291
1885
  ctx,
1292
1886
  "POST",
1293
- `${base2(ctx.appId)}/${encodeURIComponent(params.id)}/resize`,
1887
+ `${base6(ctx.appId)}/${encodeURIComponent(params.id)}/resize`,
1294
1888
  { offeringId: params.offeringId }
1295
1889
  );
1296
1890
  }
@@ -1298,56 +1892,40 @@ function rename(ctx, params) {
1298
1892
  return call(
1299
1893
  ctx,
1300
1894
  "POST",
1301
- `${base2(ctx.appId)}/${encodeURIComponent(params.id)}/rename`,
1895
+ `${base6(ctx.appId)}/${encodeURIComponent(params.id)}/rename`,
1302
1896
  { name: params.name }
1303
1897
  );
1304
1898
  }
1305
1899
  async function waitForPhase(ctx, params) {
1306
- const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS2;
1900
+ const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS4;
1307
1901
  const wanted = new Set(params.phases);
1308
- const start = Date.now();
1309
- let transientSince = null;
1310
- for (; ; ) {
1311
- let resource;
1312
- try {
1313
- ({ resource } = await get5(ctx, { id: params.id }));
1314
- transientSince = null;
1315
- } catch (err) {
1316
- if (!isTransientError(err)) {
1317
- throw err;
1318
- }
1319
- transientSince ??= Date.now();
1320
- if (Date.now() - transientSince > TRANSIENT_GRACE_MS) {
1321
- throw err;
1322
- }
1323
- params.onProgress?.(
1324
- `retrying after a gateway error\u2026 (${Math.round((Date.now() - start) / 1e3)}s)`
1325
- );
1326
- await sleep(POLL_MS3);
1327
- continue;
1328
- }
1329
- if (wanted.has(resource.phase) && (params.until?.(resource) ?? true)) {
1330
- return { status: "done", resource };
1331
- }
1332
- if (resource.phase === "failed") {
1333
- return {
1334
- status: "failed",
1335
- resource,
1336
- error: resource.lastError ?? "The platform could not complete the change."
1337
- };
1338
- }
1339
- if (Date.now() - start > timeoutMs) {
1340
- return {
1341
- status: "timeout",
1342
- resource,
1343
- error: `Timed out after ${Math.round(timeoutMs / 1e3)}s; resource is still ${resource.phase}`
1344
- };
1902
+ const arrived = (resource2) => wanted.has(resource2.phase) && (params.until?.(resource2) ?? true);
1903
+ const outcome = await pollUntil(
1904
+ async () => (await get7(ctx, { id: params.id })).resource,
1905
+ (resource2) => arrived(resource2) || resource2.phase === "failed",
1906
+ {
1907
+ timeoutMs,
1908
+ pollMs: POLL_MS5,
1909
+ describe: (resource2, start2) => `${resource2.phase}${resource2.detail ? ` \xB7 ${resource2.detail}` : ""}${resource2.resizingTo ? ` \xB7 resizing to ${resource2.resizingTo.label}` : ""}\u2026 (${elapsedSeconds(start2)}s)`,
1910
+ onProgress: params.onProgress
1345
1911
  }
1346
- params.onProgress?.(
1347
- `${resource.phase}${resource.detail ? ` \xB7 ${resource.detail}` : ""}${resource.resizingTo ? ` \xB7 resizing to ${resource.resizingTo.label}` : ""}\u2026 (${Math.round((Date.now() - start) / 1e3)}s)`
1348
- );
1349
- await sleep(POLL_MS3);
1912
+ );
1913
+ const resource = outcome.value;
1914
+ if (!outcome.settled) {
1915
+ return {
1916
+ status: "timeout",
1917
+ resource,
1918
+ error: timedOut(timeoutMs, `; resource is still ${resource.phase}`)
1919
+ };
1920
+ }
1921
+ if (arrived(resource)) {
1922
+ return { status: "done", resource };
1350
1923
  }
1924
+ return {
1925
+ status: "failed",
1926
+ resource,
1927
+ error: resource.lastError ?? "The platform could not complete the change."
1928
+ };
1351
1929
  }
1352
1930
 
1353
1931
  // src/ops/issues.ts
@@ -1358,18 +1936,18 @@ __export(issues_exports, {
1358
1936
  create: () => create2,
1359
1937
  del: () => del,
1360
1938
  edit: () => edit,
1361
- get: () => get6,
1362
- list: () => list7,
1939
+ get: () => get8,
1940
+ list: () => list8,
1363
1941
  reopen: () => reopen
1364
1942
  });
1365
- function list7(ctx, params = {}) {
1943
+ function list8(ctx, params = {}) {
1366
1944
  return call(
1367
1945
  ctx,
1368
1946
  "GET",
1369
1947
  `/_internal/v2/apps/${ctx.appId}/issues${qs(params)}`
1370
1948
  );
1371
1949
  }
1372
- function get6(ctx, number) {
1950
+ function get8(ctx, number) {
1373
1951
  return call(
1374
1952
  ctx,
1375
1953
  "GET",
@@ -1453,7 +2031,7 @@ __export(jewels_exports, {
1453
2031
  JEWEL_RUN_TIMEOUT_MS: () => JEWEL_RUN_TIMEOUT_MS,
1454
2032
  dryrun: () => dryrun,
1455
2033
  exportSummary: () => exportSummary,
1456
- getRun: () => getRun,
2034
+ getRun: () => getRun2,
1457
2035
  grade: () => grade,
1458
2036
  overview: () => overview,
1459
2037
  pair: () => pair,
@@ -1550,7 +2128,7 @@ function runs(ctx, params = {}) {
1550
2128
  `/_internal/v2/apps/${ctx.appId}/jewels/training-runs${qs(params)}`
1551
2129
  );
1552
2130
  }
1553
- function getRun(ctx, runId) {
2131
+ function getRun2(ctx, runId) {
1554
2132
  return call(
1555
2133
  ctx,
1556
2134
  "GET",
@@ -1571,9 +2149,9 @@ function grade(ctx, runId) {
1571
2149
  var methods_exports = {};
1572
2150
  __export(methods_exports, {
1573
2151
  invoke: () => invoke,
1574
- list: () => list8
2152
+ list: () => list9
1575
2153
  });
1576
- async function list8(ctx) {
2154
+ async function list9(ctx) {
1577
2155
  const dashboard = await call(
1578
2156
  ctx,
1579
2157
  "GET",
@@ -1630,19 +2208,19 @@ function invalidate(ctx, params = {}) {
1630
2208
  // src/ops/requests.ts
1631
2209
  var requests_exports = {};
1632
2210
  __export(requests_exports, {
1633
- get: () => get7,
1634
- list: () => list9,
2211
+ get: () => get9,
2212
+ list: () => list10,
1635
2213
  statsForMethod: () => statsForMethod,
1636
2214
  statsSummary: () => statsSummary
1637
2215
  });
1638
- function list9(ctx, params = {}) {
2216
+ function list10(ctx, params = {}) {
1639
2217
  return call(
1640
2218
  ctx,
1641
2219
  "GET",
1642
2220
  `/_internal/v2/apps/${ctx.appId}/requests${qs(params)}`
1643
2221
  );
1644
2222
  }
1645
- function get7(ctx, requestId) {
2223
+ function get9(ctx, requestId) {
1646
2224
  return call(
1647
2225
  ctx,
1648
2226
  "GET",
@@ -1668,18 +2246,18 @@ function statsForMethod(ctx, methodId, params = {}) {
1668
2246
  var secrets_exports = {};
1669
2247
  __export(secrets_exports, {
1670
2248
  del: () => del2,
1671
- get: () => get8,
1672
- list: () => list10,
2249
+ get: () => get10,
2250
+ list: () => list11,
1673
2251
  set: () => set2
1674
2252
  });
1675
- function list10(ctx) {
2253
+ function list11(ctx) {
1676
2254
  return call(
1677
2255
  ctx,
1678
2256
  "GET",
1679
2257
  `/_internal/v2/apps/${ctx.appId}/secrets`
1680
2258
  );
1681
2259
  }
1682
- function get8(ctx, key) {
2260
+ function get10(ctx, key) {
1683
2261
  return call(
1684
2262
  ctx,
1685
2263
  "GET",
@@ -1735,11 +2313,11 @@ function updateSettings(ctx, partial) {
1735
2313
  var users_exports = {};
1736
2314
  __export(users_exports, {
1737
2315
  createApiKey: () => createApiKey,
1738
- list: () => list11,
2316
+ list: () => list12,
1739
2317
  revokeApiKey: () => revokeApiKey,
1740
2318
  setRole: () => setRole
1741
2319
  });
1742
- function list11(ctx, params = {}) {
2320
+ function list12(ctx, params = {}) {
1743
2321
  return call(
1744
2322
  ctx,
1745
2323
  "GET",
@@ -1925,6 +2503,10 @@ function buildClient(ctx) {
1925
2503
  cron: bindOps(cron_exports, ctx),
1926
2504
  data: bindOps(data_exports, ctx),
1927
2505
  dataSources: bindOps(dataSources_exports, ctx),
2506
+ dataSourceJobs: bindOps(dataSourceJobs_exports, ctx),
2507
+ dataSourceConnectors: bindOps(dataSourceConnectors_exports, ctx),
2508
+ dataSourceEvals: bindOps(dataSourceEvals_exports, ctx),
2509
+ dataSourceMappers: bindOps(dataSourceMappers_exports, ctx),
1928
2510
  db: bindOps(db_exports, ctx),
1929
2511
  diagnostics: bindOps(diagnostics_exports, ctx),
1930
2512
  domains: bindOps(domains_exports, ctx),