@milaboratories/pl-model-common 1.25.3 → 1.26.1
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/linker_columns.cjs +2 -5
- package/dist/drivers/pframe/linker_columns.cjs.map +1 -1
- package/dist/drivers/pframe/linker_columns.js +2 -5
- package/dist/drivers/pframe/linker_columns.js.map +1 -1
- package/dist/drivers/pframe/query/query_spec.d.ts +2 -2
- package/dist/drivers/pframe/spec/anchored.cjs +58 -0
- package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
- package/dist/drivers/pframe/spec/anchored.d.ts +3 -0
- package/dist/drivers/pframe/spec/anchored.js +58 -0
- package/dist/drivers/pframe/spec/anchored.js.map +1 -1
- package/dist/drivers/pframe/spec/native_id.cjs +1 -0
- package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
- package/dist/drivers/pframe/spec/native_id.js +1 -0
- package/dist/drivers/pframe/spec/native_id.js.map +1 -1
- package/dist/drivers/pframe/spec/selectors.cjs +8 -0
- package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
- package/dist/drivers/pframe/spec/selectors.d.ts +13 -0
- package/dist/drivers/pframe/spec/selectors.js +8 -0
- package/dist/drivers/pframe/spec/selectors.js.map +1 -1
- package/dist/drivers/pframe/spec/spec.cjs +7 -2
- package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
- package/dist/drivers/pframe/spec/spec.d.ts +13 -1
- package/dist/drivers/pframe/spec/spec.js +7 -2
- package/dist/drivers/pframe/spec/spec.js.map +1 -1
- package/dist/pool/query.cjs +1 -1
- package/dist/pool/query.cjs.map +1 -1
- package/dist/pool/query.js +1 -1
- package/dist/pool/query.js.map +1 -1
- package/dist/pool/spec.cjs.map +1 -1
- package/dist/pool/spec.d.ts +4 -1
- package/dist/pool/spec.js.map +1 -1
- package/package.json +3 -3
- package/src/drivers/pframe/linker_columns.test.ts +22 -3
- package/src/drivers/pframe/linker_columns.ts +2 -2
- package/src/drivers/pframe/query/query_spec.ts +2 -2
- package/src/drivers/pframe/query/utils.test.ts +2 -2
- package/src/drivers/pframe/spec/anchored.ts +73 -0
- package/src/drivers/pframe/spec/native_id.ts +1 -0
- package/src/drivers/pframe/spec/selectors.ts +28 -0
- package/src/drivers/pframe/spec/spec.ts +33 -3
- package/src/pool/query.ts +6 -0
- package/src/pool/spec.ts +4 -0
|
@@ -312,6 +312,10 @@ export type AxisSpec = {
|
|
|
312
312
|
* unique identifier */
|
|
313
313
|
readonly domain?: Record<string, string>;
|
|
314
314
|
|
|
315
|
+
/** Context domain provides additional axis identity that is matched
|
|
316
|
+
* by kinship rules (subset/superset/overlap) rather than exact equality */
|
|
317
|
+
readonly contextDomain?: Record<string, string>;
|
|
318
|
+
|
|
315
319
|
/** Any additional information attached to the axis that does not affect its
|
|
316
320
|
* identifier */
|
|
317
321
|
readonly annotations?: Record<string, string>;
|
|
@@ -421,6 +425,12 @@ function normalizingAxesComparator(
|
|
|
421
425
|
return domain1 < domain2 ? 1 : -1;
|
|
422
426
|
}
|
|
423
427
|
|
|
428
|
+
const contextDomain1 = canonicalizeJson(axis1.contextDomain ?? {});
|
|
429
|
+
const contextDomain2 = canonicalizeJson(axis2.contextDomain ?? {});
|
|
430
|
+
if (contextDomain1 !== contextDomain2) {
|
|
431
|
+
return contextDomain1 < contextDomain2 ? 1 : -1;
|
|
432
|
+
}
|
|
433
|
+
|
|
424
434
|
const parents1 = canonicalizeAxisWithParents(axis1);
|
|
425
435
|
const parents2 = canonicalizeAxisWithParents(axis2);
|
|
426
436
|
|
|
@@ -592,6 +602,10 @@ export type PUniversalColumnSpec = PObjectSpec & {
|
|
|
592
602
|
* unique identifier */
|
|
593
603
|
readonly domain?: Record<string, string>;
|
|
594
604
|
|
|
605
|
+
/** Context domain provides additional column identity that is matched
|
|
606
|
+
* by kinship rules (subset/superset/overlap) rather than exact equality */
|
|
607
|
+
readonly contextDomain?: Record<string, string>;
|
|
608
|
+
|
|
595
609
|
/** Any additional information attached to the column that does not affect its
|
|
596
610
|
* identifier */
|
|
597
611
|
readonly annotations?: Record<string, string>;
|
|
@@ -635,6 +649,10 @@ export type PColumnSpecId = {
|
|
|
635
649
|
* unique identifier */
|
|
636
650
|
readonly domain?: Record<string, string>;
|
|
637
651
|
|
|
652
|
+
/** Context domain provides additional column identity that is matched
|
|
653
|
+
* by kinship rules (subset/superset/overlap) rather than exact equality */
|
|
654
|
+
readonly contextDomain?: Record<string, string>;
|
|
655
|
+
|
|
638
656
|
/** A list of zero-based indices of parent axes from the {@link axesSpec} array. */
|
|
639
657
|
readonly parentAxes?: number[];
|
|
640
658
|
|
|
@@ -648,6 +666,7 @@ export function getPColumnSpecId(spec: PColumnSpec): PColumnSpecId {
|
|
|
648
666
|
valueType: spec.valueType,
|
|
649
667
|
name: spec.name,
|
|
650
668
|
domain: spec.domain,
|
|
669
|
+
contextDomain: spec.contextDomain,
|
|
651
670
|
parentAxes: spec.parentAxes,
|
|
652
671
|
axesId: getAxesId(spec.axesSpec),
|
|
653
672
|
};
|
|
@@ -695,6 +714,10 @@ export interface AxisId {
|
|
|
695
714
|
/** Adds auxiliary information to the axis or column name and type to form a
|
|
696
715
|
* unique identifier */
|
|
697
716
|
readonly domain?: Record<string, string>;
|
|
717
|
+
|
|
718
|
+
/** Context domain provides additional axis identity that is matched
|
|
719
|
+
* by kinship rules (subset/superset/overlap) rather than exact equality */
|
|
720
|
+
readonly contextDomain?: Record<string, string>;
|
|
698
721
|
}
|
|
699
722
|
|
|
700
723
|
/** Array of axis ids */
|
|
@@ -702,11 +725,14 @@ export type AxesId = AxisId[];
|
|
|
702
725
|
|
|
703
726
|
/** Extracts axis ids from axis spec */
|
|
704
727
|
export function getAxisId(spec: AxisSpec): AxisId {
|
|
705
|
-
const { type, name, domain } = spec;
|
|
706
|
-
const result = { type, name };
|
|
728
|
+
const { type, name, domain, contextDomain } = spec;
|
|
729
|
+
const result: AxisId = { type, name };
|
|
707
730
|
if (domain && Object.entries(domain).length > 0) {
|
|
708
731
|
Object.assign(result, { domain });
|
|
709
732
|
}
|
|
733
|
+
if (contextDomain && Object.entries(contextDomain).length > 0) {
|
|
734
|
+
Object.assign(result, { contextDomain });
|
|
735
|
+
}
|
|
710
736
|
return result;
|
|
711
737
|
}
|
|
712
738
|
|
|
@@ -732,7 +758,11 @@ function matchDomain(query?: Record<string, string>, target?: Record<string, str
|
|
|
732
758
|
|
|
733
759
|
/** Returns whether "match" axis id is compatible with the "query" */
|
|
734
760
|
export function matchAxisId(query: AxisId, target: AxisId): boolean {
|
|
735
|
-
return
|
|
761
|
+
return (
|
|
762
|
+
query.name === target.name &&
|
|
763
|
+
matchDomain(query.domain, target.domain) &&
|
|
764
|
+
matchDomain(query.contextDomain, target.contextDomain)
|
|
765
|
+
);
|
|
736
766
|
}
|
|
737
767
|
|
|
738
768
|
export function getTypeFromPColumnOrAxisSpec(spec: PColumnSpec | AxisSpec): ValueType {
|
package/src/pool/query.ts
CHANGED
|
@@ -80,6 +80,12 @@ export function executePSpecPredicate(predicate: PSpecPredicate, spec: PObjectSp
|
|
|
80
80
|
(axisSpec.domain !== undefined &&
|
|
81
81
|
Object.entries(matcher.domain).every(
|
|
82
82
|
([domain, domainValue]) => axisSpec.domain![domain] === domainValue,
|
|
83
|
+
))) &&
|
|
84
|
+
(matcher.contextDomain === undefined ||
|
|
85
|
+
Object.keys(matcher.contextDomain).length === 0 ||
|
|
86
|
+
(axisSpec.contextDomain !== undefined &&
|
|
87
|
+
Object.entries(matcher.contextDomain).every(
|
|
88
|
+
([key, value]) => axisSpec.contextDomain![key] === value,
|
|
83
89
|
))),
|
|
84
90
|
),
|
|
85
91
|
)
|
package/src/pool/spec.ts
CHANGED
|
@@ -14,6 +14,10 @@ export type PObjectSpec = {
|
|
|
14
14
|
/** Domain is a set of key-value pairs that can be used to identify the object */
|
|
15
15
|
readonly domain?: Record<string, string>;
|
|
16
16
|
|
|
17
|
+
/** Context domain provides additional axis/column identity that is matched
|
|
18
|
+
* by kinship rules (subset/superset/overlap) rather than exact equality */
|
|
19
|
+
readonly contextDomain?: Record<string, string>;
|
|
20
|
+
|
|
17
21
|
/** Additional information attached to the object */
|
|
18
22
|
readonly annotations?: Record<string, string>;
|
|
19
23
|
};
|