@astrale-os/kernel-protocol 0.5.0-beta.9 → 0.5.0
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/artifact/index.d.ts +1 -1
- package/dist/artifact/index.js +1 -1
- package/dist/artifact/ref.d.ts +2 -0
- package/dist/artifact/ref.js +4 -3
- 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/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/errors/retry.d.ts +25 -0
- package/dist/errors/retry.js +46 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/invocation/admission.d.ts +2 -2
- package/dist/invocation/admission.js +5 -5
- package/dist/invocation/binary.d.ts +1 -0
- package/dist/invocation/binary.js +21 -4
- package/dist/invocation/binding-codecs.d.ts +3 -2
- package/dist/invocation/binding-codecs.js +1 -6
- package/dist/invocation/delegate.d.ts +0 -20
- package/dist/invocation/delegate.js +2 -34
- package/dist/invocation/http/binary.d.ts +3 -1
- package/dist/invocation/http/binary.js +6 -1
- package/dist/invocation/http/index.d.ts +2 -1
- package/dist/invocation/http/index.js +2 -1
- package/dist/invocation/http/negotiation.js +3 -10
- package/dist/invocation/http/request.d.ts +11 -0
- package/dist/invocation/http/request.js +69 -0
- package/dist/invocation/index.d.ts +5 -4
- package/dist/invocation/index.js +4 -3
- package/dist/invocation/maintenance.d.ts +14 -0
- package/dist/invocation/maintenance.js +18 -0
- package/dist/invocation/redirect.d.ts +10 -12
- package/dist/invocation/redirect.js +10 -22
- package/dist/invocation/request.d.ts +3 -0
- package/dist/invocation/request.js +9 -2
- package/dist/invocation/response.d.ts +6 -1
- package/dist/invocation/response.js +26 -15
- package/dist/invocation/routing.d.ts +14 -4
- package/dist/invocation/routing.js +35 -20
- package/dist/invocation/schema.d.ts +6 -4
- package/dist/invocation/schema.js +5 -11
- package/dist/invocation/service-reason.d.ts +20 -15
- package/dist/invocation/service-reason.js +27 -19
- package/dist/invocation/stale-route.d.ts +3 -3
- package/dist/invocation/target.d.ts +5 -2
- package/dist/invocation/target.js +25 -3
- package/dist/invocation/websocket/binary.js +1 -0
- 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/release/bindings/view.d.ts +11 -0
- package/dist/release/bindings/view.js +54 -0
- 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 +15 -20
- 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 +5 -2
- package/dist/{publication → release}/bundle.js +13 -7
- package/dist/{publication → release}/delivery/attestation.d.ts +1 -0
- package/dist/{publication → release}/delivery/claims.d.ts +7 -2
- package/dist/{publication → release}/delivery/claims.js +20 -13
- package/dist/release/delivery/delivery.d.ts +11 -0
- package/dist/{publication → release}/delivery/delivery.js +7 -12
- 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 +5 -1
- package/dist/{publication → release}/delivery/index.js +4 -0
- package/dist/{publication → release}/delivery/limits.d.ts +2 -1
- package/dist/release/delivery/limits.js +5 -0
- package/dist/{publication → release}/delivery/request.d.ts +10 -9
- package/dist/{publication → release}/delivery/request.js +9 -10
- 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 -6
- package/dist/release/error.d.ts +7 -0
- package/dist/release/error.js +11 -0
- package/dist/release/index.d.ts +17 -0
- package/dist/release/index.js +10 -0
- package/dist/release/issuer.d.ts +5 -0
- package/dist/release/issuer.js +34 -0
- package/dist/release/manifest.d.ts +6 -0
- package/dist/release/manifest.js +22 -0
- 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 +125 -0
- package/dist/release/requirements.d.ts +41 -0
- package/dist/release/requirements.js +306 -0
- package/dist/{publication → release}/route.js +24 -24
- package/dist/{publication → release}/schema.js +4 -4
- package/dist/release/served.d.ts +27 -0
- package/dist/release/served.js +56 -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 +11 -21
- package/dist/routes/compiler.d.ts +2 -2
- package/dist/routes/compiler.js +7 -3
- package/dist/routes/credential.d.ts +12 -2
- package/dist/routes/credential.js +9 -4
- package/dist/routes/decode.d.ts +5 -2
- package/dist/routes/decode.js +24 -17
- package/dist/routes/deployment-retired.d.ts +30 -0
- package/dist/routes/deployment-retired.js +96 -0
- package/dist/routes/encode.js +12 -5
- 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 -33
- package/dist/routes/header.d.ts +9 -0
- package/dist/routes/header.js +34 -0
- package/dist/routes/index.d.ts +2 -2
- package/dist/routes/index.js +2 -2
- 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 -1
- package/dist/routes/reservation.d.ts +4 -2
- package/dist/routes/reservation.js +14 -8
- package/dist/routes/routing.d.ts +18 -6
- package/dist/routes/routing.js +28 -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/routes/template.d.ts +0 -1
- package/dist/routes/template.js +0 -3
- package/dist/runtime/artifact.d.ts +5 -4
- package/dist/runtime/artifact.js +7 -4
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/schema/installation/codec.d.ts +9 -0
- package/dist/schema/installation/codec.js +82 -0
- package/dist/schema/installation/index.d.ts +2 -0
- package/dist/schema/installation/index.js +1 -0
- package/dist/schema/installation/introspection/codec.d.ts +5 -2
- package/dist/schema/installation/introspection/codec.js +319 -193
- package/dist/schema/installation/introspection/index.d.ts +2 -2
- package/dist/schema/installation/introspection/index.js +1 -1
- package/dist/schema/installation/introspection/result.d.ts +84 -25
- package/dist/schema/installation/result.d.ts +15 -0
- package/dist/schema/installation/result.js +1 -0
- package/package.json +21 -75
- package/dist/codecs/msgpack.d.ts +0 -4
- package/dist/codecs/msgpack.js +0 -50
- package/dist/publication/bindings/invocation.js +0 -13
- package/dist/publication/bindings/view.d.ts +0 -7
- package/dist/publication/bindings/view.js +0 -28
- 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-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/index.js +0 -10
- package/dist/publication/manifest.d.ts +0 -6
- package/dist/publication/manifest.js +0 -30
- package/dist/publication/publication.d.ts +0 -36
- package/dist/publication/publication.js +0 -133
- package/dist/publication/reference.d.ts +0 -17
- package/dist/publication/reference.js +0 -68
- package/dist/publication/requirements.d.ts +0 -26
- package/dist/publication/requirements.js +0 -180
- 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}/route.d.ts +0 -0
- /package/dist/{publication → release}/schema.d.ts +0 -0
- /package/dist/{publication/content.js → release/shape.js} +0 -0
|
@@ -1,33 +1,92 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
1
2
|
import type { introspection } from '@astrale-os/kernel-core/schema';
|
|
2
|
-
import type { bundle } from '@astrale-os/kernel-dsl/v1';
|
|
3
|
-
import type {
|
|
4
|
-
import type { Publication } from '../../../publication/index.js';
|
|
5
|
-
import type { PublicationRequirements } from '../../../publication/index.js';
|
|
3
|
+
import type { bundle, Key, Revision } from '@astrale-os/kernel-dsl/v1';
|
|
4
|
+
import type { BuildDigest, ReleaseDigest, ReleaseRef, DomainRelease, Requirements } from '../../../release/index.js';
|
|
6
5
|
export type Digest = `sha256:${string}`;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
readonly
|
|
10
|
-
|
|
11
|
-
readonly
|
|
12
|
-
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
readonly kind: 'remote';
|
|
16
|
-
readonly publication: Publication;
|
|
17
|
-
};
|
|
18
|
-
export interface Installation {
|
|
19
|
-
readonly state: 'installed' | 'ready' | 'removing';
|
|
20
|
-
readonly target: Digest;
|
|
21
|
-
readonly source: Source;
|
|
22
|
-
readonly bundle: bundle.Bundle;
|
|
23
|
-
readonly readiness: Digest | null;
|
|
6
|
+
/** Lightweight proof of one exact ready installed Domain generation. */
|
|
7
|
+
export interface DomainInfo {
|
|
8
|
+
readonly origin: Key.Origin;
|
|
9
|
+
readonly revision: Revision;
|
|
10
|
+
readonly generation: Digest;
|
|
11
|
+
/** Exact reference of the ready pinned release, or null for a local Domain. */
|
|
12
|
+
readonly release: ReleaseRef | null;
|
|
13
|
+
readonly readiness: Digest;
|
|
24
14
|
readonly capabilities: {
|
|
25
|
-
readonly requested:
|
|
26
|
-
readonly materialized:
|
|
15
|
+
readonly requested: Requirements['capabilities'];
|
|
16
|
+
readonly materialized: Requirements['capabilities'];
|
|
27
17
|
};
|
|
18
|
+
readonly bindings: DomainRelease['bindings'];
|
|
19
|
+
}
|
|
20
|
+
/** Explicit complete Bundle observed coherently with its ready Domain generation. */
|
|
21
|
+
export interface DomainBundle {
|
|
22
|
+
readonly domain: DomainInfo;
|
|
23
|
+
readonly bundle: bundle.Bundle;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* How one ready Domain generation binds one dependency of its exact closure: `exact` when the
|
|
27
|
+
* pinned revision is the one the Kernel serves, `retained` when the Kernel serves another revision
|
|
28
|
+
* and keeps the pinned one as inactive context admitted by unchanged meaning.
|
|
29
|
+
*/
|
|
30
|
+
export interface DependencyBinding {
|
|
31
|
+
readonly origin: Key.Origin;
|
|
32
|
+
readonly pinned: Revision;
|
|
33
|
+
readonly active: Revision;
|
|
34
|
+
readonly binding: 'exact' | 'retained';
|
|
35
|
+
}
|
|
36
|
+
/** The origin-ordered dependency bindings observed coherently with a ready Domain generation. */
|
|
37
|
+
export interface DomainDependencies {
|
|
38
|
+
readonly domain: DomainInfo;
|
|
39
|
+
readonly dependencies: readonly DependencyBinding[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* What one installation pins: a DomainRelease v4 pin, its release digest beside the build digest
|
|
43
|
+
* it runs, or, for a local install, the digest of the stored artifact its source named.
|
|
44
|
+
*/
|
|
45
|
+
export type InstalledPin = {
|
|
46
|
+
readonly kind: 'release';
|
|
47
|
+
readonly release: ReleaseDigest;
|
|
48
|
+
readonly build: BuildDigest;
|
|
49
|
+
} | {
|
|
50
|
+
readonly kind: 'artifact';
|
|
51
|
+
readonly artifact: Digest;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The issuer of a release one installation replaced, as the Kernel records it: accepted while its
|
|
55
|
+
* work drains, and listed until a later consented install re-pins or prunes it, drained or not.
|
|
56
|
+
*/
|
|
57
|
+
export interface InFlightIssuer {
|
|
58
|
+
readonly issuer: IssuerId;
|
|
59
|
+
/** Pinned document digest of the replaced release. */
|
|
60
|
+
readonly release: Digest;
|
|
61
|
+
/** UTC millisecond ISO 8601 instant of the activation commit that replaced it. */
|
|
62
|
+
readonly replacedAt: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* One ready installation the Kernel pins to a deployment or to a stored artifact, as its caller can
|
|
66
|
+
* read it.
|
|
67
|
+
*/
|
|
68
|
+
export interface InstalledRelease {
|
|
69
|
+
readonly origin: Key.Origin;
|
|
70
|
+
readonly revision: Revision;
|
|
71
|
+
/** Issuer of the installation's Domain principal. */
|
|
72
|
+
readonly issuer: IssuerId;
|
|
73
|
+
/**
|
|
74
|
+
* The deployment URL, an HTTP(S) origin, the Kernel discovered the pinned document at: present
|
|
75
|
+
* exactly for a `release` pin, since an `artifact` pin names no deployment.
|
|
76
|
+
*/
|
|
77
|
+
readonly url?: string;
|
|
78
|
+
readonly pin: InstalledPin;
|
|
79
|
+
/** Issuer-ordered, distinct, never the current issuer. */
|
|
80
|
+
readonly inFlight: readonly InFlightIssuer[];
|
|
28
81
|
}
|
|
29
|
-
export type ResultFor<Input extends introspection.Introspection> =
|
|
82
|
+
export type ResultFor<Input extends introspection.Introspection> = Input extends {
|
|
83
|
+
readonly kind: 'installed';
|
|
84
|
+
} ? readonly InstalledRelease[] : Input extends {
|
|
85
|
+
readonly kind: 'bundle';
|
|
86
|
+
} ? DomainBundle : Input extends {
|
|
87
|
+
readonly kind: 'dependencies';
|
|
88
|
+
} ? DomainDependencies : DomainInfo;
|
|
30
89
|
export interface Limits {
|
|
31
|
-
readonly
|
|
90
|
+
readonly maximumReleaseBytes: number;
|
|
32
91
|
readonly maximumBundleBytes: number;
|
|
33
92
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InstallReceipt } from '@astrale-os/kernel-core/schema/kernel/syscalls/contracts';
|
|
2
|
+
import type { Key, Revision } from '@astrale-os/kernel-dsl/v1';
|
|
3
|
+
/** One exact installed Domain generation: what an install that changes nothing reports. */
|
|
4
|
+
export interface InstalledGeneration {
|
|
5
|
+
readonly origin: Key.Origin;
|
|
6
|
+
readonly revision: Revision;
|
|
7
|
+
readonly generation: `sha256:${string}`;
|
|
8
|
+
}
|
|
9
|
+
export type InstallResult = {
|
|
10
|
+
readonly changed: true;
|
|
11
|
+
readonly receipt: InstallReceipt;
|
|
12
|
+
} | {
|
|
13
|
+
readonly changed: false;
|
|
14
|
+
readonly domains: readonly [InstalledGeneration, ...InstalledGeneration[]];
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-protocol",
|
|
3
|
-
"version": "0.5.0
|
|
4
|
-
"description": "Portable Astrale invocation,
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Portable Astrale invocation, Release, installation, routing, and issuer protocols",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -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,49 +51,25 @@
|
|
|
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"
|
|
53
61
|
},
|
|
54
|
-
"./invocation/service-reason": {
|
|
55
|
-
"types": "./dist/invocation/service-reason.d.ts",
|
|
56
|
-
"import": "./dist/invocation/service-reason.js"
|
|
57
|
-
},
|
|
58
62
|
"./artifact": {
|
|
59
63
|
"types": "./dist/artifact/index.d.ts",
|
|
60
64
|
"import": "./dist/artifact/index.js"
|
|
61
65
|
},
|
|
62
|
-
"./
|
|
63
|
-
"types": "./dist/
|
|
64
|
-
"import": "./dist/
|
|
65
|
-
},
|
|
66
|
-
"./publication/publication": {
|
|
67
|
-
"types": "./dist/publication/publication.d.ts",
|
|
68
|
-
"import": "./dist/publication/publication.js"
|
|
69
|
-
},
|
|
70
|
-
"./publication/reference": {
|
|
71
|
-
"types": "./dist/publication/reference.d.ts",
|
|
72
|
-
"import": "./dist/publication/reference.js"
|
|
73
|
-
},
|
|
74
|
-
"./publication/requirements": {
|
|
75
|
-
"types": "./dist/publication/requirements.d.ts",
|
|
76
|
-
"import": "./dist/publication/requirements.js"
|
|
77
|
-
},
|
|
78
|
-
"./publication/delivery": {
|
|
79
|
-
"types": "./dist/publication/delivery/index.d.ts",
|
|
80
|
-
"import": "./dist/publication/delivery/index.js"
|
|
81
|
-
},
|
|
82
|
-
"./publication/bundle": {
|
|
83
|
-
"types": "./dist/publication/bundle.d.ts",
|
|
84
|
-
"import": "./dist/publication/bundle.js"
|
|
85
|
-
},
|
|
86
|
-
"./publication/bundle-evidence": {
|
|
87
|
-
"types": "./dist/publication/bundle-evidence.d.ts",
|
|
88
|
-
"import": "./dist/publication/bundle-evidence.js"
|
|
66
|
+
"./release": {
|
|
67
|
+
"types": "./dist/release/index.d.ts",
|
|
68
|
+
"import": "./dist/release/index.js"
|
|
89
69
|
},
|
|
90
|
-
"./
|
|
91
|
-
"types": "./dist/
|
|
92
|
-
"import": "./dist/
|
|
70
|
+
"./release/delivery": {
|
|
71
|
+
"types": "./dist/release/delivery/index.d.ts",
|
|
72
|
+
"import": "./dist/release/delivery/index.js"
|
|
93
73
|
},
|
|
94
74
|
"./routes": {
|
|
95
75
|
"types": "./dist/routes/index.d.ts",
|
|
@@ -99,30 +79,6 @@
|
|
|
99
79
|
"types": "./dist/schema/index.d.ts",
|
|
100
80
|
"import": "./dist/schema/index.js"
|
|
101
81
|
},
|
|
102
|
-
"./routes/admission": {
|
|
103
|
-
"types": "./dist/routes/admission.d.ts",
|
|
104
|
-
"import": "./dist/routes/admission.js"
|
|
105
|
-
},
|
|
106
|
-
"./routes/binding": {
|
|
107
|
-
"types": "./dist/routes/binding.d.ts",
|
|
108
|
-
"import": "./dist/routes/binding.js"
|
|
109
|
-
},
|
|
110
|
-
"./routes/evidence": {
|
|
111
|
-
"types": "./dist/routes/evidence.d.ts",
|
|
112
|
-
"import": "./dist/routes/evidence.js"
|
|
113
|
-
},
|
|
114
|
-
"./routes/placement": {
|
|
115
|
-
"types": "./dist/routes/placement.d.ts",
|
|
116
|
-
"import": "./dist/routes/placement.js"
|
|
117
|
-
},
|
|
118
|
-
"./routes/release-unavailable": {
|
|
119
|
-
"types": "./dist/routes/release-unavailable.d.ts",
|
|
120
|
-
"import": "./dist/routes/release-unavailable.js"
|
|
121
|
-
},
|
|
122
|
-
"./routes/routing": {
|
|
123
|
-
"types": "./dist/routes/routing.d.ts",
|
|
124
|
-
"import": "./dist/routes/routing.js"
|
|
125
|
-
},
|
|
126
82
|
"./runtime": {
|
|
127
83
|
"types": "./dist/runtime/index.d.ts",
|
|
128
84
|
"import": "./dist/runtime/index.js"
|
|
@@ -133,31 +89,21 @@
|
|
|
133
89
|
"access": "public"
|
|
134
90
|
},
|
|
135
91
|
"dependencies": {
|
|
136
|
-
"@astrale-os/kernel-core": "
|
|
137
|
-
"@astrale-os/kernel-dsl": "
|
|
92
|
+
"@astrale-os/kernel-core": "0.9.0",
|
|
93
|
+
"@astrale-os/kernel-dsl": "0.2.0",
|
|
138
94
|
"@noble/hashes": "2.3.0"
|
|
139
95
|
},
|
|
140
96
|
"devDependencies": {
|
|
141
97
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
142
|
-
"msgpackr": "^2.0.5",
|
|
143
98
|
"typescript": "7.0.2",
|
|
144
|
-
"vitest": "^
|
|
145
|
-
},
|
|
146
|
-
"peerDependencies": {
|
|
147
|
-
"msgpackr": "^2.0.5"
|
|
148
|
-
},
|
|
149
|
-
"peerDependenciesMeta": {
|
|
150
|
-
"msgpackr": {
|
|
151
|
-
"optional": true
|
|
152
|
-
}
|
|
99
|
+
"vitest": "^5.0.1"
|
|
153
100
|
},
|
|
154
101
|
"scripts": {
|
|
155
102
|
"build": "tsc",
|
|
156
103
|
"clean": "rm -rf dist",
|
|
157
|
-
"typecheck": "tsc --noEmit",
|
|
104
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.workers.json",
|
|
158
105
|
"test": "vitest run",
|
|
159
106
|
"test:file": "vitest run",
|
|
160
|
-
"test:watch": "vitest"
|
|
161
|
-
"preinstall": "node -e \"try{require('./.check-workspace.cjs')}catch{}\""
|
|
107
|
+
"test:watch": "vitest"
|
|
162
108
|
}
|
|
163
109
|
}
|
package/dist/codecs/msgpack.d.ts
DELETED
package/dist/codecs/msgpack.js
DELETED
|
@@ -1,50 +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
|
-
const [packing, unpacking] = await Promise.all([
|
|
8
|
-
import('msgpackr/pack'),
|
|
9
|
-
import('msgpackr/unpack'),
|
|
10
|
-
]);
|
|
11
|
-
library = Object.freeze({ pack: packing.pack, unpack: unpacking.unpack });
|
|
12
|
-
}
|
|
13
|
-
return MSGPACK;
|
|
14
|
-
}
|
|
15
|
-
const MSGPACK = Object.freeze({
|
|
16
|
-
name: 'msgpack',
|
|
17
|
-
contentType: CONTENT_TYPE_MSGPACK,
|
|
18
|
-
binary: true,
|
|
19
|
-
encode(data) {
|
|
20
|
-
if (library === null)
|
|
21
|
-
throw new Error('MsgPack codec is not loaded');
|
|
22
|
-
return new Uint8Array(library.pack(acceptValue(data)));
|
|
23
|
-
},
|
|
24
|
-
decode(input) {
|
|
25
|
-
if (library === null)
|
|
26
|
-
throw new Error('MsgPack codec is not loaded');
|
|
27
|
-
if (typeof input === 'string')
|
|
28
|
-
throw new TypeError('MsgPack requires a binary envelope');
|
|
29
|
-
let decoded;
|
|
30
|
-
try {
|
|
31
|
-
decoded = library.unpack(input);
|
|
32
|
-
}
|
|
33
|
-
catch (cause) {
|
|
34
|
-
throw new DecodeError('MsgPack envelope is malformed.', { cause });
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
return acceptValue(decoded);
|
|
38
|
-
}
|
|
39
|
-
catch (cause) {
|
|
40
|
-
if (cause instanceof BoundaryError) {
|
|
41
|
-
throw new DecodeError('MsgPack envelope is not a portable value.', { cause });
|
|
42
|
-
}
|
|
43
|
-
throw cause;
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
/** Package-private canonical identity check used by Protocol binding selection. */
|
|
48
|
-
export function isMsgpackCodec(input) {
|
|
49
|
-
return input === MSGPACK;
|
|
50
|
-
}
|
|
@@ -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,7 +0,0 @@
|
|
|
1
|
-
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
|
-
export interface ViewBinding {
|
|
3
|
-
readonly view: Key.View;
|
|
4
|
-
readonly href: string;
|
|
5
|
-
readonly handshake: 'shell' | 'none';
|
|
6
|
-
}
|
|
7
|
-
export declare function admitViewBinding(input: unknown, origin: string): ViewBinding;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
|
-
import { absoluteHttpUrl, exact, record } from '../content.js';
|
|
3
|
-
import { fail } from '../error.js';
|
|
4
|
-
export function admitViewBinding(input, origin) {
|
|
5
|
-
const value = record(input, 'PUBLICATION_VIEW_INVALID', 'Published View binding is invalid.');
|
|
6
|
-
exact(value, ['view', 'href', 'handshake'], 'PUBLICATION_VIEW_INVALID');
|
|
7
|
-
let view;
|
|
8
|
-
try {
|
|
9
|
-
view = Key(String(value.view));
|
|
10
|
-
}
|
|
11
|
-
catch (cause) {
|
|
12
|
-
if (cause instanceof TypeError) {
|
|
13
|
-
return fail('PUBLICATION_VIEW_INVALID', 'View key is invalid.', cause);
|
|
14
|
-
}
|
|
15
|
-
throw cause;
|
|
16
|
-
}
|
|
17
|
-
if (Key.origin(view) !== origin || !view.slice(view.indexOf(':') + 1).startsWith('view.')) {
|
|
18
|
-
fail('PUBLICATION_VIEW_INVALID', 'View binding must name a root View.');
|
|
19
|
-
}
|
|
20
|
-
if (value.handshake !== 'shell' && value.handshake !== 'none') {
|
|
21
|
-
fail('PUBLICATION_VIEW_INVALID', 'View handshake is invalid.');
|
|
22
|
-
}
|
|
23
|
-
return Object.freeze({
|
|
24
|
-
view,
|
|
25
|
-
href: absoluteHttpUrl(value.href, true, 'PUBLICATION_VIEW_INVALID'),
|
|
26
|
-
handshake: value.handshake,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
@@ -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,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, PATH, url, seal, accept, encode, type Publication } from './publication.js';
|
|
2
|
-
export { acceptBundle, decodeBundle } from './bundle-admission.js';
|
|
3
|
-
export { BUNDLE_MEDIA_TYPE, 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 CapabilityAdminRequirements, 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 InvocationEndpoints, type ViewBinding, } from './bindings/index.js';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { MEDIA_TYPE, PATH, url, seal, accept, encode } from './publication.js';
|
|
2
|
-
export { acceptBundle, decodeBundle } from './bundle-admission.js';
|
|
3
|
-
export { BUNDLE_MEDIA_TYPE, describeBundle } from './bundle.js';
|
|
4
|
-
export { verifyBundleBytes } from './bundle-evidence.js';
|
|
5
|
-
export { placeDelivery } from './delivery-declaration.js';
|
|
6
|
-
export { PublicationError } from './error.js';
|
|
7
|
-
export * as delivery from './delivery/index.js';
|
|
8
|
-
export { ClassOperationOrder, admitRequirements, validateRequirements, } from './requirements.js';
|
|
9
|
-
export { acceptReference, compareReference, compareReferences, matchesReference, reference, } from './reference.js';
|
|
10
|
-
export { acceptInvocationEndpoints, } from './bindings/index.js';
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { acceptDefinitionRef } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
|
-
import { exact, record } from './content.js';
|
|
3
|
-
import { fail } from './error.js';
|
|
4
|
-
export function admitManifest(input) {
|
|
5
|
-
if (input === undefined)
|
|
6
|
-
return undefined;
|
|
7
|
-
const value = record(input, 'PUBLICATION_INVALID', 'Manifest is invalid.');
|
|
8
|
-
exact(value, ['logo', 'entrypoint'], 'PUBLICATION_INVALID');
|
|
9
|
-
if (value.logo !== undefined && typeof value.logo !== 'string') {
|
|
10
|
-
fail('PUBLICATION_INVALID', 'Manifest logo must be a string.');
|
|
11
|
-
}
|
|
12
|
-
let entrypoint;
|
|
13
|
-
if (value.entrypoint !== undefined) {
|
|
14
|
-
let ref;
|
|
15
|
-
try {
|
|
16
|
-
ref = acceptDefinitionRef(value.entrypoint);
|
|
17
|
-
}
|
|
18
|
-
catch (cause) {
|
|
19
|
-
return fail('PUBLICATION_INVALID', 'Manifest entrypoint must be a root View reference.', cause);
|
|
20
|
-
}
|
|
21
|
-
if (ref.kind !== 'view') {
|
|
22
|
-
fail('PUBLICATION_INVALID', 'Manifest entrypoint must be a root View reference.');
|
|
23
|
-
}
|
|
24
|
-
entrypoint = ref;
|
|
25
|
-
}
|
|
26
|
-
return Object.freeze({
|
|
27
|
-
...(value.logo === undefined ? {} : { logo: value.logo }),
|
|
28
|
-
...(entrypoint === undefined ? {} : { entrypoint }),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
@@ -1,36 +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=2';
|
|
13
|
-
/** Resolve the canonical Publication URL beneath one exact HTTP(S) serving issuer. */
|
|
14
|
-
export declare function url(input: string): string;
|
|
15
|
-
export interface Publication {
|
|
16
|
-
readonly format: 'astrale.domain.publication';
|
|
17
|
-
readonly version: 2;
|
|
18
|
-
readonly origin: Key.Origin;
|
|
19
|
-
readonly identity: {
|
|
20
|
-
readonly issuer: IssuerId;
|
|
21
|
-
readonly subject: string;
|
|
22
|
-
};
|
|
23
|
-
readonly etag: Etag;
|
|
24
|
-
readonly schema: Schema;
|
|
25
|
-
readonly requirements: PublicationRequirements;
|
|
26
|
-
readonly manifest?: Manifest;
|
|
27
|
-
readonly bindings: {
|
|
28
|
-
readonly callables: readonly CallableBinding[];
|
|
29
|
-
readonly views: readonly ViewBinding[];
|
|
30
|
-
};
|
|
31
|
-
readonly routes: readonly HttpRoute[];
|
|
32
|
-
readonly delivery?: DeliveryEndpoint;
|
|
33
|
-
}
|
|
34
|
-
export declare function seal(input: Content): Publication;
|
|
35
|
-
export declare function accept(input: unknown): Publication;
|
|
36
|
-
export declare function encode(input: Publication): Uint8Array;
|