@514labs/moose-lib 0.6.266-ci-8-ge6e86870 → 0.6.266-ci-4-g819ca2bb
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-vY6tmKGn.d.ts → browserCompatible-CpjUXotI.d.ts} +1 -1
- package/dist/{browserCompatible-y8O70Ttx.d.mts → browserCompatible-fk6xPzoB.d.mts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +81 -85
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +81 -85
- 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 +81 -85
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +81 -85
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-DSzxmiN9.d.mts → index-Dd3ZmpTq.d.mts} +40 -60
- package/dist/{index-DSzxmiN9.d.ts → index-Dd3ZmpTq.d.ts} +40 -60
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +71 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -87
- 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
|
@@ -690,9 +690,7 @@ 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()
|
|
694
|
-
materializedViews: /* @__PURE__ */ new Map(),
|
|
695
|
-
customViews: /* @__PURE__ */ new Map()
|
|
693
|
+
webApps: /* @__PURE__ */ new Map()
|
|
696
694
|
};
|
|
697
695
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
698
696
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -708,8 +706,6 @@ var loadIndex = () => {
|
|
|
708
706
|
registry.sqlResources.clear();
|
|
709
707
|
registry.workflows.clear();
|
|
710
708
|
registry.webApps.clear();
|
|
711
|
-
registry.materializedViews.clear();
|
|
712
|
-
registry.customViews.clear();
|
|
713
709
|
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
714
710
|
Object.keys(__require.cache).forEach((key) => {
|
|
715
711
|
if (key.startsWith(appDir)) {
|
|
@@ -2354,67 +2350,6 @@ var ETLPipeline = class {
|
|
|
2354
2350
|
}
|
|
2355
2351
|
};
|
|
2356
2352
|
|
|
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
|
-
|
|
2418
2353
|
// src/dmv2/sdk/sqlResource.ts
|
|
2419
2354
|
var SqlResource = class {
|
|
2420
2355
|
/** @internal */
|
|
@@ -2469,18 +2404,66 @@ var SqlResource = class {
|
|
|
2469
2404
|
}
|
|
2470
2405
|
};
|
|
2471
2406
|
|
|
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
|
+
|
|
2472
2465
|
// src/dmv2/sdk/view.ts
|
|
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;
|
|
2466
|
+
var View = class extends SqlResource {
|
|
2484
2467
|
/**
|
|
2485
2468
|
* Creates a new View instance.
|
|
2486
2469
|
* @param name The name of the view to be created.
|
|
@@ -2491,16 +2474,17 @@ var View = class {
|
|
|
2491
2474
|
if (typeof selectStatement !== "string") {
|
|
2492
2475
|
selectStatement = toStaticQuery(selectStatement);
|
|
2493
2476
|
}
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2477
|
+
super(
|
|
2478
|
+
name,
|
|
2479
|
+
[
|
|
2480
|
+
`CREATE VIEW IF NOT EXISTS ${name}
|
|
2481
|
+
AS ${selectStatement}`.trim()
|
|
2482
|
+
],
|
|
2483
|
+
[dropView(name)],
|
|
2484
|
+
{
|
|
2485
|
+
pullsDataFrom: baseTables
|
|
2486
|
+
}
|
|
2487
|
+
);
|
|
2504
2488
|
}
|
|
2505
2489
|
};
|
|
2506
2490
|
|