@astrale-os/kernel-protocol 0.5.0-beta.52 → 0.5.0-beta.53
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.
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { type ViewHostRequirements } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
|
|
1
2
|
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
3
|
export interface ViewBinding {
|
|
3
4
|
readonly view: Key.View;
|
|
4
5
|
readonly href: string;
|
|
5
6
|
readonly handshake: 'shell' | 'none';
|
|
6
7
|
readonly iframe?: IframeRequirements;
|
|
8
|
+
readonly host?: ViewHostRequirements;
|
|
7
9
|
}
|
|
8
10
|
export interface IframeRequirements {
|
|
9
11
|
readonly sandbox?: readonly string[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { acceptViewHostRequirements, } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
|
|
1
2
|
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
3
|
import { absoluteHttpUrl, exact, record } from '../content.js';
|
|
3
4
|
import { fail } from '../error.js';
|
|
@@ -11,7 +12,7 @@ export function canonicalizeViewBinding(input, origin) {
|
|
|
11
12
|
}
|
|
12
13
|
function readViewBinding(input, origin, canonicalize) {
|
|
13
14
|
const value = record(input, 'PUBLICATION_VIEW_INVALID', 'Published View binding is invalid.');
|
|
14
|
-
exact(value, ['view', 'href', 'handshake', 'iframe'], 'PUBLICATION_VIEW_INVALID');
|
|
15
|
+
exact(value, ['view', 'href', 'handshake', 'iframe', 'host'], 'PUBLICATION_VIEW_INVALID');
|
|
15
16
|
let view;
|
|
16
17
|
try {
|
|
17
18
|
view = Key(String(value.view));
|
|
@@ -29,11 +30,21 @@ function readViewBinding(input, origin, canonicalize) {
|
|
|
29
30
|
fail('PUBLICATION_VIEW_INVALID', 'View handshake is invalid.');
|
|
30
31
|
}
|
|
31
32
|
const iframe = admitIframeRequirements(dataValue(value, 'iframe'), value.handshake, canonicalize);
|
|
33
|
+
let host;
|
|
34
|
+
try {
|
|
35
|
+
host = acceptViewHostRequirements(dataValue(value, 'host'), value.handshake, canonicalize);
|
|
36
|
+
}
|
|
37
|
+
catch (cause) {
|
|
38
|
+
if (cause instanceof TypeError)
|
|
39
|
+
return fail('PUBLICATION_VIEW_INVALID', 'View host requirements are invalid.', cause);
|
|
40
|
+
throw cause;
|
|
41
|
+
}
|
|
32
42
|
return Object.freeze({
|
|
33
43
|
view,
|
|
34
44
|
href: absoluteHttpUrl(value.href, true, 'PUBLICATION_VIEW_INVALID'),
|
|
35
45
|
handshake: value.handshake,
|
|
36
46
|
...(iframe === undefined ? {} : { iframe }),
|
|
47
|
+
...(host === undefined ? {} : { host }),
|
|
37
48
|
});
|
|
38
49
|
}
|
|
39
50
|
function admitIframeRequirements(input, handshake, canonicalize) {
|
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.53",
|
|
4
4
|
"description": "Portable Astrale invocation, publication, installation, routing, and issuer protocols",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"access": "public"
|
|
138
138
|
},
|
|
139
139
|
"dependencies": {
|
|
140
|
-
"@astrale-os/kernel-core": "0.9.0-beta.
|
|
140
|
+
"@astrale-os/kernel-core": "0.9.0-beta.47",
|
|
141
141
|
"@astrale-os/kernel-dsl": "0.2.0-beta.33",
|
|
142
142
|
"@noble/hashes": "2.3.0"
|
|
143
143
|
},
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"scripts": {
|
|
159
159
|
"build": "tsc",
|
|
160
160
|
"clean": "rm -rf dist",
|
|
161
|
-
"typecheck": "tsc --noEmit",
|
|
161
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.workers.json",
|
|
162
162
|
"test": "vitest run",
|
|
163
163
|
"test:file": "vitest run",
|
|
164
164
|
"test:watch": "vitest"
|