@milaboratories/pl-model-common 1.25.1 → 1.25.2
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 +6 -5
- package/dist/flags/block_flags.cjs.map +1 -1
- package/dist/flags/block_flags.d.ts +11 -8
- package/dist/flags/block_flags.js +6 -4
- 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/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
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
package/dist/author_marker.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
//#region src/author_marker.d.ts
|
|
1
2
|
/** Structure to help resolve conflicts if multiple participants writes to
|
|
2
3
|
* the same state */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
interface AuthorMarker {
|
|
5
|
+
/** Unique identifier of client or even a specific window that sets this
|
|
6
|
+
* particular state */
|
|
7
|
+
authorId: string;
|
|
8
|
+
/** Sequential version of the state local to the author */
|
|
9
|
+
localVersion: number;
|
|
9
10
|
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { AuthorMarker };
|
|
10
13
|
//# sourceMappingURL=author_marker.d.ts.map
|
package/dist/base32_encode.cjs
CHANGED
|
@@ -1,56 +1,50 @@
|
|
|
1
|
-
'use strict';
|
|
2
1
|
|
|
2
|
+
//#region src/base32_encode.ts
|
|
3
3
|
function toDataView(data) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return new DataView(data);
|
|
8
|
-
throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray");
|
|
4
|
+
if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray) return new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
5
|
+
if (data instanceof ArrayBuffer) return new DataView(data);
|
|
6
|
+
throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray");
|
|
9
7
|
}
|
|
10
8
|
const RFC4648 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
11
9
|
const RFC4648_HEX = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
12
10
|
const CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
13
11
|
function base32Encode(data, variant, options) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (padding)
|
|
49
|
-
while (output.length % 8 !== 0) {
|
|
50
|
-
output += "=";
|
|
51
|
-
}
|
|
52
|
-
return output;
|
|
12
|
+
options = options || {};
|
|
13
|
+
let alphabet, defaultPadding;
|
|
14
|
+
switch (variant) {
|
|
15
|
+
case "RFC3548":
|
|
16
|
+
case "RFC4648":
|
|
17
|
+
alphabet = RFC4648;
|
|
18
|
+
defaultPadding = true;
|
|
19
|
+
break;
|
|
20
|
+
case "RFC4648-HEX":
|
|
21
|
+
alphabet = RFC4648_HEX;
|
|
22
|
+
defaultPadding = true;
|
|
23
|
+
break;
|
|
24
|
+
case "Crockford":
|
|
25
|
+
alphabet = CROCKFORD;
|
|
26
|
+
defaultPadding = false;
|
|
27
|
+
break;
|
|
28
|
+
default: throw new Error("Unknown base32 variant: " + String(variant));
|
|
29
|
+
}
|
|
30
|
+
const padding = options.padding !== void 0 ? options.padding : defaultPadding;
|
|
31
|
+
const view = toDataView(data);
|
|
32
|
+
let bits = 0;
|
|
33
|
+
let value = 0;
|
|
34
|
+
let output = "";
|
|
35
|
+
for (let i = 0; i < view.byteLength; i++) {
|
|
36
|
+
value = value << 8 | view.getUint8(i);
|
|
37
|
+
bits += 8;
|
|
38
|
+
while (bits >= 5) {
|
|
39
|
+
output += alphabet[value >>> bits - 5 & 31];
|
|
40
|
+
bits -= 5;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (bits > 0) output += alphabet[value << 5 - bits & 31];
|
|
44
|
+
if (padding) while (output.length % 8 !== 0) output += "=";
|
|
45
|
+
return output;
|
|
53
46
|
}
|
|
54
47
|
|
|
48
|
+
//#endregion
|
|
55
49
|
exports.base32Encode = base32Encode;
|
|
56
|
-
//# sourceMappingURL=base32_encode.cjs.map
|
|
50
|
+
//# sourceMappingURL=base32_encode.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base32_encode.cjs","sources":["../src/base32_encode.ts"],"sourcesContent":["type Data = Int8Array | Uint8Array | Uint8ClampedArray | ArrayBuffer;\n\nfunction toDataView(data: Data) {\n if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray)\n return new DataView(data.buffer, data.byteOffset, data.byteLength);\n\n if (data instanceof ArrayBuffer) return new DataView(data);\n\n throw new TypeError(\n \"Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray\",\n );\n}\n\ninterface Options {\n /** If set, forcefully enable or disable padding. The default behavior is to follow the default of the selected variant. */\n padding?: boolean;\n}\n\nconst RFC4648 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\nconst RFC4648_HEX = \"0123456789ABCDEFGHIJKLMNOPQRSTUV\";\nconst CROCKFORD = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\n\nexport function base32Encode(\n data: Data,\n variant: \"RFC3548\" | \"RFC4648\" | \"RFC4648-HEX\" | \"Crockford\",\n options?: Options,\n) {\n options = options || {};\n let alphabet, defaultPadding;\n\n switch (variant) {\n case \"RFC3548\":\n case \"RFC4648\":\n alphabet = RFC4648;\n defaultPadding = true;\n break;\n case \"RFC4648-HEX\":\n alphabet = RFC4648_HEX;\n defaultPadding = true;\n break;\n case \"Crockford\":\n alphabet = CROCKFORD;\n defaultPadding = false;\n break;\n default:\n throw new Error(\"Unknown base32 variant: \" + String(variant));\n }\n\n const padding = options.padding !== undefined ? options.padding : defaultPadding;\n const view = toDataView(data);\n\n let bits = 0;\n let value = 0;\n let output = \"\";\n\n for (let i = 0; i < view.byteLength; i++) {\n value = (value << 8) | view.getUint8(i);\n bits += 8;\n\n while (bits >= 5) {\n output += alphabet[(value >>> (bits - 5)) & 31];\n bits -= 5;\n }\n }\n\n if (bits > 0) output += alphabet[(value << (5 - bits)) & 31];\n\n if (padding)\n while (output.length % 8 !== 0) {\n output += \"=\";\n }\n\n return output;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"base32_encode.cjs","names":[],"sources":["../src/base32_encode.ts"],"sourcesContent":["type Data = Int8Array | Uint8Array | Uint8ClampedArray | ArrayBuffer;\n\nfunction toDataView(data: Data) {\n if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray)\n return new DataView(data.buffer, data.byteOffset, data.byteLength);\n\n if (data instanceof ArrayBuffer) return new DataView(data);\n\n throw new TypeError(\n \"Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray\",\n );\n}\n\ninterface Options {\n /** If set, forcefully enable or disable padding. The default behavior is to follow the default of the selected variant. */\n padding?: boolean;\n}\n\nconst RFC4648 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\nconst RFC4648_HEX = \"0123456789ABCDEFGHIJKLMNOPQRSTUV\";\nconst CROCKFORD = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\n\nexport function base32Encode(\n data: Data,\n variant: \"RFC3548\" | \"RFC4648\" | \"RFC4648-HEX\" | \"Crockford\",\n options?: Options,\n) {\n options = options || {};\n let alphabet, defaultPadding;\n\n switch (variant) {\n case \"RFC3548\":\n case \"RFC4648\":\n alphabet = RFC4648;\n defaultPadding = true;\n break;\n case \"RFC4648-HEX\":\n alphabet = RFC4648_HEX;\n defaultPadding = true;\n break;\n case \"Crockford\":\n alphabet = CROCKFORD;\n defaultPadding = false;\n break;\n default:\n throw new Error(\"Unknown base32 variant: \" + String(variant));\n }\n\n const padding = options.padding !== undefined ? options.padding : defaultPadding;\n const view = toDataView(data);\n\n let bits = 0;\n let value = 0;\n let output = \"\";\n\n for (let i = 0; i < view.byteLength; i++) {\n value = (value << 8) | view.getUint8(i);\n bits += 8;\n\n while (bits >= 5) {\n output += alphabet[(value >>> (bits - 5)) & 31];\n bits -= 5;\n }\n }\n\n if (bits > 0) output += alphabet[(value << (5 - bits)) & 31];\n\n if (padding)\n while (output.length % 8 !== 0) {\n output += \"=\";\n }\n\n return output;\n}\n"],"mappings":";;AAEA,SAAS,WAAW,MAAY;AAC9B,KAAI,gBAAgB,aAAa,gBAAgB,cAAc,gBAAgB,kBAC7E,QAAO,IAAI,SAAS,KAAK,QAAQ,KAAK,YAAY,KAAK,WAAW;AAEpE,KAAI,gBAAgB,YAAa,QAAO,IAAI,SAAS,KAAK;AAE1D,OAAM,IAAI,UACR,2FACD;;AAQH,MAAM,UAAU;AAChB,MAAM,cAAc;AACpB,MAAM,YAAY;AAElB,SAAgB,aACd,MACA,SACA,SACA;AACA,WAAU,WAAW,EAAE;CACvB,IAAI,UAAU;AAEd,SAAQ,SAAR;EACE,KAAK;EACL,KAAK;AACH,cAAW;AACX,oBAAiB;AACjB;EACF,KAAK;AACH,cAAW;AACX,oBAAiB;AACjB;EACF,KAAK;AACH,cAAW;AACX,oBAAiB;AACjB;EACF,QACE,OAAM,IAAI,MAAM,6BAA6B,OAAO,QAAQ,CAAC;;CAGjE,MAAM,UAAU,QAAQ,YAAY,SAAY,QAAQ,UAAU;CAClE,MAAM,OAAO,WAAW,KAAK;CAE7B,IAAI,OAAO;CACX,IAAI,QAAQ;CACZ,IAAI,SAAS;AAEb,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,YAAY,KAAK;AACxC,UAAS,SAAS,IAAK,KAAK,SAAS,EAAE;AACvC,UAAQ;AAER,SAAO,QAAQ,GAAG;AAChB,aAAU,SAAU,UAAW,OAAO,IAAM;AAC5C,WAAQ;;;AAIZ,KAAI,OAAO,EAAG,WAAU,SAAU,SAAU,IAAI,OAAS;AAEzD,KAAI,QACF,QAAO,OAAO,SAAS,MAAM,EAC3B,WAAU;AAGd,QAAO"}
|
package/dist/base32_encode.js
CHANGED
|
@@ -1,54 +1,49 @@
|
|
|
1
|
+
//#region src/base32_encode.ts
|
|
1
2
|
function toDataView(data) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return new DataView(data);
|
|
6
|
-
throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray");
|
|
3
|
+
if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray) return new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
4
|
+
if (data instanceof ArrayBuffer) return new DataView(data);
|
|
5
|
+
throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray");
|
|
7
6
|
}
|
|
8
7
|
const RFC4648 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
9
8
|
const RFC4648_HEX = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
|
|
10
9
|
const CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
11
10
|
function base32Encode(data, variant, options) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (padding)
|
|
47
|
-
while (output.length % 8 !== 0) {
|
|
48
|
-
output += "=";
|
|
49
|
-
}
|
|
50
|
-
return output;
|
|
11
|
+
options = options || {};
|
|
12
|
+
let alphabet, defaultPadding;
|
|
13
|
+
switch (variant) {
|
|
14
|
+
case "RFC3548":
|
|
15
|
+
case "RFC4648":
|
|
16
|
+
alphabet = RFC4648;
|
|
17
|
+
defaultPadding = true;
|
|
18
|
+
break;
|
|
19
|
+
case "RFC4648-HEX":
|
|
20
|
+
alphabet = RFC4648_HEX;
|
|
21
|
+
defaultPadding = true;
|
|
22
|
+
break;
|
|
23
|
+
case "Crockford":
|
|
24
|
+
alphabet = CROCKFORD;
|
|
25
|
+
defaultPadding = false;
|
|
26
|
+
break;
|
|
27
|
+
default: throw new Error("Unknown base32 variant: " + String(variant));
|
|
28
|
+
}
|
|
29
|
+
const padding = options.padding !== void 0 ? options.padding : defaultPadding;
|
|
30
|
+
const view = toDataView(data);
|
|
31
|
+
let bits = 0;
|
|
32
|
+
let value = 0;
|
|
33
|
+
let output = "";
|
|
34
|
+
for (let i = 0; i < view.byteLength; i++) {
|
|
35
|
+
value = value << 8 | view.getUint8(i);
|
|
36
|
+
bits += 8;
|
|
37
|
+
while (bits >= 5) {
|
|
38
|
+
output += alphabet[value >>> bits - 5 & 31];
|
|
39
|
+
bits -= 5;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (bits > 0) output += alphabet[value << 5 - bits & 31];
|
|
43
|
+
if (padding) while (output.length % 8 !== 0) output += "=";
|
|
44
|
+
return output;
|
|
51
45
|
}
|
|
52
46
|
|
|
47
|
+
//#endregion
|
|
53
48
|
export { base32Encode };
|
|
54
|
-
//# sourceMappingURL=base32_encode.js.map
|
|
49
|
+
//# sourceMappingURL=base32_encode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base32_encode.js","sources":["../src/base32_encode.ts"],"sourcesContent":["type Data = Int8Array | Uint8Array | Uint8ClampedArray | ArrayBuffer;\n\nfunction toDataView(data: Data) {\n if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray)\n return new DataView(data.buffer, data.byteOffset, data.byteLength);\n\n if (data instanceof ArrayBuffer) return new DataView(data);\n\n throw new TypeError(\n \"Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray\",\n );\n}\n\ninterface Options {\n /** If set, forcefully enable or disable padding. The default behavior is to follow the default of the selected variant. */\n padding?: boolean;\n}\n\nconst RFC4648 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\nconst RFC4648_HEX = \"0123456789ABCDEFGHIJKLMNOPQRSTUV\";\nconst CROCKFORD = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\n\nexport function base32Encode(\n data: Data,\n variant: \"RFC3548\" | \"RFC4648\" | \"RFC4648-HEX\" | \"Crockford\",\n options?: Options,\n) {\n options = options || {};\n let alphabet, defaultPadding;\n\n switch (variant) {\n case \"RFC3548\":\n case \"RFC4648\":\n alphabet = RFC4648;\n defaultPadding = true;\n break;\n case \"RFC4648-HEX\":\n alphabet = RFC4648_HEX;\n defaultPadding = true;\n break;\n case \"Crockford\":\n alphabet = CROCKFORD;\n defaultPadding = false;\n break;\n default:\n throw new Error(\"Unknown base32 variant: \" + String(variant));\n }\n\n const padding = options.padding !== undefined ? options.padding : defaultPadding;\n const view = toDataView(data);\n\n let bits = 0;\n let value = 0;\n let output = \"\";\n\n for (let i = 0; i < view.byteLength; i++) {\n value = (value << 8) | view.getUint8(i);\n bits += 8;\n\n while (bits >= 5) {\n output += alphabet[(value >>> (bits - 5)) & 31];\n bits -= 5;\n }\n }\n\n if (bits > 0) output += alphabet[(value << (5 - bits)) & 31];\n\n if (padding)\n while (output.length % 8 !== 0) {\n output += \"=\";\n }\n\n return output;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"base32_encode.js","names":[],"sources":["../src/base32_encode.ts"],"sourcesContent":["type Data = Int8Array | Uint8Array | Uint8ClampedArray | ArrayBuffer;\n\nfunction toDataView(data: Data) {\n if (data instanceof Int8Array || data instanceof Uint8Array || data instanceof Uint8ClampedArray)\n return new DataView(data.buffer, data.byteOffset, data.byteLength);\n\n if (data instanceof ArrayBuffer) return new DataView(data);\n\n throw new TypeError(\n \"Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray\",\n );\n}\n\ninterface Options {\n /** If set, forcefully enable or disable padding. The default behavior is to follow the default of the selected variant. */\n padding?: boolean;\n}\n\nconst RFC4648 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\nconst RFC4648_HEX = \"0123456789ABCDEFGHIJKLMNOPQRSTUV\";\nconst CROCKFORD = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\n\nexport function base32Encode(\n data: Data,\n variant: \"RFC3548\" | \"RFC4648\" | \"RFC4648-HEX\" | \"Crockford\",\n options?: Options,\n) {\n options = options || {};\n let alphabet, defaultPadding;\n\n switch (variant) {\n case \"RFC3548\":\n case \"RFC4648\":\n alphabet = RFC4648;\n defaultPadding = true;\n break;\n case \"RFC4648-HEX\":\n alphabet = RFC4648_HEX;\n defaultPadding = true;\n break;\n case \"Crockford\":\n alphabet = CROCKFORD;\n defaultPadding = false;\n break;\n default:\n throw new Error(\"Unknown base32 variant: \" + String(variant));\n }\n\n const padding = options.padding !== undefined ? options.padding : defaultPadding;\n const view = toDataView(data);\n\n let bits = 0;\n let value = 0;\n let output = \"\";\n\n for (let i = 0; i < view.byteLength; i++) {\n value = (value << 8) | view.getUint8(i);\n bits += 8;\n\n while (bits >= 5) {\n output += alphabet[(value >>> (bits - 5)) & 31];\n bits -= 5;\n }\n }\n\n if (bits > 0) output += alphabet[(value << (5 - bits)) & 31];\n\n if (padding)\n while (output.length % 8 !== 0) {\n output += \"=\";\n }\n\n return output;\n}\n"],"mappings":";AAEA,SAAS,WAAW,MAAY;AAC9B,KAAI,gBAAgB,aAAa,gBAAgB,cAAc,gBAAgB,kBAC7E,QAAO,IAAI,SAAS,KAAK,QAAQ,KAAK,YAAY,KAAK,WAAW;AAEpE,KAAI,gBAAgB,YAAa,QAAO,IAAI,SAAS,KAAK;AAE1D,OAAM,IAAI,UACR,2FACD;;AAQH,MAAM,UAAU;AAChB,MAAM,cAAc;AACpB,MAAM,YAAY;AAElB,SAAgB,aACd,MACA,SACA,SACA;AACA,WAAU,WAAW,EAAE;CACvB,IAAI,UAAU;AAEd,SAAQ,SAAR;EACE,KAAK;EACL,KAAK;AACH,cAAW;AACX,oBAAiB;AACjB;EACF,KAAK;AACH,cAAW;AACX,oBAAiB;AACjB;EACF,KAAK;AACH,cAAW;AACX,oBAAiB;AACjB;EACF,QACE,OAAM,IAAI,MAAM,6BAA6B,OAAO,QAAQ,CAAC;;CAGjE,MAAM,UAAU,QAAQ,YAAY,SAAY,QAAQ,UAAU;CAClE,MAAM,OAAO,WAAW,KAAK;CAE7B,IAAI,OAAO;CACX,IAAI,QAAQ;CACZ,IAAI,SAAS;AAEb,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,YAAY,KAAK;AACxC,UAAS,SAAS,IAAK,KAAK,SAAS,EAAE;AACvC,UAAQ;AAER,SAAO,QAAQ,GAAG;AAChB,aAAU,SAAU,UAAW,OAAO,IAAM;AAC5C,WAAQ;;;AAIZ,KAAI,OAAO,EAAG,WAAU,SAAU,SAAU,IAAI,OAAS;AAEzD,KAAI,QACF,QAAO,OAAO,SAAS,MAAM,EAC3B,WAAU;AAGd,QAAO"}
|
package/dist/base64.cjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
'use strict';
|
|
2
1
|
|
|
2
|
+
//#region src/base64.ts
|
|
3
3
|
function base64Encode(value) {
|
|
4
|
-
|
|
4
|
+
return Buffer.from(value).toString("base64");
|
|
5
5
|
}
|
|
6
6
|
function base64Decode(value) {
|
|
7
|
-
|
|
7
|
+
return Buffer.from(value, "base64").toString();
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
//#endregion
|
|
10
11
|
exports.base64Decode = base64Decode;
|
|
11
12
|
exports.base64Encode = base64Encode;
|
|
12
|
-
//# sourceMappingURL=base64.cjs.map
|
|
13
|
+
//# sourceMappingURL=base64.cjs.map
|
package/dist/base64.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64.cjs","sources":["../src/base64.ts"],"sourcesContent":["import type { WithImplicitCoercion } from \"node:buffer\";\n\nexport type Base64Compatible<T> =\n T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> =\n Base64Compatible<T> extends never\n ? never\n : string & {\n __base64_encoded: T;\n };\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString(\"base64\") as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, \"base64\").toString() as T;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"base64.cjs","names":[],"sources":["../src/base64.ts"],"sourcesContent":["import type { WithImplicitCoercion } from \"node:buffer\";\n\nexport type Base64Compatible<T> =\n T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> =\n Base64Compatible<T> extends never\n ? never\n : string & {\n __base64_encoded: T;\n };\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString(\"base64\") as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, \"base64\").toString() as T;\n}\n"],"mappings":";;AAYA,SAAgB,aAAgB,OAA8C;AAC5E,QAAO,OAAO,KAAK,MAAM,CAAC,SAAS,SAAS;;AAG9C,SAAgB,aAA+B,OAA4B;AACzE,QAAO,OAAO,KAAK,OAAO,SAAS,CAAC,UAAU"}
|
package/dist/base64.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { WithImplicitCoercion } from "node:buffer";
|
|
2
|
+
|
|
3
|
+
//#region src/base64.d.ts
|
|
4
|
+
type Base64Compatible<T> = T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;
|
|
5
|
+
type Base64Encoded<T = unknown> = Base64Compatible<T> extends never ? never : string & {
|
|
6
|
+
__base64_encoded: T;
|
|
5
7
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
declare function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T>;
|
|
9
|
+
declare function base64Decode<T extends string>(value: Base64Encoded<T>): T;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Base64Compatible, Base64Encoded, base64Decode, base64Encode };
|
|
8
12
|
//# sourceMappingURL=base64.d.ts.map
|
package/dist/base64.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
//#region src/base64.ts
|
|
1
2
|
function base64Encode(value) {
|
|
2
|
-
|
|
3
|
+
return Buffer.from(value).toString("base64");
|
|
3
4
|
}
|
|
4
5
|
function base64Decode(value) {
|
|
5
|
-
|
|
6
|
+
return Buffer.from(value, "base64").toString();
|
|
6
7
|
}
|
|
7
8
|
|
|
9
|
+
//#endregion
|
|
8
10
|
export { base64Decode, base64Encode };
|
|
9
|
-
//# sourceMappingURL=base64.js.map
|
|
11
|
+
//# sourceMappingURL=base64.js.map
|
package/dist/base64.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64.js","sources":["../src/base64.ts"],"sourcesContent":["import type { WithImplicitCoercion } from \"node:buffer\";\n\nexport type Base64Compatible<T> =\n T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> =\n Base64Compatible<T> extends never\n ? never\n : string & {\n __base64_encoded: T;\n };\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString(\"base64\") as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, \"base64\").toString() as T;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"base64.js","names":[],"sources":["../src/base64.ts"],"sourcesContent":["import type { WithImplicitCoercion } from \"node:buffer\";\n\nexport type Base64Compatible<T> =\n T extends WithImplicitCoercion<Uint8Array | readonly number[] | string> ? T : never;\n\nexport type Base64Encoded<T = unknown> =\n Base64Compatible<T> extends never\n ? never\n : string & {\n __base64_encoded: T;\n };\n\nexport function base64Encode<T>(value: Base64Compatible<T>): Base64Encoded<T> {\n return Buffer.from(value).toString(\"base64\") as Base64Encoded<T>;\n}\n\nexport function base64Decode<T extends string>(value: Base64Encoded<T>): T {\n return Buffer.from(value, \"base64\").toString() as T;\n}\n"],"mappings":";AAYA,SAAgB,aAAgB,OAA8C;AAC5E,QAAO,OAAO,KAAK,MAAM,CAAC,SAAS,SAAS;;AAG9C,SAAgB,aAA+B,OAA4B;AACzE,QAAO,OAAO,KAAK,OAAO,SAAS,CAAC,UAAU"}
|
package/dist/block_state.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { StringifiedJson } from "./json";
|
|
1
|
+
import { AuthorMarker } from "./author_marker.js";
|
|
2
|
+
import { BlockOutputsBase } from "./common_types.js";
|
|
3
|
+
import { NavigationState } from "./navigation.js";
|
|
4
|
+
import { StringifiedJson } from "./json.js";
|
|
5
|
+
|
|
6
|
+
//#region src/block_state.d.ts
|
|
5
7
|
/**
|
|
6
8
|
* @template Args sets type of block arguments passed to the workflow
|
|
7
9
|
* @template Outputs type of the outputs returned by the workflow and rendered
|
|
@@ -10,25 +12,21 @@ import { StringifiedJson } from "./json";
|
|
|
10
12
|
* to the workflow
|
|
11
13
|
* @template Href typed href to represent navigation state
|
|
12
14
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/** Current navigation state */
|
|
22
|
-
navigationState: NavigationState<Href>;
|
|
23
|
-
readonly author: AuthorMarker | undefined;
|
|
15
|
+
type BlockState<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> = {
|
|
16
|
+
/** Block arguments passed to the workflow */args: Args;
|
|
17
|
+
/** UI State persisted in the block state but not passed to the backend
|
|
18
|
+
* template */
|
|
19
|
+
ui: UiState; /** Outputs rendered with block config */
|
|
20
|
+
outputs: Outputs; /** Current navigation state */
|
|
21
|
+
navigationState: NavigationState<Href>;
|
|
22
|
+
readonly author: AuthorMarker | undefined;
|
|
24
23
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/** Current navigation state */
|
|
31
|
-
navigationState: NavigationState<Href>;
|
|
32
|
-
readonly author: AuthorMarker | undefined;
|
|
24
|
+
type BlockStateV3<_Data = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, Href extends `/${string}` = `/${string}`> = {
|
|
25
|
+
/** Block storage persisted in the block state */blockStorage: StringifiedJson; /** Outputs rendered with block config */
|
|
26
|
+
outputs: Outputs; /** Current navigation state */
|
|
27
|
+
navigationState: NavigationState<Href>;
|
|
28
|
+
readonly author: AuthorMarker | undefined;
|
|
33
29
|
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { BlockState, BlockStateV3 };
|
|
34
32
|
//# sourceMappingURL=block_state.d.ts.map
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
'use strict';
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
//#region src/bmodel/block_config.ts
|
|
4
3
|
function extractCodeWithInfo(cfg) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
4
|
+
if (cfg.code === void 0) throw new Error("extractCodeWithInfo: No code bundle");
|
|
5
|
+
return {
|
|
6
|
+
code: cfg.code,
|
|
7
|
+
sdkVersion: cfg.sdkVersion,
|
|
8
|
+
featureFlags: cfg.featureFlags
|
|
9
|
+
};
|
|
12
10
|
}
|
|
13
11
|
|
|
12
|
+
//#endregion
|
|
14
13
|
exports.extractCodeWithInfo = extractCodeWithInfo;
|
|
15
|
-
//# sourceMappingURL=block_config.cjs.map
|
|
14
|
+
//# sourceMappingURL=block_config.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_config.cjs","sources":["../../src/bmodel/block_config.ts"],"sourcesContent":["// TODO BroadActiveHandleDescriptor must be removed\n\nimport type { BlockCodeFeatureFlags } from \"../flags\";\nimport type { BlockCodeWithInfo, Code } from \"./code\";\nimport type { BlockRenderingMode } from \"./types\";\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV4Generic<\n _Args = unknown,\n _Data extends Record<string, unknown> = Record<string, unknown>,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<\n string,\n BroadActiveHandleDescriptor\n >,\n> = {\n /** Discriminator to identify config version */\n readonly configVersion: 4;\n\n readonly modelAPIVersion: 2;\n\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Lambda to derive list of sections for the left overview panel */\n readonly sections: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block subtitle, shown below the title */\n readonly subtitle?: NarrowActiveHandleDescriptor;\n\n /** Lambda returning array of tags for search functionality */\n readonly tags?: BroadActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n * */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n\n /** Facade callbacks supported by this block (for pre-execution validation) */\n readonly blockLifecycleCallbacks: Record<string, NarrowActiveHandleDescriptor>;\n};\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV3Generic<\n Args = unknown,\n UiState = unknown,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<\n string,\n BroadActiveHandleDescriptor\n >,\n> = {\n /** Discriminator to identify config version */\n readonly configVersion: 3;\n\n readonly modelAPIVersion: 1;\n\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** Initial value for the args when block is added to the project */\n readonly initialUiState: UiState;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n */\n readonly inputsValid: BroadActiveHandleDescriptor;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: BroadActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block subtitle, shown below the title */\n readonly subtitle?: NarrowActiveHandleDescriptor;\n\n /** Lambda returning array of tags for search functionality */\n readonly tags?: BroadActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\nexport type BlockConfigGeneric = BlockConfigV3Generic | BlockConfigV4Generic;\n\nexport function extractCodeWithInfo(cfg: BlockConfigGeneric): BlockCodeWithInfo {\n if (cfg.code === undefined) throw new Error(\"extractCodeWithInfo: No code bundle\");\n return {\n code: cfg.code,\n sdkVersion: cfg.sdkVersion,\n featureFlags: cfg.featureFlags,\n };\n}\n"],"
|
|
1
|
+
{"version":3,"file":"block_config.cjs","names":[],"sources":["../../src/bmodel/block_config.ts"],"sourcesContent":["// TODO BroadActiveHandleDescriptor must be removed\n\nimport type { BlockCodeFeatureFlags } from \"../flags\";\nimport type { BlockCodeWithInfo, Code } from \"./code\";\nimport type { BlockRenderingMode } from \"./types\";\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV4Generic<\n _Args = unknown,\n _Data extends Record<string, unknown> = Record<string, unknown>,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<\n string,\n BroadActiveHandleDescriptor\n >,\n> = {\n /** Discriminator to identify config version */\n readonly configVersion: 4;\n\n readonly modelAPIVersion: 2;\n\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Lambda to derive list of sections for the left overview panel */\n readonly sections: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block subtitle, shown below the title */\n readonly subtitle?: NarrowActiveHandleDescriptor;\n\n /** Lambda returning array of tags for search functionality */\n readonly tags?: BroadActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n * */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n\n /** Facade callbacks supported by this block (for pre-execution validation) */\n readonly blockLifecycleCallbacks: Record<string, NarrowActiveHandleDescriptor>;\n};\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV3Generic<\n Args = unknown,\n UiState = unknown,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<\n string,\n BroadActiveHandleDescriptor\n >,\n> = {\n /** Discriminator to identify config version */\n readonly configVersion: 3;\n\n readonly modelAPIVersion: 1;\n\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** Initial value for the args when block is added to the project */\n readonly initialUiState: UiState;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n */\n readonly inputsValid: BroadActiveHandleDescriptor;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: BroadActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block subtitle, shown below the title */\n readonly subtitle?: NarrowActiveHandleDescriptor;\n\n /** Lambda returning array of tags for search functionality */\n readonly tags?: BroadActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\nexport type BlockConfigGeneric = BlockConfigV3Generic | BlockConfigV4Generic;\n\nexport function extractCodeWithInfo(cfg: BlockConfigGeneric): BlockCodeWithInfo {\n if (cfg.code === undefined) throw new Error(\"extractCodeWithInfo: No code bundle\");\n return {\n code: cfg.code,\n sdkVersion: cfg.sdkVersion,\n featureFlags: cfg.featureFlags,\n };\n}\n"],"mappings":";;AAmIA,SAAgB,oBAAoB,KAA4C;AAC9E,KAAI,IAAI,SAAS,OAAW,OAAM,IAAI,MAAM,sCAAsC;AAClF,QAAO;EACL,MAAM,IAAI;EACV,YAAY,IAAI;EAChB,cAAc,IAAI;EACnB"}
|
|
@@ -1,83 +1,64 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { BlockCodeFeatureFlags } from "../flags/block_flags.js";
|
|
2
|
+
import { BlockCodeWithInfo, Code } from "./code.js";
|
|
3
|
+
import { BlockRenderingMode } from "./types.js";
|
|
4
|
+
|
|
5
|
+
//#region src/bmodel/block_config.d.ts
|
|
4
6
|
/**
|
|
5
7
|
* BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,
|
|
6
8
|
* NarrowActiveHandleDescriptor = ConfigRenderLambda
|
|
7
9
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* influences dependency graph construction
|
|
27
|
-
* */
|
|
28
|
-
readonly enrichmentTargets?: NarrowActiveHandleDescriptor;
|
|
29
|
-
/** Configuration for the output cells */
|
|
30
|
-
readonly outputs: Outputs;
|
|
31
|
-
/** Config code bundle */
|
|
32
|
-
readonly code?: Code;
|
|
33
|
-
/** Feature flags for the block Model and UI code. */
|
|
34
|
-
readonly featureFlags?: BlockCodeFeatureFlags;
|
|
35
|
-
/** Facade callbacks supported by this block (for pre-execution validation) */
|
|
36
|
-
readonly blockLifecycleCallbacks: Record<string, NarrowActiveHandleDescriptor>;
|
|
10
|
+
type BlockConfigV4Generic<_Args = unknown, _Data extends Record<string, unknown> = Record<string, unknown>, BroadActiveHandleDescriptor = unknown, NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor, Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>> = {
|
|
11
|
+
/** Discriminator to identify config version */readonly configVersion: 4;
|
|
12
|
+
readonly modelAPIVersion: 2; /** SDK version used by the block */
|
|
13
|
+
readonly sdkVersion: string; /** Main rendering mode for the block */
|
|
14
|
+
readonly renderingMode: BlockRenderingMode; /** Lambda to derive list of sections for the left overview panel */
|
|
15
|
+
readonly sections: NarrowActiveHandleDescriptor; /** Lambda to derive block title */
|
|
16
|
+
readonly title?: NarrowActiveHandleDescriptor; /** Lambda to derive block subtitle, shown below the title */
|
|
17
|
+
readonly subtitle?: NarrowActiveHandleDescriptor; /** Lambda returning array of tags for search functionality */
|
|
18
|
+
readonly tags?: BroadActiveHandleDescriptor;
|
|
19
|
+
/**
|
|
20
|
+
* Lambda returning list of upstream blocks this block enriches with its exports,
|
|
21
|
+
* influences dependency graph construction
|
|
22
|
+
* */
|
|
23
|
+
readonly enrichmentTargets?: NarrowActiveHandleDescriptor; /** Configuration for the output cells */
|
|
24
|
+
readonly outputs: Outputs; /** Config code bundle */
|
|
25
|
+
readonly code?: Code; /** Feature flags for the block Model and UI code. */
|
|
26
|
+
readonly featureFlags?: BlockCodeFeatureFlags; /** Facade callbacks supported by this block (for pre-execution validation) */
|
|
27
|
+
readonly blockLifecycleCallbacks: Record<string, NarrowActiveHandleDescriptor>;
|
|
37
28
|
};
|
|
38
29
|
/**
|
|
39
30
|
* BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,
|
|
40
31
|
* NarrowActiveHandleDescriptor = ConfigRenderLambda
|
|
41
32
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
readonly tags?: BroadActiveHandleDescriptor;
|
|
69
|
-
/**
|
|
70
|
-
* Lambda returning list of upstream blocks this block enriches with its exports,
|
|
71
|
-
* influences dependency graph construction
|
|
72
|
-
*/
|
|
73
|
-
readonly enrichmentTargets?: NarrowActiveHandleDescriptor;
|
|
74
|
-
/** Configuration for the output cells */
|
|
75
|
-
readonly outputs: Outputs;
|
|
76
|
-
/** Config code bundle */
|
|
77
|
-
readonly code?: Code;
|
|
78
|
-
/** Feature flags for the block Model and UI code. */
|
|
79
|
-
readonly featureFlags?: BlockCodeFeatureFlags;
|
|
33
|
+
type BlockConfigV3Generic<Args = unknown, UiState = unknown, BroadActiveHandleDescriptor = unknown, NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor, Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>> = {
|
|
34
|
+
/** Discriminator to identify config version */readonly configVersion: 3;
|
|
35
|
+
readonly modelAPIVersion: 1; /** SDK version used by the block */
|
|
36
|
+
readonly sdkVersion: string; /** Main rendering mode for the block */
|
|
37
|
+
readonly renderingMode: BlockRenderingMode; /** Initial value for the args when block is added to the project */
|
|
38
|
+
readonly initialArgs: Args; /** Initial value for the args when block is added to the project */
|
|
39
|
+
readonly initialUiState: UiState;
|
|
40
|
+
/**
|
|
41
|
+
* Config to determine whether the block can be executed with current
|
|
42
|
+
* arguments.
|
|
43
|
+
*
|
|
44
|
+
* Optional to support earlier SDK version configs.
|
|
45
|
+
*/
|
|
46
|
+
readonly inputsValid: BroadActiveHandleDescriptor; /** Configuration to derive list of section for the left overview panel */
|
|
47
|
+
readonly sections: BroadActiveHandleDescriptor; /** Lambda to derive block title */
|
|
48
|
+
readonly title?: NarrowActiveHandleDescriptor; /** Lambda to derive block subtitle, shown below the title */
|
|
49
|
+
readonly subtitle?: NarrowActiveHandleDescriptor; /** Lambda returning array of tags for search functionality */
|
|
50
|
+
readonly tags?: BroadActiveHandleDescriptor;
|
|
51
|
+
/**
|
|
52
|
+
* Lambda returning list of upstream blocks this block enriches with its exports,
|
|
53
|
+
* influences dependency graph construction
|
|
54
|
+
*/
|
|
55
|
+
readonly enrichmentTargets?: NarrowActiveHandleDescriptor; /** Configuration for the output cells */
|
|
56
|
+
readonly outputs: Outputs; /** Config code bundle */
|
|
57
|
+
readonly code?: Code; /** Feature flags for the block Model and UI code. */
|
|
58
|
+
readonly featureFlags?: BlockCodeFeatureFlags;
|
|
80
59
|
};
|
|
81
|
-
|
|
82
|
-
|
|
60
|
+
type BlockConfigGeneric = BlockConfigV3Generic | BlockConfigV4Generic;
|
|
61
|
+
declare function extractCodeWithInfo(cfg: BlockConfigGeneric): BlockCodeWithInfo;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { BlockConfigGeneric, BlockConfigV3Generic, BlockConfigV4Generic, extractCodeWithInfo };
|
|
83
64
|
//# sourceMappingURL=block_config.d.ts.map
|