@flux-control/effect-modbus-rs 0.7.0 → 0.8.0
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/dist/index.js +2 -4
- package/dist/src/AsciiTransportService.d.ts +1 -1
- package/dist/src/RtuTransportService.d.ts +1 -1
- package/dist/src/TcpTransportService.d.ts +1 -1
- package/dist/src/WasmAsciiTransportService.d.ts +1 -1
- package/dist/src/WasmRtuTransportService.d.ts +1 -1
- package/dist/src/WasmWsTransportService.d.ts +1 -1
- package/dist/src/mocks.d.ts +1 -1
- package/dist/src/shared-transport.d.ts +8 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1263,10 +1263,9 @@ var createMockTransport = (devices) => {
|
|
|
1263
1263
|
setRequestTimeout: (_timeoutMs) => ensureOpen,
|
|
1264
1264
|
clearRequestTimeout: () => ensureOpen,
|
|
1265
1265
|
reconnect: () => Effect7.andThen(reconnectOnce, SubscriptionRef3.set(connectionState, ConnectionState.Connected())),
|
|
1266
|
-
close: () => Effect7.gen(function* () {
|
|
1266
|
+
close: (scope) => Effect7.gen(function* () {
|
|
1267
1267
|
if (closed)
|
|
1268
1268
|
return;
|
|
1269
|
-
const scope = yield* Effect7.scope;
|
|
1270
1269
|
yield* Scope2.close(scope, Exit3.void).pipe(Effect7.onExit(() => closeTransport));
|
|
1271
1270
|
}),
|
|
1272
1271
|
hasPendingRequests: () => false
|
|
@@ -1466,10 +1465,9 @@ function createTransportScoped(transportKey, openMethod, serviceName, config) {
|
|
|
1466
1465
|
return yield* transportClosed();
|
|
1467
1466
|
yield* SubscriptionRef4.set(connectionState, ConnectionState.Connected());
|
|
1468
1467
|
}),
|
|
1469
|
-
close: Effect8.fnUntraced(function* () {
|
|
1468
|
+
close: Effect8.fnUntraced(function* (scope) {
|
|
1470
1469
|
if (closed)
|
|
1471
1470
|
return;
|
|
1472
|
-
const scope = yield* Effect8.scope;
|
|
1473
1471
|
yield* Scope3.close(scope, Exit4.void).pipe(Effect8.onExit(() => closeTransport));
|
|
1474
1472
|
}),
|
|
1475
1473
|
withBatchingClient: batching.withBatchingClient,
|
|
@@ -48,7 +48,7 @@ export declare class AsciiTransportService extends AsciiTransportService_base {
|
|
|
48
48
|
setRequestTimeout: (timeoutMs: number) => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
49
49
|
clearRequestTimeout: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
50
50
|
reconnect: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusError, never>;
|
|
51
|
-
close: () => import("effect/Effect").Effect<void, import("./errors").ModbusError,
|
|
51
|
+
close: (scope: import("effect/Scope").Closeable) => import("effect/Effect").Effect<void, import("./errors").ModbusError, never>;
|
|
52
52
|
withBatchingClient: (unitId: number, options?: import("./batching-client").BatchingClientOptions & {
|
|
53
53
|
readonly retry?: import("./retry").ModbusRetryPolicy;
|
|
54
54
|
}) => import("effect/Effect").Effect<import("./batching-client").BatchingModbusClient, import("./errors").ModbusError | import("./errors").ModbusUnitAlreadyDeclaredError>;
|
|
@@ -48,7 +48,7 @@ export declare class RtuTransportService extends RtuTransportService_base {
|
|
|
48
48
|
setRequestTimeout: (timeoutMs: number) => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
49
49
|
clearRequestTimeout: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
50
50
|
reconnect: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusError, never>;
|
|
51
|
-
close: () => import("effect/Effect").Effect<void, import("./errors").ModbusError,
|
|
51
|
+
close: (scope: import("effect/Scope").Closeable) => import("effect/Effect").Effect<void, import("./errors").ModbusError, never>;
|
|
52
52
|
withBatchingClient: (unitId: number, options?: import("./batching-client").BatchingClientOptions & {
|
|
53
53
|
readonly retry?: import("./retry").ModbusRetryPolicy;
|
|
54
54
|
}) => import("effect/Effect").Effect<import("./batching-client").BatchingModbusClient, import("./errors").ModbusError | import("./errors").ModbusUnitAlreadyDeclaredError>;
|
|
@@ -48,7 +48,7 @@ export declare class TcpTransportService extends TcpTransportService_base {
|
|
|
48
48
|
setRequestTimeout: (timeoutMs: number) => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
49
49
|
clearRequestTimeout: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
50
50
|
reconnect: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusError, never>;
|
|
51
|
-
close: () => import("effect/Effect").Effect<void, import("./errors").ModbusError,
|
|
51
|
+
close: (scope: import("effect/Scope").Closeable) => import("effect/Effect").Effect<void, import("./errors").ModbusError, never>;
|
|
52
52
|
withBatchingClient: (unitId: number, options?: import("./batching-client").BatchingClientOptions & {
|
|
53
53
|
readonly retry?: import("./retry").ModbusRetryPolicy;
|
|
54
54
|
}) => import("effect/Effect").Effect<import("./batching-client").BatchingModbusClient, import("./errors").ModbusError | import("./errors").ModbusUnitAlreadyDeclaredError>;
|
|
@@ -54,7 +54,7 @@ export declare class WasmAsciiTransportService extends WasmAsciiTransportService
|
|
|
54
54
|
setRequestTimeout: (timeoutMs: number) => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
55
55
|
clearRequestTimeout: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
56
56
|
reconnect: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusError, never>;
|
|
57
|
-
close: () => import("effect/Effect").Effect<void, import("./errors").ModbusError,
|
|
57
|
+
close: (scope: import("effect/Scope").Closeable) => import("effect/Effect").Effect<void, import("./errors").ModbusError, never>;
|
|
58
58
|
withBatchingClient: (unitId: number, options?: import("./batching-client").BatchingClientOptions & {
|
|
59
59
|
readonly retry?: import("./retry").ModbusRetryPolicy;
|
|
60
60
|
}) => import("effect/Effect").Effect<import("./batching-client").BatchingModbusClient, import("./errors").ModbusError | import("./errors").ModbusUnitAlreadyDeclaredError>;
|
|
@@ -54,7 +54,7 @@ export declare class WasmRtuTransportService extends WasmRtuTransportService_bas
|
|
|
54
54
|
setRequestTimeout: (timeoutMs: number) => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
55
55
|
clearRequestTimeout: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
56
56
|
reconnect: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusError, never>;
|
|
57
|
-
close: () => import("effect/Effect").Effect<void, import("./errors").ModbusError,
|
|
57
|
+
close: (scope: import("effect/Scope").Closeable) => import("effect/Effect").Effect<void, import("./errors").ModbusError, never>;
|
|
58
58
|
withBatchingClient: (unitId: number, options?: import("./batching-client").BatchingClientOptions & {
|
|
59
59
|
readonly retry?: import("./retry").ModbusRetryPolicy;
|
|
60
60
|
}) => import("effect/Effect").Effect<import("./batching-client").BatchingModbusClient, import("./errors").ModbusError | import("./errors").ModbusUnitAlreadyDeclaredError>;
|
|
@@ -41,7 +41,7 @@ export declare class WasmWsTransportService extends WasmWsTransportService_base
|
|
|
41
41
|
setRequestTimeout: (timeoutMs: number) => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
42
42
|
clearRequestTimeout: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusNotConnectedError, never>;
|
|
43
43
|
reconnect: () => import("effect/Effect").Effect<undefined, import("./errors").ModbusError, never>;
|
|
44
|
-
close: () => import("effect/Effect").Effect<void, import("./errors").ModbusError,
|
|
44
|
+
close: (scope: import("effect/Scope").Closeable) => import("effect/Effect").Effect<void, import("./errors").ModbusError, never>;
|
|
45
45
|
withBatchingClient: (unitId: number, options?: import("./batching-client").BatchingClientOptions & {
|
|
46
46
|
readonly retry?: import("./retry").ModbusRetryPolicy;
|
|
47
47
|
}) => import("effect/Effect").Effect<import("./batching-client").BatchingModbusClient, import("./errors").ModbusError | import("./errors").ModbusUnitAlreadyDeclaredError>;
|
package/dist/src/mocks.d.ts
CHANGED
|
@@ -159,6 +159,6 @@ export declare const createMockTransport: (devices: SlaveDeviceDefinitions) => (
|
|
|
159
159
|
setRequestTimeout: (_timeoutMs: number) => Effect.Effect<void, ModbusNotConnectedError, never>;
|
|
160
160
|
clearRequestTimeout: () => Effect.Effect<void, ModbusNotConnectedError, never>;
|
|
161
161
|
reconnect: () => Effect.Effect<void, ModbusError, never>;
|
|
162
|
-
close: () => Effect.Effect<void, never,
|
|
162
|
+
close: (scope: Scope.Closeable) => Effect.Effect<void, never, never>;
|
|
163
163
|
hasPendingRequests: () => false;
|
|
164
164
|
}, never, Scope.Scope>;
|
|
@@ -132,8 +132,13 @@ export interface TransportServiceApi {
|
|
|
132
132
|
* while the reconnect was running.
|
|
133
133
|
*/
|
|
134
134
|
reconnect(): Effect.Effect<void, ModbusError>;
|
|
135
|
-
/**
|
|
136
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Closes `scope`, then closes the transport.
|
|
137
|
+
*
|
|
138
|
+
* Pass the scope that holds the work to finish first, such as
|
|
139
|
+
* `onShutdown` writes. The transport closes even if a finalizer fails.
|
|
140
|
+
*/
|
|
141
|
+
close(scope: Scope.Closeable): Effect.Effect<void, ModbusError>;
|
|
137
142
|
/**
|
|
138
143
|
* Declares the {@link BatchingModbusClient} for a unit.
|
|
139
144
|
*
|
|
@@ -236,7 +241,7 @@ export declare function createTransportScoped<TOptions, TClient extends AnyModbu
|
|
|
236
241
|
setRequestTimeout: (timeoutMs: number) => Effect.Effect<undefined, ModbusNotConnectedError, never>;
|
|
237
242
|
clearRequestTimeout: () => Effect.Effect<undefined, ModbusNotConnectedError, never>;
|
|
238
243
|
reconnect: () => Effect.Effect<undefined, ModbusError, never>;
|
|
239
|
-
close: () => Effect.Effect<void, ModbusError,
|
|
244
|
+
close: (scope: Scope.Closeable) => Effect.Effect<void, ModbusError, never>;
|
|
240
245
|
withBatchingClient: (unitId: number, options?: BatchingClientOptions & {
|
|
241
246
|
readonly retry?: ModbusRetryPolicy;
|
|
242
247
|
}) => Effect.Effect<BatchingModbusClient, ModbusError | ModbusUnitAlreadyDeclaredError>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flux-control/effect-modbus-rs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Type-safe Modbus communication via Effect-TS, wrapping the modbus-rs npm bindings.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@changesets/cli": "^2.31.1",
|
|
46
46
|
"@effect/language-service": "0.87.2",
|
|
47
|
-
"@effect/platform-bun": "^4.0.0-rc.
|
|
47
|
+
"@effect/platform-bun": "^4.0.0-rc.118",
|
|
48
48
|
"@oxlint/plugins": "1.76.0",
|
|
49
49
|
"@types/bun": "latest",
|
|
50
|
-
"effect": "4.0.0-rc.
|
|
50
|
+
"effect": "4.0.0-rc.118",
|
|
51
51
|
"fallow": "^2.104.0",
|
|
52
52
|
"husky": "^9.1.7",
|
|
53
53
|
"oxfmt": "^0.71.0",
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
"typescript": "^7.0.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"effect": "^4.0.0-rc.
|
|
58
|
+
"effect": "^4.0.0-rc.118"
|
|
59
59
|
}
|
|
60
60
|
}
|