@puzzle-electronics/sdk 0.0.0-stage → 0.30.7
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/LICENSE +5 -0
- package/README.md +44 -2
- package/dist/index.cjs +15854 -0
- package/dist/index.d.cts +20775 -0
- package/dist/index.d.ts +20775 -0
- package/dist/index.js +15818 -0
- package/package.json +49 -4
- package/puzzle-root-ca.crt +15 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Copyright (c) 2026 Puzzle Electronics Corporation. All rights reserved.
|
|
2
|
+
|
|
3
|
+
This software is proprietary to Puzzle Electronics Corporation ("Puzzle"). Puzzle grants you a non-exclusive, non-transferable license to install and use this software, unmodified, solely to develop and run applications that communicate with Puzzle hardware. You may distribute it only as part of such an application, unmodified except as that application's build tools compile, bundle or minify it. Code this software generates, such as new projects, and examples copied from its documentation may be used, modified and distributed without restriction. No other right or license is granted, whether by implication or otherwise, except as Puzzle agrees in writing.
|
|
4
|
+
|
|
5
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL PUZZLE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Puzzle SDK for TypeScript
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Connect to [Puzzle Electronics](https://puzzleelectronics.com) systems from Node.js or the browser: load modules, send
|
|
4
|
+
commands, and stream data, with types for every module.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```shell
|
|
9
|
+
npm install @puzzle-electronics/sdk
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { Facades, apiKeyAuthenticator, clientInstance } from "@puzzle-electronics/sdk";
|
|
16
|
+
|
|
17
|
+
const host = "puzzle-acme-001.local";
|
|
18
|
+
// Systems with accounts need an API key, created in the dashboard's System Settings
|
|
19
|
+
clientInstance.onAuthenticate = apiKeyAuthenticator(process.env.PUZZLE_API_KEY!, `https://${host}`);
|
|
20
|
+
await clientInstance.connect(host);
|
|
21
|
+
|
|
22
|
+
const rs485 = await Facades.load_serial_rs485("SerialRS485");
|
|
23
|
+
const portA = rs485.channel("A");
|
|
24
|
+
|
|
25
|
+
await portA.transmitString("READ?\n");
|
|
26
|
+
for await (const message of portA.streamReceivedString()) {
|
|
27
|
+
console.log(message.data);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Systems serve a certificate from the Puzzle root CA, which ships with this package. In Node, connect by hostname
|
|
32
|
+
rather than IP address and trust the root:
|
|
33
|
+
|
|
34
|
+
```shell
|
|
35
|
+
NODE_EXTRA_CA_CERTS=node_modules/@puzzle-electronics/sdk/puzzle-root-ca.crt node app.js
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
Guides and module reference: [docs.puzzleelectronics.com](https://docs.puzzleelectronics.com). For help, see
|
|
41
|
+
[Getting help](https://docs.puzzleelectronics.com/getting-help).
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
Proprietary, for use with Puzzle hardware. See the LICENSE file included with the package.
|