@514labs/moose-lib 0.6.293 → 0.6.294-ci-16-gb7a5d464

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