motion-master-client 0.0.55 → 0.0.56

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 (132) hide show
  1. package/.babelrc +3 -0
  2. package/.eslintrc.json +18 -0
  3. package/README.md +123 -123
  4. package/jest.config.ts +16 -0
  5. package/motion-master.proto +1861 -0
  6. package/package.json +6 -21
  7. package/project.json +45 -0
  8. package/src/{index.d.ts → index.ts} +26 -26
  9. package/src/lib/cia402.spec.ts +77 -0
  10. package/src/lib/cia402.ts +414 -0
  11. package/src/lib/config-file.spec.ts +114 -0
  12. package/src/lib/config-file.ts +63 -0
  13. package/src/lib/device-log-line.ts +5 -0
  14. package/src/lib/device-parameter.spec.ts +85 -0
  15. package/src/lib/device-parameter.ts +79 -0
  16. package/src/lib/device.ts +10 -0
  17. package/src/lib/hardware-description.spec.ts +253 -0
  18. package/src/lib/hardware-description.ts +129 -0
  19. package/src/lib/logger.ts +5 -0
  20. package/src/lib/monitoring-config.ts +6 -0
  21. package/src/lib/{monitoring-entry.d.ts → monitoring-entry.ts} +10 -9
  22. package/src/lib/motion-master-client.ts +266 -0
  23. package/src/lib/motion-master-pub-sub-client.ts +100 -0
  24. package/src/lib/motion-master-pub-sub-socket.ts +46 -0
  25. package/src/lib/motion-master-pub-sub-web-socket.ts +77 -0
  26. package/src/lib/motion-master-pub-sub-worker-socket.ts +57 -0
  27. package/src/lib/motion-master-req-res-client.spec.ts +740 -0
  28. package/src/lib/motion-master-req-res-client.ts +2211 -0
  29. package/src/lib/motion-master-req-res-socket.ts +68 -0
  30. package/src/lib/motion-master-req-res-web-socket.ts +123 -0
  31. package/src/lib/motion-master-req-res-worker-socket.ts +89 -0
  32. package/src/lib/motion-master.proto.d.ts +5183 -5083
  33. package/src/lib/motion-master.proto.js +53218 -52284
  34. package/src/lib/operators.ts +108 -0
  35. package/src/lib/options.ts +12 -0
  36. package/src/lib/parameter.spec.ts +160 -0
  37. package/src/lib/parameter.ts +170 -0
  38. package/src/lib/product-id-range.ts +8 -0
  39. package/src/lib/request-status-resolver.ts +403 -0
  40. package/src/lib/system-log-line.ts +9 -0
  41. package/src/lib/{types.d.ts → types.ts} +141 -209
  42. package/src/lib/urls.ts +6 -0
  43. package/src/lib/util.ts +332 -0
  44. package/src/lib/web-socket-connection-close-codes.ts +85 -0
  45. package/tsconfig.json +23 -0
  46. package/tsconfig.lib.json +10 -0
  47. package/tsconfig.spec.json +20 -0
  48. package/typedoc.json +10 -0
  49. package/src/index.js +0 -30
  50. package/src/index.js.map +0 -1
  51. package/src/lib/cia402.d.ts +0 -182
  52. package/src/lib/cia402.js +0 -392
  53. package/src/lib/cia402.js.map +0 -1
  54. package/src/lib/config-file.d.ts +0 -13
  55. package/src/lib/config-file.js +0 -50
  56. package/src/lib/config-file.js.map +0 -1
  57. package/src/lib/device-log-line.d.ts +0 -5
  58. package/src/lib/device-log-line.js +0 -3
  59. package/src/lib/device-log-line.js.map +0 -1
  60. package/src/lib/device-parameter.d.ts +0 -56
  61. package/src/lib/device-parameter.js +0 -39
  62. package/src/lib/device-parameter.js.map +0 -1
  63. package/src/lib/device.d.ts +0 -9
  64. package/src/lib/device.js +0 -3
  65. package/src/lib/device.js.map +0 -1
  66. package/src/lib/hardware-description.d.ts +0 -41
  67. package/src/lib/hardware-description.js +0 -94
  68. package/src/lib/hardware-description.js.map +0 -1
  69. package/src/lib/logger.d.ts +0 -1
  70. package/src/lib/logger.js +0 -8
  71. package/src/lib/logger.js.map +0 -1
  72. package/src/lib/monitoring-config.d.ts +0 -6
  73. package/src/lib/monitoring-config.js +0 -3
  74. package/src/lib/monitoring-config.js.map +0 -1
  75. package/src/lib/monitoring-entry.js +0 -3
  76. package/src/lib/monitoring-entry.js.map +0 -1
  77. package/src/lib/motion-master-client.d.ts +0 -56
  78. package/src/lib/motion-master-client.js +0 -167
  79. package/src/lib/motion-master-client.js.map +0 -1
  80. package/src/lib/motion-master-pub-sub-client.d.ts +0 -17
  81. package/src/lib/motion-master-pub-sub-client.js +0 -73
  82. package/src/lib/motion-master-pub-sub-client.js.map +0 -1
  83. package/src/lib/motion-master-pub-sub-socket.d.ts +0 -42
  84. package/src/lib/motion-master-pub-sub-socket.js +0 -3
  85. package/src/lib/motion-master-pub-sub-socket.js.map +0 -1
  86. package/src/lib/motion-master-pub-sub-web-socket.d.ts +0 -18
  87. package/src/lib/motion-master-pub-sub-web-socket.js +0 -66
  88. package/src/lib/motion-master-pub-sub-web-socket.js.map +0 -1
  89. package/src/lib/motion-master-pub-sub-worker-socket.d.ts +0 -18
  90. package/src/lib/motion-master-pub-sub-worker-socket.js +0 -48
  91. package/src/lib/motion-master-pub-sub-worker-socket.js.map +0 -1
  92. package/src/lib/motion-master-req-res-client.d.ts +0 -947
  93. package/src/lib/motion-master-req-res-client.js +0 -1735
  94. package/src/lib/motion-master-req-res-client.js.map +0 -1
  95. package/src/lib/motion-master-req-res-socket.d.ts +0 -60
  96. package/src/lib/motion-master-req-res-socket.js +0 -3
  97. package/src/lib/motion-master-req-res-socket.js.map +0 -1
  98. package/src/lib/motion-master-req-res-web-socket.d.ts +0 -28
  99. package/src/lib/motion-master-req-res-web-socket.js +0 -98
  100. package/src/lib/motion-master-req-res-web-socket.js.map +0 -1
  101. package/src/lib/motion-master-req-res-worker-socket.d.ts +0 -24
  102. package/src/lib/motion-master-req-res-worker-socket.js +0 -72
  103. package/src/lib/motion-master-req-res-worker-socket.js.map +0 -1
  104. package/src/lib/operators.d.ts +0 -20
  105. package/src/lib/operators.js +0 -84
  106. package/src/lib/operators.js.map +0 -1
  107. package/src/lib/options.d.ts +0 -10
  108. package/src/lib/options.js +0 -14
  109. package/src/lib/options.js.map +0 -1
  110. package/src/lib/parameter.d.ts +0 -72
  111. package/src/lib/parameter.js +0 -119
  112. package/src/lib/parameter.js.map +0 -1
  113. package/src/lib/product-id-range.d.ts +0 -7
  114. package/src/lib/product-id-range.js +0 -12
  115. package/src/lib/product-id-range.js.map +0 -1
  116. package/src/lib/request-status-resolver.d.ts +0 -4
  117. package/src/lib/request-status-resolver.js +0 -345
  118. package/src/lib/request-status-resolver.js.map +0 -1
  119. package/src/lib/system-log-line.d.ts +0 -9
  120. package/src/lib/system-log-line.js +0 -3
  121. package/src/lib/system-log-line.js.map +0 -1
  122. package/src/lib/types.js +0 -29
  123. package/src/lib/types.js.map +0 -1
  124. package/src/lib/urls.d.ts +0 -3
  125. package/src/lib/urls.js +0 -10
  126. package/src/lib/urls.js.map +0 -1
  127. package/src/lib/util.d.ts +0 -42
  128. package/src/lib/util.js +0 -327
  129. package/src/lib/util.js.map +0 -1
  130. package/src/lib/web-socket-connection-close-codes.d.ts +0 -8
  131. package/src/lib/web-socket-connection-close-codes.js +0 -89
  132. package/src/lib/web-socket-connection-close-codes.js.map +0 -1
