@microtronics/studio-cli 0.3.5 → 0.4.1

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/out/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC"}
package/out/api.js CHANGED
@@ -1,10 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Registry = exports.Manifest = exports.Dependencies = void 0;
3
+ exports.DefaultFiles = exports.Diagnostics = exports.Helper = exports.DDE = exports.DDE_Core = exports.Registry = exports.Manifest = exports.Dependencies = void 0;
4
4
  const dependencies_1 = require("./dependencies");
5
5
  Object.defineProperty(exports, "Dependencies", { enumerable: true, get: function () { return dependencies_1.Dependencies; } });
6
6
  const manifest_1 = require("./manifest");
7
7
  Object.defineProperty(exports, "Manifest", { enumerable: true, get: function () { return manifest_1.Manifest; } });
8
8
  const registryAPI_1 = require("./registryAPI");
9
9
  Object.defineProperty(exports, "Registry", { enumerable: true, get: function () { return registryAPI_1.Registry; } });
10
+ const dde_1 = require("./dde/dde");
11
+ Object.defineProperty(exports, "DDE", { enumerable: true, get: function () { return dde_1.DDE; } });
12
+ const coreDefinitions_1 = require("./dde/coreDefinitions");
13
+ Object.defineProperty(exports, "DDE_Core", { enumerable: true, get: function () { return coreDefinitions_1.DDE_Core; } });
14
+ const helper_1 = require("./helper");
15
+ Object.defineProperty(exports, "Helper", { enumerable: true, get: function () { return helper_1.Helper; } });
16
+ const diagnostics_1 = require("./diagnostics");
17
+ Object.defineProperty(exports, "Diagnostics", { enumerable: true, get: function () { return diagnostics_1.Diagnostics; } });
18
+ const defaultFiles_1 = require("./defaultFiles");
19
+ Object.defineProperty(exports, "DefaultFiles", { enumerable: true, get: function () { return defaultFiles_1.DefaultFiles; } });
10
20
  //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coreDefinitions.d.ts","sourceRoot":"","sources":["../../src/dde/coreDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,yBAAiB,QAAQ,CAAC;IACzB,MAAM,WAAW,OAAO;QACvB,UAAU,EAAE;YACX,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;SAChC,CAAC;QACF,YAAY,EAAE,eAAe,CAAC;KAC9B;IAED,MAAM,WAAW,eAAe;QAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KAEtB;IAED,MAAM,WAAW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AY,+BAMvD;IAED,MAAM,CAAC,MAAM,WAAW;oBACX,QAAQ,aAAa,YAAY,UAAU,OAAO;KAW9D,CAAC;IAeF,MAAM,CAAC,MAAM,SAAS,EAAE,GAqMvB,CAAC;IAEF,MAAM,CAAC,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;KAmBhC,CAAC;IAcF,MAAM,UAAU,yBAAyB,CAAC,SAAS,EAAE,MAAM,WAG1D;IAED,MAAM,WAAW,WAAW;QAC3B;;WAEG;QACH,WAAW,EAAE,MAAM,CAAC;QACpB;;WAEG;QACH,IAAI,EAAE,GAAG,CAAC;QACV;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;KACb;;CACD"}
