@qrvey/formula-lang 0.3.1 → 0.4.0
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/CHANGELOG.md +11 -0
- package/__tests__/integration/__mocks__/context.ts +23 -0
- package/__tests__/integration/__mocks__/elasticsearchScripts.ts +11 -4
- package/__tests__/integration/__mocks__/sqlScripts.ts +3 -2
- package/__tests__/integration/elasticsearch.test.ts +17 -3
- package/__tests__/integration/expression.test.ts +34 -0
- package/__tests__/integration/redshift.test.ts +15 -0
- package/__tests__/integration/sonwflake.test.ts +15 -0
- package/dist/constants/interfaces.d.ts +8 -8
- package/dist/transpiler/columnTranspilation.d.ts +3 -0
- package/dist/transpiler/columnTranspilation.js +19 -0
- package/dist/transpiler/columnTranspilation.js.map +1 -0
- package/dist/transpiler/index.d.ts +3 -2
- package/dist/transpiler/index.js +6 -1
- package/dist/transpiler/index.js.map +1 -1
- package/dist/utils/getVariableType.d.ts +3 -3
- package/dist/utils/getVariableType.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
<a name="0.4.0"></a>
|
|
2
|
+
# [0.4.0](https://bitbucket.org/qrvey/qrvey_formula_lang/compare/v0.3.1...v0.4.0) (2023-04-24)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **columns:** add column transpilation from AST ([cd28ff9](https://bitbucket.org/qrvey/qrvey_formula_lang/commits/cd28ff9))
|
|
8
|
+
* **columns:** support columns ([478909c](https://bitbucket.org/qrvey/qrvey_formula_lang/commits/478909c))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
1
12
|
<a name="0.3.0"></a>
|
|
2
13
|
# [0.3.0](https://bitbucket.org/qrvey/qrvey_formula_lang/compare/v0.2.0...v0.3.0) (2023-04-24)
|
|
3
14
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FormulaContext } from '../../../src/constants/interfaces';
|
|
2
|
+
|
|
3
|
+
export const basicContext: FormulaContext = {
|
|
4
|
+
model: [
|
|
5
|
+
{
|
|
6
|
+
id: 'ID123.test',
|
|
7
|
+
label: 'Column String',
|
|
8
|
+
column: 'Origin_String_Column_Test',
|
|
9
|
+
type: 'string',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: 'DateID1',
|
|
13
|
+
label: 'Column Date',
|
|
14
|
+
column: 'Origin_Date_Column_Test',
|
|
15
|
+
type: 'date',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: 'NOW',
|
|
19
|
+
label: 'NOW',
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
@@ -7,12 +7,19 @@ export const dateFormatScript = `String DATE_FORMAT_SCRIPT(def date_value, Strin
|
|
|
7
7
|
return DateTimeFormatter.ofPattern(format).format(date_value)
|
|
8
8
|
}`;
|
|
9
9
|
|
|
10
|
-
export function dateFormatToInt(
|
|
11
|
-
|
|
10
|
+
export function dateFormatToInt(
|
|
11
|
+
format: string,
|
|
12
|
+
column: string | undefined = undefined,
|
|
13
|
+
): string {
|
|
14
|
+
if (!column) column = `ZonedDateTime.parse("2023-12-31T00:00:00.000Z")`;
|
|
15
|
+
return `Integer.parseInt(DATE_FORMAT_SCRIPT(${column}, '${format}'))`;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
export function dateParser(
|
|
15
|
-
|
|
18
|
+
export function dateParser(
|
|
19
|
+
format: string,
|
|
20
|
+
column: string | undefined = undefined,
|
|
21
|
+
): string {
|
|
22
|
+
const dateToInt = dateFormatToInt(format, column);
|
|
16
23
|
return `${dateFormatScript}\n${dateToInt}`;
|
|
17
24
|
}
|
|
18
25
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export function datePart(part: string) {
|
|
2
|
-
|
|
1
|
+
export function datePart(part: string, column: string | undefined = undefined) {
|
|
2
|
+
if (!column) column = `CAST('2023-12-31T00:00:00.000Z' AS TIMESTAMPTZ)`;
|
|
3
|
+
return `DATE_PART('${part}', ${column})`;
|
|
3
4
|
}
|
|
4
5
|
|
|
5
6
|
export function dateDif(unit: string): string {
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
dateFormatToInt,
|
|
6
6
|
dateFormatScript,
|
|
7
7
|
} from './__mocks__/elasticsearchScripts';
|
|
8
|
+
import { basicContext } from './__mocks__/context';
|
|
8
9
|
const currentEngine = ENGINES.ELASTICSEARCH;
|
|
9
10
|
|
|
10
11
|
describe('ELASTICSEARCH Transpile program', () => {
|
|
@@ -32,6 +33,13 @@ describe('ELASTICSEARCH Transpile program', () => {
|
|
|
32
33
|
expect(result?.expression).toBe(`Math.abs(5)`);
|
|
33
34
|
});
|
|
34
35
|
|
|
36
|
+
test('Cast Date string', () => {
|
|
37
|
+
const result = Transpile('"12/31/2022 13:35:45"', currentEngine);
|
|
38
|
+
expect(result?.expression).toBe(
|
|
39
|
+
`ZonedDateTime.parse("2022-12-31T13:35:45.000Z")`,
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
35
43
|
test('DAY function', () => {
|
|
36
44
|
const result = Transpile('DAY("12/31/2023")', currentEngine);
|
|
37
45
|
const mock = dateParser('dd').replace(/\n/g, '');
|
|
@@ -43,13 +51,19 @@ describe('ELASTICSEARCH Transpile program', () => {
|
|
|
43
51
|
'DAY("12/31/2023") + DAY("12/31/2023")',
|
|
44
52
|
currentEngine,
|
|
45
53
|
);
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
)} + ${dateFormatToInt('dd')})`;
|
|
54
|
+
const ddToInt = dateFormatToInt('dd');
|
|
55
|
+
const concat = `${dateFormatScript}\n(${ddToInt} + ${ddToInt})`;
|
|
49
56
|
const mock = concat.replace(/\n/g, '');
|
|
50
57
|
expect(result?.expression?.replace(/\n/g, '')).toBe(mock);
|
|
51
58
|
});
|
|
52
59
|
|
|
60
|
+
test('DAY function with a variable Column', () => {
|
|
61
|
+
const result = Transpile('DAY([DateID1])', currentEngine, basicContext);
|
|
62
|
+
const column = 'doc["Origin_Date_Column_Test"]';
|
|
63
|
+
const mock = dateParser('dd', column).replace(/\n/g, '');
|
|
64
|
+
expect(result?.expression?.replace(/\n/g, '')).toBe(mock);
|
|
65
|
+
});
|
|
66
|
+
|
|
53
67
|
test('MONTH function', () => {
|
|
54
68
|
const result = Transpile('MONTH("12/31/2023")', currentEngine);
|
|
55
69
|
const mock = dateParser('MM').replace(/\n/g, '');
|
|
@@ -19,4 +19,38 @@ describe('Raw Expression test suite', () => {
|
|
|
19
19
|
expect(result?.error).not.toBeUndefined();
|
|
20
20
|
expect(result?.error instanceof MissingArgumentError).toBeTruthy();
|
|
21
21
|
});
|
|
22
|
+
|
|
23
|
+
test('Should transpile a column', () => {
|
|
24
|
+
const program = '[8db21fc4]';
|
|
25
|
+
const columnName = 'Origin_Column_Test';
|
|
26
|
+
const result = Transpile(program, ENGINES.ELASTICSEARCH, {
|
|
27
|
+
model: [
|
|
28
|
+
{
|
|
29
|
+
label: 'Text',
|
|
30
|
+
id: '8db21fc4',
|
|
31
|
+
column: columnName,
|
|
32
|
+
type: 'string',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
});
|
|
36
|
+
expect(result?.valid).toBe(true);
|
|
37
|
+
expect(result?.expression).toBe(`doc["${columnName}"]`);
|
|
38
|
+
});
|
|
39
|
+
/*
|
|
40
|
+
test('Should transpile a column with property', () => {
|
|
41
|
+
const program = '[8db21fc4.country]';
|
|
42
|
+
const columnName = 'Origin_Column_Test';
|
|
43
|
+
const result = Transpile(program, ENGINES.ELASTICSEARCH, {
|
|
44
|
+
model: [
|
|
45
|
+
{
|
|
46
|
+
label: 'Text',
|
|
47
|
+
id: '8db21fc4',
|
|
48
|
+
column: columnName,
|
|
49
|
+
type: 'string',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
});
|
|
53
|
+
expect(result?.valid).toBe(true);
|
|
54
|
+
expect(result?.expression).toBe(`doc["${columnName}"]`);
|
|
55
|
+
});*/
|
|
22
56
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ENGINES, Transpile } from '../../src';
|
|
2
2
|
import { datePart, dateDif } from './__mocks__/sqlScripts';
|
|
3
|
+
import { basicContext } from './__mocks__/context';
|
|
3
4
|
const currentEngine = ENGINES.REDSHIFT;
|
|
4
5
|
|
|
5
6
|
describe('SNOWFLAKE Transpile program', () => {
|
|
@@ -27,11 +28,25 @@ describe('SNOWFLAKE Transpile program', () => {
|
|
|
27
28
|
expect(result?.expression).toBe(`ABS(5)`);
|
|
28
29
|
});
|
|
29
30
|
|
|
31
|
+
test('Cast Date string', () => {
|
|
32
|
+
const result = Transpile('"12/31/2022 13:35:45"', currentEngine);
|
|
33
|
+
expect(result?.expression).toBe(
|
|
34
|
+
`CAST('2022-12-31T13:35:45.000Z' AS TIMESTAMPTZ)`,
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
30
38
|
test('DAY function', () => {
|
|
31
39
|
const result = Transpile('DAY("12/31/2023")', currentEngine);
|
|
32
40
|
expect(result?.expression).toBe(datePart('day'));
|
|
33
41
|
});
|
|
34
42
|
|
|
43
|
+
test('DAY function with a variable Column', () => {
|
|
44
|
+
const result = Transpile('DAY([DateID1])', currentEngine, basicContext);
|
|
45
|
+
const column = '"Origin_Date_Column_Test"';
|
|
46
|
+
const mock = datePart('day', column).replace(/\n/g, '');
|
|
47
|
+
expect(result?.expression?.replace(/\n/g, '')).toBe(mock);
|
|
48
|
+
});
|
|
49
|
+
|
|
35
50
|
test('MONTH function', () => {
|
|
36
51
|
const result = Transpile('MONTH("12/31/2023")', currentEngine);
|
|
37
52
|
expect(result?.expression).toBe(datePart('month'));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ENGINES, Transpile } from '../../src';
|
|
2
2
|
import { datePart, dateDif } from './__mocks__/sqlScripts';
|
|
3
|
+
import { basicContext } from './__mocks__/context';
|
|
3
4
|
const currentEngine = ENGINES.SNOWFLAKE;
|
|
4
5
|
|
|
5
6
|
describe('SNOWFLAKE Transpile program', () => {
|
|
@@ -27,11 +28,25 @@ describe('SNOWFLAKE Transpile program', () => {
|
|
|
27
28
|
expect(result?.expression).toBe(`ABS(5)`);
|
|
28
29
|
});
|
|
29
30
|
|
|
31
|
+
test('Cast Date string', () => {
|
|
32
|
+
const result = Transpile('"12/31/2022 13:35:45"', currentEngine);
|
|
33
|
+
expect(result?.expression).toBe(
|
|
34
|
+
`CAST('2022-12-31T13:35:45.000Z' AS TIMESTAMPTZ)`,
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
|
|
30
38
|
test('DAY function', () => {
|
|
31
39
|
const result = Transpile('DAY("12/31/2023")', currentEngine);
|
|
32
40
|
expect(result?.expression).toBe(datePart('day'));
|
|
33
41
|
});
|
|
34
42
|
|
|
43
|
+
test('DAY function with a variable Column', () => {
|
|
44
|
+
const result = Transpile('DAY([DateID1])', currentEngine, basicContext);
|
|
45
|
+
const column = '"Origin_Date_Column_Test"';
|
|
46
|
+
const mock = datePart('day', column).replace(/\n/g, '');
|
|
47
|
+
expect(result?.expression?.replace(/\n/g, '')).toBe(mock);
|
|
48
|
+
});
|
|
49
|
+
|
|
35
50
|
test('MONTH function', () => {
|
|
36
51
|
const result = Transpile('MONTH("12/31/2023")', currentEngine);
|
|
37
52
|
expect(result?.expression).toBe(datePart('month'));
|
|
@@ -8,7 +8,7 @@ export interface FunctionDefinition extends FunctionElementDefinition {
|
|
|
8
8
|
transpiler: TranspilerEnginesFunction;
|
|
9
9
|
parameters?: Array<FunctionParameters>;
|
|
10
10
|
}
|
|
11
|
-
type TranspilerEnginesFunction = {
|
|
11
|
+
export type TranspilerEnginesFunction = {
|
|
12
12
|
[key in ENGINES]: Function;
|
|
13
13
|
};
|
|
14
14
|
interface FunctionParameters extends FunctionElementDefinition {
|
|
@@ -58,24 +58,24 @@ export interface FunctionCallAST extends CommonAST {
|
|
|
58
58
|
arguments: Array<CommonAST>;
|
|
59
59
|
}
|
|
60
60
|
export type ValueASTType = string | boolean | number | CommonAST[] | null | Date;
|
|
61
|
-
export interface
|
|
61
|
+
export interface CommonValueAST extends CommonAST {
|
|
62
62
|
value: ValueASTType;
|
|
63
63
|
}
|
|
64
|
-
export interface VariableAST extends
|
|
65
|
-
context?:
|
|
64
|
+
export interface VariableAST extends CommonValueAST {
|
|
65
|
+
context?: VariableContextDefinition;
|
|
66
66
|
}
|
|
67
|
-
export interface LiteralAST extends
|
|
67
|
+
export interface LiteralAST extends CommonValueAST {
|
|
68
68
|
dataType: string;
|
|
69
69
|
}
|
|
70
|
-
export
|
|
71
|
-
export interface VariableDefinition {
|
|
70
|
+
export interface VariableContextDefinition {
|
|
72
71
|
label: string;
|
|
73
72
|
id: string;
|
|
74
73
|
column?: string;
|
|
75
74
|
type: string;
|
|
76
75
|
}
|
|
77
76
|
export interface FormulaContext {
|
|
78
|
-
model?:
|
|
77
|
+
model?: VariableContextDefinition[];
|
|
79
78
|
}
|
|
80
79
|
export type VariableASTType = 'Variable' | 'Column' | 'Token';
|
|
80
|
+
export type DateDifUnitParam = 'Y' | 'M' | 'D';
|
|
81
81
|
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ENGINES } from '../constants';
|
|
2
|
+
export function columnTranspilation(engine, { value, context }) {
|
|
3
|
+
if (!context || !context.column)
|
|
4
|
+
return { value };
|
|
5
|
+
const columnForEngine = {
|
|
6
|
+
[ENGINES.ELASTICSEARCH]: elasticsearch,
|
|
7
|
+
[ENGINES.SNOWFLAKE]: sql,
|
|
8
|
+
[ENGINES.REDSHIFT]: sql,
|
|
9
|
+
};
|
|
10
|
+
const result = columnForEngine[engine](context);
|
|
11
|
+
return { value: result, dataType: context.type };
|
|
12
|
+
}
|
|
13
|
+
function elasticsearch(context) {
|
|
14
|
+
return `doc["${context.column}"]`;
|
|
15
|
+
}
|
|
16
|
+
function sql(context) {
|
|
17
|
+
return `"${context.column}"`;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=columnTranspilation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columnTranspilation.js","sourceRoot":"","sources":["../../src/transpiler/columnTranspilation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAOvC,MAAM,UAAU,mBAAmB,CAC/B,MAAe,EACf,EAAE,KAAK,EAAE,OAAO,EAAe;IAE/B,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAClD,MAAM,eAAe,GAAG;QACpB,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,aAAa;QACtC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,GAAG;QACxB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,GAAG;KAC1B,CAAC;IACF,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;IAChD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;AACrD,CAAC;AAED,SAAS,aAAa,CAAC,OAAkC;IACrD,OAAO,QAAQ,OAAO,CAAC,MAAM,IAAI,CAAC;AACtC,CAAC;AAED,SAAS,GAAG,CAAC,OAAkC;IAC3C,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;AACjC,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ENGINES } from '../constants';
|
|
2
|
-
import { CommonAST, ProgramAST, BinaryExpressionAST, UnaryExpressionAST, FunctionCallAST, LiteralAST, FunctionDefinition, TranspilationResponse, ProcessNodeResult } from '../constants/interfaces';
|
|
2
|
+
import { CommonAST, ProgramAST, BinaryExpressionAST, UnaryExpressionAST, FunctionCallAST, LiteralAST, FunctionDefinition, TranspilationResponse, ProcessNodeResult, VariableAST } from '../constants/interfaces';
|
|
3
3
|
export declare class Transpiler {
|
|
4
|
-
readonly engine: ENGINES;
|
|
5
4
|
private ast;
|
|
5
|
+
private readonly engine;
|
|
6
6
|
private customFunctionList;
|
|
7
7
|
constructor(ast: ProgramAST, engine: ENGINES);
|
|
8
8
|
get(): TranspilationResponse;
|
|
9
9
|
processNode(expression: CommonAST): ProcessNodeResult;
|
|
10
|
+
column(data: VariableAST): ProcessNodeResult;
|
|
10
11
|
literal({ value, dataType }: LiteralAST): ProcessNodeResult;
|
|
11
12
|
unaryExpression({ operator, right, }: UnaryExpressionAST): ProcessNodeResult;
|
|
12
13
|
binaryExpression({ left, operator, right, }: BinaryExpressionAST): ProcessNodeResult;
|
package/dist/transpiler/index.js
CHANGED
|
@@ -3,11 +3,12 @@ import { UnknownFunctionError } from '../errors/definitions';
|
|
|
3
3
|
import { functionList } from '../functions';
|
|
4
4
|
import { customFunction as customFunctionUtil, customDateCast } from '../utils';
|
|
5
5
|
import { validateFuncStructure } from './validateFuncStructure';
|
|
6
|
+
import { columnTranspilation } from './columnTranspilation';
|
|
6
7
|
export class Transpiler {
|
|
7
8
|
constructor(ast, engine) {
|
|
8
|
-
this.customFunctionList = new Set();
|
|
9
9
|
this.ast = ast;
|
|
10
10
|
this.engine = engine;
|
|
11
|
+
this.customFunctionList = new Set();
|
|
11
12
|
}
|
|
12
13
|
get() {
|
|
13
14
|
try {
|
|
@@ -30,12 +31,16 @@ export class Transpiler {
|
|
|
30
31
|
const nodes = {
|
|
31
32
|
[AST_TYPES.variable]: this.literal,
|
|
32
33
|
[AST_TYPES.literal]: this.literal,
|
|
34
|
+
[AST_TYPES.column]: this.column,
|
|
33
35
|
[AST_TYPES.unaryExpression]: this.unaryExpression,
|
|
34
36
|
[AST_TYPES.binaryExpression]: this.binaryExpression,
|
|
35
37
|
[AST_TYPES.functionCall]: this.functionCall,
|
|
36
38
|
};
|
|
37
39
|
return nodes[type].call(this, expression);
|
|
38
40
|
}
|
|
41
|
+
column(data) {
|
|
42
|
+
return columnTranspilation(this.engine, data);
|
|
43
|
+
}
|
|
39
44
|
literal({ value, dataType }) {
|
|
40
45
|
if (dataType === 'date')
|
|
41
46
|
value = customDateCast(this.engine)(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transpiler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transpiler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAanE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,OAAO,UAAU;IAGnB,YAAoB,GAAe,EAAmB,MAAe;QAAjD,QAAG,GAAH,GAAG,CAAY;QAAmB,WAAM,GAAN,MAAM,CAAS;QAF7D,uBAAkB,GAAG,IAAI,GAAG,EAAE,CAAC;IAEiC,CAAC;IAEzE,GAAG;QACC,IAAI;YACA,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;YAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAC7D,OAAO;gBACH,KAAK,EAAE,IAAI,KAAK,SAAS;gBACzB,UAAU,EAAE,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC;aACtD,CAAC;SACL;QAAC,OAAO,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BAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,sBAAsB,CAClB,UAAyC;QAEzC,IAAI,CAAC,UAAU;YAAE,OAAO,SAAS,CAAC;QAClC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;QAC7B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/D,IAAI,OAAO;YAAE,OAAO,GAAG,OAAO,KAAK,KAAK,EAAE,CAAC;QAC3C,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAED,MAAM,UAAU,YAAY,CACxB,GAAe,EACf,MAAe;IAEf,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FormulaContext, VariableASTType,
|
|
2
|
-
export declare function getVariableContext(variableName: string, context?: FormulaContext):
|
|
3
|
-
export declare function getVariableType(columnCxt?:
|
|
1
|
+
import { FormulaContext, VariableASTType, VariableContextDefinition } from '../constants/interfaces';
|
|
2
|
+
export declare function getVariableContext(variableName: string, context?: FormulaContext): VariableContextDefinition | undefined;
|
|
3
|
+
export declare function getVariableType(columnCxt?: VariableContextDefinition): VariableASTType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getVariableType.js","sourceRoot":"","sources":["../../src/utils/getVariableType.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,kBAAkB,CAC9B,YAAoB,EACpB,OAAwB;;IAExB,OAAO,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,uBAAuB,CAC5B,
|
|
1
|
+
{"version":3,"file":"getVariableType.js","sourceRoot":"","sources":["../../src/utils/getVariableType.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,kBAAkB,CAC9B,YAAoB,EACpB,OAAwB;;IAExB,OAAO,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,0CAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,YAAY,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,uBAAuB,CAC5B,eAA0C;IAE1C,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,eAAe,CAC3B,SAAqC;IAErC,OAAO,SAAS,KAAK,SAAS;QAC1B,CAAC,CAAC,uBAAuB,CAAC,SAAS,CAAC;QACpC,CAAC,CAAC,UAAU,CAAC;AACrB,CAAC"}
|