@astrale-os/kernel-dsl 1.0.0-beta.26 → 1.0.0-beta.28

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.
Files changed (96) hide show
  1. package/dist/v1/addressing/ordering.d.ts +2 -2
  2. package/dist/v1/addressing/ordering.js +2 -4
  3. package/dist/v1/builder/index.d.ts +2 -0
  4. package/dist/v1/builder/index.js +1 -0
  5. package/dist/v1/builder/lowering/schema/compile.js +2 -0
  6. package/dist/v1/builder/schema/input.d.ts +3 -0
  7. package/dist/v1/builder/schema/rule.d.ts +316 -0
  8. package/dist/v1/builder/schema/rule.js +192 -0
  9. package/dist/v1/bundle/index.d.ts +2 -0
  10. package/dist/v1/bundle/index.js +1 -0
  11. package/dist/v1/bundle/rule.d.ts +14 -0
  12. package/dist/v1/bundle/rule.js +41 -0
  13. package/dist/v1/compiled/admission/diagnostic.d.ts +14 -0
  14. package/dist/v1/compiled/admission/diagnostic.js +6 -0
  15. package/dist/v1/compiled/admission/revision.js +1 -0
  16. package/dist/v1/compiled/admission/semantics/policy/callable.js +2 -3
  17. package/dist/v1/compiled/admission/semantics/policy/parity.js +8 -13
  18. package/dist/v1/compiled/admission/semantics/policy/pattern.js +3 -5
  19. package/dist/v1/compiled/admission/wire/entry.js +29 -1
  20. package/dist/v1/compiled/admission/wire/policy.js +16 -11
  21. package/dist/v1/compiled/compiler/compile.js +1 -0
  22. package/dist/v1/compiled/index.d.ts +2 -0
  23. package/dist/v1/compiled/index.js +1 -0
  24. package/dist/v1/compiled/model/schema.d.ts +3 -0
  25. package/dist/v1/compiled/rule.d.ts +49 -0
  26. package/dist/v1/compiled/rule.js +169 -0
  27. package/dist/v1/index.d.ts +1 -0
  28. package/dist/v1/language/callable/admission.js +2 -1
  29. package/dist/v1/language/definition/metadata.d.ts +33 -0
  30. package/dist/v1/language/definition/metadata.js +44 -0
  31. package/dist/v1/language/policy/analysis/branches.js +6 -7
  32. package/dist/v1/language/policy/analysis/budgets.js +8 -6
  33. package/dist/v1/language/policy/analysis/checks.js +5 -4
  34. package/dist/v1/language/policy/analysis/composition.js +2 -2
  35. package/dist/v1/language/policy/analysis/typing.js +3 -2
  36. package/dist/v1/language/policy/model/policy.d.ts +22 -0
  37. package/dist/v1/language/policy/model/policy.js +28 -4
  38. package/dist/v1/language/policy/normalization/normalize.js +33 -56
  39. package/dist/v1/language/value/evaluate/assertions.d.ts +2 -2
  40. package/dist/v1/language/value/evaluate/assertions.js +4 -34
  41. package/dist/v1/language/value/evaluate/evaluator.js +10 -15
  42. package/dist/v1/language/value/evaluate/validity.optimization.js +9 -14
  43. package/dist/v1/language/value/files.js +2 -1
  44. package/dist/v1/language/value/ordering.js +1 -3
  45. package/dist/v1/language/value/profile/canonicalize.js +1 -3
  46. package/dist/v1/language/value/syntax/walk.d.ts +2 -0
  47. package/dist/v1/language/value/syntax/walk.js +4 -0
  48. package/dist/v1/schema/.spec/schemas/domain-schema.schema.json +36 -0
  49. package/dist/v1/schema/compatibility/api.d.ts +2 -0
  50. package/dist/v1/schema/compatibility/api.js +1 -0
  51. package/dist/v1/schema/compatibility/rule.d.ts +13 -0
  52. package/dist/v1/schema/compatibility/rule.js +23 -0
  53. package/dist/v1/schema/diagnostic.d.ts +1 -1
  54. package/dist/v1/schema/enforcement/changes.d.ts +590 -0
  55. package/dist/v1/schema/enforcement/changes.js +566 -0
  56. package/dist/v1/schema/enforcement/derived.d.ts +236 -0
  57. package/dist/v1/schema/enforcement/derived.js +243 -0
  58. package/dist/v1/schema/enforcement/dispose.d.ts +308 -0
  59. package/dist/v1/schema/enforcement/dispose.js +275 -0
  60. package/dist/v1/schema/enforcement/facts.d.ts +89 -0
  61. package/dist/v1/schema/enforcement/facts.js +70 -0
  62. package/dist/v1/schema/enforcement/fields.d.ts +65 -0
  63. package/dist/v1/schema/enforcement/fields.js +36 -0
  64. package/dist/v1/schema/enforcement/index.d.ts +39 -0
  65. package/dist/v1/schema/enforcement/index.js +10 -0
  66. package/dist/v1/schema/enforcement/install.d.ts +1634 -0
  67. package/dist/v1/schema/enforcement/install.js +1223 -0
  68. package/dist/v1/schema/enforcement/lifecycle.d.ts +87 -0
  69. package/dist/v1/schema/enforcement/lifecycle.js +91 -0
  70. package/dist/v1/schema/enforcement/model.d.ts +253 -0
  71. package/dist/v1/schema/enforcement/model.js +1 -0
  72. package/dist/v1/schema/enforcement/obligations.d.ts +248 -0
  73. package/dist/v1/schema/enforcement/obligations.js +240 -0
  74. package/dist/v1/schema/enforcement/write.d.ts +1314 -0
  75. package/dist/v1/schema/enforcement/write.js +1017 -0
  76. package/dist/v1/schema/index.d.ts +1 -0
  77. package/dist/v1/schema/index.js +1 -0
  78. package/dist/v1/schema/model/schema.d.ts +3 -0
  79. package/dist/v1/schema/normalization/domain.js +13 -0
  80. package/dist/v1/schema/resolution/origins.js +4 -7
  81. package/dist/v1/schema/rule.d.ts +6 -7
  82. package/dist/v1/schema/rule.js +25 -13
  83. package/dist/v1/schema/validation/domain.js +2 -0
  84. package/dist/v1/schema/validation/domain.structure.d.ts +14 -0
  85. package/dist/v1/schema/validation/domain.structure.js +15 -0
  86. package/dist/v1/schema/validation/icon.d.ts +4 -0
  87. package/dist/v1/schema/validation/icon.js +29 -0
  88. package/dist/v1/schema/validation/policy/references.js +5 -11
  89. package/dist/v1/schema/validation/policy/uses.js +3 -8
  90. package/dist/value/canonical.d.ts +16 -1
  91. package/dist/value/canonical.js +90 -33
  92. package/dist/value/index.d.ts +2 -0
  93. package/dist/value/index.js +1 -0
  94. package/dist/value/rule.d.ts +12 -0
  95. package/dist/value/rule.js +50 -0
  96. package/package.json +5 -1
