@uwdata/mosaic-core 0.16.1 → 0.17.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.
Files changed (41) hide show
  1. package/package.json +7 -11
  2. package/src/Coordinator.js +0 -24
  3. package/src/index-types.ts +1 -0
  4. package/src/preagg/sufficient-statistics.js +1 -0
  5. package/tsconfig.json +6 -8
  6. package/LICENSE +0 -47
  7. package/dist/types/Coordinator.d.ts +0 -164
  8. package/dist/types/MosaicClient.d.ts +0 -143
  9. package/dist/types/Param.d.ts +0 -47
  10. package/dist/types/QueryConsolidator.d.ts +0 -9
  11. package/dist/types/QueryManager.d.ts +0 -91
  12. package/dist/types/Selection.d.ts +0 -235
  13. package/dist/types/SelectionClause.d.ts +0 -105
  14. package/dist/types/connectors/Connector.d.ts +0 -25
  15. package/dist/types/connectors/rest.d.ts +0 -13
  16. package/dist/types/connectors/socket.d.ts +0 -100
  17. package/dist/types/connectors/wasm.d.ts +0 -135
  18. package/dist/types/index-types.d.ts +0 -4
  19. package/dist/types/index.d.ts +0 -19
  20. package/dist/types/make-client.d.ts +0 -78
  21. package/dist/types/preagg/PreAggregator.d.ts +0 -180
  22. package/dist/types/preagg/preagg-columns.d.ts +0 -14
  23. package/dist/types/preagg/sufficient-statistics.d.ts +0 -13
  24. package/dist/types/types.d.ts +0 -63
  25. package/dist/types/util/AsyncDispatch.d.ts +0 -100
  26. package/dist/types/util/cache.d.ts +0 -17
  27. package/dist/types/util/decode-ipc.d.ts +0 -12
  28. package/dist/types/util/distinct.d.ts +0 -2
  29. package/dist/types/util/field-info.d.ts +0 -23
  30. package/dist/types/util/hash.d.ts +0 -1
  31. package/dist/types/util/is-activatable.d.ts +0 -6
  32. package/dist/types/util/is-arrow-table.d.ts +0 -8
  33. package/dist/types/util/js-type.d.ts +0 -7
  34. package/dist/types/util/priority-queue.d.ts +0 -37
  35. package/dist/types/util/query-result.d.ts +0 -44
  36. package/dist/types/util/selection-types.d.ts +0 -114
  37. package/dist/types/util/synchronizer.d.ts +0 -29
  38. package/dist/types/util/throttle.d.ts +0 -13
  39. package/dist/types/util/to-data-columns.d.ts +0 -29
  40. package/dist/types/util/void-logger.d.ts +0 -10
  41. package/jsconfig.json +0 -11
