diff --git a/package-lock.json b/package-lock.json index 0e0c391..5c4646e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,7 @@ "requires": true, "packages": { "": { - "version": "1.6.0-dev.2", + "version": "1.8.0-dev.1", "license": "MIT", "dependencies": { "@ctrl/tinycolor": "^3.3.3", @@ -23,7 +23,7 @@ "parse-duration": "^0.4.4", "spark-md5": "^3.0.1", "tinycolor": "^0.0.1", - "ts-interface-checker": "^0.1.13" + "ts-interface-checker": "^0.2.0" }, "devDependencies": { "@babel/core": "^7.12.10", @@ -8015,7 +8015,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz", "integrity": "sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -8035,7 +8035,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz", "integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -8043,7 +8043,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz", "integrity": "sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -8051,7 +8051,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/lodash._createcache/-/lodash._createcache-3.1.2.tgz", "integrity": "sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -8070,7 +8070,7 @@ "version": "3.9.1", "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -8094,7 +8094,7 @@ "version": "3.6.1", "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -12350,9 +12350,9 @@ } }, "node_modules/ts-interface-checker": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", - "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.2.0.tgz", + "integrity": "sha512-wkqy1TC9FxALfAl10ov0joZK5aXjIhnOYBe26XSPiRD0UemFuQOF7D/LowiCFu5gbjYJc+ao0H+I50YYU9oKVA==" }, "node_modules/tslib": { "version": "2.1.0", @@ -18757,7 +18757,7 @@ "resolved": "https://registry.npmjs.org/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz", "integrity": "sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=", "bundled": true, - "dev": true + "extraneous": true }, "lodash._baseuniq": { "version": "4.6.0", @@ -18775,21 +18775,21 @@ "resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz", "integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4=", "bundled": true, - "dev": true + "extraneous": true }, "lodash._cacheindexof": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz", "integrity": "sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=", "bundled": true, - "dev": true + "extraneous": true }, "lodash._createcache": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/lodash._createcache/-/lodash._createcache-3.1.2.tgz", "integrity": "sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=", "bundled": true, - "dev": true, + "extraneous": true, "requires": { "lodash._getnative": "^3.0.0" } @@ -18806,7 +18806,7 @@ "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", "bundled": true, - "dev": true + "extraneous": true }, "lodash._root": { "version": "3.0.1", @@ -18827,7 +18827,7 @@ "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", "bundled": true, - "dev": true + "extraneous": true }, "lodash.union": { "version": "4.6.0", @@ -22225,9 +22225,9 @@ } }, "ts-interface-checker": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", - "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==" + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.2.0.tgz", + "integrity": "sha512-wkqy1TC9FxALfAl10ov0joZK5aXjIhnOYBe26XSPiRD0UemFuQOF7D/LowiCFu5gbjYJc+ao0H+I50YYU9oKVA==" }, "tslib": { "version": "2.1.0", diff --git a/package.json b/package.json index 0893d56..066d8f5 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "parse-duration": "^0.4.4", "spark-md5": "^3.0.1", "tinycolor": "^0.0.1", - "ts-interface-checker": "^0.1.13" + "ts-interface-checker": "^0.2.0" }, "devDependencies": { "@babel/core": "^7.12.10", diff --git a/src/types-config-ti.ts b/src/types-config-ti.ts index 417b3b0..2273108 100644 --- a/src/types-config-ti.ts +++ b/src/types-config-ti.ts @@ -45,6 +45,7 @@ export const ChartCardSpanExtConfig = t.iface([], { }); export const ChartCardAllSeriesExternalConfig = t.iface([], { + "entity": t.opt("string"), "attribute": t.opt("string"), "name": t.opt("string"), "type": t.opt(t.union(t.lit('line'), t.lit('column'), t.lit('area'))), @@ -80,41 +81,8 @@ export const ChartCardAllSeriesExternalConfig = t.iface([], { "color_threshold": t.opt(t.array("ChartCardColorThreshold")), }); -export const ChartCardSeriesExternalConfig = t.iface([], { +export const ChartCardSeriesExternalConfig = t.iface(["ChartCardAllSeriesExternalConfig"], { "entity": "string", - "attribute": t.opt("string"), - "name": t.opt("string"), - "type": t.opt(t.union(t.lit('line'), t.lit('column'), t.lit('area'))), - "color": t.opt("string"), - "opacity": t.opt("number"), - "curve": t.opt(t.union(t.lit('smooth'), t.lit('straight'), t.lit('stepline'))), - "stroke_width": t.opt("number"), - "extend_to_end": t.opt("boolean"), - "unit": t.opt("string"), - "invert": t.opt("boolean"), - "data_generator": t.opt("string"), - "float_precision": t.opt("number"), - "min": t.opt("number"), - "max": t.opt("number"), - "offset": t.opt("string"), - "fill_raw": t.opt("GroupByFill"), - "show": t.opt(t.iface([], { - "as_duration": t.opt("ChartCardPrettyTime"), - "legend_value": t.opt("boolean"), - "in_header": t.opt(t.union("boolean", t.lit('raw'))), - "header_color_threshold": t.opt("boolean"), - "in_chart": t.opt("boolean"), - "datalabels": t.opt(t.union("boolean", t.lit('total'))), - "hidden_by_default": t.opt("boolean"), - "extremas": t.opt(t.union("boolean", t.lit('time'))), - })), - "group_by": t.opt(t.iface([], { - "duration": t.opt("string"), - "func": t.opt("GroupByFunc"), - "fill": t.opt("GroupByFill"), - })), - "transform": t.opt("string"), - "color_threshold": t.opt(t.array("ChartCardColorThreshold")), }); export const ChartCardPrettyTime = t.union(t.lit('millisecond'), t.lit('second'), t.lit('minute'), t.lit('hour'), t.lit('day'), t.lit('week'), t.lit('month'), t.lit('year')); diff --git a/src/types-config.ts b/src/types-config.ts index 8b0dda2..5904129 100644 --- a/src/types-config.ts +++ b/src/types-config.ts @@ -42,6 +42,7 @@ export interface ChartCardSpanExtConfig { } export interface ChartCardAllSeriesExternalConfig { + entity?: string; attribute?: string; name?: string; type?: 'line' | 'column' | 'area'; @@ -77,45 +78,8 @@ export interface ChartCardAllSeriesExternalConfig { color_threshold?: ChartCardColorThreshold[]; } -// Need to duplicate because of https://github.com/gristlabs/ts-interface-checker/issues/35 -// export interface ChartCardSeriesExternalConfig extends ChartCardAllSeriesExternalConfig { -// entity: string; -// } -export interface ChartCardSeriesExternalConfig { +export interface ChartCardSeriesExternalConfig extends ChartCardAllSeriesExternalConfig { entity: string; - attribute?: string; - name?: string; - type?: 'line' | 'column' | 'area'; - color?: string; - opacity?: number; - curve?: 'smooth' | 'straight' | 'stepline'; - stroke_width?: number; - extend_to_end?: boolean; - unit?: string; - invert?: boolean; - data_generator?: string; - float_precision?: number; - min?: number; - max?: number; - offset?: string; - fill_raw?: GroupByFill; - show?: { - as_duration?: ChartCardPrettyTime; - legend_value?: boolean; - in_header?: boolean | 'raw'; - header_color_threshold?: boolean; - in_chart?: boolean; - datalabels?: boolean | 'total'; - hidden_by_default?: boolean; - extremas?: boolean | 'time'; - }; - group_by?: { - duration?: string; - func?: GroupByFunc; - fill?: GroupByFill; - }; - transform?: string; - color_threshold?: ChartCardColorThreshold[]; } export type ChartCardPrettyTime = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';