@openxiot/xiot-core-spec-ts 0.0.6 → 0.0.7

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 (46) hide show
  1. package/dist/index.d.ts +0 -11
  2. package/dist/index.js +0 -11
  3. package/dist/xiot/core/spec/codec/template/DeviceTemplateCodec.js +5 -1
  4. package/dist/xiot/core/spec/typedef/definition/ActionDefinition.d.ts +2 -1
  5. package/dist/xiot/core/spec/typedef/definition/ActionDefinition.js +3 -1
  6. package/dist/xiot/core/spec/typedef/definition/DeviceDefinition.d.ts +2 -1
  7. package/dist/xiot/core/spec/typedef/definition/DeviceDefinition.js +3 -1
  8. package/dist/xiot/core/spec/typedef/definition/EventDefinition.d.ts +2 -1
  9. package/dist/xiot/core/spec/typedef/definition/EventDefinition.js +3 -1
  10. package/dist/xiot/core/spec/typedef/definition/FormatDefinition.d.ts +2 -1
  11. package/dist/xiot/core/spec/typedef/definition/FormatDefinition.js +3 -1
  12. package/dist/xiot/core/spec/typedef/definition/PropertyDefinition.d.ts +2 -1
  13. package/dist/xiot/core/spec/typedef/definition/PropertyDefinition.js +3 -1
  14. package/dist/xiot/core/spec/typedef/definition/ServiceDefinition.d.ts +2 -1
  15. package/dist/xiot/core/spec/typedef/definition/ServiceDefinition.js +3 -1
  16. package/dist/xiot/core/spec/typedef/definition/UnitDefinition.d.ts +2 -1
  17. package/dist/xiot/core/spec/typedef/definition/UnitDefinition.js +3 -1
  18. package/dist/xiot/core/spec/typedef/instance/DeviceInstance.d.ts +2 -1
  19. package/dist/xiot/core/spec/typedef/instance/DeviceInstance.js +3 -1
  20. package/dist/xiot/core/spec/typedef/lifecycle/WithLifecycle.d.ts +4 -0
  21. package/dist/xiot/core/spec/typedef/lifecycle/WithLifecycle.js +10 -0
  22. package/dist/xiot/core/spec/typedef/template/DeviceTemplate.d.ts +2 -4
  23. package/dist/xiot/core/spec/typedef/template/DeviceTemplate.js +3 -4
  24. package/package.json +1 -1
  25. package/dist/xiot/core/spec/codec/lifecycle/definition/ActionDefinitionWithLifecycleCodec.d.ts +0 -11
  26. package/dist/xiot/core/spec/codec/lifecycle/definition/ActionDefinitionWithLifecycleCodec.js +0 -38
  27. package/dist/xiot/core/spec/codec/lifecycle/definition/DeviceDefinitionWithLifecycleCodec.d.ts +0 -11
  28. package/dist/xiot/core/spec/codec/lifecycle/definition/DeviceDefinitionWithLifecycleCodec.js +0 -38
  29. package/dist/xiot/core/spec/codec/lifecycle/definition/EventDefinitionWithLifecycleCodec.d.ts +0 -11
  30. package/dist/xiot/core/spec/codec/lifecycle/definition/EventDefinitionWithLifecycleCodec.js +0 -38
  31. package/dist/xiot/core/spec/codec/lifecycle/definition/FormatDefinitionWithLifecycleCodec.d.ts +0 -11
  32. package/dist/xiot/core/spec/codec/lifecycle/definition/FormatDefinitionWithLifecycleCodec.js +0 -38
  33. package/dist/xiot/core/spec/codec/lifecycle/definition/PropertyDefinitionWithLifecycleCodec.d.ts +0 -8
  34. package/dist/xiot/core/spec/codec/lifecycle/definition/PropertyDefinitionWithLifecycleCodec.js +0 -38
  35. package/dist/xiot/core/spec/codec/lifecycle/definition/ServiceDefinitionWithLifecycleCodec.d.ts +0 -11
  36. package/dist/xiot/core/spec/codec/lifecycle/definition/ServiceDefinitionWithLifecycleCodec.js +0 -38
  37. package/dist/xiot/core/spec/codec/lifecycle/definition/UnitDefinitionWithLifecycleCodec.d.ts +0 -11
  38. package/dist/xiot/core/spec/codec/lifecycle/definition/UnitDefinitionWithLifecycleCodec.js +0 -38
  39. package/dist/xiot/core/spec/codec/lifecycle/instance/DeviceInstanceWithLifecycleCodec.d.ts +0 -11
  40. package/dist/xiot/core/spec/codec/lifecycle/instance/DeviceInstanceWithLifecycleCodec.js +0 -38
  41. package/dist/xiot/core/spec/codec/lifecycle/product/VersionWithLifecycleCodec.d.ts +0 -10
  42. package/dist/xiot/core/spec/codec/lifecycle/product/VersionWithLifecycleCodec.js +0 -42
  43. package/dist/xiot/core/spec/codec/lifecycle/template/DeviceTemplateWithLifecycleCodec.d.ts +0 -11
  44. package/dist/xiot/core/spec/codec/lifecycle/template/DeviceTemplateWithLifecycleCodec.js +0 -38
  45. package/dist/xiot/core/spec/codec/lifecycle/type/DeviceTypeWithLifecycleCodec.d.ts +0 -12
  46. package/dist/xiot/core/spec/codec/lifecycle/type/DeviceTypeWithLifecycleCodec.js +0 -36
