@kepler.gl/actions 3.3.0-alpha.8 → 3.3.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import { default as ActionTypes } from './action-types';
2
2
  import { FileCacheItem } from '@kepler.gl/processors';
3
3
  import { Layer, LayerBaseConfig } from '@kepler.gl/layers';
4
4
  import { KeplerTable } from '@kepler.gl/table';
5
- import { AddDataToMapPayload, ViewportPadding, ValueOf, Merge, PickInfo, RGBColor, NestedPartial, LayerVisConfig, ColorUI, Feature, FeatureSelectionContext, InteractionConfig, Filter, ParsedConfig, ParsedLayer, EffectPropsPartial, AnnotationPropsPartial, SyncTimelineMode, AnimationConfig, FilterAnimationConfig, LayerOrder, LayerOrderGroup } from '@kepler.gl/types';
5
+ import { AddDataToMapPayload, ViewportPadding, ValueOf, Merge, PickInfo, RGBColor, NestedPartial, LayerVisConfig, ColorUI, Feature, FeatureSelectionContext, InteractionConfig, Filter, ParsedConfig, ParsedLayer, EffectPropsPartial, AnnotationPropsPartial, SyncTimelineMode, AnimationConfig, FilterAnimationConfig, LayerOrder, LayerOrderGroup, ProtoDataset } from '@kepler.gl/types';
6
6
  export type ApplyLayerConfigUpdaterAction = {
7
7
  oldLayerId: string;
8
8
  newLayerConfig: ParsedLayer;
@@ -564,6 +564,123 @@ export type UpdateDatasetColorUpdater = {
564
564
  export declare function updateTableColor(dataId: string, newColor: RGBColor): Merge<UpdateDatasetColorUpdater, {
565
565
  type: typeof ActionTypes.UPDATE_TABLE_COLOR;
566
566
  }>;
567
+ export type RefreshDatasetUpdaterAction = {
568
+ dataId: string;
569
+ };
570
+ /**
571
+ * Re-fetch an externally hosted dataset from its source URL.
572
+ * @memberof visStateActions
573
+ * @param dataId dataset id
574
+ * @returns action
575
+ * @public
576
+ */
577
+ export declare function refreshDataset(dataId: string): Merge<RefreshDatasetUpdaterAction, {
578
+ type: typeof ActionTypes.REFRESH_DATASET;
579
+ }>;
580
+ export type RefreshDatasetSuccessUpdaterAction = {
581
+ dataId: string;
582
+ result: {
583
+ data: ProtoDataset['data'] | null;
584
+ notModified: boolean;
585
+ etag?: string;
586
+ lastModified?: string;
587
+ size?: number;
588
+ };
589
+ };
590
+ /**
591
+ * Apply a successful remote dataset refresh.
592
+ * @memberof visStateActions
593
+ * @returns action
594
+ */
595
+ export declare function refreshDatasetSuccess(dataId: string, result: RefreshDatasetSuccessUpdaterAction['result']): Merge<RefreshDatasetSuccessUpdaterAction, {
596
+ type: typeof ActionTypes.REFRESH_DATASET_SUCCESS;
597
+ }>;
598
+ export type RefreshDatasetErrorUpdaterAction = {
599
+ dataId: string;
600
+ error: Error;
601
+ };
602
+ /**
603
+ * Record a failed remote dataset refresh.
604
+ * @memberof visStateActions
605
+ * @returns action
606
+ */
607
+ export declare function refreshDatasetError(dataId: string, error: Error): Merge<RefreshDatasetErrorUpdaterAction, {
608
+ type: typeof ActionTypes.REFRESH_DATASET_ERROR;
609
+ }>;
610
+ export type RefreshDatasetProgressUpdaterAction = {
611
+ dataId: string;
612
+ percent: number;
613
+ };
614
+ /**
615
+ * Update download progress for an in-flight remote dataset refresh (0–100).
616
+ * @memberof visStateActions
617
+ * @returns action
618
+ */
619
+ export declare function refreshDatasetProgress(dataId: string, percent: number): Merge<RefreshDatasetProgressUpdaterAction, {
620
+ type: typeof ActionTypes.REFRESH_DATASET_PROGRESS;
621
+ }>;
622
+ /**
623
+ * One dataset row: a column-ordered array (same as `ProtoDataset.data.rows`)
624
+ * or a field-name record. Missing keys become `null`.
625
+ */
626
+ export type DatasetRow = any[] | Record<string, unknown>;
627
+ export type AddToDatasetOptions = {
628
+ /**
629
+ * Field name used as a unique key. Matching rows are replaced in place;
630
+ * keys that are not in the table are appended. Last incoming row wins when
631
+ * the same key appears twice. Row tables only — Arrow/DuckDB no-op with a warning.
632
+ */
633
+ upsertBy?: string;
634
+ };
635
+ export type AddToDatasetUpdaterAction = {
636
+ dataId: string;
637
+ rows: DatasetRow | DatasetRow[];
638
+ options?: AddToDatasetOptions;
639
+ };
640
+ /**
641
+ * Append rows to an existing in-memory row dataset without `addDataToMap`.
642
+ * Keeps layer identity and style. Pass `options.upsertBy` to replace rows that
643
+ * share that key and append the rest.
644
+ *
645
+ * Not implemented for Arrow or DuckDB tables (no INSERT / concat yet); those
646
+ * calls warn and leave the table unchanged. Use `addDataToMap` with
647
+ * `keepExistingConfig` for a full replace.
648
+ * @memberof visStateActions
649
+ * @param dataId dataset id
650
+ * @param rows one row or an array of rows (arrays in field order, or objects keyed by field name)
651
+ * @param options optional `{upsertBy}` field name
652
+ * @returns action
653
+ * @public
654
+ */
655
+ export declare function addToDataset(dataId: string, rows: DatasetRow | DatasetRow[], options?: AddToDatasetOptions): Merge<AddToDatasetUpdaterAction, {
656
+ type: typeof ActionTypes.ADD_TO_DATASET;
657
+ }>;
658
+ export type RemoveFromDatasetByField = {
659
+ field: string;
660
+ values: unknown | unknown[];
661
+ };
662
+ export type RemoveFromDatasetUpdaterAction = {
663
+ dataId: string;
664
+ rowIndexes?: number | number[];
665
+ byField?: RemoveFromDatasetByField;
666
+ };
667
+ /**
668
+ * Delete rows from an existing in-memory row dataset without restyling layers.
669
+ * The second argument is either row indexes or `{field, values}` to match a
670
+ * column (e.g. an id). Out-of-range indexes are a no-op for the whole action.
671
+ *
672
+ * Not implemented for Arrow or DuckDB tables; those calls warn and leave the
673
+ * table unchanged. For a full table replace use `addDataToMap` with
674
+ * `keepExistingConfig`.
675
+ * @memberof visStateActions
676
+ * @param dataId dataset id
677
+ * @param rowIndexesOrMatcher one index, an array of indexes, or `{field, values}`
678
+ * @returns action
679
+ * @public
680
+ */
681
+ export declare function removeFromDataset(dataId: string, rowIndexesOrMatcher: number | number[] | RemoveFromDatasetByField): Merge<RemoveFromDatasetUpdaterAction, {
682
+ type: typeof ActionTypes.REMOVE_FROM_DATASET;
683
+ }>;
567
684
  export type SortTableColumnUpdaterAction = {
568
685
  dataId: string;
569
686
  column: string;
@@ -732,6 +849,30 @@ export declare function updateDatasetProps(dataId: string, props: {
732
849
  }): Merge<UpdateDatasetPropsUpdaterAction, {
733
850
  type: typeof ActionTypes.UPDATE_DATASET_PROPS;
734
851
  }>;
852
+ export type UpdateDatasetUpdaterAction = {
853
+ dataId: string;
854
+ /** New column data + field descriptors, e.g. `{cols, fields, arrowTable}` (same shape `KeplerTable.importData` accepts). */
855
+ data: ProtoDataset['data'];
856
+ /**
857
+ * Optional old → new column-name map, used to carry layers/filters/tooltips
858
+ * across a rename (name-based reconciliation alone would treat a renamed
859
+ * column as removed).
860
+ */
861
+ renames?: Record<string, string>;
862
+ };
863
+ /**
864
+ * Update an existing dataset's schema (columns + fields) in place.
865
+ * Unlike `addDataToMap`, this keeps the dataset `id`/`label`/`color`/`metadata`
866
+ * and reconciles layers, filters and tooltip config that referenced the old
867
+ * columns. Used by the AI assistant's `map.add-column` command.
868
+ * @param dataId - ***required** Id of the dataset to update
869
+ * @param data - ***required** New column data + field descriptors
870
+ * @param renames - (Optional) old column name → new column name, so layers/filters follow a rename
871
+ * @returns action
872
+ */
873
+ export declare function updateDataset(dataId: string, data: ProtoDataset['data'], renames?: Record<string, string>): Merge<UpdateDatasetUpdaterAction, {
874
+ type: typeof ActionTypes.UPDATE_DATASET;
875
+ }>;
735
876
  export type ToggleFilterAnimationUpdaterAction = {
736
877
  idx: number;
737
878
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kepler.gl/actions",
3
3
  "author": "Shan He <shan@uber.com>",
4
- "version": "3.3.0-alpha.8",
4
+ "version": "3.3.0-alpha.9",
5
5
  "description": "kepler.gl constants used by kepler.gl components, actions and reducers",
6
6
  "license": "MIT",
7
7
  "main": "dist/cjs/index.js",
@@ -29,13 +29,13 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@deck.gl/core": "^9.3.1",
32
- "@kepler.gl/cloud-providers": "3.3.0-alpha.8",
33
- "@kepler.gl/constants": "3.3.0-alpha.8",
34
- "@kepler.gl/layers": "3.3.0-alpha.8",
35
- "@kepler.gl/processors": "3.3.0-alpha.8",
36
- "@kepler.gl/table": "3.3.0-alpha.8",
37
- "@kepler.gl/types": "3.3.0-alpha.8",
38
- "@kepler.gl/utils": "3.3.0-alpha.8",
32
+ "@kepler.gl/cloud-providers": "3.3.0-alpha.9",
33
+ "@kepler.gl/constants": "3.3.0-alpha.9",
34
+ "@kepler.gl/layers": "3.3.0-alpha.9",
35
+ "@kepler.gl/processors": "3.3.0-alpha.9",
36
+ "@kepler.gl/table": "3.3.0-alpha.9",
37
+ "@kepler.gl/types": "3.3.0-alpha.9",
38
+ "@kepler.gl/utils": "3.3.0-alpha.9",
39
39
  "@reduxjs/toolkit": "^1.7.2",
40
40
  "@types/react-redux": "^7.1.23",
41
41
  "@types/redux-actions": "^2.6.2",