@lizard-build/sdk 0.1.61 → 0.1.62

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.mts CHANGED
@@ -68,7 +68,7 @@ interface Addon {
68
68
  name: string;
69
69
  type: AddonType;
70
70
  projectId: string;
71
- status: 'none' | 'running' | 'crashed' | 'stopped';
71
+ status: 'none' | 'running' | 'crashed' | 'stopped' | 'paused';
72
72
  deployStatus: string;
73
73
  version?: string;
74
74
  /** Exposed connection variables (e.g. DATABASE_URL, REDIS_URL). */
@@ -117,6 +117,13 @@ declare class AddonsAPI {
117
117
  }): Promise<Addon>;
118
118
  /** Restart an addon. */
119
119
  redeploy(projectId: string, addonId: string): Promise<void>;
120
+ /**
121
+ * Pause a managed database: it scales to 0 (connections are refused) and keeps its host,
122
+ * port, password and data. Postgres and Redis.
123
+ */
124
+ pause(projectId: string, addonId: string): Promise<PauseState>;
125
+ /** Resume a paused database: same host, port, password and data. */
126
+ resume(projectId: string, addonId: string): Promise<PauseState>;
120
127
  rename(projectId: string, addonId: string, name: string): Promise<unknown>;
121
128
  secrets(projectId: string, addonId: string): Promise<Array<{
122
129
  key: string;
@@ -136,6 +143,25 @@ interface CreateProjectOpts {
136
143
  workspaceId: string;
137
144
  name: string;
138
145
  }
146
+ /** One app or managed database a project / workspace pause or resume acted on. */
147
+ interface PausedService {
148
+ kind: 'app' | 'database';
149
+ id: string;
150
+ name: string;
151
+ }
152
+ /** What `projects.pause/resume` and `workspaces.pause/resume` answer: what was done, and
153
+ * what was skipped with why (already paused, not running, busy, a storage bucket...). */
154
+ interface PauseResult {
155
+ done: PausedService[];
156
+ skipped: Array<PausedService & {
157
+ reason: string;
158
+ }>;
159
+ }
160
+ /** What pausing or resuming one service answers. */
161
+ interface PauseState {
162
+ ok: boolean;
163
+ status: 'paused' | 'running';
164
+ }
139
165
  declare class ProjectsAPI {
140
166
  private readonly client;
141
167
  constructor(client: PlatformClient);
@@ -154,6 +180,13 @@ declare class ProjectsAPI {
154
180
  update(id: string, opts: {
155
181
  name?: string;
156
182
  }): Promise<Project>;
183
+ /**
184
+ * Pause every app and managed database of a project: each scales to 0 and keeps its URL,
185
+ * host, port, password, settings and volumes. Skipped ones are listed with why.
186
+ */
187
+ pause(id: string): Promise<PauseResult>;
188
+ /** Resume what was paused in a project (not what a billing freeze paused). */
189
+ resume(id: string): Promise<PauseResult>;
157
190
  /** Delete a project. */
158
191
  delete(id: string): Promise<void>;
159
192
  apply(id: string, config: ProjectConfig): Promise<ConfigResult>;
@@ -205,7 +238,7 @@ interface Service {
205
238
  id: string;
206
239
  name: string;
207
240
  projectId: string;
208
- status: 'none' | 'running' | 'crashed' | 'stopped';
241
+ status: 'none' | 'running' | 'crashed' | 'stopped' | 'paused';
209
242
  deployStatus: 'idle' | 'building' | 'deploying' | 'restarting' | 'failed' | 'deleting';
210
243
  domain?: string;
211
244
  region?: string;
@@ -323,6 +356,13 @@ declare class ServicesAPI {
323
356
  redeploy(id: string): Promise<DeployHandle>;
324
357
  /** Restart a service without rebuilding. */
325
358
  restart(id: string): Promise<void>;
359
+ /**
360
+ * Pause a service: it scales to 0 (its URL answers 503) and keeps its URL, settings, env
361
+ * and volumes. Restart and redeploy are refused until it is resumed.
362
+ */
363
+ pause(id: string): Promise<PauseState>;
364
+ /** Resume a paused service: it starts again from the same image, with its data. */
365
+ resume(id: string): Promise<PauseState>;
326
366
  /** Scale a service. */
327
367
  scale(id: string, opts: ScaleOpts): Promise<void>;
328
368
  /**
@@ -1432,6 +1472,13 @@ declare class WorkspacesAPI {
1432
1472
  * `code: 'ACCOUNT_SCOPE_REQUIRED'`.
1433
1473
  */
1434
1474
  create(opts: CreateWorkspaceOpts): Promise<Workspace>;
1475
+ /**
1476
+ * Pause every app and managed database in every project of a workspace (owner only).
1477
+ * Each keeps its URL, host, port, password, settings and volumes.
1478
+ */
1479
+ pause(id: string): Promise<PauseResult>;
1480
+ /** Resume what was paused in a workspace (owner only; not what a billing freeze paused). */
1481
+ resume(id: string): Promise<PauseResult>;
1435
1482
  /**
1436
1483
  * Delete a workspace.
1437
1484
  *
package/dist/index.d.ts CHANGED
@@ -68,7 +68,7 @@ interface Addon {
68
68
  name: string;
69
69
  type: AddonType;
70
70
  projectId: string;
71
- status: 'none' | 'running' | 'crashed' | 'stopped';
71
+ status: 'none' | 'running' | 'crashed' | 'stopped' | 'paused';
72
72
  deployStatus: string;
73
73
  version?: string;
74
74
  /** Exposed connection variables (e.g. DATABASE_URL, REDIS_URL). */
@@ -117,6 +117,13 @@ declare class AddonsAPI {
117
117
  }): Promise<Addon>;
118
118
  /** Restart an addon. */
119
119
  redeploy(projectId: string, addonId: string): Promise<void>;
120
+ /**
121
+ * Pause a managed database: it scales to 0 (connections are refused) and keeps its host,
122
+ * port, password and data. Postgres and Redis.
123
+ */
124
+ pause(projectId: string, addonId: string): Promise<PauseState>;
125
+ /** Resume a paused database: same host, port, password and data. */
126
+ resume(projectId: string, addonId: string): Promise<PauseState>;
120
127
  rename(projectId: string, addonId: string, name: string): Promise<unknown>;
121
128
  secrets(projectId: string, addonId: string): Promise<Array<{
122
129
  key: string;
@@ -136,6 +143,25 @@ interface CreateProjectOpts {
136
143
  workspaceId: string;
137
144
  name: string;
138
145
  }
146
+ /** One app or managed database a project / workspace pause or resume acted on. */
147
+ interface PausedService {
148
+ kind: 'app' | 'database';
149
+ id: string;
150
+ name: string;
151
+ }
152
+ /** What `projects.pause/resume` and `workspaces.pause/resume` answer: what was done, and
153
+ * what was skipped with why (already paused, not running, busy, a storage bucket...). */
154
+ interface PauseResult {
155
+ done: PausedService[];
156
+ skipped: Array<PausedService & {
157
+ reason: string;
158
+ }>;
159
+ }
160
+ /** What pausing or resuming one service answers. */
161
+ interface PauseState {
162
+ ok: boolean;
163
+ status: 'paused' | 'running';
164
+ }
139
165
  declare class ProjectsAPI {
140
166
  private readonly client;
141
167
  constructor(client: PlatformClient);
@@ -154,6 +180,13 @@ declare class ProjectsAPI {
154
180
  update(id: string, opts: {
155
181
  name?: string;
156
182
  }): Promise<Project>;
183
+ /**
184
+ * Pause every app and managed database of a project: each scales to 0 and keeps its URL,
185
+ * host, port, password, settings and volumes. Skipped ones are listed with why.
186
+ */
187
+ pause(id: string): Promise<PauseResult>;
188
+ /** Resume what was paused in a project (not what a billing freeze paused). */
189
+ resume(id: string): Promise<PauseResult>;
157
190
  /** Delete a project. */
158
191
  delete(id: string): Promise<void>;
159
192
  apply(id: string, config: ProjectConfig): Promise<ConfigResult>;
@@ -205,7 +238,7 @@ interface Service {
205
238
  id: string;
206
239
  name: string;
207
240
  projectId: string;
208
- status: 'none' | 'running' | 'crashed' | 'stopped';
241
+ status: 'none' | 'running' | 'crashed' | 'stopped' | 'paused';
209
242
  deployStatus: 'idle' | 'building' | 'deploying' | 'restarting' | 'failed' | 'deleting';
210
243
  domain?: string;
211
244
  region?: string;
@@ -323,6 +356,13 @@ declare class ServicesAPI {
323
356
  redeploy(id: string): Promise<DeployHandle>;
324
357
  /** Restart a service without rebuilding. */
325
358
  restart(id: string): Promise<void>;
359
+ /**
360
+ * Pause a service: it scales to 0 (its URL answers 503) and keeps its URL, settings, env
361
+ * and volumes. Restart and redeploy are refused until it is resumed.
362
+ */
363
+ pause(id: string): Promise<PauseState>;
364
+ /** Resume a paused service: it starts again from the same image, with its data. */
365
+ resume(id: string): Promise<PauseState>;
326
366
  /** Scale a service. */
327
367
  scale(id: string, opts: ScaleOpts): Promise<void>;
328
368
  /**
@@ -1432,6 +1472,13 @@ declare class WorkspacesAPI {
1432
1472
  * `code: 'ACCOUNT_SCOPE_REQUIRED'`.
1433
1473
  */
1434
1474
  create(opts: CreateWorkspaceOpts): Promise<Workspace>;
1475
+ /**
1476
+ * Pause every app and managed database in every project of a workspace (owner only).
1477
+ * Each keeps its URL, host, port, password, settings and volumes.
1478
+ */
1479
+ pause(id: string): Promise<PauseResult>;
1480
+ /** Resume what was paused in a workspace (owner only; not what a billing freeze paused). */
1481
+ resume(id: string): Promise<PauseResult>;
1435
1482
  /**
1436
1483
  * Delete a workspace.
1437
1484
  *
package/dist/index.js CHANGED
@@ -407,6 +407,17 @@ var ServicesAPI = class {
407
407
  restart(id) {
408
408
  return this.client.post(`/api/apps/${id}/restart`, {});
409
409
  }
410
+ /**
411
+ * Pause a service: it scales to 0 (its URL answers 503) and keeps its URL, settings, env
412
+ * and volumes. Restart and redeploy are refused until it is resumed.
413
+ */
414
+ pause(id) {
415
+ return this.client.post(`/api/apps/${id}/pause`, {});
416
+ }
417
+ /** Resume a paused service: it starts again from the same image, with its data. */
418
+ resume(id) {
419
+ return this.client.post(`/api/apps/${id}/resume`, {});
420
+ }
410
421
  /** Scale a service. */
411
422
  async scale(id, opts) {
412
423
  if (opts.storageMi !== void 0) throw new LizardError("Storage scaling is only supported for addons");
@@ -1393,6 +1404,17 @@ var ProjectsAPI = class {
1393
1404
  update(id, opts) {
1394
1405
  return this.client.patch(`/api/projects/${id}`, opts);
1395
1406
  }
1407
+ /**
1408
+ * Pause every app and managed database of a project: each scales to 0 and keeps its URL,
1409
+ * host, port, password, settings and volumes. Skipped ones are listed with why.
1410
+ */
1411
+ pause(id) {
1412
+ return this.client.post(`/api/projects/${id}/pause`, {});
1413
+ }
1414
+ /** Resume what was paused in a project (not what a billing freeze paused). */
1415
+ resume(id) {
1416
+ return this.client.post(`/api/projects/${id}/resume`, {});
1417
+ }
1396
1418
  /** Delete a project. */
1397
1419
  delete(id) {
1398
1420
  return this.client.delete(`/api/projects/${id}`);
@@ -1473,6 +1495,17 @@ var AddonsAPI = class {
1473
1495
  redeploy(projectId, addonId) {
1474
1496
  return this.client.post(`/api/projects/${projectId}/addons/${addonId}/redeploy`, {});
1475
1497
  }
1498
+ /**
1499
+ * Pause a managed database: it scales to 0 (connections are refused) and keeps its host,
1500
+ * port, password and data. Postgres and Redis.
1501
+ */
1502
+ pause(projectId, addonId) {
1503
+ return this.client.post(`/api/projects/${projectId}/addons/${addonId}/pause`, {});
1504
+ }
1505
+ /** Resume a paused database: same host, port, password and data. */
1506
+ resume(projectId, addonId) {
1507
+ return this.client.post(`/api/projects/${projectId}/addons/${addonId}/resume`, {});
1508
+ }
1476
1509
  rename(projectId, addonId, name) {
1477
1510
  return this.client.patch(`/api/projects/${projectId}/addons/${addonId}`, { name });
1478
1511
  }
@@ -1663,6 +1696,17 @@ var WorkspacesAPI = class {
1663
1696
  create(opts) {
1664
1697
  return this.client.post("/api/workspaces", opts);
1665
1698
  }
1699
+ /**
1700
+ * Pause every app and managed database in every project of a workspace (owner only).
1701
+ * Each keeps its URL, host, port, password, settings and volumes.
1702
+ */
1703
+ pause(id) {
1704
+ return this.client.post(`/api/workspaces/${id}/pause`, {});
1705
+ }
1706
+ /** Resume what was paused in a workspace (owner only; not what a billing freeze paused). */
1707
+ resume(id) {
1708
+ return this.client.post(`/api/workspaces/${id}/resume`, {});
1709
+ }
1666
1710
  /**
1667
1711
  * Delete a workspace.
1668
1712
  *
package/dist/index.mjs CHANGED
@@ -354,6 +354,17 @@ var ServicesAPI = class {
354
354
  restart(id) {
355
355
  return this.client.post(`/api/apps/${id}/restart`, {});
356
356
  }
357
+ /**
358
+ * Pause a service: it scales to 0 (its URL answers 503) and keeps its URL, settings, env
359
+ * and volumes. Restart and redeploy are refused until it is resumed.
360
+ */
361
+ pause(id) {
362
+ return this.client.post(`/api/apps/${id}/pause`, {});
363
+ }
364
+ /** Resume a paused service: it starts again from the same image, with its data. */
365
+ resume(id) {
366
+ return this.client.post(`/api/apps/${id}/resume`, {});
367
+ }
357
368
  /** Scale a service. */
358
369
  async scale(id, opts) {
359
370
  if (opts.storageMi !== void 0) throw new LizardError("Storage scaling is only supported for addons");
@@ -1340,6 +1351,17 @@ var ProjectsAPI = class {
1340
1351
  update(id, opts) {
1341
1352
  return this.client.patch(`/api/projects/${id}`, opts);
1342
1353
  }
1354
+ /**
1355
+ * Pause every app and managed database of a project: each scales to 0 and keeps its URL,
1356
+ * host, port, password, settings and volumes. Skipped ones are listed with why.
1357
+ */
1358
+ pause(id) {
1359
+ return this.client.post(`/api/projects/${id}/pause`, {});
1360
+ }
1361
+ /** Resume what was paused in a project (not what a billing freeze paused). */
1362
+ resume(id) {
1363
+ return this.client.post(`/api/projects/${id}/resume`, {});
1364
+ }
1343
1365
  /** Delete a project. */
1344
1366
  delete(id) {
1345
1367
  return this.client.delete(`/api/projects/${id}`);
@@ -1420,6 +1442,17 @@ var AddonsAPI = class {
1420
1442
  redeploy(projectId, addonId) {
1421
1443
  return this.client.post(`/api/projects/${projectId}/addons/${addonId}/redeploy`, {});
1422
1444
  }
1445
+ /**
1446
+ * Pause a managed database: it scales to 0 (connections are refused) and keeps its host,
1447
+ * port, password and data. Postgres and Redis.
1448
+ */
1449
+ pause(projectId, addonId) {
1450
+ return this.client.post(`/api/projects/${projectId}/addons/${addonId}/pause`, {});
1451
+ }
1452
+ /** Resume a paused database: same host, port, password and data. */
1453
+ resume(projectId, addonId) {
1454
+ return this.client.post(`/api/projects/${projectId}/addons/${addonId}/resume`, {});
1455
+ }
1423
1456
  rename(projectId, addonId, name) {
1424
1457
  return this.client.patch(`/api/projects/${projectId}/addons/${addonId}`, { name });
1425
1458
  }
@@ -1610,6 +1643,17 @@ var WorkspacesAPI = class {
1610
1643
  create(opts) {
1611
1644
  return this.client.post("/api/workspaces", opts);
1612
1645
  }
1646
+ /**
1647
+ * Pause every app and managed database in every project of a workspace (owner only).
1648
+ * Each keeps its URL, host, port, password, settings and volumes.
1649
+ */
1650
+ pause(id) {
1651
+ return this.client.post(`/api/workspaces/${id}/pause`, {});
1652
+ }
1653
+ /** Resume what was paused in a workspace (owner only; not what a billing freeze paused). */
1654
+ resume(id) {
1655
+ return this.client.post(`/api/workspaces/${id}/resume`, {});
1656
+ }
1613
1657
  /**
1614
1658
  * Delete a workspace.
1615
1659
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lizard-build/sdk",
3
- "version": "0.1.61",
3
+ "version": "0.1.62",
4
4
  "description": "TypeScript SDK for Lizard: Firecracker microVM sandboxes, code execution and cloud apps.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",