@machine0/sdk 0.2.0 → 0.2.1

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/README.md CHANGED
@@ -58,6 +58,7 @@ Notes:
58
58
  - Lifecycle mutations (`start`, `stop`, `reboot`, `suspend`, `destroy`) are asynchronous on the server — they return `{success: true}` immediately and the machine transitions through states (`STARTING`, `STOPPING`, …). Poll `get()` to observe progress.
59
59
  - `machines.create` responds before the image join exists, so the created machine lacks `image`/`distribution` — call `get()` if you need them right away.
60
60
  - `sshKeys.create({type: "MANAGED", name})` returns the plaintext `privateKey` — store it. (Managed keys are retrievable later through the CLI's `machine0 keys get <name> --download`; this SDK deliberately never requests the private key after creation.)
61
+ - `get()`, `getByName()` and `update()` return the machine's creation-time environment variables as `env` (`{}` when it has none, `null` if they could not be read) — with their values, so don't log whole responses. `list()` never includes them.
61
62
  - All date fields are ISO-8601 strings.
62
63
 
63
64
  ## Options
package/dist/types.d.ts CHANGED
@@ -112,6 +112,14 @@ export interface MachineDetail {
112
112
  statusExplanation: string | null;
113
113
  /** See {@link Machine.orderExpiresAt}. */
114
114
  orderExpiresAt: string | null;
115
+ /**
116
+ * The environment variables the machine was created with
117
+ * ({@link MachineCreateInput.env}) — its own variables only, not those it
118
+ * inherits from a profile. `{}` when it was created without any; `null` when
119
+ * they are stored but could not be read. Treat the values as secrets: don't
120
+ * log a whole `MachineDetail`.
121
+ */
122
+ env: Record<string, string> | null;
115
123
  }
116
124
  export interface DiskMount {
117
125
  diskName: string;
@@ -268,7 +276,7 @@ export interface SshKeyCreatedManaged extends SshKeyWithFile {
268
276
  }
269
277
  export declare const MACHINE_KEYS: readonly ["id", "name", "url", "status", "ip", "size", "region", "provider", "createdAt", "firstStartedAt", "destroyedAt", "image", "distribution", "ageMinutes", "totalCost", "pricePerHour", "metricsEnabled", "onIdle", "idleTimeoutMinutes", "orderExpiresAt"];
270
278
  export declare const MACHINE_CREATED_KEYS: readonly ["id", "name", "url", "status", "ip", "size", "region", "provider", "createdAt", "firstStartedAt", "destroyedAt", "ageMinutes", "totalCost", "pricePerHour", "metricsEnabled", "onIdle", "idleTimeoutMinutes", "orderExpiresAt", "envApplied"];
271
- export declare const MACHINE_DETAIL_KEYS: readonly ["id", "name", "url", "status", "ip", "size", "vcpu", "ram", "disk", "region", "provider", "createdAt", "firstStartedAt", "image", "imageVersion", "defaultSSHUsername", "sshClientInitialCommand", "metricsEnabled", "onIdle", "idleTimeoutMinutes", "distribution", "key", "ageMinutes", "totalCost", "pricePerHour", "mountPaths", "statusExplanation", "orderExpiresAt"];
279
+ export declare const MACHINE_DETAIL_KEYS: readonly ["id", "name", "url", "status", "ip", "size", "vcpu", "ram", "disk", "region", "provider", "createdAt", "firstStartedAt", "image", "imageVersion", "defaultSSHUsername", "sshClientInitialCommand", "metricsEnabled", "onIdle", "idleTimeoutMinutes", "distribution", "key", "ageMinutes", "totalCost", "pricePerHour", "mountPaths", "statusExplanation", "orderExpiresAt", "env"];
272
280
  export declare const IMAGE_KEYS: readonly ["id", "name", "description", "distribution", "type", "status", "provider", "sizeGb", "minDiskGb", "regions", "gpuOnly", "gitRepo", "gitBranch", "flakeDir", "nixProfile", "createdAt", "updatedAt", "ageMinutes", "totalCost", "pricePerHour"];
273
281
  export declare const IMAGE_LIST_KEYS: readonly ["id", "name", "description", "distribution", "type", "status", "provider", "sizeGb", "minDiskGb", "regions", "gpuOnly", "gitRepo", "gitBranch", "flakeDir", "nixProfile", "createdAt", "updatedAt", "ageMinutes", "totalCost", "pricePerHour", "latestVersionError"];
274
282
  export declare const IMAGE_DETAIL_KEYS: readonly ["id", "name", "description", "distribution", "type", "status", "provider", "sizeGb", "minDiskGb", "regions", "gpuOnly", "gitRepo", "gitBranch", "flakeDir", "nixProfile", "createdAt", "updatedAt", "ageMinutes", "totalCost", "pricePerHour", "versionSnapshotStorageCost"];
package/dist/types.js CHANGED
@@ -89,6 +89,7 @@ export const MACHINE_DETAIL_KEYS = [
89
89
  "mountPaths",
90
90
  "statusExplanation",
91
91
  "orderExpiresAt",
92
+ "env",
92
93
  ];
93
94
  // The shared Image keys — valid against BOTH images.list rows and images.get
94
95
  // (kept stable for existing consumers indexing either shape).
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.2.0";
1
+ export declare const SDK_VERSION = "0.2.1";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Must match the "version" field in package.json — version.test.ts enforces
2
2
  // the sync, and the deploy-sdk workflow compares this constant (imported from
3
3
  // the built dist under plain Node) against package.json before publishing.
4
- export const SDK_VERSION = "0.2.0";
4
+ export const SDK_VERSION = "0.2.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@machine0/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Typed Node.js/TypeScript SDK for the machine0 API. Zero dependencies, fetch-based.",
5
5
  "homepage": "https://machine0.io",
6
6
  "author": "Barnaby Malet <barnaby@machine0.io>",