@514labs/moose-lib 0.6.288 → 0.6.289-ci-9-g221fb3d9
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-DCCiBirg.d.mts} +1 -1
- package/dist/{browserCompatible-BUKAJYbj.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 +115 -86
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +111 -86
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/compilerPlugin.js +4 -1
- package/dist/compilerPlugin.js.map +1 -1
- package/dist/compilerPlugin.mjs +5 -1
- package/dist/compilerPlugin.mjs.map +1 -1
- package/dist/dataModels/toDataModels.js +4 -1
- package/dist/dataModels/toDataModels.js.map +1 -1
- package/dist/dataModels/toDataModels.mjs +5 -1
- package/dist/dataModels/toDataModels.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 +115 -86
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +111 -86
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-BtkwFbT9.d.mts → index-CcZRaA0b.d.mts} +84 -41
- package/dist/{index-BtkwFbT9.d.ts → index-CcZRaA0b.d.ts} +84 -41
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +117 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -76
- 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)) {
|
|
@@ -798,7 +802,8 @@ var dlqColumns = [
|
|
|
798
802
|
annotations: [],
|
|
799
803
|
ttl: null,
|
|
800
804
|
codec: null,
|
|
801
|
-
materialized: null
|
|
805
|
+
materialized: null,
|
|
806
|
+
comment: null
|
|
802
807
|
},
|
|
803
808
|
{
|
|
804
809
|
name: "errorMessage",
|
|
@@ -810,7 +815,8 @@ var dlqColumns = [
|
|
|
810
815
|
annotations: [],
|
|
811
816
|
ttl: null,
|
|
812
817
|
codec: null,
|
|
813
|
-
materialized: null
|
|
818
|
+
materialized: null,
|
|
819
|
+
comment: null
|
|
814
820
|
},
|
|
815
821
|
{
|
|
816
822
|
name: "errorType",
|
|
@@ -822,7 +828,8 @@ var dlqColumns = [
|
|
|
822
828
|
annotations: [],
|
|
823
829
|
ttl: null,
|
|
824
830
|
codec: null,
|
|
825
|
-
materialized: null
|
|
831
|
+
materialized: null,
|
|
832
|
+
comment: null
|
|
826
833
|
},
|
|
827
834
|
{
|
|
828
835
|
name: "failedAt",
|
|
@@ -834,7 +841,8 @@ var dlqColumns = [
|
|
|
834
841
|
annotations: [],
|
|
835
842
|
ttl: null,
|
|
836
843
|
codec: null,
|
|
837
|
-
materialized: null
|
|
844
|
+
materialized: null,
|
|
845
|
+
comment: null
|
|
838
846
|
},
|
|
839
847
|
{
|
|
840
848
|
name: "source",
|
|
@@ -846,7 +854,8 @@ var dlqColumns = [
|
|
|
846
854
|
annotations: [],
|
|
847
855
|
ttl: null,
|
|
848
856
|
codec: null,
|
|
849
|
-
materialized: null
|
|
857
|
+
materialized: null,
|
|
858
|
+
comment: null
|
|
850
859
|
}
|
|
851
860
|
];
|
|
852
861
|
var getWorkflows = async () => {
|
|
@@ -2357,6 +2366,67 @@ var ETLPipeline = class {
|
|
|
2357
2366
|
}
|
|
2358
2367
|
};
|
|
2359
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
|
+
|
|
2360
2430
|
// src/dmv2/sdk/sqlResource.ts
|
|
2361
2431
|
var SqlResource = class {
|
|
2362
2432
|
/** @internal */
|
|
@@ -2411,66 +2481,18 @@ var SqlResource = class {
|
|
|
2411
2481
|
}
|
|
2412
2482
|
};
|
|
2413
2483
|
|
|
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
2484
|
// src/dmv2/sdk/view.ts
|
|
2473
|
-
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;
|
|
2474
2496
|
/**
|
|
2475
2497
|
* Creates a new View instance.
|
|
2476
2498
|
* @param name The name of the view to be created.
|
|
@@ -2481,17 +2503,16 @@ var View = class extends SqlResource {
|
|
|
2481
2503
|
if (typeof selectStatement !== "string") {
|
|
2482
2504
|
selectStatement = toStaticQuery(selectStatement);
|
|
2483
2505
|
}
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
{
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
);
|
|
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);
|
|
2495
2516
|
}
|
|
2496
2517
|
};
|
|
2497
2518
|
|
|
@@ -2680,6 +2701,18 @@ function getWebApps() {
|
|
|
2680
2701
|
function getWebApp(name) {
|
|
2681
2702
|
return getMooseInternal().webApps.get(name);
|
|
2682
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
|
+
}
|
|
2683
2716
|
|
|
2684
2717
|
// src/index.ts
|
|
2685
2718
|
init_commons();
|
|
@@ -3381,11 +3414,15 @@ export {
|
|
|
3381
3414
|
getApi,
|
|
3382
3415
|
getApis,
|
|
3383
3416
|
getClickhouseClient,
|
|
3417
|
+
getCustomView,
|
|
3418
|
+
getCustomViews,
|
|
3384
3419
|
getFileName,
|
|
3385
3420
|
getIngestApi,
|
|
3386
3421
|
getIngestApis,
|
|
3387
3422
|
getKafkaClient,
|
|
3388
3423
|
getKafkaProducer,
|
|
3424
|
+
getMaterializedView,
|
|
3425
|
+
getMaterializedViews,
|
|
3389
3426
|
getMooseClients,
|
|
3390
3427
|
getMooseUtils,
|
|
3391
3428
|
getSqlResource,
|