@lizard-build/sdk 0.1.66 → 0.1.67

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
@@ -1485,6 +1485,27 @@ interface ResalePricing {
1485
1485
  enabled: boolean;
1486
1486
  multipliers: ResaleMultipliers;
1487
1487
  }
1488
+ /** What a workspace may run at once (null: no limit). See {@link WorkspacesAPI.setLimits}. */
1489
+ interface WorkspaceLimits {
1490
+ /** Sandboxes running (or resuming) at once; paused ones do not count. */
1491
+ maxRunningSandboxes: number | null;
1492
+ /** vCPU its apps and databases may be using right now (measured). */
1493
+ maxCpuVcpus: number | null;
1494
+ /** Memory (MB) its apps and databases may be using right now (measured). */
1495
+ maxMemoryMb: number | null;
1496
+ }
1497
+ interface WorkspaceUsage {
1498
+ runningSandboxes: number;
1499
+ /** Measured, all regions, its apps and databases. */
1500
+ cpuVcpus: number;
1501
+ memoryMb: number;
1502
+ /** Unix ms of the oldest reading in the sum; null when nothing was measured. */
1503
+ measuredAt: number | null;
1504
+ }
1505
+ interface WorkspaceLimitsInfo {
1506
+ limits: WorkspaceLimits;
1507
+ usage: WorkspaceUsage;
1508
+ }
1488
1509
  interface CreateWorkspaceOpts {
1489
1510
  name: string;
1490
1511
  }
