@514labs/moose-lib 0.6.262-ci-5-gf85ca97c → 0.6.262-ci-2-gfc2fb4ba

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.
@@ -1822,21 +1822,46 @@ declare class ETLPipeline<T, U> {
1822
1822
  run(): Promise<void>;
1823
1823
  }
1824
1824
 
1825
+ type SqlObject = OlapTable<any> | SqlResource;
1825
1826
  /**
1826
- * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1827
- * Emits structured data for the Moose infrastructure system.
1827
+ * Represents a generic SQL resource that requires setup and teardown commands.
1828
+ * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1828
1829
  */
1829
- declare class View {
1830
+ declare class SqlResource {
1830
1831
  /** @internal */
1831
- readonly kind = "CustomView";
1832
- /** The name of the view */
1832
+ readonly kind = "SqlResource";
1833
+ /** Array of SQL statements to execute for setting up the resource. */
1834
+ setup: readonly string[];
1835
+ /** Array of SQL statements to execute for tearing down the resource. */
1836
+ teardown: readonly string[];
1837
+ /** The name of the SQL resource (e.g., view name, materialized view name). */
1833
1838
  name: string;
1834
- /** The SELECT SQL statement that defines the view */
1835
- selectSql: string;
1836
- /** Names of source tables/views that the SELECT reads from */
1837
- sourceTables: string[];
1838
- /** @internal Source file path where this view was defined */
1839
+ /** List of OlapTables or Views that this resource reads data from. */
1840
+ pullsDataFrom: SqlObject[];
1841
+ /** List of OlapTables or Views that this resource writes data to. */
1842
+ pushesDataTo: SqlObject[];
1843
+ /** @internal Source file path where this resource was defined */
1839
1844
  sourceFile?: string;
1845
+ /**
1846
+ * Creates a new SqlResource instance.
1847
+ * @param name The name of the resource.
1848
+ * @param setup An array of SQL DDL statements to create the resource.
1849
+ * @param teardown An array of SQL DDL statements to drop the resource.
1850
+ * @param options Optional configuration for specifying data dependencies.
1851
+ * @param options.pullsDataFrom Tables/Views this resource reads from.
1852
+ * @param options.pushesDataTo Tables/Views this resource writes to.
1853
+ */
1854
+ constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
1855
+ pullsDataFrom?: SqlObject[];
1856
+ pushesDataTo?: SqlObject[];
1857
+ });
1858
+ }
1859
+
1860
+ /**
1861
+ * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1862
+ * Inherits from SqlResource, providing setup (CREATE VIEW) and teardown (DROP VIEW) commands.
1863
+ */
1864
+ declare class View extends SqlResource {
1840
1865
  /**
1841
1866
  * Creates a new View instance.
1842
1867
  * @param name The name of the view to be created.
@@ -1882,19 +1907,9 @@ interface MaterializedViewConfig<T> {
1882
1907
  *
1883
1908
  * @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
1884
1909
  */
1885
- declare class MaterializedView<TargetTable> {
1886
- /** @internal */
1887
- readonly kind = "MaterializedView";
1888
- /** The name of the materialized view */
1889
- name: string;
1910
+ declare class MaterializedView<TargetTable> extends SqlResource {
1890
1911
  /** The target OlapTable instance where the materialized data is stored. */
1891
1912
  targetTable: OlapTable<TargetTable>;
1892
- /** The SELECT SQL statement */
1893
- selectSql: string;
1894
- /** Names of source tables that the SELECT reads from */
1895
- sourceTables: string[];
1896
- /** @internal Source file path where this MV was defined */
1897
- sourceFile?: string;
1898
1913
  /**
1899
1914
  * Creates a new MaterializedView instance.
1900
1915
  * Requires the `TargetTable` type parameter to be explicitly provided or inferred,
@@ -1907,41 +1922,6 @@ declare class MaterializedView<TargetTable> {
1907
1922
  constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
1908
1923
  }
1909
1924
 
1910
- type SqlObject = OlapTable<any> | SqlResource;
1911
- /**
1912
- * Represents a generic SQL resource that requires setup and teardown commands.
1913
- * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1914
- */
1915
- declare class SqlResource {
1916
- /** @internal */
1917
- readonly kind = "SqlResource";
1918
- /** Array of SQL statements to execute for setting up the resource. */
1919
- setup: readonly string[];
1920
- /** Array of SQL statements to execute for tearing down the resource. */
1921
- teardown: readonly string[];
1922
- /** The name of the SQL resource (e.g., view name, materialized view name). */
1923
- name: string;
1924
- /** List of OlapTables or Views that this resource reads data from. */
1925
- pullsDataFrom: SqlObject[];
1926
- /** List of OlapTables or Views that this resource writes data to. */
1927
- pushesDataTo: SqlObject[];
1928
- /** @internal Source file path where this resource was defined */
1929
- sourceFile?: string;
1930
- /**
1931
- * Creates a new SqlResource instance.
1932
- * @param name The name of the resource.
1933
- * @param setup An array of SQL DDL statements to create the resource.
1934
- * @param teardown An array of SQL DDL statements to drop the resource.
1935
- * @param options Optional configuration for specifying data dependencies.
1936
- * @param options.pullsDataFrom Tables/Views this resource reads from.
1937
- * @param options.pushesDataTo Tables/Views this resource writes to.
1938
- */
1939
- constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
1940
- pullsDataFrom?: SqlObject[];
1941
- pushesDataTo?: SqlObject[];
1942
- });
1943
- }
1944
-
1945
1925
  type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
1946
1926
  interface FrameworkApp {
1947
1927
  handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
@@ -1822,21 +1822,46 @@ declare class ETLPipeline<T, U> {
1822
1822
  run(): Promise<void>;
1823
1823
  }
1824
1824
 
1825
+ type SqlObject = OlapTable<any> | SqlResource;
1825
1826
  /**
1826
- * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1827
- * Emits structured data for the Moose infrastructure system.
1827
+ * Represents a generic SQL resource that requires setup and teardown commands.
1828
+ * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1828
1829
  */
1829
- declare class View {
1830
+ declare class SqlResource {
1830
1831
  /** @internal */
1831
- readonly kind = "CustomView";
1832
- /** The name of the view */
1832
+ readonly kind = "SqlResource";
1833
+ /** Array of SQL statements to execute for setting up the resource. */
1834
+ setup: readonly string[];
1835
+ /** Array of SQL statements to execute for tearing down the resource. */
1836
+ teardown: readonly string[];
1837
+ /** The name of the SQL resource (e.g., view name, materialized view name). */
1833
1838
  name: string;
1834
- /** The SELECT SQL statement that defines the view */
1835
- selectSql: string;
1836
- /** Names of source tables/views that the SELECT reads from */
1837
- sourceTables: string[];
1838
- /** @internal Source file path where this view was defined */
1839
+ /** List of OlapTables or Views that this resource reads data from. */
1840
+ pullsDataFrom: SqlObject[];
1841
+ /** List of OlapTables or Views that this resource writes data to. */
1842
+ pushesDataTo: SqlObject[];
1843
+ /** @internal Source file path where this resource was defined */
1839
1844
  sourceFile?: string;
1845
+ /**
1846
+ * Creates a new SqlResource instance.
1847
+ * @param name The name of the resource.
1848
+ * @param setup An array of SQL DDL statements to create the resource.
1849
+ * @param teardown An array of SQL DDL statements to drop the resource.
1850
+ * @param options Optional configuration for specifying data dependencies.
1851
+ * @param options.pullsDataFrom Tables/Views this resource reads from.
1852
+ * @param options.pushesDataTo Tables/Views this resource writes to.
1853
+ */
1854
+ constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
1855
+ pullsDataFrom?: SqlObject[];
1856
+ pushesDataTo?: SqlObject[];
1857
+ });
1858
+ }
1859
+
1860
+ /**
1861
+ * Represents a database View, defined by a SQL SELECT statement based on one or more base tables or other views.
1862
+ * Inherits from SqlResource, providing setup (CREATE VIEW) and teardown (DROP VIEW) commands.
1863
+ */
1864
+ declare class View extends SqlResource {
1840
1865
  /**
1841
1866
  * Creates a new View instance.
1842
1867
  * @param name The name of the view to be created.
@@ -1882,19 +1907,9 @@ interface MaterializedViewConfig<T> {
1882
1907
  *
1883
1908
  * @template TargetTable The data type of the records stored in the underlying target OlapTable. The structure of T defines the target table schema.
1884
1909
  */
1885
- declare class MaterializedView<TargetTable> {
1886
- /** @internal */
1887
- readonly kind = "MaterializedView";
1888
- /** The name of the materialized view */
1889
- name: string;
1910
+ declare class MaterializedView<TargetTable> extends SqlResource {
1890
1911
  /** The target OlapTable instance where the materialized data is stored. */
1891
1912
  targetTable: OlapTable<TargetTable>;
1892
- /** The SELECT SQL statement */
1893
- selectSql: string;
1894
- /** Names of source tables that the SELECT reads from */
1895
- sourceTables: string[];
1896
- /** @internal Source file path where this MV was defined */
1897
- sourceFile?: string;
1898
1913
  /**
1899
1914
  * Creates a new MaterializedView instance.
1900
1915
  * Requires the `TargetTable` type parameter to be explicitly provided or inferred,
@@ -1907,41 +1922,6 @@ declare class MaterializedView<TargetTable> {
1907
1922
  constructor(options: MaterializedViewConfig<TargetTable>, targetSchema: IJsonSchemaCollection$1.IV3_1, targetColumns: Column[]);
1908
1923
  }
1909
1924
 
1910
- type SqlObject = OlapTable<any> | SqlResource;
1911
- /**
1912
- * Represents a generic SQL resource that requires setup and teardown commands.
1913
- * Base class for constructs like Views and Materialized Views. Tracks dependencies.
1914
- */
1915
- declare class SqlResource {
1916
- /** @internal */
1917
- readonly kind = "SqlResource";
1918
- /** Array of SQL statements to execute for setting up the resource. */
1919
- setup: readonly string[];
1920
- /** Array of SQL statements to execute for tearing down the resource. */
1921
- teardown: readonly string[];
1922
- /** The name of the SQL resource (e.g., view name, materialized view name). */
1923
- name: string;
1924
- /** List of OlapTables or Views that this resource reads data from. */
1925
- pullsDataFrom: SqlObject[];
1926
- /** List of OlapTables or Views that this resource writes data to. */
1927
- pushesDataTo: SqlObject[];
1928
- /** @internal Source file path where this resource was defined */
1929
- sourceFile?: string;
1930
- /**
1931
- * Creates a new SqlResource instance.
1932
- * @param name The name of the resource.
1933
- * @param setup An array of SQL DDL statements to create the resource.
1934
- * @param teardown An array of SQL DDL statements to drop the resource.
1935
- * @param options Optional configuration for specifying data dependencies.
1936
- * @param options.pullsDataFrom Tables/Views this resource reads from.
1937
- * @param options.pushesDataTo Tables/Views this resource writes to.
1938
- */
1939
- constructor(name: string, setup: readonly (string | Sql)[], teardown: readonly (string | Sql)[], options?: {
1940
- pullsDataFrom?: SqlObject[];
1941
- pushesDataTo?: SqlObject[];
1942
- });
1943
- }
1944
-
1945
1925
  type WebAppHandler = (req: http.IncomingMessage, res: http.ServerResponse) => void | Promise<void>;
1946
1926
  interface FrameworkApp {
1947
1927
  handle?: (req: http.IncomingMessage, res: http.ServerResponse, next?: (err?: any) => void) => void;
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-CDqMXtd_.mjs';
2
- import { K as ApiUtil, a4 as MooseClient } from './index-B2jILcTY.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-B2jILcTY.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-GsBQtLKo.mjs';
2
+ import { K as ApiUtil, a4 as MooseClient } from './index-B1HsstjQ.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-B1HsstjQ.mjs';
4
4
  import * as _clickhouse_client from '@clickhouse/client';
5
5
  import { KafkaJS } from '@confluentinc/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-BpwCKgGF.js';
2
- import { K as ApiUtil, a4 as MooseClient } from './index-B2jILcTY.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-B2jILcTY.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-CC6Jamxn.js';
2
+ import { K as ApiUtil, a4 as MooseClient } from './index-B1HsstjQ.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-B1HsstjQ.js';
4
4
  import * as _clickhouse_client from '@clickhouse/client';
5
5
  import { KafkaJS } from '@confluentinc/kafka-javascript';
6
6
  import http from 'http';
package/dist/index.js CHANGED
@@ -759,9 +759,7 @@ var moose_internal = {
759
759
  apis: /* @__PURE__ */ new Map(),
760
760
  sqlResources: /* @__PURE__ */ new Map(),
761
761
  workflows: /* @__PURE__ */ new Map(),
762
- webApps: /* @__PURE__ */ new Map(),
763
- materializedViews: /* @__PURE__ */ new Map(),
764
- customViews: /* @__PURE__ */ new Map()
762
+ webApps: /* @__PURE__ */ new Map()
765
763
  };
766
764
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
767
765
  var getMooseInternal = () => globalThis.moose_internal;
@@ -777,8 +775,6 @@ var loadIndex = () => {
777
775
  registry.sqlResources.clear();
778
776
  registry.workflows.clear();
779
777
  registry.webApps.clear();
780
- registry.materializedViews.clear();
781
- registry.customViews.clear();
782
778
  const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
783
779
  Object.keys(require.cache).forEach((key) => {
784
780
  if (key.startsWith(appDir)) {
@@ -2206,6 +2202,7 @@ var IngestPipeline = class extends TypedBase {
2206
2202
  if (config.table) {
2207
2203
  const tableConfig = typeof config.table === "object" ? {
2208
2204
  ...config.table,
2205
+ lifeCycle: config.table.lifeCycle ?? config.lifeCycle,
2209
2206
  ...config.version && { version: config.version }
2210
2207
  } : {
2211
2208
  lifeCycle: config.lifeCycle,
@@ -2236,7 +2233,10 @@ var IngestPipeline = class extends TypedBase {
2236
2233
  const streamConfig = {
2237
2234
  destination: this.table,
2238
2235
  defaultDeadLetterQueue: this.deadLetterQueue,
2239
- ...typeof config.stream === "object" ? config.stream : { lifeCycle: config.lifeCycle },
2236
+ ...typeof config.stream === "object" ? {
2237
+ ...config.stream,
2238
+ lifeCycle: config.stream.lifeCycle ?? config.lifeCycle
2239
+ } : { lifeCycle: config.lifeCycle },
2240
2240
  ...config.version && { version: config.version }
2241
2241
  };
2242
2242
  this.stream = new Stream(
@@ -2412,67 +2412,6 @@ var ETLPipeline = class {
2412
2412
  }
2413
2413
  };
2414
2414
 
2415
- // src/dmv2/sdk/materializedView.ts
2416
- var requireTargetTableName = (tableName) => {
2417
- if (typeof tableName === "string") {
2418
- return tableName;
2419
- } else {
2420
- throw new Error("Name of targetTable is not specified.");
2421
- }
2422
- };
2423
- var MaterializedView = class {
2424
- /** @internal */
2425
- kind = "MaterializedView";
2426
- /** The name of the materialized view */
2427
- name;
2428
- /** The target OlapTable instance where the materialized data is stored. */
2429
- targetTable;
2430
- /** The SELECT SQL statement */
2431
- selectSql;
2432
- /** Names of source tables that the SELECT reads from */
2433
- sourceTables;
2434
- /** @internal Source file path where this MV was defined */
2435
- sourceFile;
2436
- constructor(options, targetSchema, targetColumns) {
2437
- let selectStatement = options.selectStatement;
2438
- if (typeof selectStatement !== "string") {
2439
- selectStatement = toStaticQuery(selectStatement);
2440
- }
2441
- if (targetSchema === void 0 || targetColumns === void 0) {
2442
- throw new Error(
2443
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2444
- );
2445
- }
2446
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2447
- requireTargetTableName(
2448
- options.targetTable?.name ?? options.tableName
2449
- ),
2450
- {
2451
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2452
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2453
- },
2454
- targetSchema,
2455
- targetColumns
2456
- );
2457
- if (targetTable.name === options.materializedViewName) {
2458
- throw new Error(
2459
- "Materialized view name cannot be the same as the target table name."
2460
- );
2461
- }
2462
- this.name = options.materializedViewName;
2463
- this.targetTable = targetTable;
2464
- this.selectSql = selectStatement;
2465
- this.sourceTables = options.selectTables.map((t) => t.name);
2466
- const stack = new Error().stack;
2467
- this.sourceFile = getSourceFileFromStack(stack);
2468
- const materializedViews = getMooseInternal().materializedViews;
2469
- if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2470
- throw new Error(`MaterializedView with name ${this.name} already exists`);
2471
- }
2472
- materializedViews.set(this.name, this);
2473
- }
2474
- };
2475
-
2476
2415
  // src/dmv2/sdk/sqlResource.ts
2477
2416
  var SqlResource = class {
2478
2417
  /** @internal */
@@ -2518,18 +2457,66 @@ var SqlResource = class {
2518
2457
  }
2519
2458
  };
2520
2459
 
2460
+ // src/dmv2/sdk/materializedView.ts
2461
+ var requireTargetTableName = (tableName) => {
2462
+ if (typeof tableName === "string") {
2463
+ return tableName;
2464
+ } else {
2465
+ throw new Error("Name of targetTable is not specified.");
2466
+ }
2467
+ };
2468
+ var MaterializedView = class extends SqlResource {
2469
+ /** The target OlapTable instance where the materialized data is stored. */
2470
+ targetTable;
2471
+ constructor(options, targetSchema, targetColumns) {
2472
+ let selectStatement = options.selectStatement;
2473
+ if (typeof selectStatement !== "string") {
2474
+ selectStatement = toStaticQuery(selectStatement);
2475
+ }
2476
+ if (targetSchema === void 0 || targetColumns === void 0) {
2477
+ throw new Error(
2478
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2479
+ );
2480
+ }
2481
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2482
+ requireTargetTableName(
2483
+ options.targetTable?.name ?? options.tableName
2484
+ ),
2485
+ {
2486
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2487
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2488
+ },
2489
+ targetSchema,
2490
+ targetColumns
2491
+ );
2492
+ if (targetTable.name === options.materializedViewName) {
2493
+ throw new Error(
2494
+ "Materialized view name cannot be the same as the target table name."
2495
+ );
2496
+ }
2497
+ super(
2498
+ options.materializedViewName,
2499
+ [
2500
+ createMaterializedView({
2501
+ name: options.materializedViewName,
2502
+ destinationTable: targetTable.name,
2503
+ select: selectStatement
2504
+ })
2505
+ // Population is now handled automatically by Rust infrastructure
2506
+ // based on table engine type and whether this is a new or updated view
2507
+ ],
2508
+ [dropView(options.materializedViewName)],
2509
+ {
2510
+ pullsDataFrom: options.selectTables,
2511
+ pushesDataTo: [targetTable]
2512
+ }
2513
+ );
2514
+ this.targetTable = targetTable;
2515
+ }
2516
+ };
2517
+
2521
2518
  // src/dmv2/sdk/view.ts
2522
- var View = class {
2523
- /** @internal */
2524
- kind = "CustomView";
2525
- /** The name of the view */
2526
- name;
2527
- /** The SELECT SQL statement that defines the view */
2528
- selectSql;
2529
- /** Names of source tables/views that the SELECT reads from */
2530
- sourceTables;
2531
- /** @internal Source file path where this view was defined */
2532
- sourceFile;
2519
+ var View = class extends SqlResource {
2533
2520
  /**
2534
2521
  * Creates a new View instance.
2535
2522
  * @param name The name of the view to be created.
@@ -2540,16 +2527,17 @@ var View = class {
2540
2527
  if (typeof selectStatement !== "string") {
2541
2528
  selectStatement = toStaticQuery(selectStatement);
2542
2529
  }
2543
- this.name = name;
2544
- this.selectSql = selectStatement;
2545
- this.sourceTables = baseTables.map((t) => t.name);
2546
- const stack = new Error().stack;
2547
- this.sourceFile = getSourceFileFromStack(stack);
2548
- const customViews = getMooseInternal().customViews;
2549
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2550
- throw new Error(`View with name ${this.name} already exists`);
2551
- }
2552
- customViews.set(this.name, this);
2530
+ super(
2531
+ name,
2532
+ [
2533
+ `CREATE VIEW IF NOT EXISTS ${name}
2534
+ AS ${selectStatement}`.trim()
2535
+ ],
2536
+ [dropView(name)],
2537
+ {
2538
+ pullsDataFrom: baseTables
2539
+ }
2540
+ );
2553
2541
  }
2554
2542
  };
2555
2543