@printobserver/sdk 0.2.0 → 0.4.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/client.d.ts CHANGED
@@ -24,9 +24,12 @@ export interface ClientOptions {
24
24
  /** Who this client acts as. */
25
25
  actor: Actor;
26
26
  /**
27
- * What authenticates to it. This server requires none of its API callers; a
28
- * credential is for a deployment that has put something in front of it that
29
- * does.
27
+ * What authenticates to it. The supervisor serves no versioned operation to a
28
+ * caller that does not present a credential it admits — the operator's, whose
29
+ * verifier it is configured with and which `printobserver credential issue`
30
+ * issues, or the one a supervision turn is handed — and a call it refuses for
31
+ * that throws `Refused` with status 401. A call whose actor is not the
32
+ * identity that credential is throws it with status 403.
30
33
  */
31
34
  credential?: string;
32
35
  }
package/dist/client.js CHANGED
@@ -115,7 +115,9 @@ function refusalText(said) {
115
115
  /** The policy's own refusal, as the answer to it carries it. */
116
116
  function rejection(status, said) {
117
117
  const answer = document(status, said);
118
- const decision = answer.record.decision;
118
+ // An action's answer carries its decision in its record; a spool command's
119
+ // carries it at the top.
120
+ const decision = "record" in answer ? answer.record.decision : answer.decision;
119
121
  if (typeof decision !== "object" || !("rejected" in decision)) {
120
122
  return new Unreadable(status, "the supervisor refused this action and answered a record whose decision is not a refusal");
121
123
  }