@514labs/moose-lib 0.6.297-ci-22-g1be0de24 → 0.6.297-ci-35-g4e0a867f

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.
@@ -1894,21 +1894,50 @@ declare class ETLPipeline<T, U> {
1894
1894
  run(): Promise<void>;
1895
1895
  }
1896
1896
 
1897
+ type SqlObject = OlapTable<any> | SqlResource;
1897
1898
  /**
1898
- * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1899
- * Emits structured data for the Moose infrastructure system.
1899
+ * Represents a generic SQL resource that requires setup and teardown commands.
1900
+ * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1900
1901
  */
1901
- declare class View {
1902
+ declare class SqlResource {
1902
1903
  /** @internal */
1903
- readonly kind = "CustomView";
1904
- /** The name of the view */
1904
+ readonly kind = "SqlResource";
1905
+ /** Array of SQL statements to execute for setting up the resource. */
1906
+ setup: readonly string[];
1907
+ /** Array of SQL statements to execute for tearing down the resource. */
1908
+ teardown: readonly string[];
1909
+ /** The name of the SQL resource (e.g., view name, materialized view name). */
1905
1910
  name: string;
1906
- /** The SELECT SQL statement that defines the view */
1907
- selectSql: string;
1908
- /** Names of source tables/views that the SELECT reads from */
1909
- sourceTables: string[];
1910
- /** @internal Source file path where this view was defined */
1911
+ /** List of OlapTables or Views that this resource reads data from. */
1912
+ pullsDataFrom: SqlObject[];
1913
+ /** List of OlapTables or Views that this resource writes data to. */
1914
+ pushesDataTo: SqlObject[];
1915
+ /** @internal Source file path where this resource was defined */
1911
1916
  sourceFile?: string;
1917
+ /** @internal Source line number where this resource was defined */
1918
+ sourceLine?: number;
1919
+ /** @internal Source column number where this resource was defined */
1920
+ sourceColumn?: number;
1921
+ /**
1922
+ * Creates a new SqlResource instance.
1923
+ * @param name The name of the resource.
1924
+ * @param setup An array of SQL DDL statements to create the resource.
1925
+ * @param teardown An array of SQL DDL statements to drop the resource.
1926
+ * @param options Optional configuration for specifying data dependencies.
1927
+ * @param options.pullsDataFrom Tables/Views this resource reads from.
1928
+ * @param options.pushesDataTo Tables/Views this resource writes to.
1929
+ */
1930
+ constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
1931
+ pullsDataFrom?: SqlObject[];
1932
+ pushesDataTo?: SqlObject[];
1933
+ });
1934
+ }
1935
+
1936
+ /**
1937
+ * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1938
+ * Inherits from SqlResource, providing setup (CREATE VIEW) and teardown (DROP VIEW) commands.
1939
+ */
1940
+ declare class View extends SqlResource {
1912
1941
  /**
1913
1942
  * Creates a new View instance.
1914
1943
  * @param name The name of the view to be created.
@@ -1954,19 +1983,9 @@ interface MaterializedViewConfig<T> {
1954
1983
  *
1955
1984
  * @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
1956
1985
  */
1957
- declare class MaterializedView<TargetTable> {
1958
- /** @internal */
1959
- readonly kind = "MaterializedView";
1960
- /** The name of the materialized view */
1961
- name: string;
1986
+ declare class MaterializedView<TargetTable> extends SqlResource {
1962
1987
  /** The target OlapTable instance where the materialized data is stored. */
1963
1988
  targetTable: OlapTable<TargetTable>;
1964
- /** The SELECT SQL statement */
1965
- selectSql: string;
1966
- /** Names of source tables that the SELECT reads from */
1967
- sourceTables: string[];
1968
- /** @internal Source file path where this MV was defined */
1969
- sourceFile?: string;
1970
1989
  /**
1971
1990
  * Creates a new MaterializedView instance.
1972
1991
  * Requires the `TargetTable` type parameter to be explicitly provided or inferred,
@@ -1979,45 +1998,6 @@ declare class MaterializedView<TargetTable> {
1979
1998
  constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
1980
1999
  }
1981
2000
 
1982
- type SqlObject = OlapTable<any> | SqlResource;
1983
- /**
1984
- * Represents a generic SQL resource that requires setup and teardown commands.
1985
- * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1986
- */
1987
- declare class SqlResource {
1988
- /** @internal */
1989
- readonly kind = "SqlResource";
1990
- /** Array of SQL statements to execute for setting up the resource. */
1991
- setup: readonly string[];
1992
- /** Array of SQL statements to execute for tearing down the resource. */
1993
- teardown: readonly string[];
1994
- /** The name of the SQL resource (e.g., view name, materialized view name). */
1995
- name: string;
1996
- /** List of OlapTables or Views that this resource reads data from. */
1997
- pullsDataFrom: SqlObject[];
1998
- /** List of OlapTables or Views that this resource writes data to. */
1999
- pushesDataTo: SqlObject[];
2000
- /** @internal Source file path where this resource was defined */
2001
- sourceFile?: string;
2002
- /** @internal Source line number where this resource was defined */
2003
- sourceLine?: number;
2004
- /** @internal Source column number where this resource was defined */
2005
- sourceColumn?: number;
2006
- /**
2007
- * Creates a new SqlResource instance.
2008
- * @param name The name of the resource.
2009
- * @param setup An array of SQL DDL statements to create the resource.
2010
- * @param teardown An array of SQL DDL statements to drop the resource.
2011
- * @param options Optional configuration for specifying data dependencies.
2012
- * @param options.pullsDataFrom Tables/Views this resource reads from.
2013
- * @param options.pushesDataTo Tables/Views this resource writes to.
2014
- */
2015
- constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
2016
- pullsDataFrom?: SqlObject[];
2017
- pushesDataTo?: SqlObject[];
2018
- });
2019
- }
2020
-
2021
2001
  type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
2022
2002
  interface FrameworkApp {
2023
2003
  handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
@@ -2134,28 +2114,6 @@ declare function getWebApps(): Map<string, WebApp>;
2134
2114
  * @returns The WebApp instance or undefined if not found
2135
2115
  */
2136
2116
  declare function getWebApp(name: string): WebApp | undefined;
2137
- /**
2138
- * Get all registered materialized views.
2139
- * @returns A Map of MV name to MaterializedView instance
2140
- */
2141
- declare function getMaterializedViews(): Map<string, MaterializedView<any>>;
2142
- /**
2143
- * Get a registered materialized view by name.
2144
- * @param name - The name of the materialized view
2145
- * @returns The MaterializedView instance or undefined if not found
2146
- */
2147
- declare function getMaterializedView(name: string): MaterializedView<any> | undefined;
2148
- /**
2149
- * Get all registered custom views.
2150
- * @returns A Map of view name to View instance
2151
- */
2152
- declare function getCustomViews(): Map<string, View>;
2153
- /**
2154
- * Get a registered custom view by name.
2155
- * @param name - The name of the custom view
2156
- * @returns The View instance or undefined if not found
2157
- */
2158
- declare function getCustomView(name: string): View | undefined;
2159
2117
 
2160
2118
  /**
2161
2119
  * @module dmv2
@@ -2197,4 +2155,4 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
2197
2155
  _argType?: ArgType;
2198
2156
  };
2199
2157
 
2200
- export { type RawValue as $, type Aggregated as A, getWorkflows as B, ConsumptionApi as C, type DeadLetterModel as D, type EgressConfig as E, type FrameworkApp as F, getWorkflow as G, getWebApps as H, IngestApi as I, getWebApp as J, getCustomView as K, LifeCycle as L, MaterializedView as M, getCustomViews as N, OlapTable as O, getMaterializedView as P, getMaterializedViews as Q, type ApiUtil as R, type SimpleAggregated as S, Task as T, type ConsumptionUtil as U, View as V, Workflow as W, quoteIdentifier as X, type IdentifierBrandedString as Y, type NonIdentifierBrandedString as Z, type Value as _, type OlapConfig as a, sql as a0, Sql as a1, toStaticQuery as a2, toQuery as a3, toQueryPreview as a4, getValueFromParameter as a5, createClickhouseParameter as a6, mapToClickHouseType as a7, type MooseUtils as a8, MooseClient as a9, type Blocks as aa, ClickHouseEngines as ab, dropView as ac, createMaterializedView as ad, populateTable as ae, QueryClient as af, WorkflowClient as ag, getTemporalClient as ah, ApiHelpers as ai, ConsumptionHelpers as aj, joinQueries as ak, type ConsumerConfig as al, type TransformConfig as am, type TaskContext as an, type TaskConfig as ao, type IngestPipelineConfig as ap, type MaterializedViewConfig as aq, type S3QueueTableSettings as b, Stream as c, type StreamConfig as d, type DeadLetter as e, DeadLetterQueue as f, type IngestConfig as g, Api as h, type ApiConfig as i, IngestPipeline as j, SqlResource as k, ETLPipeline as l, type ETLPipelineConfig as m, WebApp as n, type WebAppConfig as o, type WebAppHandler as p, getTables as q, getTable as r, getStreams as s, getStream as t, getIngestApis as u, getIngestApi as v, getApis as w, getApi as x, getSqlResources as y, getSqlResource as z };
2158
+ export { toQuery as $, type Aggregated as A, getWorkflows as B, ConsumptionApi as C, type DeadLetterModel as D, type EgressConfig as E, type FrameworkApp as F, getWorkflow as G, getWebApps as H, IngestApi as I, getWebApp as J, type ApiUtil as K, LifeCycle as L, MaterializedView as M, type ConsumptionUtil as N, OlapTable as O, quoteIdentifier as P, type IdentifierBrandedString as Q, type NonIdentifierBrandedString as R, type SimpleAggregated as S, Task as T, type Value as U, View as V, Workflow as W, type RawValue as X, sql as Y, Sql as Z, toStaticQuery as _, type OlapConfig as a, toQueryPreview as a0, getValueFromParameter as a1, createClickhouseParameter as a2, mapToClickHouseType as a3, type MooseUtils as a4, MooseClient as a5, type Blocks as a6, ClickHouseEngines as a7, dropView as a8, createMaterializedView as a9, populateTable as aa, QueryClient as ab, WorkflowClient as ac, getTemporalClient as ad, ApiHelpers as ae, ConsumptionHelpers as af, joinQueries as ag, type ConsumerConfig as ah, type TransformConfig as ai, type TaskContext as aj, type TaskConfig as ak, type IngestPipelineConfig as al, type MaterializedViewConfig as am, type S3QueueTableSettings as b, Stream as c, type StreamConfig as d, type DeadLetter as e, DeadLetterQueue as f, type IngestConfig as g, Api as h, type ApiConfig as i, IngestPipeline as j, SqlResource as k, ETLPipeline as l, type ETLPipelineConfig as m, WebApp as n, type WebAppConfig as o, type WebAppHandler as p, getTables as q, getTable as r, getStreams as s, getStream as t, getIngestApis as u, getIngestApi as v, getApis as w, getApi as x, getSqlResources as y, getSqlResource as z };
@@ -1894,21 +1894,50 @@ declare class ETLPipeline<T, U> {
1894
1894
  run(): Promise<void>;
1895
1895
  }
1896
1896
 
1897
+ type SqlObject = OlapTable<any> | SqlResource;
1897
1898
  /**
1898
- * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1899
- * Emits structured data for the Moose infrastructure system.
1899
+ * Represents a generic SQL resource that requires setup and teardown commands.
1900
+ * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1900
1901
  */
1901
- declare class View {
1902
+ declare class SqlResource {
1902
1903
  /** @internal */
1903
- readonly kind = "CustomView";
1904
- /** The name of the view */
1904
+ readonly kind = "SqlResource";
1905
+ /** Array of SQL statements to execute for setting up the resource. */
1906
+ setup: readonly string[];
1907
+ /** Array of SQL statements to execute for tearing down the resource. */
1908
+ teardown: readonly string[];
1909
+ /** The name of the SQL resource (e.g., view name, materialized view name). */
1905
1910
  name: string;
1906
- /** The SELECT SQL statement that defines the view */
1907
- selectSql: string;
1908
- /** Names of source tables/views that the SELECT reads from */
1909
- sourceTables: string[];
1910
- /** @internal Source file path where this view was defined */
1911
+ /** List of OlapTables or Views that this resource reads data from. */
1912
+ pullsDataFrom: SqlObject[];
1913
+ /** List of OlapTables or Views that this resource writes data to. */
1914
+ pushesDataTo: SqlObject[];
1915
+ /** @internal Source file path where this resource was defined */
1911
1916
  sourceFile?: string;
1917
+ /** @internal Source line number where this resource was defined */
1918
+ sourceLine?: number;
1919
+ /** @internal Source column number where this resource was defined */
1920
+ sourceColumn?: number;
1921
+ /**
1922
+ * Creates a new SqlResource instance.
1923
+ * @param name The name of the resource.
1924
+ * @param setup An array of SQL DDL statements to create the resource.
1925
+ * @param teardown An array of SQL DDL statements to drop the resource.
1926
+ * @param options Optional configuration for specifying data dependencies.
1927
+ * @param options.pullsDataFrom Tables/Views this resource reads from.
1928
+ * @param options.pushesDataTo Tables/Views this resource writes to.
1929
+ */
1930
+ constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
1931
+ pullsDataFrom?: SqlObject[];
1932
+ pushesDataTo?: SqlObject[];
1933
+ });
1934
+ }
1935
+
1936
+ /**
1937
+ * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1938
+ * Inherits from SqlResource, providing setup (CREATE VIEW) and teardown (DROP VIEW) commands.
1939
+ */
1940
+ declare class View extends SqlResource {
1912
1941
  /**
1913
1942
  * Creates a new View instance.
1914
1943
  * @param name The name of the view to be created.
@@ -1954,19 +1983,9 @@ interface MaterializedViewConfig<T> {
1954
1983
  *
1955
1984
  * @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
1956
1985
  */
1957
- declare class MaterializedView<TargetTable> {
1958
- /** @internal */
1959
- readonly kind = "MaterializedView";
1960
- /** The name of the materialized view */
1961
- name: string;
1986
+ declare class MaterializedView<TargetTable> extends SqlResource {
1962
1987
  /** The target OlapTable instance where the materialized data is stored. */
1963
1988
  targetTable: OlapTable<TargetTable>;
1964
- /** The SELECT SQL statement */
1965
- selectSql: string;
1966
- /** Names of source tables that the SELECT reads from */
1967
- sourceTables: string[];
1968
- /** @internal Source file path where this MV was defined */
1969
- sourceFile?: string;
1970
1989
  /**
1971
1990
  * Creates a new MaterializedView instance.
1972
1991
  * Requires the `TargetTable` type parameter to be explicitly provided or inferred,
@@ -1979,45 +1998,6 @@ declare class MaterializedView<TargetTable> {
1979
1998
  constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
1980
1999
  }
1981
2000
 
1982
- type SqlObject = OlapTable<any> | SqlResource;
1983
- /**
1984
- * Represents a generic SQL resource that requires setup and teardown commands.
1985
- * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1986
- */
1987
- declare class SqlResource {
1988
- /** @internal */
1989
- readonly kind = "SqlResource";
1990
- /** Array of SQL statements to execute for setting up the resource. */
1991
- setup: readonly string[];
1992
- /** Array of SQL statements to execute for tearing down the resource. */
1993
- teardown: readonly string[];
1994
- /** The name of the SQL resource (e.g., view name, materialized view name). */
1995
- name: string;
1996
- /** List of OlapTables or Views that this resource reads data from. */
1997
- pullsDataFrom: SqlObject[];
1998
- /** List of OlapTables or Views that this resource writes data to. */
1999
- pushesDataTo: SqlObject[];
2000
- /** @internal Source file path where this resource was defined */
2001
- sourceFile?: string;
2002
- /** @internal Source line number where this resource was defined */
2003
- sourceLine?: number;
2004
- /** @internal Source column number where this resource was defined */
2005
- sourceColumn?: number;
2006
- /**
2007
- * Creates a new SqlResource instance.
2008
- * @param name The name of the resource.
2009
- * @param setup An array of SQL DDL statements to create the resource.
2010
- * @param teardown An array of SQL DDL statements to drop the resource.
2011
- * @param options Optional configuration for specifying data dependencies.
2012
- * @param options.pullsDataFrom Tables/Views this resource reads from.
2013
- * @param options.pushesDataTo Tables/Views this resource writes to.
2014
- */
2015
- constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
2016
- pullsDataFrom?: SqlObject[];
2017
- pushesDataTo?: SqlObject[];
2018
- });
2019
- }
2020
-
2021
2001
  type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
2022
2002
  interface FrameworkApp {
2023
2003
  handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
@@ -2134,28 +2114,6 @@ declare function getWebApps(): Map<string, WebApp>;
2134
2114
  * @returns The WebApp instance or undefined if not found
2135
2115
  */
2136
2116
  declare function getWebApp(name: string): WebApp | undefined;
2137
- /**
2138
- * Get all registered materialized views.
2139
- * @returns A Map of MV name to MaterializedView instance
2140
- */
2141
- declare function getMaterializedViews(): Map<string, MaterializedView<any>>;
2142
- /**
2143
- * Get a registered materialized view by name.
2144
- * @param name - The name of the materialized view
2145
- * @returns The MaterializedView instance or undefined if not found
2146
- */
2147
- declare function getMaterializedView(name: string): MaterializedView<any> | undefined;
2148
- /**
2149
- * Get all registered custom views.
2150
- * @returns A Map of view name to View instance
2151
- */
2152
- declare function getCustomViews(): Map<string, View>;
2153
- /**
2154
- * Get a registered custom view by name.
2155
- * @param name - The name of the custom view
2156
- * @returns The View instance or undefined if not found
2157
- */
2158
- declare function getCustomView(name: string): View | undefined;
2159
2117
 
2160
2118
  /**
2161
2119
  * @module dmv2
@@ -2197,4 +2155,4 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
2197
2155
  _argType?: ArgType;
2198
2156
  };
2199
2157
 
2200
- export { type RawValue as $, type Aggregated as A, getWorkflows as B, ConsumptionApi as C, type DeadLetterModel as D, type EgressConfig as E, type FrameworkApp as F, getWorkflow as G, getWebApps as H, IngestApi as I, getWebApp as J, getCustomView as K, LifeCycle as L, MaterializedView as M, getCustomViews as N, OlapTable as O, getMaterializedView as P, getMaterializedViews as Q, type ApiUtil as R, type SimpleAggregated as S, Task as T, type ConsumptionUtil as U, View as V, Workflow as W, quoteIdentifier as X, type IdentifierBrandedString as Y, type NonIdentifierBrandedString as Z, type Value as _, type OlapConfig as a, sql as a0, Sql as a1, toStaticQuery as a2, toQuery as a3, toQueryPreview as a4, getValueFromParameter as a5, createClickhouseParameter as a6, mapToClickHouseType as a7, type MooseUtils as a8, MooseClient as a9, type Blocks as aa, ClickHouseEngines as ab, dropView as ac, createMaterializedView as ad, populateTable as ae, QueryClient as af, WorkflowClient as ag, getTemporalClient as ah, ApiHelpers as ai, ConsumptionHelpers as aj, joinQueries as ak, type ConsumerConfig as al, type TransformConfig as am, type TaskContext as an, type TaskConfig as ao, type IngestPipelineConfig as ap, type MaterializedViewConfig as aq, type S3QueueTableSettings as b, Stream as c, type StreamConfig as d, type DeadLetter as e, DeadLetterQueue as f, type IngestConfig as g, Api as h, type ApiConfig as i, IngestPipeline as j, SqlResource as k, ETLPipeline as l, type ETLPipelineConfig as m, WebApp as n, type WebAppConfig as o, type WebAppHandler as p, getTables as q, getTable as r, getStreams as s, getStream as t, getIngestApis as u, getIngestApi as v, getApis as w, getApi as x, getSqlResources as y, getSqlResource as z };
2158
+ export { toQuery as $, type Aggregated as A, getWorkflows as B, ConsumptionApi as C, type DeadLetterModel as D, type EgressConfig as E, type FrameworkApp as F, getWorkflow as G, getWebApps as H, IngestApi as I, getWebApp as J, type ApiUtil as K, LifeCycle as L, MaterializedView as M, type ConsumptionUtil as N, OlapTable as O, quoteIdentifier as P, type IdentifierBrandedString as Q, type NonIdentifierBrandedString as R, type SimpleAggregated as S, Task as T, type Value as U, View as V, Workflow as W, type RawValue as X, sql as Y, Sql as Z, toStaticQuery as _, type OlapConfig as a, toQueryPreview as a0, getValueFromParameter as a1, createClickhouseParameter as a2, mapToClickHouseType as a3, type MooseUtils as a4, MooseClient as a5, type Blocks as a6, ClickHouseEngines as a7, dropView as a8, createMaterializedView as a9, populateTable as aa, QueryClient as ab, WorkflowClient as ac, getTemporalClient as ad, ApiHelpers as ae, ConsumptionHelpers as af, joinQueries as ag, type ConsumerConfig as ah, type TransformConfig as ai, type TaskContext as aj, type TaskConfig as ak, type IngestPipelineConfig as al, type MaterializedViewConfig as am, type S3QueueTableSettings as b, Stream as c, type StreamConfig as d, type DeadLetter as e, DeadLetterQueue as f, type IngestConfig as g, Api as h, type ApiConfig as i, IngestPipeline as j, SqlResource as k, ETLPipeline as l, type ETLPipelineConfig as m, WebApp as n, type WebAppConfig as o, type WebAppHandler as p, getTables as q, getTable as r, getStreams as s, getStream as t, getIngestApis as u, getIngestApi as v, getApis as w, getApi as x, getSqlResources as y, getSqlResource as z };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- 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, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, 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-CkQfVyoI.mjs';
2
- import { a8 as MooseUtils, R as ApiUtil, a9 as MooseClient } from './index-9XL-mk89.mjs';
3
- export { A as Aggregated, h as Api, i as ApiConfig, ai as ApiHelpers, aa as Blocks, ab as ClickHouseEngines, C as ConsumptionApi, aj as ConsumptionHelpers, 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, af as QueryClient, $ 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, ag as WorkflowClient, a6 as createClickhouseParameter, ad as createMaterializedView, ac as dropView, 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, ah as getTemporalClient, a5 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, ak as joinQueries, a7 as mapToClickHouseType, ae as populateTable, X as quoteIdentifier, a0 as sql, a3 as toQuery, a4 as toQueryPreview, a2 as toStaticQuery } from './index-9XL-mk89.mjs';
1
+ 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, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, 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';
2
+ import { a4 as MooseUtils, K as ApiUtil, a5 as MooseClient } from './index-CcHF2cVT.mjs';
3
+ export { A as Aggregated, h as Api, i as ApiConfig, ae as ApiHelpers, a6 as Blocks, a7 as ClickHouseEngines, C as ConsumptionApi, af as ConsumptionHelpers, 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, ab as QueryClient, 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, ac as WorkflowClient, a2 as createClickhouseParameter, a9 as createMaterializedView, a8 as dropView, 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, ad as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, ag as joinQueries, a3 as mapToClickHouseType, aa as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-CcHF2cVT.mjs';
4
4
  import * as _clickhouse_client from '@clickhouse/client';
5
5
  import { KafkaJS } from '@514labs/kafka-javascript';
6
6
  import http from 'http';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- 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, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, 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-CprLtYmW.js';
2
- import { a8 as MooseUtils, R as ApiUtil, a9 as MooseClient } from './index-9XL-mk89.js';
3
- export { A as Aggregated, h as Api, i as ApiConfig, ai as ApiHelpers, aa as Blocks, ab as ClickHouseEngines, C as ConsumptionApi, aj as ConsumptionHelpers, 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, af as QueryClient, $ 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, ag as WorkflowClient, a6 as createClickhouseParameter, ad as createMaterializedView, ac as dropView, 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, ah as getTemporalClient, a5 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, ak as joinQueries, a7 as mapToClickHouseType, ae as populateTable, X as quoteIdentifier, a0 as sql, a3 as toQuery, a4 as toQueryPreview, a2 as toStaticQuery } from './index-9XL-mk89.js';
1
+ 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, e as ClickHouseLineString, p as ClickHouseMaterialized, f as ClickHouseMultiLineString, h as ClickHouseMultiPolygon, b as ClickHouseNamedTuple, c as ClickHousePoint, g as ClickHousePolygon, i as ClickHousePrecision, d as ClickHouseRing, 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';
2
+ import { a4 as MooseUtils, K as ApiUtil, a5 as MooseClient } from './index-CcHF2cVT.js';
3
+ export { A as Aggregated, h as Api, i as ApiConfig, ae as ApiHelpers, a6 as Blocks, a7 as ClickHouseEngines, C as ConsumptionApi, af as ConsumptionHelpers, 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, ab as QueryClient, 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, ac as WorkflowClient, a2 as createClickhouseParameter, a9 as createMaterializedView, a8 as dropView, 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, ad as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, ag as joinQueries, a3 as mapToClickHouseType, aa as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-CcHF2cVT.js';
4
4
  import * as _clickhouse_client from '@clickhouse/client';
5
5
  import { KafkaJS } from '@514labs/kafka-javascript';
6
6
  import http from 'http';
package/dist/index.js CHANGED
@@ -562,9 +562,7 @@ var init_internal = __esm({
562
562
  apis: /* @__PURE__ */ new Map(),
563
563
  sqlResources: /* @__PURE__ */ new Map(),
564
564
  workflows: /* @__PURE__ */ new Map(),
565
- webApps: /* @__PURE__ */ new Map(),
566
- materializedViews: /* @__PURE__ */ new Map(),
567
- customViews: /* @__PURE__ */ new Map()
565
+ webApps: /* @__PURE__ */ new Map()
568
566
  };
569
567
  defaultRetentionPeriod = 60 * 60 * 24 * 7;
570
568
  getMooseInternal = () => globalThis.moose_internal;
@@ -580,8 +578,6 @@ var init_internal = __esm({
580
578
  registry.sqlResources.clear();
581
579
  registry.workflows.clear();
582
580
  registry.webApps.clear();
583
- registry.materializedViews.clear();
584
- registry.customViews.clear();
585
581
  const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
586
582
  Object.keys(require.cache).forEach((key) => {
587
583
  if (key.startsWith(appDir)) {
@@ -2480,78 +2476,6 @@ var init_etlPipeline = __esm({
2480
2476
  }
2481
2477
  });
2482
2478
 
2483
- // src/dmv2/sdk/materializedView.ts
2484
- var requireTargetTableName, MaterializedView;
2485
- var init_materializedView = __esm({
2486
- "src/dmv2/sdk/materializedView.ts"() {
2487
- "use strict";
2488
- init_helpers();
2489
- init_sqlHelpers();
2490
- init_olapTable();
2491
- init_internal();
2492
- init_stackTrace();
2493
- requireTargetTableName = (tableName) => {
2494
- if (typeof tableName === "string") {
2495
- return tableName;
2496
- } else {
2497
- throw new Error("Name of targetTable is not specified.");
2498
- }
2499
- };
2500
- MaterializedView = class {
2501
- /** @internal */
2502
- kind = "MaterializedView";
2503
- /** The name of the materialized view */
2504
- name;
2505
- /** The target OlapTable instance where the materialized data is stored. */
2506
- targetTable;
2507
- /** The SELECT SQL statement */
2508
- selectSql;
2509
- /** Names of source tables that the SELECT reads from */
2510
- sourceTables;
2511
- /** @internal Source file path where this MV was defined */
2512
- sourceFile;
2513
- constructor(options, targetSchema, targetColumns) {
2514
- let selectStatement = options.selectStatement;
2515
- if (typeof selectStatement !== "string") {
2516
- selectStatement = toStaticQuery(selectStatement);
2517
- }
2518
- if (targetSchema === void 0 || targetColumns === void 0) {
2519
- throw new Error(
2520
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2521
- );
2522
- }
2523
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2524
- requireTargetTableName(
2525
- options.targetTable?.name ?? options.tableName
2526
- ),
2527
- {
2528
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2529
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2530
- },
2531
- targetSchema,
2532
- targetColumns
2533
- );
2534
- if (targetTable.name === options.materializedViewName) {
2535
- throw new Error(
2536
- "Materialized view name cannot be the same as the target table name."
2537
- );
2538
- }
2539
- this.name = options.materializedViewName;
2540
- this.targetTable = targetTable;
2541
- this.selectSql = selectStatement;
2542
- this.sourceTables = options.selectTables.map((t) => t.name);
2543
- const stack = new Error().stack;
2544
- this.sourceFile = getSourceFileFromStack(stack);
2545
- const materializedViews = getMooseInternal().materializedViews;
2546
- if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2547
- throw new Error(`MaterializedView with name ${this.name} already exists`);
2548
- }
2549
- materializedViews.set(this.name, this);
2550
- }
2551
- };
2552
- }
2553
- });
2554
-
2555
2479
  // src/dmv2/sdk/sqlResource.ts
2556
2480
  var SqlResource;
2557
2481
  var init_sqlResource = __esm({
@@ -2615,25 +2539,83 @@ var init_sqlResource = __esm({
2615
2539
  }
2616
2540
  });
2617
2541
 
2542
+ // src/dmv2/sdk/materializedView.ts
2543
+ var requireTargetTableName, MaterializedView;
2544
+ var init_materializedView = __esm({
2545
+ "src/dmv2/sdk/materializedView.ts"() {
2546
+ "use strict";
2547
+ init_helpers();
2548
+ init_sqlHelpers();
2549
+ init_olapTable();
2550
+ init_sqlResource();
2551
+ requireTargetTableName = (tableName) => {
2552
+ if (typeof tableName === "string") {
2553
+ return tableName;
2554
+ } else {
2555
+ throw new Error("Name of targetTable is not specified.");
2556
+ }
2557
+ };
2558
+ MaterializedView = class extends SqlResource {
2559
+ /** The target OlapTable instance where the materialized data is stored. */
2560
+ targetTable;
2561
+ constructor(options, targetSchema, targetColumns) {
2562
+ let selectStatement = options.selectStatement;
2563
+ if (typeof selectStatement !== "string") {
2564
+ selectStatement = toStaticQuery(selectStatement);
2565
+ }
2566
+ if (targetSchema === void 0 || targetColumns === void 0) {
2567
+ throw new Error(
2568
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2569
+ );
2570
+ }
2571
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2572
+ requireTargetTableName(
2573
+ options.targetTable?.name ?? options.tableName
2574
+ ),
2575
+ {
2576
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2577
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2578
+ },
2579
+ targetSchema,
2580
+ targetColumns
2581
+ );
2582
+ if (targetTable.name === options.materializedViewName) {
2583
+ throw new Error(
2584
+ "Materialized view name cannot be the same as the target table name."
2585
+ );
2586
+ }
2587
+ super(
2588
+ options.materializedViewName,
2589
+ [
2590
+ createMaterializedView({
2591
+ name: options.materializedViewName,
2592
+ destinationTable: targetTable.name,
2593
+ select: selectStatement
2594
+ })
2595
+ // Population is now handled automatically by Rust infrastructure
2596
+ // based on table engine type and whether this is a new or updated view
2597
+ ],
2598
+ [dropView(options.materializedViewName)],
2599
+ {
2600
+ pullsDataFrom: options.selectTables,
2601
+ pushesDataTo: [targetTable]
2602
+ }
2603
+ );
2604
+ this.targetTable = targetTable;
2605
+ }
2606
+ };
2607
+ }
2608
+ });
2609
+
2618
2610
  // src/dmv2/sdk/view.ts
2619
2611
  var View;
2620
2612
  var init_view = __esm({
2621
2613
  "src/dmv2/sdk/view.ts"() {
2622
2614
  "use strict";
2615
+ init_helpers();
2623
2616
  init_sqlHelpers();
2624
- init_internal();
2625
- init_stackTrace();
2626
- View = class {
2627
- /** @internal */
2628
- kind = "CustomView";
2629
- /** The name of the view */
2630
- name;
2631
- /** The SELECT SQL statement that defines the view */
2632
- selectSql;
2633
- /** Names of source tables/views that the SELECT reads from */
2634
- sourceTables;
2635
- /** @internal Source file path where this view was defined */
2636
- sourceFile;
2617
+ init_sqlResource();
2618
+ View = class extends SqlResource {
2637
2619
  /**
2638
2620
  * Creates a new View instance.
2639
2621
  * @param name The name of the view to be created.
@@ -2644,16 +2626,17 @@ var init_view = __esm({
2644
2626
  if (typeof selectStatement !== "string") {
2645
2627
  selectStatement = toStaticQuery(selectStatement);
2646
2628
  }
2647
- this.name = name;
2648
- this.selectSql = selectStatement;
2649
- this.sourceTables = baseTables.map((t) => t.name);
2650
- const stack = new Error().stack;
2651
- this.sourceFile = getSourceFileFromStack(stack);
2652
- const customViews = getMooseInternal().customViews;
2653
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2654
- throw new Error(`View with name ${this.name} already exists`);
2655
- }
2656
- customViews.set(this.name, this);
2629
+ super(
2630
+ name,
2631
+ [
2632
+ `CREATE VIEW IF NOT EXISTS ${name}
2633
+ AS ${selectStatement}`.trim()
2634
+ ],
2635
+ [dropView(name)],
2636
+ {
2637
+ pullsDataFrom: baseTables
2638
+ }
2639
+ );
2657
2640
  }
2658
2641
  };
2659
2642
  }
@@ -2857,18 +2840,6 @@ function getWebApps() {
2857
2840
  function getWebApp(name) {
2858
2841
  return getMooseInternal().webApps.get(name);
2859
2842
  }
2860
- function getMaterializedViews() {
2861
- return getMooseInternal().materializedViews;
2862
- }
2863
- function getMaterializedView(name) {
2864
- return getMooseInternal().materializedViews.get(name);
2865
- }
2866
- function getCustomViews() {
2867
- return getMooseInternal().customViews;
2868
- }
2869
- function getCustomView(name) {
2870
- return getMooseInternal().customViews.get(name);
2871
- }
2872
2843
  var init_registry = __esm({
2873
2844
  "src/dmv2/registry.ts"() {
2874
2845
  "use strict";
@@ -3751,16 +3722,12 @@ __export(index_exports, {
3751
3722
  getApi: () => getApi,
3752
3723
  getApis: () => getApis,
3753
3724
  getClickhouseClient: () => getClickhouseClient,
3754
- getCustomView: () => getCustomView,
3755
- getCustomViews: () => getCustomViews,
3756
3725
  getFileName: () => getFileName,
3757
3726
  getIngestApi: () => getIngestApi,
3758
3727
  getIngestApis: () => getIngestApis,
3759
3728
  getKafkaClient: () => getKafkaClient,
3760
3729
  getKafkaProducer: () => getKafkaProducer,
3761
3730
  getLegacyMooseUtils: () => getLegacyMooseUtils,
3762
- getMaterializedView: () => getMaterializedView,
3763
- getMaterializedViews: () => getMaterializedViews,
3764
3731
  getMooseClients: () => getMooseClients,
3765
3732
  getMooseUtils: () => getMooseUtils,
3766
3733
  getMooseUtilsFromRequest: () => getMooseUtilsFromRequest,
@@ -3863,16 +3830,12 @@ init_index();
3863
3830
  getApi,
3864
3831
  getApis,
3865
3832
  getClickhouseClient,
3866
- getCustomView,
3867
- getCustomViews,
3868
3833
  getFileName,
3869
3834
  getIngestApi,
3870
3835
  getIngestApis,
3871
3836
  getKafkaClient,
3872
3837
  getKafkaProducer,
3873
3838
  getLegacyMooseUtils,
3874
- getMaterializedView,
3875
- getMaterializedViews,
3876
3839
  getMooseClients,
3877
3840
  getMooseUtils,
3878
3841
  getMooseUtilsFromRequest,