@astrale-os/kernel-protocol 0.5.0-beta.67 → 0.5.0-beta.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codecs/index.d.ts +1 -2
- package/dist/codecs/index.js +1 -2
- package/dist/codecs/media-types.d.ts +0 -1
- package/dist/codecs/media-types.js +0 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/invocation/admission.d.ts +2 -2
- package/dist/invocation/admission.js +5 -5
- package/dist/invocation/binding-codecs.d.ts +1 -1
- package/dist/invocation/binding-codecs.js +1 -6
- package/dist/invocation/http/negotiation.js +3 -10
- package/dist/invocation/index.d.ts +5 -2
- package/dist/invocation/index.js +4 -2
- package/dist/invocation/legacy/index.d.ts +29 -0
- package/dist/invocation/legacy/index.js +28 -0
- package/dist/invocation/legacy/route.d.ts +14 -0
- package/dist/invocation/legacy/route.js +25 -0
- package/dist/invocation/legacy/via.d.ts +30 -0
- package/dist/invocation/legacy/via.js +15 -0
- package/dist/invocation/redirect.d.ts +15 -12
- package/dist/invocation/redirect.js +9 -21
- package/dist/invocation/request.js +2 -2
- package/dist/invocation/routing.d.ts +19 -5
- package/dist/invocation/routing.js +50 -20
- package/dist/invocation/schema.d.ts +3 -8
- package/dist/invocation/schema.js +3 -10
- package/dist/invocation/service-reason.d.ts +13 -13
- package/dist/invocation/service-reason.js +13 -12
- package/dist/invocation/stale-route.d.ts +1 -1
- package/dist/invocation/target.d.ts +3 -0
- package/dist/invocation/target.js +8 -1
- package/dist/invocation/websocket/index.d.ts +1 -1
- package/dist/invocation/websocket/index.js +1 -1
- package/dist/invocation/websocket/subprotocol.d.ts +1 -2
- package/dist/invocation/websocket/subprotocol.js +3 -4
- package/dist/issuer/index.d.ts +1 -0
- package/dist/issuer/index.js +1 -0
- package/dist/issuer/paths.d.ts +2 -0
- package/dist/issuer/paths.js +1 -0
- package/dist/issuer/workflow-engine.d.ts +18 -0
- package/dist/issuer/workflow-engine.js +59 -0
- package/dist/{publication → release}/bindings/callable.js +6 -6
- package/dist/release/bindings/invocation.js +13 -0
- package/dist/{publication → release}/bindings/view.d.ts +1 -1
- package/dist/{publication → release}/bindings/view.js +10 -10
- package/dist/release/build.d.ts +6 -0
- package/dist/release/build.js +7 -0
- package/dist/release/bundle-admission.d.ts +21 -0
- package/dist/{publication → release}/bundle-admission.js +18 -18
- package/dist/{publication → release}/bundle-descriptor.js +6 -6
- package/dist/release/bundle-evidence.d.ts +3 -0
- package/dist/release/bundle-evidence.js +13 -0
- package/dist/{publication → release}/bundle.d.ts +2 -2
- package/dist/{publication → release}/bundle.js +9 -9
- package/dist/{publication → release}/delivery/attestation.d.ts +1 -0
- package/dist/release/delivery/claims.d.ts +21 -0
- package/dist/release/delivery/claims.js +68 -0
- package/dist/release/delivery/delivery.d.ts +11 -0
- package/dist/release/delivery/delivery.js +24 -0
- package/dist/{publication → release}/delivery/error.d.ts +2 -0
- package/dist/{publication → release}/delivery/error.js +1 -0
- package/dist/{publication → release}/delivery/index.d.ts +6 -1
- package/dist/{publication → release}/delivery/index.js +5 -0
- package/dist/{publication → release}/delivery/limits.d.ts +2 -1
- package/dist/release/delivery/limits.js +5 -0
- package/dist/release/delivery/request.d.ts +21 -0
- package/dist/release/delivery/request.js +60 -0
- package/dist/{publication → release}/delivery-declaration.js +4 -4
- package/dist/release/delivery-endpoint.js +22 -0
- package/dist/release/digest.d.ts +13 -0
- package/dist/{publication/etag.js → release/digest.js} +1 -10
- package/dist/release/error.d.ts +7 -0
- package/dist/release/error.js +11 -0
- package/dist/release/index.d.ts +21 -0
- package/dist/release/index.js +14 -0
- package/dist/release/issuer.d.ts +5 -0
- package/dist/release/issuer.js +34 -0
- package/dist/release/legacy/bindings.d.ts +14 -0
- package/dist/release/legacy/bindings.js +11 -0
- package/dist/release/legacy/bundle-admission.d.ts +6 -0
- package/dist/release/legacy/bundle-admission.js +10 -0
- package/dist/release/legacy/bundle-evidence.d.ts +8 -0
- package/dist/release/legacy/bundle-evidence.js +11 -0
- package/dist/release/legacy/bundle.d.ts +24 -0
- package/dist/release/legacy/bundle.js +31 -0
- package/dist/release/legacy/delivery/attestation.d.ts +6 -0
- package/dist/release/legacy/delivery/attestation.js +1 -0
- package/dist/{publication → release/legacy}/delivery/claims.d.ts +9 -0
- package/dist/{publication → release/legacy}/delivery/claims.js +7 -2
- package/dist/release/legacy/delivery/delivery.d.ts +18 -0
- package/dist/{publication → release/legacy}/delivery/delivery.js +6 -2
- package/dist/release/legacy/delivery/error.d.ts +16 -0
- package/dist/release/legacy/delivery/error.js +6 -0
- package/dist/release/legacy/delivery/index.d.ts +13 -0
- package/dist/release/legacy/delivery/index.js +13 -0
- package/dist/release/legacy/delivery/limits.d.ts +21 -0
- package/dist/release/legacy/delivery/limits.js +22 -0
- package/dist/release/legacy/delivery/request.d.ts +26 -0
- package/dist/{publication → release/legacy}/delivery/request.js +8 -3
- package/dist/release/legacy/delivery-declaration.d.ts +9 -0
- package/dist/release/legacy/delivery-declaration.js +11 -0
- package/dist/release/legacy/error.d.ts +26 -0
- package/dist/release/legacy/error.js +114 -0
- package/dist/release/legacy/etag.d.ts +12 -0
- package/dist/release/legacy/etag.js +14 -0
- package/dist/release/legacy/index.d.ts +72 -0
- package/dist/{publication → release/legacy}/index.js +7 -2
- package/dist/release/legacy/profiles.d.ts +23 -0
- package/dist/release/legacy/profiles.js +36 -0
- package/dist/release/legacy/projection.d.ts +13 -0
- package/dist/release/legacy/projection.js +25 -0
- package/dist/release/legacy/publication.d.ts +90 -0
- package/dist/release/legacy/publication.js +124 -0
- package/dist/release/legacy/reference.d.ts +47 -0
- package/dist/{publication → release/legacy}/reference.js +27 -3
- package/dist/release/legacy/requirements.d.ts +30 -0
- package/dist/release/legacy/requirements.js +20 -0
- package/dist/{publication → release}/manifest.js +6 -6
- package/dist/release/reference.d.ts +26 -0
- package/dist/release/reference.js +70 -0
- package/dist/release/release.d.ts +60 -0
- package/dist/release/release.js +123 -0
- package/dist/{publication → release}/requirements.d.ts +11 -4
- package/dist/{publication → release}/requirements.js +58 -39
- package/dist/{publication → release}/route.js +24 -24
- package/dist/{publication → release}/schema.js +4 -4
- package/dist/release/served.d.ts +26 -0
- package/dist/release/served.js +65 -0
- package/dist/release/shape.d.ts +8 -0
- package/dist/routes/admission.d.ts +1 -1
- package/dist/routes/admission.js +7 -85
- package/dist/routes/binding.d.ts +3 -3
- package/dist/routes/binding.js +10 -19
- package/dist/routes/compiler.d.ts +2 -2
- package/dist/routes/compiler.js +3 -2
- package/dist/routes/credential.d.ts +1 -1
- package/dist/routes/decode.d.ts +5 -2
- package/dist/routes/decode.js +15 -4
- package/dist/routes/deployment-retired.d.ts +30 -0
- package/dist/routes/deployment-retired.js +96 -0
- package/dist/routes/encode.js +7 -6
- package/dist/routes/entries.d.ts +23 -0
- package/dist/routes/entries.js +150 -0
- package/dist/routes/evidence.d.ts +3 -3
- package/dist/routes/evidence.js +7 -34
- package/dist/routes/header.d.ts +9 -0
- package/dist/routes/header.js +34 -0
- package/dist/routes/index.d.ts +5 -2
- package/dist/routes/index.js +5 -2
- package/dist/routes/legacy/index.d.ts +29 -0
- package/dist/routes/legacy/index.js +29 -0
- package/dist/routes/legacy/routing.d.ts +24 -0
- package/dist/routes/legacy/routing.js +45 -0
- package/dist/routes/legacy/table.d.ts +34 -0
- package/dist/routes/legacy/table.js +50 -0
- package/dist/routes/mapping.d.ts +1 -1
- package/dist/routes/mapping.js +4 -4
- package/dist/routes/match.d.ts +1 -1
- package/dist/routes/placement.d.ts +2 -2
- package/dist/routes/plan.d.ts +1 -1
- package/dist/routes/request.d.ts +3 -3
- package/dist/routes/reservation.d.ts +4 -2
- package/dist/routes/reservation.js +4 -3
- package/dist/routes/routing.d.ts +30 -6
- package/dist/routes/routing.js +34 -49
- package/dist/routes/select.d.ts +1 -1
- package/dist/routes/table.d.ts +3 -2
- package/dist/routes/target.d.ts +5 -0
- package/dist/routes/target.js +16 -0
- package/dist/runtime/artifact.d.ts +2 -2
- package/dist/runtime/artifact.js +2 -2
- package/dist/schema/installation/codec.d.ts +6 -1
- package/dist/schema/installation/codec.js +10 -7
- package/dist/schema/installation/introspection/codec.d.ts +11 -2
- package/dist/schema/installation/introspection/codec.js +59 -41
- package/dist/schema/installation/introspection/result.d.ts +8 -1
- package/dist/schema/installation/legacy/index.d.ts +39 -0
- package/dist/schema/installation/legacy/index.js +39 -0
- package/dist/schema/installation/legacy/installation.d.ts +9 -0
- package/dist/schema/installation/legacy/installation.js +28 -0
- package/dist/schema/installation/legacy/introspection.d.ts +10 -0
- package/dist/schema/installation/legacy/introspection.js +70 -0
- package/dist/schema/installation/legacy/msgpack.d.ts +1 -0
- package/dist/schema/installation/legacy/msgpack.js +143 -0
- package/package.json +59 -36
- package/dist/codecs/msgpack.d.ts +0 -4
- package/dist/codecs/msgpack.js +0 -53
- package/dist/publication/bindings/invocation.js +0 -13
- package/dist/publication/bundle-admission.d.ts +0 -4
- package/dist/publication/bundle-evidence.d.ts +0 -3
- package/dist/publication/bundle-evidence.js +0 -13
- package/dist/publication/content.d.ts +0 -10
- package/dist/publication/delivery/delivery.d.ts +0 -9
- package/dist/publication/delivery/limits.js +0 -4
- package/dist/publication/delivery/request.d.ts +0 -15
- package/dist/publication/delivery-endpoint.js +0 -22
- package/dist/publication/error.d.ts +0 -7
- package/dist/publication/error.js +0 -11
- package/dist/publication/etag.d.ts +0 -6
- package/dist/publication/index.d.ts +0 -17
- package/dist/publication/legacy-requirements.d.ts +0 -12
- package/dist/publication/legacy-requirements.js +0 -23
- package/dist/publication/publication.d.ts +0 -38
- package/dist/publication/publication.js +0 -146
- package/dist/publication/reference.d.ts +0 -17
- package/dist/routes/release-unavailable.d.ts +0 -8
- package/dist/routes/release-unavailable.js +0 -32
- /package/dist/{publication → release}/bindings/callable.d.ts +0 -0
- /package/dist/{publication → release}/bindings/index.d.ts +0 -0
- /package/dist/{publication → release}/bindings/index.js +0 -0
- /package/dist/{publication → release}/bindings/invocation.d.ts +0 -0
- /package/dist/{publication → release}/bundle-descriptor.d.ts +0 -0
- /package/dist/{publication → release}/declaration.d.ts +0 -0
- /package/dist/{publication → release}/declaration.js +0 -0
- /package/dist/{publication → release}/delivery/attestation.js +0 -0
- /package/dist/{publication → release}/delivery-declaration.d.ts +0 -0
- /package/dist/{publication → release}/delivery-endpoint.d.ts +0 -0
- /package/dist/{publication → release}/manifest.d.ts +0 -0
- /package/dist/{publication → release}/route.d.ts +0 -0
- /package/dist/{publication → release}/schema.d.ts +0 -0
- /package/dist/{publication/content.js → release/shape.js} +0 -0
|
@@ -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;
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { AuthValueError } from '@astrale-os/kernel-core/auth/error';
|
|
2
|
-
import { accept as acceptIssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
3
|
-
import { Key, patterns } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
4
|
-
import * as portable from '@astrale-os/kernel-dsl/value';
|
|
5
|
-
import { admitCallableBinding, admitViewBinding } from './bindings/index.js';
|
|
6
|
-
import { canonicalizeViewBinding } from './bindings/view.js';
|
|
7
|
-
import { array, deepFreeze, exact, record, unique } from './content.js';
|
|
8
|
-
import { admitEndpoint as admitDeliveryEndpoint } from './delivery-endpoint.js';
|
|
9
|
-
import { fail } from './error.js';
|
|
10
|
-
import { admitDigest, computeEtag } from './etag.js';
|
|
11
|
-
import { decodeLegacyRequirements, encodeLegacyRequirements } from './legacy-requirements.js';
|
|
12
|
-
import { admitManifest } from './manifest.js';
|
|
13
|
-
import { admitRequirements } from './requirements.js';
|
|
14
|
-
import { admitRoute } from './route.js';
|
|
15
|
-
import { admitSchema } from './schema.js';
|
|
16
|
-
export const PATH = '/.well-known/astrale/domain.json';
|
|
17
|
-
export const MEDIA_TYPE = 'application/vnd.astrale.domain-publication+json;v=3';
|
|
18
|
-
export const LEGACY_MEDIA_TYPE = 'application/vnd.astrale.domain-publication+json;v=2';
|
|
19
|
-
export function mediaType(input) {
|
|
20
|
-
return input.version === 2 ? LEGACY_MEDIA_TYPE : MEDIA_TYPE;
|
|
21
|
-
}
|
|
22
|
-
/** Resolve the canonical Publication URL beneath one exact HTTP(S) serving issuer. */
|
|
23
|
-
export function url(input) {
|
|
24
|
-
const admitted = admitIssuer(input);
|
|
25
|
-
let value;
|
|
26
|
-
try {
|
|
27
|
-
value = new URL(admitted);
|
|
28
|
-
}
|
|
29
|
-
catch (cause) {
|
|
30
|
-
return fail('PUBLICATION_INVALID', 'Publication issuer is not an HTTP(S) URL.', cause);
|
|
31
|
-
}
|
|
32
|
-
if ((value.protocol !== 'https:' && value.protocol !== 'http:') ||
|
|
33
|
-
value.username !== '' ||
|
|
34
|
-
value.password !== '' ||
|
|
35
|
-
value.search !== '' ||
|
|
36
|
-
value.hash !== '') {
|
|
37
|
-
fail('PUBLICATION_INVALID', 'Publication issuer is not an HTTP(S) URL.');
|
|
38
|
-
}
|
|
39
|
-
return `${admitted.replace(/\/+$/u, '')}${PATH}`;
|
|
40
|
-
}
|
|
41
|
-
export function seal(input) {
|
|
42
|
-
const canonical = withoutEtag(acceptPublication({ ...input, etag: 'canonicalizing' }, 'seal'));
|
|
43
|
-
return acceptPublication({ ...canonical, etag: computeEtag(canonical) }, 'canonical');
|
|
44
|
-
}
|
|
45
|
-
export function accept(input) {
|
|
46
|
-
const publication = acceptPublication(input, 'wire');
|
|
47
|
-
if (publication.etag !== computeEtag(withoutEtag(publication))) {
|
|
48
|
-
fail('PUBLICATION_ETAG_MISMATCH', 'Publication ETag does not match its canonical content.');
|
|
49
|
-
}
|
|
50
|
-
return publication;
|
|
51
|
-
}
|
|
52
|
-
export function encode(input) {
|
|
53
|
-
const wire = input.version === 2
|
|
54
|
-
? { ...input, requirements: encodeLegacyRequirements(input.requirements) }
|
|
55
|
-
: input;
|
|
56
|
-
return portable.json.encode(wire);
|
|
57
|
-
}
|
|
58
|
-
function acceptPublication(input, mode) {
|
|
59
|
-
const value = record(input, 'PUBLICATION_INVALID', 'Expected a Publication object.');
|
|
60
|
-
exact(value, [
|
|
61
|
-
'format',
|
|
62
|
-
'version',
|
|
63
|
-
'origin',
|
|
64
|
-
'identity',
|
|
65
|
-
'etag',
|
|
66
|
-
'schema',
|
|
67
|
-
'requirements',
|
|
68
|
-
'manifest',
|
|
69
|
-
'bindings',
|
|
70
|
-
'routes',
|
|
71
|
-
'delivery',
|
|
72
|
-
], 'PUBLICATION_INVALID');
|
|
73
|
-
if (value.format !== 'astrale.domain.publication' ||
|
|
74
|
-
(value.version !== 2 && value.version !== 3)) {
|
|
75
|
-
fail('PUBLICATION_INVALID', 'Unsupported Publication format or version.');
|
|
76
|
-
}
|
|
77
|
-
if (typeof value.origin !== 'string' || !patterns.origin.test(value.origin)) {
|
|
78
|
-
fail('PUBLICATION_INVALID', 'Publication origin is invalid.');
|
|
79
|
-
}
|
|
80
|
-
const origin = value.origin;
|
|
81
|
-
const identity = record(value.identity, 'PUBLICATION_INVALID', 'Publication identity is invalid.');
|
|
82
|
-
exact(identity, ['issuer', 'subject'], 'PUBLICATION_INVALID');
|
|
83
|
-
const issuer = admitIssuer(identity.issuer);
|
|
84
|
-
if (identity.subject !== origin) {
|
|
85
|
-
fail('PUBLICATION_INVALID', 'Publication identity subject must equal its root origin.');
|
|
86
|
-
}
|
|
87
|
-
const publishedSchema = admitSchema(value.schema);
|
|
88
|
-
const requirements = value.version === 2 && mode === 'wire'
|
|
89
|
-
? decodeLegacyRequirements(value.requirements)
|
|
90
|
-
: admitRequirements(value.requirements);
|
|
91
|
-
const manifest = admitManifest(value.manifest);
|
|
92
|
-
const bindingSet = record(value.bindings, 'PUBLICATION_BINDING_INVALID', 'Publication bindings are invalid.');
|
|
93
|
-
exact(bindingSet, ['callables', 'views'], 'PUBLICATION_BINDING_INVALID');
|
|
94
|
-
const callables = array(bindingSet.callables, 'PUBLICATION_BINDING_INVALID').map((entry) => admitCallableBinding(entry, origin));
|
|
95
|
-
unique(callables.map(({ callable }) => callable), 'PUBLICATION_BINDING_INVALID', 'callable binding');
|
|
96
|
-
const views = array(bindingSet.views, 'PUBLICATION_VIEW_INVALID').map((entry) => mode === 'seal' ? canonicalizeViewBinding(entry, origin) : admitViewBinding(entry, origin));
|
|
97
|
-
unique(views.map(({ view }) => view), 'PUBLICATION_VIEW_INVALID', 'View binding');
|
|
98
|
-
const routes = array(value.routes, 'PUBLICATION_ROUTE_INVALID').map((entry) => admitRoute(entry, origin));
|
|
99
|
-
unique(routes.map(({ name }) => name), 'PUBLICATION_ROUTE_INVALID', 'route name');
|
|
100
|
-
for (const callable of new Set(routes.map(({ callable }) => callable))) {
|
|
101
|
-
if (routes.filter((route) => route.callable === callable && route.default === true).length > 1) {
|
|
102
|
-
fail('PUBLICATION_ROUTE_INVALID', `Callable ${callable} has more than one default route.`);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (manifest?.entrypoint !== undefined) {
|
|
106
|
-
if (manifest.entrypoint.origin !== origin) {
|
|
107
|
-
fail('PUBLICATION_VIEW_INVALID', 'Manifest entrypoint must belong to the root origin.');
|
|
108
|
-
}
|
|
109
|
-
const key = Key.of(manifest.entrypoint);
|
|
110
|
-
if (!views.some(({ view }) => view === key)) {
|
|
111
|
-
fail('PUBLICATION_VIEW_INVALID', 'Manifest entrypoint must have a published View binding.');
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
const delivery = admitDeliveryEndpoint(value.delivery, publishedSchema.bundle.href);
|
|
115
|
-
const admittedEtag = mode === 'wire' ? admitDigest(value.etag) : value.etag;
|
|
116
|
-
if (typeof admittedEtag !== 'string')
|
|
117
|
-
fail('PUBLICATION_INVALID', 'Publication ETag is missing.');
|
|
118
|
-
return deepFreeze({
|
|
119
|
-
format: 'astrale.domain.publication',
|
|
120
|
-
version: value.version,
|
|
121
|
-
origin,
|
|
122
|
-
identity: { issuer, subject: origin },
|
|
123
|
-
etag: admittedEtag,
|
|
124
|
-
schema: publishedSchema,
|
|
125
|
-
requirements,
|
|
126
|
-
...(manifest === undefined ? {} : { manifest }),
|
|
127
|
-
bindings: { callables, views },
|
|
128
|
-
routes,
|
|
129
|
-
...(delivery === undefined ? {} : { delivery }),
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
function admitIssuer(input) {
|
|
133
|
-
try {
|
|
134
|
-
return acceptIssuerId(String(input));
|
|
135
|
-
}
|
|
136
|
-
catch (cause) {
|
|
137
|
-
if (cause instanceof AuthValueError) {
|
|
138
|
-
return fail('PUBLICATION_INVALID', 'Publication issuer is invalid.', cause);
|
|
139
|
-
}
|
|
140
|
-
throw cause;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function withoutEtag(input) {
|
|
144
|
-
const { etag: _etag, ...content } = input;
|
|
145
|
-
return content;
|
|
146
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Revision } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
|
-
import { type Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
3
|
-
import type { Etag } from './etag.js';
|
|
4
|
-
import type { Publication } from './publication.js';
|
|
5
|
-
/** Compact untrusted projection that witnesses one exact Publication. */
|
|
6
|
-
export interface PublicationRef {
|
|
7
|
-
readonly origin: Key.Origin;
|
|
8
|
-
readonly identity: Publication['identity'];
|
|
9
|
-
readonly revision: Revision;
|
|
10
|
-
readonly etag: Etag;
|
|
11
|
-
}
|
|
12
|
-
export type PublicationReferenceRelation = 'exact' | 'same-schema' | 'schema-drift' | 'identity-drift' | 'origin-drift';
|
|
13
|
-
export declare function reference(input: Publication): PublicationRef;
|
|
14
|
-
export declare function acceptReference(input: unknown): PublicationRef;
|
|
15
|
-
export declare function compareReferences(input: PublicationRef, expected: PublicationRef): PublicationReferenceRelation;
|
|
16
|
-
export declare function compareReference(input: Publication, expected: PublicationRef): PublicationReferenceRelation;
|
|
17
|
-
export declare function matchesReference(input: Publication, expected: PublicationRef): boolean;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { HttpRequest } from './request.js';
|
|
2
|
-
export interface ReleaseUnavailable {
|
|
3
|
-
readonly kind: 'release-unavailable';
|
|
4
|
-
}
|
|
5
|
-
export declare const HTTP_ROUTE_RELEASE_UNAVAILABLE: 'x-astrale-release-unavailable';
|
|
6
|
-
export declare const HTTP_ROUTE_RELEASE_UNAVAILABLE_STATUS: 410;
|
|
7
|
-
export declare function releaseUnavailableHeaders(): Readonly<Record<string, string>>;
|
|
8
|
-
export declare function decodeReleaseUnavailable(status: number, headers: HttpRequest['headers']): ReleaseUnavailable | undefined;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { fail } from './error.js';
|
|
2
|
-
export const HTTP_ROUTE_RELEASE_UNAVAILABLE = 'x-astrale-release-unavailable';
|
|
3
|
-
export const HTTP_ROUTE_RELEASE_UNAVAILABLE_STATUS = 410;
|
|
4
|
-
export function releaseUnavailableHeaders() {
|
|
5
|
-
return Object.freeze({
|
|
6
|
-
[HTTP_ROUTE_RELEASE_UNAVAILABLE]: '1',
|
|
7
|
-
'cache-control': 'no-store',
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
export function decodeReleaseUnavailable(status, headers) {
|
|
11
|
-
const encoded = header(headers, HTTP_ROUTE_RELEASE_UNAVAILABLE);
|
|
12
|
-
if (encoded === undefined)
|
|
13
|
-
return undefined;
|
|
14
|
-
if (status !== HTTP_ROUTE_RELEASE_UNAVAILABLE_STATUS || encoded !== '1') {
|
|
15
|
-
fail('NATIVE_ROUTE_ROUTING_INVALID', `${HTTP_ROUTE_RELEASE_UNAVAILABLE} is reserved for status ${HTTP_ROUTE_RELEASE_UNAVAILABLE_STATUS} with value 1.`);
|
|
16
|
-
}
|
|
17
|
-
return Object.freeze({ kind: 'release-unavailable' });
|
|
18
|
-
}
|
|
19
|
-
function header(input, name) {
|
|
20
|
-
if (input instanceof Headers)
|
|
21
|
-
return input.get(name) ?? undefined;
|
|
22
|
-
let found;
|
|
23
|
-
for (const [candidate, value] of Object.entries(input ?? {})) {
|
|
24
|
-
if (candidate.toLowerCase() !== name || value === undefined)
|
|
25
|
-
continue;
|
|
26
|
-
if (found !== undefined || (Array.isArray(value) && value.length !== 1)) {
|
|
27
|
-
fail('NATIVE_ROUTE_ROUTING_INVALID', `Header ${name} must occur at most once.`);
|
|
28
|
-
}
|
|
29
|
-
found = typeof value === 'string' ? value : value[0];
|
|
30
|
-
}
|
|
31
|
-
return found;
|
|
32
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|