@@ -1,78 +0,0 @@
1
- /**
2
- * @typedef {Object} MakeClientOptions
3
- * @property {Coordinator} [coordinator] Mosaic coordinator.
4
- * Defaults to the global coordinator.
5
- * @property {Selection|null} [selection] A selection whose predicates are
6
- * fed into the query function to produce the SQL query.
7
- * @property {boolean} [enabled] A flag (default `true`) indicating if the
8
- * client should initially be enabled or not.
9
- * @property {boolean} [filterStable] A flag (default `true`) indicating if the
10
- * if client queries can be sped up using pre-aggregated data. Should be set
11
- * to `false` if filtering changes the groupby domain of the query.
12
- * @property {function(): Promise<void>} [prepare]
13
- * An async function to prepare the client before running queries.
14
- * @property {function(any): any} [query]
15
- * A function that returns a query from a list of selection predicates.
16
- * @property {function(any): void} [queryResult]
17
- * Called by the coordinator to return a query result.
18
- * @property {function(): void} [queryPending]
19
- * Called by the coordinator to report a query execution error.
20
- * @property {function(any): void} [queryError]
21
- * Called by the coordinator to inform the client that a query is pending.
22
- */
23
- /**
24
- * Make a new client with the given options, and connect the client to the
25
- * provided coordinator.
26
- * @param {MakeClientOptions} options The options for making the client.
27
- * @returns {MosaicClient & { destroy: () => void }} The resulting client,
28
- * along with a method to destroy the client when no longer needed.
29
- */
30
- export function makeClient(options: MakeClientOptions): MosaicClient & {
31
- destroy: () => void;
32
- };
33
- export type MakeClientOptions = {
34
- /**
35
- * Mosaic coordinator.
36
- * Defaults to the global coordinator.
37
- */
38
- coordinator?: Coordinator;
39
- /**
40
- * A selection whose predicates are
41
- * fed into the query function to produce the SQL query.
42
- */
43
- selection?: Selection | null;
44
- /**
45
- * A flag (default `true`) indicating if the
46
- * client should initially be enabled or not.
47
- */
48
- enabled?: boolean;
49
- /**
50
- * A flag (default `true`) indicating if the
51
- * if client queries can be sped up using pre-aggregated data. Should be set
52
- * to `false` if filtering changes the groupby domain of the query.
53
- */
54
- filterStable?: boolean;
55
- /**
56
- * An async function to prepare the client before running queries.
57
- */
58
- prepare?: () => Promise<void>;
59
- /**
60
- * A function that returns a query from a list of selection predicates.
61
- */
62
- query?: (arg0: any) => any;
63
- /**
64
- * Called by the coordinator to return a query result.
65
- */
66
- queryResult?: (arg0: any) => void;
67
- /**
68
- * Called by the coordinator to report a query execution error.
69
- */
70
- queryPending?: () => void;
71
- /**
72
- * Called by the coordinator to inform the client that a query is pending.
73
- */
74
- queryError?: (arg0: any) => void;
75
- };
76
- import { MosaicClient } from './MosaicClient.js';
77
- import type { Coordinator } from './Coordinator.js';
78
- import type { Selection } from './Selection.js';
@@ -1,180 +0,0 @@
1
- /**
2
- * @typedef {object} PreAggregateOptions
3
- * @property {string} [schema] Database schema (namespace) in which to write
4
- * pre-aggregated materialzied views (default 'mosaic').
5
- * @property {boolean} [options.enabled=true] Flag to enable or disable the
6
- * pre-aggregation. This flag can be updated later via the `enabled` property.
7
- */
8
- /**
9
- * Build and query optimized pre-aggregated materaialized views, for fast
10
- * computation of groupby aggregate queries over compatible client queries
11
- * and selections. The materialized views contains pre-aggregated data for a
12
- * Mosaic client, subdivided by possible query values from an active selection
13
- * clause. These materialized views are database tables that can be queried
14
- * for rapid updates.
15
- *
16
- * Compatible client queries must consist of only groupby dimensions and
17
- * supported aggregate functions. Compatible selections must contain an active
18
- * clause that exposes metadata for an interval or point value predicate.
19
- *
20
- * Materialized views are written to a dedicated schema (namespace) that
21
- * can be set using the *schema* constructor option. This schema acts as a
22
- * persistent cache, and materialized view tables may be used across sessions.
23
- * The `dropSchema` method issues a query to remove *all* tables within this
24
- * schema. This may be needed if the original tables have updated data, but
25
- * should be used with care.
26
- */
27
- export class PreAggregator {
28
- /**
29
- * Create a new manager of materialized views of pre-aggregated data.
30
- * @param {Coordinator} coordinator A Mosaic coordinator.
31
- * @param {PreAggregateOptions} [options] Pre-aggregation options.
32
- */
33
- constructor(coordinator: Coordinator, { schema, enabled }?: PreAggregateOptions);
34
- /** @type {Map<MosaicClient, PreAggregateInfo | Skip | null>} */
35
- entries: Map<MosaicClient, PreAggregateInfo | {
36
- skip: boolean;
37
- result: any;
38
- } | null>;
39
- active: any;
40
- mc: Coordinator;
41
- _schema: string;
42
- _enabled: boolean;
43
- /**
44
- * Set the enabled state of this manager. If false, any local state is
45
- * cleared and subsequent request calls will return null until re-enabled.
46
- * This method has no effect on any pre-aggregated tables already in the
47
- * database.
48
- * @param {boolean} [state] The enabled state to set.
49
- */
50
- set enabled(state: boolean);
51
- /**
52
- * Get the enabled state of this manager.
53
- * @returns {boolean} The current enabled state.
54
- */
55
- get enabled(): boolean;
56
- /**
57
- * Set the database schema used for pre-aggregated materialized view tables.
58
- * Upon changes, any local state is cleared. This method does _not_ drop any
59
- * existing materialized views, use `dropSchema` before changing the schema
60
- * to also remove existing materalized views in the database.
61
- * @param {string} [schema] The schema name to set.
62
- */
63
- set schema(schema: string);
64
- /**
65
- * Get the database schema used for pre-aggregated materialized view tables.
66
- * @returns {string} The current schema name.
67
- */
68
- get schema(): string;
69
- /**
70
- * Issues a query through the coordinator to drop the current schema for
71
- * pre-aggregated materialized views. *All* materialized view tables in the
72
- * schema will be removed and local state is cleared. Call this method if
73
- * the underlying base tables have been updated, causing materialized view
74
- * to become stale and inaccurate. Use this method with care! Once dropped,
75
- * the schema will be repopulated by future pre-aggregation requests.
76
- * @returns A query result promise.
77
- */
78
- dropSchema(): import("../util/query-result.js").QueryResult;
79
- /**
80
- * Clear the cache of pre-aggregation entries for the current active
81
- * selection clause. This method does _not_ drop any existing materialized
82
- * views. Use `dropSchema` to remove existing materialized view tables from
83
- * the database.
84
- */
85
- clear(): void;
86
- /**
87
- * Return pre-aggregation information for the active state of a
88
- * client-selection pair, or null if the client has unstable filters.
89
- * This method has multiple possible side effects, including materialized
90
- * view creation and updating internal caches.
91
- * @param {MosaicClient} client A Mosaic client.
92
- * @param {Selection} selection A Mosaic selection to filter the client by.
93
- * @param {SelectionClause} activeClause A representative active selection
94
- * clause for which to generate materialized views of pre-aggregates.
95
- * @returns {PreAggregateInfo | Skip | null} Information and query generator
96
- * for pre-aggregated tables, or null if the client has unstable filters.
97
- */
98
- request(client: MosaicClient, selection: Selection, activeClause: SelectionClause): PreAggregateInfo | {
99
- skip: boolean;
100
- result: any;
101
- } | null;
102
- }
103
- /**
104
- * Metadata and query generator for materialized views of pre-aggregated data.
105
- * This object provides the information needed to generate and query the
106
- * materialized views for a client-selection pair relative to a specific
107
- * active clause and selection state.
108
- */
109
- export class PreAggregateInfo {
110
- /**
111
- * Create a new pre-aggregation information instance.
112
- * @param {object} options Options object.
113
- * @param {string} options.table The materialized view table name.
114
- * @param {string} options.create The table creation query.
115
- * @param {*} options.active Active column information.
116
- * @param {SelectQuery} options.select Base query for requesting updates
117
- * using a pre-aggregated materialized view.
118
- */
119
- constructor({ table, create, active, select }: {
120
- table: string;
121
- create: string;
122
- active: any;
123
- select: SelectQuery;
124
- });
125
- /**
126
- * The name of the materialized view.
127
- * @type {string}
128
- */
129
- table: string;
130
- /**
131
- * The SQL query used to generate the materialized view.
132
- * @type {string}
133
- */
134
- create: string;
135
- /**
136
- * A result promise returned for the materialized view creation query.
137
- * @type {Promise | null}
138
- */
139
- result: Promise<any> | null;
140
- /**
141
- * Definitions and predicate function for the active columns,
142
- * which are dynamically filtered by the active clause.
143
- */
144
- active: any;
145
- /**
146
- * Select query (sans where clause) for materialized views.
147
- * @type {SelectQuery}
148
- */
149
- select: SelectQuery;
150
- /**
151
- * Boolean flag indicating a client that should be skipped.
152
- * This value is always false for a created materialized view.
153
- * @type {boolean}
154
- */
155
- skip: boolean;
156
- /**
157
- * Generate a materialized view query for the given predicate.
158
- * @param {ExprNode} predicate The current active clause predicate.
159
- * @returns {SelectQuery} A materialized view query.
160
- */
161
- query(predicate: ExprNode): SelectQuery;
162
- }
163
- export type PreAggregateOptions = {
164
- /**
165
- * Database schema (namespace) in which to write
166
- * pre-aggregated materialzied views (default 'mosaic').
167
- */
168
- schema?: string;
169
- /**
170
- * Flag to enable or disable the
171
- * pre-aggregation. This flag can be updated later via the `enabled` property.
172
- */
173
- enabled?: boolean;
174
- };
175
- import type { MosaicClient } from '../MosaicClient.js';
176
- import type { Coordinator } from '../Coordinator.js';
177
- import type { Selection } from '../Selection.js';
178
- import type { SelectionClause } from '../util/selection-types.js';
179
- import type { SelectQuery } from '@uwdata/mosaic-sql';
180
- import type { ExprNode } from '@uwdata/mosaic-sql';
@@ -1,14 +0,0 @@
1
- /**
2
- * Determine pre-aggregation columns for a given Mosaic client.
3
- * @param {MosaicClient} client The Mosaic client.
4
- * @returns An object with necessary column data to generate pre-aggregated
5
- * columns, or null if the client can't be optimized or the client query
6
- * contains an invalid or unsupported expression.
7
- */
8
- export function preaggColumns(client: MosaicClient): {
9
- group: string[];
10
- preagg: Record<string, ExprNode>;
11
- output: Record<string, ExprNode>;
12
- };
13
- import type { MosaicClient } from '../MosaicClient.js';
14
- import type { ExprNode } from '@uwdata/mosaic-sql';
@@ -1,13 +0,0 @@
1
- /**
2
- * Determine sufficient statistics to preaggregate the given node. This
3
- * method populates the *preagg* and *aggrs* arguments with necessary
4
- * information for preaggregation optimization.
5
- * @param {AggregateNode} node An aggregate function.
6
- * @param {Record<string, ExprNode>} preagg Map of column names to
7
- * expressions to include in the preaggregation table.
8
- * @returns {ExprNode} Output aggregate expression that uses preaggregated
9
- * sufficient statistics to service updates.
10
- */
11
- export function sufficientStatistics(node: AggregateNode, preagg: Record<string, ExprNode>, avg: any): ExprNode;
12
- import type { AggregateNode } from '@uwdata/mosaic-sql';
13
- import type { ExprNode } from '@uwdata/mosaic-sql';
@@ -1,63 +0,0 @@
1
- import type { DescribeQuery, ExprNode, Query } from '@uwdata/mosaic-sql';
2
- /** Query type accepted by a coordinator. */
3
- export type QueryType = string | Query | DescribeQuery;
4
- /** String indicating a JavaScript data type. */
5
- export type JSType = 'number' | 'date' | 'boolean' | 'string' | 'array' | 'object';
6
- /** String indicating a requested summary statistic. */
7
- export type Stat = 'count' | 'nulls' | 'max' | 'min' | 'distinct';
8
- /** A reference to a database column or expression. */
9
- export type FieldRef = string | ExprNode;
10
- /**
11
- * A request for metadata information about a database column.
12
- */
13
- export interface FieldInfoRequest {
14
- table: string;
15
- column: FieldRef;
16
- stats?: Stat[];
17
- }
18
- /**
19
- * A response with metadata information about a database column.
20
- */
21
- export interface FieldInfo extends Partial<Record<Stat, number>> {
22
- table: string;
23
- column: string;
24
- sqlType: string;
25
- type: JSType;
26
- nullable: boolean;
27
- }
28
- /** A result row from a DESCRIBE query. */
29
- export interface ColumnDescription {
30
- column_name: string;
31
- column_type: string;
32
- null: 'YES' | 'NO';
33
- }
34
- /**
35
- * Interface for components that perform selection activation.
36
- */
37
- export interface Activatable {
38
- /**
39
- * Activate the selection that this component publishes to.
40
- */
41
- activate(): void;
42
- }
43
- /**
44
- * Interface for cache implementations.
45
- */
46
- export interface Cache {
47
- get(key: string): any;
48
- set(key: string, value: any): any;
49
- clear(): void;
50
- }
51
- /**
52
- * Interface for logger implementations
53
- */
54
- export interface Logger {
55
- debug(...args: any[]): void;
56
- info(...args: any[]): void;
57
- log(...args: any[]): void;
58
- warn(...args: any[]): void;
59
- error(...args: any[]): void;
60
- group(label?: any): void;
61
- groupCollapsed(label?: any): void;
62
- groupEnd(): void;
63
- }
@@ -1,100 +0,0 @@
1
- /**
2
- * Event dispatcher supporting asynchronous updates. If an event handler
3
- * callback returns a Promise, the dispatcher waits for all such Promises
4
- * to settle before dispatching future events of the same type.
5
- */
6
- export class AsyncDispatch {
7
- _callbacks: Map<any, any>;
8
- /**
9
- * Add an event listener callback for the provided event type.
10
- * @param {string} type The event type.
11
- * @param {(value: *) => void | Promise} callback The event handler
12
- * callback function to add. If the callback has already been
13
- * added for the event type, this method has no effect.
14
- */
15
- addEventListener(type: string, callback: (value: any) => void | Promise<any>): void;
16
- /**
17
- * Remove an event listener callback for the provided event type.
18
- * @param {string} type The event type.
19
- * @param {(value: *) => void | Promise} callback The event handler
20
- * callback function to remove.
21
- */
22
- removeEventListener(type: string, callback: (value: any) => void | Promise<any>): void;
23
- /**
24
- * Lifecycle method that returns the event value to emit.
25
- * This default implementation simply returns the input value as-is.
26
- * Subclasses may override this method to implement custom transformations
27
- * prior to emitting an event value to all listeners.
28
- * @param {string} type The event type.
29
- * @param {*} value The event value.
30
- * @returns The (possibly transformed) event value to emit.
31
- */
32
- willEmit(type: string, value: any): any;
33
- /**
34
- * Lifecycle method that returns a filter function for updating the
35
- * queue of unemitted event values prior to enqueueing a new value.
36
- * This default implementation simply returns null, indicating that
37
- * any other unemitted event values should be dropped (that is, all
38
- * queued events are filtered).
39
- * @param {string} type The event type.
40
- * @param {*} value The new event value that will be enqueued.
41
- * @returns {(value: *) => boolean|null} A dispatch queue filter
42
- * function, or null if all unemitted event values should be filtered.
43
- */
44
- emitQueueFilter(type: string, value: any): (value: any) => boolean | null;
45
- /**
46
- * Cancel all unemitted event values for the given event type.
47
- * @param {string} type The event type.
48
- */
49
- cancel(type: string): void;
50
- /**
51
- * Returns a promise that resolves when any pending updates complete for
52
- * the event of the given type currently being processed. The Promise will
53
- * resolve immediately if the queue for the given event type is empty.
54
- * @param {string} type The event type to wait for.
55
- * @returns {Promise} A pending event promise.
56
- */
57
- pending(type: string): Promise<any>;
58
- /**
59
- * Emit an event value to listeners for the given event type.
60
- * If a previous emit has not yet resolved, the event value
61
- * will be queued to be emitted later.
62
- * The actual event value given to listeners will be the result
63
- * of passing the input value through the emitValue() method.
64
- * @param {string} type The event type.
65
- * @param {*} value The event value.
66
- */
67
- emit(type: string, value: any): void;
68
- }
69
- /**
70
- * Queue for managing unemitted event values.
71
- */
72
- export class DispatchQueue {
73
- /**
74
- * Clear the queue state of all event values.
75
- */
76
- clear(): void;
77
- next: any;
78
- /**
79
- * Indicate if the queue is empty.
80
- * @returns {boolean} True if queue is empty, false otherwise.
81
- */
82
- isEmpty(): boolean;
83
- /**
84
- * Add a new value to the queue, and optionally filter the
85
- * current queue content in response.
86
- * @param {*} value The value to add.
87
- * @param {(value: *) => boolean} [filter] An optional filter
88
- * function to apply to existing queue content. If unspecified
89
- * or falsy, all previously queued values are removed. Otherwise,
90
- * the provided function is applied to all queue entries. The
91
- * entry is retained if the filter function returns a truthy value,
92
- * otherwise the entry is removed.
93
- */
94
- enqueue(value: any, filter?: (value: any) => boolean): void;
95
- /**
96
- * Remove and return the next queued event value.
97
- * @returns {*} The next event value in the queue.
98
- */
99
- dequeue(): any;
100
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Create a new cache that ignores all values.
3
- * @returns {Cache}
4
- */
5
- export function voidCache(): Cache;
6
- /**
7
- * Create a new cache that uses an LRU eviction policy.
8
- * @param {object} [options] Cache options.
9
- * @param {number} [options.max] Maximum number of cache entries.
10
- * @param {number} [options.ttl] Time-to-live for cache entries.
11
- * @returns {Cache}
12
- */
13
- export function lruCache({ max, ttl }?: {
14
- max?: number;
15
- ttl?: number;
16
- }): Cache;
17
- import type { Cache } from '../types.js';
@@ -1,12 +0,0 @@
1
- /**
2
- * Decode Arrow IPC bytes to a table instance.
3
- * The default options map date and timestamp values to JS Date objects.
4
- * @param {ArrayBuffer | Uint8Array} data Arrow IPC bytes.
5
- * @param {ExtractionOptions} [options] Arrow IPC extraction options.
6
- * If unspecified, the default options will extract date and timestamp
7
- * values to JS Date objects.
8
- * @returns {Table} A table instance.
9
- */
10
- export function decodeIPC(data: ArrayBuffer | Uint8Array, options?: ExtractionOptions): Table;
11
- import type { ExtractionOptions } from '@uwdata/flechette';
12
- import type { Table } from '@uwdata/flechette';
@@ -1,2 +0,0 @@
1
- export function distinct(a: any, b: any): boolean;
2
- export function distinctArray(a: any, b: any): boolean;
@@ -1,23 +0,0 @@
1
- /**
2
- * Queries information about fields of a table.
3
- * If the `fields` array contains a single field with the column set to '*',
4
- * the function will retrieve and return the table information using `getTableInfo`.
5
- * Otherwise, it will query individual field information using `getFieldInfo`
6
- * for each field in the `fields` array.
7
- * @param {import('../Coordinator.js').Coordinator} mc A Mosaic coordinator.
8
- * @param {import('../types.js').FieldInfoRequest[]} fields
9
- * @returns {Promise<import('../types.js').FieldInfo[]>}
10
- */
11
- export function queryFieldInfo(mc: import("../Coordinator.js").Coordinator, fields: import("../types.js").FieldInfoRequest[]): Promise<import("../types.js").FieldInfo[]>;
12
- export const Count: "count";
13
- export const Nulls: "nulls";
14
- export const Max: "max";
15
- export const Min: "min";
16
- export const Distinct: "distinct";
17
- export namespace Stats {
18
- export { Count };
19
- export { Nulls };
20
- export { Max };
21
- export { Min };
22
- export { Distinct };
23
- }
@@ -1 +0,0 @@
1
- export function fnv_hash(v: any): number;
@@ -1,6 +0,0 @@
1
- /**
2
- * Test if a value implements the Activatable interface.
3
- * @param {*} value The value to test.
4
- * @returns {value is import('../types.js').Activatable}
5
- */
6
- export function isActivatable(value: any): value is import("../types.js").Activatable;
@@ -1,8 +0,0 @@
1
- /**
2
- * Test if a value is a Flechette Arrow table.
3
- * We use a "duck typing" approach and check for a getChild function.
4
- * @param {*} values The value to test
5
- * @returns {values is import('@uwdata/flechette').Table}
6
- * true if the value duck types as Arrow data
7
- */
8
- export function isArrowTable(values: any): values is import("@uwdata/flechette").Table;
@@ -1,7 +0,0 @@
1
- /**
2
- * Maps a SQL data type to its corresponding JavaScript type.
3
- * @param {string} type The name of a SQL data type
4
- * @returns {import('../types.js').JSType} The corresponding JavaScript type name
5
- * @throws {Error} Throws an error if the given SQL type name is unsupported or unrecognized.
6
- */
7
- export function jsType(type: string): import("../types.js").JSType;
@@ -1,37 +0,0 @@
1
- export class PriorityQueue {
2
- /**
3
- * Create a new priority queue instance.
4
- * @param {number} ranks An integer number of rank-order priority levels.
5
- */
6
- constructor(ranks: number);
7
- queue: {
8
- head: any;
9
- tail: any;
10
- }[];
11
- /**
12
- * Indicate if the queue is empty.
13
- * @returns {boolean} true if empty, false otherwise.
14
- */
15
- isEmpty(): boolean;
16
- /**
17
- * Insert an item into the queue with a given priority rank.
18
- * @param {*} item The item to add.
19
- * @param {number} rank The integer priority rank.
20
- * Priority ranks are integers starting at zero.
21
- * Lower ranks indicate higher priority.
22
- */
23
- insert(item: any, rank: number): void;
24
- /**
25
- * Remove a set of items from the queue, regardless of priority rank.
26
- * If a provided item is not in the queue it will be ignored.
27
- * @param {(item: *) => boolean} test A predicate function to test
28
- * if an item should be removed (true to drop, false to keep).
29
- */
30
- remove(test: (item: any) => boolean): void;
31
- /**
32
- * Remove and return the next highest priority item.
33
- * @returns {*} The next item in the queue,
34
- * or undefined if this queue is empty.
35
- */
36
- next(): any;
37
- }
@@ -1,44 +0,0 @@
1
- export const QueryState: Readonly<{
2
- pending: symbol;
3
- ready: symbol;
4
- error: symbol;
5
- done: symbol;
6
- }>;
7
- /**
8
- * A query result Promise that can allows external callers
9
- * to resolve or reject the Promise.
10
- */
11
- export class QueryResult extends Promise<any> {
12
- /**
13
- * Create a new query result Promise.
14
- */
15
- constructor();
16
- _resolve: any;
17
- _reject: any;
18
- _state: symbol;
19
- _value: any;
20
- /**
21
- * Resolve the result Promise with a prepared value or the provided value.
22
- * This method will only succeed if either a value is provided or the promise is ready.
23
- * @param {*} value The result value.
24
- * @returns {this}
25
- */
26
- fulfill(value: any): this;
27
- /**
28
- * Prepare to resolve with the provided value.
29
- * @param {*} value The result value.
30
- * @returns {this}
31
- */
32
- ready(value: any): this;
33
- /**
34
- * Rejects the result Promise with the provided error.
35
- * @param {*} error The error value.
36
- * @returns {this}
37
- */
38
- reject(error: any): this;
39
- /**
40
- * Returns the state of this query result.
41
- * @returns {symbol}
42
- */
43
- get state(): symbol;
44
- }