@514labs/moose-lib 0.6.279-ci-2-g69faf7b6 → 0.6.280

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.
@@ -1882,21 +1882,50 @@ declare class ETLPipeline<T, U> {
1882
1882
  run(): Promise<void>;
1883
1883
  }
1884
1884
 
1885
+ type SqlObject = OlapTable<any> | SqlResource;
1885
1886
  /**
1886
- * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1887
- * Emits structured data for the Moose infrastructure system.
1887
+ * Represents a generic SQL resource that requires setup and teardown commands.
1888
+ * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1888
1889
  */
1889
- declare class View {
1890
+ declare class SqlResource {
1890
1891
  /** @internal */
1891
- readonly kind = "CustomView";
1892
- /** The name of the view */
1892
+ readonly kind = "SqlResource";
1893
+ /** Array of SQL statements to execute for setting up the resource. */
1894
+ setup: readonly string[];
1895
+ /** Array of SQL statements to execute for tearing down the resource. */
1896
+ teardown: readonly string[];
1897
+ /** The name of the SQL resource (e.g., view name, materialized view name). */
1893
1898
  name: string;
1894
- /** The SELECT SQL statement that defines the view */
1895
- selectSql: string;
1896
- /** Names of source tables/views that the SELECT reads from */
1897
- sourceTables: string[];
1898
- /** @internal Source file path where this view was defined */
1899
+ /** List of OlapTables or Views that this resource reads data from. */
1900
+ pullsDataFrom: SqlObject[];
1901
+ /** List of OlapTables or Views that this resource writes data to. */
1902
+ pushesDataTo: SqlObject[];
1903
+ /** @internal Source file path where this resource was defined */
1899
1904
  sourceFile?: string;
1905
+ /** @internal Source line number where this resource was defined */
1906
+ sourceLine?: number;
1907
+ /** @internal Source column number where this resource was defined */
1908
+ sourceColumn?: number;
1909
+ /**
1910
+ * Creates a new SqlResource instance.
1911
+ * @param name The name of the resource.
1912
+ * @param setup An array of SQL DDL statements to create the resource.
1913
+ * @param teardown An array of SQL DDL statements to drop the resource.
1914
+ * @param options Optional configuration for specifying data dependencies.
1915
+ * @param options.pullsDataFrom Tables/Views this resource reads from.
1916
+ * @param options.pushesDataTo Tables/Views this resource writes to.
1917
+ */
1918
+ constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
1919
+ pullsDataFrom?: SqlObject[];
1920
+ pushesDataTo?: SqlObject[];
1921
+ });
1922
+ }
1923
+
1924
+ /**
1925
+ * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1926
+ * Inherits from SqlResource, providing setup (CREATE VIEW) and teardown (DROP VIEW) commands.
1927
+ */
1928
+ declare class View extends SqlResource {
1900
1929
  /**
1901
1930
  * Creates a new View instance.
1902
1931
  * @param name The name of the view to be created.
@@ -1942,19 +1971,9 @@ interface MaterializedViewConfig<T> {
1942
1971
  *
1943
1972
  * @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
1944
1973
  */
1945
- declare class MaterializedView<TargetTable> {
1946
- /** @internal */
1947
- readonly kind = "MaterializedView";
1948
- /** The name of the materialized view */
1949
- name: string;
1974
+ declare class MaterializedView<TargetTable> extends SqlResource {
1950
1975
  /** The target OlapTable instance where the materialized data is stored. */
1951
1976
  targetTable: OlapTable<TargetTable>;
1952
- /** The SELECT SQL statement */
1953
- selectSql: string;
1954
- /** Names of source tables that the SELECT reads from */
1955
- sourceTables: string[];
1956
- /** @internal Source file path where this MV was defined */
1957
- sourceFile?: string;
1958
1977
  /**
1959
1978
  * Creates a new MaterializedView instance.
1960
1979
  * Requires the `TargetTable` type parameter to be explicitly provided or inferred,
@@ -1967,45 +1986,6 @@ declare class MaterializedView<TargetTable> {
1967
1986
  constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
1968
1987
  }
1969
1988
 
1970
- type SqlObject = OlapTable<any> | SqlResource;
1971
- /**
1972
- * Represents a generic SQL resource that requires setup and teardown commands.
1973
- * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1974
- */
1975
- declare class SqlResource {
1976
- /** @internal */
1977
- readonly kind = "SqlResource";
1978
- /** Array of SQL statements to execute for setting up the resource. */
1979
- setup: readonly string[];
1980
- /** Array of SQL statements to execute for tearing down the resource. */
1981
- teardown: readonly string[];
1982
- /** The name of the SQL resource (e.g., view name, materialized view name). */
1983
- name: string;
1984
- /** List of OlapTables or Views that this resource reads data from. */
1985
- pullsDataFrom: SqlObject[];
1986
- /** List of OlapTables or Views that this resource writes data to. */
1987
- pushesDataTo: SqlObject[];
1988
- /** @internal Source file path where this resource was defined */
1989
- sourceFile?: string;
1990
- /** @internal Source line number where this resource was defined */
1991
- sourceLine?: number;
1992
- /** @internal Source column number where this resource was defined */
1993
- sourceColumn?: number;
1994
- /**
1995
- * Creates a new SqlResource instance.
1996
- * @param name The name of the resource.
1997
- * @param setup An array of SQL DDL statements to create the resource.
1998
- * @param teardown An array of SQL DDL statements to drop the resource.
1999
- * @param options Optional configuration for specifying data dependencies.
2000
- * @param options.pullsDataFrom Tables/Views this resource reads from.
2001
- * @param options.pushesDataTo Tables/Views this resource writes to.
2002
- */
2003
- constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
2004
- pullsDataFrom?: SqlObject[];
2005
- pushesDataTo?: SqlObject[];
2006
- });
2007
- }
2008
-
2009
1989
  type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
2010
1990
  interface FrameworkApp {
2011
1991
  handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
@@ -2122,28 +2102,6 @@ declare function getWebApps(): Map<string, WebApp>;
2122
2102
  * @returns The WebApp instance or undefined if not found
2123
2103
  */
2124
2104
  declare function getWebApp(name: string): WebApp | undefined;
2125
- /**
2126
- * Get all registered materialized views.
2127
- * @returns A Map of MV name to MaterializedView instance
2128
- */
2129
- declare function getMaterializedViews(): Map<string, MaterializedView<any>>;
2130
- /**
2131
- * Get a registered materialized view by name.
2132
- * @param name - The name of the materialized view
2133
- * @returns The MaterializedView instance or undefined if not found
2134
- */
2135
- declare function getMaterializedView(name: string): MaterializedView<any> | undefined;
2136
- /**
2137
- * Get all registered custom views.
2138
- * @returns A Map of view name to View instance
2139
- */
2140
- declare function getCustomViews(): Map<string, View>;
2141
- /**
2142
- * Get a registered custom view by name.
2143
- * @param name - The name of the custom view
2144
- * @returns The View instance or undefined if not found
2145
- */
2146
- declare function getCustomView(name: string): View | undefined;
2147
2105
 
2148
2106
  /**
2149
2107
  * @module dmv2
@@ -2185,4 +2143,4 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
2185
2143
  _argType?: ArgType;
2186
2144
  };
2187
2145
 
2188
- 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, MooseClient as a4, type Blocks as a5, ClickHouseEngines as a6, dropView as a7, createMaterializedView as a8, populateTable as a9, QueryClient as aa, WorkflowClient as ab, getTemporalClient as ac, ApiHelpers as ad, ConsumptionHelpers as ae, joinQueries as af, type ConsumerConfig as ag, type TransformConfig as ah, type TaskContext as ai, type TaskConfig as aj, type IngestPipelineConfig as ak, type MaterializedViewConfig as al, getMaterializedViews as am, getMaterializedView as an, getCustomViews as ao, getCustomView as ap, 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 };
2146
+ 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, MooseClient as a4, type Blocks as a5, ClickHouseEngines as a6, dropView as a7, createMaterializedView as a8, populateTable as a9, QueryClient as aa, WorkflowClient as ab, getTemporalClient as ac, ApiHelpers as ad, ConsumptionHelpers as ae, joinQueries as af, type ConsumerConfig as ag, type TransformConfig as ah, type TaskContext as ai, type TaskConfig as aj, type IngestPipelineConfig as ak, type MaterializedViewConfig as al, 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 };
@@ -1882,21 +1882,50 @@ declare class ETLPipeline<T, U> {
1882
1882
  run(): Promise<void>;
1883
1883
  }
1884
1884
 
1885
+ type SqlObject = OlapTable<any> | SqlResource;
1885
1886
  /**
1886
- * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1887
- * Emits structured data for the Moose infrastructure system.
1887
+ * Represents a generic SQL resource that requires setup and teardown commands.
1888
+ * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1888
1889
  */
1889
- declare class View {
1890
+ declare class SqlResource {
1890
1891
  /** @internal */
1891
- readonly kind = "CustomView";
1892
- /** The name of the view */
1892
+ readonly kind = "SqlResource";
1893
+ /** Array of SQL statements to execute for setting up the resource. */
1894
+ setup: readonly string[];
1895
+ /** Array of SQL statements to execute for tearing down the resource. */
1896
+ teardown: readonly string[];
1897
+ /** The name of the SQL resource (e.g., view name, materialized view name). */
1893
1898
  name: string;
1894
- /** The SELECT SQL statement that defines the view */
1895
- selectSql: string;
1896
- /** Names of source tables/views that the SELECT reads from */
1897
- sourceTables: string[];
1898
- /** @internal Source file path where this view was defined */
1899
+ /** List of OlapTables or Views that this resource reads data from. */
1900
+ pullsDataFrom: SqlObject[];
1901
+ /** List of OlapTables or Views that this resource writes data to. */
1902
+ pushesDataTo: SqlObject[];
1903
+ /** @internal Source file path where this resource was defined */
1899
1904
  sourceFile?: string;
1905
+ /** @internal Source line number where this resource was defined */
1906
+ sourceLine?: number;
1907
+ /** @internal Source column number where this resource was defined */
1908
+ sourceColumn?: number;
1909
+ /**
1910
+ * Creates a new SqlResource instance.
1911
+ * @param name The name of the resource.
1912
+ * @param setup An array of SQL DDL statements to create the resource.
1913
+ * @param teardown An array of SQL DDL statements to drop the resource.
1914
+ * @param options Optional configuration for specifying data dependencies.
1915
+ * @param options.pullsDataFrom Tables/Views this resource reads from.
1916
+ * @param options.pushesDataTo Tables/Views this resource writes to.
1917
+ */
1918
+ constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
1919
+ pullsDataFrom?: SqlObject[];
1920
+ pushesDataTo?: SqlObject[];
1921
+ });
1922
+ }
1923
+
1924
+ /**
1925
+ * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1926
+ * Inherits from SqlResource, providing setup (CREATE VIEW) and teardown (DROP VIEW) commands.
1927
+ */
1928
+ declare class View extends SqlResource {
1900
1929
  /**
1901
1930
  * Creates a new View instance.
1902
1931
  * @param name The name of the view to be created.
@@ -1942,19 +1971,9 @@ interface MaterializedViewConfig<T> {
1942
1971
  *
1943
1972
  * @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
1944
1973
  */
1945
- declare class MaterializedView<TargetTable> {
1946
- /** @internal */
1947
- readonly kind = "MaterializedView";
1948
- /** The name of the materialized view */
1949
- name: string;
1974
+ declare class MaterializedView<TargetTable> extends SqlResource {
1950
1975
  /** The target OlapTable instance where the materialized data is stored. */
1951
1976
  targetTable: OlapTable<TargetTable>;
1952
- /** The SELECT SQL statement */
1953
- selectSql: string;
1954
- /** Names of source tables that the SELECT reads from */
1955
- sourceTables: string[];
1956
- /** @internal Source file path where this MV was defined */
1957
- sourceFile?: string;
1958
1977
  /**
1959
1978
  * Creates a new MaterializedView instance.
1960
1979
  * Requires the `TargetTable` type parameter to be explicitly provided or inferred,
@@ -1967,45 +1986,6 @@ declare class MaterializedView<TargetTable> {
1967
1986
  constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
1968
1987
  }
1969
1988
 
1970
- type SqlObject = OlapTable<any> | SqlResource;
1971
- /**
1972
- * Represents a generic SQL resource that requires setup and teardown commands.
1973
- * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1974
- */
1975
- declare class SqlResource {
1976
- /** @internal */
1977
- readonly kind = "SqlResource";
1978
- /** Array of SQL statements to execute for setting up the resource. */
1979
- setup: readonly string[];
1980
- /** Array of SQL statements to execute for tearing down the resource. */
1981
- teardown: readonly string[];
1982
- /** The name of the SQL resource (e.g., view name, materialized view name). */
1983
- name: string;
1984
- /** List of OlapTables or Views that this resource reads data from. */
1985
- pullsDataFrom: SqlObject[];
1986
- /** List of OlapTables or Views that this resource writes data to. */
1987
- pushesDataTo: SqlObject[];
1988
- /** @internal Source file path where this resource was defined */
1989
- sourceFile?: string;
1990
- /** @internal Source line number where this resource was defined */
1991
- sourceLine?: number;
1992
- /** @internal Source column number where this resource was defined */
1993
- sourceColumn?: number;
1994
- /**
1995
- * Creates a new SqlResource instance.
1996
- * @param name The name of the resource.
1997
- * @param setup An array of SQL DDL statements to create the resource.
1998
- * @param teardown An array of SQL DDL statements to drop the resource.
1999
- * @param options Optional configuration for specifying data dependencies.
2000
- * @param options.pullsDataFrom Tables/Views this resource reads from.
2001
- * @param options.pushesDataTo Tables/Views this resource writes to.
2002
- */
2003
- constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
2004
- pullsDataFrom?: SqlObject[];
2005
- pushesDataTo?: SqlObject[];
2006
- });
2007
- }
2008
-
2009
1989
  type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
2010
1990
  interface FrameworkApp {
2011
1991
  handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
@@ -2122,28 +2102,6 @@ declare function getWebApps(): Map<string, WebApp>;
2122
2102
  * @returns The WebApp instance or undefined if not found
2123
2103
  */
2124
2104
  declare function getWebApp(name: string): WebApp | undefined;
2125
- /**
2126
- * Get all registered materialized views.
2127
- * @returns A Map of MV name to MaterializedView instance
2128
- */
2129
- declare function getMaterializedViews(): Map<string, MaterializedView<any>>;
2130
- /**
2131
- * Get a registered materialized view by name.
2132
- * @param name - The name of the materialized view
2133
- * @returns The MaterializedView instance or undefined if not found
2134
- */
2135
- declare function getMaterializedView(name: string): MaterializedView<any> | undefined;
2136
- /**
2137
- * Get all registered custom views.
2138
- * @returns A Map of view name to View instance
2139
- */
2140
- declare function getCustomViews(): Map<string, View>;
2141
- /**
2142
- * Get a registered custom view by name.
2143
- * @param name - The name of the custom view
2144
- * @returns The View instance or undefined if not found
2145
- */
2146
- declare function getCustomView(name: string): View | undefined;
2147
2105
 
2148
2106
  /**
2149
2107
  * @module dmv2
@@ -2185,4 +2143,4 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
2185
2143
  _argType?: ArgType;
2186
2144
  };
2187
2145
 
2188
- 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, MooseClient as a4, type Blocks as a5, ClickHouseEngines as a6, dropView as a7, createMaterializedView as a8, populateTable as a9, QueryClient as aa, WorkflowClient as ab, getTemporalClient as ac, ApiHelpers as ad, ConsumptionHelpers as ae, joinQueries as af, type ConsumerConfig as ag, type TransformConfig as ah, type TaskContext as ai, type TaskConfig as aj, type IngestPipelineConfig as ak, type MaterializedViewConfig as al, getMaterializedViews as am, getMaterializedView as an, getCustomViews as ao, getCustomView as ap, 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 };
2146
+ 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, MooseClient as a4, type Blocks as a5, ClickHouseEngines as a6, dropView as a7, createMaterializedView as a8, populateTable as a9, QueryClient as aa, WorkflowClient as ab, getTemporalClient as ac, ApiHelpers as ad, ConsumptionHelpers as ae, joinQueries as af, type ConsumerConfig as ag, type TransformConfig as ah, type TaskContext as ai, type TaskConfig as aj, type IngestPipelineConfig as ak, type MaterializedViewConfig as al, 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-Bs-byVfO.mjs';
2
- import { K as ApiUtil, a4 as MooseClient } from './index-KhGbXtkS.mjs';
3
- export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae 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, aa 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, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 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, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-KhGbXtkS.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-15NCyT1P.mjs';
2
+ import { K as ApiUtil, a4 as MooseClient } from './index-BtkwFbT9.mjs';
3
+ export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae 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, aa 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, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 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, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-BtkwFbT9.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-D8Hbpq6L.js';
2
- import { K as ApiUtil, a4 as MooseClient } from './index-KhGbXtkS.js';
3
- export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae 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, aa 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, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 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, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-KhGbXtkS.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-BUKAJYbj.js';
2
+ import { K as ApiUtil, a4 as MooseClient } from './index-BtkwFbT9.js';
3
+ export { A as Aggregated, h as Api, i as ApiConfig, ad as ApiHelpers, a5 as Blocks, a6 as ClickHouseEngines, C as ConsumptionApi, ae 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, aa 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, ab as WorkflowClient, a2 as createClickhouseParameter, a8 as createMaterializedView, a7 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, ac as getTemporalClient, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, af as joinQueries, a3 as mapToClickHouseType, a9 as populateTable, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-BtkwFbT9.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
@@ -796,9 +796,7 @@ var moose_internal = {
796
796
  apis: /* @__PURE__ */ new Map(),
797
797
  sqlResources: /* @__PURE__ */ new Map(),
798
798
  workflows: /* @__PURE__ */ new Map(),
799
- webApps: /* @__PURE__ */ new Map(),
800
- materializedViews: /* @__PURE__ */ new Map(),
801
- customViews: /* @__PURE__ */ new Map()
799
+ webApps: /* @__PURE__ */ new Map()
802
800
  };
803
801
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
804
802
  var getMooseInternal = () => globalThis.moose_internal;
@@ -814,8 +812,6 @@ var loadIndex = () => {
814
812
  registry.sqlResources.clear();
815
813
  registry.workflows.clear();
816
814
  registry.webApps.clear();
817
- registry.materializedViews.clear();
818
- registry.customViews.clear();
819
815
  const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
820
816
  Object.keys(require.cache).forEach((key) => {
821
817
  if (key.startsWith(appDir)) {
@@ -2462,67 +2458,6 @@ var ETLPipeline = class {
2462
2458
  }
2463
2459
  };
2464
2460
 
2465
- // src/dmv2/sdk/materializedView.ts
2466
- var requireTargetTableName = (tableName) => {
2467
- if (typeof tableName === "string") {
2468
- return tableName;
2469
- } else {
2470
- throw new Error("Name of targetTable is not specified.");
2471
- }
2472
- };
2473
- var MaterializedView = class {
2474
- /** @internal */
2475
- kind = "MaterializedView";
2476
- /** The name of the materialized view */
2477
- name;
2478
- /** The target OlapTable instance where the materialized data is stored. */
2479
- targetTable;
2480
- /** The SELECT SQL statement */
2481
- selectSql;
2482
- /** Names of source tables that the SELECT reads from */
2483
- sourceTables;
2484
- /** @internal Source file path where this MV was defined */
2485
- sourceFile;
2486
- constructor(options, targetSchema, targetColumns) {
2487
- let selectStatement = options.selectStatement;
2488
- if (typeof selectStatement !== "string") {
2489
- selectStatement = toStaticQuery(selectStatement);
2490
- }
2491
- if (targetSchema === void 0 || targetColumns === void 0) {
2492
- throw new Error(
2493
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2494
- );
2495
- }
2496
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2497
- requireTargetTableName(
2498
- options.targetTable?.name ?? options.tableName
2499
- ),
2500
- {
2501
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2502
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2503
- },
2504
- targetSchema,
2505
- targetColumns
2506
- );
2507
- if (targetTable.name === options.materializedViewName) {
2508
- throw new Error(
2509
- "Materialized view name cannot be the same as the target table name."
2510
- );
2511
- }
2512
- this.name = options.materializedViewName;
2513
- this.targetTable = targetTable;
2514
- this.selectSql = selectStatement;
2515
- this.sourceTables = options.selectTables.map((t) => t.name);
2516
- const stack = new Error().stack;
2517
- this.sourceFile = getSourceFileFromStack(stack);
2518
- const materializedViews = getMooseInternal().materializedViews;
2519
- if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2520
- throw new Error(`MaterializedView with name ${this.name} already exists`);
2521
- }
2522
- materializedViews.set(this.name, this);
2523
- }
2524
- };
2525
-
2526
2461
  // src/dmv2/sdk/sqlResource.ts
2527
2462
  var SqlResource = class {
2528
2463
  /** @internal */
@@ -2577,18 +2512,66 @@ var SqlResource = class {
2577
2512
  }
2578
2513
  };
2579
2514
 
2515
+ // src/dmv2/sdk/materializedView.ts
2516
+ var requireTargetTableName = (tableName) => {
2517
+ if (typeof tableName === "string") {
2518
+ return tableName;
2519
+ } else {
2520
+ throw new Error("Name of targetTable is not specified.");
2521
+ }
2522
+ };
2523
+ var MaterializedView = class extends SqlResource {
2524
+ /** The target OlapTable instance where the materialized data is stored. */
2525
+ targetTable;
2526
+ constructor(options, targetSchema, targetColumns) {
2527
+ let selectStatement = options.selectStatement;
2528
+ if (typeof selectStatement !== "string") {
2529
+ selectStatement = toStaticQuery(selectStatement);
2530
+ }
2531
+ if (targetSchema === void 0 || targetColumns === void 0) {
2532
+ throw new Error(
2533
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2534
+ );
2535
+ }
2536
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2537
+ requireTargetTableName(
2538
+ options.targetTable?.name ?? options.tableName
2539
+ ),
2540
+ {
2541
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2542
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2543
+ },
2544
+ targetSchema,
2545
+ targetColumns
2546
+ );
2547
+ if (targetTable.name === options.materializedViewName) {
2548
+ throw new Error(
2549
+ "Materialized view name cannot be the same as the target table name."
2550
+ );
2551
+ }
2552
+ super(
2553
+ options.materializedViewName,
2554
+ [
2555
+ createMaterializedView({
2556
+ name: options.materializedViewName,
2557
+ destinationTable: targetTable.name,
2558
+ select: selectStatement
2559
+ })
2560
+ // Population is now handled automatically by Rust infrastructure
2561
+ // based on table engine type and whether this is a new or updated view
2562
+ ],
2563
+ [dropView(options.materializedViewName)],
2564
+ {
2565
+ pullsDataFrom: options.selectTables,
2566
+ pushesDataTo: [targetTable]
2567
+ }
2568
+ );
2569
+ this.targetTable = targetTable;
2570
+ }
2571
+ };
2572
+
2580
2573
  // src/dmv2/sdk/view.ts
2581
- var View = class {
2582
- /** @internal */
2583
- kind = "CustomView";
2584
- /** The name of the view */
2585
- name;
2586
- /** The SELECT SQL statement that defines the view */
2587
- selectSql;
2588
- /** Names of source tables/views that the SELECT reads from */
2589
- sourceTables;
2590
- /** @internal Source file path where this view was defined */
2591
- sourceFile;
2574
+ var View = class extends SqlResource {
2592
2575
  /**
2593
2576
  * Creates a new View instance.
2594
2577
  * @param name The name of the view to be created.
@@ -2599,16 +2582,17 @@ var View = class {
2599
2582
  if (typeof selectStatement !== "string") {
2600
2583
  selectStatement = toStaticQuery(selectStatement);
2601
2584
  }
2602
- this.name = name;
2603
- this.selectSql = selectStatement;
2604
- this.sourceTables = baseTables.map((t) => t.name);
2605
- const stack = new Error().stack;
2606
- this.sourceFile = getSourceFileFromStack(stack);
2607
- const customViews = getMooseInternal().customViews;
2608
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2609
- throw new Error(`View with name ${this.name} already exists`);
2610
- }
2611
- customViews.set(this.name, this);
2585
+ super(
2586
+ name,
2587
+ [
2588
+ `CREATE VIEW IF NOT EXISTS ${name}
2589
+ AS ${selectStatement}`.trim()
2590
+ ],
2591
+ [dropView(name)],
2592
+ {
2593
+ pullsDataFrom: baseTables
2594
+ }
2595
+ );
2612
2596
  }
2613
2597
  };
2614
2598