@astrale-os/kernel-protocol 0.5.0-beta.66 → 0.5.0-beta.68
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/codecs/index.d.ts +1 -2
- package/dist/codecs/index.js +1 -2
- package/dist/codecs/media-types.d.ts +0 -1
- package/dist/codecs/media-types.js +0 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/invocation/admission.d.ts +2 -2
- package/dist/invocation/admission.js +5 -5
- package/dist/invocation/binding-codecs.d.ts +1 -1
- package/dist/invocation/binding-codecs.js +1 -6
- package/dist/invocation/http/negotiation.js +3 -10
- package/dist/invocation/index.d.ts +5 -2
- package/dist/invocation/index.js +4 -2
- package/dist/invocation/legacy/index.d.ts +29 -0
- package/dist/invocation/legacy/index.js +28 -0
- package/dist/invocation/legacy/route.d.ts +14 -0
- package/dist/invocation/legacy/route.js +25 -0
- package/dist/invocation/legacy/via.d.ts +30 -0
- package/dist/invocation/legacy/via.js +15 -0
- package/dist/invocation/redirect.d.ts +15 -12
- package/dist/invocation/redirect.js +9 -21
- package/dist/invocation/request.js +2 -2
- package/dist/invocation/routing.d.ts +19 -5
- package/dist/invocation/routing.js +50 -20
- package/dist/invocation/schema.d.ts +3 -8
- package/dist/invocation/schema.js +3 -10
- package/dist/invocation/service-reason.d.ts +13 -13
- package/dist/invocation/service-reason.js +13 -12
- package/dist/invocation/stale-route.d.ts +1 -1
- package/dist/invocation/target.d.ts +3 -0
- package/dist/invocation/target.js +8 -1
- package/dist/invocation/websocket/index.d.ts +1 -1
- package/dist/invocation/websocket/index.js +1 -1
- package/dist/invocation/websocket/subprotocol.d.ts +1 -2
- package/dist/invocation/websocket/subprotocol.js +3 -4
- package/dist/issuer/index.d.ts +1 -0
- package/dist/issuer/index.js +1 -0
- package/dist/issuer/paths.d.ts +2 -0
- package/dist/issuer/paths.js +1 -0
- package/dist/issuer/workflow-engine.d.ts +18 -0
- package/dist/issuer/workflow-engine.js +59 -0
- package/dist/{publication → release}/bindings/callable.js +6 -6
- package/dist/release/bindings/invocation.js +13 -0
- package/dist/{publication → release}/bindings/view.d.ts +1 -1
- package/dist/{publication → release}/bindings/view.js +10 -10
- package/dist/release/build.d.ts +6 -0
- package/dist/release/build.js +7 -0
- package/dist/release/bundle-admission.d.ts +21 -0
- package/dist/{publication → release}/bundle-admission.js +18 -18
- package/dist/{publication → release}/bundle-descriptor.js +6 -6
- package/dist/release/bundle-evidence.d.ts +3 -0
- package/dist/release/bundle-evidence.js +13 -0
- package/dist/{publication → release}/bundle.d.ts +2 -2
- package/dist/{publication → release}/bundle.js +9 -9
- package/dist/{publication → release}/delivery/attestation.d.ts +1 -0
- package/dist/release/delivery/claims.d.ts +21 -0
- package/dist/release/delivery/claims.js +68 -0
- package/dist/release/delivery/delivery.d.ts +11 -0
- package/dist/release/delivery/delivery.js +24 -0
- package/dist/{publication → release}/delivery/error.d.ts +2 -0
- package/dist/{publication → release}/delivery/error.js +1 -0
- package/dist/{publication → release}/delivery/index.d.ts +6 -1
- package/dist/{publication → release}/delivery/index.js +5 -0
- package/dist/{publication → release}/delivery/limits.d.ts +2 -1
- package/dist/release/delivery/limits.js +5 -0
- package/dist/release/delivery/request.d.ts +21 -0
- package/dist/release/delivery/request.js +60 -0
- package/dist/{publication → release}/delivery-declaration.js +4 -4
- package/dist/release/delivery-endpoint.js +22 -0
- package/dist/release/digest.d.ts +13 -0
- package/dist/{publication/etag.js → release/digest.js} +1 -10
- package/dist/release/error.d.ts +7 -0
- package/dist/release/error.js +11 -0
- package/dist/release/index.d.ts +21 -0
- package/dist/release/index.js +14 -0
- package/dist/release/issuer.d.ts +5 -0
- package/dist/release/issuer.js +34 -0
- package/dist/release/legacy/bindings.d.ts +14 -0
- package/dist/release/legacy/bindings.js +11 -0
- package/dist/release/legacy/bundle-admission.d.ts +6 -0
- package/dist/release/legacy/bundle-admission.js +10 -0
- package/dist/release/legacy/bundle-evidence.d.ts +8 -0
- package/dist/release/legacy/bundle-evidence.js +11 -0
- package/dist/release/legacy/bundle.d.ts +24 -0
- package/dist/release/legacy/bundle.js +31 -0
- package/dist/release/legacy/delivery/attestation.d.ts +6 -0
- package/dist/release/legacy/delivery/attestation.js +1 -0
- package/dist/{publication → release/legacy}/delivery/claims.d.ts +9 -0
- package/dist/{publication → release/legacy}/delivery/claims.js +7 -2
- package/dist/release/legacy/delivery/delivery.d.ts +18 -0
- package/dist/{publication → release/legacy}/delivery/delivery.js +6 -2
- package/dist/release/legacy/delivery/error.d.ts +16 -0
- package/dist/release/legacy/delivery/error.js +6 -0
- package/dist/release/legacy/delivery/index.d.ts +13 -0
- package/dist/release/legacy/delivery/index.js +13 -0
- package/dist/release/legacy/delivery/limits.d.ts +21 -0
- package/dist/release/legacy/delivery/limits.js +22 -0
- package/dist/release/legacy/delivery/request.d.ts +26 -0
- package/dist/{publication → release/legacy}/delivery/request.js +8 -3
- package/dist/release/legacy/delivery-declaration.d.ts +9 -0
- package/dist/release/legacy/delivery-declaration.js +11 -0
- package/dist/release/legacy/error.d.ts +26 -0
- package/dist/release/legacy/error.js +114 -0
- package/dist/release/legacy/etag.d.ts +12 -0
- package/dist/release/legacy/etag.js +14 -0
- package/dist/release/legacy/index.d.ts +72 -0
- package/dist/{publication → release/legacy}/index.js +7 -2
- package/dist/release/legacy/profiles.d.ts +23 -0
- package/dist/release/legacy/profiles.js +36 -0
- package/dist/release/legacy/projection.d.ts +13 -0
- package/dist/release/legacy/projection.js +25 -0
- package/dist/release/legacy/publication.d.ts +90 -0
- package/dist/release/legacy/publication.js +124 -0
- package/dist/release/legacy/reference.d.ts +47 -0
- package/dist/{publication → release/legacy}/reference.js +27 -3
- package/dist/release/legacy/requirements.d.ts +30 -0
- package/dist/release/legacy/requirements.js +20 -0
- package/dist/{publication → release}/manifest.js +6 -6
- package/dist/release/reference.d.ts +26 -0
- package/dist/release/reference.js +70 -0
- package/dist/release/release.d.ts +60 -0
- package/dist/release/release.js +123 -0
- package/dist/{publication → release}/requirements.d.ts +11 -4
- package/dist/{publication → release}/requirements.js +58 -39
- package/dist/{publication → release}/route.js +24 -24
- package/dist/{publication → release}/schema.js +4 -4
- package/dist/release/served.d.ts +26 -0
- package/dist/release/served.js +65 -0
- package/dist/release/shape.d.ts +8 -0
- package/dist/routes/admission.d.ts +1 -1
- package/dist/routes/admission.js +7 -85
- package/dist/routes/binding.d.ts +3 -3
- package/dist/routes/binding.js +10 -19
- package/dist/routes/compiler.d.ts +2 -2
- package/dist/routes/compiler.js +3 -2
- package/dist/routes/credential.d.ts +1 -1
- package/dist/routes/decode.d.ts +5 -2
- package/dist/routes/decode.js +15 -4
- package/dist/routes/deployment-retired.d.ts +30 -0
- package/dist/routes/deployment-retired.js +96 -0
- package/dist/routes/encode.js +7 -6
- package/dist/routes/entries.d.ts +23 -0
- package/dist/routes/entries.js +150 -0
- package/dist/routes/evidence.d.ts +3 -3
- package/dist/routes/evidence.js +7 -34
- package/dist/routes/header.d.ts +9 -0
- package/dist/routes/header.js +34 -0
- package/dist/routes/index.d.ts +5 -2
- package/dist/routes/index.js +5 -2
- package/dist/routes/legacy/index.d.ts +29 -0
- package/dist/routes/legacy/index.js +29 -0
- package/dist/routes/legacy/routing.d.ts +24 -0
- package/dist/routes/legacy/routing.js +45 -0
- package/dist/routes/legacy/table.d.ts +34 -0
- package/dist/routes/legacy/table.js +50 -0
- package/dist/routes/mapping.d.ts +1 -1
- package/dist/routes/mapping.js +4 -4
- package/dist/routes/match.d.ts +1 -1
- package/dist/routes/placement.d.ts +2 -2
- package/dist/routes/plan.d.ts +1 -1
- package/dist/routes/request.d.ts +3 -3
- package/dist/routes/reservation.d.ts +4 -2
- package/dist/routes/reservation.js +4 -3
- package/dist/routes/routing.d.ts +30 -6
- package/dist/routes/routing.js +34 -49
- package/dist/routes/select.d.ts +1 -1
- package/dist/routes/table.d.ts +3 -2
- package/dist/routes/target.d.ts +5 -0
- package/dist/routes/target.js +16 -0
- package/dist/runtime/artifact.d.ts +2 -2
- package/dist/runtime/artifact.js +2 -2
- package/dist/schema/installation/codec.d.ts +6 -1
- package/dist/schema/installation/codec.js +10 -7
- package/dist/schema/installation/introspection/codec.d.ts +11 -2
- package/dist/schema/installation/introspection/codec.js +59 -41
- package/dist/schema/installation/introspection/result.d.ts +8 -1
- package/dist/schema/installation/legacy/index.d.ts +39 -0
- package/dist/schema/installation/legacy/index.js +39 -0
- package/dist/schema/installation/legacy/installation.d.ts +9 -0
- package/dist/schema/installation/legacy/installation.js +28 -0
- package/dist/schema/installation/legacy/introspection.d.ts +10 -0
- package/dist/schema/installation/legacy/introspection.js +70 -0
- package/dist/schema/installation/legacy/msgpack.d.ts +1 -0
- package/dist/schema/installation/legacy/msgpack.js +143 -0
- package/package.json +59 -36
- package/dist/codecs/msgpack.d.ts +0 -4
- package/dist/codecs/msgpack.js +0 -53
- package/dist/publication/bindings/invocation.js +0 -13
- package/dist/publication/bundle-admission.d.ts +0 -4
- package/dist/publication/bundle-evidence.d.ts +0 -3
- package/dist/publication/bundle-evidence.js +0 -13
- package/dist/publication/content.d.ts +0 -10
- package/dist/publication/delivery/delivery.d.ts +0 -9
- package/dist/publication/delivery/limits.js +0 -4
- package/dist/publication/delivery/request.d.ts +0 -15
- package/dist/publication/delivery-endpoint.js +0 -22
- package/dist/publication/error.d.ts +0 -7
- package/dist/publication/error.js +0 -11
- package/dist/publication/etag.d.ts +0 -6
- package/dist/publication/index.d.ts +0 -17
- package/dist/publication/legacy-requirements.d.ts +0 -12
- package/dist/publication/legacy-requirements.js +0 -23
- package/dist/publication/publication.d.ts +0 -38
- package/dist/publication/publication.js +0 -146
- package/dist/publication/reference.d.ts +0 -17
- package/dist/routes/release-unavailable.d.ts +0 -8
- package/dist/routes/release-unavailable.js +0 -32
- /package/dist/{publication → release}/bindings/callable.d.ts +0 -0
- /package/dist/{publication → release}/bindings/index.d.ts +0 -0
- /package/dist/{publication → release}/bindings/index.js +0 -0
- /package/dist/{publication → release}/bindings/invocation.d.ts +0 -0
- /package/dist/{publication → release}/bundle-descriptor.d.ts +0 -0
- /package/dist/{publication → release}/declaration.d.ts +0 -0
- /package/dist/{publication → release}/declaration.js +0 -0
- /package/dist/{publication → release}/delivery/attestation.js +0 -0
- /package/dist/{publication → release}/delivery-declaration.d.ts +0 -0
- /package/dist/{publication → release}/delivery-endpoint.d.ts +0 -0
- /package/dist/{publication → release}/manifest.d.ts +0 -0
- /package/dist/{publication → release}/route.d.ts +0 -0
- /package/dist/{publication → release}/schema.d.ts +0 -0
- /package/dist/{publication/content.js → release/shape.js} +0 -0
package/dist/routes/routing.d.ts
CHANGED
|
@@ -1,22 +1,46 @@
|
|
|
1
1
|
import type * as invocation from '../invocation/index.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Sha256Digest } from '../release/digest.js';
|
|
3
|
+
import type { PublicationRef } from '../release/legacy/reference.js';
|
|
4
|
+
import type { ReleaseRef } from '../release/reference.js';
|
|
3
5
|
import type { HttpRequest } from './request.js';
|
|
4
6
|
export interface StaleControl {
|
|
5
7
|
readonly kind: 'stale';
|
|
6
|
-
|
|
8
|
+
/** Current Publication ETag; release-backed destinations report their frozen v3 projection's ETag. */
|
|
9
|
+
readonly current: Sha256Digest;
|
|
7
10
|
}
|
|
8
11
|
export interface MissControl {
|
|
9
12
|
readonly kind: 'miss';
|
|
10
13
|
}
|
|
11
|
-
|
|
14
|
+
/** The references one release-backed destination answers native routes for. */
|
|
15
|
+
export interface ServedReferences {
|
|
16
|
+
readonly release: ReleaseRef;
|
|
17
|
+
/**
|
|
18
|
+
* Reference of the frozen v3 projection the destination serves at `domain.json`, which a
|
|
19
|
+
* legacy native-route If-Match names by its Publication ETag.
|
|
20
|
+
*
|
|
21
|
+
* @deprecated Successor: the release digest in If-Match, emitted by the breaking release (AM-1).
|
|
22
|
+
*/
|
|
23
|
+
readonly projection: PublicationRef;
|
|
24
|
+
}
|
|
25
|
+
/** If-Match carries the routed digest of a native route request (`invocation.routedDigest`). */
|
|
26
|
+
export declare const HTTP_ROUTE_DIGEST: 'if-match';
|
|
12
27
|
export declare const HTTP_ROUTE_ISSUER: 'x-astrale-issuer';
|
|
13
28
|
export declare const HTTP_ROUTE_STALE: 'x-astrale-route-stale';
|
|
14
29
|
export declare const HTTP_ROUTE_STALE_STATUS: 412;
|
|
15
30
|
export declare const HTTP_ROUTE_MISS: 'x-astrale-route-miss';
|
|
16
31
|
export declare const HTTP_ROUTE_MISS_STATUS: 421;
|
|
17
|
-
|
|
18
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Decode the native routing pair of one request against the references a release-backed
|
|
34
|
+
* destination serves: an If-Match naming its release digest is a `Via`, one naming its projection
|
|
35
|
+
* ETag a legacy `PublicationVia`. An If-Match naming any other strong digest is stale whether or
|
|
36
|
+
* not the issuer header is present, as a Server answers before decoding; otherwise both headers
|
|
37
|
+
* are required. Stale reports the projection ETag as current, the legacy meaning every
|
|
38
|
+
* native-route value keeps until the breaking release (AM-1).
|
|
39
|
+
*/
|
|
40
|
+
export declare function decodeRouting(input: Pick<HttpRequest, 'headers'>, served: ServedReferences): invocation.Via | invocation.PublicationVia | StaleControl | undefined;
|
|
41
|
+
/** Emit the reserved stale header naming `current` (see `StaleControl.current`). */
|
|
42
|
+
export declare function staleHeaders(current: Sha256Digest): Readonly<Record<string, string>>;
|
|
19
43
|
export declare function decodeStale(status: number, headers: HttpRequest['headers']): StaleControl | undefined;
|
|
20
44
|
export declare function missHeaders(): Readonly<Record<string, string>>;
|
|
21
45
|
export declare function decodeMiss(status: number, headers: HttpRequest['headers']): MissControl | undefined;
|
|
22
|
-
export declare function encodeStrongEtag(input:
|
|
46
|
+
export declare function encodeStrongEtag(input: Sha256Digest): string;
|
package/dist/routes/routing.js
CHANGED
|
@@ -1,36 +1,41 @@
|
|
|
1
|
-
import * as auth from '@astrale-os/kernel-core/auth';
|
|
2
1
|
import { fail } from './error.js';
|
|
3
|
-
|
|
2
|
+
import { acceptIssuerHeader, reservedHeader, strongDigest } from './header.js';
|
|
3
|
+
/** If-Match carries the routed digest of a native route request (`invocation.routedDigest`). */
|
|
4
|
+
export const HTTP_ROUTE_DIGEST = 'if-match';
|
|
4
5
|
export const HTTP_ROUTE_ISSUER = 'x-astrale-issuer';
|
|
5
6
|
export const HTTP_ROUTE_STALE = 'x-astrale-route-stale';
|
|
6
7
|
export const HTTP_ROUTE_STALE_STATUS = 412;
|
|
7
8
|
export const HTTP_ROUTE_MISS = 'x-astrale-route-miss';
|
|
8
9
|
export const HTTP_ROUTE_MISS_STATUS = 421;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Decode the native routing pair of one request against the references a release-backed
|
|
12
|
+
* destination serves: an If-Match naming its release digest is a `Via`, one naming its projection
|
|
13
|
+
* ETag a legacy `PublicationVia`. An If-Match naming any other strong digest is stale whether or
|
|
14
|
+
* not the issuer header is present, as a Server answers before decoding; otherwise both headers
|
|
15
|
+
* are required. Stale reports the projection ETag as current, the legacy meaning every
|
|
16
|
+
* native-route value keeps until the breaking release (AM-1).
|
|
17
|
+
*/
|
|
18
|
+
export function decodeRouting(input, served) {
|
|
19
|
+
const encodedDigest = reservedHeader(input.headers, HTTP_ROUTE_DIGEST);
|
|
20
|
+
const encodedIssuer = reservedHeader(input.headers, HTTP_ROUTE_ISSUER);
|
|
21
|
+
if (encodedDigest === undefined && encodedIssuer === undefined)
|
|
14
22
|
return undefined;
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
const named = encodedDigest === undefined ? undefined : strongDigest(encodedDigest);
|
|
24
|
+
if (named !== undefined && named !== served.release.digest && named !== served.projection.etag) {
|
|
25
|
+
return Object.freeze({ kind: 'stale', current: served.projection.etag });
|
|
17
26
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
fail('NATIVE_ROUTE_ROUTING_INVALID', 'If-Match does not name the compiled Publication.');
|
|
27
|
+
if (encodedDigest === undefined || encodedIssuer === undefined) {
|
|
28
|
+
fail('NATIVE_ROUTE_ROUTING_INVALID', `${HTTP_ROUTE_DIGEST} and ${HTTP_ROUTE_ISSUER} must occur together.`);
|
|
21
29
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
issuer = auth.issuer.accept(encodedIssuer);
|
|
30
|
+
if (named === undefined) {
|
|
31
|
+
fail('NATIVE_ROUTE_ROUTING_INVALID', 'If-Match must contain exactly one strong quoted digest.');
|
|
25
32
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
throw cause;
|
|
31
|
-
}
|
|
32
|
-
return Object.freeze({ kind: 'via', publication, issuer });
|
|
33
|
+
const issuer = acceptIssuerHeader(encodedIssuer, HTTP_ROUTE_ISSUER);
|
|
34
|
+
return named === served.release.digest
|
|
35
|
+
? Object.freeze({ kind: 'via', release: served.release, issuer })
|
|
36
|
+
: Object.freeze({ kind: 'via', publication: served.projection, issuer });
|
|
33
37
|
}
|
|
38
|
+
/** Emit the reserved stale header naming `current` (see `StaleControl.current`). */
|
|
34
39
|
export function staleHeaders(current) {
|
|
35
40
|
return Object.freeze({
|
|
36
41
|
[HTTP_ROUTE_STALE]: encodeStrongEtag(current),
|
|
@@ -38,22 +43,23 @@ export function staleHeaders(current) {
|
|
|
38
43
|
});
|
|
39
44
|
}
|
|
40
45
|
export function decodeStale(status, headers) {
|
|
41
|
-
const encoded =
|
|
46
|
+
const encoded = reservedHeader(headers, HTTP_ROUTE_STALE);
|
|
42
47
|
if (encoded === undefined)
|
|
43
48
|
return undefined;
|
|
44
49
|
if (status !== HTTP_ROUTE_STALE_STATUS) {
|
|
45
50
|
fail('NATIVE_ROUTE_ROUTING_INVALID', `Header ${HTTP_ROUTE_STALE} is reserved for status ${HTTP_ROUTE_STALE_STATUS}.`);
|
|
46
51
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
52
|
+
const current = strongDigest(encoded);
|
|
53
|
+
if (current === undefined) {
|
|
54
|
+
fail('NATIVE_ROUTE_ROUTING_INVALID', `${HTTP_ROUTE_STALE} must contain exactly one strong quoted digest.`);
|
|
55
|
+
}
|
|
56
|
+
return Object.freeze({ kind: 'stale', current });
|
|
51
57
|
}
|
|
52
58
|
export function missHeaders() {
|
|
53
59
|
return Object.freeze({ [HTTP_ROUTE_MISS]: '1', 'cache-control': 'no-store' });
|
|
54
60
|
}
|
|
55
61
|
export function decodeMiss(status, headers) {
|
|
56
|
-
const encoded =
|
|
62
|
+
const encoded = reservedHeader(headers, HTTP_ROUTE_MISS);
|
|
57
63
|
if (encoded === undefined)
|
|
58
64
|
return undefined;
|
|
59
65
|
if (status !== HTTP_ROUTE_MISS_STATUS || encoded !== '1') {
|
|
@@ -64,24 +70,3 @@ export function decodeMiss(status, headers) {
|
|
|
64
70
|
export function encodeStrongEtag(input) {
|
|
65
71
|
return `"${input}"`;
|
|
66
72
|
}
|
|
67
|
-
function decodeStrongEtag(input, label) {
|
|
68
|
-
const matched = STRONG_ETAG.exec(input);
|
|
69
|
-
if (matched === null) {
|
|
70
|
-
fail('NATIVE_ROUTE_ROUTING_INVALID', `${label} must contain exactly one strong quoted Publication ETag.`);
|
|
71
|
-
}
|
|
72
|
-
return matched[1];
|
|
73
|
-
}
|
|
74
|
-
function routingHeader(input, name) {
|
|
75
|
-
if (input instanceof Headers)
|
|
76
|
-
return input.get(name) ?? undefined;
|
|
77
|
-
let found;
|
|
78
|
-
for (const [candidate, value] of Object.entries(input ?? {})) {
|
|
79
|
-
if (candidate.toLowerCase() !== name || value === undefined)
|
|
80
|
-
continue;
|
|
81
|
-
if (found !== undefined || (Array.isArray(value) && value.length !== 1)) {
|
|
82
|
-
fail('NATIVE_ROUTE_ROUTING_INVALID', `Header ${name} must occur at most once.`);
|
|
83
|
-
}
|
|
84
|
-
found = typeof value === 'string' ? value : value[0];
|
|
85
|
-
}
|
|
86
|
-
return found;
|
|
87
|
-
}
|
package/dist/routes/select.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Key } from '@astrale-os/kernel-dsl/v1';
|
|
2
2
|
import type { Route, Table } from './table.js';
|
|
3
|
-
export declare function select(table: Table, callable: Key.Callable, route?: string): Route | undefined;
|
|
3
|
+
export declare function select(table: Pick<Table, 'entries'>, callable: Key.Callable, route?: string): Route | undefined;
|
package/dist/routes/table.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ReleaseRef } from '../release/reference.js';
|
|
2
2
|
import type { PlanEntry } from './plan.js';
|
|
3
3
|
export interface Route extends Omit<PlanEntry, 'path'> {
|
|
4
4
|
readonly href: string;
|
|
5
5
|
}
|
|
6
|
+
/** Serving proof tied to one exact release and its resolved Domain. */
|
|
6
7
|
export interface Table {
|
|
7
|
-
readonly
|
|
8
|
+
readonly release: ReleaseRef;
|
|
8
9
|
readonly entries: readonly Route[];
|
|
9
10
|
}
|
package/dist/routes/target.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { Domain } from '@astrale-os/kernel-dsl/v1';
|
|
2
|
+
import type { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
3
|
+
import type { MeaningFingerprint } from '@astrale-os/kernel-dsl/v1/schema/fingerprint';
|
|
1
4
|
export type RouteTarget = {
|
|
2
5
|
readonly kind: 'function';
|
|
3
6
|
} | {
|
|
@@ -11,3 +14,5 @@ export type RouteTarget = {
|
|
|
11
14
|
export declare function requiresReceiver(entry: {
|
|
12
15
|
readonly target: RouteTarget;
|
|
13
16
|
}): boolean;
|
|
17
|
+
/** Fingerprint of the route Domain's callable meaning, which every native route Target pins. */
|
|
18
|
+
export declare function routeFingerprint(domain: Pick<Domain, 'callable'>, callable: Key.Callable): MeaningFingerprint;
|
package/dist/routes/target.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
import { callableFingerprint } from '@astrale-os/kernel-dsl/v1/schema/fingerprint';
|
|
2
|
+
import { fail } from './error.js';
|
|
1
3
|
export function requiresReceiver(entry) {
|
|
2
4
|
return entry.target.kind === 'method' && entry.target.dispatch === 'instance';
|
|
3
5
|
}
|
|
6
|
+
const FINGERPRINTS = new WeakMap();
|
|
7
|
+
/** Fingerprint of the route Domain's callable meaning, which every native route Target pins. */
|
|
8
|
+
export function routeFingerprint(domain, callable) {
|
|
9
|
+
const meaning = domain.callable(callable);
|
|
10
|
+
if (meaning === undefined) {
|
|
11
|
+
fail('NATIVE_ROUTE_BINDING_INVALID', `Route callable ${callable} is absent from its Domain.`);
|
|
12
|
+
}
|
|
13
|
+
let fingerprint = FINGERPRINTS.get(meaning);
|
|
14
|
+
if (fingerprint === undefined) {
|
|
15
|
+
fingerprint = callableFingerprint(meaning);
|
|
16
|
+
FINGERPRINTS.set(meaning, fingerprint);
|
|
17
|
+
}
|
|
18
|
+
return fingerprint;
|
|
19
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
2
|
import type { Key, Revision } from '@astrale-os/kernel-dsl/v1';
|
|
3
3
|
import type { Digest, Ref } from '../artifact/index.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Requirements } from '../release/requirements.js';
|
|
5
5
|
export interface ExecutableDependency {
|
|
6
6
|
readonly path: string;
|
|
7
7
|
readonly ref: Ref;
|
|
@@ -34,7 +34,7 @@ export interface RuntimeArtifact {
|
|
|
34
34
|
readonly version: 2 | 3;
|
|
35
35
|
readonly issuer: IssuerId;
|
|
36
36
|
readonly bundle: Ref;
|
|
37
|
-
readonly requirements:
|
|
37
|
+
readonly requirements: Requirements;
|
|
38
38
|
readonly modules: readonly [Module, ...Module[]];
|
|
39
39
|
}
|
|
40
40
|
export declare const MEDIA_TYPE: 'application/vnd.astrale.domain-runtime+json;v=3';
|
package/dist/runtime/artifact.js
CHANGED
|
@@ -3,8 +3,8 @@ import { patterns } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
|
3
3
|
import * as portable from '@astrale-os/kernel-dsl/value';
|
|
4
4
|
import { sha256 } from '@noble/hashes/sha2.js';
|
|
5
5
|
import * as artifact from '../artifact/index.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { decodeLegacyRequirements, encodeLegacyRequirements } from '../release/legacy/profiles.js';
|
|
7
|
+
import { admitRequirements } from '../release/legacy/requirements.js';
|
|
8
8
|
export const MEDIA_TYPE = 'application/vnd.astrale.domain-runtime+json;v=3';
|
|
9
9
|
export const LEGACY_MEDIA_TYPE = 'application/vnd.astrale.domain-runtime+json;v=2';
|
|
10
10
|
export function mediaType(input) {
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { InstallResult } from './result.js';
|
|
2
|
-
export declare const MEDIA_TYPE: 'application/vnd.astrale.schema-installation.
|
|
2
|
+
export declare const MEDIA_TYPE: 'application/vnd.astrale.schema-installation.v2+json';
|
|
3
3
|
export declare function encode(result: InstallResult): Promise<Uint8Array>;
|
|
4
4
|
export declare function decode(bytes: Uint8Array, maximumBytes: number): Promise<InstallResult>;
|
|
5
|
+
/**
|
|
6
|
+
* Package-private: admit one decoded installation result. Shared with the pre-R1 representation in
|
|
7
|
+
* `./legacy/`, which decodes other bytes into this same wire value.
|
|
8
|
+
*/
|
|
9
|
+
export declare function accept(input: unknown): InstallResult;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { installReceipt } from '@astrale-os/kernel-core/schema/kernel/syscalls/contracts';
|
|
2
|
+
import { json } from '@astrale-os/kernel-dsl/value';
|
|
2
3
|
import { acceptDomainInfo } from './introspection/index.js';
|
|
3
|
-
export const MEDIA_TYPE = 'application/vnd.astrale.schema-installation.
|
|
4
|
+
export const MEDIA_TYPE = 'application/vnd.astrale.schema-installation.v2+json';
|
|
5
|
+
const encoder = new TextEncoder();
|
|
4
6
|
export async function encode(result) {
|
|
5
|
-
|
|
6
|
-
const { pack } = await import('msgpackr/pack');
|
|
7
|
-
return new Uint8Array(pack(accept(result)));
|
|
7
|
+
return encoder.encode(json.serialize(accept(result)));
|
|
8
8
|
}
|
|
9
9
|
export async function decode(bytes, maximumBytes) {
|
|
10
10
|
if (!(bytes instanceof Uint8Array) ||
|
|
@@ -13,17 +13,20 @@ export async function decode(bytes, maximumBytes) {
|
|
|
13
13
|
bytes.byteLength > maximumBytes) {
|
|
14
14
|
throw new TypeError('Schema installation evidence is invalid or exceeds its bound.');
|
|
15
15
|
}
|
|
16
|
-
const { unpack } = await import('msgpackr');
|
|
17
16
|
let value;
|
|
18
17
|
try {
|
|
19
|
-
value =
|
|
18
|
+
value = json.decode(bytes, { limits: { maxBytes: maximumBytes } });
|
|
20
19
|
}
|
|
21
20
|
catch (cause) {
|
|
22
21
|
throw new TypeError('Schema installation evidence is malformed.', { cause });
|
|
23
22
|
}
|
|
24
23
|
return accept(value);
|
|
25
24
|
}
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Package-private: admit one decoded installation result. Shared with the pre-R1 representation in
|
|
27
|
+
* `./legacy/`, which decodes other bytes into this same wire value.
|
|
28
|
+
*/
|
|
29
|
+
export function accept(input) {
|
|
27
30
|
const value = record(input);
|
|
28
31
|
if (value.changed === true) {
|
|
29
32
|
exact(value, ['changed', 'receipt']);
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import type { introspection } from '@astrale-os/kernel-core/schema';
|
|
2
|
-
import type { DomainDependencies, DomainInfo, Limits, ResultFor } from './result.js';
|
|
3
|
-
export declare const MEDIA_TYPE: 'application/vnd.astrale.schema-introspection.
|
|
2
|
+
import type { DomainBundle, DomainDependencies, DomainInfo, Limits, ResultFor } from './result.js';
|
|
3
|
+
export declare const MEDIA_TYPE: 'application/vnd.astrale.schema-introspection.v3+json';
|
|
4
4
|
export declare function encode<Input extends introspection.Introspection>(input: Input, result: ResultFor<Input>): Promise<Uint8Array>;
|
|
5
5
|
export declare function decode<Input extends introspection.Introspection>(input: Input, bytes: Uint8Array, limits: Limits): Promise<ResultFor<Input>>;
|
|
6
|
+
/**
|
|
7
|
+
* Package-private: admit one decoded evidence value for an admitted request. Shared with the
|
|
8
|
+
* pre-R1 representation in `../legacy/`, which decodes other bytes into this same wire value.
|
|
9
|
+
*/
|
|
10
|
+
export declare function acceptEvidence(request: introspection.Introspection, decoded: unknown, limits: Limits): DomainInfo | DomainBundle | DomainDependencies;
|
|
11
|
+
/** Package-private: admit the evidence bounds a request declares. Shared with `../legacy/`. */
|
|
12
|
+
export declare function admitLimits(request: introspection.Introspection, limits: Limits): void;
|
|
6
13
|
/** Admit dependency bindings: origin-ordered, one per origin, each label agreeing with its revisions. */
|
|
7
14
|
export declare function acceptDomainDependencies(input: unknown): DomainDependencies;
|
|
8
15
|
export declare function acceptDomainInfo(input: unknown): DomainInfo;
|
|
16
|
+
/** Package-private: admit one introspection request. Shared with `../legacy/`. */
|
|
17
|
+
export declare function admitRequest(input: introspection.Introspection): introspection.Introspection;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { patterns } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
2
|
import * as bundle from '@astrale-os/kernel-dsl/v1/bundle/transport';
|
|
3
3
|
import { revision as schemaRevision } from '@astrale-os/kernel-dsl/v1/schema/revision';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { json } from '@astrale-os/kernel-dsl/value';
|
|
5
|
+
import { admitCallableBinding, admitViewBinding } from '../../../release/bindings/index.js';
|
|
6
|
+
import { withPublicationError } from '../../../release/legacy/error.js';
|
|
7
|
+
import * as publication from '../../../release/legacy/index.js';
|
|
8
|
+
export const MEDIA_TYPE = 'application/vnd.astrale.schema-introspection.v3+json';
|
|
9
|
+
const encoder = new TextEncoder();
|
|
10
|
+
const serializedBundles = new WeakMap();
|
|
8
11
|
const admittedBundles = new Map();
|
|
9
12
|
const MAXIMUM_ADMITTED_BUNDLES = 128;
|
|
13
|
+
// The Bundle travels as its JSON text inside the evidence; string escaping at most doubles it.
|
|
14
|
+
const BUNDLE_ESCAPE_FACTOR = 2;
|
|
15
|
+
// Encoding is bounded by the Server response policy, not by the default portable-value limits.
|
|
16
|
+
const ENCODE_LIMITS = Object.freeze({
|
|
17
|
+
maxBytes: Number.MAX_SAFE_INTEGER,
|
|
18
|
+
maxStringBytes: Number.MAX_SAFE_INTEGER,
|
|
19
|
+
});
|
|
10
20
|
export async function encode(input, result) {
|
|
11
21
|
const request = admitRequest(input);
|
|
12
22
|
const wire = request.kind === 'bundle'
|
|
@@ -15,39 +25,52 @@ export async function encode(input, result) {
|
|
|
15
25
|
? encodeDomainDependencies(result)
|
|
16
26
|
: encodeDomainInfo(result);
|
|
17
27
|
proveRequestedOrigin(request, result);
|
|
18
|
-
|
|
19
|
-
const { pack } = await import('msgpackr/pack');
|
|
20
|
-
return new Uint8Array(pack(wire));
|
|
28
|
+
return encoder.encode(json.serialize(wire, { limits: ENCODE_LIMITS }));
|
|
21
29
|
}
|
|
22
30
|
export async function decode(input, bytes, limits) {
|
|
23
31
|
const request = admitRequest(input);
|
|
24
32
|
if (!(bytes instanceof Uint8Array))
|
|
25
33
|
invalid('Schema introspection evidence must be binary.');
|
|
26
|
-
|
|
27
|
-
if (request.kind === 'bundle')
|
|
28
|
-
admitLimit(limits.maximumBundleBytes, 'Bundle');
|
|
34
|
+
admitLimits(request, limits);
|
|
29
35
|
const maximumEvidenceBytes = limits.maximumPublicationBytes +
|
|
30
|
-
(request.kind === 'bundle' ? limits.maximumBundleBytes : 0) +
|
|
36
|
+
(request.kind === 'bundle' ? BUNDLE_ESCAPE_FACTOR * limits.maximumBundleBytes : 0) +
|
|
31
37
|
4_096;
|
|
32
38
|
if (bytes.byteLength > maximumEvidenceBytes) {
|
|
33
39
|
invalid('Schema introspection evidence exceeds its declared bounds.');
|
|
34
40
|
}
|
|
35
|
-
const { unpack } = await import('msgpackr');
|
|
36
41
|
let decoded;
|
|
37
42
|
try {
|
|
38
|
-
decoded =
|
|
43
|
+
decoded = json.decode(bytes, {
|
|
44
|
+
limits: {
|
|
45
|
+
maxBytes: maximumEvidenceBytes,
|
|
46
|
+
...(request.kind === 'bundle' ? { maxStringBytes: limits.maximumBundleBytes } : {}),
|
|
47
|
+
},
|
|
48
|
+
});
|
|
39
49
|
}
|
|
40
50
|
catch (cause) {
|
|
41
51
|
throw new TypeError('Schema introspection evidence is malformed.', { cause });
|
|
42
52
|
}
|
|
43
|
-
|
|
53
|
+
return acceptEvidence(request, decoded, limits);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Package-private: admit one decoded evidence value for an admitted request. Shared with the
|
|
57
|
+
* pre-R1 representation in `../legacy/`, which decodes other bytes into this same wire value.
|
|
58
|
+
*/
|
|
59
|
+
export function acceptEvidence(request, decoded, limits) {
|
|
60
|
+
const result = request.kind === 'bundle'
|
|
44
61
|
? decodeDomainBundle(decoded, limits.maximumBundleBytes)
|
|
45
62
|
: request.kind === 'dependencies'
|
|
46
63
|
? acceptDomainDependencies(decoded)
|
|
47
|
-
: acceptDomainInfo(decoded)
|
|
64
|
+
: acceptDomainInfo(decoded);
|
|
48
65
|
proveRequestedOrigin(request, result);
|
|
49
66
|
return result;
|
|
50
67
|
}
|
|
68
|
+
/** Package-private: admit the evidence bounds a request declares. Shared with `../legacy/`. */
|
|
69
|
+
export function admitLimits(request, limits) {
|
|
70
|
+
admitLimit(limits.maximumPublicationBytes, 'Publication');
|
|
71
|
+
if (request.kind === 'bundle')
|
|
72
|
+
admitLimit(limits.maximumBundleBytes, 'Bundle');
|
|
73
|
+
}
|
|
51
74
|
function proveRequestedOrigin(request, result) {
|
|
52
75
|
const origin = request.kind === 'inspect'
|
|
53
76
|
? result.origin
|
|
@@ -107,44 +130,35 @@ function encodeDomainBundle(input) {
|
|
|
107
130
|
const admittedDomain = acceptDomainInfo(input.domain);
|
|
108
131
|
const domain = encodeDomainInfo(admittedDomain);
|
|
109
132
|
proveBundle(input.bundle, admittedDomain);
|
|
110
|
-
const
|
|
111
|
-
if (!
|
|
112
|
-
|
|
113
|
-
return Object.freeze({ domain, bundle:
|
|
133
|
+
const text = serializedBundles.get(input.bundle) ?? bundle.serialize(input.bundle);
|
|
134
|
+
if (!serializedBundles.has(input.bundle))
|
|
135
|
+
serializedBundles.set(input.bundle, text);
|
|
136
|
+
return Object.freeze({ domain, bundle: text });
|
|
114
137
|
}
|
|
115
138
|
function decodeDomainBundle(input, maximum) {
|
|
116
139
|
const value = record(input, 'Domain Bundle result');
|
|
117
140
|
exact(value, ['bundle', 'domain'], 'Domain Bundle result');
|
|
118
141
|
const domain = acceptDomainInfo(value.domain);
|
|
119
|
-
const
|
|
142
|
+
const text = boundedText(value.bundle, maximum, 'Bundle');
|
|
120
143
|
const cached = admittedBundles.get(domain.generation);
|
|
121
|
-
if (cached !== undefined &&
|
|
144
|
+
if (cached !== undefined && cached.text === text) {
|
|
122
145
|
return Object.freeze({ domain, bundle: cached.bundle });
|
|
123
146
|
}
|
|
124
147
|
let admitted;
|
|
125
148
|
try {
|
|
126
|
-
admitted = bundle.decode(
|
|
149
|
+
admitted = bundle.decode(text);
|
|
127
150
|
}
|
|
128
151
|
catch (cause) {
|
|
129
152
|
throw new TypeError('Installed Domain Bundle is invalid.', { cause });
|
|
130
153
|
}
|
|
131
154
|
proveBundle(admitted, domain);
|
|
132
155
|
admittedBundles.delete(domain.generation);
|
|
133
|
-
admittedBundles.set(domain.generation, Object.freeze({
|
|
156
|
+
admittedBundles.set(domain.generation, Object.freeze({ text, bundle: admitted }));
|
|
134
157
|
if (admittedBundles.size > MAXIMUM_ADMITTED_BUNDLES) {
|
|
135
158
|
admittedBundles.delete(admittedBundles.keys().next().value);
|
|
136
159
|
}
|
|
137
160
|
return Object.freeze({ domain, bundle: admitted });
|
|
138
161
|
}
|
|
139
|
-
function sameBytes(left, right) {
|
|
140
|
-
if (left.byteLength !== right.byteLength)
|
|
141
|
-
return false;
|
|
142
|
-
for (let index = 0; index < left.byteLength; index += 1) {
|
|
143
|
-
if (left[index] !== right[index])
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
162
|
function encodeDomainInfo(input) {
|
|
149
163
|
return acceptDomainInfo(input);
|
|
150
164
|
}
|
|
@@ -188,14 +202,15 @@ function publicationReference(input, origin, revision) {
|
|
|
188
202
|
function bindings(input, origin) {
|
|
189
203
|
const value = record(input, 'Domain bindings');
|
|
190
204
|
exact(value, ['callables', 'views'], 'Domain bindings');
|
|
191
|
-
|
|
205
|
+
const { callables, views } = value;
|
|
206
|
+
if (!Array.isArray(callables) || !Array.isArray(views)) {
|
|
192
207
|
invalid('Domain bindings are invalid.');
|
|
193
208
|
}
|
|
194
209
|
try {
|
|
195
|
-
return Object.freeze({
|
|
196
|
-
callables: Object.freeze(
|
|
197
|
-
views: Object.freeze(
|
|
198
|
-
});
|
|
210
|
+
return withPublicationError(() => Object.freeze({
|
|
211
|
+
callables: Object.freeze(callables.map((entry) => admitCallableBinding(entry, origin))),
|
|
212
|
+
views: Object.freeze(views.map((entry) => admitViewBinding(entry, origin))),
|
|
213
|
+
}));
|
|
199
214
|
}
|
|
200
215
|
catch (cause) {
|
|
201
216
|
throw new TypeError('Domain bindings are invalid.', { cause });
|
|
@@ -220,7 +235,8 @@ function capabilities(input) {
|
|
|
220
235
|
throw new TypeError('Domain capabilities are invalid.', { cause });
|
|
221
236
|
}
|
|
222
237
|
}
|
|
223
|
-
|
|
238
|
+
/** Package-private: admit one introspection request. Shared with `../legacy/`. */
|
|
239
|
+
export function admitRequest(input) {
|
|
224
240
|
const value = record(input, 'Schema introspection request');
|
|
225
241
|
exact(value, ['kind', 'origin'], 'Schema introspection request');
|
|
226
242
|
if (value.kind !== 'inspect' && value.kind !== 'bundle' && value.kind !== 'dependencies') {
|
|
@@ -237,11 +253,13 @@ function digest(input, label) {
|
|
|
237
253
|
}
|
|
238
254
|
return input;
|
|
239
255
|
}
|
|
240
|
-
function
|
|
241
|
-
if (
|
|
256
|
+
function boundedText(input, maximum, label) {
|
|
257
|
+
if (typeof input !== 'string' ||
|
|
258
|
+
input.length === 0 ||
|
|
259
|
+
encoder.encode(input).byteLength > maximum) {
|
|
242
260
|
invalid(`${label} evidence is invalid or exceeds its bound.`);
|
|
243
261
|
}
|
|
244
|
-
return
|
|
262
|
+
return input;
|
|
245
263
|
}
|
|
246
264
|
function admitLimit(input, label) {
|
|
247
265
|
if (!Number.isSafeInteger(input) || input < 1)
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import type { introspection } from '@astrale-os/kernel-core/schema';
|
|
2
2
|
import type { bundle, Key, Revision } from '@astrale-os/kernel-dsl/v1';
|
|
3
|
-
import type { Publication, PublicationRef, PublicationRequirements } from '../../../
|
|
3
|
+
import type { Publication, PublicationRef, PublicationRequirements } from '../../../release/legacy/index.js';
|
|
4
4
|
export type Digest = `sha256:${string}`;
|
|
5
5
|
/** Lightweight proof of one exact ready installed Domain generation. */
|
|
6
6
|
export interface DomainInfo {
|
|
7
7
|
readonly origin: Key.Origin;
|
|
8
8
|
readonly revision: Revision;
|
|
9
9
|
readonly generation: Digest;
|
|
10
|
+
/**
|
|
11
|
+
* Installed Publication reference: the pinned document's own for a legacy pin, the reference of
|
|
12
|
+
* the frozen v3 projection for a v4 pin.
|
|
13
|
+
*
|
|
14
|
+
* @deprecated Successor: `DomainInfo.release`, the installed `ReleaseRef`, emitted by the
|
|
15
|
+
* breaking release (AM-1).
|
|
16
|
+
*/
|
|
10
17
|
readonly publication: PublicationRef | null;
|
|
11
18
|
readonly readiness: Digest;
|
|
12
19
|
readonly capabilities: {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only decoders for the schema evidence of Hosts older than beta.127: MessagePack
|
|
3
|
+
* installation v1 (`application/vnd.astrale.schema-installation.v1+msgpack`) and introspection v2
|
|
4
|
+
* (`application/vnd.astrale.schema-introspection.v2+msgpack`). Each decodes its bytes into the same
|
|
5
|
+
* wire value as the canonical JSON evidence and admits it with the canonical checks, so it returns
|
|
6
|
+
* exactly the canonical `InstallResult` and introspection results. Nothing here encodes: Servers
|
|
7
|
+
* emit only the canonical JSON evidence.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Use `installation.decode` / `installation.introspection.decode` with their
|
|
10
|
+
* `MEDIA_TYPE`, the JSON evidence every Host from beta.127 serves.
|
|
11
|
+
*
|
|
12
|
+
* Short-term consumers, all through `@astrale-os/kernel-client` `SchemaApi`, which selects these
|
|
13
|
+
* decoders by the received media type:
|
|
14
|
+
* - Admin managing the 1Pact Host (Kernel beta.117) and the astrale Hosts on beta.121 and beta.126
|
|
15
|
+
* (`schema.inspect` before every Manager call, child `install`/`inspect`, `bundle` reads);
|
|
16
|
+
* - the CLI used by 1Pact developers, and `adapter-astrale` 0.5.0-beta.148, which runs
|
|
17
|
+
* `astrale introspect` before every 1Pact deploy (`introspect`, `view`,
|
|
18
|
+
* `domain install --direct`, cold-cache `call`);
|
|
19
|
+
* - the Console back-office (`schema.bundle` of every installed Domain);
|
|
20
|
+
* - SDK Project tooling (`pnpm dev`, the Environment installation reconcile), which runs
|
|
21
|
+
* `astrale introspect` and `astrale domain install --direct` through that same CLI against our
|
|
22
|
+
* beta.121 and beta.126 Hosts.
|
|
23
|
+
*
|
|
24
|
+
* Removal, in a separate breaking release: once no supported Host is older than beta.127 (the
|
|
25
|
+
* 1Pact Host upgraded; astrale-01, shared-01 and admin-users replaced or upgraded). Then delete, in
|
|
26
|
+
* the same PR:
|
|
27
|
+
* - this folder with its tests, golden evidence and laws, its `legacy/` entry in
|
|
28
|
+
* `../.spec/layout.ts`, and the `./schema/installation/legacy` subpaths (source and `dist`) of
|
|
29
|
+
* `protocol/package.json` with the `schema/installation/legacy/**` include of
|
|
30
|
+
* `protocol/tsconfig.json`;
|
|
31
|
+
* - the legacy media-type branches of `client/schema/schema.ts` and
|
|
32
|
+
* `client/schema/introspection.ts`, and `client/schema/__tests__/legacy-evidence.test.ts`;
|
|
33
|
+
* - the legacy paragraphs of `client/schema/.spec/architecture.md` and
|
|
34
|
+
* `../.spec/architecture.md`;
|
|
35
|
+
* - the package-private exports of `../codec.ts` (`accept`) and `../introspection/codec.ts`
|
|
36
|
+
* (`acceptEvidence`, `admitLimits`, `admitRequest`), which return to module scope.
|
|
37
|
+
*/
|
|
38
|
+
export { MEDIA_TYPE, decode } from './installation.js';
|
|
39
|
+
export * as introspection from './introspection.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only decoders for the schema evidence of Hosts older than beta.127: MessagePack
|
|
3
|
+
* installation v1 (`application/vnd.astrale.schema-installation.v1+msgpack`) and introspection v2
|
|
4
|
+
* (`application/vnd.astrale.schema-introspection.v2+msgpack`). Each decodes its bytes into the same
|
|
5
|
+
* wire value as the canonical JSON evidence and admits it with the canonical checks, so it returns
|
|
6
|
+
* exactly the canonical `InstallResult` and introspection results. Nothing here encodes: Servers
|
|
7
|
+
* emit only the canonical JSON evidence.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Use `installation.decode` / `installation.introspection.decode` with their
|
|
10
|
+
* `MEDIA_TYPE`, the JSON evidence every Host from beta.127 serves.
|
|
11
|
+
*
|
|
12
|
+
* Short-term consumers, all through `@astrale-os/kernel-client` `SchemaApi`, which selects these
|
|
13
|
+
* decoders by the received media type:
|
|
14
|
+
* - Admin managing the 1Pact Host (Kernel beta.117) and the astrale Hosts on beta.121 and beta.126
|
|
15
|
+
* (`schema.inspect` before every Manager call, child `install`/`inspect`, `bundle` reads);
|
|
16
|
+
* - the CLI used by 1Pact developers, and `adapter-astrale` 0.5.0-beta.148, which runs
|
|
17
|
+
* `astrale introspect` before every 1Pact deploy (`introspect`, `view`,
|
|
18
|
+
* `domain install --direct`, cold-cache `call`);
|
|
19
|
+
* - the Console back-office (`schema.bundle` of every installed Domain);
|
|
20
|
+
* - SDK Project tooling (`pnpm dev`, the Environment installation reconcile), which runs
|
|
21
|
+
* `astrale introspect` and `astrale domain install --direct` through that same CLI against our
|
|
22
|
+
* beta.121 and beta.126 Hosts.
|
|
23
|
+
*
|
|
24
|
+
* Removal, in a separate breaking release: once no supported Host is older than beta.127 (the
|
|
25
|
+
* 1Pact Host upgraded; astrale-01, shared-01 and admin-users replaced or upgraded). Then delete, in
|
|
26
|
+
* the same PR:
|
|
27
|
+
* - this folder with its tests, golden evidence and laws, its `legacy/` entry in
|
|
28
|
+
* `../.spec/layout.ts`, and the `./schema/installation/legacy` subpaths (source and `dist`) of
|
|
29
|
+
* `protocol/package.json` with the `schema/installation/legacy/**` include of
|
|
30
|
+
* `protocol/tsconfig.json`;
|
|
31
|
+
* - the legacy media-type branches of `client/schema/schema.ts` and
|
|
32
|
+
* `client/schema/introspection.ts`, and `client/schema/__tests__/legacy-evidence.test.ts`;
|
|
33
|
+
* - the legacy paragraphs of `client/schema/.spec/architecture.md` and
|
|
34
|
+
* `../.spec/architecture.md`;
|
|
35
|
+
* - the package-private exports of `../codec.ts` (`accept`) and `../introspection/codec.ts`
|
|
36
|
+
* (`acceptEvidence`, `admitLimits`, `admitRequest`), which return to module scope.
|
|
37
|
+
*/
|
|
38
|
+
export { MEDIA_TYPE, decode } from './installation.js';
|
|
39
|
+
export * as introspection from './introspection.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InstallResult } from '../result.js';
|
|
2
|
+
/** @deprecated Read-only: Hosts older than beta.127 serve this; current Hosts serve `installation.MEDIA_TYPE`. */
|
|
3
|
+
export declare const MEDIA_TYPE: 'application/vnd.astrale.schema-installation.v1+msgpack';
|
|
4
|
+
/**
|
|
5
|
+
* Decode version-one (MessagePack) installation evidence into the canonical result.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated Read-only; use `installation.decode` with `installation.MEDIA_TYPE`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function decode(bytes: Uint8Array, maximumBytes: number): Promise<InstallResult>;
|