@devrev/meerkat-node 0.0.123 → 0.0.124
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/__tests__/comprehensive/helpers/test-helpers.js +214 -0
- package/__tests__/comprehensive/helpers/test-helpers.js.map +1 -0
- package/__tests__/comprehensive/synthetic/schema-setup.js +256 -0
- package/__tests__/comprehensive/synthetic/schema-setup.js.map +1 -0
- package/__tests__/comprehensive/synthetic/table-schemas.js +453 -0
- package/__tests__/comprehensive/synthetic/table-schemas.js.map +1 -0
- package/ensure-table-schema-alias/ensure-table-schema-alias.js +39 -0
- package/ensure-table-schema-alias/ensure-table-schema-alias.js.map +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/comprehensive/helpers/test-helpers.d.ts +106 -0
- package/src/__tests__/comprehensive/synthetic/schema-setup.d.ts +31 -0
- package/src/__tests__/comprehensive/synthetic/table-schemas.d.ts +123 -0
- package/src/ensure-table-schema-alias/ensure-table-schema-alias.d.ts +3 -0
- package/src/index.d.ts +1 -0
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TableSchema Definitions for Synthetic Test Tables
|
|
3
|
+
*
|
|
4
|
+
* These schemas match the synthetic tables created in schema-setup.ts
|
|
5
|
+
* and follow the same conventions as production Meerkat schemas.
|
|
6
|
+
*/ "use strict";
|
|
7
|
+
function _export(target, all) {
|
|
8
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: all[name]
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
_export(exports, {
|
|
14
|
+
DIM_PART_SCHEMA: function() {
|
|
15
|
+
return DIM_PART_SCHEMA;
|
|
16
|
+
},
|
|
17
|
+
DIM_USER_SCHEMA: function() {
|
|
18
|
+
return DIM_USER_SCHEMA;
|
|
19
|
+
},
|
|
20
|
+
FACT_ALL_TYPES_SCHEMA: function() {
|
|
21
|
+
return FACT_ALL_TYPES_SCHEMA;
|
|
22
|
+
},
|
|
23
|
+
getAllSchemas: function() {
|
|
24
|
+
return getAllSchemas;
|
|
25
|
+
},
|
|
26
|
+
getFactSchema: function() {
|
|
27
|
+
return getFactSchema;
|
|
28
|
+
},
|
|
29
|
+
getFactWithPartSchema: function() {
|
|
30
|
+
return getFactWithPartSchema;
|
|
31
|
+
},
|
|
32
|
+
getFactWithUserSchema: function() {
|
|
33
|
+
return getFactWithUserSchema;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const FACT_ALL_TYPES_SCHEMA = {
|
|
37
|
+
name: 'fact_all_types',
|
|
38
|
+
sql: 'SELECT * FROM fact_all_types',
|
|
39
|
+
measures: [
|
|
40
|
+
// Numeric measures
|
|
41
|
+
{
|
|
42
|
+
name: 'metric_bigint',
|
|
43
|
+
sql: 'metric_bigint',
|
|
44
|
+
type: 'number'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'small_bigint',
|
|
48
|
+
sql: 'small_bigint',
|
|
49
|
+
type: 'number'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'metric_numeric',
|
|
53
|
+
sql: 'metric_numeric',
|
|
54
|
+
type: 'number'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'precise_numeric',
|
|
58
|
+
sql: 'precise_numeric',
|
|
59
|
+
type: 'number'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'metric_double',
|
|
63
|
+
sql: 'metric_double',
|
|
64
|
+
type: 'number'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'metric_float',
|
|
68
|
+
sql: 'metric_float',
|
|
69
|
+
type: 'number'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'nullable_int',
|
|
73
|
+
sql: 'nullable_int',
|
|
74
|
+
type: 'number'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'mtti_seconds',
|
|
78
|
+
sql: 'mtti_seconds',
|
|
79
|
+
type: 'number'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'severity_id_int',
|
|
83
|
+
sql: 'severity_id_int',
|
|
84
|
+
type: 'number'
|
|
85
|
+
},
|
|
86
|
+
// Aggregate measures
|
|
87
|
+
{
|
|
88
|
+
name: 'count',
|
|
89
|
+
sql: 'COUNT(*)',
|
|
90
|
+
type: 'number'
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'sum_metric_bigint',
|
|
94
|
+
sql: 'SUM(metric_bigint)',
|
|
95
|
+
type: 'number'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'avg_metric_double',
|
|
99
|
+
sql: 'AVG(metric_double)',
|
|
100
|
+
type: 'number'
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'min_metric_numeric',
|
|
104
|
+
sql: 'MIN(metric_numeric)',
|
|
105
|
+
type: 'number'
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'max_metric_numeric',
|
|
109
|
+
sql: 'MAX(metric_numeric)',
|
|
110
|
+
type: 'number'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'count_distinct_user_id',
|
|
114
|
+
sql: 'COUNT(DISTINCT user_id)',
|
|
115
|
+
type: 'number'
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
dimensions: [
|
|
119
|
+
// ID fields
|
|
120
|
+
{
|
|
121
|
+
name: 'id_bigint',
|
|
122
|
+
sql: 'id_bigint',
|
|
123
|
+
type: 'number'
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'incident_id',
|
|
127
|
+
sql: 'incident_id',
|
|
128
|
+
type: 'string'
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'user_id',
|
|
132
|
+
sql: 'user_id',
|
|
133
|
+
type: 'string'
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: 'part_id',
|
|
137
|
+
sql: 'part_id',
|
|
138
|
+
type: 'string'
|
|
139
|
+
},
|
|
140
|
+
// Boolean dimensions
|
|
141
|
+
{
|
|
142
|
+
name: 'is_deleted',
|
|
143
|
+
sql: 'is_deleted',
|
|
144
|
+
type: 'boolean'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'flag_boolean',
|
|
148
|
+
sql: 'flag_boolean',
|
|
149
|
+
type: 'boolean'
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: 'is_active',
|
|
153
|
+
sql: 'is_active',
|
|
154
|
+
type: 'boolean'
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: 'resolved_by',
|
|
158
|
+
sql: 'resolved_by',
|
|
159
|
+
type: 'number'
|
|
160
|
+
},
|
|
161
|
+
// String/enum dimensions
|
|
162
|
+
{
|
|
163
|
+
name: 'priority',
|
|
164
|
+
sql: 'priority',
|
|
165
|
+
type: 'string'
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'status',
|
|
169
|
+
sql: 'status',
|
|
170
|
+
type: 'string'
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'severity_label',
|
|
174
|
+
sql: 'severity_label',
|
|
175
|
+
type: 'string'
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'environment',
|
|
179
|
+
sql: 'environment',
|
|
180
|
+
type: 'string'
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'title',
|
|
184
|
+
sql: 'title',
|
|
185
|
+
type: 'string'
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'description',
|
|
189
|
+
sql: 'description',
|
|
190
|
+
type: 'string'
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: 'nullable_string',
|
|
194
|
+
sql: 'nullable_string',
|
|
195
|
+
type: 'string'
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: 'edge_case_string',
|
|
199
|
+
sql: 'edge_case_string',
|
|
200
|
+
type: 'string'
|
|
201
|
+
},
|
|
202
|
+
// Date dimensions
|
|
203
|
+
{
|
|
204
|
+
name: 'record_date',
|
|
205
|
+
sql: 'record_date',
|
|
206
|
+
type: 'time'
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: 'created_date',
|
|
210
|
+
sql: 'created_date',
|
|
211
|
+
type: 'time'
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: 'mitigated_date',
|
|
215
|
+
sql: 'mitigated_date',
|
|
216
|
+
type: 'time'
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: 'partition_record_date',
|
|
220
|
+
sql: 'partition_record_date',
|
|
221
|
+
type: 'time'
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'nullable_date',
|
|
225
|
+
sql: 'nullable_date',
|
|
226
|
+
type: 'time'
|
|
227
|
+
},
|
|
228
|
+
// Timestamp dimensions
|
|
229
|
+
{
|
|
230
|
+
name: 'created_timestamp',
|
|
231
|
+
sql: 'created_timestamp',
|
|
232
|
+
type: 'time'
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: 'identified_timestamp',
|
|
236
|
+
sql: 'identified_timestamp',
|
|
237
|
+
type: 'time'
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: 'deployment_time',
|
|
241
|
+
sql: 'deployment_time',
|
|
242
|
+
type: 'time'
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: 'partition_record_ts',
|
|
246
|
+
sql: 'partition_record_ts',
|
|
247
|
+
type: 'time'
|
|
248
|
+
},
|
|
249
|
+
// Array dimensions
|
|
250
|
+
{
|
|
251
|
+
name: 'tags',
|
|
252
|
+
sql: 'tags',
|
|
253
|
+
type: 'string_array'
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: 'owned_by_ids',
|
|
257
|
+
sql: 'owned_by_ids',
|
|
258
|
+
type: 'string_array'
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: 'part_ids',
|
|
262
|
+
sql: 'part_ids',
|
|
263
|
+
type: 'string_array'
|
|
264
|
+
},
|
|
265
|
+
// JSON-derived dimensions (stored as VARCHAR)
|
|
266
|
+
{
|
|
267
|
+
name: 'metadata_json',
|
|
268
|
+
sql: 'metadata_json',
|
|
269
|
+
type: 'string'
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: 'stage_json',
|
|
273
|
+
sql: 'stage_json',
|
|
274
|
+
type: 'string'
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'impact_json',
|
|
278
|
+
sql: 'impact_json',
|
|
279
|
+
type: 'string'
|
|
280
|
+
},
|
|
281
|
+
// Derived dimensions
|
|
282
|
+
{
|
|
283
|
+
name: 'created_month',
|
|
284
|
+
sql: 'created_month',
|
|
285
|
+
type: 'string'
|
|
286
|
+
},
|
|
287
|
+
// JSON extracted dimensions (examples of how to extract JSON fields)
|
|
288
|
+
{
|
|
289
|
+
name: 'severity_id_from_json',
|
|
290
|
+
sql: "CAST(json_extract_path_text(metadata_json, 'severity_id') AS INTEGER)",
|
|
291
|
+
type: 'number'
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: 'impact_from_json',
|
|
295
|
+
sql: "json_extract_path_text(metadata_json, 'impact')",
|
|
296
|
+
type: 'string'
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
};
|
|
300
|
+
const DIM_USER_SCHEMA = {
|
|
301
|
+
name: 'dim_user',
|
|
302
|
+
sql: 'SELECT * FROM dim_user',
|
|
303
|
+
measures: [
|
|
304
|
+
{
|
|
305
|
+
name: 'count_users',
|
|
306
|
+
sql: 'COUNT(*)',
|
|
307
|
+
type: 'number'
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: 'count_distinct_users',
|
|
311
|
+
sql: 'COUNT(DISTINCT user_id)',
|
|
312
|
+
type: 'number'
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
dimensions: [
|
|
316
|
+
{
|
|
317
|
+
name: 'user_id',
|
|
318
|
+
sql: 'user_id',
|
|
319
|
+
type: 'string'
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: 'user_name',
|
|
323
|
+
sql: 'user_name',
|
|
324
|
+
type: 'string'
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
name: 'user_email',
|
|
328
|
+
sql: 'user_email',
|
|
329
|
+
type: 'string'
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: 'user_segment',
|
|
333
|
+
sql: 'user_segment',
|
|
334
|
+
type: 'string'
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
name: 'user_department',
|
|
338
|
+
sql: 'user_department',
|
|
339
|
+
type: 'string'
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
name: 'user_created_date',
|
|
343
|
+
sql: 'user_created_date',
|
|
344
|
+
type: 'time'
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: 'is_active_user',
|
|
348
|
+
sql: 'is_active_user',
|
|
349
|
+
type: 'boolean'
|
|
350
|
+
}
|
|
351
|
+
],
|
|
352
|
+
joins: [
|
|
353
|
+
{
|
|
354
|
+
name: 'fact_all_types',
|
|
355
|
+
relationship: 'belongsTo',
|
|
356
|
+
sql: 'fact_all_types.user_id = dim_user.user_id'
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
};
|
|
360
|
+
const DIM_PART_SCHEMA = {
|
|
361
|
+
name: 'dim_part',
|
|
362
|
+
sql: 'SELECT * FROM dim_part',
|
|
363
|
+
measures: [
|
|
364
|
+
{
|
|
365
|
+
name: 'count_parts',
|
|
366
|
+
sql: 'COUNT(*)',
|
|
367
|
+
type: 'number'
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
name: 'avg_weight',
|
|
371
|
+
sql: 'AVG(weight)',
|
|
372
|
+
type: 'number'
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
name: 'avg_price',
|
|
376
|
+
sql: 'AVG(price)',
|
|
377
|
+
type: 'number'
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: 'sum_weight',
|
|
381
|
+
sql: 'SUM(weight)',
|
|
382
|
+
type: 'number'
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
dimensions: [
|
|
386
|
+
{
|
|
387
|
+
name: 'part_id',
|
|
388
|
+
sql: 'part_id',
|
|
389
|
+
type: 'string'
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
name: 'part_name',
|
|
393
|
+
sql: 'part_name',
|
|
394
|
+
type: 'string'
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
name: 'product_category',
|
|
398
|
+
sql: 'product_category',
|
|
399
|
+
type: 'string'
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: 'product_tier',
|
|
403
|
+
sql: 'product_tier',
|
|
404
|
+
type: 'string'
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
name: 'weight',
|
|
408
|
+
sql: 'weight',
|
|
409
|
+
type: 'number'
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
name: 'price',
|
|
413
|
+
sql: 'price',
|
|
414
|
+
type: 'number'
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
name: 'in_stock',
|
|
418
|
+
sql: 'in_stock',
|
|
419
|
+
type: 'boolean'
|
|
420
|
+
}
|
|
421
|
+
],
|
|
422
|
+
joins: [
|
|
423
|
+
{
|
|
424
|
+
name: 'fact_all_types',
|
|
425
|
+
relationship: 'belongsTo',
|
|
426
|
+
sql: 'fact_all_types.part_id = dim_part.part_id'
|
|
427
|
+
}
|
|
428
|
+
]
|
|
429
|
+
};
|
|
430
|
+
function getAllSchemas() {
|
|
431
|
+
return [
|
|
432
|
+
FACT_ALL_TYPES_SCHEMA,
|
|
433
|
+
DIM_USER_SCHEMA,
|
|
434
|
+
DIM_PART_SCHEMA
|
|
435
|
+
];
|
|
436
|
+
}
|
|
437
|
+
function getFactSchema() {
|
|
438
|
+
return FACT_ALL_TYPES_SCHEMA;
|
|
439
|
+
}
|
|
440
|
+
function getFactWithUserSchema() {
|
|
441
|
+
return [
|
|
442
|
+
FACT_ALL_TYPES_SCHEMA,
|
|
443
|
+
DIM_USER_SCHEMA
|
|
444
|
+
];
|
|
445
|
+
}
|
|
446
|
+
function getFactWithPartSchema() {
|
|
447
|
+
return [
|
|
448
|
+
FACT_ALL_TYPES_SCHEMA,
|
|
449
|
+
DIM_PART_SCHEMA
|
|
450
|
+
];
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
//# sourceMappingURL=table-schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../meerkat-node/src/__tests__/comprehensive/synthetic/table-schemas.ts"],"sourcesContent":["/**\n * TableSchema Definitions for Synthetic Test Tables\n * \n * These schemas match the synthetic tables created in schema-setup.ts\n * and follow the same conventions as production Meerkat schemas.\n */\n\nexport const FACT_ALL_TYPES_SCHEMA = {\n name: 'fact_all_types',\n sql: 'SELECT * FROM fact_all_types',\n \n measures: [\n // Numeric measures\n { name: 'metric_bigint', sql: 'metric_bigint', type: 'number' },\n { name: 'small_bigint', sql: 'small_bigint', type: 'number' },\n { name: 'metric_numeric', sql: 'metric_numeric', type: 'number' },\n { name: 'precise_numeric', sql: 'precise_numeric', type: 'number' },\n { name: 'metric_double', sql: 'metric_double', type: 'number' },\n { name: 'metric_float', sql: 'metric_float', type: 'number' },\n { name: 'nullable_int', sql: 'nullable_int', type: 'number' },\n { name: 'mtti_seconds', sql: 'mtti_seconds', type: 'number' },\n { name: 'severity_id_int', sql: 'severity_id_int', type: 'number' },\n \n // Aggregate measures\n { name: 'count', sql: 'COUNT(*)', type: 'number' },\n { name: 'sum_metric_bigint', sql: 'SUM(metric_bigint)', type: 'number' },\n { name: 'avg_metric_double', sql: 'AVG(metric_double)', type: 'number' },\n { name: 'min_metric_numeric', sql: 'MIN(metric_numeric)', type: 'number' },\n { name: 'max_metric_numeric', sql: 'MAX(metric_numeric)', type: 'number' },\n { name: 'count_distinct_user_id', sql: 'COUNT(DISTINCT user_id)', type: 'number' },\n ],\n \n dimensions: [\n // ID fields\n { name: 'id_bigint', sql: 'id_bigint', type: 'number' },\n { name: 'incident_id', sql: 'incident_id', type: 'string' },\n { name: 'user_id', sql: 'user_id', type: 'string' },\n { name: 'part_id', sql: 'part_id', type: 'string' },\n \n // Boolean dimensions\n { name: 'is_deleted', sql: 'is_deleted', type: 'boolean' },\n { name: 'flag_boolean', sql: 'flag_boolean', type: 'boolean' },\n { name: 'is_active', sql: 'is_active', type: 'boolean' },\n { name: 'resolved_by', sql: 'resolved_by', type: 'number' },\n \n // String/enum dimensions\n { name: 'priority', sql: 'priority', type: 'string' },\n { name: 'status', sql: 'status', type: 'string' },\n { name: 'severity_label', sql: 'severity_label', type: 'string' },\n { name: 'environment', sql: 'environment', type: 'string' },\n { name: 'title', sql: 'title', type: 'string' },\n { name: 'description', sql: 'description', type: 'string' },\n { name: 'nullable_string', sql: 'nullable_string', type: 'string' },\n { name: 'edge_case_string', sql: 'edge_case_string', type: 'string' },\n \n // Date dimensions\n { name: 'record_date', sql: 'record_date', type: 'time' },\n { name: 'created_date', sql: 'created_date', type: 'time' },\n { name: 'mitigated_date', sql: 'mitigated_date', type: 'time' },\n { name: 'partition_record_date', sql: 'partition_record_date', type: 'time' },\n { name: 'nullable_date', sql: 'nullable_date', type: 'time' },\n \n // Timestamp dimensions\n { name: 'created_timestamp', sql: 'created_timestamp', type: 'time' },\n { name: 'identified_timestamp', sql: 'identified_timestamp', type: 'time' },\n { name: 'deployment_time', sql: 'deployment_time', type: 'time' },\n { name: 'partition_record_ts', sql: 'partition_record_ts', type: 'time' },\n \n // Array dimensions\n { name: 'tags', sql: 'tags', type: 'string_array' },\n { name: 'owned_by_ids', sql: 'owned_by_ids', type: 'string_array' },\n { name: 'part_ids', sql: 'part_ids', type: 'string_array' },\n \n // JSON-derived dimensions (stored as VARCHAR)\n { name: 'metadata_json', sql: 'metadata_json', type: 'string' },\n { name: 'stage_json', sql: 'stage_json', type: 'string' },\n { name: 'impact_json', sql: 'impact_json', type: 'string' },\n \n // Derived dimensions\n { name: 'created_month', sql: 'created_month', type: 'string' },\n \n // JSON extracted dimensions (examples of how to extract JSON fields)\n { \n name: 'severity_id_from_json', \n sql: \"CAST(json_extract_path_text(metadata_json, 'severity_id') AS INTEGER)\", \n type: 'number' \n },\n { \n name: 'impact_from_json', \n sql: \"json_extract_path_text(metadata_json, 'impact')\", \n type: 'string' \n },\n ],\n};\n\nexport const DIM_USER_SCHEMA = {\n name: 'dim_user',\n sql: 'SELECT * FROM dim_user',\n \n measures: [\n { name: 'count_users', sql: 'COUNT(*)', type: 'number' },\n { name: 'count_distinct_users', sql: 'COUNT(DISTINCT user_id)', type: 'number' },\n ],\n \n dimensions: [\n { name: 'user_id', sql: 'user_id', type: 'string' },\n { name: 'user_name', sql: 'user_name', type: 'string' },\n { name: 'user_email', sql: 'user_email', type: 'string' },\n { name: 'user_segment', sql: 'user_segment', type: 'string' },\n { name: 'user_department', sql: 'user_department', type: 'string' },\n { name: 'user_created_date', sql: 'user_created_date', type: 'time' },\n { name: 'is_active_user', sql: 'is_active_user', type: 'boolean' },\n ],\n \n joins: [\n {\n name: 'fact_all_types',\n relationship: 'belongsTo',\n sql: 'fact_all_types.user_id = dim_user.user_id',\n },\n ],\n};\n\nexport const DIM_PART_SCHEMA = {\n name: 'dim_part',\n sql: 'SELECT * FROM dim_part',\n \n measures: [\n { name: 'count_parts', sql: 'COUNT(*)', type: 'number' },\n { name: 'avg_weight', sql: 'AVG(weight)', type: 'number' },\n { name: 'avg_price', sql: 'AVG(price)', type: 'number' },\n { name: 'sum_weight', sql: 'SUM(weight)', type: 'number' },\n ],\n \n dimensions: [\n { name: 'part_id', sql: 'part_id', type: 'string' },\n { name: 'part_name', sql: 'part_name', type: 'string' },\n { name: 'product_category', sql: 'product_category', type: 'string' },\n { name: 'product_tier', sql: 'product_tier', type: 'string' },\n { name: 'weight', sql: 'weight', type: 'number' },\n { name: 'price', sql: 'price', type: 'number' },\n { name: 'in_stock', sql: 'in_stock', type: 'boolean' },\n ],\n \n joins: [\n {\n name: 'fact_all_types',\n relationship: 'belongsTo',\n sql: 'fact_all_types.part_id = dim_part.part_id',\n },\n ],\n};\n\n/**\n * Helper to get all schemas as an array\n */\nexport function getAllSchemas() {\n return [FACT_ALL_TYPES_SCHEMA, DIM_USER_SCHEMA, DIM_PART_SCHEMA];\n}\n\n/**\n * Helper to get just the fact schema\n */\nexport function getFactSchema() {\n return FACT_ALL_TYPES_SCHEMA;\n}\n\n/**\n * Helper to get fact + one dimension\n */\nexport function getFactWithUserSchema() {\n return [FACT_ALL_TYPES_SCHEMA, DIM_USER_SCHEMA];\n}\n\nexport function getFactWithPartSchema() {\n return [FACT_ALL_TYPES_SCHEMA, DIM_PART_SCHEMA];\n}\n\n"],"names":["DIM_PART_SCHEMA","DIM_USER_SCHEMA","FACT_ALL_TYPES_SCHEMA","getAllSchemas","getFactSchema","getFactWithPartSchema","getFactWithUserSchema","name","sql","measures","type","dimensions","joins","relationship"],"mappings":"AAAA;;;;;CAKC;;;;;;;;IAsHYA,eAAe;eAAfA;;IA5BAC,eAAe;eAAfA;;IAxFAC,qBAAqB;eAArBA;;IAqJGC,aAAa;eAAbA;;IAOAC,aAAa;eAAbA;;IAWAC,qBAAqB;eAArBA;;IAJAC,qBAAqB;eAArBA;;;AAnKT,MAAMJ,wBAAwB;IACnCK,MAAM;IACNC,KAAK;IAELC,UAAU;QACR,mBAAmB;QACnB;YAAEF,MAAM;YAAiBC,KAAK;YAAiBE,MAAM;QAAS;QAC9D;YAAEH,MAAM;YAAgBC,KAAK;YAAgBE,MAAM;QAAS;QAC5D;YAAEH,MAAM;YAAkBC,KAAK;YAAkBE,MAAM;QAAS;QAChE;YAAEH,MAAM;YAAmBC,KAAK;YAAmBE,MAAM;QAAS;Q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S;QAC5D;YAAEH,MAAM;YAAUC,KAAK;YAAUE,MAAM;QAAS;QAChD;YAAEH,MAAM;YAASC,KAAK;YAASE,MAAM;QAAS;QAC9C;YAAEH,MAAM;YAAYC,KAAK;YAAYE,MAAM;QAAU;KACtD;IAEDE,OAAO;QACL;YACEL,MAAM;YACNM,cAAc;YACdL,KAAK;QACP;KACD;AACH;AAKO,SAASL;IACd,OAAO;QAACD;QAAuBD;QAAiBD;KAAgB;AAClE;AAKO,SAASI;IACd,OAAOF;AACT;AAKO,SAASI;IACd,OAAO;QAACJ;QAAuBD;KAAgB;AACjD;AAEO,SAASI;IACd,OAAO;QAACH;QAAuBF;KAAgB;AACjD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function _export(target, all) {
|
|
3
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
get: all[name]
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
_export(exports, {
|
|
9
|
+
ensureTableSchemaAlias: function() {
|
|
10
|
+
return ensureTableSchemaAlias;
|
|
11
|
+
},
|
|
12
|
+
ensureTableSchemasAlias: function() {
|
|
13
|
+
return ensureTableSchemasAlias;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const _meerkatcore = require("@devrev/meerkat-core");
|
|
17
|
+
const _duckdbexec = require("../duckdb-exec");
|
|
18
|
+
const ensureTableSchemasAlias = async (tableSchemas)=>{
|
|
19
|
+
return (0, _meerkatcore.ensureTableSchemaAliasSql)({
|
|
20
|
+
tableSchemas,
|
|
21
|
+
ensureExpressionAlias: async ({ items })=>{
|
|
22
|
+
const aliasedItems = await (0, _meerkatcore.ensureColumnAliasBatch)({
|
|
23
|
+
items: items.map((item)=>({
|
|
24
|
+
sql: item.sql,
|
|
25
|
+
tableName: item.context.tableName
|
|
26
|
+
})),
|
|
27
|
+
executeQuery: (query)=>(0, _duckdbexec.duckdbExec)(query)
|
|
28
|
+
});
|
|
29
|
+
return aliasedItems.map((item)=>item.sql);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const ensureTableSchemaAlias = ()=>{
|
|
34
|
+
return async (tableSchemas)=>{
|
|
35
|
+
return ensureTableSchemasAlias(tableSchemas);
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=ensure-table-schema-alias.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../meerkat-node/src/ensure-table-schema-alias/ensure-table-schema-alias.ts"],"sourcesContent":["import {\n TableSchema,\n ensureColumnAliasBatch,\n ensureTableSchemaAliasSql,\n} from '@devrev/meerkat-core';\nimport { duckdbExec } from '../duckdb-exec';\n\nexport const ensureTableSchemasAlias = async (\n tableSchemas: TableSchema[]\n): Promise<TableSchema[]> => {\n return ensureTableSchemaAliasSql({\n tableSchemas,\n ensureExpressionAlias: async ({ items }) => {\n const aliasedItems = await ensureColumnAliasBatch({\n items: items.map((item) => ({\n sql: item.sql,\n tableName: item.context.tableName,\n })),\n executeQuery: (query) =>\n duckdbExec<Record<string, string>[]>(query),\n });\n\n return aliasedItems.map((item) => item.sql);\n },\n });\n};\n\nexport const ensureTableSchemaAlias = () => {\n return async (tableSchemas: TableSchema[]): Promise<TableSchema[]> => {\n return ensureTableSchemasAlias(tableSchemas);\n };\n};\n"],"names":["ensureTableSchemaAlias","ensureTableSchemasAlias","tableSchemas","ensureTableSchemaAliasSql","ensureExpressionAlias","items","aliasedItems","ensureColumnAliasBatch","map","item","sql","tableName","context","executeQuery","query","duckdbExec"],"mappings":";;;;;;;;IA2BaA,sBAAsB;eAAtBA;;IApBAC,uBAAuB;eAAvBA;;;6BAHN;4BACoB;AAEpB,MAAMA,0BAA0B,OACrCC;IAEA,OAAOC,IAAAA,sCAAyB,EAAC;QAC/BD;QACAE,uBAAuB,OAAO,EAAEC,KAAK,EAAE;YACrC,MAAMC,eAAe,MAAMC,IAAAA,mCAAsB,EAAC;gBAChDF,OAAOA,MAAMG,GAAG,CAAC,CAACC,OAAU,CAAA;wBAC1BC,KAAKD,KAAKC,GAAG;wBACbC,WAAWF,KAAKG,OAAO,CAACD,SAAS;oBACnC,CAAA;gBACAE,cAAc,CAACC,QACbC,IAAAA,sBAAU,EAA2BD;YACzC;YAEA,OAAOR,aAAaE,GAAG,CAAC,CAACC,OAASA,KAAKC,GAAG;QAC5C;IACF;AACF;AAEO,MAAMV,yBAAyB;IACpC,OAAO,OAAOE;QACZ,OAAOD,wBAAwBC;IACjC;AACF"}
|
package/index.js
CHANGED
|
@@ -6,5 +6,6 @@ _export_star._(require("./duckdb-manager/duckdb-manager"), exports);
|
|
|
6
6
|
_export_star._(require("./duckdb-singleton"), exports);
|
|
7
7
|
_export_star._(require("./file-manager/file-manager"), exports);
|
|
8
8
|
_export_star._(require("./node-sql-to-serialization"), exports);
|
|
9
|
+
_export_star._(require("./ensure-table-schema-alias/ensure-table-schema-alias"), exports);
|
|
9
10
|
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../meerkat-node/src/index.ts"],"sourcesContent":["export * from './cube-to-sql-with-resolution/cube-to-sql-with-resolution';\nexport * from './cube-to-sql/cube-to-sql';\nexport * from './duckdb-manager/duckdb-manager';\nexport * from './duckdb-singleton';\nexport * from './file-manager/file-manager';\nexport * from './node-sql-to-serialization';\n"],"names":[],"mappings":";;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA"}
|
|
1
|
+
{"version":3,"sources":["../../meerkat-node/src/index.ts"],"sourcesContent":["export * from './cube-to-sql-with-resolution/cube-to-sql-with-resolution';\nexport * from './cube-to-sql/cube-to-sql';\nexport * from './duckdb-manager/duckdb-manager';\nexport * from './duckdb-singleton';\nexport * from './file-manager/file-manager';\nexport * from './node-sql-to-serialization';\nexport * from './ensure-table-schema-alias/ensure-table-schema-alias';\n"],"names":[],"mappings":";;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devrev/meerkat-node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.124",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@swc/helpers": "~0.5.0",
|
|
6
6
|
"@devrev/meerkat-core": "*",
|
|
7
7
|
"axios": "^1.13.5",
|
|
8
8
|
"lodash": "^4.17.23",
|
|
9
|
-
"duckdb": "
|
|
9
|
+
"duckdb": "1.3.4"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"release": "semantic-release"
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Helper Utilities
|
|
3
|
+
*
|
|
4
|
+
* Common utilities for Vitest-based comprehensive tests
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Batch Error Reporter
|
|
8
|
+
*
|
|
9
|
+
* Collects multiple test failures and reports them together
|
|
10
|
+
* instead of failing on the first error. Useful for data-driven tests.
|
|
11
|
+
*/
|
|
12
|
+
export declare class BatchErrorReporter {
|
|
13
|
+
private errors;
|
|
14
|
+
/**
|
|
15
|
+
* Add an error to the batch
|
|
16
|
+
*/
|
|
17
|
+
addError(testCase: string, error: Error, context?: any): void;
|
|
18
|
+
/**
|
|
19
|
+
* Check if there are any errors
|
|
20
|
+
*/
|
|
21
|
+
hasErrors(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Get count of errors
|
|
24
|
+
*/
|
|
25
|
+
getErrorCount(): number;
|
|
26
|
+
/**
|
|
27
|
+
* Get all errors
|
|
28
|
+
*/
|
|
29
|
+
getErrors(): {
|
|
30
|
+
testCase: string;
|
|
31
|
+
error: Error;
|
|
32
|
+
context?: any;
|
|
33
|
+
}[];
|
|
34
|
+
/**
|
|
35
|
+
* Throw if there are any errors, with a comprehensive report
|
|
36
|
+
*/
|
|
37
|
+
throwIfErrors(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Clear all errors
|
|
40
|
+
*/
|
|
41
|
+
clear(): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Compare numeric values with tolerance for floating-point precision
|
|
45
|
+
*/
|
|
46
|
+
export declare function compareNumbers(actual: number, expected: number, tolerance?: number): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Compare query results with tolerance for numeric fields
|
|
49
|
+
*/
|
|
50
|
+
export declare function compareResults(actual: any[], expected: any[], options?: {
|
|
51
|
+
numericTolerance?: number;
|
|
52
|
+
ignoreOrder?: boolean;
|
|
53
|
+
ignoreFields?: string[];
|
|
54
|
+
}): {
|
|
55
|
+
match: boolean;
|
|
56
|
+
diff?: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Create a reference SQL query for validation
|
|
60
|
+
* This is the "oracle" pattern - we create direct SQL to validate Meerkat's output
|
|
61
|
+
*/
|
|
62
|
+
export declare function createReferenceSQL(options: {
|
|
63
|
+
select: string[];
|
|
64
|
+
from: string;
|
|
65
|
+
where?: string;
|
|
66
|
+
groupBy?: string[];
|
|
67
|
+
orderBy?: string[];
|
|
68
|
+
limit?: number;
|
|
69
|
+
}): string;
|
|
70
|
+
/**
|
|
71
|
+
* Measure execution time of a function
|
|
72
|
+
*/
|
|
73
|
+
export declare function measureExecutionTime<T>(fn: () => Promise<T>): Promise<{
|
|
74
|
+
result: T;
|
|
75
|
+
duration: number;
|
|
76
|
+
}>;
|
|
77
|
+
/**
|
|
78
|
+
* Validate query performance against a budget
|
|
79
|
+
*/
|
|
80
|
+
export declare function validatePerformance(duration: number, budgetMs: number, queryDescription: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Execute a reference SQL and validate against Meerkat result
|
|
83
|
+
*/
|
|
84
|
+
export declare function validateAgainstReference(meerkatResult: any[], referenceSQL: string, options?: {
|
|
85
|
+
numericTolerance?: number;
|
|
86
|
+
ignoreOrder?: boolean;
|
|
87
|
+
ignoreFields?: string[];
|
|
88
|
+
}): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Generate test cases for a data-driven test
|
|
91
|
+
*/
|
|
92
|
+
export declare function generateTestCases<T>(template: T, variations: Array<Partial<T>>): T[];
|
|
93
|
+
/**
|
|
94
|
+
* Format SQL for error messages (truncate if too long)
|
|
95
|
+
*/
|
|
96
|
+
export declare function formatSQL(sql: string, maxLength?: number): string;
|
|
97
|
+
/**
|
|
98
|
+
* Retry a function with exponential backoff
|
|
99
|
+
* Useful for flaky operations
|
|
100
|
+
*/
|
|
101
|
+
export declare function retryWithBackoff<T>(fn: () => Promise<T>, options?: {
|
|
102
|
+
maxRetries?: number;
|
|
103
|
+
initialDelay?: number;
|
|
104
|
+
maxDelay?: number;
|
|
105
|
+
backoffMultiplier?: number;
|
|
106
|
+
}): Promise<T>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthetic Schema Setup
|
|
3
|
+
*
|
|
4
|
+
* Creates comprehensive test tables with 1M+ rows covering all data types
|
|
5
|
+
* and patterns used in production Meerkat queries.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Create the comprehensive fact_all_types table
|
|
9
|
+
* This table contains ~100 columns covering all normalized DB types
|
|
10
|
+
*/
|
|
11
|
+
export declare function createFactAllTypesTable(): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Create dimension table: dim_user
|
|
14
|
+
*/
|
|
15
|
+
export declare function createDimUserTable(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Create dimension table: dim_part
|
|
18
|
+
*/
|
|
19
|
+
export declare function createDimPartTable(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Create all synthetic tables in one go
|
|
22
|
+
*/
|
|
23
|
+
export declare function createAllSyntheticTables(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Drop all synthetic tables (for cleanup)
|
|
26
|
+
*/
|
|
27
|
+
export declare function dropSyntheticTables(): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Verify tables exist and have data
|
|
30
|
+
*/
|
|
31
|
+
export declare function verifySyntheticTables(): Promise<void>;
|