@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.
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/author_marker.d.ts +9 -6
- package/dist/base32_encode.cjs +40 -46
- package/dist/base32_encode.cjs.map +1 -1
- package/dist/base32_encode.js +40 -45
- package/dist/base32_encode.js.map +1 -1
- package/dist/base64.cjs +5 -4
- package/dist/base64.cjs.map +1 -1
- package/dist/base64.d.ts +10 -6
- package/dist/base64.js +5 -3
- package/dist/base64.js.map +1 -1
- package/dist/block_state.d.ts +21 -23
- package/dist/bmodel/block_config.cjs +9 -10
- package/dist/bmodel/block_config.cjs.map +1 -1
- package/dist/bmodel/block_config.d.ts +53 -72
- package/dist/bmodel/block_config.js +9 -9
- package/dist/bmodel/block_config.js.map +1 -1
- package/dist/bmodel/code.cjs +7 -6
- package/dist/bmodel/code.cjs.map +1 -1
- package/dist/bmodel/code.d.ts +17 -13
- package/dist/bmodel/code.js +6 -4
- package/dist/bmodel/code.js.map +1 -1
- package/dist/bmodel/container.d.ts +46 -44
- package/dist/bmodel/index.cjs +3 -0
- package/dist/bmodel/index.d.ts +5 -6
- package/dist/bmodel/index.js +3 -0
- package/dist/bmodel/normalization.cjs +90 -106
- package/dist/bmodel/normalization.cjs.map +1 -1
- package/dist/bmodel/normalization.d.ts +7 -3
- package/dist/bmodel/normalization.js +90 -105
- package/dist/bmodel/normalization.js.map +1 -1
- package/dist/bmodel/types.d.ts +4 -1
- package/dist/branding.d.ts +5 -5
- package/dist/common_types.d.ts +19 -15
- package/dist/driver_kit.d.ts +25 -17
- package/dist/drivers/ChunkedStreamReader.cjs +168 -203
- package/dist/drivers/ChunkedStreamReader.cjs.map +1 -1
- package/dist/drivers/ChunkedStreamReader.d.ts +104 -100
- package/dist/drivers/ChunkedStreamReader.js +168 -202
- package/dist/drivers/ChunkedStreamReader.js.map +1 -1
- package/dist/drivers/blob.cjs +15 -17
- package/dist/drivers/blob.cjs.map +1 -1
- package/dist/drivers/blob.d.ts +35 -35
- package/dist/drivers/blob.js +14 -15
- package/dist/drivers/blob.js.map +1 -1
- package/dist/drivers/index.cjs +18 -0
- package/dist/drivers/index.d.ts +29 -9
- package/dist/drivers/index.js +18 -0
- package/dist/drivers/interfaces.d.ts +17 -14
- package/dist/drivers/log.cjs +4 -3
- package/dist/drivers/log.cjs.map +1 -1
- package/dist/drivers/log.d.ts +52 -49
- package/dist/drivers/log.js +4 -2
- package/dist/drivers/log.js.map +1 -1
- package/dist/drivers/ls.cjs +16 -19
- package/dist/drivers/ls.cjs.map +1 -1
- package/dist/drivers/ls.d.ts +73 -76
- package/dist/drivers/ls.js +16 -17
- package/dist/drivers/ls.js.map +1 -1
- package/dist/drivers/pframe/column_filter.d.ts +19 -15
- package/dist/drivers/pframe/data_info.cjs +201 -252
- package/dist/drivers/pframe/data_info.cjs.map +1 -1
- package/dist/drivers/pframe/data_info.d.ts +84 -109
- package/dist/drivers/pframe/data_info.js +201 -250
- package/dist/drivers/pframe/data_info.js.map +1 -1
- package/dist/drivers/pframe/data_types.cjs +38 -63
- package/dist/drivers/pframe/data_types.cjs.map +1 -1
- package/dist/drivers/pframe/data_types.d.ts +91 -93
- package/dist/drivers/pframe/data_types.js +38 -61
- package/dist/drivers/pframe/data_types.js.map +1 -1
- package/dist/drivers/pframe/driver.cjs +7 -0
- package/dist/drivers/pframe/driver.cjs.map +1 -0
- package/dist/drivers/pframe/driver.d.ts +50 -45
- package/dist/drivers/pframe/driver.js +6 -0
- package/dist/drivers/pframe/driver.js.map +1 -0
- package/dist/drivers/pframe/filter_spec.d.ts +127 -123
- package/dist/drivers/pframe/find_columns.d.ts +21 -17
- package/dist/drivers/pframe/index.cjs +15 -0
- package/dist/drivers/pframe/index.d.ts +23 -16
- package/dist/drivers/pframe/index.js +15 -0
- package/dist/drivers/pframe/linker_columns.cjs +184 -238
- package/dist/drivers/pframe/linker_columns.cjs.map +1 -1
- package/dist/drivers/pframe/linker_columns.d.ts +45 -38
- package/dist/drivers/pframe/linker_columns.js +184 -236
- package/dist/drivers/pframe/linker_columns.js.map +1 -1
- package/dist/drivers/pframe/pframe.d.ts +26 -21
- package/dist/drivers/pframe/query/index.cjs +1 -0
- package/dist/drivers/pframe/query/index.d.ts +3 -4
- package/dist/drivers/pframe/query/index.js +1 -0
- package/dist/drivers/pframe/query/query_common.d.ts +205 -247
- package/dist/drivers/pframe/query/query_data.d.ts +25 -23
- package/dist/drivers/pframe/query/query_spec.d.ts +30 -29
- package/dist/drivers/pframe/query/utils.cjs +164 -183
- package/dist/drivers/pframe/query/utils.cjs.map +1 -1
- package/dist/drivers/pframe/query/utils.d.ts +13 -12
- package/dist/drivers/pframe/query/utils.js +164 -181
- package/dist/drivers/pframe/query/utils.js.map +1 -1
- package/dist/drivers/pframe/spec/anchored.cjs +178 -216
- package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
- package/dist/drivers/pframe/spec/anchored.d.ts +53 -49
- package/dist/drivers/pframe/spec/anchored.js +176 -214
- package/dist/drivers/pframe/spec/anchored.js.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.cjs +8 -7
- package/dist/drivers/pframe/spec/filtered_column.cjs.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.d.ts +20 -17
- package/dist/drivers/pframe/spec/filtered_column.js +8 -6
- package/dist/drivers/pframe/spec/filtered_column.js.map +1 -1
- package/dist/drivers/pframe/spec/ids.cjs +16 -14
- package/dist/drivers/pframe/spec/ids.cjs.map +1 -1
- package/dist/drivers/pframe/spec/ids.d.ts +13 -8
- package/dist/drivers/pframe/spec/ids.js +14 -12
- package/dist/drivers/pframe/spec/ids.js.map +1 -1
- package/dist/drivers/pframe/spec/index.cjs +6 -0
- package/dist/drivers/pframe/spec/index.d.ts +6 -7
- package/dist/drivers/pframe/spec/index.js +6 -0
- package/dist/drivers/pframe/spec/native_id.cjs +16 -16
- package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
- package/dist/drivers/pframe/spec/native_id.d.ts +9 -4
- package/dist/drivers/pframe/spec/native_id.js +13 -13
- package/dist/drivers/pframe/spec/native_id.js.map +1 -1
- package/dist/drivers/pframe/spec/selectors.cjs +72 -112
- package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
- package/dist/drivers/pframe/spec/selectors.d.ts +99 -94
- package/dist/drivers/pframe/spec/selectors.js +72 -110
- package/dist/drivers/pframe/spec/selectors.js.map +1 -1
- package/dist/drivers/pframe/spec/spec.cjs +282 -324
- package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
- package/dist/drivers/pframe/spec/spec.d.ts +263 -272
- package/dist/drivers/pframe/spec/spec.js +281 -322
- package/dist/drivers/pframe/spec/spec.js.map +1 -1
- package/dist/drivers/pframe/table.d.ts +28 -24
- package/dist/drivers/pframe/table_calculate.cjs +117 -147
- package/dist/drivers/pframe/table_calculate.cjs.map +1 -1
- package/dist/drivers/pframe/table_calculate.d.ts +219 -220
- package/dist/drivers/pframe/table_calculate.js +117 -145
- package/dist/drivers/pframe/table_calculate.js.map +1 -1
- package/dist/drivers/pframe/table_common.cjs +13 -14
- package/dist/drivers/pframe/table_common.cjs.map +1 -1
- package/dist/drivers/pframe/table_common.d.ts +24 -19
- package/dist/drivers/pframe/table_common.js +13 -13
- package/dist/drivers/pframe/table_common.js.map +1 -1
- package/dist/drivers/pframe/unique_values.d.ts +23 -18
- package/dist/drivers/upload.d.ts +21 -18
- package/dist/drivers/urls.cjs +5 -6
- package/dist/drivers/urls.cjs.map +1 -1
- package/dist/drivers/urls.d.ts +12 -9
- package/dist/drivers/urls.js +5 -5
- package/dist/drivers/urls.js.map +1 -1
- package/dist/errors.cjs +65 -86
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +36 -33
- package/dist/errors.js +65 -85
- package/dist/errors.js.map +1 -1
- package/dist/flags/block_flags.cjs +7 -6
- package/dist/flags/block_flags.cjs.map +1 -1
- package/dist/flags/block_flags.d.ts +12 -8
- package/dist/flags/block_flags.js +7 -5
- package/dist/flags/block_flags.js.map +1 -1
- package/dist/flags/flag_utils.cjs +69 -108
- package/dist/flags/flag_utils.cjs.map +1 -1
- package/dist/flags/flag_utils.d.ts +40 -42
- package/dist/flags/flag_utils.js +70 -107
- package/dist/flags/flag_utils.js.map +1 -1
- package/dist/flags/type_utils.d.ts +12 -11
- package/dist/httpAuth.cjs +16 -20
- package/dist/httpAuth.cjs.map +1 -1
- package/dist/httpAuth.d.ts +10 -7
- package/dist/httpAuth.js +16 -19
- package/dist/httpAuth.js.map +1 -1
- package/dist/index.cjs +176 -179
- package/dist/index.d.ts +58 -20
- package/dist/index.js +37 -34
- package/dist/json.cjs +10 -8
- package/dist/json.cjs.map +1 -1
- package/dist/json.d.ts +18 -18
- package/dist/json.js +8 -6
- package/dist/json.js.map +1 -1
- package/dist/navigation.cjs +3 -2
- package/dist/navigation.cjs.map +1 -1
- package/dist/navigation.d.ts +18 -21
- package/dist/navigation.js +3 -1
- package/dist/navigation.js.map +1 -1
- package/dist/plid.cjs +16 -20
- package/dist/plid.cjs.map +1 -1
- package/dist/plid.d.ts +11 -7
- package/dist/plid.js +15 -18
- package/dist/plid.js.map +1 -1
- package/dist/pool/entry.d.ts +11 -11
- package/dist/pool/index.d.ts +3 -4
- package/dist/pool/query.cjs +21 -43
- package/dist/pool/query.cjs.map +1 -1
- package/dist/pool/query.d.ts +25 -20
- package/dist/pool/query.js +20 -40
- package/dist/pool/query.js.map +1 -1
- package/dist/pool/spec.cjs +40 -47
- package/dist/pool/spec.cjs.map +1 -1
- package/dist/pool/spec.d.ts +33 -31
- package/dist/pool/spec.js +40 -45
- package/dist/pool/spec.js.map +1 -1
- package/dist/ref.cjs +51 -71
- package/dist/ref.cjs.map +1 -1
- package/dist/ref.d.ts +36 -33
- package/dist/ref.js +50 -69
- package/dist/ref.js.map +1 -1
- package/dist/utag.d.ts +18 -14
- package/dist/util.cjs +8 -7
- package/dist/util.cjs.map +1 -1
- package/dist/util.d.ts +5 -2
- package/dist/util.js +8 -6
- package/dist/util.js.map +1 -1
- package/dist/value_or_error.cjs +7 -3
- package/dist/value_or_error.cjs.map +1 -1
- package/dist/value_or_error.d.ts +9 -6
- package/dist/value_or_error.js +7 -2
- package/dist/value_or_error.js.map +1 -1
- package/package.json +6 -6
- package/src/flags/block_flags.ts +2 -1
- package/src/flags/flag_utils.ts +0 -22
- package/dist/author_marker.d.ts.map +0 -1
- package/dist/base32_encode.d.ts +0 -8
- package/dist/base32_encode.d.ts.map +0 -1
- package/dist/base64.d.ts.map +0 -1
- package/dist/block_state.d.ts.map +0 -1
- package/dist/bmodel/block_config.d.ts.map +0 -1
- package/dist/bmodel/code.d.ts.map +0 -1
- package/dist/bmodel/container.d.ts.map +0 -1
- package/dist/bmodel/index.d.ts.map +0 -1
- package/dist/bmodel/normalization.d.ts.map +0 -1
- package/dist/bmodel/types.d.ts.map +0 -1
- package/dist/branding.d.ts.map +0 -1
- package/dist/common_types.d.ts.map +0 -1
- package/dist/driver_kit.d.ts.map +0 -1
- package/dist/drivers/ChunkedStreamReader.d.ts.map +0 -1
- package/dist/drivers/blob.d.ts.map +0 -1
- package/dist/drivers/index.d.ts.map +0 -1
- package/dist/drivers/interfaces.d.ts.map +0 -1
- package/dist/drivers/log.d.ts.map +0 -1
- package/dist/drivers/ls.d.ts.map +0 -1
- package/dist/drivers/pframe/column_filter.d.ts.map +0 -1
- package/dist/drivers/pframe/data_info.d.ts.map +0 -1
- package/dist/drivers/pframe/data_types.d.ts.map +0 -1
- package/dist/drivers/pframe/driver.d.ts.map +0 -1
- package/dist/drivers/pframe/filter_spec.d.ts.map +0 -1
- package/dist/drivers/pframe/find_columns.d.ts.map +0 -1
- package/dist/drivers/pframe/index.d.ts.map +0 -1
- package/dist/drivers/pframe/linker_columns.d.ts.map +0 -1
- package/dist/drivers/pframe/pframe.d.ts.map +0 -1
- package/dist/drivers/pframe/query/index.d.ts.map +0 -1
- package/dist/drivers/pframe/query/query_common.d.ts.map +0 -1
- package/dist/drivers/pframe/query/query_data.d.ts.map +0 -1
- package/dist/drivers/pframe/query/query_spec.d.ts.map +0 -1
- package/dist/drivers/pframe/query/utils.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/anchored.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/filtered_column.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/ids.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/index.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/native_id.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/selectors.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/spec.d.ts.map +0 -1
- package/dist/drivers/pframe/table.d.ts.map +0 -1
- package/dist/drivers/pframe/table_calculate.d.ts.map +0 -1
- package/dist/drivers/pframe/table_common.d.ts.map +0 -1
- package/dist/drivers/pframe/type_util.d.ts +0 -5
- package/dist/drivers/pframe/type_util.d.ts.map +0 -1
- package/dist/drivers/pframe/unique_values.d.ts.map +0 -1
- package/dist/drivers/upload.d.ts.map +0 -1
- package/dist/drivers/urls.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/flags/block_flags.d.ts.map +0 -1
- package/dist/flags/flag_utils.d.ts.map +0 -1
- package/dist/flags/index.d.ts +0 -4
- package/dist/flags/index.d.ts.map +0 -1
- package/dist/flags/type_utils.d.ts.map +0 -1
- package/dist/httpAuth.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json.d.ts.map +0 -1
- package/dist/navigation.d.ts.map +0 -1
- package/dist/plid.d.ts.map +0 -1
- package/dist/pool/entry.d.ts.map +0 -1
- package/dist/pool/index.d.ts.map +0 -1
- package/dist/pool/query.d.ts.map +0 -1
- package/dist/pool/spec.d.ts.map +0 -1
- package/dist/ref.d.ts.map +0 -1
- package/dist/utag.d.ts.map +0 -1
- package/dist/util.d.ts.map +0 -1
- package/dist/value_or_error.d.ts.map +0 -1
package/dist/drivers/ls.cjs
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
7
|
+
return handle.startsWith(uploadPrefix);
|
|
9
8
|
}
|
|
10
9
|
function isImportFileHandleIndex(handle) {
|
|
11
|
-
|
|
10
|
+
return handle.startsWith(indexPrefix);
|
|
12
11
|
}
|
|
13
12
|
/** Gets a file path from an import handle. */
|
|
14
13
|
function getFilePathFromHandle(handle) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
24
|
+
return filePath.replace(/^.*[\\/]/, "");
|
|
29
25
|
}
|
|
30
26
|
/** Gets a file name from an import handle. */
|
|
31
27
|
function getFileNameFromHandle(handle) {
|
|
32
|
-
|
|
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
|
package/dist/drivers/ls.cjs.map
CHANGED
|
@@ -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"],"
|
|
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"}
|
package/dist/drivers/ls.d.ts
CHANGED
|
@@ -1,92 +1,89 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
14
|
+
type StorageHandleLocal = `local://${string}`;
|
|
12
15
|
/** Results in index */
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
type ListFilesResult = {
|
|
24
|
+
parent?: string;
|
|
25
|
+
entries: LsEntry[];
|
|
23
26
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
type LsEntry = {
|
|
28
|
+
type: "dir";
|
|
29
|
+
name: string;
|
|
30
|
+
fullPath: string;
|
|
28
31
|
} | {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
84
|
+
declare function getFilePathFromHandle(handle: ImportFileHandle): string;
|
|
90
85
|
/** Gets a file name from an import handle. */
|
|
91
|
-
|
|
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
|
package/dist/drivers/ls.js
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
import { assertNever } from
|
|
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
|
-
|
|
7
|
+
return handle.startsWith(uploadPrefix);
|
|
7
8
|
}
|
|
8
9
|
function isImportFileHandleIndex(handle) {
|
|
9
|
-
|
|
10
|
+
return handle.startsWith(indexPrefix);
|
|
10
11
|
}
|
|
11
12
|
/** Gets a file path from an import handle. */
|
|
12
13
|
function getFilePathFromHandle(handle) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
24
|
+
return filePath.replace(/^.*[\\/]/, "");
|
|
27
25
|
}
|
|
28
26
|
/** Gets a file name from an import handle. */
|
|
29
27
|
function getFileNameFromHandle(handle) {
|
|
30
|
-
|
|
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
|
package/dist/drivers/ls.js.map
CHANGED
|
@@ -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"],"
|
|
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
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|