@push.rocks/smartrust 1.1.2 → 1.2.1

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.
@@ -39,4 +39,9 @@ export interface IRustBridgeOptions extends IBinaryLocatorOptions {
39
39
  readyEventName?: string;
40
40
  /** Optional logger instance */
41
41
  logger?: IRustBridgeLogger;
42
+ /** Maximum message size in bytes (default: 50MB). Messages exceeding this are rejected. */
43
+ maxPayloadSize?: number;
44
+ /** Inactivity timeout for streaming commands in ms (default: same as requestTimeoutMs).
45
+ * Resets on each chunk received. */
46
+ streamTimeoutMs?: number;
42
47
  }
@@ -38,3 +38,25 @@ export interface ICommandDefinition<TParams = any, TResult = any> {
38
38
  * Used to type-safe the bridge's sendCommand method.
39
39
  */
40
40
  export type TCommandMap = Record<string, ICommandDefinition>;
41
+
42
+ /**
43
+ * Stream chunk message received from the Rust binary during a streaming command.
44
+ */
45
+ export interface IManagementStreamChunk {
46
+ id: string;
47
+ stream: true;
48
+ data: any;
49
+ }
50
+
51
+ /**
52
+ * Extract keys from a command map whose definitions include a `chunk` field,
53
+ * indicating they support streaming responses.
54
+ */
55
+ export type TStreamingCommandKeys<TCommands extends TCommandMap> = {
56
+ [K in keyof TCommands]: TCommands[K] extends { chunk: any } ? K : never;
57
+ }[keyof TCommands];
58
+
59
+ /**
60
+ * Extract the chunk type from a command definition that has a `chunk` field.
61
+ */
62
+ export type TExtractChunk<TDef> = TDef extends { chunk: infer C } ? C : never;
package/ts/plugins.ts CHANGED
@@ -2,11 +2,10 @@
2
2
  import * as path from 'path';
3
3
  import * as fs from 'fs';
4
4
  import * as childProcess from 'child_process';
5
- import * as readline from 'readline';
6
5
  import * as events from 'events';
7
6
  import * as url from 'url';
8
7
 
9
- export { path, fs, childProcess, readline, events, url };
8
+ export { path, fs, childProcess, events, url };
10
9
 
11
10
  // @push.rocks scope
12
11
  import * as smartpath from '@push.rocks/smartpath';