@synapticon/motion-master-client 2.3.0-beta.0 → 6.0.0-alpha.22
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 +21 -0
- package/dist/client.d.ts +20 -0
- package/dist/client.js +37 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +8 -0
- package/dist/generated/Api.d.ts +991 -0
- package/dist/generated/Api.js +614 -0
- package/dist/generated/data-contracts.d.ts +644 -0
- package/dist/generated/data-contracts.js +12 -0
- package/dist/generated/http-client.d.ts +60 -0
- package/dist/generated/http-client.js +171 -0
- package/dist/hex.d.ts +2 -0
- package/dist/hex.js +20 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.js +16 -22
- package/dist/mmpd.d.ts +54 -0
- package/dist/mmpd.js +323 -0
- package/dist/sdo.d.ts +15 -0
- package/dist/sdo.js +212 -0
- package/dist/somanet.d.ts +5 -0
- package/dist/somanet.js +15 -0
- package/dist/web-socket-connection.d.ts +69 -0
- package/dist/web-socket-connection.js +206 -0
- package/package.json +29 -35
- package/.vscode/launch.json +0 -23
- package/README.md +0 -118
- package/box.config.json +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/motion-master-client-web-socket-connection.d.ts +0 -43
- package/dist/motion-master-client-web-socket-connection.d.ts.map +0 -1
- package/dist/motion-master-client-web-socket-connection.js +0 -91
- package/dist/motion-master-client-web-socket-connection.js.map +0 -1
- package/dist/motion-master-client.d.ts +0 -105
- package/dist/motion-master-client.d.ts.map +0 -1
- package/dist/motion-master-client.js +0 -348
- package/dist/motion-master-client.js.map +0 -1
- package/dist/motion-master-notification-subscribe-data.d.ts +0 -8
- package/dist/motion-master-notification-subscribe-data.d.ts.map +0 -1
- package/dist/motion-master-notification-subscribe-data.js +0 -3
- package/dist/motion-master-notification-subscribe-data.js.map +0 -1
- package/dist/motion-master-notification-web-socket-connection.d.ts +0 -56
- package/dist/motion-master-notification-web-socket-connection.d.ts.map +0 -1
- package/dist/motion-master-notification-web-socket-connection.js +0 -115
- package/dist/motion-master-notification-web-socket-connection.js.map +0 -1
- package/dist/motion-master-notification.d.ts +0 -31
- package/dist/motion-master-notification.d.ts.map +0 -1
- package/dist/motion-master-notification.js +0 -44
- package/dist/motion-master-notification.js.map +0 -1
- package/dist/util.d.ts +0 -16
- package/dist/util.d.ts.map +0 -1
- package/dist/util.js +0 -24
- package/dist/util.js.map +0 -1
- package/licenses.format.json +0 -4
- package/motion-master-client.config.json +0 -7
- package/smm_data_dic.json +0 -1213
- package/src/index.ts +0 -7
- package/src/motion-master-client-web-socket-connection.ts +0 -104
- package/src/motion-master-client.ts +0 -468
- package/src/motion-master-notification-subscribe-data.ts +0 -7
- package/src/motion-master-notification-web-socket-connection.ts +0 -143
- package/src/motion-master-notification.ts +0 -51
- package/src/util.ts +0 -22
- package/test.sh +0 -122
- package/tsconfig.json +0 -63
- package/tslint.json +0 -118
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Synapticon GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Api } from './generated/Api.js';
|
|
2
|
+
import type { ApiConfig } from './generated/http-client.js';
|
|
3
|
+
import { type MmpdFile } from './mmpd.js';
|
|
4
|
+
import { WebSocketConnection, type WebSocketConstructor } from './web-socket-connection.js';
|
|
5
|
+
export interface MotionMasterClientOptions {
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
wsUrl?: string;
|
|
8
|
+
WebSocket?: WebSocketConstructor;
|
|
9
|
+
webSocketOptions?: unknown;
|
|
10
|
+
customFetch?: ApiConfig['customFetch'];
|
|
11
|
+
}
|
|
12
|
+
export declare class MotionMasterClient {
|
|
13
|
+
readonly api: Api;
|
|
14
|
+
readonly ws: WebSocketConnection;
|
|
15
|
+
private readonly httpBaseUrl;
|
|
16
|
+
private readonly customFetch?;
|
|
17
|
+
constructor(options?: MotionMasterClientOptions);
|
|
18
|
+
fetchProcessDataDump(signal?: AbortSignal): Promise<MmpdFile>;
|
|
19
|
+
close(): void;
|
|
20
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// The MotionMasterClient facade: a single connection object that composes the generated HTTP API
|
|
2
|
+
// (`client.api.*`, flat — e.g. `client.api.getVersion()`) with the WebSocket connection
|
|
3
|
+
// (`client.ws`). It is a *connection, not a model*: it holds no mutable device/parameter/AL state
|
|
4
|
+
// — the HTTP API and the monitoring stream are the source of truth. Isomorphic: pass `WebSocket`
|
|
5
|
+
// (and `customFetch`) to run under Node; both default to the platform globals in the browser.
|
|
6
|
+
import { Api } from './generated/Api.js';
|
|
7
|
+
import { API_BASE_URL, WS_URL } from './constants.js';
|
|
8
|
+
import { fetchProcessDataDump } from './mmpd.js';
|
|
9
|
+
import { WebSocketConnection } from './web-socket-connection.js';
|
|
10
|
+
export class MotionMasterClient {
|
|
11
|
+
/// The generated HTTP API client. Flat method surface: `client.api.getVersion()`,
|
|
12
|
+
/// `client.api.scan()`, `client.api.sdoUpload(...)`, ...
|
|
13
|
+
api;
|
|
14
|
+
/// The WebSocket connection: `client.ws.subscribe(topic, cb)`,
|
|
15
|
+
/// `client.ws.onNotification(cb)`, `client.ws.onProgress(cb)`. Connects lazily.
|
|
16
|
+
ws;
|
|
17
|
+
httpBaseUrl;
|
|
18
|
+
customFetch;
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this.httpBaseUrl = options.baseUrl ?? API_BASE_URL;
|
|
21
|
+
this.customFetch = options.customFetch;
|
|
22
|
+
this.api = new Api({ baseUrl: this.httpBaseUrl, customFetch: options.customFetch });
|
|
23
|
+
this.ws = new WebSocketConnection({
|
|
24
|
+
url: options.wsUrl ?? WS_URL,
|
|
25
|
+
WebSocket: options.WebSocket,
|
|
26
|
+
protocolsOrOptions: options.webSocketOptions,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/// Fetches and parses the live recorder dump (`GET /api/process-data/dump`) as an `MmpdFile`.
|
|
30
|
+
fetchProcessDataDump(signal) {
|
|
31
|
+
return fetchProcessDataDump(this.httpBaseUrl, { fetch: this.customFetch, signal });
|
|
32
|
+
}
|
|
33
|
+
/// Closes the WebSocket connection (and cancels reconnection). The HTTP API needs no teardown.
|
|
34
|
+
close() {
|
|
35
|
+
this.ws.close();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Default endpoints for a Motion Master instance running on the same machine as the client. The
|
|
2
|
+
// bundled Let's Encrypt cert is for `local.motion-master.synapticon.com`, which resolves to
|
|
3
|
+
// 127.0.0.1, so these work out of the box for a localhost install. Override both via
|
|
4
|
+
// `MotionMasterClient` options for a remote/LAN deployment.
|
|
5
|
+
export const API_BASE_URL = 'https://local.motion-master.synapticon.com:61447';
|
|
6
|
+
// The WebSocket connection runs on its own port/loop (separate from the HTTP API) so a slow HTTP
|
|
7
|
+
// request can never stall the monitoring/notification stream.
|
|
8
|
+
export const WS_URL = 'wss://local.motion-master.synapticon.com:62281';
|