@cleocode/lafs 2026.4.0 → 2026.4.3
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 +97 -68
- package/dist/src/a2a/bindings/grpc.d.ts +117 -11
- package/dist/src/a2a/bindings/grpc.d.ts.map +1 -1
- package/dist/src/a2a/bindings/grpc.js +79 -8
- package/dist/src/a2a/bindings/grpc.js.map +1 -1
- package/dist/src/a2a/bindings/http.d.ts +129 -14
- package/dist/src/a2a/bindings/http.d.ts.map +1 -1
- package/dist/src/a2a/bindings/http.js +93 -12
- package/dist/src/a2a/bindings/http.js.map +1 -1
- package/dist/src/a2a/bindings/index.d.ts +80 -7
- package/dist/src/a2a/bindings/index.d.ts.map +1 -1
- package/dist/src/a2a/bindings/index.js +69 -2
- package/dist/src/a2a/bindings/index.js.map +1 -1
- package/dist/src/a2a/bindings/jsonrpc.d.ts +193 -9
- package/dist/src/a2a/bindings/jsonrpc.d.ts.map +1 -1
- package/dist/src/a2a/bindings/jsonrpc.js +152 -9
- package/dist/src/a2a/bindings/jsonrpc.js.map +1 -1
- package/dist/src/a2a/bridge.d.ts +232 -37
- package/dist/src/a2a/bridge.d.ts.map +1 -1
- package/dist/src/a2a/bridge.js +172 -24
- package/dist/src/a2a/bridge.js.map +1 -1
- package/dist/src/a2a/extensions.d.ts +221 -12
- package/dist/src/a2a/extensions.d.ts.map +1 -1
- package/dist/src/a2a/extensions.js +175 -11
- package/dist/src/a2a/extensions.js.map +1 -1
- package/dist/src/a2a/index.d.ts +2 -0
- package/dist/src/a2a/index.d.ts.map +1 -1
- package/dist/src/a2a/index.js +2 -0
- package/dist/src/a2a/index.js.map +1 -1
- package/dist/src/a2a/streaming.d.ts +274 -2
- package/dist/src/a2a/streaming.d.ts.map +1 -1
- package/dist/src/a2a/streaming.js +245 -2
- package/dist/src/a2a/streaming.js.map +1 -1
- package/dist/src/a2a/task-lifecycle.d.ts +339 -19
- package/dist/src/a2a/task-lifecycle.d.ts.map +1 -1
- package/dist/src/a2a/task-lifecycle.js +302 -19
- package/dist/src/a2a/task-lifecycle.js.map +1 -1
- package/dist/src/budgetEnforcement.d.ts +88 -14
- package/dist/src/budgetEnforcement.d.ts.map +1 -1
- package/dist/src/budgetEnforcement.js +132 -19
- package/dist/src/budgetEnforcement.js.map +1 -1
- package/dist/src/circuit-breaker/index.d.ts +254 -9
- package/dist/src/circuit-breaker/index.d.ts.map +1 -1
- package/dist/src/circuit-breaker/index.js +218 -9
- package/dist/src/circuit-breaker/index.js.map +1 -1
- package/dist/src/compliance.d.ts +176 -0
- package/dist/src/compliance.d.ts.map +1 -1
- package/dist/src/compliance.js +100 -0
- package/dist/src/compliance.js.map +1 -1
- package/dist/src/conformance.d.ts +52 -0
- package/dist/src/conformance.d.ts.map +1 -1
- package/dist/src/conformance.js +41 -0
- package/dist/src/conformance.js.map +1 -1
- package/dist/src/conformanceProfiles.d.ts +66 -0
- package/dist/src/conformanceProfiles.d.ts.map +1 -1
- package/dist/src/conformanceProfiles.js +51 -0
- package/dist/src/conformanceProfiles.js.map +1 -1
- package/dist/src/deprecationRegistry.d.ts +80 -0
- package/dist/src/deprecationRegistry.d.ts.map +1 -1
- package/dist/src/deprecationRegistry.js +50 -0
- package/dist/src/deprecationRegistry.js.map +1 -1
- package/dist/src/discovery.d.ts +344 -63
- package/dist/src/discovery.d.ts.map +1 -1
- package/dist/src/discovery.js +67 -13
- package/dist/src/discovery.js.map +1 -1
- package/dist/src/envelope.d.ts +252 -0
- package/dist/src/envelope.d.ts.map +1 -1
- package/dist/src/envelope.js +165 -0
- package/dist/src/envelope.js.map +1 -1
- package/dist/src/errorRegistry.d.ts +159 -0
- package/dist/src/errorRegistry.d.ts.map +1 -1
- package/dist/src/errorRegistry.js +115 -0
- package/dist/src/errorRegistry.js.map +1 -1
- package/dist/src/fieldExtraction.d.ts +125 -25
- package/dist/src/fieldExtraction.d.ts.map +1 -1
- package/dist/src/fieldExtraction.js +85 -16
- package/dist/src/fieldExtraction.js.map +1 -1
- package/dist/src/flagResolver.d.ts +75 -9
- package/dist/src/flagResolver.d.ts.map +1 -1
- package/dist/src/flagResolver.js +20 -4
- package/dist/src/flagResolver.js.map +1 -1
- package/dist/src/flagSemantics.d.ts +76 -1
- package/dist/src/flagSemantics.d.ts.map +1 -1
- package/dist/src/flagSemantics.js +66 -0
- package/dist/src/flagSemantics.js.map +1 -1
- package/dist/src/health/index.d.ts +87 -6
- package/dist/src/health/index.d.ts.map +1 -1
- package/dist/src/health/index.js +54 -6
- package/dist/src/health/index.js.map +1 -1
- package/dist/src/index.d.ts +12 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +12 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/mviProjection.d.ts +42 -6
- package/dist/src/mviProjection.d.ts.map +1 -1
- package/dist/src/mviProjection.js +31 -5
- package/dist/src/mviProjection.js.map +1 -1
- package/dist/src/native-loader.d.ts +49 -0
- package/dist/src/native-loader.d.ts.map +1 -0
- package/dist/src/native-loader.js +56 -0
- package/dist/src/native-loader.js.map +1 -0
- package/dist/src/problemDetails.d.ts +70 -4
- package/dist/src/problemDetails.d.ts.map +1 -1
- package/dist/src/problemDetails.js +21 -3
- package/dist/src/problemDetails.js.map +1 -1
- package/dist/src/shutdown/index.d.ts +96 -7
- package/dist/src/shutdown/index.d.ts.map +1 -1
- package/dist/src/shutdown/index.js +72 -7
- package/dist/src/shutdown/index.js.map +1 -1
- package/dist/src/tokenEstimator.d.ts +97 -11
- package/dist/src/tokenEstimator.d.ts.map +1 -1
- package/dist/src/tokenEstimator.js +90 -11
- package/dist/src/tokenEstimator.js.map +1 -1
- package/dist/src/types.d.ts +467 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +64 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/validateEnvelope.d.ts +59 -1
- package/dist/src/validateEnvelope.d.ts.map +1 -1
- package/dist/src/validateEnvelope.js +75 -9
- package/dist/src/validateEnvelope.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/lafs.md +3 -4
- package/package.json +6 -3
- package/dist/src/mcpAdapter.d.ts +0 -29
- package/dist/src/mcpAdapter.d.ts.map +0 -1
- package/dist/src/mcpAdapter.js +0 -286
- package/dist/src/mcpAdapter.js.map +0 -1
- package/schemas/v1/conformance-profiles.d.ts +0 -15
- package/schemas/v1/envelope.schema.d.ts +0 -14
- package/schemas/v1/error-registry.d.ts +0 -24
package/dist/src/types.js
CHANGED
|
@@ -1,12 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Immutable set of all valid {@link MVILevel} values.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Used by {@link isMVILevel} for runtime validation. Being a `ReadonlySet`
|
|
6
|
+
* prevents accidental mutation of the canonical level list.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* if (MVI_LEVELS.has(input)) {
|
|
11
|
+
* // input is a valid MVILevel
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
1
15
|
export const MVI_LEVELS = new Set([
|
|
2
16
|
'minimal',
|
|
3
17
|
'standard',
|
|
4
18
|
'full',
|
|
5
19
|
'custom',
|
|
6
20
|
]);
|
|
21
|
+
/**
|
|
22
|
+
* Type guard that checks whether an unknown value is a valid {@link MVILevel}.
|
|
23
|
+
*
|
|
24
|
+
* @param value - The value to test.
|
|
25
|
+
* @returns `true` if `value` is one of the recognised MVI level strings.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* Performs a string type check followed by a set membership lookup against
|
|
29
|
+
* {@link MVI_LEVELS}. Safe to call with any input type.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const level: unknown = 'minimal';
|
|
34
|
+
* if (isMVILevel(level)) {
|
|
35
|
+
* // level is narrowed to MVILevel
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
7
39
|
export function isMVILevel(value) {
|
|
8
40
|
return typeof value === 'string' && MVI_LEVELS.has(value);
|
|
9
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Immutable set of all valid {@link LAFSAgentAction} values.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Used by {@link isAgentAction} for runtime validation. Being a `ReadonlySet`
|
|
47
|
+
* prevents accidental mutation of the canonical action list.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* if (AGENT_ACTIONS.has(action)) {
|
|
52
|
+
* // action is a valid LAFSAgentAction
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
10
56
|
export const AGENT_ACTIONS = new Set([
|
|
11
57
|
'retry',
|
|
12
58
|
'retry_modified',
|
|
@@ -16,6 +62,24 @@ export const AGENT_ACTIONS = new Set([
|
|
|
16
62
|
'refresh_context',
|
|
17
63
|
'authenticate',
|
|
18
64
|
]);
|
|
65
|
+
/**
|
|
66
|
+
* Type guard that checks whether an unknown value is a valid {@link LAFSAgentAction}.
|
|
67
|
+
*
|
|
68
|
+
* @param value - The value to test.
|
|
69
|
+
* @returns `true` if `value` is one of the recognised agent action strings.
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* Performs a string type check followed by a set membership lookup against
|
|
73
|
+
* {@link AGENT_ACTIONS}. Safe to call with any input type.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const action: unknown = 'retry';
|
|
78
|
+
* if (isAgentAction(action)) {
|
|
79
|
+
* // action is narrowed to LAFSAgentAction
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
19
83
|
export function isAgentAction(value) {
|
|
20
84
|
return typeof value === 'string' && AGENT_ACTIONS.has(value);
|
|
21
85
|
}
|
package/dist/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AA0EA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,UAAU,GAA0B,IAAI,GAAG,CAAW;IACjE,SAAS;IACT,UAAU;IACV,MAAM;IACN,QAAQ;CACT,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,UAAU,CAAC,GAAG,CAAC,KAAiB,CAAC,CAAC;AACxE,CAAC;AAqED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiC,IAAI,GAAG,CAAkB;IAClF,OAAO;IACP,gBAAgB;IAChB,UAAU;IACV,MAAM;IACN,MAAM;IACN,iBAAiB;IACjB,cAAc;CACf,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,aAAa,CAAC,GAAG,CAAC,KAAwB,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -1,16 +1,74 @@
|
|
|
1
1
|
import type { LAFSEnvelope } from './types.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Structured representation of a single schema validation error.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Normalizes the validation error shape from either the native Rust
|
|
7
|
+
* validator or the AJV fallback into a predictable structure with
|
|
8
|
+
* guaranteed non-optional fields.
|
|
9
|
+
*/
|
|
3
10
|
export interface StructuredValidationError {
|
|
11
|
+
/** JSON Pointer path to the property that failed validation (e.g., `"/_meta/mvi"`). */
|
|
4
12
|
path: string;
|
|
13
|
+
/** The JSON Schema keyword that triggered the error (e.g., `"required"`, `"type"`). */
|
|
5
14
|
keyword: string;
|
|
15
|
+
/** Human-readable description of the validation failure. */
|
|
6
16
|
message: string;
|
|
17
|
+
/** Keyword-specific parameters (e.g., `{ missingProperty: "success" }`). */
|
|
7
18
|
params: Record<string, unknown>;
|
|
8
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Result of validating a value against the LAFS envelope JSON Schema.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Contains both human-readable error strings and structured error objects
|
|
25
|
+
* for programmatic consumption.
|
|
26
|
+
*/
|
|
9
27
|
export interface EnvelopeValidationResult {
|
|
28
|
+
/** True when the input fully conforms to the envelope schema. */
|
|
10
29
|
valid: boolean;
|
|
30
|
+
/** Flattened human-readable error messages (empty when valid). */
|
|
11
31
|
errors: string[];
|
|
32
|
+
/** Structured error objects with path, keyword, and params (empty when valid). */
|
|
12
33
|
structuredErrors: StructuredValidationError[];
|
|
13
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Validates an unknown input against the LAFS envelope JSON Schema (Draft-07).
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Uses the native Rust validator (when available) or falls back to
|
|
40
|
+
* AJV. Both backends report all violations, not just the first.
|
|
41
|
+
* The compiled schema/validator is shared across calls for performance.
|
|
42
|
+
*
|
|
43
|
+
* @param input - The raw value to validate.
|
|
44
|
+
* @returns An {@link EnvelopeValidationResult} with validity status and any errors.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const result = validateEnvelope(JSON.parse(rawJson));
|
|
49
|
+
* if (!result.valid) {
|
|
50
|
+
* console.error(result.errors);
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
14
54
|
export declare function validateEnvelope(input: unknown): EnvelopeValidationResult;
|
|
55
|
+
/**
|
|
56
|
+
* Validates input and throws on schema failure, returning a typed envelope on success.
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
* Thin wrapper around {@link validateEnvelope} that converts a non-valid
|
|
60
|
+
* result into a thrown `Error`. The error message includes all validation
|
|
61
|
+
* errors joined by semicolons.
|
|
62
|
+
*
|
|
63
|
+
* @param input - The raw value to validate as a LAFS envelope.
|
|
64
|
+
* @returns The input cast to {@link LAFSEnvelope} when schema validation passes.
|
|
65
|
+
* @throws {Error} When the input does not conform to the envelope schema.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const envelope = assertEnvelope(parsed);
|
|
70
|
+
* console.log(envelope.success);
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
15
73
|
export declare function assertEnvelope(input: unknown): LAFSEnvelope;
|
|
16
74
|
//# sourceMappingURL=validateEnvelope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateEnvelope.d.ts","sourceRoot":"","sources":["../../src/validateEnvelope.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"validateEnvelope.d.ts","sourceRoot":"","sources":["../../src/validateEnvelope.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA4C/C;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB;IACxC,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb,uFAAuF;IACvF,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC,iEAAiE;IACjE,KAAK,EAAE,OAAO,CAAC;IACf,kEAAkE;IAClE,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,kFAAkF;IAClF,gBAAgB,EAAE,yBAAyB,EAAE,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CA8CzE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAM3D"}
|
|
@@ -1,14 +1,62 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const
|
|
2
|
+
import { getNativeModule } from './native-loader.js';
|
|
3
|
+
// ── AJV Fallback (loaded lazily, only when native binding unavailable) ──
|
|
4
|
+
let ajvValidate = null;
|
|
5
|
+
function getAjvValidate() {
|
|
6
|
+
if (ajvValidate)
|
|
7
|
+
return ajvValidate;
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
const envelopeSchema = require('../schemas/v1/envelope.schema.json');
|
|
10
|
+
const AjvModule = require('ajv');
|
|
11
|
+
const AddFormatsModule = require('ajv-formats');
|
|
12
|
+
const AjvCtor = (typeof AjvModule === 'function' ? AjvModule : AjvModule.default);
|
|
13
|
+
const addFormats = (typeof AddFormatsModule === 'function' ? AddFormatsModule : AddFormatsModule.default);
|
|
14
|
+
const ajv = new AjvCtor({ allErrors: true, strict: true, allowUnionTypes: true });
|
|
15
|
+
addFormats(ajv);
|
|
16
|
+
ajvValidate = ajv.compile(envelopeSchema);
|
|
17
|
+
return ajvValidate;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Validates an unknown input against the LAFS envelope JSON Schema (Draft-07).
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* Uses the native Rust validator (when available) or falls back to
|
|
24
|
+
* AJV. Both backends report all violations, not just the first.
|
|
25
|
+
* The compiled schema/validator is shared across calls for performance.
|
|
26
|
+
*
|
|
27
|
+
* @param input - The raw value to validate.
|
|
28
|
+
* @returns An {@link EnvelopeValidationResult} with validity status and any errors.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const result = validateEnvelope(JSON.parse(rawJson));
|
|
33
|
+
* if (!result.valid) {
|
|
34
|
+
* console.error(result.errors);
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
11
38
|
export function validateEnvelope(input) {
|
|
39
|
+
// Try native Rust binding first (faster, schema embedded at compile time)
|
|
40
|
+
const native = getNativeModule();
|
|
41
|
+
if (native) {
|
|
42
|
+
const payload = JSON.stringify(input);
|
|
43
|
+
const result = native.lafsValidateEnvelope(payload);
|
|
44
|
+
return {
|
|
45
|
+
valid: result.valid,
|
|
46
|
+
errors: result.errors,
|
|
47
|
+
structuredErrors: result.structuredErrors.map((se) => ({
|
|
48
|
+
path: se.path,
|
|
49
|
+
keyword: se.keyword,
|
|
50
|
+
message: se.message,
|
|
51
|
+
params: se.params,
|
|
52
|
+
})),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
// AJV fallback when native binding is unavailable
|
|
56
|
+
const validate = getAjvValidate();
|
|
57
|
+
if (!validate) {
|
|
58
|
+
return { valid: false, errors: ['Validation unavailable'], structuredErrors: [] };
|
|
59
|
+
}
|
|
12
60
|
const valid = validate(input);
|
|
13
61
|
if (valid) {
|
|
14
62
|
return { valid: true, errors: [], structuredErrors: [] };
|
|
@@ -22,6 +70,24 @@ export function validateEnvelope(input) {
|
|
|
22
70
|
const errors = structuredErrors.map((se) => `${se.path} ${se.message}`.trim());
|
|
23
71
|
return { valid: false, errors, structuredErrors };
|
|
24
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Validates input and throws on schema failure, returning a typed envelope on success.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* Thin wrapper around {@link validateEnvelope} that converts a non-valid
|
|
78
|
+
* result into a thrown `Error`. The error message includes all validation
|
|
79
|
+
* errors joined by semicolons.
|
|
80
|
+
*
|
|
81
|
+
* @param input - The raw value to validate as a LAFS envelope.
|
|
82
|
+
* @returns The input cast to {@link LAFSEnvelope} when schema validation passes.
|
|
83
|
+
* @throws {Error} When the input does not conform to the envelope schema.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const envelope = assertEnvelope(parsed);
|
|
88
|
+
* console.log(envelope.success);
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
25
91
|
export function assertEnvelope(input) {
|
|
26
92
|
const result = validateEnvelope(input);
|
|
27
93
|
if (!result.valid) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateEnvelope.js","sourceRoot":"","sources":["../../src/validateEnvelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"validateEnvelope.js","sourceRoot":"","sources":["../../src/validateEnvelope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,2EAA2E;AAE3E,IAAI,WAAW,GAQJ,IAAI,CAAC;AAEhB,SAAS,cAAc;IACrB,IAAI,WAAW;QAAE,OAAO,WAAW,CAAC;IAEpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,OAAO,CAAC,oCAAoC,CAA4B,CAAC;IAChG,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAId,CAAC;IAClB,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAElB,CAAC;IAE7B,MAAM,OAAO,GAAG,CAAC,OAAO,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAI/E,CAAC;IAEF,MAAM,UAA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