@astrale-os/kernel-dsl 1.0.0-beta.16 → 1.0.0-beta.18

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 (75) hide show
  1. package/dist/v1/builder/class/authoring.d.ts +40 -4
  2. package/dist/v1/builder/class/authoring.js +3 -2
  3. package/dist/v1/builder/class/input.d.ts +45 -14
  4. package/dist/v1/builder/index.d.ts +2 -1
  5. package/dist/v1/builder/lowering/class.d.ts +8 -0
  6. package/dist/v1/builder/lowering/class.js +40 -16
  7. package/dist/v1/builder/lowering/schema/compile.js +3 -3
  8. package/dist/v1/builder/policy/authoring.js +97 -88
  9. package/dist/v1/bundle/model.js +1 -1
  10. package/dist/v1/compiled/admission/accept.js +1 -7
  11. package/dist/v1/compiled/admission/semantics/class.js +2 -3
  12. package/dist/v1/compiled/admission/semantics/policy/parity.js +25 -13
  13. package/dist/v1/compiled/admission/wire/class.js +23 -18
  14. package/dist/v1/compiled/admission/wire/policy.d.ts +4 -3
  15. package/dist/v1/compiled/admission/wire/policy.js +8 -7
  16. package/dist/v1/compiled/loader/load.js +1 -1
  17. package/dist/v1/domain/create.js +1 -1
  18. package/dist/v1/domain/model/input.d.ts +2 -1
  19. package/dist/v1/domain/projection/classes.js +1 -1
  20. package/dist/v1/domain/validation/create.d.ts +2 -1
  21. package/dist/v1/domain/validation/create.js +1 -1
  22. package/dist/v1/index.d.ts +1 -1
  23. package/dist/v1/language/callable/resolved.d.ts +11 -2
  24. package/dist/v1/language/class/model/class.d.ts +17 -5
  25. package/dist/v1/language/freeze.d.ts +5 -0
  26. package/dist/v1/{schema/canonical → language}/freeze.js +4 -0
  27. package/dist/v1/language/policy/analysis/typing.d.ts +1 -0
  28. package/dist/v1/language/policy/analysis/typing.js +74 -79
  29. package/dist/v1/language/policy/model/policy.d.ts +44 -4
  30. package/dist/v1/language/policy/model/policy.js +14 -0
  31. package/dist/v1/language/policy/normalization/normalize.d.ts +6 -6
  32. package/dist/v1/language/policy/normalization/normalize.js +5 -5
  33. package/dist/v1/language/validation/rule.d.ts +18 -8
  34. package/dist/v1/language/validation/rule.js +2 -11
  35. package/dist/v1/language/value/evaluate/program.d.ts +2 -1
  36. package/dist/v1/language/value/evaluate/program.js +2 -2
  37. package/dist/v1/language/value/evaluate/validate.d.ts +2 -2
  38. package/dist/v1/language/value/evaluate/validate.js +2 -2
  39. package/dist/v1/language/value/profile/json.validate.d.ts +3 -1
  40. package/dist/v1/language/value/profile/json.validate.js +3 -2
  41. package/dist/v1/schema/.spec/schemas/domain-schema.schema.json +180 -25
  42. package/dist/v1/schema/admission/callable.js +1 -1
  43. package/dist/v1/schema/canonical/revision.js +4 -4
  44. package/dist/v1/schema/compatibility/comparators/callables.js +1 -1
  45. package/dist/v1/schema/compatibility/comparators/classes.js +4 -4
  46. package/dist/v1/schema/compatibility/comparators/members.js +1 -1
  47. package/dist/v1/schema/compatibility/comparators/values.js +2 -2
  48. package/dist/v1/schema/compatibility/report.js +1 -1
  49. package/dist/v1/schema/compatibility/versioning/index.js +1 -1
  50. package/dist/v1/schema/model/schema.js +1 -1
  51. package/dist/v1/schema/normalization/domain.js +9 -8
  52. package/dist/v1/schema/resolution/domain.js +1 -1
  53. package/dist/v1/schema/resolution/origins.js +3 -2
  54. package/dist/v1/schema/rule.d.ts +8 -20
  55. package/dist/v1/schema/rule.js +1 -1
  56. package/dist/v1/schema/validation/class.js +2 -3
  57. package/dist/v1/schema/validation/domain.json-schema.d.ts +2 -2
  58. package/dist/v1/schema/validation/domain.json-schema.js +20 -6
  59. package/dist/v1/schema/validation/domain.structure.d.ts +4765 -1005
  60. package/dist/v1/schema/validation/domain.structure.js +21 -9
  61. package/dist/v1/schema/validation/json.json-schema.d.ts +18 -2
  62. package/dist/v1/schema/validation/json.json-schema.js +14 -4
  63. package/dist/v1/schema/validation/policy/budgets.d.ts +1 -1
  64. package/dist/v1/schema/validation/policy/budgets.js +4 -4
  65. package/dist/v1/schema/validation/policy/uses.d.ts +10 -2
  66. package/dist/v1/schema/validation/policy/uses.js +26 -13
  67. package/dist/v1/schema/validation/policy/validate.js +2 -3
  68. package/dist/v1/schema/validation/value.json-schema.d.ts +4 -6
  69. package/dist/v1/schema/validation/value.json-schema.js +18 -25
  70. package/package.json +1 -1
  71. package/dist/v1/schema/canonical/domain.d.ts +0 -3
  72. package/dist/v1/schema/canonical/domain.digest.d.ts +0 -3
  73. package/dist/v1/schema/canonical/domain.digest.js +0 -5
  74. package/dist/v1/schema/canonical/domain.js +0 -5
  75. package/dist/v1/schema/canonical/freeze.d.ts +0 -1
