tywrap 0.2.0 → 0.3.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.
Files changed (163) hide show
  1. package/README.md +65 -31
  2. package/dist/cli.js +49 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config/index.d.ts +11 -7
  5. package/dist/config/index.d.ts.map +1 -1
  6. package/dist/config/index.js +43 -7
  7. package/dist/config/index.js.map +1 -1
  8. package/dist/core/analyzer.d.ts +1 -0
  9. package/dist/core/analyzer.d.ts.map +1 -1
  10. package/dist/core/analyzer.js +47 -12
  11. package/dist/core/analyzer.js.map +1 -1
  12. package/dist/core/annotation-parser.d.ts +8 -0
  13. package/dist/core/annotation-parser.d.ts.map +1 -0
  14. package/dist/core/annotation-parser.js +409 -0
  15. package/dist/core/annotation-parser.js.map +1 -0
  16. package/dist/core/discovery.d.ts +1 -0
  17. package/dist/core/discovery.d.ts.map +1 -1
  18. package/dist/core/discovery.js +9 -9
  19. package/dist/core/discovery.js.map +1 -1
  20. package/dist/core/generator.d.ts +9 -1
  21. package/dist/core/generator.d.ts.map +1 -1
  22. package/dist/core/generator.js +738 -104
  23. package/dist/core/generator.js.map +1 -1
  24. package/dist/core/mapper.d.ts +9 -7
  25. package/dist/core/mapper.d.ts.map +1 -1
  26. package/dist/core/mapper.js +129 -44
  27. package/dist/core/mapper.js.map +1 -1
  28. package/dist/index.d.ts +23 -7
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +23 -3
  31. package/dist/index.js.map +1 -1
  32. package/dist/runtime/base.d.ts +17 -7
  33. package/dist/runtime/base.d.ts.map +1 -1
  34. package/dist/runtime/base.js +18 -1
  35. package/dist/runtime/base.js.map +1 -1
  36. package/dist/runtime/bounded-context.d.ts +252 -0
  37. package/dist/runtime/bounded-context.d.ts.map +1 -0
  38. package/dist/runtime/bounded-context.js +454 -0
  39. package/dist/runtime/bounded-context.js.map +1 -0
  40. package/dist/runtime/bridge-core.d.ts +1 -0
  41. package/dist/runtime/bridge-core.d.ts.map +1 -1
  42. package/dist/runtime/bridge-core.js +52 -17
  43. package/dist/runtime/bridge-core.js.map +1 -1
  44. package/dist/runtime/bridge-protocol.d.ts +184 -0
  45. package/dist/runtime/bridge-protocol.d.ts.map +1 -0
  46. package/dist/runtime/bridge-protocol.js +344 -0
  47. package/dist/runtime/bridge-protocol.js.map +1 -0
  48. package/dist/runtime/disposable.d.ts +40 -0
  49. package/dist/runtime/disposable.d.ts.map +1 -0
  50. package/dist/runtime/disposable.js +49 -0
  51. package/dist/runtime/disposable.js.map +1 -0
  52. package/dist/runtime/errors.d.ts +10 -0
  53. package/dist/runtime/errors.d.ts.map +1 -1
  54. package/dist/runtime/errors.js +9 -0
  55. package/dist/runtime/errors.js.map +1 -1
  56. package/dist/runtime/http-io.d.ts +91 -0
  57. package/dist/runtime/http-io.d.ts.map +1 -0
  58. package/dist/runtime/http-io.js +195 -0
  59. package/dist/runtime/http-io.js.map +1 -0
  60. package/dist/runtime/http.d.ts +48 -13
  61. package/dist/runtime/http.d.ts.map +1 -1
  62. package/dist/runtime/http.js +60 -73
  63. package/dist/runtime/http.js.map +1 -1
  64. package/dist/runtime/node.d.ts +97 -130
  65. package/dist/runtime/node.d.ts.map +1 -1
  66. package/dist/runtime/node.js +392 -521
  67. package/dist/runtime/node.js.map +1 -1
  68. package/dist/runtime/optimized-node.d.ts +1 -1
  69. package/dist/runtime/optimized-node.d.ts.map +1 -1
  70. package/dist/runtime/optimized-node.js +1 -1
  71. package/dist/runtime/optimized-node.js.map +1 -1
  72. package/dist/runtime/pooled-transport.d.ts +135 -0
  73. package/dist/runtime/pooled-transport.d.ts.map +1 -0
  74. package/dist/runtime/pooled-transport.js +177 -0
  75. package/dist/runtime/pooled-transport.js.map +1 -0
  76. package/dist/runtime/process-io.d.ts +209 -0
  77. package/dist/runtime/process-io.d.ts.map +1 -0
  78. package/dist/runtime/process-io.js +729 -0
  79. package/dist/runtime/process-io.js.map +1 -0
  80. package/dist/runtime/pyodide-io.d.ts +154 -0
  81. package/dist/runtime/pyodide-io.d.ts.map +1 -0
  82. package/dist/runtime/pyodide-io.js +459 -0
  83. package/dist/runtime/pyodide-io.js.map +1 -0
  84. package/dist/runtime/pyodide.d.ts +51 -19
  85. package/dist/runtime/pyodide.d.ts.map +1 -1
  86. package/dist/runtime/pyodide.js +57 -186
  87. package/dist/runtime/pyodide.js.map +1 -1
  88. package/dist/runtime/safe-codec.d.ts +103 -0
  89. package/dist/runtime/safe-codec.d.ts.map +1 -0
  90. package/dist/runtime/safe-codec.js +519 -0
  91. package/dist/runtime/safe-codec.js.map +1 -0
  92. package/dist/runtime/transport.d.ts +191 -0
  93. package/dist/runtime/transport.d.ts.map +1 -0
  94. package/dist/runtime/transport.js +86 -0
  95. package/dist/runtime/transport.js.map +1 -0
  96. package/dist/runtime/validators.d.ts +120 -0
  97. package/dist/runtime/validators.d.ts.map +1 -0
  98. package/dist/runtime/validators.js +229 -0
  99. package/dist/runtime/validators.js.map +1 -0
  100. package/dist/runtime/worker-pool.d.ts +208 -0
  101. package/dist/runtime/worker-pool.d.ts.map +1 -0
  102. package/dist/runtime/worker-pool.js +419 -0
  103. package/dist/runtime/worker-pool.js.map +1 -0
  104. package/dist/types/index.d.ts +51 -1
  105. package/dist/types/index.d.ts.map +1 -1
  106. package/dist/tywrap.d.ts.map +1 -1
  107. package/dist/tywrap.js +227 -328
  108. package/dist/tywrap.js.map +1 -1
  109. package/dist/utils/cache.d.ts.map +1 -1
  110. package/dist/utils/cache.js +53 -5
  111. package/dist/utils/cache.js.map +1 -1
  112. package/dist/utils/codec.d.ts.map +1 -1
  113. package/dist/utils/codec.js +114 -1
  114. package/dist/utils/codec.js.map +1 -1
  115. package/dist/utils/ir-cache.d.ts +28 -0
  116. package/dist/utils/ir-cache.d.ts.map +1 -0
  117. package/dist/utils/ir-cache.js +29 -0
  118. package/dist/utils/ir-cache.js.map +1 -0
  119. package/dist/utils/parallel-processor.d.ts +1 -1
  120. package/dist/utils/parallel-processor.d.ts.map +1 -1
  121. package/dist/utils/parallel-processor.js +111 -40
  122. package/dist/utils/parallel-processor.js.map +1 -1
  123. package/dist/utils/runtime.d.ts +5 -1
  124. package/dist/utils/runtime.d.ts.map +1 -1
  125. package/dist/utils/runtime.js +112 -18
  126. package/dist/utils/runtime.js.map +1 -1
  127. package/package.json +40 -18
  128. package/runtime/python_bridge.py +108 -15
  129. package/runtime/safe_codec.py +344 -0
  130. package/src/cli.ts +61 -2
  131. package/src/config/index.ts +63 -17
  132. package/src/core/analyzer.ts +52 -15
  133. package/src/core/annotation-parser.ts +500 -0
  134. package/src/core/discovery.ts +26 -12
  135. package/src/core/generator.ts +956 -116
  136. package/src/core/mapper.ts +158 -51
  137. package/src/index.ts +78 -6
  138. package/src/runtime/base.ts +18 -26
  139. package/src/runtime/bounded-context.ts +608 -0
  140. package/src/runtime/bridge-core.ts +58 -18
  141. package/src/runtime/bridge-protocol.ts +483 -0
  142. package/src/runtime/disposable.ts +65 -0
  143. package/src/runtime/errors.ts +14 -0
  144. package/src/runtime/http-io.ts +245 -0
  145. package/src/runtime/http.ts +76 -115
  146. package/src/runtime/node.ts +563 -676
  147. package/src/runtime/optimized-node.ts +4 -1
  148. package/src/runtime/pooled-transport.ts +263 -0
  149. package/src/runtime/process-io.ts +930 -0
  150. package/src/runtime/pyodide-io.ts +551 -0
  151. package/src/runtime/pyodide.ts +75 -215
  152. package/src/runtime/safe-codec.ts +651 -0
  153. package/src/runtime/transport.ts +278 -0
  154. package/src/runtime/validators.ts +252 -0
  155. package/src/runtime/worker-pool.ts +559 -0
  156. package/src/types/global.d.ts +11 -1
  157. package/src/types/index.ts +63 -0
  158. package/src/tywrap.ts +279 -358
  159. package/src/utils/cache.ts +59 -5
  160. package/src/utils/codec.ts +122 -1
  161. package/src/utils/ir-cache.ts +51 -0
  162. package/src/utils/parallel-processor.ts +119 -43
  163. package/src/utils/runtime.ts +129 -18
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Transport layer for BridgeProtocol.
3
+ *
4
+ * Provides an abstract I/O channel for all bridge communications across
5
+ * the JS-Python boundary. Concrete implementations handle different runtimes:
6
+ * - ProcessIO: Child process with stdio streams (Node.js)
7
+ * - HttpIO: HTTP POST requests (remote Python server)
8
+ * - PyodideIO: In-memory Pyodide calls (browser/WASM)
9
+ *
10
+ * @see https://github.com/bbopen/tywrap/issues/149
11
+ */
12
+ import type { Disposable } from './disposable.js';
13
+ /** Protocol identifier for tywrap communication */
14
+ export declare const PROTOCOL_ID = "tywrap/1";
15
+ /**
16
+ * Protocol message format for all transports.
17
+ *
18
+ * Each method corresponds to a BridgeProtocol operation:
19
+ * - `call`: Invoke a module-level function
20
+ * - `instantiate`: Create a new class instance
21
+ * - `call_method`: Invoke a method on an existing instance
22
+ * - `dispose_instance`: Release an instance handle
23
+ * - `meta`: Get bridge metadata
24
+ */
25
+ export interface ProtocolMessage {
26
+ /** Unique message identifier for request-response correlation */
27
+ id: number;
28
+ /** Protocol identifier (must be 'tywrap/1') */
29
+ protocol: typeof PROTOCOL_ID;
30
+ /** The method to invoke */
31
+ method: 'call' | 'instantiate' | 'call_method' | 'dispose_instance' | 'meta';
32
+ /** Method parameters */
33
+ params: {
34
+ /** Python module path (for call and instantiate) */
35
+ module?: string;
36
+ /** Function name (for call) */
37
+ functionName?: string;
38
+ /** Class name (for instantiate) */
39
+ className?: string;
40
+ /** Instance handle (for call_method and dispose_instance) */
41
+ handle?: string;
42
+ /** Method name (for call_method) */
43
+ methodName?: string;
44
+ /** Positional arguments */
45
+ args?: unknown[];
46
+ /** Keyword arguments */
47
+ kwargs?: Record<string, unknown>;
48
+ };
49
+ }
50
+ /**
51
+ * Protocol response format from the Python side.
52
+ *
53
+ * A response contains either a result or an error, never both.
54
+ * The `id` field correlates the response to its originating request.
55
+ */
56
+ export interface ProtocolResponse {
57
+ /** Message identifier matching the originating request */
58
+ id: number;
59
+ /** Protocol identifier (echoed back from request) */
60
+ protocol?: string;
61
+ /** Successful result value (undefined if error occurred) */
62
+ result?: unknown;
63
+ /** Error information (undefined if operation succeeded) */
64
+ error?: {
65
+ /** Python exception type name */
66
+ type: string;
67
+ /** Error message */
68
+ message: string;
69
+ /** Optional Python traceback for debugging */
70
+ traceback?: string;
71
+ };
72
+ }
73
+ /**
74
+ * Abstract transport for sending messages across the JS-Python boundary.
75
+ *
76
+ * Transport implementations handle the low-level I/O details while
77
+ * providing a consistent interface for the higher-level BridgeProtocol.
78
+ *
79
+ * Lifecycle:
80
+ * 1. Create transport instance
81
+ * 2. Call `init()` to establish the connection
82
+ * 3. Use `send()` to exchange messages
83
+ * 4. Call `dispose()` to release resources
84
+ *
85
+ * Implementations:
86
+ * - ProcessIO: Spawns a Python child process, communicates via stdio
87
+ * - HttpIO: Sends HTTP POST requests to a Python server
88
+ * - PyodideIO: Calls Pyodide directly in-memory (WASM)
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * const transport = new ProcessIO({ pythonPath: 'python3' });
93
+ * await transport.init();
94
+ *
95
+ * const response = await transport.send(
96
+ * JSON.stringify({
97
+ * id: 1,
98
+ * protocol: 'tywrap/1',
99
+ * method: 'call',
100
+ * params: { module: 'math', functionName: 'sqrt', args: [16], kwargs: {} },
101
+ * }),
102
+ * 5000
103
+ * );
104
+ *
105
+ * await transport.dispose();
106
+ * ```
107
+ */
108
+ export interface Transport extends Disposable {
109
+ /**
110
+ * Initialize the transport.
111
+ *
112
+ * This method establishes the underlying connection (e.g., spawns a process,
113
+ * opens a connection). It must be called before `send()` can be used.
114
+ *
115
+ * This method should be idempotent - calling it multiple times after
116
+ * successful initialization should be a no-op.
117
+ *
118
+ * @throws BridgeError if initialization fails
119
+ */
120
+ init(): Promise<void>;
121
+ /**
122
+ * Send a message and wait for the response.
123
+ *
124
+ * @param message - The JSON-encoded protocol message to send
125
+ * @param timeoutMs - Timeout in milliseconds (0 = no timeout)
126
+ * @param signal - Optional AbortSignal for external cancellation
127
+ * @returns The raw response string (JSON-encoded ProtocolResponse)
128
+ *
129
+ * @throws BridgeTimeoutError if the operation times out or is aborted
130
+ * @throws BridgeDisposedError if the transport has been disposed
131
+ * @throws BridgeProtocolError if the message format is invalid
132
+ * @throws BridgeError for other transport-level failures
133
+ */
134
+ send(message: string, timeoutMs: number, signal?: AbortSignal): Promise<string>;
135
+ /**
136
+ * Whether the transport is ready to send messages.
137
+ *
138
+ * Returns `true` after successful `init()` and before `dispose()`.
139
+ * Returns `false` in all other states.
140
+ */
141
+ readonly isReady: boolean;
142
+ }
143
+ /**
144
+ * Base options for creating a Transport.
145
+ *
146
+ * Concrete transport implementations may extend this with
147
+ * additional configuration options.
148
+ */
149
+ export interface TransportOptions {
150
+ /**
151
+ * Default timeout for operations in milliseconds.
152
+ *
153
+ * This timeout applies to individual `send()` calls when
154
+ * no explicit timeout is provided.
155
+ *
156
+ * @default 30000 (30 seconds)
157
+ */
158
+ defaultTimeoutMs?: number;
159
+ }
160
+ /**
161
+ * Type guard to check if a value implements the Transport interface.
162
+ *
163
+ * @param value - The value to check
164
+ * @returns True if the value has all required Transport methods and properties
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * function useTransport(maybeTransport: unknown) {
169
+ * if (isTransport(maybeTransport)) {
170
+ * await maybeTransport.init();
171
+ * // TypeScript now knows maybeTransport is Transport
172
+ * }
173
+ * }
174
+ * ```
175
+ */
176
+ export declare function isTransport(value: unknown): value is Transport;
177
+ /**
178
+ * Type guard to check if a value is a valid ProtocolMessage.
179
+ *
180
+ * @param value - The value to check
181
+ * @returns True if the value conforms to the ProtocolMessage structure
182
+ */
183
+ export declare function isProtocolMessage(value: unknown): value is ProtocolMessage;
184
+ /**
185
+ * Type guard to check if a value is a valid ProtocolResponse.
186
+ *
187
+ * @param value - The value to check
188
+ * @returns True if the value conforms to the ProtocolResponse structure
189
+ */
190
+ export declare function isProtocolResponse(value: unknown): value is ProtocolResponse;
191
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceR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C;KACpB,CAAC;CACH;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C;;;;;;;;;;OAUG;IACH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEhF;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAMD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAS9D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAe1E;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAqB5E"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Transport layer for BridgeProtocol.
3
+ *
4
+ * Provides an abstract I/O channel for all bridge communications across
5
+ * the JS-Python boundary. Concrete implementations handle different runtimes:
6
+ * - ProcessIO: Child process with stdio streams (Node.js)
7
+ * - HttpIO: HTTP POST requests (remote Python server)
8
+ * - PyodideIO: In-memory Pyodide calls (browser/WASM)
9
+ *
10
+ * @see https://github.com/bbopen/tywrap/issues/149
11
+ */
12
+ // =============================================================================
13
+ // PROTOCOL CONSTANTS
14
+ // =============================================================================
15
+ /** Protocol identifier for tywrap communication */
16
+ export const PROTOCOL_ID = 'tywrap/1';
17
+ // =============================================================================
18
+ // TYPE GUARDS
19
+ // =============================================================================
20
+ /**
21
+ * Type guard to check if a value implements the Transport interface.
22
+ *
23
+ * @param value - The value to check
24
+ * @returns True if the value has all required Transport methods and properties
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * function useTransport(maybeTransport: unknown) {
29
+ * if (isTransport(maybeTransport)) {
30
+ * await maybeTransport.init();
31
+ * // TypeScript now knows maybeTransport is Transport
32
+ * }
33
+ * }
34
+ * ```
35
+ */
36
+ export function isTransport(value) {
37
+ return (value !== null &&
38
+ typeof value === 'object' &&
39
+ typeof value.init === 'function' &&
40
+ typeof value.send === 'function' &&
41
+ typeof value.dispose === 'function' &&
42
+ 'isReady' in value);
43
+ }
44
+ /**
45
+ * Type guard to check if a value is a valid ProtocolMessage.
46
+ *
47
+ * @param value - The value to check
48
+ * @returns True if the value conforms to the ProtocolMessage structure
49
+ */
50
+ export function isProtocolMessage(value) {
51
+ if (value === null || typeof value !== 'object') {
52
+ return false;
53
+ }
54
+ const msg = value;
55
+ return (typeof msg.id === 'number' &&
56
+ msg.protocol === PROTOCOL_ID &&
57
+ typeof msg.method === 'string' &&
58
+ ['call', 'instantiate', 'call_method', 'dispose_instance', 'meta'].includes(msg.method) &&
59
+ typeof msg.params === 'object' &&
60
+ msg.params !== null);
61
+ }
62
+ /**
63
+ * Type guard to check if a value is a valid ProtocolResponse.
64
+ *
65
+ * @param value - The value to check
66
+ * @returns True if the value conforms to the ProtocolResponse structure
67
+ */
68
+ export function isProtocolResponse(value) {
69
+ if (value === null || typeof value !== 'object') {
70
+ return false;
71
+ }
72
+ const resp = value;
73
+ if (typeof resp.id !== 'number') {
74
+ return false;
75
+ }
76
+ // Must have either result or error (or neither for void returns)
77
+ if (resp.error !== undefined) {
78
+ if (typeof resp.error !== 'object' || resp.error === null) {
79
+ return false;
80
+ }
81
+ const err = resp.error;
82
+ return typeof err.type === 'string' && typeof err.message === 'string';
83
+ }
84
+ return true;
85
+ }
86
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+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CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,KAAyB,CAAC;IAEvC,IAAI,OAAO,IAAI,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,iEAAiE;IACjE,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC7B,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YAC1D,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,OAAO,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC;IACzE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Pure validation functions for runtime value checking.
3
+ *
4
+ * These functions are used by BoundedContext and can also be used
5
+ * independently for validation in CLI tools, config loading, etc.
6
+ */
7
+ /**
8
+ * Error thrown when validation fails.
9
+ */
10
+ export declare class ValidationError extends Error {
11
+ constructor(message: string);
12
+ }
13
+ /**
14
+ * Check if a value is a finite number (not NaN, not Infinity).
15
+ */
16
+ export declare function isFiniteNumber(value: unknown): value is number;
17
+ /**
18
+ * Check if a value is a positive finite number.
19
+ */
20
+ export declare function isPositiveNumber(value: unknown): value is number;
21
+ /**
22
+ * Check if a value is a non-negative finite number.
23
+ */
24
+ export declare function isNonNegativeNumber(value: unknown): value is number;
25
+ /**
26
+ * Check if a value is a non-empty string.
27
+ */
28
+ export declare function isNonEmptyString(value: unknown): value is string;
29
+ /**
30
+ * Check if a value is a plain object (not null, not array).
31
+ */
32
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
33
+ /**
34
+ * Assert that a value is a finite number.
35
+ *
36
+ * @param value - The value to check
37
+ * @param name - The name of the parameter (for error messages)
38
+ * @returns The value as a number
39
+ * @throws ValidationError if the value is not a finite number
40
+ */
41
+ export declare function assertFiniteNumber(value: unknown, name: string): number;
42
+ /**
43
+ * Assert that a value is a positive number (> 0).
44
+ *
45
+ * @param value - The value to check
46
+ * @param name - The name of the parameter (for error messages)
47
+ * @returns The value as a number
48
+ * @throws ValidationError if the value is not a positive number
49
+ */
50
+ export declare function assertPositive(value: unknown, name: string): number;
51
+ /**
52
+ * Assert that a value is a non-negative number (>= 0).
53
+ *
54
+ * @param value - The value to check
55
+ * @param name - The name of the parameter (for error messages)
56
+ * @returns The value as a number
57
+ * @throws ValidationError if the value is not a non-negative number
58
+ */
59
+ export declare function assertNonNegative(value: unknown, name: string): number;
60
+ /**
61
+ * Assert that a value is a string.
62
+ *
63
+ * @param value - The value to check
64
+ * @param name - The name of the parameter (for error messages)
65
+ * @returns The value as a string
66
+ * @throws ValidationError if the value is not a string
67
+ */
68
+ export declare function assertString(value: unknown, name: string): string;
69
+ /**
70
+ * Assert that a value is a non-empty string.
71
+ *
72
+ * @param value - The value to check
73
+ * @param name - The name of the parameter (for error messages)
74
+ * @returns The value as a string
75
+ * @throws ValidationError if the value is not a non-empty string
76
+ */
77
+ export declare function assertNonEmptyString(value: unknown, name: string): string;
78
+ /**
79
+ * Assert that a value is an array.
80
+ *
81
+ * @param value - The value to check
82
+ * @param name - The name of the parameter (for error messages)
83
+ * @returns The value as an array
84
+ * @throws ValidationError if the value is not an array
85
+ */
86
+ export declare function assertArray<T = unknown>(value: unknown, name: string): T[];
87
+ /**
88
+ * Assert that a value is a plain object (not null, not array).
89
+ *
90
+ * @param value - The value to check
91
+ * @param name - The name of the parameter (for error messages)
92
+ * @returns The value as a Record
93
+ * @throws ValidationError if the value is not a plain object
94
+ */
95
+ export declare function assertObject(value: unknown, name: string): Record<string, unknown>;
96
+ export declare function containsSpecialFloat(value: unknown): boolean;
97
+ /**
98
+ * Assert that a value does not contain non-finite numbers.
99
+ *
100
+ * @param value - The value to check
101
+ * @param name - The name of the parameter (for error messages)
102
+ * @throws ValidationError if the value contains NaN or Infinity
103
+ */
104
+ export declare function assertNoSpecialFloats(value: unknown, name: string): void;
105
+ /**
106
+ * Sanitize a string for use in a cache key filename.
107
+ * Removes or replaces characters that could cause path traversal or invalid filenames.
108
+ *
109
+ * @param value - The string to sanitize
110
+ * @returns A safe string for use in filenames
111
+ */
112
+ export declare function sanitizeForFilename(value: string): string;
113
+ /**
114
+ * Check if a string looks like a path traversal attempt.
115
+ *
116
+ * @param value - The string to check
117
+ * @returns True if the string contains path traversal patterns
118
+ */
119
+ export declare function containsPathTraversal(value: string): boolean;
120
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/runtime/validators.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAMD;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE9D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEhE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEnE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEhE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE9E;AAMD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMvE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMnE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMtE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKjE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMzE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,CAK1E;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMlF;AAqCD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE5D;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAMxE;AAMD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE5D"}
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Pure validation functions for runtime value checking.
3
+ *
4
+ * These functions are used by BoundedContext and can also be used
5
+ * independently for validation in CLI tools, config loading, etc.
6
+ */
7
+ /**
8
+ * Error thrown when validation fails.
9
+ */
10
+ export class ValidationError extends Error {
11
+ constructor(message) {
12
+ super(message);
13
+ this.name = 'ValidationError';
14
+ }
15
+ }
16
+ // ═══════════════════════════════════════════════════════════════════════════
17
+ // TYPE GUARDS
18
+ // ═══════════════════════════════════════════════════════════════════════════
19
+ /**
20
+ * Check if a value is a finite number (not NaN, not Infinity).
21
+ */
22
+ export function isFiniteNumber(value) {
23
+ return typeof value === 'number' && Number.isFinite(value);
24
+ }
25
+ /**
26
+ * Check if a value is a positive finite number.
27
+ */
28
+ export function isPositiveNumber(value) {
29
+ return isFiniteNumber(value) && value > 0;
30
+ }
31
+ /**
32
+ * Check if a value is a non-negative finite number.
33
+ */
34
+ export function isNonNegativeNumber(value) {
35
+ return isFiniteNumber(value) && value >= 0;
36
+ }
37
+ /**
38
+ * Check if a value is a non-empty string.
39
+ */
40
+ export function isNonEmptyString(value) {
41
+ return typeof value === 'string' && value.length > 0;
42
+ }
43
+ /**
44
+ * Check if a value is a plain object (not null, not array).
45
+ */
46
+ export function isPlainObject(value) {
47
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
48
+ }
49
+ // ═══════════════════════════════════════════════════════════════════════════
50
+ // ASSERTIONS
51
+ // ═══════════════════════════════════════════════════════════════════════════
52
+ /**
53
+ * Assert that a value is a finite number.
54
+ *
55
+ * @param value - The value to check
56
+ * @param name - The name of the parameter (for error messages)
57
+ * @returns The value as a number
58
+ * @throws ValidationError if the value is not a finite number
59
+ */
60
+ export function assertFiniteNumber(value, name) {
61
+ if (!isFiniteNumber(value)) {
62
+ const actual = typeof value === 'number' ? String(value) : typeof value;
63
+ throw new ValidationError(`${name} must be a finite number, got: ${actual}`);
64
+ }
65
+ return value;
66
+ }
67
+ /**
68
+ * Assert that a value is a positive number (> 0).
69
+ *
70
+ * @param value - The value to check
71
+ * @param name - The name of the parameter (for error messages)
72
+ * @returns The value as a number
73
+ * @throws ValidationError if the value is not a positive number
74
+ */
75
+ export function assertPositive(value, name) {
76
+ const num = assertFiniteNumber(value, name);
77
+ if (num <= 0) {
78
+ throw new ValidationError(`${name} must be positive, got: ${num}`);
79
+ }
80
+ return num;
81
+ }
82
+ /**
83
+ * Assert that a value is a non-negative number (>= 0).
84
+ *
85
+ * @param value - The value to check
86
+ * @param name - The name of the parameter (for error messages)
87
+ * @returns The value as a number
88
+ * @throws ValidationError if the value is not a non-negative number
89
+ */
90
+ export function assertNonNegative(value, name) {
91
+ const num = assertFiniteNumber(value, name);
92
+ if (num < 0) {
93
+ throw new ValidationError(`${name} must be non-negative, got: ${num}`);
94
+ }
95
+ return num;
96
+ }
97
+ /**
98
+ * Assert that a value is a string.
99
+ *
100
+ * @param value - The value to check
101
+ * @param name - The name of the parameter (for error messages)
102
+ * @returns The value as a string
103
+ * @throws ValidationError if the value is not a string
104
+ */
105
+ export function assertString(value, name) {
106
+ if (typeof value !== 'string') {
107
+ throw new ValidationError(`${name} must be a string, got: ${typeof value}`);
108
+ }
109
+ return value;
110
+ }
111
+ /**
112
+ * Assert that a value is a non-empty string.
113
+ *
114
+ * @param value - The value to check
115
+ * @param name - The name of the parameter (for error messages)
116
+ * @returns The value as a string
117
+ * @throws ValidationError if the value is not a non-empty string
118
+ */
119
+ export function assertNonEmptyString(value, name) {
120
+ const str = assertString(value, name);
121
+ if (str.length === 0) {
122
+ throw new ValidationError(`${name} must not be empty`);
123
+ }
124
+ return str;
125
+ }
126
+ /**
127
+ * Assert that a value is an array.
128
+ *
129
+ * @param value - The value to check
130
+ * @param name - The name of the parameter (for error messages)
131
+ * @returns The value as an array
132
+ * @throws ValidationError if the value is not an array
133
+ */
134
+ export function assertArray(value, name) {
135
+ if (!Array.isArray(value)) {
136
+ throw new ValidationError(`${name} must be an array, got: ${typeof value}`);
137
+ }
138
+ return value;
139
+ }
140
+ /**
141
+ * Assert that a value is a plain object (not null, not array).
142
+ *
143
+ * @param value - The value to check
144
+ * @param name - The name of the parameter (for error messages)
145
+ * @returns The value as a Record
146
+ * @throws ValidationError if the value is not a plain object
147
+ */
148
+ export function assertObject(value, name) {
149
+ if (!isPlainObject(value)) {
150
+ const actual = value === null ? 'null' : Array.isArray(value) ? 'array' : typeof value;
151
+ throw new ValidationError(`${name} must be an object, got: ${actual}`);
152
+ }
153
+ return value;
154
+ }
155
+ // ═══════════════════════════════════════════════════════════════════════════
156
+ // SPECIAL FLOAT DETECTION (for codec validation)
157
+ // ═══════════════════════════════════════════════════════════════════════════
158
+ /**
159
+ * Check if a value contains non-finite numbers (NaN, Infinity, -Infinity).
160
+ * Recursively checks arrays and objects.
161
+ *
162
+ * This is used to detect values that cannot be safely serialized to JSON,
163
+ * as JSON.stringify converts NaN/Infinity to null, which can cause
164
+ * silent data corruption.
165
+ *
166
+ * @param value - The value to check
167
+ * @returns True if the value contains NaN or Infinity anywhere
168
+ */
169
+ function containsSpecialFloatRecursive(value, visited) {
170
+ if (typeof value === 'number') {
171
+ return !Number.isFinite(value);
172
+ }
173
+ if (value === null || typeof value !== 'object') {
174
+ return false;
175
+ }
176
+ if (visited.has(value)) {
177
+ return false;
178
+ }
179
+ visited.add(value);
180
+ if (Array.isArray(value)) {
181
+ return value.some(item => containsSpecialFloatRecursive(item, visited));
182
+ }
183
+ if (isPlainObject(value)) {
184
+ return Object.values(value).some(item => containsSpecialFloatRecursive(item, visited));
185
+ }
186
+ return false;
187
+ }
188
+ export function containsSpecialFloat(value) {
189
+ return containsSpecialFloatRecursive(value, new WeakSet());
190
+ }
191
+ /**
192
+ * Assert that a value does not contain non-finite numbers.
193
+ *
194
+ * @param value - The value to check
195
+ * @param name - The name of the parameter (for error messages)
196
+ * @throws ValidationError if the value contains NaN or Infinity
197
+ */
198
+ export function assertNoSpecialFloats(value, name) {
199
+ if (containsSpecialFloat(value)) {
200
+ throw new ValidationError(`${name} contains non-finite numbers (NaN or Infinity) which cannot be serialized to JSON`);
201
+ }
202
+ }
203
+ // ═══════════════════════════════════════════════════════════════════════════
204
+ // PATH VALIDATION (for CLI security)
205
+ // ═══════════════════════════════════════════════════════════════════════════
206
+ /**
207
+ * Sanitize a string for use in a cache key filename.
208
+ * Removes or replaces characters that could cause path traversal or invalid filenames.
209
+ *
210
+ * @param value - The string to sanitize
211
+ * @returns A safe string for use in filenames
212
+ */
213
+ export function sanitizeForFilename(value) {
214
+ // Replace path separators and traversal patterns
215
+ return value
216
+ .replace(/\.\./g, '__')
217
+ .replace(/[/\\:*?"<>|]/g, '_')
218
+ .replace(/\s+/g, '_');
219
+ }
220
+ /**
221
+ * Check if a string looks like a path traversal attempt.
222
+ *
223
+ * @param value - The string to check
224
+ * @returns True if the string contains path traversal patterns
225
+ */
226
+ export function containsPathTraversal(value) {
227
+ return value.includes('..') || value.includes('/') || value.includes('\\');
228
+ }
229
+ //# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/runtime/validators.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACvD,CAAC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