@514labs/moose-lib 0.6.266-ci-2-g933b2685 → 0.6.266-ci-8-ge6e86870
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-CpjUXotI.d.ts → browserCompatible-vY6tmKGn.d.ts} +1 -1
- package/dist/{browserCompatible-fk6xPzoB.d.mts → browserCompatible-y8O70Ttx.d.mts} +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 +85 -81
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +85 -81
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-Dd3ZmpTq.d.mts → index-DSzxmiN9.d.mts} +60 -40
- package/dist/{index-Dd3ZmpTq.d.ts → index-DSzxmiN9.d.ts} +60 -40
- 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
|
@@ -690,7 +690,9 @@ var moose_internal = {
|
|
|
690
690
|
apis: /* @__PURE__ */ new Map(),
|
|
691
691
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
692
692
|
workflows: /* @__PURE__ */ new Map(),
|
|
693
|
-
webApps: /* @__PURE__ */ new Map()
|
|
693
|
+
webApps: /* @__PURE__ */ new Map(),
|
|
694
|
+
materializedViews: /* @__PURE__ */ new Map(),
|
|
695
|
+
customViews: /* @__PURE__ */ new Map()
|
|
694
696
|
};
|
|
695
697
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
696
698
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -706,6 +708,8 @@ var loadIndex = () => {
|
|
|
706
708
|
registry.sqlResources.clear();
|
|
707
709
|
registry.workflows.clear();
|
|
708
710
|
registry.webApps.clear();
|
|
711
|
+
registry.materializedViews.clear();
|
|
712
|
+
registry.customViews.clear();
|
|
709
713
|
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
710
714
|
Object.keys(__require.cache).forEach((key) => {
|
|
711
715
|
if (key.startsWith(appDir)) {
|
|
@@ -2350,6 +2354,67 @@ var ETLPipeline = class {
|
|
|
2350
2354
|
}
|
|
2351
2355
|
};
|
|
2352
2356
|
|
|
2357
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2358
|
+
var requireTargetTableName = (tableName) => {
|
|
2359
|
+
if (typeof tableName === "string") {
|
|
2360
|
+
return tableName;
|
|
2361
|
+
} else {
|
|
2362
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2363
|
+
}
|
|
2364
|
+
};
|
|
2365
|
+
var MaterializedView = class {
|
|
2366
|
+
/** @internal */
|
|
2367
|
+
kind = "MaterializedView";
|
|
2368
|
+
/** The name of the materialized view */
|
|
2369
|
+
name;
|
|
2370
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2371
|
+
targetTable;
|
|
2372
|
+
/** The SELECT SQL statement */
|
|
2373
|
+
selectSql;
|
|
2374
|
+
/** Names of source tables that the SELECT reads from */
|
|
2375
|
+
sourceTables;
|
|
2376
|
+
/** @internal Source file path where this MV was defined */
|
|
2377
|
+
sourceFile;
|
|
2378
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2379
|
+
let selectStatement = options.selectStatement;
|
|
2380
|
+
if (typeof selectStatement !== "string") {
|
|
2381
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2382
|
+
}
|
|
2383
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2384
|
+
throw new Error(
|
|
2385
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2386
|
+
);
|
|
2387
|
+
}
|
|
2388
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2389
|
+
requireTargetTableName(
|
|
2390
|
+
options.targetTable?.name ?? options.tableName
|
|
2391
|
+
),
|
|
2392
|
+
{
|
|
2393
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2394
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2395
|
+
},
|
|
2396
|
+
targetSchema,
|
|
2397
|
+
targetColumns
|
|
2398
|
+
);
|
|
2399
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2400
|
+
throw new Error(
|
|
2401
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2402
|
+
);
|
|
2403
|
+
}
|
|
2404
|
+
this.name = options.materializedViewName;
|
|
2405
|
+
this.targetTable = targetTable;
|
|
2406
|
+
this.selectSql = selectStatement;
|
|
2407
|
+
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2408
|
+
const stack = new Error().stack;
|
|
2409
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2410
|
+
const materializedViews = getMooseInternal().materializedViews;
|
|
2411
|
+
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2412
|
+
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2413
|
+
}
|
|
2414
|
+
materializedViews.set(this.name, this);
|
|
2415
|
+
}
|
|
2416
|
+
};
|
|
2417
|
+
|
|
2353
2418
|
// src/dmv2/sdk/sqlResource.ts
|
|
2354
2419
|
var SqlResource = class {
|
|
2355
2420
|
/** @internal */
|
|
@@ -2404,66 +2469,18 @@ var SqlResource = class {
|
|
|
2404
2469
|
}
|
|
2405
2470
|
};
|
|
2406
2471
|
|
|
2407
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2408
|
-
var requireTargetTableName = (tableName) => {
|
|
2409
|
-
if (typeof tableName === "string") {
|
|
2410
|
-
return tableName;
|
|
2411
|
-
} else {
|
|
2412
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2413
|
-
}
|
|
2414
|
-
};
|
|
2415
|
-
var MaterializedView = class extends SqlResource {
|
|
2416
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2417
|
-
targetTable;
|
|
2418
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2419
|
-
let selectStatement = options.selectStatement;
|
|
2420
|
-
if (typeof selectStatement !== "string") {
|
|
2421
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2422
|
-
}
|
|
2423
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2424
|
-
throw new Error(
|
|
2425
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2426
|
-
);
|
|
2427
|
-
}
|
|
2428
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2429
|
-
requireTargetTableName(
|
|
2430
|
-
options.targetTable?.name ?? options.tableName
|
|
2431
|
-
),
|
|
2432
|
-
{
|
|
2433
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2434
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2435
|
-
},
|
|
2436
|
-
targetSchema,
|
|
2437
|
-
targetColumns
|
|
2438
|
-
);
|
|
2439
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2440
|
-
throw new Error(
|
|
2441
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2442
|
-
);
|
|
2443
|
-
}
|
|
2444
|
-
super(
|
|
2445
|
-
options.materializedViewName,
|
|
2446
|
-
[
|
|
2447
|
-
createMaterializedView({
|
|
2448
|
-
name: options.materializedViewName,
|
|
2449
|
-
destinationTable: targetTable.name,
|
|
2450
|
-
select: selectStatement
|
|
2451
|
-
})
|
|
2452
|
-
// Population is now handled automatically by Rust infrastructure
|
|
2453
|
-
// based on table engine type and whether this is a new or updated view
|
|
2454
|
-
],
|
|
2455
|
-
[dropView(options.materializedViewName)],
|
|
2456
|
-
{
|
|
2457
|
-
pullsDataFrom: options.selectTables,
|
|
2458
|
-
pushesDataTo: [targetTable]
|
|
2459
|
-
}
|
|
2460
|
-
);
|
|
2461
|
-
this.targetTable = targetTable;
|
|
2462
|
-
}
|
|
2463
|
-
};
|
|
2464
|
-
|
|
2465
2472
|
// src/dmv2/sdk/view.ts
|
|
2466
|
-
var View = class
|
|
2473
|
+
var View = class {
|
|
2474
|
+
/** @internal */
|
|
2475
|
+
kind = "CustomView";
|
|
2476
|
+
/** The name of the view */
|
|
2477
|
+
name;
|
|
2478
|
+
/** The SELECT SQL statement that defines the view */
|
|
2479
|
+
selectSql;
|
|
2480
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
2481
|
+
sourceTables;
|
|
2482
|
+
/** @internal Source file path where this view was defined */
|
|
2483
|
+
sourceFile;
|
|
2467
2484
|
/**
|
|
2468
2485
|
* Creates a new View instance.
|
|
2469
2486
|
* @param name The name of the view to be created.
|
|
@@ -2474,17 +2491,16 @@ var View = class extends SqlResource {
|
|
|
2474
2491
|
if (typeof selectStatement !== "string") {
|
|
2475
2492
|
selectStatement = toStaticQuery(selectStatement);
|
|
2476
2493
|
}
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
{
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
);
|
|
2494
|
+
this.name = name;
|
|
2495
|
+
this.selectSql = selectStatement;
|
|
2496
|
+
this.sourceTables = baseTables.map((t) => t.name);
|
|
2497
|
+
const stack = new Error().stack;
|
|
2498
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2499
|
+
const customViews = getMooseInternal().customViews;
|
|
2500
|
+
if (!isClientOnlyMode() && customViews.has(this.name)) {
|
|
2501
|
+
throw new Error(`View with name ${this.name} already exists`);
|
|
2502
|
+
}
|
|
2503
|
+
customViews.set(this.name, this);
|
|
2488
2504
|
}
|
|
2489
2505
|
};
|
|
2490
2506
|
|