@hecks/client 5.0.0 → 6.0.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 +2 -0
- package/dist/answer.d.ts +28 -0
- package/dist/answer.js.map +1 -1
- package/dist/client.d.ts +16 -1
- package/dist/client.js +41 -2
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -106,6 +106,8 @@ missing domain or URL throws a `TypeError`.
|
|
|
106
106
|
- `read(): Promise<Answer>`: posts `{"read": true}` and returns everything the domain holds.
|
|
107
107
|
- `dispatch(verb, args = {}, to?, role?, actorId?): Promise<Answer>`: posts one command and returns the raw answer. `verb` is `Aggregate.Verb` or fully qualified. `to` targets an existing instance and is omitted for a command that creates one.
|
|
108
108
|
- `query(name, args = {}): Promise<Answer>`: asks one declared query (`Aggregate.Query`, bare or qualified) and returns the raw answer, with the result in `answer.queries` (`[{ query, rows, error? }]`). The host reads current state and writes nothing. A server-side call like the others: the host accepts it only from the same machine.
|
|
109
|
+
- `validate(verb, args = {}, to?, role?, actorId?): Promise<Validation>`: asks whether a command would be accepted right now, and if not, why: `{ ok, refusals: [{ kind, stage, refusal?, message, attribute?, path?, rule? }] }`. The host runs the command as far as it can and keeps nothing, and answers HTTP 200 whether or not it would be refused, so this resolves with the verdict and never throws `DomainRefusal`. Advisory: the state it judged can change before the real dispatch. The Rust host lists every unmet given, ensure and invariant of the stage it stopped in, and every unknown and absent argument, each naming its `rule` or its `attribute` and `path`; a coercion mismatch it reports alone.
|
|
110
|
+
- `schema(verb): Promise<object>`: the JSON Schema (draft 2020-12) of the facts a command takes, for checking a payload locally before asking. Rules over stored state ride along as `x-` annotations; `validate` stays the authority on them. The host serves it at the command's JSON route with `?schema=1`, from the `<domain>.schemas.json` the wasm build writes beside the IR. Throws `DomainUnavailable` when the host cannot be reached or has no schema for the command.
|
|
109
111
|
- `apply<T>(command): Promise<T>`: dispatches `command.verb` with `command.with`, `command.to`, `command.role` and `command.actorId`, reads the answer with `command.parse`, and returns the result when `command.confirm` accepts it. Otherwise it throws `DomainRefusal` built from the answer's last refusal.
|
|
110
112
|
- `instancesOf(answer, aggregate): [string, state][]`: the states of one aggregate, bare or qualified name.
|
|
111
113
|
|
package/dist/answer.d.ts
CHANGED
|
@@ -4,6 +4,32 @@ export interface Refusal {
|
|
|
4
4
|
kind: string;
|
|
5
5
|
error: string;
|
|
6
6
|
}
|
|
7
|
+
/** One reason a command would be refused, as a validation reports it. */
|
|
8
|
+
export interface ValidationRefusal {
|
|
9
|
+
/** What sort of no: `refused`, `not_found`, `unauthorized` or `absent_argument`. */
|
|
10
|
+
kind: string;
|
|
11
|
+
/** The point of dispatch it came from: `arguments`, `role`, `references`, `state`, `givens`, `ensures`, `invariants`. */
|
|
12
|
+
stage: string;
|
|
13
|
+
/** The refusal class the domain raises (`GivenNotMet`), when the host names it. */
|
|
14
|
+
refusal?: string | null;
|
|
15
|
+
/** The domain's own words for why. */
|
|
16
|
+
message: string | null;
|
|
17
|
+
/** The attribute it is about, when the host knows (the Ruby runtime does; the Rust host does not yet). */
|
|
18
|
+
attribute?: string | null;
|
|
19
|
+
/** A JSON Pointer to the offending value, when the host knows. */
|
|
20
|
+
path?: string | null;
|
|
21
|
+
/** The text of the rule that refused, when the host knows. */
|
|
22
|
+
rule?: string | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Whether a command would be accepted right now and, if not, why. Advisory: the state it was judged
|
|
26
|
+
* on can change before the real dispatch, which stays authoritative. The Rust host stops at the
|
|
27
|
+
* first refusal, so `refusals` holds at most one there.
|
|
28
|
+
*/
|
|
29
|
+
export interface Validation {
|
|
30
|
+
ok: boolean;
|
|
31
|
+
refusals: ValidationRefusal[];
|
|
32
|
+
}
|
|
7
33
|
/**
|
|
8
34
|
* The body of every host answer: the state of the aggregates, keyed
|
|
9
35
|
* `Domain::Aggregate#id`, and the refusals the run reported. `error` is set
|
|
@@ -15,6 +41,8 @@ export interface Answer {
|
|
|
15
41
|
/** One entry per question asked with `HostClient#query`. */
|
|
16
42
|
queries?: QueryResult[];
|
|
17
43
|
error?: string;
|
|
44
|
+
/** Set on the answer to a validation (`HostClient#validate`). */
|
|
45
|
+
ok?: boolean;
|
|
18
46
|
}
|
|
19
47
|
/**
|
|
20
48
|
* What the host answered to one declared query: its rows (each a state, keyed
|
package/dist/answer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer.js","sourceRoot":"","sources":["../src/answer.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,6EAA6E;AAC7E,8CAA8C;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"answer.js","sourceRoot":"","sources":["../src/answer.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,6EAA6E;AAC7E,8CAA8C;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA+D5C;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,SAAiB;IAC3D,MAAM,MAAM,GAAG,GAAG,SAAS,GAAG,CAAC;IAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;SAC1C,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;SACzC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,+EAA+E;AAC/E,8DAA8D;AAC9D,SAAS,MAAM,CAAC,GAAY,EAAE,GAAW;IACvC,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,GAAG;Q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AAI,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IACxH,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACpD,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAChH,MAAM,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,IAAI,cAAc,EAAE,KAAK,CAAC,KAAK,IAAI,2BAA2B,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACpH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Answer } from "./answer.js";
|
|
1
|
+
import type { Answer, Validation } from "./answer.js";
|
|
2
2
|
/** What a `HostClient` needs to reach one domain. */
|
|
3
3
|
export interface ClientOptions {
|
|
4
4
|
/** The domain's name as its bluebook declares it ("Shop"). Falls back to the `HECKS_DOMAIN` environment variable. */
|
|
@@ -69,6 +69,21 @@ export declare class HostClient {
|
|
|
69
69
|
* from the state in it and turn a miss into a refusal with `refusalOf`.
|
|
70
70
|
*/
|
|
71
71
|
dispatch(verb: string, args?: Record<string, unknown>, to?: string, role?: string, actorId?: string): Promise<Answer>;
|
|
72
|
+
/**
|
|
73
|
+
* Asks whether a command would be accepted right now, and if not, why. The host runs the command
|
|
74
|
+
* as far as it can and keeps nothing: no write, no reaction. It answers HTTP 200 whether or not
|
|
75
|
+
* the command would be refused, so this resolves with the verdict and never throws a
|
|
76
|
+
* `DomainRefusal`; `DomainUnavailable` still means the host could not be reached.
|
|
77
|
+
*/
|
|
78
|
+
validate(verb: string, args?: Record<string, unknown>, to?: string, role?: string, actorId?: string): Promise<Validation>;
|
|
79
|
+
/**
|
|
80
|
+
* The JSON Schema of the facts one command takes (`Aggregate.Command`, bare or qualified), for
|
|
81
|
+
* checking a payload before asking the host. A schema cannot hold a rule over stored state, so
|
|
82
|
+
* those ride along as `x-` annotations; `validate` stays the authority. Throws
|
|
83
|
+
* `DomainUnavailable` when the host cannot be reached or has no schema for the command.
|
|
84
|
+
*/
|
|
85
|
+
schema(verb: string): Promise<Record<string, unknown>>;
|
|
86
|
+
private commandBody;
|
|
72
87
|
/**
|
|
73
88
|
* Asks one declared query (`Aggregate.Query`, bare or qualified) and returns the raw answer.
|
|
74
89
|
* The host reads current state and writes nothing; the rows are in `answer.queries`, which
|
package/dist/client.js
CHANGED
|
@@ -81,15 +81,54 @@ export class HostClient {
|
|
|
81
81
|
* from the state in it and turn a miss into a refusal with `refusalOf`.
|
|
82
82
|
*/
|
|
83
83
|
dispatch(verb, args = {}, to, role, actorId) {
|
|
84
|
+
return this.post(this.commandBody(verb, args, to, role, actorId));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Asks whether a command would be accepted right now, and if not, why. The host runs the command
|
|
88
|
+
* as far as it can and keeps nothing: no write, no reaction. It answers HTTP 200 whether or not
|
|
89
|
+
* the command would be refused, so this resolves with the verdict and never throws a
|
|
90
|
+
* `DomainRefusal`; `DomainUnavailable` still means the host could not be reached.
|
|
91
|
+
*/
|
|
92
|
+
async validate(verb, args = {}, to, role, actorId) {
|
|
93
|
+
const answer = await this.post({ ...this.commandBody(verb, args, to, role, actorId), dry_run: true });
|
|
94
|
+
return { ok: answer.ok === true, refusals: (answer.refusals ?? []) };
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The JSON Schema of the facts one command takes (`Aggregate.Command`, bare or qualified), for
|
|
98
|
+
* checking a payload before asking the host. A schema cannot hold a rule over stored state, so
|
|
99
|
+
* those ride along as `x-` annotations; `validate` stays the authority. Throws
|
|
100
|
+
* `DomainUnavailable` when the host cannot be reached or has no schema for the command.
|
|
101
|
+
*/
|
|
102
|
+
async schema(verb) {
|
|
103
|
+
const [domain, rest] = this.qualify(verb).split("::");
|
|
104
|
+
const [aggregate, command] = rest.split(".");
|
|
105
|
+
const send = this.fetchImpl ?? globalThis.fetch;
|
|
106
|
+
let res;
|
|
107
|
+
try {
|
|
108
|
+
res = await send(`${this.url}/${domain}/${aggregate}/${command}.json?schema=1`, { signal: AbortSignal.timeout(this.timeoutMs) });
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
throw new DomainUnavailable(`could not reach the domain at ${this.url}: ${err}`);
|
|
112
|
+
}
|
|
113
|
+
if (!res.ok)
|
|
114
|
+
throw new DomainUnavailable(`the domain answered HTTP ${res.status} for the schema of ${verb}`);
|
|
115
|
+
try {
|
|
116
|
+
return (await res.json());
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
throw new DomainUnavailable("the domain did not answer with JSON");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
commandBody(verb, args, to, role, actorId) {
|
|
84
123
|
const asRole = role ?? this.role;
|
|
85
124
|
const asActor = actorId ?? this.actorId;
|
|
86
|
-
return
|
|
125
|
+
return {
|
|
87
126
|
verb: this.qualify(verb),
|
|
88
127
|
...(to ? { to } : {}),
|
|
89
128
|
with: args,
|
|
90
129
|
...(asRole ? { role: asRole } : {}),
|
|
91
130
|
...(asActor ? { actor_id: asActor } : {}),
|
|
92
|
-
}
|
|
131
|
+
};
|
|
93
132
|
}
|
|
94
133
|
/**
|
|
95
134
|
* Asks one declared query (`Aggregate.Query`, bare or qualified) and returns the raw answer.
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,mDAAmD;AACnD,EAAE;AACF,qBAAqB;AACrB,iFAAiF;AACjF,4DAA4D;AAC5D,+EAA+E;AAC/E,uEAAuE;AACvE,2CAA2C;AAC3C,8CAA8C;AAC9C,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,sFAAsF;AACtF,8EAA8E;AAC9E,aAAa;AACb,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,6EAA6E;AAC7E,cAAc;AACd,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,wEAAwE;AACxE,qEAAqE;AACrE,yCAAyC;AACzC,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,2EAA2E;AAC3E,SAAS;AAET,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAmDhC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAsB,EAAE;IACnD,MAAM,KAAK,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/E,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACnC,CAAC,CAAC;AAEF,uCAAuC;AACvC,MAAM,OAAO,UAAU;IACrB,wCAAwC;IAC/B,MAAM,CAAS;IACxB,qDAAqD;IAC5C,GAAG,CAAS;IACJ,IAAI,CAAqB;IACzB,OAAO,CAAqB;IAC5B,SAAS,CAAS;IAClB,SAAS,CAA2B;IACpC,IAAI,CAAU;IAE/B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CAAC;QACnF,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,iBAAiB,CAAC,4BAA4B,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAEnF,IAAI,MAAc,CAAC;QACnB,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAW,CAAC;QACxC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,iBAAiB,CAAC,qCAAqC,CAAC,CAAC;QACrE,CAAC;QACD,IAAI,MAAM,CAAC,KAAK;YAAE,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5D,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED,+CAA+C;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAyB,EAAE,EAAc,EAAE,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { HostClient, createClient } from "./client.js";
|
|
2
2
|
export type { ClientOptions, Command } from "./client.js";
|
|
3
3
|
export { instancesOf, rowsOf, text, whole, optionalWhole } from "./answer.js";
|
|
4
|
-
export type { Answer, QueryResult, Refusal } from "./answer.js";
|
|
4
|
+
export type { Answer, QueryResult, Refusal, Validation, ValidationRefusal } from "./answer.js";
|
|
5
5
|
export { DomainRefusal, DomainUnavailable, refusalOf } from "./errors.js";
|
|
6
6
|
export { createResilientFetch, ResilientFetchError } from "./resilientFetch.js";
|
|
7
7
|
export type { ResilientFetch, ResilientFetchConfig, ResilientRequest } from "./resilientFetch.js";
|
package/package.json
CHANGED