@printobserver/sdk 0.7.0 → 0.8.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 +26 -3
- package/dist/contract.js +22 -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", "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"];
|
|
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", "close_print", "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. */
|
|
@@ -50,7 +50,7 @@ export type ActionId = string;
|
|
|
50
50
|
* the
|
|
51
51
|
* payload lives on `PrintAction` itself.
|
|
52
52
|
*/
|
|
53
|
-
export type ActionKind = "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";
|
|
53
|
+
export type ActionKind = "pause" | "resume" | "cancel" | "start_print" | "set_feedrate_factor" | "set_flowrate_factor" | "set_tool_target_c" | "set_bed_target_c" | "set_fan_percent" | "acknowledge_failure" | "close_print" | "register_spool" | "load_spool" | "unload_spool" | "adjust_spool" | "retire_spool";
|
|
54
54
|
/**
|
|
55
55
|
* One request, the decision taken on it, and what became of it.
|
|
56
56
|
*
|
|
@@ -981,6 +981,11 @@ export type PrintAction = {
|
|
|
981
981
|
disposition: AcknowledgementDisposition;
|
|
982
982
|
event_id: EventId;
|
|
983
983
|
reason: string;
|
|
984
|
+
} | {
|
|
985
|
+
action: "close_print";
|
|
986
|
+
actor: Actor;
|
|
987
|
+
outcome: PrintOutcome;
|
|
988
|
+
reason: string;
|
|
984
989
|
};
|
|
985
990
|
/** Everything a supervision turn is given about one print. */
|
|
986
991
|
export interface PrintContext {
|
|
@@ -1024,7 +1029,7 @@ export interface PrintEndedPayload {
|
|
|
1024
1029
|
/** A lowercase hyphenated version 7 UUID identifying one print. */
|
|
1025
1030
|
export type PrintId = string;
|
|
1026
1031
|
/** How a print ended. */
|
|
1027
|
-
export type PrintOutcome = "completed" | "cancelled" | "failed";
|
|
1032
|
+
export type PrintOutcome = "completed" | "cancelled" | "failed" | "interrupted";
|
|
1028
1033
|
/**
|
|
1029
1034
|
* One print, and the record supervision keys from.
|
|
1030
1035
|
*
|
|
@@ -1222,6 +1227,14 @@ export type RejectionReason = {
|
|
|
1222
1227
|
file_name: string;
|
|
1223
1228
|
waited_s: number;
|
|
1224
1229
|
};
|
|
1230
|
+
} | "print_already_ended" | {
|
|
1231
|
+
print_still_active: {
|
|
1232
|
+
state: PrinterState;
|
|
1233
|
+
};
|
|
1234
|
+
} | {
|
|
1235
|
+
intervention_still_active: {
|
|
1236
|
+
intervention_id: InterventionId;
|
|
1237
|
+
};
|
|
1225
1238
|
} | {
|
|
1226
1239
|
spool_refused: {
|
|
1227
1240
|
cause: SpoolRefusalCause;
|
|
@@ -1921,6 +1934,16 @@ export declare class GeneratedClient extends GeneratedSurface {
|
|
|
1921
1934
|
* the reason, the value asked for and the range allowed.
|
|
1922
1935
|
*/
|
|
1923
1936
|
acknowledgeFailure(printId: string, disposition: AcknowledgementDisposition, eventId: EventId, reason: string): Promise<ActionAnswer>;
|
|
1937
|
+
/**
|
|
1938
|
+
* Call `close_print` on the configured supervisor.
|
|
1939
|
+
*
|
|
1940
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1941
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1942
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
1943
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
1944
|
+
* the reason, the value asked for and the range allowed.
|
|
1945
|
+
*/
|
|
1946
|
+
closePrint(printId: string, outcome: PrintOutcome, reason: string): Promise<ActionAnswer>;
|
|
1924
1947
|
/**
|
|
1925
1948
|
* Call `register_spool` on the configured supervisor.
|
|
1926
1949
|
*
|
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.8.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.
|
|
@@ -36,6 +36,7 @@ export const OPERATION_NAMES = [
|
|
|
36
36
|
"set_bed_target_c",
|
|
37
37
|
"set_fan_percent",
|
|
38
38
|
"acknowledge_failure",
|
|
39
|
+
"close_print",
|
|
39
40
|
"register_spool",
|
|
40
41
|
"load_spool",
|
|
41
42
|
"unload_spool",
|
|
@@ -556,6 +557,26 @@ export class GeneratedClient extends GeneratedSurface {
|
|
|
556
557
|
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
557
558
|
return await this.call("POST", target, asked, sending);
|
|
558
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* Call `close_print` on the configured supervisor.
|
|
562
|
+
*
|
|
563
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
564
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
565
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
566
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
567
|
+
* the reason, the value asked for and the range allowed.
|
|
568
|
+
*/
|
|
569
|
+
async closePrint(printId, outcome, reason) {
|
|
570
|
+
reasonGiven(reason);
|
|
571
|
+
const target = `/v1/prints/${printId}/actions/close_print`;
|
|
572
|
+
const asked = [];
|
|
573
|
+
const sending = {};
|
|
574
|
+
sending.actor = this.actor;
|
|
575
|
+
sending.outcome = outcome;
|
|
576
|
+
sending.reason = reason;
|
|
577
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
578
|
+
return await this.call("POST", target, asked, sending);
|
|
579
|
+
}
|
|
559
580
|
/**
|
|
560
581
|
* Call `register_spool` on the configured supervisor.
|
|
561
582
|
*
|
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.8.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.8.0"
|
|
23
23
|
}
|