@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,39 +1,36 @@
1
- 'use strict';
2
-
3
- var util = require('../util.cjs');
1
+ const require_util = require('../util.cjs');
4
2
 
3
+ //#region src/drivers/ls.ts
5
4
  const uploadPrefix = "upload://upload/";
6
5
  const indexPrefix = "index://index/";
7
6
  function isImportFileHandleUpload(handle) {
8
- return handle.startsWith(uploadPrefix);
7
+ return handle.startsWith(uploadPrefix);
9
8
  }
10
9
  function isImportFileHandleIndex(handle) {
11
- return handle.startsWith(indexPrefix);
10
+ return handle.startsWith(indexPrefix);
12
11
  }
13
12
  /** Gets a file path from an import handle. */
14
13
  function getFilePathFromHandle(handle) {
15
- if (isImportFileHandleIndex(handle)) {
16
- const trimmed = handle.slice(indexPrefix.length);
17
- const data = JSON.parse(decodeURIComponent(trimmed));
18
- return data.path;
19
- }
20
- else if (isImportFileHandleUpload(handle)) {
21
- const trimmed = handle.slice(uploadPrefix.length);
22
- const data = JSON.parse(decodeURIComponent(trimmed));
23
- return data.localPath;
24
- }
25
- util.assertNever(handle);
14
+ if (isImportFileHandleIndex(handle)) {
15
+ const trimmed = handle.slice(14);
16
+ return JSON.parse(decodeURIComponent(trimmed)).path;
17
+ } else if (isImportFileHandleUpload(handle)) {
18
+ const trimmed = handle.slice(16);
19
+ return JSON.parse(decodeURIComponent(trimmed)).localPath;
20
+ }
21
+ require_util.assertNever(handle);
26
22
  }
27
23
  function extractFileName(filePath) {
28
- return filePath.replace(/^.*[\\/]/, "");
24
+ return filePath.replace(/^.*[\\/]/, "");
29
25
  }
30
26
  /** Gets a file name from an import handle. */
31
27
  function getFileNameFromHandle(handle) {
32
- return extractFileName(getFilePathFromHandle(handle));
28
+ return extractFileName(getFilePathFromHandle(handle));
33
29
  }
34
30
 
31
+ //#endregion
35
32
  exports.getFileNameFromHandle = getFileNameFromHandle;
36
33
  exports.getFilePathFromHandle = getFilePathFromHandle;
37
34
  exports.isImportFileHandleIndex = isImportFileHandleIndex;
38
35
  exports.isImportFileHandleUpload = isImportFileHandleUpload;
