@514labs/moose-lib 0.6.279-ci-9-gaf2329aa → 0.6.279-ci-1-g5f380e27

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