@npmteam2024/sapiente-blanditiis-temporibus
v1.0.1
Published
Downloads
7
Maintainers
Keywords
Readme
LwM2M TypeScript type definitions and JSON schema
TypeScript type definitions and JSON schema for the objects defined in the LwM2M Object Registry.
This is useful if you need to validate a JSON representation of those objects.
Installation
npm ci
// Clone LwM2M object registry
git clone https://github.com/OpenMobileAlliance/lwm2m-registry.git --depth 1
npm test
Usage
See example.ts
JSON document structure
LwM2M values are encoded as a JSON document, where the key is an extended
version of the LwM2M URN: <ObjectID>:<ObjectVersion>@<LwM2MVersion>
(where
ObjectVersion
and/or LwM2MVersion
can be omitted if it is 1.0
).
Building the types
git clone https://github.com/OpenMobileAlliance/lwm2m-registry.git --depth 1
npx tsx cli/generate-types.ts
npx tsx cli/generate-json-schema.ts
# Format the source
npx prettier --write ./
# Make sure result compiles
npx tsc
# Compile JS exports
npx swc -d types-dist ./types
# Make sure example runs
npx tsx ./example.ts