@printobserver/sdk 0.5.0 → 0.6.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/dist/contract.d.ts +40 -1
- package/dist/contract.js +38 -1
- package/package.json +2 -2
package/dist/contract.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare const CONTRACT_VERSION: string;
|
|
|
18
18
|
* Every operation this client exposes a method for, which is every operation
|
|
19
19
|
* the server declares and no other.
|
|
20
20
|
*/
|
|
21
|
-
export declare const OPERATION_NAMES: readonly ["prints", "status", "context", "image", "history", "manifest_get", "look", "manifest_set", "spools", "spool", "printer_history", "preflight", "pause", "resume", "cancel", "start_print", "set_feedrate_factor", "set_flowrate_factor", "set_tool_target_c", "set_bed_target_c", "set_fan_percent", "acknowledge_failure", "register_spool", "load_spool", "unload_spool", "adjust_spool", "retire_spool"];
|
|
21
|
+
export declare const OPERATION_NAMES: readonly ["prints", "status", "context", "image", "history", "events", "manifest_get", "look", "manifest_set", "spools", "spool", "printer_history", "preflight", "pause", "resume", "cancel", "start_print", "set_feedrate_factor", "set_flowrate_factor", "set_tool_target_c", "set_bed_target_c", "set_fan_percent", "acknowledge_failure", "register_spool", "load_spool", "unload_spool", "adjust_spool", "retire_spool"];
|
|
22
22
|
/** What an operator's acknowledgement of a failure event asks for next. */
|
|
23
23
|
export type AcknowledgementDisposition = "continue" | "watch" | "stop";
|
|
24
24
|
/** What one mutating request left behind it. */
|
|
@@ -264,6 +264,28 @@ export interface EventRecord {
|
|
|
264
264
|
* declares for itself.
|
|
265
265
|
*/
|
|
266
266
|
export type EventSource = string;
|
|
267
|
+
/**
|
|
268
|
+
* What an events read answers: the events stored after its cursor that pass
|
|
269
|
+
* its filters, oldest first, and where the next read picks up.
|
|
270
|
+
*/
|
|
271
|
+
export interface EventsAnswer {
|
|
272
|
+
/**
|
|
273
|
+
* The last event this read examined, whether or not it passed the
|
|
274
|
+
* filters, given as `after` to read on from it; null when the log held
|
|
275
|
+
* nothing to start after. Always sent, as null when it is that.
|
|
276
|
+
*/
|
|
277
|
+
cursor: EventId | null;
|
|
278
|
+
/**
|
|
279
|
+
* The events, oldest first in the order they were stored, each exactly as
|
|
280
|
+
* a history read serves it.
|
|
281
|
+
*/
|
|
282
|
+
events: Array<EventRecord>;
|
|
283
|
+
/**
|
|
284
|
+
* The watched print's end as stored, whatever the filters said, and null
|
|
285
|
+
* while it is open. Absent from a read that names no print.
|
|
286
|
+
*/
|
|
287
|
+
print_ended?: PrintEnded | null;
|
|
288
|
+
}
|
|
267
289
|
/** What happened when an accepted action reached the printer. */
|
|
268
290
|
export type ExecutionOutcome = "succeeded" | {
|
|
269
291
|
failed: {
|
|
@@ -914,6 +936,15 @@ export interface PrintContext {
|
|
|
914
936
|
/** A bounded list of this print's events, newest first. */
|
|
915
937
|
recent_events: Array<EventRecord>;
|
|
916
938
|
}
|
|
939
|
+
/** One print's end, as its `print_ended` event stored it. */
|
|
940
|
+
export interface PrintEnded {
|
|
941
|
+
/** The `print_ended` event. */
|
|
942
|
+
event_id: EventId;
|
|
943
|
+
/** How the print ended. */
|
|
944
|
+
outcome: PrintOutcome;
|
|
945
|
+
/** When that event was received. */
|
|
946
|
+
received_at: Timestamp;
|
|
947
|
+
}
|
|
917
948
|
/** A print ended. */
|
|
918
949
|
export interface PrintEndedPayload {
|
|
919
950
|
/** How far into its file it last read, when that was read. */
|
|
@@ -1578,6 +1609,14 @@ export declare class GeneratedClient extends GeneratedSurface {
|
|
|
1578
1609
|
* said no.
|
|
1579
1610
|
*/
|
|
1580
1611
|
history(printId: string, limit?: number): Promise<HistoryAnswer>;
|
|
1612
|
+
/**
|
|
1613
|
+
* Call `events` on the configured supervisor.
|
|
1614
|
+
*
|
|
1615
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1616
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1617
|
+
* said no.
|
|
1618
|
+
*/
|
|
1619
|
+
events(after?: string, printId?: string, kinds?: Array<string>, excludeKinds?: Array<string>, waitS?: number, limit?: number): Promise<EventsAnswer>;
|
|
1581
1620
|
/**
|
|
1582
1621
|
* Call `manifest_get` on the configured supervisor.
|
|
1583
1622
|
*
|
package/dist/contract.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* generate-clients`, and commit what that writes.
|
|
8
8
|
*/
|
|
9
9
|
import { GeneratedSurface, reasonGiven } from "./surface.js";
|
|
10
|
-
export const CONTRACT_VERSION = "0.
|
|
10
|
+
export const CONTRACT_VERSION = "0.6.0";
|
|
11
11
|
/**
|
|
12
12
|
* Every operation this client exposes a method for, which is every operation
|
|
13
13
|
* the server declares and no other.
|
|
@@ -18,6 +18,7 @@ export const OPERATION_NAMES = [
|
|
|
18
18
|
"context",
|
|
19
19
|
"image",
|
|
20
20
|
"history",
|
|
21
|
+
"events",
|
|
21
22
|
"manifest_get",
|
|
22
23
|
"look",
|
|
23
24
|
"manifest_set",
|
|
@@ -169,6 +170,42 @@ export class GeneratedClient extends GeneratedSurface {
|
|
|
169
170
|
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
170
171
|
return await this.call("GET", target, asked, sending);
|
|
171
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Call `events` on the configured supervisor.
|
|
175
|
+
*
|
|
176
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
177
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
178
|
+
* said no.
|
|
179
|
+
*/
|
|
180
|
+
async events(after, printId, kinds, excludeKinds, waitS, limit) {
|
|
181
|
+
const target = `/v1/events`;
|
|
182
|
+
const asked = [];
|
|
183
|
+
if (after !== undefined) {
|
|
184
|
+
asked.push(["after", String(after)]);
|
|
185
|
+
}
|
|
186
|
+
if (printId !== undefined) {
|
|
187
|
+
asked.push(["print_id", String(printId)]);
|
|
188
|
+
}
|
|
189
|
+
if (kinds !== undefined) {
|
|
190
|
+
for (const value of kinds) {
|
|
191
|
+
asked.push(["kinds", String(value)]);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (excludeKinds !== undefined) {
|
|
195
|
+
for (const value of excludeKinds) {
|
|
196
|
+
asked.push(["exclude_kinds", String(value)]);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (waitS !== undefined) {
|
|
200
|
+
asked.push(["wait_s", String(waitS)]);
|
|
201
|
+
}
|
|
202
|
+
if (limit !== undefined) {
|
|
203
|
+
asked.push(["limit", String(limit)]);
|
|
204
|
+
}
|
|
205
|
+
const sending = undefined;
|
|
206
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
207
|
+
return await this.call("GET", target, asked, sending);
|
|
208
|
+
}
|
|
172
209
|
/**
|
|
173
210
|
* Call `manifest_get` on the configured supervisor.
|
|
174
211
|
*
|
package/package.json
CHANGED
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"main": "dist/index.js",
|
|
14
14
|
"name": "@printobserver/sdk",
|
|
15
|
-
"printobserverContractVersion": "0.
|
|
15
|
+
"printobserverContractVersion": "0.6.0",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "https://github.com/nickderobertis/printobserver"
|
|
19
19
|
},
|
|
20
20
|
"type": "module",
|
|
21
21
|
"types": "dist/index.d.ts",
|
|
22
|
-
"version": "0.
|
|
22
|
+
"version": "0.6.0"
|
|
23
23
|
}
|