@openxiot/xiot-core-spec-ts 0.0.3 → 0.0.4

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.
Files changed (68) hide show
  1. package/dist/index.d.ts +20 -11
  2. package/dist/index.js +20 -11
  3. package/dist/xiot/core/spec/codec/by/CreatorCodec.d.ts +5 -0
  4. package/dist/xiot/core/spec/codec/by/CreatorCodec.js +20 -0
  5. package/dist/xiot/core/spec/codec/by/UpdaterCodec.d.ts +5 -0
  6. package/dist/xiot/core/spec/codec/by/UpdaterCodec.js +20 -0
  7. package/dist/xiot/core/spec/codec/product/basic/ProductBasicCodec.d.ts +7 -0
  8. package/dist/xiot/core/spec/codec/product/basic/ProductBasicCodec.js +55 -0
  9. package/dist/xiot/core/spec/codec/product/firmware/ProductFirmwareCodec.d.ts +7 -0
  10. package/dist/xiot/core/spec/codec/product/firmware/ProductFirmwareCodec.js +44 -0
  11. package/dist/xiot/core/spec/codec/product/firmware/ProductFirmwareInstanceCodec.d.ts +7 -0
  12. package/dist/xiot/core/spec/codec/product/firmware/ProductFirmwareInstanceCodec.js +63 -0
  13. package/dist/xiot/core/spec/codec/product/instance/ProductInstanceCodec.d.ts +7 -0
  14. package/dist/xiot/core/spec/codec/product/instance/ProductInstanceCodec.js +46 -0
  15. package/dist/xiot/core/spec/codec/product/manual/ProductManualCodec.d.ts +7 -0
  16. package/dist/xiot/core/spec/codec/product/manual/ProductManualCodec.js +79 -0
  17. package/dist/xiot/core/spec/codec/product/panel/ProductPanelCodec.d.ts +7 -0
  18. package/dist/xiot/core/spec/codec/product/panel/ProductPanelCodec.js +99 -0
  19. package/dist/xiot/core/spec/codec/product/wizard/ProductWizardCodec.d.ts +7 -0
  20. package/dist/xiot/core/spec/codec/product/wizard/ProductWizardCodec.js +88 -0
  21. package/dist/xiot/core/spec/codec/version/GenericVersionCodec.d.ts +5 -0
  22. package/dist/xiot/core/spec/codec/version/GenericVersionCodec.js +16 -0
  23. package/dist/xiot/core/spec/typedef/by/Creator.d.ts +6 -0
  24. package/dist/xiot/core/spec/typedef/by/Creator.js +11 -0
  25. package/dist/xiot/core/spec/typedef/by/Updater.d.ts +6 -0
  26. package/dist/xiot/core/spec/typedef/by/Updater.js +11 -0
  27. package/dist/xiot/core/spec/typedef/instance/Action.d.ts +8 -0
  28. package/dist/xiot/core/spec/typedef/instance/Action.js +104 -0
  29. package/dist/xiot/core/spec/typedef/product/basic/ProductBasic.d.ts +19 -0
  30. package/dist/xiot/core/spec/typedef/product/basic/ProductBasic.js +21 -0
  31. package/dist/xiot/core/spec/typedef/product/firmware/ProductFirmware.d.ts +10 -0
  32. package/dist/xiot/core/spec/typedef/product/firmware/ProductFirmware.js +13 -0
  33. package/dist/xiot/core/spec/typedef/product/firmware/ProductFirmwareInstance.d.ts +21 -0
  34. package/dist/xiot/core/spec/typedef/product/firmware/ProductFirmwareInstance.js +24 -0
  35. package/dist/xiot/core/spec/typedef/product/instance/ProductInstance.d.ts +11 -0
  36. package/dist/xiot/core/spec/typedef/product/instance/ProductInstance.js +13 -0
  37. package/dist/xiot/core/spec/typedef/product/manual/ProductManual.d.ts +15 -0
  38. package/dist/xiot/core/spec/typedef/product/manual/ProductManual.js +20 -0
  39. package/dist/xiot/core/spec/typedef/product/panel/ProductPanel.d.ts +27 -0
  40. package/dist/xiot/core/spec/typedef/product/panel/ProductPanel.js +32 -0
  41. package/dist/xiot/core/spec/typedef/product/wizard/ProductWizard.d.ts +16 -0
  42. package/dist/xiot/core/spec/typedef/product/wizard/ProductWizard.js +21 -0
  43. package/dist/xiot/core/spec/typedef/version/GenericVersion.d.ts +5 -0
  44. package/dist/xiot/core/spec/typedef/version/GenericVersion.js +10 -0
  45. package/dist/xiot/core/spec/typedef/version/{Version.d.ts → SemanticVersion.d.ts} +2 -3
  46. package/dist/xiot/core/spec/typedef/version/SemanticVersion.js +21 -0
  47. package/package.json +1 -1
  48. package/dist/xiot/core/spec/codec/product/ProductCodec.d.ts +0 -7
  49. package/dist/xiot/core/spec/codec/product/ProductCodec.js +0 -76
  50. package/dist/xiot/core/spec/codec/product/ProductVersionCodec.d.ts +0 -7
  51. package/dist/xiot/core/spec/codec/product/ProductVersionCodec.js +0 -69
  52. package/dist/xiot/core/spec/codec/product/resource/ProductResourceCodec.d.ts +0 -7
  53. package/dist/xiot/core/spec/codec/product/resource/ProductResourceCodec.js +0 -45
  54. package/dist/xiot/core/spec/codec/product/resource/ProductResourceVersionCodec.d.ts +0 -7
  55. package/dist/xiot/core/spec/codec/product/resource/ProductResourceVersionCodec.js +0 -69
  56. package/dist/xiot/core/spec/codec/product/resource/ResourceVersionCodec.d.ts +0 -7
  57. package/dist/xiot/core/spec/codec/product/resource/ResourceVersionCodec.js +0 -65
  58. package/dist/xiot/core/spec/typedef/product/Product.d.ts +0 -22
  59. package/dist/xiot/core/spec/typedef/product/Product.js +0 -25
  60. package/dist/xiot/core/spec/typedef/product/ProductVersion.d.ts +0 -17
  61. package/dist/xiot/core/spec/typedef/product/ProductVersion.js +0 -24
  62. package/dist/xiot/core/spec/typedef/product/resource/ProductResource.d.ts +0 -8
  63. package/dist/xiot/core/spec/typedef/product/resource/ProductResource.js +0 -13
  64. package/dist/xiot/core/spec/typedef/product/resource/ProductResourceVersion.d.ts +0 -5
  65. package/dist/xiot/core/spec/typedef/product/resource/ProductResourceVersion.js +0 -12
  66. package/dist/xiot/core/spec/typedef/product/resource/ResourceVersion.d.ts +0 -16
  67. package/dist/xiot/core/spec/typedef/product/resource/ResourceVersion.js +0 -30
  68. package/dist/xiot/core/spec/typedef/version/Version.js +0 -40
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductWizardCodec = void 0;
4
+ const ProductWizard_1 = require("../../../typedef/product/wizard/ProductWizard");
5
+ const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
6
+ const CreatorCodec_1 = require("../../by/CreatorCodec");
7
+ const UpdaterCodec_1 = require("../../by/UpdaterCodec");
8
+ class ProductWizardStepCodec {
9
+ static encode(x) {
10
+ return {
11
+ index: x.index,
12
+ image: x.image,
13
+ description: x.description,
14
+ };
15
+ }
16
+ static decode(x) {
17
+ if (x) {
18
+ return new ProductWizard_1.ProductWizardStep(x.index || 0, x.image || '', x.description || '');
19
+ }
20
+ return new ProductWizard_1.ProductWizardStep();
21
+ }
22
+ static encodeArray(arr) {
23
+ const list = [];
24
+ if (arr === null || arr === void 0 ? void 0 : arr.length) {
25
+ for (const o of arr) {
26
+ list.push(this.encode(o));
27
+ }
28
+ }
29
+ return list;
30
+ }
31
+ static decodeArray(arr) {
32
+ const list = [];
33
+ if (arr === null || arr === void 0 ? void 0 : arr.length) {
34
+ for (const o of arr) {
35
+ list.push(this.decode(o));
36
+ }
37
+ }
38
+ return list;
39
+ }
40
+ }
41
+ class ProductWizardCodec {
42
+ static encode(x) {
43
+ let o = {
44
+ lifecycle: x.lifecycle.toString(),
45
+ steps: ProductWizardStepCodec.encodeArray(x.steps),
46
+ };
47
+ if (x.creator) {
48
+ o.creator = CreatorCodec_1.CreatorCodec.encode(x.creator);
49
+ }
50
+ if (x.updater) {
51
+ o.updater = UpdaterCodec_1.UpdaterCodec.encode(x.updater);
52
+ }
53
+ return o;
54
+ }
55
+ static decode(o) {
56
+ const x = new ProductWizard_1.ProductWizard();
57
+ if (o) {
58
+ x.lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || Lifecycle_1.LifeCycle.DEVELOPMENT);
59
+ x.steps = ProductWizardStepCodec.decodeArray(o.steps);
60
+ if (o.creator) {
61
+ x.creator = CreatorCodec_1.CreatorCodec.decode(o.creator);
62
+ }
63
+ if (o.updater) {
64
+ x.updater = UpdaterCodec_1.UpdaterCodec.decode(o.updater);
65
+ }
66
+ }
67
+ return x;
68
+ }
69
+ static encodeArray(arr) {
70
+ const list = [];
71
+ if (arr === null || arr === void 0 ? void 0 : arr.length) {
72
+ for (const o of arr) {
73
+ list.push(this.encode(o));
74
+ }
75
+ }
76
+ return list;
77
+ }
78
+ static decodeArray(arr) {
79
+ const instances = [];
80
+ if (arr === null || arr === void 0 ? void 0 : arr.length) {
81
+ for (const o of arr) {
82
+ instances.push(this.decode(o));
83
+ }
84
+ }
85
+ return instances;
86
+ }
87
+ }
88
+ exports.ProductWizardCodec = ProductWizardCodec;
@@ -0,0 +1,5 @@
1
+ import { GenericVersion } from "../../typedef/version/GenericVersion";
2
+ export declare class GenericVersionCodec {
3
+ static encode(x: GenericVersion): any;
4
+ static decode(o: any): GenericVersion;
5
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenericVersionCodec = void 0;
4
+ const GenericVersion_1 = require("../../typedef/version/GenericVersion");
5
+ class GenericVersionCodec {
6
+ static encode(x) {
7
+ return {
8
+ name: x.name,
9
+ code: x.code
10
+ };
11
+ }
12
+ static decode(o) {
13
+ return new GenericVersion_1.GenericVersion(o.name || '', o.code || 0);
14
+ }
15
+ }
16
+ exports.GenericVersionCodec = GenericVersionCodec;
@@ -0,0 +1,6 @@
1
+ export declare class Creator {
2
+ id: string;
3
+ name: string;
4
+ timestamp: number;
5
+ constructor(id: string, name: string, timestamp: number);
6
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Creator = void 0;
4
+ class Creator {
5
+ constructor(id, name, timestamp) {
6
+ this.id = id;
7
+ this.name = name;
8
+ this.timestamp = timestamp;
9
+ }
10
+ }
11
+ exports.Creator = Creator;
@@ -0,0 +1,6 @@
1
+ export declare class Updater {
2
+ id: string;
3
+ name: string;
4
+ timestamp: number;
5
+ constructor(id: string, name: string, timestamp: number);
6
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Updater = void 0;
4
+ class Updater {
5
+ constructor(id, name, timestamp) {
6
+ this.id = id;
7
+ this.name = name;
8
+ this.timestamp = timestamp;
9
+ }
10
+ }
11
+ exports.Updater = Updater;
@@ -1,5 +1,7 @@
1
1
  import { ActionType } from '../definition/urn/ActionType';
2
2
  import { Argument } from './Argument';
3
+ import { ActionOperation } from '../operation/ActionOperation';
4
+ import { Property } from "./Property";
3
5
  export declare class Action {
4
6
  iid: number;
5
7
  type: ActionType;
@@ -11,4 +13,10 @@ export declare class Action {
11
13
  getArgumentsOut(): Argument[];
12
14
  addArgumentIn(arg: Argument): void;
13
15
  addArgumentOut(arg: Argument): void;
16
+ tryInvoke(o: ActionOperation, properties: Map<number, Property>): void;
17
+ private checkArgumentCount;
18
+ private checkArgumentValue;
19
+ private checkArgumentValueByCombinationValue;
20
+ private checkCombinationValue;
21
+ private checkArgumentValueByRawValue;
14
22
  }
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Action = void 0;
4
+ const Status_1 = require("../status/Status");
5
+ const DataFormat_1 = require("../definition/property/data/DataFormat");
4
6
  class Action {
5
7
  constructor(iid, type, description, argumentsIn, argumentsOut) {
6
8
  this.iid = 0;
@@ -29,5 +31,107 @@ class Action {
29
31
  addArgumentOut(arg) {
30
32
  this.out.set(arg.piid, arg);
31
33
  }
34
+ /*----------------------------------------------------------------------
35
+ * for debugger
36
+ *----------------------------------------------------------------------*/
37
+ tryInvoke(o, properties) {
38
+ o.status = Status_1.Status.COMPLETED;
39
+ for (const def of Array.from(this.in.values())) {
40
+ const arg = o.in.get(def.piid);
41
+ this.checkArgumentCount(o, arg, def);
42
+ if (o.isError()) {
43
+ break;
44
+ }
45
+ if (!arg) {
46
+ continue;
47
+ }
48
+ this.checkArgumentValue(o, arg, def, properties);
49
+ if (o.isError()) {
50
+ break;
51
+ }
52
+ }
53
+ }
54
+ checkArgumentCount(o, arg, def) {
55
+ if (arg === undefined) {
56
+ if (def.minRepeat > 0) {
57
+ o.status = Status_1.Status.ACTION_IN_ERROR;
58
+ o.description = "action in is null !";
59
+ }
60
+ }
61
+ else {
62
+ if (arg.values.length > def.maxRepeat) {
63
+ o.status = Status_1.Status.ACTION_IN_ERROR;
64
+ o.description = "action in.size() > maxRepeat !";
65
+ }
66
+ }
67
+ }
68
+ checkArgumentValue(o, arg, def, properties) {
69
+ const property = properties.get(def.piid);
70
+ if (property === undefined) {
71
+ o.status = Status_1.Status.INTERNAL_ERROR;
72
+ o.description = `找不到参数的属性定义: ${def.piid}`;
73
+ return;
74
+ }
75
+ if (property.format === DataFormat_1.DataFormat.COMBINATION) {
76
+ this.checkArgumentValueByCombinationValue(o, arg, def, property, properties);
77
+ }
78
+ else {
79
+ this.checkArgumentValueByRawValue(o, arg, def, property);
80
+ }
81
+ }
82
+ checkArgumentValueByCombinationValue(o, arg, def, property, properties) {
83
+ for (const argValue of arg.values) {
84
+ if (!(argValue instanceof Map)) {
85
+ o.status = Status_1.Status.ACTION_IN_VALUE_INVALID;
86
+ o.description = `combination value invalid: ${typeof argValue}`;
87
+ break;
88
+ }
89
+ this.checkCombinationValue(o, argValue, property, properties);
90
+ if (o.isError()) {
91
+ break;
92
+ }
93
+ }
94
+ }
95
+ checkCombinationValue(o, argValue, property, properties) {
96
+ for (const piid of property.members) {
97
+ const value = argValue.get(piid);
98
+ if (value === undefined || value === null) {
99
+ o.status = Status_1.Status.ACTION_IN_VALUE_INVALID;
100
+ o.description = `the member value in combination is null: piid: [${piid}]`;
101
+ break;
102
+ }
103
+ const member = properties.get(piid);
104
+ if (member === undefined) {
105
+ o.status = Status_1.Status.INTERNAL_ERROR;
106
+ o.description = `找不到组合参数的成员属性定义: ${piid}`;
107
+ break;
108
+ }
109
+ // 尝试写属性值,进行校验
110
+ if (!member.trySetValue(value)) {
111
+ o.status = Status_1.Status.PROPERTY_VALUE_INVALID;
112
+ o.description = `组合参数的成员属性值非法: piid: [${piid}], value: [${value}]`;
113
+ break;
114
+ }
115
+ // 如果argValue的值是浮点型,而property.value是整型,则帮argValue修正值为整型。布尔型不进行修正。
116
+ if (member.format !== DataFormat_1.DataFormat.BOOL) {
117
+ argValue.set(piid, value);
118
+ }
119
+ else {
120
+ // 当为bool类型,针对decimal数据做数据修复
121
+ // if (value instanceof BigDecimal) {
122
+ // argValue.set(piid, (value as BigDecimal).intValue());
123
+ // }
124
+ }
125
+ }
126
+ }
127
+ checkArgumentValueByRawValue(o, arg, def, property) {
128
+ if (property.trySetValues(arg.values)) {
129
+ // 假设这里不需要额外处理
130
+ }
131
+ else {
132
+ o.status = Status_1.Status.ACTION_IN_VALUE_INVALID;
133
+ o.description = "action in value invalid, piid: " + def.piid;
134
+ }
135
+ }
32
136
  }
33
137
  exports.Action = Action;
@@ -0,0 +1,19 @@
1
+ import { Urn } from '../../definition/urn/Urn';
2
+ import { Creator } from '../../by/Creator';
3
+ import { Updater } from '../../by/Updater';
4
+ import { LifeCycle } from '../../lifecycle/Lifecycle';
5
+ export declare class ProductBasic {
6
+ id: number;
7
+ organization: string;
8
+ model: string;
9
+ template: Urn;
10
+ name: string;
11
+ icon: string;
12
+ upgrade: string[];
13
+ protocol: string;
14
+ lifecycle: LifeCycle;
15
+ naming: string[];
16
+ creator: Creator | null;
17
+ updater: Updater | null;
18
+ constructor(id: number | undefined, organization: string, model: string, template: Urn, name: string, icon: string, upgrade?: string[], protocol?: string, lifecycle?: LifeCycle, naming?: string[], creator?: Creator | null, updater?: Updater | null);
19
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductBasic = void 0;
4
+ const Lifecycle_1 = require("../../lifecycle/Lifecycle");
5
+ class ProductBasic {
6
+ constructor(id = 0, organization, model, template, name, icon, upgrade = [], protocol = '', lifecycle = Lifecycle_1.LifeCycle.DEVELOPMENT, naming = [], creator = null, updater = null) {
7
+ this.id = id;
8
+ this.organization = organization;
9
+ this.model = model;
10
+ this.template = template;
11
+ this.name = name;
12
+ this.icon = icon;
13
+ this.upgrade = upgrade;
14
+ this.protocol = protocol;
15
+ this.lifecycle = lifecycle;
16
+ this.naming = naming;
17
+ this.creator = creator;
18
+ this.updater = updater;
19
+ }
20
+ }
21
+ exports.ProductBasic = ProductBasic;
@@ -0,0 +1,10 @@
1
+ import { Creator } from "../../by/Creator";
2
+ import { Updater } from "../../by/Updater";
3
+ export declare class ProductFirmware {
4
+ name: string;
5
+ description: string;
6
+ type: string;
7
+ creator: Creator | null;
8
+ updater: Updater | null;
9
+ constructor(name?: string, description?: string, type?: string, creator?: Creator | null, updater?: Updater | null);
10
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductFirmware = void 0;
4
+ class ProductFirmware {
5
+ constructor(name = '', description = '', type = '', creator = null, updater = null) {
6
+ this.name = name;
7
+ this.description = description;
8
+ this.type = type;
9
+ this.creator = creator;
10
+ this.updater = updater;
11
+ }
12
+ }
13
+ exports.ProductFirmware = ProductFirmware;
@@ -0,0 +1,21 @@
1
+ import { GenericVersion } from "../../version/GenericVersion";
2
+ import { LifeCycle } from "../../lifecycle/Lifecycle";
3
+ import { Creator } from "../../by/Creator";
4
+ import { Updater } from "../../by/Updater";
5
+ export declare class FirmwareSample {
6
+ memo: string;
7
+ url: string;
8
+ size: number;
9
+ md5: string;
10
+ constructor(memo: string, url: string, size: number, md5: string);
11
+ }
12
+ export declare class ProductFirmwareInstance {
13
+ lifecycle: LifeCycle;
14
+ version: GenericVersion;
15
+ minUpgradeVersionCode: number;
16
+ type: string;
17
+ simple: FirmwareSample | null;
18
+ creator: Creator | null;
19
+ updater: Updater | null;
20
+ constructor(lifecycle: LifeCycle, version: GenericVersion, minUpgradeVersionCode: number, type: string, simple?: FirmwareSample | null, creator?: Creator | null, updater?: Updater | null);
21
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductFirmwareInstance = exports.FirmwareSample = void 0;
4
+ class FirmwareSample {
5
+ constructor(memo, url, size, md5) {
6
+ this.memo = memo;
7
+ this.url = url;
8
+ this.size = size;
9
+ this.md5 = md5;
10
+ }
11
+ }
12
+ exports.FirmwareSample = FirmwareSample;
13
+ class ProductFirmwareInstance {
14
+ constructor(lifecycle, version, minUpgradeVersionCode, type, simple = null, creator = null, updater = null) {
15
+ this.lifecycle = lifecycle;
16
+ this.version = version;
17
+ this.minUpgradeVersionCode = minUpgradeVersionCode;
18
+ this.type = type;
19
+ this.simple = simple;
20
+ this.creator = creator;
21
+ this.updater = updater;
22
+ }
23
+ }
24
+ exports.ProductFirmwareInstance = ProductFirmwareInstance;
@@ -0,0 +1,11 @@
1
+ import { LifeCycle } from "../../lifecycle/Lifecycle";
2
+ import { Urn } from "../../definition/urn/Urn";
3
+ import { Creator } from "../../by/Creator";
4
+ import { Updater } from "../../by/Updater";
5
+ export declare class ProductInstance {
6
+ lifecycle: LifeCycle;
7
+ type: Urn | null;
8
+ creator: Creator | null;
9
+ updater: Updater | null;
10
+ constructor(lifecycle?: LifeCycle, type?: Urn | null, creator?: Creator | null, updater?: Updater | null);
11
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductInstance = void 0;
4
+ const Lifecycle_1 = require("../../lifecycle/Lifecycle");
5
+ class ProductInstance {
6
+ constructor(lifecycle = Lifecycle_1.LifeCycle.DEVELOPMENT, type = null, creator = null, updater = null) {
7
+ this.lifecycle = lifecycle;
8
+ this.type = type;
9
+ this.creator = creator;
10
+ this.updater = updater;
11
+ }
12
+ }
13
+ exports.ProductInstance = ProductInstance;
@@ -0,0 +1,15 @@
1
+ import { LifeCycle } from "../../lifecycle/Lifecycle";
2
+ import { Creator } from "../../by/Creator";
3
+ import { Updater } from "../../by/Updater";
4
+ export declare class ProductManualPage {
5
+ index: number;
6
+ url: string;
7
+ constructor(index?: number, url?: string);
8
+ }
9
+ export declare class ProductManual {
10
+ pages: ProductManualPage[];
11
+ lifecycle: LifeCycle;
12
+ creator: Creator | null;
13
+ updater: Updater | null;
14
+ constructor(pages?: ProductManualPage[], lifecycle?: LifeCycle, creator?: Creator | null, updater?: Updater | null);
15
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductManual = exports.ProductManualPage = void 0;
4
+ const Lifecycle_1 = require("../../lifecycle/Lifecycle");
5
+ class ProductManualPage {
6
+ constructor(index = 0, url = '') {
7
+ this.index = index;
8
+ this.url = url;
9
+ }
10
+ }
11
+ exports.ProductManualPage = ProductManualPage;
12
+ class ProductManual {
13
+ constructor(pages = [], lifecycle = Lifecycle_1.LifeCycle.DEVELOPMENT, creator = null, updater = null) {
14
+ this.pages = pages;
15
+ this.lifecycle = lifecycle;
16
+ this.creator = creator;
17
+ this.updater = updater;
18
+ }
19
+ }
20
+ exports.ProductManual = ProductManual;
@@ -0,0 +1,27 @@
1
+ import { LifeCycle } from "../../lifecycle/Lifecycle";
2
+ import { Creator } from "../../by/Creator";
3
+ import { Updater } from "../../by/Updater";
4
+ import { GenericVersion } from "../../version/GenericVersion";
5
+ import { Urn } from "../../definition/urn/Urn";
6
+ export declare class ProductPanelWeb {
7
+ format: string;
8
+ url: string;
9
+ constructor(format: string, url: string);
10
+ }
11
+ export declare class ProductPanelMiniApp {
12
+ appId: string;
13
+ constructor(appId: string);
14
+ }
15
+ export declare class ProductPanel {
16
+ status: string;
17
+ lifecycle: LifeCycle;
18
+ category: string;
19
+ type: string;
20
+ web: ProductPanelWeb | null;
21
+ miniapp: ProductPanelMiniApp | null;
22
+ version: GenericVersion;
23
+ instance: Urn;
24
+ creator: Creator | null;
25
+ updater: Updater | null;
26
+ constructor(status: string, lifecycle: LifeCycle | undefined, category: string, type: string, web: ProductPanelWeb | null, miniapp: ProductPanelMiniApp | null, version: GenericVersion, instance: Urn, creator?: Creator | null, updater?: Updater | null);
27
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductPanel = exports.ProductPanelMiniApp = exports.ProductPanelWeb = void 0;
4
+ const Lifecycle_1 = require("../../lifecycle/Lifecycle");
5
+ class ProductPanelWeb {
6
+ constructor(format, url) {
7
+ this.format = format;
8
+ this.url = url;
9
+ }
10
+ }
11
+ exports.ProductPanelWeb = ProductPanelWeb;
12
+ class ProductPanelMiniApp {
13
+ constructor(appId) {
14
+ this.appId = appId;
15
+ }
16
+ }
17
+ exports.ProductPanelMiniApp = ProductPanelMiniApp;
18
+ class ProductPanel {
19
+ constructor(status, lifecycle = Lifecycle_1.LifeCycle.DEVELOPMENT, category, type, web, miniapp, version, instance, creator = null, updater = null) {
20
+ this.status = status;
21
+ this.lifecycle = lifecycle;
22
+ this.category = category;
23
+ this.type = type;
24
+ this.web = web;
25
+ this.miniapp = miniapp;
26
+ this.version = version;
27
+ this.instance = instance;
28
+ this.creator = creator;
29
+ this.updater = updater;
30
+ }
31
+ }
32
+ exports.ProductPanel = ProductPanel;
@@ -0,0 +1,16 @@
1
+ import { LifeCycle } from "../../lifecycle/Lifecycle";
2
+ import { Creator } from "../../by/Creator";
3
+ import { Updater } from "../../by/Updater";
4
+ export declare class ProductWizardStep {
5
+ index: number;
6
+ image: string;
7
+ description: string;
8
+ constructor(index?: number, image?: string, description?: string);
9
+ }
10
+ export declare class ProductWizard {
11
+ steps: ProductWizardStep[];
12
+ lifecycle: LifeCycle;
13
+ creator: Creator | null;
14
+ updater: Updater | null;
15
+ constructor(steps?: ProductWizardStep[], lifecycle?: LifeCycle, creator?: Creator | null, updater?: Updater | null);
16
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductWizard = exports.ProductWizardStep = void 0;
4
+ const Lifecycle_1 = require("../../lifecycle/Lifecycle");
5
+ class ProductWizardStep {
6
+ constructor(index = 0, image = '', description = '') {
7
+ this.index = index;
8
+ this.image = image;
9
+ this.description = description;
10
+ }
11
+ }
12
+ exports.ProductWizardStep = ProductWizardStep;
13
+ class ProductWizard {
14
+ constructor(steps = [], lifecycle = Lifecycle_1.LifeCycle.DEVELOPMENT, creator = null, updater = null) {
15
+ this.steps = steps;
16
+ this.lifecycle = lifecycle;
17
+ this.creator = creator;
18
+ this.updater = updater;
19
+ }
20
+ }
21
+ exports.ProductWizard = ProductWizard;
@@ -0,0 +1,5 @@
1
+ export declare class GenericVersion {
2
+ name: string;
3
+ code: number;
4
+ constructor(name: string, code: number);
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenericVersion = void 0;
4
+ class GenericVersion {
5
+ constructor(name, code) {
6
+ this.name = name;
7
+ this.code = code;
8
+ }
9
+ }
10
+ exports.GenericVersion = GenericVersion;
@@ -1,9 +1,8 @@
1
- export declare class Version {
1
+ export declare class SemanticVersion {
2
2
  major: number;
3
3
  minor: number;
4
4
  patch: number;
5
5
  constructor(major: number, minor: number, patch: number);
6
- static fromString(version: string): Version;
6
+ static fromString(version: string): SemanticVersion;
7
7
  toString(): string;
8
- greaterThan(other: Version): boolean;
9
8
  }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SemanticVersion = void 0;
4
+ class SemanticVersion {
5
+ constructor(major, minor, patch) {
6
+ this.major = major;
7
+ this.minor = minor;
8
+ this.patch = patch;
9
+ }
10
+ static fromString(version) {
11
+ const s = version.split('.');
12
+ const x = Number.parseInt(s[0]);
13
+ const y = Number.parseInt(s[1]);
14
+ const z = Number.parseInt(s[2]);
15
+ return new SemanticVersion(x, y, z);
16
+ }
17
+ toString() {
18
+ return `${this.major}.${this.minor}.${this.patch}`;
19
+ }
20
+ }
21
+ exports.SemanticVersion = SemanticVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openxiot/xiot-core-spec-ts",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "XIOT Specification Codec",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,7 +0,0 @@
1
- import { Product } from '../../typedef/product/Product';
2
- export declare class ProductCodec {
3
- static decode(o: any): Product;
4
- static encode(x: Product): any;
5
- static decodeArray(arr: any[]): Product[];
6
- static encodeArray(products: Product[]): any[];
7
- }