@madewithremy/admin 0.1.20 → 0.1.22

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.d.ts CHANGED
@@ -1009,6 +1009,17 @@ interface DataLiftFromLiveResult {
1009
1009
  * Ops are pure: (ctx, params) → typed result. No printing, no process coupling.
1010
1010
  */
1011
1011
 
1012
+ interface LiftFromDevParams {
1013
+ /**
1014
+ * Which dev session to lift from, by dev release id. An app has a dev session per workspace — one
1015
+ * per person's box, one per person's CLI — so this is required once more than one is open. The
1016
+ * server refuses rather than picking: promoting the wrong workspace's data over live is not
1017
+ * recoverable, and nothing in the request would show it had happened.
1018
+ *
1019
+ * The ids are on the dashboard's `devSessions`, and the `ambiguous_dev_session` error lists them.
1020
+ */
1021
+ releaseId?: string;
1022
+ }
1012
1023
  /**
1013
1024
  * Destructively copy every dev-release database over the live-release databases.
1014
1025
  *
@@ -1019,18 +1030,27 @@ interface DataLiftFromLiveResult {
1019
1030
  * AND `--confirm` as a double-gate; the op always sends `{ confirm: true }`.
1020
1031
  *
1021
1032
  * @throws AdminApiError `no_dev_session` (404) — no dev release exists (start a dev session first);
1022
- * `no_live_release` (404) — app has never been published (publish first, then lift).
1033
+ * `no_live_release` (404) — app has never been published (publish first, then lift);
1034
+ * `ambiguous_dev_session` (400) — the app has several dev sessions open, so `releaseId` is
1035
+ * required; the error message lists the open ones.
1023
1036
  * @example
1024
1037
  * const result = await admin.data.liftFromDev();
1025
1038
  * console.log(`Lifted ${result.databasesAffected.length} databases to live`);
1039
+ * // With more than one dev session open, name the one you mean:
1040
+ * await admin.data.liftFromDev({ releaseId: '8f2c1e04-...' });
1026
1041
  */
1027
- declare function liftFromDev(ctx: AdminContext): Promise<DataLiftFromDevResult>;
1042
+ declare function liftFromDev(ctx: AdminContext, params?: LiftFromDevParams): Promise<DataLiftFromDevResult>;
1028
1043
  interface LiftFromLiveParams {
1029
1044
  /**
1030
1045
  * Empty dev databases in place — clears all rows, keeps schema and IDs,
1031
1046
  * no data read from live. Defaults to false (full copy from live).
1032
1047
  */
1033
1048
  truncate?: boolean;
1049
+ /**
1050
+ * Which dev session to overwrite, by dev release id. Required once the app has more than one
1051
+ * open — see `LiftFromDevParams.releaseId`.
1052
+ */
1053
+ releaseId?: string;
1034
1054
  }
1035
1055
  /**
1036
1056
  * Destructively replace dev-release databases with the live-release databases,
@@ -1043,7 +1063,8 @@ interface LiftFromLiveParams {
1043
1063
  * `lift-live-to-dev`.
1044
1064
  *
1045
1065
  * @throws AdminApiError `no_dev_session` (404) — no dev release exists (start a dev session first);
1046
- * `no_live_release` (404) — no live release (copy mode only; not thrown when `truncate` is true).
1066
+ * `no_live_release` (404) — no live release (copy mode only; not thrown when `truncate` is true);
1067
+ * `ambiguous_dev_session` (400) — several dev sessions are open, so `releaseId` is required.
1047
1068
  * @example
1048
1069
  * // Pull live data into dev for debugging:
1049
1070
  * await admin.data.liftFromLive();
@@ -1052,11 +1073,12 @@ interface LiftFromLiveParams {
1052
1073
  */
1053
1074
  declare function liftFromLive(ctx: AdminContext, params?: LiftFromLiveParams): Promise<DataLiftFromLiveResult>;
1054
1075
 
1076
+ type data_LiftFromDevParams = LiftFromDevParams;
1055
1077
  type data_LiftFromLiveParams = LiftFromLiveParams;
1056
1078
  declare const data_liftFromDev: typeof liftFromDev;
1057
1079
  declare const data_liftFromLive: typeof liftFromLive;
1058
1080
  declare namespace data {
1059
- export { type data_LiftFromLiveParams as LiftFromLiveParams, data_liftFromDev as liftFromDev, data_liftFromLive as liftFromLive };
1081
+ export { type data_LiftFromDevParams as LiftFromDevParams, type data_LiftFromLiveParams as LiftFromLiveParams, data_liftFromDev as liftFromDev, data_liftFromLive as liftFromLive };
1060
1082
  }
1061
1083
 
1062
1084
  /**
@@ -2631,13 +2653,26 @@ interface MoveParams {
2631
2653
  restart?: boolean;
2632
2654
  /**
2633
2655
  * Parallel chains to copy with, instead of the target size's default (XL 32,
2634
- * Large 16, Medium 8, Small 4; max 128). The platform runs eight chains per
2635
- * worker, so this is the worker count times eight. Takes effect when the
2656
+ * Large 16, Medium 8, Small 4; max 128). The platform runs four chains per
2657
+ * worker, so this is the worker count times four. Takes effect when the
2636
2658
  * copy's windows are cut: with a move already under way, pair it with
2637
2659
  * `restart`.
2638
2660
  */
2639
2661
  chains?: number;
2640
2662
  }