39
- //# sourceMappingURL=ls.cjs.map
36
+ //# sourceMappingURL=ls.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ls.cjs","sources":["../../src/drivers/ls.ts"],"sourcesContent":["import { assertNever } from \"../util\";\nimport type { Branded } from \"../branding\";\nimport type { TableRange } from \"./pframe\";\nimport type { FileLike } from \"./interfaces\";\n\nconst uploadPrefix = \"upload://upload/\";\nconst indexPrefix = \"index://index/\";\n\nexport type ImportFileHandleUpload = `upload://upload/${string}`;\nexport type ImportFileHandleIndex = `index://index/${string}`;\n\nexport type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;\n\nexport type LocalImportFileHandle = Branded<ImportFileHandle, \"Local\">;\n\nexport function isImportFileHandleUpload(\n handle: ImportFileHandle,\n): handle is ImportFileHandleUpload {\n return handle.startsWith(uploadPrefix);\n}\n\nexport function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex {\n return handle.startsWith(indexPrefix);\n}\n\n/** Results in upload */\nexport type StorageHandleLocal = `local://${string}`;\n\n/** Results in index */\nexport type StorageHandleRemote = `remote://${string}`;\n\nexport type StorageHandle = StorageHandleLocal | StorageHandleRemote;\n\nexport type StorageEntry = {\n name: string;\n handle: StorageHandle;\n initialFullPath: string;\n\n // TODO\n // pathStartsWithDisk\n};\n\nexport type ListFilesResult = {\n parent?: string;\n entries: LsEntry[];\n};\n\nexport type LsEntry =\n | {\n type: \"dir\";\n name: string;\n fullPath: string;\n }\n | {\n type: \"file\";\n name: string;\n fullPath: string;\n\n /** This handle should be set to args... */\n handle: ImportFileHandle;\n };\n\nexport type OpenDialogFilter = {\n /** Human-readable file type name */\n readonly name: string;\n /** File extensions */\n readonly extensions: string[];\n};\n\nexport type OpenDialogOps = {\n /** Open dialog window title */\n readonly title?: string;\n /** Custom label for the confirmation button, when left empty the default label will be used. */\n readonly buttonLabel?: string;\n /** Limits of file types user can select */\n readonly filters?: OpenDialogFilter[];\n};\n\nexport type OpenSingleFileResponse = {\n /** Contains local file handle, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly file?: LocalImportFileHandle;\n};\n\nexport type OpenMultipleFilesResponse = {\n /** Contains local file handles, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly files?: LocalImportFileHandle[];\n};\n\n/** Can be used to limit request for local file content to a certain bytes range */\nexport type FileRange = {\n /** From byte index (inclusive) */\n readonly from: number;\n /** To byte index (exclusive) */\n readonly to: number;\n};\n\nexport interface LsDriver {\n /** remote and local storages */\n getStorageList(): Promise<StorageEntry[]>;\n\n listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;\n\n /** Opens system file open dialog allowing to select single file and awaits user action */\n showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;\n\n /** Opens system file open dialog allowing to multiple files and awaits user action */\n showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;\n\n /** Given a handle to a local file, allows to get file size */\n getLocalFileSize(file: LocalImportFileHandle): Promise<number>;\n\n /** Given a handle to a local file, allows to get its content */\n getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;\n\n /**\n * Resolves browser's File object into platforma's import file handle.\n *\n * This method is useful among other things for implementation of UI\n * components, that handle file Drag&Drop.\n * */\n fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;\n\n /** Saves currently opened block webview as a PDF. */\n exportToPdf?(): Promise<void>;\n}\n\n/** Gets a file path from an import handle. */\nexport function getFilePathFromHandle(handle: ImportFileHandle): string {\n if (isImportFileHandleIndex(handle)) {\n const trimmed = handle.slice(indexPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { path: string };\n return data.path;\n } else if (isImportFileHandleUpload(handle)) {\n const trimmed = handle.slice(uploadPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { localPath: string };\n return data.localPath;\n }\n\n assertNever(handle);\n}\n\nfunction extractFileName(filePath: string) {\n return filePath.replace(/^.*[\\\\/]/, \"\");\n}\n\n/** Gets a file name from an import handle. */\nexport function getFileNameFromHandle(handle: ImportFileHandle): string {\n return extractFileName(getFilePathFromHandle(handle));\n}\n"],"names":["assertNever"],"mappings":";;;;AAKA,MAAM,YAAY,GAAG,kBAAkB;AACvC,MAAM,WAAW,GAAG,gBAAgB;AAS9B,SAAU,wBAAwB,CACtC,MAAwB,EAAA;AAExB,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC;AACxC;AAEM,SAAU,uBAAuB,CAAC,MAAwB,EAAA;AAC9D,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC;AACvC;AAyGA;AACM,SAAU,qBAAqB,CAAC,MAAwB,EAAA;AAC5D,IAAA,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAE;QACnC,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAqB;QACxE,OAAO,IAAI,CAAC,IAAI;IAClB;AAAO,SAAA,IAAI,wBAAwB,CAAC,MAAM,CAAC,EAAE;QAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC;QACjD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAA0B;QAC7E,OAAO,IAAI,CAAC,SAAS;IACvB;IAEAA,gBAAW,CAAC,MAAM,CAAC;AACrB;AAEA,SAAS,eAAe,CAAC,QAAgB,EAAA;IACvC,OAAO,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;AACzC;AAEA;AACM,SAAU,qBAAqB,CAAC,MAAwB,EAAA;AAC5D,IAAA,OAAO,eAAe,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACvD;;;;;;;"}
1
+ {"version":3,"file":"ls.cjs","names":[],"sources":["../../src/drivers/ls.ts"],"sourcesContent":["import { assertNever } from \"../util\";\nimport type { Branded } from \"../branding\";\nimport type { TableRange } from \"./pframe\";\nimport type { FileLike } from \"./interfaces\";\n\nconst uploadPrefix = \"upload://upload/\";\nconst indexPrefix = \"index://index/\";\n\nexport type ImportFileHandleUpload = `upload://upload/${string}`;\nexport type ImportFileHandleIndex = `index://index/${string}`;\n\nexport type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;\n\nexport type LocalImportFileHandle = Branded<ImportFileHandle, \"Local\">;\n\nexport function isImportFileHandleUpload(\n handle: ImportFileHandle,\n): handle is ImportFileHandleUpload {\n return handle.startsWith(uploadPrefix);\n}\n\nexport function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex {\n return handle.startsWith(indexPrefix);\n}\n\n/** Results in upload */\nexport type StorageHandleLocal = `local://${string}`;\n\n/** Results in index */\nexport type StorageHandleRemote = `remote://${string}`;\n\nexport type StorageHandle = StorageHandleLocal | StorageHandleRemote;\n\nexport type StorageEntry = {\n name: string;\n handle: StorageHandle;\n initialFullPath: string;\n\n // TODO\n // pathStartsWithDisk\n};\n\nexport type ListFilesResult = {\n parent?: string;\n entries: LsEntry[];\n};\n\nexport type LsEntry =\n | {\n type: \"dir\";\n name: string;\n fullPath: string;\n }\n | {\n type: \"file\";\n name: string;\n fullPath: string;\n\n /** This handle should be set to args... */\n handle: ImportFileHandle;\n };\n\nexport type OpenDialogFilter = {\n /** Human-readable file type name */\n readonly name: string;\n /** File extensions */\n readonly extensions: string[];\n};\n\nexport type OpenDialogOps = {\n /** Open dialog window title */\n readonly title?: string;\n /** Custom label for the confirmation button, when left empty the default label will be used. */\n readonly buttonLabel?: string;\n /** Limits of file types user can select */\n readonly filters?: OpenDialogFilter[];\n};\n\nexport type OpenSingleFileResponse = {\n /** Contains local file handle, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly file?: LocalImportFileHandle;\n};\n\nexport type OpenMultipleFilesResponse = {\n /** Contains local file handles, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly files?: LocalImportFileHandle[];\n};\n\n/** Can be used to limit request for local file content to a certain bytes range */\nexport type FileRange = {\n /** From byte index (inclusive) */\n readonly from: number;\n /** To byte index (exclusive) */\n readonly to: number;\n};\n\nexport interface LsDriver {\n /** remote and local storages */\n getStorageList(): Promise<StorageEntry[]>;\n\n listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;\n\n /** Opens system file open dialog allowing to select single file and awaits user action */\n showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;\n\n /** Opens system file open dialog allowing to multiple files and awaits user action */\n showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;\n\n /** Given a handle to a local file, allows to get file size */\n getLocalFileSize(file: LocalImportFileHandle): Promise<number>;\n\n /** Given a handle to a local file, allows to get its content */\n getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;\n\n /**\n * Resolves browser's File object into platforma's import file handle.\n *\n * This method is useful among other things for implementation of UI\n * components, that handle file Drag&Drop.\n * */\n fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;\n\n /** Saves currently opened block webview as a PDF. */\n exportToPdf?(): Promise<void>;\n}\n\n/** Gets a file path from an import handle. */\nexport function getFilePathFromHandle(handle: ImportFileHandle): string {\n if (isImportFileHandleIndex(handle)) {\n const trimmed = handle.slice(indexPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { path: string };\n return data.path;\n } else if (isImportFileHandleUpload(handle)) {\n const trimmed = handle.slice(uploadPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { localPath: string };\n return data.localPath;\n }\n\n assertNever(handle);\n}\n\nfunction extractFileName(filePath: string) {\n return filePath.replace(/^.*[\\\\/]/, \"\");\n}\n\n/** Gets a file name from an import handle. */\nexport function getFileNameFromHandle(handle: ImportFileHandle): string {\n return extractFileName(getFilePathFromHandle(handle));\n}\n"],"mappings":";;;AAKA,MAAM,eAAe;AACrB,MAAM,cAAc;AASpB,SAAgB,yBACd,QACkC;AAClC,QAAO,OAAO,WAAW,aAAa;;AAGxC,SAAgB,wBAAwB,QAA2D;AACjG,QAAO,OAAO,WAAW,YAAY;;;AA2GvC,SAAgB,sBAAsB,QAAkC;AACtE,KAAI,wBAAwB,OAAO,EAAE;EACnC,MAAM,UAAU,OAAO,MAAM,GAAmB;AAEhD,SADa,KAAK,MAAM,mBAAmB,QAAQ,CAAC,CACxC;YACH,yBAAyB,OAAO,EAAE;EAC3C,MAAM,UAAU,OAAO,MAAM,GAAoB;AAEjD,SADa,KAAK,MAAM,mBAAmB,QAAQ,CAAC,CACxC;;AAGd,0BAAY,OAAO;;AAGrB,SAAS,gBAAgB,UAAkB;AACzC,QAAO,SAAS,QAAQ,YAAY,GAAG;;;AAIzC,SAAgB,sBAAsB,QAAkC;AACtE,QAAO,gBAAgB,sBAAsB,OAAO,CAAC"}
@@ -1,92 +1,89 @@
1
- import type { Branded } from "../branding";
2
- import type { TableRange } from "./pframe";
3
- import type { FileLike } from "./interfaces";
4
- export type ImportFileHandleUpload = `upload://upload/${string}`;
5
- export type ImportFileHandleIndex = `index://index/${string}`;
6
- export type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;
7
- export type LocalImportFileHandle = Branded<ImportFileHandle, "Local">;
8
- export declare function isImportFileHandleUpload(handle: ImportFileHandle): handle is ImportFileHandleUpload;
9
- export declare function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex;
1
+ import { Branded } from "../branding.js";
2
+ import { FileLike } from "./interfaces.js";
3
+ import { TableRange } from "./pframe/data_types.js";
4
+ import "./pframe/index.js";
5
+
6
+ //#region src/drivers/ls.d.ts
7
+ type ImportFileHandleUpload = `upload://upload/${string}`;
8
+ type ImportFileHandleIndex = `index://index/${string}`;
9
+ type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;
10
+ type LocalImportFileHandle = Branded<ImportFileHandle, "Local">;
11
+ declare function isImportFileHandleUpload(handle: ImportFileHandle): handle is ImportFileHandleUpload;
12
+ declare function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex;
10
13
  /** Results in upload */
