@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.
@@ -1,4 +1,4 @@
1
- import './index-B2jILcTY.js';
1
+ import './index-B1HsstjQ.js';
2
2
  import { Pattern, TagBase } from 'typia/lib/tags';
3
3
  import { tags } from 'typia';
4
4
 
@@ -1,4 +1,4 @@
1
- import './index-B2jILcTY.mjs';
1
+ import './index-B1HsstjQ.mjs';
2
2
  import { Pattern, TagBase } from 'typia/lib/tags';
3
3
  import { tags } from 'typia';
4
4
 
@@ -1,5 +1,5 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, 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, 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, a2 as createClickhouseParameter, 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, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-B2jILcTY.mjs';
2
- 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, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, 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';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, 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, 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, a2 as createClickhouseParameter, 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, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-B1HsstjQ.mjs';
2
+ 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, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, 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';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -1,5 +1,5 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, 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, 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, a2 as createClickhouseParameter, 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, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-B2jILcTY.js';
2
- 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, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, 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';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, K as ApiUtil, C as ConsumptionApi, 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, 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, a2 as createClickhouseParameter, 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, a1 as getValueFromParameter, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows, a3 as mapToClickHouseType, P as quoteIdentifier, Y as sql, $ as toQuery, a0 as toQueryPreview, _ as toStaticQuery } from './index-B1HsstjQ.js';
2
+ 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, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, 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';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -667,6 +667,16 @@ function emptyIfUndefined(value) {
667
667
  return value === void 0 ? "" : value;
668
668
  }
669
669
 
