diff --git a/src/client/deserializers/app-settings.ts b/src/client/deserializers/app-settings.ts index 35d80f28d..b4b29e350 100644 --- a/src/client/deserializers/app-settings.ts +++ b/src/client/deserializers/app-settings.ts @@ -15,14 +15,14 @@ */ import { ClientAppSettings, SerializedAppSettings } from "../../common/models/app-settings/app-settings"; -import { deserialize as customizationDeserialize } from "./customization"; -import { deserialize as oauthDeserialize } from "./oauth"; +import { deserialize as deserializeCustomization } from "./customization"; +import { deserialize as deserializeOauth } from "./oauth"; export function deserialize({ oauth, clientTimeout, customization, version }: SerializedAppSettings): ClientAppSettings { return { clientTimeout, version, - customization: customizationDeserialize(customization), - oauth: oauthDeserialize(oauth) + customization: deserializeCustomization(customization), + oauth: deserializeOauth(oauth) }; } diff --git a/src/client/deserializers/customization.ts b/src/client/deserializers/customization.ts index 01d0fe9c3..20cd6f2b0 100644 --- a/src/client/deserializers/customization.ts +++ b/src/client/deserializers/customization.ts @@ -16,7 +16,7 @@ import { Timezone } from "chronoshift"; import { ClientCustomization, SerializedCustomization } from "../../common/models/customization/customization"; -import { deserialize as localeDeserialize } from "../../common/models/locale/locale"; +import { deserialize as deserializeLocale } from "../../common/models/locale/locale"; export function deserialize(customization: SerializedCustomization): ClientCustomization { const { headerBackground, locale, customLogoSvg, timezones, externalViews, hasUrlShortener, sentryDSN } = customization; @@ -26,7 +26,7 @@ export function deserialize(customization: SerializedCustomization): ClientCusto externalViews, hasUrlShortener, sentryDSN, - locale: localeDeserialize(locale), + locale: deserializeLocale(locale), timezones: timezones.map(Timezone.fromJS) }; } diff --git a/src/client/deserializers/data-cube.ts b/src/client/deserializers/data-cube.ts index d826d47dd..23693e6c8 100644 --- a/src/client/deserializers/data-cube.ts +++ b/src/client/deserializers/data-cube.ts @@ -17,12 +17,12 @@ import { Duration, Timezone } from "chronoshift"; import { AttributeInfo, Executor } from "plywood"; import { ClientDataCube, SerializedDataCube } from "../../common/models/data-cube/data-cube"; -import { serialize as dimensionsSerialize } from "../../common/models/dimension/dimensions"; +import { serialize as serializeDimensions } from "../../common/models/dimension/dimensions"; import { Filter } from "../../common/models/filter/filter"; -import { serialize as measuresSerialize } from "../../common/models/measure/measures"; +import { serialize as serializeMeasures } from "../../common/models/measure/measures"; import { RefreshRule } from "../../common/models/refresh-rule/refresh-rule"; -import { deserialize as dimensionsDeserialize } from "./dimensions"; -import { deserialize as measuresDeserialize } from "./measures"; +import { deserialize as deserializeDimensions } from "./dimensions"; +import { deserialize as deserializeMeasures } from "./measures"; export function deserialize(dataCube: SerializedDataCube, executor: Executor): ClientDataCube { const { @@ -60,12 +60,12 @@ export function deserialize(dataCube: SerializedDataCube, executor: Executor): C defaultSplitDimensions, defaultTimezone: Timezone.fromJS(defaultTimezone), description, - dimensions: dimensionsDeserialize(dimensions), + dimensions: deserializeDimensions(dimensions), executor, extendedDescription, group, maxSplits, - measures: measuresDeserialize(measures), + measures: deserializeMeasures(measures), name, options, refreshRule: RefreshRule.fromJS(refreshRule), @@ -116,11 +116,11 @@ export function serialize(dataCube: ClientDataCube): SerializedDataCube { defaultSplitDimensions, defaultTimezone: defaultTimezone.toJS(), description, - dimensions: dimensionsSerialize(dimensions), + dimensions: serializeDimensions(dimensions), extendedDescription, group, maxSplits, - measures: measuresSerialize(measures), + measures: serializeMeasures(measures), name, options, refreshRule: RefreshRule.fromJS(refreshRule), diff --git a/src/client/deserializers/dimensions.ts b/src/client/deserializers/dimensions.ts index ee08f04ee..4f3f50cd9 100644 --- a/src/client/deserializers/dimensions.ts +++ b/src/client/deserializers/dimensions.ts @@ -16,11 +16,11 @@ import { ClientDimensions, SerializedDimensions } from "../../common/models/dimension/dimensions"; import { mapValues } from "../../common/utils/object/object"; -import { deserialize as dimensionDeserialize } from "./dimension"; +import { deserialize as deserializeDimension } from "./dimension"; export function deserialize({ tree, byName }: SerializedDimensions): ClientDimensions { return { tree, - byName: mapValues(byName, dimensionDeserialize) + byName: mapValues(byName, deserializeDimension) }; } diff --git a/src/client/deserializers/measures.ts b/src/client/deserializers/measures.ts index c0bbdc891..0410d9e88 100644 --- a/src/client/deserializers/measures.ts +++ b/src/client/deserializers/measures.ts @@ -16,11 +16,11 @@ import { ClientMeasures, SerializedMeasures } from "../../common/models/measure/measures"; import { mapValues } from "../../common/utils/object/object"; -import { deserialize as measureDeserialize } from "./measure"; +import { deserialize as deserializeMeasure } from "./measure"; export function deserialize({ tree, byName }: SerializedMeasures): ClientMeasures { return { tree, - byName: mapValues(byName, measureDeserialize) + byName: mapValues(byName, deserializeMeasure) }; } diff --git a/src/client/deserializers/sources.ts b/src/client/deserializers/sources.ts index adc64fa92..cdd78c938 100644 --- a/src/client/deserializers/sources.ts +++ b/src/client/deserializers/sources.ts @@ -18,15 +18,15 @@ import { ClientAppSettings } from "../../common/models/app-settings/app-settings import { SerializedDataCube } from "../../common/models/data-cube/data-cube"; import { ClientSources, SerializedSources } from "../../common/models/sources/sources"; import { Ajax } from "../utils/ajax/ajax"; -import { deserialize as clusterDeserialize } from "./cluster"; -import { deserialize as dataCubeDeserialize } from "./data-cube"; +import { deserialize as deserializeCluster } from "./cluster"; +import { deserialize as deserializeDataCube } from "./data-cube"; export function deserialize(settings: SerializedSources, appSettings: ClientAppSettings): ClientSources { - const clusters = settings.clusters.map(clusterDeserialize); + const clusters = settings.clusters.map(deserializeCluster); const dataCubes = settings.dataCubes.map((dataCube: SerializedDataCube) => { const executor = Ajax.queryUrlExecutorFactory(dataCube.name, appSettings); - return dataCubeDeserialize(dataCube, executor); + return deserializeDataCube(dataCube, executor); }); return { diff --git a/src/common/models/app-settings/app-settings.ts b/src/common/models/app-settings/app-settings.ts index f85edb29b..870cffc25 100644 --- a/src/common/models/app-settings/app-settings.ts +++ b/src/common/models/app-settings/app-settings.ts @@ -21,14 +21,14 @@ import { Customization, CustomizationJS, fromConfig as customizationFromConfig, - serialize as customizationSerialize, + serialize as serializeCustomization, SerializedCustomization } from "../customization/customization"; import { fromConfig as oauthFromConfig, Oauth, OauthJS, - serialize as oauthSerialize, + serialize as serializeOauth, SerializedOauth } from "../oauth/oauth"; @@ -82,8 +82,8 @@ export function serialize({ oauth, clientTimeout, customization, version }: AppS return { clientTimeout, version, - customization: customizationSerialize(customization), - oauth: oauthSerialize(oauth) + customization: serializeCustomization(customization), + oauth: serializeOauth(oauth) }; } diff --git a/src/common/models/cluster/cluster.mocha.ts b/src/common/models/cluster/cluster.mocha.ts index 3312a0cde..44a1e2e62 100644 --- a/src/common/models/cluster/cluster.mocha.ts +++ b/src/common/models/cluster/cluster.mocha.ts @@ -25,7 +25,7 @@ use(equivalent); describe("Cluster", () => { describe("fromConfig", () => { - it("should load defaults", () => { + it("should load default values", () => { const cluster = fromConfig({ name: "foobar", url: "http://bazz" diff --git a/src/common/models/customization/customization.ts b/src/common/models/customization/customization.ts index 659fb43c0..dd668c73d 100644 --- a/src/common/models/customization/customization.ts +++ b/src/common/models/customization/customization.ts @@ -20,7 +20,7 @@ import { LOGGER } from "../../logger/logger"; import { assoc } from "../../utils/functional/functional"; import { isTruthy } from "../../utils/general/general"; import { ExternalView, ExternalViewValue } from "../external-view/external-view"; -import { fromConfig as localeFromConfig, Locale, LocaleJS, serialize as localeSerialize } from "../locale/locale"; +import { fromConfig as localeFromConfig, Locale, LocaleJS, serialize as serializeLocale } from "../locale/locale"; import { fromConfig as urlShortenerFromConfig, UrlShortener, UrlShortenerDef } from "../url-shortener/url-shortener"; export const DEFAULT_TITLE = "Turnilo (%v)"; @@ -184,7 +184,7 @@ export function fromConfig(config: CustomizationJS = {}): Customization { ? configExternalViews.map(ExternalView.fromJS) : []; - const customization = { + return { title, headerBackground, customLogoSvg, @@ -195,8 +195,6 @@ export function fromConfig(config: CustomizationJS = {}): Customization { locale: localeFromConfig(locale), externalViews }; - - return customization; } export function serialize(customization: Customization): SerializedCustomization { @@ -207,7 +205,7 @@ export function serialize(customization: Customization): SerializedCustomization hasUrlShortener: isTruthy(urlShortener), headerBackground, sentryDSN, - locale: localeSerialize(locale), + locale: serializeLocale(locale), timezones: timezones.map(t => t.toJS()) }; } diff --git a/src/common/models/data-cube/data-cube.ts b/src/common/models/data-cube/data-cube.ts index 5d8074604..a6ab40f77 100644 --- a/src/common/models/data-cube/data-cube.ts +++ b/src/common/models/data-cube/data-cube.ts @@ -42,7 +42,7 @@ import { findDimensionByName, fromConfig as dimensionsFromConfig, prepend, - serialize as dimensionsSerialize, + serialize as serializeDimensions, SerializedDimensions } from "../dimension/dimensions"; import { RelativeTimeFilterClause, TimeFilterPeriod } from "../filter-clause/filter-clause"; @@ -54,7 +54,8 @@ import { hasMeasureWithName, MeasureOrGroupJS, Measures, - serialize as measuresSerialize, SerializedMeasures + serialize as serializeMeasures, + SerializedMeasures } from "../measure/measures"; import { QueryDecoratorDefinition, QueryDecoratorDefinitionJS } from "../query-decorator/query-decorator"; import { RefreshRule, RefreshRuleJS } from "../refresh-rule/refresh-rule"; @@ -433,11 +434,11 @@ export function serialize(dataCube: DataCube): SerializedDataCube { defaultSplitDimensions, defaultTimezone: defaultTimezone.toJS(), description, - dimensions: dimensionsSerialize(dimensions), + dimensions: serializeDimensions(dimensions), extendedDescription, group, maxSplits, - measures: measuresSerialize(measures), + measures: serializeMeasures(measures), name, options, refreshRule: refreshRule.toJS(), diff --git a/src/common/models/dimension/dimensions.ts b/src/common/models/dimension/dimensions.ts index a77487cc7..0a0cfb133 100644 --- a/src/common/models/dimension/dimensions.ts +++ b/src/common/models/dimension/dimensions.ts @@ -22,7 +22,7 @@ import { Dimension, DimensionJS, fromConfig as dimensionFromConfig, - serialize as dimensionSerialize, + serialize as serializeDimension, SerializedDimension } from "./dimension"; @@ -105,7 +105,7 @@ export interface SerializedDimensions { export function serialize({ tree, byName }: Dimensions): SerializedDimensions { return { tree, - byName: mapValues(byName, dimensionSerialize) + byName: mapValues(byName, serializeDimension) }; } diff --git a/src/common/models/measure/measures.ts b/src/common/models/measure/measures.ts index 76855527a..f6eed2885 100644 --- a/src/common/models/measure/measures.ts +++ b/src/common/models/measure/measures.ts @@ -24,7 +24,7 @@ import { fromConfig as measureFromConfig, Measure, MeasureJS, - serialize as measureSerialize, + serialize as serializeMeasure, SerializedMeasure } from "./measure"; @@ -107,7 +107,7 @@ export type ClientMeasures = Measures; export function serialize({ tree, byName }: Measures): SerializedMeasures { return { tree, - byName: mapValues(byName, measureSerialize) + byName: mapValues(byName, serializeMeasure) }; } diff --git a/src/common/models/sources/sources.ts b/src/common/models/sources/sources.ts index a8953e6ed..9d09ac608 100644 --- a/src/common/models/sources/sources.ts +++ b/src/common/models/sources/sources.ts @@ -21,7 +21,7 @@ import { Cluster, ClusterJS, fromConfig as clusterFromConfig, - serialize as clusterSerialize, + serialize as serializeCluster, SerializedCluster } from "../cluster/cluster"; import { findCluster } from "../cluster/find-cluster"; @@ -30,7 +30,7 @@ import { DataCube, DataCubeJS, fromConfig as dataCubeFromConfig, - serialize as dataCubeSerialize, + serialize as serializeDataCube, SerializedDataCube } from "../data-cube/data-cube"; import { isQueryable, QueryableDataCube } from "../data-cube/queryable-data-cube"; @@ -99,11 +99,11 @@ export function serialize({ clusters: serverClusters, dataCubes: serverDataCubes }: Sources): SerializedSources { - const clusters = serverClusters.map(clusterSerialize); + const clusters = serverClusters.map(serializeCluster); const dataCubes = serverDataCubes .filter(dc => isQueryable(dc)) - .map(dataCubeSerialize); + .map(serializeDataCube); return { clusters,