@rsconcept/domain 1.8.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{analyzer-DpE0qknt.d.ts → analyzer-iqAXyROE.d.ts} +2 -2
- package/dist/{arguments-extractor-Dd1lFom9.d.ts → arguments-extractor-ngatANBI.d.ts} +2 -2
- package/dist/{ast-annotations-CZCzs9Uk.d.ts → ast-annotations-D6KZDu12.d.ts} +2 -2
- package/dist/{calculator-Dt03dsnd.d.ts → calculator-k8BGIKmj.d.ts} +2 -2
- package/dist/diagnostics-Clo3mkba.d.ts +279 -0
- package/dist/diagnostics-DYMvTSev.js +532 -0
- package/dist/diagnostics-DYMvTSev.js.map +1 -0
- package/dist/index.d.ts +14 -15
- package/dist/index.js +7 -6
- package/dist/library/diagnostics.d.ts +2 -0
- package/dist/library/diagnostics.js +2 -0
- package/dist/library/index.d.ts +15 -6
- package/dist/library/index.js +41 -13
- package/dist/library/index.js.map +1 -1
- package/dist/library/oss-api.d.ts +1 -1
- package/dist/library/oss-api.js +1 -1
- package/dist/library/rsengine.d.ts +2 -3
- package/dist/library/rsengine.js +1 -1
- package/dist/library/rsform-api.d.ts +4 -4
- package/dist/library/rsform-api.js +1 -404
- package/dist/library/rsform.d.ts +2 -198
- package/dist/library/rsform.js.map +1 -1
- package/dist/library/rsmodel-api.d.ts +2 -3
- package/dist/library/rsmodel-api.js +2 -4
- package/dist/library/rsmodel-api.js.map +1 -1
- package/dist/library/rsmodel.d.ts +2 -46
- package/dist/library/structure-planner.d.ts +2 -2
- package/dist/library/structure-planner.js +1 -1
- package/dist/rslang/api.d.ts +1 -1
- package/dist/rslang/api.js +2 -1
- package/dist/rslang/api.js.map +1 -1
- package/dist/rslang/ast-annotations.d.ts +1 -1
- package/dist/rslang/eval/calculator.d.ts +1 -1
- package/dist/rslang/eval/evaluator.js +2 -2
- package/dist/rslang/eval/value-api.d.ts +1 -1
- package/dist/rslang/index.d.ts +8 -8
- package/dist/rslang/index.js +2 -2
- package/dist/rslang/labels.d.ts +4 -2
- package/dist/rslang/labels.js +8 -2
- package/dist/rslang/labels.js.map +1 -1
- package/dist/rslang/parser/syntax-errors/index.d.ts +1 -1
- package/dist/rslang/parser/syntax-errors/index.js +1 -1
- package/dist/rslang/semantic/analyzer.d.ts +1 -1
- package/dist/rslang/semantic/analyzer.js +3 -3
- package/dist/rslang/semantic/arguments-extractor.d.ts +1 -1
- package/dist/rslang/semantic/arguments-extractor.js +1 -1
- package/dist/rslang/semantic/type-auditor.d.ts +1 -1
- package/dist/rslang/semantic/type-auditor.js +4 -4
- package/dist/rslang/semantic/type-auditor.js.map +1 -1
- package/dist/rslang/semantic/typification-api.d.ts +1 -1
- package/dist/rslang/semantic/typification-parser.d.ts +1 -1
- package/dist/rslang/semantic/typification.d.ts +2 -2
- package/dist/rslang/semantic/typification.js +14 -6
- package/dist/rslang/semantic/typification.js.map +1 -1
- package/dist/rslang/semantic/value-auditor.js +2 -2
- package/dist/rslang/typification-graph.d.ts +1 -1
- package/dist/{syntax-errors-B6c2vsan.js → syntax-errors-D_VV5hAM.js} +3 -3
- package/dist/{syntax-errors-B6c2vsan.js.map → syntax-errors-D_VV5hAM.js.map} +1 -1
- package/dist/{typification-DDuv88ir.d.ts → typification-9lNu9R4k.d.ts} +8 -4
- package/dist/{typification-graph-8VdK6_Fh.d.ts → typification-graph-BY_oGT82.d.ts} +2 -2
- package/dist/{typification-parser-DHO42ZRc.d.ts → typification-parser-Dytsv9CI.d.ts} +2 -2
- package/dist/{value-api-C2X4Pom5.d.ts → value-api-CXLl_zg0.d.ts} +2 -2
- package/package.json +5 -1
- package/src/index.ts +8 -0
- package/src/library/diagnostics.ts +188 -0
- package/src/library/index.ts +9 -0
- package/src/library/oss-api.test.ts +1 -2
- package/src/library/rsform-api.ts +12 -17
- package/src/library/rsform.ts +4 -2
- package/src/library/rsmodel-api.ts +2 -8
- package/src/library/template-instantiation.test.ts +123 -5
- package/src/library/template-instantiation.ts +42 -12
- package/src/rslang/api.ts +2 -1
- package/src/rslang/labels.ts +10 -1
- package/src/rslang/semantic/type-auditor.test.ts +25 -6
- package/src/rslang/semantic/type-auditor.ts +2 -1
- package/src/rslang/semantic/typification-api.test.ts +21 -5
- package/src/rslang/semantic/typification-parser.test.ts +6 -1
- package/src/rslang/semantic/typification.ts +16 -6
- package/dist/library/rsform-api.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { EntityReference, Grammeme, ReferenceType, SyntacticReference, TermContext, WordForm, supportedGrammemes } from "./cctext/language.js";
|
|
2
2
|
import { t as Graph } from "./graph-DR8rL2o3.js";
|
|
3
|
-
import { FolderNode, FolderTree } from "./library/folder-tree.js";
|
|
4
|
-
import { a as LibraryItemType, i as LibraryItemReference, n as CurrentVersion, o as LocationHead, r as LibraryItem, s as VersionInfo, t as AccessPolicy } from "./library-CYun28Xz.js";
|
|
5
|
-
import { n as OssLayout, r as Position2D } from "./oss-layout-3glgAqfn.js";
|
|
6
|
-
import { Block, CstSubstituteInfo, NodeType, Operation, OperationInput, OperationSchema, OperationSchemaStats, OperationSynthesis, OperationType, OssItem, SubstitutionErrorDescription, SubstitutionErrorType } from "./library/oss.js";
|
|
7
3
|
import { r as printTree, t as CMSyntaxNode } from "./lezer-tree-iS7LpLBJ.js";
|
|
8
4
|
import { a as TOKEN_ERROR, c as flattenAst, d as printAst, f as visitAstDFS, i as FlatAstNode, l as getNodeIndices, n as AstNodeBase, o as buildTree, r as FlatAST, s as findByUid, t as AstNode, u as getNodeText } from "./ast-C8sIpKdL.js";
|
|
9
5
|
import { t as Branded } from "./branded-ZlzIcxzu.js";
|
|
10
6
|
import { n as generateStub, t as applyHash_fnv1a } from "./hash-Y8I4c6Al.js";
|
|
11
|
-
import { b as Typification, d as EmptySetT, f as ExpressionType, g as TypeClass,
|
|
7
|
+
import { A as makeTypePath, b as Typification, d as EmptySetT, f as ExpressionType, g as TypeClass, m as LogicT, t as AnyTypificationT, v as TypeID, y as TypePath } from "./typification-9lNu9R4k.js";
|
|
12
8
|
import { i as RSErrorDescription, r as RSErrorCode } from "./error-CzIbnP-N.js";
|
|
13
|
-
import { i as readTypeAnnotation, r as readErrorAnnotation } from "./ast-annotations-
|
|
9
|
+
import { i as readTypeAnnotation, r as readErrorAnnotation } from "./ast-annotations-D6KZDu12.js";
|
|
14
10
|
import { d as ValuePath, l as Value, o as TUPLE_ID, p as makeValuePath } from "./value-BduA_ZGp.js";
|
|
15
|
-
import { n as CalculatorResult, r as RSCalculator, t as CalculatorEvaluateOptions } from "./calculator-
|
|
16
|
-
import { d as printValue } from "./value-api-
|
|
11
|
+
import { n as CalculatorResult, r as RSCalculator, t as CalculatorEvaluateOptions } from "./calculator-k8BGIKmj.js";
|
|
12
|
+
import { d as printValue } from "./value-api-CXLl_zg0.js";
|
|
17
13
|
import { t as parser } from "./parser-Bwd8LxJ1.js";
|
|
18
14
|
import { t as TokenID } from "./token-DeXAmzwr.js";
|
|
19
15
|
import { t as ValueClass } from "./value-class-CNI-lqXJ.js";
|
|
20
|
-
import { a as RSLangAnalyzer, n as AnalysisFast, r as AnalysisFull, t as AnalysisBase } from "./analyzer-
|
|
21
|
-
import { n as ArgumentsType } from "./arguments-extractor-
|
|
22
|
-
import { n as applyAsciiTypeSubstitutions, r as parseTypeText } from "./typification-parser-
|
|
23
|
-
import { n as TypificationNodeData, t as TypificationGraph } from "./typification-graph-
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
16
|
+
import { a as RSLangAnalyzer, n as AnalysisFast, r as AnalysisFull, t as AnalysisBase } from "./analyzer-iqAXyROE.js";
|
|
17
|
+
import { n as ArgumentsType } from "./arguments-extractor-ngatANBI.js";
|
|
18
|
+
import { n as applyAsciiTypeSubstitutions, r as parseTypeText } from "./typification-parser-Dytsv9CI.js";
|
|
19
|
+
import { n as TypificationNodeData, t as TypificationGraph } from "./typification-graph-BY_oGT82.js";
|
|
20
|
+
import { a as LibraryItemType, i as LibraryItemReference, n as CurrentVersion, o as LocationHead, r as LibraryItem, s as VersionInfo, t as AccessPolicy } from "./library-CYun28Xz.js";
|
|
21
|
+
import { C as TypeInfo, S as Substitution, _ as CstClass, a as hasCstDiagnostic, b as RSForm, c as BasicsContext, d as RSModel, f as RSModelStats, g as Constituenta, h as Attribution, i as assignSchemaDiagnostics, l as DEFAULT_VALUE_TEXT, m as ArgumentValue, n as DiagnosticKind, o as modelStatusCstDiagnostic, r as RSDiagnosticCode, s as BasicBinding, t as CstDiagnostic, u as EvalStatus, v as CstStatus, x as RSFormStats, y as CstType } from "./diagnostics-Clo3mkba.js";
|
|
22
|
+
import { FolderNode, FolderTree } from "./library/folder-tree.js";
|
|
23
|
+
import { n as OssLayout, r as Position2D } from "./oss-layout-3glgAqfn.js";
|
|
24
|
+
import { Block, CstSubstituteInfo, NodeType, Operation, OperationInput, OperationSchema, OperationSchemaStats, OperationSynthesis, OperationType, OssItem, SubstitutionErrorDescription, SubstitutionErrorType } from "./library/oss.js";
|
|
26
25
|
import { RSEngine } from "./library/rsengine.js";
|
|
27
|
-
export { AccessPolicy, type AnalysisBase, type AnalysisFast, type AnalysisFull, AnyTypificationT, type ArgumentValue, type ArgumentsType, type AstNode, type AstNodeBase, type Attribution, type BasicBinding, type BasicsContext, type Block, type Branded, type CMSyntaxNode, type CalculatorEvaluateOptions, type CalculatorResult, type Constituenta, CstClass, CstStatus, type CstSubstituteInfo, CstType, type CurrentVersion, DEFAULT_VALUE_TEXT, EmptySetT, type EntityReference, EvalStatus, type ExpressionType, type FlatAST, type FlatAstNode, FolderNode, FolderTree, Grammeme, Graph, type LibraryItem, type LibraryItemReference, LibraryItemType, LocationHead, LogicT, NodeType, type Operation, type OperationInput, type OperationSchema, type OperationSchemaStats, type OperationSynthesis, OperationType, type OssItem, type OssLayout, type Position2D, RSCalculator, RSEngine, RSErrorCode, type RSErrorDescription, type RSForm, type RSFormStats, RSLangAnalyzer, type RSModel, type RSModelStats, ReferenceType, type Substitution, type SubstitutionErrorDescription, SubstitutionErrorType, type SyntacticReference, TOKEN_ERROR, TUPLE_ID, type TermContext, TokenID, TypeClass, TypeID, type TypeInfo, type TypePath, type Typification, TypificationGraph, type TypificationNodeData, type Value, ValueClass, type ValuePath, type VersionInfo, type WordForm, applyAsciiTypeSubstitutions, applyHash_fnv1a, buildTree, findByUid, flattenAst, generateStub, getNodeIndices, getNodeText, makeTypePath, makeValuePath, parseTypeText, printAst, printTree, printValue, readErrorAnnotation, readTypeAnnotation, parser as rslangParser, supportedGrammemes, visitAstDFS };
|
|
26
|
+
export { AccessPolicy, type AnalysisBase, type AnalysisFast, type AnalysisFull, AnyTypificationT, type ArgumentValue, type ArgumentsType, type AstNode, type AstNodeBase, type Attribution, type BasicBinding, type BasicsContext, type Block, type Branded, type CMSyntaxNode, type CalculatorEvaluateOptions, type CalculatorResult, type Constituenta, CstClass, type CstDiagnostic, CstStatus, type CstSubstituteInfo, CstType, type CurrentVersion, DEFAULT_VALUE_TEXT, DiagnosticKind, EmptySetT, type EntityReference, EvalStatus, type ExpressionType, type FlatAST, type FlatAstNode, FolderNode, FolderTree, Grammeme, Graph, type LibraryItem, type LibraryItemReference, LibraryItemType, LocationHead, LogicT, NodeType, type Operation, type OperationInput, type OperationSchema, type OperationSchemaStats, type OperationSynthesis, OperationType, type OssItem, type OssLayout, type Position2D, RSCalculator, RSDiagnosticCode, RSEngine, RSErrorCode, type RSErrorDescription, type RSForm, type RSFormStats, RSLangAnalyzer, type RSModel, type RSModelStats, ReferenceType, type Substitution, type SubstitutionErrorDescription, SubstitutionErrorType, type SyntacticReference, TOKEN_ERROR, TUPLE_ID, type TermContext, TokenID, TypeClass, TypeID, type TypeInfo, type TypePath, type Typification, TypificationGraph, type TypificationNodeData, type Value, ValueClass, type ValuePath, type VersionInfo, type WordForm, applyAsciiTypeSubstitutions, applyHash_fnv1a, assignSchemaDiagnostics, buildTree, findByUid, flattenAst, generateStub, getNodeIndices, getNodeText, hasCstDiagnostic, makeTypePath, makeValuePath, modelStatusCstDiagnostic, parseTypeText, printAst, printTree, printValue, readErrorAnnotation, readTypeAnnotation, parser as rslangParser, supportedGrammemes, visitAstDFS };
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { Grammeme, ReferenceType, supportedGrammemes } from "./cctext/language.js";
|
|
2
2
|
import { Graph } from "./graph/graph.js";
|
|
3
|
-
import { FolderNode, FolderTree } from "./library/folder-tree.js";
|
|
4
|
-
import { AccessPolicy, LibraryItemType, LocationHead } from "./library/library.js";
|
|
5
|
-
import { NodeType, OperationType, SubstitutionErrorType } from "./library/oss.js";
|
|
6
|
-
import { readErrorAnnotation, readTypeAnnotation } from "./rslang/ast-annotations.js";
|
|
7
|
-
import { RSErrorCode } from "./rslang/error.js";
|
|
8
3
|
import { TOKEN_ERROR, buildTree, findByUid, flattenAst, getNodeIndices, getNodeText, printAst, visitAstDFS } from "./parsing/ast.js";
|
|
9
4
|
import { printTree } from "./parsing/lezer-tree.js";
|
|
10
5
|
import { TokenID } from "./rslang/parser/token.js";
|
|
11
6
|
import { AnyTypificationT, EmptySetT, LogicT, TypeClass, TypeID, makeTypePath } from "./rslang/semantic/typification.js";
|
|
7
|
+
import { readErrorAnnotation, readTypeAnnotation } from "./rslang/ast-annotations.js";
|
|
8
|
+
import { RSErrorCode } from "./rslang/error.js";
|
|
12
9
|
import { applyHash_fnv1a, generateStub } from "./shared/hash.js";
|
|
13
10
|
import { C as printValue, o as TUPLE_ID, u as makeValuePath } from "./value-COprb2Je.js";
|
|
14
11
|
import { RSCalculator } from "./rslang/eval/calculator.js";
|
|
@@ -18,6 +15,10 @@ import { RSLangAnalyzer } from "./rslang/semantic/analyzer.js";
|
|
|
18
15
|
import { applyAsciiTypeSubstitutions, parseTypeText } from "./rslang/semantic/typification-parser.js";
|
|
19
16
|
import { TypificationGraph } from "./rslang/typification-graph.js";
|
|
20
17
|
import { CstClass, CstStatus, CstType } from "./library/rsform.js";
|
|
18
|
+
import { a as modelStatusCstDiagnostic, i as hasCstDiagnostic, n as RSDiagnosticCode, r as assignSchemaDiagnostics, t as DiagnosticKind } from "./diagnostics-DYMvTSev.js";
|
|
21
19
|
import { DEFAULT_VALUE_TEXT, EvalStatus } from "./library/rsmodel.js";
|
|
20
|
+
import { FolderNode, FolderTree } from "./library/folder-tree.js";
|
|
21
|
+
import { AccessPolicy, LibraryItemType, LocationHead } from "./library/library.js";
|
|
22
|
+
import { NodeType, OperationType, SubstitutionErrorType } from "./library/oss.js";
|
|
22
23
|
import { RSEngine } from "./library/rsengine.js";
|
|
23
|
-
export { AccessPolicy, AnyTypificationT, CstClass, CstStatus, CstType, DEFAULT_VALUE_TEXT, EmptySetT, EvalStatus, FolderNode, FolderTree, Grammeme, Graph, LibraryItemType, LocationHead, LogicT, NodeType, OperationType, RSCalculator, RSEngine, RSErrorCode, RSLangAnalyzer, ReferenceType, SubstitutionErrorType, TOKEN_ERROR, TUPLE_ID, TokenID, TypeClass, TypeID, TypificationGraph, ValueClass, applyAsciiTypeSubstitutions, applyHash_fnv1a, buildTree, findByUid, flattenAst, generateStub, getNodeIndices, getNodeText, makeTypePath, makeValuePath, parseTypeText, printAst, printTree, printValue, readErrorAnnotation, readTypeAnnotation, parser as rslangParser, supportedGrammemes, visitAstDFS };
|
|
24
|
+
export { AccessPolicy, AnyTypificationT, CstClass, CstStatus, CstType, DEFAULT_VALUE_TEXT, DiagnosticKind, EmptySetT, EvalStatus, FolderNode, FolderTree, Grammeme, Graph, LibraryItemType, LocationHead, LogicT, NodeType, OperationType, RSCalculator, RSDiagnosticCode, RSEngine, RSErrorCode, RSLangAnalyzer, ReferenceType, SubstitutionErrorType, TOKEN_ERROR, TUPLE_ID, TokenID, TypeClass, TypeID, TypificationGraph, ValueClass, applyAsciiTypeSubstitutions, applyHash_fnv1a, assignSchemaDiagnostics, buildTree, findByUid, flattenAst, generateStub, getNodeIndices, getNodeText, hasCstDiagnostic, makeTypePath, makeValuePath, modelStatusCstDiagnostic, parseTypeText, printAst, printTree, printValue, readErrorAnnotation, readTypeAnnotation, parser as rslangParser, supportedGrammemes, visitAstDFS };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as hasCstDiagnostic, i as assignSchemaDiagnostics, n as DiagnosticKind, o as modelStatusCstDiagnostic, r as RSDiagnosticCode, t as CstDiagnostic } from "../diagnostics-Clo3mkba.js";
|
|
2
|
+
export { CstDiagnostic, DiagnosticKind, RSDiagnosticCode, assignSchemaDiagnostics, hasCstDiagnostic, modelStatusCstDiagnostic };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as modelStatusCstDiagnostic, i as hasCstDiagnostic, n as RSDiagnosticCode, r as assignSchemaDiagnostics, t as DiagnosticKind } from "../diagnostics-DYMvTSev.js";
|
|
2
|
+
export { DiagnosticKind, RSDiagnosticCode, assignSchemaDiagnostics, hasCstDiagnostic, modelStatusCstDiagnostic };
|
package/dist/library/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { FolderNode, FolderTree } from "./folder-tree.js";
|
|
2
1
|
import { a as LibraryItemType, i as LibraryItemReference, n as CurrentVersion, o as LocationHead, r as LibraryItem, s as VersionInfo, t as AccessPolicy } from "../library-CYun28Xz.js";
|
|
2
|
+
import { C as TypeInfo, S as Substitution, _ as CstClass, a as hasCstDiagnostic, b as RSForm, c as BasicsContext, d as RSModel, f as RSModelStats, g as Constituenta, h as Attribution, i as assignSchemaDiagnostics, l as DEFAULT_VALUE_TEXT, m as ArgumentValue, n as DiagnosticKind, o as modelStatusCstDiagnostic, r as RSDiagnosticCode, s as BasicBinding, t as CstDiagnostic, u as EvalStatus, v as CstStatus, x as RSFormStats, y as CstType } from "../diagnostics-Clo3mkba.js";
|
|
3
|
+
import { FolderNode, FolderTree } from "./folder-tree.js";
|
|
3
4
|
import { n as OssLayout, r as Position2D } from "../oss-layout-3glgAqfn.js";
|
|
4
5
|
import { Block, CstSubstituteInfo, NodeType, Operation, OperationInput, OperationSchema, OperationSchemaStats, OperationSynthesis, OperationType, OssItem, SubstitutionErrorDescription, SubstitutionErrorType } from "./oss.js";
|
|
5
|
-
import { ArgumentValue, Attribution, Constituenta, CstClass, CstStatus, CstType, RSForm, RSFormStats, Substitution, TypeInfo } from "./rsform.js";
|
|
6
|
-
import { BasicBinding, BasicsContext, DEFAULT_VALUE_TEXT, EvalStatus, RSModel, RSModelStats } from "./rsmodel.js";
|
|
7
6
|
import { RSEngine } from "./rsengine.js";
|
|
8
7
|
|
|
9
8
|
//#region src/library/template-instantiation.d.ts
|
|
@@ -27,11 +26,18 @@ interface TemplateInstantiationItem {
|
|
|
27
26
|
typification_manual: string;
|
|
28
27
|
value_is_property: boolean;
|
|
29
28
|
}
|
|
29
|
+
/** Conflicting argument bindings inferred for the same template dependency. */
|
|
30
|
+
interface TemplateBindingConflict {
|
|
31
|
+
templateAlias: string;
|
|
32
|
+
paramAlias: string;
|
|
33
|
+
existing: string;
|
|
34
|
+
incoming: string;
|
|
35
|
+
}
|
|
30
36
|
/**
|
|
31
37
|
* Batch create plan: dependencies first, selected template constituent last.
|
|
32
38
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
39
|
+
* Reuses constituents whose substituted formal definition already exists in the target schema
|
|
40
|
+
* (normalized comparison), even when the bank alias differs from the matched target alias.
|
|
35
41
|
* {@link TemplateInstantiationPlan.mainDuplicateAlias} reports when the selected template is a duplicate.
|
|
36
42
|
* Does not set `insert_after`; the caller supplies insertion on the batch DTO.
|
|
37
43
|
*/
|
|
@@ -39,6 +45,8 @@ interface TemplateInstantiationPlan {
|
|
|
39
45
|
items: TemplateInstantiationItem[];
|
|
40
46
|
/** Set when the selected template expression already exists in the target schema. */
|
|
41
47
|
mainDuplicateAlias: string | null;
|
|
48
|
+
/** Set when nested template calls bind the same parameter to different global aliases. */
|
|
49
|
+
bindingConflict: TemplateBindingConflict | null;
|
|
42
50
|
}
|
|
43
51
|
/**
|
|
44
52
|
* Input for planning template instantiation into a conceptual schema.
|
|
@@ -80,6 +88,7 @@ declare class TemplateInstantiationPlanner {
|
|
|
80
88
|
private readonly userMapping;
|
|
81
89
|
private readonly depBindings;
|
|
82
90
|
private readonly depRefs;
|
|
91
|
+
private bindingConflict;
|
|
83
92
|
/** @param input - See {@link TemplateInstantiationInput}. */
|
|
84
93
|
constructor(input: TemplateInstantiationInput);
|
|
85
94
|
/** @returns Dependency items in topological order, then the main template item when it is not a duplicate. */
|
|
@@ -90,5 +99,5 @@ declare class TemplateInstantiationPlanner {
|
|
|
90
99
|
private collectDependencies;
|
|
91
100
|
}
|
|
92
101
|
//#endregion
|
|
93
|
-
export { AccessPolicy, type ArgumentValue, type Attribution, type BasicBinding, type BasicsContext, type Block, type Constituenta, CstClass, CstStatus, type CstSubstituteInfo, CstType, type CurrentVersion, DEFAULT_VALUE_TEXT, EvalStatus, FolderNode, FolderTree, type LibraryItem, type LibraryItemReference, LibraryItemType, LocationHead, NodeType, type Operation, type OperationInput, type OperationSchema, type OperationSchemaStats, type OperationSynthesis, OperationType, type OssItem, type OssLayout, type Position2D, RSEngine, type RSForm, type RSFormStats, type RSModel, type RSModelStats, type Substitution, type SubstitutionErrorDescription, SubstitutionErrorType, type TemplateInstantiationInput, type TemplateInstantiationItem, type TemplateInstantiationPlan, TemplateInstantiationPlanner, type TypeInfo, type VersionInfo, planTemplateInstantiation };
|
|
102
|
+
export { AccessPolicy, type ArgumentValue, type Attribution, type BasicBinding, type BasicsContext, type Block, type Constituenta, CstClass, type CstDiagnostic, CstStatus, type CstSubstituteInfo, CstType, type CurrentVersion, DEFAULT_VALUE_TEXT, DiagnosticKind, EvalStatus, FolderNode, FolderTree, type LibraryItem, type LibraryItemReference, LibraryItemType, LocationHead, NodeType, type Operation, type OperationInput, type OperationSchema, type OperationSchemaStats, type OperationSynthesis, OperationType, type OssItem, type OssLayout, type Position2D, RSDiagnosticCode, RSEngine, type RSForm, type RSFormStats, type RSModel, type RSModelStats, type Substitution, type SubstitutionErrorDescription, SubstitutionErrorType, type TemplateBindingConflict, type TemplateInstantiationInput, type TemplateInstantiationItem, type TemplateInstantiationPlan, TemplateInstantiationPlanner, type TypeInfo, type VersionInfo, assignSchemaDiagnostics, hasCstDiagnostic, modelStatusCstDiagnostic, planTemplateInstantiation };
|
|
94
103
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/library/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { FolderNode, FolderTree } from "./folder-tree.js";
|
|
2
|
-
import { AccessPolicy, LibraryItemType, LocationHead } from "./library.js";
|
|
3
|
-
import { NodeType, OperationType, SubstitutionErrorType } from "./oss.js";
|
|
4
1
|
import { visitAstDFS } from "../parsing/ast.js";
|
|
5
2
|
import "../parsing/index.js";
|
|
6
3
|
import { TokenID } from "../rslang/parser/token.js";
|
|
@@ -8,8 +5,11 @@ import { TypeID } from "../rslang/semantic/typification.js";
|
|
|
8
5
|
import { labelType } from "../rslang/labels.js";
|
|
9
6
|
import { applyAliasMapping, isGlobalAlias, parseRSLangExpression, splitTemplateDefinition, substituteLocalAliases, substituteTemplateArgs } from "../rslang/api.js";
|
|
10
7
|
import { CstClass, CstStatus, CstType } from "./rsform.js";
|
|
11
|
-
import { applyMappingToConstituents, argumentValuesToMapping,
|
|
8
|
+
import { D as isFunctional, a as modelStatusCstDiagnostic, c as applyMappingToConstituents, h as generateAlias, i as hasCstDiagnostic, j as normalizeExpression, l as argumentValuesToMapping, n as RSDiagnosticCode, r as assignSchemaDiagnostics, t as DiagnosticKind, w as inferTemplatedType } from "../diagnostics-DYMvTSev.js";
|
|
12
9
|
import { DEFAULT_VALUE_TEXT, EvalStatus } from "./rsmodel.js";
|
|
10
|
+
import { FolderNode, FolderTree } from "./folder-tree.js";
|
|
11
|
+
import { AccessPolicy, LibraryItemType, LocationHead } from "./library.js";
|
|
12
|
+
import { NodeType, OperationType, SubstitutionErrorType } from "./oss.js";
|
|
13
13
|
import { RSEngine } from "./rsengine.js";
|
|
14
14
|
//#region src/library/template-instantiation.ts
|
|
15
15
|
/**
|
|
@@ -39,6 +39,7 @@ var TemplateInstantiationPlanner = class {
|
|
|
39
39
|
userMapping;
|
|
40
40
|
depBindings = /* @__PURE__ */ new Map();
|
|
41
41
|
depRefs = /* @__PURE__ */ new Map();
|
|
42
|
+
bindingConflict = null;
|
|
42
43
|
/** @param input - See {@link TemplateInstantiationInput}. */
|
|
43
44
|
constructor(input) {
|
|
44
45
|
this.targetSchema = input.targetSchema;
|
|
@@ -52,12 +53,18 @@ var TemplateInstantiationPlanner = class {
|
|
|
52
53
|
plan() {
|
|
53
54
|
const mainDefinition = substituteTemplateArgs(this.prototype.definition_formal, this.userMapping);
|
|
54
55
|
this.collectDependencies(mainDefinition, this.userMapping);
|
|
56
|
+
if (this.bindingConflict) return {
|
|
57
|
+
items: [],
|
|
58
|
+
mainDuplicateAlias: null,
|
|
59
|
+
bindingConflict: this.bindingConflict
|
|
60
|
+
};
|
|
55
61
|
const definitionIndex = createFormalDefinitionIndex(this.targetSchema);
|
|
56
62
|
const dependencyItems = this.buildDependencyItems(definitionIndex);
|
|
57
63
|
const { item: mainItem, duplicateAlias: mainDuplicateAlias } = this.buildMainItem(mainDefinition, dependencyItems.takenAliases, dependencyItems.aliasMapping, definitionIndex);
|
|
58
64
|
return {
|
|
59
65
|
items: mainItem ? [...dependencyItems.items, mainItem] : dependencyItems.items,
|
|
60
|
-
mainDuplicateAlias
|
|
66
|
+
mainDuplicateAlias,
|
|
67
|
+
bindingConflict: null
|
|
61
68
|
};
|
|
62
69
|
}
|
|
63
70
|
buildDependencyItems(definitionIndex) {
|
|
@@ -113,13 +120,22 @@ var TemplateInstantiationPlanner = class {
|
|
|
113
120
|
};
|
|
114
121
|
}
|
|
115
122
|
ensureDep(templateAlias, bindings, referrer) {
|
|
116
|
-
if (
|
|
123
|
+
if (this.bindingConflict) return;
|
|
124
|
+
if (!this.templateByAlias.has(templateAlias)) return;
|
|
117
125
|
if (referrer && this.depBindings.has(referrer)) {
|
|
118
126
|
const refs = this.depRefs.get(referrer) ?? /* @__PURE__ */ new Set();
|
|
119
127
|
refs.add(templateAlias);
|
|
120
128
|
this.depRefs.set(referrer, refs);
|
|
121
129
|
}
|
|
122
|
-
const
|
|
130
|
+
const mergeResult = mergeBindings(this.depBindings.get(templateAlias), bindings);
|
|
131
|
+
if (!mergeResult.ok) {
|
|
132
|
+
this.bindingConflict = {
|
|
133
|
+
templateAlias,
|
|
134
|
+
...mergeResult.conflict
|
|
135
|
+
};
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const merged = mergeResult.bindings;
|
|
123
139
|
const changed = !this.depBindings.has(templateAlias) || merged.size !== (this.depBindings.get(templateAlias)?.size ?? 0);
|
|
124
140
|
this.depBindings.set(templateAlias, merged);
|
|
125
141
|
if (!changed && referrer) return;
|
|
@@ -129,6 +145,7 @@ var TemplateInstantiationPlanner = class {
|
|
|
129
145
|
this.collectDependencies(definition, argumentValuesToMapping(args), templateAlias);
|
|
130
146
|
}
|
|
131
147
|
collectDependencies(expression, scope, referrer) {
|
|
148
|
+
if (this.bindingConflict) return;
|
|
132
149
|
const ast = parseRSLangExpression(expression);
|
|
133
150
|
if (!ast) return;
|
|
134
151
|
for (const call of extractFuncCalls(ast, expression)) {
|
|
@@ -190,8 +207,22 @@ function resolveArgBinding(argExpr, scope) {
|
|
|
190
207
|
}
|
|
191
208
|
function mergeBindings(existing, incoming) {
|
|
192
209
|
const result = new Map(existing);
|
|
193
|
-
for (const [alias, value] of incoming)
|
|
194
|
-
|
|
210
|
+
for (const [alias, value] of incoming) {
|
|
211
|
+
const existingValue = result.get(alias);
|
|
212
|
+
if (existingValue === void 0) result.set(alias, value);
|
|
213
|
+
else if (existingValue !== value) return {
|
|
214
|
+
ok: false,
|
|
215
|
+
conflict: {
|
|
216
|
+
paramAlias: alias,
|
|
217
|
+
existing: existingValue,
|
|
218
|
+
incoming: value
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
ok: true,
|
|
224
|
+
bindings: result
|
|
225
|
+
};
|
|
195
226
|
}
|
|
196
227
|
function bindingMapToArgs(params, bindings) {
|
|
197
228
|
return params.map((param) => ({
|
|
@@ -236,9 +267,6 @@ function extractFuncCalls(ast, expression) {
|
|
|
236
267
|
});
|
|
237
268
|
return result;
|
|
238
269
|
}
|
|
239
|
-
function targetHasAlias(schema, alias) {
|
|
240
|
-
return schema.items.some((cst) => cst.alias === alias);
|
|
241
|
-
}
|
|
242
270
|
function topologicalSort(aliases, refs) {
|
|
243
271
|
const remaining = new Set(aliases);
|
|
244
272
|
const sorted = [];
|
|
@@ -256,6 +284,6 @@ function topologicalSort(aliases, refs) {
|
|
|
256
284
|
return sorted;
|
|
257
285
|
}
|
|
258
286
|
//#endregion
|
|
259
|
-
export { AccessPolicy, CstClass, CstStatus, CstType, DEFAULT_VALUE_TEXT, EvalStatus, FolderNode, FolderTree, LibraryItemType, LocationHead, NodeType, OperationType, RSEngine, SubstitutionErrorType, TemplateInstantiationPlanner, planTemplateInstantiation };
|
|
287
|
+
export { AccessPolicy, CstClass, CstStatus, CstType, DEFAULT_VALUE_TEXT, DiagnosticKind, EvalStatus, FolderNode, FolderTree, LibraryItemType, LocationHead, NodeType, OperationType, RSDiagnosticCode, RSEngine, SubstitutionErrorType, TemplateInstantiationPlanner, assignSchemaDiagnostics, hasCstDiagnostic, modelStatusCstDiagnostic, planTemplateInstantiation };
|
|
260
288
|
|
|
261
289
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/library/template-instantiation.ts"],"sourcesContent":["/**\n * Module: template instantiation from the expression bank into a target {@link RSForm}.\n */\n\nimport { type AstNode, visitAstDFS } from '../parsing';\nimport {\n type AliasMapping,\n applyAliasMapping,\n isGlobalAlias,\n parseRSLangExpression,\n splitTemplateDefinition,\n substituteLocalAliases,\n substituteTemplateArgs\n} from '../rslang/api';\nimport { labelType } from '../rslang/labels';\nimport { TokenID } from '../rslang/parser/token';\nimport { TypeID } from '../rslang/semantic/typification';\n\nimport { type ArgumentValue, type Constituenta, type CstType, type RSForm } from './rsform';\nimport {\n applyMappingToConstituents,\n argumentValuesToMapping,\n generateAlias,\n inferTemplatedType,\n isFunctional,\n normalizeExpression\n} from './rsform-api';\n\n/**\n * Payload for one {@link Constituenta} to create when instantiating an expression-bank template.\n *\n * Aliases are generated for the target schema. Formal definitions and typifications already\n * reflect user argument substitution and remapping of bank aliases to those new aliases.\n */\nexport interface TemplateInstantiationItem {\n /** Alias to assign in the target schema. */\n alias: string;\n /** Inferred type after argument substitution (function/predicate may become term/axiom). */\n cst_type: CstType;\n crucial: boolean;\n convention: string;\n definition_formal: string;\n definition_raw: string;\n term_raw: string;\n term_forms: Constituenta['term_forms'];\n typification_manual: string;\n value_is_property: boolean;\n}\n\n/**\n * Batch create plan: dependencies first, selected template constituent last.\n *\n * Skips bank functions/predicates whose alias already exists in the target schema, and\n * constituents whose substituted formal definition already exists (normalized comparison).\n * {@link TemplateInstantiationPlan.mainDuplicateAlias} reports when the selected template is a duplicate.\n * Does not set `insert_after`; the caller supplies insertion on the batch DTO.\n */\nexport interface TemplateInstantiationPlan {\n items: TemplateInstantiationItem[];\n /** Set when the selected template expression already exists in the target schema. */\n mainDuplicateAlias: string | null;\n}\n\n/**\n * Input for planning template instantiation into a conceptual schema.\n */\nexport interface TemplateInstantiationInput {\n /** Schema that will receive new constituents. */\n targetSchema: RSForm;\n /** All constituents of the selected expression-bank RSForm (not only the prototype). */\n templateItems: Constituenta[];\n /** Template constituent chosen in the UI (main expression to add). */\n prototype: Constituenta;\n /** User bindings from template parameter aliases to target-schema global aliases. */\n userArgs: ArgumentValue[];\n /**\n * Main constituent attributes from the create dialog (alias, labels, flags).\n * `definition_formal` and `cst_type` may be overridden from `prototype` and `userArgs`.\n */\n mainItem: TemplateInstantiationItem;\n}\n\ninterface FuncCallRef {\n callee: string;\n args: string[];\n}\n\ninterface TemplateParam {\n alias: string;\n typification: string;\n}\n\n/**\n * Build a batch create plan for a template expression and its bank dependencies.\n *\n * Walks nested `F#` / `P#` calls in the substituted expression, collects missing term-functions\n * and predicate-functions from `templateItems`, propagates argument bindings into nested calls,\n * topologically orders dependencies, and remaps bank aliases to freshly generated target aliases.\n */\nexport function planTemplateInstantiation(input: TemplateInstantiationInput): TemplateInstantiationPlan {\n return new TemplateInstantiationPlanner(input).plan();\n}\n\n/**\n * Stateful planner for {@link planTemplateInstantiation}.\n *\n * Prefer the function wrapper unless you need to hold or reuse planner state between calls.\n */\nexport class TemplateInstantiationPlanner {\n private readonly targetSchema: RSForm;\n private readonly prototype: Constituenta;\n private readonly userArgs: ArgumentValue[];\n private readonly mainItemTemplate: TemplateInstantiationItem;\n private readonly templateByAlias: Map<string, Constituenta>;\n private readonly userMapping: AliasMapping;\n private readonly depBindings = new Map<string, Map<string, string>>();\n private readonly depRefs = new Map<string, Set<string>>();\n\n /** @param input - See {@link TemplateInstantiationInput}. */\n constructor(input: TemplateInstantiationInput) {\n this.targetSchema = input.targetSchema;\n this.prototype = input.prototype;\n this.userArgs = input.userArgs;\n this.mainItemTemplate = input.mainItem;\n this.templateByAlias = new Map(\n input.templateItems.filter(cst => isFunctional(cst.cst_type)).map(cst => [cst.alias, cst])\n );\n this.userMapping = argumentValuesToMapping(input.userArgs);\n }\n\n /** @returns Dependency items in topological order, then the main template item when it is not a duplicate. */\n plan(): TemplateInstantiationPlan {\n const mainDefinition = substituteTemplateArgs(this.prototype.definition_formal, this.userMapping);\n this.collectDependencies(mainDefinition, this.userMapping);\n\n const definitionIndex = createFormalDefinitionIndex(this.targetSchema);\n const dependencyItems = this.buildDependencyItems(definitionIndex);\n const { item: mainItem, duplicateAlias: mainDuplicateAlias } = this.buildMainItem(\n mainDefinition,\n dependencyItems.takenAliases,\n dependencyItems.aliasMapping,\n definitionIndex\n );\n\n return {\n items: mainItem ? [...dependencyItems.items, mainItem] : dependencyItems.items,\n mainDuplicateAlias\n };\n }\n\n private buildDependencyItems(definitionIndex: FormalDefinitionIndex): {\n items: TemplateInstantiationItem[];\n aliasMapping: AliasMapping;\n takenAliases: string[];\n } {\n const dependencyAliases = topologicalSort([...this.depBindings.keys()], this.depRefs);\n const aliasMapping: AliasMapping = {};\n const takenAliases: string[] = [];\n const reservedAliases = [this.mainItemTemplate.alias];\n const items: TemplateInstantiationItem[] = [];\n\n for (const templateAlias of dependencyAliases) {\n const template = this.templateByAlias.get(templateAlias)!;\n const bindings = this.depBindings.get(templateAlias)!;\n const args = bindingMapToArgs(getTemplateParams(template), bindings);\n const cst_type = inferTemplatedType(template.cst_type, args);\n const definition = applyAliasMapping(\n substituteTemplateArgs(template.definition_formal, argumentValuesToMapping(args)),\n aliasMapping\n );\n\n const existingAlias = definitionIndex.find(cst_type, definition);\n if (existingAlias) {\n aliasMapping[templateAlias] = existingAlias;\n continue;\n }\n\n const alias = generateAlias(template.cst_type, this.targetSchema, [...reservedAliases, ...takenAliases]);\n takenAliases.push(alias);\n aliasMapping[templateAlias] = alias;\n\n const item = instantiateTemplateItem(template, args, alias);\n item.definition_formal = definition;\n applyMappingToConstituents([item], aliasMapping, false);\n definitionIndex.register(cst_type, item.definition_formal, alias);\n items.push(item);\n }\n\n return { items, aliasMapping, takenAliases };\n }\n\n private buildMainItem(\n mainDefinition: string,\n takenAliases: string[],\n aliasMapping: AliasMapping,\n definitionIndex: FormalDefinitionIndex\n ): { item: TemplateInstantiationItem | null; duplicateAlias: string | null } {\n const mappedDefinition = applyAliasMapping(mainDefinition, aliasMapping);\n const cst_type = inferTemplatedType(this.prototype.cst_type, this.userArgs);\n\n const duplicateAlias = definitionIndex.find(cst_type, mappedDefinition);\n if (duplicateAlias) {\n return { item: null, duplicateAlias };\n }\n\n const mainItem: TemplateInstantiationItem = {\n ...this.mainItemTemplate,\n definition_formal: mappedDefinition,\n cst_type\n };\n applyMappingToConstituents([mainItem], aliasMapping, false);\n\n if (takenAliases.includes(mainItem.alias)) {\n mainItem.alias = generateAlias(mainItem.cst_type, this.targetSchema, [\n ...takenAliases,\n this.mainItemTemplate.alias\n ]);\n }\n\n return { item: mainItem, duplicateAlias: null };\n }\n\n private ensureDep(templateAlias: string, bindings: Map<string, string>, referrer?: string): void {\n if (targetHasAlias(this.targetSchema, templateAlias) || !this.templateByAlias.has(templateAlias)) {\n return;\n }\n if (referrer && this.depBindings.has(referrer)) {\n const refs = this.depRefs.get(referrer) ?? new Set<string>();\n refs.add(templateAlias);\n this.depRefs.set(referrer, refs);\n }\n const merged = mergeBindings(this.depBindings.get(templateAlias), bindings);\n const changed =\n !this.depBindings.has(templateAlias) || merged.size !== (this.depBindings.get(templateAlias)?.size ?? 0);\n this.depBindings.set(templateAlias, merged);\n if (!changed && referrer) {\n return;\n }\n const template = this.templateByAlias.get(templateAlias)!;\n const args = bindingMapToArgs(getTemplateParams(template), merged);\n const definition = substituteTemplateArgs(template.definition_formal, argumentValuesToMapping(args));\n this.collectDependencies(definition, argumentValuesToMapping(args), templateAlias);\n }\n\n private collectDependencies(expression: string, scope: AliasMapping, referrer?: string): void {\n const ast = parseRSLangExpression(expression);\n if (!ast) {\n return;\n }\n for (const call of extractFuncCalls(ast, expression)) {\n const template = this.templateByAlias.get(call.callee);\n if (!template) {\n continue;\n }\n const scopedArgs = call.args.map(arg => substituteLocalAliases(arg, scope));\n const bindings = bindingsFromCall(getTemplateParams(template), scopedArgs, scope);\n this.ensureDep(call.callee, bindings, referrer);\n }\n }\n}\n\n// ======= Internals ========\n\n/** Normalized formal definitions in the target schema and in the current plan. */\nclass FormalDefinitionIndex {\n private readonly byKey = new Map<string, string>();\n\n register(cst_type: CstType, definition_formal: string, alias: string): void {\n const normalized = normalizeExpression(definition_formal, cst_type);\n if (!normalized) {\n return;\n }\n this.byKey.set(formalDefinitionKey(cst_type, normalized), alias);\n }\n\n find(cst_type: CstType, definition_formal: string): string | null {\n const normalized = normalizeExpression(definition_formal, cst_type);\n if (!normalized) {\n return null;\n }\n return this.byKey.get(formalDefinitionKey(cst_type, normalized)) ?? null;\n }\n}\n\nfunction createFormalDefinitionIndex(schema: RSForm): FormalDefinitionIndex {\n const index = new FormalDefinitionIndex();\n for (const cst of schema.items) {\n index.register(cst.cst_type, cst.definition_formal, cst.alias);\n }\n return index;\n}\n\nfunction formalDefinitionKey(cst_type: CstType, normalized: string): string {\n return `${cst_type}\\0${normalized}`;\n}\n\nfunction instantiateTemplateItem(\n template: Constituenta,\n args: ArgumentValue[],\n alias: string\n): TemplateInstantiationItem {\n return {\n alias,\n cst_type: inferTemplatedType(template.cst_type, args),\n crucial: template.crucial,\n convention: template.convention,\n definition_formal: substituteTemplateArgs(template.definition_formal, argumentValuesToMapping(args)),\n definition_raw: template.definition_raw,\n term_raw: template.term_raw,\n term_forms: [...template.term_forms],\n typification_manual: template.typification_manual,\n value_is_property: template.value_is_property\n };\n}\n\nfunction bindingsFromCall(params: TemplateParam[], callArgs: string[], scope: AliasMapping): Map<string, string> {\n const bindings = new Map<string, string>();\n params.forEach((param, index) => {\n const value = resolveArgBinding(callArgs[index] ?? '', scope);\n if (value) {\n bindings.set(param.alias, value);\n }\n });\n return bindings;\n}\n\nfunction resolveArgBinding(argExpr: string, scope: AliasMapping): string | undefined {\n const scoped = substituteLocalAliases(argExpr, scope).trim();\n if (isGlobalAlias(scoped)) {\n return scoped;\n }\n return undefined;\n}\n\nfunction mergeBindings(existing: Map<string, string> | undefined, incoming: Map<string, string>): Map<string, string> {\n const result = new Map(existing);\n for (const [alias, value] of incoming) {\n if (!result.has(alias)) {\n result.set(alias, value);\n }\n }\n return result;\n}\n\nfunction bindingMapToArgs(params: TemplateParam[], bindings: Map<string, string>): ArgumentValue[] {\n return params.map(param => ({\n alias: param.alias,\n typification: param.typification,\n value: bindings.get(param.alias)\n }));\n}\n\nfunction getTemplateParams(template: Constituenta): TemplateParam[] {\n const effectiveType = template.effectiveType;\n if (effectiveType && (effectiveType.typeID === TypeID.function || effectiveType.typeID === TypeID.predicate)) {\n return effectiveType.args.map(arg => ({\n alias: arg.alias,\n typification: labelType(arg.type)\n }));\n }\n const { head } = splitTemplateDefinition(template.definition_formal);\n if (!head) {\n return [];\n }\n return head.split(',').map(part => {\n const trimmed = part.trim();\n const separator = trimmed.indexOf('∈');\n if (separator === -1) {\n return { alias: trimmed, typification: '' };\n }\n return {\n alias: trimmed.slice(0, separator).trim(),\n typification: trimmed.slice(separator + 1).trim()\n };\n });\n}\n\nfunction extractFuncCalls(ast: AstNode, expression: string): FuncCallRef[] {\n const result: FuncCallRef[] = [];\n visitAstDFS(ast, node => {\n if (node.typeID !== TokenID.NT_FUNC_CALL || node.children.length < 1) {\n return;\n }\n const calleeNode = node.children[0];\n if (\n calleeNode.typeID !== TokenID.ID_FUNCTION &&\n calleeNode.typeID !== TokenID.ID_PREDICATE &&\n calleeNode.typeID !== TokenID.ID_GLOBAL\n ) {\n return;\n }\n const callee = expression.slice(calleeNode.from, calleeNode.to);\n if (!/^[FP]\\d+$/.test(callee)) {\n return;\n }\n result.push({\n callee,\n args: node.children.slice(1).map(child => expression.slice(child.from, child.to).trim())\n });\n });\n return result;\n}\n\nfunction targetHasAlias(schema: RSForm, alias: string): boolean {\n return schema.items.some(cst => cst.alias === alias);\n}\n\nfunction topologicalSort(aliases: string[], refs: Map<string, Set<string>>): string[] {\n const remaining = new Set(aliases);\n const sorted: string[] = [];\n while (remaining.size > 0) {\n const ready = [...remaining].filter(alias => {\n const deps = refs.get(alias) ?? new Set<string>();\n return [...deps].every(dep => !remaining.has(dep));\n });\n if (ready.length === 0) {\n return [...remaining, ...sorted].reverse();\n }\n ready.sort();\n for (const alias of ready) {\n sorted.push(alias);\n remaining.delete(alias);\n }\n }\n return sorted;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmGA,SAAgB,0BAA0B,OAA8D;CACtG,OAAO,IAAI,6BAA6B,KAAK,CAAC,CAAC,KAAK;AACtD;;;;;;AAOA,IAAa,+BAAb,MAA0C;CACxC;CACA;CACA;CACA;CACA;CACA;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CAAC,CAAC,KAAI,UAAS,WAAW,MAAM,MAAM,MAAM,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC;EACzF,CAAC;CACH,CAAC;CACD,OAAO;AACT;AAEA,SAAS,eAAe,QAAgB,OAAwB;CAC9D,OAAO,OAAO,MAAM,MAAK,QAAO,IAAI,UAAU,KAAK;AACrD;AAEA,SAAS,gBAAgB,SAAmB,MAA0C;CACpF,MAAM,YAAY,IAAI,IAAI,OAAO;CACjC,MAAM,SAAmB,CAAC;CAC1B,OAAO,UAAU,OAAO,GAAG;EACzB,MAAM,QAAQ,CAAC,GAAG,SAAS,CAAC,CAAC,QAAO,UAAS;GAE3C,OAAO,CAAC,GADK,KAAK,IAAI,KAAK,qBAAK,IAAI,IAAY,CACjC,CAAC,CAAC,OAAM,QAAO,CAAC,UAAU,IAAI,GAAG,CAAC;EACnD,CAAC;EACD,IAAI,MAAM,WAAW,GACnB,OAAO,CAAC,GAAG,WAAW,GAAG,MAAM,CAAC,CAAC,QAAQ;EAE3C,MAAM,KAAK;EACX,KAAK,MAAM,SAAS,OAAO;GACzB,OAAO,KAAK,KAAK;GACjB,UAAU,OAAO,KAAK;EACxB;CACF;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/library/template-instantiation.ts"],"sourcesContent":["/**\n * Module: template instantiation from the expression bank into a target {@link RSForm}.\n */\n\nimport { type AstNode, visitAstDFS } from '../parsing';\nimport {\n type AliasMapping,\n applyAliasMapping,\n isGlobalAlias,\n parseRSLangExpression,\n splitTemplateDefinition,\n substituteLocalAliases,\n substituteTemplateArgs\n} from '../rslang/api';\nimport { labelType } from '../rslang/labels';\nimport { TokenID } from '../rslang/parser/token';\nimport { TypeID } from '../rslang/semantic/typification';\n\nimport { type ArgumentValue, type Constituenta, type CstType, type RSForm } from './rsform';\nimport {\n applyMappingToConstituents,\n argumentValuesToMapping,\n generateAlias,\n inferTemplatedType,\n isFunctional,\n normalizeExpression\n} from './rsform-api';\n\n/**\n * Payload for one {@link Constituenta} to create when instantiating an expression-bank template.\n *\n * Aliases are generated for the target schema. Formal definitions and typifications already\n * reflect user argument substitution and remapping of bank aliases to those new aliases.\n */\nexport interface TemplateInstantiationItem {\n /** Alias to assign in the target schema. */\n alias: string;\n /** Inferred type after argument substitution (function/predicate may become term/axiom). */\n cst_type: CstType;\n crucial: boolean;\n convention: string;\n definition_formal: string;\n definition_raw: string;\n term_raw: string;\n term_forms: Constituenta['term_forms'];\n typification_manual: string;\n value_is_property: boolean;\n}\n\n/** Conflicting argument bindings inferred for the same template dependency. */\nexport interface TemplateBindingConflict {\n templateAlias: string;\n paramAlias: string;\n existing: string;\n incoming: string;\n}\n\n/**\n * Batch create plan: dependencies first, selected template constituent last.\n *\n * Reuses constituents whose substituted formal definition already exists in the target schema\n * (normalized comparison), even when the bank alias differs from the matched target alias.\n * {@link TemplateInstantiationPlan.mainDuplicateAlias} reports when the selected template is a duplicate.\n * Does not set `insert_after`; the caller supplies insertion on the batch DTO.\n */\nexport interface TemplateInstantiationPlan {\n items: TemplateInstantiationItem[];\n /** Set when the selected template expression already exists in the target schema. */\n mainDuplicateAlias: string | null;\n /** Set when nested template calls bind the same parameter to different global aliases. */\n bindingConflict: TemplateBindingConflict | null;\n}\n\n/**\n * Input for planning template instantiation into a conceptual schema.\n */\nexport interface TemplateInstantiationInput {\n /** Schema that will receive new constituents. */\n targetSchema: RSForm;\n /** All constituents of the selected expression-bank RSForm (not only the prototype). */\n templateItems: Constituenta[];\n /** Template constituent chosen in the UI (main expression to add). */\n prototype: Constituenta;\n /** User bindings from template parameter aliases to target-schema global aliases. */\n userArgs: ArgumentValue[];\n /**\n * Main constituent attributes from the create dialog (alias, labels, flags).\n * `definition_formal` and `cst_type` may be overridden from `prototype` and `userArgs`.\n */\n mainItem: TemplateInstantiationItem;\n}\n\ninterface FuncCallRef {\n callee: string;\n args: string[];\n}\n\ninterface TemplateParam {\n alias: string;\n typification: string;\n}\n\n/**\n * Build a batch create plan for a template expression and its bank dependencies.\n *\n * Walks nested `F#` / `P#` calls in the substituted expression, collects missing term-functions\n * and predicate-functions from `templateItems`, propagates argument bindings into nested calls,\n * topologically orders dependencies, and remaps bank aliases to freshly generated target aliases.\n */\nexport function planTemplateInstantiation(input: TemplateInstantiationInput): TemplateInstantiationPlan {\n return new TemplateInstantiationPlanner(input).plan();\n}\n\n/**\n * Stateful planner for {@link planTemplateInstantiation}.\n *\n * Prefer the function wrapper unless you need to hold or reuse planner state between calls.\n */\nexport class TemplateInstantiationPlanner {\n private readonly targetSchema: RSForm;\n private readonly prototype: Constituenta;\n private readonly userArgs: ArgumentValue[];\n private readonly mainItemTemplate: TemplateInstantiationItem;\n private readonly templateByAlias: Map<string, Constituenta>;\n private readonly userMapping: AliasMapping;\n private readonly depBindings = new Map<string, Map<string, string>>();\n private readonly depRefs = new Map<string, Set<string>>();\n private bindingConflict: TemplateBindingConflict | null = null;\n\n /** @param input - See {@link TemplateInstantiationInput}. */\n constructor(input: TemplateInstantiationInput) {\n this.targetSchema = input.targetSchema;\n this.prototype = input.prototype;\n this.userArgs = input.userArgs;\n this.mainItemTemplate = input.mainItem;\n this.templateByAlias = new Map(\n input.templateItems.filter(cst => isFunctional(cst.cst_type)).map(cst => [cst.alias, cst])\n );\n this.userMapping = argumentValuesToMapping(input.userArgs);\n }\n\n /** @returns Dependency items in topological order, then the main template item when it is not a duplicate. */\n plan(): TemplateInstantiationPlan {\n const mainDefinition = substituteTemplateArgs(this.prototype.definition_formal, this.userMapping);\n this.collectDependencies(mainDefinition, this.userMapping);\n\n if (this.bindingConflict) {\n return { items: [], mainDuplicateAlias: null, bindingConflict: this.bindingConflict };\n }\n\n const definitionIndex = createFormalDefinitionIndex(this.targetSchema);\n const dependencyItems = this.buildDependencyItems(definitionIndex);\n const { item: mainItem, duplicateAlias: mainDuplicateAlias } = this.buildMainItem(\n mainDefinition,\n dependencyItems.takenAliases,\n dependencyItems.aliasMapping,\n definitionIndex\n );\n\n return {\n items: mainItem ? [...dependencyItems.items, mainItem] : dependencyItems.items,\n mainDuplicateAlias,\n bindingConflict: null\n };\n }\n\n private buildDependencyItems(definitionIndex: FormalDefinitionIndex): {\n items: TemplateInstantiationItem[];\n aliasMapping: AliasMapping;\n takenAliases: string[];\n } {\n const dependencyAliases = topologicalSort([...this.depBindings.keys()], this.depRefs);\n const aliasMapping: AliasMapping = {};\n const takenAliases: string[] = [];\n const reservedAliases = [this.mainItemTemplate.alias];\n const items: TemplateInstantiationItem[] = [];\n\n for (const templateAlias of dependencyAliases) {\n const template = this.templateByAlias.get(templateAlias)!;\n const bindings = this.depBindings.get(templateAlias)!;\n const args = bindingMapToArgs(getTemplateParams(template), bindings);\n const cst_type = inferTemplatedType(template.cst_type, args);\n const definition = applyAliasMapping(\n substituteTemplateArgs(template.definition_formal, argumentValuesToMapping(args)),\n aliasMapping\n );\n\n const existingAlias = definitionIndex.find(cst_type, definition);\n if (existingAlias) {\n aliasMapping[templateAlias] = existingAlias;\n continue;\n }\n\n const alias = generateAlias(template.cst_type, this.targetSchema, [...reservedAliases, ...takenAliases]);\n takenAliases.push(alias);\n aliasMapping[templateAlias] = alias;\n\n const item = instantiateTemplateItem(template, args, alias);\n item.definition_formal = definition;\n applyMappingToConstituents([item], aliasMapping, false);\n definitionIndex.register(cst_type, item.definition_formal, alias);\n items.push(item);\n }\n\n return { items, aliasMapping, takenAliases };\n }\n\n private buildMainItem(\n mainDefinition: string,\n takenAliases: string[],\n aliasMapping: AliasMapping,\n definitionIndex: FormalDefinitionIndex\n ): { item: TemplateInstantiationItem | null; duplicateAlias: string | null } {\n const mappedDefinition = applyAliasMapping(mainDefinition, aliasMapping);\n const cst_type = inferTemplatedType(this.prototype.cst_type, this.userArgs);\n\n const duplicateAlias = definitionIndex.find(cst_type, mappedDefinition);\n if (duplicateAlias) {\n return { item: null, duplicateAlias };\n }\n\n const mainItem: TemplateInstantiationItem = {\n ...this.mainItemTemplate,\n definition_formal: mappedDefinition,\n cst_type\n };\n applyMappingToConstituents([mainItem], aliasMapping, false);\n\n if (takenAliases.includes(mainItem.alias)) {\n mainItem.alias = generateAlias(mainItem.cst_type, this.targetSchema, [\n ...takenAliases,\n this.mainItemTemplate.alias\n ]);\n }\n\n return { item: mainItem, duplicateAlias: null };\n }\n\n private ensureDep(templateAlias: string, bindings: Map<string, string>, referrer?: string): void {\n if (this.bindingConflict) {\n return;\n }\n if (!this.templateByAlias.has(templateAlias)) {\n return;\n }\n if (referrer && this.depBindings.has(referrer)) {\n const refs = this.depRefs.get(referrer) ?? new Set<string>();\n refs.add(templateAlias);\n this.depRefs.set(referrer, refs);\n }\n const mergeResult = mergeBindings(this.depBindings.get(templateAlias), bindings);\n if (!mergeResult.ok) {\n this.bindingConflict = { templateAlias, ...mergeResult.conflict };\n return;\n }\n const merged = mergeResult.bindings;\n const changed =\n !this.depBindings.has(templateAlias) || merged.size !== (this.depBindings.get(templateAlias)?.size ?? 0);\n this.depBindings.set(templateAlias, merged);\n if (!changed && referrer) {\n return;\n }\n const template = this.templateByAlias.get(templateAlias)!;\n const args = bindingMapToArgs(getTemplateParams(template), merged);\n const definition = substituteTemplateArgs(template.definition_formal, argumentValuesToMapping(args));\n this.collectDependencies(definition, argumentValuesToMapping(args), templateAlias);\n }\n\n private collectDependencies(expression: string, scope: AliasMapping, referrer?: string): void {\n if (this.bindingConflict) {\n return;\n }\n const ast = parseRSLangExpression(expression);\n if (!ast) {\n return;\n }\n for (const call of extractFuncCalls(ast, expression)) {\n const template = this.templateByAlias.get(call.callee);\n if (!template) {\n continue;\n }\n const scopedArgs = call.args.map(arg => substituteLocalAliases(arg, scope));\n const bindings = bindingsFromCall(getTemplateParams(template), scopedArgs, scope);\n this.ensureDep(call.callee, bindings, referrer);\n }\n }\n}\n\n// ======= Internals ========\n\n/** Normalized formal definitions in the target schema and in the current plan. */\nclass FormalDefinitionIndex {\n private readonly byKey = new Map<string, string>();\n\n register(cst_type: CstType, definition_formal: string, alias: string): void {\n const normalized = normalizeExpression(definition_formal, cst_type);\n if (!normalized) {\n return;\n }\n this.byKey.set(formalDefinitionKey(cst_type, normalized), alias);\n }\n\n find(cst_type: CstType, definition_formal: string): string | null {\n const normalized = normalizeExpression(definition_formal, cst_type);\n if (!normalized) {\n return null;\n }\n return this.byKey.get(formalDefinitionKey(cst_type, normalized)) ?? null;\n }\n}\n\nfunction createFormalDefinitionIndex(schema: RSForm): FormalDefinitionIndex {\n const index = new FormalDefinitionIndex();\n for (const cst of schema.items) {\n index.register(cst.cst_type, cst.definition_formal, cst.alias);\n }\n return index;\n}\n\nfunction formalDefinitionKey(cst_type: CstType, normalized: string): string {\n return `${cst_type}\\0${normalized}`;\n}\n\nfunction instantiateTemplateItem(\n template: Constituenta,\n args: ArgumentValue[],\n alias: string\n): TemplateInstantiationItem {\n return {\n alias,\n cst_type: inferTemplatedType(template.cst_type, args),\n crucial: template.crucial,\n convention: template.convention,\n definition_formal: substituteTemplateArgs(template.definition_formal, argumentValuesToMapping(args)),\n definition_raw: template.definition_raw,\n term_raw: template.term_raw,\n term_forms: [...template.term_forms],\n typification_manual: template.typification_manual,\n value_is_property: template.value_is_property\n };\n}\n\nfunction bindingsFromCall(params: TemplateParam[], callArgs: string[], scope: AliasMapping): Map<string, string> {\n const bindings = new Map<string, string>();\n params.forEach((param, index) => {\n const value = resolveArgBinding(callArgs[index] ?? '', scope);\n if (value) {\n bindings.set(param.alias, value);\n }\n });\n return bindings;\n}\n\nfunction resolveArgBinding(argExpr: string, scope: AliasMapping): string | undefined {\n const scoped = substituteLocalAliases(argExpr, scope).trim();\n if (isGlobalAlias(scoped)) {\n return scoped;\n }\n return undefined;\n}\n\ntype MergeBindingsResult =\n | { ok: true; bindings: Map<string, string> }\n | { ok: false; conflict: { paramAlias: string; existing: string; incoming: string } };\n\nfunction mergeBindings(existing: Map<string, string> | undefined, incoming: Map<string, string>): MergeBindingsResult {\n const result = new Map(existing);\n for (const [alias, value] of incoming) {\n const existingValue = result.get(alias);\n if (existingValue === undefined) {\n result.set(alias, value);\n } else if (existingValue !== value) {\n return { ok: false, conflict: { paramAlias: alias, existing: existingValue, incoming: value } };\n }\n }\n return { ok: true, bindings: result };\n}\n\nfunction bindingMapToArgs(params: TemplateParam[], bindings: Map<string, string>): ArgumentValue[] {\n return params.map(param => ({\n alias: param.alias,\n typification: param.typification,\n value: bindings.get(param.alias)\n }));\n}\n\nfunction getTemplateParams(template: Constituenta): TemplateParam[] {\n const effectiveType = template.effectiveType;\n if (effectiveType && (effectiveType.typeID === TypeID.function || effectiveType.typeID === TypeID.predicate)) {\n return effectiveType.args.map(arg => ({\n alias: arg.alias,\n typification: labelType(arg.type)\n }));\n }\n const { head } = splitTemplateDefinition(template.definition_formal);\n if (!head) {\n return [];\n }\n return head.split(',').map(part => {\n const trimmed = part.trim();\n const separator = trimmed.indexOf('∈');\n if (separator === -1) {\n return { alias: trimmed, typification: '' };\n }\n return {\n alias: trimmed.slice(0, separator).trim(),\n typification: trimmed.slice(separator + 1).trim()\n };\n });\n}\n\nfunction extractFuncCalls(ast: AstNode, expression: string): FuncCallRef[] {\n const result: FuncCallRef[] = [];\n visitAstDFS(ast, node => {\n if (node.typeID !== TokenID.NT_FUNC_CALL || node.children.length < 1) {\n return;\n }\n const calleeNode = node.children[0];\n if (\n calleeNode.typeID !== TokenID.ID_FUNCTION &&\n calleeNode.typeID !== TokenID.ID_PREDICATE &&\n calleeNode.typeID !== TokenID.ID_GLOBAL\n ) {\n return;\n }\n const callee = expression.slice(calleeNode.from, calleeNode.to);\n if (!/^[FP]\\d+$/.test(callee)) {\n return;\n }\n result.push({\n callee,\n args: node.children.slice(1).map(child => expression.slice(child.from, child.to).trim())\n });\n });\n return result;\n}\n\nfunction topologicalSort(aliases: string[], refs: Map<string, Set<string>>): string[] {\n const remaining = new Set(aliases);\n const sorted: string[] = [];\n while (remaining.size > 0) {\n const ready = [...remaining].filter(alias => {\n const deps = refs.get(alias) ?? new Set<string>();\n return [...deps].every(dep => !remaining.has(dep));\n });\n if (ready.length === 0) {\n return [...remaining, ...sorted].reverse();\n }\n ready.sort();\n for (const alias of ready) {\n sorted.push(alias);\n remaining.delete(alias);\n }\n }\n return sorted;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA6GA,SAAgB,0BAA0B,OAA8D;CACtG,OAAO,IAAI,6BAA6B,KAAK,CAAC,CAAC,KAAK;AACtD;;;;;;AAOA,IAAa,+BAAb,MAA0C;CACxC;CACA;CACA;CACA;CACA;CACA;CACA,8BAA+B,IAAI,IAAiC;CACpE,0BAA2B,IAAI,IAAyB;CACxD,kBAA0D;;CAG1D,YAAY,OAAmC;EAC7C,KAAK,eAAe,MAAM;EAC1B,KAAK,YAAY,MAAM;EACvB,KAAK,WAAW,MAAM;EACtB,KAAK,mBAAmB,MAAM;EAC9B,KAAK,kBAAkB,IAAI,IACzB,MAAM,cAAc,QAAO,QAAO,aAAa,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAI,QAAO,CAAC,IAAI,OAAO,GAAG,CAAC,CAC3F;EACA,KAAK,cAAc,wBAAwB,MAAM,QAAQ;CAC3D;;CAGA,OAAkC;EAChC,MAAM,iBAAiB,uBAAuB,KAAK,UAAU,mBAAmB,KAAK,WAAW;EAChG,KAAK,oBAAoB,gBAAgB,KAAK,WAAW;EAEzD,IAAI,KAAK,iBACP,OAAO;GAAE,OAAO,CAAC;GAAG,oBAAoB;GAAM,iBAAiB,KAAK;EAAgB;EAGtF,MAAM,kBAAkB,4BAA4B,KAAK,YAAY;EACrE,MAAM,kBAAkB,KAAK,qBAAqB,eAAe;EACjE,MAAM,EAAE,MAAM,UAAU,gBAAgB,uBAAuB,KAAK,cAClE,gBACA,gBAAgB,cAChB,gBAAgB,cAChB,eACF;EAEA,OAAO;GACL,OAAO,WAAW,CAAC,GAAG,gBAAgB,OAAO,QAAQ,IAAI,gBAAgB;GACzE;GACA,iBAAiB;EACnB;CACF;CAEA,qBAA6B,iBAI3B;EACA,MAAM,oBAAoB,gBAAgB,CAAC,GAAG,KAA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AAQ;EAE3C,MAAM,KAAK;EACX,KAAK,MAAM,SAAS,OAAO;GACzB,OAAO,KAAK,KAAK;GACjB,UAAU,OAAO,KAAK;EACxB;CACF;CACA,OAAO;AACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as LibraryItem } from "../library-CYun28Xz.js";
|
|
2
|
+
import { S as Substitution, b as RSForm, g as Constituenta } from "../diagnostics-Clo3mkba.js";
|
|
2
3
|
import { NodeType, OperationSchema, SubstitutionErrorDescription } from "./oss.js";
|
|
3
|
-
import { Constituenta, RSForm, Substitution } from "./rsform.js";
|
|
4
4
|
|
|
5
5
|
//#region src/library/oss-api.d.ts
|
|
6
6
|
declare function constructNodeID(type: NodeType, itemID: number): string;
|
package/dist/library/oss-api.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Graph } from "../graph/graph.js";
|
|
2
|
-
import { NodeType, SubstitutionErrorType } from "./oss.js";
|
|
3
2
|
import { labelType } from "../rslang/labels.js";
|
|
4
3
|
import { applyAliasMapping, applyTypificationMapping, isSetTypification } from "../rslang/api.js";
|
|
5
4
|
import { extractBases } from "../rslang/semantic/typification-api.js";
|
|
6
5
|
import { CstClass, CstType } from "./rsform.js";
|
|
6
|
+
import { NodeType, SubstitutionErrorType } from "./oss.js";
|
|
7
7
|
import "../graph/index.js";
|
|
8
8
|
//#region src/library/oss-api.ts
|
|
9
9
|
/**
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { t as AstNode } from "../ast-C8sIpKdL.js";
|
|
2
2
|
import { l as Value } from "../value-BduA_ZGp.js";
|
|
3
|
-
import { n as CalculatorResult, r as RSCalculator, t as CalculatorEvaluateOptions } from "../calculator-
|
|
4
|
-
import {
|
|
5
|
-
import { BasicBinding, BasicsContext, EvalStatus, RSModel } from "./rsmodel.js";
|
|
3
|
+
import { n as CalculatorResult, r as RSCalculator, t as CalculatorEvaluateOptions } from "../calculator-k8BGIKmj.js";
|
|
4
|
+
import { b as RSForm, c as BasicsContext, d as RSModel, s as BasicBinding, u as EvalStatus, y as CstType } from "../diagnostics-Clo3mkba.js";
|
|
6
5
|
|
|
7
6
|
//#region src/library/rsengine.d.ts
|
|
8
7
|
/** Services for {@link RSEngine}. */
|
package/dist/library/rsengine.js
CHANGED
|
@@ -4,7 +4,7 @@ import { l as compare } from "../value-COprb2Je.js";
|
|
|
4
4
|
import { RSCalculator } from "../rslang/eval/calculator.js";
|
|
5
5
|
import "../rslang/index.js";
|
|
6
6
|
import { CstType } from "./rsform.js";
|
|
7
|
-
import {
|
|
7
|
+
import { D as isFunctional, E as isBasicConcept, T as isBaseSet, g as getAnalysisFor } from "../diagnostics-DYMvTSev.js";
|
|
8
8
|
import { TYPE_BASIC } from "./rsmodel.js";
|
|
9
9
|
import { inferEvalStatus, isInferrable, tryFixValue } from "./rsmodel-api.js";
|
|
10
10
|
//#region src/library/rsengine.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as LibraryItem } from "../library-CYun28Xz.js";
|
|
2
1
|
import { t as AstNode } from "../ast-C8sIpKdL.js";
|
|
3
|
-
import { g as TypeClass, y as TypePath } from "../typification-
|
|
2
|
+
import { g as TypeClass, y as TypePath } from "../typification-9lNu9R4k.js";
|
|
4
3
|
import { t as ValueClass } from "../value-class-CNI-lqXJ.js";
|
|
5
|
-
import { r as AnalysisFull } from "../analyzer-
|
|
6
|
-
import {
|
|
4
|
+
import { r as AnalysisFull } from "../analyzer-iqAXyROE.js";
|
|
5
|
+
import { r as LibraryItem } from "../library-CYun28Xz.js";
|
|
6
|
+
import { _ as CstClass, b as RSForm, g as Constituenta, m as ArgumentValue, v as CstStatus, x as RSFormStats, y as CstType } from "../diagnostics-Clo3mkba.js";
|
|
7
7
|
import { AliasMapping } from "../rslang/api.js";
|
|
8
8
|
|
|
9
9
|
//#region src/library/rsform-api.d.ts
|