@milaboratories/pl-model-common 1.25.1 → 1.25.3

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 (288) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/author_marker.d.ts +9 -6
  3. package/dist/base32_encode.cjs +40 -46
  4. package/dist/base32_encode.cjs.map +1 -1
  5. package/dist/base32_encode.js +40 -45
  6. package/dist/base32_encode.js.map +1 -1
  7. package/dist/base64.cjs +5 -4
  8. package/dist/base64.cjs.map +1 -1
  9. package/dist/base64.d.ts +10 -6
  10. package/dist/base64.js +5 -3
  11. package/dist/base64.js.map +1 -1
  12. package/dist/block_state.d.ts +21 -23
  13. package/dist/bmodel/block_config.cjs +9 -10
  14. package/dist/bmodel/block_config.cjs.map +1 -1
  15. package/dist/bmodel/block_config.d.ts +53 -72
  16. package/dist/bmodel/block_config.js +9 -9
  17. package/dist/bmodel/block_config.js.map +1 -1
  18. package/dist/bmodel/code.cjs +7 -6
  19. package/dist/bmodel/code.cjs.map +1 -1
  20. package/dist/bmodel/code.d.ts +17 -13
  21. package/dist/bmodel/code.js +6 -4
  22. package/dist/bmodel/code.js.map +1 -1
  23. package/dist/bmodel/container.d.ts +46 -44
  24. package/dist/bmodel/index.cjs +3 -0
  25. package/dist/bmodel/index.d.ts +5 -6
  26. package/dist/bmodel/index.js +3 -0
  27. package/dist/bmodel/normalization.cjs +90 -106
  28. package/dist/bmodel/normalization.cjs.map +1 -1
  29. package/dist/bmodel/normalization.d.ts +7 -3
  30. package/dist/bmodel/normalization.js +90 -105
  31. package/dist/bmodel/normalization.js.map +1 -1
  32. package/dist/bmodel/types.d.ts +4 -1
  33. package/dist/branding.d.ts +5 -5
  34. package/dist/common_types.d.ts +19 -15
  35. package/dist/driver_kit.d.ts +25 -17
  36. package/dist/drivers/ChunkedStreamReader.cjs +168 -203
  37. package/dist/drivers/ChunkedStreamReader.cjs.map +1 -1
  38. package/dist/drivers/ChunkedStreamReader.d.ts +104 -100
  39. package/dist/drivers/ChunkedStreamReader.js +168 -202
  40. package/dist/drivers/ChunkedStreamReader.js.map +1 -1
  41. package/dist/drivers/blob.cjs +15 -17
  42. package/dist/drivers/blob.cjs.map +1 -1
  43. package/dist/drivers/blob.d.ts +35 -35
  44. package/dist/drivers/blob.js +14 -15
  45. package/dist/drivers/blob.js.map +1 -1
  46. package/dist/drivers/index.cjs +18 -0
  47. package/dist/drivers/index.d.ts +29 -9
  48. package/dist/drivers/index.js +18 -0
  49. package/dist/drivers/interfaces.d.ts +17 -14
  50. package/dist/drivers/log.cjs +4 -3
  51. package/dist/drivers/log.cjs.map +1 -1
  52. package/dist/drivers/log.d.ts +52 -49
  53. package/dist/drivers/log.js +4 -2
  54. package/dist/drivers/log.js.map +1 -1
  55. package/dist/drivers/ls.cjs +16 -19
  56. package/dist/drivers/ls.cjs.map +1 -1
  57. package/dist/drivers/ls.d.ts +73 -76
  58. package/dist/drivers/ls.js +16 -17
  59. package/dist/drivers/ls.js.map +1 -1
  60. package/dist/drivers/pframe/column_filter.d.ts +19 -15
  61. package/dist/drivers/pframe/data_info.cjs +201 -252
  62. package/dist/drivers/pframe/data_info.cjs.map +1 -1
  63. package/dist/drivers/pframe/data_info.d.ts +84 -109
  64. package/dist/drivers/pframe/data_info.js +201 -250
  65. package/dist/drivers/pframe/data_info.js.map +1 -1
  66. package/dist/drivers/pframe/data_types.cjs +38 -63
  67. package/dist/drivers/pframe/data_types.cjs.map +1 -1
  68. package/dist/drivers/pframe/data_types.d.ts +91 -93
  69. package/dist/drivers/pframe/data_types.js +38 -61
  70. package/dist/drivers/pframe/data_types.js.map +1 -1
  71. package/dist/drivers/pframe/driver.cjs +7 -0
  72. package/dist/drivers/pframe/driver.cjs.map +1 -0
  73. package/dist/drivers/pframe/driver.d.ts +50 -45
  74. package/dist/drivers/pframe/driver.js +6 -0
  75. package/dist/drivers/pframe/driver.js.map +1 -0
  76. package/dist/drivers/pframe/filter_spec.d.ts +127 -123
  77. package/dist/drivers/pframe/find_columns.d.ts +21 -17
  78. package/dist/drivers/pframe/index.cjs +15 -0
  79. package/dist/drivers/pframe/index.d.ts +23 -16
  80. package/dist/drivers/pframe/index.js +15 -0
  81. package/dist/drivers/pframe/linker_columns.cjs +184 -238
  82. package/dist/drivers/pframe/linker_columns.cjs.map +1 -1
  83. package/dist/drivers/pframe/linker_columns.d.ts +45 -38
  84. package/dist/drivers/pframe/linker_columns.js +184 -236
  85. package/dist/drivers/pframe/linker_columns.js.map +1 -1
  86. package/dist/drivers/pframe/pframe.d.ts +26 -21
  87. package/dist/drivers/pframe/query/index.cjs +1 -0
  88. package/dist/drivers/pframe/query/index.d.ts +3 -4
  89. package/dist/drivers/pframe/query/index.js +1 -0
  90. package/dist/drivers/pframe/query/query_common.d.ts +205 -247
  91. package/dist/drivers/pframe/query/query_data.d.ts +25 -23
  92. package/dist/drivers/pframe/query/query_spec.d.ts +30 -29
  93. package/dist/drivers/pframe/query/utils.cjs +164 -183
  94. package/dist/drivers/pframe/query/utils.cjs.map +1 -1
  95. package/dist/drivers/pframe/query/utils.d.ts +13 -12
  96. package/dist/drivers/pframe/query/utils.js +164 -181
  97. package/dist/drivers/pframe/query/utils.js.map +1 -1
  98. package/dist/drivers/pframe/spec/anchored.cjs +178 -216
  99. package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
  100. package/dist/drivers/pframe/spec/anchored.d.ts +53 -49
  101. package/dist/drivers/pframe/spec/anchored.js +176 -214
  102. package/dist/drivers/pframe/spec/anchored.js.map +1 -1
  103. package/dist/drivers/pframe/spec/filtered_column.cjs +8 -7
  104. package/dist/drivers/pframe/spec/filtered_column.cjs.map +1 -1
  105. package/dist/drivers/pframe/spec/filtered_column.d.ts +20 -17
  106. package/dist/drivers/pframe/spec/filtered_column.js +8 -6
  107. package/dist/drivers/pframe/spec/filtered_column.js.map +1 -1
  108. package/dist/drivers/pframe/spec/ids.cjs +16 -14
  109. package/dist/drivers/pframe/spec/ids.cjs.map +1 -1
  110. package/dist/drivers/pframe/spec/ids.d.ts +13 -8
  111. package/dist/drivers/pframe/spec/ids.js +14 -12
  112. package/dist/drivers/pframe/spec/ids.js.map +1 -1
  113. package/dist/drivers/pframe/spec/index.cjs +6 -0
  114. package/dist/drivers/pframe/spec/index.d.ts +6 -7
  115. package/dist/drivers/pframe/spec/index.js +6 -0
  116. package/dist/drivers/pframe/spec/native_id.cjs +16 -16
  117. package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
  118. package/dist/drivers/pframe/spec/native_id.d.ts +9 -4
  119. package/dist/drivers/pframe/spec/native_id.js +13 -13
  120. package/dist/drivers/pframe/spec/native_id.js.map +1 -1
  121. package/dist/drivers/pframe/spec/selectors.cjs +72 -112
  122. package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
  123. package/dist/drivers/pframe/spec/selectors.d.ts +99 -94
  124. package/dist/drivers/pframe/spec/selectors.js +72 -110
  125. package/dist/drivers/pframe/spec/selectors.js.map +1 -1
  126. package/dist/drivers/pframe/spec/spec.cjs +282 -324
  127. package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
  128. package/dist/drivers/pframe/spec/spec.d.ts +263 -272
  129. package/dist/drivers/pframe/spec/spec.js +281 -322
  130. package/dist/drivers/pframe/spec/spec.js.map +1 -1
  131. package/dist/drivers/pframe/table.d.ts +28 -24
  132. package/dist/drivers/pframe/table_calculate.cjs +117 -147
  133. package/dist/drivers/pframe/table_calculate.cjs.map +1 -1
  134. package/dist/drivers/pframe/table_calculate.d.ts +219 -220
  135. package/dist/drivers/pframe/table_calculate.js +117 -145
  136. package/dist/drivers/pframe/table_calculate.js.map +1 -1
  137. package/dist/drivers/pframe/table_common.cjs +13 -14
  138. package/dist/drivers/pframe/table_common.cjs.map +1 -1
  139. package/dist/drivers/pframe/table_common.d.ts +24 -19
  140. package/dist/drivers/pframe/table_common.js +13 -13
  141. package/dist/drivers/pframe/table_common.js.map +1 -1
  142. package/dist/drivers/pframe/unique_values.d.ts +23 -18
  143. package/dist/drivers/upload.d.ts +21 -18
  144. package/dist/drivers/urls.cjs +5 -6
  145. package/dist/drivers/urls.cjs.map +1 -1
  146. package/dist/drivers/urls.d.ts +12 -9
  147. package/dist/drivers/urls.js +5 -5
  148. package/dist/drivers/urls.js.map +1 -1
  149. package/dist/errors.cjs +65 -86
  150. package/dist/errors.cjs.map +1 -1
  151. package/dist/errors.d.ts +36 -33
  152. package/dist/errors.js +65 -85
  153. package/dist/errors.js.map +1 -1
  154. package/dist/flags/block_flags.cjs +7 -6
  155. package/dist/flags/block_flags.cjs.map +1 -1
  156. package/dist/flags/block_flags.d.ts +12 -8
  157. package/dist/flags/block_flags.js +7 -5
  158. package/dist/flags/block_flags.js.map +1 -1
  159. package/dist/flags/flag_utils.cjs +69 -108
  160. package/dist/flags/flag_utils.cjs.map +1 -1
  161. package/dist/flags/flag_utils.d.ts +40 -42
  162. package/dist/flags/flag_utils.js +70 -107
  163. package/dist/flags/flag_utils.js.map +1 -1
  164. package/dist/flags/type_utils.d.ts +12 -11
  165. package/dist/httpAuth.cjs +16 -20
  166. package/dist/httpAuth.cjs.map +1 -1
  167. package/dist/httpAuth.d.ts +10 -7
  168. package/dist/httpAuth.js +16 -19
  169. package/dist/httpAuth.js.map +1 -1
  170. package/dist/index.cjs +176 -179
  171. package/dist/index.d.ts +58 -20
  172. package/dist/index.js +37 -34
  173. package/dist/json.cjs +10 -8
  174. package/dist/json.cjs.map +1 -1
  175. package/dist/json.d.ts +18 -18
  176. package/dist/json.js +8 -6
  177. package/dist/json.js.map +1 -1
  178. package/dist/navigation.cjs +3 -2
  179. package/dist/navigation.cjs.map +1 -1
  180. package/dist/navigation.d.ts +18 -21
  181. package/dist/navigation.js +3 -1
  182. package/dist/navigation.js.map +1 -1
  183. package/dist/plid.cjs +16 -20
  184. package/dist/plid.cjs.map +1 -1
  185. package/dist/plid.d.ts +11 -7
  186. package/dist/plid.js +15 -18
  187. package/dist/plid.js.map +1 -1
  188. package/dist/pool/entry.d.ts +11 -11
  189. package/dist/pool/index.d.ts +3 -4
  190. package/dist/pool/query.cjs +21 -43
  191. package/dist/pool/query.cjs.map +1 -1
  192. package/dist/pool/query.d.ts +25 -20
  193. package/dist/pool/query.js +20 -40
  194. package/dist/pool/query.js.map +1 -1
  195. package/dist/pool/spec.cjs +40 -47
  196. package/dist/pool/spec.cjs.map +1 -1
  197. package/dist/pool/spec.d.ts +33 -31
  198. package/dist/pool/spec.js +40 -45
  199. package/dist/pool/spec.js.map +1 -1
  200. package/dist/ref.cjs +51 -71
  201. package/dist/ref.cjs.map +1 -1
  202. package/dist/ref.d.ts +36 -33
  203. package/dist/ref.js +50 -69
  204. package/dist/ref.js.map +1 -1
  205. package/dist/utag.d.ts +18 -14
  206. package/dist/util.cjs +8 -7
  207. package/dist/util.cjs.map +1 -1
  208. package/dist/util.d.ts +5 -2
  209. package/dist/util.js +8 -6
  210. package/dist/util.js.map +1 -1
  211. package/dist/value_or_error.cjs +7 -3
  212. package/dist/value_or_error.cjs.map +1 -1
  213. package/dist/value_or_error.d.ts +9 -6
  214. package/dist/value_or_error.js +7 -2
  215. package/dist/value_or_error.js.map +1 -1
  216. package/package.json +6 -6
  217. package/src/flags/block_flags.ts +2 -1
  218. package/src/flags/flag_utils.ts +0 -22
  219. package/dist/author_marker.d.ts.map +0 -1
  220. package/dist/base32_encode.d.ts +0 -8
  221. package/dist/base32_encode.d.ts.map +0 -1
  222. package/dist/base64.d.ts.map +0 -1
  223. package/dist/block_state.d.ts.map +0 -1
  224. package/dist/bmodel/block_config.d.ts.map +0 -1
  225. package/dist/bmodel/code.d.ts.map +0 -1
  226. package/dist/bmodel/container.d.ts.map +0 -1
  227. package/dist/bmodel/index.d.ts.map +0 -1
  228. package/dist/bmodel/normalization.d.ts.map +0 -1
  229. package/dist/bmodel/types.d.ts.map +0 -1
  230. package/dist/branding.d.ts.map +0 -1
  231. package/dist/common_types.d.ts.map +0 -1
  232. package/dist/driver_kit.d.ts.map +0 -1
  233. package/dist/drivers/ChunkedStreamReader.d.ts.map +0 -1
  234. package/dist/drivers/blob.d.ts.map +0 -1
  235. package/dist/drivers/index.d.ts.map +0 -1
  236. package/dist/drivers/interfaces.d.ts.map +0 -1
  237. package/dist/drivers/log.d.ts.map +0 -1
  238. package/dist/drivers/ls.d.ts.map +0 -1
  239. package/dist/drivers/pframe/column_filter.d.ts.map +0 -1
  240. package/dist/drivers/pframe/data_info.d.ts.map +0 -1
  241. package/dist/drivers/pframe/data_types.d.ts.map +0 -1
  242. package/dist/drivers/pframe/driver.d.ts.map +0 -1
  243. package/dist/drivers/pframe/filter_spec.d.ts.map +0 -1
  244. package/dist/drivers/pframe/find_columns.d.ts.map +0 -1
  245. package/dist/drivers/pframe/index.d.ts.map +0 -1
  246. package/dist/drivers/pframe/linker_columns.d.ts.map +0 -1
  247. package/dist/drivers/pframe/pframe.d.ts.map +0 -1
  248. package/dist/drivers/pframe/query/index.d.ts.map +0 -1
  249. package/dist/drivers/pframe/query/query_common.d.ts.map +0 -1
  250. package/dist/drivers/pframe/query/query_data.d.ts.map +0 -1
  251. package/dist/drivers/pframe/query/query_spec.d.ts.map +0 -1
  252. package/dist/drivers/pframe/query/utils.d.ts.map +0 -1
  253. package/dist/drivers/pframe/spec/anchored.d.ts.map +0 -1
  254. package/dist/drivers/pframe/spec/filtered_column.d.ts.map +0 -1
  255. package/dist/drivers/pframe/spec/ids.d.ts.map +0 -1
  256. package/dist/drivers/pframe/spec/index.d.ts.map +0 -1
  257. package/dist/drivers/pframe/spec/native_id.d.ts.map +0 -1
  258. package/dist/drivers/pframe/spec/selectors.d.ts.map +0 -1
  259. package/dist/drivers/pframe/spec/spec.d.ts.map +0 -1
  260. package/dist/drivers/pframe/table.d.ts.map +0 -1
  261. package/dist/drivers/pframe/table_calculate.d.ts.map +0 -1
  262. package/dist/drivers/pframe/table_common.d.ts.map +0 -1
  263. package/dist/drivers/pframe/type_util.d.ts +0 -5
  264. package/dist/drivers/pframe/type_util.d.ts.map +0 -1
  265. package/dist/drivers/pframe/unique_values.d.ts.map +0 -1
  266. package/dist/drivers/upload.d.ts.map +0 -1
  267. package/dist/drivers/urls.d.ts.map +0 -1
  268. package/dist/errors.d.ts.map +0 -1
  269. package/dist/flags/block_flags.d.ts.map +0 -1
  270. package/dist/flags/flag_utils.d.ts.map +0 -1
  271. package/dist/flags/index.d.ts +0 -4
  272. package/dist/flags/index.d.ts.map +0 -1
  273. package/dist/flags/type_utils.d.ts.map +0 -1
  274. package/dist/httpAuth.d.ts.map +0 -1
  275. package/dist/index.cjs.map +0 -1
  276. package/dist/index.d.ts.map +0 -1
  277. package/dist/index.js.map +0 -1
  278. package/dist/json.d.ts.map +0 -1
  279. package/dist/navigation.d.ts.map +0 -1
  280. package/dist/plid.d.ts.map +0 -1
  281. package/dist/pool/entry.d.ts.map +0 -1
  282. package/dist/pool/index.d.ts.map +0 -1
  283. package/dist/pool/query.d.ts.map +0 -1
  284. package/dist/pool/spec.d.ts.map +0 -1
  285. package/dist/ref.d.ts.map +0 -1
  286. package/dist/utag.d.ts.map +0 -1
  287. package/dist/util.d.ts.map +0 -1
  288. package/dist/value_or_error.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ChunkedStreamReader.js","sources":["../../src/drivers/ChunkedStreamReader.ts"],"sourcesContent":["import type { RangeBytes } from \"./blob\";\n\n/**\n * Status returned by onError handler to indicate what action to take\n * - 'continue': Retry the failed operation\n * - 'error': Error the stream (calls controller.error, aborts ongoing fetches)\n * - 'cancel': Cancel the stream gracefully (calls controller.close, aborts ongoing fetches)\n */\nexport type ErrorHandlerStatus = \"continue\" | \"error\" | \"cancel\";\n\n/**\n * Options for creating a ChunkedStreamReader\n */\nexport interface ChunkedStreamReaderOptions {\n /**\n * Function to fetch a chunk of data. Optionally accepts an AbortSignal to cancel the fetch.\n */\n fetchChunk: (range: RangeBytes, signal?: AbortSignal) => Promise<Uint8Array>;\n\n /**\n * Total size of the blob in bytes\n */\n totalSize: number;\n\n /**\n * Size of each chunk to read in bytes (default: 16MB)\n */\n chunkSize?: number;\n\n /**\n * Error handler callback. Called when an error occurs during chunk fetching.\n * Should return:\n * - 'continue' to retry the operation\n * - 'error' to error the stream (will call controller.error and abort ongoing fetches)\n * - 'cancel' to cancel gracefully (will call controller.close and abort ongoing fetches)\n * Default behavior: returns 'error'.\n */\n onError?: (error: unknown) => Promise<ErrorHandlerStatus>;\n}\n\n/**\n * ChunkedStreamReader creates a ReadableStream that reads data from a blob driver\n * in fixed-size chunks. This is useful for streaming large files without loading\n * them entirely into memory.\n */\nexport class ChunkedStreamReader {\n private currentPosition: number = 0;\n private _read = true;\n private _canceled = false;\n private _errored = false;\n private abortController: AbortController | null = null;\n private readonly options: Required<ChunkedStreamReaderOptions>;\n\n /**\n * Creates a new ChunkedStreamReader instance.\n * Use the static `create` method instead.\n */\n private constructor(options: ChunkedStreamReaderOptions) {\n // Normalize options with defaults\n this.options = {\n ...options,\n chunkSize: options.chunkSize ?? 16 * 1024 * 1024,\n onError:\n options.onError ??\n (async () => {\n // Default behavior: error (will automatically call controller.error)\n return \"error\";\n }),\n };\n\n if (this.totalSize < 0) {\n throw new Error(\"Total size must be non-negative\");\n }\n if (this.chunkSize <= 0) {\n throw new Error(\"Chunk size must be positive\");\n }\n }\n\n /**\n * Gets the fetchChunk function from options\n */\n private get fetchChunk() {\n return this.options.fetchChunk;\n }\n\n /**\n * Gets the total size from options\n */\n private get totalSize() {\n return this.options.totalSize;\n }\n\n /**\n * Gets the chunk size from options\n */\n private get chunkSize() {\n return this.options.chunkSize;\n }\n\n /**\n * Gets the onError callback from options\n */\n private get onError() {\n return this.options.onError;\n }\n\n /**\n * Creates and returns a ReadableStream that reads data in chunks.\n *\n * @param options - Configuration options for the chunked stream reader\n * @returns ReadableStream that can be consumed by zip.add or other stream consumers\n *\n * @example\n * ```typescript\n * const stream = ChunkedStreamReader.create({\n * fetchChunk: async (range, signal) => {\n * const response = await fetch(`/api/data?from=${range.from}&to=${range.to}`, { signal });\n * return new Uint8Array(await response.arrayBuffer());\n * },\n * totalSize: 1024 * 1024, // 1MB\n * chunkSize: 64 * 1024, // 64KB chunks\n * });\n * ```\n */\n static create(options: ChunkedStreamReaderOptions): ReadableStream<Uint8Array> {\n const reader = new ChunkedStreamReader(options);\n return reader.createStream();\n }\n\n private readStart() {\n this._read = true;\n }\n\n private readStop() {\n this._read = false;\n }\n\n private async tryRead(controller: ReadableStreamDefaultController<Uint8Array>): Promise<boolean> {\n if (this._canceled) {\n return true;\n }\n\n // Check if we've read all data\n if (this.isComplete()) {\n controller.close();\n return true;\n }\n\n try {\n // Calculate the end position for this chunk\n // Ensure we don't read beyond the total size\n const endPosition = Math.min(this.currentPosition + this.chunkSize, this.totalSize);\n\n // Fetch the chunk from the blob driver, passing the abort signal if available\n const data = await this.fetchChunk(\n { from: this.currentPosition, to: endPosition },\n this.abortController?.signal,\n );\n\n // Check if stream was cancelled during the fetch\n if (this._canceled) {\n return true;\n }\n\n // Enqueue the data into the stream\n controller.enqueue(data);\n\n // Update the current position for the next chunk\n this.currentPosition = endPosition;\n\n if (!controller.desiredSize || controller.desiredSize <= 0) {\n // The internal queue is full, so propagate\n // the backpressure signal to the underlying source.\n this.readStop();\n }\n } catch (error) {\n // If any error occurs during chunk reading, call the error handler\n const status = await this.onError(error);\n\n if (status === \"error\") {\n this._errored = true;\n // Error the stream and abort any ongoing fetch operations\n controller.error(error);\n this.abortController?.abort(\"Stream errored\");\n return true; // Stop reading\n }\n\n if (status === \"cancel\") {\n this._canceled = true;\n // Close the stream gracefully and abort any ongoing fetch operations\n controller.close();\n this.abortController?.abort(\"Stream cancelled\");\n console.debug(\"ChunkedStreamReader cancelled due to error\");\n return true; // Stop reading\n }\n }\n\n return false;\n }\n\n /**\n * Creates and returns a ReadableStream that reads data in chunks.\n * The stream will automatically close when all data has been read.\n *\n * @private - Use the static `create` method instead\n * @returns ReadableStream that can be consumed by zip.add or other stream consumers\n */\n private createStream(): ReadableStream<Uint8Array> {\n // Create an AbortController for this stream\n this.abortController = new AbortController();\n\n return new ReadableStream({\n start: async (controller) => {\n while (true) {\n if (this._canceled || this._errored) {\n return;\n }\n\n if (!this._read) {\n await new Promise((r) => setTimeout(r, 0));\n if (controller.desiredSize) {\n this.readStart();\n }\n } else {\n const isDone = await this.tryRead(controller);\n if (isDone) {\n return;\n }\n }\n }\n },\n\n pull: () => {\n this.readStart();\n },\n\n cancel: (reason) => {\n this._canceled = true;\n // Abort any ongoing fetch operations\n this.abortController?.abort(reason);\n console.debug(\"ChunkedStreamReader cancelled:\", reason);\n },\n });\n }\n\n /**\n * Gets the current reading position in bytes.\n *\n * @returns Current position as number of bytes read\n */\n getCurrentPosition(): number {\n return this.currentPosition;\n }\n\n /**\n * Gets the remaining bytes to be read.\n *\n * @returns Number of bytes remaining\n */\n getRemainingBytes(): number {\n return Math.max(0, this.totalSize - this.currentPosition);\n }\n\n /**\n * Checks if the entire blob has been read.\n *\n * @returns True if all data has been read\n */\n isComplete(): boolean {\n return this.currentPosition >= this.totalSize;\n }\n}\n"],"names":[],"mappings":"AAwCA;;;;AAIG;MACU,mBAAmB,CAAA;IACtB,eAAe,GAAW,CAAC;IAC3B,KAAK,GAAG,IAAI;IACZ,SAAS,GAAG,KAAK;IACjB,QAAQ,GAAG,KAAK;IAChB,eAAe,GAA2B,IAAI;AACrC,IAAA,OAAO;AAExB;;;AAGG;AACH,IAAA,WAAA,CAAoB,OAAmC,EAAA;;QAErD,IAAI,CAAC,OAAO,GAAG;AACb,YAAA,GAAG,OAAO;YACV,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI;YAChD,OAAO,EACL,OAAO,CAAC,OAAO;iBACd,YAAW;;AAEV,oBAAA,OAAO,OAAO;AAChB,gBAAA,CAAC,CAAC;SACL;AAED,QAAA,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC;QACpD;AACA,QAAA,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,EAAE;AACvB,YAAA,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC;QAChD;IACF;AAEA;;AAEG;AACH,IAAA,IAAY,UAAU,GAAA;AACpB,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU;IAChC;AAEA;;AAEG;AACH,IAAA,IAAY,SAAS,GAAA;AACnB,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS;IAC/B;AAEA;;AAEG;AACH,IAAA,IAAY,SAAS,GAAA;AACnB,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS;IAC/B;AAEA;;AAEG;AACH,IAAA,IAAY,OAAO,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO;IAC7B;AAEA;;;;;;;;;;;;;;;;;AAiBG;IACH,OAAO,MAAM,CAAC,OAAmC,EAAA;AAC/C,QAAA,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,OAAO,CAAC;AAC/C,QAAA,OAAO,MAAM,CAAC,YAAY,EAAE;IAC9B;IAEQ,SAAS,GAAA;AACf,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;IACnB;IAEQ,QAAQ,GAAA;AACd,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;IACpB;IAEQ,MAAM,OAAO,CAAC,UAAuD,EAAA;AAC3E,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,YAAA,OAAO,IAAI;QACb;;AAGA,QAAA,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;YACrB,UAAU,CAAC,KAAK,EAAE;AAClB,YAAA,OAAO,IAAI;QACb;AAEA,QAAA,IAAI;;;AAGF,YAAA,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC;;YAGnF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,UAAU,CAChC,EAAE,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,EAAE,WAAW,EAAE,EAC/C,IAAI,CAAC,eAAe,EAAE,MAAM,CAC7B;;AAGD,YAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,gBAAA,OAAO,IAAI;YACb;;AAGA,YAAA,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC;;AAGxB,YAAA,IAAI,CAAC,eAAe,GAAG,WAAW;YAElC,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,UAAU,CAAC,WAAW,IAAI,CAAC,EAAE;;;gBAG1D,IAAI,CAAC,QAAQ,EAAE;YACjB;QACF;QAAE,OAAO,KAAK,EAAE;;YAEd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;AAExC,YAAA,IAAI,MAAM,KAAK,OAAO,EAAE;AACtB,gBAAA,IAAI,CAAC,QAAQ,GAAG,IAAI;;AAEpB,gBAAA,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC;AACvB,gBAAA,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,gBAAgB,CAAC;gBAC7C,OAAO,IAAI,CAAC;YACd;AAEA,YAAA,IAAI,MAAM,KAAK,QAAQ,EAAE;AACvB,gBAAA,IAAI,CAAC,SAAS,GAAG,IAAI;;gBAErB,UAAU,CAAC,KAAK,EAAE;AAClB,gBAAA,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,kBAAkB,CAAC;AAC/C,gBAAA,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC;gBAC3D,OAAO,IAAI,CAAC;YACd;QACF;AAEA,QAAA,OAAO,KAAK;IACd;AAEA;;;;;;AAMG;IACK,YAAY,GAAA;;AAElB,QAAA,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,EAAE;QAE5C,OAAO,IAAI,cAAc,CAAC;AACxB,YAAA,KAAK,EAAE,OAAO,UAAU,KAAI;gBAC1B,OAAO,IAAI,EAAE;oBACX,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,EAAE;wBACnC;oBACF;AAEA,oBAAA,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;AACf,wBAAA,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1C,wBAAA,IAAI,UAAU,CAAC,WAAW,EAAE;4BAC1B,IAAI,CAAC,SAAS,EAAE;wBAClB;oBACF;yBAAO;wBACL,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;wBAC7C,IAAI,MAAM,EAAE;4BACV;wBACF;oBACF;gBACF;YACF,CAAC;YAED,IAAI,EAAE,MAAK;gBACT,IAAI,CAAC,SAAS,EAAE;YAClB,CAAC;AAED,YAAA,MAAM,EAAE,CAAC,MAAM,KAAI;AACjB,gBAAA,IAAI,CAAC,SAAS,GAAG,IAAI;;AAErB,gBAAA,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC;AACnC,gBAAA,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,MAAM,CAAC;YACzD,CAAC;AACF,SAAA,CAAC;IACJ;AAEA;;;;AAIG;IACH,kBAAkB,GAAA;QAChB,OAAO,IAAI,CAAC,eAAe;IAC7B;AAEA;;;;AAIG;IACH,iBAAiB,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC;IAC3D;AAEA;;;;AAIG;IACH,UAAU,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,SAAS;IAC/C;AACD;;;;"}
