@514labs/moose-lib 0.6.262-ci-6-gd6cda938 → 0.6.262-ci-3-ge15fe9de
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-BpwCKgGF.d.ts → browserCompatible-CC6Jamxn.d.ts} +1 -1
- package/dist/{browserCompatible-CDqMXtd_.d.mts → browserCompatible-GsBQtLKo.d.mts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +86 -86
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +86 -86
- 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 +86 -86
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +86 -86
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-B2jILcTY.d.mts → index-B1HsstjQ.d.mts} +36 -56
- package/dist/{index-B2jILcTY.d.ts → index-B1HsstjQ.d.ts} +36 -56
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +76 -88
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -88
- 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
|
@@ -601,6 +601,16 @@ function emptyIfUndefined(value) {
|
|
|
601
601
|
return value === void 0 ? "" : value;
|
|
602
602
|
}
|
|
603
603
|
|
|
604
|
+
// src/blocks/helpers.ts
|
|
605
|
+
function dropView(name) {
|
|
606
|
+
return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
|
|
607
|
+
}
|
|
608
|
+
function createMaterializedView(options) {
|
|
609
|
+
return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
|
|
610
|
+
TO ${quoteIdentifier(options.destinationTable)}
|
|
611
|
+
AS ${options.select}`.trim();
|
|
612
|
+
}
|
|
613
|
+
|
|
604
614
|
// src/dmv2/internal.ts
|
|
605
615
|
import process2 from "process";
|
|
606
616
|
|
|
@@ -654,9 +664,7 @@ var moose_internal = {
|
|
|
654
664
|
apis: /* @__PURE__ */ new Map(),
|
|
655
665
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
656
666
|
workflows: /* @__PURE__ */ new Map(),
|
|
657
|
-
webApps: /* @__PURE__ */ new Map()
|
|
658
|
-
materializedViews: /* @__PURE__ */ new Map(),
|
|
659
|
-
customViews: /* @__PURE__ */ new Map()
|
|
667
|
+
webApps: /* @__PURE__ */ new Map()
|
|
660
668
|
};
|
|
661
669
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
662
670
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -2066,6 +2074,7 @@ var IngestPipeline = class extends TypedBase {
|
|
|
2066
2074
|
if (config.table) {
|
|
2067
2075
|
const tableConfig = typeof config.table === "object" ? {
|
|
2068
2076
|
...config.table,
|
|
2077
|
+
lifeCycle: config.table.lifeCycle ?? config.lifeCycle,
|
|
2069
2078
|
...config.version && { version: config.version }
|
|
2070
2079
|
} : {
|
|
2071
2080
|
lifeCycle: config.lifeCycle,
|
|
@@ -2096,7 +2105,10 @@ var IngestPipeline = class extends TypedBase {
|
|
|
2096
2105
|
const streamConfig = {
|
|
2097
2106
|
destination: this.table,
|
|
2098
2107
|
defaultDeadLetterQueue: this.deadLetterQueue,
|
|
2099
|
-
...typeof config.stream === "object" ?
|
|
2108
|
+
...typeof config.stream === "object" ? {
|
|
2109
|
+
...config.stream,
|
|
2110
|
+
lifeCycle: config.stream.lifeCycle ?? config.lifeCycle
|
|
2111
|
+
} : { lifeCycle: config.lifeCycle },
|
|
2100
2112
|
...config.version && { version: config.version }
|
|
2101
2113
|
};
|
|
2102
2114
|
this.stream = new Stream(
|
|
@@ -2272,67 +2284,6 @@ var ETLPipeline = class {
|
|
|
2272
2284
|
}
|
|
2273
2285
|
};
|
|
2274
2286
|
|
|
2275
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2276
|
-
var requireTargetTableName = (tableName) => {
|
|
2277
|
-
if (typeof tableName === "string") {
|
|
2278
|
-
return tableName;
|
|
2279
|
-
} else {
|
|
2280
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2281
|
-
}
|
|
2282
|
-
};
|
|
2283
|
-
var MaterializedView = class {
|
|
2284
|
-
/** @internal */
|
|
2285
|
-
kind = "MaterializedView";
|
|
2286
|
-
/** The name of the materialized view */
|
|
2287
|
-
name;
|
|
2288
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2289
|
-
targetTable;
|
|
2290
|
-
/** The SELECT SQL statement */
|
|
2291
|
-
selectSql;
|
|
2292
|
-
/** Names of source tables that the SELECT reads from */
|
|
2293
|
-
sourceTables;
|
|
2294
|
-
/** @internal Source file path where this MV was defined */
|
|
2295
|
-
sourceFile;
|
|
2296
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2297
|
-
let selectStatement = options.selectStatement;
|
|
2298
|
-
if (typeof selectStatement !== "string") {
|
|
2299
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2300
|
-
}
|
|
2301
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2302
|
-
throw new Error(
|
|
2303
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2304
|
-
);
|
|
2305
|
-
}
|
|
2306
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2307
|
-
requireTargetTableName(
|
|
2308
|
-
options.targetTable?.name ?? options.tableName
|
|
2309
|
-
),
|
|
2310
|
-
{
|
|
2311
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2312
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2313
|
-
},
|
|
2314
|
-
targetSchema,
|
|
2315
|
-
targetColumns
|
|
2316
|
-
);
|
|
2317
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2318
|
-
throw new Error(
|
|
2319
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2320
|
-
);
|
|
2321
|
-
}
|
|
2322
|
-
this.name = options.materializedViewName;
|
|
2323
|
-
this.targetTable = targetTable;
|
|
2324
|
-
this.selectSql = selectStatement;
|
|
2325
|
-
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2326
|
-
const stack = new Error().stack;
|
|
2327
|
-
this.sourceFile = getSourceFileFromStack(stack);
|
|
2328
|
-
const materializedViews = getMooseInternal().materializedViews;
|
|
2329
|
-
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2330
|
-
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2331
|
-
}
|
|
2332
|
-
materializedViews.set(this.name, this);
|
|
2333
|
-
}
|
|
2334
|
-
};
|
|
2335
|
-
|
|
2336
2287
|
// src/dmv2/sdk/sqlResource.ts
|
|
2337
2288
|
var SqlResource = class {
|
|
2338
2289
|
/** @internal */
|
|
@@ -2378,18 +2329,66 @@ var SqlResource = class {
|
|
|
2378
2329
|
}
|
|
2379
2330
|
};
|
|
2380
2331
|
|
|
2332
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2333
|
+
var requireTargetTableName = (tableName) => {
|
|
2334
|
+
if (typeof tableName === "string") {
|
|
2335
|
+
return tableName;
|
|
2336
|
+
} else {
|
|
2337
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2338
|
+
}
|
|
2339
|
+
};
|
|
2340
|
+
var MaterializedView = class extends SqlResource {
|
|
2341
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2342
|
+
targetTable;
|
|
2343
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2344
|
+
let selectStatement = options.selectStatement;
|
|
2345
|
+
if (typeof selectStatement !== "string") {
|
|
2346
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2347
|
+
}
|
|
2348
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2349
|
+
throw new Error(
|
|
2350
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2351
|
+
);
|
|
2352
|
+
}
|
|
2353
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2354
|
+
requireTargetTableName(
|
|
2355
|
+
options.targetTable?.name ?? options.tableName
|
|
2356
|
+
),
|
|
2357
|
+
{
|
|
2358
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2359
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2360
|
+
},
|
|
2361
|
+
targetSchema,
|
|
2362
|
+
targetColumns
|
|
2363
|
+
);
|
|
2364
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2365
|
+
throw new Error(
|
|
2366
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2367
|
+
);
|
|
2368
|
+
}
|
|
2369
|
+
super(
|
|
2370
|
+
options.materializedViewName,
|
|
2371
|
+
[
|
|
2372
|
+
createMaterializedView({
|
|
2373
|
+
name: options.materializedViewName,
|
|
2374
|
+
destinationTable: targetTable.name,
|
|
2375
|
+
select: selectStatement
|
|
2376
|
+
})
|
|
2377
|
+
// Population is now handled automatically by Rust infrastructure
|
|
2378
|
+
// based on table engine type and whether this is a new or updated view
|
|
2379
|
+
],
|
|
2380
|
+
[dropView(options.materializedViewName)],
|
|
2381
|
+
{
|
|
2382
|
+
pullsDataFrom: options.selectTables,
|
|
2383
|
+
pushesDataTo: [targetTable]
|
|
2384
|
+
}
|
|
2385
|
+
);
|
|
2386
|
+
this.targetTable = targetTable;
|
|
2387
|
+
}
|
|
2388
|
+
};
|
|
2389
|
+
|
|
2381
2390
|
// src/dmv2/sdk/view.ts
|
|
2382
|
-
var View = class {
|
|
2383
|
-
/** @internal */
|
|
2384
|
-
kind = "CustomView";
|
|
2385
|
-
/** The name of the view */
|
|
2386
|
-
name;
|
|
2387
|
-
/** The SELECT SQL statement that defines the view */
|
|
2388
|
-
selectSql;
|
|
2389
|
-
/** Names of source tables/views that the SELECT reads from */
|
|
2390
|
-
sourceTables;
|
|
2391
|
-
/** @internal Source file path where this view was defined */
|
|
2392
|
-
sourceFile;
|
|
2391
|
+
var View = class extends SqlResource {
|
|
2393
2392
|
/**
|
|
2394
2393
|
* Creates a new View instance.
|
|
2395
2394
|
* @param name The name of the view to be created.
|
|
@@ -2400,16 +2399,17 @@ var View = class {
|
|
|
2400
2399
|
if (typeof selectStatement !== "string") {
|
|
2401
2400
|
selectStatement = toStaticQuery(selectStatement);
|
|
2402
2401
|
}
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2402
|
+
super(
|
|
2403
|
+
name,
|
|
2404
|
+
[
|
|
2405
|
+
`CREATE VIEW IF NOT EXISTS ${name}
|
|
2406
|
+
AS ${selectStatement}`.trim()
|
|
2407
|
+
],
|
|
2408
|
+
[dropView(name)],
|
|
2409
|
+
{
|
|
2410
|
+
pullsDataFrom: baseTables
|
|
2411
|
+
}
|
|
2412
|
+
);
|
|
2413
2413
|
}
|
|
2414
2414
|
};
|
|
2415
2415
|
|