@514labs/moose-lib 0.6.284-ci-4-g1a9baa0b → 0.6.284-ci-9-g6ab40892

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.
@@ -1,4 +1,4 @@
1
- import './index-KhGbXtkS.mjs';
1
+ import './index-BtkwFbT9.mjs';
2
2
  import { Pattern, TagBase } from 'typia/lib/tags';
3
3
  import { tags } from 'typia';
4
4
 
@@ -1,4 +1,4 @@
1
- import './index-KhGbXtkS.js';
1
+ import './index-BtkwFbT9.js';
2
2
  import { Pattern, TagBase } from 'typia/lib/tags';
3
3
  import { tags } from 'typia';
4
4
 
@@ -1,5 +1,5 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, N as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Q as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, R as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, X as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, Z as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, U as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, a2 as createClickhouseParameter, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-KhGbXtkS.mjs';
2
- export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-Bs-byVfO.mjs';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, N as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Q as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, R as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, X as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, Z as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, U as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, a2 as createClickhouseParameter, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-BtkwFbT9.mjs';
2
+ export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-15NCyT1P.mjs';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -1,5 +1,5 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, N as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Q as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, R as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, X as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, Z as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, U as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, a2 as createClickhouseParameter, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-KhGbXtkS.js';
2
- export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-D8Hbpq6L.js';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, N as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Q as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, R as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, X as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, Z as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, U as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, a2 as createClickhouseParameter, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-BtkwFbT9.js';
2
+ export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-BUKAJYbj.js';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -705,6 +705,16 @@ function emptyIfUndefined(value) {
705
705
  return value === void 0 ? "" : value;
706
706
  }
707
707
 
