@128technology/yinz
Advanced tools
Comparing version 5.0.0-alpha.2 to 5.0.0-alpha.3
@@ -19,6 +19,6 @@ import { Element, Document } from 'libxmljs'; | ||
toXML(rootEl?: Element, options?: XMLSerializationOptions): Document; | ||
resolveLeafRefPath(path: Path): Promise<Path>; | ||
evaluateWhenCondition(path: Path): Promise<boolean>; | ||
evaluateLeafRef(path: Path): Promise<string[]>; | ||
evaluateSuggestionRef(path: Path): Promise<string[]>; | ||
resolveLeafRefPath(path: Path, context?: unknown): Promise<Path>; | ||
evaluateWhenCondition(path: Path, context?: unknown): Promise<boolean>; | ||
evaluateLeafRef(path: Path, context?: unknown): Promise<string[]>; | ||
evaluateSuggestionRef(path: Path, context?: unknown): Promise<string[]>; | ||
getInstanceFromElement(element: Element): Instance | LeafListChildInstance; | ||
@@ -25,0 +25,0 @@ getInstance(path: Path, noMatchHandler?: NoMatchHandler): ListChildInstance | ContainerInstance | ListInstance | LeafListInstance | LeafInstance | LeafListChildInstance | undefined; |
@@ -57,6 +57,6 @@ "use strict"; | ||
} | ||
async resolveLeafRefPath(path) { | ||
async resolveLeafRefPath(path, context) { | ||
var _a, _b; | ||
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.jsonMode) { | ||
return (_b = this.options) === null || _b === void 0 ? void 0 : _b.jsonMode.resolveLeafRefPath(path); | ||
return (_b = this.options) === null || _b === void 0 ? void 0 : _b.jsonMode.resolveLeafRefPath(path, context); | ||
} | ||
@@ -95,3 +95,3 @@ const instance = this.getInstance(path); | ||
} | ||
async evaluateWhenCondition(path) { | ||
async evaluateWhenCondition(path, context) { | ||
var _a, _b; | ||
@@ -103,3 +103,3 @@ const model = this.model.getModelForPath(path.map(({ name }) => name).join('.')); | ||
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.jsonMode) { | ||
return (_b = this.options) === null || _b === void 0 ? void 0 : _b.jsonMode.evaluateWhenCondition(path); | ||
return (_b = this.options) === null || _b === void 0 ? void 0 : _b.jsonMode.evaluateWhenCondition(path, context); | ||
} | ||
@@ -113,4 +113,4 @@ const { element, cleanUp } = this.getElementForPath(path); | ||
for (const when of modelRoot.when) { | ||
const { condition, context } = when; | ||
const contextNode = context === enum_1.ContextNode.parent || modelRoot instanceof model_1.Choice ? instanceRoot.parent() : instanceRoot; | ||
const { condition, context: whenContext } = when; | ||
const contextNode = whenContext === enum_1.ContextNode.parent || modelRoot instanceof model_1.Choice ? instanceRoot.parent() : instanceRoot; | ||
const result = contextNode.get(condition, this.model.namespaces); | ||
@@ -134,6 +134,6 @@ if (!result) { | ||
} | ||
async evaluateLeafRef(path) { | ||
async evaluateLeafRef(path, context) { | ||
var _a, _b; | ||
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.jsonMode) { | ||
return (_b = this.options) === null || _b === void 0 ? void 0 : _b.jsonMode.evaluateLeafRef(path); | ||
return (_b = this.options) === null || _b === void 0 ? void 0 : _b.jsonMode.evaluateLeafRef(path, context); | ||
} | ||
@@ -160,6 +160,6 @@ const model = this.model.getModelForPath(path.map(({ name }) => name).join('.')); | ||
} | ||
async evaluateSuggestionRef(path) { | ||
async evaluateSuggestionRef(path, context) { | ||
var _a, _b; | ||
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.jsonMode) { | ||
return (_b = this.options) === null || _b === void 0 ? void 0 : _b.jsonMode.evaluateSuggestionRef(path); | ||
return (_b = this.options) === null || _b === void 0 ? void 0 : _b.jsonMode.evaluateSuggestionRef(path, context); | ||
} | ||
@@ -166,0 +166,0 @@ const model = this.model.getModelForPath(path.map(({ name }) => name).join('.')); |
@@ -48,6 +48,6 @@ import ContainerInstance from './ContainerInstance'; | ||
export interface IJSONModeEvaluators { | ||
evaluateWhenCondition: (path: Path) => Promise<boolean>; | ||
evaluateLeafRef: (path: Path) => Promise<string[]>; | ||
evaluateSuggestionRef: (path: Path) => Promise<string[]>; | ||
resolveLeafRefPath: (path: Path) => Promise<Path>; | ||
evaluateWhenCondition: (path: Path, context?: unknown) => Promise<boolean>; | ||
evaluateLeafRef: (path: Path, context?: unknown) => Promise<string[]>; | ||
evaluateSuggestionRef: (path: Path, context?: unknown) => Promise<string[]>; | ||
resolveLeafRefPath: (path: Path, context?: unknown) => Promise<Path>; | ||
} | ||
@@ -54,0 +54,0 @@ export interface IInstanceOptions { |
{ | ||
"name": "@128technology/yinz", | ||
"version": "5.0.0-alpha.2", | ||
"version": "5.0.0-alpha.3", | ||
"description": "A module for injesting a YIN datamodel and handling instance data.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
638363