@514labs/moose-lib 0.6.262-ci-2-g39e53084 → 0.6.262-ci-5-gf85ca97c
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-CC6Jamxn.d.ts → browserCompatible-BpwCKgGF.d.ts} +1 -1
- package/dist/{browserCompatible-GsBQtLKo.d.mts → browserCompatible-CDqMXtd_.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-B1HsstjQ.d.mts → index-B2jILcTY.d.mts} +56 -36
- package/dist/{index-B1HsstjQ.d.ts → index-B2jILcTY.d.ts} +56 -36
- 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
|
@@ -655,7 +655,9 @@ var moose_internal = {
|
|
|
655
655
|
apis: /* @__PURE__ */ new Map(),
|
|
656
656
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
657
657
|
workflows: /* @__PURE__ */ new Map(),
|
|
658
|
-
webApps: /* @__PURE__ */ new Map()
|
|
658
|
+
webApps: /* @__PURE__ */ new Map(),
|
|
659
|
+
materializedViews: /* @__PURE__ */ new Map(),
|
|
660
|
+
customViews: /* @__PURE__ */ new Map()
|
|
659
661
|
};
|
|
660
662
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
661
663
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -671,6 +673,8 @@ var loadIndex = () => {
|
|
|
671
673
|
registry.sqlResources.clear();
|
|
672
674
|
registry.workflows.clear();
|
|
673
675
|
registry.webApps.clear();
|
|
676
|
+
registry.materializedViews.clear();
|
|
677
|
+
registry.customViews.clear();
|
|
674
678
|
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
675
679
|
Object.keys(__require.cache).forEach((key) => {
|
|
676
680
|
if (key.startsWith(appDir)) {
|
|
@@ -2304,6 +2308,67 @@ var ETLPipeline = class {
|
|
|
2304
2308
|
}
|
|
2305
2309
|
};
|
|
2306
2310
|
|
|
2311
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2312
|
+
var requireTargetTableName = (tableName) => {
|
|
2313
|
+
if (typeof tableName === "string") {
|
|
2314
|
+
return tableName;
|
|
2315
|
+
} else {
|
|
2316
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2317
|
+
}
|
|
2318
|
+
};
|
|
2319
|
+
var MaterializedView = class {
|
|
2320
|
+
/** @internal */
|
|
2321
|
+
kind = "MaterializedView";
|
|
2322
|
+
/** The name of the materialized view */
|
|
2323
|
+
name;
|
|
2324
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2325
|
+
targetTable;
|
|
2326
|
+
/** The SELECT SQL statement */
|
|
2327
|
+
selectSql;
|
|
2328
|
+
/** Names of source tables that the SELECT reads from */
|
|
2329
|
+
sourceTables;
|
|
2330
|
+
/** @internal Source file path where this MV was defined */
|
|
2331
|
+
sourceFile;
|
|
2332
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2333
|
+
let selectStatement = options.selectStatement;
|
|
2334
|
+
if (typeof selectStatement !== "string") {
|
|
2335
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2336
|
+
}
|
|
2337
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2338
|
+
throw new Error(
|
|
2339
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2340
|
+
);
|
|
2341
|
+
}
|
|
2342
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2343
|
+
requireTargetTableName(
|
|
2344
|
+
options.targetTable?.name ?? options.tableName
|
|
2345
|
+
),
|
|
2346
|
+
{
|
|
2347
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2348
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2349
|
+
},
|
|
2350
|
+
targetSchema,
|
|
2351
|
+
targetColumns
|
|
2352
|
+
);
|
|
2353
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2354
|
+
throw new Error(
|
|
2355
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2356
|
+
);
|
|
2357
|
+
}
|
|
2358
|
+
this.name = options.materializedViewName;
|
|
2359
|
+
this.targetTable = targetTable;
|
|
2360
|
+
this.selectSql = selectStatement;
|
|
2361
|
+
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2362
|
+
const stack = new Error().stack;
|
|
2363
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2364
|
+
const materializedViews = getMooseInternal().materializedViews;
|
|
2365
|
+
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2366
|
+
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2367
|
+
}
|
|
2368
|
+
materializedViews.set(this.name, this);
|
|
2369
|
+
}
|
|
2370
|
+
};
|
|
2371
|
+
|
|
2307
2372
|
// src/dmv2/sdk/sqlResource.ts
|
|
2308
2373
|
var SqlResource = class {
|
|
2309
2374
|
/** @internal */
|
|
@@ -2349,66 +2414,18 @@ var SqlResource = class {
|
|
|
2349
2414
|
}
|
|
2350
2415
|
};
|
|
2351
2416
|
|
|
2352
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2353
|
-
var requireTargetTableName = (tableName) => {
|
|
2354
|
-
if (typeof tableName === "string") {
|
|
2355
|
-
return tableName;
|
|
2356
|
-
} else {
|
|
2357
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2358
|
-
}
|
|
2359
|
-
};
|
|
2360
|
-
var MaterializedView = class extends SqlResource {
|
|
2361
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2362
|
-
targetTable;
|
|
2363
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2364
|
-
let selectStatement = options.selectStatement;
|
|
2365
|
-
if (typeof selectStatement !== "string") {
|
|
2366
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2367
|
-
}
|
|
2368
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2369
|
-
throw new Error(
|
|
2370
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2371
|
-
);
|
|
2372
|
-
}
|
|
2373
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2374
|
-
requireTargetTableName(
|
|
2375
|
-
options.targetTable?.name ?? options.tableName
|
|
2376
|
-
),
|
|
2377
|
-
{
|
|
2378
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2379
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2380
|
-
},
|
|
2381
|
-
targetSchema,
|
|
2382
|
-
targetColumns
|
|
2383
|
-
);
|
|
2384
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2385
|
-
throw new Error(
|
|
2386
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2387
|
-
);
|
|
2388
|
-
}
|
|
2389
|
-
super(
|
|
2390
|
-
options.materializedViewName,
|
|
2391
|
-
[
|
|
2392
|
-
createMaterializedView({
|
|
2393
|
-
name: options.materializedViewName,
|
|
2394
|
-
destinationTable: targetTable.name,
|
|
2395
|
-
select: selectStatement
|
|
2396
|
-
})
|
|
2397
|
-
// Population is now handled automatically by Rust infrastructure
|
|
2398
|
-
// based on table engine type and whether this is a new or updated view
|
|
2399
|
-
],
|
|
2400
|
-
[dropView(options.materializedViewName)],
|
|
2401
|
-
{
|
|
2402
|
-
pullsDataFrom: options.selectTables,
|
|
2403
|
-
pushesDataTo: [targetTable]
|
|
2404
|
-
}
|
|
2405
|
-
);
|
|
2406
|
-
this.targetTable = targetTable;
|
|
2407
|
-
}
|
|
2408
|
-
};
|
|
2409
|
-
|
|
2410
2417
|
// src/dmv2/sdk/view.ts
|
|
2411
|
-
var View = class
|
|
2418
|
+
var View = class {
|
|
2419
|
+
/** @internal */
|
|
2420
|
+
kind = "CustomView";
|
|
2421
|
+
/** The name of the view */
|
|
2422
|
+
name;
|
|
2423
|
+
/** The SELECT SQL statement that defines the view */
|
|
2424
|
+
selectSql;
|
|
2425
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
2426
|
+
sourceTables;
|
|
2427
|
+
/** @internal Source file path where this view was defined */
|
|
2428
|
+
sourceFile;
|
|
2412
2429
|
/**
|
|
2413
2430
|
* Creates a new View instance.
|
|
2414
2431
|
* @param name The name of the view to be created.
|
|
@@ -2419,17 +2436,16 @@ var View = class extends SqlResource {
|
|
|
2419
2436
|
if (typeof selectStatement !== "string") {
|
|
2420
2437
|
selectStatement = toStaticQuery(selectStatement);
|
|
2421
2438
|
}
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
{
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
);
|
|
2439
|
+
this.name = name;
|
|
2440
|
+
this.selectSql = selectStatement;
|
|
2441
|
+
this.sourceTables = baseTables.map((t) => t.name);
|
|
2442
|
+
const stack = new Error().stack;
|
|
2443
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2444
|
+
const customViews = getMooseInternal().customViews;
|
|
2445
|
+
if (!isClientOnlyMode() && customViews.has(this.name)) {
|
|
2446
|
+
throw new Error(`View with name ${this.name} already exists`);
|
|
2447
|
+
}
|
|
2448
|
+
customViews.set(this.name, this);
|
|
2433
2449
|
}
|
|
2434
2450
|
};
|
|
2435
2451
|
|