@openxiot/xiot-core-spec-ts 0.0.9 → 0.0.12
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/xiot/core/spec/codec/definition/NamespaceDefinitionCodec.js +10 -2
- package/dist/xiot/core/spec/typedef/constant/Spec.d.ts +1 -0
- package/dist/xiot/core/spec/typedef/constant/Spec.js +1 -0
- package/dist/xiot/core/spec/typedef/definition/NamespaceDefinition.d.ts +2 -0
- package/dist/xiot/core/spec/typedef/definition/NamespaceDefinition.js +2 -0
- package/dist/xiot/core/spec/typedef/visibility/Visibility.d.ts +7 -0
- package/dist/xiot/core/spec/typedef/visibility/Visibility.js +24 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -191,6 +191,7 @@ export * from './xiot/core/spec/typedef/version/GenericVersion';
|
|
|
191
191
|
export * from './xiot/core/spec/typedef/version/SemanticVersion';
|
|
192
192
|
export * from './xiot/core/spec/typedef/somewhere/Somewhere';
|
|
193
193
|
export * from './xiot/core/spec/typedef/somewhere/Where';
|
|
194
|
+
export * from './xiot/core/spec/typedef/visibility/Visibility';
|
|
194
195
|
export * from './xiot/core/spec/typedef/xid/ActionID';
|
|
195
196
|
export * from './xiot/core/spec/typedef/xid/EventID';
|
|
196
197
|
export * from './xiot/core/spec/typedef/xid/PropertyID';
|
package/dist/index.js
CHANGED
|
@@ -207,6 +207,7 @@ __exportStar(require("./xiot/core/spec/typedef/version/GenericVersion"), exports
|
|
|
207
207
|
__exportStar(require("./xiot/core/spec/typedef/version/SemanticVersion"), exports);
|
|
208
208
|
__exportStar(require("./xiot/core/spec/typedef/somewhere/Somewhere"), exports);
|
|
209
209
|
__exportStar(require("./xiot/core/spec/typedef/somewhere/Where"), exports);
|
|
210
|
+
__exportStar(require("./xiot/core/spec/typedef/visibility/Visibility"), exports);
|
|
210
211
|
__exportStar(require("./xiot/core/spec/typedef/xid/ActionID"), exports);
|
|
211
212
|
__exportStar(require("./xiot/core/spec/typedef/xid/EventID"), exports);
|
|
212
213
|
__exportStar(require("./xiot/core/spec/typedef/xid/PropertyID"), exports);
|
|
@@ -4,6 +4,7 @@ exports.NamespaceDefinitionCodec = void 0;
|
|
|
4
4
|
const NamespaceDefinition_1 = require("../../typedef/definition/NamespaceDefinition");
|
|
5
5
|
const Spec_1 = require("../../typedef/constant/Spec");
|
|
6
6
|
const DescriptionCodec_1 = require("./DescriptionCodec");
|
|
7
|
+
const Visibility_1 = require("@openxiot/xiot-core-spec-ts/xiot/core/spec/typedef/visibility/Visibility");
|
|
7
8
|
class NamespaceDefinitionCodec {
|
|
8
9
|
static decodeArray(list) {
|
|
9
10
|
const array = [];
|
|
@@ -13,15 +14,22 @@ class NamespaceDefinitionCodec {
|
|
|
13
14
|
return array;
|
|
14
15
|
}
|
|
15
16
|
static decode(o) {
|
|
17
|
+
const visibility = o[Spec_1.Spec.VISIBILITY] || '';
|
|
16
18
|
const namespace = o[Spec_1.Spec.NAMESPACE];
|
|
17
19
|
const description = DescriptionCodec_1.DescriptionCodec.decode(o[Spec_1.Spec.DESCRIPTION]);
|
|
18
|
-
|
|
20
|
+
const def = new NamespaceDefinition_1.NamespaceDefinition(namespace, description);
|
|
21
|
+
def.visibility = (0, Visibility_1.VisibilityFromString)(visibility);
|
|
22
|
+
return def;
|
|
19
23
|
}
|
|
20
24
|
static encode(def) {
|
|
21
|
-
|
|
25
|
+
let o = {
|
|
22
26
|
namespace: def.namespace,
|
|
23
27
|
description: DescriptionCodec_1.DescriptionCodec.encode(def.description)
|
|
24
28
|
};
|
|
29
|
+
if (def.visibility === Visibility_1.Visibility.UNDEFINED) {
|
|
30
|
+
o[Spec_1.Spec.VISIBILITY] = def.visibility;
|
|
31
|
+
}
|
|
32
|
+
return o;
|
|
25
33
|
}
|
|
26
34
|
static encodeArray(list) {
|
|
27
35
|
return list.map(x => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Visibility } from "@openxiot/xiot-core-spec-ts/xiot/core/spec/typedef/visibility/Visibility";
|
|
1
2
|
export declare class NamespaceDefinition {
|
|
2
3
|
namespace: string;
|
|
3
4
|
description: Map<string, string>;
|
|
5
|
+
visibility: Visibility;
|
|
4
6
|
constructor(namespace: string, description: Map<string, string>);
|
|
5
7
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NamespaceDefinition = void 0;
|
|
4
|
+
const Visibility_1 = require("@openxiot/xiot-core-spec-ts/xiot/core/spec/typedef/visibility/Visibility");
|
|
4
5
|
class NamespaceDefinition {
|
|
5
6
|
constructor(namespace, description) {
|
|
6
7
|
this.namespace = '';
|
|
7
8
|
this.description = new Map();
|
|
9
|
+
this.visibility = Visibility_1.Visibility.UNDEFINED;
|
|
8
10
|
this.namespace = namespace;
|
|
9
11
|
this.description = description;
|
|
10
12
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Visibility = void 0;
|
|
4
|
+
exports.VisibilityToString = VisibilityToString;
|
|
5
|
+
exports.VisibilityFromString = VisibilityFromString;
|
|
6
|
+
var Visibility;
|
|
7
|
+
(function (Visibility) {
|
|
8
|
+
Visibility["UNDEFINED"] = "undefined";
|
|
9
|
+
Visibility["PUBLIC"] = "public";
|
|
10
|
+
Visibility["PRIVATE"] = "private";
|
|
11
|
+
})(Visibility || (exports.Visibility = Visibility = {}));
|
|
12
|
+
function VisibilityToString(type) {
|
|
13
|
+
return type.toString();
|
|
14
|
+
}
|
|
15
|
+
function VisibilityFromString(type) {
|
|
16
|
+
const keys = Object.keys(Visibility);
|
|
17
|
+
for (const key of keys) {
|
|
18
|
+
const s = VisibilityToString(Visibility[key]);
|
|
19
|
+
if (s === type) {
|
|
20
|
+
return Visibility[key];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return Visibility.UNDEFINED;
|
|
24
|
+
}
|