@datakable/core 1.0.1 → 2.0.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/README.md +5 -3
- package/dist/catalog/codes.cjs +12 -8
- package/dist/catalog/codes.cjs.map +1 -1
- package/dist/catalog/codes.js +12 -8
- package/dist/catalog/codes.js.map +1 -1
- package/dist/catalog/slots.cjs +10 -6
- package/dist/catalog/slots.cjs.map +1 -1
- package/dist/catalog/slots.js +10 -6
- package/dist/catalog/slots.js.map +1 -1
- package/dist/{codes-OsjAR3Wz.d.cts → codes-B9bCK73-.d.cts} +30 -4
- package/dist/{codes-OsjAR3Wz.d.ts → codes-B9bCK73-.d.ts} +30 -4
- package/dist/column/column-def.cjs.map +1 -1
- package/dist/column/get-value.cjs +6 -1
- package/dist/column/get-value.cjs.map +1 -1
- package/dist/column/get-value.js +6 -1
- package/dist/column/get-value.js.map +1 -1
- package/dist/column-filters.d.cts +2 -2
- package/dist/column-filters.d.ts +2 -2
- package/dist/diagnostics/build.cjs +4 -1
- package/dist/diagnostics/build.cjs.map +1 -1
- package/dist/diagnostics/build.js +4 -1
- package/dist/diagnostics/build.js.map +1 -1
- package/dist/diagnostics/catalog.cjs +11 -5
- package/dist/diagnostics/catalog.cjs.map +1 -1
- package/dist/diagnostics/catalog.js +10 -5
- package/dist/diagnostics/catalog.js.map +1 -1
- package/dist/diagnostics/codes.cjs +12 -8
- package/dist/diagnostics/codes.cjs.map +1 -1
- package/dist/diagnostics/codes.js +12 -8
- package/dist/diagnostics/codes.js.map +1 -1
- package/dist/diagnostics/console.cjs +13 -6
- package/dist/diagnostics/console.cjs.map +1 -1
- package/dist/diagnostics/console.js +13 -6
- package/dist/diagnostics/console.js.map +1 -1
- package/dist/diagnostics/env.cjs +1 -0
- package/dist/diagnostics/env.cjs.map +1 -1
- package/dist/diagnostics/env.js +1 -0
- package/dist/diagnostics/env.js.map +1 -1
- package/dist/diagnostics/explain-text.cjs +2 -1
- package/dist/diagnostics/explain-text.cjs.map +1 -1
- package/dist/diagnostics/explain-text.js +2 -1
- package/dist/diagnostics/explain-text.js.map +1 -1
- package/dist/diagnostics/explain.cjs +3 -2
- package/dist/diagnostics/explain.cjs.map +1 -1
- package/dist/diagnostics/explain.js +3 -2
- package/dist/diagnostics/explain.js.map +1 -1
- package/dist/diagnostics/hub.cjs +5 -4
- package/dist/diagnostics/hub.cjs.map +1 -1
- package/dist/diagnostics/hub.js +5 -4
- package/dist/diagnostics/hub.js.map +1 -1
- package/dist/diagnostics/process-guard.cjs +26 -0
- package/dist/diagnostics/process-guard.cjs.map +1 -0
- package/dist/diagnostics/process-guard.js +9 -0
- package/dist/diagnostics/process-guard.js.map +1 -0
- package/dist/diagnostics/prose.cjs +120 -0
- package/dist/diagnostics/prose.cjs.map +1 -0
- package/dist/diagnostics/prose.js +93 -0
- package/dist/diagnostics/prose.js.map +1 -0
- package/dist/diagnostics/redact.cjs +7 -4
- package/dist/diagnostics/redact.cjs.map +1 -1
- package/dist/diagnostics/redact.js +6 -4
- package/dist/diagnostics/redact.js.map +1 -1
- package/dist/diagnostics/trace-store.cjs +6 -0
- package/dist/diagnostics/trace-store.cjs.map +1 -1
- package/dist/diagnostics/trace-store.js +4 -0
- package/dist/diagnostics/trace-store.js.map +1 -1
- package/dist/diagnostics/tracer.cjs +74 -13
- package/dist/diagnostics/tracer.cjs.map +1 -1
- package/dist/diagnostics/tracer.js +75 -14
- package/dist/diagnostics/tracer.js.map +1 -1
- package/dist/diagnostics/types.cjs.map +1 -1
- package/dist/{explain-vkD2cewE.d.cts → explain-Q8Cg0cZy.d.cts} +13 -4
- package/dist/{explain-Dn99IQt0.d.ts → explain-i0OATi_W.d.ts} +13 -4
- package/dist/feature/codes.cjs +1 -0
- package/dist/feature/codes.cjs.map +1 -1
- package/dist/feature/codes.js +1 -0
- package/dist/feature/codes.js.map +1 -1
- package/dist/feature/install.cjs +4 -3
- package/dist/feature/install.cjs.map +1 -1
- package/dist/feature/install.js +4 -3
- package/dist/feature/install.js.map +1 -1
- package/dist/features/column-filters/codes.cjs +1 -0
- package/dist/features/column-filters/codes.cjs.map +1 -1
- package/dist/features/column-filters/codes.js +1 -0
- package/dist/features/column-filters/codes.js.map +1 -1
- package/dist/features/column-filters/column-filters.cjs +4 -2
- package/dist/features/column-filters/column-filters.cjs.map +1 -1
- package/dist/features/column-filters/column-filters.js +4 -2
- package/dist/features/column-filters/column-filters.js.map +1 -1
- package/dist/features/column-filters/match.cjs +5 -5
- package/dist/features/column-filters/match.cjs.map +1 -1
- package/dist/features/column-filters/match.js +5 -5
- package/dist/features/column-filters/match.js.map +1 -1
- package/dist/features/pagination/codes.cjs +1 -0
- package/dist/features/pagination/codes.cjs.map +1 -1
- package/dist/features/pagination/codes.js +1 -0
- package/dist/features/pagination/codes.js.map +1 -1
- package/dist/features/pagination/pagination.cjs +16 -13
- package/dist/features/pagination/pagination.cjs.map +1 -1
- package/dist/features/pagination/pagination.js +16 -13
- package/dist/features/pagination/pagination.js.map +1 -1
- package/dist/features/search/codes.cjs +1 -0
- package/dist/features/search/codes.cjs.map +1 -1
- package/dist/features/search/codes.js +1 -0
- package/dist/features/search/codes.js.map +1 -1
- package/dist/features/search/search-index.cjs +68 -15
- package/dist/features/search/search-index.cjs.map +1 -1
- package/dist/features/search/search-index.js +68 -15
- package/dist/features/search/search-index.js.map +1 -1
- package/dist/features/search/search.cjs +41 -9
- package/dist/features/search/search.cjs.map +1 -1
- package/dist/features/search/search.js +41 -9
- package/dist/features/search/search.js.map +1 -1
- package/dist/features/search/skipped-codes.cjs +45 -0
- package/dist/features/search/skipped-codes.cjs.map +1 -0
- package/dist/features/search/skipped-codes.js +20 -0
- package/dist/features/search/skipped-codes.js.map +1 -0
- package/dist/features/sorting/codes.cjs +1 -0
- package/dist/features/sorting/codes.cjs.map +1 -1
- package/dist/features/sorting/codes.js +1 -0
- package/dist/features/sorting/codes.js.map +1 -1
- package/dist/features/sorting/sorting.cjs +16 -20
- package/dist/features/sorting/sorting.cjs.map +1 -1
- package/dist/features/sorting/sorting.js +16 -20
- package/dist/features/sorting/sorting.js.map +1 -1
- package/dist/features/sorting/strategy.cjs +4 -4
- package/dist/features/sorting/strategy.cjs.map +1 -1
- package/dist/features/sorting/strategy.js +4 -4
- package/dist/features/sorting/strategy.js.map +1 -1
- package/dist/features/validity/codes.cjs +1 -0
- package/dist/features/validity/codes.cjs.map +1 -1
- package/dist/features/validity/codes.js +1 -0
- package/dist/features/validity/codes.js.map +1 -1
- package/dist/features/validity/validity.cjs +3 -3
- package/dist/features/validity/validity.cjs.map +1 -1
- package/dist/features/validity/validity.js +3 -3
- package/dist/features/validity/validity.js.map +1 -1
- package/dist/index.d.cts +13 -10
- package/dist/index.d.ts +13 -10
- package/dist/ingest/data-check-codes.cjs +4 -2
- package/dist/ingest/data-check-codes.cjs.map +1 -1
- package/dist/ingest/data-check-codes.js +4 -2
- package/dist/ingest/data-check-codes.js.map +1 -1
- package/dist/ingest/data-checks.cjs +1 -1
- package/dist/ingest/data-checks.cjs.map +1 -1
- package/dist/ingest/data-checks.js +1 -1
- package/dist/ingest/data-checks.js.map +1 -1
- package/dist/ingest/row-key-codes.cjs +1 -0
- package/dist/ingest/row-key-codes.cjs.map +1 -1
- package/dist/ingest/row-key-codes.js +1 -0
- package/dist/ingest/row-key-codes.js.map +1 -1
- package/dist/ingest/row-key.cjs +23 -20
- package/dist/ingest/row-key.cjs.map +1 -1
- package/dist/ingest/row-key.js +23 -20
- package/dist/ingest/row-key.js.map +1 -1
- package/dist/ingest/schema-codes.cjs +1 -0
- package/dist/ingest/schema-codes.cjs.map +1 -1
- package/dist/ingest/schema-codes.js +1 -0
- package/dist/ingest/schema-codes.js.map +1 -1
- package/dist/ingest/unique-fields.cjs +2 -2
- package/dist/ingest/unique-fields.cjs.map +1 -1
- package/dist/ingest/unique-fields.js +2 -2
- package/dist/ingest/unique-fields.js.map +1 -1
- package/dist/intercept/boundary.cjs +4 -2
- package/dist/intercept/boundary.cjs.map +1 -1
- package/dist/intercept/boundary.js +4 -2
- package/dist/intercept/boundary.js.map +1 -1
- package/dist/intercept/cell-batch.cjs +4 -4
- package/dist/intercept/cell-batch.cjs.map +1 -1
- package/dist/intercept/cell-batch.js +4 -4
- package/dist/intercept/cell-batch.js.map +1 -1
- package/dist/intercept/codes.cjs +1 -0
- package/dist/intercept/codes.cjs.map +1 -1
- package/dist/intercept/codes.js +1 -0
- package/dist/intercept/codes.js.map +1 -1
- package/dist/intercept/fallbacks.cjs +12 -20
- package/dist/intercept/fallbacks.cjs.map +1 -1
- package/dist/intercept/fallbacks.js +12 -20
- package/dist/intercept/fallbacks.js.map +1 -1
- package/dist/intercept/runtime.cjs +7 -9
- package/dist/intercept/runtime.cjs.map +1 -1
- package/dist/intercept/runtime.js +7 -9
- package/dist/intercept/runtime.js.map +1 -1
- package/dist/messages/index.cjs +4 -1
- package/dist/messages/index.cjs.map +1 -1
- package/dist/messages/index.js +4 -1
- package/dist/messages/index.js.map +1 -1
- package/dist/pagination.d.cts +2 -2
- package/dist/pagination.d.ts +2 -2
- package/dist/pipeline/codes.cjs +1 -0
- package/dist/pipeline/codes.cjs.map +1 -1
- package/dist/pipeline/codes.js +1 -0
- package/dist/pipeline/codes.js.map +1 -1
- package/dist/pipeline/column-cache.cjs +94 -76
- package/dist/pipeline/column-cache.cjs.map +1 -1
- package/dist/pipeline/column-cache.js +92 -75
- package/dist/pipeline/column-cache.js.map +1 -1
- package/dist/pipeline/dev-checks.cjs +1 -0
- package/dist/pipeline/dev-checks.cjs.map +1 -1
- package/dist/pipeline/dev-checks.js +1 -0
- package/dist/pipeline/dev-checks.js.map +1 -1
- package/dist/pipeline/env-codes.cjs +3 -2
- package/dist/pipeline/env-codes.cjs.map +1 -1
- package/dist/pipeline/env-codes.js +3 -2
- package/dist/pipeline/env-codes.js.map +1 -1
- package/dist/pipeline/perf-codes.cjs +1 -0
- package/dist/pipeline/perf-codes.cjs.map +1 -1
- package/dist/pipeline/perf-codes.js +1 -0
- package/dist/pipeline/perf-codes.js.map +1 -1
- package/dist/pipeline/runner.cjs +17 -9
- package/dist/pipeline/runner.cjs.map +1 -1
- package/dist/pipeline/runner.js +17 -9
- package/dist/pipeline/runner.js.map +1 -1
- package/dist/pipeline/slice.cjs +3 -1
- package/dist/pipeline/slice.cjs.map +1 -1
- package/dist/pipeline/slice.js +3 -1
- package/dist/pipeline/slice.js.map +1 -1
- package/dist/schema.d.cts +2 -2
- package/dist/schema.d.ts +2 -2
- package/dist/{search-async-entry-v5JdEk5Y.d.cts → search-async-entry-CuLYPfY_.d.cts} +2 -2
- package/dist/{search-async-entry-DGSw2pDL.d.ts → search-async-entry-Cx7xpuVZ.d.ts} +2 -2
- package/dist/search-async.d.cts +3 -3
- package/dist/search-async.d.ts +3 -3
- package/dist/search.d.cts +8 -6
- package/dist/search.d.ts +8 -6
- package/dist/server.d.cts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/sorting.d.cts +2 -2
- package/dist/sorting.d.ts +2 -2
- package/dist/source/codes.cjs +1 -0
- package/dist/source/codes.cjs.map +1 -1
- package/dist/source/codes.js +1 -0
- package/dist/source/codes.js.map +1 -1
- package/dist/source/fetch-codes.cjs +1 -0
- package/dist/source/fetch-codes.cjs.map +1 -1
- package/dist/source/fetch-codes.js +1 -0
- package/dist/source/fetch-codes.js.map +1 -1
- package/dist/table/codes.cjs +1 -0
- package/dist/table/codes.cjs.map +1 -1
- package/dist/table/codes.js +1 -0
- package/dist/table/codes.js.map +1 -1
- package/dist/table/create-table.cjs +39 -9
- package/dist/table/create-table.cjs.map +1 -1
- package/dist/table/create-table.js +39 -9
- package/dist/table/create-table.js.map +1 -1
- package/dist/table/data-mutation.cjs +1 -0
- package/dist/table/data-mutation.cjs.map +1 -1
- package/dist/table/data-mutation.js +1 -0
- package/dist/table/data-mutation.js.map +1 -1
- package/dist/table/internals.cjs.map +1 -1
- package/dist/table/internals.js.map +1 -1
- package/dist/table/ssr-codes.cjs +1 -0
- package/dist/table/ssr-codes.cjs.map +1 -1
- package/dist/table/ssr-codes.js +1 -0
- package/dist/table/ssr-codes.js.map +1 -1
- package/dist/table/ssr.cjs +4 -1
- package/dist/table/ssr.cjs.map +1 -1
- package/dist/table/ssr.js +4 -1
- package/dist/table/ssr.js.map +1 -1
- package/dist/table/state-feedback.cjs +19 -0
- package/dist/table/state-feedback.cjs.map +1 -1
- package/dist/table/state-feedback.js +19 -0
- package/dist/table/state-feedback.js.map +1 -1
- package/dist/table/types.cjs.map +1 -1
- package/dist/table/types.js.map +1 -1
- package/dist/validity.d.cts +2 -2
- package/dist/validity.d.ts +2 -2
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/versioning/codes.cjs +18 -0
- package/dist/versioning/codes.cjs.map +1 -1
- package/dist/versioning/codes.js +18 -0
- package/dist/versioning/codes.js.map +1 -1
- package/dist/versioning/registry.cjs +4 -2
- package/dist/versioning/registry.cjs.map +1 -1
- package/dist/versioning/registry.js +4 -2
- package/dist/versioning/registry.js.map +1 -1
- package/package.json +39 -3
|
@@ -3,24 +3,39 @@ import { describeReturn, expectedReturn, formatSlot, slotDiagnostics } from "../
|
|
|
3
3
|
import { defaultFormat } from "../column/format.js";
|
|
4
4
|
import { getValue } from "../column/get-value.js";
|
|
5
5
|
import { keepDiagnostics } from "../diagnostics/catalog.js";
|
|
6
|
+
import "../diagnostics/process-guard.js";
|
|
6
7
|
import { CellFailures, runCells } from "../intercept/cell-batch.js";
|
|
7
8
|
import { createContextPool } from "../intercept/context.js";
|
|
8
9
|
import { pipelineDiagnostics } from "./codes.js";
|
|
9
10
|
import { allRows } from "./indices.js";
|
|
11
|
+
import { runJob } from "./slice.js";
|
|
10
12
|
keepDiagnostics(pipelineDiagnostics, slotDiagnostics);
|
|
11
13
|
var NULL = 1;
|
|
12
14
|
var UNDEFINED = 2;
|
|
15
|
+
var nullishKinds = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
function nullishOf(values) {
|
|
17
|
+
return nullishKinds.get(values);
|
|
18
|
+
}
|
|
13
19
|
function allStrings(values) {
|
|
14
20
|
for (let i = 0; i < values.length; i++) if (typeof values[i] !== "string") return false;
|
|
15
21
|
return true;
|
|
16
22
|
}
|
|
17
23
|
var typeName = (v) => Array.isArray(v) ? "array" : typeof v;
|
|
24
|
+
var STEP = 512;
|
|
25
|
+
var SHARED = 1024;
|
|
26
|
+
function share(cells) {
|
|
27
|
+
const seen = /* @__PURE__ */ new Map();
|
|
28
|
+
for (let r = 0; r < cells.length; r++) {
|
|
29
|
+
const s = cells[r];
|
|
30
|
+
const hit = seen.get(s);
|
|
31
|
+
if (hit !== void 0) cells[r] = hit;
|
|
32
|
+
else if (seen.size < SHARED) seen.set(s, s);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
18
35
|
function createColumnCache(host) {
|
|
19
36
|
const byData = /* @__PURE__ */ new WeakMap();
|
|
20
37
|
const pool = createContextPool();
|
|
21
38
|
const failures = new CellFailures();
|
|
22
|
-
const unrenderable = new CellFailures();
|
|
23
|
-
const badReturns = new CellFailures();
|
|
24
39
|
function entry(data, column) {
|
|
25
40
|
let cols = byData.get(data);
|
|
26
41
|
if (!cols) {
|
|
@@ -47,8 +62,6 @@ function createColumnCache(host) {
|
|
|
47
62
|
body();
|
|
48
63
|
} finally {
|
|
49
64
|
failures.reset();
|
|
50
|
-
unrenderable.reset();
|
|
51
|
-
badReturns.reset();
|
|
52
65
|
}
|
|
53
66
|
});
|
|
54
67
|
} finally {
|
|
@@ -104,6 +117,7 @@ function createColumnCache(host) {
|
|
|
104
117
|
}
|
|
105
118
|
}
|
|
106
119
|
e.nullish = kinds;
|
|
120
|
+
if (kinds) nullishKinds.set(out, kinds);
|
|
107
121
|
return out;
|
|
108
122
|
}
|
|
109
123
|
const flags = host.flags;
|
|
@@ -118,14 +132,15 @@ function createColumnCache(host) {
|
|
|
118
132
|
if (flags && flags.count > before) e.flaggedValues = true;
|
|
119
133
|
return e.values;
|
|
120
134
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
135
|
+
function* formatting(data, column, sliced) {
|
|
136
|
+
let e = entry(data, column);
|
|
123
137
|
if (e.formatted) {
|
|
124
138
|
if (flags && e.flaggedFormatted) flags.count++;
|
|
125
139
|
return e.formatted;
|
|
126
140
|
}
|
|
127
141
|
const before = flags?.count ?? 0;
|
|
128
142
|
const vals = values(data, column);
|
|
143
|
+
if (sliced) yield;
|
|
129
144
|
const kinds = e.nullish;
|
|
130
145
|
const valueAt = (r) => {
|
|
131
146
|
const k = kinds?.[r];
|
|
@@ -133,80 +148,82 @@ function createColumnCache(host) {
|
|
|
133
148
|
};
|
|
134
149
|
const n = data.length;
|
|
135
150
|
const rows = allRows(data);
|
|
136
|
-
let out;
|
|
137
151
|
const format = column.format;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
badReturns.add(r, void 0);
|
|
155
|
-
}
|
|
156
|
-
return defaultFormat(s);
|
|
157
|
-
},
|
|
158
|
-
cells,
|
|
159
|
-
"",
|
|
160
|
-
failures
|
|
161
|
-
);
|
|
162
|
-
failures.report(host.emit, column.index, column.id, "format");
|
|
163
|
-
if (process.env.NODE_ENV !== "production" && badReturns.count > 0) {
|
|
164
|
-
host.emit("DK_CALLBACK_BAD_RETURN", {
|
|
165
|
-
slot: `columns[${column.index}].format`,
|
|
166
|
-
column: column.id,
|
|
167
|
-
expected: expectedReturn(formatSlot),
|
|
168
|
-
received: describeReturn(firstBad),
|
|
169
|
-
count: badReturns.count,
|
|
170
|
-
rows: Array.from(badReturns.sample()),
|
|
171
|
-
fallback: formatSlot.fallback
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
let cur = 0;
|
|
177
|
-
let firstType = "";
|
|
178
|
-
const onUnrenderable = column.hasCell ? void 0 : (v) => {
|
|
179
|
-
if (unrenderable.count === 0) firstType = typeName(v);
|
|
180
|
-
unrenderable.add(cur, void 0);
|
|
181
|
-
};
|
|
182
|
-
runCells(
|
|
183
|
-
rows,
|
|
184
|
-
(r) => {
|
|
185
|
-
cur = r;
|
|
186
|
-
return defaultFormat(valueAt(r), onUnrenderable);
|
|
187
|
-
},
|
|
188
|
-
cells,
|
|
189
|
-
"",
|
|
190
|
-
failures
|
|
191
|
-
);
|
|
192
|
-
failures.report(host.emit, column.index, column.id, "format");
|
|
193
|
-
if (unrenderable.count > 0) {
|
|
194
|
-
host.emit("DK_UNRENDERABLE_VALUE", {
|
|
195
|
-
column: column.id,
|
|
196
|
-
index: column.index,
|
|
197
|
-
count: unrenderable.count,
|
|
198
|
-
rows: Array.from(unrenderable.sample()),
|
|
199
|
-
valueType: firstType
|
|
200
|
-
});
|
|
152
|
+
const failed = new CellFailures();
|
|
153
|
+
const bad = process.env.NODE_ENV !== "production" ? new CellFailures() : void 0;
|
|
154
|
+
const unrendered = new CellFailures();
|
|
155
|
+
let firstBad;
|
|
156
|
+
let firstType = "";
|
|
157
|
+
let cur = 0;
|
|
158
|
+
const onUnrenderable = column.hasCell ? void 0 : (v) => {
|
|
159
|
+
if (unrendered.count === 0) firstType = typeName(v);
|
|
160
|
+
unrendered.add(cur, void 0);
|
|
161
|
+
};
|
|
162
|
+
const cell = format ? (r) => {
|
|
163
|
+
const s = format(valueAt(r));
|
|
164
|
+
if (typeof s === "string") return s;
|
|
165
|
+
if (process.env.NODE_ENV !== "production" && bad) {
|
|
166
|
+
if (bad.count === 0) firstBad = s;
|
|
167
|
+
bad.add(r, void 0);
|
|
201
168
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
169
|
+
return defaultFormat(s);
|
|
170
|
+
} : (r) => {
|
|
171
|
+
cur = r;
|
|
172
|
+
return defaultFormat(valueAt(r), onUnrenderable);
|
|
173
|
+
};
|
|
174
|
+
const strings = !format && !(vals instanceof Float64Array) && allStrings(vals);
|
|
175
|
+
let out = strings ? void 0 : new Array(n).fill("");
|
|
176
|
+
for (let from = 0; from < n; from += STEP) {
|
|
177
|
+
const part = sliced && !strings ? rows.subarray(from, from + STEP) : rows;
|
|
178
|
+
batch(column, "format", "format", part, () => {
|
|
179
|
+
if (strings) out = vals;
|
|
180
|
+
else runCells(part, cell, out, "", failed);
|
|
181
|
+
});
|
|
182
|
+
if (part === rows || from + STEP >= n) break;
|
|
183
|
+
yield;
|
|
184
|
+
}
|
|
185
|
+
out ??= new Array(n).fill("");
|
|
186
|
+
failed.report(host.emit, column.index, column.id, "format");
|
|
187
|
+
if (process.env.NODE_ENV !== "production" && bad && bad.count > 0) {
|
|
188
|
+
host.emit("DK_CALLBACK_BAD_RETURN", {
|
|
189
|
+
slot: `columns[${column.index}].format`,
|
|
190
|
+
column: column.id,
|
|
191
|
+
expected: expectedReturn(formatSlot),
|
|
192
|
+
received: describeReturn(firstBad),
|
|
193
|
+
count: bad.count,
|
|
194
|
+
rows: Array.from(bad.sample()),
|
|
195
|
+
fallback: formatSlot.fallback
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
if (unrendered.count > 0) {
|
|
199
|
+
host.emit("DK_UNRENDERABLE_VALUE", {
|
|
200
|
+
column: column.id,
|
|
201
|
+
index: column.index,
|
|
202
|
+
count: unrendered.count,
|
|
203
|
+
rows: Array.from(unrendered.sample()),
|
|
204
|
+
valueType: firstType
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
if (out !== vals) share(out);
|
|
208
|
+
e = entry(data, column);
|
|
209
|
+
if (!e.formatted) {
|
|
210
|
+
e.formatted = out;
|
|
211
|
+
if (flags && flags.count > before) e.flaggedFormatted = true;
|
|
212
|
+
}
|
|
205
213
|
return e.formatted;
|
|
206
214
|
}
|
|
207
|
-
|
|
215
|
+
function formatted(data, column) {
|
|
216
|
+
return runJob(() => formatting(data, column, false));
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
values,
|
|
220
|
+
formatted,
|
|
221
|
+
formattedSliced: (data, column) => formatting(data, column, true),
|
|
222
|
+
batch
|
|
223
|
+
};
|
|
208
224
|
}
|
|
209
225
|
export {
|
|
210
|
-
createColumnCache
|
|
226
|
+
createColumnCache,
|
|
227
|
+
nullishOf
|
|
211
228
|
};
|
|
212
229
|
//# sourceMappingURL=column-cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pipeline/column-cache.ts"],"sourcesContent":["import { describeReturn, expectedReturn, formatSlot, slotDiagnostics } from '../catalog/slots'\nimport { defaultFormat } from '../column/format'\nimport { getValue } from '../column/get-value'\nimport { keepDiagnostics } from '../diagnostics/catalog'\nimport type { Emit } from '../diagnostics/types'\nimport { CellFailures, type CellSlot, runCells } from '../intercept/cell-batch'\nimport { type ContextBase, createContextPool } from '../intercept/context'\nimport type { InterceptorRuntime } from '../intercept/runtime'\nimport { pipelineDiagnostics } from './codes'\nimport type { ColumnLike, ResolvedColumn } from './columns'\nimport { allRows } from './indices'\nimport type { ColumnValues } from './types'\n\nkeepDiagnostics(pipelineDiagnostics, slotDiagnostics)\n\nexport interface ColumnCacheHost {\n readonly runtime: InterceptorRuntime\n readonly emit: Emit\n base(): ContextBase\n /**\n * The §6.6 status rule's counter (pipeline/status-rule.ts): `emit` increments it for a diagnostic\n * the rule counts. An entry whose read incremented it is flagged, and every later read of that\n * entry increments it again (its cells still hold the fallback values).\n */\n readonly flags?: { count: number }\n}\n\nexport interface ColumnCache {\n /**\n * The values of `column` for every row of `data` (index = row index). An all-number column is a\n * `Float64Array` with `NaN` for `null` / `undefined`; any other column a plain array.\n */\n values(data: readonly unknown[], column: ResolvedColumn): ColumnValues\n /** `format` (or the default formatter) applied to {@link values}: what the user sees. */\n formatted(data: readonly unknown[], column: ResolvedColumn): readonly string[]\n /**\n * Runs `body` as one `column:batch` over `rows` (pooled ctx, `where` = `columns[i].<field>`):\n * interceptors see one dispatch per column, never one per cell. `body` loops over the cells\n * with an inline `try/catch` and reports its own failures.\n */\n batch(\n column: ResolvedColumn,\n slot: CellSlot,\n field: string,\n rows: Uint32Array,\n body: () => void,\n ): void\n}\n\ninterface Entry {\n values?: ColumnValues\n /** Numeric columns: 1 = `null`, 2 = `undefined` per row. Absent when there are none. */\n nullish?: Uint8Array | undefined\n formatted?: readonly string[]\n /** Reading `values` / `formatted` reported a diagnostic the status rule counts. */\n flaggedValues?: boolean\n flaggedFormatted?: boolean\n}\n\nconst NULL = 1\nconst UNDEFINED = 2\n\nfunction allStrings(values: readonly unknown[]): boolean {\n for (let i = 0; i < values.length; i++) if (typeof values[i] !== 'string') return false\n return true\n}\n\nconst typeName = (v: unknown) => (Array.isArray(v) ? 'array' : typeof v)\n\n/**\n * The lazy column cache (§9.1): a column is read only when a step asks for it, once per data\n * reference, in one `column:batch` per column (never per cell, §3.4). Entries live in a `WeakMap`\n * keyed by the data reference, then by the column definition, so new data or a changed column\n * releases them.\n */\nexport function createColumnCache(host: ColumnCacheHost): ColumnCache {\n const byData = new WeakMap<readonly unknown[], WeakMap<ColumnLike, Entry>>()\n const pool = createContextPool()\n const failures = new CellFailures()\n const unrenderable = new CellFailures()\n /** Dev: `format` returns that broke the slot contract (`first` = the first bad value). */\n const badReturns = new CellFailures()\n\n function entry(data: readonly unknown[], column: ResolvedColumn): Entry {\n let cols = byData.get(data)\n if (!cols) {\n cols = new WeakMap()\n byData.set(data, cols)\n }\n let e = cols.get(column.def)\n if (!e) {\n e = {}\n cols.set(column.def, e)\n }\n return e\n }\n\n /** One `column:batch` (pooled ctx); `where` = `columns[i].<field>`, never row data. */\n function batch(\n column: ResolvedColumn,\n slot: CellSlot,\n field: string,\n rows: Uint32Array,\n body: () => void,\n ) {\n const ctx = pool.acquire(\n 'column:batch',\n { column: column.id, slot, rows },\n `columns[${column.index}].${field}`,\n host.base(),\n )\n try {\n void host.runtime.run('column:batch', ctx, (): undefined => {\n try {\n body()\n } finally {\n failures.reset()\n unrenderable.reset()\n badReturns.reset()\n }\n })\n } finally {\n pool.release(ctx)\n }\n }\n\n function readValues(data: readonly unknown[], column: ResolvedColumn, e: Entry): ColumnValues {\n const n = data.length\n const rows = allRows(data)\n const out: unknown[] = new Array(n).fill(undefined)\n const field = column.path ? 'key' : 'accessor'\n batch(column, 'accessor', field, rows, () => {\n const path = column.path\n const accessor = column.accessor\n if (path) {\n let cur = 0\n const onError = (error: unknown) => failures.add(cur, error)\n runCells(\n rows,\n (r) => {\n cur = r\n return getValue(data[r], path, onError)\n },\n out,\n undefined,\n failures,\n )\n } else if (accessor) {\n runCells(rows, (r) => accessor(data[r]), out, undefined, failures)\n }\n failures.report(host.emit, column.index, column.id, 'accessor', undefined, field)\n })\n return toNumeric(out, e) ?? out\n }\n\n /** A `Float64Array` when every non-nullish value is a number (and there is one); else nothing. */\n function toNumeric(values: unknown[], e: Entry): Float64Array | undefined {\n let numbers = 0\n let nullish = 0\n for (let i = 0; i < values.length; i++) {\n const v = values[i]\n if (typeof v === 'number') numbers++\n else if (v === null || v === undefined) nullish++\n else return undefined\n }\n if (numbers === 0) return undefined\n const out = new Float64Array(values.length)\n const kinds = nullish > 0 ? new Uint8Array(values.length) : undefined\n for (let i = 0; i < values.length; i++) {\n const v = values[i]\n if (typeof v === 'number') out[i] = v\n else {\n out[i] = Number.NaN\n if (kinds) kinds[i] = v === null ? NULL : UNDEFINED\n }\n }\n e.nullish = kinds\n return out\n }\n\n const flags = host.flags\n\n function values(data: readonly unknown[], column: ResolvedColumn): ColumnValues {\n const e = entry(data, column)\n if (e.values) {\n if (flags && e.flaggedValues) flags.count++\n return e.values\n }\n const before = flags?.count ?? 0\n e.values = readValues(data, column, e)\n if (flags && flags.count > before) e.flaggedValues = true\n return e.values\n }\n\n function formatted(data: readonly unknown[], column: ResolvedColumn): readonly string[] {\n const e = entry(data, column)\n if (e.formatted) {\n if (flags && e.flaggedFormatted) flags.count++\n return e.formatted\n }\n const before = flags?.count ?? 0\n const vals = values(data, column)\n const kinds = e.nullish\n // The raw value: nullish numbers read back as null / undefined, not NaN.\n const valueAt = (r: number): unknown => {\n const k = kinds?.[r]\n return k ? (k === NULL ? null : undefined) : vals[r]\n }\n const n = data.length\n const rows = allRows(data)\n let out: string[] | undefined\n const format = column.format\n batch(column, 'format', 'format', rows, () => {\n // Values that are all strings already format to themselves: no copy (§9.3 memory).\n if (!format && !(vals instanceof Float64Array) && allStrings(vals)) {\n out = vals as string[]\n return\n }\n const cells: string[] = new Array(n).fill('')\n out = cells\n if (format) {\n let firstBad: unknown\n runCells(\n rows,\n (r) => {\n const s = format(valueAt(r))\n if (typeof s === 'string') return s\n // Slot contract (dev): counted only on this non-string path; coerced either way.\n if ((process.env.NODE_ENV !== \"production\")) {\n if (badReturns.count === 0) firstBad = s\n badReturns.add(r, undefined)\n }\n return defaultFormat(s)\n },\n cells,\n '',\n failures,\n )\n failures.report(host.emit, column.index, column.id, 'format')\n if ((process.env.NODE_ENV !== \"production\") && badReturns.count > 0) {\n host.emit('DK_CALLBACK_BAD_RETURN', {\n slot: `columns[${column.index}].format`,\n column: column.id,\n expected: expectedReturn(formatSlot),\n received: describeReturn(firstBad),\n count: badReturns.count,\n rows: Array.from(badReturns.sample()),\n fallback: formatSlot.fallback,\n })\n }\n return\n }\n let cur = 0\n let firstType = ''\n // A column with `cell` renders itself: its formatted value only feeds search.\n const onUnrenderable = column.hasCell\n ? undefined\n : (v: unknown) => {\n if (unrenderable.count === 0) firstType = typeName(v)\n unrenderable.add(cur, undefined)\n }\n runCells(\n rows,\n (r) => {\n cur = r\n return defaultFormat(valueAt(r), onUnrenderable)\n },\n cells,\n '',\n failures,\n )\n failures.report(host.emit, column.index, column.id, 'format')\n if (unrenderable.count > 0) {\n host.emit('DK_UNRENDERABLE_VALUE', {\n column: column.id,\n index: column.index,\n count: unrenderable.count,\n rows: Array.from(unrenderable.sample()),\n valueType: firstType,\n })\n }\n })\n // An interceptor skipped the batch: every cell is the slot fallback.\n e.formatted = out ?? new Array<string>(n).fill('')\n if (flags && flags.count > before) e.flaggedFormatted = true\n return e.formatted\n }\n\n return { values, formatted, batch }\n}\n"],"mappings":";AAAA,SAAS,gBAAgB,gBAAgB,YAAY,uBAAuB;AAC5E,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAEhC,SAAS,cAA6B,gBAAgB;AACtD,SAA2B,yBAAyB;AAEpD,SAAS,2BAA2B;AAEpC,SAAS,eAAe;AAGxB,gBAAgB,qBAAqB,eAAe;AA8CpD,IAAM,OAAO;AACb,IAAM,YAAY;AAElB,SAAS,WAAW,QAAqC;AACvD,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,IAAK,KAAI,OAAO,OAAO,CAAC,MAAM,SAAU,QAAO;AAClF,SAAO;AACT;AAEA,IAAM,WAAW,CAAC,MAAgB,MAAM,QAAQ,CAAC,IAAI,UAAU,OAAO;AAQ/D,SAAS,kBAAkB,MAAoC;AACpE,QAAM,SAAS,oBAAI,QAAwD;AAC3E,QAAM,OAAO,kBAAkB;AAC/B,QAAM,WAAW,IAAI,aAAa;AAClC,QAAM,eAAe,IAAI,aAAa;AAEtC,QAAM,aAAa,IAAI,aAAa;AAEpC,WAAS,MAAM,MAA0B,QAA+B;AACtE,QAAI,OAAO,OAAO,IAAI,IAAI;AAC1B,QAAI,CAAC,MAAM;AACT,aAAO,oBAAI,QAAQ;AACnB,aAAO,IAAI,MAAM,IAAI;AAAA,IACvB;AACA,QAAI,IAAI,KAAK,IAAI,OAAO,GAAG;AAC3B,QAAI,CAAC,GAAG;AACN,UAAI,CAAC;AACL,WAAK,IAAI,OAAO,KAAK,CAAC;AAAA,IACxB;AACA,WAAO;AAAA,EACT;AAGA,WAAS,MACP,QACA,MACA,OACA,MACA,MACA;AACA,UAAM,MAAM,KAAK;AAAA,MACf;AAAA,MACA,EAAE,QAAQ,OAAO,IAAI,MAAM,KAAK;A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ACpD,qBAAa,IAAI,KAAK,MAAS;AAAA,MACjC;AACJ;AAAA,QACE;AAAA,QACA,CAAC,MAAM;AACL,gBAAM;AACN,iBAAO,cAAc,QAAQ,CAAC,GAAG,cAAc;AAAA,QACjD;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA,eAAS,OAAO,KAAK,MAAM,OAAO,OAAO,OAAO,IAAI,QAAQ;AAC5D,UAAI,aAAa,QAAQ,GAAG;AAC1B,aAAK,KAAK,yBAAyB;AAAA,UACjC,QAAQ,OAAO;AAAA,UACf,OAAO,OAAO;AAAA,UACd,OAAO,aAAa;AAAA,UACpB,MAAM,MAAM,KAAK,aAAa,OAAO,CAAC;AAAA,UACtC,WAAW;AAAA,QACb,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAED,MAAE,YAAY,OAAO,IAAI,MAAc,CAAC,EAAE,KAAK,EAAE;AACjD,QAAI,SAAS,MAAM,QAAQ,OAAQ,GAAE,mBAAmB;AACxD,WAAO,EAAE;AAAA,EACX;AAEA,SAAO,EAAE,QAAQ,WAAW,MAAM;AACpC;","names":["values"]}
|
|
1
|
+
{"version":3,"sources":["../../src/pipeline/column-cache.ts"],"sourcesContent":["import { describeReturn, expectedReturn, formatSlot, slotDiagnostics } from '../catalog/slots'\nimport { defaultFormat } from '../column/format'\nimport { getValue } from '../column/get-value'\nimport { keepDiagnostics } from '../diagnostics/catalog'\nimport '../diagnostics/process-guard'\nimport type { Emit } from '../diagnostics/types'\nimport { CellFailures, type CellSlot, runCells } from '../intercept/cell-batch'\nimport { type ContextBase, createContextPool } from '../intercept/context'\nimport type { InterceptorRuntime } from '../intercept/runtime'\nimport { pipelineDiagnostics } from './codes'\nimport type { ColumnLike, ResolvedColumn } from './columns'\nimport { allRows } from './indices'\nimport { runJob } from './slice'\nimport type { ColumnValues } from './types'\n\nkeepDiagnostics(pipelineDiagnostics, slotDiagnostics)\n\nexport interface ColumnCacheHost {\n readonly runtime: InterceptorRuntime\n readonly emit: Emit\n base(): ContextBase\n /**\n * The §6.6 status rule's counter (pipeline/status-rule.ts): `emit` increments it for a diagnostic\n * the rule counts. An entry whose read incremented it is flagged, and every later read of that\n * entry increments it again (its cells still hold the fallback values).\n */\n readonly flags?: { count: number }\n}\n\n/**\n * Internal member of the pipeline's run context (not on the public `RowModelContext`): a column's\n * formatted values as a time-sliced job (search, #40); `undefined` for an unknown column.\n */\nexport interface SlicedFormatting {\n readonly formattedSliced?: (\n id: string,\n ) => Generator<undefined, readonly string[] | undefined, undefined>\n}\n\nexport interface ColumnCache {\n /**\n * The values of `column` for every row of `data` (index = row index). An all-number column is a\n * `Float64Array` with `NaN` for `null` / `undefined`; any other column a plain array.\n */\n values(data: readonly unknown[], column: ResolvedColumn): ColumnValues\n /** `format` (or the default formatter) applied to {@link values}: what the user sees. */\n formatted(data: readonly unknown[], column: ResolvedColumn): readonly string[]\n /**\n * {@link formatted} as a time-sliced job (§9.1, #40): the cells are formatted in batches of a few\n * milliseconds with a `yield` between them (one `column:batch` per batch, never per cell).\n */\n formattedSliced(\n data: readonly unknown[],\n column: ResolvedColumn,\n ): Generator<undefined, readonly string[], undefined>\n /**\n * Runs `body` as one `column:batch` over `rows` (pooled ctx, `where` = `columns[i].<field>`):\n * interceptors see one dispatch per column, never one per cell. `body` loops over the cells\n * with an inline `try/catch` and reports its own failures.\n */\n batch(\n column: ResolvedColumn,\n slot: CellSlot,\n field: string,\n rows: Uint32Array,\n body: () => void,\n ): void\n}\n\ninterface Entry {\n values?: ColumnValues\n /** Numeric columns: 1 = `null`, 2 = `undefined` per row. Absent when there are none. */\n nullish?: Uint8Array | undefined\n formatted?: readonly string[]\n /** Reading `values` / `formatted` reported a diagnostic the status rule counts. */\n flaggedValues?: boolean\n flaggedFormatted?: boolean\n}\n\nconst NULL = 1\nconst UNDEFINED = 2\n\n/** The nullish kinds of each cached numeric column that has any (see {@link nullishOf}). */\nconst nullishKinds = new WeakMap<Float64Array, Uint8Array>()\n\n/**\n * Which rows of a cached all-number column (`values` from the column cache) hold `null` /\n * `undefined` (non-zero) rather than a real `NaN`: both are stored as `NaN`. `undefined` when no\n * row does. Lets search format such a column on the fly (`''` / `'NaN'`) instead of caching a\n * string per row (#27).\n */\nexport function nullishOf(values: Float64Array): Uint8Array | undefined {\n return nullishKinds.get(values)\n}\n\nfunction allStrings(values: readonly unknown[]): boolean {\n for (let i = 0; i < values.length; i++) if (typeof values[i] !== 'string') return false\n return true\n}\n\nconst typeName = (v: unknown) => (Array.isArray(v) ? 'array' : typeof v)\n\n/** Rows per batch of a sliced format (#40): small, so the slicer's clock check comes often. */\nconst STEP = 512\n\n/** Distinct strings {@link share} remembers per column: enough for categories, tags, flags. */\nconst SHARED = 1024\n\n/**\n * Repeated formatted strings of a column share one copy (§9.3 memory, #27): each formatted cell is\n * a fresh string, so a column of tags or categories would keep one per row. Only the first\n * {@link SHARED} distinct strings are remembered; once per column, after formatting.\n */\nfunction share(cells: string[]) {\n const seen = new Map<string, string>()\n for (let r = 0; r < cells.length; r++) {\n const s = cells[r] as string\n const hit = seen.get(s)\n if (hit !== undefined) cells[r] = hit\n else if (seen.size < SHARED) seen.set(s, s)\n }\n}\n\n/**\n * The lazy column cache (§9.1): a column is read only when a step asks for it, once per data\n * reference, in one `column:batch` per column (never per cell, §3.4). Entries live in a `WeakMap`\n * keyed by the data reference, then by the column definition, so new data or a changed column\n * releases them.\n */\nexport function createColumnCache(host: ColumnCacheHost): ColumnCache {\n const byData = new WeakMap<readonly unknown[], WeakMap<ColumnLike, Entry>>()\n const pool = createContextPool()\n const failures = new CellFailures()\n\n function entry(data: readonly unknown[], column: ResolvedColumn): Entry {\n let cols = byData.get(data)\n if (!cols) {\n cols = new WeakMap()\n byData.set(data, cols)\n }\n let e = cols.get(column.def)\n if (!e) {\n e = {}\n cols.set(column.def, e)\n }\n return e\n }\n\n /** One `column:batch` (pooled ctx); `where` = `columns[i].<field>`, never row data. */\n function batch(\n column: ResolvedColumn,\n slot: CellSlot,\n field: string,\n rows: Uint32Array,\n body: () => void,\n ) {\n const ctx = pool.acquire(\n 'column:batch',\n { column: column.id, slot, rows },\n `columns[${column.index}].${field}`,\n host.base(),\n )\n try {\n void host.runtime.run('column:batch', ctx, (): undefined => {\n try {\n body()\n } finally {\n failures.reset()\n }\n })\n } finally {\n pool.release(ctx)\n }\n }\n\n function readValues(data: readonly unknown[], column: ResolvedColumn, e: Entry): ColumnValues {\n const n = data.length\n const rows = allRows(data)\n const out: unknown[] = new Array(n).fill(undefined)\n const field = column.path ? 'key' : 'accessor'\n batch(column, 'accessor', field, rows, () => {\n const path = column.path\n const accessor = column.accessor\n if (path) {\n let cur = 0\n const onError = (error: unknown) => failures.add(cur, error)\n runCells(\n rows,\n (r) => {\n cur = r\n return getValue(data[r], path, onError)\n },\n out,\n undefined,\n failures,\n )\n } else if (accessor) {\n runCells(rows, (r) => accessor(data[r]), out, undefined, failures)\n }\n failures.report(host.emit, column.index, column.id, 'accessor', undefined, field)\n })\n return toNumeric(out, e) ?? out\n }\n\n /** A `Float64Array` when every non-nullish value is a number (and there is one); else nothing. */\n function toNumeric(values: unknown[], e: Entry): Float64Array | undefined {\n let numbers = 0\n let nullish = 0\n for (let i = 0; i < values.length; i++) {\n const v = values[i]\n if (typeof v === 'number') numbers++\n else if (v === null || v === undefined) nullish++\n else return undefined\n }\n if (numbers === 0) return undefined\n const out = new Float64Array(values.length)\n const kinds = nullish > 0 ? new Uint8Array(values.length) : undefined\n for (let i = 0; i < values.length; i++) {\n const v = values[i]\n if (typeof v === 'number') out[i] = v\n else {\n out[i] = Number.NaN\n if (kinds) kinds[i] = v === null ? NULL : UNDEFINED\n }\n }\n e.nullish = kinds\n if (kinds) nullishKinds.set(out, kinds)\n return out\n }\n\n const flags = host.flags\n\n function values(data: readonly unknown[], column: ResolvedColumn): ColumnValues {\n const e = entry(data, column)\n if (e.values) {\n if (flags && e.flaggedValues) flags.count++\n return e.values\n }\n const before = flags?.count ?? 0\n e.values = readValues(data, column, e)\n if (flags && flags.count > before) e.flaggedValues = true\n return e.values\n }\n\n /**\n * Formats `column` once per data reference, in one `column:batch`; `sliced` (#40): in batches of\n * {@link STEP} rows with a `yield` between them, so the slicer can end the task on time (a slow\n * formatter, e.g. dates, is never one long task). Failures and slot-contract breaks are counted\n * over the whole column and reported once.\n */\n function* formatting(\n data: readonly unknown[],\n column: ResolvedColumn,\n sliced: boolean,\n ): Generator<undefined, readonly string[], undefined> {\n let e = entry(data, column)\n if (e.formatted) {\n if (flags && e.flaggedFormatted) flags.count++\n return e.formatted\n }\n const before = flags?.count ?? 0\n const vals = values(data, column)\n if (sliced) yield // reading the values is a task of its own\n const kinds = e.nullish\n // The raw value: nullish numbers read back as null / undefined, not NaN.\n const valueAt = (r: number): unknown => {\n const k = kinds?.[r]\n return k ? (k === NULL ? null : undefined) : vals[r]\n }\n const n = data.length\n const rows = allRows(data)\n const format = column.format\n // Job-local counts: a sliced column spans several batches.\n const failed = new CellFailures()\n const bad = (process.env.NODE_ENV !== \"production\") ? new CellFailures() : undefined\n const unrendered = new CellFailures()\n let firstBad: unknown\n let firstType = ''\n let cur = 0\n // A column with `cell` renders itself: its formatted value only feeds search.\n const onUnrenderable = column.hasCell\n ? undefined\n : (v: unknown) => {\n if (unrendered.count === 0) firstType = typeName(v)\n unrendered.add(cur, undefined)\n }\n const cell = format\n ? (r: number) => {\n const s = format(valueAt(r))\n if (typeof s === 'string') return s\n // Slot contract (dev): counted only on this non-string path; coerced either way.\n if ((process.env.NODE_ENV !== \"production\") && bad) {\n if (bad.count === 0) firstBad = s\n bad.add(r, undefined)\n }\n return defaultFormat(s)\n }\n : (r: number) => {\n cur = r\n return defaultFormat(valueAt(r), onUnrenderable)\n }\n // Values that are all strings already format to themselves: no copy (§9.3 memory).\n const strings = !format && !(vals instanceof Float64Array) && allStrings(vals)\n let out: string[] | undefined = strings ? undefined : new Array(n).fill('')\n for (let from = 0; from < n; from += STEP) {\n const part = sliced && !strings ? rows.subarray(from, from + STEP) : rows\n // An interceptor may skip a batch: its cells keep the slot fallback ('').\n batch(column, 'format', 'format', part, () => {\n if (strings) out = vals as string[]\n else runCells(part, cell, out as string[], '', failed)\n })\n if (part === rows || from + STEP >= n) break\n yield\n }\n out ??= new Array<string>(n).fill('')\n failed.report(host.emit, column.index, column.id, 'format')\n if ((process.env.NODE_ENV !== \"production\") && bad && bad.count > 0) {\n host.emit('DK_CALLBACK_BAD_RETURN', {\n slot: `columns[${column.index}].format`,\n column: column.id,\n expected: expectedReturn(formatSlot),\n received: describeReturn(firstBad),\n count: bad.count,\n rows: Array.from(bad.sample()),\n fallback: formatSlot.fallback,\n })\n }\n if (unrendered.count > 0) {\n host.emit('DK_UNRENDERABLE_VALUE', {\n column: column.id,\n index: column.index,\n count: unrendered.count,\n rows: Array.from(unrendered.sample()),\n valueType: firstType,\n })\n }\n if (out !== vals) share(out)\n // A synchronous read may have cached the column while a sliced job ran.\n e = entry(data, column)\n if (!e.formatted) {\n e.formatted = out\n if (flags && flags.count > before) e.flaggedFormatted = true\n }\n return e.formatted\n }\n\n function formatted(data: readonly unknown[], column: ResolvedColumn): readonly string[] {\n return runJob(() => formatting(data, column, false))\n }\n\n return {\n values,\n formatted,\n formattedSliced: (data, column) => formatting(data, column, true),\n batch,\n }\n}\n"],"mappings":";AAAA,SAAS,gBAAgB,gBAAgB,YAAY,uBAAuB;AAC5E,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,OAAO;AAEP,SAAS,cAA6B,gBAAgB;AACtD,SAA2B,yBAAyB;AAEpD,SAAS,2BAA2B;AAEpC,SAAS,eAAe;AACxB,SAAS,cAAc;AAGvB,gBAAgB,qBAAqB,eAAe;AAgEpD,IAAM,OAAO;AACb,IAAM,YAAY;AAGlB,IAAM,eAAe,oBAAI,QAAkC;AAQpD,SAAS,UAAU,QAA8C;AACtE,SAAO,aAAa,IAAI,MAAM;AAChC;AAEA,SAAS,WAAW,QAAqC;AACvD,WAAS,IAAI,GAAG,IAAI,OAAO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AG;AACnE,WAAK,KAAK,0BAA0B;AAAA,QAClC,MAAM,WAAW,OAAO,KAAK;AAAA,QAC7B,QAAQ,OAAO;AAAA,QACf,UAAU,eAAe,UAAU;AAAA,QACnC,UAAU,eAAe,QAAQ;AAAA,QACjC,OAAO,IAAI;AAAA,QACX,MAAM,MAAM,KAAK,IAAI,OAAO,CAAC;AAAA,QAC7B,UAAU,WAAW;AAAA,MACvB,CAAC;AAAA,IACH;AACA,QAAI,WAAW,QAAQ,GAAG;AACxB,WAAK,KAAK,yBAAyB;AAAA,QACjC,QAAQ,OAAO;AAAA,QACf,OAAO,OAAO;AAAA,QACd,OAAO,WAAW;AAAA,QAClB,MAAM,MAAM,KAAK,WAAW,OAAO,CAAC;AAAA,QACpC,WAAW;AAAA,MACb,CAAC;AAAA,IACH;AACA,QAAI,QAAQ,KAAM,OAAM,GAAG;AAE3B,QAAI,MAAM,MAAM,MAAM;AACtB,QAAI,CAAC,EAAE,WAAW;AAChB,QAAE,YAAY;AACd,UAAI,SAAS,MAAM,QAAQ,OAAQ,GAAE,mBAAmB;AAAA,IAC1D;AACA,WAAO,EAAE;AAAA,EACX;AAEA,WAAS,UAAU,MAA0B,QAA2C;AACtF,WAAO,OAAO,MAAM,WAAW,MAAM,QAAQ,KAAK,CAAC;AAAA,EACrD;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,iBAAiB,CAAC,MAAM,WAAW,WAAW,MAAM,QAAQ,IAAI;AAAA,IAChE;AAAA,EACF;AACF;","names":["values"]}
|
|
@@ -27,6 +27,7 @@ __export(dev_checks_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(dev_checks_exports);
|
|
28
28
|
var import_slots = require("../catalog/slots.cjs");
|
|
29
29
|
var import_catalog = require("../diagnostics/catalog.cjs");
|
|
30
|
+
var import_process_guard = require("../diagnostics/process-guard.cjs");
|
|
30
31
|
var stepDiagnostics = process.env.NODE_ENV !== "production" ? [
|
|
31
32
|
(0, import_catalog.defineDiagnostic)({
|
|
32
33
|
code: "DK_FEATURE_BAD_OUTPUT",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pipeline/dev-checks.ts"],"sourcesContent":["import { describeReturn } from '../catalog/slots'\nimport { defineDiagnostic } from '../diagnostics/catalog'\nimport type { Emit } from '../diagnostics/types'\n\n/**\n * `devChecks` on `pipeline:step` (§3.4, §8.3): a feature `rowModel` must return a `Uint32Array` of\n * row indices and must not write to its input (the input is the previous step's memoised output).\n * Dev only: the definitions, their text and the checks sit behind `(process.env.NODE_ENV !== \"production\")`, so a production bundle has\n * none of it. They run only when a step is recomputed (memo misses), with bounded cost.\n */\n\ndeclare module '../diagnostics/catalog' {\n interface DiagnosticCatalog {\n DK_FEATURE_BAD_OUTPUT: {\n feature: string\n /** What `rowModel` returned, as a type (`an Array`); never the value. */\n received: string\n /** An out-of-range index (a `Uint32Array` output): its value and the row count. */\n index?: number\n rowCount?: number\n }\n DK_FEATURE_MUTATED_INPUT: {\n feature: string\n }\n }\n}\n\nexport const stepDiagnostics = (process.env.NODE_ENV !== \"production\")\n ? [\n defineDiagnostic({\n code: 'DK_FEATURE_BAD_OUTPUT',\n level: 'error',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n problem: (d) =>\n d.index === undefined\n ? `feature \"${d.feature}\" rowModel() returned ${d.received}, not a Uint32Array of ` +\n 'row indices'\n : `feature \"${d.feature}\" rowModel() returned row index ${d.index}, but the data has ` +\n `${d.rowCount} rows`,\n impact: () => 'the step passed its input through (the feature had no effect this run)',\n fix: (d) => [\n `return a Uint32Array of row indices from rowModel() of feature \"${d.feature}\": ` +\n 'indices.subarray(0, n), a new Uint32Array(n) you filled, or Uint32Array.from(list)',\n d.index === undefined\n ? 'rowModel() is synchronous; return the input indices when the feature is inactive'\n : 'only return indices taken from the input (each is a position in options.data)',\n ],\n }),\n defineDiagnostic({\n code: 'DK_FEATURE_MUTATED_INPUT',\n level: 'warn',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n problem: (d) => `feature \"${d.feature}\" rowModel() wrote to its input indices`,\n impact: () =>\n \"the input is the previous step's memoised output: later runs can show rows in the \" +\n 'wrong order or the wrong rows until the data changes',\n fix: (d) => [\n `copy before changing in feature \"${d.feature}\": indices.slice().sort(...) instead of ` +\n 'indices.sort(...)',\n 'or write the result into a new Uint32Array',\n ],\n }),\n ]\n : []\n\n/** At most this many input positions are hashed per step. */\nconst SAMPLES = 64\n\n/**\n * A bounded fingerprint of an index array: FNV-1a over the length and at most {@link SAMPLES}\n * evenly spaced positions (every position when shorter; position 0 always).\n */\nexport function indexPrint(indices: Uint32Array): number {\n const n = indices.length\n const stride = n <= SAMPLES ? 1 : Math.floor(n / SAMPLES)\n let h = Math.imul(0x811c9dc5 ^ n, 0x01000193)\n for (let i = 0, k = 0; i < n && k < SAMPLES; i += stride, k++) {\n h = Math.imul(h ^ (indices[i] as number), 0x01000193)\n }\n return h >>> 0\n}\n\n/** The first index `>= rowCount`, or -1. */\nfunction outOfRange(out: Uint32Array, rowCount: number): number {\n for (let i = 0; i < out.length; i++) if ((out[i] as number) >= rowCount) return out[i] as number\n return -1\n}\n\n/**\n * Checks one recomputed step (dev): reports a mutated input (`before` = {@link indexPrint} of the\n * input before `rowModel` ran) and a bad output. Returns whether `out` can be used.\n */\nexport function checkStep(\n emit: Emit,\n feature: string,\n input: Uint32Array,\n before: number,\n out: unknown,\n rowCount: number,\n): boolean {\n if (indexPrint(input) !== before) emit('DK_FEATURE_MUTATED_INPUT', { feature })\n if (!(out instanceof Uint32Array)) {\n emit('DK_FEATURE_BAD_OUTPUT', { feature, received: describeReturn(out) })\n return false\n }\n const index = outOfRange(out, rowCount)\n if (index < 0) return true\n emit('DK_FEATURE_BAD_OUTPUT', { feature, received: 'a Uint32Array', index, rowCount })\n return false\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,qBAAiC;
|
|
1
|
+
{"version":3,"sources":["../../src/pipeline/dev-checks.ts"],"sourcesContent":["import { describeReturn } from '../catalog/slots'\nimport { defineDiagnostic } from '../diagnostics/catalog'\nimport '../diagnostics/process-guard'\nimport type { Emit } from '../diagnostics/types'\n\n/**\n * `devChecks` on `pipeline:step` (§3.4, §8.3): a feature `rowModel` must return a `Uint32Array` of\n * row indices and must not write to its input (the input is the previous step's memoised output).\n * Dev only: the definitions, their text and the checks sit behind `(process.env.NODE_ENV !== \"production\")`, so a production bundle has\n * none of it. They run only when a step is recomputed (memo misses), with bounded cost.\n */\n\ndeclare module '../diagnostics/catalog' {\n interface DiagnosticCatalog {\n DK_FEATURE_BAD_OUTPUT: {\n feature: string\n /** What `rowModel` returned, as a type (`an Array`); never the value. */\n received: string\n /** An out-of-range index (a `Uint32Array` output): its value and the row count. */\n index?: number\n rowCount?: number\n }\n DK_FEATURE_MUTATED_INPUT: {\n feature: string\n }\n }\n}\n\nexport const stepDiagnostics = (process.env.NODE_ENV !== \"production\")\n ? [\n defineDiagnostic({\n code: 'DK_FEATURE_BAD_OUTPUT',\n level: 'error',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n problem: (d) =>\n d.index === undefined\n ? `feature \"${d.feature}\" rowModel() returned ${d.received}, not a Uint32Array of ` +\n 'row indices'\n : `feature \"${d.feature}\" rowModel() returned row index ${d.index}, but the data has ` +\n `${d.rowCount} rows`,\n impact: () => 'the step passed its input through (the feature had no effect this run)',\n fix: (d) => [\n `return a Uint32Array of row indices from rowModel() of feature \"${d.feature}\": ` +\n 'indices.subarray(0, n), a new Uint32Array(n) you filled, or Uint32Array.from(list)',\n d.index === undefined\n ? 'rowModel() is synchronous; return the input indices when the feature is inactive'\n : 'only return indices taken from the input (each is a position in options.data)',\n ],\n }),\n defineDiagnostic({\n code: 'DK_FEATURE_MUTATED_INPUT',\n level: 'warn',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n problem: (d) => `feature \"${d.feature}\" rowModel() wrote to its input indices`,\n impact: () =>\n \"the input is the previous step's memoised output: later runs can show rows in the \" +\n 'wrong order or the wrong rows until the data changes',\n fix: (d) => [\n `copy before changing in feature \"${d.feature}\": indices.slice().sort(...) instead of ` +\n 'indices.sort(...)',\n 'or write the result into a new Uint32Array',\n ],\n }),\n ]\n : []\n\n/** At most this many input positions are hashed per step. */\nconst SAMPLES = 64\n\n/**\n * A bounded fingerprint of an index array: FNV-1a over the length and at most {@link SAMPLES}\n * evenly spaced positions (every position when shorter; position 0 always).\n */\nexport function indexPrint(indices: Uint32Array): number {\n const n = indices.length\n const stride = n <= SAMPLES ? 1 : Math.floor(n / SAMPLES)\n let h = Math.imul(0x811c9dc5 ^ n, 0x01000193)\n for (let i = 0, k = 0; i < n && k < SAMPLES; i += stride, k++) {\n h = Math.imul(h ^ (indices[i] as number), 0x01000193)\n }\n return h >>> 0\n}\n\n/** The first index `>= rowCount`, or -1. */\nfunction outOfRange(out: Uint32Array, rowCount: number): number {\n for (let i = 0; i < out.length; i++) if ((out[i] as number) >= rowCount) return out[i] as number\n return -1\n}\n\n/**\n * Checks one recomputed step (dev): reports a mutated input (`before` = {@link indexPrint} of the\n * input before `rowModel` ran) and a bad output. Returns whether `out` can be used.\n */\nexport function checkStep(\n emit: Emit,\n feature: string,\n input: Uint32Array,\n before: number,\n out: unknown,\n rowCount: number,\n): boolean {\n if (indexPrint(input) !== before) emit('DK_FEATURE_MUTATED_INPUT', { feature })\n if (!(out instanceof Uint32Array)) {\n emit('DK_FEATURE_BAD_OUTPUT', { feature, received: describeReturn(out) })\n return false\n }\n const index = outOfRange(out, rowCount)\n if (index < 0) return true\n emit('DK_FEATURE_BAD_OUTPUT', { feature, received: 'a Uint32Array', index, rowCount })\n return false\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAC/B,qBAAiC;AACjC,2BAAO;AA0BA,IAAM,kBAAmB,QAAQ,IAAI,aAAa,eACrD;AAAA,MACE,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,MACA,SACA,OACA,QACA,KACA,UACS;AACT,MAAI,WAAW,KAAK,MAAM,OAAQ,MAAK,4BAA4B,EAAE,QAAQ,CAAC;AAC9E,MAAI,EAAE,eAAe,cAAc;AACjC,SAAK,yBAAyB,EAAE,SAAS,cAAU,6BAAe,GAAG,EAAE,CAAC;AACxE,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,WAAW,KAAK,QAAQ;AACtC,MAAI,QAAQ,EAAG,QAAO;AACtB,OAAK,yBAAyB,EAAE,SAAS,UAAU,iBAAiB,OAAO,SAAS,CAAC;AACrF,SAAO;AACT;","names":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/pipeline/dev-checks.ts
|
|
2
2
|
import { describeReturn } from "../catalog/slots.js";
|
|
3
3
|
import { defineDiagnostic } from "../diagnostics/catalog.js";
|
|
4
|
+
import "../diagnostics/process-guard.js";
|
|
4
5
|
var stepDiagnostics = process.env.NODE_ENV !== "production" ? [
|
|
5
6
|
defineDiagnostic({
|
|
6
7
|
code: "DK_FEATURE_BAD_OUTPUT",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pipeline/dev-checks.ts"],"sourcesContent":["import { describeReturn } from '../catalog/slots'\nimport { defineDiagnostic } from '../diagnostics/catalog'\nimport type { Emit } from '../diagnostics/types'\n\n/**\n * `devChecks` on `pipeline:step` (§3.4, §8.3): a feature `rowModel` must return a `Uint32Array` of\n * row indices and must not write to its input (the input is the previous step's memoised output).\n * Dev only: the definitions, their text and the checks sit behind `(process.env.NODE_ENV !== \"production\")`, so a production bundle has\n * none of it. They run only when a step is recomputed (memo misses), with bounded cost.\n */\n\ndeclare module '../diagnostics/catalog' {\n interface DiagnosticCatalog {\n DK_FEATURE_BAD_OUTPUT: {\n feature: string\n /** What `rowModel` returned, as a type (`an Array`); never the value. */\n received: string\n /** An out-of-range index (a `Uint32Array` output): its value and the row count. */\n index?: number\n rowCount?: number\n }\n DK_FEATURE_MUTATED_INPUT: {\n feature: string\n }\n }\n}\n\nexport const stepDiagnostics = (process.env.NODE_ENV !== \"production\")\n ? [\n defineDiagnostic({\n code: 'DK_FEATURE_BAD_OUTPUT',\n level: 'error',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n problem: (d) =>\n d.index === undefined\n ? `feature \"${d.feature}\" rowModel() returned ${d.received}, not a Uint32Array of ` +\n 'row indices'\n : `feature \"${d.feature}\" rowModel() returned row index ${d.index}, but the data has ` +\n `${d.rowCount} rows`,\n impact: () => 'the step passed its input through (the feature had no effect this run)',\n fix: (d) => [\n `return a Uint32Array of row indices from rowModel() of feature \"${d.feature}\": ` +\n 'indices.subarray(0, n), a new Uint32Array(n) you filled, or Uint32Array.from(list)',\n d.index === undefined\n ? 'rowModel() is synchronous; return the input indices when the feature is inactive'\n : 'only return indices taken from the input (each is a position in options.data)',\n ],\n }),\n defineDiagnostic({\n code: 'DK_FEATURE_MUTATED_INPUT',\n level: 'warn',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n problem: (d) => `feature \"${d.feature}\" rowModel() wrote to its input indices`,\n impact: () =>\n \"the input is the previous step's memoised output: later runs can show rows in the \" +\n 'wrong order or the wrong rows until the data changes',\n fix: (d) => [\n `copy before changing in feature \"${d.feature}\": indices.slice().sort(...) instead of ` +\n 'indices.sort(...)',\n 'or write the result into a new Uint32Array',\n ],\n }),\n ]\n : []\n\n/** At most this many input positions are hashed per step. */\nconst SAMPLES = 64\n\n/**\n * A bounded fingerprint of an index array: FNV-1a over the length and at most {@link SAMPLES}\n * evenly spaced positions (every position when shorter; position 0 always).\n */\nexport function indexPrint(indices: Uint32Array): number {\n const n = indices.length\n const stride = n <= SAMPLES ? 1 : Math.floor(n / SAMPLES)\n let h = Math.imul(0x811c9dc5 ^ n, 0x01000193)\n for (let i = 0, k = 0; i < n && k < SAMPLES; i += stride, k++) {\n h = Math.imul(h ^ (indices[i] as number), 0x01000193)\n }\n return h >>> 0\n}\n\n/** The first index `>= rowCount`, or -1. */\nfunction outOfRange(out: Uint32Array, rowCount: number): number {\n for (let i = 0; i < out.length; i++) if ((out[i] as number) >= rowCount) return out[i] as number\n return -1\n}\n\n/**\n * Checks one recomputed step (dev): reports a mutated input (`before` = {@link indexPrint} of the\n * input before `rowModel` ran) and a bad output. Returns whether `out` can be used.\n */\nexport function checkStep(\n emit: Emit,\n feature: string,\n input: Uint32Array,\n before: number,\n out: unknown,\n rowCount: number,\n): boolean {\n if (indexPrint(input) !== before) emit('DK_FEATURE_MUTATED_INPUT', { feature })\n if (!(out instanceof Uint32Array)) {\n emit('DK_FEATURE_BAD_OUTPUT', { feature, received: describeReturn(out) })\n return false\n }\n const index = outOfRange(out, rowCount)\n if (index < 0) return true\n emit('DK_FEATURE_BAD_OUTPUT', { feature, received: 'a Uint32Array', index, rowCount })\n return false\n}\n"],"mappings":";AAAA,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;
|
|
1
|
+
{"version":3,"sources":["../../src/pipeline/dev-checks.ts"],"sourcesContent":["import { describeReturn } from '../catalog/slots'\nimport { defineDiagnostic } from '../diagnostics/catalog'\nimport '../diagnostics/process-guard'\nimport type { Emit } from '../diagnostics/types'\n\n/**\n * `devChecks` on `pipeline:step` (§3.4, §8.3): a feature `rowModel` must return a `Uint32Array` of\n * row indices and must not write to its input (the input is the previous step's memoised output).\n * Dev only: the definitions, their text and the checks sit behind `(process.env.NODE_ENV !== \"production\")`, so a production bundle has\n * none of it. They run only when a step is recomputed (memo misses), with bounded cost.\n */\n\ndeclare module '../diagnostics/catalog' {\n interface DiagnosticCatalog {\n DK_FEATURE_BAD_OUTPUT: {\n feature: string\n /** What `rowModel` returned, as a type (`an Array`); never the value. */\n received: string\n /** An out-of-range index (a `Uint32Array` output): its value and the row count. */\n index?: number\n rowCount?: number\n }\n DK_FEATURE_MUTATED_INPUT: {\n feature: string\n }\n }\n}\n\nexport const stepDiagnostics = (process.env.NODE_ENV !== \"production\")\n ? [\n defineDiagnostic({\n code: 'DK_FEATURE_BAD_OUTPUT',\n level: 'error',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n problem: (d) =>\n d.index === undefined\n ? `feature \"${d.feature}\" rowModel() returned ${d.received}, not a Uint32Array of ` +\n 'row indices'\n : `feature \"${d.feature}\" rowModel() returned row index ${d.index}, but the data has ` +\n `${d.rowCount} rows`,\n impact: () => 'the step passed its input through (the feature had no effect this run)',\n fix: (d) => [\n `return a Uint32Array of row indices from rowModel() of feature \"${d.feature}\": ` +\n 'indices.subarray(0, n), a new Uint32Array(n) you filled, or Uint32Array.from(list)',\n d.index === undefined\n ? 'rowModel() is synchronous; return the input indices when the feature is inactive'\n : 'only return indices taken from the input (each is a position in options.data)',\n ],\n }),\n defineDiagnostic({\n code: 'DK_FEATURE_MUTATED_INPUT',\n level: 'warn',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n problem: (d) => `feature \"${d.feature}\" rowModel() wrote to its input indices`,\n impact: () =>\n \"the input is the previous step's memoised output: later runs can show rows in the \" +\n 'wrong order or the wrong rows until the data changes',\n fix: (d) => [\n `copy before changing in feature \"${d.feature}\": indices.slice().sort(...) instead of ` +\n 'indices.sort(...)',\n 'or write the result into a new Uint32Array',\n ],\n }),\n ]\n : []\n\n/** At most this many input positions are hashed per step. */\nconst SAMPLES = 64\n\n/**\n * A bounded fingerprint of an index array: FNV-1a over the length and at most {@link SAMPLES}\n * evenly spaced positions (every position when shorter; position 0 always).\n */\nexport function indexPrint(indices: Uint32Array): number {\n const n = indices.length\n const stride = n <= SAMPLES ? 1 : Math.floor(n / SAMPLES)\n let h = Math.imul(0x811c9dc5 ^ n, 0x01000193)\n for (let i = 0, k = 0; i < n && k < SAMPLES; i += stride, k++) {\n h = Math.imul(h ^ (indices[i] as number), 0x01000193)\n }\n return h >>> 0\n}\n\n/** The first index `>= rowCount`, or -1. */\nfunction outOfRange(out: Uint32Array, rowCount: number): number {\n for (let i = 0; i < out.length; i++) if ((out[i] as number) >= rowCount) return out[i] as number\n return -1\n}\n\n/**\n * Checks one recomputed step (dev): reports a mutated input (`before` = {@link indexPrint} of the\n * input before `rowModel` ran) and a bad output. Returns whether `out` can be used.\n */\nexport function checkStep(\n emit: Emit,\n feature: string,\n input: Uint32Array,\n before: number,\n out: unknown,\n rowCount: number,\n): boolean {\n if (indexPrint(input) !== before) emit('DK_FEATURE_MUTATED_INPUT', { feature })\n if (!(out instanceof Uint32Array)) {\n emit('DK_FEATURE_BAD_OUTPUT', { feature, received: describeReturn(out) })\n return false\n }\n const index = outOfRange(out, rowCount)\n if (index < 0) return true\n emit('DK_FEATURE_BAD_OUTPUT', { feature, received: 'a Uint32Array', index, rowCount })\n return false\n}\n"],"mappings":";AAAA,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,OAAO;AA0BA,IAAM,kBAAmB,QAAQ,IAAI,aAAa,eACrD;AAAA,EACE,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,CAAC,OAAO,EAAE,MAAM,WAAW,MAAM,EAAE,QAAQ;AAAA,IAClD,SAAS,CAAC,MACR,EAAE,UAAU,SACR,YAAY,EAAE,OAAO,yBAAyB,EAAE,QAAQ,uCAExD,YAAY,EAAE,OAAO,mCAAmC,EAAE,KAAK,sBAC5D,EAAE,QAAQ;AAAA,IACnB,QAAQ,MAAM;AAAA,IACd,KAAK,CAAC,MAAM;AAAA,MACV,mEAAmE,EAAE,OAAO;AAAA,MAE5E,EAAE,UAAU,SACR,qFACA;AAAA,IACN;AAAA,EACF,CAAC;AAAA,EACD,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,OAAO;AAAA,IACP,OAAO,CAAC,OAAO,EAAE,MAAM,WAAW,MAAM,EAAE,QAAQ;AAAA,IAClD,SAAS,CAAC,MAAM,YAAY,EAAE,OAAO;AAAA,IACrC,QAAQ,MACN;AAAA,IAEF,KAAK,CAAC,MAAM;AAAA,MACV,oCAAoC,EAAE,OAAO;AAAA,MAE7C;AAAA,IACF;AAAA,EACF,CAAC;AACH,IACA,CAAC;AAGL,IAAM,UAAU;AAMT,SAAS,WAAW,SAA8B;AACvD,QAAM,IAAI,QAAQ;AAClB,QAAM,SAAS,KAAK,UAAU,IAAI,KAAK,MAAM,IAAI,OAAO;AACxD,MAAI,IAAI,KAAK,KAAK,aAAa,GAAG,QAAU;AAC5C,WAAS,IAAI,GAAG,IAAI,GAAG,IAAI,KAAK,IAAI,SAAS,KAAK,QAAQ,KAAK;AAC7D,QAAI,KAAK,KAAK,IAAK,QAAQ,CAAC,GAAc,QAAU;AAAA,EACtD;AACA,SAAO,MAAM;AACf;AAGA,SAAS,WAAW,KAAkB,UAA0B;AAC9D,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,IAAK,KAAK,IAAI,CAAC,KAAgB,SAAU,QAAO,IAAI,CAAC;AACrF,SAAO;AACT;AAMO,SAAS,UACd,MACA,SACA,OACA,QACA,KACA,UACS;AACT,MAAI,WAAW,KAAK,MAAM,OAAQ,MAAK,4BAA4B,EAAE,QAAQ,CAAC;AAC9E,MAAI,EAAE,eAAe,cAAc;AACjC,SAAK,yBAAyB,EAAE,SAAS,UAAU,eAAe,GAAG,EAAE,CAAC;AACxE,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,WAAW,KAAK,QAAQ;AACtC,MAAI,QAAQ,EAAG,QAAO;AACtB,OAAK,yBAAyB,EAAE,SAAS,UAAU,iBAAiB,OAAO,SAAS,CAAC;AACrF,SAAO;AACT;","names":[]}
|
|
@@ -25,6 +25,7 @@ __export(env_codes_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(env_codes_exports);
|
|
27
27
|
var import_catalog = require("../diagnostics/catalog.cjs");
|
|
28
|
+
var import_process_guard = require("../diagnostics/process-guard.cjs");
|
|
28
29
|
var ms = (n) => `${n.toFixed(1)} ms`;
|
|
29
30
|
var envMessages = {
|
|
30
31
|
DK_ENV_FALLBACK: {
|
|
@@ -39,11 +40,11 @@ var envMessages = {
|
|
|
39
40
|
]
|
|
40
41
|
},
|
|
41
42
|
DK_PERF_HINT: {
|
|
42
|
-
problem: (d) =>
|
|
43
|
+
problem: (d) => `${d.sliced ? "a time slice of " : ""}the "${d.feature}" step took ${ms(d.ms)} on ${d.rows} rows, over the ${ms(d.budget)} budget of one task` + (d.slot ? `; ${Math.round((d.share ?? 1) * 100)} % of it in ${d.slot} (column "${d.column}")` : ""),
|
|
43
44
|
impact: () => "the page could not respond to input while it ran (a long task)",
|
|
44
45
|
fix: (d) => [
|
|
45
46
|
d.stage === "none" ? `move the work of "${d.feature}" out of rowModel (precompute it, or run it in a Worker)` : `let the server do it: ${d.feature}({ mode: 'server' }) with options.fetcher`,
|
|
46
|
-
`make the per-row work of "${d.feature}" cheaper (precompute keys, avoid Intl / regex per row), or run it in a Worker`
|
|
47
|
+
d.slot ? `make ${d.slot} cheaper (precompute it, avoid Intl / regex per call), or run it in a Worker` : `make the per-row work of "${d.feature}" cheaper (precompute keys, avoid Intl / regex per row), or run it in a Worker`
|
|
47
48
|
]
|
|
48
49
|
}
|
|
49
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pipeline/env-codes.ts"],"sourcesContent":["import { type DiagnosticMessages, defineDiagnostic } from '../diagnostics/catalog'\n\ndeclare module '../diagnostics/catalog' {\n interface DiagnosticCatalog {\n DK_ENV_FALLBACK: {\n /** The missing runtime capability, e.g. `'scheduler.yield'` or `'Intl.Collator'`. */\n api: string\n /** The feature that needed it (`where`). */\n feature: string\n /** What was asked for, e.g. the requested collator locale. */\n requested?: string\n /** What is used instead, e.g. `'setTimeout'` or the resolved locale. */\n fallback: string\n }\n DK_PERF_HINT: {\n /** The feature whose step exceeded the budget (`where`). */\n feature: string\n /** Its pipeline stage. */\n stage: string\n /** Measured step time, in milliseconds. */\n ms: number\n /** Rows the step received. */\n rows: number\n /** The budget, in milliseconds (§9.3: the longest task). */\n budget: number\n }\n }\n}\n\nconst ms = (n: number) => `${n.toFixed(1)} ms`\n\n/** Message text (§8.2): development builds, or production via `@datakable/core/messages`. */\nexport const envMessages: DiagnosticMessages<'DK_ENV_FALLBACK' | 'DK_PERF_HINT'> = {\n DK_ENV_FALLBACK: {\n problem: (d) =>\n `${d.api}${d.requested === undefined ? '' : ` (${JSON.stringify(d.requested)})`} is not ` +\n `available in this environment (feature \"${d.feature}\")`,\n impact: (d) => `DataKable uses ${d.fallback} instead; results are the same`,\n fix: (d) =>\n d.api === 'Intl.Collator'\n ? [\n `use a locale this runtime supports (Intl.Collator.supportedLocalesOf(${JSON.stringify(d.requested)}) is empty)`,\n 'or ship full ICU data (Node: the default full-icu build; browsers: a polyfill such as @formatjs/intl)',\n ]\n : [\n `nothing to do: ${d.fallback} is a correct fallback for ${d.api}`,\n `${d.api} is used automatically where the runtime provides it`,\n ],\n },\n DK_PERF_HINT: {\n problem: (d) =>\n
|
|
1
|
+
{"version":3,"sources":["../../src/pipeline/env-codes.ts"],"sourcesContent":["import { type DiagnosticMessages, defineDiagnostic } from '../diagnostics/catalog'\nimport '../diagnostics/process-guard'\n\ndeclare module '../diagnostics/catalog' {\n interface DiagnosticCatalog {\n DK_ENV_FALLBACK: {\n /** The missing runtime capability, e.g. `'scheduler.yield'` or `'Intl.Collator'`. */\n api: string\n /** The feature that needed it (`where`). */\n feature: string\n /** What was asked for, e.g. the requested collator locale. */\n requested?: string\n /** What is used instead, e.g. `'setTimeout'` or the resolved locale. */\n fallback: string\n }\n DK_PERF_HINT: {\n /** The feature whose step exceeded the budget (`where`). */\n feature: string\n /** Its pipeline stage. */\n stage: string\n /** Measured step time, in milliseconds. */\n ms: number\n /** Rows the step received. */\n rows: number\n /** The budget, in milliseconds (§9.3: the longest task). */\n budget: number\n /** One slice of the step's time-sliced work, run between pipeline runs (#61). */\n sliced?: boolean\n /** The column slot at least half of the time went to, e.g. `columns[0].format` (#62). */\n slot?: string\n /** Its column id. */\n column?: string\n /** Its share of {@link ms}, 0.5 to 1. */\n share?: number\n }\n }\n}\n\nconst ms = (n: number) => `${n.toFixed(1)} ms`\n\n/** Message text (§8.2): development builds, or production via `@datakable/core/messages`. */\nexport const envMessages: DiagnosticMessages<'DK_ENV_FALLBACK' | 'DK_PERF_HINT'> = {\n DK_ENV_FALLBACK: {\n problem: (d) =>\n `${d.api}${d.requested === undefined ? '' : ` (${JSON.stringify(d.requested)})`} is not ` +\n `available in this environment (feature \"${d.feature}\")`,\n impact: (d) => `DataKable uses ${d.fallback} instead; results are the same`,\n fix: (d) =>\n d.api === 'Intl.Collator'\n ? [\n `use a locale this runtime supports (Intl.Collator.supportedLocalesOf(${JSON.stringify(d.requested)}) is empty)`,\n 'or ship full ICU data (Node: the default full-icu build; browsers: a polyfill such as @formatjs/intl)',\n ]\n : [\n `nothing to do: ${d.fallback} is a correct fallback for ${d.api}`,\n `${d.api} is used automatically where the runtime provides it`,\n ],\n },\n DK_PERF_HINT: {\n problem: (d) =>\n `${d.sliced ? 'a time slice of ' : ''}the \"${d.feature}\" step took ${ms(d.ms)} on ` +\n `${d.rows} rows, over the ${ms(d.budget)} budget of one task` +\n (d.slot\n ? `; ${Math.round((d.share ?? 1) * 100)} % of it in ${d.slot} (column \"${d.column}\")`\n : ''),\n impact: () => 'the page could not respond to input while it ran (a long task)',\n fix: (d) => [\n d.stage === 'none'\n ? `move the work of \"${d.feature}\" out of rowModel (precompute it, or run it in a Worker)`\n : `let the server do it: ${d.feature}({ mode: 'server' }) with options.fetcher`,\n d.slot\n ? `make ${d.slot} cheaper (precompute it, avoid Intl / regex per call), or run it in a Worker`\n : `make the per-row work of \"${d.feature}\" cheaper (precompute keys, avoid Intl / regex per row), or run it in a Worker`,\n ],\n },\n}\n\n/** `DK_ENV_FALLBACK` (§8.3): a missing runtime capability and the fallback used. */\nexport const envDiagnostics = [\n defineDiagnostic(\n {\n code: 'DK_ENV_FALLBACK',\n level: 'info',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n },\n (process.env.NODE_ENV !== \"production\") && envMessages.DK_ENV_FALLBACK,\n ),\n]\n"],"mappings":";;;;;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,EAAE,MAAM,WAAW,MAAM,EAAE,QAAQ;AAAA,IACpD;AAAA,IACC,QAAQ,IAAI,aAAa,gBAAiB,YAAY;AAAA,EACzD;AACF;","names":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/pipeline/env-codes.ts
|
|
2
2
|
import { defineDiagnostic } from "../diagnostics/catalog.js";
|
|
3
|
+
import "../diagnostics/process-guard.js";
|
|
3
4
|
var ms = (n) => `${n.toFixed(1)} ms`;
|
|
4
5
|
var envMessages = {
|
|
5
6
|
DK_ENV_FALLBACK: {
|
|
@@ -14,11 +15,11 @@ var envMessages = {
|
|
|
14
15
|
]
|
|
15
16
|
},
|
|
16
17
|
DK_PERF_HINT: {
|
|
17
|
-
problem: (d) =>
|
|
18
|
+
problem: (d) => `${d.sliced ? "a time slice of " : ""}the "${d.feature}" step took ${ms(d.ms)} on ${d.rows} rows, over the ${ms(d.budget)} budget of one task` + (d.slot ? `; ${Math.round((d.share ?? 1) * 100)} % of it in ${d.slot} (column "${d.column}")` : ""),
|
|
18
19
|
impact: () => "the page could not respond to input while it ran (a long task)",
|
|
19
20
|
fix: (d) => [
|
|
20
21
|
d.stage === "none" ? `move the work of "${d.feature}" out of rowModel (precompute it, or run it in a Worker)` : `let the server do it: ${d.feature}({ mode: 'server' }) with options.fetcher`,
|
|
21
|
-
`make the per-row work of "${d.feature}" cheaper (precompute keys, avoid Intl / regex per row), or run it in a Worker`
|
|
22
|
+
d.slot ? `make ${d.slot} cheaper (precompute it, avoid Intl / regex per call), or run it in a Worker` : `make the per-row work of "${d.feature}" cheaper (precompute keys, avoid Intl / regex per row), or run it in a Worker`
|
|
22
23
|
]
|
|
23
24
|
}
|
|
24
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pipeline/env-codes.ts"],"sourcesContent":["import { type DiagnosticMessages, defineDiagnostic } from '../diagnostics/catalog'\n\ndeclare module '../diagnostics/catalog' {\n interface DiagnosticCatalog {\n DK_ENV_FALLBACK: {\n /** The missing runtime capability, e.g. `'scheduler.yield'` or `'Intl.Collator'`. */\n api: string\n /** The feature that needed it (`where`). */\n feature: string\n /** What was asked for, e.g. the requested collator locale. */\n requested?: string\n /** What is used instead, e.g. `'setTimeout'` or the resolved locale. */\n fallback: string\n }\n DK_PERF_HINT: {\n /** The feature whose step exceeded the budget (`where`). */\n feature: string\n /** Its pipeline stage. */\n stage: string\n /** Measured step time, in milliseconds. */\n ms: number\n /** Rows the step received. */\n rows: number\n /** The budget, in milliseconds (§9.3: the longest task). */\n budget: number\n }\n }\n}\n\nconst ms = (n: number) => `${n.toFixed(1)} ms`\n\n/** Message text (§8.2): development builds, or production via `@datakable/core/messages`. */\nexport const envMessages: DiagnosticMessages<'DK_ENV_FALLBACK' | 'DK_PERF_HINT'> = {\n DK_ENV_FALLBACK: {\n problem: (d) =>\n `${d.api}${d.requested === undefined ? '' : ` (${JSON.stringify(d.requested)})`} is not ` +\n `available in this environment (feature \"${d.feature}\")`,\n impact: (d) => `DataKable uses ${d.fallback} instead; results are the same`,\n fix: (d) =>\n d.api === 'Intl.Collator'\n ? [\n `use a locale this runtime supports (Intl.Collator.supportedLocalesOf(${JSON.stringify(d.requested)}) is empty)`,\n 'or ship full ICU data (Node: the default full-icu build; browsers: a polyfill such as @formatjs/intl)',\n ]\n : [\n `nothing to do: ${d.fallback} is a correct fallback for ${d.api}`,\n `${d.api} is used automatically where the runtime provides it`,\n ],\n },\n DK_PERF_HINT: {\n problem: (d) =>\n
|
|
1
|
+
{"version":3,"sources":["../../src/pipeline/env-codes.ts"],"sourcesContent":["import { type DiagnosticMessages, defineDiagnostic } from '../diagnostics/catalog'\nimport '../diagnostics/process-guard'\n\ndeclare module '../diagnostics/catalog' {\n interface DiagnosticCatalog {\n DK_ENV_FALLBACK: {\n /** The missing runtime capability, e.g. `'scheduler.yield'` or `'Intl.Collator'`. */\n api: string\n /** The feature that needed it (`where`). */\n feature: string\n /** What was asked for, e.g. the requested collator locale. */\n requested?: string\n /** What is used instead, e.g. `'setTimeout'` or the resolved locale. */\n fallback: string\n }\n DK_PERF_HINT: {\n /** The feature whose step exceeded the budget (`where`). */\n feature: string\n /** Its pipeline stage. */\n stage: string\n /** Measured step time, in milliseconds. */\n ms: number\n /** Rows the step received. */\n rows: number\n /** The budget, in milliseconds (§9.3: the longest task). */\n budget: number\n /** One slice of the step's time-sliced work, run between pipeline runs (#61). */\n sliced?: boolean\n /** The column slot at least half of the time went to, e.g. `columns[0].format` (#62). */\n slot?: string\n /** Its column id. */\n column?: string\n /** Its share of {@link ms}, 0.5 to 1. */\n share?: number\n }\n }\n}\n\nconst ms = (n: number) => `${n.toFixed(1)} ms`\n\n/** Message text (§8.2): development builds, or production via `@datakable/core/messages`. */\nexport const envMessages: DiagnosticMessages<'DK_ENV_FALLBACK' | 'DK_PERF_HINT'> = {\n DK_ENV_FALLBACK: {\n problem: (d) =>\n `${d.api}${d.requested === undefined ? '' : ` (${JSON.stringify(d.requested)})`} is not ` +\n `available in this environment (feature \"${d.feature}\")`,\n impact: (d) => `DataKable uses ${d.fallback} instead; results are the same`,\n fix: (d) =>\n d.api === 'Intl.Collator'\n ? [\n `use a locale this runtime supports (Intl.Collator.supportedLocalesOf(${JSON.stringify(d.requested)}) is empty)`,\n 'or ship full ICU data (Node: the default full-icu build; browsers: a polyfill such as @formatjs/intl)',\n ]\n : [\n `nothing to do: ${d.fallback} is a correct fallback for ${d.api}`,\n `${d.api} is used automatically where the runtime provides it`,\n ],\n },\n DK_PERF_HINT: {\n problem: (d) =>\n `${d.sliced ? 'a time slice of ' : ''}the \"${d.feature}\" step took ${ms(d.ms)} on ` +\n `${d.rows} rows, over the ${ms(d.budget)} budget of one task` +\n (d.slot\n ? `; ${Math.round((d.share ?? 1) * 100)} % of it in ${d.slot} (column \"${d.column}\")`\n : ''),\n impact: () => 'the page could not respond to input while it ran (a long task)',\n fix: (d) => [\n d.stage === 'none'\n ? `move the work of \"${d.feature}\" out of rowModel (precompute it, or run it in a Worker)`\n : `let the server do it: ${d.feature}({ mode: 'server' }) with options.fetcher`,\n d.slot\n ? `make ${d.slot} cheaper (precompute it, avoid Intl / regex per call), or run it in a Worker`\n : `make the per-row work of \"${d.feature}\" cheaper (precompute keys, avoid Intl / regex per row), or run it in a Worker`,\n ],\n },\n}\n\n/** `DK_ENV_FALLBACK` (§8.3): a missing runtime capability and the fallback used. */\nexport const envDiagnostics = [\n defineDiagnostic(\n {\n code: 'DK_ENV_FALLBACK',\n level: 'info',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n },\n (process.env.NODE_ENV !== \"production\") && envMessages.DK_ENV_FALLBACK,\n ),\n]\n"],"mappings":";AAAA,SAAkC,wBAAwB;AAC1D,OAAO;AAqCP,IAAM,KAAK,CAAC,MAAc,GAAG,EAAE,QAAQ,CAAC,CAAC;AAGlC,IAAM,cAAsE;AAAA,EACjF,iBAAiB;AAAA,IACf,SAAS,CAAC,MACR,GAAG,EAAE,GAAG,GAAG,EAAE,cAAc,SAAY,KAAK,KAAK,KAAK,UAAU,EAAE,SAAS,CAAC,GAAG,mDACpC,EAAE,OAAO;AAAA,IACtD,QAAQ,CAAC,MAAM,kBAAkB,EAAE,QAAQ;AAAA,IAC3C,KAAK,CAAC,MACJ,EAAE,QAAQ,kBACN;AAAA,MACE,wEAAwE,KAAK,UAAU,EAAE,SAAS,CAAC;AAAA,MACnG;AAAA,IACF,IACA;AAAA,MACE,kBAAkB,EAAE,QAAQ,8BAA8B,EAAE,GAAG;AAAA,MAC/D,GAAG,EAAE,GAAG;AAAA,IACV;AAAA,EACR;AAAA,EACA,cAAc;AAAA,IACZ,SAAS,CAAC,MACR,GAAG,EAAE,SAAS,qBAAqB,EAAE,QAAQ,EAAE,OAAO,eAAe,GAAG,EAAE,EAAE,CAAC,OAC1E,EAAE,IAAI,mBAAmB,GAAG,EAAE,MAAM,CAAC,yBACvC,EAAE,OACC,KAAK,KAAK,OAAO,EAAE,SAAS,KAAK,GAAG,CAAC,eAAe,EAAE,IAAI,aAAa,EAAE,MAAM,OAC/E;AAAA,IACN,QAAQ,MAAM;AAAA,IACd,KAAK,CAAC,MAAM;AAAA,MACV,EAAE,UAAU,SACR,qBAAqB,EAAE,OAAO,6DAC9B,yBAAyB,EAAE,OAAO;AAAA,MACtC,EAAE,OACE,QAAQ,EAAE,IAAI,iFACd,6BAA6B,EAAE,OAAO;AAAA,IAC5C;AAAA,EACF;AACF;AAGO,IAAM,iBAAiB;AAAA,EAC5B;AAAA,IACE;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO,CAAC,OAAO,EAAE,MAAM,WAAW,MAAM,EAAE,QAAQ;AAAA,IACpD;AAAA,IACC,QAAQ,IAAI,aAAa,gBAAiB,YAAY;AAAA,EACzD;AACF;","names":[]}
|
|
@@ -24,6 +24,7 @@ __export(perf_codes_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(perf_codes_exports);
|
|
26
26
|
var import_catalog = require("../diagnostics/catalog.cjs");
|
|
27
|
+
var import_process_guard = require("../diagnostics/process-guard.cjs");
|
|
27
28
|
var import_env_codes = require("./env-codes.cjs");
|
|
28
29
|
var perfDiagnostics = [
|
|
29
30
|
(0, import_catalog.defineDiagnostic)(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pipeline/perf-codes.ts"],"sourcesContent":["import { defineDiagnostic } from '../diagnostics/catalog'\nimport { envMessages } from './env-codes'\n\n// Apart from env-codes.ts: only the tracer uses this definition, and the tracer is off in\n// production unless installed (`interceptors: [tracer()]`), so a production bundle without it\n// carries no DK_PERF_HINT.\n\n/** `DK_PERF_HINT` (§8.3): a traced step over its budget (the tracer reports it). */\nexport const perfDiagnostics = [\n defineDiagnostic(\n {\n code: 'DK_PERF_HINT',\n level: 'info',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n },\n (process.env.NODE_ENV !== \"production\") && envMessages.DK_PERF_HINT,\n ),\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiC;AACjC,uBAA4B;AAOrB,IAAM,kBAAkB;AAAA,MAC7B;AAAA,IACE;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO,CAAC,OAAO,EAAE,MAAM,WAAW,MAAM,EAAE,QAAQ;AAAA,IACpD;AAAA,IACC,QAAQ,IAAI,aAAa,gBAAiB,6BAAY;AAAA,EACzD;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/pipeline/perf-codes.ts"],"sourcesContent":["import { defineDiagnostic } from '../diagnostics/catalog'\nimport '../diagnostics/process-guard'\nimport { envMessages } from './env-codes'\n\n// Apart from env-codes.ts: only the tracer uses this definition, and the tracer is off in\n// production unless installed (`interceptors: [tracer()]`), so a production bundle without it\n// carries no DK_PERF_HINT.\n\n/** `DK_PERF_HINT` (§8.3): a traced step over its budget (the tracer reports it). */\nexport const perfDiagnostics = [\n defineDiagnostic(\n {\n code: 'DK_PERF_HINT',\n level: 'info',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n },\n (process.env.NODE_ENV !== \"production\") && envMessages.DK_PERF_HINT,\n ),\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiC;AACjC,2BAAO;AACP,uBAA4B;AAOrB,IAAM,kBAAkB;AAAA,MAC7B;AAAA,IACE;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO,CAAC,OAAO,EAAE,MAAM,WAAW,MAAM,EAAE,QAAQ;AAAA,IACpD;AAAA,IACC,QAAQ,IAAI,aAAa,gBAAiB,6BAAY;AAAA,EACzD;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pipeline/perf-codes.ts"],"sourcesContent":["import { defineDiagnostic } from '../diagnostics/catalog'\nimport { envMessages } from './env-codes'\n\n// Apart from env-codes.ts: only the tracer uses this definition, and the tracer is off in\n// production unless installed (`interceptors: [tracer()]`), so a production bundle without it\n// carries no DK_PERF_HINT.\n\n/** `DK_PERF_HINT` (§8.3): a traced step over its budget (the tracer reports it). */\nexport const perfDiagnostics = [\n defineDiagnostic(\n {\n code: 'DK_PERF_HINT',\n level: 'info',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n },\n (process.env.NODE_ENV !== \"production\") && envMessages.DK_PERF_HINT,\n ),\n]\n"],"mappings":";AAAA,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAOrB,IAAM,kBAAkB;AAAA,EAC7B;AAAA,IACE;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO,CAAC,OAAO,EAAE,MAAM,WAAW,MAAM,EAAE,QAAQ;AAAA,IACpD;AAAA,IACC,QAAQ,IAAI,aAAa,gBAAiB,YAAY;AAAA,EACzD;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/pipeline/perf-codes.ts"],"sourcesContent":["import { defineDiagnostic } from '../diagnostics/catalog'\nimport '../diagnostics/process-guard'\nimport { envMessages } from './env-codes'\n\n// Apart from env-codes.ts: only the tracer uses this definition, and the tracer is off in\n// production unless installed (`interceptors: [tracer()]`), so a production bundle without it\n// carries no DK_PERF_HINT.\n\n/** `DK_PERF_HINT` (§8.3): a traced step over its budget (the tracer reports it). */\nexport const perfDiagnostics = [\n defineDiagnostic(\n {\n code: 'DK_PERF_HINT',\n level: 'info',\n where: (d) => ({ kind: 'feature', name: d.feature }),\n },\n (process.env.NODE_ENV !== \"production\") && envMessages.DK_PERF_HINT,\n ),\n]\n"],"mappings":";AAAA,SAAS,wBAAwB;AACjC,OAAO;AACP,SAAS,mBAAmB;AAOrB,IAAM,kBAAkB;AAAA,EAC7B;AAAA,IACE;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO,CAAC,OAAO,EAAE,MAAM,WAAW,MAAM,EAAE,QAAQ;AAAA,IACpD;AAAA,IACC,QAAQ,IAAI,aAAa,gBAAiB,YAAY;AAAA,EACzD;AACF;","names":[]}
|
package/dist/pipeline/runner.cjs
CHANGED
|
@@ -25,6 +25,8 @@ __export(runner_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(runner_exports);
|
|
26
26
|
var import_get_value = require("../column/get-value.cjs");
|
|
27
27
|
var import_catalog = require("../diagnostics/catalog.cjs");
|
|
28
|
+
var import_process_guard = require("../diagnostics/process-guard.cjs");
|
|
29
|
+
var import_trace_store = require("../diagnostics/trace-store.cjs");
|
|
28
30
|
var import_codes = require("../feature/codes.cjs");
|
|
29
31
|
var import_cell_issues = require("../ingest/cell-issues.cjs");
|
|
30
32
|
var import_row_key = require("../ingest/row-key.cjs");
|
|
@@ -76,7 +78,8 @@ function createPipeline(host) {
|
|
|
76
78
|
// Not during SSR, and not for the first row model (the hydrated client matches the server).
|
|
77
79
|
enabled: () => refresh !== void 0 && last !== void 0 && host.base().phase === "client",
|
|
78
80
|
trigger: () => host.base().trigger,
|
|
79
|
-
done: (trigger) => refresh?.(trigger)
|
|
81
|
+
done: (trigger) => refresh?.(trigger),
|
|
82
|
+
timed: (feature, ms) => import_trace_store.sliceTimer.current?.(host.base(), feature, ms)
|
|
80
83
|
});
|
|
81
84
|
function reportCell(col, index, e, field) {
|
|
82
85
|
const name = (0, import_classify.errorName)(e);
|
|
@@ -87,7 +90,7 @@ function createPipeline(host) {
|
|
|
87
90
|
column: col.id,
|
|
88
91
|
rows: [index],
|
|
89
92
|
count: 1,
|
|
90
|
-
fallback: "
|
|
93
|
+
fallback: "cell-undefined",
|
|
91
94
|
...name === void 0 ? {} : { errorName: name }
|
|
92
95
|
},
|
|
93
96
|
{ cause: e }
|
|
@@ -142,7 +145,7 @@ function createPipeline(host) {
|
|
|
142
145
|
slot: "rowKey",
|
|
143
146
|
rows: Array.from(keyFailures.sample()),
|
|
144
147
|
count: keyFailures.count,
|
|
145
|
-
fallback: "
|
|
148
|
+
fallback: "row-key-index",
|
|
146
149
|
...name === void 0 ? {} : { errorName: name }
|
|
147
150
|
},
|
|
148
151
|
{ cause: keyError }
|
|
@@ -202,6 +205,10 @@ function createPipeline(host) {
|
|
|
202
205
|
const col = cols.byId.get(id);
|
|
203
206
|
return col ? cache.formatted(data, col) : void 0;
|
|
204
207
|
},
|
|
208
|
+
*formattedSliced(id) {
|
|
209
|
+
const col = cols.byId.get(id);
|
|
210
|
+
return col ? yield* cache.formattedSliced(data, col) : void 0;
|
|
211
|
+
},
|
|
205
212
|
batch: (id, slot, rows, body) => {
|
|
206
213
|
const col = cols.byId.get(id);
|
|
207
214
|
if (col) cache.batch(col, slot, slot, rows, body);
|
|
@@ -245,13 +252,14 @@ function createPipeline(host) {
|
|
|
245
252
|
{
|
|
246
253
|
feature: f.name,
|
|
247
254
|
hook: "rowModel",
|
|
248
|
-
fallback: "
|
|
255
|
+
fallback: "step-passthrough",
|
|
249
256
|
...name === void 0 ? {} : { errorName: name }
|
|
250
257
|
},
|
|
251
258
|
{ cause: e }
|
|
252
259
|
);
|
|
253
260
|
return input;
|
|
254
261
|
}
|
|
262
|
+
if (waiting > waited) ctx2.meta.set(import_trace_store.SLICED, true);
|
|
255
263
|
if (process.env.NODE_ENV !== "production" && !(0, import_dev_checks.checkStep)(stepEmit, f.name, input, before, out, data.length)) return input;
|
|
256
264
|
ok = true;
|
|
257
265
|
return out instanceof Uint32Array ? out : input;
|
|
@@ -286,11 +294,11 @@ function createPipeline(host) {
|
|
|
286
294
|
});
|
|
287
295
|
} finally {
|
|
288
296
|
slicer?.end();
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
297
|
+
if (result) model = result;
|
|
298
|
+
else {
|
|
299
|
+
const isInitialLoad = host.isInitialLoad();
|
|
300
|
+
model = last ? { ...last.model, status: "error", isInitialLoad } : { rows: EMPTY, filteredCount: 0, totalCount: 0, status: "error", isInitialLoad };
|
|
301
|
+
}
|
|
294
302
|
}
|
|
295
303
|
return model;
|
|
296
304
|
}
|