@milaboratories/pl-model-common 1.11.3 → 1.12.0
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/drivers/pframe/data.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/{anchored_id.d.ts → anchored.d.ts} +20 -13
- package/dist/drivers/pframe/spec/anchored.d.ts.map +1 -0
- package/dist/drivers/pframe/spec/filtered_column.d.ts +31 -0
- package/dist/drivers/pframe/spec/filtered_column.d.ts.map +1 -0
- package/dist/drivers/pframe/spec/ids.d.ts +24 -0
- package/dist/drivers/pframe/spec/ids.d.ts.map +1 -0
- package/dist/drivers/pframe/spec/index.d.ts +3 -1
- package/dist/drivers/pframe/spec/index.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/selectors.d.ts +3 -3
- package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -1
- package/dist/drivers/pframe/spec/spec.d.ts +2 -0
- package/dist/drivers/pframe/spec/spec.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +228 -196
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/drivers/pframe/data.ts +1 -0
- package/src/drivers/pframe/spec/{anchored_id.ts → anchored.ts} +63 -21
- package/src/drivers/pframe/spec/filtered_column.ts +39 -0
- package/src/drivers/pframe/spec/ids.ts +31 -0
- package/src/drivers/pframe/spec/index.ts +3 -1
- package/src/drivers/pframe/spec/selectors.ts +4 -3
- package/src/drivers/pframe/spec/spec.ts +6 -0
- package/dist/drivers/pframe/spec/anchored_id.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/data.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/data.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,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zB,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,eAAoB,GACzB,WAAW,CAwBb;AAED,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,mBAAmB;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,WAAW,GAAG;IACxB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAEhB,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { PColumnSpec } from './spec';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export type CanonicalPColumnId = Branded<string, 'CanonicalPColumnId'>;
|
|
2
|
+
import { AnchoredPColumnId, AnchoredPColumnSelector, PColumnSelector } from './selectors';
|
|
3
|
+
import { AxisFilter } from './filtered_column';
|
|
4
|
+
import { SUniversalPColumnId, UniversalPColumnId } from './ids';
|
|
6
5
|
/**
|
|
7
6
|
* Context for resolving and generating anchored references to columns and axes
|
|
8
7
|
* Maintains maps of known domain values and axes that can be referenced by anchors
|
|
9
8
|
*/
|
|
10
|
-
export declare class
|
|
9
|
+
export declare class AnchoredIdDeriver {
|
|
11
10
|
private readonly anchors;
|
|
12
11
|
private readonly domains;
|
|
13
12
|
private readonly axes;
|
|
@@ -27,24 +26,32 @@ export declare class AnchorIdDeriver {
|
|
|
27
26
|
constructor(anchors: Record<string, PColumnSpec>);
|
|
28
27
|
/**
|
|
29
28
|
* Derives an anchored column identifier from a column specification
|
|
30
|
-
* Replaces domain values and axes with anchored references when possible
|
|
31
29
|
* @param spec Column specification to anchor
|
|
32
30
|
* @returns An anchored column identifier that can be used to identify columns similar to the input specification
|
|
33
31
|
*/
|
|
34
|
-
derive(spec: PColumnSpec):
|
|
32
|
+
derive(spec: PColumnSpec): AnchoredPColumnId;
|
|
33
|
+
/**
|
|
34
|
+
* Derives an anchored column identifier from a column specification
|
|
35
|
+
* @param spec Column specification to anchor
|
|
36
|
+
* @param axisFilters Axis filters to apply to the column
|
|
37
|
+
* @returns An anchored and sliced column identifier that can be used to identify columns similar to the input specification
|
|
38
|
+
*/
|
|
39
|
+
derive(spec: PColumnSpec, axisFilters?: AxisFilter[]): UniversalPColumnId;
|
|
35
40
|
/**
|
|
36
41
|
* Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column
|
|
37
42
|
* @param spec Column specification to anchor
|
|
43
|
+
* @param axisFilters Optional axis filters to apply to the column
|
|
38
44
|
* @returns A canonicalized string representation of the anchored column identifier
|
|
39
45
|
*/
|
|
40
|
-
|
|
46
|
+
deriveS(spec: PColumnSpec, axisFilters?: AxisFilter[]): SUniversalPColumnId;
|
|
41
47
|
}
|
|
42
48
|
/**
|
|
43
|
-
* Resolves anchored references in a column matcher to create a non-anchored matcher
|
|
49
|
+
* Resolves anchored references in a column matcher to create a non-anchored matcher.
|
|
50
|
+
* Doing an opposite operation to {@link AnchorIdDeriver.derive()}.
|
|
44
51
|
*
|
|
45
|
-
* @param anchors - Record of anchor column specifications indexed by anchor
|
|
46
|
-
* @param matcher - An anchored column matcher containing references that need to be resolved
|
|
52
|
+
* @param anchors - Record of anchor column specifications indexed by anchor id
|
|
53
|
+
* @param matcher - An anchored column matcher (or id, which is subtype of it) containing references that need to be resolved
|
|
47
54
|
* @returns A non-anchored column matcher with all references resolved to actual values
|
|
48
55
|
*/
|
|
49
|
-
export declare function resolveAnchors(anchors: Record<string, PColumnSpec>, matcher:
|
|
50
|
-
//# sourceMappingURL=
|
|
56
|
+
export declare function resolveAnchors(anchors: Record<string, PColumnSpec>, matcher: AnchoredPColumnSelector): PColumnSelector;
|
|
57
|
+
//# sourceMappingURL=anchored.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchored.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/spec/anchored.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,WAAW,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,KAAK,EAAoD,iBAAiB,EAAE,uBAAuB,EAAgB,eAAe,EAAE,MAAM,aAAa,CAAC;AAC/J,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAerE;;;GAGG;AACH,qBAAa,iBAAiB;IAiBhB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAhBpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyC;IAC9D;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkB;IAC9C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6B;IAEhE;;;OAGG;gBAC0B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;IAwBjE;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,iBAAiB;IAE5C;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,kBAAkB;IAmFzE;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE,GAAG,mBAAmB;CAG5E;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,uBAAuB,GAAG,eAAe,CAqCtH"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PValue } from '../data';
|
|
2
|
+
import { AnchoredPColumnId } from './selectors';
|
|
3
|
+
/** Axis filter by index */
|
|
4
|
+
export type AxisFilterByIdx = [number, PValue];
|
|
5
|
+
/** Axis filter by name */
|
|
6
|
+
export type AxisFilterByName = [string, PValue];
|
|
7
|
+
/** Axis filter */
|
|
8
|
+
export type AxisFilter = AxisFilterByIdx | AxisFilterByName;
|
|
9
|
+
/**
|
|
10
|
+
* Identifies a column derived from a CanonicalPColumnId by fixing values on certain axes,
|
|
11
|
+
* thus effectively reducing the dimensionality of the original column.
|
|
12
|
+
*/
|
|
13
|
+
export type FilteredPColumn<CID = AnchoredPColumnId, AFI = AxisFilter> = {
|
|
14
|
+
/** The original column identifier */
|
|
15
|
+
source: CID;
|
|
16
|
+
/**
|
|
17
|
+
* List of fixed axes and their corresponding values.
|
|
18
|
+
* Each entry fixes one axis to a specific value, creating a slice of the multidimensional data.
|
|
19
|
+
* This effectively reduces the dimensionality by one for each fixed axis.
|
|
20
|
+
* Ordered by the axis index in canonical case.
|
|
21
|
+
*/
|
|
22
|
+
axisFilters: AFI[];
|
|
23
|
+
};
|
|
24
|
+
export type FilteredPColumnId = FilteredPColumn<AnchoredPColumnId, AxisFilterByIdx>;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if a given value is a FilteredPColumn
|
|
27
|
+
* @param id - The value to check
|
|
28
|
+
* @returns True if the value is a FilteredPColumn, false otherwise
|
|
29
|
+
*/
|
|
30
|
+
export declare function isFilteredPColumn(id: unknown): id is FilteredPColumn;
|
|
31
|
+
//# sourceMappingURL=filtered_column.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filtered_column.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/spec/filtered_column.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,2BAA2B;AAC3B,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C,0BAA0B;AAC1B,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEhD,kBAAkB;AAClB,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAE5D;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,GAAG,GAAG,iBAAiB,EAAE,GAAG,GAAG,UAAU,IAAI;IACvE,qCAAqC;IACrC,MAAM,EAAE,GAAG,CAAC;IAEZ;;;;;OAKG;IACH,WAAW,EAAE,GAAG,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;AAEpF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,eAAe,CAEpE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Branded } from '../../../branding';
|
|
2
|
+
import { AnchoredPColumnId } from './selectors';
|
|
3
|
+
import { FilteredPColumnId } from './filtered_column';
|
|
4
|
+
/**
|
|
5
|
+
* Universal column identifier optionally anchored and optionally filtered.
|
|
6
|
+
*/
|
|
7
|
+
export type UniversalPColumnId = AnchoredPColumnId | FilteredPColumnId;
|
|
8
|
+
/**
|
|
9
|
+
* Canonically serialized {@link UniversalPColumnId}.
|
|
10
|
+
*/
|
|
11
|
+
export type SUniversalPColumnId = Branded<string, 'SUniversalPColumnId'>;
|
|
12
|
+
/**
|
|
13
|
+
* Canonically serializes a {@link UniversalPColumnId} to a string.
|
|
14
|
+
* @param id - The column identifier to serialize
|
|
15
|
+
* @returns The canonically serialized string
|
|
16
|
+
*/
|
|
17
|
+
export declare function stringifyColumnId(id: UniversalPColumnId): SUniversalPColumnId;
|
|
18
|
+
/**
|
|
19
|
+
* Parses a canonically serialized {@link UniversalPColumnId} from a string.
|
|
20
|
+
* @param str - The string to parse
|
|
21
|
+
* @returns The parsed column identifier
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseColumnId(str: SUniversalPColumnId): UniversalPColumnId;
|
|
24
|
+
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/spec/ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;AAEzE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,kBAAkB,GAAG,mBAAmB,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,mBAAmB,GAAG,kBAAkB,CAE1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/spec/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/spec/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
|
|
@@ -86,7 +86,7 @@ export type AnchoredColumnMatchStrategy = 'expectSingle' | 'expectMultiple' | 't
|
|
|
86
86
|
* Matcher for PColumns in an anchored context
|
|
87
87
|
* Supports partial matching on axes, allowing for flexible column discovery
|
|
88
88
|
*/
|
|
89
|
-
export interface
|
|
89
|
+
export interface AnchoredPColumnSelector {
|
|
90
90
|
/** Optional name of the column to match; can't be used together with namePattern */
|
|
91
91
|
name?: string;
|
|
92
92
|
/** Optional regexp pattern for column name matching; can't be used together with name */
|
|
@@ -112,7 +112,7 @@ export interface APColumnSelector {
|
|
|
112
112
|
/**
|
|
113
113
|
* Matcher for PColumns in a non-anchored context
|
|
114
114
|
*/
|
|
115
|
-
export interface PColumnSelector extends
|
|
115
|
+
export interface PColumnSelector extends AnchoredPColumnSelector {
|
|
116
116
|
domainAnchor?: never;
|
|
117
117
|
domain?: Record<string, string>;
|
|
118
118
|
axes?: AxisSelector[];
|
|
@@ -121,7 +121,7 @@ export interface PColumnSelector extends APColumnSelector {
|
|
|
121
121
|
* Strict identifier for PColumns in an anchored context
|
|
122
122
|
* Unlike APColumnMatcher, this requires exact matches on domain and axes
|
|
123
123
|
*/
|
|
124
|
-
export interface
|
|
124
|
+
export interface AnchoredPColumnId extends AnchoredPColumnSelector {
|
|
125
125
|
/** Name is required for exact column identification */
|
|
126
126
|
name: string;
|
|
127
127
|
/** No namePattern in ID */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/spec/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/spec/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAG7D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAE/B;;;OAGG;IACH,IAAI,CA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AQ,EAAE,eAAe,GAAG,OAAO,CAmErF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,oBAAoB,EAAE,eAAe,GAAG,eAAe,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,CAKhI"}
|
|
@@ -118,6 +118,8 @@ export type AxesId = AxisId[];
|
|
|
118
118
|
export declare function getAxisId(spec: AxisSpec): AxisId;
|
|
119
119
|
/** Extracts axes ids from axes spec array from column spec */
|
|
120
120
|
export declare function getAxesId(spec: AxesSpec): AxesId;
|
|
121
|
+
/** Canonicalizes axis id */
|
|
122
|
+
export declare function canonicalizeAxisId(id: AxisId): string;
|
|
121
123
|
/** Returns whether "match" axis id is compatible with the "query" */
|
|
122
124
|
export declare function matchAxisId(query: AxisId, target: AxisId): boolean;
|
|
123
125
|
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/spec/spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../../src/drivers/pframe/spec/spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGrE,wEAAwE;AACxE,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjF;;;;;;;KAOK;AACL,MAAM,WAAW,QAAQ;IACvB,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAEzB,uBAAuB;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;2BACuB;IACvB,QAAQ,CAAC,MAAM,C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AC3C,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE7B,kBAAkB;IAClB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAED,gEAAgE;AAChE,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACnD,oDAAoD;IACpD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,MAAM;IACrB;qCACiC;IACjC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAEzB,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;2BACuB;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED,wBAAwB;AACxB,MAAM,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;AAE9B,uCAAuC;AACvC,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAGhD;AAED,8DAA8D;AAC9D,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAEhD;AAED,4BAA4B;AAC5B,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAErD;AAYD,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAElE"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var G=Object.defineProperty;var Q=(n,t,e)=>t in n?G(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var d=(n,t,e)=>Q(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("canonicalize"),l=require("zod");function Y(n){return n!==void 0&&n.startsWith("log+live://log/")}function w(n){throw new Error("Unexpected object: "+n)}const S="upload://upload/",k="index://index/";function C(n){return n.startsWith(S)}function F(n){return n.startsWith(k)}function $(n){if(F(n)){const t=n.slice(k.length);return JSON.parse(decodeURIComponent(t)).path}else if(C(n)){const t=n.slice(S.length);return JSON.parse(decodeURIComponent(t)).localPath}w(n)}function Z(n){return n.replace(/^.*[\\/]/,"")}function v(n){return Z($(n))}const D=-2147483648,g=-9007199254740991n,O=NaN,U=NaN,R=null,B=null;function p(n,t){switch(t){case"Int":return n===D;case"Long":return n===Number(g)||n===g;case"Float":return n===O;case"Double":return n===U;case"String":return n===R;case"Bytes":return n===B;default:throw Error(`unsupported data type: ${t}`)}}function nn(n){if(!T(n))throw new Error(`Expected not-NA PValue, got ${n}`);return n}function T(n,t){if(!t)return typeof n=="string"||typeof n=="number"&&isFinite(n)||typeof n=="bigint";if(p(n,t))return!1;switch(t){case"Int":return typeof n=="number";case"Long":return typeof n=="number"||typeof n=="bigint";case"Float":return typeof n=="number";case"Double":return typeof n=="number";case"String":return typeof n=="string";case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${t}`)}}function j(n,t){if(!t)return n===null||typeof n=="string"||typeof n=="number"||typeof n=="bigint";if(p(n,t))return!0;switch(t){case"Int":return typeof n=="number";case"Long":return typeof n=="number"||typeof n=="bigint";case"Float":return typeof n=="number";case"Double":return typeof n=="number";case"String":return typeof n=="string";case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${t}`)}}function tn(n){if(n===null||typeof n=="string"||typeof n=="number")return n;if(typeof n=="bigint")return{bigint:n.toString()};throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`)}function L(n,t){if(n===null||typeof n=="string"||typeof n=="number"||typeof n=="bigint"){if(t&&!p(n,t)&&!j(n,t))throw new Error(`Unexpected value type, got ${typeof n}, expected ${t}`);return n}if(typeof n=="object"&&n!==null&&"bigint"in n&&typeof n.bigint=="string"){if(t&&t!=="Long")throw new Error(`Unexpected value type, got serialized bigint, expected ${t}`);return BigInt(n.bigint)}throw new Error(`Unsupported type ${typeof n} (value ${n}).`)}function en(n){if(n=H(n),n===null)throw new Error("Value is null");return n}function H(n){if(n=L(n),n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"){if(!isFinite(n))throw new Error(`Value is not finite (${n})`);return n}if(typeof n=="bigint")return Number(n);throw new Error(`Unexpected value type: ${typeof n}`)}function J(n,t){const e=Math.floor(t/8),r=1<<7-t%8;return(n[e]&r)>0}const M={type:"absent"},_=null;function rn(n){return typeof n=="object"&&n!==null&&n.type==="absent"}function on(n,t,e={}){if(J(n.absent,t))return e.absent===void 0?M:e.absent;const r=n.data[t],o=n.type;if(p(r,o))return e.na===void 0?_:e.na;switch(o){case"Int":return r;case"Long":return Number(r);case"Float":return r;case"Double":return r;case"String":return r;case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${o}`)}}function h(n){const{type:t,name:e,domain:r}=n;return{type:t,name:e,...r&&{domain:r}}}function an(n){return n.map(h)}function sn(n,t){if(n===void 0)return t===void 0;if(t===void 0)return!0;for(const e in t)if(n[e]!==t[e])return!1;return!0}function K(n,t){return n.name===t.name&&sn(n.domain,t.domain)}function un(n,t){return{...n,src:m(n.src,t)}}function m(n,t){switch(n.type){case"column":return{type:"column",column:t(n.column)};case"inner":case"full":return{type:n.type,entries:n.entries.map(e=>m(e,t))};case"outer":return{type:"outer",primary:m(n.primary,t),secondary:n.secondary.map(e=>m(e,t))};default:w(n)}}function I(n){return V(h(n))}function E(n,t){return JSON.stringify([n,t])}class cn{constructor(t){d(this,"domains",new Map);d(this,"axes",new Map);d(this,"domainPacks",[]);d(this,"domainPackToAnchor",new Map);this.anchors=t;const e=Object.entries(t);e.sort((r,o)=>r[0].localeCompare(o[0]));for(const[r,o]of e){for(let i=0;i<o.axesSpec.length;i++){const a=o.axesSpec[i],s=I(a);this.axes.set(s,{anchor:r,idx:i})}if(o.domain!==void 0){const i=Object.entries(o.domain);i.sort((a,s)=>a[0].localeCompare(s[0])),this.domainPackToAnchor.set(JSON.stringify(i),r),this.domainPacks.push(i.map(([a])=>a));for(const[a,s]of i){const c=E(a,s);this.domains.set(c,r)}}}}derive(t){const e={name:t.name,axes:[]};let r;if(t.domain!==void 0)n:for(const o of this.domainPacks){const i=[];for(const s of o){const c=t.domain[s];if(c!==void 0)i.push([s,c]);else break n}const a=this.domainPackToAnchor.get(JSON.stringify(i));if(a!==void 0){e.domainAnchor=a,r=new Set(o);break}}for(const[o,i]of Object.entries(t.domain??{})){if(r!==void 0&&r.has(o))continue;const a=E(o,i),s=this.domains.get(a);e.domain??(e.domain={}),e.domain[o]=s?{anchor:s}:i}return e.axes=t.axesSpec.map(o=>{const i=I(o);return this.axes.get(i)??o}),e}deriveCanonical(t){const e=this.derive(t);return V(e)}}function fn(n,t){const e={...t};if(e.domainAnchor!==void 0){const r=n[e.domainAnchor];if(!r)throw new Error(`Anchor "${e.domainAnchor}" not found`);const o=r.domain||{};e.domain={...o,...e.domain},delete e.domainAnchor}if(e.domain){const r={};for(const[o,i]of Object.entries(e.domain))if(typeof i=="string")r[o]=i;else{const a=n[i.anchor];if(!a)throw new Error(`Anchor "${i.anchor}" not found for domain key "${o}"`);if(!a.domain||a.domain[o]===void 0)throw new Error(`Domain key "${o}" not found in anchor "${i.anchor}"`);r[o]=a.domain[o]}e.domain=r}return e.axes&&(e.axes=e.axes.map(r=>dn(n,r))),e}function dn(n,t){if(!ln(t))return t;const e=t.anchor,r=n[e];if(!r)throw new Error(`Anchor "${e}" not found for axis reference`);if("idx"in t){if(t.idx<0||t.idx>=r.axesSpec.length)throw new Error(`Axis index ${t.idx} out of bounds for anchor "${e}"`);return r.axesSpec[t.idx]}else if("name"in t){const o=r.axesSpec.filter(i=>i.name===t.name);if(o.length>1)throw new Error(`Multiple axes with name "${t.name}" found in anchor "${e}"`);if(o.length===0)throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);return o[0]}else if("id"in t){const o=r.axesSpec.filter(i=>K(t.id,h(i)));if(o.length>1)throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);if(o.length===0)throw new Error(`No matching axis found for matcher in anchor "${e}"`);return o[0]}throw new Error("Unsupported axis reference type")}function ln(n){return typeof n=="object"&&"anchor"in n}function u(n){return n.kind==="PColumn"}function z(n){return u(n.spec)}function mn(n){return u(n.obj)}function pn(n){return u(n.obj.spec)}function hn(n){if(!z(n))throw new Error(`not a PColumn (kind = ${n.spec.kind})`);return n}function yn(n,t){return n===void 0?void 0:{...n,data:t(n.data)}}function bn(n){const t=new Map,e=r=>{switch(r.type){case"column":t.set(r.column.id,r.column);return;case"full":case"inner":for(const o of r.entries)e(o);return;case"outer":e(r.primary);for(const o of r.secondary)e(o);return;default:w(r)}};return e(n),[...t.values()]}function gn(n){throw new Error("Unexpected object: "+n)}function y(n,t){switch(n.type){case"and":for(const e of n.operands)if(!y(e,t))return!1;return!0;case"or":for(const e of n.operands)if(y(e,t))return!0;return!1;case"not":return!y(n.operand,t);case"name":return u(t)&&t.name===n.name;case"name_pattern":return u(t)&&!!t.name.match(n.pattern);case"annotation":return u(t)&&t.annotations!==void 0&&t.annotations[n.annotation]===n.value;case"annotation_pattern":return u(t)&&t.annotations!==void 0&&t.annotations[n.annotation]!==void 0&&!!t.annotations[n.annotation].match(n.pattern);case"has_axes":return u(t)&&n.axes.every(e=>t.axesSpec.some(r=>(e.type===void 0||e.type===r.type)&&(e.name===void 0||e.name===r.name)&&(e.domain===void 0||Object.keys(e.domain).length===0||r.domain!==void 0&&Object.entries(e.domain).every(([o,i])=>r.domain[o]===i))));default:gn(n)}}function P(n,t){if(n.name!==void 0&&n.name!==t.name)return!1;if(n.type!==void 0){if(Array.isArray(n.type)){if(!n.type.includes(t.type))return!1}else if(n.type!==t.type)return!1}if(n.domain!==void 0){const e=t.domain||{};for(const[r,o]of Object.entries(n.domain))if(e[r]!==o)return!1}return!0}function A(n,t){if(t.name!==void 0&&n.name!==t.name||t.namePattern!==void 0&&!new RegExp(t.namePattern).test(n.name))return!1;if(t.type!==void 0){if(Array.isArray(t.type)){if(!t.type.includes(n.valueType))return!1}else if(t.type!==n.valueType)return!1}if(t.domain!==void 0){const e=n.domain||{};for(const[r,o]of Object.entries(t.domain))if(e[r]!==o)return!1}if(t.axes!==void 0){const e=n.axesSpec.map(h);if(t.partialAxesMatch){for(const r of t.axes)if(!e.some(o=>P(r,o)))return!1}else{if(e.length!==t.axes.length)return!1;for(let r=0;r<t.axes.length;r++)if(!P(t.axes[r],e[r]))return!1}}if(t.annotations!==void 0){const e=n.annotations||{};for(const[r,o]of Object.entries(t.annotations))if(e[r]!==o)return!1}if(t.annotationPatterns!==void 0){const e=n.annotations||{};for(const[r,o]of Object.entries(t.annotationPatterns)){const i=e[r];if(i===void 0||!new RegExp(o).test(i))return!1}}return!0}function Pn(n){return Array.isArray(n)?t=>n.some(e=>u(t)&&A(t,e)):t=>u(t)&&A(t,n)}const An={href:"/"},wn=l.z.object({__isRef:l.z.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),blockId:l.z.string().describe("Upstream block id"),name:l.z.string().describe("Name of the output provided to the upstream block's output context")}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").strict().readonly();function xn(n){return typeof n=="object"&&n!==null&&"__isRef"in n&&n.__isRef===!0&&"blockId"in n&&"name"in n}function Nn(n,t){return n.blockId===t.blockId&&n.name===t.name}function In(n,t){return n.ok?{ok:!0,value:t(n.value)}:n}function En(n){if(n instanceof Int8Array||n instanceof Uint8Array||n instanceof Uint8ClampedArray)return new DataView(n.buffer,n.byteOffset,n.byteLength);if(n instanceof ArrayBuffer)return new DataView(n);throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray")}const Vn="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",Sn="0123456789ABCDEFGHIJKLMNOPQRSTUV",kn="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function W(n,t,e){e=e||{};let r,o;switch(t){case"RFC3548":case"RFC4648":r=Vn,o=!0;break;case"RFC4648-HEX":r=Sn,o=!0;break;case"Crockford":r=kn,o=!1;break;default:throw new Error("Unknown base32 variant: "+String(t))}const i=e.padding!==void 0?e.padding:o,a=En(n);let s=0,c=0,f="";for(let b=0;b<a.byteLength;b++)for(c=c<<8|a.getUint8(b),s+=8;s>=5;)f+=r[c>>>s-5&31],s-=5;if(s>0&&(f+=r[c<<5-s&31]),i)for(;f.length%8!==0;)f+="=";return f}const x=15,q=24,N=l.z.string().length(q).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");function Cn(){const n=new Uint8Array(x);return crypto.getRandomValues(n),N.parse(W(n,"RFC4648"))}function X(n){if(n.length!==x)throw new Error(`Wrong number of bytes: ${n.length}`);return N.parse(W(n,"RFC4648"))}async function Fn(n){const t=new TextEncoder,e=await crypto.subtle.digest("SHA-256",t.encode(n));return X(new Uint8Array(e.slice(0,15)))}exports.AnchorIdDeriver=cn;exports.DefaultNavigationState=An;exports.PTableAbsent=M;exports.PTableNA=_;exports.PValueBytesNA=B;exports.PValueDoubleNA=U;exports.PValueFloatNA=O;exports.PValueIntNA=D;exports.PValueLongNA=g;exports.PValueStringNA=R;exports.PlId=N;exports.PlIdBytes=x;exports.PlIdLength=q;exports.PlRef=wn;exports.digestPlId=Fn;exports.ensureNotNAPValue=nn;exports.ensurePColumn=hn;exports.executePSpecPredicate=y;exports.extractAllColumns=bn;exports.getAxesId=an;exports.getAxisId=h;exports.getFileNameFromHandle=v;exports.getFilePathFromHandle=$;exports.isImportFileHandleIndex=F;exports.isImportFileHandleUpload=C;exports.isLiveLog=Y;exports.isNotNAPValue=T;exports.isPColumn=z;exports.isPColumnResult=pn;exports.isPColumnSpec=u;exports.isPColumnSpecResult=mn;exports.isPTableAbsent=rn;exports.isPValue=j;exports.isPlRef=xn;exports.isValueAbsent=J;exports.isValueNA=p;exports.mapJoinEntry=m;exports.mapPObjectData=yn;exports.mapPTableDef=un;exports.mapValueInVOE=In;exports.matchAxis=P;exports.matchAxisId=K;exports.matchPColumn=A;exports.pTableValue=on;exports.pValueToStringOrNumber=en;exports.pValueToStringOrNumberOrNull=H;exports.plId=X;exports.plRefsEqual=Nn;exports.resolveAnchors=fn;exports.safeConvertToPValue=L;exports.selectorsToPredicate=Pn;exports.toJsonSafePValue=tn;exports.uniquePlId=Cn;
|
|
1
|
+
"use strict";var Q=Object.defineProperty;var Y=(n,e,t)=>e in n?Q(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var m=(n,e,t)=>Y(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("canonicalize"),p=require("zod");function Z(n){return n!==void 0&&n.startsWith("log+live://log/")}function x(n){throw new Error("Unexpected object: "+n)}const S="upload://upload/",C="index://index/";function k(n){return n.startsWith(S)}function F(n){return n.startsWith(C)}function $(n){if(F(n)){const e=n.slice(C.length);return JSON.parse(decodeURIComponent(e)).path}else if(k(n)){const e=n.slice(S.length);return JSON.parse(decodeURIComponent(e)).localPath}x(n)}function v(n){return n.replace(/^.*[\\/]/,"")}function nn(n){return v($(n))}const O=-2147483648,g=-9007199254740991n,D=NaN,U=NaN,R=null,B=null;function y(n,e){switch(e){case"Int":return n===O;case"Long":return n===Number(g)||n===g;case"Float":return n===D;case"Double":return n===U;case"String":return n===R;case"Bytes":return n===B;default:throw Error(`unsupported data type: ${e}`)}}function en(n){if(!j(n))throw new Error(`Expected not-NA PValue, got ${n}`);return n}function j(n,e){if(!e)return typeof n=="string"||typeof n=="number"&&isFinite(n)||typeof n=="bigint";if(y(n,e))return!1;switch(e){case"Int":return typeof n=="number";case"Long":return typeof n=="number"||typeof n=="bigint";case"Float":return typeof n=="number";case"Double":return typeof n=="number";case"String":return typeof n=="string";case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${e}`)}}function T(n,e){if(!e)return n===null||typeof n=="string"||typeof n=="number"||typeof n=="bigint";if(y(n,e))return!0;switch(e){case"Int":return typeof n=="number";case"Long":return typeof n=="number"||typeof n=="bigint";case"Float":return typeof n=="number";case"Double":return typeof n=="number";case"String":return typeof n=="string";case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${e}`)}}function tn(n){if(n===null||typeof n=="string"||typeof n=="number")return n;if(typeof n=="bigint")return{bigint:n.toString()};throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`)}function L(n,e){if(n===null||typeof n=="string"||typeof n=="number"||typeof n=="bigint"){if(e&&!y(n,e)&&!T(n,e))throw new Error(`Unexpected value type, got ${typeof n}, expected ${e}`);return n}if(typeof n=="object"&&n!==null&&"bigint"in n&&typeof n.bigint=="string"){if(e&&e!=="Long")throw new Error(`Unexpected value type, got serialized bigint, expected ${e}`);return BigInt(n.bigint)}throw new Error(`Unsupported type ${typeof n} (value ${n}).`)}function rn(n){if(n=H(n),n===null)throw new Error("Value is null");return n}function H(n){if(n=L(n),n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"){if(!isFinite(n))throw new Error(`Value is not finite (${n})`);return n}if(typeof n=="bigint")return Number(n);throw new Error(`Unexpected value type: ${typeof n}`)}function J(n,e){const t=Math.floor(e/8),r=1<<7-e%8;return(n[t]&r)>0}const M={type:"absent"},_=null;function on(n){return typeof n=="object"&&n!==null&&n.type==="absent"}function an(n,e,t={}){if(J(n.absent,e))return t.absent===void 0?M:t.absent;const r=n.data[e],o=n.type;if(y(r,o))return t.na===void 0?_:t.na;switch(o){case"Int":return r;case"Long":return Number(r);case"Float":return r;case"Double":return r;case"String":return r;case"Bytes":throw Error("Bytes not yet supported");default:throw Error(`unsupported data type: ${o}`)}}function l(n){const{type:e,name:t,domain:r}=n;return{type:e,name:t,...r&&{domain:r}}}function sn(n){return n.map(l)}function un(n){return w(l(n))}function cn(n,e){if(n===void 0)return e===void 0;if(e===void 0)return!0;for(const t in e)if(n[t]!==e[t])return!1;return!0}function z(n,e){return n.name===e.name&&cn(n.domain,e.domain)}function fn(n,e){return{...n,src:h(n.src,e)}}function h(n,e){switch(n.type){case"column":return{type:"column",column:e(n.column)};case"inner":case"full":return{type:n.type,entries:n.entries.map(t=>h(t,e))};case"outer":return{type:"outer",primary:h(n.primary,e),secondary:n.secondary.map(t=>h(t,e))};default:x(n)}}function K(n){return w(n)}function dn(n){return JSON.parse(n)}function E(n){return w(l(n))}function V(n,e){return JSON.stringify([n,e])}class ln{constructor(e){m(this,"domains",new Map);m(this,"axes",new Map);m(this,"domainPacks",[]);m(this,"domainPackToAnchor",new Map);this.anchors=e;const t=Object.entries(e);t.sort((r,o)=>r[0].localeCompare(o[0]));for(const[r,o]of t){for(let i=0;i<o.axesSpec.length;i++){const s=o.axesSpec[i],a=E(s);this.axes.set(a,{anchor:r,idx:i})}if(o.domain!==void 0){const i=Object.entries(o.domain);i.sort((s,a)=>s[0].localeCompare(a[0])),this.domainPackToAnchor.set(JSON.stringify(i),r),this.domainPacks.push(i.map(([s])=>s));for(const[s,a]of i){const u=V(s,a);this.domains.set(u,r)}}}}derive(e,t){const r={name:e.name,axes:[]};let o;if(e.domain!==void 0)n:for(const s of this.domainPacks){const a=[];for(const c of s){const d=e.domain[c];if(d!==void 0)a.push([c,d]);else break n}const u=this.domainPackToAnchor.get(JSON.stringify(a));if(u!==void 0){r.domainAnchor=u,o=new Set(s);break}}for(const[s,a]of Object.entries(e.domain??{})){if(o!==void 0&&o.has(s))continue;const u=V(s,a),c=this.domains.get(u);r.domain??(r.domain={}),r.domain[s]=c?{anchor:c}:a}if(r.axes=e.axesSpec.map(s=>{const a=E(s);return this.axes.get(a)??s}),!t||t.length===0)return r;const i=[];for(const s of t){const[a,u]=s;if(typeof a=="number"){if(a<0||a>=e.axesSpec.length)throw new Error(`Axis index ${a} is out of bounds (0-${e.axesSpec.length-1})`);i.push([a,u])}else{const c=e.axesSpec.findIndex(d=>d.name===a);if(c===-1)throw new Error(`Axis with name "${a}" not found in the column specification`);i.push([c,u])}}return i.sort((s,a)=>s[0]-a[0]),{source:r,axisFilters:i}}deriveS(e,t){return K(this.derive(e,t))}}function mn(n,e){const t={...e};if(t.domainAnchor!==void 0){const r=n[t.domainAnchor];if(!r)throw new Error(`Anchor "${t.domainAnchor}" not found`);const o=r.domain||{};t.domain={...o,...t.domain},delete t.domainAnchor}if(t.domain){const r={};for(const[o,i]of Object.entries(t.domain))if(typeof i=="string")r[o]=i;else{const s=n[i.anchor];if(!s)throw new Error(`Anchor "${i.anchor}" not found for domain key "${o}"`);if(!s.domain||s.domain[o]===void 0)throw new Error(`Domain key "${o}" not found in anchor "${i.anchor}"`);r[o]=s.domain[o]}t.domain=r}return t.axes&&(t.axes=t.axes.map(r=>pn(n,r))),t}function pn(n,e){if(!hn(e))return e;const t=e.anchor,r=n[t];if(!r)throw new Error(`Anchor "${t}" not found for axis reference`);if("idx"in e){if(e.idx<0||e.idx>=r.axesSpec.length)throw new Error(`Axis index ${e.idx} out of bounds for anchor "${t}"`);return r.axesSpec[e.idx]}else if("name"in e){const o=r.axesSpec.filter(i=>i.name===e.name);if(o.length>1)throw new Error(`Multiple axes with name "${e.name}" found in anchor "${t}"`);if(o.length===0)throw new Error(`Axis with name "${e.name}" not found in anchor "${t}"`);return o[0]}else if("id"in e){const o=r.axesSpec.filter(i=>z(e.id,l(i)));if(o.length>1)throw new Error(`Multiple matching axes found for matcher in anchor "${t}"`);if(o.length===0)throw new Error(`No matching axis found for matcher in anchor "${t}"`);return o[0]}throw new Error("Unsupported axis reference type")}function hn(n){return typeof n=="object"&&"anchor"in n}function yn(n){return typeof n=="object"&&n!==null&&"source"in n&&"axisFilters"in n}function f(n){return n.kind==="PColumn"}function W(n){return f(n.spec)}function bn(n){return f(n.obj)}function gn(n){return f(n.obj.spec)}function An(n){if(!W(n))throw new Error(`not a PColumn (kind = ${n.spec.kind})`);return n}function Pn(n,e){return n===void 0?void 0:{...n,data:e(n.data)}}function wn(n){const e=new Map,t=r=>{switch(r.type){case"column":e.set(r.column.id,r.column);return;case"full":case"inner":for(const o of r.entries)t(o);return;case"outer":t(r.primary);for(const o of r.secondary)t(o);return;default:x(r)}};return t(n),[...e.values()]}function xn(n){throw new Error("Unexpected object: "+n)}function b(n,e){switch(n.type){case"and":for(const t of n.operands)if(!b(t,e))return!1;return!0;case"or":for(const t of n.operands)if(b(t,e))return!0;return!1;case"not":return!b(n.operand,e);case"name":return f(e)&&e.name===n.name;case"name_pattern":return f(e)&&!!e.name.match(n.pattern);case"annotation":return f(e)&&e.annotations!==void 0&&e.annotations[n.annotation]===n.value;case"annotation_pattern":return f(e)&&e.annotations!==void 0&&e.annotations[n.annotation]!==void 0&&!!e.annotations[n.annotation].match(n.pattern);case"has_axes":return f(e)&&n.axes.every(t=>e.axesSpec.some(r=>(t.type===void 0||t.type===r.type)&&(t.name===void 0||t.name===r.name)&&(t.domain===void 0||Object.keys(t.domain).length===0||r.domain!==void 0&&Object.entries(t.domain).every(([o,i])=>r.domain[o]===i))));default:xn(n)}}function A(n,e){if(n.name!==void 0&&n.name!==e.name)return!1;if(n.type!==void 0){if(Array.isArray(n.type)){if(!n.type.includes(e.type))return!1}else if(n.type!==e.type)return!1}if(n.domain!==void 0){const t=e.domain||{};for(const[r,o]of Object.entries(n.domain))if(t[r]!==o)return!1}return!0}function P(n,e){if(e.name!==void 0&&n.name!==e.name||e.namePattern!==void 0&&!new RegExp(e.namePattern).test(n.name))return!1;if(e.type!==void 0){if(Array.isArray(e.type)){if(!e.type.includes(n.valueType))return!1}else if(e.type!==n.valueType)return!1}if(e.domain!==void 0){const t=n.domain||{};for(const[r,o]of Object.entries(e.domain))if(t[r]!==o)return!1}if(e.axes!==void 0){const t=n.axesSpec.map(l);if(e.partialAxesMatch){for(const r of e.axes)if(!t.some(o=>A(r,o)))return!1}else{if(t.length!==e.axes.length)return!1;for(let r=0;r<e.axes.length;r++)if(!A(e.axes[r],t[r]))return!1}}if(e.annotations!==void 0){const t=n.annotations||{};for(const[r,o]of Object.entries(e.annotations))if(t[r]!==o)return!1}if(e.annotationPatterns!==void 0){const t=n.annotations||{};for(const[r,o]of Object.entries(e.annotationPatterns)){const i=t[r];if(i===void 0||!new RegExp(o).test(i))return!1}}return!0}function In(n){return Array.isArray(n)?e=>n.some(t=>f(e)&&P(e,t)):e=>f(e)&&P(e,n)}const Nn={href:"/"},En=p.z.object({__isRef:p.z.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),blockId:p.z.string().describe("Upstream block id"),name:p.z.string().describe("Name of the output provided to the upstream block's output context")}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").strict().readonly();function Vn(n){return typeof n=="object"&&n!==null&&"__isRef"in n&&n.__isRef===!0&&"blockId"in n&&"name"in n}function Sn(n,e){return n.blockId===e.blockId&&n.name===e.name}function Cn(n,e){return n.ok?{ok:!0,value:e(n.value)}:n}function kn(n){if(n instanceof Int8Array||n instanceof Uint8Array||n instanceof Uint8ClampedArray)return new DataView(n.buffer,n.byteOffset,n.byteLength);if(n instanceof ArrayBuffer)return new DataView(n);throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray")}const Fn="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",$n="0123456789ABCDEFGHIJKLMNOPQRSTUV",On="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function q(n,e,t){t=t||{};let r,o;switch(e){case"RFC3548":case"RFC4648":r=Fn,o=!0;break;case"RFC4648-HEX":r=$n,o=!0;break;case"Crockford":r=On,o=!1;break;default:throw new Error("Unknown base32 variant: "+String(e))}const i=t.padding!==void 0?t.padding:o,s=kn(n);let a=0,u=0,c="";for(let d=0;d<s.byteLength;d++)for(u=u<<8|s.getUint8(d),a+=8;a>=5;)c+=r[u>>>a-5&31],a-=5;if(a>0&&(c+=r[u<<5-a&31]),i)for(;c.length%8!==0;)c+="=";return c}const I=15,X=24,N=p.z.string().length(X).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");function Dn(){const n=new Uint8Array(I);return crypto.getRandomValues(n),N.parse(q(n,"RFC4648"))}function G(n){if(n.length!==I)throw new Error(`Wrong number of bytes: ${n.length}`);return N.parse(q(n,"RFC4648"))}async function Un(n){const e=new TextEncoder,t=await crypto.subtle.digest("SHA-256",e.encode(n));return G(new Uint8Array(t.slice(0,15)))}exports.AnchoredIdDeriver=ln;exports.DefaultNavigationState=Nn;exports.PTableAbsent=M;exports.PTableNA=_;exports.PValueBytesNA=B;exports.PValueDoubleNA=U;exports.PValueFloatNA=D;exports.PValueIntNA=O;exports.PValueLongNA=g;exports.PValueStringNA=R;exports.PlId=N;exports.PlIdBytes=I;exports.PlIdLength=X;exports.PlRef=En;exports.canonicalizeAxisId=un;exports.digestPlId=Un;exports.ensureNotNAPValue=en;exports.ensurePColumn=An;exports.executePSpecPredicate=b;exports.extractAllColumns=wn;exports.getAxesId=sn;exports.getAxisId=l;exports.getFileNameFromHandle=nn;exports.getFilePathFromHandle=$;exports.isFilteredPColumn=yn;exports.isImportFileHandleIndex=F;exports.isImportFileHandleUpload=k;exports.isLiveLog=Z;exports.isNotNAPValue=j;exports.isPColumn=W;exports.isPColumnResult=gn;exports.isPColumnSpec=f;exports.isPColumnSpecResult=bn;exports.isPTableAbsent=on;exports.isPValue=T;exports.isPlRef=Vn;exports.isValueAbsent=J;exports.isValueNA=y;exports.mapJoinEntry=h;exports.mapPObjectData=Pn;exports.mapPTableDef=fn;exports.mapValueInVOE=Cn;exports.matchAxis=A;exports.matchAxisId=z;exports.matchPColumn=P;exports.pTableValue=an;exports.pValueToStringOrNumber=rn;exports.pValueToStringOrNumberOrNull=H;exports.parseColumnId=dn;exports.plId=G;exports.plRefsEqual=Sn;exports.resolveAnchors=mn;exports.safeConvertToPValue=L;exports.selectorsToPredicate=In;exports.stringifyColumnId=K;exports.toJsonSafePValue=tn;exports.uniquePlId=Dn;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|