1
+ {"version":3,"file":"ChunkedStreamReader.js","names":[],"sources":["../../src/drivers/ChunkedStreamReader.ts"],"sourcesContent":["import type { RangeBytes } from \"./blob\";\n\n/**\n * Status returned by onError handler to indicate what action to take\n * - 'continue': Retry the failed operation\n * - 'error': Error the stream (calls controller.error, aborts ongoing fetches)\n * - 'cancel': Cancel the stream gracefully (calls controller.close, aborts ongoing fetches)\n */\nexport type ErrorHandlerStatus = \"continue\" | \"error\" | \"cancel\";\n\n/**\n * Options for creating a ChunkedStreamReader\n */\nexport interface ChunkedStreamReaderOptions {\n /**\n * Function to fetch a chunk of data. Optionally accepts an AbortSignal to cancel the fetch.\n */\n fetchChunk: (range: RangeBytes, signal?: AbortSignal) => Promise<Uint8Array>;\n\n /**\n * Total size of the blob in bytes\n */\n totalSize: number;\n\n /**\n * Size of each chunk to read in bytes (default: 16MB)\n */\n chunkSize?: number;\n\n /**\n * Error handler callback. Called when an error occurs during chunk fetching.\n * Should return:\n * - 'continue' to retry the operation\n * - 'error' to error the stream (will call controller.error and abort ongoing fetches)\n * - 'cancel' to cancel gracefully (will call controller.close and abort ongoing fetches)\n * Default behavior: returns 'error'.\n */\n onError?: (error: unknown) => Promise<ErrorHandlerStatus>;\n}\n\n/**\n * ChunkedStreamReader creates a ReadableStream that reads data from a blob driver\n * in fixed-size chunks. This is useful for streaming large files without loading\n * them entirely into memory.\n */\nexport class ChunkedStreamReader {\n private currentPosition: number = 0;\n private _read = true;\n private _canceled = false;\n private _errored = false;\n private abortController: AbortController | null = null;\n private readonly options: Required<ChunkedStreamReaderOptions>;\n\n /**\n * Creates a new ChunkedStreamReader instance.\n * Use the static `create` method instead.\n */\n private constructor(options: ChunkedStreamReaderOptions) {\n // Normalize options with defaults\n this.options = {\n ...options,\n chunkSize: options.chunkSize ?? 16 * 1024 * 1024,\n onError:\n options.onError ??\n (async () => {\n // Default behavior: error (will automatically call controller.error)\n return \"error\";\n }),\n };\n\n if (this.totalSize < 0) {\n throw new Error(\"Total size must be non-negative\");\n }\n if (this.chunkSize <= 0) {\n throw new Error(\"Chunk size must be positive\");\n }\n }\n\n /**\n * Gets the fetchChunk function from options\n */\n private get fetchChunk() {\n return this.options.fetchChunk;\n }\n\n /**\n * Gets the total size from options\n */\n private get totalSize() {\n return this.options.totalSize;\n }\n\n /**\n * Gets the chunk size from options\n */\n private get chunkSize() {\n return this.options.chunkSize;\n }\n\n /**\n * Gets the onError callback from options\n */\n private get onError() {\n return this.options.onError;\n }\n\n /**\n * Creates and returns a ReadableStream that reads data in chunks.\n *\n * @param options - Configuration options for the chunked stream reader\n * @returns ReadableStream that can be consumed by zip.add or other stream consumers\n *\n * @example\n * ```typescript\n * const stream = ChunkedStreamReader.create({\n * fetchChunk: async (range, signal) => {\n * const response = await fetch(`/api/data?from=${range.from}&to=${range.to}`, { signal });\n * return new Uint8Array(await response.arrayBuffer());\n * },\n * totalSize: 1024 * 1024, // 1MB\n * chunkSize: 64 * 1024, // 64KB chunks\n * });\n * ```\n */\n static create(options: ChunkedStreamReaderOptions): ReadableStream<Uint8Array> {\n const reader = new ChunkedStreamReader(options);\n return reader.createStream();\n }\n\n private readStart() {\n this._read = true;\n }\n\n private readStop() {\n this._read = false;\n }\n\n private async tryRead(controller: ReadableStreamDefaultController<Uint8Array>): Promise<boolean> {\n if (this._canceled) {\n return true;\n }\n\n // Check if we've read all data\n if (this.isComplete()) {\n controller.close();\n return true;\n }\n\n try {\n // Calculate the end position for this chunk\n // Ensure we don't read beyond the total size\n const endPosition = Math.min(this.currentPosition + this.chunkSize, this.totalSize);\n\n // Fetch the chunk from the blob driver, passing the abort signal if available\n const data = await this.fetchChunk(\n { from: this.currentPosition, to: endPosition },\n this.abortController?.signal,\n );\n\n // Check if stream was cancelled during the fetch\n if (this._canceled) {\n return true;\n }\n\n // Enqueue the data into the stream\n controller.enqueue(data);\n\n // Update the current position for the next chunk\n this.currentPosition = endPosition;\n\n if (!controller.desiredSize || controller.desiredSize <= 0) {\n // The internal queue is full, so propagate\n // the backpressure signal to the underlying source.\n this.readStop();\n }\n } catch (error) {\n // If any error occurs during chunk reading, call the error handler\n const status = await this.onError(error);\n\n if (status === \"error\") {\n this._errored = true;\n // Error the stream and abort any ongoing fetch operations\n controller.error(error);\n this.abortController?.abort(\"Stream errored\");\n return true; // Stop reading\n }\n\n if (status === \"cancel\") {\n this._canceled = true;\n // Close the stream gracefully and abort any ongoing fetch operations\n controller.close();\n this.abortController?.abort(\"Stream cancelled\");\n console.debug(\"ChunkedStreamReader cancelled due to error\");\n return true; // Stop reading\n }\n }\n\n return false;\n }\n\n /**\n * Creates and returns a ReadableStream that reads data in chunks.\n * The stream will automatically close when all data has been read.\n *\n * @private - Use the static `create` method instead\n * @returns ReadableStream that can be consumed by zip.add or other stream consumers\n */\n private createStream(): ReadableStream<Uint8Array> {\n // Create an AbortController for this stream\n this.abortController = new AbortController();\n\n return new ReadableStream({\n start: async (controller) => {\n while (true) {\n if (this._canceled || this._errored) {\n return;\n }\n\n if (!this._read) {\n await new Promise((r) => setTimeout(r, 0));\n if (controller.desiredSize) {\n this.readStart();\n }\n } else {\n const isDone = await this.tryRead(controller);\n if (isDone) {\n return;\n }\n }\n }\n },\n\n pull: () => {\n this.readStart();\n },\n\n cancel: (reason) => {\n this._canceled = true;\n // Abort any ongoing fetch operations\n this.abortController?.abort(reason);\n console.debug(\"ChunkedStreamReader cancelled:\", reason);\n },\n });\n }\n\n /**\n * Gets the current reading position in bytes.\n *\n * @returns Current position as number of bytes read\n */\n getCurrentPosition(): number {\n return this.currentPosition;\n }\n\n /**\n * Gets the remaining bytes to be read.\n *\n * @returns Number of bytes remaining\n */\n getRemainingBytes(): number {\n return Math.max(0, this.totalSize - this.currentPosition);\n }\n\n /**\n * Checks if the entire blob has been read.\n *\n * @returns True if all data has been read\n */\n isComplete(): boolean {\n return this.currentPosition >= this.totalSize;\n }\n}\n"],"mappings":";;;;;;AA6CA,IAAa,sBAAb,MAAa,oBAAoB;CAC/B,AAAQ,kBAA0B;CAClC,AAAQ,QAAQ;CAChB,AAAQ,YAAY;CACpB,AAAQ,WAAW;CACnB,AAAQ,kBAA0C;CAClD,AAAiB;;;;;CAMjB,AAAQ,YAAY,SAAqC;AAEvD,OAAK,UAAU;GACb,GAAG;GACH,WAAW,QAAQ,aAAa,KAAK,OAAO;GAC5C,SACE,QAAQ,YACP,YAAY;AAEX,WAAO;;GAEZ;AAED,MAAI,KAAK,YAAY,EACnB,OAAM,IAAI,MAAM,kCAAkC;AAEpD,MAAI,KAAK,aAAa,EACpB,OAAM,IAAI,MAAM,8BAA8B;;;;;CAOlD,IAAY,aAAa;AACvB,SAAO,KAAK,QAAQ;;;;;CAMtB,IAAY,YAAY;AACtB,SAAO,KAAK,QAAQ;;;;;CAMtB,IAAY,YAAY;AACtB,SAAO,KAAK,QAAQ;;;;;CAMtB,IAAY,UAAU;AACpB,SAAO,KAAK,QAAQ;;;;;;;;;;;;;;;;;;;;CAqBtB,OAAO,OAAO,SAAiE;AAE7E,SADe,IAAI,oBAAoB,QAAQ,CACjC,cAAc;;CAG9B,AAAQ,YAAY;AAClB,OAAK,QAAQ;;CAGf,AAAQ,WAAW;AACjB,OAAK,QAAQ;;CAGf,MAAc,QAAQ,YAA2E;AAC/F,MAAI,KAAK,UACP,QAAO;AAIT,MAAI,KAAK,YAAY,EAAE;AACrB,cAAW,OAAO;AAClB,UAAO;;AAGT,MAAI;GAGF,MAAM,cAAc,KAAK,IAAI,KAAK,kBAAkB,KAAK,WAAW,KAAK,UAAU;GAGnF,MAAM,OAAO,MAAM,KAAK,WACtB;IAAE,MAAM,KAAK;IAAiB,IAAI;IAAa,EAC/C,KAAK,iBAAiB,OACvB;AAGD,OAAI,KAAK,UACP,QAAO;AAIT,cAAW,QAAQ,KAAK;AAGxB,QAAK,kBAAkB;AAEvB,OAAI,CAAC,WAAW,eAAe,WAAW,eAAe,EAGvD,MAAK,UAAU;WAEV,OAAO;GAEd,MAAM,SAAS,MAAM,KAAK,QAAQ,MAAM;AAExC,OAAI,WAAW,SAAS;AACtB,SAAK,WAAW;AAEhB,eAAW,MAAM,MAAM;AACvB,SAAK,iBAAiB,MAAM,iBAAiB;AAC7C,WAAO;;AAGT,OAAI,WAAW,UAAU;AACvB,SAAK,YAAY;AAEjB,eAAW,OAAO;AAClB,SAAK,iBAAiB,MAAM,mBAAmB;AAC/C,YAAQ,MAAM,6CAA6C;AAC3D,WAAO;;;AAIX,SAAO;;;;;;;;;CAUT,AAAQ,eAA2C;AAEjD,OAAK,kBAAkB,IAAI,iBAAiB;AAE5C,SAAO,IAAI,eAAe;GACxB,OAAO,OAAO,eAAe;AAC3B,WAAO,MAAM;AACX,SAAI,KAAK,aAAa,KAAK,SACzB;AAGF,SAAI,CAAC,KAAK,OAAO;AACf,YAAM,IAAI,SAAS,MAAM,WAAW,GAAG,EAAE,CAAC;AAC1C,UAAI,WAAW,YACb,MAAK,WAAW;gBAGH,MAAM,KAAK,QAAQ,WAAW,CAE3C;;;GAMR,YAAY;AACV,SAAK,WAAW;;GAGlB,SAAS,WAAW;AAClB,SAAK,YAAY;AAEjB,SAAK,iBAAiB,MAAM,OAAO;AACnC,YAAQ,MAAM,kCAAkC,OAAO;;GAE1D,CAAC;;;;;;;CAQJ,qBAA6B;AAC3B,SAAO,KAAK;;;;;;;CAQd,oBAA4B;AAC1B,SAAO,KAAK,IAAI,GAAG,KAAK,YAAY,KAAK,gBAAgB;;;;;;;CAQ3D,aAAsB;AACpB,SAAO,KAAK,mBAAmB,KAAK"}
@@ -1,29 +1,27 @@
1
- 'use strict';
2
-
3
- var zod = require('zod');
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ let zod = require("zod");
4
3
 
