@514labs/moose-lib 0.6.284-ci-8-g9790d0a6 → 0.6.284-ci-5-g1643505d
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-15NCyT1P.d.mts → browserCompatible-Bs-byVfO.d.mts} +1 -1
- package/dist/{browserCompatible-BUKAJYbj.d.ts → browserCompatible-D8Hbpq6L.d.ts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +85 -81
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +85 -81
- 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 +105 -81
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +101 -81
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-BtkwFbT9.d.mts → index-KhGbXtkS.d.mts} +83 -41
- package/dist/{index-BtkwFbT9.d.ts → index-KhGbXtkS.d.ts} +83 -41
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +87 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -71
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +28 -2
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +28 -2
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -695,7 +695,9 @@ var moose_internal = {
|
|
|
695
695
|
apis: /* @__PURE__ */ new Map(),
|
|
696
696
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
697
697
|
workflows: /* @__PURE__ */ new Map(),
|
|
698
|
-
webApps: /* @__PURE__ */ new Map()
|
|
698
|
+
webApps: /* @__PURE__ */ new Map(),
|
|
699
|
+
materializedViews: /* @__PURE__ */ new Map(),
|
|
700
|
+
customViews: /* @__PURE__ */ new Map()
|
|
699
701
|
};
|
|
700
702
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
701
703
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -711,6 +713,8 @@ var loadIndex = () => {
|
|
|
711
713
|
registry.sqlResources.clear();
|
|
712
714
|
registry.workflows.clear();
|
|
713
715
|
registry.webApps.clear();
|
|
716
|
+
registry.materializedViews.clear();
|
|
717
|
+
registry.customViews.clear();
|
|
714
718
|
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
715
719
|
Object.keys(__require.cache).forEach((key) => {
|
|
716
720
|
if (key.startsWith(appDir)) {
|
|
@@ -2357,6 +2361,67 @@ var ETLPipeline = class {
|
|
|
2357
2361
|
}
|
|
2358
2362
|
};
|
|
2359
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 {
|
|
2373
|
+
/** @internal */
|
|
2374
|
+
kind = "MaterializedView";
|
|
2375
|
+
/** The name of the materialized view */
|
|
2376
|
+
name;
|
|
2377
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2378
|
+
targetTable;
|
|
2379
|
+
/** The SELECT SQL statement */
|
|
2380
|
+
selectSql;
|
|
2381
|
+
/** Names of source tables that the SELECT reads from */
|
|
2382
|
+
sourceTables;
|
|
2383
|
+
/** @internal Source file path where this MV was defined */
|
|
2384
|
+
sourceFile;
|
|
2385
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2386
|
+
let selectStatement = options.selectStatement;
|
|
2387
|
+
if (typeof selectStatement !== "string") {
|
|
2388
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2389
|
+
}
|
|
2390
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2391
|
+
throw new Error(
|
|
2392
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2393
|
+
);
|
|
2394
|
+
}
|
|
2395
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2396
|
+
requireTargetTableName(
|
|
2397
|
+
options.targetTable?.name ?? options.tableName
|
|
2398
|
+
),
|
|
2399
|
+
{
|
|
2400
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2401
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2402
|
+
},
|
|
2403
|
+
targetSchema,
|
|
2404
|
+
targetColumns
|
|
2405
|
+
);
|
|
2406
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2407
|
+
throw new Error(
|
|
2408
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2409
|
+
);
|
|
2410
|
+
}
|
|
2411
|
+
this.name = options.materializedViewName;
|
|
2412
|
+
this.targetTable = targetTable;
|
|
2413
|
+
this.selectSql = selectStatement;
|
|
2414
|
+
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2415
|
+
const stack = new Error().stack;
|
|
2416
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2417
|
+
const materializedViews = getMooseInternal().materializedViews;
|
|
2418
|
+
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2419
|
+
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2420
|
+
}
|
|
2421
|
+
materializedViews.set(this.name, this);
|
|
2422
|
+
}
|
|
2423
|
+
};
|
|
2424
|
+
|
|
2360
2425
|
// src/dmv2/sdk/sqlResource.ts
|
|
2361
2426
|
var SqlResource = class {
|
|
2362
2427
|
/** @internal */
|
|
@@ -2411,66 +2476,18 @@ var SqlResource = class {
|
|
|
2411
2476
|
}
|
|
2412
2477
|
};
|
|
2413
2478
|
|
|
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
|
-
|
|
2472
2479
|
// src/dmv2/sdk/view.ts
|
|
2473
|
-
var View = class
|
|
2480
|
+
var View = class {
|
|
2481
|
+
/** @internal */
|
|
2482
|
+
kind = "CustomView";
|
|
2483
|
+
/** The name of the view */
|
|
2484
|
+
name;
|
|
2485
|
+
/** The SELECT SQL statement that defines the view */
|
|
2486
|
+
selectSql;
|
|
2487
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
2488
|
+
sourceTables;
|
|
2489
|
+
/** @internal Source file path where this view was defined */
|
|
2490
|
+
sourceFile;
|
|
2474
2491
|
/**
|
|
2475
2492
|
* Creates a new View instance.
|
|
2476
2493
|
* @param name The name of the view to be created.
|
|
@@ -2481,17 +2498,16 @@ var View = class extends SqlResource {
|
|
|
2481
2498
|
if (typeof selectStatement !== "string") {
|
|
2482
2499
|
selectStatement = toStaticQuery(selectStatement);
|
|
2483
2500
|
}
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
{
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
);
|
|
2501
|
+
this.name = name;
|
|
2502
|
+
this.selectSql = selectStatement;
|
|
2503
|
+
this.sourceTables = baseTables.map((t) => t.name);
|
|
2504
|
+
const stack = new Error().stack;
|
|
2505
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2506
|
+
const customViews = getMooseInternal().customViews;
|
|
2507
|
+
if (!isClientOnlyMode() && customViews.has(this.name)) {
|
|
2508
|
+
throw new Error(`View with name ${this.name} already exists`);
|
|
2509
|
+
}
|
|
2510
|
+
customViews.set(this.name, this);
|
|
2495
2511
|
}
|
|
2496
2512
|
};
|
|
2497
2513
|
|