@514labs/moose-lib 0.6.295-ci-20-gbe187727 → 0.6.295

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-CcZRaA0b.js';
1
+ import './index-rQOQo9sv.js';
2
2
  import { Pattern, TagBase } from 'typia/lib/tags';
3
3
  import { tags } from 'typia';
4
4
 
@@ -1,4 +1,4 @@
1
- import './index-CcZRaA0b.mjs';
1
+ import './index-rQOQo9sv.mjs';
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, R as ApiUtil, C as ConsumptionApi, U as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Y as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, Z as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, $ as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, a1 as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, _ as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, a6 as createClickhouseParameter, x as getApi, w as getApis, K as getCustomView, N as getCustomViews, v as getIngestApi, u as getIngestApis, P as getMaterializedView, Q as getMaterializedViews, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, a5 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a7 as mapToClickHouseType, X as quoteIdentifier, a0 as sql, a3 as toQuery, a4 as toQueryPreview, a2 as toStaticQuery } from './index-CcZRaA0b.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-DCCiBirg.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-rQOQo9sv.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-ChWHzgtb.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, R as ApiUtil, C as ConsumptionApi, U as ConsumptionUtil, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, Y as IdentifierBrandedString, I as IngestApi, g as IngestConfig, j as IngestPipeline, L as LifeCycle, M as MaterializedView, Z as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, $ as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, a1 as Sql, k as SqlResource, c as Stream, d as StreamConfig, T as Task, _ as Value, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, a6 as createClickhouseParameter, x as getApi, w as getApis, K as getCustomView, N as getCustomViews, v as getIngestApi, u as getIngestApis, P as getMaterializedView, Q as getMaterializedViews, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, a5 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a7 as mapToClickHouseType, X as quoteIdentifier, a0 as sql, a3 as toQuery, a4 as toQueryPreview, a2 as toStaticQuery } from './index-CcZRaA0b.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-DhVPp9qX.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-rQOQo9sv.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-B8CAYjv5.js';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -403,12 +403,8 @@ __export(browserCompatible_exports, {
403
403
  createClickhouseParameter: () => createClickhouseParameter,
404
404
  getApi: () => getApi,
405
405
  getApis: () => getApis2,
406
- getCustomView: () => getCustomView,
407
- getCustomViews: () => getCustomViews,
408
406
  getIngestApi: () => getIngestApi,
409
407
  getIngestApis: () => getIngestApis,
410
- getMaterializedView: () => getMaterializedView,
411
- getMaterializedViews: () => getMaterializedViews,
412
408
  getSqlResource: () => getSqlResource,
413
409
  getSqlResources: () => getSqlResources,
414
410
  getStream: () => getStream,
@@ -709,6 +705,16 @@ function emptyIfUndefined(value) {
709
705
  return value === void 0 ? "" : value;
710
706
  }
711
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
+
712
718
  // src/dmv2/internal.ts
713
719
  var import_process = __toESM(require("process"));
714
720
 
@@ -759,9 +765,7 @@ var moose_internal = {
759
765
  apis: /* @__PURE__ */ new Map(),
760
766
  sqlResources: /* @__PURE__ */ new Map(),
761
767
  workflows: /* @__PURE__ */ new Map(),
762
- webApps: /* @__PURE__ */ new Map(),
763
- materializedViews: /* @__PURE__ */ new Map(),
764
- customViews: /* @__PURE__ */ new Map()
768
+ webApps: /* @__PURE__ */ new Map()
765
769
  };
766
770
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
767
771
  var getMooseInternal = () => globalThis.moose_internal;
@@ -2395,67 +2399,6 @@ var ETLPipeline = class {
2395
2399
  }
2396
2400
  };
2397
2401
 
2398
- // src/dmv2/sdk/materializedView.ts
2399
- var requireTargetTableName = (tableName) => {
2400
- if (typeof tableName === "string") {
2401
- return tableName;
2402
- } else {
2403
- throw new Error("Name of targetTable is not specified.");
2404
- }
2405
- };
2406
- var MaterializedView = class {
2407
- /** @internal */
2408
- kind = "MaterializedView";
2409
- /** The name of the materialized view */
2410
- name;
2411
- /** The target OlapTable instance where the materialized data is stored. */
2412
- targetTable;
2413
- /** The SELECT SQL statement */
2414
- selectSql;
2415
- /** Names of source tables that the SELECT reads from */
2416
- sourceTables;
2417
- /** @internal Source file path where this MV was defined */
2418
- sourceFile;
2419
- constructor(options, targetSchema, targetColumns) {
2420
- let selectStatement = options.selectStatement;
2421
- if (typeof selectStatement !== "string") {
2422
- selectStatement = toStaticQuery(selectStatement);
2423
- }
2424
- if (targetSchema === void 0 || targetColumns === void 0) {
2425
- throw new Error(
2426
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2427
- );
2428
- }
2429
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2430
- requireTargetTableName(
2431
- options.targetTable?.name ?? options.tableName
2432
- ),
2433
- {
2434
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2435
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2436
- },
2437
- targetSchema,
2438
- targetColumns
2439
- );
2440
- if (targetTable.name === options.materializedViewName) {
2441
- throw new Error(
2442
- "Materialized view name cannot be the same as the target table name."
2443
- );
2444
- }
2445
- this.name = options.materializedViewName;
2446
- this.targetTable = targetTable;
2447
- this.selectSql = selectStatement;
2448
- this.sourceTables = options.selectTables.map((t) => t.name);
2449
- const stack = new Error().stack;
2450
- this.sourceFile = getSourceFileFromStack(stack);
2451
- const materializedViews = getMooseInternal().materializedViews;
2452
- if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2453
- throw new Error(`MaterializedView with name ${this.name} already exists`);
2454
- }
2455
- materializedViews.set(this.name, this);
2456
- }
2457
- };
2458
-
2459
2402
  // src/dmv2/sdk/sqlResource.ts
