@instruments/materialgraph 0.29.0 → 0.30.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/brands-client.d.ts +1 -1
- package/by-colour-types.d.ts +4 -4
- package/catalogue-client.d.ts +3 -3
- package/catalogue-client.js +3 -3
- package/catalogue-types.d.ts +1 -1
- package/client-vocabulary.d.ts +3 -5
- package/client-vocabulary.js +9 -6
- package/client.d.ts +73 -174
- package/client.js +85 -211
- package/colour-region-types.d.ts +18 -0
- package/colours-client.d.ts +10 -83
- package/colours-client.js +1 -85
- package/find-variants-by-colour-types.d.ts +197 -0
- package/find-variants-by-vector-types.d.ts +67 -0
- package/find-variants-by-vector-types.js +5 -0
- package/get-variant-types.d.ts +50 -0
- package/get-variant-types.js +10 -0
- package/identifiers.d.ts +1 -1
- package/identifiers.js +1 -1
- package/image-reference-types.d.ts +18 -0
- package/index.d.ts +8 -7
- package/index.js +1 -1
- package/list-enum-values-types.d.ts +58 -0
- package/list-variants-types.d.ts +6 -2
- package/material-asset-types.d.ts +2 -2
- package/material-types.d.ts +11 -150
- package/operations.d.ts +1 -1
- package/operations.js +26 -88
- package/package.json +1 -1
- package/palette-search-types.d.ts +3 -49
- package/resolve-colour-types.d.ts +5 -5
- package/resolve-variant-types.d.ts +75 -0
- package/{identify-types.js → resolve-variant-types.js} +2 -2
- package/response-schemas.generated.d.ts +1 -1
- package/response-schemas.generated.js +45 -84
- package/run-types.d.ts +23 -216
- package/runs.d.ts +10 -58
- package/runs.js +19 -106
- package/schema-resource-types.d.ts +2 -139
- package/schema-resource-types.js +0 -8
- package/search-card-types.d.ts +1 -1
- package/search-index-plan-types.d.ts +4 -1
- package/search-request-types.d.ts +10 -2
- package/spec-types.d.ts +4 -4
- package/spec-types.js +2 -2
- package/sse.d.ts +2 -2
- package/sse.js +2 -2
- package/types.d.ts +4 -38
- package/webmcp.generated.js +3 -3
- package/workflows-client.d.ts +54 -0
- package/workflows-client.js +41 -0
- package/client-source-material-comments.d.ts +0 -51
- package/client-source-material-comments.js +0 -6
- package/codes-client.d.ts +0 -118
- package/codes-client.js +0 -99
- package/codes-types.d.ts +0 -325
- package/colour-aggregate-types.d.ts +0 -163
- package/coordinate-client.d.ts +0 -23
- package/coordinate-client.js +0 -13
- package/demand-batch-types.d.ts +0 -118
- package/demand-types.d.ts +0 -154
- package/identify-types.d.ts +0 -82
- package/material-composition-client.d.ts +0 -21
- package/material-composition-client.js +0 -13
- package/material-composition-types.d.ts +0 -403
- package/material-composition-types.js +0 -1
- package/source-material-validation.d.ts +0 -7
- package/source-material-validation.js +0 -214
- package/spec-facet-types.d.ts +0 -48
- package/spec-facet-types.js +0 -7
- package/substitute-types.d.ts +0 -102
- package/substitute-types.js +0 -1
- package/suggest-types.d.ts +0 -67
- package/suggest-types.js +0 -28
- package/taxonomy-coverage-types.d.ts +0 -34
- package/taxonomy-coverage-types.js +0 -1
- /package/{codes-types.js → colour-region-types.js} +0 -0
- /package/{colour-aggregate-types.js → find-variants-by-colour-types.js} +0 -0
- /package/{demand-batch-types.js → image-reference-types.js} +0 -0
- /package/{demand-types.js → list-enum-values-types.js} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { HttpTransport } from "./http-transport.js";
|
|
2
|
+
/**
|
|
3
|
+
* The workflow Run surface, namespaced as `mg.workflows`. A Run is the start of
|
|
4
|
+
* one registered Mastra workflow and nothing else: you name the workflow, hand
|
|
5
|
+
* it its input, and follow the Run it returns. Replaces the flat `createRun()`,
|
|
6
|
+
* `run()`, `streamRunEvents()` and `drainRunEvents()` methods, retired with no
|
|
7
|
+
* shim when `/api/v1/runs` moved under `/api/v1/workflows/{workflowId}/runs`.
|
|
8
|
+
*
|
|
9
|
+
* THE QUESTION: "do a whole job for me" — the ASYNC lens. Everything else on
|
|
10
|
+
* the client answers in one round trip; a Run may suspend for human input and
|
|
11
|
+
* finish minutes later. `start()` acknowledges without executing, `run()` polls
|
|
12
|
+
* the ledger, and `streamRunEvents()` follows it live.
|
|
13
|
+
*
|
|
14
|
+
* `workflowId` is the registered workflow's id, such as `curate-collection`. A
|
|
15
|
+
* Run is read under the workflow that started it: asking for it under another
|
|
16
|
+
* workflow's id is a 404.
|
|
17
|
+
*
|
|
18
|
+
* Starting a Run needs the `mg:compose` or `mg:write` scope, plus whatever
|
|
19
|
+
* scope the workflow itself declares.
|
|
20
|
+
*/
|
|
21
|
+
import type { RunId } from "./identifiers.js";
|
|
22
|
+
import type { CreatePublicRunRequest, CreatePublicRunResponse, DrainRunEventsOptions, PublicRunResponse, RunEvent, StreamRunEventsOptions } from "./run-types.js";
|
|
23
|
+
export declare class WorkflowsClient {
|
|
24
|
+
#private;
|
|
25
|
+
constructor(options: {
|
|
26
|
+
transport: HttpTransport;
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Start an asynchronous Run of `workflowId` (POST
|
|
30
|
+
* `/api/v1/workflows/{workflowId}/runs`). Pass `idempotencyKey` so a retry
|
|
31
|
+
* replays rather than duplicates. Follow with {@link streamRunEvents} (live)
|
|
32
|
+
* or {@link run} (poll).
|
|
33
|
+
*/
|
|
34
|
+
start(workflowId: string, body: CreatePublicRunRequest, signal?: AbortSignal): Promise<CreatePublicRunResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* THE QUESTION: "where has this Run got to?" — the caller-owned, redacted
|
|
37
|
+
* ledger record. Polling; prefer {@link streamRunEvents} when a human is
|
|
38
|
+
* waiting.
|
|
39
|
+
*/
|
|
40
|
+
run(workflowId: string, runId: RunId, signal?: AbortSignal): Promise<PublicRunResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Stream ordered Run events as an async iterator (GET
|
|
43
|
+
* `/api/v1/workflows/{workflowId}/runs/{runId}/events`, SSE). Iterates until
|
|
44
|
+
* the stream ends or the signal aborts; pass `after` to resume from the last
|
|
45
|
+
* observed sequence.
|
|
46
|
+
*/
|
|
47
|
+
streamRunEvents(workflowId: string, runId: RunId, options?: StreamRunEventsOptions): AsyncGenerator<RunEvent>;
|
|
48
|
+
/**
|
|
49
|
+
* Collect Run events until a terminal event, the deadline, or the stream
|
|
50
|
+
* ends — the bounded events-log pattern (a single pass over
|
|
51
|
+
* {@link streamRunEvents}).
|
|
52
|
+
*/
|
|
53
|
+
drainRunEvents(workflowId: string, runId: RunId, options: DrainRunEventsOptions): Promise<RunEvent[]>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { drainRunEvents, getWorkflowRun, startWorkflowRun, streamRunEvents, } from "./runs.js";
|
|
2
|
+
export class WorkflowsClient {
|
|
3
|
+
#transport;
|
|
4
|
+
constructor(options) {
|
|
5
|
+
this.#transport = options.transport;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Start an asynchronous Run of `workflowId` (POST
|
|
9
|
+
* `/api/v1/workflows/{workflowId}/runs`). Pass `idempotencyKey` so a retry
|
|
10
|
+
* replays rather than duplicates. Follow with {@link streamRunEvents} (live)
|
|
11
|
+
* or {@link run} (poll).
|
|
12
|
+
*/
|
|
13
|
+
async start(workflowId, body, signal) {
|
|
14
|
+
return await startWorkflowRun(this.#transport, workflowId, body, signal);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* THE QUESTION: "where has this Run got to?" — the caller-owned, redacted
|
|
18
|
+
* ledger record. Polling; prefer {@link streamRunEvents} when a human is
|
|
19
|
+
* waiting.
|
|
20
|
+
*/
|
|
21
|
+
async run(workflowId, runId, signal) {
|
|
22
|
+
return await getWorkflowRun(this.#transport, workflowId, runId, signal);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Stream ordered Run events as an async iterator (GET
|
|
26
|
+
* `/api/v1/workflows/{workflowId}/runs/{runId}/events`, SSE). Iterates until
|
|
27
|
+
* the stream ends or the signal aborts; pass `after` to resume from the last
|
|
28
|
+
* observed sequence.
|
|
29
|
+
*/
|
|
30
|
+
streamRunEvents(workflowId, runId, options) {
|
|
31
|
+
return streamRunEvents(this.#transport, workflowId, runId, options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Collect Run events until a terminal event, the deadline, or the stream
|
|
35
|
+
* ends — the bounded events-log pattern (a single pass over
|
|
36
|
+
* {@link streamRunEvents}).
|
|
37
|
+
*/
|
|
38
|
+
async drainRunEvents(workflowId, runId, options) {
|
|
39
|
+
return await drainRunEvents(this.#transport, workflowId, runId, options);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The per-file comment surface, namespaced as `mg.sourceMaterialComments` — the
|
|
3
|
-
* argument people leave on one uploaded file (MG-1345).
|
|
4
|
-
*
|
|
5
|
-
* A namespace rather than two more flat methods on an already-large facade,
|
|
6
|
-
* following `mg.codes` and `mg.colours`: reading a thread and adding to it are
|
|
7
|
-
* one family, they share a `(batchId, sourceId)` referent, and neither makes
|
|
8
|
-
* sense without the other. The namespace holds no transport of its own — the
|
|
9
|
-
* client hands it the shared one, so auth, rate-limit accounting and error
|
|
10
|
-
* shaping stay in one place.
|
|
11
|
-
*
|
|
12
|
-
* TWO RULES A CONSUMER MUST NOT GET WRONG.
|
|
13
|
-
*
|
|
14
|
-
* **The author name is REPORTED, never verified.** Every comment carries
|
|
15
|
-
* `author.attribution: "reported"` — a name somebody typed — plus `recordedBy`,
|
|
16
|
-
* the authenticated principal that actually wrote the row. Render "recorded as
|
|
17
|
-
* from Ruth Fielding", never "Ruth Fielding said". The API takes a machine key,
|
|
18
|
-
* and the person whose argument a remark carries is usually not the person at
|
|
19
|
-
* the keyboard; presenting the one as the other is the failure this field
|
|
20
|
-
* exists to prevent.
|
|
21
|
-
*
|
|
22
|
-
* **A reply is not a root.** {@link SourceMaterialCommentsNamespace.post}
|
|
23
|
-
* returns a result discriminated on `kind`: switch on it rather than reaching
|
|
24
|
-
* for `replies`, which a `reply` does not have. Threads are one level deep and
|
|
25
|
-
* the database enforces it, so a reply can never grow replies of its own.
|
|
26
|
-
*
|
|
27
|
-
* ROUTING OUT OF THIS NAMESPACE. `mg.sourceMaterialBatch(batchId)` already
|
|
28
|
-
* inlines every file's thread, so opening a batch is ONE call — do not loop this
|
|
29
|
-
* namespace over a batch's files to rebuild what that read returns. Reach for
|
|
30
|
-
* `list` when you are watching a single file.
|
|
31
|
-
*/
|
|
32
|
-
import type { HttpTransport } from "./http-transport.js";
|
|
33
|
-
import type { PostSourceMaterialCommentInput, PostSourceMaterialCommentResult, SourceMaterialCommentThread } from "./run-types.js";
|
|
34
|
-
export type SourceMaterialCommentsNamespace = {
|
|
35
|
-
/**
|
|
36
|
-
* One file's thread, oldest root first, each root carrying its replies.
|
|
37
|
-
* `comments` is always an array; `truncated` says whether you are holding the
|
|
38
|
-
* whole thread. A file that is not in that batch, or a batch you do not own,
|
|
39
|
-
* raises the same 404 as a file that never existed.
|
|
40
|
-
*/
|
|
41
|
-
list(batchId: string, sourceId: string, signal?: AbortSignal): Promise<SourceMaterialCommentThread>;
|
|
42
|
-
/**
|
|
43
|
-
* Add one remark. Pass `parentCommentId` to answer a ROOT comment on the same
|
|
44
|
-
* file; nesting deeper is a 400. Pass `idempotencyKey` so a retry after a
|
|
45
|
-
* network timeout returns the comment you already posted rather than a
|
|
46
|
-
* permanent duplicate.
|
|
47
|
-
*/
|
|
48
|
-
post(batchId: string, sourceId: string, input: PostSourceMaterialCommentInput, signal?: AbortSignal): Promise<PostSourceMaterialCommentResult>;
|
|
49
|
-
};
|
|
50
|
-
/** Bind the comment operations to the client's shared transport. */
|
|
51
|
-
export declare const createSourceMaterialCommentsNamespace: (transport: HttpTransport) => SourceMaterialCommentsNamespace;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { listSourceMaterialComments, postSourceMaterialComment, } from "./runs.js";
|
|
2
|
-
/** Bind the comment operations to the client's shared transport. */
|
|
3
|
-
export const createSourceMaterialCommentsNamespace = (transport) => ({
|
|
4
|
-
list: async (batchId, sourceId, signal) => await listSourceMaterialComments(transport, batchId, sourceId, signal),
|
|
5
|
-
post: async (batchId, sourceId, input, signal) => await postSourceMaterialComment(transport, batchId, sourceId, input, signal),
|
|
6
|
-
});
|
package/codes-client.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The advisory building-code surface, namespaced as `mg.codes`.
|
|
3
|
-
*
|
|
4
|
-
* Three calls that are one workflow — discover the vocabulary, state the space,
|
|
5
|
-
* then badge candidates against it — so they live together rather than as three
|
|
6
|
-
* flat methods on an already-large client facade. `mg.browse` set the precedent
|
|
7
|
-
* for a namespace when a capability is a small family rather than a single verb.
|
|
8
|
-
*
|
|
9
|
-
* The namespace holds no transport of its own: the client hands it bound
|
|
10
|
-
* `get`/`post` callbacks, so auth, rate-limit accounting and error shaping stay
|
|
11
|
-
* in exactly one place.
|
|
12
|
-
*
|
|
13
|
-
* ADVISORY ONLY: every verdict and every envelope carries the AHJ caveat — this
|
|
14
|
-
* is model code as adopted, never a legal determination.
|
|
15
|
-
*
|
|
16
|
-
* ROUTING. Codes answers "is this material allowed in THIS SPACE?" — a question
|
|
17
|
-
* about a jurisdiction, an occupancy group and a finish location, not about a
|
|
18
|
-
* material alone.
|
|
19
|
-
* - "which materials carry Class A?" → `mg.bySpec("fire_classifications:...")`.
|
|
20
|
-
* That is a property question; this namespace is what tells you the space
|
|
21
|
-
* demands Class A in the first place.
|
|
22
|
-
* - "what does this one material hold?" → `mg.materialBlocks(variantId)`.
|
|
23
|
-
* - "find me something like this, but compliant" → `mg.search({ filters })`
|
|
24
|
-
* once `requirements()` has told you which filter to apply.
|
|
25
|
-
*/
|
|
26
|
-
import type { CodeAdvisoryInput, CodeAdvisoryResponse, CodeContextRequest, CodeContextResponse, CodeRequirementsResponse } from "./codes-types.js";
|
|
27
|
-
import type { QueryParams } from "./http-transport.js";
|
|
28
|
-
import type { SdkOperationId } from "./operations.js";
|
|
29
|
-
/** The client's own request primitives, handed down so this file owns no transport. */
|
|
30
|
-
export type CodesTransport = {
|
|
31
|
-
get<T>(operationId: SdkOperationId, query?: QueryParams, signal?: AbortSignal): Promise<T>;
|
|
32
|
-
post<T>(operationId: SdkOperationId, body: unknown, signal?: AbortSignal): Promise<T>;
|
|
33
|
-
};
|
|
34
|
-
export declare class CodesClient {
|
|
35
|
-
#private;
|
|
36
|
-
constructor(transport: CodesTransport);
|
|
37
|
-
/**
|
|
38
|
-
* THE QUESTION: "what may I even say about a space?" — the vocabulary for
|
|
39
|
-
* stating a code context, and the first call of the three.
|
|
40
|
-
*
|
|
41
|
-
* Everything {@link CodesClient.requirements} and {@link CodesClient.advisory}
|
|
42
|
-
* accept is listed here, so nothing need be hardcoded and a 400 for an unknown
|
|
43
|
-
* jurisdiction / occupancy / space is always avoidable.
|
|
44
|
-
*
|
|
45
|
-
* The vocabulary for stating a code context (GET `/api/v1/codes/context`):
|
|
46
|
-
* seeded jurisdictions and their coverage tier, the occupancy groups the
|
|
47
|
-
* registry keys on, finish locations, dimensions, classification scales with
|
|
48
|
-
* classes ordered best-first, and which `room` term correlates to which
|
|
49
|
-
* regulatory axes.
|
|
50
|
-
*
|
|
51
|
-
* Start here — every value the other two calls accept is listed in this one
|
|
52
|
-
* response, so nothing need be hardcoded. A correlation the registry refuses to
|
|
53
|
-
* make comes back `null`, never a guess.
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* const vocab = await mg.codes.context();
|
|
57
|
-
* const texas = vocab.jurisdictions.find((j) => j.id === "us-tx");
|
|
58
|
-
* // `model_baseline` means unamended model IBC stood in for this AHJ's own table.
|
|
59
|
-
* console.log(texas?.coverage, texas?.adoptionNote);
|
|
60
|
-
*/
|
|
61
|
-
context(signal?: AbortSignal): Promise<CodeContextResponse>;
|
|
62
|
-
/**
|
|
63
|
-
* THE QUESTION: "what does this space DEMAND?" — before any candidate exists.
|
|
64
|
-
*
|
|
65
|
-
* Run it before shortlisting, not after: it tells you which specification to
|
|
66
|
-
* filter on, which you then spend on `mg.bySpec()` or `mg.search({ filters })`.
|
|
67
|
-
* Use {@link CodesClient.advisory} once you hold candidates to badge.
|
|
68
|
-
*
|
|
69
|
-
* What a space demands, before any candidate exists (GET
|
|
70
|
-
* `/api/v1/codes/requirements`). State the space by explicit axes, or by a
|
|
71
|
-
* `roomType` the axes are correlated from.
|
|
72
|
-
*
|
|
73
|
-
* An empty `requirements` array means nothing in the registry applies to this
|
|
74
|
-
* context. It is NOT a pass.
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* const { requirements } = await mg.codes.requirements({
|
|
78
|
-
* jurisdictionId: "us-tx",
|
|
79
|
-
* occupancyGroup: "A-2", // or: roomType: "hotel_room" to correlate the axes
|
|
80
|
-
* spaceType: "corridors",
|
|
81
|
-
* sprinklered: true,
|
|
82
|
-
* });
|
|
83
|
-
* requirements.map((r) => `${r.dimension}: ${r.label} (${r.section})`);
|
|
84
|
-
*/
|
|
85
|
-
requirements(input: CodeContextRequest, signal?: AbortSignal): Promise<CodeRequirementsResponse>;
|
|
86
|
-
/**
|
|
87
|
-
* THE QUESTION: "do THESE candidates satisfy what this space demands?" — the
|
|
88
|
-
* third call, once you hold materials.
|
|
89
|
-
*
|
|
90
|
-
* Context is CONDITIONAL: supply `occupancyGroup` + `spaceType`, or a
|
|
91
|
-
* `roomType` for them to correlate from, or a mix — an explicit axis always
|
|
92
|
-
* wins, and an axis that resolves to nothing is a 400 naming it. The full rule,
|
|
93
|
-
* with the validator's own messages, is on {@link CodeContextRequest}.
|
|
94
|
-
*
|
|
95
|
-
* Read `summary.status` honestly: `unverified` means no comparable rating is on
|
|
96
|
-
* file. It is not a pass, and it is common. Use {@link CodesClient.requirements}
|
|
97
|
-
* when you have no candidates yet, and `mg.materialBlocks()` to see whether a
|
|
98
|
-
* material's fire/slip facts are missing or merely unverified.
|
|
99
|
-
*
|
|
100
|
-
* Badge materials against the advisory building-code registry for one context
|
|
101
|
-
* (POST `/api/v1/codes/advisory`, ≤ 100 ids). Each applicable requirement is
|
|
102
|
-
* badged `meets` / `shortfall` / `unknown` from the material's accepted fire
|
|
103
|
-
* and slip facts, in input order; each material also carries a rolled-up
|
|
104
|
-
* `summary`, and `resolvedContext` reports the axes actually used.
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* const advisory = await mg.codes.advisory({
|
|
108
|
-
* variantIds: scheme.picks.map((p) => p.variantId),
|
|
109
|
-
* jurisdictionId: "us-tx",
|
|
110
|
-
* occupancyGroup: "A-2", // or: roomType: "hotel_room" to correlate the axes
|
|
111
|
-
* spaceType: "corridors", // corridors | exit_stairs_passageways | rooms_enclosed_spaces
|
|
112
|
-
* sprinklered: true,
|
|
113
|
-
* });
|
|
114
|
-
* // `unverified` means no comparable rating is on file — common, never a pass.
|
|
115
|
-
* const blocked = advisory.results.filter((r) => r.summary?.status === "shortfall");
|
|
116
|
-
*/
|
|
117
|
-
advisory(input: CodeAdvisoryInput, signal?: AbortSignal): Promise<CodeAdvisoryResponse>;
|
|
118
|
-
}
|
package/codes-client.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
export class CodesClient {
|
|
2
|
-
#transport;
|
|
3
|
-
constructor(transport) {
|
|
4
|
-
this.#transport = transport;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* THE QUESTION: "what may I even say about a space?" — the vocabulary for
|
|
8
|
-
* stating a code context, and the first call of the three.
|
|
9
|
-
*
|
|
10
|
-
* Everything {@link CodesClient.requirements} and {@link CodesClient.advisory}
|
|
11
|
-
* accept is listed here, so nothing need be hardcoded and a 400 for an unknown
|
|
12
|
-
* jurisdiction / occupancy / space is always avoidable.
|
|
13
|
-
*
|
|
14
|
-
* The vocabulary for stating a code context (GET `/api/v1/codes/context`):
|
|
15
|
-
* seeded jurisdictions and their coverage tier, the occupancy groups the
|
|
16
|
-
* registry keys on, finish locations, dimensions, classification scales with
|
|
17
|
-
* classes ordered best-first, and which `room` term correlates to which
|
|
18
|
-
* regulatory axes.
|
|
19
|
-
*
|
|
20
|
-
* Start here — every value the other two calls accept is listed in this one
|
|
21
|
-
* response, so nothing need be hardcoded. A correlation the registry refuses to
|
|
22
|
-
* make comes back `null`, never a guess.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* const vocab = await mg.codes.context();
|
|
26
|
-
* const texas = vocab.jurisdictions.find((j) => j.id === "us-tx");
|
|
27
|
-
* // `model_baseline` means unamended model IBC stood in for this AHJ's own table.
|
|
28
|
-
* console.log(texas?.coverage, texas?.adoptionNote);
|
|
29
|
-
*/
|
|
30
|
-
async context(signal) {
|
|
31
|
-
return await this.#transport.get("list_code_context", undefined, signal);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* THE QUESTION: "what does this space DEMAND?" — before any candidate exists.
|
|
35
|
-
*
|
|
36
|
-
* Run it before shortlisting, not after: it tells you which specification to
|
|
37
|
-
* filter on, which you then spend on `mg.bySpec()` or `mg.search({ filters })`.
|
|
38
|
-
* Use {@link CodesClient.advisory} once you hold candidates to badge.
|
|
39
|
-
*
|
|
40
|
-
* What a space demands, before any candidate exists (GET
|
|
41
|
-
* `/api/v1/codes/requirements`). State the space by explicit axes, or by a
|
|
42
|
-
* `roomType` the axes are correlated from.
|
|
43
|
-
*
|
|
44
|
-
* An empty `requirements` array means nothing in the registry applies to this
|
|
45
|
-
* context. It is NOT a pass.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* const { requirements } = await mg.codes.requirements({
|
|
49
|
-
* jurisdictionId: "us-tx",
|
|
50
|
-
* occupancyGroup: "A-2", // or: roomType: "hotel_room" to correlate the axes
|
|
51
|
-
* spaceType: "corridors",
|
|
52
|
-
* sprinklered: true,
|
|
53
|
-
* });
|
|
54
|
-
* requirements.map((r) => `${r.dimension}: ${r.label} (${r.section})`);
|
|
55
|
-
*/
|
|
56
|
-
async requirements(input, signal) {
|
|
57
|
-
return await this.#transport.get("list_code_requirements", {
|
|
58
|
-
jurisdiction: input.jurisdictionId,
|
|
59
|
-
occupancy: input.occupancyGroup,
|
|
60
|
-
room: input.roomType,
|
|
61
|
-
space: input.spaceType,
|
|
62
|
-
sprinklered: input.sprinklered,
|
|
63
|
-
}, signal);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* THE QUESTION: "do THESE candidates satisfy what this space demands?" — the
|
|
67
|
-
* third call, once you hold materials.
|
|
68
|
-
*
|
|
69
|
-
* Context is CONDITIONAL: supply `occupancyGroup` + `spaceType`, or a
|
|
70
|
-
* `roomType` for them to correlate from, or a mix — an explicit axis always
|
|
71
|
-
* wins, and an axis that resolves to nothing is a 400 naming it. The full rule,
|
|
72
|
-
* with the validator's own messages, is on {@link CodeContextRequest}.
|
|
73
|
-
*
|
|
74
|
-
* Read `summary.status` honestly: `unverified` means no comparable rating is on
|
|
75
|
-
* file. It is not a pass, and it is common. Use {@link CodesClient.requirements}
|
|
76
|
-
* when you have no candidates yet, and `mg.materialBlocks()` to see whether a
|
|
77
|
-
* material's fire/slip facts are missing or merely unverified.
|
|
78
|
-
*
|
|
79
|
-
* Badge materials against the advisory building-code registry for one context
|
|
80
|
-
* (POST `/api/v1/codes/advisory`, ≤ 100 ids). Each applicable requirement is
|
|
81
|
-
* badged `meets` / `shortfall` / `unknown` from the material's accepted fire
|
|
82
|
-
* and slip facts, in input order; each material also carries a rolled-up
|
|
83
|
-
* `summary`, and `resolvedContext` reports the axes actually used.
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* const advisory = await mg.codes.advisory({
|
|
87
|
-
* variantIds: scheme.picks.map((p) => p.variantId),
|
|
88
|
-
* jurisdictionId: "us-tx",
|
|
89
|
-
* occupancyGroup: "A-2", // or: roomType: "hotel_room" to correlate the axes
|
|
90
|
-
* spaceType: "corridors", // corridors | exit_stairs_passageways | rooms_enclosed_spaces
|
|
91
|
-
* sprinklered: true,
|
|
92
|
-
* });
|
|
93
|
-
* // `unverified` means no comparable rating is on file — common, never a pass.
|
|
94
|
-
* const blocked = advisory.results.filter((r) => r.summary?.status === "shortfall");
|
|
95
|
-
*/
|
|
96
|
-
async advisory(input, signal) {
|
|
97
|
-
return await this.#transport.post("resolveCodeAdvisory", input, signal);
|
|
98
|
-
}
|
|
99
|
-
}
|