@rsconcept/domain 3.0.0 → 3.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-fNhkwO-6.d.ts → analyzer-CzFaWR7w.d.ts} +4 -4
- package/dist/{api-Bf0f_uiI.d.ts → api-DgecYHjR.d.ts} +5 -3
- package/dist/{arguments-extractor-ngatANBI.d.ts → arguments-extractor-CXWRT5Ou.d.ts} +4 -4
- package/dist/{ast-C8sIpKdL.d.ts → ast-D-D6Rq3T.d.ts} +2 -3
- package/dist/{ast-annotations-CiIx8qBM.d.ts → ast-annotations-x4PJ_Lhc.d.ts} +4 -4
- package/dist/{calculator-DE89LtIM.d.ts → calculator-uPaTV3hc.d.ts} +5 -5
- package/dist/cctext/language-api.d.ts +0 -1
- package/dist/{diagnostics-ndGYbvgh.js → diagnostics-D1Cp21nP.js} +16 -3
- package/dist/{diagnostics-ndGYbvgh.js.map → diagnostics-D1Cp21nP.js.map} +1 -1
- package/dist/{diagnostics-DsEhmFh0.d.ts → diagnostics-DKyMf6q-.d.ts} +20 -6
- package/dist/{expression-generator-CoucLIkE.d.ts → expression-generator-CADzBw-C.d.ts} +3 -2
- package/dist/graph/index.d.ts +1 -0
- package/dist/index-CnuO4w8e.d.ts +13 -0
- package/dist/index-D5RahF1K.d.ts +2 -0
- package/dist/{index-DpiTybDB.d.ts → index-DCO4mxiO.d.ts} +9 -7
- package/dist/index-DntDUXW1.d.ts +1 -0
- package/dist/index-x0_Y5uPV.d.ts +2 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.js +1 -1
- package/dist/{lezer-tree-iS7LpLBJ.d.ts → lezer-tree-BQZqBT5A.d.ts} +1 -2
- package/dist/library/diagnostics.d.ts +1 -1
- package/dist/library/diagnostics.js +1 -1
- package/dist/library/index.d.ts +2 -3
- package/dist/library/index.js +1 -1
- package/dist/library/oss-api.d.ts +11 -3
- package/dist/library/oss-api.js +45 -4
- package/dist/library/oss-api.js.map +1 -1
- package/dist/library/oss-layout-api.d.ts +0 -1
- package/dist/library/oss.d.ts +21 -16
- package/dist/library/oss.js +19 -13
- package/dist/library/oss.js.map +1 -1
- package/dist/library/rsengine.d.ts +6 -5
- package/dist/library/rsengine.js +1 -1
- package/dist/library/rsform-api/index.d.ts +1 -1
- package/dist/library/rsform-api/index.js +1 -1
- package/dist/library/rsform.d.ts +1 -1
- package/dist/library/rsmodel-api.d.ts +5 -5
- package/dist/library/rsmodel-api.js +1 -1
- package/dist/library/rsmodel.d.ts +1 -1
- package/dist/library/structure-planner.d.ts +3 -3
- package/dist/library/structure-planner.js +1 -1
- package/dist/{parser-Bwd8LxJ1.d.ts → parser-DkejtiOR.d.ts} +1 -2
- package/dist/parsing/ast.d.ts +1 -1
- package/dist/parsing/index.d.ts +3 -2
- package/dist/parsing/lezer-tree.d.ts +1 -1
- package/dist/rslang/api.d.ts +2 -2
- package/dist/rslang/ast-annotations.d.ts +1 -1
- package/dist/rslang/eval/calculator.d.ts +1 -1
- package/dist/rslang/eval/evaluation-cache.d.ts +3 -3
- package/dist/rslang/eval/evaluator.d.ts +3 -3
- package/dist/rslang/eval/value-api.d.ts +1 -1
- package/dist/rslang/eval/value.d.ts +1 -1
- package/dist/rslang/index.d.ts +11 -10
- package/dist/rslang/labels.d.ts +3 -3
- package/dist/rslang/parser/expression-generator.d.ts +1 -1
- package/dist/rslang/parser/normalize.d.ts +2 -1
- package/dist/rslang/parser/parser.d.ts +1 -1
- package/dist/rslang/parser/parser.terms.d.ts +1 -40
- package/dist/rslang/parser/syntax-errors/index.d.ts +3 -3
- package/dist/rslang/semantic/analyzer.d.ts +1 -1
- package/dist/rslang/semantic/arguments-extractor.d.ts +1 -1
- package/dist/rslang/semantic/type-auditor.d.ts +3 -3
- package/dist/rslang/semantic/typification-api.d.ts +1 -2
- package/dist/rslang/semantic/typification-parser.d.ts +1 -1
- package/dist/rslang/semantic/typification.d.ts +1 -1
- package/dist/rslang/semantic/value-auditor.d.ts +2 -2
- package/dist/rslang/typification-graph.d.ts +1 -1
- package/dist/shared/index.d.ts +1 -0
- package/dist/{typification-graph-BY_oGT82.d.ts → typification-graph-CSxDt18X.d.ts} +2 -3
- package/dist/{typification-9lNu9R4k.d.ts → typification-hWUoWCba.d.ts} +2 -1
- package/dist/{typification-parser-Dytsv9CI.d.ts → typification-parser-DFxj4JiQ.d.ts} +2 -3
- package/dist/{value-BduA_ZGp.d.ts → value-XpJOVzMP.d.ts} +2 -1
- package/dist/{value-api-CXLl_zg0.d.ts → value-api-Dw8UkwCD.d.ts} +3 -4
- package/package.json +8 -8
- package/src/library/diagnostics.ts +16 -2
- package/src/library/oss-api.test.ts +100 -5
- package/src/library/oss-api.ts +71 -5
- package/src/library/oss.ts +22 -16
- package/dist/index-BKZ67WMa.d.ts +0 -1
- package/dist/index-BVVgDSdq.d.ts +0 -1
- package/dist/index-DmtQKWjk.d.ts +0 -1
- package/dist/index-_6s0AX1B.d.ts +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { t as Graph } from "./graph-CL73WdW1.js";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import "./index-DntDUXW1.js";
|
|
3
|
+
import { f as ExpressionType, y as TypePath } from "./typification-hWUoWCba.js";
|
|
4
|
+
import { l as Value } from "./value-XpJOVzMP.js";
|
|
5
|
+
import { a as RSLangAnalyzer, t as AnalysisBase } from "./analyzer-CzFaWR7w.js";
|
|
6
|
+
import "./index-CnuO4w8e.js";
|
|
5
7
|
import { i as LibraryItemReference, n as CurrentVersion, r as LibraryItem, s as VersionInfo } from "./library-CYun28Xz.js";
|
|
6
|
-
|
|
7
8
|
//#region src/library/rsform.d.ts
|
|
8
9
|
/** Represents {@link Constituenta} type. */
|
|
9
10
|
declare const CstType: {
|
|
@@ -244,7 +245,7 @@ declare const DiagnosticKind: {
|
|
|
244
245
|
readonly MODEL: "model";
|
|
245
246
|
};
|
|
246
247
|
type DiagnosticKind = (typeof DiagnosticKind)[keyof typeof DiagnosticKind];
|
|
247
|
-
/** Schema and
|
|
248
|
+
/** Schema, model, and substitution-table diagnostic codes (same numeric format as {@link RSErrorCode}). */
|
|
248
249
|
declare const RSDiagnosticCode: {
|
|
249
250
|
readonly schemaHomonym: 35073;
|
|
250
251
|
readonly schemaFormalDuplicate: 35074;
|
|
@@ -256,6 +257,19 @@ declare const RSDiagnosticCode: {
|
|
|
256
257
|
readonly modelAxiomFalse: 35089;
|
|
257
258
|
readonly modelInvalidData: 35090;
|
|
258
259
|
readonly modelEvalFail: 35091;
|
|
260
|
+
readonly substitutionInvalidIDs: 35104;
|
|
261
|
+
readonly substitutionIncorrectCst: 35105;
|
|
262
|
+
readonly substitutionInvalidClasses: 35106;
|
|
263
|
+
readonly substitutionInvalidBasic: 35107;
|
|
264
|
+
readonly substitutionInvalidConstant: 35108;
|
|
265
|
+
readonly substitutionTypificationCycle: 35109;
|
|
266
|
+
readonly substitutionBaseNotSet: 35110;
|
|
267
|
+
readonly substitutionUnequalTypification: 35111;
|
|
268
|
+
/** Non-blocking warning: formal definitions differ after mapping. */
|
|
269
|
+
readonly substitutionUnequalExpressions: 10536;
|
|
270
|
+
readonly substitutionUnequalArgsCount: 35113;
|
|
271
|
+
readonly substitutionUnequalArgs: 35114;
|
|
272
|
+
readonly substitutionInvalidNominal: 35115;
|
|
259
273
|
};
|
|
260
274
|
type RSDiagnosticCode = (typeof RSDiagnosticCode)[keyof typeof RSDiagnosticCode];
|
|
261
275
|
/** Compact diagnostic stored on {@link Constituenta} after schema loading. */
|
|
@@ -300,4 +314,4 @@ declare function detectDependencyCycleDiagnostics(graph: Graph, resolveAlias: (i
|
|
|
300
314
|
declare function modelStatusCstDiagnostic(status: EvalStatus, cstType: CstType): CstDiagnostic | null;
|
|
301
315
|
//#endregion
|
|
302
316
|
export { RSFormStats as C, TypeInfo as E, RSForm as S, TermForm as T, Attribution as _, detectDependencyCycleDiagnostics as a, CstStatus as b, modelStatusCstDiagnostic as c, DEFAULT_VALUE_TEXT as d, EvalStatus as f, ArgumentValue as g, TYPE_BASIC as h, assignSchemaDiagnostics as i, BasicBinding as l, RSModelStats as m, DiagnosticKind as n, formatDependencyCycle as o, RSModel as p, RSDiagnosticCode as r, hasCstDiagnostic as s, CstDiagnostic as t, BasicsContext as u, Constituenta as v, Substitution as w, CstType as x, CstClass as y };
|
|
303
|
-
//# sourceMappingURL=diagnostics-
|
|
317
|
+
//# sourceMappingURL=diagnostics-DKyMf6q-.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { t as AstNode } from "./ast-
|
|
1
|
+
import { t as AstNode } from "./ast-D-D6Rq3T.js";
|
|
2
|
+
import "./index-D5RahF1K.js";
|
|
2
3
|
//#region src/rslang/parser/expression-generator.d.ts
|
|
3
4
|
interface ExpressionGeneratorOptions {
|
|
4
5
|
normalize?: boolean;
|
|
@@ -7,4 +8,4 @@ interface ExpressionGeneratorOptions {
|
|
|
7
8
|
declare function generateExpressionFromAst(ast: AstNode, options?: ExpressionGeneratorOptions): string;
|
|
8
9
|
//#endregion
|
|
9
10
|
export { generateExpressionFromAst as t };
|
|
10
|
-
//# sourceMappingURL=expression-generator-
|
|
11
|
+
//# sourceMappingURL=expression-generator-CADzBw-C.d.ts.map
|
package/dist/graph/index.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "./typification-hWUoWCba.js";
|
|
2
|
+
import "./error-B0EkIx4K.js";
|
|
3
|
+
import "./ast-annotations-x4PJ_Lhc.js";
|
|
4
|
+
import "./value-XpJOVzMP.js";
|
|
5
|
+
import "./calculator-uPaTV3hc.js";
|
|
6
|
+
import "./value-api-Dw8UkwCD.js";
|
|
7
|
+
import "./parser-DkejtiOR.js";
|
|
8
|
+
import "./token-DeXAmzwr.js";
|
|
9
|
+
import "./value-class-CNI-lqXJ.js";
|
|
10
|
+
import "./analyzer-CzFaWR7w.js";
|
|
11
|
+
import "./arguments-extractor-CXWRT5Ou.js";
|
|
12
|
+
import "./typification-parser-DFxj4JiQ.js";
|
|
13
|
+
import "./typification-graph-CSxDt18X.js";
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { t as Graph } from "./graph-CL73WdW1.js";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import "./index-DntDUXW1.js";
|
|
3
|
+
import { t as AstNode } from "./ast-D-D6Rq3T.js";
|
|
4
|
+
import "./index-D5RahF1K.js";
|
|
5
|
+
import { f as ExpressionType, g as TypeClass, y as TypePath } from "./typification-hWUoWCba.js";
|
|
4
6
|
import { t as ValueClass } from "./value-class-CNI-lqXJ.js";
|
|
5
|
-
import { r as AnalysisFull } from "./analyzer-
|
|
7
|
+
import { r as AnalysisFull } from "./analyzer-CzFaWR7w.js";
|
|
8
|
+
import "./index-CnuO4w8e.js";
|
|
6
9
|
import { r as LibraryItem } from "./library-CYun28Xz.js";
|
|
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-
|
|
8
|
-
import { t as AliasMapping } from "./api-
|
|
9
|
-
|
|
10
|
+
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-DKyMf6q-.js";
|
|
11
|
+
import { t as AliasMapping } from "./api-DgecYHjR.js";
|
|
10
12
|
//#region src/library/rsform-api/types.d.ts
|
|
11
13
|
/** Fields needed to restore formal dependency order. */
|
|
12
14
|
interface FormalOrderFields {
|
|
@@ -373,4 +375,4 @@ declare function insertItemAfter<T extends {
|
|
|
373
375
|
}>(items: T[], item: T, insertAfter: number | null | undefined): void;
|
|
374
376
|
//#endregion
|
|
375
377
|
export { removeAliasReference as $, canProduceStructure as A, filterAttributions as B, restoreConstituentOrder as C, inferTemplatedType as D, inferTemplate as E, isBasicConcept as F, MappableFields as G, remapAttributionsUnderSubstitution as H, isFunctional as I, applyMappingToConstituents as J, addAliasReference as K, isLogical as L, guessCstType as M, inferClass as N, normalizeExpression as O, isBaseSet as P, maxAliasIndex as Q, isTemplateCst as R, buildFormalDependencyGraph as S, inferStatus as T, getAnalysisFor as U, importAttributions as V, refineAnalysisForDependencyCycles as W, buildSequentialAliasMapping as X, argumentValuesToMapping as Y, generateAlias as Z, findCstByStructure as _, buildDefinitionReferenceGraph as a, DiagnosticSourceFields as at, calculateSchemaStats as b, resolveConstituentTextChange as c, SchemaIssueFields as ct, SynthesizableFields as d, SpawnPathFields as dt, validateAliasFormat as et, inlineSynthesis as f, StructureCapableFields as ft, remapSubstitutionsAfterImport as g, applyConstituentSubstitutions as h, TextResolvableFields as ht, TextChangeOptions as i, DescribableFields as it, getCstTypePrefix as j, canHaveManualTypification as k, InlineSynthesisInput as l, SearchableFields as lt, SubstitutionResult as m, TemplateSourceFields as mt, moveIdsInOrder as n, AliasTypedFields as nt, buildTermReferenceGraph as o, FormalOrderFields as ot, sortItemsForInlineSynthesis as p, TemplateParamSourceFields as pt, allocateImportAliases as q, reorderItemsByIds as r, BasicTextCheckFields as rt, resolveAllConstituentTexts as s, ModelEvalFields as st, insertItemAfter as t, validateNewAlias as tt, InlineSynthesisResult as u, SemanticRelations as ut, getStructureName as v, applyFilterCategory as w, isSchemaIssue as x, inferNewSpawnPosition as y, typeClassForCstType as z };
|
|
376
|
-
//# sourceMappingURL=index-
|
|
378
|
+
//# sourceMappingURL=index-DCO4mxiO.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./graph-CL73WdW1.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { EntityReference, Grammeme, ReferenceType, SyntacticReference, TermContext, WordForm, supportedGrammemes } from "./cctext/language.js";
|
|
2
2
|
import { t as Graph } from "./graph-CL73WdW1.js";
|
|
3
|
-
import { r as printTree, t as CMSyntaxNode } from "./lezer-tree-
|
|
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-
|
|
3
|
+
import { r as printTree, t as CMSyntaxNode } from "./lezer-tree-BQZqBT5A.js";
|
|
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-D-D6Rq3T.js";
|
|
5
5
|
import { t as Branded } from "./branded-ZlzIcxzu.js";
|
|
6
6
|
import { n as generateStub, t as applyHash_fnv1a } from "./hash-Y8I4c6Al.js";
|
|
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-
|
|
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-hWUoWCba.js";
|
|
8
8
|
import { i as RSErrorDescription, r as RSErrorCode } from "./error-B0EkIx4K.js";
|
|
9
|
-
import { i as readTypeAnnotation, r as readErrorAnnotation } from "./ast-annotations-
|
|
10
|
-
import { d as ValuePath, l as Value, o as TUPLE_ID, p as makeValuePath } from "./value-
|
|
11
|
-
import { n as CalculatorResult, r as RSCalculator, t as CalculatorEvaluateOptions } from "./calculator-
|
|
12
|
-
import { d as printValue } from "./value-api-
|
|
13
|
-
import { t as parser } from "./parser-
|
|
9
|
+
import { i as readTypeAnnotation, r as readErrorAnnotation } from "./ast-annotations-x4PJ_Lhc.js";
|
|
10
|
+
import { d as ValuePath, l as Value, o as TUPLE_ID, p as makeValuePath } from "./value-XpJOVzMP.js";
|
|
11
|
+
import { n as CalculatorResult, r as RSCalculator, t as CalculatorEvaluateOptions } from "./calculator-uPaTV3hc.js";
|
|
12
|
+
import { d as printValue } from "./value-api-Dw8UkwCD.js";
|
|
13
|
+
import { t as parser } from "./parser-DkejtiOR.js";
|
|
14
14
|
import { t as TokenID } from "./token-DeXAmzwr.js";
|
|
15
15
|
import { t as ValueClass } from "./value-class-CNI-lqXJ.js";
|
|
16
|
-
import { a as RSLangAnalyzer, n as AnalysisFast, r as AnalysisFull, t as AnalysisBase } from "./analyzer-
|
|
17
|
-
import { n as ArgumentsType } from "./arguments-extractor-
|
|
18
|
-
import { n as applyAsciiTypeSubstitutions, r as parseTypeText } from "./typification-parser-
|
|
19
|
-
import { n as TypificationNodeData, t as TypificationGraph } from "./typification-graph-
|
|
16
|
+
import { a as RSLangAnalyzer, n as AnalysisFast, r as AnalysisFull, t as AnalysisBase } from "./analyzer-CzFaWR7w.js";
|
|
17
|
+
import { n as ArgumentsType } from "./arguments-extractor-CXWRT5Ou.js";
|
|
18
|
+
import { n as applyAsciiTypeSubstitutions, r as parseTypeText } from "./typification-parser-DFxj4JiQ.js";
|
|
19
|
+
import { n as TypificationNodeData, t as TypificationGraph } from "./typification-graph-CSxDt18X.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, 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-
|
|
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-DKyMf6q-.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";
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { ValueClass } from "./rslang/semantic/value-class.js";
|
|
|
15
15
|
import { RSLangAnalyzer } from "./rslang/semantic/analyzer.js";
|
|
16
16
|
import { applyAsciiTypeSubstitutions, parseTypeText } from "./rslang/semantic/typification-parser.js";
|
|
17
17
|
import { TypificationGraph } from "./rslang/typification-graph.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-
|
|
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-D1Cp21nP.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,5 +1,4 @@
|
|
|
1
1
|
import { NodeType, Tree, TreeCursor } from "@lezer/common";
|
|
2
|
-
|
|
3
2
|
//#region src/parsing/lezer-tree.d.ts
|
|
4
3
|
/** Represents syntax tree node data. */
|
|
5
4
|
interface CMSyntaxNode {
|
|
@@ -11,4 +10,4 @@ interface CMSyntaxNode {
|
|
|
11
10
|
declare function printTree(tree: Tree): string;
|
|
12
11
|
//#endregion
|
|
13
12
|
export { TreeCursor as n, printTree as r, CMSyntaxNode as t };
|
|
14
|
-
//# sourceMappingURL=lezer-tree-
|
|
13
|
+
//# sourceMappingURL=lezer-tree-BQZqBT5A.d.ts.map
|
|
@@ -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-DKyMf6q-.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-D1Cp21nP.js";
|
|
2
2
|
export { DiagnosticKind, RSDiagnosticCode, assignSchemaDiagnostics, detectDependencyCycleDiagnostics, formatDependencyCycle, hasCstDiagnostic, modelStatusCstDiagnostic };
|
package/dist/library/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
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, 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-
|
|
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-DKyMf6q-.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";
|
|
6
6
|
import { RSEngine } from "./rsengine.js";
|
|
7
|
-
import { mt as TemplateSourceFields } from "../index-
|
|
8
|
-
|
|
7
|
+
import { mt as TemplateSourceFields } from "../index-DCO4mxiO.js";
|
|
9
8
|
//#region src/library/template-instantiation.d.ts
|
|
10
9
|
/**
|
|
11
10
|
* Payload for one {@link Constituenta} to create when instantiating an expression-bank template.
|
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 { $ 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-
|
|
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-D1Cp21nP.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,7 +1,6 @@
|
|
|
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-DKyMf6q-.js";
|
|
3
3
|
import { NodeType, OperationSchema, SubstitutionErrorDescription } from "./oss.js";
|
|
4
|
-
|
|
5
4
|
//#region src/library/oss-api.d.ts
|
|
6
5
|
declare function constructNodeID(type: NodeType, itemID: number): string;
|
|
7
6
|
/** Sorts library items relevant for the specified {@link OperationSchema}. */
|
|
@@ -22,7 +21,16 @@ declare class SubstitutionValidator {
|
|
|
22
21
|
validate(): boolean;
|
|
23
22
|
private calculateSuggestions;
|
|
24
23
|
private checkTypes;
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Detect cycles among base/constant sets implied by typifications of non-base
|
|
26
|
+
* constituents under the substitution table.
|
|
27
|
+
*/
|
|
28
|
+
private checkTypificationCycles;
|
|
29
|
+
/**
|
|
30
|
+
* Detect logical cycles in formal definitions after applying the substitution table
|
|
31
|
+
* (e.g. D16 := F2[D15] with identification D15 → D16 yields D16 := F2[D16]).
|
|
32
|
+
*/
|
|
33
|
+
private checkDefinitionCycles;
|
|
26
34
|
private checkSubstitutions;
|
|
27
35
|
private prepareBaseMappings;
|
|
28
36
|
private calculateSubstituteMappings;
|
package/dist/library/oss-api.js
CHANGED
|
@@ -3,6 +3,7 @@ import { labelType } from "../rslang/labels.js";
|
|
|
3
3
|
import { applyAliasMapping, applyTypificationMapping, isSetTypification } from "../rslang/api.js";
|
|
4
4
|
import { CstClass, CstType } from "./rsform.js";
|
|
5
5
|
import { extractBases } from "../rslang/semantic/typification-api.js";
|
|
6
|
+
import { a as formatDependencyCycle } from "../diagnostics-D1Cp21nP.js";
|
|
6
7
|
import "../graph/index.js";
|
|
7
8
|
import { NodeType, SubstitutionErrorType } from "./oss.js";
|
|
8
9
|
//#region src/library/oss-api.ts
|
|
@@ -66,7 +67,8 @@ var SubstitutionValidator = class {
|
|
|
66
67
|
this.calculateSuggestions();
|
|
67
68
|
if (this.substitutions.length === 0) return true;
|
|
68
69
|
if (!this.checkTypes()) return false;
|
|
69
|
-
if (!this.
|
|
70
|
+
if (!this.checkTypificationCycles()) return false;
|
|
71
|
+
if (!this.checkDefinitionCycles()) return false;
|
|
70
72
|
if (!this.checkSubstitutions()) return false;
|
|
71
73
|
return true;
|
|
72
74
|
}
|
|
@@ -131,7 +133,11 @@ var SubstitutionValidator = class {
|
|
|
131
133
|
}
|
|
132
134
|
return true;
|
|
133
135
|
}
|
|
134
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Detect cycles among base/constant sets implied by typifications of non-base
|
|
138
|
+
* constituents under the substitution table.
|
|
139
|
+
*/
|
|
140
|
+
checkTypificationCycles() {
|
|
135
141
|
const graph = new Graph();
|
|
136
142
|
for (const schema of this.schemas) for (const cst of schema.items) if (cst.cst_type === CstType.BASE || cst.cst_type === CstType.CONSTANT) graph.addNode(cst.id);
|
|
137
143
|
for (const item of this.substitutions) {
|
|
@@ -161,6 +167,41 @@ var SubstitutionValidator = class {
|
|
|
161
167
|
}
|
|
162
168
|
return true;
|
|
163
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Detect logical cycles in formal definitions after applying the substitution table
|
|
172
|
+
* (e.g. D16 := F2[D15] with identification D15 → D16 yields D16 := F2[D16]).
|
|
173
|
+
*/
|
|
174
|
+
checkDefinitionCycles() {
|
|
175
|
+
const graph = new Graph();
|
|
176
|
+
for (const schema of this.schemas) for (const [id, node] of schema.graph.nodes) {
|
|
177
|
+
graph.addNode(id);
|
|
178
|
+
for (const output of node.outputs) graph.addEdge(id, output);
|
|
179
|
+
}
|
|
180
|
+
const deleted = /* @__PURE__ */ new Map();
|
|
181
|
+
for (const item of this.substitutions) deleted.set(item.original, item.substitution);
|
|
182
|
+
const resolve = (id) => deleted.get(id) ?? id;
|
|
183
|
+
const result = new Graph();
|
|
184
|
+
for (const id of graph.nodes.keys()) if (!deleted.has(id)) result.addNode(id);
|
|
185
|
+
for (const substitutionId of deleted.values()) result.addNode(substitutionId);
|
|
186
|
+
for (const [id, node] of graph.nodes) for (const output of node.outputs) {
|
|
187
|
+
if (deleted.has(output)) continue;
|
|
188
|
+
result.addEdge(resolve(id), output);
|
|
189
|
+
}
|
|
190
|
+
const cycle = result.findCycle();
|
|
191
|
+
if (cycle !== null) {
|
|
192
|
+
const aliases = cycle.map((id) => {
|
|
193
|
+
const cst = this.cstByID.get(id);
|
|
194
|
+
if (!cst) return String(id);
|
|
195
|
+
if (this.schemas.length > 1) {
|
|
196
|
+
const schema = this.schemaByID.get(cst.schema);
|
|
197
|
+
return schema ? `[${schema.alias}]-${cst.alias}` : cst.alias;
|
|
198
|
+
}
|
|
199
|
+
return cst.alias;
|
|
200
|
+
});
|
|
201
|
+
return this.reportError(SubstitutionErrorType.definitionCycle, [formatDependencyCycle(aliases)]);
|
|
202
|
+
}
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
164
205
|
checkSubstitutions() {
|
|
165
206
|
const baseMappings = this.prepareBaseMappings();
|
|
166
207
|
const typeMappings = this.calculateSubstituteMappings(baseMappings);
|
|
@@ -233,9 +274,9 @@ var SubstitutionValidator = class {
|
|
|
233
274
|
const expression2 = applyAliasMapping(right.definition_formal, this.mapping.get(schema2.id));
|
|
234
275
|
return expression1.replace(/\s+/g, "") === expression2.replace(/\s+/g, "");
|
|
235
276
|
}
|
|
236
|
-
reportError(
|
|
277
|
+
reportError(code, params) {
|
|
237
278
|
this.errors.push({
|
|
238
|
-
|
|
279
|
+
code,
|
|
239
280
|
params
|
|
240
281
|
});
|
|
241
282
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oss-api.js","names":[],"sources":["../../src/library/oss-api.ts"],"sourcesContent":["/**\n * Module: API for OperationSystem.\n */\n\nimport { Graph } from '../graph';\nimport { type AliasMapping, applyAliasMapping, applyTypificationMapping, isSetTypification } from '../rslang/api';\nimport { labelType } from '../rslang/labels';\nimport { extractBases } from '../rslang/semantic/typification-api';\n\nimport { type LibraryItem } from './library';\nimport { NodeType, type OperationSchema, type SubstitutionErrorDescription, SubstitutionErrorType } from './oss';\nimport { type Constituenta, CstClass, CstType, type RSForm, type Substitution } from './rsform';\nimport { type FormalOrderFields } from './rsform-api';\n\nconst STARTING_SUB_INDEX = 900; // max semantic index for starting substitution\n\nexport function constructNodeID(type: NodeType, itemID: number): string {\n return type === NodeType.OPERATION ? 'o' + String(itemID) : 'b' + String(itemID);\n}\n\n/** Sorts library items relevant for the specified {@link OperationSchema}. */\nexport function sortItemsForOSS(oss: OperationSchema, items: readonly LibraryItem[]): LibraryItem[] {\n const result = items.filter(item => item.location === oss.location);\n for (const item of items) {\n if (item.visible && item.owner === oss.owner && !result.includes(item)) {\n result.push(item);\n }\n }\n for (const item of items) {\n if (item.visible && !result.includes(item)) {\n result.push(item);\n }\n }\n for (const item of items) {\n if (!result.includes(item)) {\n result.push(item);\n }\n }\n return result;\n}\n\ntype CrossMapping = Map<number, AliasMapping>;\n\n/** Validator for Substitution table. */\nexport class SubstitutionValidator {\n public errors: SubstitutionErrorDescription[] = [];\n public suggestions: Substitution[] = [];\n\n private schemas: RSForm[];\n private substitutions: Substitution[];\n private constituents = new Set<number>();\n private originals = new Set<number>();\n private mapping: CrossMapping = new Map();\n\n private cstByID = new Map<number, Constituenta>();\n private schemaByID = new Map<number, RSForm>();\n private schemaByCst = new Map<number, RSForm>();\n\n constructor(schemas: RSForm[], substitutions: Substitution[]) {\n this.schemas = schemas;\n this.substitutions = substitutions;\n if (schemas.length === 0) {\n return;\n }\n\n for (const schema of schemas) {\n this.schemaByID.set(schema.id, schema);\n this.mapping.set(schema.id, {});\n for (const item of schema.items) {\n this.cstByID.set(item.id, item);\n this.schemaByCst.set(item.id, schema);\n }\n }\n if (substitutions.length === 0) {\n return;\n }\n let index = STARTING_SUB_INDEX;\n for (const item of substitutions) {\n this.constituents.add(item.original);\n this.constituents.add(item.substitution);\n this.originals.add(item.original);\n const original = this.cstByID.get(item.original);\n const substitution = this.cstByID.get(item.substitution);\n if (!original || !substitution) {\n return;\n }\n index++;\n const newAlias = `${substitution.alias[0]}${index}`;\n this.mapping.get(original.schema)![original.alias] = newAlias;\n this.mapping.get(substitution.schema)![substitution.alias] = newAlias;\n }\n }\n\n public validate(): boolean {\n this.errors = [];\n this.suggestions = [];\n this.calculateSuggestions();\n if (this.substitutions.length === 0) {\n return true;\n }\n if (!this.checkTypes()) {\n return false;\n }\n if (!this.checkCycles()) {\n return false;\n }\n if (!this.checkSubstitutions()) {\n return false;\n }\n return true;\n }\n\n private calculateSuggestions(): void {\n const candidates = new Map<number, string>();\n const minors = new Set<number>();\n const schemaByCst = new Map<number, RSForm>();\n for (const schema of this.schemas) {\n for (const cst of schema.items) {\n if (this.originals.has(cst.id)) {\n continue;\n }\n if (cst.cst_class === CstClass.BASIC || cst.definition_formal.length === 0) {\n continue;\n }\n const inputs = schema.graph.at(cst.id)!.inputs;\n if (inputs.some(id => !this.constituents.has(id))) {\n continue;\n }\n if (inputs.some(id => this.originals.has(id))) {\n minors.add(cst.id);\n }\n candidates.set(\n cst.id,\n applyAliasMapping(cst.definition_formal, this.mapping.get(schema.id)!).replace(/\\s+/g, '')\n );\n schemaByCst.set(cst.id, schema);\n }\n }\n for (const [key1, value1] of candidates) {\n for (const [key2, value2] of candidates) {\n if (key1 >= key2) {\n continue;\n }\n if (schemaByCst.get(key1) === schemaByCst.get(key2)) {\n continue;\n }\n if (value1 != value2) {\n continue;\n }\n if (minors.has(key2)) {\n this.suggestions.push({\n original: key2,\n substitution: key1\n });\n } else {\n this.suggestions.push({\n original: key1,\n substitution: key2\n });\n }\n }\n }\n }\n\n private checkTypes(): boolean {\n for (const item of this.substitutions) {\n const original = this.cstByID.get(item.original);\n const substitution = this.cstByID.get(item.substitution);\n if (!original || !substitution) {\n return this.reportError(SubstitutionErrorType.invalidIDs, []);\n }\n if (\n substitution.analysis &&\n original.analysis &&\n (!original.analysis.success || !substitution.analysis.success)\n ) {\n return this.reportError(SubstitutionErrorType.incorrectCst, [substitution.alias, original.alias]);\n }\n switch (substitution.cst_type) {\n case CstType.NOMINAL: {\n if (original.cst_type !== CstType.NOMINAL) {\n return this.reportError(SubstitutionErrorType.invalidNominal, [substitution.alias, original.alias]);\n }\n break;\n }\n case CstType.BASE: {\n if (\n original.cst_type !== CstType.BASE &&\n original.cst_type !== CstType.CONSTANT &&\n original.cst_type !== CstType.NOMINAL\n ) {\n return this.reportError(SubstitutionErrorType.invalidBasic, [substitution.alias, original.alias]);\n }\n break;\n }\n\n case CstType.CONSTANT: {\n if (original.cst_type !== CstType.CONSTANT) {\n return this.reportError(SubstitutionErrorType.invalidConstant, [substitution.alias, original.alias]);\n }\n break;\n }\n\n case CstType.AXIOM:\n case CstType.STATEMENT: {\n if (original.cst_type !== CstType.AXIOM && original.cst_type !== CstType.STATEMENT) {\n return this.reportError(SubstitutionErrorType.invalidClasses, [substitution.alias, original.alias]);\n }\n break;\n }\n\n case CstType.FUNCTION: {\n if (original.cst_type !== CstType.FUNCTION) {\n return this.reportError(SubstitutionErrorType.invalidClasses, [substitution.alias, original.alias]);\n }\n break;\n }\n case CstType.PREDICATE: {\n if (original.cst_type !== CstType.PREDICATE) {\n return this.reportError(SubstitutionErrorType.invalidClasses, [substitution.alias, original.alias]);\n }\n break;\n }\n\n case CstType.TERM:\n case CstType.STRUCTURED: {\n if (\n original.cst_type !== CstType.TERM &&\n original.cst_type !== CstType.STRUCTURED &&\n original.cst_type !== CstType.BASE\n ) {\n return this.reportError(SubstitutionErrorType.invalidClasses, [substitution.alias, original.alias]);\n }\n break;\n }\n }\n }\n return true;\n }\n\n private checkCycles(): boolean {\n const graph = new Graph();\n for (const schema of this.schemas) {\n for (const cst of schema.items) {\n if (cst.cst_type === CstType.BASE || cst.cst_type === CstType.CONSTANT) {\n graph.addNode(cst.id);\n }\n }\n }\n for (const item of this.substitutions) {\n const original = this.cstByID.get(item.original)!;\n const substitution = this.cstByID.get(item.substitution)!;\n for (const cst of [original, substitution]) {\n if (cst.cst_type === CstType.BASE || cst.cst_type === CstType.CONSTANT) {\n continue;\n }\n graph.addNode(cst.id);\n if (cst.effectiveType === null) {\n continue;\n }\n const parents = extractBases(cst.effectiveType);\n if (parents.size === 0) {\n continue;\n }\n const schema = this.schemaByID.get(cst.schema)!;\n for (const alias of parents) {\n const parent = schema.cstByAlias.get(alias);\n if (parent) {\n graph.addEdge(parent.id, cst.id);\n }\n }\n }\n graph.addEdge(substitution.id, original.id);\n }\n const cycle = graph.findCycle();\n if (cycle !== null) {\n const cycleMsg = cycle\n .map(id => {\n const cst = this.cstByID.get(id)!;\n const schema = this.schemaByID.get(cst.schema)!;\n return `[${schema.alias}]-${cst.alias}`;\n })\n .join(', ');\n return this.reportError(SubstitutionErrorType.typificationCycle, [cycleMsg]);\n }\n return true;\n }\n\n private checkSubstitutions(): boolean {\n const baseMappings = this.prepareBaseMappings();\n const typeMappings = this.calculateSubstituteMappings(baseMappings);\n if (typeMappings === null) {\n return false;\n }\n for (const item of this.substitutions) {\n const original = this.cstByID.get(item.original)!;\n if (\n original.cst_type === CstType.BASE ||\n original.cst_type === CstType.CONSTANT ||\n original.cst_type === CstType.NOMINAL\n ) {\n continue;\n }\n const substitution = this.cstByID.get(item.substitution)!;\n if (original.cst_type === substitution.cst_type && original.cst_class !== CstClass.BASIC) {\n if (!this.checkEqual(original, substitution)) {\n this.reportError(SubstitutionErrorType.unequalExpressions, [substitution.alias, original.alias]);\n // Note: do not interrupt the validation process. Only warn about the problem.\n }\n }\n\n if (original.analysis.success !== substitution.analysis.success) {\n return this.reportError(SubstitutionErrorType.unequalTypification, [substitution.alias, original.alias]);\n }\n if (!original.analysis.success || !substitution.analysis.success) {\n continue;\n }\n\n const originalType = applyTypificationMapping(\n applyAliasMapping(labelType(original.effectiveType), baseMappings.get(original.schema)!),\n typeMappings\n );\n const substitutionType = applyTypificationMapping(\n applyAliasMapping(labelType(substitution.effectiveType), baseMappings.get(substitution.schema)!),\n typeMappings\n );\n if (originalType !== substitutionType) {\n return this.reportError(SubstitutionErrorType.unequalTypification, [substitution.alias, original.alias]);\n }\n }\n return true;\n }\n\n private prepareBaseMappings(): CrossMapping {\n const result: CrossMapping = new Map();\n let baseCount = 0;\n let constCount = 0;\n for (const schema of this.schemas) {\n const mapping: AliasMapping = {};\n for (const cst of schema.items) {\n if (cst.cst_type === CstType.BASE) {\n baseCount++;\n mapping[cst.alias] = `X${baseCount}`;\n } else if (cst.cst_type === CstType.CONSTANT) {\n constCount++;\n mapping[cst.alias] = `C${constCount}`;\n }\n result.set(schema.id, mapping);\n }\n }\n return result;\n }\n\n private calculateSubstituteMappings(baseMappings: CrossMapping): AliasMapping | null {\n const result: AliasMapping = {};\n const processed = new Set<string>();\n for (const item of this.substitutions) {\n const original = this.cstByID.get(item.original)!;\n if (original.cst_type !== CstType.BASE && original.cst_type !== CstType.CONSTANT) {\n continue;\n }\n const originalAlias = baseMappings.get(original.schema)![original.alias];\n\n const substitution = this.cstByID.get(item.substitution)!;\n let substitutionText = '';\n if (substitution.cst_type === original.cst_type || !substitution.effectiveType) {\n substitutionText = baseMappings.get(substitution.schema)![substitution.alias];\n } else {\n const typeText = labelType(substitution.effectiveType);\n substitutionText = applyAliasMapping(typeText, baseMappings.get(substitution.schema)!);\n substitutionText = applyTypificationMapping(substitutionText, result);\n if (!isSetTypification(substitutionText)) {\n this.reportError(SubstitutionErrorType.baseSubstitutionNotSet, [substitution.alias, typeText]);\n return null;\n }\n if (substitutionText.includes('×') || substitutionText.startsWith('ℬℬ')) {\n substitutionText = substitutionText.slice(1);\n } else {\n substitutionText = substitutionText.slice(2, -1);\n }\n }\n for (const prevAlias of processed) {\n result[prevAlias] = applyTypificationMapping(result[prevAlias], { [originalAlias]: substitutionText });\n }\n result[originalAlias] = substitutionText;\n processed.add(originalAlias);\n }\n return result;\n }\n\n private checkEqual(\n left: FormalOrderFields & { schema: number },\n right: FormalOrderFields & { schema: number }\n ): boolean {\n const schema1 = this.schemaByID.get(left.schema)!;\n const inputs1 = schema1.graph.at(left.id)!.inputs;\n if (inputs1.some(id => !this.constituents.has(id))) {\n return false;\n }\n const schema2 = this.schemaByID.get(right.schema)!;\n const inputs2 = schema2.graph.at(right.id)!.inputs;\n if (inputs2.some(id => !this.constituents.has(id))) {\n return false;\n }\n const expression1 = applyAliasMapping(left.definition_formal, this.mapping.get(schema1.id)!);\n const expression2 = applyAliasMapping(right.definition_formal, this.mapping.get(schema2.id)!);\n return expression1.replace(/\\s+/g, '') === expression2.replace(/\\s+/g, '');\n }\n\n private reportError(errorType: SubstitutionErrorType, params: string[]): boolean {\n this.errors.push({\n errorType: errorType,\n params: params\n });\n return false;\n }\n}\n\n/** Filter relocate candidates from gives schema. */\nexport function getRelocateCandidates(\n source: number,\n destination: number,\n schema: RSForm,\n oss: OperationSchema\n): Constituenta[] {\n const destinationSchema = oss.operationByID.get(destination)?.result;\n if (!destinationSchema) {\n return [];\n }\n const node = oss.graph.at(source);\n if (!node) {\n return [];\n }\n\n if (node.outputs.includes(destination)) {\n return schema.items;\n }\n\n const addedCst = schema.items.filter(item => !item.is_inherited).map(cst => cst.id);\n\n const unreachableBases: number[] = [];\n for (const cst of schema.items.filter(item => item.is_inherited)) {\n if (cst.parent_schema == destinationSchema) {\n continue;\n }\n const parent = schema.inheritance.find(item => item.child === cst.id && item.child_source === cst.schema)?.parent;\n if (parent) {\n const original = oss.substitutions.find(sub => sub.substitution === parent)?.original;\n if (original) {\n continue;\n }\n }\n unreachableBases.push(cst.id);\n }\n const unreachable = schema.graph.expandAllOutputs(unreachableBases);\n return schema.items.filter(\n cst => cst.parent_schema === destinationSchema || (addedCst.includes(cst.id) && !unreachable.includes(cst.id))\n );\n}\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,qBAAqB;AAE3B,SAAgB,gBAAgB,MAAgB,QAAwB;CACtE,OAAO,SAAS,SAAS,YAAY,MAAM,OAAO,MAAM,IAAI,MAAM,OAAO,MAAM;AACjF;;AAGA,SAAgB,gBAAgB,KAAsB,OAA8C;CAClG,MAAM,SAAS,MAAM,QAAO,SAAQ,KAAK,aAAa,IAAI,QAAQ;CAClE,KAAK,MAAM,QAAQ,OACjB,IAAI,KAAK,WAAW,KAAK,UAAU,IAAI,SAAS,CAAC,OAAO,SAAS,IA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,MAAM;CAChC,IAAI,CAAC,MACH,OAAO,CAAC;CAGV,IAAI,KAAK,QAAQ,SAAS,WAAW,GACnC,OAAO,OAAO;CAGhB,MAAM,WAAW,OAAO,MAAM,QAAO,SAAQ,CAAC,KAAK,YAAY,CAAC,CAAC,KAAI,QAAO,IAAI,EAAE;CAElF,MAAM,mBAA6B,CAAC;CACpC,KAAK,MAAM,OAAO,OAAO,MAAM,QAAO,SAAQ,KAAK,YAAY,GAAG;EAChE,IAAI,IAAI,iBAAiB,mBACvB;EAEF,MAAM,SAAS,OAAO,YAAY,MAAK,SAAQ,KAAK,UAAU,IAAI,MAAM,KAAK,iBAAiB,IAAI,MAAM,CAAC,EAAE;EAC3G,IAAI,QAEF;OADiB,IAAI,cAAc,MAAK,QAAO,IAAI,iBAAiB,MAAM,CAAC,EAAE,UAE3E;EACF;EAEF,iBAAiB,KAAK,IAAI,EAAE;CAC9B;CACA,MAAM,cAAc,OAAO,MAAM,iBAAiB,gBAAgB;CAClE,OAAO,OAAO,MAAM,QAClB,QAAO,IAAI,kBAAkB,qBAAsB,SAAS,SAAS,IAAI,EAAE,KAAK,CAAC,YAAY,SAAS,IAAI,EAAE,CAC9G;AACF"}
|
|
1
|
+
{"version":3,"file":"oss-api.js","names":[],"sources":["../../src/library/oss-api.ts"],"sourcesContent":["/**\n * Module: API for OperationSystem.\n */\n\nimport { Graph } from '../graph';\nimport { type AliasMapping, applyAliasMapping, applyTypificationMapping, isSetTypification } from '../rslang/api';\nimport { labelType } from '../rslang/labels';\nimport { extractBases } from '../rslang/semantic/typification-api';\n\nimport { formatDependencyCycle } from './diagnostics';\nimport { type LibraryItem } from './library';\nimport { NodeType, type OperationSchema, type SubstitutionErrorDescription, SubstitutionErrorType } from './oss';\nimport { type Constituenta, CstClass, CstType, type RSForm, type Substitution } from './rsform';\nimport { type FormalOrderFields } from './rsform-api';\n\nconst STARTING_SUB_INDEX = 900; // max semantic index for starting substitution\n\nexport function constructNodeID(type: NodeType, itemID: number): string {\n return type === NodeType.OPERATION ? 'o' + String(itemID) : 'b' + String(itemID);\n}\n\n/** Sorts library items relevant for the specified {@link OperationSchema}. */\nexport function sortItemsForOSS(oss: OperationSchema, items: readonly LibraryItem[]): LibraryItem[] {\n const result = items.filter(item => item.location === oss.location);\n for (const item of items) {\n if (item.visible && item.owner === oss.owner && !result.includes(item)) {\n result.push(item);\n }\n }\n for (const item of items) {\n if (item.visible && !result.includes(item)) {\n result.push(item);\n }\n }\n for (const item of items) {\n if (!result.includes(item)) {\n result.push(item);\n }\n }\n return result;\n}\n\ntype CrossMapping = Map<number, AliasMapping>;\n\n/** Validator for Substitution table. */\nexport class SubstitutionValidator {\n public errors: SubstitutionErrorDescription[] = [];\n public suggestions: Substitution[] = [];\n\n private schemas: RSForm[];\n private substitutions: Substitution[];\n private constituents = new Set<number>();\n private originals = new Set<number>();\n private mapping: CrossMapping = new Map();\n\n private cstByID = new Map<number, Constituenta>();\n private schemaByID = new Map<number, RSForm>();\n private schemaByCst = new Map<number, RSForm>();\n\n constructor(schemas: RSForm[], substitutions: Substitution[]) {\n this.schemas = schemas;\n this.substitutions = substitutions;\n if (schemas.length === 0) {\n return;\n }\n\n for (const schema of schemas) {\n this.schemaByID.set(schema.id, schema);\n this.mapping.set(schema.id, {});\n for (const item of schema.items) {\n this.cstByID.set(item.id, item);\n this.schemaByCst.set(item.id, schema);\n }\n }\n if (substitutions.length === 0) {\n return;\n }\n let index = STARTING_SUB_INDEX;\n for (const item of substitutions) {\n this.constituents.add(item.original);\n this.constituents.add(item.substitution);\n this.originals.add(item.original);\n const original = this.cstByID.get(item.original);\n const substitution = this.cstByID.get(item.substitution);\n if (!original || !substitution) {\n return;\n }\n index++;\n const newAlias = `${substitution.alias[0]}${index}`;\n this.mapping.get(original.schema)![original.alias] = newAlias;\n this.mapping.get(substitution.schema)![substitution.alias] = newAlias;\n }\n }\n\n public validate(): boolean {\n this.errors = [];\n this.suggestions = [];\n this.calculateSuggestions();\n if (this.substitutions.length === 0) {\n return true;\n }\n if (!this.checkTypes()) {\n return false;\n }\n if (!this.checkTypificationCycles()) {\n return false;\n }\n if (!this.checkDefinitionCycles()) {\n return false;\n }\n if (!this.checkSubstitutions()) {\n return false;\n }\n return true;\n }\n\n private calculateSuggestions(): void {\n const candidates = new Map<number, string>();\n const minors = new Set<number>();\n const schemaByCst = new Map<number, RSForm>();\n for (const schema of this.schemas) {\n for (const cst of schema.items) {\n if (this.originals.has(cst.id)) {\n continue;\n }\n if (cst.cst_class === CstClass.BASIC || cst.definition_formal.length === 0) {\n continue;\n }\n const inputs = schema.graph.at(cst.id)!.inputs;\n if (inputs.some(id => !this.constituents.has(id))) {\n continue;\n }\n if (inputs.some(id => this.originals.has(id))) {\n minors.add(cst.id);\n }\n candidates.set(\n cst.id,\n applyAliasMapping(cst.definition_formal, this.mapping.get(schema.id)!).replace(/\\s+/g, '')\n );\n schemaByCst.set(cst.id, schema);\n }\n }\n for (const [key1, value1] of candidates) {\n for (const [key2, value2] of candidates) {\n if (key1 >= key2) {\n continue;\n }\n if (schemaByCst.get(key1) === schemaByCst.get(key2)) {\n continue;\n }\n if (value1 != value2) {\n continue;\n }\n if (minors.has(key2)) {\n this.suggestions.push({\n original: key2,\n substitution: key1\n });\n } else {\n this.suggestions.push({\n original: key1,\n substitution: key2\n });\n }\n }\n }\n }\n\n private checkTypes(): boolean {\n for (const item of this.substitutions) {\n const original = this.cstByID.get(item.original);\n const substitution = this.cstByID.get(item.substitution);\n if (!original || !substitution) {\n return this.reportError(SubstitutionErrorType.invalidIDs, []);\n }\n if (\n substitution.analysis &&\n original.analysis &&\n (!original.analysis.success || !substitution.analysis.success)\n ) {\n return this.reportError(SubstitutionErrorType.incorrectCst, [substitution.alias, original.alias]);\n }\n switch (substitution.cst_type) {\n case CstType.NOMINAL: {\n if (original.cst_type !== CstType.NOMINAL) {\n return this.reportError(SubstitutionErrorType.invalidNominal, [substitution.alias, original.alias]);\n }\n break;\n }\n case CstType.BASE: {\n if (\n original.cst_type !== CstType.BASE &&\n original.cst_type !== CstType.CONSTANT &&\n original.cst_type !== CstType.NOMINAL\n ) {\n return this.reportError(SubstitutionErrorType.invalidBasic, [substitution.alias, original.alias]);\n }\n break;\n }\n\n case CstType.CONSTANT: {\n if (original.cst_type !== CstType.CONSTANT) {\n return this.reportError(SubstitutionErrorType.invalidConstant, [substitution.alias, original.alias]);\n }\n break;\n }\n\n case CstType.AXIOM:\n case CstType.STATEMENT: {\n if (original.cst_type !== CstType.AXIOM && original.cst_type !== CstType.STATEMENT) {\n return this.reportError(SubstitutionErrorType.invalidClasses, [substitution.alias, original.alias]);\n }\n break;\n }\n\n case CstType.FUNCTION: {\n if (original.cst_type !== CstType.FUNCTION) {\n return this.reportError(SubstitutionErrorType.invalidClasses, [substitution.alias, original.alias]);\n }\n break;\n }\n case CstType.PREDICATE: {\n if (original.cst_type !== CstType.PREDICATE) {\n return this.reportError(SubstitutionErrorType.invalidClasses, [substitution.alias, original.alias]);\n }\n break;\n }\n\n case CstType.TERM:\n case CstType.STRUCTURED: {\n if (\n original.cst_type !== CstType.TERM &&\n original.cst_type !== CstType.STRUCTURED &&\n original.cst_type !== CstType.BASE\n ) {\n return this.reportError(SubstitutionErrorType.invalidClasses, [substitution.alias, original.alias]);\n }\n break;\n }\n }\n }\n return true;\n }\n\n /**\n * Detect cycles among base/constant sets implied by typifications of non-base\n * constituents under the substitution table.\n */\n private checkTypificationCycles(): boolean {\n const graph = new Graph();\n for (const schema of this.schemas) {\n for (const cst of schema.items) {\n if (cst.cst_type === CstType.BASE || cst.cst_type === CstType.CONSTANT) {\n graph.addNode(cst.id);\n }\n }\n }\n for (const item of this.substitutions) {\n const original = this.cstByID.get(item.original)!;\n const substitution = this.cstByID.get(item.substitution)!;\n for (const cst of [original, substitution]) {\n if (cst.cst_type === CstType.BASE || cst.cst_type === CstType.CONSTANT) {\n continue;\n }\n graph.addNode(cst.id);\n if (cst.effectiveType === null) {\n continue;\n }\n const parents = extractBases(cst.effectiveType);\n if (parents.size === 0) {\n continue;\n }\n const schema = this.schemaByID.get(cst.schema)!;\n for (const alias of parents) {\n const parent = schema.cstByAlias.get(alias);\n if (parent) {\n graph.addEdge(parent.id, cst.id);\n }\n }\n }\n graph.addEdge(substitution.id, original.id);\n }\n const cycle = graph.findCycle();\n if (cycle !== null) {\n const cycleMsg = cycle\n .map(id => {\n const cst = this.cstByID.get(id)!;\n const schema = this.schemaByID.get(cst.schema)!;\n return `[${schema.alias}]-${cst.alias}`;\n })\n .join(', ');\n return this.reportError(SubstitutionErrorType.typificationCycle, [cycleMsg]);\n }\n return true;\n }\n\n /**\n * Detect logical cycles in formal definitions after applying the substitution table\n * (e.g. D16 := F2[D15] with identification D15 → D16 yields D16 := F2[D16]).\n */\n private checkDefinitionCycles(): boolean {\n const graph = new Graph();\n for (const schema of this.schemas) {\n for (const [id, node] of schema.graph.nodes) {\n graph.addNode(id);\n for (const output of node.outputs) {\n graph.addEdge(id, output);\n }\n }\n }\n\n const deleted = new Map<number, number>();\n for (const item of this.substitutions) {\n deleted.set(item.original, item.substitution);\n }\n const resolve = (id: number): number => deleted.get(id) ?? id;\n\n const result = new Graph();\n for (const id of graph.nodes.keys()) {\n if (!deleted.has(id)) {\n result.addNode(id);\n }\n }\n for (const substitutionId of deleted.values()) {\n result.addNode(substitutionId);\n }\n\n for (const [id, node] of graph.nodes) {\n for (const output of node.outputs) {\n if (deleted.has(output)) {\n continue;\n }\n result.addEdge(resolve(id), output);\n }\n }\n\n const cycle = result.findCycle();\n if (cycle !== null) {\n const aliases = cycle.map(id => {\n const cst = this.cstByID.get(id);\n if (!cst) {\n return String(id);\n }\n if (this.schemas.length > 1) {\n const schema = this.schemaByID.get(cst.schema);\n return schema ? `[${schema.alias}]-${cst.alias}` : cst.alias;\n }\n return cst.alias;\n });\n return this.reportError(SubstitutionErrorType.definitionCycle, [formatDependencyCycle(aliases)]);\n }\n return true;\n }\n\n private checkSubstitutions(): boolean {\n const baseMappings = this.prepareBaseMappings();\n const typeMappings = this.calculateSubstituteMappings(baseMappings);\n if (typeMappings === null) {\n return false;\n }\n for (const item of this.substitutions) {\n const original = this.cstByID.get(item.original)!;\n if (\n original.cst_type === CstType.BASE ||\n original.cst_type === CstType.CONSTANT ||\n original.cst_type === CstType.NOMINAL\n ) {\n continue;\n }\n const substitution = this.cstByID.get(item.substitution)!;\n if (original.cst_type === substitution.cst_type && original.cst_class !== CstClass.BASIC) {\n if (!this.checkEqual(original, substitution)) {\n this.reportError(SubstitutionErrorType.unequalExpressions, [substitution.alias, original.alias]);\n // Note: do not interrupt the validation process. Only warn about the problem.\n }\n }\n\n if (original.analysis.success !== substitution.analysis.success) {\n return this.reportError(SubstitutionErrorType.unequalTypification, [substitution.alias, original.alias]);\n }\n if (!original.analysis.success || !substitution.analysis.success) {\n continue;\n }\n\n const originalType = applyTypificationMapping(\n applyAliasMapping(labelType(original.effectiveType), baseMappings.get(original.schema)!),\n typeMappings\n );\n const substitutionType = applyTypificationMapping(\n applyAliasMapping(labelType(substitution.effectiveType), baseMappings.get(substitution.schema)!),\n typeMappings\n );\n if (originalType !== substitutionType) {\n return this.reportError(SubstitutionErrorType.unequalTypification, [substitution.alias, original.alias]);\n }\n }\n return true;\n }\n\n private prepareBaseMappings(): CrossMapping {\n const result: CrossMapping = new Map();\n let baseCount = 0;\n let constCount = 0;\n for (const schema of this.schemas) {\n const mapping: AliasMapping = {};\n for (const cst of schema.items) {\n if (cst.cst_type === CstType.BASE) {\n baseCount++;\n mapping[cst.alias] = `X${baseCount}`;\n } else if (cst.cst_type === CstType.CONSTANT) {\n constCount++;\n mapping[cst.alias] = `C${constCount}`;\n }\n result.set(schema.id, mapping);\n }\n }\n return result;\n }\n\n private calculateSubstituteMappings(baseMappings: CrossMapping): AliasMapping | null {\n const result: AliasMapping = {};\n const processed = new Set<string>();\n for (const item of this.substitutions) {\n const original = this.cstByID.get(item.original)!;\n if (original.cst_type !== CstType.BASE && original.cst_type !== CstType.CONSTANT) {\n continue;\n }\n const originalAlias = baseMappings.get(original.schema)![original.alias];\n\n const substitution = this.cstByID.get(item.substitution)!;\n let substitutionText = '';\n if (substitution.cst_type === original.cst_type || !substitution.effectiveType) {\n substitutionText = baseMappings.get(substitution.schema)![substitution.alias];\n } else {\n const typeText = labelType(substitution.effectiveType);\n substitutionText = applyAliasMapping(typeText, baseMappings.get(substitution.schema)!);\n substitutionText = applyTypificationMapping(substitutionText, result);\n if (!isSetTypification(substitutionText)) {\n this.reportError(SubstitutionErrorType.baseSubstitutionNotSet, [substitution.alias, typeText]);\n return null;\n }\n if (substitutionText.includes('×') || substitutionText.startsWith('ℬℬ')) {\n substitutionText = substitutionText.slice(1);\n } else {\n substitutionText = substitutionText.slice(2, -1);\n }\n }\n for (const prevAlias of processed) {\n result[prevAlias] = applyTypificationMapping(result[prevAlias], { [originalAlias]: substitutionText });\n }\n result[originalAlias] = substitutionText;\n processed.add(originalAlias);\n }\n return result;\n }\n\n private checkEqual(\n left: FormalOrderFields & { schema: number },\n right: FormalOrderFields & { schema: number }\n ): boolean {\n const schema1 = this.schemaByID.get(left.schema)!;\n const inputs1 = schema1.graph.at(left.id)!.inputs;\n if (inputs1.some(id => !this.constituents.has(id))) {\n return false;\n }\n const schema2 = this.schemaByID.get(right.schema)!;\n const inputs2 = schema2.graph.at(right.id)!.inputs;\n if (inputs2.some(id => !this.constituents.has(id))) {\n return false;\n }\n const expression1 = applyAliasMapping(left.definition_formal, this.mapping.get(schema1.id)!);\n const expression2 = applyAliasMapping(right.definition_formal, this.mapping.get(schema2.id)!);\n return expression1.replace(/\\s+/g, '') === expression2.replace(/\\s+/g, '');\n }\n\n private reportError(code: SubstitutionErrorType, params: string[]): boolean {\n this.errors.push({\n code,\n params\n });\n return false;\n }\n}\n\n/** Filter relocate candidates from gives schema. */\nexport function getRelocateCandidates(\n source: number,\n destination: number,\n schema: RSForm,\n oss: OperationSchema\n): Constituenta[] {\n const destinationSchema = oss.operationByID.get(destination)?.result;\n if (!destinationSchema) {\n return [];\n }\n const node = oss.graph.at(source);\n if (!node) {\n return [];\n }\n\n if (node.outputs.includes(destination)) {\n return schema.items;\n }\n\n const addedCst = schema.items.filter(item => !item.is_inherited).map(cst => cst.id);\n\n const unreachableBases: number[] = [];\n for (const cst of schema.items.filter(item => item.is_inherited)) {\n if (cst.parent_schema == destinationSchema) {\n continue;\n }\n const parent = schema.inheritance.find(item => item.child === cst.id && item.child_source === cst.schema)?.parent;\n if (parent) {\n const original = oss.substitutions.find(sub => sub.substitution === parent)?.original;\n if (original) {\n continue;\n }\n }\n unreachableBases.push(cst.id);\n }\n const unreachable = schema.graph.expandAllOutputs(unreachableBases);\n return schema.items.filter(\n cst => cst.parent_schema === destinationSchema || (addedCst.includes(cst.id) && !unreachable.includes(cst.id))\n );\n}\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,qBAAqB;AAE3B,SAAgB,gBAAgB,MAAgB,QAAwB;CACtE,OAAO,SAAS,SAAS,YAAY,MAAM,OAAO,MAAM,IAAI,MAAM,OAAO,MAAM;AACjF;;AAGA,SAAgB,gBAAgB,KAAsB,OAA8C;CAClG,MAAM,SAAS,MAAM,QAAO,SAAQ,KAAK,aAAa,IAAI,QAAQ;CAClE,KAAK,MAAM,QAAQ,OACjB,IAAI,KAAK,WAAW,KAAK,UAAU,IAAI,SAAS,CAAC,OAAO,SAAS,IAAI,GACnE,OAAO,KAAK,IAAI;CAGpB,KAAK,MAAM,QAAQ,OACjB,IAAI,KAAK,WAAW,CAAC,OAAO,SAAS,IAAI,GACvC,OAAO,KAAK,IAAI;CAGpB,KAAK,MAAM,QAAQ,OACjB,IAAI,CAAC,OAAO,SAAS,IAAI,GACvB,OAAO,KAAK,IAAI;CAGpB,OAAO;AACT;;AAKA,IAAa,wBAAb,MAAmC;CACjC,SAAgD,CAAC;CACjD,cAAqC,CAAC;CAEtC;CACA;CACA,+BAAuB,IAAI,IAAY;CACvC,4BAAoB,IAAI,IAAY;CACpC,0BAAgC,IAAI,IAAI;CAExC,0BAAkB,IAAI,IAA0B;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AI,MAAM,KAAK,iBAAiB,IAAI,MAAM,CAAC,EAAE;EAC3G,IAAI,QAEF;OADiB,IAAI,cAAc,MAAK,QAAO,IAAI,iBAAiB,MAAM,CAAC,EAAE,UAE3E;EACF;EAEF,iBAAiB,KAAK,IAAI,EAAE;CAC9B;CACA,MAAM,cAAc,OAAO,MAAM,iBAAiB,gBAAgB;CAClE,OAAO,OAAO,MAAM,QAClB,QAAO,IAAI,kBAAkB,qBAAsB,SAAS,SAAS,IAAI,EAAE,KAAK,CAAC,YAAY,SAAS,IAAI,EAAE,CAC9G;AACF"}
|
package/dist/library/oss.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as Graph } from "../graph-CL73WdW1.js";
|
|
2
|
+
import "../index-DntDUXW1.js";
|
|
2
3
|
import { r as LibraryItem } from "../library-CYun28Xz.js";
|
|
3
4
|
import { n as OssLayout, t as NodePosition } from "../oss-layout-3glgAqfn.js";
|
|
4
|
-
|
|
5
5
|
//#region src/library/oss.d.ts
|
|
6
6
|
/** Represents OSS node type. */
|
|
7
7
|
declare const NodeType: {
|
|
@@ -108,25 +108,30 @@ interface OperationSchema extends LibraryItem {
|
|
|
108
108
|
blockByID: Map<number, Block>;
|
|
109
109
|
itemByNodeID: Map<string, OssItem>;
|
|
110
110
|
}
|
|
111
|
-
/** Represents substitution error description. */
|
|
111
|
+
/** Represents substitution error description (same code space as {@link RSDiagnosticCode}). */
|
|
112
112
|
interface SubstitutionErrorDescription {
|
|
113
|
-
|
|
113
|
+
code: SubstitutionErrorType;
|
|
114
114
|
params: string[];
|
|
115
115
|
}
|
|
116
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Substitution-table error codes — aliases into {@link RSDiagnosticCode}.
|
|
118
|
+
* Logical definition cycles reuse {@link RSDiagnosticCode.schemaDependencyCycle}.
|
|
119
|
+
*/
|
|
117
120
|
declare const SubstitutionErrorType: {
|
|
118
|
-
readonly invalidIDs:
|
|
119
|
-
readonly incorrectCst:
|
|
120
|
-
readonly invalidClasses:
|
|
121
|
-
readonly invalidBasic:
|
|
122
|
-
readonly invalidConstant:
|
|
123
|
-
readonly typificationCycle:
|
|
124
|
-
readonly baseSubstitutionNotSet:
|
|
125
|
-
readonly unequalTypification:
|
|
126
|
-
readonly unequalExpressions:
|
|
127
|
-
readonly unequalArgsCount:
|
|
128
|
-
readonly unequalArgs:
|
|
129
|
-
readonly invalidNominal:
|
|
121
|
+
readonly invalidIDs: 35104;
|
|
122
|
+
readonly incorrectCst: 35105;
|
|
123
|
+
readonly invalidClasses: 35106;
|
|
124
|
+
readonly invalidBasic: 35107;
|
|
125
|
+
readonly invalidConstant: 35108;
|
|
126
|
+
readonly typificationCycle: 35109;
|
|
127
|
+
readonly baseSubstitutionNotSet: 35110;
|
|
128
|
+
readonly unequalTypification: 35111;
|
|
129
|
+
readonly unequalExpressions: 10536;
|
|
130
|
+
readonly unequalArgsCount: 35113;
|
|
131
|
+
readonly unequalArgs: 35114;
|
|
132
|
+
readonly invalidNominal: 35115;
|
|
133
|
+
/** Same code as constituent schema dependency cycle. */
|
|
134
|
+
readonly definitionCycle: 35078;
|
|
130
135
|
};
|
|
131
136
|
type SubstitutionErrorType = (typeof SubstitutionErrorType)[keyof typeof SubstitutionErrorType];
|
|
132
137
|
//#endregion
|
package/dist/library/oss.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as RSDiagnosticCode } from "../diagnostics-D1Cp21nP.js";
|
|
1
2
|
//#region src/library/oss.ts
|
|
2
3
|
/** Represents OSS node type. */
|
|
3
4
|
const NodeType = {
|
|
@@ -10,20 +11,25 @@ const OperationType = {
|
|
|
10
11
|
SYNTHESIS: "synthesis",
|
|
11
12
|
REPLICA: "replica"
|
|
12
13
|
};
|
|
13
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Substitution-table error codes — aliases into {@link RSDiagnosticCode}.
|
|
16
|
+
* Logical definition cycles reuse {@link RSDiagnosticCode.schemaDependencyCycle}.
|
|
17
|
+
*/
|
|
14
18
|
const SubstitutionErrorType = {
|
|
15
|
-
invalidIDs:
|
|
16
|
-
incorrectCst:
|
|
17
|
-
invalidClasses:
|
|
18
|
-
invalidBasic:
|
|
19
|
-
invalidConstant:
|
|
20
|
-
typificationCycle:
|
|
21
|
-
baseSubstitutionNotSet:
|
|
22
|
-
unequalTypification:
|
|
23
|
-
unequalExpressions:
|
|
24
|
-
unequalArgsCount:
|
|
25
|
-
unequalArgs:
|
|
26
|
-
invalidNominal:
|
|
19
|
+
invalidIDs: RSDiagnosticCode.substitutionInvalidIDs,
|
|
20
|
+
incorrectCst: RSDiagnosticCode.substitutionIncorrectCst,
|
|
21
|
+
invalidClasses: RSDiagnosticCode.substitutionInvalidClasses,
|
|
22
|
+
invalidBasic: RSDiagnosticCode.substitutionInvalidBasic,
|
|
23
|
+
invalidConstant: RSDiagnosticCode.substitutionInvalidConstant,
|
|
24
|
+
typificationCycle: RSDiagnosticCode.substitutionTypificationCycle,
|
|
25
|
+
baseSubstitutionNotSet: RSDiagnosticCode.substitutionBaseNotSet,
|
|
26
|
+
unequalTypification: RSDiagnosticCode.substitutionUnequalTypification,
|
|
27
|
+
unequalExpressions: RSDiagnosticCode.substitutionUnequalExpressions,
|
|
28
|
+
unequalArgsCount: RSDiagnosticCode.substitutionUnequalArgsCount,
|
|
29
|
+
unequalArgs: RSDiagnosticCode.substitutionUnequalArgs,
|
|
30
|
+
invalidNominal: RSDiagnosticCode.substitutionInvalidNominal,
|
|
31
|
+
/** Same code as constituent schema dependency cycle. */
|
|
32
|
+
definitionCycle: RSDiagnosticCode.schemaDependencyCycle
|
|
27
33
|
};
|
|
28
34
|
//#endregion
|
|
29
35
|
export { NodeType, OperationType, SubstitutionErrorType };
|
package/dist/library/oss.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oss.js","names":[],"sources":["../../src/library/oss.ts"],"sourcesContent":["/**\n * Module: Schema of Synthesis Operations.\n */\n\nimport { type Graph } from '../graph';\n\nimport { type LibraryItem } from './library';\nimport { type NodePosition, type OssLayout } from './oss-layout';\n\n/** Represents OSS node type. */\nexport const NodeType = {\n OPERATION: 1,\n BLOCK: 2\n} as const;\nexport type NodeType = (typeof NodeType)[keyof typeof NodeType];\n\n/** Represents OSS graph node. */\ninterface OssNode extends NodePosition {\n nodeType: NodeType;\n parent: number | null;\n}\n\n/** Represents {@link Operation} type. */\nexport const OperationType = {\n INPUT: 'input',\n SYNTHESIS: 'synthesis',\n REPLICA: 'replica'\n} as const;\nexport type OperationType = (typeof OperationType)[keyof typeof OperationType];\n\n/** Represents {@link Substitution} extended data. */\nexport interface CstSubstituteInfo {\n original: number;\n substitution: number;\n operation: number;\n original_schema: number;\n original_alias: string;\n original_term: string;\n substitution_schema: number;\n substitution_alias: string;\n substitution_term: string;\n}\n\n/** Represents Operation common attributes. */\ninterface OperationBase extends OssNode {\n id: number;\n alias: string;\n title: string;\n description: string;\n operation_type: OperationType;\n result: number | null;\n nodeType: typeof NodeType.OPERATION;\n has_additions: boolean;\n}\n\n/** Represents Input Operation. */\nexport interface OperationInput extends OperationBase {\n operation_type: typeof OperationType.INPUT;\n is_import: boolean;\n}\n\n/** Represents Replica Operation. */\ninterface OperationReplica extends OperationBase {\n operation_type: typeof OperationType.REPLICA;\n target: number;\n}\n\n/** Represents Synthesis Operation. */\nexport interface OperationSynthesis extends OperationBase {\n operation_type: typeof OperationType.SYNTHESIS;\n is_consolidation: boolean; // aka 'diamond synthesis'\n substitutions: CstSubstituteInfo[];\n arguments: number[];\n}\n\n/** Represents Operation. */\nexport type Operation = OperationInput | OperationReplica | OperationSynthesis;\n\n/** Represents Block. */\nexport interface Block extends OssNode {\n id: number;\n oss: number;\n title: string;\n description: string;\n parent: number | null;\n nodeType: typeof NodeType.BLOCK;\n}\n\n/** Represents item of OperationSchema. */\nexport type OssItem = Operation | Block;\n\n/** Represents {@link OperationSchema} statistics. */\nexport interface OperationSchemaStats {\n count_all: number;\n count_inputs: number;\n count_synthesis: number;\n count_schemas: number;\n count_owned: number;\n count_block: number;\n count_references: number;\n}\n\n/** Represents OperationSchema. */\nexport interface OperationSchema extends LibraryItem {\n editors: number[];\n operations: Operation[];\n blocks: Block[];\n replicas: {\n original: number;\n replica: number;\n }[];\n layout: OssLayout;\n arguments: {\n operation: number;\n argument: number;\n }[];\n substitutions: CstSubstituteInfo[];\n\n graph: Graph;\n extendedGraph: Graph;\n hierarchy: Graph<string>;\n schemas: number[];\n stats: OperationSchemaStats;\n operationByID: Map<number, Operation>;\n blockByID: Map<number, Block>;\n itemByNodeID: Map<string, OssItem>;\n}\n\n/** Represents substitution error description. */\nexport interface SubstitutionErrorDescription {\n
|
|
1
|
+
{"version":3,"file":"oss.js","names":[],"sources":["../../src/library/oss.ts"],"sourcesContent":["/**\n * Module: Schema of Synthesis Operations.\n */\n\nimport { type Graph } from '../graph';\n\nimport { RSDiagnosticCode } from './diagnostics';\nimport { type LibraryItem } from './library';\nimport { type NodePosition, type OssLayout } from './oss-layout';\n\n/** Represents OSS node type. */\nexport const NodeType = {\n OPERATION: 1,\n BLOCK: 2\n} as const;\nexport type NodeType = (typeof NodeType)[keyof typeof NodeType];\n\n/** Represents OSS graph node. */\ninterface OssNode extends NodePosition {\n nodeType: NodeType;\n parent: number | null;\n}\n\n/** Represents {@link Operation} type. */\nexport const OperationType = {\n INPUT: 'input',\n SYNTHESIS: 'synthesis',\n REPLICA: 'replica'\n} as const;\nexport type OperationType = (typeof OperationType)[keyof typeof OperationType];\n\n/** Represents {@link Substitution} extended data. */\nexport interface CstSubstituteInfo {\n original: number;\n substitution: number;\n operation: number;\n original_schema: number;\n original_alias: string;\n original_term: string;\n substitution_schema: number;\n substitution_alias: string;\n substitution_term: string;\n}\n\n/** Represents Operation common attributes. */\ninterface OperationBase extends OssNode {\n id: number;\n alias: string;\n title: string;\n description: string;\n operation_type: OperationType;\n result: number | null;\n nodeType: typeof NodeType.OPERATION;\n has_additions: boolean;\n}\n\n/** Represents Input Operation. */\nexport interface OperationInput extends OperationBase {\n operation_type: typeof OperationType.INPUT;\n is_import: boolean;\n}\n\n/** Represents Replica Operation. */\ninterface OperationReplica extends OperationBase {\n operation_type: typeof OperationType.REPLICA;\n target: number;\n}\n\n/** Represents Synthesis Operation. */\nexport interface OperationSynthesis extends OperationBase {\n operation_type: typeof OperationType.SYNTHESIS;\n is_consolidation: boolean; // aka 'diamond synthesis'\n substitutions: CstSubstituteInfo[];\n arguments: number[];\n}\n\n/** Represents Operation. */\nexport type Operation = OperationInput | OperationReplica | OperationSynthesis;\n\n/** Represents Block. */\nexport interface Block extends OssNode {\n id: number;\n oss: number;\n title: string;\n description: string;\n parent: number | null;\n nodeType: typeof NodeType.BLOCK;\n}\n\n/** Represents item of OperationSchema. */\nexport type OssItem = Operation | Block;\n\n/** Represents {@link OperationSchema} statistics. */\nexport interface OperationSchemaStats {\n count_all: number;\n count_inputs: number;\n count_synthesis: number;\n count_schemas: number;\n count_owned: number;\n count_block: number;\n count_references: number;\n}\n\n/** Represents OperationSchema. */\nexport interface OperationSchema extends LibraryItem {\n editors: number[];\n operations: Operation[];\n blocks: Block[];\n replicas: {\n original: number;\n replica: number;\n }[];\n layout: OssLayout;\n arguments: {\n operation: number;\n argument: number;\n }[];\n substitutions: CstSubstituteInfo[];\n\n graph: Graph;\n extendedGraph: Graph;\n hierarchy: Graph<string>;\n schemas: number[];\n stats: OperationSchemaStats;\n operationByID: Map<number, Operation>;\n blockByID: Map<number, Block>;\n itemByNodeID: Map<string, OssItem>;\n}\n\n/** Represents substitution error description (same code space as {@link RSDiagnosticCode}). */\nexport interface SubstitutionErrorDescription {\n code: SubstitutionErrorType;\n params: string[];\n}\n\n/**\n * Substitution-table error codes — aliases into {@link RSDiagnosticCode}.\n * Logical definition cycles reuse {@link RSDiagnosticCode.schemaDependencyCycle}.\n */\nexport const SubstitutionErrorType = {\n invalidIDs: RSDiagnosticCode.substitutionInvalidIDs,\n incorrectCst: RSDiagnosticCode.substitutionIncorrectCst,\n invalidClasses: RSDiagnosticCode.substitutionInvalidClasses,\n invalidBasic: RSDiagnosticCode.substitutionInvalidBasic,\n invalidConstant: RSDiagnosticCode.substitutionInvalidConstant,\n typificationCycle: RSDiagnosticCode.substitutionTypificationCycle,\n baseSubstitutionNotSet: RSDiagnosticCode.substitutionBaseNotSet,\n unequalTypification: RSDiagnosticCode.substitutionUnequalTypification,\n unequalExpressions: RSDiagnosticCode.substitutionUnequalExpressions,\n unequalArgsCount: RSDiagnosticCode.substitutionUnequalArgsCount,\n unequalArgs: RSDiagnosticCode.substitutionUnequalArgs,\n invalidNominal: RSDiagnosticCode.substitutionInvalidNominal,\n /** Same code as constituent schema dependency cycle. */\n definitionCycle: RSDiagnosticCode.schemaDependencyCycle\n} as const satisfies Record<string, (typeof RSDiagnosticCode)[keyof typeof RSDiagnosticCode]>;\nexport type SubstitutionErrorType = (typeof SubstitutionErrorType)[keyof typeof SubstitutionErrorType];\n"],"mappings":";;;AAWA,MAAa,WAAW;CACtB,WAAW;CACX,OAAO;AACT;;AAUA,MAAa,gBAAgB;CAC3B,OAAO;CACP,WAAW;CACX,SAAS;AACX;;;;;AA+GA,MAAa,wBAAwB;CACnC,YAAY,iBAAiB;CAC7B,cAAc,iBAAiB;CAC/B,gBAAgB,iBAAiB;CACjC,cAAc,iBAAiB;CAC/B,iBAAiB,iBAAiB;CAClC,mBAAmB,iBAAiB;CACpC,wBAAwB,iBAAiB;CACzC,qBAAqB,iBAAiB;CACtC,oBAAoB,iBAAiB;CACrC,kBAAkB,iBAAiB;CACnC,aAAa,iBAAiB;CAC9B,gBAAgB,iBAAiB;;CAEjC,iBAAiB,iBAAiB;AACpC"}
|