package/dist/index.d.ts CHANGED
@@ -230,17 +230,6 @@ export * from './xiot/core/spec/codec/key/AccessKeyCodec';
230
230
  export * from './xiot/core/spec/codec/key/DeviceKeyCodec';
231
231
  export * from './xiot/core/spec/codec/key/DeviceCertCodec';
232
232
  export * from './xiot/core/spec/codec/lifecycle/app/ApplicationWithLifecycleCodec';
233
- export * from './xiot/core/spec/codec/lifecycle/definition/ActionDefinitionWithLifecycleCodec';
234
- export * from './xiot/core/spec/codec/lifecycle/definition/DeviceDefinitionWithLifecycleCodec';
235
- export * from './xiot/core/spec/codec/lifecycle/definition/EventDefinitionWithLifecycleCodec';
236
- export * from './xiot/core/spec/codec/lifecycle/definition/FormatDefinitionWithLifecycleCodec';
237
- export * from './xiot/core/spec/codec/lifecycle/definition/PropertyDefinitionWithLifecycleCodec';
238
- export * from './xiot/core/spec/codec/lifecycle/definition/ServiceDefinitionWithLifecycleCodec';
239
- export * from './xiot/core/spec/codec/lifecycle/definition/UnitDefinitionWithLifecycleCodec';
240
- export * from './xiot/core/spec/codec/lifecycle/instance/DeviceInstanceWithLifecycleCodec';
241
- export * from './xiot/core/spec/codec/lifecycle/product/VersionWithLifecycleCodec';
242
- export * from './xiot/core/spec/codec/lifecycle/template/DeviceTemplateWithLifecycleCodec';
243
- export * from './xiot/core/spec/codec/lifecycle/type/DeviceTypeWithLifecycleCodec';
244
233
  export * from './xiot/core/spec/codec/notice/DeviceNoticeCodec';
245
234
  export * from './xiot/core/spec/codec/notice/device/DeviceAccessKeyChangedCodec';
246
235
  export * from './xiot/core/spec/codec/notice/device/DeviceChildrenAddedCodec';
package/dist/index.js CHANGED
@@ -246,17 +246,6 @@ __exportStar(require("./xiot/core/spec/codec/key/AccessKeyCodec"), exports);
246
246
  __exportStar(require("./xiot/core/spec/codec/key/DeviceKeyCodec"), exports);
247
247
  __exportStar(require("./xiot/core/spec/codec/key/DeviceCertCodec"), exports);
248
248
  __exportStar(require("./xiot/core/spec/codec/lifecycle/app/ApplicationWithLifecycleCodec"), exports);
249
- __exportStar(require("./xiot/core/spec/codec/lifecycle/definition/ActionDefinitionWithLifecycleCodec"), exports);
250
- __exportStar(require("./xiot/core/spec/codec/lifecycle/definition/DeviceDefinitionWithLifecycleCodec"), exports);
251
- __exportStar(require("./xiot/core/spec/codec/lifecycle/definition/EventDefinitionWithLifecycleCodec"), exports);
252
- __exportStar(require("./xiot/core/spec/codec/lifecycle/definition/FormatDefinitionWithLifecycleCodec"), exports);
253
- __exportStar(require("./xiot/core/spec/codec/lifecycle/definition/PropertyDefinitionWithLifecycleCodec"), exports);
254
- __exportStar(require("./xiot/core/spec/codec/lifecycle/definition/ServiceDefinitionWithLifecycleCodec"), exports);
255
- __exportStar(require("./xiot/core/spec/codec/lifecycle/definition/UnitDefinitionWithLifecycleCodec"), exports);
256
- __exportStar(require("./xiot/core/spec/codec/lifecycle/instance/DeviceInstanceWithLifecycleCodec"), exports);
257
- __exportStar(require("./xiot/core/spec/codec/lifecycle/product/VersionWithLifecycleCodec"), exports);
258
- __exportStar(require("./xiot/core/spec/codec/lifecycle/template/DeviceTemplateWithLifecycleCodec"), exports);
259
- __exportStar(require("./xiot/core/spec/codec/lifecycle/type/DeviceTypeWithLifecycleCodec"), exports);
260
249
  __exportStar(require("./xiot/core/spec/codec/notice/DeviceNoticeCodec"), exports);
261
250
  __exportStar(require("./xiot/core/spec/codec/notice/device/DeviceAccessKeyChangedCodec"), exports);
262
251
  __exportStar(require("./xiot/core/spec/codec/notice/device/DeviceChildrenAddedCodec"), exports);
@@ -6,12 +6,16 @@ const DeviceType_1 = require("../../typedef/definition/urn/DeviceType");
6
6
  const DescriptionCodec_1 = require("../definition/DescriptionCodec");
7
7
  const Spec_1 = require("../../typedef/constant/Spec");
8
8
  const ServiceTemplateCodec_1 = require("./ServiceTemplateCodec");
9
+ const Lifecycle_1 = require("@openxiot/xiot-core-spec-ts/xiot/core/spec/typedef/lifecycle/Lifecycle");
9
10
  class DeviceTemplateCodec {
10
11
  static decode(o) {
12
+ const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || '');
11
13
  const type = new DeviceType_1.DeviceType(o[Spec_1.Spec.TYPE]);
12
14
  const description = DescriptionCodec_1.DescriptionCodec.decode(o[Spec_1.Spec.DESCRIPTION]);
13
15
  const services = ServiceTemplateCodec_1.ServiceTemplateCodec.decodeArray(o[Spec_1.Spec.SERVICES]);
14
- return new DeviceTemplate_1.DeviceTemplate(type, description, services);
16
+ const template = new DeviceTemplate_1.DeviceTemplate(type, description, services);
17
+ template.lifecycle = lifecycle;
18
+ return template;
15
19
  }
