@astrale-os/sdk 0.5.0-beta.99 → 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 +52 -2
- 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 -1506
- 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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LucideIconData } from '@lucide/icons';
|
|
2
|
+
declare const CLASS_ICON: unique symbol;
|
|
3
|
+
/** An admitted, self-contained SVG suitable for a Node Class presentation icon. */
|
|
4
|
+
export type ClassIcon = string & {
|
|
5
|
+
readonly [CLASS_ICON]: true;
|
|
6
|
+
};
|
|
7
|
+
/** Stable empty SVG used when an author explicitly chooses to render no icon glyph. */
|
|
8
|
+
export declare const NEUTRAL_CLASS_ICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"></svg>";
|
|
9
|
+
/** Framework-neutral constructors for canonical Node Class icons. */
|
|
10
|
+
export declare const classIcon: Readonly<{
|
|
11
|
+
readonly neutral: ClassIcon;
|
|
12
|
+
svg(source: string): ClassIcon;
|
|
13
|
+
lucide(icon: LucideIconData): ClassIcon;
|
|
14
|
+
}>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { buildLucideSvg } from '@lucide/icons/build';
|
|
2
|
+
const MAX_CLASS_ICON_LENGTH = 8_000;
|
|
3
|
+
const SVG_ROOT = /^<svg(?:\s[^>]*)?>[\s\S]*<\/svg>$/u;
|
|
4
|
+
const SVG_ROOT_OPEN = /<svg(?:\s|>)/gu;
|
|
5
|
+
const SVG_ROOT_CLOSE = /<\/svg\s*>/gu;
|
|
6
|
+
const SVG_GRAPHIC = /<(?:circle|ellipse|line|path|polygon|polyline|rect)\b/iu;
|
|
7
|
+
const UNSAFE_SVG = /<\s*(?:animate|discard|embed|foreignObject|iframe|image|object|script|set|style|use)\b|<!DOCTYPE\b|<!ENTITY\b|\son[a-z][\w:.-]*\s*=|(?:href|xlink:href)\s*=|javascript\s*:|url\s*\(/iu;
|
|
8
|
+
/** Stable empty SVG used when an author explicitly chooses to render no icon glyph. */
|
|
9
|
+
export const NEUTRAL_CLASS_ICON_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"></svg>';
|
|
10
|
+
function svg(source) {
|
|
11
|
+
if (typeof source !== 'string') {
|
|
12
|
+
throw new TypeError('Class icon must be an inline SVG string.');
|
|
13
|
+
}
|
|
14
|
+
const value = source.trim();
|
|
15
|
+
if (Array.from(value).length > MAX_CLASS_ICON_LENGTH) {
|
|
16
|
+
throw new TypeError(`Class icon must contain at most ${MAX_CLASS_ICON_LENGTH} characters.`);
|
|
17
|
+
}
|
|
18
|
+
if (!SVG_ROOT.test(value) ||
|
|
19
|
+
(value.match(SVG_ROOT_OPEN)?.length ?? 0) !== 1 ||
|
|
20
|
+
(value.match(SVG_ROOT_CLOSE)?.length ?? 0) !== 1) {
|
|
21
|
+
throw new TypeError('Class icon must be one complete inline <svg> element.');
|
|
22
|
+
}
|
|
23
|
+
if (UNSAFE_SVG.test(value)) {
|
|
24
|
+
throw new TypeError('Class icon SVG must be self-contained and contain no executable content.');
|
|
25
|
+
}
|
|
26
|
+
if (value !== NEUTRAL_CLASS_ICON_SVG && !SVG_GRAPHIC.test(value)) {
|
|
27
|
+
throw new TypeError('Class icon SVG must contain a visible vector element.');
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
function lucide(icon) {
|
|
32
|
+
let source;
|
|
33
|
+
try {
|
|
34
|
+
source = buildLucideSvg(icon, { color: 'currentColor' });
|
|
35
|
+
}
|
|
36
|
+
catch (cause) {
|
|
37
|
+
throw new TypeError('Class icon must be valid Lucide icon data.', { cause });
|
|
38
|
+
}
|
|
39
|
+
return svg(source);
|
|
40
|
+
}
|
|
41
|
+
/** Framework-neutral constructors for canonical Node Class icons. */
|
|
42
|
+
export const classIcon = Object.freeze({
|
|
43
|
+
neutral: svg(NEUTRAL_CLASS_ICON_SVG),
|
|
44
|
+
svg,
|
|
45
|
+
lucide,
|
|
46
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type DeclaredErrorFamily = 'VALIDATION_ERROR' | 'NOT_FOUND' | 'CONFLICT' | 'UNSUPPORTED';
|
|
3
|
+
export interface DeclaredErrorDefinition<out Details extends z.ZodType = z.ZodType> {
|
|
4
|
+
readonly family: DeclaredErrorFamily;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly details: Details;
|
|
7
|
+
}
|
|
8
|
+
/** Declare a reusable business-error contract. Its registration key supplies the code. */
|
|
9
|
+
export declare function error<const Definition extends DeclaredErrorDefinition>(definition: Definition & Record<Exclude<keyof Definition, keyof DeclaredErrorDefinition>, never>): Readonly<Definition>;
|
|
10
|
+
/** Shared admission for Schema declarations and Action/Workflow registration. */
|
|
11
|
+
export declare function acceptErrorDefinition(input: unknown, label?: string): DeclaredErrorDefinition;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const MAXIMUM_MESSAGE_BYTES = 512;
|
|
3
|
+
const FAMILIES = new Set([
|
|
4
|
+
'VALIDATION_ERROR',
|
|
5
|
+
'NOT_FOUND',
|
|
6
|
+
'CONFLICT',
|
|
7
|
+
'UNSUPPORTED',
|
|
8
|
+
]);
|
|
9
|
+
/** Declare a reusable business-error contract. Its registration key supplies the code. */
|
|
10
|
+
export function error(definition) {
|
|
11
|
+
return acceptErrorDefinition(definition);
|
|
12
|
+
}
|
|
13
|
+
/** Shared admission for Schema declarations and Action/Workflow registration. */
|
|
14
|
+
export function acceptErrorDefinition(input, label = 'Error declaration') {
|
|
15
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
16
|
+
throw new TypeError(`${label} is invalid.`);
|
|
17
|
+
}
|
|
18
|
+
const candidate = input;
|
|
19
|
+
if (Reflect.ownKeys(candidate).length !== 3 ||
|
|
20
|
+
!Object.hasOwn(candidate, 'family') ||
|
|
21
|
+
!Object.hasOwn(candidate, 'message') ||
|
|
22
|
+
!Object.hasOwn(candidate, 'details')) {
|
|
23
|
+
throw new TypeError(`${label} is invalid.`);
|
|
24
|
+
}
|
|
25
|
+
const { family, message, details } = candidate;
|
|
26
|
+
if (!FAMILIES.has(family) ||
|
|
27
|
+
typeof message !== 'string' ||
|
|
28
|
+
message.trim() === '' ||
|
|
29
|
+
new TextEncoder().encode(message).byteLength > MAXIMUM_MESSAGE_BYTES ||
|
|
30
|
+
!(details instanceof z.ZodType)) {
|
|
31
|
+
throw new TypeError(`${label} is invalid.`);
|
|
32
|
+
}
|
|
33
|
+
return Object.freeze({ family: family, message, details });
|
|
34
|
+
}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
/** Canonical Schema authoring, compilation, loading, and resolved Domain surface. */
|
|
2
2
|
export * from '@astrale-os/kernel-dsl/v1';
|
|
3
|
+
export { defineSchema } from './schema-authoring.js';
|
|
4
|
+
export type { AuthoredSchema, AuthoredDomain } from './schema-authoring.js';
|
|
5
|
+
export { stateProperty } from './state-property.js';
|
|
6
|
+
export type { StateProperty } from './state-property.js';
|
|
7
|
+
export { property } from './property.js';
|
|
8
|
+
export type { AuthoredProperty, PropertyOptions } from './property.js';
|
|
3
9
|
export { patterns } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
4
|
-
export
|
|
10
|
+
export { defineClass, nodeClass } from './class-authoring.js';
|
|
11
|
+
export type { AuthoredNodeClass, NodeClassInput } from './class-authoring.js';
|
|
12
|
+
export { error } from './error.js';
|
|
13
|
+
export type { DeclaredErrorDefinition, DeclaredErrorFamily } from './error.js';
|
|
14
|
+
export { classIcon } from './class-icon.js';
|
|
15
|
+
export type { ClassIcon } from './class-icon.js';
|
|
16
|
+
export type { CallablePolicyBuilder, CallablePolicyContext, CallableProjection, AuthoredMethodProjection, AuthoredPropertyProjection, ClassIdentityProjection, ClassOwnerProjection, CoreEdge, CoreEndpoint, CoreNode, DefinedSchema, DirectedEdgeClass, ClassReferenceProjection, ClassProjection, FunctionProjection, EdgeClass, Function, Method, MethodProjection, Lazy, NodeClass, Policy, PolicyExistsContext, PolicyNodeBinder, PolicyPatternContext, Property, PropertyProjection, ResolvedDomainOfInput, View, } from '@astrale-os/kernel-dsl/v1/builder';
|
|
5
17
|
export type { Array, Object, Value } from '@astrale-os/kernel-dsl/value';
|
|
6
|
-
export type { ClassKind, DirectedEdgeContract, EdgeClassPolicies, NodeClassDefinition, PolicyCheckObject, PropertyFacet, UndirectedEdgeContract, } from '@astrale-os/kernel-dsl/v1/language';
|
|
18
|
+
export type { ClassKind, DirectedEdgeContract, EdgeClassPolicies, NodeClassDefinition, PolicyCheckObject, PolicyObjectRef, PropertyFacet, StateTopology, UndirectedEdgeContract, } from '@astrale-os/kernel-dsl/v1/language';
|
|
7
19
|
export type { DomainSchema } from '@astrale-os/kernel-dsl/v1/schema';
|
|
8
20
|
/** Kernel-owned Schema values used by authored product Schemas and graph operations. */
|
|
9
|
-
export { AuthorityOperationOrder, AuthorityOperations, AuthorityRelations,
|
|
10
|
-
export type { AuthorityOperation, AuthorityRelation
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* The SDK-owned interface also gives downstream declaration emit a portable public type name.
|
|
15
|
-
*/
|
|
16
|
-
export interface KernelSchema extends CoreKernelSchema {
|
|
17
|
-
}
|
|
18
|
-
export declare const KernelSchema: KernelSchema;
|
|
21
|
+
export { AuthorityOperationOrder, AuthorityOperations, AuthorityRelations, KernelRootFunctions, OperationCore, operationOf, } from '@astrale-os/kernel-core/schema';
|
|
22
|
+
export type { AuthorityOperation, AuthorityRelation } from '@astrale-os/kernel-core/schema';
|
|
23
|
+
export { K, KernelSchema } from './kernel.js';
|
|
24
|
+
export type { Kernel, KernelClass, KernelDomain } from './kernel.js';
|
|
25
|
+
export { nodeId } from './node-id.js';
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { KernelSchema as CoreKernelSchema } from '@astrale-os/kernel-core/schema';
|
|
2
1
|
/** Canonical Schema authoring, compilation, loading, and resolved Domain surface. */
|
|
3
|
-
import { schema as language } from '@astrale-os/kernel-dsl/v1';
|
|
4
2
|
export * from '@astrale-os/kernel-dsl/v1';
|
|
3
|
+
export { defineSchema } from './schema-authoring.js';
|
|
4
|
+
export { stateProperty } from './state-property.js';
|
|
5
|
+
export { property } from './property.js';
|
|
5
6
|
export { patterns } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
7
|
+
export { defineClass, nodeClass } from './class-authoring.js';
|
|
8
|
+
export { error } from './error.js';
|
|
9
|
+
export { classIcon } from './class-icon.js';
|
|
6
10
|
/** Kernel-owned Schema values used by authored product Schemas and graph operations. */
|
|
7
|
-
export { AuthorityOperationOrder, AuthorityOperations, AuthorityRelations,
|
|
8
|
-
export
|
|
11
|
+
export { AuthorityOperationOrder, AuthorityOperations, AuthorityRelations, KernelRootFunctions, OperationCore, operationOf, } from '@astrale-os/kernel-core/schema';
|
|
12
|
+
export { K, KernelSchema } from './kernel.js';
|
|
13
|
+
export { nodeId } from './node-id.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ResolvedClass } from '@astrale-os/kernel-dsl/v1';
|
|
2
|
+
import type { DefinedSchema } from '@astrale-os/kernel-dsl/v1/builder';
|
|
3
|
+
import { KernelSchema as CoreKernelSchema } from '@astrale-os/kernel-core/schema';
|
|
4
|
+
import { schema } from '@astrale-os/kernel-dsl/v1';
|
|
5
|
+
type KernelClasses = schema.DomainOf<CoreKernelSchema>['classes'];
|
|
6
|
+
/** A Kernel Class retains its canonical name instead of copying its resolved collections. */
|
|
7
|
+
export interface KernelClass<Name extends keyof KernelClasses> extends Pick<KernelClasses[Name], keyof ResolvedClass> {
|
|
8
|
+
readonly key: `${CoreKernelSchema['origin']}:class.${Name}`;
|
|
9
|
+
}
|
|
10
|
+
/** The canonical Kernel Domain with reusable Class references. */
|
|
11
|
+
export interface KernelDomain extends schema.DomainOf<CoreKernelSchema> {
|
|
12
|
+
readonly classes: {
|
|
13
|
+
readonly [Name in keyof KernelClasses]: KernelClass<Name>;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** SDK-owned portable name for the Kernel Schema's exact contract. */
|
|
17
|
+
export interface KernelSchema extends DefinedSchema<CoreKernelSchema['origin'], KernelDomain> {
|
|
18
|
+
}
|
|
19
|
+
export declare const KernelSchema: KernelSchema;
|
|
20
|
+
export declare const K: schema.ResolvedDomainOf<KernelSchema>;
|
|
21
|
+
export type Kernel = typeof K;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { K as CoreKernel, KernelSchema as CoreKernelSchema } from '@astrale-os/kernel-core/schema';
|
|
2
|
+
import { schema } from '@astrale-os/kernel-dsl/v1';
|
|
3
|
+
// Admission belongs to the SDK's DSL instance, even when Core uses a different package instance.
|
|
4
|
+
export const KernelSchema = schema.accept(CoreKernelSchema);
|
|
5
|
+
export const K = CoreKernel;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { fullMatch } from '@astrale-os/kernel-dsl/v1';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/** Bare Kernel node identity. Does not assert existence, Class, or authority. */
|
|
4
|
+
export function nodeId() {
|
|
5
|
+
return z.string().min(1).max(255).check(fullMatch('[A-Za-z0-9._-]+'));
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Property as CanonicalProperty, type ValueSchemaInput } from '@astrale-os/kernel-dsl/v1/builder';
|
|
2
|
+
/** Stable SDK-owned options for ordinary Schema properties. */
|
|
3
|
+
export interface PropertyOptions {
|
|
4
|
+
readonly required?: boolean;
|
|
5
|
+
readonly description?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Keep canonical generic inference: ordinary properties carry no state machine. */
|
|
8
|
+
export type AuthoredProperty<Schema extends ValueSchemaInput, Options extends PropertyOptions = Record<never, never>> = CanonicalProperty<Schema, Options, never>;
|
|
9
|
+
/** Canonical property authoring with a portable inferred return type. */
|
|
10
|
+
export declare const property: <const Schema extends ValueSchemaInput, const Options extends PropertyOptions = Record<never, never>>(schema: Schema, options?: Options) => AuthoredProperty<Schema, {
|
|
11
|
+
[Key in keyof Options]: Options[Key];
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { DefinedSchema, ResolvedDomainOfInput } from '@astrale-os/kernel-dsl/v1/builder';
|
|
2
|
+
import type { DomainSchema } from '@astrale-os/kernel-dsl/v1/schema';
|
|
3
|
+
import { defineSchema as kernelDefineSchema } from '@astrale-os/kernel-dsl/v1';
|
|
4
|
+
type DomainSchemaInput = Parameters<typeof kernelDefineSchema>[1];
|
|
5
|
+
declare const authoredGraph: unique symbol;
|
|
6
|
+
/** Opaque legacy Schemas retain their witness; SDK Schemas retain authored input and edges. */
|
|
7
|
+
type Entry = readonly [origin: string, schema: DomainSchema] | readonly [
|
|
8
|
+
origin: string,
|
|
9
|
+
input: DomainSchemaInput,
|
|
10
|
+
dependencies: Readonly<Record<string, string>>
|
|
11
|
+
];
|
|
12
|
+
type Dependencies<Input> = 'dependencies' extends keyof Input ? NonNullable<Input['dependencies']> : {};
|
|
13
|
+
type GraphOf<Schema> = typeof authoredGraph extends keyof Schema ? Schema[typeof authoredGraph] extends infer Graph ? Graph extends Entry ? Graph : never : never : Schema extends DomainSchema<infer Origin> ? readonly [Origin, Schema] : never;
|
|
14
|
+
type GraphOfInput<Origin extends string, Input extends DomainSchemaInput> = readonly [
|
|
15
|
+
Origin,
|
|
16
|
+
{
|
|
17
|
+
readonly [Key in keyof Input as Exclude<Key, 'dependencies'>]: Input[Key];
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
readonly [Alias in keyof Dependencies<Input>]: Dependencies<Input>[Alias] extends DomainSchema<infer DependencyOrigin> ? DependencyOrigin : never;
|
|
21
|
+
}
|
|
22
|
+
] | {
|
|
23
|
+
[Alias in keyof Dependencies<Input>]: GraphOf<Dependencies<Input>[Alias]>;
|
|
24
|
+
}[keyof Dependencies<Input>];
|
|
25
|
+
type LastEntry<Graph> = (Graph extends unknown ? (entry: () => Graph) => void : never) extends (entry: infer Intersection) => void ? Intersection extends () => infer Last ? Last : never : never;
|
|
26
|
+
type WithoutEquivalent<Graph, Selected> = Graph extends Selected ? Selected extends Graph ? never : Graph : Graph;
|
|
27
|
+
type UniqueEntries<Graph, Selected = LastEntry<Graph>> = [Graph] extends [never] ? never : Selected | UniqueEntries<WithoutEquivalent<Graph, Selected>>;
|
|
28
|
+
type InputOf<Origin extends string, Graph extends Entry> = Extract<Graph, readonly [Origin, DomainSchemaInput, Readonly<Record<string, string>>]> extends readonly [
|
|
29
|
+
string,
|
|
30
|
+
infer Input extends DomainSchemaInput,
|
|
31
|
+
infer Dependencies extends Readonly<Record<string, string>>
|
|
32
|
+
] ? Input & {
|
|
33
|
+
readonly dependencies: {
|
|
34
|
+
readonly [Alias in keyof Dependencies]: SchemaOf<Dependencies[Alias], Graph>;
|
|
35
|
+
};
|
|
36
|
+
} : never;
|
|
37
|
+
type SchemaOf<Origin extends string, Graph extends Entry> = Extract<Graph, readonly [Origin, DomainSchema]> extends infer Legacy ? [Legacy] extends [never] ? AuthoredSchema<Origin, Graph> : Legacy extends readonly [string, infer Schema extends DomainSchema] ? Schema : never : never;
|
|
38
|
+
/** Resolve a dependency graph without expanding a shared Schema at each dependency edge. */
|
|
39
|
+
export interface AuthoredDomain<Origin extends string, Graph extends Entry> extends ResolvedDomainOfInput<Origin, InputOf<Origin, Graph>> {
|
|
40
|
+
}
|
|
41
|
+
/** A Schema retains each transitive author's input once, with dependency edges represented by origin. */
|
|
42
|
+
export interface AuthoredSchema<Origin extends string, Graph extends Entry> extends DefinedSchema<Origin, AuthoredDomain<Origin, Graph>> {
|
|
43
|
+
readonly [authoredGraph]?: Graph;
|
|
44
|
+
}
|
|
45
|
+
type DefineSchema = <const Origin extends string, const Input extends DomainSchemaInput>(origin: Origin, input: Input) => string extends Origin | Extract<Dependencies<Input>[keyof Dependencies<Input>], DomainSchema>['origin'] ? DefinedSchema<Origin, ResolvedDomainOfInput<Origin, Input>> : AuthoredSchema<Origin, Extract<UniqueEntries<GraphOfInput<Origin, Input>>, Entry>>;
|
|
46
|
+
/** The canonical implementation with a portable, automatically inferred declaration. */
|
|
47
|
+
export declare const defineSchema: DefineSchema;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StateMachine } from '@astrale-os/kernel-dsl/v1/language/state';
|
|
2
|
+
import { stateProperty as canonicalStateProperty, type PropertyOptions } from '@astrale-os/kernel-dsl/v1/builder';
|
|
3
|
+
type StatePropertyOptions = Omit<PropertyOptions, 'required'>;
|
|
4
|
+
/** Keep the machine's internal Zod schemas behind a portable public property handle. */
|
|
5
|
+
export interface StateProperty<Machine extends StateMachine, Options extends StatePropertyOptions = Record<never, never>> extends ReturnType<typeof canonicalStateProperty<Machine, Options>> {
|
|
6
|
+
}
|
|
7
|
+
/** Canonical state-property authoring with a portable inferred return type. */
|
|
8
|
+
export declare const stateProperty: <const Machine extends StateMachine, const Options extends StatePropertyOptions = Record<never, never>>(machine: Machine, options?: Options & Record<Exclude<keyof Options, 'description'>, never>) => StateProperty<Machine, {
|
|
9
|
+
[Key in keyof Options]: Options[Key];
|
|
10
|
+
}>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isLegacyDeployment } from '../deployment/deploy.js';
|
|
2
|
+
import { isProject } from './define.js';
|
|
3
|
+
export const PROJECT_EXPORT_HINT = 'astrale.config.ts must export exactly one default Project:\n' +
|
|
4
|
+
" import { defineProject } from '@astrale-os/sdk/project'\n" +
|
|
5
|
+
' export default defineProject({ application, environments: { development: { deployment: adapter() } } })\n';
|
|
6
|
+
/** Admit the module namespace of one loaded `astrale.config.ts`: exactly one default Project. */
|
|
7
|
+
export function admitProjectModule(loaded) {
|
|
8
|
+
if (loaded === null ||
|
|
9
|
+
typeof loaded !== 'object' ||
|
|
10
|
+
Array.isArray(loaded) ||
|
|
11
|
+
!Object.hasOwn(loaded, 'default') ||
|
|
12
|
+
Object.keys(loaded).some((key) => key !== 'default')) {
|
|
13
|
+
throw new TypeError(PROJECT_EXPORT_HINT);
|
|
14
|
+
}
|
|
15
|
+
const value = Reflect.get(loaded, 'default');
|
|
16
|
+
if (isProject(value))
|
|
17
|
+
return value;
|
|
18
|
+
if (isLegacyDeployment(value)) {
|
|
19
|
+
throw new TypeError(`astrale.config.ts exports the legacy deploy() aggregate; migrate Application and Environments into defineProject().\n${PROJECT_EXPORT_HINT}`);
|
|
20
|
+
}
|
|
21
|
+
throw new TypeError(`Default export must be created by defineProject().\n${PROJECT_EXPORT_HINT}`);
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ApplicationIdentity } from '../application/index.js';
|
|
2
|
+
import type { Tests } from '../testing/index.js';
|
|
3
|
+
import type { Project, ProjectEnvironment, ProjectEntrypoints } from './project.js';
|
|
4
|
+
export interface ProjectInput<ApplicationValue extends ApplicationIdentity, EnvironmentsValue extends Readonly<Record<string, ProjectEnvironment>>, TestsValue extends Tests | undefined> {
|
|
5
|
+
readonly application: ApplicationValue;
|
|
6
|
+
readonly environments: EnvironmentsValue;
|
|
7
|
+
readonly entrypoints?: ProjectEntrypoints;
|
|
8
|
+
readonly tests?: TestsValue;
|
|
9
|
+
}
|
|
10
|
+
/** Capture one inert Project definition without loading entrypoints or performing effects. */
|
|
11
|
+
export declare function defineProject<const ApplicationValue extends ApplicationIdentity, const EnvironmentsValue extends Readonly<Record<string, ProjectEnvironment>>, const TestsValue extends Tests | undefined = undefined>(input: ProjectInput<ApplicationValue, EnvironmentsValue, TestsValue>): Project<ApplicationValue, EnvironmentsValue, TestsValue>;
|
|
12
|
+
export declare function isProject(input: unknown): input is Project;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { isApplication } from '../application/index.js';
|
|
2
|
+
import { isDeployment } from '../deployment/deployment.js';
|
|
3
|
+
import { isTests } from '../testing/index.js';
|
|
4
|
+
const admittedProjects = new WeakSet();
|
|
5
|
+
const ENVIRONMENT_NAME = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/u;
|
|
6
|
+
/** Capture one inert Project definition without loading entrypoints or performing effects. */
|
|
7
|
+
export function defineProject(input) {
|
|
8
|
+
const value = record(input, 'Project definition');
|
|
9
|
+
exact(value, ['application', 'environments'], ['entrypoints', 'tests'], invalid);
|
|
10
|
+
if (!isApplication(input.application))
|
|
11
|
+
throw new TypeError('Project Application is not admitted.');
|
|
12
|
+
const environments = record(input.environments, 'Project environments');
|
|
13
|
+
if (Reflect.ownKeys(environments).some((key) => typeof key !== 'string')) {
|
|
14
|
+
throw new TypeError('Project Environment names must be strings.');
|
|
15
|
+
}
|
|
16
|
+
const names = Object.keys(environments);
|
|
17
|
+
if (names.length === 0)
|
|
18
|
+
throw new TypeError('Project must declare at least one Environment.');
|
|
19
|
+
const captured = Object.create(null);
|
|
20
|
+
for (const name of names) {
|
|
21
|
+
if (!ENVIRONMENT_NAME.test(name)) {
|
|
22
|
+
throw new TypeError(`Project Environment name "${name}" is not normalized.`);
|
|
23
|
+
}
|
|
24
|
+
const environment = record(environments[name], `Project Environment ${name}`);
|
|
25
|
+
exact(environment, ['deployment'], ['installation'], () => invalidEnvironment(name));
|
|
26
|
+
if (!isDeployment(environment.deployment)) {
|
|
27
|
+
throw new TypeError(`Project Environment ${name} deployment is not admitted.`);
|
|
28
|
+
}
|
|
29
|
+
const installation = environment.installation === undefined
|
|
30
|
+
? undefined
|
|
31
|
+
: admitInstallation(environment.installation, name);
|
|
32
|
+
environment.deployment.adapter.admit?.(environment.deployment.parameters, {
|
|
33
|
+
environment: name,
|
|
34
|
+
...(installation === undefined ? {} : { installation }),
|
|
35
|
+
});
|
|
36
|
+
captured[name] = Object.freeze({
|
|
37
|
+
deployment: environment.deployment,
|
|
38
|
+
...(installation === undefined ? {} : { installation }),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const entrypoints = input.entrypoints === undefined ? undefined : admitEntrypoints(input.entrypoints);
|
|
42
|
+
if (input.tests !== undefined && !isTests(input.tests)) {
|
|
43
|
+
throw new TypeError('Project tests must be created by tests().');
|
|
44
|
+
}
|
|
45
|
+
const project = Object.freeze({
|
|
46
|
+
kind: 'project',
|
|
47
|
+
application: input.application,
|
|
48
|
+
environments: Object.freeze(captured),
|
|
49
|
+
...(entrypoints === undefined ? {} : { entrypoints }),
|
|
50
|
+
...(input.tests === undefined ? {} : { tests: input.tests }),
|
|
51
|
+
});
|
|
52
|
+
admittedProjects.add(project);
|
|
53
|
+
return project;
|
|
54
|
+
}
|
|
55
|
+
export function isProject(input) {
|
|
56
|
+
return input !== null && typeof input === 'object' && admittedProjects.has(input);
|
|
57
|
+
}
|
|
58
|
+
function admitEntrypoints(input) {
|
|
59
|
+
const value = record(input, 'Project entrypoints');
|
|
60
|
+
exact(value, ['runtime'], [], () => {
|
|
61
|
+
throw new TypeError('Project entrypoints must contain exactly runtime.');
|
|
62
|
+
});
|
|
63
|
+
if (typeof input.runtime !== 'string' ||
|
|
64
|
+
input.runtime.length === 0 ||
|
|
65
|
+
input.runtime.trim() !== input.runtime ||
|
|
66
|
+
input.runtime.includes('\0')) {
|
|
67
|
+
throw new TypeError('Project Runtime entrypoint must be a non-empty stable module coordinate.');
|
|
68
|
+
}
|
|
69
|
+
return Object.freeze({ runtime: input.runtime });
|
|
70
|
+
}
|
|
71
|
+
function admitInstallation(input, environment) {
|
|
72
|
+
const value = record(input, `Project Environment ${environment} installation`);
|
|
73
|
+
exact(value, ['instance'], ['identity'], () => {
|
|
74
|
+
throw new TypeError(`Project Environment ${environment} installation may contain only instance and identity.`);
|
|
75
|
+
});
|
|
76
|
+
const instance = stableCoordinate(value.instance, 'installation instance');
|
|
77
|
+
const identity = value.identity === undefined
|
|
78
|
+
? undefined
|
|
79
|
+
: stableCoordinate(value.identity, 'installation identity');
|
|
80
|
+
return Object.freeze({ instance, ...(identity === undefined ? {} : { identity }) });
|
|
81
|
+
}
|
|
82
|
+
function stableCoordinate(input, label) {
|
|
83
|
+
if (typeof input !== 'string' || input.length === 0 || input.trim() !== input) {
|
|
84
|
+
throw new TypeError(`Project ${label} must be a non-empty stable string.`);
|
|
85
|
+
}
|
|
86
|
+
return input;
|
|
87
|
+
}
|
|
88
|
+
function record(input, label) {
|
|
89
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
90
|
+
throw new TypeError(`${label} must be an object.`);
|
|
91
|
+
}
|
|
92
|
+
return input;
|
|
93
|
+
}
|
|
94
|
+
function exact(input, required, optional, fail) {
|
|
95
|
+
const allowed = new Set([...required, ...optional]);
|
|
96
|
+
if (required.some((key) => !Object.hasOwn(input, key)) ||
|
|
97
|
+
Reflect.ownKeys(input).some((key) => !allowed.has(key))) {
|
|
98
|
+
fail();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function invalid() {
|
|
102
|
+
throw new TypeError('Project definition may contain only application, environments, entrypoints, and tests.');
|
|
103
|
+
}
|
|
104
|
+
function invalidEnvironment(name) {
|
|
105
|
+
throw new TypeError(`Project Environment ${name} may contain only deployment and installation.`);
|
|
106
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { admitProjectModule, PROJECT_EXPORT_HINT } from './admit.js';
|
|
2
|
+
export { defineProject, isProject } from './define.js';
|
|
3
|
+
export type { ProjectInput } from './define.js';
|
|
4
|
+
export type { ApplicationOfProject, EnvironmentsOfProject, Project, ProjectEntrypoints, ProjectEnvironment, } from './project.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ApplicationIdentity } from '../application/index.js';
|
|
2
|
+
import type { InstallationTarget } from '../deployment/adapter/index.js';
|
|
3
|
+
import type { Tests } from '../testing/index.js';
|
|
4
|
+
export interface ProjectEntrypoints {
|
|
5
|
+
readonly runtime: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ProjectEnvironment<DeploymentValue = unknown> {
|
|
8
|
+
readonly deployment: DeploymentValue;
|
|
9
|
+
readonly installation?: InstallationTarget;
|
|
10
|
+
}
|
|
11
|
+
/** The complete independently executable software-product definition in astrale.config.ts. */
|
|
12
|
+
export interface Project<ApplicationValue extends ApplicationIdentity = ApplicationIdentity, EnvironmentsValue extends Readonly<Record<string, ProjectEnvironment>> = Readonly<Record<string, ProjectEnvironment>>, TestsValue extends Tests | undefined = undefined> {
|
|
13
|
+
readonly kind: 'project';
|
|
14
|
+
readonly application: ApplicationValue;
|
|
15
|
+
readonly environments: EnvironmentsValue;
|
|
16
|
+
readonly entrypoints?: ProjectEntrypoints;
|
|
17
|
+
readonly tests?: TestsValue;
|
|
18
|
+
}
|
|
19
|
+
export type ApplicationOfProject<Value> = Value extends {
|
|
20
|
+
readonly application: infer ApplicationValue;
|
|
21
|
+
} ? Extract<ApplicationValue, ApplicationIdentity> : never;
|
|
22
|
+
export type EnvironmentsOfProject<Value> = Value extends {
|
|
23
|
+
readonly environments: infer EnvironmentsValue;
|
|
24
|
+
} ? EnvironmentsValue : never;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GraphAdmissionContext, GraphData, GraphDiagnostic } from '../../platform/graph/document/index.js';
|
|
2
|
+
import type { Domain } from '../../platform/schema/index.js';
|
|
3
|
+
import { Graph } from '../../platform/graph/document/index.js';
|
|
4
|
+
export declare class DatasetAdmissionError extends TypeError {
|
|
5
|
+
readonly dataset: string;
|
|
6
|
+
readonly diagnostics: readonly GraphDiagnostic[];
|
|
7
|
+
readonly code: 'DATASET_REJECTED';
|
|
8
|
+
constructor(dataset: string, diagnostics: readonly GraphDiagnostic[]);
|
|
9
|
+
}
|
|
10
|
+
/** Admit Dataset facts through the canonical Kernel Graph admission over the resolved Domain. */
|
|
11
|
+
export declare function admitDatasetGraph(id: string, domain: Domain, data: GraphData): Graph;
|
|
12
|
+
/** Project one resolved Domain closure into the Class knowledge Graph admission requires. */
|
|
13
|
+
export declare function admissionContext(domain: Domain): GraphAdmissionContext;
|