2663
+ /**
2664
+ * Halt a move under way. Its chains stop at their next checkpoint and the
2665
+ * record reads `error: "Stopped by operator."`; a plain `move` to the same
2666
+ * target resumes from the chains' cursors.
2667
+ *
2668
+ * @throws AdminApiError `data_source_not_found` (404), `no_move_in_flight`
2669
+ * (422) when nothing is being moved.
2670
+ * @example
2671
+ * await admin.dataSources.stopMove({ slug: 'archive' });
2672
+ */
2673
+ declare function stopMove(ctx: AdminContext, params: {
2674
+ slug: string;
2675
+ }): Promise<DataSourcesMoveResult>;
2641
2676
  /**
2642
2677
  * Move a data source between placements: shared → dedicated, dedicated →
2643
2678
  * shared, or one resource to another.
@@ -2839,12 +2874,13 @@ declare const dataSources_rm: typeof rm;
2839
2874
  declare const dataSources_rmWhere: typeof rmWhere;
2840
2875
  declare const dataSources_rmWhereAll: typeof rmWhereAll;
2841
2876
  declare const dataSources_search: typeof search;
2877
+ declare const dataSources_stopMove: typeof stopMove;
2842
2878
  declare const dataSources_summarize: typeof summarize;
2843
2879
  declare const dataSources_waitForCandidate: typeof waitForCandidate;
2844
2880
  declare const dataSources_waitForIngest: typeof waitForIngest;
2845
2881
  declare const dataSources_waitForMove: typeof waitForMove;
2846
2882
  declare namespace dataSources {
2847
- export { type dataSources_AddDocumentParams as AddDocumentParams, type dataSources_AddDocumentResult as AddDocumentResult, type dataSources_ConfigSetParams as ConfigSetParams, type dataSources_CountParams as CountParams, type dataSources_CreateParams as CreateParams, DEFAULT_WAIT_TIMEOUT_MS$3 as DEFAULT_WAIT_TIMEOUT_MS, dataSources_DOCUMENTS_IDS_MAX as DOCUMENTS_IDS_MAX, type dataSources_DocumentsParams as DocumentsParams, type dataSources_DropParams as DropParams, dataSources_FAILURES_PAGE as FAILURES_PAGE, type dataSources_MoveParams as MoveParams, type dataSources_PromoteParams as PromoteParams, type dataSources_RevectorizeParams as RevectorizeParams, type dataSources_RmParams as RmParams, type dataSources_RmWhereParams as RmWhereParams, type dataSources_SearchParams as SearchParams, type dataSources_SummarizedDocument as SummarizedDocument, type dataSources_WaitForCandidateParams as WaitForCandidateParams, type dataSources_WaitForCandidateResult as WaitForCandidateResult, type dataSources_WaitForIngestParams as WaitForIngestParams, type dataSources_WaitForIngestResult as WaitForIngestResult, type dataSources_WaitForMoveParams as WaitForMoveParams, type dataSources_WaitForMoveResult as WaitForMoveResult, dataSources_addDocument as addDocument, dataSources_allDocuments as allDocuments, dataSources_configGet as configGet, dataSources_configSet as configSet, dataSources_count as count, create$1 as create, dataSources_deleteSource as deleteSource, dataSources_documents as documents, dataSources_drop as drop, list$8 as list, dataSources_move as move, dataSources_promote as promote, dataSources_revectorize as revectorize, dataSources_rm as rm, dataSources_rmWhere as rmWhere, dataSources_rmWhereAll as rmWhereAll, dataSources_search as search, dataSources_summarize as summarize, dataSources_waitForCandidate as waitForCandidate, dataSources_waitForIngest as waitForIngest, dataSources_waitForMove as waitForMove };
2883
+ export { type dataSources_AddDocumentParams as AddDocumentParams, type dataSources_AddDocumentResult as AddDocumentResult, type dataSources_ConfigSetParams as ConfigSetParams, type dataSources_CountParams as CountParams, type dataSources_CreateParams as CreateParams, DEFAULT_WAIT_TIMEOUT_MS$3 as DEFAULT_WAIT_TIMEOUT_MS, dataSources_DOCUMENTS_IDS_MAX as DOCUMENTS_IDS_MAX, type dataSources_DocumentsParams as DocumentsParams, type dataSources_DropParams as DropParams, dataSources_FAILURES_PAGE as FAILURES_PAGE, type dataSources_MoveParams as MoveParams, type dataSources_PromoteParams as PromoteParams, type dataSources_RevectorizeParams as RevectorizeParams, type dataSources_RmParams as RmParams, type dataSources_RmWhereParams as RmWhereParams, type dataSources_SearchParams as SearchParams, type dataSources_SummarizedDocument as SummarizedDocument, type dataSources_WaitForCandidateParams as WaitForCandidateParams, type dataSources_WaitForCandidateResult as WaitForCandidateResult, type dataSources_WaitForIngestParams as WaitForIngestParams, type dataSources_WaitForIngestResult as WaitForIngestResult, type dataSources_WaitForMoveParams as WaitForMoveParams, type dataSources_WaitForMoveResult as WaitForMoveResult, dataSources_addDocument as addDocument, dataSources_allDocuments as allDocuments, dataSources_configGet as configGet, dataSources_configSet as configSet, dataSources_count as count, create$1 as create, dataSources_deleteSource as deleteSource, dataSources_documents as documents, dataSources_drop as drop, list$8 as list, dataSources_move as move, dataSources_promote as promote, dataSources_revectorize as revectorize, dataSources_rm as rm, dataSources_rmWhere as rmWhere, dataSources_rmWhereAll as rmWhereAll, dataSources_search as search, dataSources_stopMove as stopMove, dataSources_summarize as summarize, dataSources_waitForCandidate as waitForCandidate, dataSources_waitForIngest as waitForIngest, dataSources_waitForMove as waitForMove };
2848
2884
  }
2849
2885
 
2850
2886
  /**
@@ -4665,7 +4701,9 @@ type InfraDesiredState = 'active' | 'hibernated' | 'destroyed';
4665
4701
  * back from durable storage (a new pod found their index empty); searches on
4666
4702
  * those sources answer `index_warming` with the copy's progress until it lands.
4667
4703
  */
