@514labs/moose-lib 0.6.297-ci-37-gf180cb49 → 0.6.297

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-CI9e2hZ2.js';
1
+ import './index-CcHF2cVT.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-CI9e2hZ2.mjs';
1
+ import './index-CcHF2cVT.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, 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, K as getView, N as getViews, 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-CI9e2hZ2.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-Dfx6yRB5.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-CcHF2cVT.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-FzU17dxm.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, 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, K as getView, N as getViews, 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-CI9e2hZ2.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-Cs3UY_5a.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-CcHF2cVT.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-CMEunMFq.js';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -334,6 +334,14 @@ var init_sqlHelpers = __esm({
334
334
  });
335
335
 
336
336
  // src/blocks/helpers.ts
337
+ function dropView(name) {
338
+ return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
339
+ }
340
+ function createMaterializedView(options) {
341
+ return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
342
+ TO ${quoteIdentifier(options.destinationTable)}
343
+ AS ${options.select}`.trim();
344
+ }
337
345
  var init_helpers = __esm({
338
346
  "src/blocks/helpers.ts"() {
339
347
  "use strict";
@@ -674,9 +682,7 @@ var init_internal = __esm({
674
682
  apis: /* @__PURE__ */ new Map(),
675
683
  sqlResources: /* @__PURE__ */ new Map(),
676
684
  workflows: /* @__PURE__ */ new Map(),
677
- webApps: /* @__PURE__ */ new Map(),
678
- materializedViews: /* @__PURE__ */ new Map(),
679
- views: /* @__PURE__ */ new Map()
685
+ webApps: /* @__PURE__ */ new Map()
680
686
  };
681
687
  defaultRetentionPeriod = 60 * 60 * 24 * 7;
682
688
  getMooseInternal = () => globalThis.moose_internal;
@@ -2557,93 +2563,6 @@ var init_etlPipeline = __esm({
2557
2563
  }
2558
2564
  });
2559
2565
 
2560
- // src/dmv2/sdk/materializedView.ts
2561
- function formatTableReference(table) {
2562
- const database = table instanceof OlapTable ? table.config.database : void 0;
2563
- if (database) {
2564
- return `\`${database}\`.\`${table.name}\``;
2565
- }
2566
- return `\`${table.name}\``;
2567
- }
2568
- var requireTargetTableName, MaterializedView;
2569
- var init_materializedView = __esm({
2570
- "src/dmv2/sdk/materializedView.ts"() {
2571
- "use strict";
2572
- init_helpers();
2573
- init_sqlHelpers();
2574
- init_olapTable();
2575
- init_internal();
2576
- init_stackTrace();
2577
- requireTargetTableName = (tableName) => {
2578
- if (typeof tableName === "string") {
2579
- return tableName;
2580
- } else {
2581
- throw new Error("Name of targetTable is not specified.");
2582
- }
2583
- };
2584
- MaterializedView = class {
2585
- /** @internal */
2586
- kind = "MaterializedView";
2587
- /** The name of the materialized view */
2588
- name;
2589
- /** The target OlapTable instance where the materialized data is stored. */
2590
- targetTable;
2591
- /** The SELECT SQL statement */
2592
- selectSql;
2593
- /** Names of source tables that the SELECT reads from */
2594
- sourceTables;
2595
- /** Optional metadata for the materialized view */
2596
- metadata;
2597
- constructor(options, targetSchema, targetColumns) {
2598
- let selectStatement = options.selectStatement;
2599
- if (typeof selectStatement !== "string") {
2600
- selectStatement = toStaticQuery(selectStatement);
2601
- }
2602
- if (targetSchema === void 0 || targetColumns === void 0) {
2603
- throw new Error(
2604
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2605
- );
2606
- }
2607
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2608
- requireTargetTableName(
2609
- options.targetTable?.name ?? options.tableName
2610
- ),
2611
- {
2612
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2613
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2614
- },
2615
- targetSchema,
2616
- targetColumns
2617
- );
2618
- if (targetTable.name === options.materializedViewName) {
2619
- throw new Error(
2620
- "Materialized view name cannot be the same as the target table name."
2621
- );
2622
- }
2623
- this.name = options.materializedViewName;
2624
- this.targetTable = targetTable;
2625
- this.selectSql = selectStatement;
2626
- this.sourceTables = options.selectTables.map(
2627
- (t) => formatTableReference(t)
2628
- );
2629
- this.metadata = options.metadata ? { ...options.metadata } : {};
2630
- if (!this.metadata.source) {
2631
- const stack = new Error().stack;
2632
- const sourceInfo = getSourceFileFromStack(stack);
2633
- if (sourceInfo) {
2634
- this.metadata.source = { file: sourceInfo };
2635
- }
2636
- }
2637
- const materializedViews = getMooseInternal().materializedViews;
2638
- if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2639
- throw new Error(`MaterializedView with name ${this.name} already exists`);
2640
- }
2641
- materializedViews.set(this.name, this);
2642
- }
2643
- };
2644
- }
2645
- });
2646
-
2647
2566
  // src/dmv2/sdk/sqlResource.ts
