@514labs/moose-lib 0.6.266-ci-8-ge6e86870 → 0.6.267

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-DSzxmiN9.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-DSzxmiN9.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-DSzxmiN9.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-y8O70Ttx.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-DSzxmiN9.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-vY6tmKGn.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';
@@ -702,6 +702,16 @@ function emptyIfUndefined(value) {
702
702
  return value === void 0 ? "" : value;
703
703
  }
704
704
 
705
+ // src/blocks/helpers.ts
706
+ function dropView(name) {
707
+ return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
708
+ }
709
+ function createMaterializedView(options) {
710
+ return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
711
+ TO ${quoteIdentifier(options.destinationTable)}
712
+ AS ${options.select}`.trim();
713
+ }
714
+
705
715
  // src/dmv2/internal.ts
706
716
  var import_process = __toESM(require("process"));
707
717
 
@@ -752,9 +762,7 @@ var moose_internal = {
752
762
  apis: /* @__PURE__ */ new Map(),
753
763
  sqlResources: /* @__PURE__ */ new Map(),
754
764
  workflows: /* @__PURE__ */ new Map(),
755
- webApps: /* @__PURE__ */ new Map(),
756
- materializedViews: /* @__PURE__ */ new Map(),
757
- customViews: /* @__PURE__ */ new Map()
765
+ webApps: /* @__PURE__ */ new Map()
758
766
  };
759
767
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
760
768
  var getMooseInternal = () => globalThis.moose_internal;
@@ -2381,67 +2389,6 @@ var ETLPipeline = class {
2381
2389
  }
2382
2390
  };
2383
2391
 
2384
- // src/dmv2/sdk/materializedView.ts
2385
- var requireTargetTableName = (tableName) => {
2386
- if (typeof tableName === "string") {
2387
- return tableName;
2388
- } else {
2389
- throw new Error("Name of targetTable is not specified.");
2390
- }
2391
- };
2392
- var MaterializedView = class {
2393
- /** @internal */
2394
- kind = "MaterializedView";
2395
- /** The name of the materialized view */
2396
- name;
2397
- /** The target OlapTable instance where the materialized data is stored. */
2398
- targetTable;
2399
- /** The SELECT SQL statement */
2400
- selectSql;
2401
- /** Names of source tables that the SELECT reads from */
2402
- sourceTables;
2403
- /** @internal Source file path where this MV was defined */
2404
- sourceFile;
2405
- constructor(options, targetSchema, targetColumns) {
2406
- let selectStatement = options.selectStatement;
2407
- if (typeof selectStatement !== "string") {
2408
- selectStatement = toStaticQuery(selectStatement);
2409
- }
2410
- if (targetSchema === void 0 || targetColumns === void 0) {
2411
- throw new Error(
2412
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2413
- );
2414
- }
2415
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2416
- requireTargetTableName(
2417
- options.targetTable?.name ?? options.tableName
2418
- ),
2419
- {
2420
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2421
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2422
- },
2423
- targetSchema,
2424
- targetColumns
2425
- );
2426
- if (targetTable.name === options.materializedViewName) {
2427
- throw new Error(
2428
- "Materialized view name cannot be the same as the target table name."
2429
- );
2430
- }
2431
- this.name = options.materializedViewName;
2432
- this.targetTable = targetTable;
2433
- this.selectSql = selectStatement;
2434
- this.sourceTables = options.selectTables.map((t) => t.name);
2435
- const stack = new Error().stack;
2436
- this.sourceFile = getSourceFileFromStack(stack);
2437
- const materializedViews = getMooseInternal().materializedViews;
2438
- if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2439
- throw new Error(`MaterializedView with name ${this.name} already exists`);
2440
- }
2441
- materializedViews.set(this.name, this);
2442
- }
2443
- };
2444
-
2445
2392
  // src/dmv2/sdk/sqlResource.ts
2446
2393
  var SqlResource = class {
2447
2394
  /** @internal */
@@ -2496,18 +2443,66 @@ var SqlResource = class {
2496
2443
  }
2497
2444
  };
2498
2445
 
2446
+ // src/dmv2/sdk/materializedView.ts
2447
+ var requireTargetTableName = (tableName) => {
2448
+ if (typeof tableName === "string") {
2449
+ return tableName;
2450
+ } else {
2451
+ throw new Error("Name of targetTable is not specified.");
2452
+ }
2453
+ };
2454
+ var MaterializedView = class extends SqlResource {
2455
+ /** The target OlapTable instance where the materialized data is stored. */
2456
+ targetTable;
2457
+ constructor(options, targetSchema, targetColumns) {
2458
+ let selectStatement = options.selectStatement;
2459
+ if (typeof selectStatement !== "string") {
2460
+ selectStatement = toStaticQuery(selectStatement);
2461
+ }
2462
+ if (targetSchema === void 0 || targetColumns === void 0) {
2463
+ throw new Error(
2464
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2465
+ );
2466
+ }
2467
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2468
+ requireTargetTableName(
2469
+ options.targetTable?.name ?? options.tableName
2470
+ ),
2471
+ {
2472
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2473
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2474
+ },
2475
+ targetSchema,
2476
+ targetColumns
2477
+ );
2478
+ if (targetTable.name === options.materializedViewName) {
2479
+ throw new Error(
2480
+ "Materialized view name cannot be the same as the target table name."
2481
+ );
2482
+ }
2483
+ super(
2484
+ options.materializedViewName,
2485
+ [
2486
+ createMaterializedView({
2487
+ name: options.materializedViewName,
2488
+ destinationTable: targetTable.name,
2489
+ select: selectStatement
2490
+ })
2491
+ // Population is now handled automatically by Rust infrastructure
2492
+ // based on table engine type and whether this is a new or updated view
2493
+ ],
2494
+ [dropView(options.materializedViewName)],
2495
+ {
2496
+ pullsDataFrom: options.selectTables,
2497
+ pushesDataTo: [targetTable]
2498
+ }
2499
+ );
2500
+ this.targetTable = targetTable;
2501
+ }
2502
+ };
2503
+
2499
2504
  // src/dmv2/sdk/view.ts
2500
- var View = class {
2501
- /** @internal */
2502
- kind = "CustomView";
2503
- /** The name of the view */
2504
- name;
2505
- /** The SELECT SQL statement that defines the view */
2506
- selectSql;
2507
- /** Names of source tables/views that the SELECT reads from */
2508
- sourceTables;
2509
- /** @internal Source file path where this view was defined */
2510
- sourceFile;
2505
+ var View = class extends SqlResource {
2511
2506
  /**
2512
2507
  * Creates a new View instance.
2513
2508
  * @param name The name of the view to be created.
@@ -2518,16 +2513,17 @@ var View = class {
2518
2513
  if (typeof selectStatement !== "string") {
2519
2514
  selectStatement = toStaticQuery(selectStatement);
2520
2515
  }
2521
- this.name = name;
2522
- this.selectSql = selectStatement;
2523
- this.sourceTables = baseTables.map((t) => t.name);
2524
- const stack = new Error().stack;
2525
- this.sourceFile = getSourceFileFromStack(stack);
2526
- const customViews = getMooseInternal().customViews;
2527
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2528
- throw new Error(`View with name ${this.name} already exists`);
2529
- }
2530
- customViews.set(this.name, this);
2516
+ super(
2517
+ name,
2518
+ [
2519
+ `CREATE VIEW IF NOT EXISTS ${name}
2520
+ AS ${selectStatement}`.trim()
2521
+ ],
2522
+ [dropView(name)],
2523
+ {
2524
+ pullsDataFrom: baseTables
2525
+ }
2526
+ );
2531
2527
  }
2532
2528
  };
2533
2529