@514labs/moose-lib 0.6.292 → 0.6.293-ci-14-g63acc348
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-ChWHzgtb.d.mts → browserCompatible-DCCiBirg.d.mts} +1 -1
- package/dist/{browserCompatible-B8CAYjv5.d.ts → browserCompatible-DhVPp9qX.d.ts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +105 -81
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +101 -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-rQOQo9sv.d.mts → index-CcZRaA0b.d.mts} +83 -41
- package/dist/{index-rQOQo9sv.d.ts → index-CcZRaA0b.d.ts} +83 -41
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +107 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -71
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +31 -3
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +31 -3
- 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)) {
|
|
@@ -2362,6 +2366,67 @@ var ETLPipeline = class {
|
|
|
2362
2366
|
}
|
|
2363
2367
|
};
|
|
2364
2368
|
|
|
2369
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2370
|
+
var requireTargetTableName = (tableName) => {
|
|
2371
|
+
if (typeof tableName === "string") {
|
|
2372
|
+
return tableName;
|
|
2373
|
+
} else {
|
|
2374
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2375
|
+
}
|
|
2376
|
+
};
|
|
2377
|
+
var MaterializedView = class {
|
|
2378
|
+
/** @internal */
|
|
2379
|
+
kind = "MaterializedView";
|
|
2380
|
+
/** The name of the materialized view */
|
|
2381
|
+
name;
|
|
2382
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2383
|
+
targetTable;
|
|
2384
|
+
/** The SELECT SQL statement */
|
|
2385
|
+
selectSql;
|
|
2386
|
+
/** Names of source tables that the SELECT reads from */
|
|
2387
|
+
sourceTables;
|
|
2388
|
+
/** @internal Source file path where this MV was defined */
|
|
2389
|
+
sourceFile;
|
|
2390
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2391
|
+
let selectStatement = options.selectStatement;
|
|
2392
|
+
if (typeof selectStatement !== "string") {
|
|
2393
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2394
|
+
}
|
|
2395
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2396
|
+
throw new Error(
|
|
2397
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2398
|
+
);
|
|
2399
|
+
}
|
|
2400
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2401
|
+
requireTargetTableName(
|
|
2402
|
+
options.targetTable?.name ?? options.tableName
|
|
2403
|
+
),
|
|
2404
|
+
{
|
|
2405
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2406
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2407
|
+
},
|
|
2408
|
+
targetSchema,
|
|
2409
|
+
targetColumns
|
|
2410
|
+
);
|
|
2411
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2412
|
+
throw new Error(
|
|
2413
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2414
|
+
);
|
|
2415
|
+
}
|
|
2416
|
+
this.name = options.materializedViewName;
|
|
2417
|
+
this.targetTable = targetTable;
|
|
2418
|
+
this.selectSql = selectStatement;
|
|
2419
|
+
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2420
|
+
const stack = new Error().stack;
|
|
2421
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2422
|
+
const materializedViews = getMooseInternal().materializedViews;
|
|
2423
|
+
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2424
|
+
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2425
|
+
}
|
|
2426
|
+
materializedViews.set(this.name, this);
|
|
2427
|
+
}
|
|
2428
|
+
};
|
|
2429
|
+
|
|
2365
2430
|
// src/dmv2/sdk/sqlResource.ts
|
|
2366
2431
|
var SqlResource = class {
|
|
2367
2432
|
/** @internal */
|
|
@@ -2416,66 +2481,18 @@ var SqlResource = class {
|
|
|
2416
2481
|
}
|
|
2417
2482
|
};
|
|
2418
2483
|
|
|
2419
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2420
|
-
var requireTargetTableName = (tableName) => {
|
|
2421
|
-
if (typeof tableName === "string") {
|
|
2422
|
-
return tableName;
|
|
2423
|
-
} else {
|
|
2424
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2425
|
-
}
|
|
2426
|
-
};
|
|
2427
|
-
var MaterializedView = class extends SqlResource {
|
|
2428
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2429
|
-
targetTable;
|
|
2430
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2431
|
-
let selectStatement = options.selectStatement;
|
|
2432
|
-
if (typeof selectStatement !== "string") {
|
|
2433
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2434
|
-
}
|
|
2435
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2436
|
-
throw new Error(
|
|
2437
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2438
|
-
);
|
|
2439
|
-
}
|
|
2440
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2441
|
-
requireTargetTableName(
|
|
2442
|
-
options.targetTable?.name ?? options.tableName
|
|
2443
|
-
),
|
|
2444
|
-
{
|
|
2445
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2446
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2447
|
-
},
|
|
2448
|
-
targetSchema,
|
|
2449
|
-
targetColumns
|
|
2450
|
-
);
|
|
2451
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2452
|
-
throw new Error(
|
|
2453
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2454
|
-
);
|
|
2455
|
-
}
|
|
2456
|
-
super(
|
|
2457
|
-
options.materializedViewName,
|
|
2458
|
-
[
|
|
2459
|
-
createMaterializedView({
|
|
2460
|
-
name: options.materializedViewName,
|
|
2461
|
-
destinationTable: targetTable.name,
|
|
2462
|
-
select: selectStatement
|
|
2463
|
-
})
|
|
2464
|
-
// Population is now handled automatically by Rust infrastructure
|
|
2465
|
-
// based on table engine type and whether this is a new or updated view
|
|
2466
|
-
],
|
|
2467
|
-
[dropView(options.materializedViewName)],
|
|
2468
|
-
{
|
|
2469
|
-
pullsDataFrom: options.selectTables,
|
|
2470
|
-
pushesDataTo: [targetTable]
|
|
2471
|
-
}
|
|
2472
|
-
);
|
|
2473
|
-
this.targetTable = targetTable;
|
|
2474
|
-
}
|
|
2475
|
-
};
|
|
2476
|
-
|
|
2477
2484
|
// src/dmv2/sdk/view.ts
|
|
2478
|
-
var View = class
|
|
2485
|
+
var View = class {
|
|
2486
|
+
/** @internal */
|
|
2487
|
+
kind = "CustomView";
|
|
2488
|
+
/** The name of the view */
|
|
2489
|
+
name;
|
|
2490
|
+
/** The SELECT SQL statement that defines the view */
|
|
2491
|
+
selectSql;
|
|
2492
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
2493
|
+
sourceTables;
|
|
2494
|
+
/** @internal Source file path where this view was defined */
|
|
2495
|
+
sourceFile;
|
|
2479
2496
|
/**
|
|
2480
2497
|
* Creates a new View instance.
|
|
2481
2498
|
* @param name The name of the view to be created.
|
|
@@ -2486,17 +2503,16 @@ var View = class extends SqlResource {
|
|
|
2486
2503
|
if (typeof selectStatement !== "string") {
|
|
2487
2504
|
selectStatement = toStaticQuery(selectStatement);
|
|
2488
2505
|
}
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
{
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
);
|
|
2506
|
+
this.name = name;
|
|
2507
|
+
this.selectSql = selectStatement;
|
|
2508
|
+
this.sourceTables = baseTables.map((t) => t.name);
|
|
2509
|
+
const stack = new Error().stack;
|
|
2510
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2511
|
+
const customViews = getMooseInternal().customViews;
|
|
2512
|
+
if (!isClientOnlyMode() && customViews.has(this.name)) {
|
|
2513
|
+
throw new Error(`View with name ${this.name} already exists`);
|
|
2514
|
+
}
|
|
2515
|
+
customViews.set(this.name, this);
|
|
2500
2516
|
}
|
|
2501
2517
|
};
|
|
2502
2518
|
|
|
@@ -2685,6 +2701,18 @@ function getWebApps() {
|
|
|
2685
2701
|
function getWebApp(name) {
|
|
2686
2702
|
return getMooseInternal().webApps.get(name);
|
|
2687
2703
|
}
|
|
2704
|
+
function getMaterializedViews() {
|
|
2705
|
+
return getMooseInternal().materializedViews;
|
|
2706
|
+
}
|
|
2707
|
+
function getMaterializedView(name) {
|
|
2708
|
+
return getMooseInternal().materializedViews.get(name);
|
|
2709
|
+
}
|
|
2710
|
+
function getCustomViews() {
|
|
2711
|
+
return getMooseInternal().customViews;
|
|
2712
|
+
}
|
|
2713
|
+
function getCustomView(name) {
|
|
2714
|
+
return getMooseInternal().customViews.get(name);
|
|
2715
|
+
}
|
|
2688
2716
|
|
|
2689
2717
|
// src/index.ts
|
|
2690
2718
|
init_commons();
|
|
@@ -3386,11 +3414,15 @@ export {
|
|
|
3386
3414
|
getApi,
|
|
3387
3415
|
getApis,
|
|
3388
3416
|
getClickhouseClient,
|
|
3417
|
+
getCustomView,
|
|
3418
|
+
getCustomViews,
|
|
3389
3419
|
getFileName,
|
|
3390
3420
|
getIngestApi,
|
|
3391
3421
|
getIngestApis,
|
|
3392
3422
|
getKafkaClient,
|
|
3393
3423
|
getKafkaProducer,
|
|
3424
|
+
getMaterializedView,
|
|
3425
|
+
getMaterializedViews,
|
|
3394
3426
|
getMooseClients,
|
|
3395
3427
|
getMooseUtils,
|
|
3396
3428
|
getSqlResource,
|