@@ -1,13 +1,13 @@
1
- import {} from '../../../../addressing/index.js';
1
+ import { Key } from '../../../../addressing/index.js';
2
2
  import { branchesOf, targetMode, isConnected, } from '../../../../language/policy/analysis/branches.js';
3
3
  import { exceededLimits, measureChecks, policyMeasurer, } from '../../../../language/policy/analysis/budgets.js';
4
4
  import { neverAdmittedClasses, } from '../../../../language/policy/analysis/checks.js';
5
5
  import {} from '../../../../language/policy/analysis/typing.js';
6
- import { checksNameTheCaller, isClassRuleChecks, } from '../../../../language/policy/model/policy.js';
6
+ import { CLASS_OPERATIONS, checksNameTheCaller, isClassRuleChecks, } from '../../../../language/policy/model/policy.js';
7
7
  import { normalizePolicyExpression } from '../../../../language/policy/normalization/normalize.js';
8
8
  import {} from '../../../model/schema.js';
9
9
  import { fail } from '../../diagnostic.js';
10
- import { isCompiledEdge } from '../context.js';
10
+ import { isCompiledEdge, } from '../context.js';
11
11
  import { callableObjectContracts } from './contracts.js';
12
12
  import { compiledPolicyTyping } from './typing.js';
13
13
  /** Check Policy typing and expansion budgets against the entry’s own closure. */
@@ -46,26 +46,25 @@ export function validatePolicyParity(context, entry, entryIndex, policies, origi
46
46
  }
47
47
  }
