@malloydata/malloy-interfaces 0.0.326 → 0.0.327
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/dist/types.d.ts +11 -3
- package/dist/types.js +23 -0
- package/package.json +2 -2
- package/scripts/hacky_gen_types.ts +2 -2
- package/thrift/malloy.thrift +11 -0
package/dist/types.d.ts
CHANGED
|
@@ -69,6 +69,10 @@ export type AtomicTypeWithRecordType = {
|
|
|
69
69
|
export type AtomicTypeWithTimestamptzType = {
|
|
70
70
|
kind: 'timestamptz_type';
|
|
71
71
|
} & TimestamptzType;
|
|
72
|
+
export type BigNumberCell = {
|
|
73
|
+
number_value: string;
|
|
74
|
+
subtype?: NumberSubtype;
|
|
75
|
+
};
|
|
72
76
|
export type BooleanCell = {
|
|
73
77
|
boolean_value: boolean;
|
|
74
78
|
};
|
|
@@ -85,8 +89,8 @@ export type CalculateOperation = {
|
|
|
85
89
|
name: string;
|
|
86
90
|
field: Field;
|
|
87
91
|
};
|
|
88
|
-
export type CellType = 'string_cell' | 'boolean_cell' | 'date_cell' | 'timestamp_cell' | 'number_cell' | 'json_cell' | 'record_cell' | 'array_cell' | 'null_cell' | 'sql_native_cell';
|
|
89
|
-
export type Cell = CellWithStringCell | CellWithBooleanCell | CellWithDateCell | CellWithTimestampCell | CellWithNumberCell | CellWithJSONCell | CellWithRecordCell | CellWithArrayCell | CellWithNullCell | CellWithSQLNativeCell;
|
|
92
|
+
export type CellType = 'string_cell' | 'boolean_cell' | 'date_cell' | 'timestamp_cell' | 'number_cell' | 'json_cell' | 'record_cell' | 'array_cell' | 'null_cell' | 'sql_native_cell' | 'big_number_cell';
|
|
93
|
+
export type Cell = CellWithStringCell | CellWithBooleanCell | CellWithDateCell | CellWithTimestampCell | CellWithNumberCell | CellWithJSONCell | CellWithRecordCell | CellWithArrayCell | CellWithNullCell | CellWithSQLNativeCell | CellWithBigNumberCell;
|
|
90
94
|
export type CellWithStringCell = {
|
|
91
95
|
kind: 'string_cell';
|
|
92
96
|
} & StringCell;
|
|
@@ -117,6 +121,9 @@ export type CellWithNullCell = {
|
|
|
117
121
|
export type CellWithSQLNativeCell = {
|
|
118
122
|
kind: 'sql_native_cell';
|
|
119
123
|
} & SQLNativeCell;
|
|
124
|
+
export type CellWithBigNumberCell = {
|
|
125
|
+
kind: 'big_number_cell';
|
|
126
|
+
} & BigNumberCell;
|
|
120
127
|
export type CompileModelRequest = {
|
|
121
128
|
model_url: string;
|
|
122
129
|
extend_model_url?: string;
|
|
@@ -384,11 +391,12 @@ export type NullCell = {};
|
|
|
384
391
|
export type NullLiteral = {};
|
|
385
392
|
export type NumberCell = {
|
|
386
393
|
number_value: number;
|
|
394
|
+
subtype?: NumberSubtype;
|
|
387
395
|
};
|
|
388
396
|
export type NumberLiteral = {
|
|
389
397
|
number_value: number;
|
|
390
398
|
};
|
|
391
|
-
export type NumberSubtype = 'integer' | 'decimal';
|
|
399
|
+
export type NumberSubtype = 'integer' | 'decimal' | 'bigint';
|
|
392
400
|
export type NumberType = {
|
|
393
401
|
subtype?: NumberSubtype;
|
|
394
402
|
};
|
package/dist/types.js
CHANGED
|
@@ -108,6 +108,22 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
108
108
|
'timestamptz_type': 'TimestamptzType',
|
|
109
109
|
},
|
|
110
110
|
},
|
|
111
|
+
'BigNumberCell': {
|
|
112
|
+
'type': 'struct',
|
|
113
|
+
'name': 'BigNumberCell',
|
|
114
|
+
'fields': {
|
|
115
|
+
'number_value': {
|
|
116
|
+
'type': 'string',
|
|
117
|
+
'optional': false,
|
|
118
|
+
'array': false,
|
|
119
|
+
},
|
|
120
|
+
'subtype': {
|
|
121
|
+
'type': 'NumberSubtype',
|
|
122
|
+
'optional': true,
|
|
123
|
+
'array': false,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
111
127
|
'BooleanCell': {
|
|
112
128
|
'type': 'struct',
|
|
113
129
|
'name': 'BooleanCell',
|
|
@@ -186,6 +202,7 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
186
202
|
'array_cell': 'ArrayCell',
|
|
187
203
|
'null_cell': 'NullCell',
|
|
188
204
|
'sql_native_cell': 'SQLNativeCell',
|
|
205
|
+
'big_number_cell': 'BigNumberCell',
|
|
189
206
|
},
|
|
190
207
|
},
|
|
191
208
|
'CompileModelRequest': {
|
|
@@ -963,6 +980,11 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
963
980
|
'optional': false,
|
|
964
981
|
'array': false,
|
|
965
982
|
},
|
|
983
|
+
'subtype': {
|
|
984
|
+
'type': 'NumberSubtype',
|
|
985
|
+
'optional': true,
|
|
986
|
+
'array': false,
|
|
987
|
+
},
|
|
966
988
|
},
|
|
967
989
|
},
|
|
968
990
|
'NumberLiteral': {
|
|
@@ -982,6 +1004,7 @@ exports.MALLOY_INTERFACE_TYPES = {
|
|
|
982
1004
|
'values': {
|
|
983
1005
|
'integer': 1,
|
|
984
1006
|
'decimal': 2,
|
|
1007
|
+
'bigint': 3,
|
|
985
1008
|
},
|
|
986
1009
|
},
|
|
987
1010
|
'NumberType': {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/malloy-interfaces",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.327",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"test": "jest --config=../../jest.config.js",
|
|
17
|
-
"clean": "tsc --build --clean && rimraf @flowtyped",
|
|
17
|
+
"clean": "tsc --build --clean && rm -f tsconfig.tsbuildinfo && rimraf @flowtyped",
|
|
18
18
|
"build": "tsc --build && npm run generate-flow",
|
|
19
19
|
"prepublishOnly": "npm run clean && npm run build",
|
|
20
20
|
"verify-types": "thrift-typescript --strictUnions --target thrift-server --sourceDir thrift --outDir generated-types malloy.thrift",
|
|
@@ -42,12 +42,12 @@ for (const file of fs.readdirSync('./generated-types')) {
|
|
|
42
42
|
);
|
|
43
43
|
const actualTypes = lines.slice(firstTypeLine, firstNonTypeLine).join('\n');
|
|
44
44
|
const isAnEnum = actualTypes.match(
|
|
45
|
-
/export enum ([A-Za-z]+) {\n( {4}([A-
|
|
45
|
+
/export enum ([A-Za-z]+) {\n( {4}([A-Z_0-9]+) = \d+,?\n)+}/
|
|
46
46
|
);
|
|
47
47
|
if (isAnEnum) {
|
|
48
48
|
const name = isAnEnum[1];
|
|
49
49
|
const values: Record<string, number> = {};
|
|
50
|
-
const matches = actualTypes.matchAll(/ {4}([A-
|
|
50
|
+
const matches = actualTypes.matchAll(/ {4}([A-Z_0-9]+) = (\d+)/g);
|
|
51
51
|
for (const match of matches) {
|
|
52
52
|
const [name, valueString] = [match[1].toLowerCase(), match[2]];
|
|
53
53
|
values[name] = parseInt(valueString);
|
package/thrift/malloy.thrift
CHANGED
|
@@ -166,6 +166,7 @@ struct BooleanType {
|
|
|
166
166
|
enum NumberSubtype {
|
|
167
167
|
INTEGER = 1,
|
|
168
168
|
DECIMAL = 2,
|
|
169
|
+
BIGINT = 3,
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
struct NumberType {
|
|
@@ -502,6 +503,15 @@ struct BooleanCell {
|
|
|
502
503
|
|
|
503
504
|
struct NumberCell {
|
|
504
505
|
1: required double number_value,
|
|
506
|
+
2: optional NumberSubtype subtype,
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// String representation for numbers that exceed JavaScript's Number.MAX_SAFE_INTEGER
|
|
510
|
+
// or require precision beyond float64. Currently used for bigints (64-bit+ integers),
|
|
511
|
+
// but designed to also support high-precision decimals in the future.
|
|
512
|
+
struct BigNumberCell {
|
|
513
|
+
1: required string number_value,
|
|
514
|
+
2: optional NumberSubtype subtype,
|
|
505
515
|
}
|
|
506
516
|
|
|
507
517
|
struct NullCell {}
|
|
@@ -542,6 +552,7 @@ union Cell {
|
|
|
542
552
|
8: required ArrayCell array_cell,
|
|
543
553
|
9: required NullCell null_cell,
|
|
544
554
|
10: required SQLNativeCell sql_native_cell,
|
|
555
|
+
11: required BigNumberCell big_number_cell,
|
|
545
556
|
}
|
|
546
557
|
|
|
547
558
|
union Data {
|