4
+ //#region src/drivers/blob.ts
5
5
  /** Range in bytes, from should be less than to. */
6
6
  const RangeBytes = zod.z.object({
7
- /** Included left border. */
8
- from: zod.z.number().min(0),
9
- /** Excluded right border. */
10
- to: zod.z.number().min(1),
7
+ from: zod.z.number().min(0),
8
+ to: zod.z.number().min(1)
11
9
  });
12
10
  function newRangeBytesOpt(from, to) {
13
- if (from == undefined || to == undefined) {
14
- return undefined;
15
- }
16
- const range = { from, to };
17
- validateRangeBytes(range, "newRangeBytesOpt");
18
- return range;
11
+ if (from == void 0 || to == void 0) return;
12
+ const range = {
13
+ from,
14
+ to
15
+ };
16
+ validateRangeBytes(range, "newRangeBytesOpt");
17
+ return range;
19
18
  }
20
19
  function validateRangeBytes(range, errMsg) {
21
- if (range.from < 0 || range.from >= range.to) {
22
- throw new Error(`${errMsg}: invalid bytes range: ${range}`);
23
- }
20
+ if (range.from < 0 || range.from >= range.to) throw new Error(`${errMsg}: invalid bytes range: ${range}`);
24
21
  }
25
22
 
23
+ //#endregion
26
24
  exports.RangeBytes = RangeBytes;
