@axonflow/sdk 9.1.0 → 9.3.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 +238 -22
- package/dist/cjs/adapters/langgraph.d.ts.map +1 -1
- package/dist/cjs/adapters/langgraph.js +20 -0
- package/dist/cjs/adapters/langgraph.js.map +1 -1
- package/dist/cjs/authzen.d.ts +353 -0
- package/dist/cjs/authzen.d.ts.map +1 -0
- package/dist/cjs/authzen.js +901 -0
- package/dist/cjs/authzen.js.map +1 -0
- package/dist/cjs/client.d.ts +135 -9
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +397 -30
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/heartbeat.d.ts +55 -4
- package/dist/cjs/heartbeat.d.ts.map +1 -1
- package/dist/cjs/heartbeat.js +86 -7
- package/dist/cjs/heartbeat.js.map +1 -1
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +55 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/read-identity.d.ts +267 -0
- package/dist/cjs/read-identity.d.ts.map +1 -0
- package/dist/cjs/read-identity.js +329 -0
- package/dist/cjs/read-identity.js.map +1 -0
- package/dist/cjs/telemetry.d.ts +176 -13
- package/dist/cjs/telemetry.d.ts.map +1 -1
- package/dist/cjs/telemetry.js +403 -37
- package/dist/cjs/telemetry.js.map +1 -1
- package/dist/cjs/types/authzen.gen.d.ts +407 -0
- package/dist/cjs/types/authzen.gen.d.ts.map +1 -0
- package/dist/cjs/types/authzen.gen.js +804 -0
- package/dist/cjs/types/authzen.gen.js.map +1 -0
- package/dist/cjs/types/config.d.ts +43 -1
- package/dist/cjs/types/config.d.ts.map +1 -1
- package/dist/cjs/types/hitl.js +1 -1
- package/dist/cjs/types/hitl.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/adapters/langgraph.d.ts.map +1 -1
- package/dist/esm/adapters/langgraph.js +20 -0
- package/dist/esm/adapters/langgraph.js.map +1 -1
- package/dist/esm/authzen.d.ts +353 -0
- package/dist/esm/authzen.d.ts.map +1 -0
- package/dist/esm/authzen.js +886 -0
- package/dist/esm/authzen.js.map +1 -0
- package/dist/esm/client.d.ts +135 -9
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +397 -30
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/heartbeat.d.ts +55 -4
- package/dist/esm/heartbeat.d.ts.map +1 -1
- package/dist/esm/heartbeat.js +85 -7
- package/dist/esm/heartbeat.js.map +1 -1
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +17 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/read-identity.d.ts +267 -0
- package/dist/esm/read-identity.d.ts.map +1 -0
- package/dist/esm/read-identity.js +320 -0
- package/dist/esm/read-identity.js.map +1 -0
- package/dist/esm/telemetry.d.ts +176 -13
- package/dist/esm/telemetry.d.ts.map +1 -1
- package/dist/esm/telemetry.js +397 -37
- package/dist/esm/telemetry.js.map +1 -1
- package/dist/esm/types/authzen.gen.d.ts +407 -0
- package/dist/esm/types/authzen.gen.d.ts.map +1 -0
- package/dist/esm/types/authzen.gen.js +779 -0
- package/dist/esm/types/authzen.gen.js.map +1 -0
- package/dist/esm/types/config.d.ts +43 -1
- package/dist/esm/types/config.d.ts.map +1 -1
- package/dist/esm/types/hitl.js +1 -1
- package/dist/esm/types/hitl.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AuthZEN-native authorization for the AxonFlow SDK.
|
|
3
|
+
*
|
|
4
|
+
* This is the surface the ADR-065 compatibility plan commits to in all five
|
|
5
|
+
* SDKs. It talks to `POST /api/v1/access/evaluation`, whose wire shape is
|
|
6
|
+
* generated from the platform's canonical contract (see
|
|
7
|
+
* `src/types/authzen.gen.ts`); nothing in this file re-states a field name or
|
|
8
|
+
* an enum value.
|
|
9
|
+
*
|
|
10
|
+
* ## What this replaces, and when
|
|
11
|
+
*
|
|
12
|
+
* Nothing yet. The existing decision surface (`decide`, `explainDecision` and
|
|
13
|
+
* the gateway/proxy methods) stays wire-stable through all of v11 and is not
|
|
14
|
+
* deprecated here. This is the surface to write NEW integrations against,
|
|
15
|
+
* because at v11 the engine behind it becomes the ADR-065 Policy Decision Point
|
|
16
|
+
* with no wire change — an integration written against it migrates once rather
|
|
17
|
+
* than twice. See `docs/AUTHZEN_MIGRATION_DRAFT.md`.
|
|
18
|
+
*
|
|
19
|
+
* ## The one thing worth knowing before you call it
|
|
20
|
+
*
|
|
21
|
+
* The server refuses anything it cannot evaluate rather than evaluating around
|
|
22
|
+
* it. Send a subject property, an unrecognised context member, or an argument
|
|
23
|
+
* beside the query, and you get an `AuthZENRefusal` naming the exact member —
|
|
24
|
+
* not a decision computed without it. That is deliberate: a decision that
|
|
25
|
+
* silently ignored an attribute would tell you the attribute was weighed when
|
|
26
|
+
* it was not, and every audit of that decision would inherit the claim.
|
|
27
|
+
*
|
|
28
|
+
* So treat an `AuthZENRefusal` as "fix the request", and retry only when
|
|
29
|
+
* `refusal.retryable` is true.
|
|
30
|
+
*/
|
|
31
|
+
import { AxonFlowError } from './errors';
|
|
32
|
+
import { AuthZENApprovalRequirement, AuthZENBulk, AuthZENCategory, AuthZENEnvelope, AuthZENError, AuthZENErrorCode, AuthZENObligation, AuthZENOperationalState, AuthZENReasonCode, AuthZENRequest, AuthZENResponse, AuthZENResponseContext } from './types/authzen.gen';
|
|
33
|
+
/**
|
|
34
|
+
* The marker every tri-state attribute carries. See {@link AuthZENAttribute}.
|
|
35
|
+
*
|
|
36
|
+
* Exported so a caller building attributes across a serialisation boundary can
|
|
37
|
+
* reconstruct one the SDK will still recognise.
|
|
38
|
+
*/
|
|
39
|
+
export declare const AUTHZEN_ATTRIBUTE_MARKER = "__axonflow_authzen_attribute__";
|
|
40
|
+
/**
|
|
41
|
+
* AUTHZEN_PATH and AUTHZEN_PROFILE_HEADER are GENERATED (./types/authzen.gen) and
|
|
42
|
+
* re-exported here under the names this module has always had. They used to be
|
|
43
|
+
* literals in this file - the SDK's own copy of two strings the platform also
|
|
44
|
+
* wrote by hand - and nothing compared the copies (axonflow-enterprise#3603).
|
|
45
|
+
* The artifact now carries them, so a platform rename is a regenerate-and-diff
|
|
46
|
+
* failure rather than a runtime 404.
|
|
47
|
+
*
|
|
48
|
+
* The SDK always sends the profile header. AuthZEN 1.0's response is a bare
|
|
49
|
+
* boolean, and the four-valued state, the obligations and the approval challenge
|
|
50
|
+
* ride in the response context, which the server returns only to a caller that
|
|
51
|
+
* asked for it by version. This SDK understands the profile, so there is no
|
|
52
|
+
* reason to ask for less than it can read - and a response WITHOUT the context is
|
|
53
|
+
* therefore a protocol failure here rather than a decision with no obligations.
|
|
54
|
+
*/
|
|
55
|
+
export { AUTHZEN_PATH, AUTHZEN_PROFILE_HEADER } from './types/authzen.gen';
|
|
56
|
+
export declare const AUTHZEN_UNKNOWN_NOT_SUPPLIED = "attribute_not_supplied";
|
|
57
|
+
export declare const AUTHZEN_UNKNOWN_RESOLUTION_FAILED = "resolution_failed";
|
|
58
|
+
export declare const AUTHZEN_UNKNOWN_STALE = "stale";
|
|
59
|
+
export declare const AUTHZEN_UNKNOWN_SCHEMA_MISMATCH = "schema_mismatch";
|
|
60
|
+
export declare const AUTHZEN_UNKNOWN_CLOSURE_UNAVAILABLE = "closure_unavailable";
|
|
61
|
+
export declare const AUTHZEN_UNKNOWN_CLOSURE_TRUNCATED = "closure_truncated";
|
|
62
|
+
export declare const AUTHZEN_UNKNOWN_MALFORMED_VALUE = "malformed_value";
|
|
63
|
+
export declare const AUTHZEN_UNKNOWN_REQUIRED_ABSENT = "required_attribute_absent";
|
|
64
|
+
/** Who declined to produce a decision. */
|
|
65
|
+
export type AuthZENRefusedBy = 'client' | 'gateway';
|
|
66
|
+
/**
|
|
67
|
+
* The request was NOT evaluated, and here is the typed reason why.
|
|
68
|
+
*
|
|
69
|
+
* A refusal is not a denial. `decision: false` says the request WAS evaluated
|
|
70
|
+
* and the answer was no; a refusal says no decision exists. Code that treats
|
|
71
|
+
* every error as a deny fails closed — which is safe — but will block traffic
|
|
72
|
+
* that should have been allowed once the request is corrected.
|
|
73
|
+
*
|
|
74
|
+
* `refusedBy` says who made the call. `'gateway'` is a refusal document the
|
|
75
|
+
* server sent; `'client'` is this SDK declining to send a request it can
|
|
76
|
+
* already see will not be evaluated — an attribute the caller could not
|
|
77
|
+
* resolve, or an evaluation with no subject. The code vocabulary is shared
|
|
78
|
+
* because the REASONS are shared: an incomplete evaluation is an incomplete
|
|
79
|
+
* evaluation whoever notices it first.
|
|
80
|
+
*/
|
|
81
|
+
export declare class AuthZENRefusal extends AxonFlowError {
|
|
82
|
+
readonly code: AuthZENErrorCode;
|
|
83
|
+
readonly pointer?: string;
|
|
84
|
+
readonly supported?: string[];
|
|
85
|
+
readonly requestId?: string;
|
|
86
|
+
readonly refusedBy: AuthZENRefusedBy;
|
|
87
|
+
constructor(code: AuthZENErrorCode, message: string, options: {
|
|
88
|
+
refusedBy: AuthZENRefusedBy;
|
|
89
|
+
pointer?: string;
|
|
90
|
+
supported?: string[];
|
|
91
|
+
requestId?: string;
|
|
92
|
+
});
|
|
93
|
+
/** Build a refusal from the structured document the server sent. */
|
|
94
|
+
static fromBody(body: AuthZENError): AuthZENRefusal;
|
|
95
|
+
/**
|
|
96
|
+
* Whether sending the same request again could give a different answer.
|
|
97
|
+
*
|
|
98
|
+
* Only a dependency failure the GATEWAY reported is. Every other code names
|
|
99
|
+
* something about the request itself, which will not change on a retry — so
|
|
100
|
+
* a client that retries on any refusal burns its budget on requests that
|
|
101
|
+
* cannot succeed.
|
|
102
|
+
*
|
|
103
|
+
* A client-side refusal is never retryable, whatever its code: this SDK does
|
|
104
|
+
* not resolve the caller's attributes, so nothing it can do will change the
|
|
105
|
+
* answer. Reading retryability off the code alone would have told a caller to
|
|
106
|
+
* retry an attribute its own resolver failed to produce.
|
|
107
|
+
*/
|
|
108
|
+
get retryable(): boolean;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* A 200 whose body this build cannot safely interpret.
|
|
112
|
+
*
|
|
113
|
+
* Deliberately NOT an `AuthZENRefusal`. A refusal carries the server's own
|
|
114
|
+
* typed code from a closed vocabulary the server owns; a response this build
|
|
115
|
+
* cannot read is not something the server said, and dressing it in a server
|
|
116
|
+
* code would tell the caller the gateway refused when it did not. The two also
|
|
117
|
+
* demand different actions: a refusal means fix the request, a protocol error
|
|
118
|
+
* means upgrade the SDK or go and look at the deployment.
|
|
119
|
+
*
|
|
120
|
+
* It is always fail-closed: no decision is returned, so a caller that lets it
|
|
121
|
+
* propagate blocks the operation.
|
|
122
|
+
*/
|
|
123
|
+
export declare class AuthZENProtocolError extends AxonFlowError {
|
|
124
|
+
constructor(message: string);
|
|
125
|
+
}
|
|
126
|
+
/** The three states a policy-visible attribute can be in. */
|
|
127
|
+
export type AuthZENAttributeState = 'known' | 'absent' | 'unknown';
|
|
128
|
+
/**
|
|
129
|
+
* One policy-visible attribute in exactly one of three states.
|
|
130
|
+
*
|
|
131
|
+
* `undefined` and `null` cannot express this. ADR-065's model has three:
|
|
132
|
+
*
|
|
133
|
+
* - `known` — the authoritative source returned a value. It is sent.
|
|
134
|
+
* - `absent` — the source successfully established that there is NO value.
|
|
135
|
+
* Absence is a FACT, not a failure, so the member is omitted and the request
|
|
136
|
+
* is sent: a policy that handles absence gets to handle it.
|
|
137
|
+
* - `unknown` — the value could not be established. The request is NOT sent.
|
|
138
|
+
* Sending it would have the gateway evaluate as though the attribute were
|
|
139
|
+
* absent, and the resulting decision — and every audit of it — would record
|
|
140
|
+
* that an attribute was weighed when nobody ever read it. That is the exact
|
|
141
|
+
* failure the whole surface refuses to commit, one hop earlier.
|
|
142
|
+
*
|
|
143
|
+
* Collapsing absent into unknown is the defect this type exists to prevent, and
|
|
144
|
+
* it is not hypothetical: on the platform side an ABSENT `subject.type` was
|
|
145
|
+
* read as the one supported value, so omitting the field bypassed the
|
|
146
|
+
* impersonation refusal that naming it correctly triggered.
|
|
147
|
+
*
|
|
148
|
+
* Where it may be used: inside the ATTRIBUTE bags — `context` on a request or a
|
|
149
|
+
* bulk envelope, and the `properties` bag on a subject, action or resource — at
|
|
150
|
+
* any depth. Not on the structural members (`subject.id`, `action.name`,
|
|
151
|
+
* `resource.type` …): those are the identity of the question being asked, not
|
|
152
|
+
* data about it, and an identity the caller cannot resolve is not an attribute
|
|
153
|
+
* whose absence a policy could evaluate — there is simply no request to make.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* AuthZENAttribute.known('acme-corp');
|
|
158
|
+
* AuthZENAttribute.absent();
|
|
159
|
+
* AuthZENAttribute.unknown(AUTHZEN_UNKNOWN_RESOLUTION_FAILED);
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
export declare class AuthZENAttribute {
|
|
163
|
+
readonly state: AuthZENAttributeState;
|
|
164
|
+
readonly value: unknown;
|
|
165
|
+
readonly reason: string;
|
|
166
|
+
/**
|
|
167
|
+
* The marker, carried as an ordinary ENUMERABLE property.
|
|
168
|
+
*
|
|
169
|
+
* Recognising an attribute by `instanceof` alone has a silent failure in the
|
|
170
|
+
* dangerous direction: a bundler that duplicated this package gives two
|
|
171
|
+
* distinct classes. A non-enumerable Symbol brand fixes that and introduces
|
|
172
|
+
* the same failure by another route - every ordinary copy strips it, so
|
|
173
|
+
* `structuredClone`, a spread, a JSON round trip or a worker boundary turned
|
|
174
|
+
* an UNKNOWN attribute back into ordinary data and SENT it. Measured against
|
|
175
|
+
* a live gateway.
|
|
176
|
+
*
|
|
177
|
+
* Recognising it by SHAPE alone has the mirror failure: a caller's own bag
|
|
178
|
+
* carrying `state`/`value`/`reason` is read as an attribute, and a legitimate
|
|
179
|
+
* request is refused with a message asserting the caller could not establish
|
|
180
|
+
* a value it did establish.
|
|
181
|
+
*
|
|
182
|
+
* An enumerable marker closes both. It survives every ordinary copy, and no
|
|
183
|
+
* caller's data carries it by accident. The Python sibling uses the same key
|
|
184
|
+
* for the same reason.
|
|
185
|
+
*/
|
|
186
|
+
readonly [AUTHZEN_ATTRIBUTE_MARKER] = true;
|
|
187
|
+
private constructor();
|
|
188
|
+
/** The source returned this value. */
|
|
189
|
+
static known(value: unknown): AuthZENAttribute;
|
|
190
|
+
/** The source established that there is no value. */
|
|
191
|
+
static absent(): AuthZENAttribute;
|
|
192
|
+
/**
|
|
193
|
+
* The value could not be established, for the named reason.
|
|
194
|
+
*
|
|
195
|
+
* The reason is mandatory. An unknown with no reason carries no more than
|
|
196
|
+
* `undefined` already did, and the whole point of the third state is that it
|
|
197
|
+
* says why.
|
|
198
|
+
*/
|
|
199
|
+
static unknown(reason: string): AuthZENAttribute;
|
|
200
|
+
/**
|
|
201
|
+
* Whether `value` is a tri-state attribute, however it was copied.
|
|
202
|
+
*
|
|
203
|
+
* See the marker above for why this is neither a bare `instanceof` nor a
|
|
204
|
+
* structural shape check.
|
|
205
|
+
*
|
|
206
|
+
* Recognition keys on the MARKER alone, deliberately, and not on the marker
|
|
207
|
+
* plus a state this build happens to know.
|
|
208
|
+
*
|
|
209
|
+
* Pairing them was a fail-open (#263). A document carrying
|
|
210
|
+
* `__axonflow_authzen_attribute__: true` with any other `state` — a newer
|
|
211
|
+
* producer's, or a corrupted one — was reported as NOT an attribute, and so
|
|
212
|
+
* was walked as ordinary data and sent on the wire, marker key and all. By
|
|
213
|
+
* the surface's own reasoning that document IS an attribute; it is one this
|
|
214
|
+
* build cannot interpret. Evaluating around it records an attribute nobody
|
|
215
|
+
* resolved as one that was weighed, and it leaks the marker convention to the
|
|
216
|
+
* gateway.
|
|
217
|
+
*
|
|
218
|
+
* Recognising it here routes it to the same refusal an `unknown` attribute
|
|
219
|
+
* gets: the resolver matches `known` and `absent` explicitly and refuses
|
|
220
|
+
* everything else, so an unrecognised state (including a missing one) refuses
|
|
221
|
+
* locally, non-retryably, with a pointer to the member — which is what the Go
|
|
222
|
+
* SDK does (sdk-go#210).
|
|
223
|
+
*
|
|
224
|
+
* A marker that is present but not boolean `true` stays data: only a positive
|
|
225
|
+
* self-identification counts, so a caller's own bag with a similarly-named key
|
|
226
|
+
* cannot be turned into a refusal.
|
|
227
|
+
*/
|
|
228
|
+
static is(value: unknown): value is AuthZENAttribute;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* The decision, with the readings a Policy Enforcement Point acts on.
|
|
232
|
+
*
|
|
233
|
+
* It implements the generated wire type rather than replacing it, so `decision`
|
|
234
|
+
* and `context` remain exactly what the server sent while the readings below
|
|
235
|
+
* stay in hand-written code the generator never has to know about.
|
|
236
|
+
*/
|
|
237
|
+
export declare class AuthZENDecision implements AuthZENResponse {
|
|
238
|
+
readonly decision: boolean;
|
|
239
|
+
readonly context?: AuthZENResponseContext;
|
|
240
|
+
constructor(response: AuthZENResponse);
|
|
241
|
+
/**
|
|
242
|
+
* Whether the enforcement point may proceed.
|
|
243
|
+
*
|
|
244
|
+
* Read this rather than `decision`. `decision` is AuthZEN 1.0's collapsed
|
|
245
|
+
* boolean; the operational STATE is what the policy engine actually produced,
|
|
246
|
+
* and exactly one state permits execution. Requiring both means a response
|
|
247
|
+
* whose boolean and state disagree can never be read as an allow — and such a
|
|
248
|
+
* response is refused before it gets here anyway, so this is the second of
|
|
249
|
+
* two locks rather than the only one.
|
|
250
|
+
*
|
|
251
|
+
* An allow with an undischarged MANDATORY obligation is not an allow. See
|
|
252
|
+
* `mandatoryObligations`.
|
|
253
|
+
*/
|
|
254
|
+
get allowed(): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* The four-valued operational state.
|
|
257
|
+
*
|
|
258
|
+
* `ERROR` when there is no context. Unreachable via `evaluate`, which refuses
|
|
259
|
+
* a context-less 200 before constructing this — but the type is public and a
|
|
260
|
+
* caller can build one by hand, and the safe reading of an outcome that
|
|
261
|
+
* carries no state is not ALLOW.
|
|
262
|
+
*/
|
|
263
|
+
get state(): AuthZENOperationalState;
|
|
264
|
+
/**
|
|
265
|
+
* The id of the evaluation that DETERMINED this outcome.
|
|
266
|
+
*
|
|
267
|
+
* For a bulk envelope this is the entry that decided the meet, not the last
|
|
268
|
+
* one evaluated: it is the id an operator looks up to explain the answer.
|
|
269
|
+
*/
|
|
270
|
+
get decisionId(): string | undefined;
|
|
271
|
+
/** The safe machine-readable reason code, when the server sent one. */
|
|
272
|
+
get reason(): AuthZENReasonCode | undefined;
|
|
273
|
+
/** The coarse outcome category, when the server sent one. */
|
|
274
|
+
get category(): AuthZENCategory | undefined;
|
|
275
|
+
/** Instructions the enforcement point must discharge before proceeding. */
|
|
276
|
+
get obligations(): AuthZENObligation[];
|
|
277
|
+
/**
|
|
278
|
+
* The obligations that are not optional.
|
|
279
|
+
*
|
|
280
|
+
* A mandatory obligation that cannot be discharged means the operation must
|
|
281
|
+
* NOT proceed, even though `allowed` is true. This SDK cannot make that call
|
|
282
|
+
* for you — whether your enforcement point can discharge a redaction is a
|
|
283
|
+
* fact about your seam, not about the decision — so it gives you the list and
|
|
284
|
+
* stays out of the way.
|
|
285
|
+
*/
|
|
286
|
+
get mandatoryObligations(): AuthZENObligation[];
|
|
287
|
+
/** The approval challenge, when the state is CHALLENGE. */
|
|
288
|
+
get approval(): AuthZENApprovalRequirement | undefined;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Return the envelope with every tri-state attribute resolved to the wire.
|
|
292
|
+
*
|
|
293
|
+
* Throws `AuthZENRefusal` with `refusedBy: 'client'` and the JSON Pointer of
|
|
294
|
+
* the offending member when an attribute is UNKNOWN.
|
|
295
|
+
*
|
|
296
|
+
* The pointers match the server's own vocabulary — `/evaluation/...` for a
|
|
297
|
+
* singular envelope, `/evaluations/evaluations/<i>/...` for a plural entry — so
|
|
298
|
+
* a client-side refusal and a gateway refusal name the same member the same
|
|
299
|
+
* way, and a caller does not have to learn two pointer dialects.
|
|
300
|
+
*/
|
|
301
|
+
export declare function resolveEnvelope(envelope: AuthZENEnvelope): AuthZENEnvelope;
|
|
302
|
+
/** Refuse an envelope that cannot produce a decision, before the round trip. */
|
|
303
|
+
export declare function checkEnvelopeComplete(envelope: AuthZENEnvelope): void;
|
|
304
|
+
/** What `evaluateEnvelope` needs from the SDK's own HTTP path. */
|
|
305
|
+
export type AuthZENTransport = (path: string, body: unknown, headers: Record<string, string>) => Promise<{
|
|
306
|
+
status: number;
|
|
307
|
+
body: string;
|
|
308
|
+
}>;
|
|
309
|
+
/**
|
|
310
|
+
* Build an envelope: RESOLVE, check completeness, then validate.
|
|
311
|
+
*
|
|
312
|
+
* The counterpart of the Python sibling's `build_envelope`, and it exists for
|
|
313
|
+
* the same reason: `evaluate` and `evaluateAll` must not each assemble an
|
|
314
|
+
* envelope inline, or the two entry points drift on the order these steps run
|
|
315
|
+
* in - and that order decides which of two problems a caller with two problems
|
|
316
|
+
* is told about.
|
|
317
|
+
*/
|
|
318
|
+
export declare function buildEnvelope(evaluation?: AuthZENRequest, evaluations?: AuthZENBulk): AuthZENEnvelope;
|
|
319
|
+
/**
|
|
320
|
+
* Run one envelope through `send` and interpret the answer.
|
|
321
|
+
*
|
|
322
|
+
* `send` is the SDK's own transport — the same authenticated fetch wrapper,
|
|
323
|
+
* headers and heartbeat gate every other method uses. It is passed in rather
|
|
324
|
+
* than built here so this module owns the AuthZEN semantics and nothing else; a
|
|
325
|
+
* second transport would be a second place for credentials, timeouts and proxy
|
|
326
|
+
* configuration to drift out of step with the client the user configured.
|
|
327
|
+
*/
|
|
328
|
+
export declare function evaluateEnvelope(send: AuthZENTransport, envelope: AuthZENEnvelope): Promise<AuthZENDecision>;
|
|
329
|
+
/**
|
|
330
|
+
* Guarantee no tri-state attribute reaches the wire.
|
|
331
|
+
*
|
|
332
|
+
* `resolveEnvelope` walks every bag the contract declares, so on today's
|
|
333
|
+
* contract this has nothing to catch. It exists for the case that does not
|
|
334
|
+
* announce itself: a container kind added to the artifact later, or an attribute
|
|
335
|
+
* reaching a member the resolver does not visit. Without it that attribute is
|
|
336
|
+
* not a crash - `JSON.stringify` turns the instance into an ordinary
|
|
337
|
+
* `{"state": …, "value": …, "reason": …}` object - so the request is SENT,
|
|
338
|
+
* carrying a resolver's internal shape where the gateway expects a value, and an
|
|
339
|
+
* UNKNOWN attribute reaches the network after all.
|
|
340
|
+
*
|
|
341
|
+
* The Python sibling carries the same control, and had exactly this defect:
|
|
342
|
+
* there the check ran after serialisation and could never fire.
|
|
343
|
+
*/
|
|
344
|
+
export declare function assertFullyResolved(value: unknown, path?: string, depth?: number): void;
|
|
345
|
+
/**
|
|
346
|
+
* The exact document this SDK would send for `envelope`.
|
|
347
|
+
*
|
|
348
|
+
* Exported for tests and for support: "what did the SDK actually put on the
|
|
349
|
+
* wire" is the first question of every integration problem, and answering it by
|
|
350
|
+
* reading the client's source is how the answer ends up wrong.
|
|
351
|
+
*/
|
|
352
|
+
export declare function toWire(envelope: AuthZENEnvelope): AuthZENEnvelope;
|
|
353
|
+
//# sourceMappingURL=authzen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authzen.d.ts","sourceRoot":"","sources":["../../src/authzen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAuB,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAUL,0BAA0B,EAC1B,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EAEd,eAAe,EACf,sBAAsB,EAMvB,MAAM,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,mCAAmC,CAAC;AAEzE;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,YAAY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