@514labs/moose-lib 0.6.279-ci-3-g3edfe2f6 → 0.6.280-ci-6-g9ba15e89
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-Bs-byVfO.d.mts → browserCompatible-15NCyT1P.d.mts} +1 -1
- package/dist/{browserCompatible-D8Hbpq6L.d.ts → browserCompatible-BUKAJYbj.d.ts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +93 -94
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +93 -94
- 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 +93 -114
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +93 -110
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-KhGbXtkS.d.mts → index-BtkwFbT9.d.mts} +41 -83
- package/dist/{index-KhGbXtkS.d.ts → index-BtkwFbT9.d.ts} +41 -83
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +83 -96
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -96
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +2 -28
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +2 -28
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -368,10 +368,13 @@ var init_runtime = __esm({
|
|
|
368
368
|
// src/dmv2/utils/stackTrace.ts
|
|
369
369
|
function shouldSkipStackLine(line) {
|
|
370
370
|
return line.includes("node_modules") || // Skip npm installed packages (prod)
|
|
371
|
-
line.includes("internal
|
|
371
|
+
line.includes("node:internal") || // Skip Node.js internals (modern format)
|
|
372
|
+
line.includes("internal/modules") || // Skip Node.js internals (older format)
|
|
372
373
|
line.includes("ts-node") || // Skip TypeScript execution
|
|
373
|
-
line.includes("/ts-moose-lib/") || // Skip dev/linked moose-lib (Unix)
|
|
374
|
-
line.includes("\\ts-moose-lib\\")
|
|
374
|
+
line.includes("/ts-moose-lib/src/") || // Skip dev/linked moose-lib src (Unix)
|
|
375
|
+
line.includes("\\ts-moose-lib\\src\\") || // Skip dev/linked moose-lib src (Windows)
|
|
376
|
+
line.includes("/ts-moose-lib/dist/") || // Skip dev/linked moose-lib dist (Unix)
|
|
377
|
+
line.includes("\\ts-moose-lib\\dist\\");
|
|
375
378
|
}
|
|
376
379
|
function parseStackLine(line) {
|
|
377
380
|
const match = line.match(/\((.*):(\d+):(\d+)\)/) || line.match(/at (.*):(\d+):(\d+)/);
|
|
@@ -474,12 +477,12 @@ var TypedBase = class {
|
|
|
474
477
|
this.validators = validators;
|
|
475
478
|
this.allowExtraFields = allowExtraFields ?? false;
|
|
476
479
|
this.metadata = config?.metadata ? { ...config.metadata } : {};
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
480
|
+
if (!this.metadata.source) {
|
|
481
|
+
const stack = new Error().stack;
|
|
482
|
+
if (stack) {
|
|
483
|
+
const info = getSourceFileInfo(stack);
|
|
484
|
+
this.metadata.source = { file: info.file, line: info.line };
|
|
485
|
+
}
|
|
483
486
|
}
|
|
484
487
|
}
|
|
485
488
|
};
|
|
@@ -692,9 +695,7 @@ var moose_internal = {
|
|
|
692
695
|
apis: /* @__PURE__ */ new Map(),
|
|
693
696
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
694
697
|
workflows: /* @__PURE__ */ new Map(),
|
|
695
|
-
webApps: /* @__PURE__ */ new Map()
|
|
696
|
-
materializedViews: /* @__PURE__ */ new Map(),
|
|
697
|
-
customViews: /* @__PURE__ */ new Map()
|
|
698
|
+
webApps: /* @__PURE__ */ new Map()
|
|
698
699
|
};
|
|
699
700
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
700
701
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -710,8 +711,6 @@ var loadIndex = () => {
|
|
|
710
711
|
registry.sqlResources.clear();
|
|
711
712
|
registry.workflows.clear();
|
|
712
713
|
registry.webApps.clear();
|
|
713
|
-
registry.materializedViews.clear();
|
|
714
|
-
registry.customViews.clear();
|
|
715
714
|
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
716
715
|
Object.keys(__require.cache).forEach((key) => {
|
|
717
716
|
if (key.startsWith(appDir)) {
|
|
@@ -2358,67 +2357,6 @@ var ETLPipeline = class {
|
|
|
2358
2357
|
}
|
|
2359
2358
|
};
|
|
2360
2359
|
|
|
2361
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2362
|
-
var requireTargetTableName = (tableName) => {
|
|
2363
|
-
if (typeof tableName === "string") {
|
|
2364
|
-
return tableName;
|
|
2365
|
-
} else {
|
|
2366
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2367
|
-
}
|
|
2368
|
-
};
|
|
2369
|
-
var MaterializedView = class {
|
|
2370
|
-
/** @internal */
|
|
2371
|
-
kind = "MaterializedView";
|
|
2372
|
-
/** The name of the materialized view */
|
|
2373
|
-
name;
|
|
2374
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2375
|
-
targetTable;
|
|
2376
|
-
/** The SELECT SQL statement */
|
|
2377
|
-
selectSql;
|
|
2378
|
-
/** Names of source tables that the SELECT reads from */
|
|
2379
|
-
sourceTables;
|
|
2380
|
-
/** @internal Source file path where this MV was defined */
|
|
2381
|
-
sourceFile;
|
|
2382
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2383
|
-
let selectStatement = options.selectStatement;
|
|
2384
|
-
if (typeof selectStatement !== "string") {
|
|
2385
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2386
|
-
}
|
|
2387
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2388
|
-
throw new Error(
|
|
2389
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2390
|
-
);
|
|
2391
|
-
}
|
|
2392
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2393
|
-
requireTargetTableName(
|
|
2394
|
-
options.targetTable?.name ?? options.tableName
|
|
2395
|
-
),
|
|
2396
|
-
{
|
|
2397
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2398
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2399
|
-
},
|
|
2400
|
-
targetSchema,
|
|
2401
|
-
targetColumns
|
|
2402
|
-
);
|
|
2403
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2404
|
-
throw new Error(
|
|
2405
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2406
|
-
);
|
|
2407
|
-
}
|
|
2408
|
-
this.name = options.materializedViewName;
|
|
2409
|
-
this.targetTable = targetTable;
|
|
2410
|
-
this.selectSql = selectStatement;
|
|
2411
|
-
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2412
|
-
const stack = new Error().stack;
|
|
2413
|
-
this.sourceFile = getSourceFileFromStack(stack);
|
|
2414
|
-
const materializedViews = getMooseInternal().materializedViews;
|
|
2415
|
-
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2416
|
-
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2417
|
-
}
|
|
2418
|
-
materializedViews.set(this.name, this);
|
|
2419
|
-
}
|
|
2420
|
-
};
|
|
2421
|
-
|
|
2422
2360
|
// src/dmv2/sdk/sqlResource.ts
|
|
2423
2361
|
var SqlResource = class {
|
|
2424
2362
|
/** @internal */
|
|
@@ -2473,18 +2411,66 @@ var SqlResource = class {
|
|
|
2473
2411
|
}
|
|
2474
2412
|
};
|
|
2475
2413
|
|
|
2414
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2415
|
+
var requireTargetTableName = (tableName) => {
|
|
2416
|
+
if (typeof tableName === "string") {
|
|
2417
|
+
return tableName;
|
|
2418
|
+
} else {
|
|
2419
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2420
|
+
}
|
|
2421
|
+
};
|
|
2422
|
+
var MaterializedView = class extends SqlResource {
|
|
2423
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2424
|
+
targetTable;
|
|
2425
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2426
|
+
let selectStatement = options.selectStatement;
|
|
2427
|
+
if (typeof selectStatement !== "string") {
|
|
2428
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2429
|
+
}
|
|
2430
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2431
|
+
throw new Error(
|
|
2432
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2433
|
+
);
|
|
2434
|
+
}
|
|
2435
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2436
|
+
requireTargetTableName(
|
|
2437
|
+
options.targetTable?.name ?? options.tableName
|
|
2438
|
+
),
|
|
2439
|
+
{
|
|
2440
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2441
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2442
|
+
},
|
|
2443
|
+
targetSchema,
|
|
2444
|
+
targetColumns
|
|
2445
|
+
);
|
|
2446
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2447
|
+
throw new Error(
|
|
2448
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2449
|
+
);
|
|
2450
|
+
}
|
|
2451
|
+
super(
|
|
2452
|
+
options.materializedViewName,
|
|
2453
|
+
[
|
|
2454
|
+
createMaterializedView({
|
|
2455
|
+
name: options.materializedViewName,
|
|
2456
|
+
destinationTable: targetTable.name,
|
|
2457
|
+
select: selectStatement
|
|
2458
|
+
})
|
|
2459
|
+
// Population is now handled automatically by Rust infrastructure
|
|
2460
|
+
// based on table engine type and whether this is a new or updated view
|
|
2461
|
+
],
|
|
2462
|
+
[dropView(options.materializedViewName)],
|
|
2463
|
+
{
|
|
2464
|
+
pullsDataFrom: options.selectTables,
|
|
2465
|
+
pushesDataTo: [targetTable]
|
|
2466
|
+
}
|
|
2467
|
+
);
|
|
2468
|
+
this.targetTable = targetTable;
|
|
2469
|
+
}
|
|
2470
|
+
};
|
|
2471
|
+
|
|
2476
2472
|
// src/dmv2/sdk/view.ts
|
|
2477
|
-
var View = class {
|
|
2478
|
-
/** @internal */
|
|
2479
|
-
kind = "CustomView";
|
|
2480
|
-
/** The name of the view */
|
|
2481
|
-
name;
|
|
2482
|
-
/** The SELECT SQL statement that defines the view */
|
|
2483
|
-
selectSql;
|
|
2484
|
-
/** Names of source tables/views that the SELECT reads from */
|
|
2485
|
-
sourceTables;
|
|
2486
|
-
/** @internal Source file path where this view was defined */
|
|
2487
|
-
sourceFile;
|
|
2473
|
+
var View = class extends SqlResource {
|
|
2488
2474
|
/**
|
|
2489
2475
|
* Creates a new View instance.
|
|
2490
2476
|
* @param name The name of the view to be created.
|
|
@@ -2495,16 +2481,17 @@ var View = class {
|
|
|
2495
2481
|
if (typeof selectStatement !== "string") {
|
|
2496
2482
|
selectStatement = toStaticQuery(selectStatement);
|
|
2497
2483
|
}
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2484
|
+
super(
|
|
2485
|
+
name,
|
|
2486
|
+
[
|
|
2487
|
+
`CREATE VIEW IF NOT EXISTS ${name}
|
|
2488
|
+
AS ${selectStatement}`.trim()
|
|
2489
|
+
],
|
|
2490
|
+
[dropView(name)],
|
|
2491
|
+
{
|
|
2492
|
+
pullsDataFrom: baseTables
|
|
2493
|
+
}
|
|
2494
|
+
);
|
|
2508
2495
|
}
|
|
2509
2496
|
};
|
|
2510
2497
|
|