From 24b585db3a0afec29a74b02c2499dc36aae0076a Mon Sep 17 00:00:00 2001 From: manushak Date: Wed, 21 Aug 2024 18:01:55 +0400 Subject: [PATCH 1/4] feat(package): update if-core version --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index c11cceb0..663d3b06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@commitlint/cli": "^18.6.0", "@commitlint/config-conventional": "^18.6.0", - "@grnsft/if-core": "^0.0.17", + "@grnsft/if-core": "^0.0.18", "axios": "^1.7.2", "csv-parse": "^5.5.6", "csv-stringify": "^6.4.6", @@ -1186,9 +1186,9 @@ } }, "node_modules/@grnsft/if-core": { - "version": "0.0.17", - "resolved": "https://registry.npmjs.org/@grnsft/if-core/-/if-core-0.0.17.tgz", - "integrity": "sha512-t94QvQgP4qomJoSqPUy70Th271/3b3E8+FfmW0Fv00je5Lb5OVAzF1FAD1GdP1UkoXJkbklO99d6hbTMCZSHlw==", + "version": "0.0.18", + "resolved": "https://registry.npmjs.org/@grnsft/if-core/-/if-core-0.0.18.tgz", + "integrity": "sha512-fZVGADUFf+9CQm+upGwGbQ5zlj7mndxZJ/Bfx2V/8+diU//xvK2vACC/7a1M0pHHhP8tKbfgdGopwWUI3POzcw==", "dependencies": { "typescript": "^5.1.6", "zod": "^3.23.8" diff --git a/package.json b/package.json index 8a86b90e..63ab8bf0 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "dependencies": { "@commitlint/cli": "^18.6.0", "@commitlint/config-conventional": "^18.6.0", - "@grnsft/if-core": "^0.0.17", + "@grnsft/if-core": "^0.0.18", "axios": "^1.7.2", "csv-parse": "^5.5.6", "csv-stringify": "^6.4.6", From f5d7043b423dfc091e5c4d3cc52a6dc6c3bbe226 Mon Sep 17 00:00:00 2001 From: manushak Date: Wed, 21 Aug 2024 18:02:53 +0400 Subject: [PATCH 2/4] feat(util): remove mapping functions --- src/common/util/helpers.ts | 68 -------------------------------------- 1 file changed, 68 deletions(-) diff --git a/src/common/util/helpers.ts b/src/common/util/helpers.ts index 3a1f623e..01b87c79 100644 --- a/src/common/util/helpers.ts +++ b/src/common/util/helpers.ts @@ -2,7 +2,6 @@ import {createInterface} from 'node:readline/promises'; import {exec} from 'child_process'; import * as path from 'path'; import {promisify} from 'util'; -import {MappingParams, PluginParams} from '@grnsft/if-core/types'; /** * Promise version of Node's `exec` from `child-process`. @@ -64,70 +63,3 @@ export const parseManifestFromStdin = async () => { return match![1]; }; - -/** - * Maps input data if the mapping has valid data. - */ -export const mapInputIfNeeded = ( - input: PluginParams, - mapping: MappingParams -) => { - const newInput = Object.assign({}, input); - - Object.entries(mapping || {}).forEach(([key, value]) => { - if (value in newInput) { - const mappedKey = input[value]; - newInput[key] = mappedKey; - delete newInput[value]; - } - }); - - return newInput; -}; - -/** - * Maps config data if the mapping hass valid data. - */ -export const mapConfigIfNeeded = (config: any, mapping: MappingParams) => { - if (!mapping) { - return config; - } - - if (typeof config !== 'object' || config === null) { - return config; - } - - const result: Record = Array.isArray(config) ? [] : {}; - - Object.entries(config).forEach(([key, value]) => { - const mappedKey = mapping[key] || key; - - if (typeof value === 'object' && value !== null) { - result[mappedKey] = mapConfigIfNeeded(value, mapping); - } else { - result[mappedKey] = - typeof value === 'string' && value in mapping ? mapping[value] : value; - } - }); - - return result; -}; - -/** - * Maps the output parameter of the plugin if the `mapping` parameter is provided. - */ -export const mapOutputIfNeeded = ( - output: PluginParams, - mapping: MappingParams -) => { - if (!mapping) return output; - - return Object.entries(output).reduce((acc, [key, value]) => { - if (key in mapping) { - acc[mapping[key]] = value; - } else { - acc[key] = value; - } - return acc; - }, {} as PluginParams); -}; From a781b0f97ca2188fbaecea28a91399d1fb2750d9 Mon Sep 17 00:00:00 2001 From: manushak Date: Wed, 21 Aug 2024 18:04:05 +0400 Subject: [PATCH 3/4] test(util): remove mapping functions tests --- src/__tests__/common/util/helpers.test.ts | 155 +--------------------- 1 file changed, 1 insertion(+), 154 deletions(-) diff --git a/src/__tests__/common/util/helpers.test.ts b/src/__tests__/common/util/helpers.test.ts index 38768937..11838100 100644 --- a/src/__tests__/common/util/helpers.test.ts +++ b/src/__tests__/common/util/helpers.test.ts @@ -2,12 +2,7 @@ jest.mock('node:readline/promises', () => require('../../../__mocks__/readline') ); -import { - parseManifestFromStdin, - mapInputIfNeeded, - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; +import {parseManifestFromStdin} from '../../../common/util/helpers'; describe('common/util/helpers: ', () => { describe('parseManifestFromStdin(): ', () => { @@ -46,152 +41,4 @@ describe('common/util/helpers: ', () => { expect(response).toEqual(expectedMessage); }); }); - - describe('mapInputIfNeeded(): ', () => { - it('returns a new object with no changes when mapping is empty.', () => { - const input = { - timestamp: '2021-01-01T00:00:00Z', - duration: 60 * 60 * 24 * 30, - 'device/carbon-footprint': 200, - 'device/expected-lifespan': 60 * 60 * 24 * 365 * 4, - 'resources-reserved': 1, - 'resources-total': 1, - }; - const mapping = {}; - - const result = mapInputIfNeeded(input, mapping); - - expect(result).toEqual(input); - }); - - it('returns a new object with keys remapped according to the mapping.', () => { - const input = { - timestamp: '2021-01-01T00:00:00Z', - duration: 60 * 60 * 24 * 30, - 'device/carbon-footprint': 200, - 'device/expected-lifespan': 60 * 60 * 24 * 365 * 4, - 'resources-reserved': 1, - 'resources-total': 1, - }; - const mapping = {'device/emissions-embodied': 'device/carbon-footprint'}; - - const expectedOutput = { - timestamp: '2021-01-01T00:00:00Z', - duration: 60 * 60 * 24 * 30, - 'device/emissions-embodied': 200, - 'device/expected-lifespan': 60 * 60 * 24 * 365 * 4, - 'resources-reserved': 1, - 'resources-total': 1, - }; - - const result = mapInputIfNeeded(input, mapping); - - expect(result).toEqual(expectedOutput); - expect(result).not.toHaveProperty('device/carbon-footprint'); - }); - }); - - describe('mapConfigIfNeeded', () => { - it('returns the config as is if no mapping is provided.', () => { - const config = { - filepath: './file.csv', - query: { - 'cpu-cores-available': 'cpu/available', - 'cpu-cores-utilized': 'cpu/utilized', - 'cpu-manufacturer': 'cpu/manufacturer', - }, - output: ['cpu-tdp', 'tdp'], - }; - - const nullMapping = null; - expect(mapConfigIfNeeded(config, nullMapping!)).toEqual(config); - - const undefinedMapping = undefined; - expect(mapConfigIfNeeded(config, undefinedMapping!)).toEqual(config); - }); - - it('recursively maps config keys and values according to the mapping.', () => { - const config = { - filepath: './file.csv', - query: { - 'cpu-cores-available': 'cpu/available', - 'cpu-cores-utilized': 'cpu/utilized', - 'cpu-manufacturer': 'cpu/manufacturer', - }, - output: ['cpu-tdp', 'tdp'], - }; - const mapping = { - 'cpu/utilized': 'cpu/util', - }; - - const expected = { - filepath: './file.csv', - query: { - 'cpu-cores-available': 'cpu/available', - 'cpu-cores-utilized': 'cpu/util', - 'cpu-manufacturer': 'cpu/manufacturer', - }, - output: ['cpu-tdp', 'tdp'], - }; - expect(mapConfigIfNeeded(config, mapping)).toEqual(expected); - }); - - it('returns an empty object or array when config is an empty object or array.', () => { - expect(mapConfigIfNeeded({}, {})).toEqual({}); - expect(mapConfigIfNeeded([], {})).toEqual([]); - }); - }); - - describe('mapOutputIfNeeded(): ', () => { - const output = { - timestamp: '2021-01-01T00:00:00Z', - duration: 3600, - 'cpu/energy': 1, - 'network/energy': 1, - 'memory/energy': 1, - }; - it('returns provided `output` if `mapping` is not valid.', () => { - const mapping = undefined; - const mappedOutput = mapOutputIfNeeded(output, mapping!); - - expect.assertions(1); - expect(mappedOutput).toEqual(output); - }); - - it('returns mapped output if `mapping` has data.', () => { - const mapping = { - 'cpu/energy': 'energy-from-cpu', - 'network/energy': 'energy-from-network', - }; - const expectedOutput = { - timestamp: '2021-01-01T00:00:00Z', - duration: 3600, - 'energy-from-cpu': 1, - 'energy-from-network': 1, - 'memory/energy': 1, - }; - const mappedOutput = mapOutputIfNeeded(output, mapping); - - expect.assertions(1); - expect(mappedOutput).toEqual(expectedOutput); - }); - - it('returns the correct mapped output if some properties are mismatched.', () => { - const mapping = { - 'mock-cpu/energy': 'energy-from-cpu', - 'network/energy': 'energy-from-network', - }; - const expectedOutput = { - timestamp: '2021-01-01T00:00:00Z', - duration: 3600, - 'cpu/energy': 1, - 'energy-from-network': 1, - 'memory/energy': 1, - }; - const mappedOutput = mapOutputIfNeeded(output, mapping); - - expect.assertions(1); - expect(mappedOutput).toEqual(expectedOutput); - }); - }); }); From d9087674bc76e6ef882d297c446ac9f35e87df28 Mon Sep 17 00:00:00 2001 From: manushak Date: Wed, 21 Aug 2024 18:08:16 +0400 Subject: [PATCH 4/4] feat(builtins): update mapping functions path --- src/if-run/builtins/coefficient/index.ts | 8 ++++---- src/if-run/builtins/copy-param/index.ts | 8 ++++---- src/if-run/builtins/csv-lookup/index.ts | 8 ++++---- src/if-run/builtins/divide/index.ts | 8 ++++---- src/if-run/builtins/exponent/index.ts | 8 ++++---- src/if-run/builtins/interpolation/index.ts | 8 ++++---- src/if-run/builtins/mock-observations/index.ts | 10 +++++----- src/if-run/builtins/multiply/index.ts | 10 +++++----- src/if-run/builtins/regex/index.ts | 8 ++++---- src/if-run/builtins/sci-embodied/index.ts | 8 ++++---- src/if-run/builtins/sci/index.ts | 8 ++++---- src/if-run/builtins/shell/index.ts | 2 +- src/if-run/builtins/subtract/index.ts | 10 +++++----- src/if-run/builtins/sum/index.ts | 8 ++++---- src/if-run/builtins/time-converter/index.ts | 8 ++++---- src/if-run/builtins/time-sync/index.ts | 8 ++++---- 16 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/if-run/builtins/coefficient/index.ts b/src/if-run/builtins/coefficient/index.ts index 289b4d7b..0a002f67 100644 --- a/src/if-run/builtins/coefficient/index.ts +++ b/src/if-run/builtins/coefficient/index.ts @@ -1,5 +1,9 @@ import {z} from 'zod'; import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { CoefficientConfig, ExecutePlugin, @@ -9,10 +13,6 @@ import { } from '@grnsft/if-core/types'; import {validate} from '../../../common/util/validations'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; import {STRINGS} from '../../config'; diff --git a/src/if-run/builtins/copy-param/index.ts b/src/if-run/builtins/copy-param/index.ts index 2128cff7..fec1fd85 100644 --- a/src/if-run/builtins/copy-param/index.ts +++ b/src/if-run/builtins/copy-param/index.ts @@ -1,5 +1,9 @@ import {z} from 'zod'; import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ConfigParams, ExecutePlugin, @@ -11,10 +15,6 @@ import { import {validate} from '../../../common/util/validations'; import {STRINGS} from '../../config'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; const {MISSING_CONFIG} = STRINGS; const {ConfigError} = ERRORS; diff --git a/src/if-run/builtins/csv-lookup/index.ts b/src/if-run/builtins/csv-lookup/index.ts index 373cbdeb..f66981b9 100644 --- a/src/if-run/builtins/csv-lookup/index.ts +++ b/src/if-run/builtins/csv-lookup/index.ts @@ -5,6 +5,10 @@ import axios from 'axios'; import {z} from 'zod'; import {parse} from 'csv-parse/sync'; import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, MappingParams, @@ -15,10 +19,6 @@ import { import {validate} from '../../../common/util/validations'; import {STRINGS} from '../../config'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; const { FILE_FETCH_FAILED, diff --git a/src/if-run/builtins/divide/index.ts b/src/if-run/builtins/divide/index.ts index ba02194b..767fd1d6 100644 --- a/src/if-run/builtins/divide/index.ts +++ b/src/if-run/builtins/divide/index.ts @@ -1,5 +1,9 @@ import {z} from 'zod'; import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, PluginParams, @@ -11,10 +15,6 @@ import { import {validate} from '../../../common/util/validations'; import {STRINGS} from '../../config'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; const {ConfigError, MissingInputDataError} = ERRORS; const {MISSING_CONFIG, MISSING_INPUT_DATA, ZERO_DIVISION} = STRINGS; diff --git a/src/if-run/builtins/exponent/index.ts b/src/if-run/builtins/exponent/index.ts index 38bc07d4..199f44b1 100644 --- a/src/if-run/builtins/exponent/index.ts +++ b/src/if-run/builtins/exponent/index.ts @@ -1,4 +1,8 @@ import {z} from 'zod'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, PluginParams, @@ -9,10 +13,6 @@ import { import {ERRORS} from '@grnsft/if-core/utils'; import {validate} from '../../../common/util/validations'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; import {STRINGS} from '../../config'; diff --git a/src/if-run/builtins/interpolation/index.ts b/src/if-run/builtins/interpolation/index.ts index 1bd1cf48..c7c9887f 100644 --- a/src/if-run/builtins/interpolation/index.ts +++ b/src/if-run/builtins/interpolation/index.ts @@ -1,6 +1,10 @@ import Spline from 'typescript-cubic-spline'; import {z} from 'zod'; import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, PluginParams, @@ -11,10 +15,6 @@ import { } from '@grnsft/if-core/types'; import {validate} from '../../../common/util/validations'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; import {STRINGS} from '../../config'; diff --git a/src/if-run/builtins/mock-observations/index.ts b/src/if-run/builtins/mock-observations/index.ts index 7b1dfee8..1aa72d30 100644 --- a/src/if-run/builtins/mock-observations/index.ts +++ b/src/if-run/builtins/mock-observations/index.ts @@ -1,5 +1,10 @@ import {DateTime, Duration} from 'luxon'; import {z} from 'zod'; +import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, PluginParams, @@ -8,13 +13,8 @@ import { PluginParametersMetadata, MappingParams, } from '@grnsft/if-core/types'; -import {ERRORS} from '@grnsft/if-core/utils'; import {validate} from '../../../common/util/validations'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; import {STRINGS} from '../../config'; diff --git a/src/if-run/builtins/multiply/index.ts b/src/if-run/builtins/multiply/index.ts index e33ee1f1..530cb77a 100644 --- a/src/if-run/builtins/multiply/index.ts +++ b/src/if-run/builtins/multiply/index.ts @@ -1,4 +1,9 @@ import {z} from 'zod'; +import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, PluginParams, @@ -6,13 +11,8 @@ import { PluginParametersMetadata, MappingParams, } from '@grnsft/if-core/types'; -import {ERRORS} from '@grnsft/if-core/utils'; import {validate} from '../../../common/util/validations'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; import {STRINGS} from '../../config'; diff --git a/src/if-run/builtins/regex/index.ts b/src/if-run/builtins/regex/index.ts index 9f017e8e..5e65e677 100644 --- a/src/if-run/builtins/regex/index.ts +++ b/src/if-run/builtins/regex/index.ts @@ -1,5 +1,9 @@ import {z} from 'zod'; import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, PluginParams, @@ -9,10 +13,6 @@ import { } from '@grnsft/if-core/types'; import {validate} from '../../../common/util/validations'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; import {STRINGS} from '../../config'; diff --git a/src/if-run/builtins/sci-embodied/index.ts b/src/if-run/builtins/sci-embodied/index.ts index 1aad045a..c6c953b5 100644 --- a/src/if-run/builtins/sci-embodied/index.ts +++ b/src/if-run/builtins/sci-embodied/index.ts @@ -1,4 +1,8 @@ import {z} from 'zod'; +import { + mapInputIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, ParameterMetadata, @@ -10,10 +14,6 @@ import { import {validate, allDefined} from '../../../common/util/validations'; import {STRINGS} from '../../config'; -import { - mapInputIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; const {SCI_EMBODIED_ERROR} = STRINGS; diff --git a/src/if-run/builtins/sci/index.ts b/src/if-run/builtins/sci/index.ts index dbafa635..407621b8 100644 --- a/src/if-run/builtins/sci/index.ts +++ b/src/if-run/builtins/sci/index.ts @@ -1,5 +1,9 @@ import {z} from 'zod'; import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapInputIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, PluginParams, @@ -10,10 +14,6 @@ import { } from '@grnsft/if-core/types'; import {validate, allDefined} from '../../../common/util/validations'; -import { - mapInputIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; import {STRINGS} from '../../config'; diff --git a/src/if-run/builtins/shell/index.ts b/src/if-run/builtins/shell/index.ts index 8926a266..ddf8b619 100644 --- a/src/if-run/builtins/shell/index.ts +++ b/src/if-run/builtins/shell/index.ts @@ -3,6 +3,7 @@ import {spawnSync, SpawnSyncReturns} from 'child_process'; import {loadAll, dump} from 'js-yaml'; import {z} from 'zod'; import {ERRORS} from '@grnsft/if-core/utils'; +import {mapOutputIfNeeded} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, PluginParams, @@ -12,7 +13,6 @@ import { } from '@grnsft/if-core/types'; import {validate} from '../../../common/util/validations'; -import {mapOutputIfNeeded} from '../../../common/util/helpers'; import {STRINGS} from '../../config'; diff --git a/src/if-run/builtins/subtract/index.ts b/src/if-run/builtins/subtract/index.ts index d4dc1181..5051017c 100644 --- a/src/if-run/builtins/subtract/index.ts +++ b/src/if-run/builtins/subtract/index.ts @@ -1,4 +1,9 @@ import {z} from 'zod'; +import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, MappingParams, @@ -6,13 +11,8 @@ import { PluginParams, SubtractConfig, } from '@grnsft/if-core/types'; -import {ERRORS} from '@grnsft/if-core/utils'; import {validate} from '../../../common/util/validations'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; import {STRINGS} from '../../config'; diff --git a/src/if-run/builtins/sum/index.ts b/src/if-run/builtins/sum/index.ts index eb0e519a..580821dd 100644 --- a/src/if-run/builtins/sum/index.ts +++ b/src/if-run/builtins/sum/index.ts @@ -1,5 +1,9 @@ import {z} from 'zod'; import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, PluginParams, @@ -9,10 +13,6 @@ import { } from '@grnsft/if-core/types'; import {validate} from '../../../common/util/validations'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; import {STRINGS} from '../../config'; diff --git a/src/if-run/builtins/time-converter/index.ts b/src/if-run/builtins/time-converter/index.ts index e757ed96..c4b9ef57 100644 --- a/src/if-run/builtins/time-converter/index.ts +++ b/src/if-run/builtins/time-converter/index.ts @@ -1,5 +1,9 @@ import {z} from 'zod'; import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapConfigIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, PluginParams, @@ -13,10 +17,6 @@ import {validate} from '../../../common/util/validations'; import {STRINGS} from '../../config'; import {TIME_UNITS_IN_SECONDS} from './config'; -import { - mapConfigIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; const {ConfigError} = ERRORS; const {MISSING_CONFIG} = STRINGS; diff --git a/src/if-run/builtins/time-sync/index.ts b/src/if-run/builtins/time-sync/index.ts index 5d909bf7..f72cae04 100644 --- a/src/if-run/builtins/time-sync/index.ts +++ b/src/if-run/builtins/time-sync/index.ts @@ -3,6 +3,10 @@ import {isDate} from 'node:util/types'; import {Settings, DateTime, DateTimeMaybeValid, Interval} from 'luxon'; import {z} from 'zod'; import {ERRORS} from '@grnsft/if-core/utils'; +import { + mapInputIfNeeded, + mapOutputIfNeeded, +} from '@grnsft/if-core/utils/helpers'; import { ExecutePlugin, PluginParams, @@ -18,10 +22,6 @@ import {validate} from '../../../common/util/validations'; import {STRINGS} from '../../config'; import {getAggregationMethod} from '../../lib/aggregate'; -import { - mapInputIfNeeded, - mapOutputIfNeeded, -} from '../../../common/util/helpers'; Settings.defaultZone = 'utc';