@514labs/moose-lib 0.6.279-ci-5-g982a1dc0 → 0.6.279-ci-3-g3edfe2f6
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 +94 -93
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +94 -93
- 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 +114 -93
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +110 -93
- 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 +96 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -83
- 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
|
@@ -362,13 +362,10 @@ var init_runtime = __esm({
|
|
|
362
362
|
// src/dmv2/utils/stackTrace.ts
|
|
363
363
|
function shouldSkipStackLine(line) {
|
|
364
364
|
return line.includes("node_modules") || // Skip npm installed packages (prod)
|
|
365
|
-
line.includes("
|
|
366
|
-
line.includes("internal/modules") || // Skip Node.js internals (older format)
|
|
365
|
+
line.includes("internal/modules") || // Skip Node.js internals
|
|
367
366
|
line.includes("ts-node") || // Skip TypeScript execution
|
|
368
|
-
line.includes("/ts-moose-lib/
|
|
369
|
-
line.includes("\\ts-moose-lib\\
|
|
370
|
-
line.includes("/ts-moose-lib/dist/") || // Skip dev/linked moose-lib dist (Unix)
|
|
371
|
-
line.includes("\\ts-moose-lib\\dist\\");
|
|
367
|
+
line.includes("/ts-moose-lib/") || // Skip dev/linked moose-lib (Unix)
|
|
368
|
+
line.includes("\\ts-moose-lib\\");
|
|
372
369
|
}
|
|
373
370
|
function parseStackLine(line) {
|
|
374
371
|
const match = line.match(/\((.*):(\d+):(\d+)\)/) || line.match(/at (.*):(\d+):(\d+)/);
|
|
@@ -471,12 +468,12 @@ var TypedBase = class {
|
|
|
471
468
|
this.validators = validators;
|
|
472
469
|
this.allowExtraFields = allowExtraFields ?? false;
|
|
473
470
|
this.metadata = config?.metadata ? { ...config.metadata } : {};
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
471
|
+
const stack = new Error().stack;
|
|
472
|
+
if (stack) {
|
|
473
|
+
const info = getSourceFileInfo(stack);
|
|
474
|
+
this.metadata.source = { file: info.file, line: info.line };
|
|
475
|
+
} else {
|
|
476
|
+
this.metadata.source = void 0;
|
|
480
477
|
}
|
|
481
478
|
}
|
|
482
479
|
};
|
|
@@ -639,16 +636,6 @@ function emptyIfUndefined(value) {
|
|
|
639
636
|
return value === void 0 ? "" : value;
|
|
640
637
|
}
|
|
641
638
|
|
|
642
|
-
// src/blocks/helpers.ts
|
|
643
|
-
function dropView(name) {
|
|
644
|
-
return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
|
|
645
|
-
}
|
|
646
|
-
function createMaterializedView(options) {
|
|
647
|
-
return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
|
|
648
|
-
TO ${quoteIdentifier(options.destinationTable)}
|
|
649
|
-
AS ${options.select}`.trim();
|
|
650
|
-
}
|
|
651
|
-
|
|
652
639
|
// src/dmv2/internal.ts
|
|
653
640
|
import process2 from "process";
|
|
654
641
|
|
|
@@ -702,7 +689,9 @@ var moose_internal = {
|
|
|
702
689
|
apis: /* @__PURE__ */ new Map(),
|
|
703
690
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
704
691
|
workflows: /* @__PURE__ */ new Map(),
|
|
705
|
-
webApps: /* @__PURE__ */ new Map()
|
|
692
|
+
webApps: /* @__PURE__ */ new Map(),
|
|
693
|
+
materializedViews: /* @__PURE__ */ new Map(),
|
|
694
|
+
customViews: /* @__PURE__ */ new Map()
|
|
706
695
|
};
|
|
707
696
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
708
697
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -2331,6 +2320,67 @@ var ETLPipeline = class {
|
|
|
2331
2320
|
}
|
|
2332
2321
|
};
|
|
2333
2322
|
|
|
2323
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2324
|
+
var requireTargetTableName = (tableName) => {
|
|
2325
|
+
if (typeof tableName === "string") {
|
|
2326
|
+
return tableName;
|
|
2327
|
+
} else {
|
|
2328
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2329
|
+
}
|
|
2330
|
+
};
|
|
2331
|
+
var MaterializedView = class {
|
|
2332
|
+
/** @internal */
|
|
2333
|
+
kind = "MaterializedView";
|
|
2334
|
+
/** The name of the materialized view */
|
|
2335
|
+
name;
|
|
2336
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2337
|
+
targetTable;
|
|
2338
|
+
/** The SELECT SQL statement */
|
|
2339
|
+
selectSql;
|
|
2340
|
+
/** Names of source tables that the SELECT reads from */
|
|
2341
|
+
sourceTables;
|
|
2342
|
+
/** @internal Source file path where this MV was defined */
|
|
2343
|
+
sourceFile;
|
|
2344
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2345
|
+
let selectStatement = options.selectStatement;
|
|
2346
|
+
if (typeof selectStatement !== "string") {
|
|
2347
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2348
|
+
}
|
|
2349
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2350
|
+
throw new Error(
|
|
2351
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2352
|
+
);
|
|
2353
|
+
}
|
|
2354
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2355
|
+
requireTargetTableName(
|
|
2356
|
+
options.targetTable?.name ?? options.tableName
|
|
2357
|
+
),
|
|
2358
|
+
{
|
|
2359
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2360
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2361
|
+
},
|
|
2362
|
+
targetSchema,
|
|
2363
|
+
targetColumns
|
|
2364
|
+
);
|
|
2365
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2366
|
+
throw new Error(
|
|
2367
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2368
|
+
);
|
|
2369
|
+
}
|
|
2370
|
+
this.name = options.materializedViewName;
|
|
2371
|
+
this.targetTable = targetTable;
|
|
2372
|
+
this.selectSql = selectStatement;
|
|
2373
|
+
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2374
|
+
const stack = new Error().stack;
|
|
2375
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2376
|
+
const materializedViews = getMooseInternal().materializedViews;
|
|
2377
|
+
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2378
|
+
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2379
|
+
}
|
|
2380
|
+
materializedViews.set(this.name, this);
|
|
2381
|
+
}
|
|
2382
|
+
};
|
|
2383
|
+
|
|
2334
2384
|
// src/dmv2/sdk/sqlResource.ts
|
|
2335
2385
|
var SqlResource = class {
|
|
2336
2386
|
/** @internal */
|
|
@@ -2385,66 +2435,18 @@ var SqlResource = class {
|
|
|
2385
2435
|
}
|
|
2386
2436
|
};
|
|
2387
2437
|
|
|
2388
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2389
|
-
var requireTargetTableName = (tableName) => {
|
|
2390
|
-
if (typeof tableName === "string") {
|
|
2391
|
-
return tableName;
|
|
2392
|
-
} else {
|
|
2393
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2394
|
-
}
|
|
2395
|
-
};
|
|
2396
|
-
var MaterializedView = class extends SqlResource {
|
|
2397
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2398
|
-
targetTable;
|
|
2399
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2400
|
-
let selectStatement = options.selectStatement;
|
|
2401
|
-
if (typeof selectStatement !== "string") {
|
|
2402
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2403
|
-
}
|
|
2404
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2405
|
-
throw new Error(
|
|
2406
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2407
|
-
);
|
|
2408
|
-
}
|
|
2409
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2410
|
-
requireTargetTableName(
|
|
2411
|
-
options.targetTable?.name ?? options.tableName
|
|
2412
|
-
),
|
|
2413
|
-
{
|
|
2414
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2415
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2416
|
-
},
|
|
2417
|
-
targetSchema,
|
|
2418
|
-
targetColumns
|
|
2419
|
-
);
|
|
2420
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2421
|
-
throw new Error(
|
|
2422
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2423
|
-
);
|
|
2424
|
-
}
|
|
2425
|
-
super(
|
|
2426
|
-
options.materializedViewName,
|
|
2427
|
-
[
|
|
2428
|
-
createMaterializedView({
|
|
2429
|
-
name: options.materializedViewName,
|
|
2430
|
-
destinationTable: targetTable.name,
|
|
2431
|
-
select: selectStatement
|
|
2432
|
-
})
|
|
2433
|
-
// Population is now handled automatically by Rust infrastructure
|
|
2434
|
-
// based on table engine type and whether this is a new or updated view
|
|
2435
|
-
],
|
|
2436
|
-
[dropView(options.materializedViewName)],
|
|
2437
|
-
{
|
|
2438
|
-
pullsDataFrom: options.selectTables,
|
|
2439
|
-
pushesDataTo: [targetTable]
|
|
2440
|
-
}
|
|
2441
|
-
);
|
|
2442
|
-
this.targetTable = targetTable;
|
|
2443
|
-
}
|
|
2444
|
-
};
|
|
2445
|
-
|
|
2446
2438
|
// src/dmv2/sdk/view.ts
|
|
2447
|
-
var View = class
|
|
2439
|
+
var View = class {
|
|
2440
|
+
/** @internal */
|
|
2441
|
+
kind = "CustomView";
|
|
2442
|
+
/** The name of the view */
|
|
2443
|
+
name;
|
|
2444
|
+
/** The SELECT SQL statement that defines the view */
|
|
2445
|
+
selectSql;
|
|
2446
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
2447
|
+
sourceTables;
|
|
2448
|
+
/** @internal Source file path where this view was defined */
|
|
2449
|
+
sourceFile;
|
|
2448
2450
|
/**
|
|
2449
2451
|
* Creates a new View instance.
|
|
2450
2452
|
* @param name The name of the view to be created.
|
|
@@ -2455,17 +2457,16 @@ var View = class extends SqlResource {
|
|
|
2455
2457
|
if (typeof selectStatement !== "string") {
|
|
2456
2458
|
selectStatement = toStaticQuery(selectStatement);
|
|
2457
2459
|
}
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
{
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
);
|
|
2460
|
+
this.name = name;
|
|
2461
|
+
this.selectSql = selectStatement;
|
|
2462
|
+
this.sourceTables = baseTables.map((t) => t.name);
|
|
2463
|
+
const stack = new Error().stack;
|
|
2464
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2465
|
+
const customViews = getMooseInternal().customViews;
|
|
2466
|
+
if (!isClientOnlyMode() && customViews.has(this.name)) {
|
|
2467
|
+
throw new Error(`View with name ${this.name} already exists`);
|
|
2468
|
+
}
|
|
2469
|
+
customViews.set(this.name, this);
|
|
2469
2470
|
}
|
|
2470
2471
|
};
|
|
2471
2472
|
|