@514labs/moose-lib 0.6.297-ci-35-g4e0a867f → 0.6.297-ci-23-g751e4221

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-CdKEq7FH.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-CdKEq7FH.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, 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-CdKEq7FH.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-CkJwv4dC.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, 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-CdKEq7FH.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-Dqfdy6x5.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
+ customViews: /* @__PURE__ */ new Map()
686
680
  };
687
681
  defaultRetentionPeriod = 60 * 60 * 24 * 7;
688
682
  getMooseInternal = () => globalThis.moose_internal;
@@ -2563,6 +2557,84 @@ var init_etlPipeline = __esm({
2563
2557
  }
2564
2558
  });
2565
2559
 
2560
+ // src/dmv2/sdk/materializedView.ts
2561
+ var requireTargetTableName, MaterializedView;
2562
+ var init_materializedView = __esm({
2563
+ "src/dmv2/sdk/materializedView.ts"() {
2564
+ "use strict";
2565
+ init_helpers();
2566
+ init_sqlHelpers();
2567
+ init_olapTable();
2568
+ init_internal();
2569
+ init_stackTrace();
2570
+ requireTargetTableName = (tableName) => {
2571
+ if (typeof tableName === "string") {
2572
+ return tableName;
2573
+ } else {
2574
+ throw new Error("Name of targetTable is not specified.");
2575
+ }
2576
+ };
2577
+ MaterializedView = class {
2578
+ /** @internal */
2579
+ kind = "MaterializedView";
2580
+ /** The name of the materialized view */
2581
+ name;
2582
+ /** The target OlapTable instance where the materialized data is stored. */
2583
+ targetTable;
2584
+ /** The SELECT SQL statement */
2585
+ selectSql;
2586
+ /** Names of source tables that the SELECT reads from */
2587
+ sourceTables;
2588
+ /** Optional metadata for the materialized view */
2589
+ metadata;
2590
+ constructor(options, targetSchema, targetColumns) {
2591
+ let selectStatement = options.selectStatement;
2592
+ if (typeof selectStatement !== "string") {
2593
+ selectStatement = toStaticQuery(selectStatement);
2594
+ }
2595
+ if (targetSchema === void 0 || targetColumns === void 0) {
2596
+ throw new Error(
2597
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2598
+ );
2599
+ }
2600
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2601
+ requireTargetTableName(
2602
+ options.targetTable?.name ?? options.tableName
2603
+ ),
2604
+ {
2605
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2606
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2607
+ },
2608
+ targetSchema,
2609
+ targetColumns
2610
+ );
2611
+ if (targetTable.name === options.materializedViewName) {
2612
+ throw new Error(
2613
+ "Materialized view name cannot be the same as the target table name."
2614
+ );
2615
+ }
2616
+ this.name = options.materializedViewName;
2617
+ this.targetTable = targetTable;
2618
+ this.selectSql = selectStatement;
2619
+ this.sourceTables = options.selectTables.map((t) => t.name);
2620
+ this.metadata = options.metadata ? { ...options.metadata } : {};
2621
+ if (!this.metadata.source) {
2622
+ const stack = new Error().stack;
2623
+ const sourceInfo = getSourceFileFromStack(stack);
2624
+ if (sourceInfo) {
2625
+ this.metadata.source = { file: sourceInfo };
2626
+ }
2627
+ }
2628
+ const materializedViews = getMooseInternal().materializedViews;
2629
+ if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2630
+ throw new Error(`MaterializedView with name ${this.name} already exists`);
2631
+ }
2632
+ materializedViews.set(this.name, this);
2633
+ }
2634
+ };
2635
+ }
2636
+ });
2637
+
2566
2638
  // src/dmv2/sdk/sqlResource.ts
2567
2639
  var SqlResource;
