@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
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frozen, read-only MessagePack decoder for the schema evidence of Hosts older than beta.127.
|
|
3
|
+
*
|
|
4
|
+
* It reads the families that msgpackr 2.0.5 `pack` (`useRecords: false`) wrote for that evidence:
|
|
5
|
+
* nil, booleans, integers, floats, strings, binary, arrays and string-keyed maps. Extension types
|
|
6
|
+
* (msgpackr records and `undefined`, timestamps, structured clones) never occur in it and are
|
|
7
|
+
* rejected, as are truncated input, trailing bytes, invalid UTF-8, non-string or duplicate map keys,
|
|
8
|
+
* integers outside the safe range, and nesting deeper than `maximumDepth`. It never encodes.
|
|
9
|
+
*/
|
|
10
|
+
const utf8 = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true });
|
|
11
|
+
export function decode(bytes, maximumDepth) {
|
|
12
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
13
|
+
let position = 0;
|
|
14
|
+
const take = (length) => {
|
|
15
|
+
if (length > bytes.byteLength - position)
|
|
16
|
+
malformed('is truncated');
|
|
17
|
+
const start = position;
|
|
18
|
+
position += length;
|
|
19
|
+
return start;
|
|
20
|
+
};
|
|
21
|
+
const u8 = () => bytes[take(1)];
|
|
22
|
+
const u16 = () => view.getUint16(take(2));
|
|
23
|
+
const u32 = () => view.getUint32(take(4));
|
|
24
|
+
const text = (length) => {
|
|
25
|
+
const start = take(length);
|
|
26
|
+
return utf8.decode(bytes.subarray(start, start + length));
|
|
27
|
+
};
|
|
28
|
+
const binary = (length) => {
|
|
29
|
+
const start = take(length);
|
|
30
|
+
return bytes.slice(start, start + length);
|
|
31
|
+
};
|
|
32
|
+
const entries = (count, width) => {
|
|
33
|
+
// Every entry occupies at least one byte per item: refuse counts the input cannot hold.
|
|
34
|
+
if (count * width > bytes.byteLength - position)
|
|
35
|
+
malformed('declares more entries than it holds');
|
|
36
|
+
};
|
|
37
|
+
const nested = (depth) => {
|
|
38
|
+
if (depth >= maximumDepth)
|
|
39
|
+
malformed(`nests deeper than ${maximumDepth} containers`);
|
|
40
|
+
return depth + 1;
|
|
41
|
+
};
|
|
42
|
+
const array = (count, depth) => {
|
|
43
|
+
entries(count, 1);
|
|
44
|
+
const output = [];
|
|
45
|
+
for (let index = 0; index < count; index += 1)
|
|
46
|
+
output.push(value(depth));
|
|
47
|
+
return output;
|
|
48
|
+
};
|
|
49
|
+
const map = (count, depth) => {
|
|
50
|
+
entries(count, 2);
|
|
51
|
+
const output = {};
|
|
52
|
+
for (let index = 0; index < count; index += 1) {
|
|
53
|
+
const key = value(depth);
|
|
54
|
+
if (typeof key !== 'string')
|
|
55
|
+
malformed('has a non-string map key');
|
|
56
|
+
if (Object.hasOwn(output, key))
|
|
57
|
+
malformed('has a duplicate map key');
|
|
58
|
+
Object.defineProperty(output, key, {
|
|
59
|
+
value: value(depth),
|
|
60
|
+
enumerable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
configurable: true,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return output;
|
|
66
|
+
};
|
|
67
|
+
const integer = (input) => {
|
|
68
|
+
const output = Number(input);
|
|
69
|
+
if (!Number.isSafeInteger(output))
|
|
70
|
+
malformed('holds an integer outside the safe range');
|
|
71
|
+
return output;
|
|
72
|
+
};
|
|
73
|
+
function value(depth) {
|
|
74
|
+
const head = u8();
|
|
75
|
+
if (head <= 0x7f)
|
|
76
|
+
return head;
|
|
77
|
+
if (head >= 0xe0)
|
|
78
|
+
return head - 0x100;
|
|
79
|
+
if (head <= 0x8f)
|
|
80
|
+
return map(head & 0x0f, nested(depth));
|
|
81
|
+
if (head <= 0x9f)
|
|
82
|
+
return array(head & 0x0f, nested(depth));
|
|
83
|
+
if (head <= 0xbf)
|
|
84
|
+
return text(head & 0x1f);
|
|
85
|
+
switch (head) {
|
|
86
|
+
case 0xc0:
|
|
87
|
+
return null;
|
|
88
|
+
case 0xc2:
|
|
89
|
+
return false;
|
|
90
|
+
case 0xc3:
|
|
91
|
+
return true;
|
|
92
|
+
case 0xc4:
|
|
93
|
+
return binary(u8());
|
|
94
|
+
case 0xc5:
|
|
95
|
+
return binary(u16());
|
|
96
|
+
case 0xc6:
|
|
97
|
+
return binary(u32());
|
|
98
|
+
case 0xca:
|
|
99
|
+
return view.getFloat32(take(4));
|
|
100
|
+
case 0xcb:
|
|
101
|
+
return view.getFloat64(take(8));
|
|
102
|
+
case 0xcc:
|
|
103
|
+
return u8();
|
|
104
|
+
case 0xcd:
|
|
105
|
+
return u16();
|
|
106
|
+
case 0xce:
|
|
107
|
+
return u32();
|
|
108
|
+
case 0xcf:
|
|
109
|
+
return integer(view.getBigUint64(take(8)));
|
|
110
|
+
case 0xd0:
|
|
111
|
+
return view.getInt8(take(1));
|
|
112
|
+
case 0xd1:
|
|
113
|
+
return view.getInt16(take(2));
|
|
114
|
+
case 0xd2:
|
|
115
|
+
return view.getInt32(take(4));
|
|
116
|
+
case 0xd3:
|
|
117
|
+
return integer(view.getBigInt64(take(8)));
|
|
118
|
+
case 0xd9:
|
|
119
|
+
return text(u8());
|
|
120
|
+
case 0xda:
|
|
121
|
+
return text(u16());
|
|
122
|
+
case 0xdb:
|
|
123
|
+
return text(u32());
|
|
124
|
+
case 0xdc:
|
|
125
|
+
return array(u16(), nested(depth));
|
|
126
|
+
case 0xdd:
|
|
127
|
+
return array(u32(), nested(depth));
|
|
128
|
+
case 0xde:
|
|
129
|
+
return map(u16(), nested(depth));
|
|
130
|
+
case 0xdf:
|
|
131
|
+
return map(u32(), nested(depth));
|
|
132
|
+
default:
|
|
133
|
+
return malformed(`uses the unsupported type 0x${head.toString(16)}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const output = value(0);
|
|
137
|
+
if (position !== bytes.byteLength)
|
|
138
|
+
malformed('has trailing bytes');
|
|
139
|
+
return output;
|
|
140
|
+
}
|
|
141
|
+
function malformed(reason) {
|
|
142
|
+
throw new TypeError(`MessagePack evidence ${reason}.`);
|
|
143
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-protocol",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.69",
|
|
4
4
|
"description": "Portable Astrale invocation, publication, installation, routing, and issuer protocols",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"types": "./dist/errors/index.d.ts",
|
|
28
28
|
"import": "./dist/errors/index.js"
|
|
29
29
|
},
|
|
30
|
+
"./issuer/claims": {
|
|
31
|
+
"types": "./dist/issuer/claims.d.ts",
|
|
32
|
+
"import": "./dist/issuer/claims.js"
|
|
33
|
+
},
|
|
30
34
|
"./issuer/configuration": {
|
|
31
35
|
"types": "./dist/issuer/configuration.d.ts",
|
|
32
36
|
"import": "./dist/issuer/configuration.js"
|
|
@@ -47,6 +51,10 @@
|
|
|
47
51
|
"types": "./dist/issuer/paths.d.ts",
|
|
48
52
|
"import": "./dist/issuer/paths.js"
|
|
49
53
|
},
|
|
54
|
+
"./issuer/workflow-engine": {
|
|
55
|
+
"types": "./dist/issuer/workflow-engine.d.ts",
|
|
56
|
+
"import": "./dist/issuer/workflow-engine.js"
|
|
57
|
+
},
|
|
50
58
|
"./invocation": {
|
|
51
59
|
"types": "./dist/invocation/index.d.ts",
|
|
52
60
|
"import": "./dist/invocation/index.js"
|
|
@@ -60,40 +68,60 @@
|
|
|
60
68
|
"import": "./dist/artifact/index.js"
|
|
61
69
|
},
|
|
62
70
|
"./publication": {
|
|
63
|
-
"types": "./dist/
|
|
64
|
-
"import": "./dist/
|
|
71
|
+
"types": "./dist/release/legacy/index.d.ts",
|
|
72
|
+
"import": "./dist/release/legacy/index.js"
|
|
65
73
|
},
|
|
66
74
|
"./publication/publication": {
|
|
67
|
-
"types": "./dist/
|
|
68
|
-
"import": "./dist/
|
|
75
|
+
"types": "./dist/release/legacy/publication.d.ts",
|
|
76
|
+
"import": "./dist/release/legacy/publication.js"
|
|
69
77
|
},
|
|
70
78
|
"./publication/reference": {
|
|
71
|
-
"types": "./dist/
|
|
72
|
-
"import": "./dist/
|
|
79
|
+
"types": "./dist/release/legacy/reference.d.ts",
|
|
80
|
+
"import": "./dist/release/legacy/reference.js"
|
|
73
81
|
},
|
|
74
82
|
"./publication/requirements": {
|
|
75
|
-
"types": "./dist/
|
|
76
|
-
"import": "./dist/
|
|
83
|
+
"types": "./dist/release/legacy/requirements.d.ts",
|
|
84
|
+
"import": "./dist/release/legacy/requirements.js"
|
|
77
85
|
},
|
|
78
86
|
"./publication/legacy-requirements": {
|
|
79
|
-
"types": "./dist/
|
|
80
|
-
"import": "./dist/
|
|
81
|
-
},
|
|
82
|
-
"./publication/delivery": {
|
|
83
|
-
"types": "./dist/publication/delivery/index.d.ts",
|
|
84
|
-
"import": "./dist/publication/delivery/index.js"
|
|
87
|
+
"types": "./dist/release/legacy/profiles.d.ts",
|
|
88
|
+
"import": "./dist/release/legacy/profiles.js"
|
|
85
89
|
},
|
|
86
90
|
"./publication/bundle": {
|
|
87
|
-
"types": "./dist/
|
|
88
|
-
"import": "./dist/
|
|
91
|
+
"types": "./dist/release/legacy/bundle.d.ts",
|
|
92
|
+
"import": "./dist/release/legacy/bundle.js"
|
|
89
93
|
},
|
|
90
94
|
"./publication/bundle-evidence": {
|
|
91
|
-
"types": "./dist/
|
|
92
|
-
"import": "./dist/
|
|
95
|
+
"types": "./dist/release/legacy/bundle-evidence.d.ts",
|
|
96
|
+
"import": "./dist/release/legacy/bundle-evidence.js"
|
|
97
|
+
},
|
|
98
|
+
"./release": {
|
|
99
|
+
"types": "./dist/release/index.d.ts",
|
|
100
|
+
"import": "./dist/release/index.js"
|
|
101
|
+
},
|
|
102
|
+
"./release/bundle": {
|
|
103
|
+
"types": "./dist/release/bundle.d.ts",
|
|
104
|
+
"import": "./dist/release/bundle.js"
|
|
105
|
+
},
|
|
106
|
+
"./release/bundle-evidence": {
|
|
107
|
+
"types": "./dist/release/bundle-evidence.d.ts",
|
|
108
|
+
"import": "./dist/release/bundle-evidence.js"
|
|
109
|
+
},
|
|
110
|
+
"./release/delivery": {
|
|
111
|
+
"types": "./dist/release/delivery/index.d.ts",
|
|
112
|
+
"import": "./dist/release/delivery/index.js"
|
|
93
113
|
},
|
|
94
|
-
"./
|
|
95
|
-
"types": "./dist/
|
|
96
|
-
"import": "./dist/
|
|
114
|
+
"./release/delivery-declaration": {
|
|
115
|
+
"types": "./dist/release/delivery-declaration.d.ts",
|
|
116
|
+
"import": "./dist/release/delivery-declaration.js"
|
|
117
|
+
},
|
|
118
|
+
"./release/legacy": {
|
|
119
|
+
"types": "./dist/release/legacy/index.d.ts",
|
|
120
|
+
"import": "./dist/release/legacy/index.js"
|
|
121
|
+
},
|
|
122
|
+
"./release/requirements": {
|
|
123
|
+
"types": "./dist/release/requirements.d.ts",
|
|
124
|
+
"import": "./dist/release/requirements.js"
|
|
97
125
|
},
|
|
98
126
|
"./routes": {
|
|
99
127
|
"types": "./dist/routes/index.d.ts",
|
|
@@ -103,6 +131,10 @@
|
|
|
103
131
|
"types": "./dist/schema/index.d.ts",
|
|
104
132
|
"import": "./dist/schema/index.js"
|
|
105
133
|
},
|
|
134
|
+
"./schema/installation/legacy": {
|
|
135
|
+
"types": "./dist/schema/installation/legacy/index.d.ts",
|
|
136
|
+
"import": "./dist/schema/installation/legacy/index.js"
|
|
137
|
+
},
|
|
106
138
|
"./routes/admission": {
|
|
107
139
|
"types": "./dist/routes/admission.d.ts",
|
|
108
140
|
"import": "./dist/routes/admission.js"
|
|
@@ -119,9 +151,13 @@
|
|
|
119
151
|
"types": "./dist/routes/placement.d.ts",
|
|
120
152
|
"import": "./dist/routes/placement.js"
|
|
121
153
|
},
|
|
122
|
-
"./routes/
|
|
123
|
-
"types": "./dist/routes/
|
|
124
|
-
"import": "./dist/routes/
|
|
154
|
+
"./routes/deployment-retired": {
|
|
155
|
+
"types": "./dist/routes/deployment-retired.d.ts",
|
|
156
|
+
"import": "./dist/routes/deployment-retired.js"
|
|
157
|
+
},
|
|
158
|
+
"./routes/legacy": {
|
|
159
|
+
"types": "./dist/routes/legacy/index.d.ts",
|
|
160
|
+
"import": "./dist/routes/legacy/index.js"
|
|
125
161
|
},
|
|
126
162
|
"./routes/routing": {
|
|
127
163
|
"types": "./dist/routes/routing.d.ts",
|
|
@@ -137,24 +173,15 @@
|
|
|
137
173
|
"access": "public"
|
|
138
174
|
},
|
|
139
175
|
"dependencies": {
|
|
140
|
-
"@astrale-os/kernel-core": "0.9.0-beta.
|
|
141
|
-
"@astrale-os/kernel-dsl": "0.2.0-beta.
|
|
176
|
+
"@astrale-os/kernel-core": "0.9.0-beta.63",
|
|
177
|
+
"@astrale-os/kernel-dsl": "0.2.0-beta.45",
|
|
142
178
|
"@noble/hashes": "2.3.0"
|
|
143
179
|
},
|
|
144
180
|
"devDependencies": {
|
|
145
181
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
146
|
-
"msgpackr": "^2.0.5",
|
|
147
182
|
"typescript": "7.0.2",
|
|
148
183
|
"vitest": "^5.0.1"
|
|
149
184
|
},
|
|
150
|
-
"peerDependencies": {
|
|
151
|
-
"msgpackr": "^2.0.5"
|
|
152
|
-
},
|
|
153
|
-
"peerDependenciesMeta": {
|
|
154
|
-
"msgpackr": {
|
|
155
|
-
"optional": true
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
185
|
"scripts": {
|
|
159
186
|
"build": "tsc",
|
|
160
187
|
"clean": "rm -rf dist",
|
package/dist/codecs/msgpack.d.ts
DELETED
package/dist/codecs/msgpack.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { accept as acceptValue, BoundaryError } from '@astrale-os/kernel-dsl/value';
|
|
2
|
-
import { DecodeError } from './codec.js';
|
|
3
|
-
import { CONTENT_TYPE_MSGPACK } from './media-types.js';
|
|
4
|
-
let library = null;
|
|
5
|
-
export async function loadMsgpack() {
|
|
6
|
-
if (library === null) {
|
|
7
|
-
// `as string` keeps TypeScript from pulling msgpackr's declarations, which assume
|
|
8
|
-
// `@types/node`, into consumer programs. The assertion is erased on emit, so bundlers
|
|
9
|
-
// still see literal specifiers; a variable would leave them unresolvable.
|
|
10
|
-
const [packing, unpacking] = await Promise.all([
|
|
11
|
-
import('msgpackr/pack'),
|
|
12
|
-
import('msgpackr'),
|
|
13
|
-
]);
|
|
14
|
-
library = Object.freeze({ pack: packing.pack, unpack: unpacking.unpack });
|
|
15
|
-
}
|
|
16
|
-
return MSGPACK;
|
|
17
|
-
}
|
|
18
|
-
const MSGPACK = Object.freeze({
|
|
19
|
-
name: 'msgpack',
|
|
20
|
-
contentType: CONTENT_TYPE_MSGPACK,
|
|
21
|
-
binary: true,
|
|
22
|
-
encode(data) {
|
|
23
|
-
if (library === null)
|
|
24
|
-
throw new Error('MsgPack codec is not loaded');
|
|
25
|
-
return new Uint8Array(library.pack(acceptValue(data)));
|
|
26
|
-
},
|
|
27
|
-
decode(input) {
|
|
28
|
-
if (library === null)
|
|
29
|
-
throw new Error('MsgPack codec is not loaded');
|
|
30
|
-
if (typeof input === 'string')
|
|
31
|
-
throw new TypeError('MsgPack requires a binary envelope');
|
|
32
|
-
let decoded;
|
|
33
|
-
try {
|
|
34
|
-
decoded = library.unpack(input);
|
|
35
|
-
}
|
|
36
|
-
catch (cause) {
|
|
37
|
-
throw new DecodeError('MsgPack envelope is malformed.', { cause });
|
|
38
|
-
}
|
|
39
|
-
try {
|
|
40
|
-
return acceptValue(decoded);
|
|
41
|
-
}
|
|
42
|
-
catch (cause) {
|
|
43
|
-
if (cause instanceof BoundaryError) {
|
|
44
|
-
throw new DecodeError('MsgPack envelope is not a portable value.', { cause });
|
|
45
|
-
}
|
|
46
|
-
throw cause;
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
/** Package-private canonical identity check used by Protocol binding selection. */
|
|
51
|
-
export function isMsgpackCodec(input) {
|
|
52
|
-
return input === MSGPACK;
|
|
53
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { absoluteHttpUrl, absoluteUrl, exact, record } from '../content.js';
|
|
2
|
-
export function acceptInvocationEndpoints(input) {
|
|
3
|
-
const value = record(input, 'PUBLICATION_BINDING_INVALID', 'Invocation endpoints are invalid.');
|
|
4
|
-
exact(value, ['http', 'websocket'], 'PUBLICATION_BINDING_INVALID');
|
|
5
|
-
const http = absoluteHttpUrl(value.http, true, 'PUBLICATION_BINDING_INVALID');
|
|
6
|
-
const websocket = value.websocket === undefined
|
|
7
|
-
? undefined
|
|
8
|
-
: absoluteUrl(value.websocket, ['ws:', 'wss:'], true, 'PUBLICATION_BINDING_INVALID');
|
|
9
|
-
return Object.freeze({
|
|
10
|
-
http,
|
|
11
|
-
...(websocket === undefined ? {} : { websocket }),
|
|
12
|
-
});
|
|
13
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import * as dslBundle from '@astrale-os/kernel-dsl/v1/bundle';
|
|
2
|
-
import type { Publication } from './publication.js';
|
|
3
|
-
export declare function acceptBundle(input: Publication, artifact: unknown): dslBundle.Bundle;
|
|
4
|
-
export declare function decodeBundle(input: Publication, bytes: Uint8Array): dslBundle.Bundle;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { fail } from './error.js';
|
|
2
|
-
import { sha256Hex } from './etag.js';
|
|
3
|
-
/** Verify exact artifact bytes without decoding an authored Schema Bundle. */
|
|
4
|
-
export function verifyBundleBytes(publication, bytes) {
|
|
5
|
-
if (!(bytes instanceof Uint8Array)) {
|
|
6
|
-
fail('PUBLICATION_INVALID', 'Bundle artifact bytes are invalid.');
|
|
7
|
-
}
|
|
8
|
-
const descriptor = publication.schema.bundle;
|
|
9
|
-
if (bytes.byteLength !== descriptor.ref.size ||
|
|
10
|
-
`sha256:${sha256Hex(bytes)}` !== descriptor.ref.digest) {
|
|
11
|
-
fail('PUBLICATION_INVALID', 'Bundle artifact does not match its descriptor.');
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { PublicationErrorCode } from './error.js';
|
|
2
|
-
import type { Publication } from './publication.js';
|
|
3
|
-
export type Content = Omit<Publication, 'etag'>;
|
|
4
|
-
export declare function record(input: unknown, code: PublicationErrorCode, message: string): Record<string, unknown>;
|
|
5
|
-
export declare function exact(value: Record<string, unknown>, allowed: readonly string[], code: PublicationErrorCode): void;
|
|
6
|
-
export declare function array(input: unknown, code: PublicationErrorCode): readonly unknown[];
|
|
7
|
-
export declare function unique(values: readonly string[], code: PublicationErrorCode, label: string): void;
|
|
8
|
-
export declare function deepFreeze<T>(value: T): T;
|
|
9
|
-
export declare function absoluteHttpUrl(input: unknown, allowSearch: boolean, code: PublicationErrorCode, allowTemplate?: boolean): string;
|
|
10
|
-
export declare function absoluteUrl(input: unknown, protocols: readonly string[], allowSearch: boolean, code: PublicationErrorCode, allowTemplate?: boolean): string;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Publication } from '../publication.js';
|
|
2
|
-
import type { Attestation } from './attestation.js';
|
|
3
|
-
export interface Delivery {
|
|
4
|
-
readonly format: 'astrale.domain.delivery';
|
|
5
|
-
readonly version: 1;
|
|
6
|
-
readonly publication: Publication;
|
|
7
|
-
readonly attestation: Attestation;
|
|
8
|
-
}
|
|
9
|
-
export declare function accept(input: unknown): Delivery;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
-
import type { Etag } from '../etag.js';
|
|
3
|
-
export interface Request {
|
|
4
|
-
readonly version: 1;
|
|
5
|
-
readonly kernel: IssuerId;
|
|
6
|
-
readonly nonce: string;
|
|
7
|
-
readonly etag: Etag;
|
|
8
|
-
}
|
|
9
|
-
/** Exact bearer credential admitted by a Delivery transport boundary. */
|
|
10
|
-
export interface Token {
|
|
11
|
-
readonly kind: 'bearer';
|
|
12
|
-
readonly token: string;
|
|
13
|
-
}
|
|
14
|
-
/** Admit the exact request representation accepted by a Delivery transport boundary. */
|
|
15
|
-
export declare function acceptRequest(input: unknown): Request;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { absoluteHttpUrl, exact, record } from './content.js';
|
|
2
|
-
import { fail } from './error.js';
|
|
3
|
-
export function admitEndpoint(input, publicUrl) {
|
|
4
|
-
if (input === undefined)
|
|
5
|
-
return undefined;
|
|
6
|
-
const value = record(input, 'PUBLICATION_INVALID', 'Delivery endpoint is invalid.');
|
|
7
|
-
exact(value, ['href', 'method', 'authentication'], 'PUBLICATION_INVALID');
|
|
8
|
-
const href = absoluteHttpUrl(value.href, true, 'PUBLICATION_INVALID');
|
|
9
|
-
if (new URL(href).origin !== new URL(publicUrl).origin || value.method !== 'POST') {
|
|
10
|
-
fail('PUBLICATION_INVALID', 'Delivery endpoint must be same-origin POST.');
|
|
11
|
-
}
|
|
12
|
-
const authentication = record(value.authentication, 'PUBLICATION_INVALID', 'Delivery authentication is invalid.');
|
|
13
|
-
exact(authentication, ['kind'], 'PUBLICATION_INVALID');
|
|
14
|
-
if (authentication.kind !== 'public' && authentication.kind !== 'bearer') {
|
|
15
|
-
fail('PUBLICATION_INVALID', 'Delivery authentication kind is invalid.');
|
|
16
|
-
}
|
|
17
|
-
return Object.freeze({
|
|
18
|
-
href,
|
|
19
|
-
method: 'POST',
|
|
20
|
-
authentication: Object.freeze({ kind: authentication.kind }),
|
|
21
|
-
});
|
|
22
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type PublicationErrorCode = 'PUBLICATION_INVALID' | 'PUBLICATION_ETAG_MISMATCH' | 'PUBLICATION_BINDING_INVALID' | 'PUBLICATION_ROUTE_INVALID' | 'PUBLICATION_VIEW_INVALID';
|
|
2
|
-
export declare class PublicationError extends Error {
|
|
3
|
-
readonly code: PublicationErrorCode;
|
|
4
|
-
readonly name = "PublicationError";
|
|
5
|
-
constructor(code: PublicationErrorCode, message: string, options?: ErrorOptions);
|
|
6
|
-
}
|
|
7
|
-
export declare function fail(code: PublicationErrorCode, message: string, cause?: unknown): never;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export class PublicationError extends Error {
|
|
2
|
-
code;
|
|
3
|
-
name = 'PublicationError';
|
|
4
|
-
constructor(code, message, options) {
|
|
5
|
-
super(message, options);
|
|
6
|
-
this.code = code;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
export function fail(code, message, cause) {
|
|
10
|
-
throw new PublicationError(code, message, cause === undefined ? undefined : { cause });
|
|
11
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Content } from './content.js';
|
|
2
|
-
export type Sha256Digest = `sha256:${string}`;
|
|
3
|
-
export type Etag = Sha256Digest;
|
|
4
|
-
export declare function admitDigest(input: unknown): Sha256Digest;
|
|
5
|
-
export declare function computeEtag(input: Content): Etag;
|
|
6
|
-
export declare function sha256Hex(input: Uint8Array): string;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export { MEDIA_TYPE, LEGACY_MEDIA_TYPE, mediaType, PATH, url, seal, accept, encode, type Publication, } from './publication.js';
|
|
2
|
-
export { acceptBundle, decodeBundle } from './bundle-admission.js';
|
|
3
|
-
export { BUNDLE_MEDIA_TYPE, bundleUrl, describeBundle, type BundleDescriptor } from './bundle.js';
|
|
4
|
-
export { verifyBundleBytes } from './bundle-evidence.js';
|
|
5
|
-
export type { Content } from './content.js';
|
|
6
|
-
export type { Declaration, DeliveryDeclaration } from './declaration.js';
|
|
7
|
-
export { placeDelivery } from './delivery-declaration.js';
|
|
8
|
-
export type { Etag, Sha256Digest } from './etag.js';
|
|
9
|
-
export { PublicationError, type PublicationErrorCode } from './error.js';
|
|
10
|
-
export * as delivery from './delivery/index.js';
|
|
11
|
-
export type { Authentication as DeliveryAuthentication, Endpoint as DeliveryEndpoint, } from './delivery-endpoint.js';
|
|
12
|
-
export type { Manifest } from './manifest.js';
|
|
13
|
-
export { ClassOperationOrder, admitRequirements, validateRequirements, type CapabilityAuthorityRequirements, type CoreCapabilityRequirement, type CapabilityRequirements, type ClassCapabilityRequirement, type ClassOperation, type NonEmpty, type PublicationRequirements, } from './requirements.js';
|
|
14
|
-
export { acceptReference, compareReference, compareReferences, matchesReference, reference, type PublicationRef, type PublicationReferenceRelation, } from './reference.js';
|
|
15
|
-
export type { BodyPick, CredentialSource, HttpMethod, HttpRoute, HttpRouteDeclaration, RouteBody, RouteHeaders, SingleCredentialSource, } from './route.js';
|
|
16
|
-
export type { Schema } from './schema.js';
|
|
17
|
-
export { acceptInvocationEndpoints, type CallableBinding, type IframeRequirements, type InvocationEndpoints, type ViewBinding, } from './bindings/index.js';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { PublicationRequirements } from './requirements.js';
|
|
2
|
-
/** Read the retired v2 wire coordinate without exposing it in canonical requirements. */
|
|
3
|
-
export declare function decodeLegacyRequirements(input: unknown): PublicationRequirements;
|
|
4
|
-
/** Preserve immutable v2 bytes and the historical installation-target digest vocabulary. */
|
|
5
|
-
export declare function encodeLegacyRequirements(input: PublicationRequirements): Readonly<{
|
|
6
|
-
capabilities: Readonly<{
|
|
7
|
-
functions?: import("./requirements.js").NonEmpty<import("@astrale-os/kernel-dsl/v1").Key.Callable>;
|
|
8
|
-
classes?: import("./requirements.js").NonEmpty<import("./requirements.js").ClassCapabilityRequirement>;
|
|
9
|
-
authority?: import("./requirements.js").CapabilityAuthorityRequirements;
|
|
10
|
-
profiles?: import("./requirements.js").NonEmpty<import("./requirements.js").CoreCapabilityRequirement> | undefined;
|
|
11
|
-
}>;
|
|
12
|
-
}>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { exact, record } from './content.js';
|
|
2
|
-
import { admitRequirements } from './requirements.js';
|
|
3
|
-
/** Read the retired v2 wire coordinate without exposing it in canonical requirements. */
|
|
4
|
-
export function decodeLegacyRequirements(input) {
|
|
5
|
-
const requirements = record(input, 'PUBLICATION_INVALID', 'Publication requirements are invalid.');
|
|
6
|
-
exact(requirements, ['capabilities'], 'PUBLICATION_INVALID');
|
|
7
|
-
const capabilities = record(requirements.capabilities, 'PUBLICATION_INVALID', 'Publication capability requirements are invalid.');
|
|
8
|
-
exact(capabilities, ['authority', 'classes', 'functions', 'profiles'], 'PUBLICATION_INVALID');
|
|
9
|
-
const { profiles, ...principal } = capabilities;
|
|
10
|
-
return admitRequirements({
|
|
11
|
-
capabilities: { ...principal, ...(profiles === undefined ? {} : { core: profiles }) },
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
/** Preserve immutable v2 bytes and the historical installation-target digest vocabulary. */
|
|
15
|
-
export function encodeLegacyRequirements(input) {
|
|
16
|
-
const { core, ...principal } = input.capabilities;
|
|
17
|
-
return Object.freeze({
|
|
18
|
-
capabilities: Object.freeze({
|
|
19
|
-
...principal,
|
|
20
|
-
...(core === undefined ? {} : { profiles: core }),
|
|
21
|
-
}),
|
|
22
|
-
});
|
|
23
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
-
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
3
|
-
import type { CallableBinding, ViewBinding } from './bindings/index.js';
|
|
4
|
-
import type { Content } from './content.js';
|
|
5
|
-
import type { Endpoint as DeliveryEndpoint } from './delivery-endpoint.js';
|
|
6
|
-
import type { Etag } from './etag.js';
|
|
7
|
-
import type { Manifest } from './manifest.js';
|
|
8
|
-
import type { PublicationRequirements } from './requirements.js';
|
|
9
|
-
import type { HttpRoute } from './route.js';
|
|
10
|
-
import type { Schema } from './schema.js';
|
|
11
|
-
export declare const PATH: '/.well-known/astrale/domain.json';
|
|
12
|
-
export declare const MEDIA_TYPE: 'application/vnd.astrale.domain-publication+json;v=3';
|
|
13
|
-
export declare const LEGACY_MEDIA_TYPE: 'application/vnd.astrale.domain-publication+json;v=2';
|
|
14
|
-
export declare function mediaType(input: Pick<Publication, 'version'>): typeof MEDIA_TYPE | typeof LEGACY_MEDIA_TYPE;
|
|
15
|
-
/** Resolve the canonical Publication URL beneath one exact HTTP(S) serving issuer. */
|
|
16
|
-
export declare function url(input: string): string;
|
|
17
|
-
export interface Publication {
|
|
18
|
-
readonly format: 'astrale.domain.publication';
|
|
19
|
-
readonly version: 2 | 3;
|
|
20
|
-
readonly origin: Key.Origin;
|
|
21
|
-
readonly identity: {
|
|
22
|
-
readonly issuer: IssuerId;
|
|
23
|
-
readonly subject: string;
|
|
24
|
-
};
|
|
25
|
-
readonly etag: Etag;
|
|
26
|
-
readonly schema: Schema;
|
|
27
|
-
readonly requirements: PublicationRequirements;
|
|
28
|
-
readonly manifest?: Manifest;
|
|
29
|
-
readonly bindings: {
|
|
30
|
-
readonly callables: readonly CallableBinding[];
|
|
31
|
-
readonly views: readonly ViewBinding[];
|
|
32
|
-
};
|
|
33
|
-
readonly routes: readonly HttpRoute[];
|
|
34
|
-
readonly delivery?: DeliveryEndpoint;
|
|
35
|
-
}
|
|
36
|
-
export declare function seal(input: Content): Publication;
|
|
37
|
-
export declare function accept(input: unknown): Publication;
|
|
38
|
-
export declare function encode(input: Publication): Uint8Array;
|