@514labs/moose-lib 0.6.297 → 0.6.298

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-CcHF2cVT.mjs';
1
+ import './index-BeUCYK3T.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-CcHF2cVT.js';
1
+ import './index-BeUCYK3T.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-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';
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-BeUCYK3T.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-DGOtJiIs.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-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';
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-BeUCYK3T.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-DzZUjqvL.js';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -334,14 +334,6 @@ 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
- }
345
337
  var init_helpers = __esm({
346
338
  "src/blocks/helpers.ts"() {
347
339
  "use strict";
@@ -682,7 +674,9 @@ var init_internal = __esm({
682
674
  apis: /* @__PURE__ */ new Map(),
683
675
  sqlResources: /* @__PURE__ */ new Map(),
684
676
  workflows: /* @__PURE__ */ new Map(),
685
- webApps: /* @__PURE__ */ new Map()
677
+ webApps: /* @__PURE__ */ new Map(),
678
+ materializedViews: /* @__PURE__ */ new Map(),
679
+ views: /* @__PURE__ */ new Map()
686
680
  };
687
681
  defaultRetentionPeriod = 60 * 60 * 24 * 7;
688
682
  getMooseInternal = () => globalThis.moose_internal;
@@ -2563,6 +2557,93 @@ var init_etlPipeline = __esm({
2563
2557
  }
2564
2558
  });
2565
2559
 
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
+
2566
2647
  // src/dmv2/sdk/sqlResource.ts
2567
2648
  var SqlResource;
2568
2649
  var init_sqlResource = __esm({
@@ -2626,104 +2707,60 @@ var init_sqlResource = __esm({
2626
2707
  }
2627
2708
  });
2628
2709
 
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
- };
2694
- }
2695
- });
2696
-
2697
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}\``;
2715
+ }
2716
+ return `\`${table.name}\``;
2717
+ }
2698
2718
  var View;
2699
2719
  var init_view = __esm({
2700
2720
  "src/dmv2/sdk/view.ts"() {
2701
2721
  "use strict";
2702
- init_helpers();
2703
2722
  init_sqlHelpers();
2704
- init_sqlResource();
2705
- View = class extends SqlResource {
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;
2706
2737
  /**
2707
2738
  * Creates a new View instance.
2708
2739
  * @param name The name of the view to be created.
2709
2740
  * @param selectStatement The SQL SELECT statement that defines the view's logic.
2710
2741
  * @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).
2711
2743
  */
2712
- constructor(name, selectStatement, baseTables) {
2744
+ constructor(name, selectStatement, baseTables, metadata) {
2713
2745
  if (typeof selectStatement !== "string") {
2714
2746
  selectStatement = toStaticQuery(selectStatement);
2715
2747
  }
2716
- super(
2717
- name,
2718
- [
2719
- `CREATE VIEW IF NOT EXISTS ${name}
2720
- AS ${selectStatement}`.trim()
2721
- ],
2722
- [dropView(name)],
2723
- {
2724
- pullsDataFrom: baseTables
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 };
2725
2757
  }
2726
- );
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);
2727
2764
  }
2728
2765
  };
2729
2766
  }
@@ -2927,6 +2964,18 @@ function getWebApps2() {
2927
2964
  function getWebApp(name) {
2928
2965
  return getMooseInternal().webApps.get(name);
2929
2966
  }
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
+ }
2930
2979
  var init_registry = __esm({
2931
2980
  "src/dmv2/registry.ts"() {
2932
2981
  "use strict";
@@ -2978,6 +3027,8 @@ __export(browserCompatible_exports, {
2978
3027
  getApis: () => getApis2,
2979
3028
  getIngestApi: () => getIngestApi,
2980
3029
  getIngestApis: () => getIngestApis,
3030
+ getMaterializedView: () => getMaterializedView,
3031
+ getMaterializedViews: () => getMaterializedViews,
2981
3032
  getSqlResource: () => getSqlResource,
2982
3033
  getSqlResources: () => getSqlResources,
2983
3034
  getStream: () => getStream,
@@ -2985,6 +3036,8 @@ __export(browserCompatible_exports, {
2985
3036
  getTable: () => getTable,
2986
3037
  getTables: () => getTables,
2987
3038
  getValueFromParameter: () => getValueFromParameter,
3039
+ getView: () => getView,
3040
+ getViews: () => getViews,
2988
3041
  getWebApp: () => getWebApp,
2989
3042
  getWebApps: () => getWebApps2,
2990
3043
  getWorkflow: () => getWorkflow,
@@ -3028,6 +3081,8 @@ init_browserCompatible();
3028
3081
  getApis,
3029
3082
  getIngestApi,
3030
3083
  getIngestApis,
3084
+ getMaterializedView,
3085
+ getMaterializedViews,
3031
3086
  getSqlResource,
3032
3087
  getSqlResources,
3033
3088
  getStream,
@@ -3035,6 +3090,8 @@ init_browserCompatible();
3035
3090
  getTable,
3036
3091
  getTables,
3037
3092
  getValueFromParameter,
3093
+ getView,
3094
+ getViews,
3038
3095
  getWebApp,
3039
3096
  getWebApps,
3040
3097
  getWorkflow,