27
25
  exports.newRangeBytesOpt = newRangeBytesOpt;
28
26
  exports.validateRangeBytes = validateRangeBytes;
29
- //# sourceMappingURL=blob.cjs.map
27
+ //# sourceMappingURL=blob.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"blob.cjs","sources":["../../src/drivers/blob.ts"],"sourcesContent":["import type { Branded } from \"../branding\";\nimport { z } from \"zod\";\n\n/** Handle of locally downloaded blob. This handle is issued only after the\n * blob's content is downloaded locally, and ready for quick access. */\nexport type LocalBlobHandle = Branded<string, \"LocalBlobHandle\">;\n\n/** Handle of remote blob. This handle is issued as soon as the data becomes\n * available on the remote server. */\nexport type RemoteBlobHandle = Branded<string, \"RemoteBlobHandle\">;\n\n/** Being configured inside the output structure provides information about\n * blob's content and means to retrieve it when needed. */\nexport interface BlobHandleAndSize<\n H extends LocalBlobHandle | RemoteBlobHandle = LocalBlobHandle | RemoteBlobHandle,\n> {\n /** Handle to retrieve block content using {@link BlobDriver.getContent()} */\n readonly handle: H;\n\n /** Blob size in bytes. */\n readonly size: number;\n}\n\n/** Range in bytes, from should be less than to. */\nexport const RangeBytes = z.object({\n /** Included left border. */\n from: z.number().min(0),\n /** Excluded right border. */\n to: z.number().min(1),\n});\n\nexport type RangeBytes = z.infer<typeof RangeBytes>;\n\nexport function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undefined {\n if (from == undefined || to == undefined) {\n return undefined;\n }\n\n const range = { from, to };\n validateRangeBytes(range, \"newRangeBytesOpt\");\n\n return range;\n}\n\nexport function validateRangeBytes(range: RangeBytes, errMsg: string) {\n if (range.from < 0 || range.from >= range.to) {\n throw new Error(`${errMsg}: invalid bytes range: ${range}`);\n }\n}\n\n/** Being configured inside the output structure provides information about\n * locally downloaded blob and means to retrieve it's content when needed. This\n * structure is created only after the blob's content is downloaded locally, and\n * ready for quick access. */\nexport type LocalBlobHandleAndSize = BlobHandleAndSize<LocalBlobHandle>;\n\n/** Being configured inside the output structure provides information about\n * remote blob and means to retrieve it's content when needed. This structure\n * is created as soon as remote blob becomes available. */\nexport type RemoteBlobHandleAndSize = BlobHandleAndSize<RemoteBlobHandle>;\n\nexport type GetContentOptions = {\n /** Byte range in [from, to) format. */\n range?: RangeBytes;\n /** Signal to abort the operation early. */\n signal?: AbortSignal;\n};\n\nexport type ContentHandler<T> = (content: ReadableStream, size: number) => Promise<T>;\n\n/** Defines API of blob driver as it is seen from the block UI code. */\nexport interface BlobDriver {\n /**\n * Given the blob handle returns its content.\n * Depending on the handle type, content will be served from locally downloaded file,\n * or directly from remote platforma storage.\n */\n getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;\n}\n"],"names":["z"],"mappings":";;;;AAuBA;AACO,MAAM,UAAU,GAAGA,KAAC,CAAC,MAAM,CAAC;;IAEjC,IAAI,EAAEA,KAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;IAEvB,EAAE,EAAEA,KAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACtB,CAAA;AAIK,SAAU,gBAAgB,CAAC,IAAa,EAAE,EAAW,EAAA;IACzD,IAAI,IAAI,IAAI,SAAS,IAAI,EAAE,IAAI,SAAS,EAAE;AACxC,QAAA,OAAO,SAAS;IAClB;AAEA,IAAA,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;AAC1B,IAAA,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,CAAC;AAE7C,IAAA,OAAO,KAAK;AACd;AAEM,SAAU,kBAAkB,CAAC,KAAiB,EAAE,MAAc,EAAA;AAClE,IAAA,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE,EAAE;QAC5C,MAAM,IAAI,KAAK,CAAC,CAAA,EAAG,MAAM,CAAA,uBAAA,EAA0B,KAAK,CAAA,CAAE,CAAC;IAC7D;AACF;;;;;;"}
1
+ {"version":3,"file":"blob.cjs","names":["z"],"sources":["../../src/drivers/blob.ts"],"sourcesContent":["import type { Branded } from \"../branding\";\nimport { z } from \"zod\";\n\n/** Handle of locally downloaded blob. This handle is issued only after the\n * blob's content is downloaded locally, and ready for quick access. */\nexport type LocalBlobHandle = Branded<string, \"LocalBlobHandle\">;\n\n/** Handle of remote blob. This handle is issued as soon as the data becomes\n * available on the remote server. */\nexport type RemoteBlobHandle = Branded<string, \"RemoteBlobHandle\">;\n\n/** Being configured inside the output structure provides information about\n * blob's content and means to retrieve it when needed. */\nexport interface BlobHandleAndSize<\n H extends LocalBlobHandle | RemoteBlobHandle = LocalBlobHandle | RemoteBlobHandle,\n> {\n /** Handle to retrieve block content using {@link BlobDriver.getContent()} */\n readonly handle: H;\n\n /** Blob size in bytes. */\n readonly size: number;\n}\n\n/** Range in bytes, from should be less than to. */\nexport const RangeBytes = z.object({\n /** Included left border. */\n from: z.number().min(0),\n /** Excluded right border. */\n to: z.number().min(1),\n});\n\nexport type RangeBytes = z.infer<typeof RangeBytes>;\n\nexport function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undefined {\n if (from == undefined || to == undefined) {\n return undefined;\n }\n\n const range = { from, to };\n validateRangeBytes(range, \"newRangeBytesOpt\");\n\n return range;\n}\n\nexport function validateRangeBytes(range: RangeBytes, errMsg: string) {\n if (range.from < 0 || range.from >= range.to) {\n throw new Error(`${errMsg}: invalid bytes range: ${range}`);\n }\n}\n\n/** Being configured inside the output structure provides information about\n * locally downloaded blob and means to retrieve it's content when needed. This\n * structure is created only after the blob's content is downloaded locally, and\n * ready for quick access. */\nexport type LocalBlobHandleAndSize = BlobHandleAndSize<LocalBlobHandle>;\n\n/** Being configured inside the output structure provides information about\n * remote blob and means to retrieve it's content when needed. This structure\n * is created as soon as remote blob becomes available. */\nexport type RemoteBlobHandleAndSize = BlobHandleAndSize<RemoteBlobHandle>;\n\nexport type GetContentOptions = {\n /** Byte range in [from, to) format. */\n range?: RangeBytes;\n /** Signal to abort the operation early. */\n signal?: AbortSignal;\n};\n\nexport type ContentHandler<T> = (content: ReadableStream, size: number) => Promise<T>;\n\n/** Defines API of blob driver as it is seen from the block UI code. */\nexport interface BlobDriver {\n /**\n * Given the blob handle returns its content.\n * Depending on the handle type, content will be served from locally downloaded file,\n * or directly from remote platforma storage.\n */\n getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;\n}\n"],"mappings":";;;;;AAwBA,MAAa,aAAaA,MAAE,OAAO;CAEjC,MAAMA,MAAE,QAAQ,CAAC,IAAI,EAAE;CAEvB,IAAIA,MAAE,QAAQ,CAAC,IAAI,EAAE;CACtB,CAAC;AAIF,SAAgB,iBAAiB,MAAe,IAAqC;AACnF,KAAI,QAAQ,UAAa,MAAM,OAC7B;CAGF,MAAM,QAAQ;EAAE;EAAM;EAAI;AAC1B,oBAAmB,OAAO,mBAAmB;AAE7C,QAAO;;AAGT,SAAgB,mBAAmB,OAAmB,QAAgB;AACpE,KAAI,MAAM,OAAO,KAAK,MAAM,QAAQ,MAAM,GACxC,OAAM,IAAI,MAAM,GAAG,OAAO,yBAAyB,QAAQ"}
@@ -1,58 +1,58 @@
1
- import type { Branded } from "../branding";
1
+ import { Branded } from "../branding.js";
2
2
  import { z } from "zod";