2460
2403
  var SqlResource = class {
2461
2404
  /** @internal */
@@ -2510,18 +2453,66 @@ var SqlResource = class {
2510
2453
  }
2511
2454
  };
2512
2455
 
2456
+ // src/dmv2/sdk/materializedView.ts
2457
+ var requireTargetTableName = (tableName) => {
2458
+ if (typeof tableName === "string") {
2459
+ return tableName;
2460
+ } else {
2461
+ throw new Error("Name of targetTable is not specified.");
2462
+ }
2463
+ };
2464
+ var MaterializedView = class extends SqlResource {
2465
+ /** The target OlapTable instance where the materialized data is stored. */
2466
+ targetTable;
2467
+ constructor(options, targetSchema, targetColumns) {
2468
+ let selectStatement = options.selectStatement;
2469
+ if (typeof selectStatement !== "string") {
2470
+ selectStatement = toStaticQuery(selectStatement);
2471
+ }
2472
+ if (targetSchema === void 0 || targetColumns === void 0) {
2473
+ throw new Error(
2474
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2475
+ );
2476
+ }
2477
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2478
+ requireTargetTableName(
2479
+ options.targetTable?.name ?? options.tableName
2480
+ ),
2481
+ {
2482
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2483
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2484
+ },
2485
+ targetSchema,
2486
+ targetColumns
2487
+ );
2488
+ if (targetTable.name === options.materializedViewName) {
2489
+ throw new Error(
2490
+ "Materialized view name cannot be the same as the target table name."
2491
+ );
2492
+ }
2493
+ super(
2494
+ options.materializedViewName,
2495
+ [
2496
+ createMaterializedView({
2497
+ name: options.materializedViewName,
2498
+ destinationTable: targetTable.name,
2499
+ select: selectStatement
2500
+ })
2501
+ // Population is now handled automatically by Rust infrastructure
2502
+ // based on table engine type and whether this is a new or updated view
2503
+ ],
2504
+ [dropView(options.materializedViewName)],
2505
+ {
2506
+ pullsDataFrom: options.selectTables,
2507
+ pushesDataTo: [targetTable]
2508
+ }
2509
+ );
2510
+ this.targetTable = targetTable;
2511
+ }
2512
+ };
2513
+
2513
2514
  // src/dmv2/sdk/view.ts
2514
- var View = class {
2515
- /** @internal */
2516
- kind = "CustomView";
2517
- /** The name of the view */
2518
- name;
2519
- /** The SELECT SQL statement that defines the view */
2520
- selectSql;
2521
- /** Names of source tables/views that the SELECT reads from */
2522
- sourceTables;
2523
- /** @internal Source file path where this view was defined */
2524
- sourceFile;
2515
+ var View = class extends SqlResource {
2525
2516
  /**
2526
2517
  * Creates a new View instance.
2527
2518
  * @param name The name of the view to be created.
@@ -2532,16 +2523,17 @@ var View = class {
2532
2523
  if (typeof selectStatement !== "string") {
2533
2524
  selectStatement = toStaticQuery(selectStatement);
2534
2525
  }
2535
- this.name = name;
2536
- this.selectSql = selectStatement;
2537
- this.sourceTables = baseTables.map((t) => t.name);
2538
- const stack = new Error().stack;
2539
- this.sourceFile = getSourceFileFromStack(stack);
2540
- const customViews = getMooseInternal().customViews;
2541
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2542
- throw new Error(`View with name ${this.name} already exists`);
2543
- }
2544
- customViews.set(this.name, this);
2526
+ super(
2527
+ name,
2528
+ [
2529
+ `CREATE VIEW IF NOT EXISTS ${name}
2530
+ AS ${selectStatement}`.trim()
2531
+ ],
2532
+ [dropView(name)],
2533
+ {
2534
+ pullsDataFrom: baseTables
2535
+ }
2536
+ );
2545
2537
  }
2546
2538
  };
2547
2539
 
@@ -2730,18 +2722,6 @@ function getWebApps2() {
2730
2722
  function getWebApp(name) {
2731
2723
  return getMooseInternal().webApps.get(name);
2732
2724
  }
2733
- function getMaterializedViews() {
2734
- return getMooseInternal().materializedViews;
2735
- }
2736
- function getMaterializedView(name) {
2737
- return getMooseInternal().materializedViews.get(name);
2738
- }
2739
- function getCustomViews() {
2740
- return getMooseInternal().customViews;
2741
- }
2742
- function getCustomView(name) {
2743
- return getMooseInternal().customViews.get(name);
2744
- }
2745
2725
  // Annotate the CommonJS export names for ESM import in node:
2746
2726
  0 && (module.exports = {
2747
2727
  Api,
@@ -2763,12 +2743,8 @@ function getCustomView(name) {
2763
2743
  createClickhouseParameter,
2764
2744
  getApi,
2765
2745
  getApis,
2766
- getCustomView,
2767
- getCustomViews,
2768
2746
  getIngestApi,
2769
2747
  getIngestApis,
2770
- getMaterializedView,
2771
- getMaterializedViews,
2772
2748
  getSqlResource,
2773
2749
  getSqlResources,
2774
2750
  getStream,