@514labs/moose-lib 0.6.297-ci-34-g865e2d1a → 0.6.297-ci-22-g1be0de24

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,50 +1894,21 @@ declare class ETLPipeline<T, U> {
1894
1894
  run(): Promise<void>;
1895
1895
  }
1896
1896
 
1897
- type SqlObject = OlapTable<any> | SqlResource;
1898
1897
  /**
1899
- * Represents a generic SQL resource that requires setup and teardown commands.
1900
- * Base class for constructs like Views and Materialized Views. Tracks dependencies.
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.
1901
1900
  */
1902
- declare class SqlResource {
1901
+ declare class View {
1903
1902
  /** @internal */
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). */
1903
+ readonly kind = "CustomView";
1904
+ /** The name of the view */
1910
1905
  name: string;
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 */
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 */
1916
1911
  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 {
1941
1912
  /**
1942
1913
  * Creates a new View instance.
1943
1914
  * @param name The name of the view to be created.
@@ -1983,9 +1954,19 @@ interface MaterializedViewConfig<T> {
1983
1954
  *
1984
1955
  * @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
1985
1956
  */
1986
- declare class MaterializedView<TargetTable> extends SqlResource {
1957
+ declare class MaterializedView<TargetTable> {
1958
+ /** @internal */
1959
+ readonly kind = "MaterializedView";
1960
+ /** The name of the materialized view */
1961
+ name: string;
1987
1962
  /** The target OlapTable instance where the materialized data is stored. */
1988
1963
  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;
1989
1970
  /**
1990
1971
  * Creates a new MaterializedView instance.
1991
1972
  * Requires the `TargetTable` type parameter to be explicitly provided or inferred,
@@ -1998,6 +1979,45 @@ declare class MaterializedView<TargetTable> extends SqlResource {
1998
1979
  constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
1999
1980
  }
2000
1981
 
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
+
2001
2021
  type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
2002
2022
  interface FrameworkApp {
2003
2023
  handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
@@ -2114,6 +2134,28 @@ declare function getWebApps(): Map<string, WebApp>;
2114
2134
  * @returns The WebApp instance or undefined if not found
2115
2135
  */
2116
2136
  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;
2117
2159
 
2118
2160
  /**
2119
2161
  * @module dmv2
@@ -2155,4 +2197,4 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
2155
2197
  _argType?: ArgType;
2156
2198
  };
2157
2199
 
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 };
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 };
@@ -1894,50 +1894,21 @@ declare class ETLPipeline<T, U> {
1894
1894
  run(): Promise<void>;
1895
1895
  }
1896
1896
 
1897
- type SqlObject = OlapTable<any> | SqlResource;
1898
1897
  /**
1899
- * Represents a generic SQL resource that requires setup and teardown commands.
1900
- * Base class for constructs like Views and Materialized Views. Tracks dependencies.
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.
1901
1900
  */
1902
- declare class SqlResource {
1901
+ declare class View {
1903
1902
  /** @internal */
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). */
1903
+ readonly kind = "CustomView";
1904
+ /** The name of the view */
1910
1905
  name: string;
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 */
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 */
1916
1911
  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 {
1941
1912
  /**
1942
1913
  * Creates a new View instance.
1943
1914
  * @param name The name of the view to be created.
@@ -1983,9 +1954,19 @@ interface MaterializedViewConfig<T> {
1983
1954
  *
1984
1955
  * @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
1985
1956
  */
1986
- declare class MaterializedView<TargetTable> extends SqlResource {
1957
+ declare class MaterializedView<TargetTable> {
1958
+ /** @internal */
1959
+ readonly kind = "MaterializedView";
1960
+ /** The name of the materialized view */
1961
+ name: string;
1987
1962
  /** The target OlapTable instance where the materialized data is stored. */
1988
1963
  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;
1989
1970
  /**
1990
1971
  * Creates a new MaterializedView instance.
1991
1972
  * Requires the `TargetTable` type parameter to be explicitly provided or inferred,
@@ -1998,6 +1979,45 @@ declare class MaterializedView<TargetTable> extends SqlResource {
1998
1979
  constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
1999
1980
  }
2000
1981
 
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
+
2001
2021
  type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
2002
2022
  interface FrameworkApp {
2003
2023
  handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
@@ -2114,6 +2134,28 @@ declare function getWebApps(): Map<string, WebApp>;
2114
2134
  * @returns The WebApp instance or undefined if not found
2115
2135
  */
2116
2136
  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;
2117
2159
 
2118
2160
  /**
2119
2161
  * @module dmv2
@@ -2155,4 +2197,4 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
2155
2197
  _argType?: ArgType;
2156
2198
  };
2157
2199
 
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 };
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 };
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-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';
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';
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-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';
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';
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,7 +562,9 @@ 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()
565
+ webApps: /* @__PURE__ */ new Map(),
566
+ materializedViews: /* @__PURE__ */ new Map(),
567
+ customViews: /* @__PURE__ */ new Map()
566
568
  };
567
569
  defaultRetentionPeriod = 60 * 60 * 24 * 7;
568
570
  getMooseInternal = () => globalThis.moose_internal;
@@ -578,6 +580,8 @@ var init_internal = __esm({
578
580
  registry.sqlResources.clear();
579
581
  registry.workflows.clear();
580
582
  registry.webApps.clear();
583
+ registry.materializedViews.clear();
584
+ registry.customViews.clear();
581
585
  const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
582
586
  Object.keys(require.cache).forEach((key) => {
583
587
  if (key.startsWith(appDir)) {
@@ -2476,6 +2480,78 @@ var init_etlPipeline = __esm({
2476
2480
  }
2477
2481
  });
2478
2482
 
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
+
2479
2555
  // src/dmv2/sdk/sqlResource.ts
2480
2556
  var SqlResource;
2481
2557
  var init_sqlResource = __esm({
@@ -2539,83 +2615,25 @@ var init_sqlResource = __esm({
2539
2615
  }
2540
2616
  });
2541
2617
 
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
-
2610
2618
  // src/dmv2/sdk/view.ts
2611
2619
  var View;
2612
2620
  var init_view = __esm({
2613
2621
  "src/dmv2/sdk/view.ts"() {
2614
2622
  "use strict";
2615
- init_helpers();
2616
2623
  init_sqlHelpers();
2617
- init_sqlResource();
2618
- View = class extends SqlResource {
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;
2619
2637
  /**
2620
2638
  * Creates a new View instance.
2621
2639
  * @param name The name of the view to be created.
@@ -2626,17 +2644,16 @@ var init_view = __esm({
2626
2644
  if (typeof selectStatement !== "string") {
2627
2645
  selectStatement = toStaticQuery(selectStatement);
2628
2646
  }
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
- );
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);
2640
2657
  }
2641
2658
  };
2642
2659
  }
@@ -2840,6 +2857,18 @@ function getWebApps() {
2840
2857
  function getWebApp(name) {
2841
2858
  return getMooseInternal().webApps.get(name);
2842
2859
  }
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
+ }
2843
2872
  var init_registry = __esm({
2844
2873
  "src/dmv2/registry.ts"() {
2845
2874
  "use strict";
@@ -3722,12 +3751,16 @@ __export(index_exports, {
3722
3751
  getApi: () => getApi,
3723
3752
  getApis: () => getApis,
3724
3753
  getClickhouseClient: () => getClickhouseClient,
3754
+ getCustomView: () => getCustomView,
3755
+ getCustomViews: () => getCustomViews,
3725
3756
  getFileName: () => getFileName,
3726
3757
  getIngestApi: () => getIngestApi,
3727
3758
  getIngestApis: () => getIngestApis,
3728
3759
  getKafkaClient: () => getKafkaClient,
3729
3760
  getKafkaProducer: () => getKafkaProducer,
3730
3761
  getLegacyMooseUtils: () => getLegacyMooseUtils,
3762
+ getMaterializedView: () => getMaterializedView,
3763
+ getMaterializedViews: () => getMaterializedViews,
3731
3764
  getMooseClients: () => getMooseClients,
3732
3765
  getMooseUtils: () => getMooseUtils,
3733
3766
  getMooseUtilsFromRequest: () => getMooseUtilsFromRequest,
@@ -3830,12 +3863,16 @@ init_index();
3830
3863
  getApi,
3831
3864
  getApis,
3832
3865
  getClickhouseClient,
3866
+ getCustomView,
3867
+ getCustomViews,
3833
3868
  getFileName,
3834
3869
  getIngestApi,
3835
3870
  getIngestApis,
3836
3871
  getKafkaClient,
3837
3872
  getKafkaProducer,
3838
3873
  getLegacyMooseUtils,
3874
+ getMaterializedView,
3875
+ getMaterializedViews,
3839
3876
  getMooseClients,
3840
3877
  getMooseUtils,
3841
3878
  getMooseUtilsFromRequest,