@astrale-os/kernel-protocol 0.5.0-beta.67 → 0.5.0-beta.69
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/claims.d.ts +7 -0
- package/dist/issuer/claims.js +7 -0
- package/dist/issuer/index.d.ts +2 -0
- package/dist/issuer/index.js +2 -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 +75 -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 +12 -1
- package/dist/routes/credential.js +11 -3
- package/dist/routes/decode.d.ts +5 -2
- package/dist/routes/decode.js +19 -6
- 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 +5 -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 +184 -47
- package/dist/schema/installation/introspection/index.d.ts +1 -1
- package/dist/schema/installation/introspection/result.d.ts +61 -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 +63 -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, InstalledRelease, 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 | readonly InstalledRelease[];
|
|
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;
|