@uwdata/mosaic-core 0.7.1 → 0.9.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.
@@ -2,7 +2,8 @@ export function queryResult() {
2
2
  let resolve;
3
3
  let reject;
4
4
  const p = new Promise((r, e) => { resolve = r; reject = e; });
5
- p.fulfill = value => (resolve(value), p);
6
- p.reject = err => (reject(err), p);
7
- return p;
5
+ return Object.assign(p, {
6
+ fulfill: value => (resolve(value), p),
7
+ reject: err => (reject(err), p)
8
+ });
8
9
  }
@@ -0,0 +1,137 @@
1
+ import { SQLExpression } from '@uwdata/mosaic-sql';
2
+ import { MosaicClient } from '../MosaicClient.js';
3
+
4
+ /**
5
+ * Selection clause metadata to guide possible query optimizations.
6
+ * Sub-interfaces provide more information about the specifics of a
7
+ * given selection based on the selection type.
8
+ */
9
+ export interface ClauseMetadata {
10
+ /**
11
+ * The selection type, such as `'point'`, `'interval'`, or `'match'`.
12
+ */
13
+ type: string;
14
+ }
15
+
16
+ /**
17
+ * Selection clause metadata indicating selection of one or more discrete
18
+ * point values, typically based on equality or is distinctiveness checks.
19
+ */
20
+ export interface PointMetadata extends ClauseMetadata {
21
+ type: 'point';
22
+ }
23
+
24
+ /** Text search matching methods. */
25
+ export type MatchMethod =
26
+ | 'contains'
27
+ | 'prefix'
28
+ | 'suffix'
29
+ | 'regexp'
30
+ | (string & {});
31
+
32
+ /**
33
+ * Selection clause metadata indicating text search matching.
34
+ */
35
+ export interface MatchMetadata extends ClauseMetadata {
36
+ type: MatchMethod;
37
+ /** The text search matching method used. */
38
+ method?: 'contains' | 'prefix' | 'suffix' | 'regexp' | (string & {});
39
+ }
40
+
41
+ /** Quantitative scale types. */
42
+ export type ScaleType =
43
+ | 'identity'
44
+ | 'linear'
45
+ | 'log'
46
+ | 'sqrt'
47
+ | 'pow'
48
+ | 'symlog'
49
+ | 'time'
50
+ | 'utc';
51
+
52
+ /** A data value interval extent. */
53
+ export type Extent = [number, number] | [Date, Date];
54
+
55
+ /**
56
+ * Descriptor for a scale that maps a data domain to screen pixels.
57
+ */
58
+ export interface Scale {
59
+ /** The scale type, such as `'linear'`, `'log'`, etc. */
60
+ type: ScaleType;
61
+ /** The scale domain, as an array of start and end data values. */
62
+ domain: Extent;
63
+ /**
64
+ * The scale range, as an array of start and end screen pixels.
65
+ * The range may be omitted for *identity* scales.
66
+ */
67
+ range?: [number, number];
68
+ /** The base of the logarithm. For `'log'` scales only. */
69
+ base?: number;
70
+ /** The constant parameter. For `'symlog'` scales only. */
71
+ constant?: number;
72
+ /** The exponent parameter. For `'pow'` scales only. */
73
+ exponent?: number;
74
+ }
75
+
76
+ /** A binning method name. */
77
+ export type BinMethod = 'floor' | 'ceil' | 'round';
78
+
79
+ /**
80
+ * Selection clause metadata for one or more selected intervals. This
81
+ * metadata can be used to determine appropriate data-space binning
82
+ * schemes that correspond to pixel-level bins in screen space.
83
+ */
84
+ export interface IntervalMetadata extends ClauseMetadata {
85
+ type: 'interval';
86
+ /**
87
+ * The interactive pixel size used by the generating component.
88
+ * Values larger than one indicate intervals that "snap-to" values
89
+ * greater than a single pixel. If unspecified, assumed to be `1`.
90
+ */
91
+ pixelSize?: number;
92
+ /**
93
+ * An array of one or more scale descriptors that describe the
94
+ * mapping from data values to screen pixels.
95
+ */
96
+ scales?: Scale[];
97
+ /**
98
+ * A hint for the binning method to use when discretizing the
99
+ * interval domain. If unspecified, the default is `'floor'`.
100
+ */
101
+ bin?: BinMethod
102
+ }
103
+
104
+ /**
105
+ * A selection clause representing filtering criteria
106
+ * to apply within a Mosiac Selection.
107
+ */
108
+ export interface SelectionClause {
109
+ /**
110
+ * A unique identifier (according to object equality) for the source
111
+ * component that generated this clause. In many cases, this is a
112
+ * reference to the originating component itself.
113
+ */
114
+ source: any;
115
+ /**
116
+ * A set of Mosaic clients associated with this clause that should not
117
+ * be updated when this clause is applied in a cross-filtering context.
118
+ */
119
+ clients?: Set<MosaicClient>;
120
+ /**
121
+ * A selected value associated with this clause. For example, for a 1D
122
+ * interval selection clause the value may be a [lo, hi] array.
123
+ */
124
+ value: any;
125
+ /**
126
+ * A predicate SQL expression suitable for use in a query WHERE clause.
127
+ * The predicate should apply filtering criteria consistent with this
128
+ * clause's *value* property.
129
+ */
130
+ predicate: SQLExpression | null;
131
+ /**
132
+ * Optional clause metadata that varies based on the selection type.
133
+ * The metadata can be used to optimize selection queries, for example
134
+ * by creating pre-aggregated data cubes when applicable.
135
+ */
136
+ meta?: ClauseMetadata;
137
+ }