@514labs/moose-lib 0.6.279-ci-9-gaf2329aa → 0.6.279-ci-13-g512ec2c0
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
|
@@ -692,7 +692,9 @@ var moose_internal = {
|
|
|
692
692
|
apis: /* @__PURE__ */ new Map(),
|
|
693
693
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
694
694
|
workflows: /* @__PURE__ */ new Map(),
|
|
695
|
-
webApps: /* @__PURE__ */ new Map()
|
|
695
|
+
webApps: /* @__PURE__ */ new Map(),
|
|
696
|
+
materializedViews: /* @__PURE__ */ new Map(),
|
|
697
|
+
customViews: /* @__PURE__ */ new Map()
|
|
696
698
|
};
|
|
697
699
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
698
700
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -708,6 +710,8 @@ var loadIndex = () => {
|
|
|
708
710
|
registry.sqlResources.clear();
|
|
709
711
|
registry.workflows.clear();
|
|
710
712
|
registry.webApps.clear();
|
|
713
|
+
registry.materializedViews.clear();
|
|
714
|
+
registry.customViews.clear();
|
|
711
715
|
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
712
716
|
Object.keys(__require.cache).forEach((key) => {
|
|
713
717
|
if (key.startsWith(appDir)) {
|
|
@@ -2354,6 +2358,67 @@ var ETLPipeline = class {
|
|
|
2354
2358
|
}
|
|
2355
2359
|
};
|
|
2356
2360
|
|
|
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
|
+
|
|
2357
2422
|
// src/dmv2/sdk/sqlResource.ts
|
|
2358
2423
|
var SqlResource = class {
|
|
2359
2424
|
/** @internal */
|
|
@@ -2408,66 +2473,18 @@ var SqlResource = class {
|
|
|
2408
2473
|
}
|
|
2409
2474
|
};
|
|
2410
2475
|
|
|
2411
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2412
|
-
var requireTargetTableName = (tableName) => {
|
|
2413
|
-
if (typeof tableName === "string") {
|
|
2414
|
-
return tableName;
|
|
2415
|
-
} else {
|
|
2416
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2417
|
-
}
|
|
2418
|
-
};
|
|
2419
|
-
var MaterializedView = class extends SqlResource {
|
|
2420
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2421
|
-
targetTable;
|
|
2422
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2423
|
-
let selectStatement = options.selectStatement;
|
|
2424
|
-
if (typeof selectStatement !== "string") {
|
|
2425
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2426
|
-
}
|
|
2427
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2428
|
-
throw new Error(
|
|
2429
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2430
|
-
);
|
|
2431
|
-
}
|
|
2432
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2433
|
-
requireTargetTableName(
|
|
2434
|
-
options.targetTable?.name ?? options.tableName
|
|
2435
|
-
),
|
|
2436
|
-
{
|
|
2437
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2438
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2439
|
-
},
|
|
2440
|
-
targetSchema,
|
|
2441
|
-
targetColumns
|
|
2442
|
-
);
|
|
2443
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2444
|
-
throw new Error(
|
|
2445
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2446
|
-
);
|
|
2447
|
-
}
|
|
2448
|
-
super(
|
|
2449
|
-
options.materializedViewName,
|
|
2450
|
-
[
|
|
2451
|
-
createMaterializedView({
|
|
2452
|
-
name: options.materializedViewName,
|
|
2453
|
-
destinationTable: targetTable.name,
|
|
2454
|
-
select: selectStatement
|
|
2455
|
-
})
|
|
2456
|
-
// Population is now handled automatically by Rust infrastructure
|
|
2457
|
-
// based on table engine type and whether this is a new or updated view
|
|
2458
|
-
],
|
|
2459
|
-
[dropView(options.materializedViewName)],
|
|
2460
|
-
{
|
|
2461
|
-
pullsDataFrom: options.selectTables,
|
|
2462
|
-
pushesDataTo: [targetTable]
|
|
2463
|
-
}
|
|
2464
|
-
);
|
|
2465
|
-
this.targetTable = targetTable;
|
|
2466
|
-
}
|
|
2467
|
-
};
|
|
2468
|
-
|
|
2469
2476
|
// src/dmv2/sdk/view.ts
|
|
2470
|
-
var View = class
|
|
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;
|
|
2471
2488
|
/**
|
|
2472
2489
|
* Creates a new View instance.
|
|
2473
2490
|
* @param name The name of the view to be created.
|
|
@@ -2478,17 +2495,16 @@ var View = class extends SqlResource {
|
|
|
2478
2495
|
if (typeof selectStatement !== "string") {
|
|
2479
2496
|
selectStatement = toStaticQuery(selectStatement);
|
|
2480
2497
|
}
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
{
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
);
|
|
2498
|
+
this.name = name;
|
|
2499
|
+
this.selectSql = selectStatement;
|
|
2500
|
+
this.sourceTables = baseTables.map((t) => t.name);
|
|
2501
|
+
const stack = new Error().stack;
|
|
2502
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2503
|
+
const customViews = getMooseInternal().customViews;
|
|
2504
|
+
if (!isClientOnlyMode() && customViews.has(this.name)) {
|
|
2505
|
+
throw new Error(`View with name ${this.name} already exists`);
|
|
2506
|
+
}
|
|
2507
|
+
customViews.set(this.name, this);
|
|
2492
2508
|
}
|
|
2493
2509
|
};
|
|
2494
2510
|
|