670
+ // src/blocks/helpers.ts
671
+ function dropView(name) {
672
+ return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
673
+ }
674
+ function createMaterializedView(options) {
675
+ return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
676
+ TO ${quoteIdentifier(options.destinationTable)}
677
+ AS ${options.select}`.trim();
678
+ }
679
+
670
680
  // src/dmv2/internal.ts
671
681
  var import_process = __toESM(require("process"));
672
682
 
@@ -717,9 +727,7 @@ var moose_internal = {
717
727
  apis: /* @__PURE__ */ new Map(),
718
728
  sqlResources: /* @__PURE__ */ new Map(),
719
729
  workflows: /* @__PURE__ */ new Map(),
720
- webApps: /* @__PURE__ */ new Map(),
721
- materializedViews: /* @__PURE__ */ new Map(),
722
- customViews: /* @__PURE__ */ new Map()
730
+ webApps: /* @__PURE__ */ new Map()
723
731
  };
724
732
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
725
733
  var getMooseInternal = () => globalThis.moose_internal;
@@ -2129,6 +2137,7 @@ var IngestPipeline = class extends TypedBase {
2129
2137
  if (config.table) {
2130
2138
  const tableConfig = typeof config.table === "object" ? {
2131
2139
  ...config.table,
2140
+ lifeCycle: config.table.lifeCycle ?? config.lifeCycle,
2132
2141
  ...config.version && { version: config.version }
2133
2142
  } : {
2134
2143
  lifeCycle: config.lifeCycle,
@@ -2159,7 +2168,10 @@ var IngestPipeline = class extends TypedBase {
2159
2168
  const streamConfig = {
2160
2169
  destination: this.table,
2161
2170
  defaultDeadLetterQueue: this.deadLetterQueue,
2162
- ...typeof config.stream === "object" ? config.stream : { lifeCycle: config.lifeCycle },
2171
+ ...typeof config.stream === "object" ? {
2172
+ ...config.stream,
2173
+ lifeCycle: config.stream.lifeCycle ?? config.lifeCycle
2174
+ } : { lifeCycle: config.lifeCycle },
2163
2175
  ...config.version && { version: config.version }
2164
2176
  };
2165
2177
  this.stream = new Stream(
@@ -2335,67 +2347,6 @@ var ETLPipeline = class {
2335
2347
  }
2336
2348
  };
2337
2349
 
2338
- // src/dmv2/sdk/materializedView.ts
2339
- var requireTargetTableName = (tableName) => {
2340
- if (typeof tableName === "string") {
2341
- return tableName;
2342
- } else {
2343
- throw new Error("Name of targetTable is not specified.");
2344
- }
2345
- };
2346
- var MaterializedView = class {
2347
- /** @internal */
2348
- kind = "MaterializedView";
2349
- /** The name of the materialized view */
2350
- name;
2351
- /** The target OlapTable instance where the materialized data is stored. */
2352
- targetTable;
2353
- /** The SELECT SQL statement */
2354
- selectSql;
2355
- /** Names of source tables that the SELECT reads from */
2356
- sourceTables;
2357
- /** @internal Source file path where this MV was defined */
2358
- sourceFile;
2359
- constructor(options, targetSchema, targetColumns) {
2360
- let selectStatement = options.selectStatement;
2361
- if (typeof selectStatement !== "string") {
2362
- selectStatement = toStaticQuery(selectStatement);
2363
- }
2364
- if (targetSchema === void 0 || targetColumns === void 0) {
2365
- throw new Error(
2366
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2367
- );
2368
- }
2369
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2370
- requireTargetTableName(
2371
- options.targetTable?.name ?? options.tableName
2372
- ),
2373
- {
2374
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2375
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2376
- },
2377
- targetSchema,
2378
- targetColumns
2379
- );
2380
- if (targetTable.name === options.materializedViewName) {
2381
- throw new Error(
2382
- "Materialized view name cannot be the same as the target table name."
2383
- );
2384
- }
2385
- this.name = options.materializedViewName;
2386
- this.targetTable = targetTable;
2387
- this.selectSql = selectStatement;
2388
- this.sourceTables = options.selectTables.map((t) => t.name);
2389
- const stack = new Error().stack;
2390
- this.sourceFile = getSourceFileFromStack(stack);
2391
- const materializedViews = getMooseInternal().materializedViews;
2392
- if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2393
- throw new Error(`MaterializedView with name ${this.name} already exists`);
2394
- }
2395
- materializedViews.set(this.name, this);
2396
- }
2397
- };
2398
-
2399
2350
  // src/dmv2/sdk/sqlResource.ts
2400
2351
  var SqlResource = class {
2401
2352
  /** @internal */
@@ -2441,18 +2392,66 @@ var SqlResource = class {
2441
2392
  }
2442
2393
  };
2443
2394
 
2395
+ // src/dmv2/sdk/materializedView.ts
2396
+ var requireTargetTableName = (tableName) => {
2397
+ if (typeof tableName === "string") {
2398
+ return tableName;
2399
+ } else {
2400
+ throw new Error("Name of targetTable is not specified.");
2401
+ }
2402
+ };
2403
+ var MaterializedView = class extends SqlResource {
2404
+ /** The target OlapTable instance where the materialized data is stored. */
2405
+ targetTable;
2406
+ constructor(options, targetSchema, targetColumns) {
2407
+ let selectStatement = options.selectStatement;
2408
+ if (typeof selectStatement !== "string") {
2409
+ selectStatement = toStaticQuery(selectStatement);
2410
+ }
2411
+ if (targetSchema === void 0 || targetColumns === void 0) {
2412
+ throw new Error(
2413
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2414
+ );
2415
+ }
2416
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2417
+ requireTargetTableName(
2418
+ options.targetTable?.name ?? options.tableName
2419
+ ),
2420
+ {
2421
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2422
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2423
+ },
2424
+ targetSchema,
2425
+ targetColumns
2426
+ );
2427
+ if (targetTable.name === options.materializedViewName) {
2428
+ throw new Error(
2429
+ "Materialized view name cannot be the same as the target table name."
2430
+ );
2431
+ }
2432
+ super(
2433
+ options.materializedViewName,
2434
+ [
2435
+ createMaterializedView({
2436
+ name: options.materializedViewName,
2437
+ destinationTable: targetTable.name,
2438
+ select: selectStatement
2439
+ })
2440
+ // Population is now handled automatically by Rust infrastructure
2441
+ // based on table engine type and whether this is a new or updated view
2442
+ ],
2443
+ [dropView(options.materializedViewName)],
2444
+ {
2445
+ pullsDataFrom: options.selectTables,
2446
+ pushesDataTo: [targetTable]
2447
+ }
2448
+ );
2449
+ this.targetTable = targetTable;
2450
+ }
2451
+ };
2452
+
2444
2453
  // src/dmv2/sdk/view.ts
2445
- var View = class {
2446
- /** @internal */
2447
- kind = "CustomView";
2448
- /** The name of the view */
2449
- name;
2450
- /** The SELECT SQL statement that defines the view */
2451
- selectSql;
2452
- /** Names of source tables/views that the SELECT reads from */
2453
- sourceTables;
2454
- /** @internal Source file path where this view was defined */
2455
- sourceFile;
2454
+ var View = class extends SqlResource {
2456
2455
  /**
2457
2456
  * Creates a new View instance.
2458
2457
  * @param name The name of the view to be created.
@@ -2463,16 +2462,17 @@ var View = class {
2463
2462
  if (typeof selectStatement !== "string") {
2464
2463
  selectStatement = toStaticQuery(selectStatement);
2465
2464
  }
2466
- this.name = name;
2467
- this.selectSql = selectStatement;
2468
- this.sourceTables = baseTables.map((t) => t.name);
2469
- const stack = new Error().stack;
2470
- this.sourceFile = getSourceFileFromStack(stack);
2471
- const customViews = getMooseInternal().customViews;
2472
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2473
- throw new Error(`View with name ${this.name} already exists`);
2474
- }
2475
- customViews.set(this.name, this);
2465
+ super(
2466
+ name,
2467
+ [
2468
+ `CREATE VIEW IF NOT EXISTS ${name}
2469
+ AS ${selectStatement}`.trim()
2470
+ ],
2471
+ [dropView(name)],
2472
+ {
2473
+ pullsDataFrom: baseTables
2474
+ }
2475
+ );
2476
2476
  }
2477
2477
  };
2478
2478