@@ -0,0 +1,533 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DDE_Core = void 0;
4
+ var DDE_Core;
5
+ (function (DDE_Core) {
6
+ let DDEContainerName;
7
+ (function (DDEContainerName) {
8
+ /** @description low frequent - from device to server */
9
+ DDEContainerName["state"] = "state";
10
+ /** @description high frequent - from device to server */
11
+ DDEContainerName["result"] = "result";
12
+ /** @description aloha - from device to server */
13
+ DDEContainerName["aloha"] = "aloha";
14
+ /** @description volatile - from device to server */
15
+ DDEContainerName["volatile"] = "volatile";
16
+ /** @description low frequent - from server to device */
17
+ DDEContainerName["setting"] = "setting";
18
+ /** @description high frequent - from server to device */
19
+ DDEContainerName["command"] = "command";
20
+ /** @description server only */
21
+ DDEContainerName["storage"] = "storage";
22
+ /** @description server only */
23
+ DDEContainerName["relations"] = "relations";
24
+ })(DDEContainerName = DDE_Core.DDEContainerName || (DDE_Core.DDEContainerName = {}));
25
+ let ContainerName;
26
+ (function (ContainerName) {
27
+ ContainerName["configA"] = "configA";
28
+ ContainerName["configB"] = "configB";
29
+ ContainerName["configC"] = "configC";
30
+ ContainerName["config0"] = "config0";
31
+ ContainerName["config1"] = "config1";
32
+ ContainerName["config2"] = "config2";
33
+ ContainerName["config3"] = "config3";
34
+ ContainerName["config4"] = "config4";
35
+ ContainerName["config5"] = "config5";
36
+ ContainerName["config6"] = "config6";
37
+ ContainerName["config7"] = "config7";
38
+ ContainerName["config8"] = "config8";
39
+ ContainerName["config9"] = "config9";
40
+ ContainerName["histdata0"] = "histdata0";
41
+ ContainerName["histdata1"] = "histdata1";
42
+ ContainerName["histdata2"] = "histdata2";
43
+ ContainerName["histdata3"] = "histdata3";
44
+ ContainerName["histdata4"] = "histdata4";
45
+ ContainerName["histdata5"] = "histdata5";
46
+ ContainerName["histdata6"] = "histdata6";
47
+ ContainerName["histdata7"] = "histdata7";
48
+ ContainerName["histdata8"] = "histdata8";
49
+ ContainerName["histdata9"] = "histdata9";
50
+ ContainerName["aloha"] = "aloha";
51
+ ContainerName["alerts"] = "alerts";
52
+ ContainerName["applog"] = "applog";
53
+ })(ContainerName = DDE_Core.ContainerName || (DDE_Core.ContainerName = {}));
54
+ let ContainerType;
55
+ (function (ContainerType) {
56
+ /**
57
+ * @description config0 - 9
58
+ */
59
+ ContainerType["cx"] = "cx";
60
+ /**
61
+ * @description histdata0 - 9
62
+ */
63
+ ContainerType["hx"] = "hx";
64
+ /**
65
+ * @description configA - B
66
+ */
67
+ ContainerType["cb"] = "cb";
68
+ ContainerType["aloha"] = "aloha";
69
+ ContainerType["applog"] = "applog";
70
+ })(ContainerType = DDE_Core.ContainerType || (DDE_Core.ContainerType = {}));
71
+ let TransferDirection;
72
+ (function (TransferDirection) {
73
+ TransferDirection["up"] = "up";
74
+ TransferDirection["down"] = "down";
75
+ TransferDirection["upPlus"] = "up+";
76
+ TransferDirection["downPlus"] = "down+";
77
+ TransferDirection["none"] = "none";
78
+ TransferDirection["backendOnly"] = "backend-only";
79
+ TransferDirection["deviceOnly"] = "device-only";
80
+ TransferDirection["both"] = "both";
81
+ TransferDirection["bothPlus"] = "both+";
82
+ /** @deprecated replaced with backendOnly*/
83
+ TransferDirection["noneBackend"] = "none-be";
84
+ })(TransferDirection = DDE_Core.TransferDirection || (DDE_Core.TransferDirection = {}));
85
+ function CONTAINER_DEF_DLO_CID_BASE(containerType, xmit) {
86
+ // eslint-disable-next-line sonarjs/no-duplicate-string
87
+ if (containerType === ContainerType.cx && ![TransferDirection.backendOnly].includes(xmit)) {
88
+ return 'DDE_CID_CONFIG';
89
+ }
90
+ if (containerType === ContainerType.hx) {
91
+ return 'DDE_CID_HISTDATA';
92
+ }
93
+ if (containerType === ContainerType.aloha) {
94
+ return 'DDE_CID_ALOHA';
95
+ }
96
+ return null;
97
+ }
98
+ DDE_Core.CONTAINER_DEF_DLO_CID_BASE = CONTAINER_DEF_DLO_CID_BASE;
99
+ const _CX_XMITS = [
100
+ TransferDirection.up,
101
+ TransferDirection.upPlus,
102
+ TransferDirection.down,
103
+ TransferDirection.downPlus,
104
+ TransferDirection.both,
105
+ TransferDirection.none,
106
+ TransferDirection.bothPlus,
107
+ TransferDirection.backendOnly,
108
+ TransferDirection.deviceOnly
109
+ ];
110
+ const _HX_XMITS = [TransferDirection.up, TransferDirection.upPlus, TransferDirection.backendOnly];
111
+ DDE_Core.CONTAINER_DEFS = {
112
+ configA: { ctype: ContainerType.cb, cnum: 'a', alias: '', flds: 'field', xmits: [TransferDirection.backendOnly] },
113
+ configB: { ctype: ContainerType.cb, cnum: 'b', alias: '', flds: 'field', xmits: [TransferDirection.backendOnly] },
114
+ configC: { ctype: ContainerType.cb, cnum: 'c', alias: '', flds: 'field', xmits: [TransferDirection.backendOnly] },
115
+ config0: { ctype: ContainerType.cx, cnum: 0, alias: '', flds: 'field', xmits: _CX_XMITS },
116
+ config1: { ctype: ContainerType.cx, cnum: 1, alias: '', flds: 'field', xmits: _CX_XMITS },
117
+ config2: { ctype: ContainerType.cx, cnum: 2, alias: '', flds: 'field', xmits: _CX_XMITS },
118
+ config3: { ctype: ContainerType.cx, cnum: 3, alias: '', flds: 'field', xmits: _CX_XMITS },
119
+ config4: { ctype: ContainerType.cx, cnum: 4, alias: '', flds: 'field', xmits: _CX_XMITS },
120
+ config5: { ctype: ContainerType.cx, cnum: 5, alias: '', flds: 'field', xmits: _CX_XMITS },
121
+ config6: { ctype: ContainerType.cx, cnum: 6, alias: '', flds: 'field', xmits: _CX_XMITS },
122
+ config7: { ctype: ContainerType.cx, cnum: 7, alias: '', flds: 'field', xmits: _CX_XMITS },
123
+ config8: { ctype: ContainerType.cx, cnum: 8, alias: '', flds: 'field', xmits: _CX_XMITS },
124
+ config9: { ctype: ContainerType.cx, cnum: 9, alias: '', flds: 'field', xmits: _CX_XMITS },
125
+ histdata0: { ctype: ContainerType.hx, cnum: 0, alias: '', flds: 'ch', xmits: _HX_XMITS },
126
+ histdata1: { ctype: ContainerType.hx, cnum: 1, alias: '', flds: 'ch', xmits: _HX_XMITS },
127
+ histdata2: { ctype: ContainerType.hx, cnum: 2, alias: '', flds: 'ch', xmits: _HX_XMITS },
128
+ histdata3: { ctype: ContainerType.hx, cnum: 3, alias: '', flds: 'ch', xmits: _HX_XMITS },
129
+ histdata4: { ctype: ContainerType.hx, cnum: 4, alias: '', flds: 'ch', xmits: _HX_XMITS },
130
+ histdata5: { ctype: ContainerType.hx, cnum: 5, alias: '', flds: 'ch', xmits: _HX_XMITS },
131
+ histdata6: { ctype: ContainerType.hx, cnum: 6, alias: '', flds: 'ch', xmits: _HX_XMITS },
132
+ histdata7: { ctype: ContainerType.hx, cnum: 7, alias: '', flds: 'ch', xmits: _HX_XMITS },
133
+ histdata8: { ctype: ContainerType.hx, cnum: 8, alias: '', flds: 'ch', xmits: _HX_XMITS },
134
+ histdata9: { ctype: ContainerType.hx, cnum: 9, alias: '', flds: 'ch', xmits: _HX_XMITS },
135
+ aloha: {
136
+ ctype: ContainerType.aloha,
137
+ cnum: undefined,
138
+ alias: ContainerType.aloha,
139
+ flds: null,
140
+ xmits: [TransferDirection.up, TransferDirection.upPlus]
141
+ },
142
+ alerts: { ctype: undefined, cnum: undefined, alias: 'alerts', flds: null, xmits: [TransferDirection.up] },
143
+ applog: {
144
+ ctype: ContainerType.applog,
145
+ cnum: undefined,
146
+ alias: ContainerType.applog,
147
+ flds: null,
148
+ xmits: [TransferDirection.upPlus]
149
+ }
150
+ };
151
+ DDE_Core.HISTDATA_CONTAINER = [
152
+ ContainerName.histdata0,
153
+ ContainerName.histdata1,
154
+ ContainerName.histdata2,
155
+ ContainerName.histdata3,
156
+ ContainerName.histdata4,
157
+ ContainerName.histdata5,
158
+ ContainerName.histdata6,
159
+ ContainerName.histdata7,
160
+ ContainerName.histdata8,
161
+ ContainerName.histdata9
162
+ ];
163
+ DDE_Core.CONFIG_CONTAINER = [
164
+ ContainerName.config0,
165
+ ContainerName.config1,
166
+ ContainerName.config2,
167
+ ContainerName.config3,
168
+ ContainerName.config4,
169
+ ContainerName.config5,
170
+ ContainerName.config6,
171
+ ContainerName.config7,
172
+ ContainerName.config8,
173
+ ContainerName.config9
174
+ ];
175
+ DDE_Core.SERVER_CONTAINER = [ContainerName.configA, ContainerName.configB, ContainerName.configC];
176
+ // relation checkings.
177
+ DDE_Core.regexRelation = /^@[a-zA-Z0-9_].[a-zA-Z0-9[\]{}._+-]+(?<!\.)$/;
178
+ const STRING_TYPES = ['astring', 'nstring', 'cstring', 'wstring', 'ustring'];
179
+ const NUMBER_TYPES = [
180
+ 'int8',
181
+ 'int16',
182
+ 'int32',
183
+ 'int64',
184
+ 'uint8',
185
+ 'uint16',
186
+ 'uint32',
187
+ 'float16',
188
+ 'float32',
189
+ 'float64'
190
+ ];
191
+ /**
192
+ * Defines what fields allow relations and the allowed target field type.
193
+ */
194
+ DDE_Core.allowedRelationTypes = {
195
+ title: STRING_TYPES,
196
+ unit: STRING_TYPES,
197
+ chartMinimum: NUMBER_TYPES,
198
+ chartMaximum: NUMBER_TYPES,
199
+ scale: NUMBER_TYPES,
200
+ offset: NUMBER_TYPES,
201
+ decimalPlaces: ['uint8', 'uint16', 'uint32', 'int8', 'int16', 'int32', 'int64'],
202
+ channelMode: ['uint8', 'uint16', 'uint32'],
203
+ chartAlarmLow: NUMBER_TYPES,
204
+ chartAlarmHigh: NUMBER_TYPES,
205
+ chartWarningLow: NUMBER_TYPES,
206
+ chartWarningHigh: NUMBER_TYPES,
207
+ chartHysteresis: NUMBER_TYPES,
208
+ chartTriggerThreshold: NUMBER_TYPES,
209
+ chartTriggerRelation: NUMBER_TYPES,
210
+ chartSetPoint: NUMBER_TYPES
211
+ };
212
+ /**
213
+ * Parse the given value and resolve any container relation
214
+ * @param attribute
215
+ * @param field
216
+ * @param ddeMap
217
+ */
218
+ function parseXMLValueWithRelation(attribute, field, ddeMap) {
219
+ /* @ts-ignore */
220
+ const currentAttributeValue = field[attribute];
221
+ if (currentAttributeValue === undefined) {
222
+ return undefined;
223
+ }
224
+ // resolve relation:
225
+ if (DDE_Core.regexRelation.exec(`${currentAttributeValue}`)) {
226
+ const isSetPoint = attribute === 'chartSetPoint';
227
+ const [root, ...containerFields] = currentAttributeValue.split('.');
228
+ const containerTitle = root.substring(1);
229
+ const realContainer = Object.values(ddeMap.containers).find(container => container.title === containerTitle);
230
+ const containerField = containerFields.join('.');
231
+ const delimeter = isSetPoint ? ';' : '%';
232
+ let xmlString = (isSetPoint ? '' : '%') + (realContainer?.name || containerTitle) + delimeter;
233
+ // handle array referenced field with automatic index
234
+ xmlString = xmlString + `${containerField}`;
235
+ // add setpoint related 'actual_output_value_x' to string
236
+ if (isSetPoint) {
237
+ const valueIndex = ddeMap.setPointList[field.name];
238
+ xmlString = xmlString + `;actual_output_value_${valueIndex}`;
239
+ }
240
+ return xmlString;
241
+ }
242
+ else {
243
+ return currentAttributeValue;
244
+ }
245
+ }
246
+ DDE_Core.parseXMLValueWithRelation = parseXMLValueWithRelation;
247
+ function parseXMLBitmask(field) {
248
+ const { bitmask } = field;
249
+ if (!bitmask) {
250
+ return undefined;
251
+ }
252
+ let xmlBitmask = `$`;
253
+ // trim all whitespaces from the bitmask
254
+ const sourceBitmask = bitmask.replaceAll(' ', '');
255
+ // bitmask is hex
256
+ if (bitmask.startsWith('0x')) {
257
+ xmlBitmask += sourceBitmask.substring(2);
258
+ }
259
+ else if (sourceBitmask.startsWith('0b')) {
260
+ // allow setting bitmask as binary value
261
+ const binaryString = sourceBitmask.substring(2).replaceAll(' ', '');
262
+ xmlBitmask += parseInt(binaryString, 2).toString(16).toUpperCase();
263
+ }
264
+ return xmlBitmask;
265
+ }
266
+ DDE_Core.parseXMLBitmask = parseXMLBitmask;
267
+ function parseXMLDefaultValue(field) {
268
+ if (field.type === 'binary') {
269
+ // remove the leading 0x prefix
270
+ return field.defaultValue.substring(2);
271
+ }
272
+ return field.defaultValue === 'NaN' ? 'NAN' : field.defaultValue;
273
+ }
274
+ DDE_Core.parseXMLDefaultValue = parseXMLDefaultValue;
275
+ DDE_Core.TDEF_NUMBER = {
276
+ xmlOut(xml, jsonField, ddeMap) {
277
+ // retain complex decpl values which may contain a field reference and not only a number
278
+ xml.decpl = parseXMLValueWithRelation('decimalPlaces', jsonField, ddeMap);
279
+ if (xml.decpl === undefined) {
280
+ xml.decpl = 0;
281
+ }
282
+ xml.vscale = parseXMLValueWithRelation('scale', jsonField, ddeMap);
283
+ xml.vofs = parseXMLValueWithRelation('offset', jsonField, ddeMap);
284
+ xml.min = parseXMLValueWithRelation('chartMinimum', jsonField, ddeMap);
285
+ xml.max = parseXMLValueWithRelation('chartMaximum', jsonField, ddeMap);
286
+ }
287
+ };
288
+ const TDEF_STRING = {
289
+ isBlob: 1,
290
+ xmlOut(xml, fieldDefinition) {
291
+ xml.max = fieldDefinition.byteSize;
292
+ }
293
+ };
294
+ const TDEF_STAMP = {
295
+ xmlOut(xml /*fdef: DDEJsonField*/) {
296
+ // currently only utc available
297
+ xml.decpl = -1; // stamp/4/8 requires decpl:-1 !
298
+ xml.param0 = 'local'; //fdef._utc ? 'local' : '';
299
+ xml.units = 'UTC'; //fdef._utc ? 'UTC' : 'Local time';
300
+ }
301
+ };
302
+ DDE_Core.TYPE_DEFS = {
303
+ u8: {
304
+ dde: 'uint8',
305
+ dim: 1,
306
+ len: 1,
307
+ ...DDE_Core.TDEF_NUMBER,
308
+ rdef: 1,
309
+ xml: { type: 'u8' },
310
+ pwn: { rwfunc: 'u8', htype: 's32' },
311
+ openApi: { type: 'number', minimum: 0 }
312
+ },
313
+ u16: {
314
+ dde: 'uint16',
315
+ dim: 1,
316
+ len: 2,
317
+ ...DDE_Core.TDEF_NUMBER,
318
+ rdef: 1,
319
+ xml: { type: 'u16' },
320
+ pwn: { rwfunc: 'u16', htype: 's32' },
321
+ openApi: { type: 'number', minimum: 0 }
322
+ },
323
+ u32: {
324
+ dde: 'uint32',
325
+ dim: 1,
326
+ len: 4,
327
+ ...DDE_Core.TDEF_NUMBER,
328
+ rdef: 1,
329
+ xml: { type: 'u32' },
330
+ pwn: { rwfunc: 'u32', htype: 's32' },
331
+ openApi: { type: 'number', minimum: 0 }
332
+ },
333
+ // u64 - does not exist / not supported by backend
334
+ s8: {
335
+ dde: 'int8',
336
+ dim: 1,
337
+ len: 1,
338
+ ...DDE_Core.TDEF_NUMBER,
339
+ rdef: 1,
340
+ xml: { type: 's8' },
341
+ pwn: { rwfunc: 's8', htype: 's32' },
342
+ openApi: { type: 'number' }
343
+ },
344
+ s16: {
345
+ dde: 'int16',
346
+ dim: 1,
347
+ len: 2,
348
+ ...DDE_Core.TDEF_NUMBER,
349
+ rdef: 1,
350
+ xml: { type: 's16' },
351
+ pwn: { rwfunc: 's16', htype: 's32' },
352
+ openApi: { type: 'number' }
353
+ },
354
+ s32: {
355
+ dde: 'int32',
356
+ dim: 1,
357
+ len: 4,
358
+ ...DDE_Core.TDEF_NUMBER,
359
+ rdef: 1,
360
+ xml: { type: 's32' },
361
+ pwn: { rwfunc: 's32' },
362
+ openApi: { type: 'number' }
363
+ },
364
+ s64: {
365
+ dde: 'int64',
366
+ dim: 0,
367
+ len: 8,
368
+ ...DDE_Core.TDEF_NUMBER,
369
+ rdef: 1,
370
+ xml: { type: 's64' },
371
+ pwn: { rwfunc: 's64', rwp: '%n{%l}', htype: '{%l}' },
372
+ openApi: { type: 'number' }
373
+ },
374
+ f16: {
375
+ dde: 'float16',
376
+ dim: 1,
377
+ len: 2,
378
+ ...DDE_Core.TDEF_NUMBER,
379
+ rdef: 1,
380
+ xml: { type: 'floatm16' },
381
+ pwn: { rwfunc: 'f16', rwp: 'Float:%n', htype: 'f32' },
382
+ openApi: { type: 'number' }
383
+ },
384
+ f32: {
385
+ dde: 'float32',
386
+ dim: 1,
387
+ len: 4,
388
+ ...DDE_Core.TDEF_NUMBER,
389
+ rdef: 1,
390
+ xml: { type: 'f32' },
391
+ pwn: { rwfunc: 'f32', rwp: 'Float:%n' },
392
+ openApi: { type: 'number' }
393
+ },
394
+ f64: {
395
+ dde: 'float64',
396
+ dim: 0,
397
+ len: 8,
398
+ ...DDE_Core.TDEF_NUMBER,
399
+ rdef: 0,
400
+ xml: { type: 'f64' },
401
+ pwn: { rwfunc: 'f64', rwp: '%n{%l}', htype: '{%l}' },
402
+ openApi: { type: 'number' }
403
+ },
404
+ stamp32: {
405
+ dde: 'stamp32',
406
+ dim: 1,
407
+ len: 4,
408
+ ...TDEF_STAMP,
409
+ rdef: 0,
410
+ xml: { type: 'stamp4' },
411
+ pwn: { rwfunc: 'stamp32' },
412
+ openApi: { type: 'string', format: 'YYYYMMDDhhmmssSSS', description: 'UTC' }
413
+ },
414
+ stamp40: {
415
+ dde: 'stamp40',
416
+ dim: 0,
417
+ len: 5,
418
+ ...TDEF_STAMP,
419
+ rdef: 0,
420
+ xml: { type: 'stamp' },
421
+ pwn: { rwfunc: 'stamp40', rwp: '%n{%l}', htype: '{%l}' },
422
+ openApi: { type: 'string', format: 'YYYYMMDDhhmmssSSS', description: 'UTC' }
423
+ },
424
+ bin: {
425
+ dde: 'binary',
426
+ dim: 0,
427
+ ...TDEF_STRING,
428
+ rdef: 0,
429
+ lenUnits: 'byte',
430
+ xml: { type: 'string', editmask: '%HEX%' },
431
+ pwn: { rwfunc: 'bin', rwlen: 1, rwp: '%n{%l}', htype: '{%l}' },
432
+ openApi: { type: 'string', description: 'HEX string' }
433
+ },
434
+ astr: {
435
+ dde: 'astring',
436
+ dim: 0,
437
+ ...TDEF_STRING,
438
+ rdef: 1,
439
+ lenUnits: 'char',
440
+ xml: { type: 'string', param1: 'nocodepage' },
441
+ pwn: { rwfunc: 'astr', rwlen: 1, rwp: '%n{%l+1}', htype: '{%l+1}' },
442
+ openApi: { type: 'string' }
443
+ },
444
+ nstr: {
445
+ dde: 'nstring',
446
+ dim: 0,
447
+ ...TDEF_STRING,
448
+ rdef: 1,
449
+ lenUnits: 'byte',
450
+ xml: { type: 'string' },
451
+ pwn: { rwfunc: 'nstr', rwlen: 1, rwp: '%n{%l+1}', htype: '{%l+1}' },
452
+ openApi: { type: 'string' }
453
+ },
454
+ wstr: {
455
+ dde: 'wstring',
456
+ dim: 0,
457
+ ...TDEF_STRING,
458
+ rdef: 1,
459
+ lenUnits: 'byte',
460
+ xml: { type: 'string' },
461
+ pwn: { rwfunc: 'wstr', rwlen: 1, rwp: '%n[%l+1]', htype: '[%l+1]' },
462
+ openApi: { type: 'string' }
463
+ },
464
+ ustr: {
465
+ dde: 'ustring',
466
+ dim: 0,
467
+ ...TDEF_STRING,
468
+ rdef: 0,
469
+ lenUnits: 'byte',
470
+ xml: { type: 'string' },
471
+ pwn: { rwfunc: 'ustr', rwlen: 1, rwp: '%n{%l+1}', htype: '{%l+1}' },
472
+ openApi: { type: 'string' }
473
+ },
474
+ cstr: {
475
+ dde: 'cstring',
476
+ dim: 0,
477
+ ...TDEF_STRING,
478
+ rdef: 1,
479
+ lenUnits: 'char',
480
+ xml: { type: 'string', editmask: '%HEX%' },
481
+ pwn: { rwfunc: 'cstr', rwlen: 1, rwp: '%n{%l+1}', htype: '{%l+1}' },
482
+ openApi: { type: 'string' }
483
+ },
484
+ // ^^^
485
+ // +1: consider terminating zero for string buffer allocations
486
+ _siteref: {
487
+ dim: 0,
488
+ len: 80,
489
+ rdef: 0,
490
+ xml: { type: 'string', max: '80', editmask: '%QUERY%all_sites;-name;!id;class;name;%EMPTY%' },
491
+ pwn: { rwfunc: 'astr', rwlen: 1, rwp: '%n{%l+1}', htype: '{%l+1}' },
492
+ js: { rwfunc: 'String' }
493
+ }
494
+ };
495
+ DDE_Core.fieldTypeDefinitions = {
496
+ uint8: DDE_Core.TYPE_DEFS.u8,
497
+ uint16: DDE_Core.TYPE_DEFS.u16,
498
+ uint32: DDE_Core.TYPE_DEFS.u32,
499
+ int8: DDE_Core.TYPE_DEFS.s8,
500
+ int16: DDE_Core.TYPE_DEFS.s16,
501
+ int32: DDE_Core.TYPE_DEFS.s32,
502
+ int64: DDE_Core.TYPE_DEFS.s64,
503
+ float16: DDE_Core.TYPE_DEFS.f16,
504
+ float32: DDE_Core.TYPE_DEFS.f32,
505
+ float64: DDE_Core.TYPE_DEFS.f64,
506
+ stamp32: DDE_Core.TYPE_DEFS.stamp32,
507
+ stamp40: DDE_Core.TYPE_DEFS.stamp40,
508
+ binary: DDE_Core.TYPE_DEFS.bin,
509
+ astring: DDE_Core.TYPE_DEFS.astr,
510
+ nstring: DDE_Core.TYPE_DEFS.nstr,
511
+ wstring: DDE_Core.TYPE_DEFS.wstr,
512
+ ustring: DDE_Core.TYPE_DEFS.ustr,
513
+ cstring: DDE_Core.TYPE_DEFS.cstr
514
+ };
515
+ const reservedFieldNames = [
516
+ '_id',
517
+ 'id',
518
+ '_stamp',
519
+ 'stamp',
520
+ 'tag',
521
+ '_uid',
522
+ 'customer_id',
523
+ 'site_id',
524
+ '_rec_flags__',
525
+ 'applog'
526
+ ];
527
+ function checkForReservedFieldName(fieldName) {
528
+ const name = fieldName.toLowerCase();
529
+ return reservedFieldNames.includes(name) || /^field\d+$/.test(name) || /^ch\d+$/.test(name);
530
+ }
531
+ DDE_Core.checkForReservedFieldName = checkForReservedFieldName;
532
+ })(DDE_Core || (exports.DDE_Core = DDE_Core = {}));
533
+ //# sourceMappingURL=coreDefinitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dde.d.ts","sourceRoot":"","sources":["../../src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