jooby-codec 1.1.0 → 1.2.0
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/dist/Command.d.ts +1 -1
- package/dist/Command.js +3 -4
- package/dist/Command.js.map +1 -1
- package/dist/CommandBinaryBuffer.d.ts +41 -0
- package/dist/CommandBinaryBuffer.js +46 -2
- package/dist/CommandBinaryBuffer.js.map +1 -1
- package/dist/UnknownCommand.d.ts +20 -0
- package/dist/UnknownCommand.js +22 -0
- package/dist/UnknownCommand.js.map +1 -0
- package/dist/commands/downlink/CorrectTime2000.d.ts +2 -2
- package/dist/commands/downlink/CorrectTime2000.js +2 -1
- package/dist/commands/downlink/CorrectTime2000.js.map +1 -1
- package/dist/commands/downlink/GetArchiveHoursMul.d.ts +47 -0
- package/dist/commands/downlink/GetArchiveHoursMul.js +66 -0
- package/dist/commands/downlink/GetArchiveHoursMul.js.map +1 -0
- package/dist/commands/downlink/NewStatus.d.ts +1 -1
- package/dist/commands/downlink/NewStatus.js +2 -1
- package/dist/commands/downlink/NewStatus.js.map +1 -1
- package/dist/commands/downlink/SetTime2000.d.ts +2 -2
- package/dist/commands/downlink/SetTime2000.js +2 -1
- package/dist/commands/downlink/SetTime2000.js.map +1 -1
- package/dist/commands/downlink/SoftRestart.d.ts +1 -1
- package/dist/commands/downlink/SoftRestart.js +2 -1
- package/dist/commands/downlink/SoftRestart.js.map +1 -1
- package/dist/commands/downlink/index.d.ts +1 -0
- package/dist/commands/downlink/index.js +1 -0
- package/dist/commands/downlink/index.js.map +1 -1
- package/dist/commands/uplink/CorrectTime2000.d.ts +1 -1
- package/dist/commands/uplink/CorrectTime2000.js +2 -1
- package/dist/commands/uplink/CorrectTime2000.js.map +1 -1
- package/dist/commands/uplink/DataDayMul.d.ts +1 -1
- package/dist/commands/uplink/DataDayMul.js +2 -1
- package/dist/commands/uplink/DataDayMul.js.map +1 -1
- package/dist/commands/uplink/DataHourMul.d.ts +1 -1
- package/dist/commands/uplink/DataHourMul.js +4 -4
- package/dist/commands/uplink/DataHourMul.js.map +1 -1
- package/dist/commands/uplink/ExAbsDayMul.d.ts +1 -1
- package/dist/commands/uplink/ExAbsDayMul.js +2 -2
- package/dist/commands/uplink/ExAbsDayMul.js.map +1 -1
- package/dist/commands/uplink/ExAbsHourMul.d.ts +1 -1
- package/dist/commands/uplink/ExAbsHourMul.js +2 -2
- package/dist/commands/uplink/ExAbsHourMul.js.map +1 -1
- package/dist/commands/uplink/GetArchiveHoursMul.d.ts +28 -0
- package/dist/commands/uplink/GetArchiveHoursMul.js +51 -0
- package/dist/commands/uplink/GetArchiveHoursMul.js.map +1 -0
- package/dist/commands/uplink/GetCurrentMul.d.ts +1 -1
- package/dist/commands/uplink/GetCurrentMul.js +2 -1
- package/dist/commands/uplink/GetCurrentMul.js.map +1 -1
- package/dist/commands/uplink/LastEvent.d.ts +116 -0
- package/dist/commands/uplink/LastEvent.js +164 -0
- package/dist/commands/uplink/LastEvent.js.map +1 -0
- package/dist/commands/uplink/NewEvent.d.ts +1 -1
- package/dist/commands/uplink/NewEvent.js +3 -2
- package/dist/commands/uplink/NewEvent.js.map +1 -1
- package/dist/commands/uplink/NewStatus.d.ts +1 -1
- package/dist/commands/uplink/NewStatus.js +3 -2
- package/dist/commands/uplink/NewStatus.js.map +1 -1
- package/dist/commands/uplink/SetTime2000.d.ts +1 -1
- package/dist/commands/uplink/SetTime2000.js +2 -1
- package/dist/commands/uplink/SetTime2000.js.map +1 -1
- package/dist/commands/uplink/SoftRestart.d.ts +1 -1
- package/dist/commands/uplink/SoftRestart.js +2 -1
- package/dist/commands/uplink/SoftRestart.js.map +1 -1
- package/dist/commands/uplink/Time2000.d.ts +2 -2
- package/dist/commands/uplink/Time2000.js +2 -1
- package/dist/commands/uplink/Time2000.js.map +1 -1
- package/dist/commands/uplink/index.d.ts +2 -0
- package/dist/commands/uplink/index.js +2 -0
- package/dist/commands/uplink/index.js.map +1 -1
- package/dist/constants/directionTypes.d.ts +3 -0
- package/dist/constants/directionTypes.js +4 -0
- package/dist/constants/directionTypes.js.map +1 -0
- package/dist/constants/hardwareTypes.d.ts +56 -0
- package/dist/constants/hardwareTypes.js +56 -14
- package/dist/constants/hardwareTypes.js.map +1 -1
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +2 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/utils/bitSet.d.ts +40 -0
- package/dist/utils/bitSet.js +54 -0
- package/dist/utils/bitSet.js.map +1 -0
- package/dist/utils/message.d.ts +2 -5
- package/dist/utils/message.js +30 -30
- package/dist/utils/message.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import Command from '../../Command.js';
|
|
2
2
|
import CommandBinaryBuffer from '../../CommandBinaryBuffer.js';
|
|
3
|
-
import * as hardwareTypes from '../../constants/hardwareTypes.js';
|
|
4
3
|
import roundNumber from '../../utils/roundNumber.js';
|
|
4
|
+
import * as hardwareTypes from '../../constants/hardwareTypes.js';
|
|
5
|
+
import { UPLINK } from '../../constants/directionTypes.js';
|
|
5
6
|
const COMMAND_ID = 0x14;
|
|
6
7
|
const COMMAND_TITLE = 'NEW_STATUS';
|
|
7
8
|
const COMMAND_BODY_MAX_SIZE = 20;
|
|
@@ -133,7 +134,7 @@ class NewStatus extends Command {
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
NewStatus.id = COMMAND_ID;
|
|
136
|
-
NewStatus.
|
|
137
|
+
NewStatus.directionType = UPLINK;
|
|
137
138
|
NewStatus.title = COMMAND_TITLE;
|
|
138
139
|
export default NewStatus;
|
|
139
140
|
//# sourceMappingURL=NewStatus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewStatus.js","sourceRoot":"","sources":["../../../src/commands/uplink/NewStatus.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,mBAAsC,MAAM,8BAA8B,CAAC;AAClF,OAAO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AAiB,EAAE,KAAK,CAAC,CAAC;iBAC9C;qBAAM;oBACH,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;iBAC1D;gBAED,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;gBAExC,IAAK,UAAU,CAAC,uBAAuB,KAAK,SAAS,EAAG;oBACpD,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;iBAC7C;qBAAM;oBACH,MAAM,CAAC,QAAQ,CAAC,CAAC,wBAAwB,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,uBAAuB,GAAG,GAAG,CAAC,CAAC,CAAC;iBAChG;gBAED,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;gBAEpD,MAAM;YAEV,KAAK,aAAa,CAAC,OAAO,CAAC;YAC3B,KAAK,aAAa,CAAC,KAAK,CAAC;YACzB;gBACI,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,EAAE,mBAAmB,QAAQ,CAAC,IAAI,mBAAmB,CAAC,CAAC;SAChG;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAClE,CAAC;;AA1Ge,YAAE,GAAG,UAAU,CAAC;AAEhB,uBAAa,GAAG,MAAM,CAAC;AAEvB,eAAK,GAAG,aAAa,CAAC;AA0G1C,eAAe,SAAS,CAAC"}
|
|
@@ -29,7 +29,7 @@ declare class SetTime2000 extends Command {
|
|
|
29
29
|
parameters: IUplinkSetTime2000Parameters;
|
|
30
30
|
constructor(parameters: IUplinkSetTime2000Parameters);
|
|
31
31
|
static readonly id = 2;
|
|
32
|
-
static readonly
|
|
32
|
+
static readonly directionType = 2;
|
|
33
33
|
static readonly title = "SET_TIME_2000";
|
|
34
34
|
static fromBytes(data: Uint8Array): SetTime2000;
|
|
35
35
|
toBytes(): Uint8Array;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Command from '../../Command.js';
|
|
2
2
|
import BinaryBuffer from '../../BinaryBuffer.js';
|
|
3
|
+
import { UPLINK } from '../../constants/directionTypes.js';
|
|
3
4
|
const COMMAND_ID = 0x02;
|
|
4
5
|
const COMMAND_TITLE = 'SET_TIME_2000';
|
|
5
6
|
const COMMAND_BODY_SIZE = 1;
|
|
@@ -47,7 +48,7 @@ class SetTime2000 extends Command {
|
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
SetTime2000.id = COMMAND_ID;
|
|
50
|
-
SetTime2000.
|
|
51
|
+
SetTime2000.directionType = UPLINK;
|
|
51
52
|
SetTime2000.title = COMMAND_TITLE;
|
|
52
53
|
export default SetTime2000;
|
|
53
54
|
//# sourceMappingURL=SetTime2000.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetTime2000.js","sourceRoot":"","sources":["../../../src/commands/uplink/SetTime2000.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"SetTime2000.js","sourceRoot":"","sources":["../../../src/commands/uplink/SetTime2000.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;AAczD,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,aAAa,GAAG,eAAe,CAAC;AACtC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAG5B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAY,SAAQ,OAAO;IAC7B,YAAqB,UAAwC;QACzD,KAAK,EAAE,CAAC;QADS,eAAU,GAAV,UAAU,CAA8B;IAE7D,CAAC;IAQD,oCAAoC;IACpC,MAAM,CAAC,SAAS,CAAG,IAAgB;QAC/B,IAAK,IAAI,CAAC,UAAU,KAAK,iBAAiB,EAAG;YACzC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,wBAAwB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;SAChF;QAED,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAE7C,MAAM,UAAU,GAAG;YACf,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;SAC5B,CAAC;QAEF,IAAK,CAAC,MAAM,CAAC,OAAO,EAAG;YACnB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,8BAA8B,CAAC,CAAC;SACpE;QAED,OAAO,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,OAAO;QACH,MAAM,EAAC,MAAM,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;QAE1D,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAExB,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;;AAhCe,cAAE,GAAG,UAAU,CAAC;AAEhB,yBAAa,GAAG,MAAM,CAAC;AAEvB,iBAAK,GAAG,aAAa,CAAC;AAgC1C,eAAe,WAAW,CAAC"}
|
|
@@ -16,7 +16,7 @@ import Command from '../../Command.js';
|
|
|
16
16
|
*/
|
|
17
17
|
declare class SoftRestart extends Command {
|
|
18
18
|
static readonly id = 25;
|
|
19
|
-
static readonly
|
|
19
|
+
static readonly directionType = 2;
|
|
20
20
|
static readonly title = "SOFT_RESTART";
|
|
21
21
|
static fromBytes(): SoftRestart;
|
|
22
22
|
toBytes(): Uint8Array;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Command from '../../Command.js';
|
|
2
|
+
import { UPLINK } from '../../constants/directionTypes.js';
|
|
2
3
|
const COMMAND_ID = 0x19;
|
|
3
4
|
const COMMAND_TITLE = 'SOFT_RESTART';
|
|
4
5
|
/**
|
|
@@ -27,7 +28,7 @@ class SoftRestart extends Command {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
SoftRestart.id = COMMAND_ID;
|
|
30
|
-
SoftRestart.
|
|
31
|
+
SoftRestart.directionType = UPLINK;
|
|
31
32
|
SoftRestart.title = COMMAND_TITLE;
|
|
32
33
|
export default SoftRestart;
|
|
33
34
|
//# sourceMappingURL=SoftRestart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SoftRestart.js","sourceRoot":"","sources":["../../../src/commands/uplink/SoftRestart.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"SoftRestart.js","sourceRoot":"","sources":["../../../src/commands/uplink/SoftRestart.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,mCAAmC,CAAC;AAGzD,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,aAAa,GAAG,cAAc,CAAC;AAGrC;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAY,SAAQ,OAAO;IAO7B,oCAAoC;IACpC,MAAM,CAAC,SAAS;QACZ,OAAO,IAAI,WAAW,EAAE,CAAC;IAC7B,CAAC;IAED,kDAAkD;IAClD,OAAO;QACH,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;;AAde,cAAE,GAAG,UAAU,CAAC;AAEhB,yBAAa,GAAG,MAAM,CAAC;AAEvB,iBAAK,GAAG,aAAa,CAAC;AAc1C,eAAe,WAAW,CAAC"}
|
|
@@ -7,7 +7,7 @@ import Command from '../../Command.js';
|
|
|
7
7
|
* {sequenceNumber: 77, time: 733845677}
|
|
8
8
|
*/
|
|
9
9
|
interface ITime2000Parameters {
|
|
10
|
-
/**
|
|
10
|
+
/** unique time manipulation operation number */
|
|
11
11
|
sequenceNumber: number;
|
|
12
12
|
/** seconds since year 2000 */
|
|
13
13
|
time: number;
|
|
@@ -33,7 +33,7 @@ declare class Time2000 extends Command {
|
|
|
33
33
|
parameters: ITime2000Parameters;
|
|
34
34
|
constructor(parameters: ITime2000Parameters);
|
|
35
35
|
static readonly id = 9;
|
|
36
|
-
static readonly
|
|
36
|
+
static readonly directionType = 2;
|
|
37
37
|
static readonly title = "TIME_2000";
|
|
38
38
|
static fromBytes(data: Uint8Array): Time2000;
|
|
39
39
|
toBytes(): Uint8Array;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Command from '../../Command.js';
|
|
2
2
|
import CommandBinaryBuffer from '../../CommandBinaryBuffer.js';
|
|
3
|
+
import { UPLINK } from '../../constants/directionTypes.js';
|
|
3
4
|
const COMMAND_ID = 0x09;
|
|
4
5
|
const COMMAND_TITLE = 'TIME_2000';
|
|
5
6
|
const COMMAND_BODY_SIZE = 5;
|
|
@@ -50,7 +51,7 @@ class Time2000 extends Command {
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
Time2000.id = COMMAND_ID;
|
|
53
|
-
Time2000.
|
|
54
|
+
Time2000.directionType = UPLINK;
|
|
54
55
|
Time2000.title = COMMAND_TITLE;
|
|
55
56
|
export default Time2000;
|
|
56
57
|
//# sourceMappingURL=Time2000.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Time2000.js","sourceRoot":"","sources":["../../../src/commands/uplink/Time2000.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Time2000.js","sourceRoot":"","sources":["../../../src/commands/uplink/Time2000.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,mBAAmB,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAC,MAA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,CAAC;;AAlCe,WAAE,GAAG,UAAU,CAAC;AAEhB,sBAAa,GAAG,MAAM,CAAC;AAEvB,cAAK,GAAG,aAAa,CAAC;AAkC1C,eAAe,QAAQ,CAAC"}
|
|
@@ -8,7 +8,9 @@ export { default as DataDayMul } from './DataDayMul.js';
|
|
|
8
8
|
export { default as DataHourMul } from './DataHourMul.js';
|
|
9
9
|
export { default as ExAbsDayMul } from './ExAbsDayMul.js';
|
|
10
10
|
export { default as ExAbsHourMul } from './ExAbsHourMul.js';
|
|
11
|
+
export { default as GetArchiveHoursMul } from './GetArchiveHoursMul.js';
|
|
11
12
|
export { default as GetCurrentMul } from './GetCurrentMul.js';
|
|
13
|
+
export { default as LastEvent } from './LastEvent.js';
|
|
12
14
|
export { default as NewEvent } from './NewEvent.js';
|
|
13
15
|
export { default as NewStatus } from './NewStatus.js';
|
|
14
16
|
export { default as SetTime2000 } from './SetTime2000.js';
|
|
@@ -8,7 +8,9 @@ export { default as DataDayMul } from './DataDayMul.js';
|
|
|
8
8
|
export { default as DataHourMul } from './DataHourMul.js';
|
|
9
9
|
export { default as ExAbsDayMul } from './ExAbsDayMul.js';
|
|
10
10
|
export { default as ExAbsHourMul } from './ExAbsHourMul.js';
|
|
11
|
+
export { default as GetArchiveHoursMul } from './GetArchiveHoursMul.js';
|
|
11
12
|
export { default as GetCurrentMul } from './GetCurrentMul.js';
|
|
13
|
+
export { default as LastEvent } from './LastEvent.js';
|
|
12
14
|
export { default as NewEvent } from './NewEvent.js';
|
|
13
15
|
export { default as NewStatus } from './NewStatus.js';
|
|
14
16
|
export { default as SetTime2000 } from './SetTime2000.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/uplink/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAA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eAAe,CAAC;AAClD,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directionTypes.js","sourceRoot":"","sources":["../../src/constants/directionTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC;AACtB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC"}
|
|
@@ -1,14 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GAS RM on cpu STM32L15x - no longer in production, over 10,000 were produced.
|
|
3
|
+
*/
|
|
1
4
|
export declare const GAZM3 = 1;
|
|
5
|
+
/**
|
|
6
|
+
* GAS RM on cpu STM32L05x - no longer in production, several thousand produced.
|
|
7
|
+
*/
|
|
2
8
|
export declare const GAZM0 = 2;
|
|
9
|
+
/**
|
|
10
|
+
* GAS RM on cpu STM32L05x - test batch.
|
|
11
|
+
*/
|
|
3
12
|
export declare const GAZM0NEW = 3;
|
|
13
|
+
/**
|
|
14
|
+
* RM for novator.
|
|
15
|
+
*
|
|
16
|
+
* 2 channels
|
|
17
|
+
*/
|
|
4
18
|
export declare const NOVATOR = 4;
|
|
19
|
+
/**
|
|
20
|
+
* RM with 2 ports, no longer in production.
|
|
21
|
+
*
|
|
22
|
+
* 2 channels
|
|
23
|
+
*/
|
|
5
24
|
export declare const IMP2EU = 5;
|
|
25
|
+
/**
|
|
26
|
+
* RM with 4 ports, EU868.
|
|
27
|
+
*
|
|
28
|
+
* 4 channels
|
|
29
|
+
*/
|
|
6
30
|
export declare const IMP4EU = 6;
|
|
31
|
+
/**
|
|
32
|
+
* RM installed inside MTX meters.
|
|
33
|
+
*/
|
|
7
34
|
export declare const MTXLORA = 7;
|
|
35
|
+
/**
|
|
36
|
+
* RM with 2 ports for the Asian region, AS923, no longer in production.
|
|
37
|
+
*
|
|
38
|
+
* 2 channels
|
|
39
|
+
*/
|
|
8
40
|
export declare const IMP2AS = 8;
|
|
41
|
+
/**
|
|
42
|
+
* RM with 2 ports for the Asian region, IN865, no longer in production.
|
|
43
|
+
*
|
|
44
|
+
* 2 channels
|
|
45
|
+
*/
|
|
9
46
|
export declare const IMP2IN = 9;
|
|
47
|
+
/**
|
|
48
|
+
* RM with 4 ports for the Asian region, IN865, no longer in production.
|
|
49
|
+
*
|
|
50
|
+
* 4 channels
|
|
51
|
+
*/
|
|
10
52
|
export declare const IMP4IN = 10;
|
|
53
|
+
/**
|
|
54
|
+
* Single-port module with supply 220 V. CLASS_C.
|
|
55
|
+
*
|
|
56
|
+
* 1 channel
|
|
57
|
+
*/
|
|
11
58
|
export declare const ELIMP = 11;
|
|
59
|
+
/**
|
|
60
|
+
* GAS RM on cpu STM32WLE5.
|
|
61
|
+
*/
|
|
12
62
|
export declare const GAZWLE = 12;
|
|
63
|
+
/**
|
|
64
|
+
* RM for ultrasonic water meter (Rozhok laboratory).
|
|
65
|
+
*/
|
|
13
66
|
export declare const WATER = 13;
|
|
67
|
+
/**
|
|
68
|
+
* Combined PLC2 & LORA RM for MTX electric energy meter.
|
|
69
|
+
*/
|
|
14
70
|
export declare const PLC2LORA = 14;
|
|
@@ -1,29 +1,71 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* GAS RM on cpu STM32L15x - no longer in production, over 10,000 were produced.
|
|
3
|
+
*/
|
|
2
4
|
export const GAZM3 = 1;
|
|
3
|
-
|
|
5
|
+
/**
|
|
6
|
+
* GAS RM on cpu STM32L05x - no longer in production, several thousand produced.
|
|
7
|
+
*/
|
|
4
8
|
export const GAZM0 = 2;
|
|
5
|
-
|
|
9
|
+
/**
|
|
10
|
+
* GAS RM on cpu STM32L05x - test batch.
|
|
11
|
+
*/
|
|
6
12
|
export const GAZM0NEW = 3;
|
|
7
|
-
|
|
13
|
+
/**
|
|
14
|
+
* RM for novator.
|
|
15
|
+
*
|
|
16
|
+
* 2 channels
|
|
17
|
+
*/
|
|
8
18
|
export const NOVATOR = 4;
|
|
9
|
-
|
|
19
|
+
/**
|
|
20
|
+
* RM with 2 ports, no longer in production.
|
|
21
|
+
*
|
|
22
|
+
* 2 channels
|
|
23
|
+
*/
|
|
10
24
|
export const IMP2EU = 5;
|
|
11
|
-
|
|
25
|
+
/**
|
|
26
|
+
* RM with 4 ports, EU868.
|
|
27
|
+
*
|
|
28
|
+
* 4 channels
|
|
29
|
+
*/
|
|
12
30
|
export const IMP4EU = 6;
|
|
13
|
-
|
|
31
|
+
/**
|
|
32
|
+
* RM installed inside MTX meters.
|
|
33
|
+
*/
|
|
14
34
|
export const MTXLORA = 7;
|
|
15
|
-
|
|
35
|
+
/**
|
|
36
|
+
* RM with 2 ports for the Asian region, AS923, no longer in production.
|
|
37
|
+
*
|
|
38
|
+
* 2 channels
|
|
39
|
+
*/
|
|
16
40
|
export const IMP2AS = 8;
|
|
17
|
-
|
|
41
|
+
/**
|
|
42
|
+
* RM with 2 ports for the Asian region, IN865, no longer in production.
|
|
43
|
+
*
|
|
44
|
+
* 2 channels
|
|
45
|
+
*/
|
|
18
46
|
export const IMP2IN = 9;
|
|
19
|
-
|
|
47
|
+
/**
|
|
48
|
+
* RM with 4 ports for the Asian region, IN865, no longer in production.
|
|
49
|
+
*
|
|
50
|
+
* 4 channels
|
|
51
|
+
*/
|
|
20
52
|
export const IMP4IN = 10;
|
|
21
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Single-port module with supply 220 V. CLASS_C.
|
|
55
|
+
*
|
|
56
|
+
* 1 channel
|
|
57
|
+
*/
|
|
22
58
|
export const ELIMP = 11;
|
|
23
|
-
|
|
59
|
+
/**
|
|
60
|
+
* GAS RM on cpu STM32WLE5.
|
|
61
|
+
*/
|
|
24
62
|
export const GAZWLE = 12;
|
|
25
|
-
|
|
63
|
+
/**
|
|
64
|
+
* RM for ultrasonic water meter (Rozhok laboratory).
|
|
65
|
+
*/
|
|
26
66
|
export const WATER = 13;
|
|
27
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Combined PLC2 & LORA RM for MTX electric energy meter.
|
|
69
|
+
*/
|
|
28
70
|
export const PLC2LORA = 14;
|
|
29
71
|
//# sourceMappingURL=hardwareTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardwareTypes.js","sourceRoot":"","sources":["../../src/constants/hardwareTypes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hardwareTypes.js","sourceRoot":"","sources":["../../src/constants/hardwareTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC;AAEvB;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC;AAEvB;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC;AAE1B;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AAEzB;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AAEzB;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,CAAC;AAEzB;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,CAAC;AAEzB;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC"}
|
package/dist/constants/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type TBitSetMask = Record<string, number>;
|
|
2
|
+
export type TBooleanObject = Record<string, boolean>;
|
|
3
|
+
/**
|
|
4
|
+
* Get integer number from object with boolean values values according to the given bit mask.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const bitMask: bitSet.TBitSetMask = {
|
|
9
|
+
* a: 2 ** 0,
|
|
10
|
+
* b: 2 ** 1,
|
|
11
|
+
* c: 2 ** 2,
|
|
12
|
+
* d: 2 ** 3,
|
|
13
|
+
* g: 2 ** 6
|
|
14
|
+
* };
|
|
15
|
+
*
|
|
16
|
+
* const result = fromObject(bitMask, {a: true, b: true, c: false, d: true, e: true, f: false, g: true});
|
|
17
|
+
* console.log(result.toString(2));
|
|
18
|
+
* // 1001011
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const fromObject: (bitMask: TBitSetMask, booleanObject: TBooleanObject) => number;
|
|
22
|
+
/**
|
|
23
|
+
* Get object with boolean values values from integer number according to the given bit mask.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const bitMask: bitSet.TBitSetMask = {
|
|
28
|
+
* a: 2 ** 0,
|
|
29
|
+
* b: 2 ** 1,
|
|
30
|
+
* c: 2 ** 2,
|
|
31
|
+
* d: 2 ** 3,
|
|
32
|
+
* g: 2 ** 6
|
|
33
|
+
* };
|
|
34
|
+
*
|
|
35
|
+
* const result = toObject(bitMask, parseInt('0110100', 2));
|
|
36
|
+
* console.log(result);
|
|
37
|
+
* // {a: false, b: false, c: true, d: false, g: false}
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const toObject: (bitMask: TBitSetMask, value: number) => TBooleanObject;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get integer number from object with boolean values values according to the given bit mask.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const bitMask: bitSet.TBitSetMask = {
|
|
7
|
+
* a: 2 ** 0,
|
|
8
|
+
* b: 2 ** 1,
|
|
9
|
+
* c: 2 ** 2,
|
|
10
|
+
* d: 2 ** 3,
|
|
11
|
+
* g: 2 ** 6
|
|
12
|
+
* };
|
|
13
|
+
*
|
|
14
|
+
* const result = fromObject(bitMask, {a: true, b: true, c: false, d: true, e: true, f: false, g: true});
|
|
15
|
+
* console.log(result.toString(2));
|
|
16
|
+
* // 1001011
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const fromObject = (bitMask, booleanObject) => {
|
|
20
|
+
let result = 0;
|
|
21
|
+
for (const [name, value] of Object.entries(booleanObject)) {
|
|
22
|
+
if (name in bitMask && value) {
|
|
23
|
+
result |= bitMask[name];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Get object with boolean values values from integer number according to the given bit mask.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const bitMask: bitSet.TBitSetMask = {
|
|
34
|
+
* a: 2 ** 0,
|
|
35
|
+
* b: 2 ** 1,
|
|
36
|
+
* c: 2 ** 2,
|
|
37
|
+
* d: 2 ** 3,
|
|
38
|
+
* g: 2 ** 6
|
|
39
|
+
* };
|
|
40
|
+
*
|
|
41
|
+
* const result = toObject(bitMask, parseInt('0110100', 2));
|
|
42
|
+
* console.log(result);
|
|
43
|
+
* // {a: false, b: false, c: true, d: false, g: false}
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export const toObject = (bitMask, value) => {
|
|
47
|
+
const result = {};
|
|
48
|
+
for (const [name, position] of Object.entries(bitMask)) {
|
|
49
|
+
result[name] = (value & position) !== 0;
|
|
50
|
+
}
|
|
51
|
+
console.log('result:', result);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=bitSet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitSet.js","sourceRoot":"","sources":["../../src/utils/bitSet.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAE,OAAoB,EAAE,aAA6B,EAAW,EAAE;IACxF,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,KAAM,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAG;QACzD,IAAK,IAAI,IAAI,OAAO,IAAI,KAAK,EAAG;YAC5B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;SAC3B;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAGF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAE,OAAoB,EAAE,KAAa,EAAmB,EAAE;IAC9E,MAAM,MAAM,GAAmB,EAAE,CAAC;IAElC,KAAM,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAG;QACtD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;KAC3C;IAED,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC"}
|
package/dist/utils/message.d.ts
CHANGED
|
@@ -17,11 +17,8 @@ interface IMessage {
|
|
|
17
17
|
};
|
|
18
18
|
isValid: boolean;
|
|
19
19
|
}
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const TYPE_UPLINK = 2;
|
|
23
|
-
export declare const fromBytes: (data: Uint8Array, direction?: number) => IMessage;
|
|
24
|
-
export declare const fromHex: (data: string, direction?: number) => IMessage;
|
|
20
|
+
export declare const fromBytes: (data: Uint8Array, direction?: number, hardwareType?: number) => IMessage;
|
|
21
|
+
export declare const fromHex: (data: string, direction?: number, hardwareType?: number) => IMessage;
|
|
25
22
|
export declare const toBytes: (commands: Array<Command>) => Uint8Array;
|
|
26
23
|
export declare const toHex: (commands: Array<Command>, options?: IHexFormatOptions) => string;
|
|
27
24
|
export {};
|
package/dist/utils/message.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
2
|
+
import UnknownCommand from '../UnknownCommand.js';
|
|
1
3
|
import * as downlinkCommands from '../commands/downlink/index.js';
|
|
2
4
|
import * as uplinkCommands from '../commands/uplink/index.js';
|
|
5
|
+
import * as directionTypes from '../constants/directionTypes.js';
|
|
6
|
+
import { AUTO, DOWNLINK, UPLINK } from '../constants/directionTypes.js';
|
|
3
7
|
import * as header from './header.js';
|
|
4
8
|
import getBytesFromHex from './getBytesFromHex.js';
|
|
5
9
|
import getHexFromBytes from './getHexFromBytes.js';
|
|
6
|
-
export const TYPE_AUTO = 0;
|
|
7
|
-
export const TYPE_DOWNLINK = 1;
|
|
8
|
-
export const TYPE_UPLINK = 2;
|
|
9
10
|
const HEADER_MAX_SIZE = 3;
|
|
11
|
+
// all allowed types
|
|
12
|
+
const directionTypeIds = new Set(Object.values(directionTypes));
|
|
10
13
|
// convert export namespace to dictionary {commandId: commandConstructor}
|
|
11
14
|
const downlinkCommandsById = Object.fromEntries(Object.values(downlinkCommands).map(item => [item.id, item]));
|
|
12
15
|
const uplinkCommandsById = Object.fromEntries(Object.values(uplinkCommands).map(item => [item.id, item]));
|
|
@@ -24,37 +27,34 @@ const calculateLrc = (data, initialLrc = 0x55) => {
|
|
|
24
27
|
});
|
|
25
28
|
return lrc;
|
|
26
29
|
};
|
|
27
|
-
const getCommand = (id, data, direction =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const commandsById = direction === TYPE_DOWNLINK ? downlinkCommandsById : uplinkCommandsById;
|
|
31
|
-
const command = commandsById[id];
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
33
|
-
if (!command) {
|
|
34
|
-
throw new Error(`Unsupported command with id: ${id}.`);
|
|
35
|
-
}
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
37
|
-
return command.fromBytes(data);
|
|
30
|
+
const getCommand = (id, data, direction = AUTO, hardwareType) => {
|
|
31
|
+
if (!directionTypeIds.has(direction)) {
|
|
32
|
+
throw new Error('wrong direction type');
|
|
38
33
|
}
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
const downlinkCommand = downlinkCommandsById[id];
|
|
35
|
+
const uplinkCommand = uplinkCommandsById[id];
|
|
36
|
+
// check command availability
|
|
37
|
+
if ((!downlinkCommand && !uplinkCommand)
|
|
38
|
+
|| (direction === DOWNLINK && !downlinkCommand)
|
|
39
|
+
|| (direction === UPLINK && !uplinkCommand)) {
|
|
40
|
+
// missing command implementation
|
|
41
|
+
return new UnknownCommand({ id, data });
|
|
42
|
+
}
|
|
43
|
+
// ths specific direction
|
|
44
|
+
if (direction === DOWNLINK || direction === UPLINK) {
|
|
45
|
+
const command = direction === UPLINK ? uplinkCommand : downlinkCommand;
|
|
46
|
+
return command.fromBytes(data, hardwareType);
|
|
47
|
+
}
|
|
48
|
+
// direction autodetect
|
|
41
49
|
try {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// console.log('downlinkCommandsById:', downlinkCommandsById);
|
|
45
|
-
// console.log('id:', id);
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
47
|
-
return command.fromBytes(data);
|
|
50
|
+
// uplink should be more often
|
|
51
|
+
return uplinkCommand.fromBytes(data, hardwareType);
|
|
48
52
|
}
|
|
49
53
|
catch {
|
|
50
|
-
|
|
51
|
-
const command = uplinkCommandsById[id];
|
|
52
|
-
//console.log('command uplink:', command);
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
54
|
-
return command.fromBytes(data);
|
|
54
|
+
return downlinkCommand.fromBytes(data);
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
export const fromBytes = (data, direction =
|
|
57
|
+
export const fromBytes = (data, direction = AUTO, hardwareType) => {
|
|
58
58
|
const commandsData = data.slice(0, -1);
|
|
59
59
|
const expectedLrc = data.at(-1) ?? 0;
|
|
60
60
|
const actualLrc = calculateLrc(commandsData);
|
|
@@ -71,7 +71,7 @@ export const fromBytes = (data, direction = TYPE_AUTO) => {
|
|
|
71
71
|
const bodyData = commandsData.slice(position + headerInfo.headerSize, position + headerInfo.headerSize + headerInfo.commandSize);
|
|
72
72
|
commands.push({
|
|
73
73
|
data: { header: headerData, body: bodyData },
|
|
74
|
-
command: getCommand(headerInfo.commandId, bodyData, direction)
|
|
74
|
+
command: getCommand(headerInfo.commandId, bodyData, direction, hardwareType)
|
|
75
75
|
});
|
|
76
76
|
// shift
|
|
77
77
|
position = position + headerInfo.headerSize + headerInfo.commandSize;
|
|
@@ -81,7 +81,7 @@ export const fromBytes = (data, direction = TYPE_AUTO) => {
|
|
|
81
81
|
result.isValid = expectedLrc === actualLrc;
|
|
82
82
|
return result;
|
|
83
83
|
};
|
|
84
|
-
export const fromHex = (data, direction =
|
|
84
|
+
export const fromHex = (data, direction = AUTO, hardwareType) => (fromBytes(getBytesFromHex(data), direction, hardwareType));
|
|
85
85
|
export const toBytes = (commands) => {
|
|
86
86
|
const arrays = commands.map(command => command.toBytes());
|
|
87
87
|
const totalLength = arrays.reduce((accumulator, item) => (accumulator + item.length), 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/utils/message.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/utils/message.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAGhE,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,gBAAgB,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAE9D,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,gCAAgC,CAAC;AAEtE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,eAAoC,MAAM,sBAAsB,CAAC;AAuBxE,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B,oBAAoB;AACpB,MAAM,gBAAgB,GAAgB,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;AAErF,yEAAyE;AACzE,MAAM,oBAAoB,GAAG,MAAM,CAAC,WAAW,CAC3C,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAC/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B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAClB,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzB,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,uBAAuB;IACvB,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IAE7E,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAE,QAAwB,EAAE,UAA6B,EAAE,EAAW,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jooby-codec",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Jooby message encoders/decoders",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./dist/index.js",
|
|
9
|
-
"./ts": "./src/index.js",
|
|
10
9
|
"./commands": "./dist/commands/index.js",
|
|
11
10
|
"./commands/downlink": "./dist/commands/downlink/index.js",
|
|
12
11
|
"./commands/downlink/*": "./dist/commands/downlink/*.js",
|
|
13
12
|
"./commands/uplink": "./dist/commands/uplink/index.js",
|
|
14
13
|
"./commands/uplink/*": "./dist/commands/uplink/*.js",
|
|
14
|
+
"./constants/*": "./dist/constants/*.js",
|
|
15
15
|
"./utils/*": "./dist/utils/*.js"
|
|
16
16
|
},
|
|
17
17
|
"types": "./dist/index.d.ts",
|