@simantic/cloud-sim 0.1.0 → 0.2.0
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 +25 -2
- package/dist/client.d.ts +2 -0
- package/dist/client.js +3 -0
- package/dist/generated/v1.d.ts +476 -9
- package/dist/http.d.ts +6 -3
- package/dist/http.js +7 -0
- package/dist/index.d.ts +2 -1
- package/dist/runs.d.ts +18 -2
- package/dist/runs.js +31 -1
- package/dist/settings.d.ts +21 -0
- package/dist/settings.js +32 -0
- package/dist/types.d.ts +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,15 +100,38 @@ sim.runs.result(id, { signal? }) // { exit_code, output, log, truncated } of a
|
|
|
100
100
|
sim.runs.output(id, { signal? }) // the UART output, as text
|
|
101
101
|
sim.runs.log(id, { signal? }) // the engine's console, as text
|
|
102
102
|
sim.runs.cancel(id, { signal? })
|
|
103
|
+
sim.runs.firmware(id, { signal? }) // the stored ELF, as a Uint8Array
|
|
104
|
+
sim.runs.deleteFirmware(id, { signal? }) // the run, its firmware no longer stored
|
|
103
105
|
sim.runs.wait(id, { signal?, intervalMs? })
|
|
104
106
|
sim.runs.follow(id, { signal?, transport?, intervalMs?, from? })
|
|
105
107
|
sim.runs.compare({ engines, mcu, firmware, ...options, version?, timeoutMs?, signal? })
|
|
106
108
|
```
|
|
107
109
|
|
|
108
110
|
`firmware` is a `Blob` (a `File` included), a `Uint8Array`, an
|
|
109
|
-
`ArrayBuffer`, `{ url }` or `{
|
|
111
|
+
`ArrayBuffer`, `{ url }`, `{ base64 }` or `{ run }`. Bytes are uploaded as
|
|
110
112
|
multipart/form-data; a URL is fetched by the server (https only, at most
|
|
111
|
-
24 MiB); base64 goes in JSON
|
|
113
|
+
24 MiB); base64 goes in JSON; `run` is the id of one of your runs whose
|
|
114
|
+
firmware the server stores, which this run runs again.
|
|
115
|
+
|
|
116
|
+
### Stored firmware
|
|
117
|
+
|
|
118
|
+
The server keeps each run's ELF, encrypted, after the run
|
|
119
|
+
(`run.firmware.stored`), so you can download it and run it again, with
|
|
120
|
+
other options or on a newer version:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
const elf = await sim.runs.firmware(run.id)
|
|
124
|
+
const again = await sim.runs.create({ mcu: run.mcu, firmware: { run: run.id }, simulatedSeconds: 30 })
|
|
125
|
+
await sim.runs.deleteFirmware(run.id) // gone; firmware.deleted_at says when
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Storage is on unless you turn it off, which deletes every run's stored
|
|
129
|
+
firmware:
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
await sim.settings.get() // { store_firmware, stored_firmware: { runs, bytes } }
|
|
133
|
+
await sim.settings.update({ storeFirmware: false })
|
|
134
|
+
```
|
|
112
135
|
|
|
113
136
|
Every create carries an `Idempotency-Key`, generated when you give none, so
|
|
114
137
|
a create the SDK retries after a lost answer gets the run it already made
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Mcus, Versions } from './catalog.js';
|
|
2
2
|
import { type ApiKey, type RetryInfo } from './http.js';
|
|
3
3
|
import { Runs } from './runs.js';
|
|
4
|
+
import { Settings } from './settings.js';
|
|
4
5
|
export interface CloudSimOptions {
|
|
5
6
|
/**
|
|
6
7
|
* An `smtc_` API key, or a simantic dashboard session's access token. A
|
|
@@ -49,5 +50,6 @@ export declare class CloudSim {
|
|
|
49
50
|
readonly runs: Runs;
|
|
50
51
|
readonly versions: Versions;
|
|
51
52
|
readonly mcus: Mcus;
|
|
53
|
+
readonly settings: Settings;
|
|
52
54
|
constructor(options: CloudSimOptions);
|
|
53
55
|
}
|
package/dist/client.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Mcus, Versions } from './catalog.js';
|
|
2
2
|
import { Transport } from './http.js';
|
|
3
3
|
import { Runs } from './runs.js';
|
|
4
|
+
import { Settings } from './settings.js';
|
|
4
5
|
/** A client of the Cloud Sim API. */
|
|
5
6
|
export class CloudSim {
|
|
6
7
|
runs;
|
|
7
8
|
versions;
|
|
8
9
|
mcus;
|
|
10
|
+
settings;
|
|
9
11
|
constructor(options) {
|
|
10
12
|
const http = new Transport(options);
|
|
11
13
|
this.runs = new Runs(http);
|
|
12
14
|
this.versions = new Versions(http);
|
|
13
15
|
this.mcus = new Mcus(http);
|
|
16
|
+
this.settings = new Settings(http);
|
|
14
17
|
}
|
|
15
18
|
}
|
package/dist/generated/v1.d.ts
CHANGED
|
@@ -86,6 +86,24 @@ export interface paths {
|
|
|
86
86
|
patch?: never;
|
|
87
87
|
trace?: never;
|
|
88
88
|
};
|
|
89
|
+
"/v1/runs/{id}/firmware": {
|
|
90
|
+
parameters: {
|
|
91
|
+
query?: never;
|
|
92
|
+
header?: never;
|
|
93
|
+
path?: never;
|
|
94
|
+
cookie?: never;
|
|
95
|
+
};
|
|
96
|
+
/** @description The ELF the run simulated, as it was given, while the server stores it (`firmware.stored`): from the run's creation until its owner deletes it or turns firmware storage off. */
|
|
97
|
+
get: operations["firmware"];
|
|
98
|
+
put?: never;
|
|
99
|
+
post?: never;
|
|
100
|
+
/** @description Deletes the run's stored firmware: at once, or for a run that has not ended, when it does (it runs on it until then). Either way the run answers with `firmware.stored` false from now on, and `firmware.deleted_at` says when. A run whose firmware is not stored answers as it is. */
|
|
101
|
+
delete: operations["delete_firmware"];
|
|
102
|
+
options?: never;
|
|
103
|
+
head?: never;
|
|
104
|
+
patch?: never;
|
|
105
|
+
trace?: never;
|
|
106
|
+
};
|
|
89
107
|
"/v1/runs/{id}/live": {
|
|
90
108
|
parameters: {
|
|
91
109
|
query?: never;
|
|
@@ -153,6 +171,23 @@ export interface paths {
|
|
|
153
171
|
patch?: never;
|
|
154
172
|
trace?: never;
|
|
155
173
|
};
|
|
174
|
+
"/v1/settings": {
|
|
175
|
+
parameters: {
|
|
176
|
+
query?: never;
|
|
177
|
+
header?: never;
|
|
178
|
+
path?: never;
|
|
179
|
+
cookie?: never;
|
|
180
|
+
};
|
|
181
|
+
get: operations["get_settings"];
|
|
182
|
+
put?: never;
|
|
183
|
+
post?: never;
|
|
184
|
+
delete?: never;
|
|
185
|
+
options?: never;
|
|
186
|
+
head?: never;
|
|
187
|
+
/** @description Changes the settings given, and answers with all of them. Turning `store_firmware` off deletes every run's stored firmware. */
|
|
188
|
+
patch: operations["update_settings"];
|
|
189
|
+
trace?: never;
|
|
190
|
+
};
|
|
156
191
|
"/v1/versions": {
|
|
157
192
|
parameters: {
|
|
158
193
|
query?: never;
|
|
@@ -279,6 +314,11 @@ export interface components {
|
|
|
279
314
|
/** @description Repeat the field for each name. */
|
|
280
315
|
usb_cdc_consoles?: string[] | null;
|
|
281
316
|
};
|
|
317
|
+
/**
|
|
318
|
+
* Format: binary
|
|
319
|
+
* @description An ELF file, as `GET /v1/runs/{id}/firmware` answers it.
|
|
320
|
+
*/
|
|
321
|
+
ElfFile: string;
|
|
282
322
|
/** @description An engine as a version pins it. */
|
|
283
323
|
EngineView: {
|
|
284
324
|
build: components["schemas"]["Build"];
|
|
@@ -313,15 +353,20 @@ export interface components {
|
|
|
313
353
|
* version), `engine_unknown`, `engine_not_in_version`,
|
|
314
354
|
* `mcu_not_supported`, `mcu_not_runnable`, `option_not_supported`,
|
|
315
355
|
* `firmware_missing`, `firmware_invalid`, `firmware_url_refused`,
|
|
316
|
-
* `firmware_fetch_failed`, `
|
|
317
|
-
*
|
|
318
|
-
*
|
|
356
|
+
* `firmware_fetch_failed`, `firmware_not_stored` (`firmware.run`
|
|
357
|
+
* names no run of yours whose firmware is stored),
|
|
358
|
+
* `invalid_request`;
|
|
359
|
+
* - 401 `unauthorized`; 403 `forbidden`, `guest_firmware_only` (the
|
|
360
|
+
* demo server runs only its examples, uploaded);
|
|
361
|
+
* - 404 `run_not_found`, `firmware_not_stored` (the run's firmware is
|
|
362
|
+
* not stored), `version_unknown` (in the path), `not_found`;
|
|
319
363
|
* - 409 `idempotency_key_reused`, `run_not_finished`, `run_finished`;
|
|
320
364
|
* - 410 `version_retired`;
|
|
321
365
|
* - 413 `firmware_too_large`, `payload_too_large`;
|
|
322
366
|
* - 415 `unsupported_media_type`;
|
|
323
367
|
* - 429 `too_many_runs` (the caller's unfinished runs are at the
|
|
324
|
-
* limit; `Retry-After` says when to look again)
|
|
368
|
+
* limit; `Retry-After` says when to look again), `demo_busy` (the
|
|
369
|
+
* demo server's queue is full);
|
|
325
370
|
* - 503 `unavailable` (a service the API relies on; `Retry-After`).
|
|
326
371
|
*/
|
|
327
372
|
code: string;
|
|
@@ -334,6 +379,17 @@ export interface components {
|
|
|
334
379
|
};
|
|
335
380
|
/** @description The firmware a run simulates. */
|
|
336
381
|
Firmware: {
|
|
382
|
+
/**
|
|
383
|
+
* Format: date-time
|
|
384
|
+
* @description When its owner deleted the ELF, or turned storage off while the
|
|
385
|
+
* server kept it.
|
|
386
|
+
*/
|
|
387
|
+
deleted_at: string | null;
|
|
388
|
+
/**
|
|
389
|
+
* Format: uuid
|
|
390
|
+
* @description The run whose stored firmware it ran again, for `run`.
|
|
391
|
+
*/
|
|
392
|
+
run: string | null;
|
|
337
393
|
/** @description Hex SHA-256 of the ELF. */
|
|
338
394
|
sha256: string;
|
|
339
395
|
/**
|
|
@@ -342,13 +398,27 @@ export interface components {
|
|
|
342
398
|
*/
|
|
343
399
|
size: number;
|
|
344
400
|
source: components["schemas"]["FirmwareSource"];
|
|
401
|
+
/**
|
|
402
|
+
* @description Whether the server keeps the ELF, encrypted, after the run: `GET
|
|
403
|
+
* /v1/runs/{id}/firmware` downloads it, and a run with `firmware:
|
|
404
|
+
* {"run": id}` runs it again. It does unless its owner turned firmware
|
|
405
|
+
* storage off (`PATCH /v1/settings`) or deleted it (`DELETE
|
|
406
|
+
* /v1/runs/{id}/firmware`), or the run is from before storage.
|
|
407
|
+
*/
|
|
408
|
+
stored: boolean;
|
|
345
409
|
/** @description The URL it was fetched from, for `url`. */
|
|
346
410
|
url: string | null;
|
|
347
411
|
};
|
|
348
|
-
/** @description The firmware: exactly one of `base64` and `
|
|
412
|
+
/** @description The firmware: exactly one of `base64`, `url` and `run`. */
|
|
349
413
|
FirmwareInput: {
|
|
350
414
|
/** @description The ELF, base64-encoded (standard alphabet, padded). */
|
|
351
415
|
base64?: string | null;
|
|
416
|
+
/**
|
|
417
|
+
* Format: uuid
|
|
418
|
+
* @description The id of one of your runs whose firmware the server stores
|
|
419
|
+
* (`firmware.stored`): this run runs that ELF again.
|
|
420
|
+
*/
|
|
421
|
+
run?: string | null;
|
|
352
422
|
/**
|
|
353
423
|
* @description An https URL the server fetches the ELF from when the run is
|
|
354
424
|
* submitted (at most 24 MiB, within 20 seconds; never a private
|
|
@@ -357,11 +427,11 @@ export interface components {
|
|
|
357
427
|
url?: string | null;
|
|
358
428
|
};
|
|
359
429
|
/**
|
|
360
|
-
* @description How a run's firmware came: a multipart file part, base64 in JSON,
|
|
361
|
-
* fetched by the server from a URL.
|
|
430
|
+
* @description How a run's firmware came: a multipart file part, base64 in JSON,
|
|
431
|
+
* fetched by the server from a URL, or another run's stored firmware.
|
|
362
432
|
* @enum {string}
|
|
363
433
|
*/
|
|
364
|
-
FirmwareSource: "upload" | "base64" | "url";
|
|
434
|
+
FirmwareSource: "upload" | "base64" | "url" | "run";
|
|
365
435
|
/**
|
|
366
436
|
* @description Where a version is in its life (index.toml `status`).
|
|
367
437
|
* @enum {string}
|
|
@@ -556,16 +626,52 @@ export interface components {
|
|
|
556
626
|
* @enum {string}
|
|
557
627
|
*/
|
|
558
628
|
RunStatus: "queued" | "starting" | "running" | "succeeded" | "failed" | "canceled";
|
|
629
|
+
/** @description The caller's settings. */
|
|
630
|
+
Settings: {
|
|
631
|
+
/**
|
|
632
|
+
* @description Whether the server keeps each run's firmware after the run, so it
|
|
633
|
+
* can be downloaded and run again. On unless turned off. Off, a run's
|
|
634
|
+
* firmware is deleted when the run ends.
|
|
635
|
+
*/
|
|
636
|
+
store_firmware: boolean;
|
|
637
|
+
/** @description What the server keeps now. */
|
|
638
|
+
stored_firmware: components["schemas"]["StoredFirmware"];
|
|
639
|
+
};
|
|
559
640
|
StatusChange: {
|
|
560
641
|
from: string;
|
|
561
642
|
mcu: string;
|
|
562
643
|
to: string;
|
|
563
644
|
};
|
|
645
|
+
/** @description The firmware the server keeps for the caller. */
|
|
646
|
+
StoredFirmware: {
|
|
647
|
+
/**
|
|
648
|
+
* Format: int64
|
|
649
|
+
* @description Their size in all, in bytes.
|
|
650
|
+
*/
|
|
651
|
+
bytes: number;
|
|
652
|
+
/**
|
|
653
|
+
* Format: int64
|
|
654
|
+
* @description How many runs' firmware.
|
|
655
|
+
*/
|
|
656
|
+
runs: number;
|
|
657
|
+
};
|
|
564
658
|
/**
|
|
565
659
|
* @description How UART bytes are written: hex rows (every engine's default) or text.
|
|
566
660
|
* @enum {string}
|
|
567
661
|
*/
|
|
568
662
|
UartEncoding: "hex" | "ascii";
|
|
663
|
+
/**
|
|
664
|
+
* @description `PATCH /v1/settings`: the settings to change. One left out stays as it
|
|
665
|
+
* is.
|
|
666
|
+
*/
|
|
667
|
+
UpdateSettings: {
|
|
668
|
+
/**
|
|
669
|
+
* @description Turning it off deletes every run's stored firmware, at once (or, for
|
|
670
|
+
* a run that has not ended, when it does), and keeps none from then
|
|
671
|
+
* on. Turning it on keeps the firmware of runs that end from then on.
|
|
672
|
+
*/
|
|
673
|
+
store_firmware?: boolean | null;
|
|
674
|
+
};
|
|
569
675
|
/** @description Every version this server serves. */
|
|
570
676
|
VersionList: {
|
|
571
677
|
/** @description What a request without `Cloud-Sim-Version` gets. */
|
|
@@ -770,7 +876,7 @@ export interface operations {
|
|
|
770
876
|
path?: never;
|
|
771
877
|
cookie?: never;
|
|
772
878
|
};
|
|
773
|
-
/** @description The run: JSON (firmware as base64 or a
|
|
879
|
+
/** @description The run: JSON (firmware as base64, a URL, or a run whose stored firmware to run again) or multipart/form-data (firmware as the file part `firmware`). */
|
|
774
880
|
requestBody: {
|
|
775
881
|
content: {
|
|
776
882
|
"application/json": components["schemas"]["CreateRun"];
|
|
@@ -1281,6 +1387,203 @@ export interface operations {
|
|
|
1281
1387
|
};
|
|
1282
1388
|
};
|
|
1283
1389
|
};
|
|
1390
|
+
firmware: {
|
|
1391
|
+
parameters: {
|
|
1392
|
+
query?: never;
|
|
1393
|
+
header?: never;
|
|
1394
|
+
path: {
|
|
1395
|
+
id: string;
|
|
1396
|
+
};
|
|
1397
|
+
cookie?: never;
|
|
1398
|
+
};
|
|
1399
|
+
requestBody?: never;
|
|
1400
|
+
responses: {
|
|
1401
|
+
200: {
|
|
1402
|
+
headers: {
|
|
1403
|
+
/** @description The API version that answered. */
|
|
1404
|
+
"Cloud-Sim-Version"?: string;
|
|
1405
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
1406
|
+
Deprecation?: string;
|
|
1407
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
1408
|
+
Sunset?: string;
|
|
1409
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
1410
|
+
"X-Request-Id"?: string;
|
|
1411
|
+
[name: string]: unknown;
|
|
1412
|
+
};
|
|
1413
|
+
content: {
|
|
1414
|
+
"application/octet-stream": components["schemas"]["ElfFile"];
|
|
1415
|
+
};
|
|
1416
|
+
};
|
|
1417
|
+
/** @description The request is not one the API takes (see `code`). */
|
|
1418
|
+
400: {
|
|
1419
|
+
headers: {
|
|
1420
|
+
/** @description The API version that answered. */
|
|
1421
|
+
"Cloud-Sim-Version"?: string;
|
|
1422
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
1423
|
+
Deprecation?: string;
|
|
1424
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
1425
|
+
Sunset?: string;
|
|
1426
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
1427
|
+
"X-Request-Id"?: string;
|
|
1428
|
+
[name: string]: unknown;
|
|
1429
|
+
};
|
|
1430
|
+
content: {
|
|
1431
|
+
"application/json": components["schemas"]["Error"];
|
|
1432
|
+
};
|
|
1433
|
+
};
|
|
1434
|
+
/** @description No valid credential. */
|
|
1435
|
+
401: {
|
|
1436
|
+
headers: {
|
|
1437
|
+
/** @description The API version that answered. */
|
|
1438
|
+
"Cloud-Sim-Version"?: string;
|
|
1439
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
1440
|
+
Deprecation?: string;
|
|
1441
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
1442
|
+
Sunset?: string;
|
|
1443
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
1444
|
+
"X-Request-Id"?: string;
|
|
1445
|
+
[name: string]: unknown;
|
|
1446
|
+
};
|
|
1447
|
+
content: {
|
|
1448
|
+
"application/json": components["schemas"]["Error"];
|
|
1449
|
+
};
|
|
1450
|
+
};
|
|
1451
|
+
/** @description No such run (`run_not_found`), or its firmware is not stored (`firmware_not_stored`). */
|
|
1452
|
+
404: {
|
|
1453
|
+
headers: {
|
|
1454
|
+
/** @description The API version that answered. */
|
|
1455
|
+
"Cloud-Sim-Version"?: string;
|
|
1456
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
1457
|
+
Deprecation?: string;
|
|
1458
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
1459
|
+
Sunset?: string;
|
|
1460
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
1461
|
+
"X-Request-Id"?: string;
|
|
1462
|
+
[name: string]: unknown;
|
|
1463
|
+
};
|
|
1464
|
+
content: {
|
|
1465
|
+
"application/json": components["schemas"]["Error"];
|
|
1466
|
+
};
|
|
1467
|
+
};
|
|
1468
|
+
/** @description A service the API relies on is unavailable. */
|
|
1469
|
+
503: {
|
|
1470
|
+
headers: {
|
|
1471
|
+
/** @description The API version that answered. */
|
|
1472
|
+
"Cloud-Sim-Version"?: string;
|
|
1473
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
1474
|
+
Deprecation?: string;
|
|
1475
|
+
/** @description Seconds to wait before trying again. */
|
|
1476
|
+
"Retry-After"?: string;
|
|
1477
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
1478
|
+
Sunset?: string;
|
|
1479
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
1480
|
+
"X-Request-Id"?: string;
|
|
1481
|
+
[name: string]: unknown;
|
|
1482
|
+
};
|
|
1483
|
+
content: {
|
|
1484
|
+
"application/json": components["schemas"]["Error"];
|
|
1485
|
+
};
|
|
1486
|
+
};
|
|
1487
|
+
};
|
|
1488
|
+
};
|
|
1489
|
+
delete_firmware: {
|
|
1490
|
+
parameters: {
|
|
1491
|
+
query?: never;
|
|
1492
|
+
header?: never;
|
|
1493
|
+
path: {
|
|
1494
|
+
id: string;
|
|
1495
|
+
};
|
|
1496
|
+
cookie?: never;
|
|
1497
|
+
};
|
|
1498
|
+
requestBody?: never;
|
|
1499
|
+
responses: {
|
|
1500
|
+
200: {
|
|
1501
|
+
headers: {
|
|
1502
|
+
/** @description The API version that answered. */
|
|
1503
|
+
"Cloud-Sim-Version"?: string;
|
|
1504
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
1505
|
+
Deprecation?: string;
|
|
1506
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
1507
|
+
Sunset?: string;
|
|
1508
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
1509
|
+
"X-Request-Id"?: string;
|
|
1510
|
+
[name: string]: unknown;
|
|
1511
|
+
};
|
|
1512
|
+
content: {
|
|
1513
|
+
"application/json": components["schemas"]["Run"];
|
|
1514
|
+
};
|
|
1515
|
+
};
|
|
1516
|
+
/** @description The request is not one the API takes (see `code`). */
|
|
1517
|
+
400: {
|
|
1518
|
+
headers: {
|
|
1519
|
+
/** @description The API version that answered. */
|
|
1520
|
+
"Cloud-Sim-Version"?: string;
|
|
1521
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
1522
|
+
Deprecation?: string;
|
|
1523
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
1524
|
+
Sunset?: string;
|
|
1525
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
1526
|
+
"X-Request-Id"?: string;
|
|
1527
|
+
[name: string]: unknown;
|
|
1528
|
+
};
|
|
1529
|
+
content: {
|
|
1530
|
+
"application/json": components["schemas"]["Error"];
|
|
1531
|
+
};
|
|
1532
|
+
};
|
|
1533
|
+
/** @description No valid credential. */
|
|
1534
|
+
401: {
|
|
1535
|
+
headers: {
|
|
1536
|
+
/** @description The API version that answered. */
|
|
1537
|
+
"Cloud-Sim-Version"?: string;
|
|
1538
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
1539
|
+
Deprecation?: string;
|
|
1540
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
1541
|
+
Sunset?: string;
|
|
1542
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
1543
|
+
"X-Request-Id"?: string;
|
|
1544
|
+
[name: string]: unknown;
|
|
1545
|
+
};
|
|
1546
|
+
content: {
|
|
1547
|
+
"application/json": components["schemas"]["Error"];
|
|
1548
|
+
};
|
|
1549
|
+
};
|
|
1550
|
+
404: {
|
|
1551
|
+
headers: {
|
|
1552
|
+
/** @description The API version that answered. */
|
|
1553
|
+
"Cloud-Sim-Version"?: string;
|
|
1554
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
1555
|
+
Deprecation?: string;
|
|
1556
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
1557
|
+
Sunset?: string;
|
|
1558
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
1559
|
+
"X-Request-Id"?: string;
|
|
1560
|
+
[name: string]: unknown;
|
|
1561
|
+
};
|
|
1562
|
+
content: {
|
|
1563
|
+
"application/json": components["schemas"]["Error"];
|
|
1564
|
+
};
|
|
1565
|
+
};
|
|
1566
|
+
/** @description A service the API relies on is unavailable. */
|
|
1567
|
+
503: {
|
|
1568
|
+
headers: {
|
|
1569
|
+
/** @description The API version that answered. */
|
|
1570
|
+
"Cloud-Sim-Version"?: string;
|
|
1571
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
1572
|
+
Deprecation?: string;
|
|
1573
|
+
/** @description Seconds to wait before trying again. */
|
|
1574
|
+
"Retry-After"?: string;
|
|
1575
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
1576
|
+
Sunset?: string;
|
|
1577
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
1578
|
+
"X-Request-Id"?: string;
|
|
1579
|
+
[name: string]: unknown;
|
|
1580
|
+
};
|
|
1581
|
+
content: {
|
|
1582
|
+
"application/json": components["schemas"]["Error"];
|
|
1583
|
+
};
|
|
1584
|
+
};
|
|
1585
|
+
};
|
|
1586
|
+
};
|
|
1284
1587
|
live: {
|
|
1285
1588
|
parameters: {
|
|
1286
1589
|
query?: {
|
|
@@ -1726,6 +2029,170 @@ export interface operations {
|
|
|
1726
2029
|
};
|
|
1727
2030
|
};
|
|
1728
2031
|
};
|
|
2032
|
+
get_settings: {
|
|
2033
|
+
parameters: {
|
|
2034
|
+
query?: never;
|
|
2035
|
+
header?: never;
|
|
2036
|
+
path?: never;
|
|
2037
|
+
cookie?: never;
|
|
2038
|
+
};
|
|
2039
|
+
requestBody?: never;
|
|
2040
|
+
responses: {
|
|
2041
|
+
200: {
|
|
2042
|
+
headers: {
|
|
2043
|
+
/** @description The API version that answered. */
|
|
2044
|
+
"Cloud-Sim-Version"?: string;
|
|
2045
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
2046
|
+
Deprecation?: string;
|
|
2047
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
2048
|
+
Sunset?: string;
|
|
2049
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
2050
|
+
"X-Request-Id"?: string;
|
|
2051
|
+
[name: string]: unknown;
|
|
2052
|
+
};
|
|
2053
|
+
content: {
|
|
2054
|
+
"application/json": components["schemas"]["Settings"];
|
|
2055
|
+
};
|
|
2056
|
+
};
|
|
2057
|
+
/** @description The request is not one the API takes (see `code`). */
|
|
2058
|
+
400: {
|
|
2059
|
+
headers: {
|
|
2060
|
+
/** @description The API version that answered. */
|
|
2061
|
+
"Cloud-Sim-Version"?: string;
|
|
2062
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
2063
|
+
Deprecation?: string;
|
|
2064
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
2065
|
+
Sunset?: string;
|
|
2066
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
2067
|
+
"X-Request-Id"?: string;
|
|
2068
|
+
[name: string]: unknown;
|
|
2069
|
+
};
|
|
2070
|
+
content: {
|
|
2071
|
+
"application/json": components["schemas"]["Error"];
|
|
2072
|
+
};
|
|
2073
|
+
};
|
|
2074
|
+
/** @description No valid credential. */
|
|
2075
|
+
401: {
|
|
2076
|
+
headers: {
|
|
2077
|
+
/** @description The API version that answered. */
|
|
2078
|
+
"Cloud-Sim-Version"?: string;
|
|
2079
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
2080
|
+
Deprecation?: string;
|
|
2081
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
2082
|
+
Sunset?: string;
|
|
2083
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
2084
|
+
"X-Request-Id"?: string;
|
|
2085
|
+
[name: string]: unknown;
|
|
2086
|
+
};
|
|
2087
|
+
content: {
|
|
2088
|
+
"application/json": components["schemas"]["Error"];
|
|
2089
|
+
};
|
|
2090
|
+
};
|
|
2091
|
+
/** @description A service the API relies on is unavailable. */
|
|
2092
|
+
503: {
|
|
2093
|
+
headers: {
|
|
2094
|
+
/** @description The API version that answered. */
|
|
2095
|
+
"Cloud-Sim-Version"?: string;
|
|
2096
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
2097
|
+
Deprecation?: string;
|
|
2098
|
+
/** @description Seconds to wait before trying again. */
|
|
2099
|
+
"Retry-After"?: string;
|
|
2100
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
2101
|
+
Sunset?: string;
|
|
2102
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
2103
|
+
"X-Request-Id"?: string;
|
|
2104
|
+
[name: string]: unknown;
|
|
2105
|
+
};
|
|
2106
|
+
content: {
|
|
2107
|
+
"application/json": components["schemas"]["Error"];
|
|
2108
|
+
};
|
|
2109
|
+
};
|
|
2110
|
+
};
|
|
2111
|
+
};
|
|
2112
|
+
update_settings: {
|
|
2113
|
+
parameters: {
|
|
2114
|
+
query?: never;
|
|
2115
|
+
header?: never;
|
|
2116
|
+
path?: never;
|
|
2117
|
+
cookie?: never;
|
|
2118
|
+
};
|
|
2119
|
+
requestBody: {
|
|
2120
|
+
content: {
|
|
2121
|
+
"application/json": components["schemas"]["UpdateSettings"];
|
|
2122
|
+
};
|
|
2123
|
+
};
|
|
2124
|
+
responses: {
|
|
2125
|
+
200: {
|
|
2126
|
+
headers: {
|
|
2127
|
+
/** @description The API version that answered. */
|
|
2128
|
+
"Cloud-Sim-Version"?: string;
|
|
2129
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
2130
|
+
Deprecation?: string;
|
|
2131
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
2132
|
+
Sunset?: string;
|
|
2133
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
2134
|
+
"X-Request-Id"?: string;
|
|
2135
|
+
[name: string]: unknown;
|
|
2136
|
+
};
|
|
2137
|
+
content: {
|
|
2138
|
+
"application/json": components["schemas"]["Settings"];
|
|
2139
|
+
};
|
|
2140
|
+
};
|
|
2141
|
+
/** @description The request is not one the API takes (see `code`). */
|
|
2142
|
+
400: {
|
|
2143
|
+
headers: {
|
|
2144
|
+
/** @description The API version that answered. */
|
|
2145
|
+
"Cloud-Sim-Version"?: string;
|
|
2146
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
2147
|
+
Deprecation?: string;
|
|
2148
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
2149
|
+
Sunset?: string;
|
|
2150
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
2151
|
+
"X-Request-Id"?: string;
|
|
2152
|
+
[name: string]: unknown;
|
|
2153
|
+
};
|
|
2154
|
+
content: {
|
|
2155
|
+
"application/json": components["schemas"]["Error"];
|
|
2156
|
+
};
|
|
2157
|
+
};
|
|
2158
|
+
/** @description No valid credential. */
|
|
2159
|
+
401: {
|
|
2160
|
+
headers: {
|
|
2161
|
+
/** @description The API version that answered. */
|
|
2162
|
+
"Cloud-Sim-Version"?: string;
|
|
2163
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
2164
|
+
Deprecation?: string;
|
|
2165
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
2166
|
+
Sunset?: string;
|
|
2167
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
2168
|
+
"X-Request-Id"?: string;
|
|
2169
|
+
[name: string]: unknown;
|
|
2170
|
+
};
|
|
2171
|
+
content: {
|
|
2172
|
+
"application/json": components["schemas"]["Error"];
|
|
2173
|
+
};
|
|
2174
|
+
};
|
|
2175
|
+
/** @description A service the API relies on is unavailable. */
|
|
2176
|
+
503: {
|
|
2177
|
+
headers: {
|
|
2178
|
+
/** @description The API version that answered. */
|
|
2179
|
+
"Cloud-Sim-Version"?: string;
|
|
2180
|
+
/** @description For a deprecated version: `@` and the Unix time it was deprecated (RFC 9745). */
|
|
2181
|
+
Deprecation?: string;
|
|
2182
|
+
/** @description Seconds to wait before trying again. */
|
|
2183
|
+
"Retry-After"?: string;
|
|
2184
|
+
/** @description For a deprecated version with a sunset date: when it retires (RFC 8594). */
|
|
2185
|
+
Sunset?: string;
|
|
2186
|
+
/** @description The request's id, which an error's `request_id` repeats. */
|
|
2187
|
+
"X-Request-Id"?: string;
|
|
2188
|
+
[name: string]: unknown;
|
|
2189
|
+
};
|
|
2190
|
+
content: {
|
|
2191
|
+
"application/json": components["schemas"]["Error"];
|
|
2192
|
+
};
|
|
2193
|
+
};
|
|
2194
|
+
};
|
|
2195
|
+
};
|
|
1729
2196
|
versions: {
|
|
1730
2197
|
parameters: {
|
|
1731
2198
|
query?: never;
|
package/dist/http.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface TransportOptions {
|
|
|
22
22
|
}
|
|
23
23
|
export type Query = Record<string, string | number | boolean | undefined>;
|
|
24
24
|
export interface Call {
|
|
25
|
-
method: 'GET' | 'POST';
|
|
25
|
+
method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
26
26
|
path: string;
|
|
27
27
|
query?: Query;
|
|
28
28
|
/** A JSON body. */
|
|
@@ -40,8 +40,9 @@ export interface Call {
|
|
|
40
40
|
/**
|
|
41
41
|
* Whether a transient failure may be sent again: true for reads, for a
|
|
42
42
|
* create that carries an Idempotency-Key, which the server answers with
|
|
43
|
-
* the run it already made,
|
|
44
|
-
* run as it is
|
|
43
|
+
* the run it already made, for a cancel or a firmware deletion, which it
|
|
44
|
+
* answers with the run as it is, and for a settings change, which sets
|
|
45
|
+
* what it sets again.
|
|
45
46
|
*/
|
|
46
47
|
retry: boolean;
|
|
47
48
|
}
|
|
@@ -60,6 +61,8 @@ export declare class Transport {
|
|
|
60
61
|
json<T>(call: Call): Promise<T>;
|
|
61
62
|
/** The answer as text. */
|
|
62
63
|
text(call: Call): Promise<string>;
|
|
64
|
+
/** The answer's bytes. */
|
|
65
|
+
bytes(call: Call): Promise<Uint8Array>;
|
|
63
66
|
/**
|
|
64
67
|
* The answer itself, its body unread (an event stream). Aborting the
|
|
65
68
|
* call's signal later still ends the body.
|
package/dist/http.js
CHANGED
|
@@ -54,6 +54,13 @@ export class Transport {
|
|
|
54
54
|
const headers = { Accept: 'text/plain', ...call.headers };
|
|
55
55
|
return this.request({ ...call, headers }, (response) => response.text());
|
|
56
56
|
}
|
|
57
|
+
/** The answer's bytes. */
|
|
58
|
+
bytes(call) {
|
|
59
|
+
const headers = { Accept: 'application/octet-stream', ...call.headers };
|
|
60
|
+
return this.request({ ...call, headers }, async (response) => {
|
|
61
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
62
|
+
});
|
|
63
|
+
}
|
|
57
64
|
/**
|
|
58
65
|
* The answer itself, its body unread (an event stream). Aborting the
|
|
59
66
|
* call's signal later still ends the body.
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type { ApiKey, RetryInfo } from './http.js';
|
|
|
4
4
|
export { type FollowEvent, type FollowOptions, type FollowTransport, type Offsets, type StreamName, POLL_INTERVAL_MS, } from './follow.js';
|
|
5
5
|
export type { CallOptions, Comparison, CompareParams, CreateOptions, CreateRunParams, FirmwareInput, ListRunsParams, RunListing, RunOptionsInput, Runs, WaitOptions, } from './runs.js';
|
|
6
6
|
export type { McuFilter, McuListOptions, Mcus, Versions } from './catalog.js';
|
|
7
|
+
export type { Settings as SettingsClient, UpdateSettingsParams } from './settings.js';
|
|
7
8
|
export { type Difference, type ResultComparison, compareResults } from './compare.js';
|
|
8
|
-
export { type Changes, type Engine, type EngineOption, type ErrorBody, type Firmware, type Lifecycle, type Live, type LiveStream, type Mcu, type McuEngine, type McuList, type Run, type RunEngine, type RunList, type RunOptions, type RunResult, type RunStatus, type UartEncoding, type Version, type VersionList, FINISHED, isFinished, } from './types.js';
|
|
9
|
+
export { type Changes, type Engine, type EngineOption, type ErrorBody, type Firmware, type FirmwareSource, type Lifecycle, type Live, type LiveStream, type Mcu, type McuEngine, type McuList, type Run, type RunEngine, type RunList, type RunOptions, type RunResult, type RunStatus, type Settings, type StoredFirmware, type UartEncoding, type Version, type VersionList, FINISHED, isFinished, } from './types.js';
|
|
9
10
|
export type { components, operations, paths } from './generated/v1.js';
|
package/dist/runs.d.ts
CHANGED
|
@@ -3,13 +3,16 @@ import { type Transport } from './http.js';
|
|
|
3
3
|
import { type Run, type RunList, type RunResult, type UartEncoding, type Version } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* A run's firmware: the ELF's bytes (sent as a multipart upload), an https
|
|
6
|
-
* URL the server fetches it from,
|
|
7
|
-
*
|
|
6
|
+
* URL the server fetches it from, the ELF already base64-encoded (sent in
|
|
7
|
+
* JSON), or the id of one of your runs whose firmware the server stores
|
|
8
|
+
* (`run.firmware.stored`), to run it again.
|
|
8
9
|
*/
|
|
9
10
|
export type FirmwareInput = Blob | Uint8Array | ArrayBuffer | {
|
|
10
11
|
url: string;
|
|
11
12
|
} | {
|
|
12
13
|
base64: string;
|
|
14
|
+
} | {
|
|
15
|
+
run: string;
|
|
13
16
|
};
|
|
14
17
|
/** What every call takes. */
|
|
15
18
|
export interface CallOptions {
|
|
@@ -105,6 +108,19 @@ export declare class Runs {
|
|
|
105
108
|
* run that finished meanwhile gets the 409, which is not retried.
|
|
106
109
|
*/
|
|
107
110
|
cancel(id: string, options?: CallOptions): Promise<Run>;
|
|
111
|
+
/**
|
|
112
|
+
* The ELF the run simulated, as it was given, while the server stores it
|
|
113
|
+
* (`run.firmware.stored`). One it does not store is 404
|
|
114
|
+
* `firmware_not_stored`.
|
|
115
|
+
*/
|
|
116
|
+
firmware(id: string, options?: CallOptions): Promise<Uint8Array>;
|
|
117
|
+
/**
|
|
118
|
+
* Deletes the run's stored firmware: at once, or for a run that has not
|
|
119
|
+
* ended, when it does. Answers with the run, `firmware.stored` false and
|
|
120
|
+
* `firmware.deleted_at` saying when. Retried like a read: the server
|
|
121
|
+
* answers a repeated deletion with the run as it is.
|
|
122
|
+
*/
|
|
123
|
+
deleteFirmware(id: string, options?: CallOptions): Promise<Run>;
|
|
108
124
|
/** The run once it has finished: succeeded, failed or canceled. */
|
|
109
125
|
wait(id: string, options?: WaitOptions): Promise<Run>;
|
|
110
126
|
/**
|
package/dist/runs.js
CHANGED
|
@@ -74,6 +74,33 @@ export class Runs {
|
|
|
74
74
|
retry: true,
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* The ELF the run simulated, as it was given, while the server stores it
|
|
79
|
+
* (`run.firmware.stored`). One it does not store is 404
|
|
80
|
+
* `firmware_not_stored`.
|
|
81
|
+
*/
|
|
82
|
+
firmware(id, options = {}) {
|
|
83
|
+
return this.http.bytes({
|
|
84
|
+
method: 'GET',
|
|
85
|
+
path: `/v1/runs/${segment(id)}/firmware`,
|
|
86
|
+
signal: options.signal,
|
|
87
|
+
retry: true,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Deletes the run's stored firmware: at once, or for a run that has not
|
|
92
|
+
* ended, when it does. Answers with the run, `firmware.stored` false and
|
|
93
|
+
* `firmware.deleted_at` saying when. Retried like a read: the server
|
|
94
|
+
* answers a repeated deletion with the run as it is.
|
|
95
|
+
*/
|
|
96
|
+
deleteFirmware(id, options = {}) {
|
|
97
|
+
return this.http.json({
|
|
98
|
+
method: 'DELETE',
|
|
99
|
+
path: `/v1/runs/${segment(id)}/firmware`,
|
|
100
|
+
signal: options.signal,
|
|
101
|
+
retry: true,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
77
104
|
/** The run once it has finished: succeeded, failed or canceled. */
|
|
78
105
|
async wait(id, options = {}) {
|
|
79
106
|
const { signal, intervalMs = WAIT_INTERVAL_MS } = options;
|
|
@@ -250,8 +277,11 @@ function firmwareBody(firmware) {
|
|
|
250
277
|
if ('base64' in firmware && typeof firmware.base64 === 'string') {
|
|
251
278
|
return { kind: 'json', json: { base64: firmware.base64 } };
|
|
252
279
|
}
|
|
280
|
+
if ('run' in firmware && typeof firmware.run === 'string') {
|
|
281
|
+
return { kind: 'json', json: { run: firmware.run } };
|
|
282
|
+
}
|
|
253
283
|
}
|
|
254
|
-
throw new TypeError('firmware must be a Blob, a Uint8Array, an ArrayBuffer, { url } or {
|
|
284
|
+
throw new TypeError('firmware must be a Blob, a Uint8Array, an ArrayBuffer, { url }, { base64 } or { run }');
|
|
255
285
|
}
|
|
256
286
|
/** The run's fields other than its firmware, as the API names them. */
|
|
257
287
|
function optionFields(params) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CallOptions } from './runs.js';
|
|
2
|
+
import type { Transport } from './http.js';
|
|
3
|
+
import type { Settings as SettingsBody } from './types.js';
|
|
4
|
+
/** The settings to change. One left out stays as it is. */
|
|
5
|
+
export interface UpdateSettingsParams extends CallOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the server stores runs' firmware. Turning it off deletes every
|
|
8
|
+
* run's stored firmware (an unfinished run's when it ends) and stores
|
|
9
|
+
* none from then on; turning it on stores the firmware of runs that end
|
|
10
|
+
* from then on.
|
|
11
|
+
*/
|
|
12
|
+
storeFirmware?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class Settings {
|
|
15
|
+
private readonly http;
|
|
16
|
+
constructor(http: Transport);
|
|
17
|
+
/** Your settings, and how much firmware the server stores for you. */
|
|
18
|
+
get(options?: CallOptions): Promise<SettingsBody>;
|
|
19
|
+
/** Changes the settings given, and answers with all of them. */
|
|
20
|
+
update(params: UpdateSettingsParams): Promise<SettingsBody>;
|
|
21
|
+
}
|
package/dist/settings.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// `client.settings`: your settings. One so far: whether the server stores
|
|
2
|
+
// each run's firmware after the run, so you can download it
|
|
3
|
+
// (`runs.firmware`) and run it again (`firmware: { run: id }`).
|
|
4
|
+
export class Settings {
|
|
5
|
+
http;
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
/** Your settings, and how much firmware the server stores for you. */
|
|
10
|
+
get(options = {}) {
|
|
11
|
+
return this.http.json({
|
|
12
|
+
method: 'GET',
|
|
13
|
+
path: '/v1/settings',
|
|
14
|
+
signal: options.signal,
|
|
15
|
+
retry: true,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/** Changes the settings given, and answers with all of them. */
|
|
19
|
+
update(params) {
|
|
20
|
+
const json = {};
|
|
21
|
+
if (params.storeFirmware !== undefined)
|
|
22
|
+
json['store_firmware'] = params.storeFirmware;
|
|
23
|
+
return this.http.json({
|
|
24
|
+
method: 'PATCH',
|
|
25
|
+
path: '/v1/settings',
|
|
26
|
+
json,
|
|
27
|
+
signal: params.signal,
|
|
28
|
+
// Setting the same value again changes nothing more.
|
|
29
|
+
retry: true,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -12,8 +12,14 @@ export type RunOptions = Schemas['RunOptions'];
|
|
|
12
12
|
export type RunResult = Schemas['RunResult'];
|
|
13
13
|
/** A page of the caller's runs, newest first. */
|
|
14
14
|
export type RunList = Schemas['RunList'];
|
|
15
|
-
/** The firmware a run simulates, as the server received it. */
|
|
15
|
+
/** The firmware a run simulates, as the server received it, and whether it stores it. */
|
|
16
16
|
export type Firmware = Schemas['Firmware'];
|
|
17
|
+
/** How a run's firmware came: uploaded, base64, from a URL, or another run's stored firmware. */
|
|
18
|
+
export type FirmwareSource = Schemas['FirmwareSource'];
|
|
19
|
+
/** Your settings: whether the server stores runs' firmware, and how much it stores. */
|
|
20
|
+
export type Settings = Schemas['Settings'];
|
|
21
|
+
/** The firmware the server stores for you. */
|
|
22
|
+
export type StoredFirmware = Schemas['StoredFirmware'];
|
|
17
23
|
/** A run and a page of each of its streams (`GET /v1/runs/{id}/live`). */
|
|
18
24
|
export type Live = Schemas['Live'];
|
|
19
25
|
/** A page of one stream. */
|
package/package.json
CHANGED