2568
2640
  var init_sqlResource = __esm({
@@ -2626,104 +2698,52 @@ var init_sqlResource = __esm({
2626
2698
  }
2627
2699
  });
2628
2700
 
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
2701
  // src/dmv2/sdk/view.ts
2698
2702
  var View;
2699
2703
  var init_view = __esm({
2700
2704
  "src/dmv2/sdk/view.ts"() {
2701
2705
  "use strict";
2702
- init_helpers();
2703
2706
  init_sqlHelpers();
2704
- init_sqlResource();
2705
- View = class extends SqlResource {
2707
+ init_internal();
2708
+ init_stackTrace();
2709
+ View = class {
2710
+ /** @internal */
2711
+ kind = "CustomView";
2712
+ /** The name of the view */
2713
+ name;
2714
+ /** The SELECT SQL statement that defines the view */
2715
+ selectSql;
2716
+ /** Names of source tables/views that the SELECT reads from */
2717
+ sourceTables;
2718
+ /** Optional metadata for the view */
2719
+ metadata;
2706
2720
  /**
2707
2721
  * Creates a new View instance.
2708
2722
  * @param name The name of the view to be created.
2709
2723
  * @param selectStatement The SQL SELECT statement that defines the view's logic.
2710
2724
  * @param baseTables An array of OlapTable or View objects that the `selectStatement` reads from. Used for dependency tracking.
2725
+ * @param metadata Optional metadata for the view (e.g., description, source file).
2711
2726
  */
2712
- constructor(name, selectStatement, baseTables) {
2727
+ constructor(name, selectStatement, baseTables, metadata) {
2713
2728
  if (typeof selectStatement !== "string") {
2714
2729
  selectStatement = toStaticQuery(selectStatement);
2715
2730
  }
2716
- super(
2717
- name,
2718
- [
2719
- `CREATE VIEW IF NOT EXISTS ${name}
2720
- AS ${selectStatement}`.trim()
2721
- ],
2722
- [dropView(name)],
2723
- {
2724
- pullsDataFrom: baseTables
2731
+ this.name = name;
2732
+ this.selectSql = selectStatement;
2733
+ this.sourceTables = baseTables.map((t) => t.name);
2734
+ this.metadata = metadata ? { ...metadata } : {};
2735
+ if (!this.metadata.source) {
2736
+ const stack = new Error().stack;
2737
+ const sourceInfo = getSourceFileFromStack(stack);
2738
+ if (sourceInfo) {
2739
+ this.metadata.source = { file: sourceInfo };
2725
2740
  }
2726
- );
2741
+ }
2742
+ const customViews = getMooseInternal().customViews;
2743
+ if (!isClientOnlyMode() && customViews.has(this.name)) {
2744
+ throw new Error(`View with name ${this.name} already exists`);
2745
+ }
2746
+ customViews.set(this.name, this);
2727
2747
  }
2728
2748
  };
2729
2749
  }
@@ -2927,6 +2947,18 @@ function getWebApps2() {
2927
2947
  function getWebApp(name) {
2928
2948
  return getMooseInternal().webApps.get(name);
2929
2949
  }
2950
+ function getMaterializedViews() {
2951
+ return getMooseInternal().materializedViews;
2952
+ }
2953
+ function getMaterializedView(name) {
2954
+ return getMooseInternal().materializedViews.get(name);
2955
+ }
2956
+ function getCustomViews() {
2957
+ return getMooseInternal().customViews;
2958
+ }
2959
+ function getCustomView(name) {
2960
+ return getMooseInternal().customViews.get(name);
2961
+ }
2930
2962
  var init_registry = __esm({
2931
2963
  "src/dmv2/registry.ts"() {
2932
2964
  "use strict";
@@ -2976,8 +3008,12 @@ __export(browserCompatible_exports, {
2976
3008
  createClickhouseParameter: () => createClickhouseParameter,
2977
3009
  getApi: () => getApi,
2978
3010
  getApis: () => getApis2,
3011
+ getCustomView: () => getCustomView,
3012
+ getCustomViews: () => getCustomViews,
2979
3013
  getIngestApi: () => getIngestApi,
2980
3014
  getIngestApis: () => getIngestApis,
3015
+ getMaterializedView: () => getMaterializedView,
3016
+ getMaterializedViews: () => getMaterializedViews,
2981
3017
  getSqlResource: () => getSqlResource,
2982
3018
  getSqlResources: () => getSqlResources,
2983
3019
  getStream: () => getStream,
@@ -3026,8 +3062,12 @@ init_browserCompatible();
3026
3062
  createClickhouseParameter,
3027
3063
  getApi,
3028
3064
  getApis,
3065
+ getCustomView,
3066
+ getCustomViews,
3029
3067
  getIngestApi,
3030
3068
  getIngestApis,
3069
+ getMaterializedView,
3070
+ getMaterializedViews,
3031
3071
  getSqlResource,
3032
3072
  getSqlResources,
3033
3073
  getStream,