@milaboratories/pl-model-common 1.24.3 → 1.24.5
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/base32_encode.cjs +11 -11
- package/dist/base32_encode.cjs.map +1 -1
- package/dist/base32_encode.d.ts +1 -1
- package/dist/base32_encode.js +11 -11
- package/dist/base32_encode.js.map +1 -1
- package/dist/base64.cjs +2 -2
- package/dist/base64.cjs.map +1 -1
- package/dist/base64.d.ts +1 -1
- package/dist/base64.d.ts.map +1 -1
- package/dist/base64.js +2 -2
- package/dist/base64.js.map +1 -1
- package/dist/block_state.d.ts +3 -3
- package/dist/bmodel/block_config.cjs +1 -1
- package/dist/bmodel/block_config.cjs.map +1 -1
- package/dist/bmodel/block_config.d.ts +3 -3
- package/dist/bmodel/block_config.d.ts.map +1 -1
- package/dist/bmodel/block_config.js +1 -1
- package/dist/bmodel/block_config.js.map +1 -1
- package/dist/bmodel/code.cjs +1 -1
- package/dist/bmodel/code.cjs.map +1 -1
- package/dist/bmodel/code.d.ts +2 -2
- package/dist/bmodel/code.js +1 -1
- package/dist/bmodel/code.js.map +1 -1
- package/dist/bmodel/container.d.ts +5 -5
- package/dist/bmodel/index.d.ts +5 -5
- package/dist/bmodel/normalization.cjs +17 -17
- package/dist/bmodel/normalization.cjs.map +1 -1
- package/dist/bmodel/normalization.d.ts +2 -2
- package/dist/bmodel/normalization.d.ts.map +1 -1
- package/dist/bmodel/normalization.js +17 -17
- package/dist/bmodel/normalization.js.map +1 -1
- package/dist/bmodel/types.d.ts +1 -1
- package/dist/branding.d.ts +2 -2
- package/dist/common_types.d.ts +1 -1
- package/dist/driver_kit.d.ts +1 -1
- package/dist/drivers/ChunkedStreamReader.cjs +13 -12
- package/dist/drivers/ChunkedStreamReader.cjs.map +1 -1
- package/dist/drivers/ChunkedStreamReader.d.ts +2 -2
- package/dist/drivers/ChunkedStreamReader.d.ts.map +1 -1
- package/dist/drivers/ChunkedStreamReader.js +13 -12
- package/dist/drivers/ChunkedStreamReader.js.map +1 -1
- package/dist/drivers/blob.cjs +1 -1
- package/dist/drivers/blob.cjs.map +1 -1
- package/dist/drivers/blob.d.ts +4 -4
- package/dist/drivers/blob.d.ts.map +1 -1
- package/dist/drivers/blob.js +1 -1
- package/dist/drivers/blob.js.map +1 -1
- package/dist/drivers/index.d.ts +8 -8
- package/dist/drivers/log.cjs +1 -1
- package/dist/drivers/log.cjs.map +1 -1
- package/dist/drivers/log.js +1 -1
- package/dist/drivers/log.js.map +1 -1
- package/dist/drivers/ls.cjs +3 -3
- package/dist/drivers/ls.cjs.map +1 -1
- package/dist/drivers/ls.d.ts +6 -6
- package/dist/drivers/ls.d.ts.map +1 -1
- package/dist/drivers/ls.js +3 -3
- package/dist/drivers/ls.js.map +1 -1
- package/dist/drivers/pframe/column_filter.d.ts +1 -1
- package/dist/drivers/pframe/data_info.cjs +119 -110
- package/dist/drivers/pframe/data_info.cjs.map +1 -1
- package/dist/drivers/pframe/data_info.d.ts +10 -10
- package/dist/drivers/pframe/data_info.d.ts.map +1 -1
- package/dist/drivers/pframe/data_info.js +119 -110
- package/dist/drivers/pframe/data_info.js.map +1 -1
- package/dist/drivers/pframe/data_types.cjs +7 -4
- package/dist/drivers/pframe/data_types.cjs.map +1 -1
- package/dist/drivers/pframe/data_types.d.ts +2 -2
- package/dist/drivers/pframe/data_types.d.ts.map +1 -1
- package/dist/drivers/pframe/data_types.js +7 -4
- package/dist/drivers/pframe/data_types.js.map +1 -1
- package/dist/drivers/pframe/driver.d.ts +10 -10
- package/dist/drivers/pframe/driver.d.ts.map +1 -1
- package/dist/drivers/pframe/find_columns.d.ts +2 -2
- package/dist/drivers/pframe/index.d.ts +14 -14
- package/dist/drivers/pframe/linker_columns.cjs +13 -5
- package/dist/drivers/pframe/linker_columns.cjs.map +1 -1
- package/dist/drivers/pframe/linker_columns.d.ts +2 -2
- package/dist/drivers/pframe/linker_columns.d.ts.map +1 -1
- package/dist/drivers/pframe/linker_columns.js +13 -5
- package/dist/drivers/pframe/linker_columns.js.map +1 -1
- package/dist/drivers/pframe/pframe.d.ts +6 -6
- package/dist/drivers/pframe/pframe.d.ts.map +1 -1
- package/dist/drivers/pframe/query/index.d.ts +2 -2
- package/dist/drivers/pframe/query/query_common.d.ts +37 -37
- package/dist/drivers/pframe/query/query_data.d.ts +2 -2
- package/dist/drivers/pframe/query/query_data.d.ts.map +1 -1
- package/dist/drivers/pframe/query/query_spec.d.ts +3 -3
- package/dist/drivers/pframe/query/query_spec.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/anchored.cjs +6 -6
- package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
- package/dist/drivers/pframe/spec/anchored.d.ts +4 -4
- package/dist/drivers/pframe/spec/anchored.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/anchored.js +6 -6
- package/dist/drivers/pframe/spec/anchored.js.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.cjs +1 -1
- package/dist/drivers/pframe/spec/filtered_column.cjs.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.d.ts +1 -1
- package/dist/drivers/pframe/spec/filtered_column.js +1 -1
- package/dist/drivers/pframe/spec/filtered_column.js.map +1 -1
- package/dist/drivers/pframe/spec/ids.cjs.map +1 -1
- package/dist/drivers/pframe/spec/ids.d.ts +5 -5
- package/dist/drivers/pframe/spec/ids.js.map +1 -1
- package/dist/drivers/pframe/spec/index.d.ts +6 -6
- package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
- package/dist/drivers/pframe/spec/native_id.d.ts +3 -3
- package/dist/drivers/pframe/spec/native_id.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/native_id.js.map +1 -1
- package/dist/drivers/pframe/spec/selectors.cjs +1 -1
- package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
- package/dist/drivers/pframe/spec/selectors.d.ts +4 -4
- package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/selectors.js +1 -1
- package/dist/drivers/pframe/spec/selectors.js.map +1 -1
- package/dist/drivers/pframe/spec/spec.cjs +64 -59
- package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
- package/dist/drivers/pframe/spec/spec.d.ts +15 -15
- package/dist/drivers/pframe/spec/spec.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/spec.js +64 -59
- package/dist/drivers/pframe/spec/spec.js.map +1 -1
- package/dist/drivers/pframe/table.d.ts +2 -2
- package/dist/drivers/pframe/table_calculate.cjs +11 -11
- package/dist/drivers/pframe/table_calculate.cjs.map +1 -1
- package/dist/drivers/pframe/table_calculate.d.ts +30 -30
- package/dist/drivers/pframe/table_calculate.d.ts.map +1 -1
- package/dist/drivers/pframe/table_calculate.js +11 -11
- package/dist/drivers/pframe/table_calculate.js.map +1 -1
- package/dist/drivers/pframe/table_common.cjs +4 -4
- package/dist/drivers/pframe/table_common.cjs.map +1 -1
- package/dist/drivers/pframe/table_common.d.ts +6 -6
- package/dist/drivers/pframe/table_common.js +4 -4
- package/dist/drivers/pframe/table_common.js.map +1 -1
- package/dist/drivers/pframe/type_util.d.ts.map +1 -1
- package/dist/drivers/pframe/unique_values.d.ts +4 -4
- package/dist/drivers/urls.cjs +2 -2
- package/dist/drivers/urls.cjs.map +1 -1
- package/dist/drivers/urls.d.ts +1 -1
- package/dist/drivers/urls.js +2 -2
- package/dist/drivers/urls.js.map +1 -1
- package/dist/errors.cjs +12 -12
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +12 -12
- package/dist/errors.js.map +1 -1
- package/dist/flags/block_flags.cjs +2 -2
- package/dist/flags/block_flags.cjs.map +1 -1
- package/dist/flags/block_flags.d.ts.map +1 -1
- package/dist/flags/block_flags.js +2 -2
- package/dist/flags/block_flags.js.map +1 -1
- package/dist/flags/flag_utils.cjs +31 -29
- package/dist/flags/flag_utils.cjs.map +1 -1
- package/dist/flags/flag_utils.d.ts +33 -33
- package/dist/flags/flag_utils.d.ts.map +1 -1
- package/dist/flags/flag_utils.js +31 -29
- package/dist/flags/flag_utils.js.map +1 -1
- package/dist/flags/index.d.ts +3 -3
- package/dist/flags/type_utils.d.ts +1 -1
- package/dist/flags/type_utils.d.ts.map +1 -1
- package/dist/httpAuth.cjs +4 -5
- package/dist/httpAuth.cjs.map +1 -1
- package/dist/httpAuth.d.ts +1 -1
- package/dist/httpAuth.d.ts.map +1 -1
- package/dist/httpAuth.js +4 -5
- package/dist/httpAuth.js.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/json.cjs +1 -1
- package/dist/json.cjs.map +1 -1
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +1 -1
- package/dist/json.js.map +1 -1
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.cjs.map +1 -1
- package/dist/navigation.d.ts +3 -3
- package/dist/navigation.js +1 -1
- package/dist/navigation.js.map +1 -1
- package/dist/plid.cjs +4 -4
- package/dist/plid.cjs.map +1 -1
- package/dist/plid.d.ts +1 -1
- package/dist/plid.js +4 -4
- package/dist/plid.js.map +1 -1
- package/dist/pool/entry.d.ts +1 -1
- package/dist/pool/index.d.ts +3 -3
- package/dist/pool/query.cjs +23 -23
- package/dist/pool/query.cjs.map +1 -1
- package/dist/pool/query.d.ts +9 -9
- package/dist/pool/query.d.ts.map +1 -1
- package/dist/pool/query.js +23 -23
- package/dist/pool/query.js.map +1 -1
- package/dist/pool/spec.cjs +9 -9
- package/dist/pool/spec.cjs.map +1 -1
- package/dist/pool/spec.d.ts +4 -4
- package/dist/pool/spec.d.ts.map +1 -1
- package/dist/pool/spec.js +9 -9
- package/dist/pool/spec.js.map +1 -1
- package/dist/ref.cjs +20 -18
- package/dist/ref.cjs.map +1 -1
- package/dist/ref.d.ts +1 -1
- package/dist/ref.d.ts.map +1 -1
- package/dist/ref.js +20 -18
- package/dist/ref.js.map +1 -1
- package/dist/utag.d.ts +1 -1
- package/dist/util.cjs +1 -1
- package/dist/util.cjs.map +1 -1
- package/dist/util.js +1 -1
- package/dist/util.js.map +1 -1
- package/dist/value_or_error.cjs.map +1 -1
- package/dist/value_or_error.d.ts.map +1 -1
- package/dist/value_or_error.js.map +1 -1
- package/package.json +18 -17
- package/src/base32_encode.ts +12 -12
- package/src/base64.ts +12 -8
- package/src/block_state.ts +3 -3
- package/src/bmodel/block_config.ts +12 -6
- package/src/bmodel/code.ts +3 -3
- package/src/bmodel/container.ts +5 -5
- package/src/bmodel/index.ts +5 -5
- package/src/bmodel/normalization.ts +33 -25
- package/src/bmodel/types.ts +1 -1
- package/src/branding.ts +2 -2
- package/src/common_types.ts +1 -1
- package/src/driver_kit.ts +1 -1
- package/src/drivers/ChunkedStreamReader.ts +16 -14
- package/src/drivers/blob.ts +7 -11
- package/src/drivers/index.ts +8 -8
- package/src/drivers/log.ts +3 -3
- package/src/drivers/ls.ts +18 -18
- package/src/drivers/pframe/column_filter.ts +1 -1
- package/src/drivers/pframe/data_info.ts +146 -146
- package/src/drivers/pframe/data_types.ts +56 -36
- package/src/drivers/pframe/driver.ts +20 -36
- package/src/drivers/pframe/find_columns.ts +2 -2
- package/src/drivers/pframe/index.ts +14 -14
- package/src/drivers/pframe/linker_columns.test.ts +280 -273
- package/src/drivers/pframe/linker_columns.ts +65 -39
- package/src/drivers/pframe/pframe.ts +6 -9
- package/src/drivers/pframe/query/index.ts +2 -2
- package/src/drivers/pframe/query/query_common.ts +46 -46
- package/src/drivers/pframe/query/query_data.ts +17 -10
- package/src/drivers/pframe/query/query_spec.ts +18 -10
- package/src/drivers/pframe/spec/anchored.ts +44 -33
- package/src/drivers/pframe/spec/filtered_column.ts +2 -2
- package/src/drivers/pframe/spec/ids.ts +6 -6
- package/src/drivers/pframe/spec/index.ts +6 -6
- package/src/drivers/pframe/spec/native_id.ts +7 -9
- package/src/drivers/pframe/spec/selectors.test.ts +170 -146
- package/src/drivers/pframe/spec/selectors.ts +22 -31
- package/src/drivers/pframe/spec/spec.test.ts +163 -176
- package/src/drivers/pframe/spec/spec.ts +132 -117
- package/src/drivers/pframe/table.ts +2 -2
- package/src/drivers/pframe/table_calculate.ts +44 -50
- package/src/drivers/pframe/table_common.ts +10 -10
- package/src/drivers/pframe/type_util.ts +2 -7
- package/src/drivers/pframe/unique_values.ts +4 -4
- package/src/drivers/urls.ts +3 -3
- package/src/errors.test.ts +20 -20
- package/src/errors.ts +24 -20
- package/src/flags/block_flags.ts +8 -7
- package/src/flags/flag_utils.test.ts +94 -73
- package/src/flags/flag_utils.ts +73 -50
- package/src/flags/index.ts +3 -3
- package/src/flags/type_utils.ts +10 -7
- package/src/httpAuth.ts +5 -6
- package/src/index.ts +19 -19
- package/src/json.ts +28 -17
- package/src/navigation.ts +4 -4
- package/src/plid.ts +6 -6
- package/src/pool/entry.ts +1 -1
- package/src/pool/index.ts +3 -3
- package/src/pool/query.ts +52 -56
- package/src/pool/spec.ts +20 -17
- package/src/ref.ts +25 -19
- package/src/utag.ts +1 -1
- package/src/util.ts +1 -1
- package/src/value_or_error.ts +6 -6
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-model-common",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.5",
|
|
4
4
|
"description": "Platforma SDK Model",
|
|
5
|
+
"files": [
|
|
6
|
+
"./dist/**/*",
|
|
7
|
+
"./src/**/*"
|
|
8
|
+
],
|
|
5
9
|
"type": "module",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
10
|
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
8
12
|
"exports": {
|
|
9
13
|
".": {
|
|
10
14
|
"types": "./dist/index.d.ts",
|
|
@@ -12,31 +16,28 @@
|
|
|
12
16
|
"require": "./dist/index.cjs"
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
|
-
"files": [
|
|
16
|
-
"./dist/**/*",
|
|
17
|
-
"./src/**/*"
|
|
18
|
-
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"zod": "~3.23.8",
|
|
21
20
|
"canonicalize": "~2.1.0",
|
|
22
|
-
"
|
|
21
|
+
"zod": "~3.23.8",
|
|
22
|
+
"@milaboratories/pl-error-like": "1.12.7"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"
|
|
25
|
+
"@vitest/coverage-istanbul": "^4.0.16",
|
|
26
26
|
"typescript": "~5.6.3",
|
|
27
27
|
"vitest": "^4.0.16",
|
|
28
|
-
"@
|
|
29
|
-
"@milaboratories/ts-
|
|
30
|
-
"@milaboratories/
|
|
31
|
-
"@milaboratories/ts-configs": "1.2.0",
|
|
32
|
-
"@milaboratories/eslint-config": "1.0.5"
|
|
28
|
+
"@milaboratories/build-configs": "1.4.2",
|
|
29
|
+
"@milaboratories/ts-configs": "1.2.1",
|
|
30
|
+
"@milaboratories/ts-builder": "1.2.6"
|
|
33
31
|
},
|
|
34
32
|
"scripts": {
|
|
35
|
-
"type-check": "ts-builder types --target node",
|
|
36
33
|
"build": "ts-builder build --target node",
|
|
37
34
|
"watch": "ts-builder build --target node --watch",
|
|
38
|
-
"
|
|
35
|
+
"check": "ts-builder check --target node",
|
|
36
|
+
"formatter:check": "ts-builder formatter --check",
|
|
37
|
+
"linter:check": "ts-builder linter --check",
|
|
38
|
+
"types:check": "ts-builder type-check --target node",
|
|
39
39
|
"test": "vitest run --coverage",
|
|
40
|
-
"do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz"
|
|
40
|
+
"do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz",
|
|
41
|
+
"fmt": "ts-builder format"
|
|
41
42
|
}
|
|
42
43
|
}
|
package/src/base32_encode.ts
CHANGED
|
@@ -7,7 +7,7 @@ function toDataView(data: Data) {
|
|
|
7
7
|
if (data instanceof ArrayBuffer) return new DataView(data);
|
|
8
8
|
|
|
9
9
|
throw new TypeError(
|
|
10
|
-
|
|
10
|
+
"Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray",
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -16,34 +16,34 @@ interface Options {
|
|
|
16
16
|
padding?: boolean;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const RFC4648 =
|
|
20
|
-
const RFC4648_HEX =
|
|
21
|
-
const CROCKFORD =
|
|
19
|
+
const RFC4648 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
20
|
+
const RFC4648_HEX = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
21
|
+
const CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
22
22
|
|
|
23
23
|
export function base32Encode(
|
|
24
24
|
data: Data,
|
|
25
|
-
variant:
|
|
25
|
+
variant: "RFC3548" | "RFC4648" | "RFC4648-HEX" | "Crockford",
|
|
26
26
|
options?: Options,
|
|
27
27
|
) {
|
|
28
28
|
options = options || {};
|
|
29
29
|
let alphabet, defaultPadding;
|
|
30
30
|
|
|
31
31
|
switch (variant) {
|
|
32
|
-
case
|
|
33
|
-
case
|
|
32
|
+
case "RFC3548":
|
|
33
|
+
case "RFC4648":
|
|
34
34
|
alphabet = RFC4648;
|
|
35
35
|
defaultPadding = true;
|
|
36
36
|
break;
|
|
37
|
-
case
|
|
37
|
+
case "RFC4648-HEX":
|
|
38
38
|
alphabet = RFC4648_HEX;
|
|
39
39
|
defaultPadding = true;
|
|
40
40
|
break;
|
|
41
|
-
case
|
|
41
|
+
case "Crockford":
|
|
42
42
|
alphabet = CROCKFORD;
|
|
43
43
|
defaultPadding = false;
|
|
44
44
|
break;
|
|
45
45
|
default:
|
|
46
|
-
throw new Error(
|
|
46
|
+
throw new Error("Unknown base32 variant: " + String(variant));
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
const padding = options.padding !== undefined ? options.padding : defaultPadding;
|
|
@@ -51,7 +51,7 @@ export function base32Encode(
|
|
|
51
51
|
|
|
52
52
|
let bits = 0;
|
|
53
53
|
let value = 0;
|
|
54
|
-
let output =
|
|
54
|
+
let output = "";
|
|
55
55
|
|
|
56
56
|
for (let i = 0; i < view.byteLength; i++) {
|
|
57
57
|
value = (value << 8) | view.getUint8(i);
|
|
@@ -67,7 +67,7 @@ export function base32Encode(
|
|
|
67
67
|
|
|
68
68
|
if (padding)
|
|
69
69
|
while (output.length % 8 !== 0) {
|
|
70
|
-
output +=
|
|
70
|
+
output += "=";
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
return output;
|
package/src/base64.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import type { WithImplicitCoercion } from
|
|
1
|
+
import type { WithImplicitCoercion } from "node:buffer";
|
|
2
2
|
|
|
3
|
-
export type Base64Compatible<T> =
|
|
3
|
+
export type Base64Compatible<T> =
|
|
4
|
+
T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;
|
|
4
5
|
|
|
5
|
-
export type Base64Encoded<T = unknown> =
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
export type Base64Encoded<T = unknown> =
|
|
7
|
+
Base64Compatible<T> extends never
|
|
8
|
+
? never
|
|
9
|
+
: string & {
|
|
10
|
+
__base64_encoded: T;
|
|
11
|
+
};
|
|
8
12
|
|
|
9
13
|
export function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {
|
|
10
|
-
return Buffer.from(value).toString(
|
|
14
|
+
return Buffer.from(value).toString("base64") as Base64Encoded<T>;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
export function base64Decode<T extends string>(value: Base64Encoded<T>): T {
|
|
14
|
-
return Buffer.from(value,
|
|
15
|
-
}
|
|
18
|
+
return Buffer.from(value, "base64").toString() as T;
|
|
19
|
+
}
|
package/src/block_state.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BlockOutputsBase } from
|
|
2
|
-
import type { NavigationState } from
|
|
3
|
-
import type { AuthorMarker } from
|
|
1
|
+
import type { BlockOutputsBase } from "./common_types";
|
|
2
|
+
import type { NavigationState } from "./navigation";
|
|
3
|
+
import type { AuthorMarker } from "./author_marker";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @template Args sets type of block arguments passed to the workflow
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// TODO BroadActiveHandleDescriptor must be removed
|
|
2
2
|
|
|
3
|
-
import type { BlockCodeFeatureFlags } from
|
|
4
|
-
import type { BlockCodeWithInfo, Code } from
|
|
5
|
-
import type { BlockRenderingMode } from
|
|
3
|
+
import type { BlockCodeFeatureFlags } from "../flags";
|
|
4
|
+
import type { BlockCodeWithInfo, Code } from "./code";
|
|
5
|
+
import type { BlockRenderingMode } from "./types";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Descriptor for a state migration function.
|
|
@@ -23,7 +23,10 @@ export type BlockConfigV4Generic<
|
|
|
23
23
|
_Data extends Record<string, unknown> = Record<string, unknown>,
|
|
24
24
|
BroadActiveHandleDescriptor = unknown,
|
|
25
25
|
NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,
|
|
26
|
-
Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<
|
|
26
|
+
Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<
|
|
27
|
+
string,
|
|
28
|
+
BroadActiveHandleDescriptor
|
|
29
|
+
>,
|
|
27
30
|
> = {
|
|
28
31
|
/** Discriminator to identify config version */
|
|
29
32
|
readonly configVersion: 4;
|
|
@@ -93,7 +96,10 @@ export type BlockConfigV3Generic<
|
|
|
93
96
|
UiState = unknown,
|
|
94
97
|
BroadActiveHandleDescriptor = unknown,
|
|
95
98
|
NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,
|
|
96
|
-
Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<
|
|
99
|
+
Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<
|
|
100
|
+
string,
|
|
101
|
+
BroadActiveHandleDescriptor
|
|
102
|
+
>,
|
|
97
103
|
> = {
|
|
98
104
|
/** Discriminator to identify config version */
|
|
99
105
|
readonly configVersion: 3;
|
|
@@ -151,7 +157,7 @@ export type BlockConfigV3Generic<
|
|
|
151
157
|
export type BlockConfigGeneric = BlockConfigV3Generic | BlockConfigV4Generic;
|
|
152
158
|
|
|
153
159
|
export function extractCodeWithInfo(cfg: BlockConfigGeneric): BlockCodeWithInfo {
|
|
154
|
-
if (cfg.code === undefined) throw new Error(
|
|
160
|
+
if (cfg.code === undefined) throw new Error("extractCodeWithInfo: No code bundle");
|
|
155
161
|
return {
|
|
156
162
|
code: cfg.code,
|
|
157
163
|
sdkVersion: cfg.sdkVersion,
|
package/src/bmodel/code.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { BlockCodeFeatureFlags } from
|
|
2
|
-
import { z } from
|
|
1
|
+
import type { BlockCodeFeatureFlags } from "../flags";
|
|
2
|
+
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
export const Code = z.object({
|
|
5
|
-
type: z.literal(
|
|
5
|
+
type: z.literal("plain"),
|
|
6
6
|
content: z.string(),
|
|
7
7
|
});
|
|
8
8
|
|
package/src/bmodel/container.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { BlockConfigV3Generic, BlockConfigV4Generic } from
|
|
2
|
-
import type { Code } from
|
|
3
|
-
import type { BlockRenderingMode } from
|
|
1
|
+
import type { BlockConfigV3Generic, BlockConfigV4Generic } from "./block_config";
|
|
2
|
+
import type { Code } from "./code";
|
|
3
|
+
import type { BlockRenderingMode } from "./types";
|
|
4
4
|
|
|
5
5
|
/** Container simplifying maintenance of forward and backward compatibility */
|
|
6
6
|
export type BlockConfigContainer = {
|
|
7
|
-
readonly v4?: Omit<BlockConfigV4Generic,
|
|
7
|
+
readonly v4?: Omit<BlockConfigV4Generic, "code">;
|
|
8
8
|
/** Actual config */
|
|
9
|
-
readonly v3?: Omit<BlockConfigV3Generic,
|
|
9
|
+
readonly v3?: Omit<BlockConfigV3Generic, "code">;
|
|
10
10
|
|
|
11
11
|
/** Config code bundle. Actually is required, but we keep it optional for backward compatibility */
|
|
12
12
|
readonly code?: Code;
|
package/src/bmodel/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "./block_config";
|
|
2
|
+
export * from "./code";
|
|
3
|
+
export * from "./types";
|
|
4
|
+
export * from "./container";
|
|
5
|
+
export * from "./normalization";
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import type { BlockConfigGeneric } from
|
|
2
|
-
import type { BlockConfigContainer } from
|
|
1
|
+
import type { BlockConfigGeneric } from "./block_config";
|
|
2
|
+
import type { BlockConfigContainer } from "./container";
|
|
3
3
|
|
|
4
4
|
function upgradeCfgOrLambda(data: unknown): unknown;
|
|
5
|
-
function upgradeCfgOrLambda(
|
|
6
|
-
|
|
7
|
-
): unknown | undefined;
|
|
8
|
-
function upgradeCfgOrLambda(
|
|
9
|
-
data: unknown | undefined,
|
|
10
|
-
): unknown | undefined {
|
|
5
|
+
function upgradeCfgOrLambda(data: unknown | undefined): unknown | undefined;
|
|
6
|
+
function upgradeCfgOrLambda(data: unknown | undefined): unknown | undefined {
|
|
11
7
|
if (data === undefined) return undefined;
|
|
12
|
-
if (typeof data ===
|
|
8
|
+
if (typeof data === "string") return { __renderLambda: true, handle: data, retentive: false };
|
|
13
9
|
return data;
|
|
14
10
|
}
|
|
15
11
|
|
|
@@ -22,7 +18,19 @@ function upgradeCfgOrLambda(
|
|
|
22
18
|
export function extractConfigGeneric(cfg: BlockConfigContainer): BlockConfigGeneric {
|
|
23
19
|
if (cfg.v4 !== undefined) {
|
|
24
20
|
// version 4 (BlockModelV3) - inputsValid is derived from args() success/failure
|
|
25
|
-
const {
|
|
21
|
+
const {
|
|
22
|
+
args,
|
|
23
|
+
prerunArgs,
|
|
24
|
+
initialData,
|
|
25
|
+
outputs,
|
|
26
|
+
renderingMode,
|
|
27
|
+
sdkVersion,
|
|
28
|
+
featureFlags,
|
|
29
|
+
sections,
|
|
30
|
+
title,
|
|
31
|
+
enrichmentTargets,
|
|
32
|
+
migrations,
|
|
33
|
+
} = cfg.v4;
|
|
26
34
|
const { code } = cfg;
|
|
27
35
|
return {
|
|
28
36
|
configVersion: 4,
|
|
@@ -79,15 +87,15 @@ export function extractConfigGeneric(cfg: BlockConfigContainer): BlockConfigGene
|
|
|
79
87
|
const { sdkVersion, renderingMode, outputs, inputsValid, sections, initialArgs, code } = cfg;
|
|
80
88
|
const fields = Object.keys(cfg);
|
|
81
89
|
if (
|
|
82
|
-
sdkVersion === undefined
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
sdkVersion === undefined ||
|
|
91
|
+
renderingMode === undefined ||
|
|
92
|
+
outputs === undefined ||
|
|
93
|
+
inputsValid === undefined ||
|
|
94
|
+
sections === undefined ||
|
|
95
|
+
initialArgs === undefined
|
|
88
96
|
)
|
|
89
97
|
throw new Error(
|
|
90
|
-
`Malformed config v2. SDK version ${sdkVersion}; Fields = ${fields.join(
|
|
98
|
+
`Malformed config v2. SDK version ${sdkVersion}; Fields = ${fields.join(", ")}`,
|
|
91
99
|
);
|
|
92
100
|
return {
|
|
93
101
|
configVersion: 3,
|
|
@@ -108,19 +116,19 @@ export function extractConfigGeneric(cfg: BlockConfigContainer): BlockConfigGene
|
|
|
108
116
|
const { sdkVersion, canRun, renderingMode, outputs, sections, initialArgs, code } = cfg;
|
|
109
117
|
const fields = Object.keys(cfg);
|
|
110
118
|
if (
|
|
111
|
-
renderingMode === undefined
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
renderingMode === undefined ||
|
|
120
|
+
outputs === undefined ||
|
|
121
|
+
canRun === undefined ||
|
|
122
|
+
sections === undefined ||
|
|
123
|
+
initialArgs === undefined
|
|
116
124
|
)
|
|
117
125
|
throw new Error(
|
|
118
|
-
`Malformed config v1. SDK version ${sdkVersion}; Fields = ${fields.join(
|
|
126
|
+
`Malformed config v1. SDK version ${sdkVersion}; Fields = ${fields.join(", ")}`,
|
|
119
127
|
);
|
|
120
128
|
return {
|
|
121
129
|
configVersion: 3,
|
|
122
130
|
modelAPIVersion: 1,
|
|
123
|
-
sdkVersion: sdkVersion ??
|
|
131
|
+
sdkVersion: sdkVersion ?? "unknown",
|
|
124
132
|
renderingMode,
|
|
125
133
|
initialArgs,
|
|
126
134
|
outputs: Object.fromEntries(
|
|
@@ -135,7 +143,7 @@ export function extractConfigGeneric(cfg: BlockConfigContainer): BlockConfigGene
|
|
|
135
143
|
const { sdkVersion } = cfg;
|
|
136
144
|
const fields = Object.keys(cfg);
|
|
137
145
|
throw new Error(
|
|
138
|
-
`Config format not supported: SDK = ${sdkVersion}; Fields = ${fields.join(
|
|
146
|
+
`Config format not supported: SDK = ${sdkVersion}; Fields = ${fields.join(", ")}`,
|
|
139
147
|
);
|
|
140
148
|
}
|
|
141
149
|
}
|
package/src/bmodel/types.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type BlockRenderingMode =
|
|
1
|
+
export type BlockRenderingMode = "Light" | "Heavy" | "DualContextHeavy";
|
package/src/branding.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
type Brand<B, K extends string =
|
|
1
|
+
type Brand<B, K extends string = "__pl_model_brand__"> = { [key in K]: B };
|
|
2
2
|
|
|
3
|
-
export type Branded<T, B, K extends string =
|
|
3
|
+
export type Branded<T, B, K extends string = "__pl_model_brand__"> = T & Brand<B, K>;
|
package/src/common_types.ts
CHANGED
package/src/driver_kit.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RangeBytes } from
|
|
1
|
+
import type { RangeBytes } from "./blob";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Status returned by onError handler to indicate what action to take
|
|
@@ -6,7 +6,7 @@ import type { RangeBytes } from './blob';
|
|
|
6
6
|
* - 'error': Error the stream (calls controller.error, aborts ongoing fetches)
|
|
7
7
|
* - 'cancel': Cancel the stream gracefully (calls controller.close, aborts ongoing fetches)
|
|
8
8
|
*/
|
|
9
|
-
export type ErrorHandlerStatus =
|
|
9
|
+
export type ErrorHandlerStatus = "continue" | "error" | "cancel";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Options for creating a ChunkedStreamReader
|
|
@@ -60,17 +60,19 @@ export class ChunkedStreamReader {
|
|
|
60
60
|
this.options = {
|
|
61
61
|
...options,
|
|
62
62
|
chunkSize: options.chunkSize ?? 16 * 1024 * 1024,
|
|
63
|
-
onError:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
onError:
|
|
64
|
+
options.onError ??
|
|
65
|
+
(async () => {
|
|
66
|
+
// Default behavior: error (will automatically call controller.error)
|
|
67
|
+
return "error";
|
|
68
|
+
}),
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
if (this.totalSize < 0) {
|
|
70
|
-
throw new Error(
|
|
72
|
+
throw new Error("Total size must be non-negative");
|
|
71
73
|
}
|
|
72
74
|
if (this.chunkSize <= 0) {
|
|
73
|
-
throw new Error(
|
|
75
|
+
throw new Error("Chunk size must be positive");
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -175,20 +177,20 @@ export class ChunkedStreamReader {
|
|
|
175
177
|
// If any error occurs during chunk reading, call the error handler
|
|
176
178
|
const status = await this.onError(error);
|
|
177
179
|
|
|
178
|
-
if (status ===
|
|
180
|
+
if (status === "error") {
|
|
179
181
|
this._errored = true;
|
|
180
182
|
// Error the stream and abort any ongoing fetch operations
|
|
181
183
|
controller.error(error);
|
|
182
|
-
this.abortController?.abort(
|
|
184
|
+
this.abortController?.abort("Stream errored");
|
|
183
185
|
return true; // Stop reading
|
|
184
186
|
}
|
|
185
187
|
|
|
186
|
-
if (status ===
|
|
188
|
+
if (status === "cancel") {
|
|
187
189
|
this._canceled = true;
|
|
188
190
|
// Close the stream gracefully and abort any ongoing fetch operations
|
|
189
191
|
controller.close();
|
|
190
|
-
this.abortController?.abort(
|
|
191
|
-
console.debug(
|
|
192
|
+
this.abortController?.abort("Stream cancelled");
|
|
193
|
+
console.debug("ChunkedStreamReader cancelled due to error");
|
|
192
194
|
return true; // Stop reading
|
|
193
195
|
}
|
|
194
196
|
}
|
|
@@ -236,7 +238,7 @@ export class ChunkedStreamReader {
|
|
|
236
238
|
this._canceled = true;
|
|
237
239
|
// Abort any ongoing fetch operations
|
|
238
240
|
this.abortController?.abort(reason);
|
|
239
|
-
console.debug(
|
|
241
|
+
console.debug("ChunkedStreamReader cancelled:", reason);
|
|
240
242
|
},
|
|
241
243
|
});
|
|
242
244
|
}
|
package/src/drivers/blob.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import type { Branded } from
|
|
2
|
-
import { z } from
|
|
1
|
+
import type { Branded } from "../branding";
|
|
2
|
+
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
/** Handle of locally downloaded blob. This handle is issued only after the
|
|
5
5
|
* blob's content is downloaded locally, and ready for quick access. */
|
|
6
|
-
export type LocalBlobHandle = Branded<string,
|
|
6
|
+
export type LocalBlobHandle = Branded<string, "LocalBlobHandle">;
|
|
7
7
|
|
|
8
8
|
/** Handle of remote blob. This handle is issued as soon as the data becomes
|
|
9
9
|
* available on the remote server. */
|
|
10
|
-
export type RemoteBlobHandle = Branded<string,
|
|
10
|
+
export type RemoteBlobHandle = Branded<string, "RemoteBlobHandle">;
|
|
11
11
|
|
|
12
12
|
/** Being configured inside the output structure provides information about
|
|
13
13
|
* blob's content and means to retrieve it when needed. */
|
|
14
14
|
export interface BlobHandleAndSize<
|
|
15
|
-
H extends LocalBlobHandle | RemoteBlobHandle = |
|
|
16
|
-
| RemoteBlobHandle,
|
|
15
|
+
H extends LocalBlobHandle | RemoteBlobHandle = LocalBlobHandle | RemoteBlobHandle,
|
|
17
16
|
> {
|
|
18
17
|
/** Handle to retrieve block content using {@link BlobDriver.getContent()} */
|
|
19
18
|
readonly handle: H;
|
|
@@ -38,7 +37,7 @@ export function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undef
|
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
const range = { from, to };
|
|
41
|
-
validateRangeBytes(range,
|
|
40
|
+
validateRangeBytes(range, "newRangeBytesOpt");
|
|
42
41
|
|
|
43
42
|
return range;
|
|
44
43
|
}
|
|
@@ -76,8 +75,5 @@ export interface BlobDriver {
|
|
|
76
75
|
* Depending on the handle type, content will be served from locally downloaded file,
|
|
77
76
|
* or directly from remote platforma storage.
|
|
78
77
|
*/
|
|
79
|
-
getContent(
|
|
80
|
-
handle: LocalBlobHandle | RemoteBlobHandle,
|
|
81
|
-
range?: RangeBytes,
|
|
82
|
-
): Promise<Uint8Array>;
|
|
78
|
+
getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;
|
|
83
79
|
}
|
package/src/drivers/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./interfaces";
|
|
2
2
|
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
3
|
+
export * from "./urls";
|
|
4
|
+
export * from "./blob";
|
|
5
|
+
export * from "./upload";
|
|
6
|
+
export * from "./log";
|
|
7
|
+
export * from "./ls";
|
|
8
8
|
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
9
|
+
export * from "./pframe";
|
|
10
|
+
export * from "./ChunkedStreamReader";
|
package/src/drivers/log.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type ReadyLogHandle = `log+ready://log/${string}`;
|
|
|
12
12
|
|
|
13
13
|
/** Type guard to check if log is live, and corresponding porcess is not finished. */
|
|
14
14
|
export function isLiveLog(handle: AnyLogHandle | undefined): handle is LiveLogHandle {
|
|
15
|
-
return handle !== undefined && handle.startsWith(
|
|
15
|
+
return handle !== undefined && handle.startsWith("log+live://log/");
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/** Driver to retrieve logs given log handle */
|
|
@@ -32,7 +32,7 @@ export interface LogsDriver {
|
|
|
32
32
|
/** Is substring for line search pattern.
|
|
33
33
|
* This option makes controller to send to the client only lines, that
|
|
34
34
|
* have given substring. */
|
|
35
|
-
searchStr?: string
|
|
35
|
+
searchStr?: string,
|
|
36
36
|
): Promise<StreamingApiResponse>;
|
|
37
37
|
|
|
38
38
|
readText(
|
|
@@ -50,7 +50,7 @@ export interface LogsDriver {
|
|
|
50
50
|
/** Is substring for line search pattern.
|
|
51
51
|
* This option makes controller to send to the client only lines, that
|
|
52
52
|
* have given substring. */
|
|
53
|
-
searchStr?: string
|
|
53
|
+
searchStr?: string,
|
|
54
54
|
): Promise<StreamingApiResponse>;
|
|
55
55
|
}
|
|
56
56
|
|
package/src/drivers/ls.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { assertNever } from
|
|
2
|
-
import type { Branded } from
|
|
3
|
-
import type { TableRange } from
|
|
4
|
-
import type { FileLike } from
|
|
1
|
+
import { assertNever } from "../util";
|
|
2
|
+
import type { Branded } from "../branding";
|
|
3
|
+
import type { TableRange } from "./pframe";
|
|
4
|
+
import type { FileLike } from "./interfaces";
|
|
5
5
|
|
|
6
|
-
const uploadPrefix =
|
|
7
|
-
const indexPrefix =
|
|
6
|
+
const uploadPrefix = "upload://upload/";
|
|
7
|
+
const indexPrefix = "index://index/";
|
|
8
8
|
|
|
9
9
|
export type ImportFileHandleUpload = `upload://upload/${string}`;
|
|
10
10
|
export type ImportFileHandleIndex = `index://index/${string}`;
|
|
11
11
|
|
|
12
12
|
export type ImportFileHandle = ImportFileHandleUpload | ImportFileHandleIndex;
|
|
13
13
|
|
|
14
|
-
export type LocalImportFileHandle = Branded<ImportFileHandle,
|
|
14
|
+
export type LocalImportFileHandle = Branded<ImportFileHandle, "Local">;
|
|
15
15
|
|
|
16
16
|
export function isImportFileHandleUpload(
|
|
17
17
|
handle: ImportFileHandle,
|
|
@@ -47,18 +47,18 @@ export type ListFilesResult = {
|
|
|
47
47
|
|
|
48
48
|
export type LsEntry =
|
|
49
49
|
| {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
type: "dir";
|
|
51
|
+
name: string;
|
|
52
|
+
fullPath: string;
|
|
53
|
+
}
|
|
54
54
|
| {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
type: "file";
|
|
56
|
+
name: string;
|
|
57
|
+
fullPath: string;
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
/** This handle should be set to args... */
|
|
60
|
+
handle: ImportFileHandle;
|
|
61
|
+
};
|
|
62
62
|
|
|
63
63
|
export type OpenDialogFilter = {
|
|
64
64
|
/** Human-readable file type name */
|
|
@@ -142,7 +142,7 @@ export function getFilePathFromHandle(handle: ImportFileHandle): string {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
function extractFileName(filePath: string) {
|
|
145
|
-
return filePath.replace(/^.*[\\/]/,
|
|
145
|
+
return filePath.replace(/^.*[\\/]/, "");
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/** Gets a file name from an import handle. */
|