2648
2567
  var SqlResource;
2649
2568
  var init_sqlResource = __esm({
@@ -2707,60 +2626,104 @@ var init_sqlResource = __esm({
2707
2626
  }
2708
2627
  });
2709
2628
 
2710
- // src/dmv2/sdk/view.ts
2711
- function formatTableReference2(table) {
2712
- const database = table instanceof OlapTable ? table.config.database : void 0;
2713
- if (database) {
2714
- return `\`${database}\`.\`${table.name}\``;
2629
+ // src/dmv2/sdk/materializedView.ts
2630
+ var requireTargetTableName, MaterializedView;
2631
+ var init_materializedView = __esm({
2632
+ "src/dmv2/sdk/materializedView.ts"() {
2633
+ "use strict";
2634
+ init_helpers();
2635
+ init_sqlHelpers();
2636
+ init_olapTable();
2637
+ init_sqlResource();
2638
+ requireTargetTableName = (tableName) => {
2639
+ if (typeof tableName === "string") {
2640
+ return tableName;
2641
+ } else {
2642
+ throw new Error("Name of targetTable is not specified.");
2643
+ }
2644
+ };
2645
+ MaterializedView = class extends SqlResource {
2646
+ /** The target OlapTable instance where the materialized data is stored. */
2647
+ targetTable;
2648
+ constructor(options, targetSchema, targetColumns) {
2649
+ let selectStatement = options.selectStatement;
2650
+ if (typeof selectStatement !== "string") {
2651
+ selectStatement = toStaticQuery(selectStatement);
2652
+ }
2653
+ if (targetSchema === void 0 || targetColumns === void 0) {
2654
+ throw new Error(
2655
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2656
+ );
2657
+ }
2658
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2659
+ requireTargetTableName(
2660
+ options.targetTable?.name ?? options.tableName
2661
+ ),
2662
+ {
2663
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2664
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2665
+ },
2666
+ targetSchema,
2667
+ targetColumns
2668
+ );
2669
+ if (targetTable.name === options.materializedViewName) {
2670
+ throw new Error(
2671
+ "Materialized view name cannot be the same as the target table name."
2672
+ );
2673
+ }
2674
+ super(
2675
+ options.materializedViewName,
2676
+ [
2677
+ createMaterializedView({
2678
+ name: options.materializedViewName,
2679
+ destinationTable: targetTable.name,
2680
+ select: selectStatement
2681
+ })
2682
+ // Population is now handled automatically by Rust infrastructure
2683
+ // based on table engine type and whether this is a new or updated view
2684
+ ],
2685
+ [dropView(options.materializedViewName)],
2686
+ {
2687
+ pullsDataFrom: options.selectTables,
2688
+ pushesDataTo: [targetTable]
2689
+ }
2690
+ );
2691
+ this.targetTable = targetTable;
2692
+ }
2693
+ };
2715
2694
  }
2716
- return `\`${table.name}\``;
2717
- }
2695
+ });
2696
+
2697
+ // src/dmv2/sdk/view.ts
2718
2698
  var View;
2719
2699
  var init_view = __esm({
2720
2700
  "src/dmv2/sdk/view.ts"() {
2721
2701
  "use strict";
2702
+ init_helpers();
2722
2703
  init_sqlHelpers();
2723
- init_olapTable();
2724
- init_internal();
2725
- init_stackTrace();
2726
- View = class {
2727
- /** @internal */
2728
- kind = "View";
2729
- /** The name of the view */
2730
- name;
2731
- /** The SELECT SQL statement that defines the view */
2732
- selectSql;
2733
- /** Names of source tables/views that the SELECT reads from */
2734
- sourceTables;
2735
- /** Optional metadata for the view */
2736
- metadata;
2704
+ init_sqlResource();
2705
+ View = class extends SqlResource {
2737
2706
  /**
2738
2707
  * Creates a new View instance.
2739
2708
  * @param name The name of the view to be created.
2740
2709
  * @param selectStatement The SQL SELECT statement that defines the view's logic.
2741
2710
  * @param baseTables An array of OlapTable or View objects that the `selectStatement` reads from. Used for dependency tracking.
2742
- * @param metadata Optional metadata for the view (e.g., description, source file).
2743
2711
  */
2744
- constructor(name, selectStatement, baseTables, metadata) {
2712
+ constructor(name, selectStatement, baseTables) {
2745
2713
  if (typeof selectStatement !== "string") {
2746
2714
  selectStatement = toStaticQuery(selectStatement);
2747
2715
  }
2748
- this.name = name;
2749
- this.selectSql = selectStatement;
2750
- this.sourceTables = baseTables.map((t) => formatTableReference2(t));
2751
- this.metadata = metadata ? { ...metadata } : {};
2752
- if (!this.metadata.source) {
2753
- const stack = new Error().stack;
2754
- const sourceInfo = getSourceFileFromStack(stack);
2755
- if (sourceInfo) {
2756
- this.metadata.source = { file: sourceInfo };
2716
+ super(
2717
+ name,
2718
+ [
2719
+ `CREATE VIEW IF NOT EXISTS ${name}
2720
+ AS ${selectStatement}`.trim()
2721
+ ],
2722
+ [dropView(name)],
2723
+ {
2724
+ pullsDataFrom: baseTables
2757
2725
  }
2758
- }
2759
- const views = getMooseInternal().views;
2760
- if (!isClientOnlyMode() && views.has(this.name)) {
2761
- throw new Error(`View with name ${this.name} already exists`);
2762
- }
2763
- views.set(this.name, this);
2726
+ );
2764
2727
  }
2765
2728
  };
2766
2729
  }
@@ -2964,18 +2927,6 @@ function getWebApps2() {
2964
2927
  function getWebApp(name) {
2965
2928
  return getMooseInternal().webApps.get(name);
2966
2929
  }
2967
- function getMaterializedViews() {
2968
- return getMooseInternal().materializedViews;
2969
- }
2970
- function getMaterializedView(name) {
2971
- return getMooseInternal().materializedViews.get(name);
2972
- }
2973
- function getViews() {
2974
- return getMooseInternal().views;
2975
- }
2976
- function getView(name) {
2977
- return getMooseInternal().views.get(name);
2978
- }
2979
2930
  var init_registry = __esm({
2980
2931
  "src/dmv2/registry.ts"() {
2981
2932
  "use strict";
@@ -3027,8 +2978,6 @@ __export(browserCompatible_exports, {
3027
2978
  getApis: () => getApis2,
3028
2979
  getIngestApi: () => getIngestApi,
3029
2980
  getIngestApis: () => getIngestApis,
3030
- getMaterializedView: () => getMaterializedView,
3031
- getMaterializedViews: () => getMaterializedViews,
3032
2981
  getSqlResource: () => getSqlResource,
3033
2982
  getSqlResources: () => getSqlResources,
3034
2983
  getStream: () => getStream,
@@ -3036,8 +2985,6 @@ __export(browserCompatible_exports, {
3036
2985
  getTable: () => getTable,
3037
2986
  getTables: () => getTables,
3038
2987
  getValueFromParameter: () => getValueFromParameter,
3039
- getView: () => getView,
3040
- getViews: () => getViews,
3041
2988
  getWebApp: () => getWebApp,
3042
2989
  getWebApps: () => getWebApps2,
3043
2990
  getWorkflow: () => getWorkflow,
@@ -3081,8 +3028,6 @@ init_browserCompatible();
3081
3028
  getApis,
3082
3029
  getIngestApi,
3083
3030
  getIngestApis,
3084
- getMaterializedView,
3085
- getMaterializedViews,
3086
3031
  getSqlResource,
3087
3032
  getSqlResources,
3088
3033
  getStream,
@@ -3090,8 +3035,6 @@ init_browserCompatible();
3090
3035
  getTable,
3091
3036
  getTables,
3092
3037
  getValueFromParameter,
3093
- getView,
3094
- getViews,
3095
3038
  getWebApp,
3096
3039
  getWebApps,
3097
3040
  getWorkflow,