11
- export type StorageHandleLocal = `local://${string}`;
14
+ type StorageHandleLocal = `local://${string}`;
12
15
  /** Results in index */
13
- export type StorageHandleRemote = `remote://${string}`;
14
- export type StorageHandle = StorageHandleLocal | StorageHandleRemote;
15
- export type StorageEntry = {
16
- name: string;
17
- handle: StorageHandle;
18
- initialFullPath: string;
16
+ type StorageHandleRemote = `remote://${string}`;
17
+ type StorageHandle = StorageHandleLocal | StorageHandleRemote;
18
+ type StorageEntry = {
19
+ name: string;
20
+ handle: StorageHandle;
21
+ initialFullPath: string;
19
22
  };
20
- export type ListFilesResult = {
21
- parent?: string;
22
- entries: LsEntry[];
23
+ type ListFilesResult = {
24
+ parent?: string;
25
+ entries: LsEntry[];
23
26
  };
24
- export type LsEntry = {
25
- type: "dir";
26
- name: string;
27
- fullPath: string;
27
+ type LsEntry = {
28
+ type: "dir";
29
+ name: string;
30
+ fullPath: string;
28
31
  } | {
29
- type: "file";
30
- name: string;
31
- fullPath: string;
32
- /** This handle should be set to args... */
33
- handle: ImportFileHandle;
32
+ type: "file";
33
+ name: string;
34
+ fullPath: string; /** This handle should be set to args... */
35
+ handle: ImportFileHandle;
34
36
  };
35
- export type OpenDialogFilter = {
36
- /** Human-readable file type name */
37
- readonly name: string;
38
- /** File extensions */
39
- readonly extensions: string[];
37
+ type OpenDialogFilter = {
38
+ /** Human-readable file type name */readonly name: string; /** File extensions */
39
+ readonly extensions: string[];
40
40
  };
41
- export type OpenDialogOps = {
42
- /** Open dialog window title */
43
- readonly title?: string;
44
- /** Custom label for the confirmation button, when left empty the default label will be used. */
45
- readonly buttonLabel?: string;
46
- /** Limits of file types user can select */
47
- readonly filters?: OpenDialogFilter[];
41
+ type OpenDialogOps = {
42
+ /** Open dialog window title */readonly title?: string; /** Custom label for the confirmation button, when left empty the default label will be used. */
43
+ readonly buttonLabel?: string; /** Limits of file types user can select */
44
+ readonly filters?: OpenDialogFilter[];
48
45
  };
49
- export type OpenSingleFileResponse = {
50
- /** Contains local file handle, allowing file importing or content reading. If user canceled
51
- * the dialog, field will be undefined. */
52
- readonly file?: LocalImportFileHandle;
46
+ type OpenSingleFileResponse = {
47
+ /** Contains local file handle, allowing file importing or content reading. If user canceled
48
+ * the dialog, field will be undefined. */
49
+ readonly file?: LocalImportFileHandle;
53
50
  };
54
- export type OpenMultipleFilesResponse = {
55
- /** Contains local file handles, allowing file importing or content reading. If user canceled
56
- * the dialog, field will be undefined. */
57
- readonly files?: LocalImportFileHandle[];
51
+ type OpenMultipleFilesResponse = {
52
+ /** Contains local file handles, allowing file importing or content reading. If user canceled
53
+ * the dialog, field will be undefined. */
54
+ readonly files?: LocalImportFileHandle[];
58
55
  };
59
56
  /** Can be used to limit request for local file content to a certain bytes range */
60
- export type FileRange = {
61
- /** From byte index (inclusive) */
62
- readonly from: number;
63
- /** To byte index (exclusive) */
64
- readonly to: number;
57
+ type FileRange = {
58
+ /** From byte index (inclusive) */readonly from: number; /** To byte index (exclusive) */
59
+ readonly to: number;
65
60
  };
66
- export interface LsDriver {
67
- /** remote and local storages */
68
- getStorageList(): Promise<StorageEntry[]>;
69
- listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;
70
- /** Opens system file open dialog allowing to select single file and awaits user action */
71
- showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;
72
- /** Opens system file open dialog allowing to multiple files and awaits user action */
73
- showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;
74
- /** Given a handle to a local file, allows to get file size */
75
- getLocalFileSize(file: LocalImportFileHandle): Promise<number>;
76
- /** Given a handle to a local file, allows to get its content */
77
- getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;
78
- /**
79
- * Resolves browser's File object into platforma's import file handle.
80
- *
81
- * This method is useful among other things for implementation of UI
82
- * components, that handle file Drag&Drop.
83
- * */
84
- fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;
85
- /** Saves currently opened block webview as a PDF. */
86
- exportToPdf?(): Promise<void>;
61
+ interface LsDriver {
62
+ /** remote and local storages */
63
+ getStorageList(): Promise<StorageEntry[]>;
64
+ listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;
65
+ /** Opens system file open dialog allowing to select single file and awaits user action */
66
+ showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;
67
+ /** Opens system file open dialog allowing to multiple files and awaits user action */
68
+ showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;
69
+ /** Given a handle to a local file, allows to get file size */
70
+ getLocalFileSize(file: LocalImportFileHandle): Promise<number>;
71
+ /** Given a handle to a local file, allows to get its content */
72
+ getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;
73
+ /**
74
+ * Resolves browser's File object into platforma's import file handle.
75
+ *
76
+ * This method is useful among other things for implementation of UI
77
+ * components, that handle file Drag&Drop.
78
+ * */
79
+ fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;
80
+ /** Saves currently opened block webview as a PDF. */
81
+ exportToPdf?(): Promise<void>;
87
82
  }
88
83
  /** Gets a file path from an import handle. */
89
- export declare function getFilePathFromHandle(handle: ImportFileHandle): string;
84
+ declare function getFilePathFromHandle(handle: ImportFileHandle): string;
90
85
  /** Gets a file name from an import handle. */
91
- export declare function getFileNameFromHandle(handle: ImportFileHandle): string;
86
+ declare function getFileNameFromHandle(handle: ImportFileHandle): string;
87
+ //#endregion
88
+ export { FileRange, ImportFileHandle, ImportFileHandleIndex, ImportFileHandleUpload, ListFilesResult, LocalImportFileHandle, LsDriver, LsEntry, OpenDialogFilter, OpenDialogOps, OpenMultipleFilesResponse, OpenSingleFileResponse, StorageEntry, StorageHandle, StorageHandleLocal, StorageHandleRemote, getFileNameFromHandle, getFilePathFromHandle, isImportFileHandleIndex, isImportFileHandleUpload };
92
89
  //# sourceMappingURL=ls.d.ts.map
@@ -1,34 +1,33 @@
1
- import { assertNever } from '../util.js';
1
+ import { assertNever } from "../util.js";
2
2
 
3
+ //#region src/drivers/ls.ts
3
4
  const uploadPrefix = "upload://upload/";
4
5
  const indexPrefix = "index://index/";
5
6
  function isImportFileHandleUpload(handle) {
6
- return handle.startsWith(uploadPrefix);
7
+ return handle.startsWith(uploadPrefix);
7
8
  }
8
9
  function isImportFileHandleIndex(handle) {
9
- return handle.startsWith(indexPrefix);
10
+ return handle.startsWith(indexPrefix);
10
11
  }
11
12
  /** Gets a file path from an import handle. */
12
13
  function getFilePathFromHandle(handle) {
13
- if (isImportFileHandleIndex(handle)) {
14
- const trimmed = handle.slice(indexPrefix.length);
15
- const data = JSON.parse(decodeURIComponent(trimmed));
16
- return data.path;
17
- }
18
- else if (isImportFileHandleUpload(handle)) {
19
- const trimmed = handle.slice(uploadPrefix.length);
20
- const data = JSON.parse(decodeURIComponent(trimmed));
21
- return data.localPath;
22
- }
23
- assertNever(handle);
14
+ if (isImportFileHandleIndex(handle)) {
15
+ const trimmed = handle.slice(14);
16
+ return JSON.parse(decodeURIComponent(trimmed)).path;
17
+ } else if (isImportFileHandleUpload(handle)) {
18
+ const trimmed = handle.slice(16);
19
+ return JSON.parse(decodeURIComponent(trimmed)).localPath;
20
+ }
21
+ assertNever(handle);
24
22
  }
25
23
  function extractFileName(filePath) {
26
- return filePath.replace(/^.*[\\/]/, "");
24
+ return filePath.replace(/^.*[\\/]/, "");
27
25
  }
28
26
  /** Gets a file name from an import handle. */
29
27
  function getFileNameFromHandle(handle) {
30
- return extractFileName(getFilePathFromHandle(handle));
28
+ return extractFileName(getFilePathFromHandle(handle));
31
29
  }
32
30
 
31
+ //#endregion
33
32
  export { getFileNameFromHandle, getFilePathFromHandle, isImportFileHandleIndex, isImportFileHandleUpload };
34
- //# sourceMappingURL=ls.js.map
33
+ //# sourceMappingURL=ls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ls.js","sources":["../../src/drivers/ls.ts"],"sourcesContent":["import { assertNever } from \"../util\";\nimport type { Branded } from \"../branding\";\nimport type { TableRange } from \"./pframe\";\nimport type { FileLike } from \"./interfaces\";\n\nconst uploadPrefix = \"upload://upload/\";\nconst indexPrefix = \"index://index/\";\n\nexport type ImportFileHandleUpload = `upload://upload/${string}`;\nexport type ImportFileHandleIndex = `index://index/${string}`;\n\nexport type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;\n\nexport type LocalImportFileHandle = Branded<ImportFileHandle, \"Local\">;\n\nexport function isImportFileHandleUpload(\n handle: ImportFileHandle,\n): handle is ImportFileHandleUpload {\n return handle.startsWith(uploadPrefix);\n}\n\nexport function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex {\n return handle.startsWith(indexPrefix);\n}\n\n/** Results in upload */\nexport type StorageHandleLocal = `local://${string}`;\n\n/** Results in index */\nexport type StorageHandleRemote = `remote://${string}`;\n\nexport type StorageHandle = StorageHandleLocal | StorageHandleRemote;\n\nexport type StorageEntry = {\n name: string;\n handle: StorageHandle;\n initialFullPath: string;\n\n // TODO\n // pathStartsWithDisk\n};\n\nexport type ListFilesResult = {\n parent?: string;\n entries: LsEntry[];\n};\n\nexport type LsEntry =\n | {\n type: \"dir\";\n name: string;\n fullPath: string;\n }\n | {\n type: \"file\";\n name: string;\n fullPath: string;\n\n /** This handle should be set to args... */\n handle: ImportFileHandle;\n };\n\nexport type OpenDialogFilter = {\n /** Human-readable file type name */\n readonly name: string;\n /** File extensions */\n readonly extensions: string[];\n};\n\nexport type OpenDialogOps = {\n /** Open dialog window title */\n readonly title?: string;\n /** Custom label for the confirmation button, when left empty the default label will be used. */\n readonly buttonLabel?: string;\n /** Limits of file types user can select */\n readonly filters?: OpenDialogFilter[];\n};\n\nexport type OpenSingleFileResponse = {\n /** Contains local file handle, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly file?: LocalImportFileHandle;\n};\n\nexport type OpenMultipleFilesResponse = {\n /** Contains local file handles, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly files?: LocalImportFileHandle[];\n};\n\n/** Can be used to limit request for local file content to a certain bytes range */\nexport type FileRange = {\n /** From byte index (inclusive) */\n readonly from: number;\n /** To byte index (exclusive) */\n readonly to: number;\n};\n\nexport interface LsDriver {\n /** remote and local storages */\n getStorageList(): Promise<StorageEntry[]>;\n\n listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;\n\n /** Opens system file open dialog allowing to select single file and awaits user action */\n showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;\n\n /** Opens system file open dialog allowing to multiple files and awaits user action */\n showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;\n\n /** Given a handle to a local file, allows to get file size */\n getLocalFileSize(file: LocalImportFileHandle): Promise<number>;\n\n /** Given a handle to a local file, allows to get its content */\n getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;\n\n /**\n * Resolves browser's File object into platforma's import file handle.\n *\n * This method is useful among other things for implementation of UI\n * components, that handle file Drag&Drop.\n * */\n fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;\n\n /** Saves currently opened block webview as a PDF. */\n exportToPdf?(): Promise<void>;\n}\n\n/** Gets a file path from an import handle. */\nexport function getFilePathFromHandle(handle: ImportFileHandle): string {\n if (isImportFileHandleIndex(handle)) {\n const trimmed = handle.slice(indexPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { path: string };\n return data.path;\n } else if (isImportFileHandleUpload(handle)) {\n const trimmed = handle.slice(uploadPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { localPath: string };\n return data.localPath;\n }\n\n assertNever(handle);\n}\n\nfunction extractFileName(filePath: string) {\n return filePath.replace(/^.*[\\\\/]/, \"\");\n}\n\n/** Gets a file name from an import handle. */\nexport function getFileNameFromHandle(handle: ImportFileHandle): string {\n return extractFileName(getFilePathFromHandle(handle));\n}\n"],"names":[],"mappings":";;AAKA,MAAM,YAAY,GAAG,kBAAkB;AACvC,MAAM,WAAW,GAAG,gBAAgB;AAS9B,SAAU,wBAAwB,CACtC,MAAwB,EAAA;AAExB,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC;AACxC;AAEM,SAAU,uBAAuB,CAAC,MAAwB,EAAA;AAC9D,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC;AACvC;AAyGA;AACM,SAAU,qBAAqB,CAAC,MAAwB,EAAA;AAC5D,IAAA,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAE;QACnC,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAqB;QACxE,OAAO,IAAI,CAAC,IAAI;IAClB;AAAO,SAAA,IAAI,wBAAwB,CAAC,MAAM,CAAC,EAAE;QAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC;QACjD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAA0B;QAC7E,OAAO,IAAI,CAAC,SAAS;IACvB;IAEA,WAAW,CAAC,MAAM,CAAC;AACrB;AAEA,SAAS,eAAe,CAAC,QAAgB,EAAA;IACvC,OAAO,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;AACzC;AAEA;AACM,SAAU,qBAAqB,CAAC,MAAwB,EAAA;AAC5D,IAAA,OAAO,eAAe,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACvD;;;;"}
1
+ {"version":3,"file":"ls.js","names":[],"sources":["../../src/drivers/ls.ts"],"sourcesContent":["import { assertNever } from \"../util\";\nimport type { Branded } from \"../branding\";\nimport type { TableRange } from \"./pframe\";\nimport type { FileLike } from \"./interfaces\";\n\nconst uploadPrefix = \"upload://upload/\";\nconst indexPrefix = \"index://index/\";\n\nexport type ImportFileHandleUpload = `upload://upload/${string}`;\nexport type ImportFileHandleIndex = `index://index/${string}`;\n\nexport type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;\n\nexport type LocalImportFileHandle = Branded<ImportFileHandle, \"Local\">;\n\nexport function isImportFileHandleUpload(\n handle: ImportFileHandle,\n): handle is ImportFileHandleUpload {\n return handle.startsWith(uploadPrefix);\n}\n\nexport function isImportFileHandleIndex(handle: ImportFileHandle): handle is ImportFileHandleIndex {\n return handle.startsWith(indexPrefix);\n}\n\n/** Results in upload */\nexport type StorageHandleLocal = `local://${string}`;\n\n/** Results in index */\nexport type StorageHandleRemote = `remote://${string}`;\n\nexport type StorageHandle = StorageHandleLocal | StorageHandleRemote;\n\nexport type StorageEntry = {\n name: string;\n handle: StorageHandle;\n initialFullPath: string;\n\n // TODO\n // pathStartsWithDisk\n};\n\nexport type ListFilesResult = {\n parent?: string;\n entries: LsEntry[];\n};\n\nexport type LsEntry =\n | {\n type: \"dir\";\n name: string;\n fullPath: string;\n }\n | {\n type: \"file\";\n name: string;\n fullPath: string;\n\n /** This handle should be set to args... */\n handle: ImportFileHandle;\n };\n\nexport type OpenDialogFilter = {\n /** Human-readable file type name */\n readonly name: string;\n /** File extensions */\n readonly extensions: string[];\n};\n\nexport type OpenDialogOps = {\n /** Open dialog window title */\n readonly title?: string;\n /** Custom label for the confirmation button, when left empty the default label will be used. */\n readonly buttonLabel?: string;\n /** Limits of file types user can select */\n readonly filters?: OpenDialogFilter[];\n};\n\nexport type OpenSingleFileResponse = {\n /** Contains local file handle, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly file?: LocalImportFileHandle;\n};\n\nexport type OpenMultipleFilesResponse = {\n /** Contains local file handles, allowing file importing or content reading. If user canceled\n * the dialog, field will be undefined. */\n readonly files?: LocalImportFileHandle[];\n};\n\n/** Can be used to limit request for local file content to a certain bytes range */\nexport type FileRange = {\n /** From byte index (inclusive) */\n readonly from: number;\n /** To byte index (exclusive) */\n readonly to: number;\n};\n\nexport interface LsDriver {\n /** remote and local storages */\n getStorageList(): Promise<StorageEntry[]>;\n\n listFiles(storage: StorageHandle, fullPath: string): Promise<ListFilesResult>;\n\n /** Opens system file open dialog allowing to select single file and awaits user action */\n showOpenSingleFileDialog(ops: OpenDialogOps): Promise<OpenSingleFileResponse>;\n\n /** Opens system file open dialog allowing to multiple files and awaits user action */\n showOpenMultipleFilesDialog(ops: OpenDialogOps): Promise<OpenMultipleFilesResponse>;\n\n /** Given a handle to a local file, allows to get file size */\n getLocalFileSize(file: LocalImportFileHandle): Promise<number>;\n\n /** Given a handle to a local file, allows to get its content */\n getLocalFileContent(file: LocalImportFileHandle, range?: TableRange): Promise<Uint8Array>;\n\n /**\n * Resolves browser's File object into platforma's import file handle.\n *\n * This method is useful among other things for implementation of UI\n * components, that handle file Drag&Drop.\n * */\n fileToImportHandle(file: FileLike): Promise<ImportFileHandle>;\n\n /** Saves currently opened block webview as a PDF. */\n exportToPdf?(): Promise<void>;\n}\n\n/** Gets a file path from an import handle. */\nexport function getFilePathFromHandle(handle: ImportFileHandle): string {\n if (isImportFileHandleIndex(handle)) {\n const trimmed = handle.slice(indexPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { path: string };\n return data.path;\n } else if (isImportFileHandleUpload(handle)) {\n const trimmed = handle.slice(uploadPrefix.length);\n const data = JSON.parse(decodeURIComponent(trimmed)) as { localPath: string };\n return data.localPath;\n }\n\n assertNever(handle);\n}\n\nfunction extractFileName(filePath: string) {\n return filePath.replace(/^.*[\\\\/]/, \"\");\n}\n\n/** Gets a file name from an import handle. */\nexport function getFileNameFromHandle(handle: ImportFileHandle): string {\n return extractFileName(getFilePathFromHandle(handle));\n}\n"],"mappings":";;;AAKA,MAAM,eAAe;AACrB,MAAM,cAAc;AASpB,SAAgB,yBACd,QACkC;AAClC,QAAO,OAAO,WAAW,aAAa;;AAGxC,SAAgB,wBAAwB,QAA2D;AACjG,QAAO,OAAO,WAAW,YAAY;;;AA2GvC,SAAgB,sBAAsB,QAAkC;AACtE,KAAI,wBAAwB,OAAO,EAAE;EACnC,MAAM,UAAU,OAAO,MAAM,GAAmB;AAEhD,SADa,KAAK,MAAM,mBAAmB,QAAQ,CAAC,CACxC;YACH,yBAAyB,OAAO,EAAE;EAC3C,MAAM,UAAU,OAAO,MAAM,GAAoB;AAEjD,SADa,KAAK,MAAM,mBAAmB,QAAQ,CAAC,CACxC;;AAGd,aAAY,OAAO;;AAGrB,SAAS,gBAAgB,UAAkB;AACzC,QAAO,SAAS,QAAQ,YAAY,GAAG;;;AAIzC,SAAgB,sBAAsB,QAAkC;AACtE,QAAO,gBAAgB,sBAAsB,OAAO,CAAC"}
@@ -1,18 +1,22 @@
1
- import type { ValueType } from "./spec/spec";
1
+ import { ValueType } from "./spec/spec.js";
2
+
3
+ //#region src/drivers/pframe/column_filter.d.ts
2
4
  /** Allows to search multiple columns in different contexts. */
3
- export interface ColumnFilter {
4
- /** Match any of the types listed here. If undefined, will be ignored during
5
- * matching. */
6
- readonly type?: ValueType[];
7
- /** Match any of the names listed here. If undefined, will be ignored during
8
- * matching. */
9
- readonly name?: string[];
10
- /** Match requires all the domains listed here to have corresponding values. */
11
- readonly domainValue?: Record<string, string>;
12
- /** Match requires all the annotations listed here to have corresponding values. */
13
- readonly annotationValue?: Record<string, string>;
14
- /** Match requires all the annotations listed here to match corresponding regex
15
- * pattern. */
16
- readonly annotationPattern?: Record<string, string>;
5
+ interface ColumnFilter {
6
+ /** Match any of the types listed here. If undefined, will be ignored during
7
+ * matching. */
8
+ readonly type?: ValueType[];
9
+ /** Match any of the names listed here. If undefined, will be ignored during
10
+ * matching. */
11
+ readonly name?: string[];
12
+ /** Match requires all the domains listed here to have corresponding values. */
13
+ readonly domainValue?: Record<string, string>;
14
+ /** Match requires all the annotations listed here to have corresponding values. */
15
+ readonly annotationValue?: Record<string, string>;
16
+ /** Match requires all the annotations listed here to match corresponding regex
17
+ * pattern. */
18
+ readonly annotationPattern?: Record<string, string>;
17
19
  }
20
+ //#endregion
21
+ export { ColumnFilter };
18
22
  //# sourceMappingURL=column_filter.d.ts.map