@duet3d/objectmodel 3.5.0-beta.13 → 3.5.0-beta.15

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.
@@ -25,6 +25,11 @@ export declare class ModelDictionary<T> extends Map<string, T | null> implements
25
25
  * @returns Updated instance
26
26
  */
27
27
  update(jsonElement: any): IModelObject | null;
28
+ /**
29
+ * Convert this object to JSON
30
+ * @returns JSON object
31
+ */
32
+ toJSON(): Record<string, T | null>;
28
33
  }
29
34
  export default ModelDictionary;
30
35
  /**
@@ -69,6 +69,17 @@ class ModelDictionary extends Map {
69
69
  }
70
70
  return this;
71
71
  }
72
+ /**
73
+ * Convert this object to JSON
74
+ * @returns JSON object
75
+ */
76
+ toJSON() {
77
+ const json = {};
78
+ for (const [key, value] of this) {
79
+ json[key] = value;
80
+ }
81
+ return json;
82
+ }
72
83
  }
73
84
  exports.ModelDictionary = ModelDictionary;
74
85
  exports.default = ModelDictionary;
@@ -25,6 +25,7 @@ export declare class Job extends ModelObject {
25
25
  lastFileAborted: boolean;
26
26
  lastFileCancelled: boolean;
27
27
  lastFileSimulated: boolean;
28
+ lastWarmUpDuration: number | null;
28
29
  layer: number | null;
29
30
  readonly layers: ModelCollection<Layer>;
30
31
  layerTime: number | null;
package/dist/job/index.js CHANGED
@@ -51,6 +51,7 @@ class Job extends ModelObject_1.default {
51
51
  this.lastFileAborted = false;
52
52
  this.lastFileCancelled = false;
53
53
  this.lastFileSimulated = false;
54
+ this.lastWarmUpDuration = null;
54
55
  this.layer = null;
55
56
  this.layers = new ModelCollection_1.default(Layer);
56
57
  this.layerTime = null;
@@ -32,11 +32,13 @@ export declare enum SbcPermission {
32
32
  superUser = "superUser"
33
33
  }
34
34
  export declare class PluginManifest extends ModelObject {
35
- #private;
36
- get id(): string;
37
- set id(value: string);
38
- get name(): string;
39
- set name(value: string);
35
+ /**
36
+ * Constructor of this class
37
+ * @param itemConstructor Item constructor type that items must derive from
38
+ */
39
+ constructor();
40
+ id: string;
41
+ name: string;
40
42
  author: string;
41
43
  version: string;
42
44
  license: string;
@@ -1,16 +1,4 @@
1
1
  "use strict";
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
- };
7
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
- if (kind === "m") throw new TypeError("Private method is not writable");
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
- };
13
- var _PluginManifest_id, _PluginManifest_name;
14
2
  Object.defineProperty(exports, "__esModule", { value: true });
15
3
  exports.PluginManifest = exports.SbcPermission = void 0;
16
4
  const ModelObject_1 = require("../ModelObject");
@@ -48,10 +36,14 @@ var SbcPermission;
48
36
  SbcPermission["superUser"] = "superUser";
49
37
  })(SbcPermission = exports.SbcPermission || (exports.SbcPermission = {}));
50
38
  class PluginManifest extends ModelObject_1.default {
39
+ /**
40
+ * Constructor of this class
41
+ * @param itemConstructor Item constructor type that items must derive from
42
+ */
51
43
  constructor() {
52
- super(...arguments);
53
- _PluginManifest_id.set(this, "");
54
- _PluginManifest_name.set(this, "");
44
+ super();
45
+ this.id = "";
46
+ this.name = "";
55
47
  this.author = "";
56
48
  this.version = "1.0.0";
57
49
  this.license = "LGPL-3.0-or-later";
@@ -71,30 +63,38 @@ class PluginManifest extends ModelObject_1.default {
71
63
  this.sbcPythonDependencies = [];
72
64
  this.rrfVersion = null;
73
65
  this.data = new Map();
74
- }
75
- get id() { return __classPrivateFieldGet(this, _PluginManifest_id, "f"); }
76
- set id(value) {
77
- if (!value || value.length > 32) {
78
- throw new Error("Invalid plugin identifier");
79
- }
80
- for (const c in value.split("")) {
81
- if (!/\w/.test(c)) {
82
- throw new Error("Illegal plugin identifier");
66
+ let id = "";
67
+ Object.defineProperty(this, "id", {
68
+ enumerable: true,
69
+ get() { return id; },
70
+ set(value) {
71
+ if (!value || value.length > 32) {
72
+ throw new Error("Invalid plugin identifier");
73
+ }
74
+ for (const c in value.split("")) {
75
+ if (!/\w/.test(c)) {
76
+ throw new Error("Illegal plugin identifier");
77
+ }
78
+ }
79
+ id = value;
83
80
  }
84
- }
85
- __classPrivateFieldSet(this, _PluginManifest_id, value, "f");
86
- }
87
- get name() { return __classPrivateFieldGet(this, _PluginManifest_name, "f"); }
88
- set name(value) {
89
- if (!value || value.length > 64) {
90
- throw new Error("Invalid plugin name");
91
- }
92
- for (const c in value.split("")) {
93
- if (!/[\w -_]/.test(c)) {
94
- throw new Error("Illegal plugin name");
81
+ });
82
+ let name = "";
83
+ Object.defineProperty(this, "name", {
84
+ enumerable: true,
85
+ get() { return name; },
86
+ set(value) {
87
+ if (!value || value.length > 64) {
88
+ throw new Error("Invalid plugin name");
89
+ }
90
+ for (const c in value.split("")) {
91
+ if (!/[\w -_]/.test(c)) {
92
+ throw new Error("Illegal plugin name");
93
+ }
94
+ }
95
+ name = value;
95
96
  }
96
- }
97
- __classPrivateFieldSet(this, _PluginManifest_name, value, "f");
97
+ });
98
98
  }
99
99
  static checkVersion(actual, required) {
100
100
  if (required) {
@@ -110,5 +110,4 @@ class PluginManifest extends ModelObject_1.default {
110
110
  }
111
111
  }
112
112
  exports.PluginManifest = PluginManifest;
113
- _PluginManifest_id = new WeakMap(), _PluginManifest_name = new WeakMap();
114
113
  exports.default = PluginManifest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duet3d/objectmodel",
3
- "version": "3.5.0-beta.13",
3
+ "version": "3.5.0-beta.15",
4
4
  "description": "TypeScript implementation of the Duet3D Object Model",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",