@@ -1550,6 +1571,27 @@ declare class WorkspacesAPI {
1550
1571
  setResalePricing(id: string, multipliers: Partial<ResaleMultipliers>): Promise<ResalePricing>;
1551
1572
  /** Turn resale prices off: scoped keys see Lizard's prices again (owner only). */
1552
1573
  clearResalePricing(id: string): Promise<ResalePricing>;
1574
+ /**
1575
+ * The workspace's limits and what it uses now. Anyone in the workspace may read them,
1576
+ * including a key scoped to it (your customer sees how close they are).
1577
+ */
1578
+ getLimits(id: string): Promise<WorkspaceLimitsInfo>;
1579
+ /**
1580
+ * Limit what a workspace may run at once (owner only, key with no scopes). A field left out
1581
+ * stays as it is; `null` removes that limit.
1582
+ *
1583
+ * - `maxRunningSandboxes`: a create, fork or resume past it fails with HTTP 429
1584
+ * `WORKSPACE_SANDBOX_LIMIT`.
1585
+ * - `maxCpuVcpus` / `maxMemoryMb`: what its apps and databases USE (measured every ~10 s,
1586
+ * not their configured limits). While at or over a cap, deploys, redeploys, restarts,
1587
+ * scale-ups, new databases and resumes there fail with HTTP 429 `WORKSPACE_USAGE_LIMIT`;
1588
+ * services already running keep running.
1589
+ *
1590
+ * ```ts
1591
+ * await lizard.workspaces.setLimits(ws.id, { maxRunningSandboxes: 5, maxCpuVcpus: 2, maxMemoryMb: 4096 })
1592
+ * ```
1593
+ */
1594
+ setLimits(id: string, limits: Partial<WorkspaceLimits>): Promise<WorkspaceLimitsInfo>;
1553
1595
  /**
1554
1596
  * Delete a workspace.
1555
1597
  *
@@ -2384,4 +2426,4 @@ declare class LizardCLI {
2384
2426
  }): Promise<CLIResult>;
2385
2427
  }
2386
2428
 
2387
- export { type Account, type Addon, type AddonType, AddonsAPI, type ApiKey, type ApiKeyScope, ApiKeysAPI, AuthenticationError, type Balance, BillingAPI, type CLIOptions, type CLIResult, type CheckoutSession, type ClickOpts, type CodeContext, CodeSandbox, ConfigApplyError, type ConfigResult, ConflictError, type ConnectionOpts, type CostMetrics, type CreateAddonOpts, type CreateApiKeyOpts, type CreateContextOpts, type CreateProjectOpts, type CreateServiceOpts, type CreateVolumeOpts, type CreateWorkspaceOpts, type CreatedApiKey, type DeployEvent, DeployHandle, Desktop, type DesktopInfo, type DesktopStartOpts, type DomainInfo, type DomainStatus, DomainsAPI, Execution, ExecutionError, type ExposedPort, type FileInfo, type ForkResult, type FsEvent, type FsOpts, GitHubAPI, type ListTransactionsOpts, Lizard, LizardCLI, LizardError, type LizardOpts, type LogLine, type MetricPoint, type MetricRange, MetricsAPI, type MouseButton, NotFoundError, PaymentRequiredError, type Plan, PlatformClient, type ProcessInfo, type ProcessOpts, type ProcessResult, type ProcessSignal, type Project, type ProjectConfig, type ProjectCost, ProjectsAPI, type PromoRedemption, type RawMetrics, type Region, RegionsAPI, type ResaleMultipliers, type ResalePricing, type RunCodeLanguage, type RunCodeOpts, Sandbox, type SandboxInfo, type SandboxOpts, type SandboxSnapshot, type ScaleOpts, type ScrollDirection, type Secret, SecretsAPI, type Service, type ServiceMetrics, type ServiceUpdate, ServicesAPI, type SetSecretOpts, type SnapshotOpts, type SnapshotScope, type SnapshotWaitOpts, type StartCheckoutOpts, type StartProNowResult, StorageAPI, type StreamEvent, type Subscription, type SubscriptionStatus, TimeoutError, type Transaction, type TransactionPage, Volume, type VolumeInfo, type Workspace, WorkspacesAPI, resolveProjectId };
2429
+ export { type Account, type Addon, type AddonType, AddonsAPI, type ApiKey, type ApiKeyScope, ApiKeysAPI, AuthenticationError, type Balance, BillingAPI, type CLIOptions, type CLIResult, type CheckoutSession, type ClickOpts, type CodeContext, CodeSandbox, ConfigApplyError, type ConfigResult, ConflictError, type ConnectionOpts, type CostMetrics, type CreateAddonOpts, type CreateApiKeyOpts, type CreateContextOpts, type CreateProjectOpts, type CreateServiceOpts, type CreateVolumeOpts, type CreateWorkspaceOpts, type CreatedApiKey, type DeployEvent, DeployHandle, Desktop, type DesktopInfo, type DesktopStartOpts, type DomainInfo, type DomainStatus, DomainsAPI, Execution, ExecutionError, type ExposedPort, type FileInfo, type ForkResult, type FsEvent, type FsOpts, GitHubAPI, type ListTransactionsOpts, Lizard, LizardCLI, LizardError, type LizardOpts, type LogLine, type MetricPoint, type MetricRange, MetricsAPI, type MouseButton, NotFoundError, PaymentRequiredError, type Plan, PlatformClient, type ProcessInfo, type ProcessOpts, type ProcessResult, type ProcessSignal, type Project, type ProjectConfig, type ProjectCost, ProjectsAPI, type PromoRedemption, type RawMetrics, type Region, RegionsAPI, type ResaleMultipliers, type ResalePricing, type RunCodeLanguage, type RunCodeOpts, Sandbox, type SandboxInfo, type SandboxOpts, type SandboxSnapshot, type ScaleOpts, type ScrollDirection, type Secret, SecretsAPI, type Service, type ServiceMetrics, type ServiceUpdate, ServicesAPI, type SetSecretOpts, type SnapshotOpts, type SnapshotScope, type SnapshotWaitOpts, type StartCheckoutOpts, type StartProNowResult, StorageAPI, type StreamEvent, type Subscription, type SubscriptionStatus, TimeoutError, type Transaction, type TransactionPage, Volume, type VolumeInfo, type Workspace, type WorkspaceLimits, type WorkspaceLimitsInfo, type WorkspaceUsage, WorkspacesAPI, resolveProjectId };
package/dist/index.d.ts CHANGED
@@ -1485,6 +1485,27 @@ interface ResalePricing {
1485
1485
  enabled: boolean;
1486
1486
  multipliers: ResaleMultipliers;
1487
1487
  }
1488
+ /** What a workspace may run at once (null: no limit). See {@link WorkspacesAPI.setLimits}. */
1489
+ interface WorkspaceLimits {
1490
+ /** Sandboxes running (or resuming) at once; paused ones do not count. */
1491
+ maxRunningSandboxes: number | null;
1492
+ /** vCPU its apps and databases may be using right now (measured). */
1493
+ maxCpuVcpus: number | null;
1494
+ /** Memory (MB) its apps and databases may be using right now (measured). */
1495
+ maxMemoryMb: number | null;
1496
+ }
1497
+ interface WorkspaceUsage {
1498
+ runningSandboxes: number;
1499
+ /** Measured, all regions, its apps and databases. */
1500
+ cpuVcpus: number;
1501
+ memoryMb: number;
1502
+ /** Unix ms of the oldest reading in the sum; null when nothing was measured. */
1503
+ measuredAt: number | null;
1504
+ }
1505
+ interface WorkspaceLimitsInfo {
1506
+ limits: WorkspaceLimits;
1507
+ usage: WorkspaceUsage;
1508
+ }
1488
1509
  interface CreateWorkspaceOpts {
1489
1510
  name: string;
1490
1511
  }
@@ -1550,6 +1571,27 @@ declare class WorkspacesAPI {
1550
1571
  setResalePricing(id: string, multipliers: Partial<ResaleMultipliers>): Promise<ResalePricing>;
1551
1572
  /** Turn resale prices off: scoped keys see Lizard's prices again (owner only). */
1552
1573
  clearResalePricing(id: string): Promise<ResalePricing>;
1574
+ /**
1575
+ * The workspace's limits and what it uses now. Anyone in the workspace may read them,
1576
+ * including a key scoped to it (your customer sees how close they are).
1577
+ */
1578
+ getLimits(id: string): Promise<WorkspaceLimitsInfo>;
1579
+ /**
1580
+ * Limit what a workspace may run at once (owner only, key with no scopes). A field left out
1581
+ * stays as it is; `null` removes that limit.
1582
+ *
1583
+ * - `maxRunningSandboxes`: a create, fork or resume past it fails with HTTP 429
1584
+ * `WORKSPACE_SANDBOX_LIMIT`.
1585
+ * - `maxCpuVcpus` / `maxMemoryMb`: what its apps and databases USE (measured every ~10 s,
1586
+ * not their configured limits). While at or over a cap, deploys, redeploys, restarts,
1587
+ * scale-ups, new databases and resumes there fail with HTTP 429 `WORKSPACE_USAGE_LIMIT`;
1588
+ * services already running keep running.
1589
+ *
1590
+ * ```ts
1591
+ * await lizard.workspaces.setLimits(ws.id, { maxRunningSandboxes: 5, maxCpuVcpus: 2, maxMemoryMb: 4096 })
1592
+ * ```
1593
+ */
1594
+ setLimits(id: string, limits: Partial<WorkspaceLimits>): Promise<WorkspaceLimitsInfo>;
1553
1595
  /**
1554
1596
  * Delete a workspace.
1555
1597
  *
@@ -2384,4 +2426,4 @@ declare class LizardCLI {
2384
2426
  }): Promise<CLIResult>;
2385
2427
  }
2386
2428
 
2387
- export { type Account, type Addon, type AddonType, AddonsAPI, type ApiKey, type ApiKeyScope, ApiKeysAPI, AuthenticationError, type Balance, BillingAPI, type CLIOptions, type CLIResult, type CheckoutSession, type ClickOpts, type CodeContext, CodeSandbox, ConfigApplyError, type ConfigResult, ConflictError, type ConnectionOpts, type CostMetrics, type CreateAddonOpts, type CreateApiKeyOpts, type CreateContextOpts, type CreateProjectOpts, type CreateServiceOpts, type CreateVolumeOpts, type CreateWorkspaceOpts, type CreatedApiKey, type DeployEvent, DeployHandle, Desktop, type DesktopInfo, type DesktopStartOpts, type DomainInfo, type DomainStatus, DomainsAPI, Execution, ExecutionError, type ExposedPort, type FileInfo, type ForkResult, type FsEvent, type FsOpts, GitHubAPI, type ListTransactionsOpts, Lizard, LizardCLI, LizardError, type LizardOpts, type LogLine, type MetricPoint, type MetricRange, MetricsAPI, type MouseButton, NotFoundError, PaymentRequiredError, type Plan, PlatformClient, type ProcessInfo, type ProcessOpts, type ProcessResult, type ProcessSignal, type Project, type ProjectConfig, type ProjectCost, ProjectsAPI, type PromoRedemption, type RawMetrics, type Region, RegionsAPI, type ResaleMultipliers, type ResalePricing, type RunCodeLanguage, type RunCodeOpts, Sandbox, type SandboxInfo, type SandboxOpts, type SandboxSnapshot, type ScaleOpts, type ScrollDirection, type Secret, SecretsAPI, type Service, type ServiceMetrics, type ServiceUpdate, ServicesAPI, type SetSecretOpts, type SnapshotOpts, type SnapshotScope, type SnapshotWaitOpts, type StartCheckoutOpts, type StartProNowResult, StorageAPI, type StreamEvent, type Subscription, type SubscriptionStatus, TimeoutError, type Transaction, type TransactionPage, Volume, type VolumeInfo, type Workspace, WorkspacesAPI, resolveProjectId };
2429
+ export { type Account, type Addon, type AddonType, AddonsAPI, type ApiKey, type ApiKeyScope, ApiKeysAPI, AuthenticationError, type Balance, BillingAPI, type CLIOptions, type CLIResult, type CheckoutSession, type ClickOpts, type CodeContext, CodeSandbox, ConfigApplyError, type ConfigResult, ConflictError, type ConnectionOpts, type CostMetrics, type CreateAddonOpts, type CreateApiKeyOpts, type CreateContextOpts, type CreateProjectOpts, type CreateServiceOpts, type CreateVolumeOpts, type CreateWorkspaceOpts, type CreatedApiKey, type DeployEvent, DeployHandle, Desktop, type DesktopInfo, type DesktopStartOpts, type DomainInfo, type DomainStatus, DomainsAPI, Execution, ExecutionError, type ExposedPort, type FileInfo, type ForkResult, type FsEvent, type FsOpts, GitHubAPI, type ListTransactionsOpts, Lizard, LizardCLI, LizardError, type LizardOpts, type LogLine, type MetricPoint, type MetricRange, MetricsAPI, type MouseButton, NotFoundError, PaymentRequiredError, type Plan, PlatformClient, type ProcessInfo, type ProcessOpts, type ProcessResult, type ProcessSignal, type Project, type ProjectConfig, type ProjectCost, ProjectsAPI, type PromoRedemption, type RawMetrics, type Region, RegionsAPI, type ResaleMultipliers, type ResalePricing, type RunCodeLanguage, type RunCodeOpts, Sandbox, type SandboxInfo, type SandboxOpts, type SandboxSnapshot, type ScaleOpts, type ScrollDirection, type Secret, SecretsAPI, type Service, type ServiceMetrics, type ServiceUpdate, ServicesAPI, type SetSecretOpts, type SnapshotOpts, type SnapshotScope, type SnapshotWaitOpts, type StartCheckoutOpts, type StartProNowResult, StorageAPI, type StreamEvent, type Subscription, type SubscriptionStatus, TimeoutError, type Transaction, type TransactionPage, Volume, type VolumeInfo, type Workspace, type WorkspaceLimits, type WorkspaceLimitsInfo, type WorkspaceUsage, WorkspacesAPI, resolveProjectId };
package/dist/index.js CHANGED
@@ -1752,6 +1752,31 @@ var WorkspacesAPI = class {
1752
1752
  clearResalePricing(id) {
1753
1753
  return this.client.put(`/api/workspaces/${id}/resale-pricing`, {});
1754
1754
  }
1755
+ /**
1756
+ * The workspace's limits and what it uses now. Anyone in the workspace may read them,
1757
+ * including a key scoped to it (your customer sees how close they are).
1758
+ */
1759
+ getLimits(id) {
1760
+ return this.client.get(`/api/workspaces/${id}/limits`);
1761
+ }
1762
+ /**
1763
+ * Limit what a workspace may run at once (owner only, key with no scopes). A field left out
1764
+ * stays as it is; `null` removes that limit.
1765
+ *
1766
+ * - `maxRunningSandboxes`: a create, fork or resume past it fails with HTTP 429
1767
+ * `WORKSPACE_SANDBOX_LIMIT`.
1768
+ * - `maxCpuVcpus` / `maxMemoryMb`: what its apps and databases USE (measured every ~10 s,
1769
+ * not their configured limits). While at or over a cap, deploys, redeploys, restarts,
1770
+ * scale-ups, new databases and resumes there fail with HTTP 429 `WORKSPACE_USAGE_LIMIT`;
1771
+ * services already running keep running.
1772
+ *
1773
+ * ```ts
1774
+ * await lizard.workspaces.setLimits(ws.id, { maxRunningSandboxes: 5, maxCpuVcpus: 2, maxMemoryMb: 4096 })
1775
+ * ```
1776
+ */
1777
+ setLimits(id, limits) {
1778
+ return this.client.put(`/api/workspaces/${id}/limits`, limits);
1779
+ }
1755
1780
  /**
1756
1781
  * Delete a workspace.
1757
1782
  *
package/dist/index.mjs CHANGED
@@ -1699,6 +1699,31 @@ var WorkspacesAPI = class {
1699
1699
  clearResalePricing(id) {
1700
1700
  return this.client.put(`/api/workspaces/${id}/resale-pricing`, {});
1701
1701
  }
1702
+ /**
1703
+ * The workspace's limits and what it uses now. Anyone in the workspace may read them,
1704
+ * including a key scoped to it (your customer sees how close they are).
1705
+ */
1706
+ getLimits(id) {
1707
+ return this.client.get(`/api/workspaces/${id}/limits`);
1708
+ }
1709
+ /**
1710
+ * Limit what a workspace may run at once (owner only, key with no scopes). A field left out
1711
+ * stays as it is; `null` removes that limit.
1712
+ *
1713
+ * - `maxRunningSandboxes`: a create, fork or resume past it fails with HTTP 429
1714
+ * `WORKSPACE_SANDBOX_LIMIT`.
1715
+ * - `maxCpuVcpus` / `maxMemoryMb`: what its apps and databases USE (measured every ~10 s,
1716
+ * not their configured limits). While at or over a cap, deploys, redeploys, restarts,
1717
+ * scale-ups, new databases and resumes there fail with HTTP 429 `WORKSPACE_USAGE_LIMIT`;
1718
+ * services already running keep running.
1719
+ *
1720
+ * ```ts
1721
+ * await lizard.workspaces.setLimits(ws.id, { maxRunningSandboxes: 5, maxCpuVcpus: 2, maxMemoryMb: 4096 })
1722
+ * ```
1723
+ */
1724
+ setLimits(id, limits) {
1725
+ return this.client.put(`/api/workspaces/${id}/limits`, limits);
1726
+ }
1702
1727
  /**
1703
1728
  * Delete a workspace.
1704
1729
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lizard-build/sdk",
3
- "version": "0.1.66",
3
+ "version": "0.1.67",
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",