@rsconcept/domain 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{diagnostics-B1OfMra1.js → diagnostics-CljEzVBV.js} +354 -5
- package/dist/diagnostics-CljEzVBV.js.map +1 -0
- package/dist/{diagnostics-Db1F7ruF.d.ts → diagnostics-Dac5sJhO.d.ts} +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/library/diagnostics.d.ts +1 -1
- package/dist/library/diagnostics.js +1 -1
- package/dist/library/index.d.ts +2 -2
- package/dist/library/index.js +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 +1 -1
- package/dist/library/rsengine.js +2 -2
- package/dist/library/rsform-api/index.d.ts +172 -19
- package/dist/library/rsform-api/index.js +2 -2
- package/dist/library/rsform.d.ts +2 -2
- package/dist/library/rsform.js.map +1 -1
- package/dist/library/rsmodel-api.d.ts +1 -1
- package/dist/library/rsmodel-api.js +2 -2
- package/dist/library/rsmodel.d.ts +1 -1
- package/dist/library/structure-planner.d.ts +1 -1
- package/dist/library/structure-planner.js +2 -2
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/library/index.ts +1 -0
- package/src/library/rsform-api/alias.ts +57 -1
- package/src/library/rsform-api/attribution.ts +87 -0
- package/src/library/rsform-api/index.ts +23 -2
- package/src/library/rsform-api/substitution.ts +82 -0
- package/src/library/rsform-api/synthesis.test.ts +126 -0
- package/src/library/rsform-api/synthesis.ts +142 -3
- package/src/library/rsform-api/text-resolution.test.ts +86 -0
- package/src/library/rsform-api/text-resolution.ts +152 -0
- package/src/library/rsform-api/transforms.test.ts +161 -0
- package/src/library/rsform-api/transforms.ts +42 -0
- package/src/library/rsform-api/types.ts +19 -2
- package/src/library/rsform.ts +1 -1
- package/dist/diagnostics-B1OfMra1.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ import { n as ArgumentsType } from "./arguments-extractor-ngatANBI.js";
|
|
|
18
18
|
import { n as applyAsciiTypeSubstitutions, r as parseTypeText } from "./typification-parser-Dytsv9CI.js";
|
|
19
19
|
import { n as TypificationNodeData, t as TypificationGraph } from "./typification-graph-BY_oGT82.js";
|
|
20
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 RSFormStats, S as RSForm, T as
|
|
21
|
+
import { C as RSFormStats, E as TypeInfo, S as RSForm, T as TermForm, _ as Attribution, a as detectDependencyCycleDiagnostics, b as CstStatus, c as modelStatusCstDiagnostic, d as DEFAULT_VALUE_TEXT, f as EvalStatus, g as ArgumentValue, i as assignSchemaDiagnostics, l as BasicBinding, m as RSModelStats, n as DiagnosticKind, o as formatDependencyCycle, p as RSModel, r as RSDiagnosticCode, s as hasCstDiagnostic, t as CstDiagnostic, u as BasicsContext, v as Constituenta, w as Substitution, x as CstType, y as CstClass } from "./diagnostics-Dac5sJhO.js";
|
|
22
22
|
import { FolderNode, FolderTree } from "./library/folder-tree.js";
|
|
23
23
|
import { n as OssLayout, r as Position2D } from "./oss-layout-3glgAqfn.js";
|
|
24
24
|
import { Block, CstSubstituteInfo, NodeType, Operation, OperationInput, OperationSchema, OperationSchemaStats, OperationSynthesis, OperationType, OssItem, SubstitutionErrorDescription, SubstitutionErrorType } from "./library/oss.js";
|
|
25
25
|
import { RSEngine } from "./library/rsengine.js";
|
|
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, detectDependencyCycleDiagnostics, findByUid, flattenAst, formatDependencyCycle, generateStub, getNodeIndices, getNodeText, hasCstDiagnostic, makeTypePath, makeValuePath, modelStatusCstDiagnostic, 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, type TermForm, 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, detectDependencyCycleDiagnostics, findByUid, flattenAst, formatDependencyCycle, generateStub, getNodeIndices, getNodeText, hasCstDiagnostic, makeTypePath, makeValuePath, modelStatusCstDiagnostic, parseTypeText, printAst, printTree, printValue, readErrorAnnotation, readTypeAnnotation, parser as rslangParser, supportedGrammemes, visitAstDFS };
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { TokenID } from "./rslang/parser/token.js";
|
|
|
6
6
|
import { AnyTypificationT, EmptySetT, LogicT, TypeClass, TypeID, makeTypePath } from "./rslang/semantic/typification.js";
|
|
7
7
|
import { parser } from "./rslang/parser/parser.js";
|
|
8
8
|
import { readErrorAnnotation, readTypeAnnotation } from "./rslang/ast-annotations.js";
|
|
9
|
+
import { CstClass, CstStatus, CstType } from "./library/rsform.js";
|
|
9
10
|
import { RSErrorCode } from "./rslang/error.js";
|
|
10
11
|
import { applyHash_fnv1a, generateStub } from "./shared/hash.js";
|
|
11
12
|
import { C as printValue, o as TUPLE_ID, u as makeValuePath } from "./value-COprb2Je.js";
|
|
@@ -14,8 +15,7 @@ import { ValueClass } from "./rslang/semantic/value-class.js";
|
|
|
14
15
|
import { RSLangAnalyzer } from "./rslang/semantic/analyzer.js";
|
|
15
16
|
import { applyAsciiTypeSubstitutions, parseTypeText } from "./rslang/semantic/typification-parser.js";
|
|
16
17
|
import { TypificationGraph } from "./rslang/typification-graph.js";
|
|
17
|
-
import {
|
|
18
|
-
import { a as formatDependencyCycle, i as detectDependencyCycleDiagnostics, n as RSDiagnosticCode, o as hasCstDiagnostic, r as assignSchemaDiagnostics, s as modelStatusCstDiagnostic, t as DiagnosticKind } from "./diagnostics-B1OfMra1.js";
|
|
18
|
+
import { a as formatDependencyCycle, i as detectDependencyCycleDiagnostics, n as RSDiagnosticCode, o as hasCstDiagnostic, r as assignSchemaDiagnostics, s as modelStatusCstDiagnostic, t as DiagnosticKind } from "./diagnostics-CljEzVBV.js";
|
|
19
19
|
import { DEFAULT_VALUE_TEXT, EvalStatus } from "./library/rsmodel.js";
|
|
20
20
|
import { FolderNode, FolderTree } from "./library/folder-tree.js";
|
|
21
21
|
import { AccessPolicy, LibraryItemType, LocationHead } from "./library/library.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as detectDependencyCycleDiagnostics, c as modelStatusCstDiagnostic, i as assignSchemaDiagnostics, n as DiagnosticKind, o as formatDependencyCycle, r as RSDiagnosticCode, s as hasCstDiagnostic, t as CstDiagnostic } from "../diagnostics-
|
|
1
|
+
import { a as detectDependencyCycleDiagnostics, c as modelStatusCstDiagnostic, i as assignSchemaDiagnostics, n as DiagnosticKind, o as formatDependencyCycle, r as RSDiagnosticCode, s as hasCstDiagnostic, t as CstDiagnostic } from "../diagnostics-Dac5sJhO.js";
|
|
2
2
|
export { CstDiagnostic, DiagnosticKind, RSDiagnosticCode, assignSchemaDiagnostics, detectDependencyCycleDiagnostics, formatDependencyCycle, hasCstDiagnostic, modelStatusCstDiagnostic };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as formatDependencyCycle, i as detectDependencyCycleDiagnostics, n as RSDiagnosticCode, o as hasCstDiagnostic, r as assignSchemaDiagnostics, s as modelStatusCstDiagnostic, t as DiagnosticKind } from "../diagnostics-
|
|
1
|
+
import { a as formatDependencyCycle, i as detectDependencyCycleDiagnostics, n as RSDiagnosticCode, o as hasCstDiagnostic, r as assignSchemaDiagnostics, s as modelStatusCstDiagnostic, t as DiagnosticKind } from "../diagnostics-CljEzVBV.js";
|
|
2
2
|
export { DiagnosticKind, RSDiagnosticCode, assignSchemaDiagnostics, detectDependencyCycleDiagnostics, formatDependencyCycle, hasCstDiagnostic, modelStatusCstDiagnostic };
|
package/dist/library/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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 RSFormStats, S as RSForm, T as
|
|
2
|
+
import { C as RSFormStats, E as TypeInfo, S as RSForm, T as TermForm, _ as Attribution, a as detectDependencyCycleDiagnostics, b as CstStatus, c as modelStatusCstDiagnostic, d as DEFAULT_VALUE_TEXT, f as EvalStatus, g as ArgumentValue, i as assignSchemaDiagnostics, l as BasicBinding, m as RSModelStats, n as DiagnosticKind, o as formatDependencyCycle, p as RSModel, r as RSDiagnosticCode, s as hasCstDiagnostic, t as CstDiagnostic, u as BasicsContext, v as Constituenta, w as Substitution, x as CstType, y as CstClass } from "../diagnostics-Dac5sJhO.js";
|
|
3
3
|
import { FolderNode, FolderTree } from "./folder-tree.js";
|
|
4
4
|
import { n as OssLayout, r as Position2D } from "../oss-layout-3glgAqfn.js";
|
|
5
5
|
import { Block, CstSubstituteInfo, NodeType, Operation, OperationInput, OperationSchema, OperationSchemaStats, OperationSynthesis, OperationType, OssItem, SubstitutionErrorDescription, SubstitutionErrorType } from "./oss.js";
|
|
@@ -99,5 +99,5 @@ declare class TemplateInstantiationPlanner {
|
|
|
99
99
|
private collectDependencies;
|
|
100
100
|
}
|
|
101
101
|
//#endregion
|
|
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, detectDependencyCycleDiagnostics, formatDependencyCycle, hasCstDiagnostic, modelStatusCstDiagnostic, 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 TermForm, type TypeInfo, type VersionInfo, assignSchemaDiagnostics, detectDependencyCycleDiagnostics, formatDependencyCycle, hasCstDiagnostic, modelStatusCstDiagnostic, planTemplateInstantiation };
|
|
103
103
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/library/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { TypeID } from "../rslang/semantic/typification.js";
|
|
|
5
5
|
import { labelType } from "../rslang/labels.js";
|
|
6
6
|
import { applyAliasMapping, isGlobalAlias, parseRSLangExpression, splitTemplateDefinition, substituteLocalAliases, substituteTemplateArgs } from "../rslang/api.js";
|
|
7
7
|
import { CstClass, CstStatus, CstType } from "./rsform.js";
|
|
8
|
-
import {
|
|
8
|
+
import { $ as isFunctional, A as normalizeExpression, R as applyMappingToConstituents, V as generateAlias, a as formatDependencyCycle, i as detectDependencyCycleDiagnostics, k as inferTemplatedType, n as RSDiagnosticCode, o as hasCstDiagnostic, r as assignSchemaDiagnostics, s as modelStatusCstDiagnostic, t as DiagnosticKind, z as argumentValuesToMapping } from "../diagnostics-CljEzVBV.js";
|
|
9
9
|
import { DEFAULT_VALUE_TEXT, EvalStatus } from "./rsmodel.js";
|
|
10
10
|
import { FolderNode, FolderTree } from "./folder-tree.js";
|
|
11
11
|
import { AccessPolicy, LibraryItemType, LocationHead } from "./library.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as LibraryItem } from "../library-CYun28Xz.js";
|
|
2
|
-
import { S as RSForm, v as Constituenta, w as Substitution } from "../diagnostics-
|
|
2
|
+
import { S as RSForm, v as Constituenta, w as Substitution } from "../diagnostics-Dac5sJhO.js";
|
|
3
3
|
import { NodeType, OperationSchema, SubstitutionErrorDescription } from "./oss.js";
|
|
4
4
|
|
|
5
5
|
//#region src/library/oss-api.d.ts
|
package/dist/library/oss-api.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Graph } from "../graph/graph.js";
|
|
2
2
|
import { labelType } from "../rslang/labels.js";
|
|
3
3
|
import { applyAliasMapping, applyTypificationMapping, isSetTypification } from "../rslang/api.js";
|
|
4
|
-
import { extractBases } from "../rslang/semantic/typification-api.js";
|
|
5
4
|
import { CstClass, CstType } from "./rsform.js";
|
|
5
|
+
import { extractBases } from "../rslang/semantic/typification-api.js";
|
|
6
6
|
import "../graph/index.js";
|
|
7
7
|
import { NodeType, SubstitutionErrorType } from "./oss.js";
|
|
8
8
|
//#region src/library/oss-api.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as AstNode } from "../ast-C8sIpKdL.js";
|
|
2
2
|
import { l as Value } from "../value-BduA_ZGp.js";
|
|
3
3
|
import { n as CalculatorResult, r as RSCalculator, t as CalculatorEvaluateOptions } from "../calculator-DE89LtIM.js";
|
|
4
|
-
import { S as RSForm, f as EvalStatus, l as BasicBinding, p as RSModel, u as BasicsContext, x as CstType } from "../diagnostics-
|
|
4
|
+
import { S as RSForm, f as EvalStatus, l as BasicBinding, p as RSModel, u as BasicsContext, x as CstType } from "../diagnostics-Dac5sJhO.js";
|
|
5
5
|
|
|
6
6
|
//#region src/library/rsengine.d.ts
|
|
7
7
|
/** Services for {@link RSEngine}. */
|
package/dist/library/rsengine.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TypeID } from "../rslang/semantic/typification.js";
|
|
2
2
|
import { normalizeType } from "../rslang/labels.js";
|
|
3
|
+
import { CstType } from "./rsform.js";
|
|
3
4
|
import { l as compare } from "../value-COprb2Je.js";
|
|
4
5
|
import { RSCalculator } from "../rslang/eval/calculator.js";
|
|
5
6
|
import "../rslang/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import { F as isBasicConcept, I as isFunctional, P as isBaseSet, b as getAnalysisFor } from "../diagnostics-B1OfMra1.js";
|
|
7
|
+
import { $ as isFunctional, P as getAnalysisFor, Q as isBasicConcept, Z as isBaseSet } from "../diagnostics-CljEzVBV.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
|
|
@@ -4,9 +4,40 @@ import { g as TypeClass, y as TypePath } from "../../typification-9lNu9R4k.js";
|
|
|
4
4
|
import { t as ValueClass } from "../../value-class-CNI-lqXJ.js";
|
|
5
5
|
import { r as AnalysisFull } from "../../analyzer-fNhkwO-6.js";
|
|
6
6
|
import { r as LibraryItem } from "../../library-CYun28Xz.js";
|
|
7
|
-
import { C as RSFormStats, S as RSForm, b as CstStatus, g as ArgumentValue, v as Constituenta, x as CstType, y as CstClass } from "../../diagnostics-
|
|
7
|
+
import { C as RSFormStats, S as RSForm, T as TermForm, _ as Attribution, b as CstStatus, g as ArgumentValue, v as Constituenta, w as Substitution, x as CstType, y as CstClass } from "../../diagnostics-Dac5sJhO.js";
|
|
8
8
|
import { t as AliasMapping } from "../../api-Bf0f_uiI.js";
|
|
9
9
|
|
|
10
|
+
//#region src/library/rsform-api/types.d.ts
|
|
11
|
+
/** Minimal constituent fields required to restore order. */
|
|
12
|
+
interface OrderableConstituenta {
|
|
13
|
+
id: number;
|
|
14
|
+
alias: string;
|
|
15
|
+
cst_type: CstType;
|
|
16
|
+
definition_formal: string;
|
|
17
|
+
}
|
|
18
|
+
/** Semantic parent/children derived from formal definitions (backend SemanticInfo). */
|
|
19
|
+
interface SemanticRelations {
|
|
20
|
+
/** Parent id for each constituenta (self when none). */
|
|
21
|
+
parentOf: Map<number, number>;
|
|
22
|
+
/** Semantic children ids for each constituenta. */
|
|
23
|
+
childrenOf: Map<number, number[]>;
|
|
24
|
+
}
|
|
25
|
+
/** Constituent fields needed to resolve term/definition entity references. */
|
|
26
|
+
interface ResolvableConstituenta {
|
|
27
|
+
id: number;
|
|
28
|
+
alias: string;
|
|
29
|
+
term_raw: string;
|
|
30
|
+
term_resolved: string;
|
|
31
|
+
term_forms: TermForm[];
|
|
32
|
+
definition_raw: string;
|
|
33
|
+
definition_resolved: string;
|
|
34
|
+
}
|
|
35
|
+
/** Constituent fields needed to allocate or reset aliases by type. */
|
|
36
|
+
interface AliasTypedConstituenta {
|
|
37
|
+
alias: string;
|
|
38
|
+
cst_type: CstType;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
10
41
|
//#region src/library/rsform-api/alias.d.ts
|
|
11
42
|
/** Fields of {@link Constituenta} updated in place by alias mapping. */
|
|
12
43
|
interface ConstituentaMappableFields {
|
|
@@ -29,6 +60,18 @@ declare function generateAlias(type: CstType, schema: RSForm, takenAliases?: str
|
|
|
29
60
|
* Mutates each element of `items` in place; pass owned or cloned data only.
|
|
30
61
|
*/
|
|
31
62
|
declare function applyMappingToConstituents<T extends ConstituentaMappableFields>(items: T[], mapping: AliasMapping, changeAliases: boolean): void;
|
|
63
|
+
/** Highest numeric alias suffix for {@link type} among {@link items} (0 when none). */
|
|
64
|
+
declare function maxAliasIndex(items: readonly AliasTypedConstituenta[], type: CstType): number;
|
|
65
|
+
/**
|
|
66
|
+
* Build alias → new-alias mapping that renumbers each type sequentially in list order.
|
|
67
|
+
* Matches backend {@code RSFormCached.reset_aliases}.
|
|
68
|
+
*/
|
|
69
|
+
declare function buildSequentialAliasMapping(items: readonly AliasTypedConstituenta[]): AliasMapping;
|
|
70
|
+
/**
|
|
71
|
+
* Allocate fresh aliases for {@link source} constituents being imported into a non-empty receiver.
|
|
72
|
+
* Returns an empty mapping when the receiver has no items (aliases kept as-is).
|
|
73
|
+
*/
|
|
74
|
+
declare function allocateImportAliases(receiver: readonly AliasTypedConstituenta[], source: readonly AliasTypedConstituenta[]): AliasMapping;
|
|
32
75
|
/** Remove alias from expression. */
|
|
33
76
|
declare function removeAliasReference(expression: string, alias: string): string;
|
|
34
77
|
/** Add alias to expression. */
|
|
@@ -48,6 +91,20 @@ declare function getAnalysisFor(expression: string, cstType: CstType, schema: RS
|
|
|
48
91
|
*/
|
|
49
92
|
declare function refineAnalysisForDependencyCycles(analysis: AnalysisFull, expression: string, schema: RSForm, alias?: string): AnalysisFull;
|
|
50
93
|
//#endregion
|
|
94
|
+
//#region src/library/rsform-api/attribution.d.ts
|
|
95
|
+
/**
|
|
96
|
+
* Remap attributions when constituents are substituted (original → replacement).
|
|
97
|
+
* Drops self-loops and duplicates. Matches sandbox / backend substitute attribution rewrite.
|
|
98
|
+
*/
|
|
99
|
+
declare function remapAttributionsUnderSubstitution(attributions: readonly Attribution[], origToSub: ReadonlyMap<number, number>): Attribution[];
|
|
100
|
+
/**
|
|
101
|
+
* Copy attributions whose both endpoints are in {@link sourceIdSet}, remapping ids via {@link idMap}.
|
|
102
|
+
* Appends onto a clone of {@link existing} with dedupe. Used by schema embedding / insert.
|
|
103
|
+
*/
|
|
104
|
+
declare function importAttributions(sourceAttributions: readonly Attribution[], sourceIdSet: ReadonlySet<number>, idMap: Readonly<Record<number, number>>, existing?: readonly Attribution[]): Attribution[];
|
|
105
|
+
/** Drop attributions that reference any id in {@link deletedIds}. */
|
|
106
|
+
declare function filterAttributions(attributions: readonly Attribution[], deletedIds: ReadonlySet<number>): Attribution[];
|
|
107
|
+
//#endregion
|
|
51
108
|
//#region src/library/rsform-api/cst-type.d.ts
|
|
52
109
|
/** Prefix for alias indicating {@link CstType}. */
|
|
53
110
|
declare function getCstTypePrefix(type: CstType): string;
|
|
@@ -91,22 +148,6 @@ declare function inferTemplate(expression: string): boolean;
|
|
|
91
148
|
/** Apply filter based on start {@link Constituenta} type. */
|
|
92
149
|
declare function applyFilterCategory(start: Constituenta, items: Constituenta[]): Constituenta[];
|
|
93
150
|
//#endregion
|
|
94
|
-
//#region src/library/rsform-api/types.d.ts
|
|
95
|
-
/** Minimal constituent fields required to restore order. */
|
|
96
|
-
interface OrderableConstituenta {
|
|
97
|
-
id: number;
|
|
98
|
-
alias: string;
|
|
99
|
-
cst_type: CstType;
|
|
100
|
-
definition_formal: string;
|
|
101
|
-
}
|
|
102
|
-
/** Semantic parent/children derived from formal definitions (backend SemanticInfo). */
|
|
103
|
-
interface SemanticRelations {
|
|
104
|
-
/** Parent id for each constituenta (self when none). */
|
|
105
|
-
parentOf: Map<number, number>;
|
|
106
|
-
/** Semantic children ids for each constituenta. */
|
|
107
|
-
childrenOf: Map<number, number[]>;
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
151
|
//#region src/library/rsform-api/formal-graph.d.ts
|
|
111
152
|
/**
|
|
112
153
|
* Build the formal dependency graph: supplier → dependent.
|
|
@@ -138,9 +179,121 @@ declare function findCstByStructure(schema: RSForm, target: Constituenta, path:
|
|
|
138
179
|
/** Retrieves name for piece of target {@link Constituenta} structure. */
|
|
139
180
|
declare function getStructureName(schema: RSForm, target: Constituenta, path: TypePath): string;
|
|
140
181
|
//#endregion
|
|
182
|
+
//#region src/library/rsform-api/substitution.d.ts
|
|
183
|
+
/** Result of applying substitutions to a schema fragment. */
|
|
184
|
+
interface SubstitutionResult<T> {
|
|
185
|
+
items: T[];
|
|
186
|
+
attributions: Attribution[];
|
|
187
|
+
deletedIds: Set<number>;
|
|
188
|
+
/** Replacement constituent ids (survivors referenced by substitutions). */
|
|
189
|
+
replacementIds: number[];
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Apply constituenta substitutions: remap attributions, drop originals, rewrite aliases in survivors.
|
|
193
|
+
* Does not resolve texts — call {@link resolveAllConstituentTexts} afterwards.
|
|
194
|
+
*/
|
|
195
|
+
declare function applyConstituentSubstitutions<T extends ConstituentaMappableFields & {
|
|
196
|
+
id: number;
|
|
197
|
+
alias: string;
|
|
198
|
+
}>(items: readonly T[], attributions: readonly Attribution[], substitutions: readonly Substitution[]): SubstitutionResult<T>;
|
|
199
|
+
/**
|
|
200
|
+
* Remap substitution endpoints after source constituents were inserted under new ids.
|
|
201
|
+
* If {@link original} was imported, map it; otherwise map {@link substitution}.
|
|
202
|
+
*/
|
|
203
|
+
declare function remapSubstitutionsAfterImport(substitutions: readonly Substitution[], sourceIdSet: ReadonlySet<number>, idMap: Readonly<Record<number, number>>): Substitution[];
|
|
204
|
+
//#endregion
|
|
141
205
|
//#region src/library/rsform-api/synthesis.d.ts
|
|
142
|
-
/**
|
|
206
|
+
/** Constituent shape required for embedding / synthesis transforms. */
|
|
207
|
+
type SynthesizableConstituenta = ConstituentaMappableFields & ResolvableConstituenta & AliasTypedConstituenta & {
|
|
208
|
+
id: number;
|
|
209
|
+
alias: string;
|
|
210
|
+
cst_type: CstType;
|
|
211
|
+
};
|
|
212
|
+
/** Input for {@link inlineSynthesis}. */
|
|
213
|
+
interface InlineSynthesisInput<T extends SynthesizableConstituenta> {
|
|
214
|
+
/** Receiver schema constituents (order preserved; imports append). */
|
|
215
|
+
receiverItems: readonly T[];
|
|
216
|
+
/** Receiver attributions (default empty). */
|
|
217
|
+
receiverAttributions?: readonly Attribution[];
|
|
218
|
+
/**
|
|
219
|
+
* Source constituents to insert (already filtered to the desired subset).
|
|
220
|
+
* Cloned; originals are not mutated.
|
|
221
|
+
*/
|
|
222
|
+
sourceItems: readonly T[];
|
|
223
|
+
/** Source attributions whose both endpoints are among {@link sourceItems}. */
|
|
224
|
+
sourceAttributions?: readonly Attribution[];
|
|
225
|
+
/**
|
|
226
|
+
* Identification table using pre-import ids:
|
|
227
|
+
* one endpoint is a source id, the other a receiver id
|
|
228
|
+
* (same rules as backend embedding / InlineSynthesis).
|
|
229
|
+
*/
|
|
230
|
+
substitutions?: readonly Substitution[];
|
|
231
|
+
/** Next free numeric id for inserted constituents. */
|
|
232
|
+
nextId: number;
|
|
233
|
+
}
|
|
234
|
+
/** Result of {@link inlineSynthesis}. */
|
|
235
|
+
interface InlineSynthesisResult<T extends SynthesizableConstituenta> {
|
|
236
|
+
items: T[];
|
|
237
|
+
attributions: Attribution[];
|
|
238
|
+
/** Updated next-id after inserts. */
|
|
239
|
+
nextId: number;
|
|
240
|
+
/** Source id → inserted id. */
|
|
241
|
+
idMap: Record<number, number>;
|
|
242
|
+
/** Alias remapping applied to imported constituents (empty when receiver was empty). */
|
|
243
|
+
aliasMapping: AliasMapping;
|
|
244
|
+
/** Ids removed by substitutions. */
|
|
245
|
+
deletedIds: Set<number>;
|
|
246
|
+
/** Ids of newly inserted constituents (before any were deleted by substitutions). */
|
|
247
|
+
insertedIds: number[];
|
|
248
|
+
/** Survivor ids referenced by applied substitutions. */
|
|
249
|
+
replacementIds: number[];
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Embed {@link InlineSynthesisInput.sourceItems} into the receiver and apply substitutions.
|
|
253
|
+
* Resolves term/definition entity references on the result.
|
|
254
|
+
* Does not mutate inputs.
|
|
255
|
+
*/
|
|
256
|
+
declare function inlineSynthesis<T extends SynthesizableConstituenta>(input: InlineSynthesisInput<T>): InlineSynthesisResult<T>;
|
|
257
|
+
/** Sorts library items relevant for schema embedding with specified {@link RSForm}. */
|
|
143
258
|
declare function sortItemsForInlineSynthesis(receiver: RSForm, items: readonly LibraryItem[]): LibraryItem[];
|
|
144
259
|
//#endregion
|
|
145
|
-
|
|
260
|
+
//#region src/library/rsform-api/text-resolution.d.ts
|
|
261
|
+
/** Options controlling which texts to re-resolve after an edit. */
|
|
262
|
+
interface TextChangeOptions {
|
|
263
|
+
termChanged: boolean;
|
|
264
|
+
termRawChanged: boolean;
|
|
265
|
+
definitionRawChanged: boolean;
|
|
266
|
+
clearTargetForms: boolean;
|
|
267
|
+
}
|
|
268
|
+
/** Build term-reference graph: referenced constituent → dependent (backend {@code graph_term}). */
|
|
269
|
+
declare function buildTermReferenceGraph(items: readonly ResolvableConstituenta[]): Graph<number>;
|
|
270
|
+
/** Build definition-reference graph: referenced constituent → dependent (backend {@code graph_text}). */
|
|
271
|
+
declare function buildDefinitionReferenceGraph(items: readonly ResolvableConstituenta[]): Graph<number>;
|
|
272
|
+
/** Resolve all term and definition texts in topological order. Mutates items in place. */
|
|
273
|
+
declare function resolveAllConstituentTexts(items: ResolvableConstituenta[]): void;
|
|
274
|
+
/**
|
|
275
|
+
* Resolve texts after a single constituent change, cascading dependents when the term changed.
|
|
276
|
+
* Mutates items in place.
|
|
277
|
+
*/
|
|
278
|
+
declare function resolveConstituentTextChange(items: ResolvableConstituenta[], targetID: number, options: TextChangeOptions): void;
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/library/rsform-api/transforms.d.ts
|
|
281
|
+
/**
|
|
282
|
+
* Pure constituenta list transforms: reorder, move, insert position.
|
|
283
|
+
*/
|
|
284
|
+
/** Rebuild an item list following {@link orderedIds}. Throws if an id is missing. */
|
|
285
|
+
declare function reorderItemsByIds<T extends {
|
|
286
|
+
id: number;
|
|
287
|
+
}>(items: readonly T[], orderedIds: readonly number[]): T[];
|
|
288
|
+
/**
|
|
289
|
+
* Move a subset of ids within an ordered id list.
|
|
290
|
+
* {@link moveTo} is clamped to `[0, rest.length]` (index among non-moving items).
|
|
291
|
+
*/
|
|
292
|
+
declare function moveIdsInOrder(ids: readonly number[], moving: readonly number[], moveTo: number): number[];
|
|
293
|
+
/** Insert {@link item} after {@link insertAfter}, or append when null/undefined/missing. Mutates {@link items}. */
|
|
294
|
+
declare function insertItemAfter<T extends {
|
|
295
|
+
id: number;
|
|
296
|
+
}>(items: T[], item: T, insertAfter: number | null | undefined): void;
|
|
297
|
+
//#endregion
|
|
298
|
+
export { type AliasTypedConstituenta, type ConstituentaMappableFields, type InlineSynthesisInput, type InlineSynthesisResult, type OrderableConstituenta, type ResolvableConstituenta, type SemanticRelations, type SubstitutionResult, type SynthesizableConstituenta, type TextChangeOptions, addAliasReference, allocateImportAliases, applyConstituentSubstitutions, applyFilterCategory, applyMappingToConstituents, argumentValuesToMapping, buildDefinitionReferenceGraph, buildFormalDependencyGraph, buildSequentialAliasMapping, buildTermReferenceGraph, calculateSchemaStats, canHaveManualTypification, canProduceStructure, filterAttributions, findCstByStructure, generateAlias, getAnalysisFor, getCstTypePrefix, getStructureName, guessCstType, importAttributions, inferClass, inferNewSpawnPosition, inferStatus, inferTemplate, inferTemplatedType, inlineSynthesis, insertItemAfter, isBaseSet, isBasicConcept, isFunctional, isLogical, isSchemaIssue, isTemplateCst, maxAliasIndex, moveIdsInOrder, normalizeExpression, refineAnalysisForDependencyCycles, remapAttributionsUnderSubstitution, remapSubstitutionsAfterImport, removeAliasReference, reorderItemsByIds, resolveAllConstituentTexts, resolveConstituentTextChange, restoreConstituentOrder, sortItemsForInlineSynthesis, typeClassForCstType, validateAliasFormat, validateNewAlias };
|
|
146
299
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { addAliasReference, applyFilterCategory, applyMappingToConstituents, argumentValuesToMapping, calculateSchemaStats, canHaveManualTypification, canProduceStructure, findCstByStructure, generateAlias, getAnalysisFor, getCstTypePrefix, getStructureName, guessCstType, inferClass, inferNewSpawnPosition, inferStatus, inferTemplate, inferTemplatedType, isBaseSet, isBasicConcept, isFunctional, isLogical, isSchemaIssue, isTemplateCst, normalizeExpression, refineAnalysisForDependencyCycles, removeAliasReference, restoreConstituentOrder, sortItemsForInlineSynthesis, typeClassForCstType, validateAliasFormat, validateNewAlias };
|
|
1
|
+
import { $ as isFunctional, A as normalizeExpression, B as buildSequentialAliasMapping, C as isSchemaIssue, D as inferStatus, E as applyFilterCategory, F as refineAnalysisForDependencyCycles, G as validateNewAlias, H as maxAliasIndex, I as addAliasReference, J as getCstTypePrefix, K as canHaveManualTypification, L as allocateImportAliases, M as importAttributions, N as remapAttributionsUnderSubstitution, O as inferTemplate, P as getAnalysisFor, Q as isBasicConcept, R as applyMappingToConstituents, S as calculateSchemaStats, T as restoreConstituentOrder, U as removeAliasReference, V as generateAlias, W as validateAliasFormat, X as inferClass, Y as guessCstType, Z as isBaseSet, _ as applyConstituentSubstitutions, b as getStructureName, c as insertItemAfter, d as inlineSynthesis, et as isLogical, f as sortItemsForInlineSynthesis, g as resolveConstituentTextChange, h as resolveAllConstituentTexts, j as filterAttributions, k as inferTemplatedType, l as moveIdsInOrder, m as buildTermReferenceGraph, nt as typeClassForCstType, p as buildDefinitionReferenceGraph, q as canProduceStructure, tt as isTemplateCst, u as reorderItemsByIds, v as remapSubstitutionsAfterImport, w as buildFormalDependencyGraph, x as inferNewSpawnPosition, y as findCstByStructure, z as argumentValuesToMapping } from "../../diagnostics-CljEzVBV.js";
|
|
2
|
+
export { addAliasReference, allocateImportAliases, applyConstituentSubstitutions, applyFilterCategory, applyMappingToConstituents, argumentValuesToMapping, buildDefinitionReferenceGraph, buildFormalDependencyGraph, buildSequentialAliasMapping, buildTermReferenceGraph, calculateSchemaStats, canHaveManualTypification, canProduceStructure, filterAttributions, findCstByStructure, generateAlias, getAnalysisFor, getCstTypePrefix, getStructureName, guessCstType, importAttributions, inferClass, inferNewSpawnPosition, inferStatus, inferTemplate, inferTemplatedType, inlineSynthesis, insertItemAfter, isBaseSet, isBasicConcept, isFunctional, isLogical, isSchemaIssue, isTemplateCst, maxAliasIndex, moveIdsInOrder, normalizeExpression, refineAnalysisForDependencyCycles, remapAttributionsUnderSubstitution, remapSubstitutionsAfterImport, removeAliasReference, reorderItemsByIds, resolveAllConstituentTexts, resolveConstituentTextChange, restoreConstituentOrder, sortItemsForInlineSynthesis, typeClassForCstType, validateAliasFormat, validateNewAlias };
|
package/dist/library/rsform.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as RSFormStats, S as RSForm, T as
|
|
2
|
-
export { ArgumentValue, Attribution, Constituenta, CstClass, CstStatus, CstType, RSForm, RSFormStats, Substitution, TypeInfo };
|
|
1
|
+
import { C as RSFormStats, E as TypeInfo, S as RSForm, T as TermForm, _ as Attribution, b as CstStatus, g as ArgumentValue, v as Constituenta, w as Substitution, x as CstType, y as CstClass } from "../diagnostics-Dac5sJhO.js";
|
|
2
|
+
export { ArgumentValue, Attribution, Constituenta, CstClass, CstStatus, CstType, RSForm, RSFormStats, Substitution, TermForm, TypeInfo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsform.js","names":[],"sources":["../../src/library/rsform.ts"],"sourcesContent":["/**\n * Module: Models for formal representation for systems of concepts.\n */\n\nimport { type Graph } from '../graph';\nimport { type AnalysisBase, type ExpressionType, type RSLangAnalyzer, type TypePath } from '../rslang';\n\nimport { type CstDiagnostic } from './diagnostics';\nimport { type CurrentVersion, type LibraryItem, type LibraryItemReference, type VersionInfo } from './library';\n\n/** Represents {@link Constituenta} type. */\nexport const CstType = {\n NOMINAL: 'nominal',\n BASE: 'basic',\n STRUCTURED: 'structure',\n TERM: 'term',\n AXIOM: 'axiom',\n FUNCTION: 'function',\n PREDICATE: 'predicate',\n CONSTANT: 'constant',\n STATEMENT: 'statement'\n} as const;\nexport type CstType = (typeof CstType)[keyof typeof CstType];\n\n/** Represents attribution of a {@link Constituenta} to another {@link Constituenta}. */\nexport interface Attribution {\n container: number;\n attribute: number;\n}\n\n/** Represents global identifier type info. */\nexport interface TypeInfo {\n alias: string;\n type: ExpressionType;\n}\n\n/** Represents function argument value. */\nexport interface ArgumentValue {\n alias: string;\n typification: string;\n value?: string;\n}\n\n/** Represents Constituenta classification in terms of system of concepts. */\nexport const CstClass = {\n NOMINAL: 'nominal',\n BASIC: 'basic',\n DERIVED: 'derived',\n STATEMENT: 'statement',\n TEMPLATE: 'template'\n} as const;\nexport type CstClass = (typeof CstClass)[keyof typeof CstClass];\n\n/** Represents formal expression Status. */\nexport const CstStatus = {\n VERIFIED: 'verified',\n INCORRECT: 'incorrect',\n INCALCULABLE: 'incalculable',\n PROPERTY: 'property',\n UNKNOWN: 'unknown'\n} as const;\nexport type CstStatus = (typeof CstStatus)[keyof typeof CstStatus];\n\n/** Represents substitution of {@link Constituenta}. */\nexport interface Substitution {\n original: number;\n substitution: number;\n}\n\n/** Represents word form for natural language. */\
|
|
1
|
+
{"version":3,"file":"rsform.js","names":[],"sources":["../../src/library/rsform.ts"],"sourcesContent":["/**\n * Module: Models for formal representation for systems of concepts.\n */\n\nimport { type Graph } from '../graph';\nimport { type AnalysisBase, type ExpressionType, type RSLangAnalyzer, type TypePath } from '../rslang';\n\nimport { type CstDiagnostic } from './diagnostics';\nimport { type CurrentVersion, type LibraryItem, type LibraryItemReference, type VersionInfo } from './library';\n\n/** Represents {@link Constituenta} type. */\nexport const CstType = {\n NOMINAL: 'nominal',\n BASE: 'basic',\n STRUCTURED: 'structure',\n TERM: 'term',\n AXIOM: 'axiom',\n FUNCTION: 'function',\n PREDICATE: 'predicate',\n CONSTANT: 'constant',\n STATEMENT: 'statement'\n} as const;\nexport type CstType = (typeof CstType)[keyof typeof CstType];\n\n/** Represents attribution of a {@link Constituenta} to another {@link Constituenta}. */\nexport interface Attribution {\n container: number;\n attribute: number;\n}\n\n/** Represents global identifier type info. */\nexport interface TypeInfo {\n alias: string;\n type: ExpressionType;\n}\n\n/** Represents function argument value. */\nexport interface ArgumentValue {\n alias: string;\n typification: string;\n value?: string;\n}\n\n/** Represents Constituenta classification in terms of system of concepts. */\nexport const CstClass = {\n NOMINAL: 'nominal',\n BASIC: 'basic',\n DERIVED: 'derived',\n STATEMENT: 'statement',\n TEMPLATE: 'template'\n} as const;\nexport type CstClass = (typeof CstClass)[keyof typeof CstClass];\n\n/** Represents formal expression Status. */\nexport const CstStatus = {\n VERIFIED: 'verified',\n INCORRECT: 'incorrect',\n INCALCULABLE: 'incalculable',\n PROPERTY: 'property',\n UNKNOWN: 'unknown'\n} as const;\nexport type CstStatus = (typeof CstStatus)[keyof typeof CstStatus];\n\n/** Represents substitution of {@link Constituenta}. */\nexport interface Substitution {\n original: number;\n substitution: number;\n}\n\n/** Represents word form for natural language. */\nexport interface TermForm {\n text: string;\n tags: string;\n}\n\n/** Represents Constituenta. */\nexport interface Constituenta {\n id: number;\n crucial: boolean;\n alias: string;\n convention: string;\n cst_type: CstType;\n definition_formal: string;\n definition_raw: string;\n definition_resolved: string;\n term_raw: string;\n term_resolved: string;\n term_forms: TermForm[];\n attributes: number[];\n\n /** Manual typification of the constituent */\n typification_manual: string;\n\n /** Controls whether base concepts expose property values or full values */\n value_is_property: boolean;\n\n analysis: AnalysisBase;\n\n /** Schema-kind {@link CstDiagnostic} list, populated during schema loading. */\n diagnostics: CstDiagnostic[];\n\n /** Typification used for dependents, model values, and display (manual when it overrides computed). */\n effectiveType: ExpressionType | null;\n\n /**\n * True when manual typification is non-empty, parses to a type, and its label differs from the\n * typification inferred from the formal definition ({@link Constituenta.analysis}.type).\n */\n is_type_mismatch: boolean;\n\n /** Identifier of {@link LibraryItem} containing this {@link Constituenta}. */\n schema: number;\n\n /** {@link CstClass} of this {@link Constituenta}. */\n cst_class: CstClass;\n /** {@link CstStatus} of this {@link Constituenta}. */\n status: CstStatus;\n\n /** Indicates if this {@link Constituenta} is a template. */\n is_template: boolean;\n /** Indicates if this {@link Constituenta} has a simple expression. */\n is_simple_expression: boolean;\n\n /** Index of {@link LibraryItem} that contains this cst (or inheritance parent).\n * 0 - not inherited, 1 - inherited by 1st schema, 2 - inherited by 2nd schema, etc.\n */\n parent_schema_index: number;\n /** {@link LibraryItem} that contains parent of this inherited {@link Constituenta}. */\n parent_schema: number | null;\n /** Indicates if this {@link Constituenta} is inherited. */\n is_inherited: boolean;\n /** Indicates if this {@link Constituenta} has children that are inherited. */\n has_inherited_children: boolean;\n\n /** {@link Constituenta} that spawned this one. */\n spawner?: number;\n /** Alias of {@link Constituenta} that spawned this one. */\n spawner_alias?: string;\n /** Structure path that spawned this one. */\n spawner_path?: TypePath;\n\n /** List of {@link Constituenta} that are spawned by this one. */\n spawn: number[];\n /** List of aliases of {@link Constituenta} that are spawned by this one. */\n spawn_alias: string[];\n}\n\n/** Represents {@link RSForm} statistics. */\nexport interface RSFormStats {\n step_complexity: number;\n\n /** Total number of constituents in the RSForm. */\n count_all: number;\n /** Number of crucial constituents in the RSForm. */\n count_crucial: number;\n\n count_problematic: number;\n /** Constituents that have same term. */\n count_homonyms: number;\n /** Constituents that have same formal definition and term. */\n count_formal_duplicates: number;\n /** Non-logical basic constituents missing convention and/or resolved term. */\n count_missing_basic_text: number;\n /** Constituents with non-empty manual typification that disagrees with inferred typification. */\n count_type_mismatch: number;\n\n count_incorrect: number;\n count_property: number;\n count_incalculable: number;\n count_inherited: number;\n\n count_text_term: number;\n count_definition: number;\n count_convention: number;\n count_comment: number;\n\n count_base: number;\n count_constant: number;\n count_structured: number;\n count_axiom: number;\n count_term: number;\n count_function: number;\n count_predicate: number;\n count_statement: number;\n count_nominal: number;\n}\n\n/** Represents inheritance data for {@link RSForm}. */\ninterface InheritanceInfo {\n child: number;\n child_source: number;\n parent: number;\n parent_source: number;\n}\n\n/** Represents formal explication for set of concepts. */\nexport interface RSForm extends LibraryItem {\n /** Whether this RSForm was produced (vs imported or inherited) */\n is_produced: boolean;\n /** Whether this RSForm has attribution feature */\n is_attributive: boolean;\n /** List of user IDs who can edit this RSForm */\n editors: number[];\n /** Information about the current version of this RSForm */\n version: CurrentVersion;\n /** Full version history of this RSForm */\n versions: VersionInfo[];\n\n /** Full list of constituents in the RSForm */\n items: Constituenta[];\n /** List of inheritance relationships between constituents */\n inheritance: InheritanceInfo[];\n /** List of constituent attribution relationships */\n attribution: Attribution[];\n /** References to Operational Schemes/Systems associated with the RSForm */\n oss: LibraryItemReference[];\n /** References to conceptual models associated with the RSForm */\n models: LibraryItemReference[];\n\n /** Analyzer instance for RS language features and validation */\n analyzer: RSLangAnalyzer;\n /** Graph structure representing formal dependencies between constituents */\n graph: Graph;\n /** Graph structure representing attribution relationships */\n attribution_graph: Graph;\n /** Map for quick lookup of constituents by alias */\n cstByAlias: Map<string, Constituenta>;\n /** Map for quick lookup of constituents by ID */\n cstByID: Map<number, Constituenta>;\n}\n"],"mappings":";;AAWA,MAAa,UAAU;CACrB,SAAS;CACT,MAAM;CACN,YAAY;CACZ,MAAM;CACN,OAAO;CACP,UAAU;CACV,WAAW;CACX,UAAU;CACV,WAAW;AACb;;AAuBA,MAAa,WAAW;CACtB,SAAS;CACT,OAAO;CACP,SAAS;CACT,WAAW;CACX,UAAU;AACZ;;AAIA,MAAa,YAAY;CACvB,UAAU;CACV,WAAW;CACX,cAAc;CACd,UAAU;CACV,SAAS;AACX"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { b as Typification, f as ExpressionType } from "../typification-9lNu9R4k.js";
|
|
2
2
|
import { d as ValuePath, l as Value } from "../value-BduA_ZGp.js";
|
|
3
|
-
import { S as RSForm, f as EvalStatus, l as BasicBinding, m as RSModelStats, v as Constituenta, x as CstType } from "../diagnostics-
|
|
3
|
+
import { S as RSForm, f as EvalStatus, l as BasicBinding, m as RSModelStats, v as Constituenta, x as CstType } from "../diagnostics-Dac5sJhO.js";
|
|
4
4
|
import { RSEngine } from "./rsengine.js";
|
|
5
5
|
|
|
6
6
|
//#region src/library/rsmodel-api.d.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TypeID } from "../rslang/semantic/typification.js";
|
|
2
|
+
import { CstType } from "./rsform.js";
|
|
2
3
|
import { O as setNestedValue, _ as extractValue, b as isTupleValue, f as tuple, l as compare, x as makeDefaultValue } from "../value-COprb2Je.js";
|
|
3
4
|
import "../rslang/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import { F as isBasicConcept, P as isBaseSet, f as calculateSchemaStats, s as modelStatusCstDiagnostic } from "../diagnostics-B1OfMra1.js";
|
|
5
|
+
import { Q as isBasicConcept, S as calculateSchemaStats, Z as isBaseSet, s as modelStatusCstDiagnostic } from "../diagnostics-CljEzVBV.js";
|
|
6
6
|
import { EvalStatus } from "./rsmodel.js";
|
|
7
7
|
//#region src/library/rsmodel-api.ts
|
|
8
8
|
const RANDOM_INTEGER_MIN = -100;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { d as DEFAULT_VALUE_TEXT, f as EvalStatus, h as TYPE_BASIC, l as BasicBinding, m as RSModelStats, p as RSModel, u as BasicsContext } from "../diagnostics-
|
|
1
|
+
import { d as DEFAULT_VALUE_TEXT, f as EvalStatus, h as TYPE_BASIC, l as BasicBinding, m as RSModelStats, p as RSModel, u as BasicsContext } from "../diagnostics-Dac5sJhO.js";
|
|
2
2
|
export { BasicBinding, BasicsContext, DEFAULT_VALUE_TEXT, EvalStatus, RSModel, RSModelStats, TYPE_BASIC };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b as Typification, y as TypePath } from "../typification-9lNu9R4k.js";
|
|
2
|
-
import { S as RSForm, v as Constituenta } from "../diagnostics-
|
|
2
|
+
import { S as RSForm, v as Constituenta } from "../diagnostics-Dac5sJhO.js";
|
|
3
3
|
|
|
4
4
|
//#region src/library/structure-planner.d.ts
|
|
5
5
|
/** Represents a node in the structure planner. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TypeID, bool, isTypification, makeTypePath } from "../rslang/semantic/typification.js";
|
|
2
2
|
import { labelType } from "../rslang/labels.js";
|
|
3
3
|
import { splitTemplateDefinition } from "../rslang/api.js";
|
|
4
|
-
import "../rslang/index.js";
|
|
5
4
|
import { CstType } from "./rsform.js";
|
|
6
|
-
import
|
|
5
|
+
import "../rslang/index.js";
|
|
6
|
+
import { y as findCstByStructure } from "../diagnostics-CljEzVBV.js";
|
|
7
7
|
//#region src/library/structure-planner.ts
|
|
8
8
|
/** Structure planner for {@link Constituenta}. */
|
|
9
9
|
var StructurePlanner = class {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/library/index.ts
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import { applyEntityReferenceMapping } from '../../cctext/language-api';
|
|
6
6
|
import { type AliasMapping, applyAliasMapping, applyTypificationMapping } from '../../rslang/api';
|
|
7
|
-
import { type ArgumentValue,
|
|
7
|
+
import { type ArgumentValue, CstType, type RSForm } from '../rsform';
|
|
8
8
|
|
|
9
9
|
import { getCstTypePrefix } from './cst-type';
|
|
10
|
+
import { type AliasTypedConstituenta } from './types';
|
|
10
11
|
|
|
11
12
|
/** Fields of {@link Constituenta} updated in place by alias mapping. */
|
|
12
13
|
export interface ConstituentaMappableFields {
|
|
@@ -92,6 +93,61 @@ export function applyMappingToConstituents<T extends ConstituentaMappableFields>
|
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
|
|
96
|
+
/** Highest numeric alias suffix for {@link type} among {@link items} (0 when none). */
|
|
97
|
+
export function maxAliasIndex(items: readonly AliasTypedConstituenta[], type: CstType): number {
|
|
98
|
+
const prefix = getCstTypePrefix(type);
|
|
99
|
+
return items.reduce((max, cst) => {
|
|
100
|
+
if (cst.cst_type !== type) {
|
|
101
|
+
return max;
|
|
102
|
+
}
|
|
103
|
+
const index = Number(cst.alias.slice(prefix.length));
|
|
104
|
+
return Number.isFinite(index) ? Math.max(max, index) : max;
|
|
105
|
+
}, 0);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Build alias → new-alias mapping that renumbers each type sequentially in list order.
|
|
110
|
+
* Matches backend {@code RSFormCached.reset_aliases}.
|
|
111
|
+
*/
|
|
112
|
+
export function buildSequentialAliasMapping(items: readonly AliasTypedConstituenta[]): AliasMapping {
|
|
113
|
+
const counts: Record<string, number> = {};
|
|
114
|
+
for (const value of Object.values(CstType)) {
|
|
115
|
+
counts[value] = 1;
|
|
116
|
+
}
|
|
117
|
+
const mapping: AliasMapping = {};
|
|
118
|
+
for (const cst of items) {
|
|
119
|
+
const alias = `${getCstTypePrefix(cst.cst_type)}${counts[cst.cst_type]}`;
|
|
120
|
+
counts[cst.cst_type] += 1;
|
|
121
|
+
if (cst.alias !== alias) {
|
|
122
|
+
mapping[cst.alias] = alias;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return mapping;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Allocate fresh aliases for {@link source} constituents being imported into a non-empty receiver.
|
|
130
|
+
* Returns an empty mapping when the receiver has no items (aliases kept as-is).
|
|
131
|
+
*/
|
|
132
|
+
export function allocateImportAliases(
|
|
133
|
+
receiver: readonly AliasTypedConstituenta[],
|
|
134
|
+
source: readonly AliasTypedConstituenta[]
|
|
135
|
+
): AliasMapping {
|
|
136
|
+
if (receiver.length === 0) {
|
|
137
|
+
return {};
|
|
138
|
+
}
|
|
139
|
+
const counts: Record<string, number> = {};
|
|
140
|
+
for (const value of Object.values(CstType)) {
|
|
141
|
+
counts[value] = maxAliasIndex(receiver, value);
|
|
142
|
+
}
|
|
143
|
+
const mapping: AliasMapping = {};
|
|
144
|
+
for (const cst of source) {
|
|
145
|
+
counts[cst.cst_type] += 1;
|
|
146
|
+
mapping[cst.alias] = `${getCstTypePrefix(cst.cst_type)}${counts[cst.cst_type]}`;
|
|
147
|
+
}
|
|
148
|
+
return mapping;
|
|
149
|
+
}
|
|
150
|
+
|
|
95
151
|
/** Remove alias from expression. */
|
|
96
152
|
export function removeAliasReference(expression: string, alias: string): string {
|
|
97
153
|
const escaped = alias.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|