@milaboratories/pl-model-common 1.24.3 → 1.24.4
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
|
@@ -1,45 +1,50 @@
|
|
|
1
|
-
import { describe, it, expect } from
|
|
2
|
-
import { RuntimeCapabilities, IncompatibleFlagsError } from
|
|
3
|
-
import type { BlockCodeFeatureFlags } from
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { RuntimeCapabilities, IncompatibleFlagsError } from "./flag_utils";
|
|
3
|
+
import type { BlockCodeFeatureFlags } from "./block_flags";
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
describe(
|
|
7
|
-
it(
|
|
5
|
+
describe("RuntimeCapabilities", () => {
|
|
6
|
+
describe("addSupportedRequirement", () => {
|
|
7
|
+
it("should add a supported requirement with default value true", () => {
|
|
8
8
|
const capabilities = new RuntimeCapabilities();
|
|
9
|
-
capabilities.addSupportedRequirement(
|
|
9
|
+
capabilities.addSupportedRequirement("requiresModelAPIVersion");
|
|
10
10
|
const blockFlags: BlockCodeFeatureFlags = { requiresModelAPIVersion: true };
|
|
11
11
|
expect(capabilities.checkCompatibility(blockFlags)).toBe(true);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
it(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
it("should add a supported requirement with a specific boolean value", () => {
|
|
15
|
+
const capabilities = new RuntimeCapabilities();
|
|
16
|
+
capabilities.addSupportedRequirement("requiresModelAPIVersion", false);
|
|
17
|
+
const blockFlags: BlockCodeFeatureFlags = { requiresModelAPIVersion: false };
|
|
18
|
+
expect(capabilities.checkCompatibility(blockFlags)).toBe(true);
|
|
19
|
+
const blockFlags2: BlockCodeFeatureFlags = { requiresModelAPIVersion: true };
|
|
20
|
+
expect(capabilities.checkCompatibility(blockFlags2)).toBe(false);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
it(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
it("should add a supported requirement with a specific number value", () => {
|
|
24
|
+
const capabilities = new RuntimeCapabilities();
|
|
25
|
+
capabilities.addSupportedRequirement("requiresModelAPIVersion", 2);
|
|
26
|
+
const blockFlags: BlockCodeFeatureFlags = { requiresModelAPIVersion: 2 };
|
|
27
|
+
expect(capabilities.checkCompatibility(blockFlags)).toBe(true);
|
|
28
|
+
const blockFlags2: BlockCodeFeatureFlags = { requiresModelAPIVersion: 3 };
|
|
29
|
+
expect(capabilities.checkCompatibility(blockFlags2)).toBe(false);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
it(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
it("should allow chaining", () => {
|
|
33
|
+
const capabilities = new RuntimeCapabilities();
|
|
34
|
+
capabilities
|
|
35
|
+
.addSupportedRequirement("requiresModelAPIVersion")
|
|
36
|
+
.addSupportedRequirement("requiresUIAPIVersion");
|
|
37
|
+
const blockFlags: BlockCodeFeatureFlags = {
|
|
38
|
+
requiresModelAPIVersion: true,
|
|
39
|
+
requiresUIAPIVersion: true,
|
|
40
|
+
};
|
|
41
|
+
expect(capabilities.checkCompatibility(blockFlags)).toBe(true);
|
|
37
42
|
});
|
|
38
43
|
|
|
39
|
-
it(
|
|
44
|
+
it("should support multiple values for the same requirement", () => {
|
|
40
45
|
const capabilities = new RuntimeCapabilities();
|
|
41
|
-
capabilities.addSupportedRequirement(
|
|
42
|
-
capabilities.addSupportedRequirement(
|
|
46
|
+
capabilities.addSupportedRequirement("requiresModelAPIVersion", 2);
|
|
47
|
+
capabilities.addSupportedRequirement("requiresModelAPIVersion", 3);
|
|
43
48
|
const blockFlags: BlockCodeFeatureFlags = { requiresModelAPIVersion: 2 };
|
|
44
49
|
expect(capabilities.checkCompatibility(blockFlags)).toBe(true);
|
|
45
50
|
const blockFlags2: BlockCodeFeatureFlags = { requiresModelAPIVersion: 3 };
|
|
@@ -49,48 +54,55 @@ describe('RuntimeCapabilities', () => {
|
|
|
49
54
|
});
|
|
50
55
|
});
|
|
51
56
|
|
|
52
|
-
describe(
|
|
53
|
-
it(
|
|
57
|
+
describe("checkCompatibility and getIncompatibleFlags", () => {
|
|
58
|
+
it("should return compatible for undefined flags", () => {
|
|
54
59
|
const capabilities = new RuntimeCapabilities();
|
|
55
60
|
expect(capabilities.checkCompatibility(undefined)).toBe(true);
|
|
56
61
|
expect(capabilities.getIncompatibleFlags(undefined)).toBeUndefined();
|
|
57
62
|
});
|
|
58
63
|
|
|
59
|
-
it(
|
|
64
|
+
it("should return compatible for empty flags object", () => {
|
|
60
65
|
const capabilities = new RuntimeCapabilities();
|
|
61
66
|
expect(capabilities.checkCompatibility({})).toBe(true);
|
|
62
67
|
expect(capabilities.getIncompatibleFlags({})).toBeUndefined();
|
|
63
68
|
});
|
|
64
69
|
|
|
65
|
-
it(
|
|
70
|
+
it("should be compatible if requirements are met", () => {
|
|
66
71
|
const capabilities = new RuntimeCapabilities()
|
|
67
|
-
.addSupportedRequirement(
|
|
68
|
-
.addSupportedRequirement(
|
|
69
|
-
const blockFlags: BlockCodeFeatureFlags = {
|
|
72
|
+
.addSupportedRequirement("requiresModelAPIVersion")
|
|
73
|
+
.addSupportedRequirement("requiresUIAPIVersion", 2);
|
|
74
|
+
const blockFlags: BlockCodeFeatureFlags = {
|
|
75
|
+
requiresModelAPIVersion: true,
|
|
76
|
+
requiresUIAPIVersion: 2,
|
|
77
|
+
supportsSomething: true,
|
|
78
|
+
};
|
|
70
79
|
expect(capabilities.checkCompatibility(blockFlags)).toBe(true);
|
|
71
80
|
expect(capabilities.getIncompatibleFlags(blockFlags)).toBeUndefined();
|
|
72
81
|
});
|
|
73
82
|
|
|
74
|
-
it(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
it("should be incompatible if a requirement value is not met", () => {
|
|
84
|
+
const capabilities = new RuntimeCapabilities().addSupportedRequirement(
|
|
85
|
+
"requiresModelAPIVersion",
|
|
86
|
+
2,
|
|
87
|
+
);
|
|
88
|
+
const blockFlags: BlockCodeFeatureFlags = { requiresModelAPIVersion: 3 };
|
|
89
|
+
expect(capabilities.checkCompatibility(blockFlags)).toBe(false);
|
|
90
|
+
const incompatible = capabilities.getIncompatibleFlags(blockFlags);
|
|
91
|
+
expect(incompatible).toEqual(new Map([["requiresModelAPIVersion", 3]]));
|
|
80
92
|
});
|
|
81
93
|
|
|
82
|
-
it(
|
|
94
|
+
it("should be incompatible if a requirement is not specified in runtime capabilities", () => {
|
|
83
95
|
const capabilities = new RuntimeCapabilities();
|
|
84
96
|
const blockFlags: BlockCodeFeatureFlags = { requiresModelAPIVersion: true };
|
|
85
97
|
expect(capabilities.checkCompatibility(blockFlags)).toBe(false);
|
|
86
98
|
const incompatible = capabilities.getIncompatibleFlags(blockFlags);
|
|
87
|
-
expect(incompatible).toEqual(new Map([[
|
|
99
|
+
expect(incompatible).toEqual(new Map([["requiresModelAPIVersion", true]]));
|
|
88
100
|
});
|
|
89
101
|
|
|
90
|
-
it(
|
|
102
|
+
it("should correctly identify multiple incompatible flags", () => {
|
|
91
103
|
const capabilities = new RuntimeCapabilities()
|
|
92
|
-
.addSupportedRequirement(
|
|
93
|
-
.addSupportedRequirement(
|
|
104
|
+
.addSupportedRequirement("requiresModelAPIVersion", true)
|
|
105
|
+
.addSupportedRequirement("requiresUIAPIVersion", 2);
|
|
94
106
|
|
|
95
107
|
const blockFlags: BlockCodeFeatureFlags = {
|
|
96
108
|
requiresModelAPIVersion: false,
|
|
@@ -100,51 +112,60 @@ describe('RuntimeCapabilities', () => {
|
|
|
100
112
|
|
|
101
113
|
expect(capabilities.checkCompatibility(blockFlags)).toBe(false);
|
|
102
114
|
const incompatible = capabilities.getIncompatibleFlags(blockFlags);
|
|
103
|
-
expect(incompatible).toEqual(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
115
|
+
expect(incompatible).toEqual(
|
|
116
|
+
new Map<string, number | boolean>([
|
|
117
|
+
["requiresModelAPIVersion", false],
|
|
118
|
+
["requiresUIAPIVersion", 3],
|
|
119
|
+
["requiresSomethingElse", true],
|
|
120
|
+
]),
|
|
121
|
+
);
|
|
108
122
|
});
|
|
109
123
|
|
|
110
|
-
it(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
124
|
+
it("should ignore non-requirement flags", () => {
|
|
125
|
+
const capabilities = new RuntimeCapabilities();
|
|
126
|
+
const blockFlags: BlockCodeFeatureFlags = { supportsSomething: true };
|
|
127
|
+
expect(capabilities.checkCompatibility(blockFlags)).toBe(true);
|
|
128
|
+
expect(capabilities.getIncompatibleFlags(blockFlags)).toBeUndefined();
|
|
115
129
|
});
|
|
116
130
|
|
|
117
|
-
it(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
131
|
+
it("should ignore undefined requirement flags in block", () => {
|
|
132
|
+
const capabilities = new RuntimeCapabilities();
|
|
133
|
+
const blockFlags: BlockCodeFeatureFlags = { requiresModelAPIVersion: undefined };
|
|
134
|
+
expect(capabilities.checkCompatibility(blockFlags)).toBe(true);
|
|
135
|
+
expect(capabilities.getIncompatibleFlags(blockFlags)).toBeUndefined();
|
|
122
136
|
});
|
|
123
137
|
|
|
124
|
-
it(
|
|
138
|
+
it("should be incompatible if a requirement is not defined in capabilities", () => {
|
|
125
139
|
const capabilities = new RuntimeCapabilities(); // No requirements added.
|
|
126
140
|
const blockFlags: BlockCodeFeatureFlags = { requiresModelAPIVersion: 1 };
|
|
127
141
|
expect(capabilities.checkCompatibility(blockFlags)).toBe(false);
|
|
128
142
|
const incompatible = capabilities.getIncompatibleFlags(blockFlags);
|
|
129
|
-
expect(incompatible).toEqual(new Map([[
|
|
143
|
+
expect(incompatible).toEqual(new Map([["requiresModelAPIVersion", 1]]));
|
|
130
144
|
});
|
|
131
145
|
});
|
|
132
146
|
|
|
133
|
-
describe(
|
|
134
|
-
it(
|
|
135
|
-
const capabilities = new RuntimeCapabilities().addSupportedRequirement(
|
|
147
|
+
describe("throwIfIncompatible", () => {
|
|
148
|
+
it("should not throw if flags are compatible", () => {
|
|
149
|
+
const capabilities = new RuntimeCapabilities().addSupportedRequirement(
|
|
150
|
+
"requiresModelAPIVersion",
|
|
151
|
+
);
|
|
136
152
|
const blockFlags: BlockCodeFeatureFlags = { requiresModelAPIVersion: true };
|
|
137
153
|
expect(() => capabilities.throwIfIncompatible(blockFlags)).not.toThrow();
|
|
138
154
|
});
|
|
139
155
|
|
|
140
|
-
it(
|
|
141
|
-
const capabilities = new RuntimeCapabilities().addSupportedRequirement(
|
|
156
|
+
it("should throw IncompatibleFlagsError if flags are incompatible", () => {
|
|
157
|
+
const capabilities = new RuntimeCapabilities().addSupportedRequirement(
|
|
158
|
+
"requiresModelAPIVersion",
|
|
159
|
+
);
|
|
142
160
|
const blockFlags: BlockCodeFeatureFlags = { requiresModelAPIVersion: false };
|
|
143
161
|
expect(() => capabilities.throwIfIncompatible(blockFlags)).toThrow(IncompatibleFlagsError);
|
|
144
162
|
});
|
|
145
163
|
|
|
146
|
-
it(
|
|
147
|
-
const capabilities = new RuntimeCapabilities().addSupportedRequirement(
|
|
164
|
+
it("should throw with an error containing incompatible flags", () => {
|
|
165
|
+
const capabilities = new RuntimeCapabilities().addSupportedRequirement(
|
|
166
|
+
"requiresModelAPIVersion",
|
|
167
|
+
1,
|
|
168
|
+
);
|
|
148
169
|
const blockFlags: BlockCodeFeatureFlags = { requiresModelAPIVersion: 2 };
|
|
149
170
|
try {
|
|
150
171
|
capabilities.throwIfIncompatible(blockFlags);
|
|
@@ -153,8 +174,8 @@ describe('RuntimeCapabilities', () => {
|
|
|
153
174
|
} catch (e) {
|
|
154
175
|
expect(e).toBeInstanceOf(IncompatibleFlagsError);
|
|
155
176
|
if (e instanceof IncompatibleFlagsError) {
|
|
156
|
-
expect(e.incompatibleFlags).toEqual(new Map([[
|
|
157
|
-
expect(e.message).toContain(
|
|
177
|
+
expect(e.incompatibleFlags).toEqual(new Map([["requiresModelAPIVersion", 2]]));
|
|
178
|
+
expect(e.message).toContain("requiresModelAPIVersion: 2");
|
|
158
179
|
}
|
|
159
180
|
}
|
|
160
181
|
});
|
package/src/flags/flag_utils.ts
CHANGED
|
@@ -1,60 +1,82 @@
|
|
|
1
|
-
import type { BlockCodeFeatureFlags, BlockCodeKnownFeatureFlags } from
|
|
2
|
-
import type { FilterKeysByPrefix } from
|
|
1
|
+
import type { BlockCodeFeatureFlags, BlockCodeKnownFeatureFlags } from "./block_flags";
|
|
2
|
+
import type { FilterKeysByPrefix } from "./type_utils";
|
|
3
3
|
|
|
4
|
-
export function checkBlockFlag(
|
|
4
|
+
export function checkBlockFlag(
|
|
5
|
+
flags: BlockCodeFeatureFlags | undefined,
|
|
6
|
+
flag: keyof BlockCodeKnownFeatureFlags,
|
|
7
|
+
flagValue: boolean | number = true,
|
|
8
|
+
): boolean {
|
|
5
9
|
if (flags === undefined) return false;
|
|
6
10
|
return flags[flag] === flagValue;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export function extractAllRequirements(
|
|
14
|
+
* Extracts all requirements from the feature flags.
|
|
15
|
+
* @param flags - The feature flags.
|
|
16
|
+
* @returns A set of requirements.
|
|
17
|
+
*/
|
|
18
|
+
export function extractAllRequirements(
|
|
19
|
+
flags: BlockCodeFeatureFlags | undefined,
|
|
20
|
+
): Set<`requires${string}`> {
|
|
15
21
|
if (flags === undefined) return new Set();
|
|
16
|
-
return new Set(
|
|
17
|
-
.
|
|
18
|
-
|
|
22
|
+
return new Set(
|
|
23
|
+
Object.entries(flags)
|
|
24
|
+
.filter(([key, value]) => key.startsWith("requires") && value === true)
|
|
25
|
+
.map(([key]) => key as `requires${string}`),
|
|
26
|
+
);
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export function extractAllSupports(
|
|
30
|
+
* Extracts all supports from the feature flags.
|
|
31
|
+
* @param flags - The feature flags.
|
|
32
|
+
* @returns A set of supports.
|
|
33
|
+
*/
|
|
34
|
+
export function extractAllSupports(
|
|
35
|
+
flags: BlockCodeFeatureFlags | undefined,
|
|
36
|
+
): Set<`supports${string}`> {
|
|
27
37
|
if (flags === undefined) return new Set();
|
|
28
|
-
return new Set(
|
|
29
|
-
.
|
|
30
|
-
|
|
38
|
+
return new Set(
|
|
39
|
+
Object.entries(flags)
|
|
40
|
+
.filter(([key, value]) => key.startsWith("supports") && value === true)
|
|
41
|
+
.map(([key]) => key as `supports${string}`),
|
|
42
|
+
);
|
|
31
43
|
}
|
|
32
44
|
|
|
33
45
|
export class IncompatibleFlagsError extends Error {
|
|
34
|
-
name =
|
|
46
|
+
name = "IncompatibleFlagsError";
|
|
35
47
|
constructor(public readonly incompatibleFlags: Map<`requires${string}`, number | boolean>) {
|
|
36
|
-
super(
|
|
48
|
+
super(
|
|
49
|
+
`Some of the block requirements are not supported by the runtime: ${Array.from(
|
|
50
|
+
incompatibleFlags.entries(),
|
|
51
|
+
)
|
|
52
|
+
.map(([key, value]) => `${key}: ${value}`)
|
|
53
|
+
.join(", ")}`,
|
|
54
|
+
);
|
|
37
55
|
}
|
|
38
56
|
}
|
|
39
57
|
|
|
40
58
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export type SupportedRequirement = FilterKeysByPrefix<BlockCodeKnownFeatureFlags,
|
|
59
|
+
* A type that represents a supported requirement.
|
|
60
|
+
* @remarks
|
|
61
|
+
* This type is used to represent a supported requirement.
|
|
62
|
+
* It is a subtype of `BlockCodeKnownFeatureFlags` and is used to represent a supported requirement.
|
|
63
|
+
* It is used to represent a supported requirement.
|
|
64
|
+
*/
|
|
65
|
+
export type SupportedRequirement = FilterKeysByPrefix<BlockCodeKnownFeatureFlags, "requires">;
|
|
48
66
|
|
|
49
67
|
export class RuntimeCapabilities {
|
|
50
|
-
private readonly supportedRequirements: Map<`requires${string}`, Set<number | boolean>> =
|
|
68
|
+
private readonly supportedRequirements: Map<`requires${string}`, Set<number | boolean>> =
|
|
69
|
+
new Map();
|
|
51
70
|
|
|
52
71
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
public addSupportedRequirement(
|
|
72
|
+
* Adds a supported requirement to the runtime capabilities.
|
|
73
|
+
* @param requirement - The requirement.
|
|
74
|
+
* @param value - The value of the requirement. If not provided, defaults to true.
|
|
75
|
+
*/
|
|
76
|
+
public addSupportedRequirement(
|
|
77
|
+
requirement: SupportedRequirement,
|
|
78
|
+
value: number | boolean = true,
|
|
79
|
+
): this {
|
|
58
80
|
if (!this.supportedRequirements.has(requirement)) {
|
|
59
81
|
this.supportedRequirements.set(requirement, new Set());
|
|
60
82
|
}
|
|
@@ -63,15 +85,17 @@ export class RuntimeCapabilities {
|
|
|
63
85
|
}
|
|
64
86
|
|
|
65
87
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
public getIncompatibleFlags(
|
|
88
|
+
* Returns a map of incompatible flags. If the block flags are compatible, returns undefined.
|
|
89
|
+
* @param blockFlags - The block flags.
|
|
90
|
+
* @returns A map of incompatible flags, or undefined if the block flags are compatible.
|
|
91
|
+
*/
|
|
92
|
+
public getIncompatibleFlags(
|
|
93
|
+
blockFlags: BlockCodeFeatureFlags | undefined,
|
|
94
|
+
): Map<`requires${string}`, number | boolean> | undefined {
|
|
71
95
|
if (blockFlags === undefined) return undefined;
|
|
72
96
|
const incompatibleFlags = new Map<`requires${string}`, number | boolean>();
|
|
73
97
|
for (const [key, value] of Object.entries(blockFlags)) {
|
|
74
|
-
if (key.startsWith(
|
|
98
|
+
if (key.startsWith("requires")) {
|
|
75
99
|
if (value === undefined) continue;
|
|
76
100
|
const supportedValues = this.supportedRequirements.get(key as `requires${string}`);
|
|
77
101
|
if (supportedValues === undefined || !supportedValues.has(value as number | boolean)) {
|
|
@@ -83,22 +107,21 @@ export class RuntimeCapabilities {
|
|
|
83
107
|
}
|
|
84
108
|
|
|
85
109
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
110
|
+
* Checks if the block flags are compatible with the runtime capabilities.
|
|
111
|
+
* @param blockFlags - The block flags.
|
|
112
|
+
* @returns True if the block flags are compatible, false otherwise.
|
|
113
|
+
*/
|
|
90
114
|
public checkCompatibility(blockFlags: BlockCodeFeatureFlags | undefined): boolean {
|
|
91
115
|
return this.getIncompatibleFlags(blockFlags) === undefined;
|
|
92
116
|
}
|
|
93
117
|
|
|
94
118
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
119
|
+
* Throws an error if the block flags are incompatible with the runtime capabilities.
|
|
120
|
+
* @param blockFlags - The block flags.
|
|
121
|
+
* @throws IncompatibleFlagsError if the block flags are incompatible with the runtime capabilities.
|
|
122
|
+
*/
|
|
99
123
|
public throwIfIncompatible(blockFlags: BlockCodeFeatureFlags | undefined) {
|
|
100
124
|
const incompatibleFlags = this.getIncompatibleFlags(blockFlags);
|
|
101
|
-
if (incompatibleFlags !== undefined)
|
|
102
|
-
throw new IncompatibleFlagsError(incompatibleFlags);
|
|
125
|
+
if (incompatibleFlags !== undefined) throw new IncompatibleFlagsError(incompatibleFlags);
|
|
103
126
|
}
|
|
104
127
|
}
|
package/src/flags/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./block_flags";
|
|
2
|
+
export * from "./flag_utils";
|
|
3
|
+
export * from "./type_utils";
|
package/src/flags/type_utils.ts
CHANGED
|
@@ -10,17 +10,17 @@ export type FilterKeysByPrefix<T, P extends string> = keyof {
|
|
|
10
10
|
* Helper to assert that two types are equal. This will cause a compile-time error if they are not.
|
|
11
11
|
* We use this to ensure all feature flags are accounted for in the arrays below.
|
|
12
12
|
*/
|
|
13
|
-
export type AssertKeysEqual<T, U> =
|
|
14
|
-
?
|
|
15
|
-
|
|
13
|
+
export type AssertKeysEqual<T, U> =
|
|
14
|
+
(<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2
|
|
15
|
+
? unknown
|
|
16
|
+
: { error: "Feature flag definitions are out of sync"; expected: T; actual: U };
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Checks if two types are exactly equal.
|
|
19
20
|
* Returns 'true' if they are, 'false' otherwise.
|
|
20
21
|
*/
|
|
21
|
-
export type Is<T, U> =
|
|
22
|
-
? true
|
|
23
|
-
: false;
|
|
22
|
+
export type Is<T, U> =
|
|
23
|
+
(<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? true : false;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Checks if T is a subtype of U.
|
|
@@ -37,7 +37,10 @@ export type Assert<T extends true> = T;
|
|
|
37
37
|
/**
|
|
38
38
|
* Helper to create a union type of two array value types.
|
|
39
39
|
*/
|
|
40
|
-
export type ArrayTypeUnion<
|
|
40
|
+
export type ArrayTypeUnion<
|
|
41
|
+
T extends readonly any[],
|
|
42
|
+
U extends readonly any[],
|
|
43
|
+
> = T[number] extends never
|
|
41
44
|
? U[number]
|
|
42
45
|
: U[number] extends never
|
|
43
46
|
? T[number]
|
package/src/httpAuth.ts
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
export function parseHttpAuth(input: string): HttpAuth {
|
|
4
4
|
const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);
|
|
5
|
-
if (match?.groups?.scheme ===
|
|
6
|
-
const credentialsMatch = /(?<username>.*?):(?<password>.*)
|
|
7
|
-
.exec(atob(match.groups.parameters));
|
|
5
|
+
if (match?.groups?.scheme === "Basic") {
|
|
6
|
+
const credentialsMatch = /(?<username>.*?):(?<password>.*)/.exec(atob(match.groups.parameters));
|
|
8
7
|
if (!credentialsMatch?.groups) {
|
|
9
8
|
throw new Error(`Malformed credentials.`);
|
|
10
9
|
}
|
|
11
10
|
return {
|
|
12
|
-
scheme:
|
|
11
|
+
scheme: "Basic",
|
|
13
12
|
username: credentialsMatch.groups.username,
|
|
14
13
|
password: credentialsMatch.groups.password,
|
|
15
14
|
};
|
|
@@ -18,7 +17,7 @@ export function parseHttpAuth(input: string): HttpAuth {
|
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
export function serializeHttpAuth(input: HttpAuth): string {
|
|
21
|
-
if (input.scheme ===
|
|
20
|
+
if (input.scheme === "Basic") {
|
|
22
21
|
return `Basic ${btoa(`${input.username}:${input.password}`)}`;
|
|
23
22
|
}
|
|
24
23
|
throw new Error(`Unsupported auth scheme: ${input.scheme as string}.`);
|
|
@@ -27,7 +26,7 @@ export function serializeHttpAuth(input: HttpAuth): string {
|
|
|
27
26
|
export type HttpAuth = BasicHttpAuth;
|
|
28
27
|
|
|
29
28
|
export interface BasicHttpAuth {
|
|
30
|
-
scheme:
|
|
29
|
+
scheme: "Basic";
|
|
31
30
|
username: string;
|
|
32
31
|
password: string;
|
|
33
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
1
|
+
export * from "./author_marker";
|
|
2
|
+
export * from "./block_state";
|
|
3
|
+
export * from "./bmodel";
|
|
4
|
+
export * from "./branding";
|
|
5
|
+
export * from "./common_types";
|
|
6
|
+
export * from "./driver_kit";
|
|
7
|
+
export * from "./drivers";
|
|
8
|
+
export * from "./errors";
|
|
9
|
+
export * from "./flags";
|
|
10
|
+
export * from "./json";
|
|
11
|
+
export * from "./navigation";
|
|
12
|
+
export * from "./plid";
|
|
13
|
+
export * from "./pool";
|
|
14
|
+
export * from "./ref";
|
|
15
|
+
export * from "./utag";
|
|
16
|
+
export * from "./value_or_error";
|
|
17
|
+
export * from "./base64";
|
|
18
|
+
export * from "./util";
|
|
19
|
+
export * from "./httpAuth";
|
package/src/json.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import canonicalize from
|
|
1
|
+
import canonicalize from "canonicalize";
|
|
2
2
|
|
|
3
3
|
type JsonPrimitive = string | number | boolean | null;
|
|
4
4
|
|
|
@@ -13,18 +13,26 @@ export type JsonSerializable =
|
|
|
13
13
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
14
14
|
type NotAssignableToJson = bigint | symbol | Function;
|
|
15
15
|
|
|
16
|
-
export type JsonCompatible<T> = unknown extends T
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
export type JsonCompatible<T> = unknown extends T
|
|
17
|
+
? unknown
|
|
18
|
+
: [T] extends [JsonValue]
|
|
19
|
+
? T
|
|
20
|
+
: [T] extends [NotAssignableToJson]
|
|
21
|
+
? never
|
|
22
|
+
: {
|
|
23
|
+
[P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue]
|
|
24
|
+
? T[P]
|
|
25
|
+
: [Exclude<T[P], undefined>] extends [NotAssignableToJson]
|
|
26
|
+
? never
|
|
27
|
+
: JsonCompatible<T[P]>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type StringifiedJson<T = unknown> =
|
|
31
|
+
JsonCompatible<T> extends never
|
|
32
|
+
? never
|
|
33
|
+
: string & {
|
|
34
|
+
__json_stringified: T;
|
|
35
|
+
};
|
|
28
36
|
|
|
29
37
|
export function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T>;
|
|
30
38
|
export function stringifyJson<T extends JsonSerializable>(value: T): string;
|
|
@@ -32,9 +40,12 @@ export function stringifyJson(value: unknown): string {
|
|
|
32
40
|
return JSON.stringify(value);
|
|
33
41
|
}
|
|
34
42
|
|
|
35
|
-
export type CanonicalizedJson<T = unknown> =
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
export type CanonicalizedJson<T = unknown> =
|
|
44
|
+
JsonCompatible<T> extends never
|
|
45
|
+
? never
|
|
46
|
+
: string & {
|
|
47
|
+
__json_canonicalized: T;
|
|
48
|
+
};
|
|
38
49
|
|
|
39
50
|
export function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;
|
|
40
51
|
export function canonicalizeJson<T extends JsonSerializable>(value: T): string;
|
|
@@ -47,5 +58,5 @@ export function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>):
|
|
|
47
58
|
}
|
|
48
59
|
|
|
49
60
|
export function bigintReplacer(_key: string, value: unknown): unknown {
|
|
50
|
-
return typeof value ===
|
|
61
|
+
return typeof value === "bigint" ? value.toString() : value;
|
|
51
62
|
}
|
package/src/navigation.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type BlockSection = BlockSectionLink | BlockSectionDelimiter;
|
|
|
6
6
|
export type BlockSectionLink = {
|
|
7
7
|
/** Potentially there may be multiple section types, i.e. for "+" rows and for
|
|
8
8
|
* sections directly opening html from the outputs. */
|
|
9
|
-
readonly type:
|
|
9
|
+
readonly type: "link";
|
|
10
10
|
|
|
11
11
|
/** Internal block section identifier */
|
|
12
12
|
readonly href: `/${string}`;
|
|
@@ -24,11 +24,11 @@ export type BlockSectionLink = {
|
|
|
24
24
|
/** Different variants for link section appearance */
|
|
25
25
|
export type BlockSectionLinkAppearance =
|
|
26
26
|
/** Shows a section of type `link` with a `+` icon and a certain specific style */
|
|
27
|
-
|
|
27
|
+
"add-section";
|
|
28
28
|
|
|
29
29
|
/** Create a horizontal line between sections */
|
|
30
30
|
export type BlockSectionDelimiter = {
|
|
31
|
-
readonly type:
|
|
31
|
+
readonly type: "delimiter";
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -39,4 +39,4 @@ export type NavigationState<Href extends `/${string}` = `/${string}`> = {
|
|
|
39
39
|
readonly href: Href;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
export const DefaultNavigationState: NavigationState = { href:
|
|
42
|
+
export const DefaultNavigationState: NavigationState = { href: "/" };
|