flowquery 1.0.70 → 1.0.71
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/README.md +456 -103
- package/dist/compute/provenance.d.ts +201 -0
- package/dist/compute/provenance.d.ts.map +1 -0
- package/dist/compute/provenance.js +216 -0
- package/dist/compute/provenance.js.map +1 -0
- package/dist/compute/runner.d.ts +196 -3
- package/dist/compute/runner.d.ts.map +1 -1
- package/dist/compute/runner.js +283 -2
- package/dist/compute/runner.js.map +1 -1
- package/dist/flowquery.min.js +1 -1
- package/dist/graph/bindings.d.ts.map +1 -1
- package/dist/graph/bindings.js +15 -1
- package/dist/graph/bindings.js.map +1 -1
- package/dist/graph/data_cache.d.ts +4 -0
- package/dist/graph/data_cache.d.ts.map +1 -1
- package/dist/graph/data_cache.js +15 -3
- package/dist/graph/data_cache.js.map +1 -1
- package/dist/graph/data_resolver.d.ts.map +1 -1
- package/dist/graph/data_resolver.js +23 -4
- package/dist/graph/data_resolver.js.map +1 -1
- package/dist/graph/physical_node.d.ts +4 -8
- package/dist/graph/physical_node.d.ts.map +1 -1
- package/dist/graph/physical_node.js +14 -85
- package/dist/graph/physical_node.js.map +1 -1
- package/dist/graph/physical_relationship.d.ts +4 -8
- package/dist/graph/physical_relationship.d.ts.map +1 -1
- package/dist/graph/physical_relationship.js +14 -85
- package/dist/graph/physical_relationship.js.map +1 -1
- package/dist/graph/relationship_match_collector.d.ts.map +1 -1
- package/dist/graph/relationship_match_collector.js +9 -0
- package/dist/graph/relationship_match_collector.js.map +1 -1
- package/dist/graph/virtual_sources.d.ts +8 -0
- package/dist/graph/virtual_sources.d.ts.map +1 -0
- package/dist/graph/virtual_sources.js +31 -0
- package/dist/graph/virtual_sources.js.map +1 -0
- package/dist/graph/virtual_statement.d.ts +41 -0
- package/dist/graph/virtual_statement.d.ts.map +1 -0
- package/dist/graph/virtual_statement.js +143 -0
- package/dist/graph/virtual_statement.js.map +1 -0
- package/dist/index.browser.d.ts +3 -3
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.d.ts +3 -3
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js.map +1 -1
- package/dist/parsing/operations/aggregated_return.d.ts +10 -0
- package/dist/parsing/operations/aggregated_return.d.ts.map +1 -1
- package/dist/parsing/operations/aggregated_return.js +56 -3
- package/dist/parsing/operations/aggregated_return.js.map +1 -1
- package/dist/parsing/operations/aggregated_with.d.ts +20 -0
- package/dist/parsing/operations/aggregated_with.d.ts.map +1 -1
- package/dist/parsing/operations/aggregated_with.js +33 -1
- package/dist/parsing/operations/aggregated_with.js.map +1 -1
- package/dist/parsing/operations/group_by.d.ts +32 -0
- package/dist/parsing/operations/group_by.d.ts.map +1 -1
- package/dist/parsing/operations/group_by.js +103 -0
- package/dist/parsing/operations/group_by.js.map +1 -1
- package/dist/parsing/operations/let.d.ts.map +1 -1
- package/dist/parsing/operations/let.js +53 -0
- package/dist/parsing/operations/let.js.map +1 -1
- package/dist/parsing/operations/load.d.ts +20 -0
- package/dist/parsing/operations/load.d.ts.map +1 -1
- package/dist/parsing/operations/load.js +71 -0
- package/dist/parsing/operations/load.js.map +1 -1
- package/dist/parsing/operations/order_by.d.ts +6 -0
- package/dist/parsing/operations/order_by.d.ts.map +1 -1
- package/dist/parsing/operations/order_by.js +10 -1
- package/dist/parsing/operations/order_by.js.map +1 -1
- package/dist/parsing/operations/return.d.ts +34 -0
- package/dist/parsing/operations/return.d.ts.map +1 -1
- package/dist/parsing/operations/return.js +95 -2
- package/dist/parsing/operations/return.js.map +1 -1
- package/dist/parsing/operations/union.d.ts +19 -2
- package/dist/parsing/operations/union.d.ts.map +1 -1
- package/dist/parsing/operations/union.js +47 -11
- package/dist/parsing/operations/union.js.map +1 -1
- package/dist/parsing/operations/union_all.d.ts +5 -1
- package/dist/parsing/operations/union_all.d.ts.map +1 -1
- package/dist/parsing/operations/union_all.js +8 -2
- package/dist/parsing/operations/union_all.js.map +1 -1
- package/dist/parsing/statement_info_crawler.d.ts +106 -0
- package/dist/parsing/statement_info_crawler.d.ts.map +1 -1
- package/dist/parsing/statement_info_crawler.js +231 -12
- package/dist/parsing/statement_info_crawler.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.attachVirtualSource = attachVirtualSource;
|
|
4
|
+
exports.getVirtualSource = getVirtualSource;
|
|
5
|
+
/**
|
|
6
|
+
* Module-level back-reference from a virtual node / relationship record
|
|
7
|
+
* (or `RelationshipMatchRecord`) to the inner-runner `RowProvenance` that
|
|
8
|
+
* produced it.
|
|
9
|
+
*
|
|
10
|
+
* Used by deep-mode provenance to thread lineage from a `CREATE VIRTUAL
|
|
11
|
+
* (:X) AS { ... }` sub-query into the outer query's row-level bindings.
|
|
12
|
+
*
|
|
13
|
+
* Decoupled from `compute/provenance` to keep the graph layer free of
|
|
14
|
+
* compute imports — the value is typed as `unknown` here and re-cast by
|
|
15
|
+
* the snapshot code that consumes it.
|
|
16
|
+
*/
|
|
17
|
+
const virtualSources = new WeakMap();
|
|
18
|
+
/** Register a virtual-sourced record with its inner provenance row. */
|
|
19
|
+
function attachVirtualSource(record, prov) {
|
|
20
|
+
virtualSources.set(record, prov);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Look up the inner provenance for a record / match object. Returns
|
|
24
|
+
* `undefined` if the value did not originate from a deep-mode virtual.
|
|
25
|
+
*/
|
|
26
|
+
function getVirtualSource(record) {
|
|
27
|
+
if (record == null)
|
|
28
|
+
return undefined;
|
|
29
|
+
return virtualSources.get(record);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=virtual_sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual_sources.js","sourceRoot":"","sources":["../../src/graph/virtual_sources.ts"],"names":[],"mappings":";;AAeA,kDAEC;AAMD,4CAGC;AA1BD;;;;;;;;;;;GAWG;AACH,MAAM,cAAc,GAA6B,IAAI,OAAO,EAAE,CAAC;AAE/D,uEAAuE;AACvE,SAAgB,mBAAmB,CAAC,MAAc,EAAE,IAAa;IAC7D,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,MAAiC;IAC9D,IAAI,MAAM,IAAI,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import ASTNode from "../parsing/ast_node";
|
|
2
|
+
/**
|
|
3
|
+
* Backing statement of a virtual node or relationship: owns the AST that
|
|
4
|
+
* synthesises the records and the optional in-memory cache around its
|
|
5
|
+
* execution.
|
|
6
|
+
*
|
|
7
|
+
* Used by {@link PhysicalNode} and {@link PhysicalRelationship} via
|
|
8
|
+
* composition so both physical kinds share a single caching + execution
|
|
9
|
+
* implementation.
|
|
10
|
+
*/
|
|
11
|
+
declare class VirtualStatement {
|
|
12
|
+
private _statement;
|
|
13
|
+
private _isStatic;
|
|
14
|
+
private _refreshEveryMs;
|
|
15
|
+
private _cache;
|
|
16
|
+
private _cachedAt;
|
|
17
|
+
set statement(statement: ASTNode | null);
|
|
18
|
+
get statement(): ASTNode | null;
|
|
19
|
+
set isStatic(value: boolean);
|
|
20
|
+
get isStatic(): boolean;
|
|
21
|
+
set refreshEveryMs(value: number | null);
|
|
22
|
+
get refreshEveryMs(): number | null;
|
|
23
|
+
invalidateCache(): void;
|
|
24
|
+
/** True if the cached payload (if any) is still within its refresh window. */
|
|
25
|
+
private isCacheFresh;
|
|
26
|
+
/**
|
|
27
|
+
* Execute the backing statement and return its records, using the
|
|
28
|
+
* persistent cache when it is safe to do so.
|
|
29
|
+
*
|
|
30
|
+
* @param args Pass-down filter arguments; bypasses the cache.
|
|
31
|
+
* @param provenance Run the inner statement with provenance enabled
|
|
32
|
+
* so each emitted record carries a weak-map link to
|
|
33
|
+
* the inner row that produced it. Also bypasses the
|
|
34
|
+
* cache (the weak-map binding must be re-established
|
|
35
|
+
* each call).
|
|
36
|
+
*/
|
|
37
|
+
data(args?: Record<string, any> | null, provenance?: boolean): Promise<Record<string, any>[]>;
|
|
38
|
+
private runInner;
|
|
39
|
+
}
|
|
40
|
+
export default VirtualStatement;
|
|
41
|
+
//# sourceMappingURL=virtual_statement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual_statement.d.ts","sourceRoot":"","sources":["../../src/graph/virtual_statement.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAG1C;;;;;;;;GAQG;AACH,cAAM,gBAAgB;IAClB,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,SAAS,CAAa;IAE9B,IAAW,SAAS,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,EAG7C;IACD,IAAW,SAAS,IAAI,OAAO,GAAG,IAAI,CAErC;IAED,IAAW,QAAQ,CAAC,KAAK,EAAE,OAAO,EAEjC;IACD,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED,IAAW,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAE7C;IACD,IAAW,cAAc,IAAI,MAAM,GAAG,IAAI,CAEzC;IAEM,eAAe,IAAI,IAAI;IAK9B,8EAA8E;IAC9E,OAAO,CAAC,YAAY;IAIpB;;;;;;;;;;OAUG;IACU,IAAI,CACb,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAW,EACvC,UAAU,GAAE,OAAe,GAC5B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;YAoBnB,QAAQ;CAoBzB;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
const virtual_sources_1 = require("./virtual_sources");
|
|
46
|
+
/**
|
|
47
|
+
* Backing statement of a virtual node or relationship: owns the AST that
|
|
48
|
+
* synthesises the records and the optional in-memory cache around its
|
|
49
|
+
* execution.
|
|
50
|
+
*
|
|
51
|
+
* Used by {@link PhysicalNode} and {@link PhysicalRelationship} via
|
|
52
|
+
* composition so both physical kinds share a single caching + execution
|
|
53
|
+
* implementation.
|
|
54
|
+
*/
|
|
55
|
+
class VirtualStatement {
|
|
56
|
+
constructor() {
|
|
57
|
+
this._statement = null;
|
|
58
|
+
this._isStatic = false;
|
|
59
|
+
this._refreshEveryMs = null;
|
|
60
|
+
this._cache = null;
|
|
61
|
+
this._cachedAt = 0;
|
|
62
|
+
}
|
|
63
|
+
set statement(statement) {
|
|
64
|
+
this._statement = statement;
|
|
65
|
+
this.invalidateCache();
|
|
66
|
+
}
|
|
67
|
+
get statement() {
|
|
68
|
+
return this._statement;
|
|
69
|
+
}
|
|
70
|
+
set isStatic(value) {
|
|
71
|
+
this._isStatic = value;
|
|
72
|
+
}
|
|
73
|
+
get isStatic() {
|
|
74
|
+
return this._isStatic;
|
|
75
|
+
}
|
|
76
|
+
set refreshEveryMs(value) {
|
|
77
|
+
this._refreshEveryMs = value;
|
|
78
|
+
}
|
|
79
|
+
get refreshEveryMs() {
|
|
80
|
+
return this._refreshEveryMs;
|
|
81
|
+
}
|
|
82
|
+
invalidateCache() {
|
|
83
|
+
this._cache = null;
|
|
84
|
+
this._cachedAt = 0;
|
|
85
|
+
}
|
|
86
|
+
/** True if the cached payload (if any) is still within its refresh window. */
|
|
87
|
+
isCacheFresh() {
|
|
88
|
+
return this._refreshEveryMs === null || Date.now() - this._cachedAt < this._refreshEveryMs;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Execute the backing statement and return its records, using the
|
|
92
|
+
* persistent cache when it is safe to do so.
|
|
93
|
+
*
|
|
94
|
+
* @param args Pass-down filter arguments; bypasses the cache.
|
|
95
|
+
* @param provenance Run the inner statement with provenance enabled
|
|
96
|
+
* so each emitted record carries a weak-map link to
|
|
97
|
+
* the inner row that produced it. Also bypasses the
|
|
98
|
+
* cache (the weak-map binding must be re-established
|
|
99
|
+
* each call).
|
|
100
|
+
*/
|
|
101
|
+
data() {
|
|
102
|
+
return __awaiter(this, arguments, void 0, function* (args = null, provenance = false) {
|
|
103
|
+
if (this._statement === null) {
|
|
104
|
+
throw new Error("Statement is null");
|
|
105
|
+
}
|
|
106
|
+
// Filter pass-down queries (with args) and provenance mode bypass
|
|
107
|
+
// the persistent cache: arg-bound results depend on runtime values,
|
|
108
|
+
// and provenance mode needs fresh records to back the lineage
|
|
109
|
+
// weak-map.
|
|
110
|
+
const cacheable = !provenance && args === null && this._isStatic;
|
|
111
|
+
if (cacheable && this._cache !== null && this.isCacheFresh()) {
|
|
112
|
+
return this._cache;
|
|
113
|
+
}
|
|
114
|
+
const result = yield this.runInner(args, provenance);
|
|
115
|
+
if (cacheable) {
|
|
116
|
+
this._cache = result;
|
|
117
|
+
this._cachedAt = Date.now();
|
|
118
|
+
}
|
|
119
|
+
return result;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
runInner(args, provenance) {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
// Lazy dynamic import to avoid a load-time cycle:
|
|
125
|
+
// virtual_statement -> runner -> parsing -> graph (back to here).
|
|
126
|
+
// Python uses the same idiom (function-local import).
|
|
127
|
+
const RunnerCtor = (yield Promise.resolve().then(() => __importStar(require("../compute/runner")))).default;
|
|
128
|
+
const runner = new RunnerCtor(null, this._statement, args, { provenance });
|
|
129
|
+
yield runner.run();
|
|
130
|
+
const result = runner.results;
|
|
131
|
+
if (provenance) {
|
|
132
|
+
const prov = runner.provenance;
|
|
133
|
+
const len = Math.min(prov.length, result.length);
|
|
134
|
+
for (let i = 0; i < len; i++) {
|
|
135
|
+
(0, virtual_sources_1.attachVirtualSource)(result[i], prov[i]);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.default = VirtualStatement;
|
|
143
|
+
//# sourceMappingURL=virtual_statement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual_statement.js","sourceRoot":"","sources":["../../src/graph/virtual_statement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uDAAwD;AAExD;;;;;;;;GAQG;AACH,MAAM,gBAAgB;IAAtB;QACY,eAAU,GAAmB,IAAI,CAAC;QAClC,cAAS,GAAY,KAAK,CAAC;QAC3B,oBAAe,GAAkB,IAAI,CAAC;QACtC,WAAM,GAAiC,IAAI,CAAC;QAC5C,cAAS,GAAW,CAAC,CAAC;IAwFlC,CAAC;IAtFG,IAAW,SAAS,CAAC,SAAyB;QAC1C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,eAAe,EAAE,CAAC;IAC3B,CAAC;IACD,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAW,QAAQ,CAAC,KAAc;QAC9B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IAC3B,CAAC;IACD,IAAW,QAAQ;QAC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AAQ,CAClB,IAAgC,EAChC,UAAmB;;YAEnB,kDAAkD;YAClD,kEAAkE;YAClE,sDAAsD;YACtD,MAAM,UAAU,GAAkB,CAAC,wDAAa,mBAAmB,GAAC,CAAC,CAAC,OAAO,CAAC;YAC9E,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;YAC3E,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;YACnB,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;YAC9B,IAAI,UAAU,EAAE,CAAC;gBACb,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;gBAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;gBACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC3B,IAAA,qCAAmB,EAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC5C,CAAC;YACL,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;CACJ;AAED,kBAAe,gBAAgB,CAAC"}
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
8
|
import { default as FlowQuery } from "./compute/flowquery";
|
|
9
|
-
import type { RunnerMetadata } from "./compute/runner";
|
|
10
|
-
import type { NodeInfo, RelationshipInfo, StatementInfo } from "./parsing/statement_info_crawler";
|
|
9
|
+
import type { CellBindingTrace, CellTrace, LineageReport, NodeBinding, RelationshipBinding, RelationshipHop, RowProvenance, RunnerMetadata, RunnerOptions } from "./compute/runner";
|
|
10
|
+
import type { ColumnLineage, ColumnReference, NodeInfo, RelationshipInfo, StatementInfo } from "./parsing/statement_info_crawler";
|
|
11
11
|
export default FlowQuery;
|
|
12
|
-
export type { NodeInfo, RelationshipInfo, RunnerMetadata, StatementInfo };
|
|
12
|
+
export type { CellBindingTrace, CellTrace, ColumnLineage, ColumnReference, LineageReport, NodeBinding, NodeInfo, RelationshipBinding, RelationshipHop, RelationshipInfo, RowProvenance, RunnerMetadata, RunnerOptions, StatementInfo, };
|
|
13
13
|
//# sourceMappingURL=index.browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EACR,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,cAAc,EACd,aAAa,EAChB,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,KAAK,EACR,aAAa,EACb,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,aAAa,EAChB,MAAM,kCAAkC,CAAC;AA+B1C,eAAe,SAAS,CAAC;AACzB,YAAY,EACR,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,eAAe,EACf,aAAa,EACb,WAAW,EACX,QAAQ,EACR,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,aAAa,EACb,aAAa,GAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;GAMG;AACH,oEAA2D;
|
|
1
|
+
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;GAMG;AACH,oEAA2D;AAY3D,4EAAoD;AACpD,4FAAmE;AAcnE;;;;;GAKG;AACH,mBAAS,CAAC,aAAa,GAAG,UAAU,OAInC;IACG,OAAO,0BAAe,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF;;;;;GAKG;AACH,mBAAS,CAAC,mBAAmB,GAAG,UAAU,IAAY;IAClD,OAAO,0BAAe,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF;;GAEG;AACH,mBAAS,CAAC,QAAQ,GAAG,kBAAQ,CAAC;AAE9B,kBAAe,mBAAS,CAAC"}
|
package/dist/index.node.d.ts
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
8
|
import { default as FlowQuery } from "./compute/flowquery";
|
|
9
|
-
import { RunnerMetadata } from "./compute/runner";
|
|
9
|
+
import { CellBindingTrace, CellTrace, LineageReport, RunnerMetadata } from "./compute/runner";
|
|
10
10
|
import Function from "./parsing/functions/function";
|
|
11
11
|
import FunctionFactory, { AsyncDataProvider } from "./parsing/functions/function_factory";
|
|
12
12
|
import { FunctionMetadata, OutputSchema, ParameterSchema } from "./parsing/functions/function_metadata";
|
|
13
|
-
import { NodeInfo, RelationshipInfo, StatementInfo } from "./parsing/statement_info_crawler";
|
|
13
|
+
import { ColumnLineage, ColumnReference, NodeInfo, RelationshipInfo, StatementInfo } from "./parsing/statement_info_crawler";
|
|
14
14
|
export default FlowQuery;
|
|
15
|
-
export { FlowQuery, Function, FunctionFactory, AsyncDataProvider, FunctionMetadata, ParameterSchema, OutputSchema, RunnerMetadata, StatementInfo, NodeInfo, RelationshipInfo, };
|
|
15
|
+
export { FlowQuery, Function, FunctionFactory, AsyncDataProvider, FunctionMetadata, ParameterSchema, OutputSchema, RunnerMetadata, StatementInfo, NodeInfo, RelationshipInfo, ColumnLineage, ColumnReference, CellTrace, CellBindingTrace, LineageReport, };
|
|
16
16
|
//# sourceMappingURL=index.node.d.ts.map
|
package/dist/index.node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC9F,OAAO,QAAQ,MAAM,8BAA8B,CAAC;AACpD,OAAO,eAAe,EAAE,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EACH,gBAAgB,EAChB,YAAY,EACZ,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,aAAa,EACb,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,aAAa,EAChB,MAAM,kCAAkC,CAAC;AA+B1C,eAAe,SAAS,CAAC;AACzB,OAAO,EACH,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,aAAa,GAChB,CAAC"}
|
package/dist/index.node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.node.js","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;GAMG;AACH,oEAA2D;
|
|
1
|
+
{"version":3,"file":"index.node.js","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;GAMG;AACH,oEAA2D;AAgDvD,0FAhDgB,mBAAS,OAgDhB;AA9Cb,4EAAoD;AA+ChD,mBA/CG,kBAAQ,CA+CH;AA9CZ,4FAA0F;AA+CtF,0BA/CG,0BAAe,CA+CH;AAjCnB;;;;;GAKG;AACH,mBAAS,CAAC,aAAa,GAAG,UAAU,OAInC;IACG,OAAO,0BAAe,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF;;;;;GAKG;AACH,mBAAS,CAAC,mBAAmB,GAAG,UAAU,IAAY;IAClD,OAAO,0BAAe,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF;;GAEG;AACH,mBAAS,CAAC,QAAQ,GAAG,kBAAQ,CAAC;AAE9B,kBAAe,mBAAS,CAAC"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
import { ProvenanceSource } from "../../compute/provenance";
|
|
1
2
|
import Return from "./return";
|
|
2
3
|
declare class AggregatedReturn extends Return {
|
|
3
4
|
private _group_by;
|
|
4
5
|
run(): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Provenance sources registered on an aggregate RETURN are folded
|
|
8
|
+
* into the active group's dedup maps rather than snapshotted per
|
|
9
|
+
* row, because each output row corresponds to a *group* of upstream
|
|
10
|
+
* matches. Override to route through the embedded `GroupBy`.
|
|
11
|
+
*/
|
|
12
|
+
addProvenanceSource(source: ProvenanceSource): void;
|
|
5
13
|
get results(): Record<string, any>[];
|
|
14
|
+
finish(): Promise<void>;
|
|
15
|
+
private _buildAggregateOutput;
|
|
6
16
|
}
|
|
7
17
|
export default AggregatedReturn;
|
|
8
18
|
//# sourceMappingURL=aggregated_return.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregated_return.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/aggregated_return.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aggregated_return.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/aggregated_return.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAiB,MAAM,0BAA0B,CAAC;AAI3E,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,cAAM,gBAAiB,SAAQ,MAAM;IACjC,OAAO,CAAC,SAAS,CAAuD;IAC3D,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAGjC;;;;;OAKG;IACI,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAG1D,IAAW,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAG1C;IACY,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAWpC,OAAO,CAAC,qBAAqB;CAmChC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const group_by_1 = __importDefault(require("./group_by"));
|
|
16
|
+
const operation_1 = __importDefault(require("./operation"));
|
|
16
17
|
const return_1 = __importDefault(require("./return"));
|
|
17
18
|
class AggregatedReturn extends return_1.default {
|
|
18
19
|
constructor() {
|
|
@@ -24,15 +25,67 @@ class AggregatedReturn extends return_1.default {
|
|
|
24
25
|
yield this._group_by.run();
|
|
25
26
|
});
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Provenance sources registered on an aggregate RETURN are folded
|
|
30
|
+
* into the active group's dedup maps rather than snapshotted per
|
|
31
|
+
* row, because each output row corresponds to a *group* of upstream
|
|
32
|
+
* matches. Override to route through the embedded `GroupBy`.
|
|
33
|
+
*/
|
|
34
|
+
addProvenanceSource(source) {
|
|
35
|
+
this._group_by.addProvenanceSource(source);
|
|
36
|
+
}
|
|
27
37
|
get results() {
|
|
38
|
+
const { results } = this._buildAggregateOutput();
|
|
39
|
+
return results;
|
|
40
|
+
}
|
|
41
|
+
finish() {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
if (this._provenanceSink !== null) {
|
|
44
|
+
const { provenance } = this._buildAggregateOutput();
|
|
45
|
+
this._provenanceSink.length = 0;
|
|
46
|
+
for (const p of provenance)
|
|
47
|
+
this._provenanceSink.push(p);
|
|
48
|
+
}
|
|
49
|
+
// Skip Return.finish() because it would re-materialise provenance
|
|
50
|
+
// from the empty per-row `_results` array; chain straight to the
|
|
51
|
+
// next operation instead.
|
|
52
|
+
yield operation_1.default.prototype.finish.call(this);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
_buildAggregateOutput() {
|
|
28
56
|
if (this._where !== null) {
|
|
29
57
|
this._group_by.where = this._where;
|
|
30
58
|
}
|
|
31
|
-
const results =
|
|
59
|
+
const results = [];
|
|
60
|
+
const provenance = [];
|
|
61
|
+
// Emit a provenance entry per result row whenever a sink is
|
|
62
|
+
// registered, even if no provenance sources were attached (e.g.
|
|
63
|
+
// `RETURN count(*)` over no MATCH). This keeps
|
|
64
|
+
// `runner.provenance.length === runner.results.length`.
|
|
65
|
+
const wantProvenance = this._provenanceSink !== null;
|
|
66
|
+
if (wantProvenance) {
|
|
67
|
+
const recordIter = this._group_by.generate_results();
|
|
68
|
+
const provIter = this._group_by.generate_provenance();
|
|
69
|
+
while (true) {
|
|
70
|
+
const r = recordIter.next();
|
|
71
|
+
const p = provIter.next();
|
|
72
|
+
if (r.done || p.done)
|
|
73
|
+
break;
|
|
74
|
+
results.push(r.value);
|
|
75
|
+
provenance.push(p.value);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
for (const r of this._group_by.generate_results())
|
|
80
|
+
results.push(r);
|
|
81
|
+
}
|
|
32
82
|
if (this._orderBy !== null) {
|
|
33
|
-
|
|
83
|
+
const indices = this._orderBy.sortIndices(results);
|
|
84
|
+
const sorted = indices.map((i) => results[i]);
|
|
85
|
+
const sortedProv = wantProvenance ? indices.map((i) => provenance[i]) : provenance;
|
|
86
|
+
return { results: sorted, provenance: sortedProv };
|
|
34
87
|
}
|
|
35
|
-
return results;
|
|
88
|
+
return { results, provenance };
|
|
36
89
|
}
|
|
37
90
|
}
|
|
38
91
|
exports.default = AggregatedReturn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregated_return.js","sourceRoot":"","sources":["../../../src/parsing/operations/aggregated_return.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"aggregated_return.js","sourceRoot":"","sources":["../../../src/parsing/operations/aggregated_return.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,0DAAiC;AACjC,4DAAoC;AACpC,sDAA8B;AAE9B,MAAM,gBAAiB,SAAQ,gBAAM;IAArC;;QACY,cAAS,GAAY,IAAI,kBAAO,CAAC,IAAI,CAAC,QAAwB,CAAC,CAAC;IA+D5E,CAAC;IA9DgB,GAAG;;YACZ,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QAC/B,CAAC;KAAA;IACD;;;;;OAKG;IACI,mBAAmB,CAAC,MAAwB;QAC/C,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IACD,IAAW,OAAO;QACd,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACjD,OAAO,OAAO,CAAC;IACnB,CAAC;IACY,MAAM;;YACf,IAAI,IAAI,CAAC,eAAe,KAAK,IAAI,EAAE,CAAC;gBAChC,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,qBAAqB,EAA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,CAAC,SAAS,CAAC,gBAAgB,EAAE;gBAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACvE,CAAC;QACD,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YACzB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACnD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9C,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;YACnF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;QACvD,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IACnC,CAAC;CACJ;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -1,7 +1,27 @@
|
|
|
1
|
+
import { ProvenanceSource } from "../../compute/provenance";
|
|
1
2
|
import With from "./return";
|
|
2
3
|
declare class AggregatedWith extends With {
|
|
3
4
|
private _group_by;
|
|
5
|
+
/**
|
|
6
|
+
* Iterator over the per-group provenance produced by `_group_by`.
|
|
7
|
+
* Advanced in lockstep with `generate_results()` inside `finish()` so
|
|
8
|
+
* that `_currentGroupProvenance` always reflects the group whose row
|
|
9
|
+
* the downstream pipeline is about to project.
|
|
10
|
+
*/
|
|
11
|
+
private _currentGroupProvenance;
|
|
4
12
|
run(): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Forward upstream provenance sources into the embedded `GroupBy`
|
|
15
|
+
* so each group accumulates the union of contributing bindings.
|
|
16
|
+
*/
|
|
17
|
+
addProvenanceSource(source: ProvenanceSource): void;
|
|
18
|
+
/**
|
|
19
|
+
* Expose this aggregation as a downstream provenance source. When
|
|
20
|
+
* the downstream pipeline projects a row, it snapshots us and
|
|
21
|
+
* receives the pre-computed provenance for the group currently being
|
|
22
|
+
* flushed by `finish()`.
|
|
23
|
+
*/
|
|
24
|
+
asProvenanceSource(): ProvenanceSource;
|
|
5
25
|
finish(): Promise<void>;
|
|
6
26
|
}
|
|
7
27
|
export default AggregatedWith;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregated_with.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/aggregated_with.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"aggregated_with.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/aggregated_with.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAiB,MAAM,0BAA0B,CAAC;AAG3E,OAAO,IAAI,MAAM,UAAU,CAAC;AAE5B,cAAM,cAAe,SAAQ,IAAI;IAC7B,OAAO,CAAC,SAAS,CAAuD;IACxE;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB,CAA8B;IAChD,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAGjC;;;OAGG;IACI,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAG1D;;;;;OAKG;IACI,kBAAkB,IAAI,gBAAgB;IAMhC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAavC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -12,27 +12,59 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const return_1 = __importDefault(require("./return"));
|
|
16
15
|
const group_by_1 = __importDefault(require("./group_by"));
|
|
16
|
+
const return_1 = __importDefault(require("./return"));
|
|
17
17
|
class AggregatedWith extends return_1.default {
|
|
18
18
|
constructor() {
|
|
19
19
|
super(...arguments);
|
|
20
20
|
this._group_by = new group_by_1.default(this.children);
|
|
21
|
+
/**
|
|
22
|
+
* Iterator over the per-group provenance produced by `_group_by`.
|
|
23
|
+
* Advanced in lockstep with `generate_results()` inside `finish()` so
|
|
24
|
+
* that `_currentGroupProvenance` always reflects the group whose row
|
|
25
|
+
* the downstream pipeline is about to project.
|
|
26
|
+
*/
|
|
27
|
+
this._currentGroupProvenance = null;
|
|
21
28
|
}
|
|
22
29
|
run() {
|
|
23
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
31
|
yield this._group_by.run();
|
|
25
32
|
});
|
|
26
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Forward upstream provenance sources into the embedded `GroupBy`
|
|
36
|
+
* so each group accumulates the union of contributing bindings.
|
|
37
|
+
*/
|
|
38
|
+
addProvenanceSource(source) {
|
|
39
|
+
this._group_by.addProvenanceSource(source);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Expose this aggregation as a downstream provenance source. When
|
|
43
|
+
* the downstream pipeline projects a row, it snapshots us and
|
|
44
|
+
* receives the pre-computed provenance for the group currently being
|
|
45
|
+
* flushed by `finish()`.
|
|
46
|
+
*/
|
|
47
|
+
asProvenanceSource() {
|
|
48
|
+
return {
|
|
49
|
+
snapshot: () => { var _a; return (_a = this._currentGroupProvenance) !== null && _a !== void 0 ? _a : { nodes: [], relationships: [], rows: [] }; },
|
|
50
|
+
};
|
|
51
|
+
}
|
|
27
52
|
finish() {
|
|
28
53
|
const _super = Object.create(null, {
|
|
29
54
|
finish: { get: () => super.finish }
|
|
30
55
|
});
|
|
31
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
57
|
var _a;
|
|
58
|
+
const wantProvenance = this._group_by.provenanceEnabled;
|
|
59
|
+
const provIter = wantProvenance ? this._group_by.generate_provenance() : null;
|
|
33
60
|
for (const _ of this._group_by.generate_results()) {
|
|
61
|
+
if (provIter !== null) {
|
|
62
|
+
const next = provIter.next();
|
|
63
|
+
this._currentGroupProvenance = next.done ? null : next.value;
|
|
64
|
+
}
|
|
34
65
|
yield ((_a = this.next) === null || _a === void 0 ? void 0 : _a.run());
|
|
35
66
|
}
|
|
67
|
+
this._currentGroupProvenance = null;
|
|
36
68
|
yield _super.finish.call(this);
|
|
37
69
|
});
|
|
38
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregated_with.js","sourceRoot":"","sources":["../../../src/parsing/operations/aggregated_with.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"aggregated_with.js","sourceRoot":"","sources":["../../../src/parsing/operations/aggregated_with.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,0DAAiC;AACjC,sDAA4B;AAE5B,MAAM,cAAe,SAAQ,gBAAI;IAAjC;;QACY,cAAS,GAAY,IAAI,kBAAO,CAAC,IAAI,CAAC,QAAwB,CAAC,CAAC;QACxE;;;;;WAKG;QACK,4BAAuB,GAAyB,IAAI,CAAC;IAoCjE,CAAC;IAnCgB,GAAG;;YACZ,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QAC/B,CAAC;KAAA;IACD;;;OAGG;IACI,mBAAmB,CAAC,MAAwB;QAC/C,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IACD;;;;;OAKG;IACI,kBAAkB;QACrB,OAAO;YACH,QAAQ,EAAE,GAAkB,EAAE,WAC1B,OAAA,MAAA,IAAI,CAAC,uBAAuB,mCAAI,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAA,EAAA;SACjF,CAAC;IACN,CAAC;IACY,MAAM;;;;;;YACf,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC;YACxD,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAC9E,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAE,CAAC;gBAChD,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;oBACpB,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;oBAC7B,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;gBACjE,CAAC;gBACD,MAAM,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,GAAG,EAAE,CAAA,CAAC;YAC3B,CAAC;YACD,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC;YACpC,MAAM,OAAM,MAAM,WAAE,CAAC;QACzB,CAAC;KAAA;CACJ;AAED,kBAAe,cAAc,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NodeBinding, ProvenanceSource, RelationshipBinding, RowProvenance, RowSegment } from "../../compute/provenance";
|
|
1
2
|
import AggregationElement from "../functions/reducer_element";
|
|
2
3
|
import Projection from "./projection";
|
|
3
4
|
import Where from "./where";
|
|
@@ -5,11 +6,25 @@ declare class Node {
|
|
|
5
6
|
private _value;
|
|
6
7
|
private _children;
|
|
7
8
|
private _elements;
|
|
9
|
+
private _provenanceNodes;
|
|
10
|
+
private _provenanceRels;
|
|
11
|
+
private _provenanceRows;
|
|
8
12
|
constructor(value?: any);
|
|
9
13
|
get value(): any;
|
|
10
14
|
get children(): Map<string, Node>;
|
|
11
15
|
get elements(): AggregationElement[] | null;
|
|
12
16
|
set elements(elements: AggregationElement[]);
|
|
17
|
+
/** Per-group dedup map for contributing node bindings (lazy). */
|
|
18
|
+
get provenanceNodes(): Map<string, NodeBinding>;
|
|
19
|
+
/** Per-group dedup map for contributing relationship bindings (lazy). */
|
|
20
|
+
get provenanceRelationships(): Map<string, RelationshipBinding>;
|
|
21
|
+
/**
|
|
22
|
+
* Per-input-row contribution segments in arrival order. One entry is
|
|
23
|
+
* appended per `GroupBy.run()` call that lands in this group, so an
|
|
24
|
+
* aggregate row's `provenance.rows` aligns positionally with
|
|
25
|
+
* `collect(...)` outputs from the same group.
|
|
26
|
+
*/
|
|
27
|
+
get provenanceRows(): RowSegment[];
|
|
13
28
|
}
|
|
14
29
|
declare class GroupBy extends Projection {
|
|
15
30
|
private _root;
|
|
@@ -17,7 +32,17 @@ declare class GroupBy extends Projection {
|
|
|
17
32
|
private _mappers;
|
|
18
33
|
private _reducers;
|
|
19
34
|
protected _where: Where | null;
|
|
35
|
+
private _provenanceSources;
|
|
20
36
|
run(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Register a provenance source whose snapshot is folded into the
|
|
39
|
+
* currently active group on every `run()`. May be called multiple
|
|
40
|
+
* times to compose contributions from several upstream MATCHes or
|
|
41
|
+
* upstream aggregation boundaries.
|
|
42
|
+
*/
|
|
43
|
+
addProvenanceSource(source: ProvenanceSource): void;
|
|
44
|
+
get provenanceEnabled(): boolean;
|
|
45
|
+
private recordProvenance;
|
|
21
46
|
private get root();
|
|
22
47
|
private get current();
|
|
23
48
|
private set current(value);
|
|
@@ -28,6 +53,13 @@ declare class GroupBy extends Projection {
|
|
|
28
53
|
private _generate_mappers;
|
|
29
54
|
private get reducers();
|
|
30
55
|
generate_results(mapperIndex?: number, node?: Node): Generator<Record<string, any>>;
|
|
56
|
+
/**
|
|
57
|
+
* Walks the group tree in the same traversal order as
|
|
58
|
+
* {@link generate_results}, yielding the materialised {@link
|
|
59
|
+
* RowProvenance} for each emitted group. When provenance is
|
|
60
|
+
* disabled, yields empty entries so callers can still zip cleanly.
|
|
61
|
+
*/
|
|
62
|
+
generate_provenance(mapperIndex?: number, node?: Node): Generator<RowProvenance>;
|
|
31
63
|
set where(where: Where);
|
|
32
64
|
get where(): boolean;
|
|
33
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group_by.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/group_by.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"group_by.d.ts","sourceRoot":"","sources":["../../../src/parsing/operations/group_by.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,UAAU,EAGb,MAAM,0BAA0B,CAAC;AAGlC,OAAO,kBAAkB,MAAM,8BAA8B,CAAC;AAC9D,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,cAAM,IAAI;IACN,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,gBAAgB,CAAyC;IACjE,OAAO,CAAC,eAAe,CAAiD;IACxE,OAAO,CAAC,eAAe,CAA6B;gBACxC,KAAK,GAAE,GAAU;IAG7B,IAAW,KAAK,IAAI,GAAG,CAEtB;IACD,IAAW,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAEvC;IACD,IAAW,QAAQ,IAAI,kBAAkB,EAAE,GAAG,IAAI,CAEjD;IACD,IAAW,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,EAAE,EAEjD;IACD,iEAAiE;IACjE,IAAW,eAAe,IAAI,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAKrD;IACD,yEAAyE;IACzE,IAAW,uBAAuB,IAAI,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAKrE;IACD;;;;;OAKG;IACH,IAAW,cAAc,IAAI,UAAU,EAAE,CAKxC;CACJ;AAED,cAAM,OAAQ,SAAQ,UAAU;IAC5B,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,QAAQ,CAA6B;IAC7C,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