@transai/connector-runner-xylem 0.0.0-stage → 0.1.2
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/CHANGELOG.md +19 -0
- package/DOCUMENTATION.md +50 -0
- package/README.md +110 -2
- package/index.cjs +66 -0
- package/index.cjs.map +7 -0
- package/integrations/connector-runner-xylem/src/connector-runner-xylem.d.ts +5 -0
- package/integrations/connector-runner-xylem/src/index.d.ts +5 -0
- package/integrations/connector-runner-xylem/src/types.d.ts +16 -0
- package/integrations/connector-runner-xylem/src/xylem-controller-poller.d.ts +9 -0
- package/integrations/connector-runner-xylem/src/xylem-digest.d.ts +29 -0
- package/integrations/connector-runner-xylem/src/xylem-live-data.schema.d.ts +103 -0
- package/integrations/connector-runner-xylem/src/xylem-metrics.d.ts +8 -0
- package/integrations/connector-runner-xylem/src/xylem-metrics.types.d.ts +49 -0
- package/integrations/connector-runner-xylem/src/xylem-metrics.utils.d.ts +4 -0
- package/libs/connector-runtime-sdk/src/index.d.ts +5 -0
- package/libs/connector-runtime-sdk/src/lib/connector-runtime.d.ts +16 -0
- package/libs/connector-runtime-sdk/src/lib/connector-runtime.interface.d.ts +5 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/files.sdk.interface.d.ts +19 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/http-client.interface.d.ts +49 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/index.d.ts +10 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/logger.sdk.interface.d.ts +7 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/offset-store.sdk.interface.d.ts +13 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/processing.sdk.interface.d.ts +30 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/receiver.sdk.interface.d.ts +14 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/sdk.interface.d.ts +31 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/sender.sdk.interface.d.ts +26 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/telemetry.sdk.interface.d.ts +15 -0
- package/libs/connector-runtime-sdk/src/lib/sdk/templating.sdk.interface.d.ts +12 -0
- package/libs/connector-runtime-sdk/src/lib/support/index.d.ts +1 -0
- package/libs/connector-runtime-sdk/src/lib/support/null-logger.d.ts +8 -0
- package/libs/connector-runtime-sdk/src/lib/types/action.d.ts +63 -0
- package/libs/connector-runtime-sdk/src/lib/types/kafka.d.ts +40 -0
- package/libs/connector-runtime-sdk/src/lib/types.d.ts +26 -0
- package/package.json +16 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## 0.1.1 (2026-10-02)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated @transai/connector-runtime-sdk to 0.22.1
|
|
6
|
+
|
|
7
|
+
## 0.1.0 (2026-09-14)
|
|
8
|
+
|
|
9
|
+
### 🚀 Features
|
|
10
|
+
|
|
11
|
+
- **XODO-1805:** xylem improvements ([#1570](https://github.com/xip-online-applications/xod-core/pull/1570))
|
|
12
|
+
|
|
13
|
+
### 🧱 Updated Dependencies
|
|
14
|
+
|
|
15
|
+
- Updated @transai/connector-runtime-sdk to 0.22.0
|
|
16
|
+
|
|
17
|
+
### ❤️ Thank You
|
|
18
|
+
|
|
19
|
+
- Twan Kuipers
|
package/DOCUMENTATION.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Xylem
|
|
2
|
+
|
|
3
|
+
The Xylem connector polls configured Xylem controllers for live data and forwards controller, sensor, measurement, notification, and status data to transAI.
|
|
4
|
+
|
|
5
|
+
## Configuration
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"controllers": [
|
|
10
|
+
{
|
|
11
|
+
"id": "controller-1",
|
|
12
|
+
"baseUrl": "https://xylem-controller.example.com",
|
|
13
|
+
"username": "<USERNAME>",
|
|
14
|
+
"password": "<PASSWORD>",
|
|
15
|
+
"intervalSeconds": 60,
|
|
16
|
+
"name": "Main controller",
|
|
17
|
+
"location": "Production line 1",
|
|
18
|
+
"endpoint": "/api/v1/livedata",
|
|
19
|
+
"timeoutMs": 10000
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`controllers` is required and must contain at least one controller. Each controller requires a unique `id`, `baseUrl`, `username`, `password`, and `intervalSeconds`. `name`, `location`, `endpoint`, and `timeoutMs` are optional. The default endpoint is `/api/v1/livedata`.
|
|
26
|
+
|
|
27
|
+
The connector authenticates requests using HTTP Digest Authentication. The poll interval and request timeout are configured independently for each controller.
|
|
28
|
+
|
|
29
|
+
## Polling and data
|
|
30
|
+
|
|
31
|
+
The connector immediately polls each configured controller when it starts, and continues polling at its configured interval. Each response must be a Xylem `livedata` payload. Payloads are validated before they are normalized and stored.
|
|
32
|
+
|
|
33
|
+
The following collections are emitted:
|
|
34
|
+
|
|
35
|
+
| Collection | Contents |
|
|
36
|
+
| ------------------ | ----------------------------------------------------------------------------- |
|
|
37
|
+
| `controllers` | Controller identity and metadata, including firmware and payload information. |
|
|
38
|
+
| `sensors` | Sensor identity, model, serial number, state, and configuration details. |
|
|
39
|
+
| `values` | Main and sub-values, value state, units, display values, and ranges. |
|
|
40
|
+
| `notifications` | Controller notifications with codes, types, timestamps, and raw data words. |
|
|
41
|
+
| `sensor_status` | Numeric sensor state and the original Xylem sensor state. |
|
|
42
|
+
| `connector_status` | Poll success or failure, state code, duration, and error details. |
|
|
43
|
+
|
|
44
|
+
Measurements are emitted to `values` with `value` and `valueState` in the metric body. Sensor status is emitted to `sensor_status` with `state_code` and `sensorState` in the metric body. Controller, sensor, value, and notification records are sent as documents with stable identity fields to support upserts.
|
|
45
|
+
|
|
46
|
+
## Failure behavior
|
|
47
|
+
|
|
48
|
+
HTTP errors, request timeouts, invalid responses, and ingestion failures are logged and emit a failed `connector_status` record with state `0`. Successful polls emit a `connector_status` record with state `1` and the poll duration. Overlapping polls for the same controller are skipped and logged as errors.
|
|
49
|
+
|
|
50
|
+
Sensors with a normalized state of `-1` generate a warning while the remaining payload data continues to be processed.
|
package/README.md
CHANGED
|
@@ -1,3 +1,111 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Xylem Connector Runner
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Polls one or more Xylem controllers through `/api/v1/livedata` using HTTP Digest Authentication. The runner validates and normalizes each response, then sends documents and metrics through the connector SDK.
|
|
4
|
+
|
|
5
|
+
## Configuration
|
|
6
|
+
|
|
7
|
+
The connector extends the standard connector configuration with `controllers`:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"controllers": [
|
|
12
|
+
{
|
|
13
|
+
"id": "test-01",
|
|
14
|
+
"baseUrl": "http://localhost:8000",
|
|
15
|
+
"endpoint": "/api/v1/livedata",
|
|
16
|
+
"username": "ADMIN",
|
|
17
|
+
"password": "1111",
|
|
18
|
+
"timeoutMs": 5000,
|
|
19
|
+
"intervalSeconds": 10
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Each controller is polled independently. Optional controller fields are `name`, `location`, `endpoint`, and `timeoutMs`. The endpoint defaults to `/api/v1/livedata`.
|
|
26
|
+
|
|
27
|
+
## API Payload
|
|
28
|
+
|
|
29
|
+
The endpoint returns a live-data envelope containing controller metadata, sensors, and notifications:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"webServer": "1.1.8",
|
|
34
|
+
"payloadType": "livedata",
|
|
35
|
+
"payloadVersion": "0.3.4",
|
|
36
|
+
"controllerTime": 1786440563,
|
|
37
|
+
"controllerType": "",
|
|
38
|
+
"controllerSerial": "00000011",
|
|
39
|
+
"controllerName": "Controller A",
|
|
40
|
+
"controllerSW": "4.00",
|
|
41
|
+
"sensors": [],
|
|
42
|
+
"notifications": []
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Sensors contain identity and state fields. `sensorPod` is optional because some controller responses omit it. `mainValue` and `subValue` are optional and may contain:
|
|
47
|
+
|
|
48
|
+
- `valueState`, such as `VALID`, `INVALID`, or `OFL`;
|
|
49
|
+
- numeric `value` when available;
|
|
50
|
+
- `UoM`, display fields, and an optional numeric range.
|
|
51
|
+
|
|
52
|
+
Unknown fields are accepted by the Zod schemas so newer controller payloads do not fail solely because they contain additional fields. Required structural fields and value types are still validated.
|
|
53
|
+
|
|
54
|
+
## Parsing And Normalization
|
|
55
|
+
|
|
56
|
+
`xylem-live-data.schema.ts` validates the complete JSON response before any records are sent. `xylem-metrics.utils.ts` then normalizes the payload:
|
|
57
|
+
|
|
58
|
+
- Controller metadata is copied into all related records.
|
|
59
|
+
- Controller documents use the API controller serial as their stable identity.
|
|
60
|
+
- Sensor documents use `controllerSerial:sensorId` as their stable identity.
|
|
61
|
+
- Notifications use `controllerSerial:notificationId` as their stable identity.
|
|
62
|
+
- Value-location documents identify the controller, sensor, and `main`/`sub` value location. They retain units, ranges, sensor metadata, and `controllerTimestamp`, but not the actual reading.
|
|
63
|
+
- Numeric readings are emitted separately as value metrics.
|
|
64
|
+
- `controllerTime` is retained as record data; sender event timestamps use platform receipt time.
|
|
65
|
+
|
|
66
|
+
`INVALID` and `OFL` readings remain visible as records without a numeric value.
|
|
67
|
+
|
|
68
|
+
## Ingestion
|
|
69
|
+
|
|
70
|
+
Documents are sent with `sender.documents()` and stable `keyField` values:
|
|
71
|
+
|
|
72
|
+
| Collection | Content |
|
|
73
|
+
| --------------- | ----------------------------------------- |
|
|
74
|
+
| `controllers` | Current controller metadata |
|
|
75
|
+
| `sensors` | Current sensor metadata |
|
|
76
|
+
| `values` | Available measurement locations and units |
|
|
77
|
+
| `notifications` | Every notification, upserted by identity |
|
|
78
|
+
|
|
79
|
+
Metrics are sent with `sender.metrics()` in separate metadata-compatible groups:
|
|
80
|
+
|
|
81
|
+
| Collection | Metric body | Metadata |
|
|
82
|
+
| ------------------ | -------------------------- | ----------------------------------------------------- |
|
|
83
|
+
| `values` | `{ value }` | Controller, sensor, value kind, unit, sensor metadata |
|
|
84
|
+
| `sensor_status` | `{ state_code }` | Controller, sensor, raw state, sensor metadata |
|
|
85
|
+
| `connector_status` | `{ state_code, duration }` | Controller and raw poll status |
|
|
86
|
+
|
|
87
|
+
Metric dimensions are stored in sender metadata; metric bodies contain only measure values. The Cube template therefore uses `metadata.*` for dimensions and `data.*` for measures.
|
|
88
|
+
|
|
89
|
+
## Status Mapping
|
|
90
|
+
|
|
91
|
+
Sensor states map to numeric codes:
|
|
92
|
+
|
|
93
|
+
| Xylem state | Code |
|
|
94
|
+
| ----------- | ---: |
|
|
95
|
+
| `INACTIVE` | `0` |
|
|
96
|
+
| `MEASURING` | `1` |
|
|
97
|
+
| Unknown | `-1` |
|
|
98
|
+
|
|
99
|
+
Controller poll status maps `failure` to `0`, `success` to `1`, and unknown states to `-1`. Unknown sensor states generate a warning containing controller and sensor identity.
|
|
100
|
+
|
|
101
|
+
## Error Handling
|
|
102
|
+
|
|
103
|
+
Controllers are isolated: one controller's failure does not stop other controllers. Transport, HTTP, JSON, validation, and ingestion failures produce a failed connector-status metric. A malformed response is not partially normalized before validation.
|
|
104
|
+
|
|
105
|
+
## Building
|
|
106
|
+
|
|
107
|
+
Run `npm exec nx build connector-runner-xylem` to build the library.
|
|
108
|
+
|
|
109
|
+
## Running unit tests
|
|
110
|
+
|
|
111
|
+
Run `npm exec nx test connector-runner-xylem` to execute the unit tests via [Jest](https://jestjs.io).
|