@madewithremy/admin 0.1.65 → 0.1.66

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.
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Provisioned-infrastructure operations: lease, park, resume and delete
2
+ * Provisioned-infrastructure operations: lease, hibernate, resume and delete
3
3
  * dedicated resources (retrieval capacity for data sources, and database
4
- * servers for databases past the shared pool's limit).
4
+ * servers for databases past the shared servers' limit).
5
5
  *
6
6
  * Ops are pure (ctx, params) → typed result. The CLI skin in
7
7
  * commands/infra.ts owns flag parsing, progress printing and exit codes.
@@ -83,9 +83,9 @@ export interface ResourceIdParams {
83
83
  id: string;
84
84
  }
85
85
  /**
86
- * Park an active resource. Data is kept and billing stops until it resumes.
87
- * Retrieval: searches on its data sources return `capacity_hibernating` while
88
- * it parks and `capacity_hibernated` once parked. A database server: every
86
+ * Hibernate an active resource. Data is kept and billing stops until it
87
+ * resumes. Retrieval: searches on its data sources return
88
+ * `capacity_hibernating` on the way and `capacity_hibernated` once there. A database server: every
89
89
  * database is backed up first, and its queries answer `database_lease_parked`
90
90
  * until it resumes.
91
91
  *
@@ -103,7 +103,7 @@ export declare function resume(ctx: AdminContext, params: ResourceIdParams): Pro
103
103
  * Retrieval: refused while any data source is placed on it; move those to
104
104
  * shared capacity (`admin.dataSources.move({ placement: 'shared' })`, data
105
105
  * intact) or delete them first. A database server: its databases go back to
106
- * the shared pool, so it's refused while any is too large for the pool to
106
+ * the shared servers, so it's refused while any is too large for them to
107
107
  * take back.
108
108
  *
109
109
  * @throws AdminApiError `resource_not_found` (404),
@@ -118,9 +118,9 @@ export interface ResizeParams {
118
118
  }
119
119
  /**
120
120
  * Change a resource's size, keeping its data. Either kind passes through
121
- * `hibernated`: the platform parks the resource, swaps its spec and brings it
122
- * back up. A resource that is already hibernated swaps in place and stays
123
- * parked. Growing is gated on a month of credits at the new rate like a
121
+ * `hibernated`: the platform hibernates the resource, swaps its spec and
122
+ * brings it back up. A resource that is already hibernated swaps in place and
123
+ * stays hibernated. Growing is gated on a month of credits at the new rate like a
124
124
  * provision; shrinking is refused below what the resource holds. The response
125
125
  * carries `resizingTo` until the swap has happened; `waitForPhase` with
126
126
  * `until: (r) => r.resizingTo === null` blocks on the whole thing.
@@ -172,7 +172,11 @@ export type WaitForPhaseResult = {
172
172
  };
173
173
  /**
174
174
  * Poll a resource until it reaches one of `phases`, fails, or the timeout
175
- * elapses. A `failed` phase returns immediately with the platform's error.
175
+ * elapses. A failure the platform is still retrying is waited through
176
+ * (`retrying`): a resume or hibernate asked of a failed resource reads
177
+ * `failed` until the platform takes its first step, and a transition that
178
+ * timed out once is tried again. One it has given up on returns with the
179
+ * platform's error.
176
180
  *
177
181
  * @example
178
182
  * const result = await admin.infra.waitForPhase({ id, phases: ['active'] });
package/dist/prod.js CHANGED
@@ -9608,7 +9608,7 @@ async function waitForPhase(ctx, params) {
9608
9608
  const arrived = (resource2) => wanted.has(resource2.phase) && (params.until?.(resource2) ?? true);
9609
9609
  const outcome = await pollUntil(
9610
9610
  async () => (await get11(ctx, { id: params.id })).resource,
9611
- (resource2) => arrived(resource2) || resource2.phase === "failed",
9611
+ (resource2) => arrived(resource2) || resource2.phase === "failed" && !resource2.retrying,
9612
9612
  {
9613
9613
  timeoutMs,
9614
9614
  pollMs: POLL_MS5,
@@ -9760,8 +9760,7 @@ function pricingOf(resource) {
9760
9760
  return {
9761
9761
  offering: offering.id,
9762
9762
  activeMonthlyDollars: offering.monthlyPriceDollars,
9763
- hibernatedMonthlyDollars: offering.hibernatedMonthlyPriceDollars,
9764
- note: "Bills hourly from activation. A month's credits were verified before the lease was accepted."
9763
+ note: "Bills hourly while active, and nothing while hibernated. A month's credits were verified before the lease was accepted."
9765
9764
  };
9766
9765
  }
9767
9766
  async function infraProvision(ctx, a) {
@@ -9822,10 +9821,8 @@ async function infraRename(ctx, a) {
9822
9821
  }
9823
9822
  async function infraResize(ctx, a) {
9824
9823
  const id = a.required("id");
9825
- const { resource } = await resize(ctx, {
9826
- id,
9827
- offeringId: a.str("offering")
9828
- });
9824
+ const offeringId = a.str("offering");
9825
+ const { resource } = await resize(ctx, { id, offeringId });
9829
9826
  const pricing = pricingOf({
9830
9827
  ...resource,
9831
9828
  offering: resource.resizingTo ?? resource.offering
@@ -9834,7 +9831,7 @@ async function infraResize(ctx, a) {
9834
9831
  printJson({
9835
9832
  resource,
9836
9833
  pricing,
9837
- note: `Resizing; ${resource.kind === "database" ? "the app's queries pause" : "searches on its sources pause"} while it is parked and restored. Poll \`infra get <id>\` or re-run with --wait.`
9834
+ note: `Resizing; ${resource.kind === "database" ? "the app's queries pause" : "searches on its sources pause"} while it is hibernated and restored. Poll \`infra get <id>\` or re-run with --wait.`
9838
9835
  });
9839
9836
  return;
9840
9837
  }
@@ -9844,7 +9841,9 @@ async function infraResize(ctx, a) {
9844
9841
  id,
9845
9842
  [resource.phase],
9846
9843
  { action: "resize", pricing },
9847
- (r) => r.resizingTo === null
9844
+ // On the size asked for, not only settled: a resize the platform gave up
9845
+ // on also clears, back at the old size.
9846
+ (r) => r.resizingTo === null && r.offeringId === offeringId
9848
9847
  );
9849
9848
  }
9850
9849
  var infraHandlers = {
@@ -9860,9 +9859,9 @@ var infraHandlers = {
9860
9859
  };
9861
9860
  var infraHelp = `remy-admin infra \u2014 Dedicated infrastructure your app leases from the platform.
9862
9861
 
9863
- Two kinds, each isolated from the shared pool: \`retrieval\`, the app's own
9864
- vector-store capacity for data sources, and \`database\`, a database server of
9865
- the app's own for databases past the shared pool's limit. Sizes and prices come
9862
+ Two kinds, each the app's own: \`retrieval\`, vector-store capacity for its
9863
+ data sources in place of the shared pool, and \`database\`, a database server
9864
+ for databases past the shared servers' limit. Sizes and prices come
9866
9865
  from the platform catalog (\`infra list\` prints them, by kind); nothing is
9867
9866
  priced client-side.
9868
9867
 
@@ -9880,11 +9879,11 @@ Subcommands:
9880
9879
  logs The platform's log for a resource (--follow to keep reading)
9881
9880
  provision Lease a new resource (needs a month's credits; prints the price;
9882
9881
  one database server an app)
9883
- hibernate Park it: data kept, its searches or queries paused, the charge stops
9882
+ hibernate Hibernate it: data kept, its searches or queries paused, the charge stops
9884
9883
  resume Bring a hibernated resource back (needs a month's credits)
9885
9884
  resize Change its size, data intact (passes through hibernated)
9886
9885
  destroy Delete it (retrieval: refused while data sources are placed on it;
9887
- database: while a database is too large for the shared pool)
9886
+ database: while a database is too large for the shared servers)
9888
9887
  rename Change the display name
9889
9888
 
9890
9889
  Usage:
@@ -9911,7 +9910,7 @@ Placing a data source on a resource:
9911
9910
  leaves a resource you mean to destroy. See \`datasources --help\`.
9912
9911
 
9913
9912
  Searches on a source whose resource is not active fail with
9914
- capacity_<phase>: capacity_hibernated once parked, capacity_hibernating /
9913
+ capacity_<phase>: capacity_hibernated once hibernated, capacity_hibernating /
9915
9914
  capacity_resuming while it moves. Once active, a source whose index is being
9916
9915
  rebuilt from durable storage (after a resume, a resize or a lost node)
9917
9916
  answers index_warming with the rebuild's progress and ETA until it lands;
@@ -9919,11 +9918,11 @@ Placing a data source on a resource:
9919
9918
  progress. The messages are written for the app's end user; the stable code
9920
9919
  is what to act on.
9921
9920
 
9922
- Dedicated databases:
9921
+ Database servers:
9923
9922
  A database server takes the app's live databases as it first becomes active,
9924
- each one let go by the shared pool and served there from then on, under the
9925
- size's own limit (\`maxDatabaseGiB\` on the offering) in place of the shared
9926
- pool's. A release the app deploys keeps its databases there. Nothing in the
9923
+ each one let go by the shared servers and served there from then on, under
9924
+ the size's own limit (\`maxDatabaseGiB\` on the offering, in GB) in place of
9925
+ the shared servers'. A release the app deploys keeps its databases there. Nothing in the
9927
9926
  app changes: the same queries, routed to it by the platform. An app has one:
9928
9927
  a second is refused with database_server_exists (422); resize the one it has.
9929
9928
 
@@ -23,7 +23,7 @@ export type InfraHealth = 'ready' | 'not-ready' | 'missing' | 'rebuilding'
23
23
  /**
24
24
  * What a resource is: `retrieval`, vector-store capacity of the app's own for
25
25
  * its data sources, or `database`, a database server of the app's own for
26
- * databases past the shared pool's limit.
26
+ * databases past the shared servers' limit.
27
27
  */
28
28
  export type InfraKind = 'retrieval' | 'database';
29
29
  /** What a retrieval size holds. */
@@ -53,20 +53,15 @@ export interface InfraOffering {
53
53
  /** User-facing capacity, e.g. "Up to ~34M chunks at 2560 dimensions (~48M at 1024, ~26M at 4096)". */
54
54
  description: string;
55
55
  hourlyPriceDollars: number;
56
- /** Hourly × 730. */
57
- monthlyPriceDollars: number;
58
56
  /**
59
- * Zero: a hibernated resource holds nothing. A retrieval resource's sources'
60
- * documents stay in the platform's own store; a database server's databases
61
- * are backed up there as it parks.
57
+ * Hourly × 730. Only an active resource bills: hibernated, it holds nothing
58
+ * and costs nothing. A retrieval resource's sources' documents stay in the
59
+ * platform's own store, and a database server's databases are backed up
60
+ * there as it hibernates.
62
61
  */
63
- hibernatedHourlyPriceDollars: number;
64
- hibernatedMonthlyPriceDollars: number;
62
+ monthlyPriceDollars: number;
65
63
  /** What the size holds, by kind. */
66
64
  capacity: InfraRetrievalCapacity | InfraDatabaseCapacity;
67
- capabilities: {
68
- hibernate: boolean;
69
- };
70
65
  retired: boolean;
71
66
  }
72
67
  export interface InfraResource {
@@ -81,6 +76,13 @@ export interface InfraResource {
81
76
  /** Data sources placed on this resource (retrieval). Destroy is refused while > 0. */
82
77
  attachedSources: number;
83
78
  lastError: string | null;
79
+ /** A failed resource: the phase it failed in. Null otherwise. */
80
+ failedIn: InfraPhase | null;
81
+ /**
82
+ * A failed resource: whether the platform is still retrying it. False once
83
+ * it waits to be resumed, hibernated or destroyed.
84
+ */
85
+ retrying: boolean;
84
86
  /** Null until the instance exists (requested, hibernated, destroyed). */
85
87
  health: InfraHealth | null;
86
88
  /**
@@ -142,11 +144,10 @@ export interface InfraResource {
142
144
  resizingTo: InfraOffering | null;
143
145
  /**
144
146
  * What this resource has actually been charged, from the ledger's own
145
- * writes, with the hours at each rate beside it. Rates are on `offering`.
147
+ * writes, with the hours it was active for. Its rate is on `offering`.
146
148
  */
147
149
  billing: {
148
150
  activeHours: number;
149
- hibernatedHours: number;
150
151
  billedDollars: number;
151
152
  lastBilledAt: string | null;
152
153
  };
@@ -157,7 +158,12 @@ export interface InfraResource {
157
158
  createdAt: string;
158
159
  updatedAt: string;
159
160
  }
160
- /** One of a database server's databases, as its pod last reported it. */
161
+ /**
162
+ * One of a database server's databases, as its pod last reported it. Every
163
+ * database on the server is listed; one the server hasn't opened yet (it
164
+ * downloads on its first query after a provision or a resume) has null sizes
165
+ * and no backup time.
166
+ */
161
167
  export interface InfraLeasedDatabase {
162
168
  databaseId: string;
163
169
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madewithremy/admin",
3
- "version": "0.1.65",
3
+ "version": "0.1.66",
4
4
  "description": "Admin SDK + CLI for managing production Remy apps",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",