node-opcua-xml2json
Advanced tools
Comparing version 2.71.0 to 2.73.0
import { ReaderStateParserLike } from "./xml2json"; | ||
declare type UAString = string | null; | ||
declare type NodeIdLike = string | null; | ||
declare type Int32 = number; | ||
declare type UInt32 = number; | ||
declare type UABoolean = boolean; | ||
declare type LocalizedTextLike = string | null; | ||
export interface StructureFieldOptions { | ||
name?: UAString; | ||
description?: (LocalizedTextLike | null); | ||
dataType?: (NodeIdLike | null); | ||
valueRank?: Int32; | ||
arrayDimensions?: UInt32[] | null; | ||
maxStringLength?: UInt32; | ||
isOptional?: UABoolean; | ||
} | ||
export declare const _definitionParser: ReaderStateParserLike; | ||
export declare const definitionReaderStateParser: ReaderStateParserLike; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.definitionReaderStateParser = exports._definitionParser = void 0; | ||
// <Definition Name="SomeName"> | ||
// <Field Name="Running" Value="0" dataType: [ValueRank="1"]> | ||
//<Definition Name="SomeName"> | ||
// <Field Name="Running" Value="0" dataType: [ValueRank="1"]> | ||
// [<Description>text</Description>] | ||
@@ -10,16 +10,6 @@ // <Field> | ||
const node_opcua_assert_1 = require("node-opcua-assert"); | ||
// <Definition Name="SomeName"> | ||
// <Field Name="Running" Value="0" dataType: [ValueRank="1"]> | ||
// [<Description>text</Description>] | ||
// <Field> | ||
// </Definition> | ||
// | ||
// Or | ||
// | ||
// (IsOptionSet) | ||
// | ||
// | ||
exports._definitionParser = { | ||
init(name, attrs) { | ||
(0, node_opcua_assert_1.default)(!this.parent.definitionFields || this.parent.definitionFields.length === 0); | ||
(0, node_opcua_assert_1.default)(!this.parent. | ||
nFields || this.parent.definitionFields.length === 0); | ||
this.parent.definitionFields = []; | ||
@@ -46,2 +36,8 @@ this.parent.definitionName = attrs.SymbolicName || attrs.Name; | ||
}; | ||
if (this.attrs.AllowSubtype !== undefined) { | ||
obj.allowSubtype = this.attrs.AllowSubtype === "true"; | ||
} | ||
else { | ||
obj.allowSubtype = false; | ||
} | ||
if (this.attrs.DataType !== undefined) { | ||
@@ -48,0 +44,0 @@ obj.dataType = this.attrs.DataType; |
@@ -8,2 +8,3 @@ import { ReaderState, ReaderStateParserLike } from "./xml2json"; | ||
valueRank?: number; | ||
allowSubtype?: boolean; | ||
} | ||
@@ -10,0 +11,0 @@ export interface Definition { |
@@ -223,3 +223,3 @@ "use strict"; | ||
else { | ||
throw new Error("Unsupported ValueRank !"); | ||
throw new Error("Unsupported ValueRank ! " + field.valueRank); | ||
} | ||
@@ -226,0 +226,0 @@ } |
@@ -0,0 +0,0 @@ import { XmlAttributes } from "./xml2json"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { Xml2Json, XmlAttributes, IReaderState } from "./xml2json"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export * from "./xml2json"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { Callback, SimpleCallback, Xml2Json } from "../xml2json"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { IReaderState, ReaderStateBase, Xml2Json, XmlAttributes } from "./xml2json"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { ReaderState, ReaderStateParser, Xml2Json, XmlAttributes } from "./xml2json"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "node-opcua-xml2json", | ||
"version": "2.71.0", | ||
"version": "2.73.0", | ||
"description": "pure nodejs OPCUA SDK - module -xml2json", | ||
@@ -25,3 +25,3 @@ "main": "dist/source/index.js", | ||
"devDependencies": { | ||
"node-opcua-nodesets": "2.71.0", | ||
"node-opcua-nodesets": "2.73.0", | ||
"should": "^13.2.3" | ||
@@ -42,3 +42,3 @@ }, | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "10f7cc1e1cd30dfef75adad9cb709a78401fabf3" | ||
"gitHead": "b23a87c1ef777c0d8b680f45ee77e2a319feb092" | ||
} |
@@ -1,3 +0,3 @@ | ||
// <Definition Name="SomeName"> | ||
// <Field Name="Running" Value="0" dataType: [ValueRank="1"]> | ||
//<Definition Name="SomeName"> | ||
// <Field Name="Running" Value="0" dataType: [ValueRank="1"]> | ||
// [<Description>text</Description>] | ||
@@ -10,3 +10,3 @@ // <Field> | ||
// <Definition Name="SomeName"> | ||
// <Field Name="Running" Value="0" dataType: [ValueRank="1"]> | ||
// <Field Name="Running" Value="0" dataType: [ValueRank="1"]> | ||
// [<Description>text</Description>] | ||
@@ -21,5 +21,37 @@ // <Field> | ||
// | ||
type UAString = string |null; | ||
type NodeIdLike = string | null; | ||
type Int32 = number; | ||
type UInt32 = number; | ||
type UABoolean = boolean; | ||
type LocalizedTextLike = string | null; | ||
export interface StructureFieldOptions { | ||
name?: UAString ; | ||
description?: (LocalizedTextLike | null); | ||
dataType?: (NodeIdLike | null); | ||
valueRank?: Int32 ; | ||
arrayDimensions?: UInt32 [] | null; | ||
maxStringLength?: UInt32 ; | ||
isOptional?: UABoolean ; | ||
} | ||
interface AA { | ||
parent: { | ||
definitionFields: StructureFieldOptions[]; | ||
nFields: number; | ||
definitionName: string; | ||
}, | ||
array: StructureFieldOptions[]; | ||
isUnion: boolean; | ||
} | ||
interface FieldParser { | ||
description?: (LocalizedTextLike | null); | ||
parent: AA; | ||
attrs: Record<string, string>; | ||
} | ||
export const _definitionParser: ReaderStateParserLike = { | ||
init(this: any, name: string, attrs: XmlAttributes) { | ||
assert(!this.parent.definitionFields || this.parent.definitionFields.length === 0); | ||
init(this: AA, name: string, attrs: XmlAttributes) { | ||
assert(!this.parent. | ||
nFields || this.parent.definitionFields.length === 0); | ||
this.parent.definitionFields = []; | ||
@@ -32,3 +64,3 @@ this.parent.definitionName = attrs.SymbolicName || attrs.Name; | ||
Field: { | ||
init(this: any) { | ||
init(this: FieldParser) { | ||
this.description = undefined; | ||
@@ -43,6 +75,11 @@ }, | ||
}, | ||
finish(this: any) { | ||
finish(this: FieldParser) { | ||
const obj: any = { | ||
name: this.attrs.Name | ||
}; | ||
if (this.attrs.AllowSubtype !== undefined) { | ||
obj.allowSubtype = this.attrs.AllowSubtype === "true"; | ||
} else { | ||
obj.allowSubtype = false; | ||
} | ||
if (this.attrs.DataType !== undefined) { | ||
@@ -49,0 +86,0 @@ obj.dataType = this.attrs.DataType; |
@@ -175,2 +175,3 @@ import { lowerFirstLetter } from "node-opcua-utils"; | ||
valueRank?: number; // default is -1 => scalar | ||
allowSubtype?: boolean; | ||
} | ||
@@ -269,3 +270,3 @@ | ||
} else { | ||
throw new Error("Unsupported ValueRank !"); | ||
throw new Error("Unsupported ValueRank ! " + field.valueRank); | ||
} | ||
@@ -272,0 +273,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97407
2109