3
+
4
+ //#region src/drivers/blob.d.ts
3
5
  /** Handle of locally downloaded blob. This handle is issued only after the
4
6
  * blob's content is downloaded locally, and ready for quick access. */
5
- export type LocalBlobHandle = Branded<string, "LocalBlobHandle">;
7
+ type LocalBlobHandle = Branded<string, "LocalBlobHandle">;
6
8
  /** Handle of remote blob. This handle is issued as soon as the data becomes
7
9
  * available on the remote server. */
8
- export type RemoteBlobHandle = Branded<string, "RemoteBlobHandle">;
10
+ type RemoteBlobHandle = Branded<string, "RemoteBlobHandle">;
9
11
  /** Being configured inside the output structure provides information about
10
12
  * blob's content and means to retrieve it when needed. */
11
- export interface BlobHandleAndSize<H extends LocalBlobHandle | RemoteBlobHandle = LocalBlobHandle | RemoteBlobHandle> {
12
- /** Handle to retrieve block content using {@link BlobDriver.getContent()} */
13
- readonly handle: H;
14
- /** Blob size in bytes. */
15
- readonly size: number;
13
+ interface BlobHandleAndSize<H extends LocalBlobHandle | RemoteBlobHandle = LocalBlobHandle | RemoteBlobHandle> {
14
+ /** Handle to retrieve block content using {@link BlobDriver.getContent()} */
15
+ readonly handle: H;
16
+ /** Blob size in bytes. */
17
+ readonly size: number;
16
18
  }
17
19
  /** Range in bytes, from should be less than to. */
18
- export declare const RangeBytes: z.ZodObject<{
19
- /** Included left border. */
20
- from: z.ZodNumber;
21
- /** Excluded right border. */
22
- to: z.ZodNumber;
20
+ declare const RangeBytes: z.ZodObject<{
21
+ /** Included left border. */from: z.ZodNumber; /** Excluded right border. */
22
+ to: z.ZodNumber;
23
23
  }, "strip", z.ZodTypeAny, {
24
- from: number;
25
- to: number;
24
+ from: number;
25
+ to: number;
26
26
  }, {
27
- from: number;
28
- to: number;
27
+ from: number;
28
+ to: number;
29
29
  }>;
30
- export type RangeBytes = z.infer<typeof RangeBytes>;
31
- export declare function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undefined;
32
- export declare function validateRangeBytes(range: RangeBytes, errMsg: string): void;
30
+ type RangeBytes = z.infer<typeof RangeBytes>;
31
+ declare function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undefined;
32
+ declare function validateRangeBytes(range: RangeBytes, errMsg: string): void;
33
33
  /** Being configured inside the output structure provides information about
34
34
  * locally downloaded blob and means to retrieve it's content when needed. This
35
35
  * structure is created only after the blob's content is downloaded locally, and
36
36
  * ready for quick access. */
37
- export type LocalBlobHandleAndSize = BlobHandleAndSize<LocalBlobHandle>;
37
+ type LocalBlobHandleAndSize = BlobHandleAndSize<LocalBlobHandle>;
38
38
  /** Being configured inside the output structure provides information about
39
39
  * remote blob and means to retrieve it's content when needed. This structure
40
40
  * is created as soon as remote blob becomes available. */
41
- export type RemoteBlobHandleAndSize = BlobHandleAndSize<RemoteBlobHandle>;
42
- export type GetContentOptions = {
43
- /** Byte range in [from, to) format. */
44
- range?: RangeBytes;
45
- /** Signal to abort the operation early. */
46
- signal?: AbortSignal;
41
+ type RemoteBlobHandleAndSize = BlobHandleAndSize<RemoteBlobHandle>;
42
+ type GetContentOptions = {
43
+ /** Byte range in [from, to) format. */range?: RangeBytes; /** Signal to abort the operation early. */
44
+ signal?: AbortSignal;
47
45
  };
48
- export type ContentHandler<T> = (content: ReadableStream, size: number) => Promise<T>;
46
+ type ContentHandler<T> = (content: ReadableStream, size: number) => Promise<T>;
49
47
  /** Defines API of blob driver as it is seen from the block UI code. */
50
- export interface BlobDriver {
51
- /**
52
- * Given the blob handle returns its content.
53
- * Depending on the handle type, content will be served from locally downloaded file,
54
- * or directly from remote platforma storage.
55
- */
56
- getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;
48
+ interface BlobDriver {
49
+ /**
50
+ * Given the blob handle returns its content.
51
+ * Depending on the handle type, content will be served from locally downloaded file,
52
+ * or directly from remote platforma storage.
53
+ */
54
+ getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;
57
55
  }
56
+ //#endregion
57
+ export { BlobDriver, BlobHandleAndSize, ContentHandler, GetContentOptions, LocalBlobHandle, LocalBlobHandleAndSize, RangeBytes, RemoteBlobHandle, RemoteBlobHandleAndSize, newRangeBytesOpt, validateRangeBytes };
58
58
  //# sourceMappingURL=blob.d.ts.map
@@ -1,25 +1,24 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
2
 
3
+ //#region src/drivers/blob.ts
3
4
  /** Range in bytes, from should be less than to. */
4
5
  const RangeBytes = z.object({
5
- /** Included left border. */
6
- from: z.number().min(0),
7
- /** Excluded right border. */
8
- to: z.number().min(1),
6
+ from: z.number().min(0),
7
+ to: z.number().min(1)
9
8
  });
10
9
  function newRangeBytesOpt(from, to) {
11
- if (from == undefined || to == undefined) {
12
- return undefined;
13
- }
14
- const range = { from, to };
15
- validateRangeBytes(range, "newRangeBytesOpt");
16
- return range;
10
+ if (from == void 0 || to == void 0) return;
11
+ const range = {
12
+ from,
13
+ to
14
+ };
15
+ validateRangeBytes(range, "newRangeBytesOpt");
16
+ return range;
17
17
  }
18
18
  function validateRangeBytes(range, errMsg) {
19
- if (range.from < 0 || range.from >= range.to) {
20
- throw new Error(`${errMsg}: invalid bytes range: ${range}`);
21
- }
19
+ if (range.from < 0 || range.from >= range.to) throw new Error(`${errMsg}: invalid bytes range: ${range}`);
22
20
  }
23
21
 
22
+ //#endregion
24
23
  export { RangeBytes, newRangeBytesOpt, validateRangeBytes };
25
- //# sourceMappingURL=blob.js.map
24
+ //# sourceMappingURL=blob.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"blob.js","sources":["../../src/drivers/blob.ts"],"sourcesContent":["import type { Branded } from \"../branding\";\nimport { z } from \"zod\";\n\n/** Handle of locally downloaded blob. This handle is issued only after the\n * blob's content is downloaded locally, and ready for quick access. */\nexport type LocalBlobHandle = Branded<string, \"LocalBlobHandle\">;\n\n/** Handle of remote blob. This handle is issued as soon as the data becomes\n * available on the remote server. */\nexport type RemoteBlobHandle = Branded<string, \"RemoteBlobHandle\">;\n\n/** Being configured inside the output structure provides information about\n * blob's content and means to retrieve it when needed. */\nexport interface BlobHandleAndSize<\n H extends LocalBlobHandle | RemoteBlobHandle = LocalBlobHandle | RemoteBlobHandle,\n> {\n /** Handle to retrieve block content using {@link BlobDriver.getContent()} */\n readonly handle: H;\n\n /** Blob size in bytes. */\n readonly size: number;\n}\n\n/** Range in bytes, from should be less than to. */\nexport const RangeBytes = z.object({\n /** Included left border. */\n from: z.number().min(0),\n /** Excluded right border. */\n to: z.number().min(1),\n});\n\nexport type RangeBytes = z.infer<typeof RangeBytes>;\n\nexport function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undefined {\n if (from == undefined || to == undefined) {\n return undefined;\n }\n\n const range = { from, to };\n validateRangeBytes(range, \"newRangeBytesOpt\");\n\n return range;\n}\n\nexport function validateRangeBytes(range: RangeBytes, errMsg: string) {\n if (range.from < 0 || range.from >= range.to) {\n throw new Error(`${errMsg}: invalid bytes range: ${range}`);\n }\n}\n\n/** Being configured inside the output structure provides information about\n * locally downloaded blob and means to retrieve it's content when needed. This\n * structure is created only after the blob's content is downloaded locally, and\n * ready for quick access. */\nexport type LocalBlobHandleAndSize = BlobHandleAndSize<LocalBlobHandle>;\n\n/** Being configured inside the output structure provides information about\n * remote blob and means to retrieve it's content when needed. This structure\n * is created as soon as remote blob becomes available. */\nexport type RemoteBlobHandleAndSize = BlobHandleAndSize<RemoteBlobHandle>;\n\nexport type GetContentOptions = {\n /** Byte range in [from, to) format. */\n range?: RangeBytes;\n /** Signal to abort the operation early. */\n signal?: AbortSignal;\n};\n\nexport type ContentHandler<T> = (content: ReadableStream, size: number) => Promise<T>;\n\n/** Defines API of blob driver as it is seen from the block UI code. */\nexport interface BlobDriver {\n /**\n * Given the blob handle returns its content.\n * Depending on the handle type, content will be served from locally downloaded file,\n * or directly from remote platforma storage.\n */\n getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;\n}\n"],"names":[],"mappings":";;AAuBA;AACO,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;;IAEjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;;IAEvB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACtB,CAAA;AAIK,SAAU,gBAAgB,CAAC,IAAa,EAAE,EAAW,EAAA;IACzD,IAAI,IAAI,IAAI,SAAS,IAAI,EAAE,IAAI,SAAS,EAAE;AACxC,QAAA,OAAO,SAAS;IAClB;AAEA,IAAA,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;AAC1B,IAAA,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,CAAC;AAE7C,IAAA,OAAO,KAAK;AACd;AAEM,SAAU,kBAAkB,CAAC,KAAiB,EAAE,MAAc,EAAA;AAClE,IAAA,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE,EAAE;QAC5C,MAAM,IAAI,KAAK,CAAC,CAAA,EAAG,MAAM,CAAA,uBAAA,EAA0B,KAAK,CAAA,CAAE,CAAC;IAC7D;AACF;;;;"}
1
+ {"version":3,"file":"blob.js","names":[],"sources":["../../src/drivers/blob.ts"],"sourcesContent":["import type { Branded } from \"../branding\";\nimport { z } from \"zod\";\n\n/** Handle of locally downloaded blob. This handle is issued only after the\n * blob's content is downloaded locally, and ready for quick access. */\nexport type LocalBlobHandle = Branded<string, \"LocalBlobHandle\">;\n\n/** Handle of remote blob. This handle is issued as soon as the data becomes\n * available on the remote server. */\nexport type RemoteBlobHandle = Branded<string, \"RemoteBlobHandle\">;\n\n/** Being configured inside the output structure provides information about\n * blob's content and means to retrieve it when needed. */\nexport interface BlobHandleAndSize<\n H extends LocalBlobHandle | RemoteBlobHandle = LocalBlobHandle | RemoteBlobHandle,\n> {\n /** Handle to retrieve block content using {@link BlobDriver.getContent()} */\n readonly handle: H;\n\n /** Blob size in bytes. */\n readonly size: number;\n}\n\n/** Range in bytes, from should be less than to. */\nexport const RangeBytes = z.object({\n /** Included left border. */\n from: z.number().min(0),\n /** Excluded right border. */\n to: z.number().min(1),\n});\n\nexport type RangeBytes = z.infer<typeof RangeBytes>;\n\nexport function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undefined {\n if (from == undefined || to == undefined) {\n return undefined;\n }\n\n const range = { from, to };\n validateRangeBytes(range, \"newRangeBytesOpt\");\n\n return range;\n}\n\nexport function validateRangeBytes(range: RangeBytes, errMsg: string) {\n if (range.from < 0 || range.from >= range.to) {\n throw new Error(`${errMsg}: invalid bytes range: ${range}`);\n }\n}\n\n/** Being configured inside the output structure provides information about\n * locally downloaded blob and means to retrieve it's content when needed. This\n * structure is created only after the blob's content is downloaded locally, and\n * ready for quick access. */\nexport type LocalBlobHandleAndSize = BlobHandleAndSize<LocalBlobHandle>;\n\n/** Being configured inside the output structure provides information about\n * remote blob and means to retrieve it's content when needed. This structure\n * is created as soon as remote blob becomes available. */\nexport type RemoteBlobHandleAndSize = BlobHandleAndSize<RemoteBlobHandle>;\n\nexport type GetContentOptions = {\n /** Byte range in [from, to) format. */\n range?: RangeBytes;\n /** Signal to abort the operation early. */\n signal?: AbortSignal;\n};\n\nexport type ContentHandler<T> = (content: ReadableStream, size: number) => Promise<T>;\n\n/** Defines API of blob driver as it is seen from the block UI code. */\nexport interface BlobDriver {\n /**\n * Given the blob handle returns its content.\n * Depending on the handle type, content will be served from locally downloaded file,\n * or directly from remote platforma storage.\n */\n getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;\n}\n"],"mappings":";;;;AAwBA,MAAa,aAAa,EAAE,OAAO;CAEjC,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE;CAEvB,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE;CACtB,CAAC;AAIF,SAAgB,iBAAiB,MAAe,IAAqC;AACnF,KAAI,QAAQ,UAAa,MAAM,OAC7B;CAGF,MAAM,QAAQ;EAAE;EAAM;EAAI;AAC1B,oBAAmB,OAAO,mBAAmB;AAE7C,QAAO;;AAGT,SAAgB,mBAAmB,OAAmB,QAAgB;AACpE,KAAI,MAAM,OAAO,KAAK,MAAM,QAAQ,MAAM,GACxC,OAAM,IAAI,MAAM,GAAG,OAAO,yBAAyB,QAAQ"}
@@ -0,0 +1,18 @@
1
+ const require_urls = require('./urls.cjs');
2
+ const require_blob = require('./blob.cjs');
3
+ const require_log = require('./log.cjs');
4
+ const require_ls = require('./ls.cjs');
5
+ const require_data_info = require('./pframe/data_info.cjs');
6
+ const require_spec = require('./pframe/spec/spec.cjs');
7
+ const require_data_types = require('./pframe/data_types.cjs');
8
+ const require_utils = require('./pframe/query/utils.cjs');
9
+ const require_table_calculate = require('./pframe/table_calculate.cjs');
10
+ const require_table_common = require('./pframe/table_common.cjs');
11
+ const require_ids = require('./pframe/spec/ids.cjs');
12
+ const require_anchored = require('./pframe/spec/anchored.cjs');
13
+ const require_filtered_column = require('./pframe/spec/filtered_column.cjs');
14
+ const require_selectors = require('./pframe/spec/selectors.cjs');
15
+ const require_native_id = require('./pframe/spec/native_id.cjs');
16
+ const require_linker_columns = require('./pframe/linker_columns.cjs');
17
+ require('./pframe/index.cjs');
18
+ const require_ChunkedStreamReader = require('./ChunkedStreamReader.cjs');
@@ -1,9 +1,29 @@
1
- export * from "./interfaces";
2
- export * from "./urls";
3
- export * from "./blob";
4
- export * from "./upload";
5
- export * from "./log";
6
- export * from "./ls";
7
- export * from "./pframe";
8
- export * from "./ChunkedStreamReader";
9
- //# sourceMappingURL=index.d.ts.map
1
+ import { BlobLike, FileLike } from "./interfaces.js";
2
+ import { ArchiveFormat, BlobToURLDriver, BlockUIURL, FolderURL, FrontendDriver, isBlockUIURL, isFolderURL } from "./urls.js";
3
+ import { BlobDriver, BlobHandleAndSize, ContentHandler, GetContentOptions, LocalBlobHandle, LocalBlobHandleAndSize, RangeBytes, RemoteBlobHandle, RemoteBlobHandleAndSize, newRangeBytesOpt, validateRangeBytes } from "./blob.js";
4
+ import { ImportProgress, ImportStatus } from "./upload.js";
5
+ import { AnyLogHandle, LiveLogHandle, LogsDriver, ProgressLogWithInfo, ReadyLogHandle, StreamingApiResponse, StreamingApiResponseHandleOutdated, StreamingApiResponseOk, isLiveLog } from "./log.js";
6
+ import { Annotation, AnnotationJson, AxesId, AxesSpec, AxisId, AxisSpec, AxisSpecNormalized, AxisTree, AxisValueType, ColumnValueType, Domain, DomainJson, Metadata, MetadataJson, PAxisName, PColumn, PColumnIdAndSpec, PColumnInfo, PColumnLazy, PColumnName, PColumnSpec, PColumnSpecId, PDataColumnSpec, PUniversalColumnSpec, ValueType, canonicalizeAxisId, canonicalizeAxisWithParents, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getNormalizedAxesList, getPColumnSpecId, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, isAxisId, isLabelColumn, isLinkerColumn, matchAxisId, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow } from "./pframe/spec/spec.js";
7
+ import { ColumnFilter } from "./pframe/column_filter.js";
8
+ import { BinaryChunk, BinaryPartitionedDataInfo, BinaryPartitionedDataInfoEntries, DataInfo, DataInfoEntries, JsonDataInfo, JsonDataInfoEntries, JsonPartitionedDataInfo, JsonPartitionedDataInfoEntries, PColumnDataEntry, PColumnKey, PColumnValue, PColumnValues, PColumnValuesEntry, ParquetChunk, ParquetChunkMapping, ParquetChunkMappingAxis, ParquetChunkMappingColumn, ParquetChunkMetadata, ParquetChunkStats, ParquetPartitionedDataInfo, ParquetPartitionedDataInfoEntries, PartitionedDataInfoEntries, dataInfoToEntries, entriesToDataInfo, isDataInfo, isDataInfoEntries, isPartitionedDataInfoEntries, mapDataInfo, mapDataInfoEntries, visitDataInfo } from "./pframe/data_info.js";
9
+ import { AAxisSelector, ADomain, AnchorAxisIdOrRefBasic, AnchorAxisRef, AnchorAxisRefByIdx, AnchorAxisRefByMatcher, AnchorAxisRefByName, AnchorDomainRef, AnchoredColumnMatchStrategy, AnchoredPColumnId, AnchoredPColumnSelector, AxisSelector, PColumnSelector, SingleAxisSelector, isAnchoredPColumnId, matchAxis, matchPColumn, selectorsToPredicate } from "./pframe/spec/selectors.js";
10
+ import { AxisFilter, AxisFilterByIdx, AxisFilterByName, AxisFilterValue, FilteredPColumn, FilteredPColumnId, isFilteredPColumn } from "./pframe/spec/filtered_column.js";
11
+ import { SUniversalPColumnId, UniversalPColumnId, parseColumnId, stringifyColumnId } from "./pframe/spec/ids.js";
12
+ import { FilterSpec, FilterSpecLeaf, FilterSpecNode, FilterSpecOfType, FilterSpecType, InferFilterSpecCommonLeaf, InferFilterSpecCommonNode, InferFilterSpecLeaf, InferFilterSpecLeafColumn, RootFilterSpec } from "./pframe/filter_spec.js";
13
+ import { PTableAbsent, PTableNA, PTableShape, PTableValue, PTableValueAxis, PTableValueBranded, PTableValueData, PTableValueDataBranded, PTableValueDouble, PTableValueFloat, PTableValueInt, PTableValueLong, PTableValueString, PTableVector, PTableVectorTyped, PVectorData, PVectorDataBytes, PVectorDataDouble, PVectorDataFloat, PVectorDataInt, PVectorDataLong, PVectorDataString, PVectorDataTyped, TableRange, ValueTypeSupported, isPTableAbsent, isPTableNA, isPTableValueAxis, pTableValue, pTableValueBranded } from "./pframe/data_types.js";
14
+ import { FindColumnsRequest, FindColumnsResponse } from "./pframe/find_columns.js";
15
+ import { PTableColumnId, PTableColumnIdAxis, PTableColumnIdColumn, PTableColumnSpec, PTableColumnSpecAxis, PTableColumnSpecColumn, getPTableColumnId } from "./pframe/table_common.js";
16
+ import { AnchoredIdDeriver, ResolveAnchorsOptions, resolveAnchors } from "./pframe/spec/anchored.js";
17
+ import { NativePObjectId, deriveNativeId } from "./pframe/spec/native_id.js";
18
+ import { SpecExprAxisRef, SpecExprColumnRef, SpecQuery, SpecQueryBooleanExpression, SpecQueryColumn, SpecQueryExpression, SpecQueryFilter, SpecQueryInlineColumn, SpecQueryJoinEntry, SpecQueryOuterJoin, SpecQuerySliceAxes, SpecQuerySort, SpecQuerySparseToDenseColumn, SpecQuerySymmetricJoin } from "./pframe/query/query_spec.js";
19
+ import { ArtificialColumnJoinEntry, CalculateTableDataRequest, CalculateTableDataResponse, ColumnJoinEntry, ConstantAxisFilter, FullJoin, FullPTableColumnData, InlineColumnJoinEntry, InnerJoin, JoinEntry, OuterJoin, PTableDef, PTableDefV2, PTableRecordFilter, PTableRecordSingleValueFilterV2, PTableSorting, SingleValueAndPredicateV2, SingleValueEqualPredicate, SingleValueGreaterOrEqualPredicate, SingleValueGreaterPredicate, SingleValueIEqualPredicate, SingleValueInSetPredicate, SingleValueIsNAPredicate, SingleValueLessOrEqualPredicate, SingleValueLessPredicate, SingleValueMatchesPredicate, SingleValueNotPredicateV2, SingleValueOrPredicateV2, SingleValuePredicateV2, SingleValueStringContainsFuzzyPredicate, SingleValueStringContainsPredicate, SingleValueStringIContainsFuzzyPredicate, SingleValueStringIContainsPredicate, SlicedColumnJoinEntry, mapJoinEntry, mapPTableDef, mapPTableDefV2, sortJoinEntry, sortPTableDef } from "./pframe/table_calculate.js";
20
+ import { UniqueValuesRequest, UniqueValuesResponse } from "./pframe/unique_values.js";
21
+ import { PFrame, PFrameDef } from "./pframe/pframe.js";
22
+ import { PTable } from "./pframe/table.js";
23
+ import { DataExprAxisRef, DataExprColumnRef, DataQuery, DataQueryBooleanExpression, DataQueryColumn, DataQueryExpression, DataQueryFilter, DataQueryInlineColumn, DataQueryJoinEntry, DataQueryOuterJoin, DataQuerySliceAxes, DataQuerySort, DataQuerySparseToDenseColumn, DataQuerySymmetricJoin } from "./pframe/query/query_data.js";
24
+ import { collectSpecQueryColumns, isBooleanExpression, mapSpecQueryColumns, sortSpecQuery, traverseQuerySpec } from "./pframe/query/utils.js";
25
+ import { PFrameDriver, PFrameHandle, PTableHandle } from "./pframe/driver.js";
26
+ import { CompositeLinkerMap, LinkerMap } from "./pframe/linker_columns.js";
27
+ import "./pframe/index.js";
28
+ import { FileRange, ImportFileHandle, ImportFileHandleIndex, ImportFileHandleUpload, ListFilesResult, LocalImportFileHandle, LsDriver, LsEntry, OpenDialogFilter, OpenDialogOps, OpenMultipleFilesResponse, OpenSingleFileResponse, StorageEntry, StorageHandle, StorageHandleLocal, StorageHandleRemote, getFileNameFromHandle, getFilePathFromHandle, isImportFileHandleIndex, isImportFileHandleUpload } from "./ls.js";
29
+ import { ChunkedStreamReader, ChunkedStreamReaderOptions, ErrorHandlerStatus } from "./ChunkedStreamReader.js";
@@ -0,0 +1,18 @@
1
+ import { isBlockUIURL, isFolderURL } from "./urls.js";
2
+ import { RangeBytes, newRangeBytesOpt, validateRangeBytes } from "./blob.js";
3
+ import { isLiveLog } from "./log.js";
4
+ import { getFileNameFromHandle, getFilePathFromHandle, isImportFileHandleIndex, isImportFileHandleUpload } from "./ls.js";
5
+ import { dataInfoToEntries, entriesToDataInfo, isDataInfo, isDataInfoEntries, isPartitionedDataInfoEntries, mapDataInfo, mapDataInfoEntries, visitDataInfo } from "./pframe/data_info.js";
6
+ import { Annotation, AnnotationJson, Domain, DomainJson, PAxisName, PColumnName, ValueType, canonicalizeAxisId, canonicalizeAxisWithParents, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getNormalizedAxesList, getPColumnSpecId, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, isAxisId, isLabelColumn, isLinkerColumn, matchAxisId, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow } from "./pframe/spec/spec.js";
7
+ import { PTableAbsent, PTableNA, isPTableAbsent, isPTableNA, isPTableValueAxis, pTableValue, pTableValueBranded } from "./pframe/data_types.js";
8
+ import { collectSpecQueryColumns, isBooleanExpression, mapSpecQueryColumns, sortSpecQuery, traverseQuerySpec } from "./pframe/query/utils.js";
9
+ import { mapJoinEntry, mapPTableDef, mapPTableDefV2, sortJoinEntry, sortPTableDef } from "./pframe/table_calculate.js";
10
+ import { getPTableColumnId } from "./pframe/table_common.js";
11
+ import { parseColumnId, stringifyColumnId } from "./pframe/spec/ids.js";
12
+ import { AnchoredIdDeriver, resolveAnchors } from "./pframe/spec/anchored.js";
13
+ import { isFilteredPColumn } from "./pframe/spec/filtered_column.js";
14
+ import { isAnchoredPColumnId, matchAxis, matchPColumn, selectorsToPredicate } from "./pframe/spec/selectors.js";
15
+ import { deriveNativeId } from "./pframe/spec/native_id.js";
16
+ import { LinkerMap } from "./pframe/linker_columns.js";
17
+ import "./pframe/index.js";
18
+ import { ChunkedStreamReader } from "./ChunkedStreamReader.js";
@@ -1,23 +1,26 @@
1
+ //#region src/drivers/interfaces.d.ts
1
2
  /**
2
3
  * Intended to match web.Blob, node.Blob, node-fetch.Blob, etc.
3
4
  */
4
- export interface BlobLike {
5
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
6
- readonly size: number;
7
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
8
- readonly type: string;
9
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
10
- text(): Promise<string>;
11
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
12
- slice(start?: number, end?: number): BlobLike;
5
+ interface BlobLike {
6
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */
7
+ readonly size: number;
8
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */
9
+ readonly type: string;
10
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */
11
+ text(): Promise<string>;
12
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */
13
+ slice(start?: number, end?: number): BlobLike;
13
14
  }
14
15
  /**
15
16
  * Intended to match web.File, node.File, node-fetch.File, etc.
16
17
  */
17
- export interface FileLike extends BlobLike {
18
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
19
- readonly lastModified: number;
20
- /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
21
- readonly name: string;
18
+ interface FileLike extends BlobLike {
19
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */
20
+ readonly lastModified: number;
21
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */
22
+ readonly name: string;
22
23
  }
24
+ //#endregion
25
+ export { BlobLike, FileLike };
23
26
  //# sourceMappingURL=interfaces.d.ts.map
@@ -1,9 +1,10 @@
1
- 'use strict';
2
1
 
2
+ //#region src/drivers/log.ts
3
3
  /** Type guard to check if log is live, and corresponding porcess is not finished. */
4
4
  function isLiveLog(handle) {
5
- return handle !== undefined && handle.startsWith("log+live://log/");
5
+ return handle !== void 0 && handle.startsWith("log+live://log/");
6
6
  }
7
7
 
8
+ //#endregion
8
9
  exports.isLiveLog = isLiveLog;
9
- //# sourceMappingURL=log.cjs.map
10
+ //# sourceMappingURL=log.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.cjs","sources":["../../src/drivers/log.ts"],"sourcesContent":["/** Handle of logs. This handle should be passed\n * to the driver for retrieving logs. */\nexport type AnyLogHandle = LiveLogHandle | ReadyLogHandle;\n\n/** Handle of the live logs of a program.\n * The resource that represents a log can be deleted,\n * in this case the handle should be refreshed. */\nexport type LiveLogHandle = `log+live://log/${string}`;\n\n/** Handle of the ready logs of a program. */\nexport type ReadyLogHandle = `log+ready://log/${string}`;\n\n/** Type guard to check if log is live, and corresponding porcess is not finished. */\nexport function isLiveLog(handle: AnyLogHandle | undefined): handle is LiveLogHandle {\n return handle !== undefined && handle.startsWith(\"log+live://log/\");\n}\n\n/** Driver to retrieve logs given log handle */\nexport interface LogsDriver {\n lastLines(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined, then starts from the end. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string,\n ): Promise<StreamingApiResponse>;\n\n readText(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined of 0, then starts from the beginning. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string,\n ): Promise<StreamingApiResponse>;\n}\n\n/** Response of the driver.\n * The caller should give a handle to retrieve it.\n * It can be OK or outdated, in which case the handle\n * should be issued again. */\nexport type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;\n\nexport type StreamingApiResponseOk = {\n /** The handle don't have to be updated,\n * the response is OK. */\n shouldUpdateHandle: false;\n\n /** Whether the log can still grow or it's in a final state. */\n live: boolean;\n\n /** Data of the response, in bytes. */\n data: Uint8Array;\n /** Current size of the file. It can grow if it's still live. */\n size: number;\n /** Offset in bytes from the beginning of a file. */\n newOffset: number;\n};\n\n/** The handle should be issued again, this one is done. */\nexport type StreamingApiResponseHandleOutdated = {\n shouldUpdateHandle: true;\n};\n\nexport type ProgressLogWithInfo = {\n progressLine?: string;\n live: boolean;\n};\n"],"names":[],"mappings":";;AAYA;AACM,SAAU,SAAS,CAAC,MAAgC,EAAA;IACxD,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC;AACrE;;;;"}
1
+ {"version":3,"file":"log.cjs","names":[],"sources":["../../src/drivers/log.ts"],"sourcesContent":["/** Handle of logs. This handle should be passed\n * to the driver for retrieving logs. */\nexport type AnyLogHandle = LiveLogHandle | ReadyLogHandle;\n\n/** Handle of the live logs of a program.\n * The resource that represents a log can be deleted,\n * in this case the handle should be refreshed. */\nexport type LiveLogHandle = `log+live://log/${string}`;\n\n/** Handle of the ready logs of a program. */\nexport type ReadyLogHandle = `log+ready://log/${string}`;\n\n/** Type guard to check if log is live, and corresponding porcess is not finished. */\nexport function isLiveLog(handle: AnyLogHandle | undefined): handle is LiveLogHandle {\n return handle !== undefined && handle.startsWith(\"log+live://log/\");\n}\n\n/** Driver to retrieve logs given log handle */\nexport interface LogsDriver {\n lastLines(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined, then starts from the end. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string,\n ): Promise<StreamingApiResponse>;\n\n readText(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined of 0, then starts from the beginning. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string,\n ): Promise<StreamingApiResponse>;\n}\n\n/** Response of the driver.\n * The caller should give a handle to retrieve it.\n * It can be OK or outdated, in which case the handle\n * should be issued again. */\nexport type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;\n\nexport type StreamingApiResponseOk = {\n /** The handle don't have to be updated,\n * the response is OK. */\n shouldUpdateHandle: false;\n\n /** Whether the log can still grow or it's in a final state. */\n live: boolean;\n\n /** Data of the response, in bytes. */\n data: Uint8Array;\n /** Current size of the file. It can grow if it's still live. */\n size: number;\n /** Offset in bytes from the beginning of a file. */\n newOffset: number;\n};\n\n/** The handle should be issued again, this one is done. */\nexport type StreamingApiResponseHandleOutdated = {\n shouldUpdateHandle: true;\n};\n\nexport type ProgressLogWithInfo = {\n progressLine?: string;\n live: boolean;\n};\n"],"mappings":";;;AAaA,SAAgB,UAAU,QAA2D;AACnF,QAAO,WAAW,UAAa,OAAO,WAAW,kBAAkB"}
@@ -1,67 +1,70 @@
1
+ //#region src/drivers/log.d.ts
1
2
  /** Handle of logs. This handle should be passed
2
3
  * to the driver for retrieving logs. */
3
- export type AnyLogHandle = LiveLogHandle | ReadyLogHandle;
4
+ type AnyLogHandle = LiveLogHandle | ReadyLogHandle;
4
5
  /** Handle of the live logs of a program.
5
6
  * The resource that represents a log can be deleted,
6
7
  * in this case the handle should be refreshed. */
7
- export type LiveLogHandle = `log+live://log/${string}`;
8
+ type LiveLogHandle = `log+live://log/${string}`;
8
9
  /** Handle of the ready logs of a program. */
9
- export type ReadyLogHandle = `log+ready://log/${string}`;
10
+ type ReadyLogHandle = `log+ready://log/${string}`;
10
11
  /** Type guard to check if log is live, and corresponding porcess is not finished. */
11
- export declare function isLiveLog(handle: AnyLogHandle | undefined): handle is LiveLogHandle;
12
+ declare function isLiveLog(handle: AnyLogHandle | undefined): handle is LiveLogHandle;
12
13
  /** Driver to retrieve logs given log handle */
13
- export interface LogsDriver {
14
- lastLines(
15
- /** A handle that was issued previously. */
16
- handle: AnyLogHandle,
17
- /** Allows client to limit total data sent from server. */
18
- lineCount: number,
19
- /** Makes streamer to perform seek operation to given offset before sending the contents.
20
- * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.
21
- * If undefined, then starts from the end. */
22
- offsetBytes?: number,
23
- /** Is substring for line search pattern.
24
- * This option makes controller to send to the client only lines, that
25
- * have given substring. */
26
- searchStr?: string): Promise<StreamingApiResponse>;
27
- readText(
28
- /** A handle that was issued previously. */
29
- handle: AnyLogHandle,
30
- /** Allows client to limit total data sent from server. */
31
- lineCount: number,
32
- /** Makes streamer to perform seek operation to given offset before sending the contents.
33
- * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.
34
- * If undefined of 0, then starts from the beginning. */
35
- offsetBytes?: number,
36
- /** Is substring for line search pattern.
37
- * This option makes controller to send to the client only lines, that
38
- * have given substring. */
39
- searchStr?: string): Promise<StreamingApiResponse>;
14
+ interface LogsDriver {
15
+ lastLines(/** A handle that was issued previously. */
16
+
17
+ handle: AnyLogHandle, /** Allows client to limit total data sent from server. */
18
+
19
+ lineCount: number,
20
+ /** Makes streamer to perform seek operation to given offset before sending the contents.
21
+ * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.
22
+ * If undefined, then starts from the end. */
23
+
24
+ offsetBytes?: number,
25
+ /** Is substring for line search pattern.
26
+ * This option makes controller to send to the client only lines, that
27
+ * have given substring. */
28
+
29
+ searchStr?: string): Promise<StreamingApiResponse>;
30
+ readText(/** A handle that was issued previously. */
31
+
32
+ handle: AnyLogHandle, /** Allows client to limit total data sent from server. */
33
+
34
+ lineCount: number,
35
+ /** Makes streamer to perform seek operation to given offset before sending the contents.
36
+ * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.
37
+ * If undefined of 0, then starts from the beginning. */
38
+
39
+ offsetBytes?: number,
40
+ /** Is substring for line search pattern.
41
+ * This option makes controller to send to the client only lines, that
42
+ * have given substring. */
43
+
44
+ searchStr?: string): Promise<StreamingApiResponse>;
40
45
  }
41
46
  /** Response of the driver.
42
47
  * The caller should give a handle to retrieve it.
43
48
  * It can be OK or outdated, in which case the handle
44
49
  * should be issued again. */
45
- export type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;
46
- export type StreamingApiResponseOk = {
47
- /** The handle don't have to be updated,
48
- * the response is OK. */
49
- shouldUpdateHandle: false;
50
- /** Whether the log can still grow or it's in a final state. */
51
- live: boolean;
52
- /** Data of the response, in bytes. */
53
- data: Uint8Array;
54
- /** Current size of the file. It can grow if it's still live. */
55
- size: number;
56
- /** Offset in bytes from the beginning of a file. */
57
- newOffset: number;
50
+ type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;
51
+ type StreamingApiResponseOk = {
52
+ /** The handle don't have to be updated,
53
+ * the response is OK. */
54
+ shouldUpdateHandle: false; /** Whether the log can still grow or it's in a final state. */
55
+ live: boolean; /** Data of the response, in bytes. */
56
+ data: Uint8Array; /** Current size of the file. It can grow if it's still live. */
57
+ size: number; /** Offset in bytes from the beginning of a file. */
58
+ newOffset: number;
58
59
  };
59
60
  /** The handle should be issued again, this one is done. */
60
- export type StreamingApiResponseHandleOutdated = {
61
- shouldUpdateHandle: true;
61
+ type StreamingApiResponseHandleOutdated = {
62
+ shouldUpdateHandle: true;
62
63
  };
63
- export type ProgressLogWithInfo = {
64
- progressLine?: string;
65
- live: boolean;
64
+ type ProgressLogWithInfo = {
65
+ progressLine?: string;
66
+ live: boolean;
66
67
  };
68
+ //#endregion
69
+ export { AnyLogHandle, LiveLogHandle, LogsDriver, ProgressLogWithInfo, ReadyLogHandle, StreamingApiResponse, StreamingApiResponseHandleOutdated, StreamingApiResponseOk, isLiveLog };
67
70
  //# sourceMappingURL=log.d.ts.map
@@ -1,7 +1,9 @@
1
+ //#region src/drivers/log.ts
1
2
  /** Type guard to check if log is live, and corresponding porcess is not finished. */
2
3
  function isLiveLog(handle) {
3
- return handle !== undefined && handle.startsWith("log+live://log/");
4
+ return handle !== void 0 && handle.startsWith("log+live://log/");
4
5
  }
5
6
 
7
+ //#endregion
6
8
  export { isLiveLog };
7
- //# sourceMappingURL=log.js.map
9
+ //# sourceMappingURL=log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sources":["../../src/drivers/log.ts"],"sourcesContent":["/** Handle of logs. This handle should be passed\n * to the driver for retrieving logs. */\nexport type AnyLogHandle = LiveLogHandle | ReadyLogHandle;\n\n/** Handle of the live logs of a program.\n * The resource that represents a log can be deleted,\n * in this case the handle should be refreshed. */\nexport type LiveLogHandle = `log+live://log/${string}`;\n\n/** Handle of the ready logs of a program. */\nexport type ReadyLogHandle = `log+ready://log/${string}`;\n\n/** Type guard to check if log is live, and corresponding porcess is not finished. */\nexport function isLiveLog(handle: AnyLogHandle | undefined): handle is LiveLogHandle {\n return handle !== undefined && handle.startsWith(\"log+live://log/\");\n}\n\n/** Driver to retrieve logs given log handle */\nexport interface LogsDriver {\n lastLines(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined, then starts from the end. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string,\n ): Promise<StreamingApiResponse>;\n\n readText(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined of 0, then starts from the beginning. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string,\n ): Promise<StreamingApiResponse>;\n}\n\n/** Response of the driver.\n * The caller should give a handle to retrieve it.\n * It can be OK or outdated, in which case the handle\n * should be issued again. */\nexport type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;\n\nexport type StreamingApiResponseOk = {\n /** The handle don't have to be updated,\n * the response is OK. */\n shouldUpdateHandle: false;\n\n /** Whether the log can still grow or it's in a final state. */\n live: boolean;\n\n /** Data of the response, in bytes. */\n data: Uint8Array;\n /** Current size of the file. It can grow if it's still live. */\n size: number;\n /** Offset in bytes from the beginning of a file. */\n newOffset: number;\n};\n\n/** The handle should be issued again, this one is done. */\nexport type StreamingApiResponseHandleOutdated = {\n shouldUpdateHandle: true;\n};\n\nexport type ProgressLogWithInfo = {\n progressLine?: string;\n live: boolean;\n};\n"],"names":[],"mappings":"AAYA;AACM,SAAU,SAAS,CAAC,MAAgC,EAAA;IACxD,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC;AACrE;;;;"}
1
+ {"version":3,"file":"log.js","names":[],"sources":["../../src/drivers/log.ts"],"sourcesContent":["/** Handle of logs. This handle should be passed\n * to the driver for retrieving logs. */\nexport type AnyLogHandle = LiveLogHandle | ReadyLogHandle;\n\n/** Handle of the live logs of a program.\n * The resource that represents a log can be deleted,\n * in this case the handle should be refreshed. */\nexport type LiveLogHandle = `log+live://log/${string}`;\n\n/** Handle of the ready logs of a program. */\nexport type ReadyLogHandle = `log+ready://log/${string}`;\n\n/** Type guard to check if log is live, and corresponding porcess is not finished. */\nexport function isLiveLog(handle: AnyLogHandle | undefined): handle is LiveLogHandle {\n return handle !== undefined && handle.startsWith(\"log+live://log/\");\n}\n\n/** Driver to retrieve logs given log handle */\nexport interface LogsDriver {\n lastLines(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined, then starts from the end. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string,\n ): Promise<StreamingApiResponse>;\n\n readText(\n /** A handle that was issued previously. */\n handle: AnyLogHandle,\n\n /** Allows client to limit total data sent from server. */\n lineCount: number,\n\n /** Makes streamer to perform seek operation to given offset before sending the contents.\n * Client can just use the <new_offset> value of the last response from server to continue streaming after reconnection.\n * If undefined of 0, then starts from the beginning. */\n offsetBytes?: number,\n\n /** Is substring for line search pattern.\n * This option makes controller to send to the client only lines, that\n * have given substring. */\n searchStr?: string,\n ): Promise<StreamingApiResponse>;\n}\n\n/** Response of the driver.\n * The caller should give a handle to retrieve it.\n * It can be OK or outdated, in which case the handle\n * should be issued again. */\nexport type StreamingApiResponse = StreamingApiResponseOk | StreamingApiResponseHandleOutdated;\n\nexport type StreamingApiResponseOk = {\n /** The handle don't have to be updated,\n * the response is OK. */\n shouldUpdateHandle: false;\n\n /** Whether the log can still grow or it's in a final state. */\n live: boolean;\n\n /** Data of the response, in bytes. */\n data: Uint8Array;\n /** Current size of the file. It can grow if it's still live. */\n size: number;\n /** Offset in bytes from the beginning of a file. */\n newOffset: number;\n};\n\n/** The handle should be issued again, this one is done. */\nexport type StreamingApiResponseHandleOutdated = {\n shouldUpdateHandle: true;\n};\n\nexport type ProgressLogWithInfo = {\n progressLine?: string;\n live: boolean;\n};\n"],"mappings":";;AAaA,SAAgB,UAAU,QAA2D;AACnF,QAAO,WAAW,UAAa,OAAO,WAAW,kBAAkB"}