@carto/api-client 0.5.1-alpha.1 → 0.5.1-alpha.2

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/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "homepage": "https://github.com/CartoDB/carto-api-client#readme",
9
9
  "author": "Don McCurdy <donmccurdy@carto.com>",
10
10
  "packageManager": "yarn@4.3.1",
11
- "version": "0.5.1-alpha.1",
11
+ "version": "0.5.1-alpha.2",
12
12
  "license": "MIT",
13
13
  "publishConfig": {
14
14
  "access": "public"
@@ -23,6 +23,8 @@ export type TileFeatures = {
23
23
  /** @privateRemarks Source: @carto/react-core */
24
24
  export type TileFeatureExtractOptions = {
25
25
  storeGeometry?: boolean;
26
+ spatialDataType?: SpatialDataType;
27
+ spatialDataColumn?: string;
26
28
  uniqueIdProperty?: string;
27
29
  };
28
30
 
package/src/utils.ts CHANGED
@@ -100,3 +100,30 @@ export const isObject: (x: unknown) => boolean = (x) =>
100
100
  /** @internal */
101
101
  export const isPureObject: (x: any) => boolean = (x) =>
102
102
  isObject(x) && x.constructor === {}.constructor;
103
+
104
+ /**
105
+ * Merges one or more source objects into a target object. Unlike `Object.assign`, does not
106
+ * assign properties with undefined values. Null values will overwrite existing properties.
107
+ */
108
+ export function assignOptional<T extends object, U, V>(
109
+ target: T,
110
+ source1: U,
111
+ source2: V
112
+ ): T & U & V;
113
+ export function assignOptional<T extends object, U>(
114
+ target: T,
115
+ source: U
116
+ ): T & U;
117
+ export function assignOptional<T extends object, U>(
118
+ target: T,
119
+ ...sources: any[]
120
+ ): any {
121
+ for (const source of sources) {
122
+ for (const key in source) {
123
+ if (source[key] !== undefined) {
124
+ (target as Record<string, unknown>)[key] = source[key];
125
+ }
126
+ }
127
+ }
128
+ return target as T & U;
129
+ }
@@ -16,7 +16,12 @@ import {
16
16
  TimeSeriesRequestOptions,
17
17
  TimeSeriesResponse,
18
18
  } from './types.js';
19
- import {InvalidColumnError, assert, getApplicableFilters} from '../utils.js';
19
+ import {
20
+ InvalidColumnError,
21
+ assert,
22
+ assignOptional,
23
+ getApplicableFilters,
24
+ } from '../utils.js';
20
25
  import {Filter, SpatialFilter, Tile} from '../types.js';
21
26
  import {
22
27
  TileFeatureExtractOptions,
@@ -84,8 +89,7 @@ export class WidgetTilesetSourceImpl extends WidgetSource<WidgetTilesetSourcePro
84
89
  }
85
90
 
86
91
  this._features = tileFeatures({
87
- ...this.props,
88
- ...this._tileFeatureExtractOptions,
92
+ ...assignOptional({}, this.props, this._tileFeatureExtractOptions),
89
93
  tiles: this._tiles,
90
94
  spatialFilter,
91
95
  });