@514labs/moose-lib 0.6.262-ci-2-g350aed07 → 0.6.262-ci-5-gf85ca97c
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/{browserCompatible-Bqhjy4pn.d.ts → browserCompatible-BpwCKgGF.d.ts} +1 -1
- package/dist/{browserCompatible-DTtKuO-Y.d.mts → browserCompatible-CDqMXtd_.d.mts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +87 -119
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +87 -119
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/dmv2/index.d.mts +1 -1
- package/dist/dmv2/index.d.ts +1 -1
- package/dist/dmv2/index.js +87 -119
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +87 -119
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-CQB6bk1i.d.mts → index-B2jILcTY.d.mts} +56 -40
- package/dist/{index-CQB6bk1i.d.ts → index-B2jILcTY.d.ts} +56 -40
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +89 -109
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -109
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +28 -4
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +28 -4
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -387,35 +387,8 @@ function getSourceFileInfo(stack) {
|
|
|
387
387
|
}
|
|
388
388
|
return {};
|
|
389
389
|
}
|
|
390
|
-
function getSourceLocationFromStack(stack) {
|
|
391
|
-
if (!stack) return void 0;
|
|
392
|
-
const lines = stack.split("\n");
|
|
393
|
-
for (const line of lines.slice(1)) {
|
|
394
|
-
if (shouldSkipStackLine(line)) {
|
|
395
|
-
continue;
|
|
396
|
-
}
|
|
397
|
-
const v8Match = line.match(/at\s+(?:.*?\s+\()?(.+):(\d+):(\d+)\)?/);
|
|
398
|
-
if (v8Match) {
|
|
399
|
-
return {
|
|
400
|
-
file: v8Match[1],
|
|
401
|
-
line: parseInt(v8Match[2], 10),
|
|
402
|
-
column: parseInt(v8Match[3], 10)
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
const smMatch = line.match(/(?:.*@)?(.+):(\d+):(\d+)/);
|
|
406
|
-
if (smMatch) {
|
|
407
|
-
return {
|
|
408
|
-
file: smMatch[1],
|
|
409
|
-
line: parseInt(smMatch[2], 10),
|
|
410
|
-
column: parseInt(smMatch[3], 10)
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
return void 0;
|
|
415
|
-
}
|
|
416
390
|
function getSourceFileFromStack(stack) {
|
|
417
|
-
|
|
418
|
-
return location?.file;
|
|
391
|
+
return getSourceFileInfo(stack).file;
|
|
419
392
|
}
|
|
420
393
|
|
|
421
394
|
// src/dmv2/typedBase.ts
|
|
@@ -628,16 +601,6 @@ function emptyIfUndefined(value) {
|
|
|
628
601
|
return value === void 0 ? "" : value;
|
|
629
602
|
}
|
|
630
603
|
|
|
631
|
-
// src/blocks/helpers.ts
|
|
632
|
-
function dropView(name) {
|
|
633
|
-
return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
|
|
634
|
-
}
|
|
635
|
-
function createMaterializedView(options) {
|
|
636
|
-
return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
|
|
637
|
-
TO ${quoteIdentifier(options.destinationTable)}
|
|
638
|
-
AS ${options.select}`.trim();
|
|
639
|
-
}
|
|
640
|
-
|
|
641
604
|
// src/dmv2/internal.ts
|
|
642
605
|
import process2 from "process";
|
|
643
606
|
|
|
@@ -691,7 +654,9 @@ var moose_internal = {
|
|
|
691
654
|
apis: /* @__PURE__ */ new Map(),
|
|
692
655
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
693
656
|
workflows: /* @__PURE__ */ new Map(),
|
|
694
|
-
webApps: /* @__PURE__ */ new Map()
|
|
657
|
+
webApps: /* @__PURE__ */ new Map(),
|
|
658
|
+
materializedViews: /* @__PURE__ */ new Map(),
|
|
659
|
+
customViews: /* @__PURE__ */ new Map()
|
|
695
660
|
};
|
|
696
661
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
697
662
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -2307,6 +2272,67 @@ var ETLPipeline = class {
|
|
|
2307
2272
|
}
|
|
2308
2273
|
};
|
|
2309
2274
|
|
|
2275
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2276
|
+
var requireTargetTableName = (tableName) => {
|
|
2277
|
+
if (typeof tableName === "string") {
|
|
2278
|
+
return tableName;
|
|
2279
|
+
} else {
|
|
2280
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2281
|
+
}
|
|
2282
|
+
};
|
|
2283
|
+
var MaterializedView = class {
|
|
2284
|
+
/** @internal */
|
|
2285
|
+
kind = "MaterializedView";
|
|
2286
|
+
/** The name of the materialized view */
|
|
2287
|
+
name;
|
|
2288
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2289
|
+
targetTable;
|
|
2290
|
+
/** The SELECT SQL statement */
|
|
2291
|
+
selectSql;
|
|
2292
|
+
/** Names of source tables that the SELECT reads from */
|
|
2293
|
+
sourceTables;
|
|
2294
|
+
/** @internal Source file path where this MV was defined */
|
|
2295
|
+
sourceFile;
|
|
2296
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2297
|
+
let selectStatement = options.selectStatement;
|
|
2298
|
+
if (typeof selectStatement !== "string") {
|
|
2299
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2300
|
+
}
|
|
2301
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2302
|
+
throw new Error(
|
|
2303
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2304
|
+
);
|
|
2305
|
+
}
|
|
2306
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2307
|
+
requireTargetTableName(
|
|
2308
|
+
options.targetTable?.name ?? options.tableName
|
|
2309
|
+
),
|
|
2310
|
+
{
|
|
2311
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2312
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2313
|
+
},
|
|
2314
|
+
targetSchema,
|
|
2315
|
+
targetColumns
|
|
2316
|
+
);
|
|
2317
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2318
|
+
throw new Error(
|
|
2319
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2320
|
+
);
|
|
2321
|
+
}
|
|
2322
|
+
this.name = options.materializedViewName;
|
|
2323
|
+
this.targetTable = targetTable;
|
|
2324
|
+
this.selectSql = selectStatement;
|
|
2325
|
+
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2326
|
+
const stack = new Error().stack;
|
|
2327
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2328
|
+
const materializedViews = getMooseInternal().materializedViews;
|
|
2329
|
+
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2330
|
+
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2331
|
+
}
|
|
2332
|
+
materializedViews.set(this.name, this);
|
|
2333
|
+
}
|
|
2334
|
+
};
|
|
2335
|
+
|
|
2310
2336
|
// src/dmv2/sdk/sqlResource.ts
|
|
2311
2337
|
var SqlResource = class {
|
|
2312
2338
|
/** @internal */
|
|
@@ -2323,10 +2349,6 @@ var SqlResource = class {
|
|
|
2323
2349
|
pushesDataTo;
|
|
2324
2350
|
/** @internal Source file path where this resource was defined */
|
|
2325
2351
|
sourceFile;
|
|
2326
|
-
/** @internal Source line number where this resource was defined */
|
|
2327
|
-
sourceLine;
|
|
2328
|
-
/** @internal Source column number where this resource was defined */
|
|
2329
|
-
sourceColumn;
|
|
2330
2352
|
/**
|
|
2331
2353
|
* Creates a new SqlResource instance.
|
|
2332
2354
|
* @param name The name of the resource.
|
|
@@ -2352,75 +2374,22 @@ var SqlResource = class {
|
|
|
2352
2374
|
this.pullsDataFrom = options?.pullsDataFrom ?? [];
|
|
2353
2375
|
this.pushesDataTo = options?.pushesDataTo ?? [];
|
|
2354
2376
|
const stack = new Error().stack;
|
|
2355
|
-
|
|
2356
|
-
if (location) {
|
|
2357
|
-
this.sourceFile = location.file;
|
|
2358
|
-
this.sourceLine = location.line;
|
|
2359
|
-
this.sourceColumn = location.column;
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
|
-
};
|
|
2363
|
-
|
|
2364
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2365
|
-
var requireTargetTableName = (tableName) => {
|
|
2366
|
-
if (typeof tableName === "string") {
|
|
2367
|
-
return tableName;
|
|
2368
|
-
} else {
|
|
2369
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2370
|
-
}
|
|
2371
|
-
};
|
|
2372
|
-
var MaterializedView = class extends SqlResource {
|
|
2373
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2374
|
-
targetTable;
|
|
2375
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2376
|
-
let selectStatement = options.selectStatement;
|
|
2377
|
-
if (typeof selectStatement !== "string") {
|
|
2378
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2379
|
-
}
|
|
2380
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2381
|
-
throw new Error(
|
|
2382
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2383
|
-
);
|
|
2384
|
-
}
|
|
2385
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2386
|
-
requireTargetTableName(
|
|
2387
|
-
options.targetTable?.name ?? options.tableName
|
|
2388
|
-
),
|
|
2389
|
-
{
|
|
2390
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2391
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2392
|
-
},
|
|
2393
|
-
targetSchema,
|
|
2394
|
-
targetColumns
|
|
2395
|
-
);
|
|
2396
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2397
|
-
throw new Error(
|
|
2398
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2399
|
-
);
|
|
2400
|
-
}
|
|
2401
|
-
super(
|
|
2402
|
-
options.materializedViewName,
|
|
2403
|
-
[
|
|
2404
|
-
createMaterializedView({
|
|
2405
|
-
name: options.materializedViewName,
|
|
2406
|
-
destinationTable: targetTable.name,
|
|
2407
|
-
select: selectStatement
|
|
2408
|
-
})
|
|
2409
|
-
// Population is now handled automatically by Rust infrastructure
|
|
2410
|
-
// based on table engine type and whether this is a new or updated view
|
|
2411
|
-
],
|
|
2412
|
-
[dropView(options.materializedViewName)],
|
|
2413
|
-
{
|
|
2414
|
-
pullsDataFrom: options.selectTables,
|
|
2415
|
-
pushesDataTo: [targetTable]
|
|
2416
|
-
}
|
|
2417
|
-
);
|
|
2418
|
-
this.targetTable = targetTable;
|
|
2377
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2419
2378
|
}
|
|
2420
2379
|
};
|
|
2421
2380
|
|
|
2422
2381
|
// src/dmv2/sdk/view.ts
|
|
2423
|
-
var View = class
|
|
2382
|
+
var View = class {
|
|
2383
|
+
/** @internal */
|
|
2384
|
+
kind = "CustomView";
|
|
2385
|
+
/** The name of the view */
|
|
2386
|
+
name;
|
|
2387
|
+
/** The SELECT SQL statement that defines the view */
|
|
2388
|
+
selectSql;
|
|
2389
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
2390
|
+
sourceTables;
|
|
2391
|
+
/** @internal Source file path where this view was defined */
|
|
2392
|
+
sourceFile;
|
|
2424
2393
|
/**
|
|
2425
2394
|
* Creates a new View instance.
|
|
2426
2395
|
* @param name The name of the view to be created.
|
|
@@ -2431,17 +2400,16 @@ var View = class extends SqlResource {
|
|
|
2431
2400
|
if (typeof selectStatement !== "string") {
|
|
2432
2401
|
selectStatement = toStaticQuery(selectStatement);
|
|
2433
2402
|
}
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
{
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
);
|
|
2403
|
+
this.name = name;
|
|
2404
|
+
this.selectSql = selectStatement;
|
|
2405
|
+
this.sourceTables = baseTables.map((t) => t.name);
|
|
2406
|
+
const stack = new Error().stack;
|
|
2407
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2408
|
+
const customViews = getMooseInternal().customViews;
|
|
2409
|
+
if (!isClientOnlyMode() && customViews.has(this.name)) {
|
|
2410
|
+
throw new Error(`View with name ${this.name} already exists`);
|
|
2411
|
+
}
|
|
2412
|
+
customViews.set(this.name, this);
|
|
2445
2413
|
}
|
|
2446
2414
|
};
|
|
2447
2415
|
|