708
+ // src/blocks/helpers.ts
709
+ function dropView(name) {
710
+ return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
711
+ }
712
+ function createMaterializedView(options) {
713
+ return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
714
+ TO ${quoteIdentifier(options.destinationTable)}
715
+ AS ${options.select}`.trim();
716
+ }
717
+
708
718
  // src/dmv2/internal.ts
709
719
  var import_process = __toESM(require("process"));
710
720
 
@@ -755,9 +765,7 @@ var moose_internal = {
755
765
  apis: /* @__PURE__ */ new Map(),
756
766
  sqlResources: /* @__PURE__ */ new Map(),
757
767
  workflows: /* @__PURE__ */ new Map(),
758
- webApps: /* @__PURE__ */ new Map(),
759
- materializedViews: /* @__PURE__ */ new Map(),
760
- customViews: /* @__PURE__ */ new Map()
768
+ webApps: /* @__PURE__ */ new Map()
761
769
  };
762
770
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
763
771
  var getMooseInternal = () => globalThis.moose_internal;
@@ -2386,67 +2394,6 @@ var ETLPipeline = class {
2386
2394
  }
2387
2395
  };
2388
2396
 
2389
- // src/dmv2/sdk/materializedView.ts
2390
- var requireTargetTableName = (tableName) => {
2391
- if (typeof tableName === "string") {
2392
- return tableName;
2393
- } else {
2394
- throw new Error("Name of targetTable is not specified.");
2395
- }
2396
- };
2397
- var MaterializedView = class {
2398
- /** @internal */
2399
- kind = "MaterializedView";
2400
- /** The name of the materialized view */
2401
- name;
2402
- /** The target OlapTable instance where the materialized data is stored. */
2403
- targetTable;
2404
- /** The SELECT SQL statement */
2405
- selectSql;
2406
- /** Names of source tables that the SELECT reads from */
2407
- sourceTables;
2408
- /** @internal Source file path where this MV was defined */
2409
- sourceFile;
2410
- constructor(options, targetSchema, targetColumns) {
2411
- let selectStatement = options.selectStatement;
2412
- if (typeof selectStatement !== "string") {
2413
- selectStatement = toStaticQuery(selectStatement);
2414
- }
2415
- if (targetSchema === void 0 || targetColumns === void 0) {
2416
- throw new Error(
2417
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2418
- );
2419
- }
2420
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2421
- requireTargetTableName(
2422
- options.targetTable?.name ?? options.tableName
2423
- ),
2424
- {
2425
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2426
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2427
- },
2428
- targetSchema,
2429
- targetColumns
2430
- );
2431
- if (targetTable.name === options.materializedViewName) {
2432
- throw new Error(
2433
- "Materialized view name cannot be the same as the target table name."
2434
- );
2435
- }
2436
- this.name = options.materializedViewName;
2437
- this.targetTable = targetTable;
2438
- this.selectSql = selectStatement;
2439
- this.sourceTables = options.selectTables.map((t) => t.name);
2440
- const stack = new Error().stack;
2441
- this.sourceFile = getSourceFileFromStack(stack);
2442
- const materializedViews = getMooseInternal().materializedViews;
2443
- if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2444
- throw new Error(`MaterializedView with name ${this.name} already exists`);
2445
- }
2446
- materializedViews.set(this.name, this);
2447
- }
2448
- };
2449
-
2450
2397
  // src/dmv2/sdk/sqlResource.ts
2451
2398
  var SqlResource = class {
2452
2399
  /** @internal */
@@ -2501,18 +2448,66 @@ var SqlResource = class {
2501
2448
  }
2502
2449
  };
2503
2450
 
2451
+ // src/dmv2/sdk/materializedView.ts
2452
+ var requireTargetTableName = (tableName) => {
2453
+ if (typeof tableName === "string") {
2454
+ return tableName;
2455
+ } else {
2456
+ throw new Error("Name of targetTable is not specified.");
2457
+ }
2458
+ };
2459
+ var MaterializedView = class extends SqlResource {
2460
+ /** The target OlapTable instance where the materialized data is stored. */
2461
+ targetTable;
2462
+ constructor(options, targetSchema, targetColumns) {
2463
+ let selectStatement = options.selectStatement;
2464
+ if (typeof selectStatement !== "string") {
2465
+ selectStatement = toStaticQuery(selectStatement);
2466
+ }
2467
+ if (targetSchema === void 0 || targetColumns === void 0) {
2468
+ throw new Error(
2469
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2470
+ );
2471
+ }
2472
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2473
+ requireTargetTableName(
2474
+ options.targetTable?.name ?? options.tableName
2475
+ ),
2476
+ {
2477
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2478
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2479
+ },
2480
+ targetSchema,
2481
+ targetColumns
2482
+ );
2483
+ if (targetTable.name === options.materializedViewName) {
2484
+ throw new Error(
2485
+ "Materialized view name cannot be the same as the target table name."
2486
+ );
2487
+ }
2488
+ super(
2489
+ options.materializedViewName,
2490
+ [
2491
+ createMaterializedView({
2492
+ name: options.materializedViewName,
2493
+ destinationTable: targetTable.name,
2494
+ select: selectStatement
2495
+ })
2496
+ // Population is now handled automatically by Rust infrastructure
2497
+ // based on table engine type and whether this is a new or updated view
2498
+ ],
2499
+ [dropView(options.materializedViewName)],
2500
+ {
2501
+ pullsDataFrom: options.selectTables,
2502
+ pushesDataTo: [targetTable]
2503
+ }
2504
+ );
2505
+ this.targetTable = targetTable;
2506
+ }
2507
+ };
2508
+
2504
2509
  // src/dmv2/sdk/view.ts
2505
- var View = class {
2506
- /** @internal */
2507
- kind = "CustomView";
2508
- /** The name of the view */
2509
- name;
2510
- /** The SELECT SQL statement that defines the view */
2511
- selectSql;
2512
- /** Names of source tables/views that the SELECT reads from */
2513
- sourceTables;
2514
- /** @internal Source file path where this view was defined */
2515
- sourceFile;
2510
+ var View = class extends SqlResource {
2516
2511
  /**
2517
2512
  * Creates a new View instance.
2518
2513
  * @param name The name of the view to be created.
@@ -2523,16 +2518,17 @@ var View = class {
2523
2518
  if (typeof selectStatement !== "string") {
2524
2519
  selectStatement = toStaticQuery(selectStatement);
2525
2520
  }
2526
- this.name = name;
2527
- this.selectSql = selectStatement;
2528
- this.sourceTables = baseTables.map((t) => t.name);
2529
- const stack = new Error().stack;
2530
- this.sourceFile = getSourceFileFromStack(stack);
2531
- const customViews = getMooseInternal().customViews;
2532
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2533
- throw new Error(`View with name ${this.name} already exists`);
2534
- }
2535
- customViews.set(this.name, this);
2521
+ super(
2522
+ name,
2523
+ [
2524
+ `CREATE VIEW IF NOT EXISTS ${name}
2525
+ AS ${selectStatement}`.trim()
2526
+ ],
2527
+ [dropView(name)],
2528
+ {
2529
+ pullsDataFrom: baseTables
2530
+ }
2531
+ );
2536
2532
  }
2537
2533
  };
2538
2534