@@ -1,6 +1,7 @@
1
1
  import { runSuspended } from '../suspended.js';
2
2
  import { loadValueProgram } from './compile/load.js';
3
3
  import { prepareValueSchema } from './evaluate/preparation.js';
4
+ import { schemaList } from './syntax/walk.js';
4
5
  const ALL_JSON_KINDS = new Set([
5
6
  'null',
6
7
  'boolean',
@@ -234,6 +235,3 @@ function normalize(input) {
234
235
  input.delete('set');
235
236
  return input;
236
237
  }
237
- function schemaList(input) {
238
- return Array.isArray(input) ? input : undefined;
239
- }
@@ -2,6 +2,7 @@ import { json } from '@astrale-os/kernel-dsl/value';
2
2
  import { compareDefinitionRefs, compareUnicode } from '../../../addressing/ordering.js';
3
3
  import { isValueObject as isJsonObject } from '../model/object.js';
4
4
  import { SCHEMA_ARRAY_KEYWORDS, SCHEMA_MAP_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, } from '../syntax/keywords.js';
5
+ import { isJsonSchema } from '../syntax/walk.js';
5
6
  const TYPE_ORDER = ['null', 'boolean', 'integer', 'number', 'string', 'array', 'object'];
6
7
  const TYPE_RANK = new Map(TYPE_ORDER.map((name, index) => [name, index]));
7
8
  const encoder = new TextEncoder();
@@ -107,6 +108,3 @@ function isComparableRef(value) {
107
108
  typeof value.kind === 'string' &&
108
109
  typeof value.name === 'string');
109
110
  }
110
- function isJsonSchema(value) {
111
- return typeof value === 'boolean' || isJsonObject(value);
112
- }
@@ -15,3 +15,5 @@ export declare function forEachSubschema(keyword: string, value: unknown, pointe
15
15
  export declare function holdsOnlySubschemas(keyword: string, value: unknown): boolean;
16
16
  export declare function collectSchemaPointers(schema: JsonSchema): ReadonlySet<string>;
17
17
  export declare function isJsonSchema(value: unknown): value is JsonSchema;
18
+ /** The subschemas an Array keyword holds, read without checking each item. */
19
+ export declare function schemaList(input: unknown): readonly JsonSchema[] | undefined;
@@ -64,3 +64,7 @@ export function collectSchemaPointers(schema) {
64
64
  export function isJsonSchema(value) {
65
65
  return typeof value === 'boolean' || isJsonObject(value);
66
66
  }
67
+ /** The subschemas an Array keyword holds, read without checking each item. */
68
+ export function schemaList(input) {
69
+ return Array.isArray(input) ? input : undefined;
70
+ }
@@ -118,6 +118,9 @@
118
118
  "name": {
119
119
  "$ref": "#/$defs/domain-name"
120
120
  },
121
+ "icon": {
122
+ "$ref": "#/$defs/domain-icon"
123
+ },
121
124
  "entrypoint": {
122
125
  "$ref": "#/$defs/view-ref"
123
126
  },
@@ -833,6 +836,39 @@
833
836
  ],
834
837
  "additionalProperties": false
835
838
  },
839
+ "domain-icon": {
840
+ "type": "object",
841
+ "properties": {
842
+ "small": {
843
+ "$ref": "#/$defs/domain-icon-art"
844
+ },
845
+ "medium": {
846
+ "$ref": "#/$defs/domain-icon-art"
847
+ },
848
+ "large": {
849
+ "$ref": "#/$defs/domain-icon-art"
850
+ }
851
+ },
852
+ "additionalProperties": false,
853
+ "description": "The presentation icon of the Domain: up to three hand-drawn sizes of inline SVG."
854
+ },
855
+ "domain-icon-art": {
856
+ "type": "object",
857
+ "properties": {
858
+ "svg": {
859
+ "type": "string",
860
+ "minLength": 1
861
+ },
862
+ "dark": {
863
+ "type": "string",
864
+ "minLength": 1
865
+ }
866
+ },
867
+ "required": [
868
+ "svg"
869
+ ],
870
+ "additionalProperties": false
871
+ },
836
872
  "domain-name": {
837
873
  "type": "string",
838
874
  "minLength": 1,
@@ -1,4 +1,6 @@
1
1
  export { compare, compareMeaning, compareStructure } from './compare.js';
2
2
  export { closedParents } from './extension.js';
3
+ export { COMPARISON_RULES as RULES } from './rule.js';
4
+ export type { ComparisonRule as Rule } from './rule.js';
3
5
  export { requiredBump } from './versioning/index.js';
4
6
  export type { Analysis, Assessment, Bump, Comparison, ComparisonEntry, ComparisonEvidence, ComparisonRequest, ComparisonScope, DiagnosticCode, Facet, Fingerprint, MeaningComparison, Observation, RequiredBump, SchemaIdentity, StructureComparison, Subject, Usage, VersionChange, } from './model.js';
@@ -1,3 +1,4 @@
1
1
  export { compare, compareMeaning, compareStructure } from './compare.js';
2
2
  export { closedParents } from './extension.js';
3
+ export { COMPARISON_RULES as RULES } from './rule.js';
3
4
  export { requiredBump } from './versioning/index.js';
@@ -0,0 +1,13 @@
1
+ import type { DiagnosticCode } from './model.js';
2
+ /** The rule one code of a refused comparison request reports. */
3
+ export interface ComparisonRule {
4
+ /** The positions its diagnostics point at, in the request, as the positions of `schema.Rule`. */
5
+ readonly positions: readonly [string, ...string[]];
6
+ /** The rule, in one plain sentence. */
7
+ readonly statement: string;
8
+ }
9
+ /**
10
+ * Every code a comparison request is refused with and the rule it reports, frozen. A code added
11
+ * here does not compile until it is described.
12
+ */
13
+ export declare const COMPARISON_RULES: Readonly<Record<DiagnosticCode, ComparisonRule>>;
@@ -0,0 +1,23 @@
1
+ import { deepFreeze } from '../../language/freeze.js';
2
+ /**
3
+ * Every code a comparison request is refused with and the rule it reports, frozen. A code added
4
+ * here does not compile until it is described.
5
+ */
6
+ export const COMPARISON_RULES = deepFreeze({
7
+ DM_MEMBER_ORIGIN_MISMATCH: {
8
+ positions: ['/target/origin', '/next/origin'],
9
+ statement: 'A member comparison and a required bump compare two versions of one origin.',
10
+ },
11
+ DM_MEMBER_ROOT_INVALID: {
12
+ positions: ['/roots', '/roots/{index}'],
13
+ statement: "The roots of a member comparison are a non-empty list without duplicates of canonical Keys of the source's origin, each of a shape V1 supports and naming a definition of the source under its exact owner.",
14
+ },
15
+ DM_CAPABILITY_INVALID: {
16
+ positions: ['/capabilities', '/capabilities/{index}'],
17
+ statement: 'The capabilities a dependency comparison declares are a list of canonical Keys, each of the target origin naming a Function, Method or Class of the retained source; a Key of another origin is ignored.',
18
+ },
19
+ DM_DEPENDENCY_NOT_RETAINED: {
20
+ positions: ['/target/origin', '/origin'],
21
+ statement: 'A dependency comparison has a target whose origin is in the closure the dependent was accepted with.',
22
+ },
23
+ });
@@ -2,7 +2,7 @@ import type { DiagnosticCode as LanguageDiagnosticCode } from '../language/valid
2
2
  import type { Diagnostic as LanguageDiagnostic } from '../language/validation/diagnostic.js';
3
3
  import type { DiagnosticCode as CompatibilityDiagnosticCode } from './compatibility/model.js';
4
4
  /** The codes a Schema document is refused with, one per rule of `RULES`. */
5
- export type SchemaDiagnosticCode = 'DV_ACCEPTANCE_CONTEXT' | 'DV_CALLABLE_ADMISSION' | 'DV_CALLABLE_AUTH' | 'DV_CALLABLE_IO' | 'DV_CLASS_ABSTRACT' | 'DV_CLASS_ACYCLIC' | 'DV_CLASS_INHERITANCE' | 'DV_CLASS_KIND' | 'DV_CORE_EDGE_CLASS' | 'DV_CORE_EDGE_CONSTRAINTS' | 'DV_CORE_EDGE_KEY' | 'DV_CORE_EDGE_PROPERTIES' | 'DV_CORE_EDGE_UNIQUE' | 'DV_CORE_NODE_CLASS' | 'DV_CORE_NODE_PROPERTIES' | 'DV_CORE_NODE_UNIQUE' | 'DV_CORE_REF' | 'DV_DATA_COMPOSITION' | 'DV_DEPENDENCY_ACYCLIC' | 'DV_DEPENDENCY_DIRECT' | 'DV_DEPENDENCY_EXACT' | 'DV_DEPENDENCY_LIMITS' | 'DV_DEPENDENCY_REVISION_COHERENCE' | 'DV_DEPENDENCY_UNIQUE' | 'DV_EDGE_ACCEPTS' | 'DV_EDGE_CLASS_COMPOSITION' | 'DV_EDGE_FOREIGN_MINIMUM' | 'DV_EDGE_LIFETIME' | 'DV_EDGE_ROLE' | 'DV_EDGE_UNIQUE' | 'DV_ENTRYPOINT' | 'DV_INHERITANCE_LIMITS' | 'DV_JSON_VALUE' | 'DV_METHOD_ABSTRACT' | 'DV_METHOD_COMPOSITION' | 'DV_NODE_UNIQUE' | 'DV_PROPERTY_AUTO' | 'DV_PROPERTY_IMMUTABLE' | 'DV_PROPERTY_STATE' | 'DV_REF_RESOLVES' | 'DV_VALUE_SCHEMA' | 'PL_BUDGET' | 'PL_COMPOSITION' | 'PL_CONNECTIVITY' | 'PL_REF' | 'PL_REPEAT' | 'PL_TARGET' | 'PL_TYPING' | 'PL_USE' | 'PL_VARIABLE_SCOPE' | 'STRUCTURE_BINARY_INPUT' | 'STRUCTURE_CALLABLE_POLICY_AUTH' | 'STRUCTURE_DEPENDENCY_ALIAS' | 'STRUCTURE_DOMAIN_NAME' | 'STRUCTURE_DUPLICATE_ITEM' | 'STRUCTURE_EDGE_BLOB' | 'STRUCTURE_EDGE_ORIENTATION' | 'STRUCTURE_FORMAT' | 'STRUCTURE_KEY' | 'STRUCTURE_MAXIMUM' | 'STRUCTURE_MINIMUM' | 'STRUCTURE_PROPERTY_KEY' | 'STRUCTURE_PROTO_KEY' | 'STRUCTURE_REQUIRED' | 'STRUCTURE_STATE_TRANSITIONS' | 'STRUCTURE_TYPE' | 'STRUCTURE_UNION' | 'STRUCTURE_UNKNOWN_FIELD' | 'STRUCTURE_VALUE' | 'UNSUPPORTED_DOCUMENT_FORMAT' | 'UNSUPPORTED_DSL_VERSION';
5
+ export type SchemaDiagnosticCode = 'DV_ACCEPTANCE_CONTEXT' | 'DV_CALLABLE_ADMISSION' | 'DV_CALLABLE_AUTH' | 'DV_CALLABLE_IO' | 'DV_CLASS_ABSTRACT' | 'DV_CLASS_ACYCLIC' | 'DV_CLASS_INHERITANCE' | 'DV_CLASS_KIND' | 'DV_CORE_EDGE_CLASS' | 'DV_CORE_EDGE_CONSTRAINTS' | 'DV_CORE_EDGE_KEY' | 'DV_CORE_EDGE_PROPERTIES' | 'DV_CORE_EDGE_UNIQUE' | 'DV_CORE_NODE_CLASS' | 'DV_CORE_NODE_PROPERTIES' | 'DV_CORE_NODE_UNIQUE' | 'DV_CORE_REF' | 'DV_DATA_COMPOSITION' | 'DV_DEPENDENCY_ACYCLIC' | 'DV_DEPENDENCY_DIRECT' | 'DV_DEPENDENCY_EXACT' | 'DV_DEPENDENCY_LIMITS' | 'DV_DEPENDENCY_REVISION_COHERENCE' | 'DV_DEPENDENCY_UNIQUE' | 'DV_DOMAIN_ICON' | 'DV_EDGE_ACCEPTS' | 'DV_EDGE_CLASS_COMPOSITION' | 'DV_EDGE_FOREIGN_MINIMUM' | 'DV_EDGE_LIFETIME' | 'DV_EDGE_ROLE' | 'DV_EDGE_UNIQUE' | 'DV_ENTRYPOINT' | 'DV_INHERITANCE_LIMITS' | 'DV_JSON_VALUE' | 'DV_METHOD_ABSTRACT' | 'DV_METHOD_COMPOSITION' | 'DV_NODE_UNIQUE' | 'DV_PROPERTY_AUTO' | 'DV_PROPERTY_IMMUTABLE' | 'DV_PROPERTY_STATE' | 'DV_REF_RESOLVES' | 'DV_VALUE_SCHEMA' | 'PL_BUDGET' | 'PL_COMPOSITION' | 'PL_CONNECTIVITY' | 'PL_REF' | 'PL_REPEAT' | 'PL_TARGET' | 'PL_TYPING' | 'PL_USE' | 'PL_VARIABLE_SCOPE' | 'STRUCTURE_BINARY_INPUT' | 'STRUCTURE_CALLABLE_POLICY_AUTH' | 'STRUCTURE_DEPENDENCY_ALIAS' | 'STRUCTURE_DOMAIN_NAME' | 'STRUCTURE_DUPLICATE_ITEM' | 'STRUCTURE_EDGE_BLOB' | 'STRUCTURE_EDGE_ORIENTATION' | 'STRUCTURE_FORMAT' | 'STRUCTURE_KEY' | 'STRUCTURE_MAXIMUM' | 'STRUCTURE_MINIMUM' | 'STRUCTURE_PROPERTY_KEY' | 'STRUCTURE_PROTO_KEY' | 'STRUCTURE_REQUIRED' | 'STRUCTURE_STATE_TRANSITIONS' | 'STRUCTURE_TYPE' | 'STRUCTURE_UNION' | 'STRUCTURE_UNKNOWN_FIELD' | 'STRUCTURE_VALUE' | 'UNSUPPORTED_DOCUMENT_FORMAT' | 'UNSUPPORTED_DSL_VERSION';
6
6
  /**
7
7
  * A Schema refuses a document with its own codes, and a comparison request with the
8
8
  * compatibility codes. `pointer` names the position the refused rule applies to, in the document