4668
- type InfraHealth = 'ready' | 'not-ready' | 'missing' | 'rebuilding';
4704
+ type InfraHealth = 'ready' | 'not-ready' | 'missing' | 'rebuilding'
4705
+ /** Serving in Qdrant's low-memory mode after repeated out-of-memory restarts, until memory settles. */
4706
+ | 'degraded';
4669
4707
  /** A leasable product from the platform catalog. Prices are cogs + margin. */
4670
4708
  interface InfraOffering {
4671
4709
  id: string;
@@ -4736,6 +4774,24 @@ interface InfraResource {
4736
4774
  measuredAt: string | null;
4737
4775
  usableDiskBytes: number;
4738
4776
  } | null;
4777
+ /**
4778
+ * The instance's resident memory against the limit it is killed at, as
4779
+ * last sampled; null until the platform has observed the instance.
4780
+ */
4781
+ memory: {
4782
+ residentBytes: number;
4783
+ limitBytes: number;
4784
+ sampledAt: string;
4785
+ } | null;
4786
+ /**
4787
+ * How often the instance has restarted and why it last stopped (`OOMKilled`,
4788
+ * `Error`); null until observed. `infra logs` carries each restart as a line.
4789
+ */
4790
+ restarts: {
4791
+ count: number;
4792
+ lastReason: string | null;
4793
+ lastAt: string | null;
4794
+ } | null;
4739
4795
  /**
4740
4796
  * The size this resource is being resized to, while a resize is under way;
4741
4797
  * null otherwise. A resize passes through `hibernated` and back to the phase
@@ -6060,7 +6116,7 @@ interface DashboardLiveRelease {
6060
6116
  /**
6061
6117
  * Response from GET /_internal/v2/apps/:appId/dashboard.
6062
6118
  * Only the fields used by this CLI are typed; the full shape
6063
- * (interfaces detail, previewReleases, devSession) is wider.
6119
+ * (interfaces detail, previewReleases, devSessions) is wider.
6064
6120
  */
6065
6121
  interface DashboardResult {
6066
6122
  appId: string;
@@ -6071,7 +6127,12 @@ interface DashboardResult {
6071
6127
  releases: ReleaseFragment[];
6072
6128
  interfaces: Record<string, unknown>;
6073
6129
  previewReleases: unknown[];
6074
- devSession: Record<string, unknown>;
6130
+ /**
6131
+ * One per workspace with a dev session open — a person's box, a person's CLI — and empty when
6132
+ * none is. Each carries the `releaseId` that names it, which is what the destructive data ops
6133
+ * take to say which session they mean.
6134
+ */
6135
+ devSessions: Array<Record<string, unknown>>;
6075
6136
  }
6076
6137
 
6077
6138
  /**
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import fs from "fs";
9
9
  import path from "path";
10
10
 
11
11
  // src/config.ts
12
- var WORKSPACE_DIR = process.env["WORKSPACE_DIR"] || "/home/vercel-sandbox/workspace";
12
+ var WORKSPACE_DIR = process.env["WORKSPACE_DIR"] || "/home/remy/workspace";
13
13
 
14
14
  // src/parseJsonConfig.ts
15
15
  import JSON5 from "json5";
@@ -339,12 +339,15 @@ __export(data_exports, {
339
339
  liftFromDev: () => liftFromDev,
340
340
  liftFromLive: () => liftFromLive
341
341
  });
342
- function liftFromDev(ctx) {
342
+ function liftFromDev(ctx, params = {}) {
343
343
  return call(
344
344
  ctx,
345
345
  "POST",
346
346
  `/_internal/v2/apps/${ctx.appId}/manage/lift-dev-to-live`,
347
- { confirm: true }
347
+ {
348
+ confirm: true,
349
+ ...params.releaseId ? { releaseId: params.releaseId } : {}
350
+ }
348
351
  );
349
352
  }
350
353
  function liftFromLive(ctx, params = {}) {
@@ -352,7 +355,11 @@ function liftFromLive(ctx, params = {}) {
352
355
  ctx,
353
356
  "POST",
354
357
  `/_internal/v2/apps/${ctx.appId}/manage/lift-live-to-dev`,
355
- { confirm: true, ...params.truncate ? { mode: "truncate" } : {} }
358
+ {
359
+ confirm: true,
360
+ ...params.truncate ? { mode: "truncate" } : {},
361
+ ...params.releaseId ? { releaseId: params.releaseId } : {}
362
+ }
356
363
  );
357
364
  }
358
365
 
@@ -379,6 +386,7 @@ __export(dataSources_exports, {
379
386
  rmWhere: () => rmWhere,
380
387
  rmWhereAll: () => rmWhereAll,
381
388
  search: () => search,
389
+ stopMove: () => stopMove,
382
390
  summarize: () => summarize,
383
391
  waitForCandidate: () => waitForCandidate,
384
392
  waitForIngest: () => waitForIngest,
@@ -460,6 +468,10 @@ function renderProgress(p, start2, extra) {
460
468
  const rate = p.ratePerMinute !== null && p.ratePerMinute > 0 ? `${Math.round(p.ratePerMinute).toLocaleString()}/min` : null;
461
469
  const parts = [
462
470
  `${p.phase}\u2026`,
471
+ // The operation's own word on what it is doing when the count does not
472
+ // say (a settle building its full-text index); a failure's note is its
473
+ // error and prints on its own line instead.
474
+ p.phase !== "failed" ? p.note : null,
463
475
  count2,
464
476
  rate,
465
477
  describeEta(p.etaAt),
@@ -749,6 +761,14 @@ function create(ctx, params) {
749
761
  ...placement !== void 0 ? { placement } : {}
750
762
  });
751
763
  }
764
+ function stopMove(ctx, params) {
765
+ return call(
766
+ ctx,
767
+ "POST",
768
+ `${base(ctx.appId)}/move/stop`,
769
+ { slug: params.slug }
770
+ );
771
+ }
752
772
  function move(ctx, params) {
753
773
  return call(ctx, "POST", `${base(ctx.appId)}/move`, {
754
774
  slug: params.slug,
@@ -774,8 +794,10 @@ async function waitForMove(ctx, params) {
774
794
  pollMs: POLL_MS,
775
795
  describe: (source2, start2) => renderProgress(source2.migration.progress, start2),
776
796
  // A corpus of any size moves as long as it keeps moving; the timeout
777
- // bounds silence.
778
- progressKey: (source2) => source2.migration?.copied ?? null,
797
+ // bounds silence. The settle moves without copying — it builds the
798
+ // target's full-text index and reports coverage — so its sample time
799
+ // counts as movement too.
800
+ progressKey: (source2) => source2.migration ? `${source2.migration.copied}|${source2.migration.progress.updatedAt ?? ""}` : null,
779
801
  onProgress: params.onProgress
780
802
  }
781
803
  );