@@ -0,0 +1,332 @@
1
+ import { inRange } from "lodash";
2
+ import { DeviceLogLine } from "./device-log-line";
3
+ import { Parameter, ParameterIndexSubindex } from "./parameter";
4
+ import { SystemLogLine } from "./system-log-line";
5
+ import { DeviceRef, DeviceRefObj, IMotionMasterMessage, MotionMasterMessage, ParameterAddressValue, ParameterTypeValue, ParameterTypeValueKey, ParameterValueType, ValueType } from "./types";
6
+
7
+ export function getParameterTypeValueDefault(key: ParameterTypeValueKey) {
8
+ if (key === 'floatValue' || key === 'intValue' || key === 'uintValue') {
9
+ return 0;
10
+ } else if (key === 'rawValue') {
11
+ return Uint8Array.from([]);
12
+ } else if (key === 'stringValue') {
13
+ return '';
14
+ } else {
15
+ return 0;
16
+ }
17
+ }
18
+
19
+ export function getParameterTypeValue(parameter: MotionMasterMessage.Status.DeviceParameterValues.IParameterValue): ParameterTypeValueKey | undefined {
20
+ return (MotionMasterMessage.Status.DeviceParameterValues.ParameterValue.create(parameter)).typeValue;
21
+ }
22
+
23
+ export function getParameterValue(parameter: MotionMasterMessage.Status.DeviceParameterValues.IParameterValue): ParameterValueType {
24
+ const key = getParameterTypeValue(parameter);
25
+ if (key && key in parameter) {
26
+ return parameter[key] ?? getParameterTypeValueDefault(key);
27
+ }
28
+ return 0;
29
+ }
30
+
31
+ export function makeDeviceRefObj(deviceRef: DeviceRef): DeviceRefObj {
32
+ if (typeof deviceRef === 'number') {
33
+ if (deviceRef <= 0xFFFF) {
34
+ return { devicePosition: deviceRef };
35
+ } else {
36
+ return { deviceAddress: deviceRef };
37
+ }
38
+ } else {
39
+ return { deviceSerialNumber: deviceRef };
40
+ }
41
+ }
42
+
43
+ // TODO: Write unit tests.
44
+ export function parseSystemLogLine(line: string): SystemLogLine | undefined {
45
+ const re = /(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d{1,3})\s\((.+)\)\s\[(.+)\](.+:\d+)(.+?)\|(.*)/s;
46
+ const result = re.exec(line);
47
+ if (result) {
48
+ return {
49
+ line,
50
+ date: new Date(result[1]),
51
+ uptime: result[2].trim(),
52
+ id: result[3].trim(),
53
+ file: result[4].trim(),
54
+ level: result[5].trim(),
55
+ message: result[6],
56
+ };
57
+ }
58
+ return;
59
+ }
60
+
61
+ // TODO: Write unit tests.
62
+ export function parseSystemLogContent(content: string): SystemLogLine[] {
63
+ const re = /(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d{1,3}.+?)(?=\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d{1,3}|$)/gs;
64
+ return content.split(re)
65
+ .filter((l) => l !== '')
66
+ .map((v) => parseSystemLogLine(v))
67
+ .filter((l): l is SystemLogLine => l !== undefined);
68
+ }
69
+
70
+ export function parseDeviceLog(line: string): DeviceLogLine | undefined {
71
+ const re = /^(\d{2}:\d{2}:\d{2}\.\d+)\s(.*)\|(.*)$/gm;
72
+ const result = re.exec(line);
73
+ if (result) {
74
+ return {
75
+ time: result[1].trim(),
76
+ level: result[2].trim(),
77
+ message: result[3].trim(),
78
+ };
79
+ }
80
+ return;
81
+ }
82
+
83
+ export function parseDeviceLogContent(content: string): DeviceLogLine[] {
84
+ return content.split('\n')
85
+ .map((v) => parseDeviceLog(v))
86
+ .filter((l): l is DeviceLogLine => l !== undefined);
87
+ }
88
+
89
+ export function mapParameterTypeValueToObject(type: keyof ParameterTypeValue, value: number | string): ParameterTypeValue {
90
+ const p: ParameterTypeValue = {};
91
+ if (type === 'floatValue') {
92
+ p['floatValue'] = typeof value === 'number' ? value : parseFloat(value);
93
+ } else if (type === 'intValue') {
94
+ p['intValue'] = typeof value === 'number' ? value : parseInt(value, 10);
95
+ } else if (type === 'rawValue') {
96
+ if (typeof value === 'number') {
97
+ p['rawValue'] = Uint8Array.from([value]);
98
+ } else {
99
+ let bytes: number[] = [];
100
+ if (value.startsWith('0x')) {
101
+ bytes = value.slice(2).match(/.{1,2}/g)?.map((h) => parseInt(h, 16)) ?? [];
102
+ } else {
103
+ bytes = value.split(',').map((c) => c.trim()).map((c) => parseInt(c, 10));
104
+ }
105
+ p['rawValue'] = Uint8Array.from(bytes);
106
+ }
107
+ } else if (type === 'stringValue') {
108
+ p['stringValue'] = typeof value === 'string' ? value : value.toString();
109
+ } else if (type === 'uintValue') {
110
+ p['uintValue'] = typeof value === 'number' ? value : parseInt(value, 10);
111
+ }
112
+ return p;
113
+ }
114
+
115
+ // Using bytes fixes: ERROR TypeError: Cannot freeze array buffer views with elements in NgRx
116
+ export function createPlainObjectFromMotionMasterMessage(motionMasterMessage: MotionMasterMessage) {
117
+ return MotionMasterMessage.toObject(motionMasterMessage, {
118
+ bytes: Array, // Valid values are `Array`
119
+ defaults: true, // Also sets default values on the resulting object
120
+ arrays: true, // Sets empty arrays for missing repeated fields even if `defaults=false`
121
+ objects: true, // Sets empty objects for missing map fields even if `defaults=false`
122
+ oneofs: true, // Includes virtual oneof properties set to the present field's name, if any
123
+ json: true, // Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings
124
+ });
125
+ }
126
+
127
+ export function convertMotionMasterMessageToLoggerContext(motionMasterMessage: IMotionMasterMessage, namespace = 'reqResMessage') {
128
+ let type;
129
+ let name;
130
+
131
+ if (motionMasterMessage.request) {
132
+ type = 'request';
133
+ name = Object.keys(motionMasterMessage.request).join();
134
+ } else if (motionMasterMessage.status) {
135
+ type = 'status';
136
+ name = Object.keys(motionMasterMessage.status).join();
137
+ }
138
+
139
+ return { namespace, motionMasterMessage, type, name };
140
+ }
141
+
142
+ export function decodeTextContent(content: Uint8Array): string {
143
+ const decoder = new TextDecoder();
144
+ const buffer = Uint8Array.from(content);
145
+ return decoder.decode(buffer);
146
+ }
147
+
148
+ export function isRxPdoIndex(index: number): boolean {
149
+ return inRange(index, 0x1600, 0x1800);
150
+ }
151
+
152
+ export function isTxPdoIndex(index: number): boolean {
153
+ return inRange(index, 0x1A00, 0x1C00);
154
+ }
155
+
156
+ export function filterRxPdoParameters<T extends ParameterIndexSubindex>(parameters: T[], excludeSubIndex000 = false): T[] {
157
+ return parameters.filter((p) => isRxPdoIndex(p.index) && (excludeSubIndex000 ? p.subindex > 0 : true)); // RxPDOs: Index area 0x1600 to 0x17FF
158
+ }
159
+
160
+ export function filterTxPdoParameters<T extends ParameterIndexSubindex>(parameters: T[], excludeSubIndex000 = false): T[] {
161
+ return parameters.filter((p) => isTxPdoIndex(p.index) && (excludeSubIndex000 ? p.subindex > 0 : true)); // TxPDOs: Index area 0x1A00 to 0x1BFF
162
+ }
163
+
164
+ export function fillPdoParametersWithMappingEntries(parameters: Parameter[], entriesPerPdo = 10): Parameter[] {
165
+ const output: Parameter[] = [];
166
+ let i = 0;
167
+ while (i < parameters.length) {
168
+ if (parameters[i].subindex === 0) {
169
+ let j = i;
170
+ while (parameters[j] && (parameters[j].index === parameters[i].index)) {
171
+ output.push(parameters[j]);
172
+ j++;
173
+ }
174
+ let d = j - i;
175
+ while (d <= entriesPerPdo) {
176
+ output.push({
177
+ index: parameters[i].index,
178
+ subindex: d,
179
+ name: parameters[i].name,
180
+ uintValue: 0,
181
+ value: 0,
182
+ valueType: ValueType.UNSIGNED32,
183
+ group: parameters[i].group,
184
+ typeValueKey: "uintValue",
185
+ readAccess: true,
186
+ writeAccess: true,
187
+ });
188
+ d++;
189
+ }
190
+ i = j;
191
+ } else {
192
+ i++;
193
+ }
194
+ }
195
+ return output;
196
+ }
197
+
198
+ export function mapParameterToPdoSubItemValue(parameter: Parameter): number {
199
+ const { index, subindex } = parameter;
200
+ if (parameter.valueType && parameter.valueType < ValueType.VISIBLE_STRING) {
201
+ const buffer = new ArrayBuffer(4);
202
+ const view = new DataView(buffer);
203
+ const bitSize = mapValueTypeToBitSize(parameter.valueType);
204
+ view.setUint16(0, index);
205
+ view.setUint8(2, subindex);
206
+ view.setUint8(3, bitSize);
207
+ return view.getUint32(0);
208
+ }
209
+ return 0;
210
+ }
211
+
212
+ export function mapValueTypeToBitSize(valueType: ValueType): number {
213
+ switch (valueType) {
214
+ case ValueType.UNSPECIFIED:
215
+ return 0;
216
+ case ValueType.BOOLEAN:
217
+ return 1;
218
+ case ValueType.INTEGER8:
219
+ case ValueType.UNSIGNED8:
220
+ return 8;
221
+ case ValueType.INTEGER16:
222
+ case ValueType.UNSIGNED16:
223
+ return 16;
224
+ case ValueType.INTEGER32:
225
+ case ValueType.UNSIGNED32:
226
+ case ValueType.REAL32:
227
+ return 32;
228
+ }
229
+ throw new Error(`Non-numeric value type "${valueType}" (data types with variable length) cannot be mapped to bit size. You will have to get this info from ESI.`);
230
+ }
231
+
232
+ export const valueTypeToParameterTypeValueKeyMap = new Map<ValueType, keyof Required<ParameterTypeValue>>([
233
+ [ValueType.BOOLEAN, 'uintValue'],
234
+ [ValueType.INTEGER8, 'intValue'],
235
+ [ValueType.INTEGER16, 'intValue'],
236
+ [ValueType.INTEGER32, 'intValue'],
237
+ [ValueType.UNSIGNED8, 'uintValue'],
238
+ [ValueType.UNSIGNED16, 'uintValue'],
239
+ [ValueType.UNSIGNED32, 'uintValue'],
240
+ [ValueType.REAL32, 'floatValue'],
241
+ [ValueType.VISIBLE_STRING, 'stringValue'],
242
+ [ValueType.OCTET_STRING, 'rawValue'],
243
+ [ValueType.UNICODE_STRING, 'stringValue'],
244
+ [ValueType.TIME_OF_DAY, 'uintValue'],
245
+ ]);
246
+
247
+ export function isValidDeviceRefObj(obj: DeviceRefObj): boolean {
248
+ return Number.isFinite(Number(obj.deviceAddress))
249
+ || (typeof obj.devicePosition === 'number' && obj.devicePosition >= 0)
250
+ || typeof obj.deviceSerialNumber === 'string';
251
+ }
252
+
253
+ export function createPdoParameterValues(parameters: Array<{ index: number, subindex: number, typeValue?: ParameterTypeValueKey }>, values: Array<ParameterValueType>) {
254
+ const output = parameters.map((parameter, i, arr) => {
255
+ const { index, subindex, typeValue } = parameter;
256
+ let value = values[i];
257
+ if (subindex === 0) {
258
+ value = arr.reduce((n, p, j) => (p.index === index && p.subindex > 0 && values[j]) ? n + 1 : n, 0);
259
+ }
260
+ return [index, subindex, value, typeValue];
261
+ }) as ParameterAddressValue[];
262
+
263
+ for (let i = 0; i < output.length - 1; i++) {
264
+ const [, subindex1, value1] = output[i];
265
+ if (subindex1 > 0 && value1 === 0) {
266
+ let j = i + 1;
267
+ let [, subindex2, value2] = output[j];
268
+ while (subindex2 > subindex1 && output[j]) {
269
+ if (typeof value2 === 'number' && value2 > 0) {
270
+ output[i][2] = value2;
271
+ output[j][2] = 0;
272
+ break;
273
+ }
274
+ if (output[++j]) {
275
+ [, subindex2, value2] = output[j];
276
+ }
277
+ }
278
+ }
279
+ }
280
+
281
+ return output;
282
+ }
283
+
284
+ export function resolveAfter(ms: number, value?: unknown) {
285
+ return new Promise(function (resolve) {
286
+ setTimeout(resolve.bind(null, value), ms);
287
+ });
288
+ }
289
+
290
+ export function convertRgbToLedColor(value: number) {
291
+ const r = (value >> 16) & 0xFF;
292
+ const g = (value >> 8) & 0xFF;
293
+ const b = value & 0xFF;
294
+ const ledColorValue = (g << 16) | (r << 8) | b;
295
+ return ledColorValue;
296
+ }
297
+
298
+ export function createRandomColor(brightness: number) {
299
+ function randomChannel(brightness: number) {
300
+ const r = 255 - brightness;
301
+ const n = 0 | ((Math.random() * r) + brightness);
302
+ const s = n.toString(16);
303
+ return (s.length == 1) ? '0' + s : s;
304
+ }
305
+ return '#' + randomChannel(brightness) + randomChannel(brightness) + randomChannel(brightness);
306
+ }
307
+
308
+ export const emptyAppBase64 = 'UEsDBBQACAAIABBye08AAAAAAAAAAAAAAAANACAAYXBwX2VtcHR5LmJpblVUDQAHMHfeXTB33l0wd95ddXgLAAEE6AMAAAToAwAAAwBQSwcIAAAAAAIAAAAAAAAAUEsBAhQDFAAIAAgAEHJ7TwAAAAACAAAAAAAAAA0AIAAAAAAAAAAAAKSBAAAAAGFwcF9lbXB0eS5iaW5VVA0ABzB33l0wd95dMHfeXXV4CwABBOgDAAAE6AMAAFBLBQYAAAAAAQABAFsAAABdAAAAAAA=';
309
+
310
+ export function getMapKeyByValue<K, V>(map: Map<K, V>, searchValue: V): K | undefined {
311
+ for (let [key, value] of map.entries()) {
312
+ if (value === searchValue) {
313
+ return key;
314
+ }
315
+ }
316
+ return;
317
+ }
318
+
319
+ export function findDuplicates<T>(arr: T[]): T[] {
320
+ const uniqueElements = new Set<T>();
321
+ const duplicates = new Set<T>();
322
+
323
+ for (const item of arr) {
324
+ if (uniqueElements.has(item)) {
325
+ duplicates.add(item);
326
+ } else {
327
+ uniqueElements.add(item);
328
+ }
329
+ }
330
+
331
+ return Array.from(duplicates);
332
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
3
+ */
4
+ export const webSocketConnectionCloseCodes = [
5
+ {
6
+ statusCode: 1000,
7
+ meaning: 'Normal Closure',
8
+ description: 'The connection successfully completed the purpose for which it was created.',
9
+ },
10
+ {
11
+ statusCode: 1001,
12
+ meaning: 'Going Away',
13
+ description: 'The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection.',
14
+ },
15
+ {
16
+ statusCode: 1002,
17
+ meaning: 'Protocol error',
18
+ description: 'The endpoint is terminating the connection due to a protocol error.',
19
+ },
20
+ {
21
+ statusCode: 1003,
22
+ meaning: 'Unsupported Data',
23
+ description: 'The connection is being terminated because the endpoint received data of a type it cannot accept. (For example, a text-only endpoint received binary data.)',
24
+ },
25
+ {
26
+ statusCode: 1004,
27
+ meaning: 'Reserved',
28
+ description: 'Reserved. A meaning might be defined in the future.',
29
+ },
30
+ {
31
+ statusCode: 1005,
32
+ meaning: 'No Status Rcvd',
33
+ description: 'Reserved. Indicates that no status code was provided even though one was expected.',
34
+ },
35
+ {
36
+ statusCode: 1006,
37
+ meaning: 'Abnormal Closure',
38
+ description: 'Reserved. Indicates that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected.',
39
+ },
40
+ {
41
+ statusCode: 1007,
42
+ meaning: 'Invalid frame payload data',
43
+ description: 'The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message).',
44
+ },
45
+ {
46
+ statusCode: 1008,
47
+ meaning: 'Policy Violation',
48
+ description: 'The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable.',
49
+ },
50
+ {
51
+ statusCode: 1009,
52
+ meaning: 'Message Too Big',
53
+ description: 'The endpoint is terminating the connection because a data frame was received that is too large.',
54
+ },
55
+ {
56
+ statusCode: 1010,
57
+ meaning: 'Mandatory Ext.',
58
+ description: 'The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn\'t.',
59
+ },
60
+ {
61
+ statusCode: 1011,
62
+ meaning: 'Internal Error',
63
+ description: 'The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.',
64
+ },
65
+ {
66
+ statusCode: 1012,
67
+ meaning: 'Service Restart',
68
+ description: 'The server is terminating the connection because it is restarting.',
69
+ },
70
+ {
71
+ statusCode: 1013,
72
+ meaning: 'Try Again Later',
73
+ description: 'The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients.',
74
+ },
75
+ {
76
+ statusCode: 1014,
77
+ meaning: 'Bad Gateway',
78
+ description: 'The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code.',
79
+ },
80
+ {
81
+ statusCode: 1015,
82
+ meaning: 'TLS handshake',
83
+ description: 'Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can\'t be verified).',
84
+ },
85
+ ];
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "forceConsistentCasingInFileNames": true,
6
+ "strict": true,
7
+ "noImplicitOverride": true,
8
+ "noPropertyAccessFromIndexSignature": true,
9
+ "noImplicitReturns": true,
10
+ "noFallthroughCasesInSwitch": true,
11
+ "allowJs": true
12
+ },
13
+ "files": [],
14
+ "include": [],
15
+ "references": [
16
+ {
17
+ "path": "./tsconfig.lib.json"
18
+ },
19
+ {
20
+ "path": "./tsconfig.spec.json"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "declaration": true,
6
+ "types": ["node"]
7
+ },
8
+ "include": ["src/**/*.ts"],
9
+ "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
10
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": ["jest", "node"]
7
+ },
8
+ "include": [
9
+ "**/*.test.ts",
10
+ "**/*.spec.ts",
11
+ "**/*.test.tsx",
12
+ "**/*.spec.tsx",
13
+ "**/*.test.js",
14
+ "**/*.spec.js",
15
+ "**/*.test.jsx",
16
+ "**/*.spec.jsx",
17
+ "**/*.d.ts",
18
+ "jest.config.ts"
19
+ ]
20
+ }
package/typedoc.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "entryPoints": [
3
+ "./src/index.ts"
4
+ ],
5
+ "out": "../../docs/motion-master-client",
6
+ "tsconfig": "./tsconfig.json",
7
+ "exclude": [
8
+ "**/*+(.spec|.e2e).ts"
9
+ ]
10
+ }
package/src/index.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./lib/cia402"), exports);
5
- tslib_1.__exportStar(require("./lib/config-file"), exports);
6
- tslib_1.__exportStar(require("./lib/device-log-line"), exports);
7
- tslib_1.__exportStar(require("./lib/device-parameter"), exports);
8
- tslib_1.__exportStar(require("./lib/device"), exports);
9
- tslib_1.__exportStar(require("./lib/hardware-description"), exports);
10
- tslib_1.__exportStar(require("./lib/monitoring-config"), exports);
11
- tslib_1.__exportStar(require("./lib/monitoring-entry"), exports);
12
- tslib_1.__exportStar(require("./lib/motion-master-client"), exports);
13
- tslib_1.__exportStar(require("./lib/motion-master-pub-sub-client"), exports);
14
- tslib_1.__exportStar(require("./lib/motion-master-pub-sub-socket"), exports);
15
- tslib_1.__exportStar(require("./lib/motion-master-pub-sub-web-socket"), exports);
16
- tslib_1.__exportStar(require("./lib/motion-master-pub-sub-worker-socket"), exports);
17
- tslib_1.__exportStar(require("./lib/motion-master-req-res-client"), exports);
18
- tslib_1.__exportStar(require("./lib/motion-master-req-res-socket"), exports);
19
- tslib_1.__exportStar(require("./lib/motion-master-req-res-web-socket"), exports);
20
- tslib_1.__exportStar(require("./lib/motion-master-req-res-worker-socket"), exports);
21
- tslib_1.__exportStar(require("./lib/operators"), exports);
22
- tslib_1.__exportStar(require("./lib/options"), exports);
23
- tslib_1.__exportStar(require("./lib/parameter"), exports);
24
- tslib_1.__exportStar(require("./lib/request-status-resolver"), exports);
25
- tslib_1.__exportStar(require("./lib/system-log-line"), exports);
26
- tslib_1.__exportStar(require("./lib/types"), exports);
27
- tslib_1.__exportStar(require("./lib/urls"), exports);
28
- tslib_1.__exportStar(require("./lib/util"), exports);
29
- tslib_1.__exportStar(require("./lib/web-socket-connection-close-codes"), exports);
30
- //# sourceMappingURL=index.js.map
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/motion-master-client/src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,4DAAkC;AAClC,gEAAsC;AACtC,iEAAuC;AACvC,uDAA6B;AAC7B,qEAA2C;AAC3C,kEAAwC;AACxC,iEAAuC;AACvC,qEAA2C;AAC3C,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,6EAAmD;AACnD,6EAAmD;AACnD,iFAAuD;AACvD,oFAA0D;AAC1D,0DAAgC;AAChC,wDAA8B;AAC9B,0DAAgC;AAChC,wEAA8C;AAC9C,gEAAsC;AACtC,sDAA4B;AAC5B,qDAA2B;AAC3B,qDAA2B;AAC3B,kFAAwD"}