16
20
  static encode(device) {
17
21
  return {
@@ -1,6 +1,7 @@
1
1
  import { ActionType } from './urn/ActionType';
2
2
  import { ArgumentDefinition } from './ArgumentDefinition';
3
- export declare class ActionDefinition {
3
+ import { WithLifecycle } from '../lifecycle/WithLifecycle';
4
+ export declare class ActionDefinition extends WithLifecycle {
4
5
  type: ActionType;
5
6
  description: Map<string, string>;
6
7
  in: ArgumentDefinition[];
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActionDefinition = void 0;
4
- class ActionDefinition {
4
+ const WithLifecycle_1 = require("../lifecycle/WithLifecycle");
5
+ class ActionDefinition extends WithLifecycle_1.WithLifecycle {
5
6
  constructor(type, description, argumentsIn, argumentsOut) {
7
+ super();
6
8
  this.description = new Map();
7
9
  this.in = [];
8
10
  this.out = [];
@@ -1,5 +1,6 @@
1
1
  import { DeviceType } from './urn/DeviceType';
2
- export declare class DeviceDefinition {
2
+ import { WithLifecycle } from '../lifecycle/WithLifecycle';
3
+ export declare class DeviceDefinition extends WithLifecycle {
3
4
  category: string;
4
5
  type: DeviceType;
5
6
  description: Map<string, string>;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DeviceDefinition = void 0;
4
- class DeviceDefinition {
4
+ const WithLifecycle_1 = require("../lifecycle/WithLifecycle");
5
+ class DeviceDefinition extends WithLifecycle_1.WithLifecycle {
5
6
  constructor(category, type, description) {
7
+ super();
6
8
  this.description = new Map();
7
9
  this.category = category;
8
10
  this.type = type;
@@ -1,6 +1,7 @@
1
1
  import { EventType } from './urn/EventType';
2
2
  import { ArgumentDefinition } from './ArgumentDefinition';
3
- export declare class EventDefinition {
3
+ import { WithLifecycle } from '../lifecycle/WithLifecycle';
4
+ export declare class EventDefinition extends WithLifecycle {
4
5
  type: EventType;
5
6
  description: Map<string, string>;
6
7
  arguments: ArgumentDefinition[];
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EventDefinition = void 0;
4
- class EventDefinition {
4
+ const WithLifecycle_1 = require("../lifecycle/WithLifecycle");
5
+ class EventDefinition extends WithLifecycle_1.WithLifecycle {
5
6
  constructor(type, description, a) {
7
+ super();
6
8
  this.description = new Map();
7
9
  this.arguments = [];
8
10
  this.type = type;
@@ -1,5 +1,6 @@
1
1
  import { FormatType } from './urn/FormatType';
2
- export declare class FormatDefinition {
2
+ import { WithLifecycle } from '../lifecycle/WithLifecycle';
3
+ export declare class FormatDefinition extends WithLifecycle {
3
4
  type: FormatType;
4
5
  description: Map<string, string>;
5
6
  constructor(type: FormatType, description: Map<string, string>);
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FormatDefinition = void 0;
4
- class FormatDefinition {
4
+ const WithLifecycle_1 = require("../lifecycle/WithLifecycle");
5
+ class FormatDefinition extends WithLifecycle_1.WithLifecycle {
5
6
  constructor(type, description) {
7
+ super();
6
8
  this.description = new Map();
7
9
  this.type = type;
8
10
  this.description = description;
@@ -4,7 +4,8 @@ import { Access } from './property/Access';
4
4
  import { ConstraintValue } from './property/ConstraintValue';
5
5
  import { ValueRange } from "./property/ValueRange";
6
6
  import { ValueList } from "./property/ValueList";
7
- export declare class PropertyDefinition {
7
+ import { WithLifecycle } from '../lifecycle/WithLifecycle';
8
+ export declare class PropertyDefinition extends WithLifecycle {
8
9
  type: PropertyType;
9
10
  description: Map<string, string>;
10
11
  format: DataFormat;
@@ -5,8 +5,10 @@ const DataFormat_1 = require("./property/data/DataFormat");
5
5
  const Access_1 = require("./property/Access");
6
6
  const ValueRange_1 = require("./property/ValueRange");
7
7
  const ValueList_1 = require("./property/ValueList");
8
- class PropertyDefinition {
8
+ const WithLifecycle_1 = require("../lifecycle/WithLifecycle");
9
+ class PropertyDefinition extends WithLifecycle_1.WithLifecycle {
9
10
  constructor(type, description) {
11
+ super();
10
12
  this.description = new Map();
11
13
  this.format = DataFormat_1.DataFormat.BOOL;
12
14
  this.access = new Access_1.Access();
@@ -2,7 +2,8 @@ import { ServiceType } from './urn/ServiceType';
2
2
  import { PropertyType } from './urn/PropertyType';
3
3
  import { ActionType } from './urn/ActionType';
4
4
  import { EventType } from './urn/EventType';
5
- export declare class ServiceDefinition {
5
+ import { WithLifecycle } from '../lifecycle/WithLifecycle';
6
+ export declare class ServiceDefinition extends WithLifecycle {
6
7
  type: ServiceType;
7
8
  description: Map<string, string>;
8
9
  requiredProperties: PropertyType[];
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ServiceDefinition = void 0;
4
- class ServiceDefinition {
4
+ const WithLifecycle_1 = require("../lifecycle/WithLifecycle");
5
+ class ServiceDefinition extends WithLifecycle_1.WithLifecycle {
5
6
  constructor(type, description, requiredProperties, optionalProperties, requiredActions, optionalActions, requiredEvents, optionalEvents) {
7
+ super();
6
8
  this.description = new Map();
7
9
  this.requiredProperties = [];
8
10
  this.optionalProperties = [];
@@ -1,5 +1,6 @@
1
1
  import { UnitType } from './urn/UnitType';
2
- export declare class UnitDefinition {
2
+ import { WithLifecycle } from '../lifecycle/WithLifecycle';
3
+ export declare class UnitDefinition extends WithLifecycle {
3
4
  type: UnitType;
4
5
  description: Map<string, string>;
5
6
  constructor(type: UnitType, description: Map<string, string>);
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UnitDefinition = void 0;
4
- class UnitDefinition {
4
+ const WithLifecycle_1 = require("../lifecycle/WithLifecycle");
5
+ class UnitDefinition extends WithLifecycle_1.WithLifecycle {
5
6
  constructor(type, description) {
7
+ super();
6
8
  this.description = new Map();
7
9
  this.type = type;
8
10
  this.description = description;
@@ -1,6 +1,7 @@
1
1
  import { Service } from './Service';
2
2
  import { Urn } from "../definition/urn/Urn";
3
- export declare class DeviceInstance {
3
+ import { WithLifecycle } from '../lifecycle/WithLifecycle';
4
+ export declare class DeviceInstance extends WithLifecycle {
4
5
  type: Urn;
5
6
  description: Map<string, string>;
6
7
  services: Map<number, Service>;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DeviceInstance = void 0;
4
- class DeviceInstance {
4
+ const WithLifecycle_1 = require("../lifecycle/WithLifecycle");
5
+ class DeviceInstance extends WithLifecycle_1.WithLifecycle {
5
6
  constructor(type, description, services) {
7
+ super();
6
8
  this.type = type;
7
9
  this.description = description;
8
10
  this.services = new Map();
@@ -0,0 +1,4 @@
1
+ import { LifeCycle } from './Lifecycle';
2
+ export declare abstract class WithLifecycle {
3
+ lifecycle: LifeCycle;
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WithLifecycle = void 0;
4
+ const Lifecycle_1 = require("./Lifecycle");
5
+ class WithLifecycle {
6
+ constructor() {
7
+ this.lifecycle = Lifecycle_1.LifeCycle.UNDEFINED;
8
+ }
9
+ }
10
+ exports.WithLifecycle = WithLifecycle;
@@ -1,9 +1,7 @@
1
1
  import { DeviceType } from '../definition/urn/DeviceType';
2
2
  import { ServiceTemplate } from './ServiceTemplate';
3
- /**
4
- * ouyang
5
- */
6
- export declare class DeviceTemplate {
3
+ import { WithLifecycle } from '../lifecycle/WithLifecycle';
4
+ export declare class DeviceTemplate extends WithLifecycle {
7
5
  type: DeviceType;
8
6
  description: Map<string, string>;
9
7
  services: Map<number, ServiceTemplate>;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DeviceTemplate = void 0;
4
- /**
5
- * ouyang
6
- */
7
- class DeviceTemplate {
4
+ const WithLifecycle_1 = require("../lifecycle/WithLifecycle");
5
+ class DeviceTemplate extends WithLifecycle_1.WithLifecycle {
8
6
  constructor(type, description, services) {
7
+ super();
9
8
  this.description = new Map();
10
9
  this.services = new Map();
11
10
  this.type = type;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openxiot/xiot-core-spec-ts",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "XIOT Specification Codec",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,11 +0,0 @@
1
- import { ActionDefinition } from '../../../typedef/definition/ActionDefinition';
2
- import { ObjectWithLifecycle } from '../../../typedef/lifecycle/ObjectWithLifecycle';
3
- export declare class ActionDefinitionWithLifecycleCodec {
4
- static encode(obj: ObjectWithLifecycle<ActionDefinition>): {
5
- lifecycle: string;
6
- definition: any;
7
- };
8
- static encodeArray(resource: ObjectWithLifecycle<ActionDefinition>[]): any[];
9
- static decode(o: any): ObjectWithLifecycle<ActionDefinition>;
10
- static decodeArray(arr: any[]): ObjectWithLifecycle<ActionDefinition>[];
11
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActionDefinitionWithLifecycleCodec = void 0;
4
- const ObjectWithLifecycle_1 = require("../../../typedef/lifecycle/ObjectWithLifecycle");
5
- const ActionDefinitionCodec_1 = require("../../definition/ActionDefinitionCodec");
6
- const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
7
- class ActionDefinitionWithLifecycleCodec {
8
- static encode(obj) {
9
- return {
10
- lifecycle: obj.lifecycle.toString(),
11
- definition: ActionDefinitionCodec_1.ActionDefinitionCodec.encode(obj.value)
12
- };
13
- }
14
- static encodeArray(resource) {
15
- const arr = [];
16
- resource.forEach(item => {
17
- arr.push(this.encode(item));
18
- });
19
- return arr;
20
- }
21
- static decode(o) {
22
- const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || '');
23
- const definition = o.definition;
24
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, ActionDefinitionCodec_1.ActionDefinitionCodec.decode(definition));
25
- }
26
- static decodeArray(arr) {
27
- const list = [];
28
- if (arr === null || arr === void 0 ? void 0 : arr.length) {
29
- for (const o of arr) {
30
- if (typeof o === 'object') {
31
- list.push(this.decode(o));
32
- }
33
- }
34
- }
35
- return list;
36
- }
37
- }
38
- exports.ActionDefinitionWithLifecycleCodec = ActionDefinitionWithLifecycleCodec;
@@ -1,11 +0,0 @@
1
- import { ObjectWithLifecycle } from '../../../typedef/lifecycle/ObjectWithLifecycle';
2
- import { DeviceDefinition } from '../../../typedef/definition/DeviceDefinition';
3
- export declare class DeviceDefinitionWithLifecycleCodec {
4
- static encode(obj: ObjectWithLifecycle<DeviceDefinition>): {
5
- lifecycle: string;
6
- definition: any;
7
- };
8
- static encodeArray(resource: ObjectWithLifecycle<DeviceDefinition>[]): any[];
9
- static decode(o: any): ObjectWithLifecycle<DeviceDefinition>;
10
- static decodeArray(arr: any[]): ObjectWithLifecycle<DeviceDefinition>[];
11
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeviceDefinitionWithLifecycleCodec = void 0;
4
- const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
5
- const ObjectWithLifecycle_1 = require("../../../typedef/lifecycle/ObjectWithLifecycle");
6
- const DeviceDefinitionCodec_1 = require("../../definition/DeviceDefinitionCodec");
7
- class DeviceDefinitionWithLifecycleCodec {
8
- static encode(obj) {
9
- return {
10
- lifecycle: obj.lifecycle.toString(),
11
- definition: DeviceDefinitionCodec_1.DeviceDefinitionCodec.encode(obj.value)
12
- };
13
- }
14
- static encodeArray(resource) {
15
- const arr = [];
16
- resource.forEach(item => {
17
- arr.push(this.encode(item));
18
- });
19
- return arr;
20
- }
21
- static decode(o) {
22
- const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || '');
23
- const definition = o.definition;
24
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, DeviceDefinitionCodec_1.DeviceDefinitionCodec.decode(definition));
25
- }
26
- static decodeArray(arr) {
27
- const list = [];
28
- if (arr === null || arr === void 0 ? void 0 : arr.length) {
29
- for (const o of arr) {
30
- if (typeof o === 'object') {
31
- list.push(this.decode(o));
32
- }
33
- }
34
- }
35
- return list;
36
- }
37
- }
38
- exports.DeviceDefinitionWithLifecycleCodec = DeviceDefinitionWithLifecycleCodec;
@@ -1,11 +0,0 @@
1
- import { EventDefinition } from '../../../typedef/definition/EventDefinition';
2
- import { ObjectWithLifecycle } from '../../../typedef/lifecycle/ObjectWithLifecycle';
3
- export declare class EventDefinitionWithLifecycleCodec {
4
- static encode(obj: ObjectWithLifecycle<EventDefinition>): {
5
- lifecycle: string;
6
- definition: any;
7
- };
8
- static encodeArray(resource: ObjectWithLifecycle<EventDefinition>[]): any[];
9
- static decode(o: any): ObjectWithLifecycle<EventDefinition>;
10
- static decodeArray(arr: any[]): ObjectWithLifecycle<EventDefinition>[];
11
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventDefinitionWithLifecycleCodec = void 0;
4
- const ObjectWithLifecycle_1 = require("../../../typedef/lifecycle/ObjectWithLifecycle");
5
- const EventDefinitionCodec_1 = require("../../definition/EventDefinitionCodec");
6
- const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
7
- class EventDefinitionWithLifecycleCodec {
8
- static encode(obj) {
9
- return {
10
- lifecycle: obj.lifecycle.toString(),
11
- definition: EventDefinitionCodec_1.EventDefinitionCodec.encode(obj.value)
12
- };
13
- }
14
- static encodeArray(resource) {
15
- const arr = [];
16
- resource.forEach(item => {
17
- arr.push(this.encode(item));
18
- });
19
- return arr;
20
- }
21
- static decode(o) {
22
- const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || '');
23
- const definition = o.definition;
24
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, EventDefinitionCodec_1.EventDefinitionCodec.decode(definition));
25
- }
26
- static decodeArray(arr) {
27
- const list = [];
28
- if (arr === null || arr === void 0 ? void 0 : arr.length) {
29
- for (const o of arr) {
30
- if (typeof o === 'object') {
31
- list.push(this.decode(o));
32
- }
33
- }
34
- }
35
- return list;
36
- }
37
- }
38
- exports.EventDefinitionWithLifecycleCodec = EventDefinitionWithLifecycleCodec;
@@ -1,11 +0,0 @@
1
- import { ObjectWithLifecycle } from '../../../typedef/lifecycle/ObjectWithLifecycle';
2
- import { FormatDefinition } from '../../../typedef/definition/FormatDefinition';
3
- export declare class FormatDefinitionWithLifecycleCodec {
4
- static encode(obj: ObjectWithLifecycle<FormatDefinition>): {
5
- lifecycle: string;
6
- definition: any;
7
- };
8
- static encodeArray(resource: ObjectWithLifecycle<FormatDefinition>[]): any[];
9
- static decode(o: any): ObjectWithLifecycle<FormatDefinition>;
10
- static decodeArray(arr: any[]): ObjectWithLifecycle<FormatDefinition>[];
11
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormatDefinitionWithLifecycleCodec = void 0;
4
- const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
5
- const ObjectWithLifecycle_1 = require("../../../typedef/lifecycle/ObjectWithLifecycle");
6
- const FormatDefinitionCodec_1 = require("../../definition/FormatDefinitionCodec");
7
- class FormatDefinitionWithLifecycleCodec {
8
- static encode(obj) {
9
- return {
10
- lifecycle: obj.lifecycle.toString(),
11
- definition: FormatDefinitionCodec_1.FormatDefinitionCodec.encode(obj.value)
12
- };
13
- }
14
- static encodeArray(resource) {
15
- const arr = [];
16
- resource.forEach(item => {
17
- arr.push(this.encode(item));
18
- });
19
- return arr;
20
- }
21
- static decode(o) {
22
- const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || '');
23
- const definition = o.definition;
24
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, FormatDefinitionCodec_1.FormatDefinitionCodec.decode(definition));
25
- }
26
- static decodeArray(arr) {
27
- const list = [];
28
- if (arr === null || arr === void 0 ? void 0 : arr.length) {
29
- for (const o of arr) {
30
- if (typeof o === 'object') {
31
- list.push(this.decode(o));
32
- }
33
- }
34
- }
35
- return list;
36
- }
37
- }
38
- exports.FormatDefinitionWithLifecycleCodec = FormatDefinitionWithLifecycleCodec;
@@ -1,8 +0,0 @@
1
- import { ObjectWithLifecycle } from '../../../typedef/lifecycle/ObjectWithLifecycle';
2
- import { PropertyDefinition } from '../../../typedef/definition/PropertyDefinition';
3
- export declare class PropertyDefinitionWithLifecycleCodec {
4
- static encode(obj: ObjectWithLifecycle<PropertyDefinition>): any;
5
- static encodeArray(resource: ObjectWithLifecycle<PropertyDefinition>[]): any[];
6
- static decode(o: any): ObjectWithLifecycle<PropertyDefinition>;
7
- static decodeArray(arr: any[]): ObjectWithLifecycle<PropertyDefinition>[];
8
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PropertyDefinitionWithLifecycleCodec = void 0;
4
- const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
5
- const ObjectWithLifecycle_1 = require("../../../typedef/lifecycle/ObjectWithLifecycle");
6
- const PropertyDefinitionCodec_1 = require("../../definition/PropertyDefinitionCodec");
7
- class PropertyDefinitionWithLifecycleCodec {
8
- static encode(obj) {
9
- return {
10
- lifecycle: obj.lifecycle.toString(),
11
- definition: PropertyDefinitionCodec_1.PropertyDefinitionCodec.encode(obj.value)
12
- };
13
- }
14
- static encodeArray(resource) {
15
- const arr = [];
16
- resource.forEach(item => {
17
- arr.push(this.encode(item));
18
- });
19
- return arr;
20
- }
21
- static decode(o) {
22
- const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || '');
23
- const definition = o.definition;
24
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, PropertyDefinitionCodec_1.PropertyDefinitionCodec.decode(definition));
25
- }
26
- static decodeArray(arr) {
27
- const list = [];
28
- if (arr === null || arr === void 0 ? void 0 : arr.length) {
29
- for (const o of arr) {
30
- if (typeof o === 'object') {
31
- list.push(this.decode(o));
32
- }
33
- }
34
- }
35
- return list;
36
- }
37
- }
38
- exports.PropertyDefinitionWithLifecycleCodec = PropertyDefinitionWithLifecycleCodec;
@@ -1,11 +0,0 @@
1
- import { ObjectWithLifecycle } from '../../../typedef/lifecycle/ObjectWithLifecycle';
2
- import { ServiceDefinition } from '../../../typedef/definition/ServiceDefinition';
3
- export declare class ServiceDefinitionWithLifecycleCodec {
4
- static encode(obj: ObjectWithLifecycle<ServiceDefinition>): {
5
- lifecycle: string;
6
- definition: any;
7
- };
8
- static encodeArray(resource: ObjectWithLifecycle<ServiceDefinition>[]): any[];
9
- static decode(o: any): ObjectWithLifecycle<ServiceDefinition>;
10
- static decodeArray(arr: any[]): ObjectWithLifecycle<ServiceDefinition>[];
11
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ServiceDefinitionWithLifecycleCodec = void 0;
4
- const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
5
- const ObjectWithLifecycle_1 = require("../../../typedef/lifecycle/ObjectWithLifecycle");
6
- const ServiceDefinitionCodec_1 = require("../../definition/ServiceDefinitionCodec");
7
- class ServiceDefinitionWithLifecycleCodec {
8
- static encode(obj) {
9
- return {
10
- lifecycle: obj.lifecycle.toString(),
11
- definition: ServiceDefinitionCodec_1.ServiceDefinitionCodec.encode(obj.value)
12
- };
13
- }
14
- static encodeArray(resource) {
15
- const arr = [];
16
- resource.forEach(item => {
17
- arr.push(this.encode(item));
18
- });
19
- return arr;
20
- }
21
- static decode(o) {
22
- const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || '');
23
- const definition = o.definition;
24
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, ServiceDefinitionCodec_1.ServiceDefinitionCodec.decode(definition));
25
- }
26
- static decodeArray(arr) {
27
- const list = [];
28
- if (arr === null || arr === void 0 ? void 0 : arr.length) {
29
- for (const o of arr) {
30
- if (typeof o === 'object') {
31
- list.push(this.decode(o));
32
- }
33
- }
34
- }
35
- return list;
36
- }
37
- }
38
- exports.ServiceDefinitionWithLifecycleCodec = ServiceDefinitionWithLifecycleCodec;
@@ -1,11 +0,0 @@
1
- import { ObjectWithLifecycle } from '../../../typedef/lifecycle/ObjectWithLifecycle';
2
- import { UnitDefinition } from '../../../typedef/definition/UnitDefinition';
3
- export declare class UnitDefinitionWithLifecycleCodec {
4
- static encode(obj: ObjectWithLifecycle<UnitDefinition>): {
5
- lifecycle: string;
6
- definition: any;
7
- };
8
- static encodeArray(resource: ObjectWithLifecycle<UnitDefinition>[]): any[];
9
- static decode(o: any): ObjectWithLifecycle<UnitDefinition>;
10
- static decodeArray(arr: any[]): ObjectWithLifecycle<UnitDefinition>[];
11
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnitDefinitionWithLifecycleCodec = void 0;
4
- const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
5
- const ObjectWithLifecycle_1 = require("../../../typedef/lifecycle/ObjectWithLifecycle");
6
- const UnitDefinitionCodec_1 = require("../../definition/UnitDefinitionCodec");
7
- class UnitDefinitionWithLifecycleCodec {
8
- static encode(obj) {
9
- return {
10
- lifecycle: obj.lifecycle.toString(),
11
- definition: UnitDefinitionCodec_1.UnitDefinitionCodec.encode(obj.value)
12
- };
13
- }
14
- static encodeArray(resource) {
15
- const arr = [];
16
- resource.forEach(item => {
17
- arr.push(this.encode(item));
18
- });
19
- return arr;
20
- }
21
- static decode(o) {
22
- const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || '');
23
- const definition = o.definition;
24
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, UnitDefinitionCodec_1.UnitDefinitionCodec.decode(definition));
25
- }
26
- static decodeArray(arr) {
27
- const list = [];
28
- if (arr === null || arr === void 0 ? void 0 : arr.length) {
29
- for (const o of arr) {
30
- if (typeof o === 'object') {
31
- list.push(this.decode(o));
32
- }
33
- }
34
- }
35
- return list;
36
- }
37
- }
38
- exports.UnitDefinitionWithLifecycleCodec = UnitDefinitionWithLifecycleCodec;
@@ -1,11 +0,0 @@
1
- import { ObjectWithLifecycle } from '../../../typedef/lifecycle/ObjectWithLifecycle';
2
- import { DeviceInstance } from '../../../typedef/instance/DeviceInstance';
3
- export declare class DeviceInstanceWithLifecycleCodec {
4
- static encode(obj: ObjectWithLifecycle<DeviceInstance>): {
5
- lifecycle: string;
6
- definition: any;
7
- };
8
- static encodeArray(resource: ObjectWithLifecycle<DeviceInstance>[]): any[];
9
- static decode(o: any): ObjectWithLifecycle<DeviceInstance>;
10
- static decodeArray(arr: any[]): ObjectWithLifecycle<DeviceInstance>[];
11
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeviceInstanceWithLifecycleCodec = void 0;
4
- const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
5
- const ObjectWithLifecycle_1 = require("../../../typedef/lifecycle/ObjectWithLifecycle");
6
- const DeviceInstanceCodec_1 = require("../../instance/DeviceInstanceCodec");
7
- class DeviceInstanceWithLifecycleCodec {
8
- static encode(obj) {
9
- return {
10
- lifecycle: obj.lifecycle.toString(),
11
- definition: DeviceInstanceCodec_1.DeviceInstanceCodec.encode(obj.value)
12
- };
13
- }
14
- static encodeArray(resource) {
15
- const arr = [];
16
- resource.forEach(item => {
17
- arr.push(this.encode(item));
18
- });
19
- return arr;
20
- }
21
- static decode(o) {
22
- const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || '');
23
- const definition = o.definition;
24
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, DeviceInstanceCodec_1.DeviceInstanceCodec.decode(definition));
25
- }
26
- static decodeArray(arr) {
27
- const list = [];
28
- if (arr === null || arr === void 0 ? void 0 : arr.length) {
29
- for (const o of arr) {
30
- if (typeof o === 'object') {
31
- list.push(this.decode(o));
32
- }
33
- }
34
- }
35
- return list;
36
- }
37
- }
38
- exports.DeviceInstanceWithLifecycleCodec = DeviceInstanceWithLifecycleCodec;
@@ -1,10 +0,0 @@
1
- import { ObjectWithLifecycle } from '../../../typedef/lifecycle/ObjectWithLifecycle';
2
- export declare class VersionWithLifecycleCodec {
3
- static encode(o: ObjectWithLifecycle<Number>): {
4
- lifecycle: string;
5
- version: Number;
6
- };
7
- static encodeArray(resource: ObjectWithLifecycle<Number>[]): any[];
8
- static decode(o: any): ObjectWithLifecycle<Number>;
9
- static decodeArray(arr: any[]): ObjectWithLifecycle<Number>[];
10
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VersionWithLifecycleCodec = void 0;
4
- const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
5
- const ObjectWithLifecycle_1 = require("../../../typedef/lifecycle/ObjectWithLifecycle");
6
- class VersionWithLifecycleCodec {
7
- static encode(o) {
8
- return {
9
- lifecycle: o.lifecycle.toString(),
10
- version: o.value
11
- };
12
- }
13
- static encodeArray(resource) {
14
- const arr = [];
15
- resource.forEach(item => {
16
- arr.push(this.encode(item));
17
- });
18
- return arr;
19
- }
20
- static decode(o) {
21
- const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || '');
22
- const version = o.version;
23
- if (typeof version === 'number') {
24
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, version);
25
- }
26
- else {
27
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, 0);
28
- }
29
- }
30
- static decodeArray(arr) {
31
- const list = [];
32
- if (arr === null || arr === void 0 ? void 0 : arr.length) {
33
- for (const o of arr) {
34
- if (typeof o === 'object') {
35
- list.push(this.decode(o));
36
- }
37
- }
38
- }
39
- return list;
40
- }
41
- }
42
- exports.VersionWithLifecycleCodec = VersionWithLifecycleCodec;
@@ -1,11 +0,0 @@
1
- import { ObjectWithLifecycle } from '../../../typedef/lifecycle/ObjectWithLifecycle';
2
- import { DeviceTemplate } from '../../../typedef/template/DeviceTemplate';
3
- export declare class DeviceTemplateWithLifecycleCodec {
4
- static encode(obj: ObjectWithLifecycle<DeviceTemplate>): {
5
- lifecycle: string;
6
- definition: any;
7
- };
8
- static encodeArray(resource: ObjectWithLifecycle<DeviceTemplate>[]): any[];
9
- static decode(o: any): ObjectWithLifecycle<DeviceTemplate>;
10
- static decodeArray(arr: any[]): ObjectWithLifecycle<DeviceTemplate>[];
11
- }
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeviceTemplateWithLifecycleCodec = void 0;
4
- const ObjectWithLifecycle_1 = require("../../../typedef/lifecycle/ObjectWithLifecycle");
5
- const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
6
- const DeviceTemplateCodec_1 = require("../../template/DeviceTemplateCodec");
7
- class DeviceTemplateWithLifecycleCodec {
8
- static encode(obj) {
9
- return {
10
- lifecycle: obj.lifecycle.toString(),
11
- definition: DeviceTemplateCodec_1.DeviceTemplateCodec.encode(obj.value)
12
- };
13
- }
14
- static encodeArray(resource) {
15
- const arr = [];
16
- resource.forEach(item => {
17
- arr.push(this.encode(item));
18
- });
19
- return arr;
20
- }
21
- static decode(o) {
22
- const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle || '');
23
- const definition = o.definition;
24
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, DeviceTemplateCodec_1.DeviceTemplateCodec.decode(definition));
25
- }
26
- static decodeArray(arr) {
27
- const list = [];
28
- if (arr === null || arr === void 0 ? void 0 : arr.length) {
29
- for (const o of arr) {
30
- if (typeof o === 'object') {
31
- list.push(this.decode(o));
32
- }
33
- }
34
- }
35
- return list;
36
- }
37
- }
38
- exports.DeviceTemplateWithLifecycleCodec = DeviceTemplateWithLifecycleCodec;
@@ -1,12 +0,0 @@
1
- import { ObjectWithLifecycle } from '../../../typedef/lifecycle/ObjectWithLifecycle';
2
- import { LifeCycle } from '../../../typedef/lifecycle/Lifecycle';
3
- import { DeviceType } from '../../../typedef/definition/urn/DeviceType';
4
- export declare class DeviceTypeWithLifecycleCodec {
5
- static encode(obj: ObjectWithLifecycle<DeviceType>): {
6
- lifecycle: LifeCycle;
7
- type: string;
8
- };
9
- static encodeArray(devicesTypes: ObjectWithLifecycle<DeviceType>[]): any[];
10
- static decode(o: any): ObjectWithLifecycle<DeviceType>;
11
- static decodeArray(arr: any[]): ObjectWithLifecycle<DeviceType>[];
12
- }
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeviceTypeWithLifecycleCodec = void 0;
4
- const ObjectWithLifecycle_1 = require("../../../typedef/lifecycle/ObjectWithLifecycle");
5
- const Lifecycle_1 = require("../../../typedef/lifecycle/Lifecycle");
6
- const DeviceType_1 = require("../../../typedef/definition/urn/DeviceType");
7
- class DeviceTypeWithLifecycleCodec {
8
- static encode(obj) {
9
- return {
10
- lifecycle: obj.lifecycle,
11
- type: obj.value.toString()
12
- };
13
- }
14
- static encodeArray(devicesTypes) {
15
- const arr = [];
16
- devicesTypes.forEach(item => {
17
- arr.push(this.encode(item));
18
- });
19
- return arr;
20
- }
21
- static decode(o) {
22
- const lifecycle = (0, Lifecycle_1.LifeCycleFromString)(o.lifecycle);
23
- const { type } = o;
24
- return new ObjectWithLifecycle_1.ObjectWithLifecycle(lifecycle, new DeviceType_1.DeviceType(type));
25
- }
26
- static decodeArray(arr) {
27
- const list = [];
28
- if (arr === null || arr === void 0 ? void 0 : arr.length) {
29
- for (const o of arr) {
30
- list.push(this.decode(o));
31
- }
32
- }
33
- return list;
34
- }
35
- }
36
- exports.DeviceTypeWithLifecycleCodec = DeviceTypeWithLifecycleCodec;