libshv-js 3.6.5 → 3.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libshv-js",
3
- "version": "3.6.5",
3
+ "version": "3.7.0",
4
4
  "description": "Typescript implementation of libshv",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
package/src/rpcmessage.ts CHANGED
@@ -37,6 +37,7 @@ const ErrorMapZod = z.imap({
37
37
  export type ErrorMap = z.infer<typeof ErrorMapZod>;
38
38
 
39
39
  const RpcRequestMetaZod = z.metamap({
40
+ [RPC_MESSAGE_CALLER_IDS]: z.int().or(z.array(z.int())).optional(),
40
41
  [RPC_MESSAGE_REQUEST_ID]: z.number(),
41
42
  [RPC_MESSAGE_METHOD]: z.string(),
42
43
  [RPC_MESSAGE_SHV_PATH]: z.string(),
@@ -47,6 +48,7 @@ const RpcRequestValueZod = z.imap({
47
48
  });
48
49
 
49
50
  const RpcResponseMetaZod = z.metamap({
51
+ [RPC_MESSAGE_CALLER_IDS]: z.int().or(z.array(z.int())).optional(),
50
52
  [RPC_MESSAGE_REQUEST_ID]: z.number(),
51
53
  });
52
54
  const RpcResponseValueZod = z.imap({
package/src/ws-client.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import {ChainPackReader, CHAINPACK_PROTOCOL_TYPE, ChainPackWriter, toChainPack} from './chainpack';
2
2
  import {type CponReader, CPON_PROTOCOL_TYPE, toCpon} from './cpon';
3
- import {ERROR_MESSAGE, ErrorCode, ERROR_CODE, RpcMessageZod, type RpcMessage, isSignal, isRequest, type RpcRequest, isResponse, ERROR_DATA, type ErrorMap, RPC_MESSAGE_METHOD, RPC_MESSAGE_SHV_PATH, RPC_MESSAGE_REQUEST_ID, RPC_MESSAGE_PARAMS, RPC_MESSAGE_ERROR, RPC_MESSAGE_RESULT} from './rpcmessage';
3
+ import {ERROR_MESSAGE, ErrorCode, ERROR_CODE, RpcMessageZod, type RpcMessage, isSignal, isRequest, type RpcRequest, isResponse, ERROR_DATA, type ErrorMap, RPC_MESSAGE_METHOD, RPC_MESSAGE_SHV_PATH, RPC_MESSAGE_REQUEST_ID, RPC_MESSAGE_PARAMS, RPC_MESSAGE_ERROR, RPC_MESSAGE_RESULT, RPC_MESSAGE_CALLER_IDS} from './rpcmessage';
4
4
  import {type RpcValue, type Null, type Int, type IMap, type ShvMap, makeMap, makeIMap, RpcValueWithMetaData, makeMetaMap} from './rpcvalue';
5
5
 
6
6
  const DEFAULT_TIMEOUT = 5000;
@@ -221,6 +221,7 @@ class WsClient {
221
221
  callRpcMethod(shvPath: string | undefined, method: string, params?: RpcValue): Promise<ResultOrError> {
222
222
  const rqId = this.requestId++;
223
223
  const rq: RpcRequest = new RpcValueWithMetaData(makeMetaMap({
224
+ [RPC_MESSAGE_CALLER_IDS]: undefined,
224
225
  [RPC_MESSAGE_REQUEST_ID]: rqId,
225
226
  [RPC_MESSAGE_METHOD]: method ?? '',
226
227
  [RPC_MESSAGE_SHV_PATH]: shvPath ?? '',
@@ -387,7 +388,7 @@ class WsClient {
387
388
  const makeLoginParams = (loginMap: ShvMap) => makeMap({
388
389
  login: loginMap,
389
390
  options: makeMap({
390
- device: options.mountPoint === 'string' ? makeMap({mountPoint: options.mountPoint}) : undefined,
391
+ device: typeof options.mountPoint === 'string' ? makeMap({mountPoint: options.mountPoint}) : undefined,
391
392
  }),
392
393
  });
393
394