ggaction 0.0.15 → 0.0.16
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/CHANGELOG.md +68 -0
- package/README.md +22 -2
- package/knowledge/action-cards.json +1 -1
- package/knowledge/intent-taxonomy.json +1 -1
- package/knowledge/mcp-resources.json +1 -1
- package/knowledge/task-packet.schema.json +1 -1
- package/knowledge/task-resolver.js +1 -1
- package/package.json +33 -6
- package/src/BasicChartProgram.js +3 -1
- package/src/ChartProgram.js +2 -0
- package/src/accessibility.js +157 -0
- package/src/actions/boxPlots/components.js +6 -8
- package/src/actions/boxPlots/create.js +4 -5
- package/src/actions/boxPlots/edit.js +3 -4
- package/src/actions/boxPlots/materialize.js +1 -1
- package/src/actions/canvas/actions.js +3 -3
- package/src/actions/canvas/fitting.js +1 -1
- package/src/actions/categoryOrder/index.js +6 -8
- package/src/actions/charts/area.js +1 -1
- package/src/actions/charts/bar.js +1 -1
- package/src/actions/charts/beeswarm.js +1 -1
- package/src/actions/charts/density.js +1 -1
- package/src/actions/charts/ecdf.js +2 -2
- package/src/actions/charts/endpoints.js +4 -4
- package/src/actions/charts/heatmap.js +1 -1
- package/src/actions/charts/histogram.js +1 -1
- package/src/actions/charts/horizon.js +1 -1
- package/src/actions/charts/interval-regression.js +2 -2
- package/src/actions/charts/line.js +1 -1
- package/src/actions/charts/parallel.js +1 -1
- package/src/actions/charts/pie.js +1 -1
- package/src/actions/charts/polar.js +2 -2
- package/src/actions/charts/radar.js +1 -1
- package/src/actions/charts/radial.js +2 -2
- package/src/actions/charts/raincloud.js +2 -2
- package/src/actions/charts/rug-strip.js +2 -2
- package/src/actions/charts/scatter.js +1 -1
- package/src/actions/composition/actions.js +20 -24
- package/src/actions/coordinates/actions.js +1 -1
- package/src/actions/coordinates/edit.js +1 -1
- package/src/actions/data/basicBin2d.js +4 -5
- package/src/actions/data/bin.js +2 -2
- package/src/actions/data/bin2d.js +6 -8
- package/src/actions/data/bin2dMaterialize.js +4 -5
- package/src/actions/data/box.js +4 -4
- package/src/actions/data/complete.js +2 -2
- package/src/actions/data/computed.js +2 -2
- package/src/actions/data/create.js +5 -12
- package/src/actions/data/density.js +3 -3
- package/src/actions/data/derived.js +10 -14
- package/src/actions/data/ecdf.js +2 -2
- package/src/actions/data/edit.js +35 -23
- package/src/actions/data/filter.js +14 -20
- package/src/actions/data/fold.js +2 -2
- package/src/actions/data/gradientProfile.js +2 -2
- package/src/actions/data/horizon.js +2 -2
- package/src/actions/data/impute.js +2 -2
- package/src/actions/data/index.js +55 -54
- package/src/actions/data/interval.js +2 -2
- package/src/actions/data/intervalEdit.js +26 -18
- package/src/actions/data/normalize.js +2 -2
- package/src/actions/data/regression.js +5 -6
- package/src/actions/data/revise.js +48 -0
- package/src/actions/data/revisionBindings.js +13 -33
- package/src/actions/data/stack.js +2 -2
- package/src/actions/data/summary.js +2 -2
- package/src/actions/data/timeUnit.js +2 -2
- package/src/actions/data/window.js +2 -2
- package/src/actions/encodings/angle.js +1 -1
- package/src/actions/encodings/appearance.js +4 -4
- package/src/actions/encodings/barWidth.js +1 -1
- package/src/actions/encodings/channels.js +2 -2
- package/src/actions/encodings/color/index.js +1 -1
- package/src/actions/encodings/density.js +2 -2
- package/src/actions/encodings/histogram.js +1 -1
- package/src/actions/encodings/horizon.js +6 -8
- package/src/actions/encodings/offset.js +2 -2
- package/src/actions/encodings/parallel.js +4 -5
- package/src/actions/encodings/pathOrder.js +6 -11
- package/src/actions/encodings/position/index.js +4 -4
- package/src/actions/encodings/ranged.js +5 -5
- package/src/actions/encodings/remove.js +4 -5
- package/src/actions/encodings/ruleAppearance.js +1 -1
- package/src/actions/encodings/seriesLayout.js +1 -1
- package/src/actions/encodings/stroke.js +1 -1
- package/src/actions/encodings/strokeDash.js +2 -2
- package/src/actions/encodings/text.js +1 -1
- package/src/actions/errorBands/create.js +11 -17
- package/src/actions/errorBands/edit.js +13 -131
- package/src/actions/errorBars/create.js +8 -13
- package/src/actions/errorBars/edit.js +10 -121
- package/src/actions/facets/actions.js +30 -16
- package/src/actions/facets/derive.js +8 -2
- package/src/actions/facets/guides.js +4 -5
- package/src/actions/facets/replay.js +4 -5
- package/src/actions/gradientPlots/components.js +5 -6
- package/src/actions/gradientPlots/create.js +4 -5
- package/src/actions/gradientPlots/edit.js +4 -5
- package/src/actions/gradientPlots/materialize.js +2 -2
- package/src/actions/gradientPlots/rebind.js +4 -5
- package/src/actions/guides/axes/axes.js +23 -4
- package/src/actions/guides/axes/axis.js +2 -2
- package/src/actions/guides/axes/edit.js +2 -2
- package/src/actions/guides/axes/labels.js +9 -9
- package/src/actions/guides/axes/lines.js +9 -7
- package/src/actions/guides/axes/parallel/lifecycle.js +13 -13
- package/src/actions/guides/axes/parallel.js +5 -5
- package/src/actions/guides/axes/remove.js +4 -4
- package/src/actions/guides/axes/tickGroups.js +4 -4
- package/src/actions/guides/axes/ticks.js +13 -4
- package/src/actions/guides/axes/titles.js +10 -10
- package/src/actions/guides/grids/grid.js +18 -29
- package/src/actions/guides/guides.js +1 -1
- package/src/actions/guides/legends/blocks.js +1 -1
- package/src/actions/guides/legends/categorical/actions.js +4 -4
- package/src/actions/guides/legends/categorical/components.js +38 -33
- package/src/actions/guides/legends/categorical/layout.js +1 -1
- package/src/actions/guides/legends/categorical/symbols.js +27 -30
- package/src/actions/guides/legends/continuous/common.js +46 -8
- package/src/actions/guides/legends/continuous/gradient.js +89 -155
- package/src/actions/guides/legends/continuous/interval.js +13 -13
- package/src/actions/guides/legends/continuous/opacity.js +30 -79
- package/src/actions/guides/legends/continuous/stroke.js +22 -322
- package/src/actions/guides/legends/edit.js +1 -1
- package/src/actions/guides/legends/focused.js +5 -5
- package/src/actions/guides/legends/lane.js +6 -6
- package/src/actions/guides/legends/remove.js +4 -5
- package/src/actions/guides/legends/size.js +21 -82
- package/src/actions/guides/legends/strokeWidth.js +17 -77
- package/src/actions/guides/polar/axes/facade.js +4 -4
- package/src/actions/guides/polar/axes/labels.js +5 -5
- package/src/actions/guides/polar/axes/lines.js +9 -15
- package/src/actions/guides/polar/axes/ticks.js +9 -15
- package/src/actions/guides/polar/axes/titles.js +5 -5
- package/src/actions/guides/polar/grids.js +11 -13
- package/src/actions/index.js +2 -0
- package/src/actions/intervals/revision.js +126 -0
- package/src/actions/marks/arc/actions.js +3 -3
- package/src/actions/marks/area/actions.js +4 -4
- package/src/actions/marks/bar/create.js +1 -1
- package/src/actions/marks/bar/edit.js +1 -1
- package/src/actions/marks/bar/materialize.js +12 -38
- package/src/actions/marks/line/actions.js +3 -3
- package/src/actions/marks/point/create.js +1 -1
- package/src/actions/marks/point/edit.js +1 -1
- package/src/actions/marks/point/jitter.js +6 -8
- package/src/actions/marks/point/materialize.js +16 -24
- package/src/actions/marks/point/packing.js +6 -8
- package/src/actions/marks/rect/actions.js +3 -3
- package/src/actions/marks/references.js +8 -10
- package/src/actions/marks/remove.js +5 -49
- package/src/actions/marks/rule/actions.js +4 -4
- package/src/actions/marks/text/actions.js +5 -5
- package/src/actions/marks/text/layout.js +12 -20
- package/src/actions/marks/text/removal.js +1 -1
- package/src/actions/marks/text/selection.js +4 -5
- package/src/actions/marks/tick/actions.js +3 -3
- package/src/actions/primitives/createGraphics.js +5 -4
- package/src/actions/primitives/editGraphics.js +5 -4
- package/src/actions/primitives/graphicProperties.js +6 -0
- package/src/actions/primitives/semantic.js +10 -3
- package/src/actions/primitives/semanticAction.js +7 -4
- package/src/actions/primitives/semanticValidation/dataset.js +2 -4
- package/src/actions/regression/components.js +10 -14
- package/src/actions/regression/create.js +3 -4
- package/src/actions/regression/edit.js +3 -4
- package/src/actions/resources/remove.js +12 -11
- package/src/actions/scales/create.js +1 -1
- package/src/actions/scales/edit.js +1 -1
- package/src/actions/scales/materialize.js +1 -1
- package/src/actions/scales/offset.js +2 -2
- package/src/actions/scales/parallel.js +1 -1
- package/src/actions/scales/quantitativeColor.js +4 -5
- package/src/actions/selection/actions.js +25 -36
- package/src/actions/textMetrics/index.js +56 -0
- package/src/actions/theme/actions.js +2 -2
- package/src/actions/theme/reconcile.js +65 -121
- package/src/actions/titles/actions.js +8 -8
- package/src/actions/titles/resolve.js +3 -3
- package/src/actions/violinPlots/create.js +1 -1
- package/src/actions/violinPlots/edit.js +1 -1
- package/src/core/action.js +107 -35
- package/src/core/diagnostics.js +16 -0
- package/src/core/extensionRegistry.js +27 -0
- package/src/core/font.js +18 -0
- package/src/core/identifiers.js +5 -4
- package/src/core/immutable.js +10 -3
- package/src/core/optionRequirements.js +8 -0
- package/src/core/programState.js +1 -1
- package/src/core/resourceReferences.js +15 -6
- package/src/core/textMetricProfile.js +28 -0
- package/src/core/textMetrics.js +24 -3
- package/src/core/validation.js +22 -10
- package/src/diagnostics.js +1 -0
- package/src/grammar/impute.js +3 -2
- package/src/grammar/scales/types.js +8 -0
- package/src/grammar/schemas/graphicBounds.js +11 -11
- package/src/layout/labels.js +11 -10
- package/src/layout/legend.js +4 -4
- package/src/layout/legendItems.js +6 -6
- package/src/layout/text.js +10 -9
- package/src/layout/title.js +9 -9
- package/src/materialization/facetGuides/placement.js +1 -1
- package/src/materialization/facetGuides/preparation.js +1 -1
- package/src/materialization/facetHeaders.js +11 -10
- package/src/materialization/guides/layout.js +3 -3
- package/src/materialization/scaleGuideDependencies.js +10 -0
- package/src/materialization/selection/items/common.js +1 -1
- package/src/materialization/text.js +2 -2
- package/src/materialization/typography.js +31 -0
- package/src/mcp/cli.js +5 -3
- package/src/persistence/codec.js +65 -0
- package/src/persistence/validation.js +185 -0
- package/src/persistence.js +74 -0
- package/src/renderers/canvas/index.js +5 -4
- package/src/renderers/nativeBackend.js +10 -0
- package/src/renderers/options.js +13 -0
- package/src/renderers/pdf.js +25 -54
- package/src/renderers/png.js +22 -17
- package/src/renderers/svg.js +10 -14
- package/src/renderers/text.js +1 -11
- package/src/selectors/coordinates.js +3 -1
- package/src/selectors/datasets.js +8 -6
- package/src/selectors/layers.js +6 -4
- package/src/selectors/markOwners.js +46 -0
- package/src/selectors/scales.js +6 -4
- package/src/theme/defaults.js +2 -1
- package/src/version.js +2 -0
- package/types/accessibility.d.ts +37 -0
- package/types/basic.d.ts +4 -2
- package/types/diagnostics.d.ts +15 -0
- package/types/index.d.ts +5 -0
- package/types/pdf.d.ts +9 -0
- package/types/persistence.d.ts +7 -0
- package/types/png.d.ts +9 -0
- package/types/program.d.ts +34 -1
|
@@ -6,14 +6,14 @@ import { derivedCreator, derivedMaterializer } from "./shared.js";
|
|
|
6
6
|
|
|
7
7
|
const OPTIONS = Object.freeze(["id", "source", "as", "expression"]);
|
|
8
8
|
|
|
9
|
-
export const materializeComputedData = derivedMaterializer(
|
|
9
|
+
export const materializeComputedData = /* @__PURE__ */ derivedMaterializer(
|
|
10
10
|
"materializeComputedData",
|
|
11
11
|
"Materialize one immutable row-level typed expression dataset.",
|
|
12
12
|
"computed",
|
|
13
13
|
deriveComputedRows
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
export const createComputedData = derivedCreator(
|
|
16
|
+
export const createComputedData = /* @__PURE__ */ derivedCreator(
|
|
17
17
|
"createComputedData",
|
|
18
18
|
"Create a typed computed field from a closed expression.",
|
|
19
19
|
OPTIONS,
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { closedAction } from "../../core/action.js";
|
|
2
2
|
import { resolveOptionalUserId } from "../../core/identifiers.js";
|
|
3
|
-
import {
|
|
4
|
-
import { validateKeys } from "../../core/validation.js";
|
|
3
|
+
import { validateDataRows } from "../../core/validation.js";
|
|
5
4
|
import { hasDataset, hasDatasetOwner } from "../../selectors/index.js";
|
|
6
5
|
|
|
7
6
|
const OPTIONS = Object.freeze(["id", "values"]);
|
|
8
7
|
|
|
9
|
-
export const createData =
|
|
10
|
-
{ op: "createData", description: "Create an immutable named dataset." },
|
|
8
|
+
export const createData = /* @__PURE__ */ closedAction(
|
|
9
|
+
{ op: "createData", description: "Create an immutable named dataset." }, OPTIONS,
|
|
11
10
|
function (args = {}) {
|
|
12
|
-
validateKeys(args, OPTIONS, "createData");
|
|
13
11
|
const id = resolveOptionalUserId(args.id, {
|
|
14
12
|
defaultId: "data",
|
|
15
13
|
label: "Dataset id",
|
|
16
14
|
operation: "createData",
|
|
17
15
|
ambiguous: this.semanticSpec.datasets.length > 0
|
|
18
16
|
});
|
|
19
|
-
|
|
20
|
-
throw new TypeError("createData requires values to be an array.");
|
|
21
|
-
}
|
|
22
|
-
if (!args.values.every(isPlainObject)) {
|
|
23
|
-
throw new TypeError("createData requires every row to be a plain object.");
|
|
24
|
-
}
|
|
17
|
+
validateDataRows(args.values, "createData");
|
|
25
18
|
if (hasDataset(this, id) || hasDatasetOwner(this, id)) {
|
|
26
19
|
throw new Error(`Dataset "${id}" already exists.`);
|
|
27
20
|
}
|
|
@@ -25,7 +25,7 @@ function requestedTransform(args, op, categorical = false) {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export const materializeDensityData = derivedMaterializer(
|
|
28
|
+
export const materializeDensityData = /* @__PURE__ */ derivedMaterializer(
|
|
29
29
|
"materializeDensityData",
|
|
30
30
|
"Materialize one grouped kernel-density dataset.",
|
|
31
31
|
"density",
|
|
@@ -44,7 +44,7 @@ export const materializeDensityData = derivedMaterializer(
|
|
|
44
44
|
}]
|
|
45
45
|
);
|
|
46
46
|
|
|
47
|
-
export const createDensityData = derivedCreator(
|
|
47
|
+
export const createDensityData = /* @__PURE__ */ derivedCreator(
|
|
48
48
|
"createDensityData",
|
|
49
49
|
"Create grouped kernel-density values.",
|
|
50
50
|
OPTIONS,
|
|
@@ -54,7 +54,7 @@ export const createDensityData = derivedCreator(
|
|
|
54
54
|
"materializeDensityData"
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
export const createCategoricalDensityData = derivedCreator(
|
|
57
|
+
export const createCategoricalDensityData = /* @__PURE__ */ derivedCreator(
|
|
58
58
|
"createCategoricalDensityData",
|
|
59
59
|
"Create category-placed kernel-density values.",
|
|
60
60
|
CATEGORICAL_OPTIONS,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { closedAction } from "../../core/action.js";
|
|
2
2
|
import { validateUserId } from "../../core/identifiers.js";
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import {
|
|
5
5
|
findDataset,
|
|
6
6
|
hasDataset,
|
|
@@ -27,10 +27,9 @@ const OWNED_MARK_ROLES = Object.freeze([
|
|
|
27
27
|
"statisticalReference"
|
|
28
28
|
]);
|
|
29
29
|
|
|
30
|
-
export const createDerivedData =
|
|
31
|
-
{ op: "createDerivedData", description: "Create an immutable derived dataset definition." },
|
|
30
|
+
export const createDerivedData = /* @__PURE__ */ closedAction(
|
|
31
|
+
{ op: "createDerivedData", description: "Create an immutable derived dataset definition." }, OPTIONS,
|
|
32
32
|
function (args = {}) {
|
|
33
|
-
validateKeys(args, OPTIONS, "createDerivedData");
|
|
34
33
|
const id = validateUserId(args.id, "Derived dataset id");
|
|
35
34
|
const requestedSource = validateUserId(args.source, "Source dataset id");
|
|
36
35
|
const source = resolveDatasetReference(
|
|
@@ -50,13 +49,12 @@ export const createDerivedData = action(
|
|
|
50
49
|
}
|
|
51
50
|
);
|
|
52
51
|
|
|
53
|
-
export const releaseDerivedData =
|
|
52
|
+
export const releaseDerivedData = /* @__PURE__ */ closedAction(
|
|
54
53
|
{
|
|
55
54
|
op: "releaseDerivedData",
|
|
56
55
|
description: "Release one unreferenced derived dataset."
|
|
57
|
-
},
|
|
56
|
+
}, RELEASE_OPTIONS,
|
|
58
57
|
function (args = {}) {
|
|
59
|
-
validateKeys(args, RELEASE_OPTIONS, "releaseDerivedData");
|
|
60
58
|
const validatedId = validateUserId(args.id, "Derived dataset id");
|
|
61
59
|
const dataset = findDataset(this, validatedId);
|
|
62
60
|
if (dataset === undefined || dataset.source === undefined) {
|
|
@@ -85,13 +83,12 @@ export const releaseDerivedData = action(
|
|
|
85
83
|
}
|
|
86
84
|
);
|
|
87
85
|
|
|
88
|
-
export const rebindLayerData =
|
|
86
|
+
export const rebindLayerData = /* @__PURE__ */ closedAction(
|
|
89
87
|
{
|
|
90
88
|
op: "rebindLayerData",
|
|
91
89
|
description: "Rebind one semantic layer to an existing dataset."
|
|
92
|
-
},
|
|
90
|
+
}, REBIND_OPTIONS,
|
|
93
91
|
function (args = {}) {
|
|
94
|
-
validateKeys(args, REBIND_OPTIONS, "rebindLayerData");
|
|
95
92
|
const id = validateUserId(args.id, "Layer id");
|
|
96
93
|
const requestedData = validateUserId(args.data, "Layer dataset id");
|
|
97
94
|
const data = resolveDatasetReference(
|
|
@@ -134,13 +131,12 @@ function applyMarkDataBinding(program, target, data) {
|
|
|
134
131
|
return applyLayerDataRematerialization(rebound, target);
|
|
135
132
|
}
|
|
136
133
|
|
|
137
|
-
export const bindMarkData =
|
|
134
|
+
export const bindMarkData = /* @__PURE__ */ closedAction(
|
|
138
135
|
{
|
|
139
136
|
op: "bindMarkData",
|
|
140
137
|
description: "Atomically bind one independent mark to materialized data."
|
|
141
|
-
},
|
|
138
|
+
}, BIND_OPTIONS,
|
|
142
139
|
function (args = {}) {
|
|
143
|
-
validateKeys(args, BIND_OPTIONS, "bindMarkData");
|
|
144
140
|
const target = validateUserId(args.target, "Mark target id");
|
|
145
141
|
const requestedData = validateUserId(args.data, "Mark dataset id");
|
|
146
142
|
const data = resolveDatasetReference(
|
package/src/actions/data/ecdf.js
CHANGED
|
@@ -9,7 +9,7 @@ const OPTIONS = Object.freeze([
|
|
|
9
9
|
"id", "source", "field", "groupBy", "weight", "missing", "as"
|
|
10
10
|
]);
|
|
11
11
|
|
|
12
|
-
export const materializeECDFData = derivedMaterializer(
|
|
12
|
+
export const materializeECDFData = /* @__PURE__ */ derivedMaterializer(
|
|
13
13
|
"materializeECDFData",
|
|
14
14
|
"Materialize one empirical cumulative distribution dataset.",
|
|
15
15
|
"ecdf",
|
|
@@ -17,7 +17,7 @@ export const materializeECDFData = derivedMaterializer(
|
|
|
17
17
|
resolveECDFTransform
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
export const createECDFData = derivedCreator(
|
|
20
|
+
export const createECDFData = /* @__PURE__ */ derivedCreator(
|
|
21
21
|
"createECDFData",
|
|
22
22
|
"Create immutable empirical cumulative distribution values.",
|
|
23
23
|
OPTIONS,
|
package/src/actions/data/edit.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { action } from "../../core/action.js";
|
|
1
|
+
import { action, closedAction } from "../../core/action.js";
|
|
2
2
|
import { isPlainObject } from "../../core/immutable.js";
|
|
3
3
|
import { validateUserId } from "../../core/identifiers.js";
|
|
4
4
|
import { validateKeys } from "../../core/validation.js";
|
|
@@ -254,7 +254,7 @@ function buildRevisionPlan(
|
|
|
254
254
|
`Derived dataset "${resolved.owner}" cannot use one of its dependents as source.`
|
|
255
255
|
);
|
|
256
256
|
}
|
|
257
|
-
const reserved = new Set();
|
|
257
|
+
const reserved = new Set(resolved.revision === undefined ? [] : [resolved.revision]);
|
|
258
258
|
const revisions = [];
|
|
259
259
|
const replacements = new Map();
|
|
260
260
|
const add = (dataset, ownerRecord, transform, requestedSource) => {
|
|
@@ -274,7 +274,12 @@ function buildRevisionPlan(
|
|
|
274
274
|
revisions.push(revision);
|
|
275
275
|
replacements.set(dataset.id, id);
|
|
276
276
|
};
|
|
277
|
-
|
|
277
|
+
if (resolved.revision === undefined) {
|
|
278
|
+
add(resolved.dataset, resolved, definition, rootSource);
|
|
279
|
+
} else {
|
|
280
|
+
revisions.push({ old: resolved.current, id: resolved.revision });
|
|
281
|
+
replacements.set(resolved.current, resolved.revision);
|
|
282
|
+
}
|
|
278
283
|
if (dependents === "recompute") {
|
|
279
284
|
for (const dataset of downstream) {
|
|
280
285
|
const policy = findTransformPolicy(dataset.transform[0].type);
|
|
@@ -292,14 +297,15 @@ function directLayerConsumers(program, data) {
|
|
|
292
297
|
.map(layer => layer.id);
|
|
293
298
|
}
|
|
294
299
|
|
|
295
|
-
function applyRevisionPlan(program, resolved, plan) {
|
|
300
|
+
export function applyRevisionPlan(program, resolved, plan, { retain = new Set() } = {}) {
|
|
296
301
|
const root = plan.revisions[0];
|
|
297
|
-
const changes = outputFieldChanges(
|
|
302
|
+
const changes = resolved === undefined ? new Map() : outputFieldChanges(
|
|
298
303
|
resolved.dataset.transform[0],
|
|
299
304
|
root.transform
|
|
300
305
|
);
|
|
301
306
|
let next = program;
|
|
302
307
|
for (const revision of plan.revisions) {
|
|
308
|
+
if (revision.transform === undefined) continue;
|
|
303
309
|
const policy = findTransformPolicy(revision.transform.type);
|
|
304
310
|
next = next.createDerivedData({
|
|
305
311
|
id: revision.id,
|
|
@@ -345,6 +351,7 @@ function applyRevisionPlan(program, resolved, plan) {
|
|
|
345
351
|
next = applyLayerDataRematerialization(next, consumer.id);
|
|
346
352
|
}
|
|
347
353
|
for (const revision of [...plan.revisions].reverse()) {
|
|
354
|
+
if (retain.has(revision.old)) continue;
|
|
348
355
|
next = next.releaseDerivedData({ id: revision.old });
|
|
349
356
|
}
|
|
350
357
|
|
|
@@ -353,6 +360,12 @@ function applyRevisionPlan(program, resolved, plan) {
|
|
|
353
360
|
return next._withContext({ ...program.context, currentData });
|
|
354
361
|
}
|
|
355
362
|
|
|
363
|
+
export function buildSourceRevisionPlan(program, source, id) {
|
|
364
|
+
return buildRevisionPlan(program, {
|
|
365
|
+
current: source, dataset: findDataset(program, source), revision: id
|
|
366
|
+
}, undefined, "recompute");
|
|
367
|
+
}
|
|
368
|
+
|
|
356
369
|
function sameRequested(left, right) {
|
|
357
370
|
return JSON.stringify(left) === JSON.stringify(right);
|
|
358
371
|
}
|
|
@@ -375,13 +388,12 @@ export function reviseDerivedData(program, {
|
|
|
375
388
|
return applyRevisionPlan(program, resolved, plan);
|
|
376
389
|
}
|
|
377
390
|
|
|
378
|
-
export const editDerivedData =
|
|
391
|
+
export const editDerivedData = /* @__PURE__ */ closedAction(
|
|
379
392
|
{
|
|
380
393
|
op: "editDerivedData",
|
|
381
394
|
description: "Atomically revise one standalone derived-data definition."
|
|
382
|
-
},
|
|
395
|
+
}, GENERIC_OPTIONS,
|
|
383
396
|
function (args = {}) {
|
|
384
|
-
validateKeys(args, GENERIC_OPTIONS, "editDerivedData");
|
|
385
397
|
if (!Object.hasOwn(args, "target")) {
|
|
386
398
|
throw new TypeError("editDerivedData requires target.");
|
|
387
399
|
}
|
|
@@ -448,72 +460,72 @@ function focusedEditor(op, type, properties) {
|
|
|
448
460
|
);
|
|
449
461
|
}
|
|
450
462
|
|
|
451
|
-
export const editComputedData = focusedEditor(
|
|
463
|
+
export const editComputedData = /* @__PURE__ */ focusedEditor(
|
|
452
464
|
"editComputedData", "computed", ["as", "expression"]
|
|
453
465
|
);
|
|
454
|
-
export const editFilteredData = focusedEditor(
|
|
466
|
+
export const editFilteredData = /* @__PURE__ */ focusedEditor(
|
|
455
467
|
"editFilteredData", "filter", ["field", "oneOf", "predicate", "range"]
|
|
456
468
|
);
|
|
457
|
-
export const editFoldData = focusedEditor(
|
|
469
|
+
export const editFoldData = /* @__PURE__ */ focusedEditor(
|
|
458
470
|
"editFoldData", "fold", ["fields", "as"]
|
|
459
471
|
);
|
|
460
|
-
export const editSummaryData = focusedEditor(
|
|
472
|
+
export const editSummaryData = /* @__PURE__ */ focusedEditor(
|
|
461
473
|
"editSummaryData", "summary", ["groupBy", "aggregates", "members", "weight"]
|
|
462
474
|
);
|
|
463
|
-
export const editBinData = focusedEditor(
|
|
475
|
+
export const editBinData = /* @__PURE__ */ focusedEditor(
|
|
464
476
|
"editBinData", "bin", [
|
|
465
477
|
"field", "maxBins", "step", "boundaries", "extent", "nice", "zero",
|
|
466
478
|
"includeEmpty", "members", "as", "weight"
|
|
467
479
|
]
|
|
468
480
|
);
|
|
469
|
-
export const editTimeUnitData = focusedEditor(
|
|
481
|
+
export const editTimeUnitData = /* @__PURE__ */ focusedEditor(
|
|
470
482
|
"editTimeUnitData", "timeUnit", [
|
|
471
483
|
"field", "unit", "as", "temporalUnit", "timeZone", "weekStartsOn",
|
|
472
484
|
"weekRule"
|
|
473
485
|
]
|
|
474
486
|
);
|
|
475
|
-
export const editWindowData = focusedEditor(
|
|
487
|
+
export const editWindowData = /* @__PURE__ */ focusedEditor(
|
|
476
488
|
"editWindowData", "window", [
|
|
477
489
|
"partitionBy", "sortBy", "operations", "temporalUnit"
|
|
478
490
|
]
|
|
479
491
|
);
|
|
480
|
-
export const editDensityData = focusedEditor(
|
|
492
|
+
export const editDensityData = /* @__PURE__ */ focusedEditor(
|
|
481
493
|
"editDensityData", "density", [
|
|
482
494
|
"field", "groupBy", "bandwidth", "extent", "steps", "kernel",
|
|
483
495
|
"normalization", "as", "weight"
|
|
484
496
|
]
|
|
485
497
|
);
|
|
486
|
-
export const editStackData = focusedEditor(
|
|
498
|
+
export const editStackData = /* @__PURE__ */ focusedEditor(
|
|
487
499
|
"editStackData", "stack", ["category", "group", "value", "mode", "as"]
|
|
488
500
|
);
|
|
489
|
-
export const editRegressionData = focusedEditor(
|
|
501
|
+
export const editRegressionData = /* @__PURE__ */ focusedEditor(
|
|
490
502
|
"editRegressionData", "regression", [
|
|
491
503
|
"x", "y", "groupBy", "method", "degree", "span", "confidenceMethod",
|
|
492
504
|
"level", "confidence", "interval"
|
|
493
505
|
]
|
|
494
506
|
);
|
|
495
|
-
export const editIntervalData = focusedEditor(
|
|
507
|
+
export const editIntervalData = /* @__PURE__ */ focusedEditor(
|
|
496
508
|
"editIntervalData", "interval", [
|
|
497
509
|
"field", "groupBy", "center", "extent", "method", "level", "as"
|
|
498
510
|
]
|
|
499
511
|
);
|
|
500
|
-
export const editECDFData = focusedEditor(
|
|
512
|
+
export const editECDFData = /* @__PURE__ */ focusedEditor(
|
|
501
513
|
"editECDFData", "ecdf", [
|
|
502
514
|
"field", "groupBy", "weight", "missing", "as"
|
|
503
515
|
]
|
|
504
516
|
);
|
|
505
|
-
export const editNormalizedData = focusedEditor(
|
|
517
|
+
export const editNormalizedData = /* @__PURE__ */ focusedEditor(
|
|
506
518
|
"editNormalizedData", "normalize", [
|
|
507
519
|
"field", "as", "groupBy", "method", "variance", "zeroDenominator",
|
|
508
520
|
"baseline", "sortBy"
|
|
509
521
|
]
|
|
510
522
|
);
|
|
511
|
-
export const editCompleteData = focusedEditor(
|
|
523
|
+
export const editCompleteData = /* @__PURE__ */ focusedEditor(
|
|
512
524
|
"editCompleteData", "complete", [
|
|
513
525
|
"key", "groupBy", "values", "sequence", "fill", "members"
|
|
514
526
|
]
|
|
515
527
|
);
|
|
516
|
-
export const editImputedData = focusedEditor(
|
|
528
|
+
export const editImputedData = /* @__PURE__ */ focusedEditor(
|
|
517
529
|
"editImputedData", "impute", [
|
|
518
530
|
"fields", "groupBy", "sortBy", "method", "value", "edges", "maxGap"
|
|
519
531
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { closedAction } from "../../core/action.js";
|
|
2
2
|
import { validateUserId } from "../../core/identifiers.js";
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { withPreviewDatasetValues } from
|
|
5
5
|
"../primitives/semanticAction.js";
|
|
6
6
|
import {
|
|
@@ -50,10 +50,9 @@ function retainedHistogramBoundaries(layer, items) {
|
|
|
50
50
|
return boundaries.length < 2 ? undefined : boundaries;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export const materializeFilteredData =
|
|
54
|
-
{ op: "materializeFilteredData", description: "Materialize one filtered derived dataset." },
|
|
53
|
+
export const materializeFilteredData = /* @__PURE__ */ closedAction(
|
|
54
|
+
{ op: "materializeFilteredData", description: "Materialize one filtered derived dataset." }, MATERIALIZE_OPTIONS,
|
|
55
55
|
function (args = {}) {
|
|
56
|
-
validateKeys(args, MATERIALIZE_OPTIONS, "materializeFilteredData");
|
|
57
56
|
const { id, source, transform } = requireDerivedDataset(
|
|
58
57
|
this,
|
|
59
58
|
args.id,
|
|
@@ -66,10 +65,9 @@ export const materializeFilteredData = action(
|
|
|
66
65
|
}
|
|
67
66
|
);
|
|
68
67
|
|
|
69
|
-
export const filterData =
|
|
70
|
-
{ op: "filterData", description: "Create a named dataset from one field filter." },
|
|
68
|
+
export const filterData = /* @__PURE__ */ closedAction(
|
|
69
|
+
{ op: "filterData", description: "Create a named dataset from one field filter." }, OPTIONS,
|
|
71
70
|
function (args = {}) {
|
|
72
|
-
validateKeys(args, OPTIONS, "filterData");
|
|
73
71
|
const id = validateUserId(args.id, "Filtered dataset id");
|
|
74
72
|
const requestedSource = validateUserId(
|
|
75
73
|
args.source ?? this.context.currentData,
|
|
@@ -97,13 +95,12 @@ export const filterData = action(
|
|
|
97
95
|
}
|
|
98
96
|
);
|
|
99
97
|
|
|
100
|
-
export const materializeMarkFilteredData =
|
|
98
|
+
export const materializeMarkFilteredData = /* @__PURE__ */ closedAction(
|
|
101
99
|
{
|
|
102
100
|
op: "materializeMarkFilteredData",
|
|
103
101
|
description: "Materialize member rows retained by one final-item mark selection."
|
|
104
|
-
},
|
|
102
|
+
}, MATERIALIZE_OPTIONS,
|
|
105
103
|
function (args = {}) {
|
|
106
|
-
validateKeys(args, MATERIALIZE_OPTIONS, "materializeMarkFilteredData");
|
|
107
104
|
const { id, dataset, source, transform } = requireDerivedDataset(
|
|
108
105
|
this,
|
|
109
106
|
args.id,
|
|
@@ -170,13 +167,12 @@ export const materializeMarkFilteredData = action(
|
|
|
170
167
|
}
|
|
171
168
|
);
|
|
172
169
|
|
|
173
|
-
export const materializeEmptyMark =
|
|
170
|
+
export const materializeEmptyMark = /* @__PURE__ */ closedAction(
|
|
174
171
|
{
|
|
175
172
|
op: "materializeEmptyMark",
|
|
176
173
|
description: "Clear one active empty-filter mark without changing its domains."
|
|
177
|
-
},
|
|
174
|
+
}, EMPTY_MARK_OPTIONS,
|
|
178
175
|
function (args = {}) {
|
|
179
|
-
validateKeys(args, EMPTY_MARK_OPTIONS, "materializeEmptyMark");
|
|
180
176
|
const id = validateUserId(args.id, "Empty mark id");
|
|
181
177
|
const layer = requireLayer(this, id);
|
|
182
178
|
const owner = this.markConfigs[id]?.markFilter;
|
|
@@ -261,13 +257,12 @@ function sameSelector(left, right) {
|
|
|
261
257
|
return JSON.stringify(left) === JSON.stringify(right);
|
|
262
258
|
}
|
|
263
259
|
|
|
264
|
-
export const removeMarkFilter =
|
|
260
|
+
export const removeMarkFilter = /* @__PURE__ */ closedAction(
|
|
265
261
|
{
|
|
266
262
|
op: "removeMarkFilter",
|
|
267
263
|
description: "Remove one active final-item filter and restore its source."
|
|
268
|
-
},
|
|
264
|
+
}, REMOVE_MARK_FILTER_OPTIONS,
|
|
269
265
|
function (args = {}) {
|
|
270
|
-
validateKeys(args, REMOVE_MARK_FILTER_OPTIONS, "removeMarkFilter");
|
|
271
266
|
const target = args.target === undefined
|
|
272
267
|
? undefined
|
|
273
268
|
: validateUserId(args.target, "Mark filter target id");
|
|
@@ -280,13 +275,12 @@ export const removeMarkFilter = action(
|
|
|
280
275
|
}
|
|
281
276
|
);
|
|
282
277
|
|
|
283
|
-
export const filterMarks =
|
|
278
|
+
export const filterMarks = /* @__PURE__ */ closedAction(
|
|
284
279
|
{
|
|
285
280
|
op: "filterMarks",
|
|
286
281
|
description: "Retain selected final mark items through immutable derived data."
|
|
287
|
-
},
|
|
282
|
+
}, MARK_OPTIONS,
|
|
288
283
|
function (args = {}) {
|
|
289
|
-
validateKeys(args, MARK_OPTIONS, "filterMarks");
|
|
290
284
|
if (args.mode !== undefined && !["replace", "compose"].includes(args.mode)) {
|
|
291
285
|
throw new Error(`Unknown mark filter mode "${args.mode}".`);
|
|
292
286
|
}
|
package/src/actions/data/fold.js
CHANGED
|
@@ -6,14 +6,14 @@ import { derivedCreator, derivedMaterializer } from "./shared.js";
|
|
|
6
6
|
|
|
7
7
|
const OPTIONS = Object.freeze(["id", "source", "fields", "as"]);
|
|
8
8
|
|
|
9
|
-
export const materializeFoldData = derivedMaterializer(
|
|
9
|
+
export const materializeFoldData = /* @__PURE__ */ derivedMaterializer(
|
|
10
10
|
"materializeFoldData",
|
|
11
11
|
"Materialize one immutable wide-to-long dataset.",
|
|
12
12
|
"fold",
|
|
13
13
|
deriveFoldRows
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
export const createFoldData = derivedCreator(
|
|
16
|
+
export const createFoldData = /* @__PURE__ */ derivedCreator(
|
|
17
17
|
"createFoldData",
|
|
18
18
|
"Create reusable key/value rows from selected wide fields.",
|
|
19
19
|
OPTIONS,
|
|
@@ -9,7 +9,7 @@ const OPTIONS = Object.freeze([
|
|
|
9
9
|
"kernel", "normalization", "center", "as"
|
|
10
10
|
]);
|
|
11
11
|
|
|
12
|
-
export const materializeGradientProfileData = derivedMaterializer(
|
|
12
|
+
export const materializeGradientProfileData = /* @__PURE__ */ derivedMaterializer(
|
|
13
13
|
"materializeGradientProfileData",
|
|
14
14
|
"Materialize one categorical density-profile dataset.",
|
|
15
15
|
"gradientProfile",
|
|
@@ -24,7 +24,7 @@ export const materializeGradientProfileData = derivedMaterializer(
|
|
|
24
24
|
}]
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
-
export const createGradientProfileData = derivedCreator(
|
|
27
|
+
export const createGradientProfileData = /* @__PURE__ */ derivedCreator(
|
|
28
28
|
"createGradientProfileData",
|
|
29
29
|
"Create one immutable categorical density-profile dataset.",
|
|
30
30
|
OPTIONS,
|
|
@@ -26,7 +26,7 @@ function requestedTransform(args) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export const materializeHorizonData = derivedMaterializer(
|
|
29
|
+
export const materializeHorizonData = /* @__PURE__ */ derivedMaterializer(
|
|
30
30
|
"materializeHorizonData",
|
|
31
31
|
"Materialize one immutable Horizon band dataset.",
|
|
32
32
|
"horizon",
|
|
@@ -34,7 +34,7 @@ export const materializeHorizonData = derivedMaterializer(
|
|
|
34
34
|
result => [{ ...result.transform, resolved: result.resolved }]
|
|
35
35
|
);
|
|
36
36
|
|
|
37
|
-
export const createHorizonData = derivedCreator(
|
|
37
|
+
export const createHorizonData = /* @__PURE__ */ derivedCreator(
|
|
38
38
|
"createHorizonData",
|
|
39
39
|
"Create one immutable Horizon band dataset.",
|
|
40
40
|
OPTIONS,
|
|
@@ -8,14 +8,14 @@ const OPTIONS = Object.freeze([
|
|
|
8
8
|
"id", "source", "fields", "groupBy", "sortBy", "method", "value", "edges", "maxGap"
|
|
9
9
|
]);
|
|
10
10
|
|
|
11
|
-
export const materializeImputedData = derivedMaterializer(
|
|
11
|
+
export const materializeImputedData = /* @__PURE__ */ derivedMaterializer(
|
|
12
12
|
"materializeImputedData",
|
|
13
13
|
"Materialize one immutable missing-value dataset.",
|
|
14
14
|
"impute",
|
|
15
15
|
deriveImputedRows
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
export const createImputedData = derivedCreator(
|
|
18
|
+
export const createImputedData = /* @__PURE__ */ derivedCreator(
|
|
19
19
|
"createImputedData",
|
|
20
20
|
"Replace explicit missing cells within independent groups.",
|
|
21
21
|
OPTIONS,
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
materializeBin2DData
|
|
36
36
|
} from "./bin2d.js";
|
|
37
37
|
import { createData } from "./create.js";
|
|
38
|
+
import { reviseData } from "./revise.js";
|
|
38
39
|
import { createWindowData, materializeWindowData } from "./window.js";
|
|
39
40
|
import { createSummaryData, materializeSummaryData } from "./summary.js";
|
|
40
41
|
import { createBinData, materializeBinData } from "./bin.js";
|
|
@@ -51,58 +52,58 @@ import { EDIT_DERIVED_DATA_ACTIONS } from "./edit.js";
|
|
|
51
52
|
import { createBoxSummaryData, createBoxOutlierData, materializeBoxSummaryData, materializeBoxOutlierData } from "./box.js";
|
|
52
53
|
|
|
53
54
|
export function registerDataActions(ProgramClass) {
|
|
54
|
-
Object.assign(ProgramClass.prototype, EDIT_DERIVED_DATA_ACTIONS
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
createCategoricalDensityData
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
55
|
+
Object.assign(ProgramClass.prototype, EDIT_DERIVED_DATA_ACTIONS, {
|
|
56
|
+
createData,
|
|
57
|
+
reviseData,
|
|
58
|
+
createDerivedData,
|
|
59
|
+
bindMarkData,
|
|
60
|
+
releaseDerivedData,
|
|
61
|
+
rebindLayerData,
|
|
62
|
+
createDensityData,
|
|
63
|
+
createCategoricalDensityData,
|
|
64
|
+
materializeFilteredData,
|
|
65
|
+
materializeMarkFilteredData,
|
|
66
|
+
filterData,
|
|
67
|
+
filterMarks,
|
|
68
|
+
materializeEmptyMark,
|
|
69
|
+
removeMarkFilter,
|
|
70
|
+
materializeRegressionData,
|
|
71
|
+
materializeDensityData,
|
|
72
|
+
createGradientProfileData,
|
|
73
|
+
materializeGradientProfileData,
|
|
74
|
+
createRegressionData,
|
|
75
|
+
materializeIntervalData,
|
|
76
|
+
createIntervalData,
|
|
77
|
+
createECDFData,
|
|
78
|
+
materializeECDFData,
|
|
79
|
+
createHorizonData,
|
|
80
|
+
materializeHorizonData,
|
|
81
|
+
createWindowData,
|
|
82
|
+
materializeWindowData,
|
|
83
|
+
createSummaryData,
|
|
84
|
+
materializeSummaryData,
|
|
85
|
+
createBinData,
|
|
86
|
+
materializeBinData,
|
|
87
|
+
createFoldData,
|
|
88
|
+
materializeFoldData,
|
|
89
|
+
createComputedData,
|
|
90
|
+
materializeComputedData,
|
|
91
|
+
createNormalizedData,
|
|
92
|
+
materializeNormalizedData,
|
|
93
|
+
createCompleteData,
|
|
94
|
+
materializeCompleteData,
|
|
95
|
+
createImputedData,
|
|
96
|
+
materializeImputedData,
|
|
97
|
+
createStackData,
|
|
98
|
+
materializeStackData,
|
|
99
|
+
createTimeUnitData,
|
|
100
|
+
materializeTimeUnitData,
|
|
101
|
+
createBin2DData,
|
|
102
|
+
editBin2DData,
|
|
103
|
+
materializeBin2DData,
|
|
104
|
+
createBoxSummaryData,
|
|
105
|
+
createBoxOutlierData,
|
|
106
|
+
materializeBoxSummaryData,
|
|
107
|
+
materializeBoxOutlierData
|
|
108
|
+
});
|
|
108
109
|
}
|
|
@@ -16,14 +16,14 @@ const OPTIONS = Object.freeze([
|
|
|
16
16
|
"as"
|
|
17
17
|
]);
|
|
18
18
|
|
|
19
|
-
export const materializeIntervalData = derivedMaterializer(
|
|
19
|
+
export const materializeIntervalData = /* @__PURE__ */ derivedMaterializer(
|
|
20
20
|
"materializeIntervalData",
|
|
21
21
|
"Materialize one grouped interval-summary dataset.",
|
|
22
22
|
"interval",
|
|
23
23
|
deriveInterval
|
|
24
24
|
);
|
|
25
25
|
|
|
26
|
-
export const createIntervalData = derivedCreator(
|
|
26
|
+
export const createIntervalData = /* @__PURE__ */ derivedCreator(
|
|
27
27
|
"createIntervalData",
|
|
28
28
|
"Create immutable grouped interval-summary values.",
|
|
29
29
|
OPTIONS,
|