-
Notifications
You must be signed in to change notification settings - Fork 8
Typescript LMAO #4
base: master
Are you sure you want to change the base?
Conversation
Rename to scoped package Update links, badges Don't use make Update travis confignpm
Typo, technically breaking change
Enable packing typescript artifacts
Eliminated dependencies
Added `keys` and `values` Maps to Enum for direct lookup. This enables clearer and more performant code and will make it easier to see which lookup tables are used / can be eliminated in the whole stack Added more JSDoc descriptions Elminated `null` from `cluster_defs.json` Now the properties are just optional instead Double quotes (Prettier default)
So essentially you built enum into the package? Hmm, personally I like the abstraction of a seperate package from a testing point of view. One of the main reasons we switched to light-enum was the memory usage, light-enum saved us approx 20% of the memory in use on a simple test application. It doesn't rebuild new objects as often for the inverse mappings (remember each lookup works in both directions by default) and makes use of those loaded from source. |
I currently made the typings not depend on the interface CommonJSON {
profileId: Record<string, number>;
foundation: Record<string, number>;
dataType: Record<string, number>;
status: Record<string, number>;
clusterId: Record<string, number>;
haDevId: Record<string, number>;
[key: string]: Record<string, number>;
} but this enables Other choices are: 1. Making it depend on the
|
@splitice I probably have a negative impact on memory at the moment, each |
These are the codes described in **11.13.2 OTA Cluster Status Codes** [on page 701](http://www.zigbee.org/~zigbeeor/wp-content/uploads/2014/10/07-5123-06-zigbee-cluster-library-specification.pdf). Originally added by @splitice in HalleyAssist@34baf8c
This reverts commit 9a27ea8. We aren't sure what these commands are yet, but they will be possible to add through the extend hook.
I'm not keen on the introduction of a typescript step. An extends method was our original plan, however we had some difficulties making that happen at the time as such a patched fork was the method we went with. |
Old singleton import can be achieved with `require("zcl-id/legacy")`
The source of truth will now be the denormalized deduplicated format This also includes the responsibilities of `zcl_meta` from `zcl-packet` Also fixed some missing information discovered
Do you mean for the JSONs? Yeah, not doing that currently. Additionally, in e25fd3a, I started working on a new source-of-truth format. "genIdentify": {
"id": 3,
"attrs": {
"identifyTime": {
"id": 0,
"type": "uint16"
},
"identifyCommissionState": {
"id": 1,
"type": "unknown"
}
},
"cmd": {
"identify": {
"id": 0,
"params": [["identifytime", "uint16"]]
},
"identifyQuery": {
"id": 1,
"params": []
},
"ezModeInvoke": {
"id": 2,
"params": [["action", "uint8"]]
},
"updateCommissionState": {
"id": 3,
"params": [["action", "uint8"], ["commstatemask", "uint8"]]
},
"triggerEffect": {
"id": 64,
"params": [["effectid", "uint8"], ["effectvariant", "uint8"]]
}
},
"cmdRsp": {
"identifyQueryRsp": {
"id": 0,
"params": [["timeout", "uint16"]]
}
} The params.reduce((s, [_, t]) => s + (t === "uint8") || (t === "uint16") * 2) (I checked) I am keeping object style for |
Run through prettier instead
Made tests pass without module depending on old JSONs Old jsons still referenced by tests
zclmeta depends on them for now
Also removed conversion script to prevent overwriting
The only breaking change is
writeStrcut
typo (and the corresponding Rsp) being corrected towriteStruct
.Has been tested with the
zigbee2mqtt
stack.That's also what I used to profile what of the
"enum"
package's functionality is needed, not just in own methods.It wasn't much. That module is essentially being misused here, so I eliminated it. @splitice also did similarly in his forks, replacing it with his
"light-enum"
.But I believe the "enum" API doesn't represent a useful abstraction here, so I plan to eliminate it entirely, in favor of direct lookups.
The API of the local "enum" replacement in
enum.ts
(which I want to propagate up the stack) represents this.I also eliminated the other dependency,
"busyman"
- a lodash alternative, in favor of native ES5 methods.There are 0 runtime dependencies now.
Finally, I added decent(?) JSDoc documentation of exported objects and functions.
Also, it's set up to release in the
@zigbee
npm namespace.I need this merged and regarded as the status quo so that I can reasonably go up the stack with
zcl-id
types being providedzcl-id
"enums" to replace the overloaded.get