@astrale-os/sdk 0.5.0-beta.98 → 0.6.0-beta.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/README.md +165 -2
- package/dist/application/action/action.d.ts +7 -4
- package/dist/application/action/authoring.d.ts +2 -1
- package/dist/application/action/context.d.ts +18 -13
- package/dist/application/action/define.d.ts +5 -1
- package/dist/application/action/define.js +6 -1
- package/dist/application/action/index.d.ts +2 -1
- package/dist/application/dependency/index.d.ts +1 -0
- package/dist/application/dependency/invoker.d.ts +26 -0
- package/dist/application/error/error.d.ts +23 -0
- package/dist/application/error/error.js +87 -0
- package/dist/application/error/index.d.ts +2 -0
- package/dist/application/error/index.js +1 -0
- package/dist/application/index.d.ts +2 -2
- package/dist/application/integration/authentication.d.ts +10 -0
- package/dist/application/integration/authentication.typecheck.js +18 -0
- package/dist/application/integration/client.d.ts +2 -0
- package/dist/application/integration/client.js +19 -2
- package/dist/application/integration/index.d.ts +1 -0
- package/dist/application/integration/operation.d.ts +3 -0
- package/dist/application/mutation/authoring/builder.js +2 -2
- package/dist/application/mutation/authoring/endpoint.d.ts +3 -3
- package/dist/application/mutation/authoring/endpoint.js +9 -0
- package/dist/application/mutation/failure.js +13 -7
- package/dist/application/mutation/index.d.ts +1 -0
- package/dist/application/requirements/{profiles.d.ts → core.d.ts} +5 -3
- package/dist/application/requirements/{profiles.js → core.js} +6 -6
- package/dist/application/requirements/index.d.ts +4 -4
- package/dist/application/requirements/index.js +5 -5
- package/dist/application/requirements/requirement.d.ts +3 -2
- package/dist/application/runtime/authoring.d.ts +1 -0
- package/dist/application/runtime/callables.js +2 -2
- package/dist/application/runtime/declarations.d.ts +43 -0
- package/dist/application/runtime/define.d.ts +2 -1
- package/dist/application/view/index.d.ts +1 -1
- package/dist/application/view/route.d.ts +4 -0
- package/dist/application/view/route.js +5 -1
- package/dist/application/workflow/authoring.d.ts +1 -0
- package/dist/application/workflow/context.d.ts +2 -1
- package/dist/application/workflow/define.d.ts +5 -1
- package/dist/application/workflow/define.js +6 -1
- package/dist/application/workflow/index.d.ts +1 -0
- package/dist/application/workflow/runner/runner.d.ts +3 -2
- package/dist/application/workflow/workflow.d.ts +4 -3
- package/dist/deployment/adapter/adapter.d.ts +12 -7
- package/dist/deployment/adapter/define.d.ts +5 -2
- package/dist/deployment/adapter/define.js +15 -17
- package/dist/deployment/adapter/deploy/context.d.ts +6 -0
- package/dist/deployment/adapter/deploy/result.d.ts +2 -0
- package/dist/deployment/adapter/index.d.ts +2 -3
- package/dist/deployment/adapter/index.js +1 -1
- package/dist/deployment/adapter/prepare/context.d.ts +13 -5
- package/dist/deployment/authoring.d.ts +1 -1
- package/dist/deployment/build/compile.js +21 -19
- package/dist/deployment/build/frontend/compilation.d.ts +2 -1
- package/dist/deployment/build/frontend/compilation.js +1 -0
- package/dist/deployment/build/material.js +5 -5
- package/dist/deployment/deploy.d.ts +10 -4
- package/dist/deployment/deploy.js +5 -5
- package/dist/deployment/deployment.d.ts +8 -5
- package/dist/deployment/deployment.js +10 -1
- package/dist/deployment/index.d.ts +5 -4
- package/dist/deployment/index.js +3 -2
- package/dist/deployment/release/addressing.d.ts +6 -2
- package/dist/deployment/release/addressing.js +9 -4
- package/dist/deployment/release/publication/callables.js +1 -1
- package/dist/deployment/release/publication/index.d.ts +1 -1
- package/dist/deployment/release/publication/index.js +1 -1
- package/dist/deployment/release/publication/routes.js +1 -1
- package/dist/deployment/release/publication/seal.d.ts +0 -1
- package/dist/deployment/release/publication/seal.js +4 -5
- package/dist/deployment/release/publication/views.js +2 -1
- package/dist/deployment/verify/preflight/artifact.js +1 -1
- package/dist/deployment/verify/readiness/deployment.js +7 -3
- package/dist/deployment/verify/readiness/identity.js +1 -1
- package/dist/deployment/verify/readiness/publication.js +2 -2
- package/dist/execution/identity/authentication.js +0 -1
- package/dist/execution/identity/exchange.d.ts +1 -0
- package/dist/execution/identity/exchange.js +1 -1
- package/dist/execution/identity/jwks.js +1 -1
- package/dist/execution/invocation/admission/authentication.d.ts +6 -3
- package/dist/execution/invocation/admission/authentication.js +16 -6
- package/dist/execution/invocation/admission/authority.d.ts +2 -2
- package/dist/execution/invocation/dependency/bind.d.ts +5 -0
- package/dist/execution/invocation/dependency/bind.js +68 -0
- package/dist/execution/invocation/dependency/index.d.ts +1 -0
- package/dist/execution/invocation/dependency/index.js +1 -0
- package/dist/execution/invocation/dispatch/action.js +19 -2
- package/dist/execution/invocation/dispatch/context.d.ts +4 -4
- package/dist/execution/invocation/dispatch/context.js +29 -9
- package/dist/execution/invocation/dispatch/workflow.js +17 -4
- package/dist/execution/invocation/integration/authentication.d.ts +5 -0
- package/dist/execution/invocation/integration/authentication.js +53 -0
- package/dist/execution/invocation/integration/call.d.ts +7 -1
- package/dist/execution/invocation/integration/call.js +8 -3
- package/dist/execution/invocation/integration/clients.d.ts +2 -2
- package/dist/execution/invocation/integration/clients.js +2 -2
- package/dist/execution/invocation/lifecycle/active.js +30 -5
- package/dist/execution/invocation/result/errors.d.ts +1 -0
- package/dist/execution/invocation/result/errors.js +15 -10
- package/dist/execution/service/create.js +3 -1
- package/dist/execution/service/service.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/platform/auth/index.d.ts +1 -1
- package/dist/platform/auth/index.js +0 -1
- package/dist/platform/graph/alias.d.ts +6 -0
- package/dist/platform/graph/alias.js +6 -0
- package/dist/platform/graph/document/index.d.ts +2 -1
- package/dist/platform/graph/document/index.js +2 -1
- package/dist/platform/graph/index.d.ts +2 -1
- package/dist/platform/graph/index.js +2 -1
- package/dist/platform/schema/class-authoring.d.ts +37 -0
- package/dist/platform/schema/class-authoring.js +20 -0
- package/dist/platform/schema/class-icon.d.ts +15 -0
- package/dist/platform/schema/class-icon.js +46 -0
- package/dist/platform/schema/error.d.ts +11 -0
- package/dist/platform/schema/error.js +34 -0
- package/dist/platform/schema/errors/index.d.ts +3 -0
- package/dist/platform/schema/errors/index.js +2 -0
- package/dist/platform/schema/icons/index.d.ts +2 -0
- package/dist/platform/schema/icons/index.js +2 -0
- package/dist/platform/schema/index.d.ts +20 -13
- package/dist/platform/schema/index.js +9 -4
- package/dist/platform/schema/kernel.d.ts +22 -0
- package/dist/platform/schema/kernel.js +5 -0
- package/dist/platform/schema/node-id.d.ts +3 -0
- package/dist/platform/schema/node-id.js +6 -0
- package/dist/platform/schema/property.d.ts +12 -0
- package/dist/platform/schema/property.js +3 -0
- package/dist/platform/schema/schema-authoring.d.ts +48 -0
- package/dist/platform/schema/schema-authoring.js +3 -0
- package/dist/platform/schema/state-property.d.ts +11 -0
- package/dist/platform/schema/state-property.js +3 -0
- package/dist/project/admit.d.ts +4 -0
- package/dist/project/admit.js +22 -0
- package/dist/project/define.d.ts +12 -0
- package/dist/project/define.js +106 -0
- package/dist/project/index.d.ts +4 -0
- package/dist/project/index.js +2 -0
- package/dist/project/project.d.ts +24 -0
- package/dist/project/project.js +1 -0
- package/dist/testing/dataset/admission.d.ts +13 -0
- package/dist/testing/dataset/admission.js +107 -0
- package/dist/testing/dataset/builder.d.ts +42 -0
- package/dist/testing/dataset/builder.js +127 -0
- package/dist/testing/dataset/codec.d.ts +6 -0
- package/dist/testing/dataset/codec.js +113 -0
- package/dist/testing/dataset/dataset.d.ts +58 -0
- package/dist/testing/dataset/dataset.js +2 -0
- package/dist/testing/dataset/define.d.ts +33 -0
- package/dist/testing/dataset/define.js +105 -0
- package/dist/testing/dataset/index.d.ts +8 -0
- package/dist/testing/dataset/index.js +4 -0
- package/dist/testing/dataset/references.d.ts +14 -0
- package/dist/testing/dataset/references.js +56 -0
- package/dist/testing/index.d.ts +9 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/load.d.ts +14 -0
- package/dist/testing/load.js +44 -0
- package/dist/testing/reference.d.ts +11 -0
- package/dist/testing/reference.js +19 -0
- package/dist/testing/tests.d.ts +12 -0
- package/dist/testing/tests.js +31 -0
- package/dist/tooling/cli/arguments.d.ts +7 -4
- package/dist/tooling/cli/arguments.js +82 -107
- package/dist/tooling/cli/astrale/authority.d.ts +5 -0
- package/dist/tooling/cli/astrale/authority.js +11 -0
- package/dist/tooling/cli/astrale/executable.d.ts +2 -0
- package/dist/tooling/cli/astrale/executable.js +47 -0
- package/dist/tooling/cli/astrale/failure.d.ts +6 -0
- package/dist/tooling/cli/astrale/failure.js +48 -0
- package/dist/tooling/cli/astrale/instance.d.ts +11 -0
- package/dist/tooling/cli/astrale/instance.js +52 -0
- package/dist/tooling/cli/astrale/process.d.ts +13 -0
- package/dist/tooling/cli/astrale/process.js +94 -0
- package/dist/tooling/cli/astrale/version.d.ts +18 -0
- package/dist/tooling/cli/astrale/version.js +55 -0
- package/dist/tooling/cli/bun.js +1 -1
- package/dist/tooling/cli/credential.d.ts +2 -0
- package/dist/tooling/cli/credential.js +57 -0
- package/dist/tooling/cli/development/candidate.d.ts +25 -0
- package/dist/tooling/cli/development/candidate.js +176 -0
- package/dist/tooling/cli/development/deployment.d.ts +16 -0
- package/dist/tooling/cli/development/deployment.js +39 -0
- package/dist/tooling/cli/development/develop.d.ts +4 -3
- package/dist/tooling/cli/development/develop.js +125 -289
- package/dist/tooling/cli/development/lease.d.ts +18 -0
- package/dist/tooling/cli/development/lease.js +163 -0
- package/dist/tooling/cli/development/lifecycle.js +4 -0
- package/dist/tooling/cli/development/project-imports.d.ts +22 -0
- package/dist/tooling/cli/development/project-imports.js +39 -0
- package/dist/tooling/cli/development/project-lock.d.ts +3 -4
- package/dist/tooling/cli/development/project-lock.js +14 -166
- package/dist/tooling/cli/development/release-evidence.d.ts +4 -0
- package/dist/tooling/cli/development/release-evidence.js +10 -0
- package/dist/tooling/cli/development/report.d.ts +6 -0
- package/dist/tooling/cli/development/report.js +14 -0
- package/dist/tooling/cli/development/source-watch.js +53 -5
- package/dist/tooling/cli/development/sources.d.ts +7 -0
- package/dist/tooling/cli/development/sources.js +48 -0
- package/dist/tooling/cli/development/target-lock.d.ts +16 -0
- package/dist/tooling/cli/development/target-lock.js +68 -0
- package/dist/tooling/cli/development/view.d.ts +28 -0
- package/dist/tooling/cli/development/view.js +151 -0
- package/dist/tooling/cli/environment-release.d.ts +21 -0
- package/dist/tooling/cli/environment-release.js +46 -0
- package/dist/tooling/cli/evidence.d.ts +11 -0
- package/dist/tooling/cli/evidence.js +53 -0
- package/dist/tooling/cli/help.js +78 -34
- package/dist/tooling/cli/index.d.ts +1 -1
- package/dist/tooling/cli/index.js +1 -1
- package/dist/tooling/cli/installation/index.d.ts +2 -0
- package/dist/tooling/cli/installation/index.js +1 -0
- package/dist/tooling/cli/installation/observation.d.ts +10 -0
- package/dist/tooling/cli/installation/observation.js +44 -0
- package/dist/tooling/cli/installation/reconcile.d.ts +32 -0
- package/dist/tooling/cli/installation/reconcile.js +122 -0
- package/dist/tooling/cli/orchestrate.js +84 -44
- package/dist/tooling/cli/project.d.ts +17 -0
- package/dist/tooling/cli/project.js +18 -0
- package/dist/tooling/cli/test.d.ts +12 -0
- package/dist/tooling/cli/test.js +47 -0
- package/dist/tooling/cli/upgrade/index.d.ts +6 -0
- package/dist/tooling/cli/upgrade/index.js +115 -0
- package/dist/tooling/cli/upgrade/manifest.d.ts +18 -0
- package/dist/tooling/cli/upgrade/manifest.js +77 -0
- package/dist/tooling/cli/upgrade/process.d.ts +2 -0
- package/dist/tooling/cli/upgrade/process.js +57 -0
- package/dist/tooling/linter/adapters/typescript/imports.js +2 -0
- package/dist/tooling/linter/adapters/typescript/index.d.ts +1 -0
- package/dist/tooling/linter/adapters/typescript/index.js +1 -0
- package/dist/tooling/linter/adapters/typescript/query-collection-type.js +4 -51
- package/dist/tooling/linter/adapters/typescript/type-analysis.d.ts +9 -0
- package/dist/tooling/linter/adapters/typescript/type-analysis.js +55 -0
- package/dist/tooling/linter/implementations/source/callable-requirements.d.ts +28 -0
- package/dist/tooling/linter/implementations/source/callable-requirements.js +234 -0
- package/dist/tooling/linter/implementations/source/dependencies.d.ts +2 -0
- package/dist/tooling/linter/implementations/source/dependencies.js +219 -0
- package/dist/tooling/linter/implementations/source/global.js +61 -5
- package/dist/tooling/linter/implementations/source/mutations.js +520 -38
- package/dist/tooling/linter/implementations/source/providers.js +19 -164
- package/dist/tooling/linter/implementations/source/schema.js +454 -2
- package/dist/tooling/linter/implementations/source/verifiers.js +2 -0
- package/dist/tooling/linter/implementations/source/workflows.js +8 -35
- package/dist/tooling/linter/policy/generated.js +2 -2
- package/dist/tooling/linter/requirements/registry.js +9 -3
- package/dist/tooling/packaging/declarations/normalize.js +3 -38
- package/dist/tooling/packaging/declarations/paths.d.ts +5 -0
- package/dist/tooling/packaging/declarations/paths.js +38 -0
- package/dist/tooling/packaging/finalize.d.ts +13 -0
- package/dist/tooling/packaging/finalize.js +62 -0
- package/dist/tooling/packaging/index.d.ts +2 -0
- package/dist/tooling/packaging/index.js +1 -0
- package/dist/tooling/packaging/javascript.d.ts +3 -0
- package/dist/tooling/packaging/javascript.js +45 -2
- package/dist/tooling/packaging/packaging.d.ts +2 -5
- package/dist/tooling/packaging/packaging.js +6 -30
- package/package.json +42 -12
- package/CHANGELOG.md +0 -1499
- package/dist/deployment/adapter/development/context.d.ts +0 -18
- package/dist/deployment/adapter/development/index.d.ts +0 -4
- package/dist/deployment/adapter/development/input.d.ts +0 -6
- package/dist/deployment/adapter/development/placement.d.ts +0 -15
- package/dist/deployment/adapter/development/session.d.ts +0 -9
- /package/dist/{deployment/adapter/development → application/dependency}/index.js +0 -0
- /package/dist/{deployment/adapter/development/context.js → application/dependency/invoker.js} +0 -0
- /package/dist/{deployment/adapter/development/input.js → application/integration/authentication.js} +0 -0
- /package/dist/{deployment/adapter/development/placement.js → application/integration/authentication.typecheck.d.ts} +0 -0
- /package/dist/{deployment/adapter/development/session.js → application/runtime/declarations.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
export { defineAdapter, isAdapter } from './define.js';
|
|
1
|
+
export { defineAdapter, defineDeployment, isAdapter } from './define.js';
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import type { Build } from '../../build/index.js';
|
|
2
2
|
import type { ResolvedRuntimeReference } from '../../runtime/index.js';
|
|
3
|
+
import type { InstallationTarget } from '../adapter.js';
|
|
3
4
|
export interface PrepareContext<BuildValue extends Build = Build> {
|
|
4
5
|
readonly projectDir: string;
|
|
5
6
|
readonly environment: string;
|
|
7
|
+
readonly installation?: InstallationTarget;
|
|
6
8
|
/**
|
|
7
|
-
* Preparation purpose.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* release for compatibility.
|
|
9
|
+
* Preparation purpose. Remote development and one-shot deployment both
|
|
10
|
+
* prepare complete release artifacts. Omitted by older custom callers means
|
|
11
|
+
* release for compatibility during the beta migration.
|
|
11
12
|
*/
|
|
12
|
-
readonly mode?: '
|
|
13
|
+
readonly mode?: 'release';
|
|
14
|
+
/**
|
|
15
|
+
* Optional preparation-input observer used by tooling that must rebuild when
|
|
16
|
+
* an adapter reads authored paths outside the Application/Runtime module graph.
|
|
17
|
+
*/
|
|
18
|
+
readonly recordSource?: (path: string) => void;
|
|
19
|
+
/** Parent-owned lifecycle cancellation shared by every preparation process/effect. */
|
|
20
|
+
readonly signal: AbortSignal;
|
|
13
21
|
readonly build: BuildValue;
|
|
14
22
|
readonly runtime: ResolvedRuntimeReference;
|
|
15
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { deploy } from './deploy.js';
|
|
2
|
-
export type { DeploymentInput } from './deploy.js';
|
|
2
|
+
export type { DeploymentInput, LegacyDeployment } from './deploy.js';
|
|
3
3
|
export type { Deployment } from './deployment.js';
|
|
4
4
|
export { runtime } from './runtime/index.js';
|
|
5
5
|
export type { RuntimeReference } from './runtime/index.js';
|
|
@@ -54,24 +54,26 @@ function compileRequirements(domain, input, sourceBundle) {
|
|
|
54
54
|
throw new TypeError('Class requirement is absent from the dependency closure.');
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
for (const
|
|
58
|
-
const subject = domain.core.nodes[
|
|
59
|
-
if (
|
|
60
|
-
throw new TypeError('
|
|
57
|
+
for (const requirement of input?.core ?? []) {
|
|
58
|
+
const subject = domain.core.nodes[requirement.subject.name];
|
|
59
|
+
if (requirement.subject.origin !== domain.origin || subject === undefined) {
|
|
60
|
+
throw new TypeError('Core capability subject must name one local Core Node.');
|
|
61
61
|
}
|
|
62
|
-
for (const key of
|
|
63
|
-
|
|
62
|
+
for (const key of requirement.functions) {
|
|
63
|
+
if (Key.origin(key) !== domain.origin) {
|
|
64
|
+
requireDirectDependency(domain, key, 'Core capability Function');
|
|
65
|
+
}
|
|
64
66
|
if (domain.callable(key) === undefined) {
|
|
65
|
-
throw new TypeError(`
|
|
67
|
+
throw new TypeError(`Core capability Function ${key} is absent from the dependency closure.`);
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
|
-
for (const
|
|
69
|
-
const key = Key.of(
|
|
70
|
-
if (
|
|
71
|
-
requireDirectDependency(domain, key, '
|
|
70
|
+
for (const classRequirement of requirement.classes) {
|
|
71
|
+
const key = Key.of(classRequirement.class);
|
|
72
|
+
if (classRequirement.class.origin !== domain.origin) {
|
|
73
|
+
requireDirectDependency(domain, key, 'Core capability Class');
|
|
72
74
|
}
|
|
73
|
-
if (domain.definition(
|
|
74
|
-
throw new TypeError('
|
|
75
|
+
if (domain.definition(classRequirement.class) === undefined) {
|
|
76
|
+
throw new TypeError('Core capability Class is absent from the dependency closure.');
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
}
|
|
@@ -82,14 +84,14 @@ function compileRequirements(domain, input, sourceBundle) {
|
|
|
82
84
|
: { functions: input.functions }),
|
|
83
85
|
...(input === undefined || input.classes.length === 0 ? {} : { classes: input.classes }),
|
|
84
86
|
...(input?.authority === undefined ? {} : { authority: input.authority }),
|
|
85
|
-
...(input === undefined || input.
|
|
87
|
+
...(input === undefined || input.core.length === 0
|
|
86
88
|
? {}
|
|
87
89
|
: {
|
|
88
|
-
|
|
89
|
-
subject:
|
|
90
|
-
...(
|
|
91
|
-
...(
|
|
92
|
-
...(
|
|
90
|
+
core: input.core.map((requirement) => ({
|
|
91
|
+
subject: requirement.subject,
|
|
92
|
+
...(requirement.functions.length === 0 ? {} : { functions: requirement.functions }),
|
|
93
|
+
...(requirement.classes.length === 0 ? {} : { classes: requirement.classes }),
|
|
94
|
+
...(requirement.authority === undefined ? {} : { authority: requirement.authority }),
|
|
93
95
|
})),
|
|
94
96
|
}),
|
|
95
97
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Frontend, FrontendSource } from '../../../application/view/index.js';
|
|
2
|
-
import type { FrontendHandshake, IframeRequirements } from '../../../application/view/index.js';
|
|
2
|
+
import type { FrontendHandshake, IframeRequirements, ViewHostRequirements } from '../../../application/view/index.js';
|
|
3
3
|
import type { Key, ViewRef } from '../../../platform/schema/index.js';
|
|
4
4
|
import type { Domain } from '../../../platform/schema/index.js';
|
|
5
5
|
export interface CompiledFrontendRoute {
|
|
@@ -8,6 +8,7 @@ export interface CompiledFrontendRoute {
|
|
|
8
8
|
readonly document: string;
|
|
9
9
|
readonly handshake: FrontendHandshake;
|
|
10
10
|
readonly iframe?: IframeRequirements;
|
|
11
|
+
readonly host?: ViewHostRequirements;
|
|
11
12
|
}
|
|
12
13
|
export interface FrontendCompilation {
|
|
13
14
|
readonly source: FrontendSource;
|
|
@@ -16,6 +16,7 @@ export function compileFrontend(frontend, domain) {
|
|
|
16
16
|
document: route.document,
|
|
17
17
|
handshake: route.handshake,
|
|
18
18
|
...(route.iframe === undefined ? {} : { iframe: route.iframe }),
|
|
19
|
+
...(route.host === undefined ? {} : { host: route.host }),
|
|
19
20
|
});
|
|
20
21
|
});
|
|
21
22
|
const entrypoint = domain.views[frontend.entrypoint];
|
|
@@ -113,20 +113,20 @@ function acceptGeneratedMaterial(input, runtime) {
|
|
|
113
113
|
const format = input?.format;
|
|
114
114
|
const version = input?.version;
|
|
115
115
|
const material = input?.material;
|
|
116
|
-
const digest = input?.digest;
|
|
117
116
|
if (input === null ||
|
|
118
117
|
typeof input !== 'object' ||
|
|
119
118
|
Array.isArray(input) ||
|
|
120
119
|
format !== 'astrale.sdk.generated-build-material' ||
|
|
121
120
|
version !== 1 ||
|
|
122
|
-
Reflect.ownKeys(input).some((key) => key !== 'format' && key !== 'version' && key !== 'material' && key !== 'digest')
|
|
123
|
-
digestOf(material) !== digest) {
|
|
121
|
+
Reflect.ownKeys(input).some((key) => key !== 'format' && key !== 'version' && key !== 'material' && key !== 'digest')) {
|
|
124
122
|
invalid();
|
|
125
123
|
}
|
|
126
124
|
assertMaterialEnvelope(material, runtime);
|
|
127
|
-
|
|
125
|
+
// One traversal seals the whole envelope. `input.material` is the exact `material` value and
|
|
126
|
+
// every other admitted key holds a primitive, so a second pass would re-walk an already frozen
|
|
127
|
+
// graph: on a real Domain that is one redundant traversal of every `schema.compiled` node.
|
|
128
128
|
deepFreeze(input);
|
|
129
|
-
return
|
|
129
|
+
return Object.freeze({ material });
|
|
130
130
|
}
|
|
131
131
|
function digestOf(input) {
|
|
132
132
|
try {
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import type { ApplicationIdentity } from '../application/index.js';
|
|
2
2
|
import type { Adapter } from './adapter/index.js';
|
|
3
|
-
import type { Deployment } from './deployment.js';
|
|
4
3
|
import type { RuntimeReference } from './runtime/index.js';
|
|
5
4
|
type CanonicalAdapter<Value> = Value extends Adapter<infer _Parameters> ? Value : never;
|
|
5
|
+
/** @deprecated Declare Application and Environments directly in defineProject(). */
|
|
6
6
|
export interface DeploymentInput<ApplicationValue extends ApplicationIdentity, AdapterValue extends object> {
|
|
7
7
|
readonly application: ApplicationValue;
|
|
8
8
|
readonly entrypoint: RuntimeReference;
|
|
9
9
|
readonly adapter: CanonicalAdapter<AdapterValue>;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
export
|
|
13
|
-
|
|
11
|
+
/** @deprecated Legacy aggregate retained only so tooling can issue an exact migration diagnostic. */
|
|
12
|
+
export interface LegacyDeployment<ApplicationValue extends ApplicationIdentity = ApplicationIdentity, AdapterValue extends object = object> {
|
|
13
|
+
readonly application: ApplicationValue;
|
|
14
|
+
readonly entrypoint: RuntimeReference;
|
|
15
|
+
readonly adapter: AdapterValue;
|
|
16
|
+
}
|
|
17
|
+
/** @deprecated Declare Application and Environments directly in defineProject(). */
|
|
18
|
+
export declare function deploy<const ApplicationValue extends ApplicationIdentity, const AdapterValue extends object>(input: DeploymentInput<ApplicationValue, AdapterValue>): LegacyDeployment<ApplicationValue, AdapterValue>;
|
|
19
|
+
export declare function isLegacyDeployment(input: unknown): input is LegacyDeployment;
|
|
14
20
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isApplication } from '../application/index.js';
|
|
2
2
|
import { isAdapter } from './adapter/index.js';
|
|
3
3
|
import { isRuntimeReference } from './runtime/index.js';
|
|
4
|
-
const
|
|
5
|
-
/**
|
|
4
|
+
const legacyDeployments = new WeakSet();
|
|
5
|
+
/** @deprecated Declare Application and Environments directly in defineProject(). */
|
|
6
6
|
export function deploy(input) {
|
|
7
7
|
if (input === null || typeof input !== 'object' || Array.isArray(input))
|
|
8
8
|
invalid();
|
|
@@ -20,11 +20,11 @@ export function deploy(input) {
|
|
|
20
20
|
if (!isAdapter(input.adapter))
|
|
21
21
|
throw new TypeError('Deployment Adapter is not admitted.');
|
|
22
22
|
const deployment = Object.freeze({ ...input });
|
|
23
|
-
|
|
23
|
+
legacyDeployments.add(deployment);
|
|
24
24
|
return deployment;
|
|
25
25
|
}
|
|
26
|
-
export function
|
|
27
|
-
return input !== null && typeof input === 'object' &&
|
|
26
|
+
export function isLegacyDeployment(input) {
|
|
27
|
+
return input !== null && typeof input === 'object' && legacyDeployments.has(input);
|
|
28
28
|
}
|
|
29
29
|
function invalid() {
|
|
30
30
|
throw new TypeError('Deployment must contain exactly application, entrypoint, and adapter.');
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export interface Deployment<
|
|
3
|
-
readonly
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
1
|
+
import type { Adapter } from './adapter/index.js';
|
|
2
|
+
export interface Deployment<Parameters extends object = object> {
|
|
3
|
+
readonly kind: 'deployment';
|
|
4
|
+
readonly adapter: Adapter<Parameters>;
|
|
5
|
+
readonly parameters: Parameters;
|
|
6
6
|
}
|
|
7
|
+
/** Internal adapter binding boundary used by public provider packages. */
|
|
8
|
+
export declare function captureDeployment<const Parameters extends object>(adapter: Adapter<Parameters>, parameters: Parameters): Deployment<Parameters>;
|
|
9
|
+
export declare function isDeployment(input: unknown): input is Deployment;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
const deployments = new WeakSet();
|
|
2
|
+
/** Internal adapter binding boundary used by public provider packages. */
|
|
3
|
+
export function captureDeployment(adapter, parameters) {
|
|
4
|
+
const value = Object.freeze({ kind: 'deployment', adapter, parameters });
|
|
5
|
+
deployments.add(value);
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
export function isDeployment(input) {
|
|
9
|
+
return input !== null && typeof input === 'object' && deployments.has(input);
|
|
10
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { defineAdapter, isAdapter } from './adapter/index.js';
|
|
2
|
-
export type { Adapter, AdapterInput, AddressingPlan, ArtifactFile, ArtifactSource, DeployContext,
|
|
1
|
+
export { defineAdapter, defineDeployment, isAdapter } from './adapter/index.js';
|
|
2
|
+
export type { Adapter, AdapterEnvironmentContext, AdapterInput, AddressingPlan, ArtifactFile, ArtifactSource, DeployContext, DeploymentPhase, DeploymentProgress, DeployResult, FailedDeployResult, MutationKnowledge, PreparedArtifact, PreparedArtifactFile, PrepareContext, ReadyDeployResult, InstallationTarget, } from './adapter/index.js';
|
|
3
3
|
export { compile, isBuild } from './build/index.js';
|
|
4
4
|
export type { Build, BuildBundle, BuildSchema } from './build/index.js';
|
|
5
|
-
export { deploy
|
|
6
|
-
export type { DeploymentInput } from './deploy.js';
|
|
5
|
+
export { deploy } from './deploy.js';
|
|
6
|
+
export type { DeploymentInput, LegacyDeployment } from './deploy.js';
|
|
7
|
+
export { isDeployment } from './deployment.js';
|
|
7
8
|
export type { Deployment } from './deployment.js';
|
|
8
9
|
export { addressing, assemble, isAddressing, isRelease } from './release/index.js';
|
|
9
10
|
export type { Addressing, Release } from './release/index.js';
|
package/dist/deployment/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { defineAdapter, isAdapter } from './adapter/index.js';
|
|
1
|
+
export { defineAdapter, defineDeployment, isAdapter } from './adapter/index.js';
|
|
2
2
|
export { compile, isBuild } from './build/index.js';
|
|
3
|
-
export { deploy
|
|
3
|
+
export { deploy } from './deploy.js';
|
|
4
|
+
export { isDeployment } from './deployment.js';
|
|
4
5
|
export { addressing, assemble, isAddressing, isRelease } from './release/index.js';
|
|
5
6
|
export { admit as admitRuntime, resolve as resolveRuntime, runtime } from './runtime/index.js';
|
|
6
7
|
export { verifyDeployment, verifyPreflight, verifyReadiness } from './verify/index.js';
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { IssuerId } from '../../platform/auth/index.js';
|
|
2
|
-
/**
|
|
2
|
+
/** Stable Domain identity and public placement, independent of how a provider obtains them. */
|
|
3
3
|
export interface Addressing {
|
|
4
4
|
readonly issuer: IssuerId;
|
|
5
|
+
/** Public origin serving this Release; the issuer can remain on an older deployment. */
|
|
6
|
+
readonly publicUrl: IssuerId;
|
|
5
7
|
}
|
|
6
|
-
export declare function addressing(input: string
|
|
8
|
+
export declare function addressing(input: string, options?: {
|
|
9
|
+
readonly publicUrl?: string;
|
|
10
|
+
}): Addressing;
|
|
7
11
|
export declare function isAddressing(input: unknown): input is Addressing;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { issuer } from '../../platform/auth/index.js';
|
|
2
2
|
const admittedAddressing = new WeakSet();
|
|
3
|
-
export function addressing(input) {
|
|
3
|
+
export function addressing(input, options = {}) {
|
|
4
|
+
const admitted = origin(input);
|
|
5
|
+
const publicUrl = options.publicUrl === undefined ? admitted : origin(options.publicUrl);
|
|
6
|
+
const value = Object.freeze({ issuer: admitted, publicUrl });
|
|
7
|
+
admittedAddressing.add(value);
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
function origin(input) {
|
|
4
11
|
let admitted;
|
|
5
12
|
let url;
|
|
6
13
|
try {
|
|
@@ -18,9 +25,7 @@ export function addressing(input) {
|
|
|
18
25
|
url.hash !== '') {
|
|
19
26
|
throw new TypeError('Addressing issuer must be an origin-only absolute HTTP(S) issuer.');
|
|
20
27
|
}
|
|
21
|
-
|
|
22
|
-
admittedAddressing.add(value);
|
|
23
|
-
return value;
|
|
28
|
+
return admitted;
|
|
24
29
|
}
|
|
25
30
|
export function isAddressing(input) {
|
|
26
31
|
return input !== null && typeof input === 'object' && admittedAddressing.has(input);
|
|
@@ -2,7 +2,7 @@ import * as publication from '@astrale-os/kernel-protocol/publication';
|
|
|
2
2
|
import { invocationPath } from '../invocation.js';
|
|
3
3
|
export function callables(build, addressing) {
|
|
4
4
|
const endpoint = publication.acceptInvocationEndpoints({
|
|
5
|
-
http: new URL(invocationPath(), addressing.
|
|
5
|
+
http: new URL(invocationPath(), addressing.publicUrl).href,
|
|
6
6
|
});
|
|
7
7
|
return Object.freeze(build.callables.map((callable) => Object.freeze({ callable, endpoint })));
|
|
8
8
|
}
|
|
@@ -2,5 +2,5 @@ export { callables } from './callables.js';
|
|
|
2
2
|
export { manifest } from './manifest.js';
|
|
3
3
|
export { requirements } from './requirements.js';
|
|
4
4
|
export { routes } from './routes.js';
|
|
5
|
-
export {
|
|
5
|
+
export { seal, type SealedPublication } from './seal.js';
|
|
6
6
|
export { views } from './views.js';
|
|
@@ -2,5 +2,5 @@ export { callables } from './callables.js';
|
|
|
2
2
|
export { manifest } from './manifest.js';
|
|
3
3
|
export { requirements } from './requirements.js';
|
|
4
4
|
export { routes } from './routes.js';
|
|
5
|
-
export {
|
|
5
|
+
export { seal } from './seal.js';
|
|
6
6
|
export { views } from './views.js';
|
|
@@ -2,7 +2,6 @@ import * as publication from '@astrale-os/kernel-protocol/publication';
|
|
|
2
2
|
import * as protocolRoutes from '@astrale-os/kernel-protocol/routes';
|
|
3
3
|
import type { Build } from '../../build/index.js';
|
|
4
4
|
import type { Addressing } from '../addressing.js';
|
|
5
|
-
export declare const BUNDLE_PATH: '/.well-known/astrale/domain.bundle.json';
|
|
6
5
|
export declare const DELIVERY_PATH: '/install';
|
|
7
6
|
export interface SealedPublication {
|
|
8
7
|
readonly publication: publication.Publication;
|
|
@@ -6,20 +6,19 @@ import { manifest } from './manifest.js';
|
|
|
6
6
|
import { requirements } from './requirements.js';
|
|
7
7
|
import { routes } from './routes.js';
|
|
8
8
|
import { views } from './views.js';
|
|
9
|
-
export const BUNDLE_PATH = '/.well-known/astrale/domain.bundle.json';
|
|
10
9
|
export const DELIVERY_PATH = '/install';
|
|
11
10
|
export function seal(build, addressing) {
|
|
12
11
|
const root = build.schema.compiled.root;
|
|
13
12
|
const selectedManifest = manifest(build);
|
|
14
13
|
const sealed = publication.seal({
|
|
15
14
|
format: 'astrale.domain.publication',
|
|
16
|
-
version:
|
|
15
|
+
version: 3,
|
|
17
16
|
origin: root.origin,
|
|
18
17
|
identity: { issuer: addressing.issuer, subject: root.origin },
|
|
19
18
|
schema: {
|
|
20
19
|
revision: root.revision,
|
|
21
20
|
bundle: {
|
|
22
|
-
href:
|
|
21
|
+
href: publication.bundleUrl(addressing.publicUrl, build.schema.bundle.ref),
|
|
23
22
|
ref: build.schema.bundle.ref,
|
|
24
23
|
},
|
|
25
24
|
},
|
|
@@ -29,12 +28,12 @@ export function seal(build, addressing) {
|
|
|
29
28
|
callables: callables(build, addressing),
|
|
30
29
|
views: views(build, addressing),
|
|
31
30
|
},
|
|
32
|
-
delivery: publication.placeDelivery({ path: DELIVERY_PATH, authentication: { kind: 'public' } }, addressing.
|
|
31
|
+
delivery: publication.placeDelivery({ path: DELIVERY_PATH, authentication: { kind: 'public' } }, addressing.publicUrl, publication.bundleUrl(addressing.publicUrl, build.schema.bundle.ref)),
|
|
33
32
|
routes: routes(build, addressing),
|
|
34
33
|
});
|
|
35
34
|
const { domain } = evidenceOf(build);
|
|
36
35
|
return Object.freeze({
|
|
37
36
|
publication: sealed,
|
|
38
|
-
routes: protocolRoutes.bind(build.routes, sealed, domain),
|
|
37
|
+
routes: protocolRoutes.bind(build.routes, sealed, domain, addressing.publicUrl),
|
|
39
38
|
});
|
|
40
39
|
}
|
|
@@ -3,11 +3,12 @@ export function views(build, addressing) {
|
|
|
3
3
|
return Object.freeze([]);
|
|
4
4
|
const base = build.frontend.source.kind === 'external'
|
|
5
5
|
? `${build.frontend.source.origin}/`
|
|
6
|
-
: `${addressing.
|
|
6
|
+
: `${addressing.publicUrl.replace(/\/+$/u, '')}/`;
|
|
7
7
|
return Object.freeze(build.frontend.routes.map((route) => Object.freeze({
|
|
8
8
|
view: route.view,
|
|
9
9
|
href: new URL(route.path.replace(/^\//u, ''), base).href,
|
|
10
10
|
handshake: route.handshake,
|
|
11
11
|
...(route.iframe === undefined ? {} : { iframe: route.iframe }),
|
|
12
|
+
...(route.host === undefined ? {} : { host: route.host }),
|
|
12
13
|
})));
|
|
13
14
|
}
|
|
@@ -89,7 +89,7 @@ function evidenceBytes(build, source) {
|
|
|
89
89
|
bundle: build.schema.bundle.ref.digest,
|
|
90
90
|
entrypoint: source.entrypoint,
|
|
91
91
|
addressing: source.addressing.kind === 'configured'
|
|
92
|
-
? { kind: 'configured',
|
|
92
|
+
? { kind: 'configured', ...source.addressing.addressing }
|
|
93
93
|
: source.addressing,
|
|
94
94
|
})),
|
|
95
95
|
];
|
|
@@ -50,7 +50,8 @@ function verifyRelease(artifact, release) {
|
|
|
50
50
|
throw new TypeError('DeployResult Release differs from the PreparedArtifact Build.');
|
|
51
51
|
}
|
|
52
52
|
if (artifact.addressing.kind === 'configured' &&
|
|
53
|
-
release.addressing.issuer !== artifact.addressing.addressing.issuer
|
|
53
|
+
(release.addressing.issuer !== artifact.addressing.addressing.issuer ||
|
|
54
|
+
release.addressing.publicUrl !== artifact.addressing.addressing.publicUrl)) {
|
|
54
55
|
throw new TypeError('DeployResult Release differs from configured Addressing.');
|
|
55
56
|
}
|
|
56
57
|
return release;
|
|
@@ -102,7 +103,7 @@ function terminal(input) {
|
|
|
102
103
|
function providerEvidence(input) {
|
|
103
104
|
if (input === null || typeof input !== 'object' || Array.isArray(input))
|
|
104
105
|
invalid();
|
|
105
|
-
exact(input, ['provider', 'deployment', 'artifact'], ['issuer']);
|
|
106
|
+
exact(input, ['provider', 'deployment', 'artifact'], ['issuer', 'preflight']);
|
|
106
107
|
if (typeof input.provider !== 'string' ||
|
|
107
108
|
input.provider.length === 0 ||
|
|
108
109
|
input.provider.trim() !== input.provider ||
|
|
@@ -110,7 +111,10 @@ function providerEvidence(input) {
|
|
|
110
111
|
input.deployment.length === 0 ||
|
|
111
112
|
input.deployment.trim() !== input.deployment ||
|
|
112
113
|
typeof input.artifact !== 'string' ||
|
|
113
|
-
(input.issuer !== undefined && typeof input.issuer !== 'string')
|
|
114
|
+
(input.issuer !== undefined && typeof input.issuer !== 'string') ||
|
|
115
|
+
(input.preflight !== undefined &&
|
|
116
|
+
input.preflight !== 'passed' &&
|
|
117
|
+
input.preflight !== 'unavailable')) {
|
|
114
118
|
invalid();
|
|
115
119
|
}
|
|
116
120
|
return Object.freeze({ ...input });
|
|
@@ -21,7 +21,7 @@ async function json(fetcher, url, signal) {
|
|
|
21
21
|
throw new Error(`GET ${url} exceeded ${MAXIMUM_IDENTITY_BYTES} bytes.`);
|
|
22
22
|
}
|
|
23
23
|
try {
|
|
24
|
-
return JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes));
|
|
24
|
+
return JSON.parse(new TextDecoder('utf-8', { fatal: true, ignoreBOM: false }).decode(bytes));
|
|
25
25
|
}
|
|
26
26
|
catch (cause) {
|
|
27
27
|
throw new Error(`GET ${url} returned invalid JSON.`, { cause });
|
|
@@ -4,7 +4,7 @@ const MAXIMUM_BUNDLE_BYTES = 16 * 1024 * 1024;
|
|
|
4
4
|
/** Fetch and verify the exact live Publication and Bundle for one Release. */
|
|
5
5
|
export async function verifyPublication(release, options = {}) {
|
|
6
6
|
const fetcher = options.fetch ?? globalThis.fetch;
|
|
7
|
-
const publicationUrl = publication.url(release.addressing.
|
|
7
|
+
const publicationUrl = publication.url(release.addressing.publicUrl);
|
|
8
8
|
const response = await fetchRequired(fetcher, publicationUrl, options.signal);
|
|
9
9
|
const deployed = publication.accept(JSON.parse(await text(response, publicationUrl, MAXIMUM_PUBLICATION_BYTES)));
|
|
10
10
|
if (!publication.matchesReference(deployed, publication.reference(release.publication))) {
|
|
@@ -33,7 +33,7 @@ async function bounded(response, url, maximum) {
|
|
|
33
33
|
async function text(response, url, maximum) {
|
|
34
34
|
const bytes = await bounded(response, url, maximum);
|
|
35
35
|
try {
|
|
36
|
-
return new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
36
|
+
return new TextDecoder('utf-8', { fatal: true, ignoreBOM: false }).decode(bytes);
|
|
37
37
|
}
|
|
38
38
|
catch (cause) {
|
|
39
39
|
throw new Error(`GET ${url} returned invalid UTF-8.`, { cause });
|
|
@@ -3,6 +3,7 @@ import type { IssuerId } from '../../platform/auth/index.js';
|
|
|
3
3
|
import type { IdentityNetworkPolicy, VerificationBasisResolver } from './jwks.js';
|
|
4
4
|
import type { SigningMaterial } from './signing.js';
|
|
5
5
|
export interface ExchangeOptions {
|
|
6
|
+
/** Caller-only exchange ceiling in seconds. Defaults to 30 minutes. */
|
|
6
7
|
readonly maximumTtlSeconds?: number;
|
|
7
8
|
}
|
|
8
9
|
export declare function maximumExchangeTtl(input: ExchangeOptions | undefined): number;
|
|
@@ -6,7 +6,7 @@ import { protocolError } from '../invocation/result/index.js';
|
|
|
6
6
|
import { acceptResolvedDelegation } from './authentication.js';
|
|
7
7
|
import { CredentialRejected, IssuerUnavailable } from './errors.js';
|
|
8
8
|
import { verifyCredential, verifyCredentialAgainst } from './jwks.js';
|
|
9
|
-
const DEFAULT_MAXIMUM_TTL_SECONDS =
|
|
9
|
+
const DEFAULT_MAXIMUM_TTL_SECONDS = 30 * 60;
|
|
10
10
|
export function maximumExchangeTtl(input) {
|
|
11
11
|
if (input === undefined)
|
|
12
12
|
return DEFAULT_MAXIMUM_TTL_SECONDS;
|
|
@@ -244,7 +244,7 @@ async function json(response, signal) {
|
|
|
244
244
|
throw new CredentialRejected('Issuer discovery document exceeds its byte limit.');
|
|
245
245
|
}
|
|
246
246
|
try {
|
|
247
|
-
return JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes));
|
|
247
|
+
return JSON.parse(new TextDecoder('utf-8', { fatal: true, ignoreBOM: false }).decode(bytes));
|
|
248
248
|
}
|
|
249
249
|
catch (cause) {
|
|
250
250
|
throw new CredentialRejected('Issuer discovery document is invalid.', cause);
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { HandlerRequest } from '@astrale-os/kernel-server';
|
|
2
|
-
import type { AnonymousCaller, ResolvedCallable } from '../../../application/action/index.js';
|
|
2
|
+
import type { AnonymousCaller, AuthenticatedCaller, ResolvedCallable } from '../../../application/action/index.js';
|
|
3
3
|
import type { Release } from '../../../deployment/release/index.js';
|
|
4
4
|
import type { Domain } from '../../../platform/schema/index.js';
|
|
5
5
|
import type { AuthenticatedInvocation, InvocationAuthority } from './authority.js';
|
|
6
6
|
export interface AnonymousInvocation {
|
|
7
7
|
readonly caller: AnonymousCaller;
|
|
8
|
-
readonly client: null;
|
|
9
8
|
readonly kernel: null;
|
|
10
9
|
readonly graph: null;
|
|
11
10
|
close(): void;
|
|
12
11
|
}
|
|
13
|
-
|
|
12
|
+
interface AdmittedAuthenticatedInvocation extends Omit<AuthenticatedInvocation, 'caller'> {
|
|
13
|
+
readonly caller: AuthenticatedCaller;
|
|
14
|
+
}
|
|
15
|
+
export type InvocationAuthentication = AnonymousInvocation | AdmittedAuthenticatedInvocation;
|
|
14
16
|
export declare function authentication(callable: ResolvedCallable, request: HandlerRequest, release: Release, domain: Domain, authority: InvocationAuthority): Promise<InvocationAuthentication>;
|
|
17
|
+
export {};
|
|
@@ -5,7 +5,6 @@ import { protocolError } from '../result/index.js';
|
|
|
5
5
|
import { requireVia } from './authority.js';
|
|
6
6
|
const ANONYMOUS = Object.freeze({
|
|
7
7
|
caller: Object.freeze({ kind: 'anonymous' }),
|
|
8
|
-
client: null,
|
|
9
8
|
kernel: null,
|
|
10
9
|
graph: null,
|
|
11
10
|
close() { },
|
|
@@ -32,20 +31,18 @@ export async function authentication(callable, request, release, domain, authori
|
|
|
32
31
|
if (authenticated === null ||
|
|
33
32
|
typeof authenticated !== 'object' ||
|
|
34
33
|
Array.isArray(authenticated) ||
|
|
35
|
-
Reflect.ownKeys(authenticated).some((key) => key !== 'caller' && key !== '
|
|
34
|
+
Reflect.ownKeys(authenticated).some((key) => key !== 'caller' && key !== 'graph' && key !== 'close') ||
|
|
36
35
|
close === undefined) {
|
|
37
36
|
invalid();
|
|
38
37
|
}
|
|
39
38
|
const caller = admitCaller(authenticated.caller);
|
|
40
39
|
const graphInput = admitGraph(authenticated.graph);
|
|
41
|
-
if (authenticated.client !== graphInput.caller)
|
|
42
|
-
invalid();
|
|
43
40
|
const graph = Object.freeze({
|
|
44
41
|
caller: bindSession(graphInput.caller),
|
|
45
42
|
self: bindSession(graphInput.self),
|
|
46
43
|
union: bindSession(graphInput.union),
|
|
47
44
|
});
|
|
48
|
-
return Object.freeze({ caller,
|
|
45
|
+
return Object.freeze({ caller, graph, close });
|
|
49
46
|
}
|
|
50
47
|
catch (cause) {
|
|
51
48
|
if (close === undefined)
|
|
@@ -91,7 +88,20 @@ function admitCaller(input) {
|
|
|
91
88
|
const principal = NodeId(Reflect.get(input, 'principal'));
|
|
92
89
|
const authority = grant.accept(Reflect.get(input, 'authority'));
|
|
93
90
|
const authentication = admitEvidence(Reflect.get(input, 'authentication'));
|
|
94
|
-
|
|
91
|
+
const caller = {
|
|
92
|
+
kind: 'authenticated',
|
|
93
|
+
get identity() {
|
|
94
|
+
if (authority.expr.kind !== 'identity') {
|
|
95
|
+
throw new TypeError('Caller authority does not resolve to one exact Identity.');
|
|
96
|
+
}
|
|
97
|
+
return authority.expr.id;
|
|
98
|
+
},
|
|
99
|
+
principal,
|
|
100
|
+
authority,
|
|
101
|
+
authentication,
|
|
102
|
+
};
|
|
103
|
+
Object.defineProperty(caller, 'identity', { enumerable: false });
|
|
104
|
+
return Object.freeze(caller);
|
|
95
105
|
}
|
|
96
106
|
function admitEvidence(input) {
|
|
97
107
|
if (input === null || typeof input !== 'object' || Array.isArray(input))
|
|
@@ -19,9 +19,9 @@ export interface InvocationAuthenticationInput {
|
|
|
19
19
|
readonly domain: Domain;
|
|
20
20
|
readonly context: InvocationContext;
|
|
21
21
|
}
|
|
22
|
+
/** Authenticated capabilities before the SDK admits and derives application caller context. */
|
|
22
23
|
export interface AuthenticatedInvocation {
|
|
23
|
-
readonly caller: AuthenticatedCaller
|
|
24
|
-
readonly client: BoundClientSession;
|
|
24
|
+
readonly caller: Omit<AuthenticatedCaller, 'identity'>;
|
|
25
25
|
readonly graph: Readonly<Record<'caller' | 'self' | 'union', BoundClientSession>>;
|
|
26
26
|
close(): void;
|
|
27
27
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HandlerDependencies } from '../../../application/dependency/index.js';
|
|
2
|
+
import type { BoundClientSession } from '../../../platform/client/session/index.js';
|
|
3
|
+
import type { Domain } from '../../../platform/schema/index.js';
|
|
4
|
+
/** Bind each explicit authority to its admitted session; metadata remains inert. */
|
|
5
|
+
export declare function bindDependencies<D extends Domain>(domain: D, sessions: Readonly<Record<'caller' | 'self' | 'union', BoundClientSession>>): HandlerDependencies<D>;
|