48
48
  for (const [classIndex, definition] of entry.definitions.classes.entries()) {
49
- for (const operation of ['read', 'traverse']) {
49
+ const edge = isCompiledEdge(definition) ? definition : undefined;
50
+ for (const operation of CLASS_OPERATIONS) {
50
51
  const policy = definition.policies[operation];
51
52
  if (typeof policy !== 'object')
52
53
  continue;
53
54
  const path = `/closure/${entryIndex}/definitions/classes/${classIndex}/policies/${operation}`;
54
55
  if (isClassRuleChecks(policy)) {
55
- // The wire admits rules only on a Node Class and only over `self` and `ref` objects.
56
- validatePolicyChecks(context, typing, entry, policy, -1, definition.ref, path, 'class');
56
+ // The wire admits rules only over `self` and `ref` objects, and `ref` alone to create a Node.
57
+ validatePolicyChecks(context, typing, entry, policy, -1, definition.ref, path, 'class', edge);
57
58
  continue;
58
59
  }
59
- const label = operation === 'read' ? 'Read' : 'Traverse';
60
+ const label = `${operation[0].toUpperCase()}${operation.slice(1)}`;
60
61
  if (definition.kind === 'node') {
61
62
  if (!typing.policyAccepts(policy.name, { kind: 'exact', ref: definition.ref })) {
62
63
  fail(path, `${label} Policy is incompatible with its protected Node Class.`);
63
64
  }
64
65
  }
65
- else if (isCompiledEdge(definition)) {
66
- if (!typing.policyAcceptsEdgeClass(policy.name, definition)) {
67
- fail(path, `${label} Policy is incompatible with an accepted Edge endpoint pair.`);
68
- }
66
+ else if (edge !== undefined && !typing.policyAcceptsEdgeClass(policy.name, edge)) {
67
+ fail(path, `${label} Policy is incompatible with an accepted Edge endpoint pair.`);
69
68
  }
70
69
  }
71
70
  if (definition.kind === 'node') {
@@ -90,7 +89,7 @@ const SITE = {
90
89
  callable: { checks: 'Callable Policy checks', objects: 'the callable object contract' },
91
90
  class: { checks: 'Class rule checks', objects: 'the Class rule object contract' },
92
91
  };
93
- function validatePolicyChecks(context, typing, entry, expression, input, receiver, path, site) {
92
+ function validatePolicyChecks(context, typing, entry, expression, input, receiver, path, site, edge) {
94
93
  if (!checksNameTheCaller(expression)) {
95
94
  fail(path, `${SITE[site].checks} must check a Policy on every branch: sameNode alone names no caller.`);
96
95
  }
@@ -99,13 +98,26 @@ function validatePolicyChecks(context, typing, entry, expression, input, receive
99
98
  }
100
99
  const leaves = new Map();
101
100
  const visit = (value, pointer) => {
102
- if ('sameNode' in value)
101
+ if ('sameNode' in value) {
102
+ // `self` is an Edge in an Edge Class rule, and sameNode compares Nodes.
103
+ if (edge !== undefined &&
104
+ (value.sameNode.left.kind === 'self' || value.sameNode.right.kind === 'self'))
105
+ fail(pointer, 'sameNode compares Nodes: self is an Edge here.');
103
106
  return;
107
+ }
104
108
  if (!('check' in value)) {
105
109
  const children = 'allOf' in value ? value.allOf : value.anyOf;
106
110
  children.forEach((child, index) => visit(child, `${pointer}/${index}`));
107
111
  return;
108
112
  }
113
+ if (edge !== undefined && value.object.kind === 'self') {
114
+ // An Edge is checked as an Edge Class Policy is: over every concrete endpoint pair.
115
+ if (!typing.policyAcceptsEdgeClass(value.check.name, edge))
116
+ fail(pointer, 'Named Policy is incompatible with an accepted Edge endpoint pair.');
117
+ const name = Key.of(edge.ref);
118
+ leaves.set(value, { accepted: [name], admitted: new Set([name]) });
119
+ return;
120
+ }
109
121
  const contracts = callableObjectContracts(context, entry, input, receiver, value.object);
110
122
  if (contracts === undefined)
111
123
  return;
@@ -2,6 +2,7 @@ import {} from '@astrale-os/kernel-dsl/value';
2
2
  import { Key } from '../../../addressing/index.js';
3
3
  import { MEDIA_TYPE_PATTERN } from '../../../language/class/model/data.js';
4
4
  import { compareEdgeUniqueTuples, compareNodeUniqueTuples, edgeUniqueTuple, nodeUniqueTuple, } from '../../../language/class/unique.js';
5
+ import { CLASS_OPERATIONS, isClassObservation } from '../../../language/policy/model/policy.js';
5
6
  import {} from '../../model/schema.js';
6
7
  import { invalid } from '../diagnostic.js';
7
8
  import { compiledCallable } from './callable.js';
@@ -63,26 +64,30 @@ export function compiledClass(input, values, path) {
63
64
  }
64
65
  function classPolicies(input, kind, path) {
65
66
  const value = object(input, 'Class Policies', path);
66
- exact(value, [], 'Class Policies', path, ['read', 'traverse']);
67
- if (value.read !== undefined)
68
- classPolicy(value.read, kind, 'Class read Policy', `${path}/read`);
69
- if (value.traverse !== undefined)
70
- classPolicy(value.traverse, kind, 'Class traverse Policy', `${path}/traverse`);
67
+ exact(value, [], 'Class Policies', path, CLASS_OPERATIONS);
68
+ for (const operation of CLASS_OPERATIONS) {
69
+ const policy = value[operation];
70
+ if (policy === undefined)
71
+ continue;
72
+ const label = `Class ${operation} Policy`;
73
+ const slot = `${path}/${operation}`;
74
+ if (isRuleChecks(policy)) {
75
+ classRuleChecks(policy, slot, kind === 'node' && operation === 'create' ? 'create' : 'class');
76
+ continue;
77
+ }
78
+ // Each slot spells one constant, and a Node create rule has no Node for a named Policy alone.
79
+ if (policy === !isClassObservation(operation))
80
+ continue;
81
+ if (kind === 'node' && operation === 'create')
82
+ invalid(label, undefined, slot);
83
+ definitionRef(policy, 'policy', label, slot);
84
+ }
71
85
  }
72
- /**
73
- * Check one observation slot: `false`, the rule no caller satisfies, a named Policy, or, on a Node
74
- * Class only, Policy checks over the observed Node.
75
- */
76
- function classPolicy(input, kind, label, path) {
77
- if (kind === 'node' &&
78
- input !== null &&
86
+ /** Policy checks, as opposed to a constant or a named Policy. */
87
+ function isRuleChecks(input) {
88
+ return (input !== null &&
79
89
  typeof input === 'object' &&
80
- ['check', 'sameNode', 'allOf', 'anyOf'].some((key) => Object.hasOwn(input, key))) {
81
- classRuleChecks(input, path);
82
- return;
83
- }
84
- if (input !== false)
85
- definitionRef(input, 'policy', label, path);
90
+ ['check', 'sameNode', 'allOf', 'anyOf'].some((key) => Object.hasOwn(input, key)));
86
91
  }
87
92
  function edgeContract(value, path) {
88
93
  const constraintsPath = `${path}/constraints`;
@@ -4,7 +4,8 @@ export declare function compiledPolicy(input: JsonValue, path: string): never;
4
4
  /** Check one callable's caller rule: `true`, the rule every caller satisfies, or Policy checks. */
5
5
  export declare function callablePolicy(input: JsonValue | undefined, path: string): void;
6
6
  /**
7
- * Check one Node Class rule: Policy checks over `self` and `ref` objects only, in their one
8
- * spelling. A lone check of `self` is spelled as the Policy reference itself.
7
+ * Check one Class rule: Policy checks over `self` and `ref` objects only, or, in a Node create
8
+ * rule, `ref` objects only, in their one spelling. A lone check of `self` is spelled as the Policy
9
+ * reference itself.
9
10
  */
10
- export declare function classRuleChecks(input: JsonValue, path: string): void;
11
+ export declare function classRuleChecks(input: JsonValue, path: string, site: 'class' | 'create'): void;
@@ -130,17 +130,18 @@ export function callablePolicy(input, path) {
130
130
  policyCheck(input, 0, path);
131
131
  }
132
132
  /**
133
- * Check one Node Class rule: Policy checks over `self` and `ref` objects only, in their one
134
- * spelling. A lone check of `self` is spelled as the Policy reference itself.
133
+ * Check one Class rule: Policy checks over `self` and `ref` objects only, or, in a Node create
134
+ * rule, `ref` objects only, in their one spelling. A lone check of `self` is spelled as the Policy
135
+ * reference itself.
135
136
  */
136
- export function classRuleChecks(input, path) {
137
- policyCheck(input, 0, path, 'class');
137
+ export function classRuleChecks(input, path, site) {
138
+ policyCheck(input, 0, path, site);
138
139
  const rule = input;
139
140
  if (json.serialize(normalizeClassRule(rule)) !== json.serialize(rule))
140
141
  invalid('Class rule spelling', undefined, path);
141
142
  }
142
143
  /** What a site calls its checks in a refusal. */
143
- const SITE = { callable: 'Callable Policy', class: 'Class rule' };
144
+ const SITE = { callable: 'Callable Policy', class: 'Class rule', create: 'Create rule' };
144
145
  /** Check the recursive Policy check wire grammar of one use site. */
145
146
  function policyCheck(input, depth, path, site = 'callable') {
146
147
  const name = SITE[site];
@@ -148,7 +149,7 @@ function policyCheck(input, depth, path, site = 'callable') {
148
149
  invalid(`${name} depth`, undefined, path);
149
150
  const value = object(input, name, path);
150
151
  if (Object.hasOwn(value, 'sameNode')) {
151
- const equality = site === 'class' ? 'Class rule equality' : 'Callable equality';
152
+ const equality = site === 'callable' ? 'Callable equality' : `${name} equality`;
152
153
  exact(value, ['sameNode'], equality, path);
153
154
  const pair = object(value.sameNode, equality, `${path}/sameNode`);
154
155
  exact(pair, ['left', 'right'], `${equality} operands`, `${path}/sameNode`);
@@ -174,7 +175,7 @@ function policyCheck(input, depth, path, site = 'callable') {
174
175
  function policyCheckObject(input, objectPath, site) {
175
176
  const name = SITE[site];
176
177
  const target = object(input, `${name} object`, objectPath);
177
- if (target.kind === 'self')
178
+ if (target.kind === 'self' && site !== 'create')
178
179
  exact(target, ['kind'], `${name} self`, objectPath);
179
180
  else if (target.kind === 'input' && site === 'callable') {
180
181
  exact(target, ['kind', 'field'], `${name} input`, objectPath);
@@ -107,7 +107,7 @@ function programValidation(programs, properties, propertyOrdering, callables) {
107
107
  ...(callable.fields === undefined
108
108
  ? {}
109
109
  : { fields: Object.freeze(Object.keys(callable.fields)) }),
110
- validateInput: (value) => validateValueProgram(input, value),
110
+ validateInput: (value, options) => validateValueProgram(input, value, [input.root], options),
111
111
  validateInputField(field, value) {
112
112
  const nodes = callable.fields?.[field];
113
113
  return nodes === undefined
@@ -136,7 +136,7 @@ function createDefinitions(declarations, classesByKey, input) {
136
136
  policy: definition.policy,
137
137
  ...(inputFields === undefined ? {} : { inputFields }),
138
138
  definition,
139
- validateInput: (value) => input.validation.callableInput(key, value),
139
+ validateInput: (value, options) => input.validation.callableInput(key, value, options),
140
140
  validateInputField: (field, value) => input.validation.callableInputField(key, field, value),
141
141
  validateOutput: (value) => input.validation.callableOutput(key, value),
142
142
  });
@@ -1,3 +1,4 @@
1
+ import type { Options } from '@astrale-os/kernel-dsl/value';
1
2
  import type { Key as AddressKey, PropertyKey, Revision } from '../../addressing/index.js';
2
3
  import type { DomainDependency, DomainDependencyMap } from '../../addressing/index.js';
3
4
  import type { CoreEdge } from '../../language/core/model/core.js';
@@ -27,7 +28,7 @@ export interface DomainValidation {
27
28
  propertyProgram(key: PropertyKey): ValueProgram;
28
29
  propertyOrdering(key: PropertyKey): OrderingKind | undefined;
29
30
  callableExists(key: AddressKey.Callable): boolean;
30
- callableInput(key: AddressKey.Callable, input: unknown): readonly Diagnostic[];
31
+ callableInput(key: AddressKey.Callable, input: unknown, options?: Options): readonly Diagnostic[];
31
32
  callableFields(key: AddressKey.Callable): readonly string[] | undefined;
32
33
  callableInputField(key: AddressKey.Callable, field: string, input: unknown): readonly Diagnostic[];
33
34
  callableOutput(key: AddressKey.Callable, output: unknown): readonly Diagnostic[];
@@ -80,7 +80,7 @@ export function createClasses(definitions, validation) {
80
80
  executable: isMethodExecutable(definition, methodDefinition),
81
81
  ...(inputFields === undefined ? {} : { inputFields }),
82
82
  definition: methodDefinition,
83
- validateInput: (input) => validation.callableInput(methodKey, input),
83
+ validateInput: (input, options) => validation.callableInput(methodKey, input, options),
84
84
  validateInputField: (field, input) => validation.callableInputField(methodKey, field, input),
85
85
  validateOutput: (output) => validation.callableOutput(methodKey, output),
86
86
  });
@@ -1,3 +1,4 @@
1
+ import type { Options } from '@astrale-os/kernel-dsl/value';
1
2
  import type { Key, PropertyKey } from '../../addressing/index.js';
2
3
  import type { Diagnostic } from '../../language/validation/diagnostic.js';
3
4
  import type { ValueProgram } from '../../language/value/compile/model.js';
@@ -10,7 +11,7 @@ export interface PropertyValidation {
10
11
  }
11
12
  export interface CallableValidation {
12
13
  readonly fields?: readonly string[];
13
- validateInput(input: unknown): readonly Diagnostic[];
14
+ validateInput(input: unknown, options?: Options): readonly Diagnostic[];
14
15
  validateInputField(field: string, input: unknown): readonly Diagnostic[];
15
16
  validateOutput(output: unknown): readonly Diagnostic[];
16
17
  }
@@ -21,7 +21,7 @@ export function createDomainValidation(properties, callables) {
21
21
  propertyProgram: (key) => propertyOf(key).program(),
22
22
  propertyOrdering: (key) => properties.get(key)?.ordering,
23
23
  callableExists: (key) => callables.has(key),
24
- callableInput: (key, input) => callableOf(key).validateInput(input),
24
+ callableInput: (key, input, options) => callableOf(key).validateInput(input, options),
25
25
  callableFields: (key) => callables.get(key)?.fields,
26
26
  callableInputField: (key, field, input) => callableOf(key).validateInputField(field, input),
27
27
  callableOutput: (key, output) => callableOf(key).validateOutput(output),
@@ -5,7 +5,7 @@ export { isBinaryInput } from './language/callable/model/callable.js';
5
5
  export type { EventOf, StateMachine, StateOf } from './language/state/index.js';
6
6
  export { PropertyValues } from './language/index.js';
7
7
  export * as metadata from './language/definition/metadata.js';
8
- export type { AnyResolvedClass, BoundMethodOf, BoundMethodShortcutsOf, CallableResultOf, CallableInputOf, CallableInputModeOf, CallableOutputOf, ClassSatisfactionKeysOf, ClassDefinition, CoreDefinition, CoreEdge, FunctionAuth, FunctionDefinition, Inheritance, BinaryInput, BinaryInputProjection, CallableInputContract, MethodDefinition, MethodOwnerKeyOf, CallablePolicy, ClassPolicy, ClassRuleChecks, ClassRuleObject, NodeClassPolicy, PolicyCheckExpression, PolicyDefinition, PropertyImmutability, PropertyInputOf, PropertyAccessOf, PropertyOutputOf, PropertyShortcutsOf, PropertyValuesOf, ResolvedClass, ResolvedCoreDefinition, ResolvedCoreEndpoint, ResolvedData, ResolvedFunction, ExecutableMethod, ResolvedMethod, ResolvedMethodCollection, ResolvedPolicy, ResolvedProperty, ResolvedView, MethodAccessOf, SelfMethodsOf, SelfPropertiesOf, SelfStaticMethodsOf, StaticMethodsOf, ViewDefinition, } from './language/index.js';
8
+ export type { AnyResolvedClass, BoundMethodOf, BoundMethodShortcutsOf, CallableResultOf, CallableInputOf, CallableInputModeOf, CallableOutputOf, ClassSatisfactionKeysOf, ClassDefinition, CoreDefinition, CoreEdge, FunctionAuth, FunctionDefinition, Inheritance, BinaryInput, BinaryInputProjection, CallableInputContract, MethodDefinition, MethodOwnerKeyOf, CallablePolicy, ClassPolicy, ClassRuleChecks, ClassRuleObject, ClassWritePolicy, CreateRuleChecks, EdgeClassPolicy, EdgeClassWritePolicy, EdgeRuleChecks, NodeClassCreatePolicy, NodeClassPolicy, NodeClassWritePolicy, PolicyCheckExpression, PolicyDefinition, PropertyImmutability, PropertyInputOf, PropertyAccessOf, PropertyOutputOf, PropertyShortcutsOf, PropertyValuesOf, ResolvedClass, ResolvedCoreDefinition, ResolvedCoreEndpoint, ResolvedData, ResolvedFunction, ExecutableMethod, ResolvedMethod, ResolvedMethodCollection, ResolvedPolicy, ResolvedProperty, ResolvedView, MethodAccessOf, SelfMethodsOf, SelfPropertiesOf, SelfStaticMethodsOf, StaticMethodsOf, ViewDefinition, } from './language/index.js';
9
9
  export { acceptDefinitionRef, callableAddress, ClassKey, equalDefinitionRefs, isDefinitionRef, Key, MethodKey, PropertyKey, } from './addressing/index.js';
10
10
  export type { ClassRef, CoreRef, DefinitionBase, DefinitionKey, DefinitionRef, FunctionRef, MethodAddress, PolicyRef, Revision, ViewRef, } from './addressing/index.js';
11
11
  export type { Definition } from './language/index.js';
@@ -1,3 +1,4 @@
1
+ import type { Options } from '@astrale-os/kernel-dsl/value';
1
2
  import type { DefinitionKey, FunctionRef, Key, MethodKey } from '../../addressing/index.js';
2
3
  import type { ResolvedClass } from '../class/resolved.js';
3
4
  import type { CallablePolicy } from '../policy/model/policy.js';
@@ -36,7 +37,11 @@ export interface ResolvedMethod<out Input = unknown, out Output = unknown, out S
36
37
  readonly static: Static;
37
38
  readonly abstract: Abstract;
38
39
  };
39
- validateInput(input: unknown): readonly Diagnostic[];
40
+ /**
41
+ * The issues of `input` against the callable's input schema, `options` overriding the portable
42
+ * limits it is admitted under: those it crossed the wire under, for a call's input.
43
+ */
44
+ validateInput(input: unknown, options?: Options): readonly Diagnostic[];
40
45
  validateInputField(field: string, input: unknown): readonly Diagnostic[];
41
46
  validateOutput(output: unknown): readonly Diagnostic[];
42
47
  readonly __input?: Input;
@@ -62,7 +67,11 @@ export interface ResolvedFunction<out Input = unknown, out Output = unknown, out
62
67
  /** Present only when the callable input is a safely enumerable closed object. */
63
68
  readonly inputFields?: readonly string[];
64
69
  readonly definition: CallableDefinitionOf<FunctionDefinition, Auth, Policy>;
65
- validateInput(input: unknown): readonly Diagnostic[];
70
+ /**
71
+ * The issues of `input` against the callable's input schema, `options` overriding the portable
72
+ * limits it is admitted under: those it crossed the wire under, for a call's input.
73
+ */
74
+ validateInput(input: unknown, options?: Options): readonly Diagnostic[];
66
75
  validateInputField(field: string, input: unknown): readonly Diagnostic[];
67
76
  validateOutput(output: unknown): readonly Diagnostic[];
68
77
  readonly __input?: Input;
@@ -1,6 +1,6 @@
1
1
  import type { ClassRef, DefinitionBase, PropertyKey } from '../../../addressing/index.js';
2
2
  import type { MethodRecord } from '../../callable/model/callable.js';
3
- import type { ClassPolicy, NodeClassPolicy } from '../../policy/model/policy.js';
3
+ import type { EdgeClassPolicy, EdgeClassWritePolicy, NodeClassCreatePolicy, NodeClassPolicy, NodeClassWritePolicy } from '../../policy/model/policy.js';
4
4
  import type { DataFacet } from './data.js';
5
5
  import type { EdgeContract } from './edge.js';
6
6
  import type { EdgePropertyDefinition, NodePropertyDefinition, PropertyFacet } from './property.js';
@@ -10,15 +10,27 @@ export type ClassKind = 'node' | 'edge';
10
10
  * on that Domain; `'internal'`, those of its Domain only; `'final'`, none.
11
11
  */
12
12
  export type Inheritance = 'open' | 'internal' | 'final';
13
- /** An absent observation rule admits every caller; a delegation is still scoped by its ceiling. */
13
+ /**
14
+ * An absent observation rule admits every caller; a delegation is still scoped by its ceiling. An
15
+ * absent write rule admits only the Domain that declares the Class.
16
+ */
14
17
  export interface NodeClassPolicies {
15
18
  readonly read?: NodeClassPolicy;
16
19
  readonly traverse?: NodeClassPolicy;
20
+ readonly create?: NodeClassCreatePolicy;
21
+ readonly update?: NodeClassWritePolicy;
22
+ readonly delete?: NodeClassWritePolicy;
17
23
  }
18
- /** An absent observation rule admits every caller; a delegation is still scoped by its ceiling. */
24
+ /**
25
+ * An absent observation rule admits every caller; a delegation is still scoped by its ceiling. An
26
+ * absent write rule admits only the Domain that declares the Class.
27
+ */
19
28
  export interface EdgeClassPolicies {
20
- readonly read?: ClassPolicy;
21
- readonly traverse?: ClassPolicy;
29
+ readonly read?: EdgeClassPolicy;
30
+ readonly traverse?: EdgeClassPolicy;
31
+ readonly create?: EdgeClassWritePolicy;
32
+ readonly update?: EdgeClassWritePolicy;
33
+ readonly delete?: EdgeClassWritePolicy;
22
34
  }
23
35
  /**
24
36
  * The Properties one key of a Node Class names, own or inherited, which no two Nodes of the Classes
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Freeze `value` and every object it reaches, in place. An object already frozen is taken as frozen
3
+ * through, so a value built from frozen parts is frozen without walking them again.
4
+ */
5
+ export declare function deepFreeze<T>(value: T): Readonly<T>;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Freeze `value` and every object it reaches, in place. An object already frozen is taken as frozen
3
+ * through, so a value built from frozen parts is frozen without walking them again.
4
+ */
1
5
  export function deepFreeze(value) {
2
6
  if (value === null || typeof value !== 'object' || Object.isFrozen(value)) {
3
7
  return value;
@@ -21,6 +21,7 @@ export type PolicyUseContract = {
21
21
  /** What Policy typing reads of the closure it types against: source or compiled admission. */
22
22
  export interface PolicyTypingScope {
23
23
  readonly normalized: ReadonlyMap<string, PolicyExpression>;
24
+ /** Each resolves, through `resolveClass`, to a Node Class. */
24
25
  readonly allNodeClasses: readonly ClassRef[];
25
26
  /** The concrete Classes of `allNodeClasses`, in its order. */
26
27
  readonly concreteNodeClasses: readonly ClassRef[];