@514labs/moose-lib 0.6.279-ci-1-g5f380e27 → 0.6.279-ci-4-g0d9088d6

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-KhGbXtkS.mjs';
1
+ import './index-BtkwFbT9.mjs';
2
2
  import { Pattern, TagBase } from 'typia/lib/tags';
3
3
  import { tags } from 'typia';
4
4
 
@@ -1,4 +1,4 @@
1
- import './index-KhGbXtkS.js';
1
+ import './index-BtkwFbT9.js';
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-KhGbXtkS.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-Bs-byVfO.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-BtkwFbT9.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-15NCyT1P.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-KhGbXtkS.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-D8Hbpq6L.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-BtkwFbT9.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-BUKAJYbj.js';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -428,10 +428,13 @@ module.exports = __toCommonJS(browserCompatible_exports);
428
428
  // src/dmv2/utils/stackTrace.ts
429
429
  function shouldSkipStackLine(line) {
430
430
  return line.includes("node_modules") || // Skip npm installed packages (prod)
431
- line.includes("internal/modules") || // Skip Node.js internals
431
+ line.includes("node:internal") || // Skip Node.js internals (modern format)
432
+ line.includes("internal/modules") || // Skip Node.js internals (older format)
432
433
  line.includes("ts-node") || // Skip TypeScript execution
433
- line.includes("/ts-moose-lib/") || // Skip dev/linked moose-lib (Unix)
434
- line.includes("\\ts-moose-lib\\");
434
+ line.includes("/ts-moose-lib/src/") || // Skip dev/linked moose-lib src (Unix)
435
+ line.includes("\\ts-moose-lib\\src\\") || // Skip dev/linked moose-lib src (Windows)
436
+ line.includes("/ts-moose-lib/dist/") || // Skip dev/linked moose-lib dist (Unix)
437
+ line.includes("\\ts-moose-lib\\dist\\");
435
438
  }
436
439
  function parseStackLine(line) {
437
440
  const match = line.match(/\((.*):(\d+):(\d+)\)/) || line.match(/at (.*):(\d+):(\d+)/);
@@ -534,12 +537,12 @@ var TypedBase = class {
534
537
  this.validators = validators;
535
538
  this.allowExtraFields = allowExtraFields ?? false;
536
539
  this.metadata = config?.metadata ? { ...config.metadata } : {};
537
- const stack = new Error().stack;
538
- if (stack) {
539
- const info = getSourceFileInfo(stack);
540
- this.metadata.source = { file: info.file, line: info.line };
541
- } else {
542
- this.metadata.source = void 0;
540
+ if (!this.metadata.source) {
541
+ const stack = new Error().stack;
542
+ if (stack) {
543
+ const info = getSourceFileInfo(stack);
544
+ this.metadata.source = { file: info.file, line: info.line };
545
+ }
543
546
  }
544
547
  }
545
548
  };
@@ -702,6 +705,16 @@ function emptyIfUndefined(value) {
702
705
  return value === void 0 ? "" : value;
703
706
  }
704
707
 
708
+ // src/blocks/helpers.ts
709
+ function dropView(name) {
710
+ return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
711
+ }
712
+ function createMaterializedView(options) {
713
+ return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
714
+ TO ${quoteIdentifier(options.destinationTable)}
715
+ AS ${options.select}`.trim();
716
+ }
717
+
705
718
  // src/dmv2/internal.ts
706
719
  var import_process = __toESM(require("process"));
707
720
 
@@ -752,9 +765,7 @@ var moose_internal = {
752
765
  apis: /* @__PURE__ */ new Map(),
753
766
  sqlResources: /* @__PURE__ */ new Map(),
754
767
  workflows: /* @__PURE__ */ new Map(),
755
- webApps: /* @__PURE__ */ new Map(),
756
- materializedViews: /* @__PURE__ */ new Map(),
757
- customViews: /* @__PURE__ */ new Map()
768
+ webApps: /* @__PURE__ */ new Map()
758
769
  };
759
770
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
760
771
  var getMooseInternal = () => globalThis.moose_internal;
@@ -2383,67 +2394,6 @@ var ETLPipeline = class {
2383
2394
  }
2384
2395
  };
2385
2396
 
2386
- // src/dmv2/sdk/materializedView.ts
2387
- var requireTargetTableName = (tableName) => {
2388
- if (typeof tableName === "string") {
2389
- return tableName;
2390
- } else {
2391
- throw new Error("Name of targetTable is not specified.");
2392
- }
2393
- };
2394
- var MaterializedView = class {
2395
- /** @internal */
2396
- kind = "MaterializedView";
2397
- /** The name of the materialized view */
2398
- name;
2399
- /** The target OlapTable instance where the materialized data is stored. */
2400
- targetTable;
2401
- /** The SELECT SQL statement */
2402
- selectSql;
2403
- /** Names of source tables that the SELECT reads from */
2404
- sourceTables;
2405
- /** @internal Source file path where this MV was defined */
2406
- sourceFile;
2407
- constructor(options, targetSchema, targetColumns) {
2408
- let selectStatement = options.selectStatement;
2409
- if (typeof selectStatement !== "string") {
2410
- selectStatement = toStaticQuery(selectStatement);
2411
- }
2412
- if (targetSchema === void 0 || targetColumns === void 0) {
2413
- throw new Error(
2414
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2415
- );
2416
- }
2417
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2418
- requireTargetTableName(
2419
- options.targetTable?.name ?? options.tableName
2420
- ),
2421
- {
2422
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2423
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2424
- },
2425
- targetSchema,
2426
- targetColumns
2427
- );
2428
- if (targetTable.name === options.materializedViewName) {
2429
- throw new Error(
2430
- "Materialized view name cannot be the same as the target table name."
2431
- );
2432
- }
2433
- this.name = options.materializedViewName;
2434
- this.targetTable = targetTable;
2435
- this.selectSql = selectStatement;
2436
- this.sourceTables = options.selectTables.map((t) => t.name);
2437
- const stack = new Error().stack;
2438
- this.sourceFile = getSourceFileFromStack(stack);
2439
- const materializedViews = getMooseInternal().materializedViews;
2440
- if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2441
- throw new Error(`MaterializedView with name ${this.name} already exists`);
2442
- }
2443
- materializedViews.set(this.name, this);
2444
- }
2445
- };
2446
-
2447
2397
  // src/dmv2/sdk/sqlResource.ts
2448
2398
  var SqlResource = class {
2449
2399
  /** @internal */
@@ -2498,18 +2448,66 @@ var SqlResource = class {
2498
2448
  }
2499
2449
  };
2500
2450
 
2451
+ // src/dmv2/sdk/materializedView.ts
2452
+ var requireTargetTableName = (tableName) => {
2453
+ if (typeof tableName === "string") {
2454
+ return tableName;
2455
+ } else {
2456
+ throw new Error("Name of targetTable is not specified.");
2457
+ }
2458
+ };
2459
+ var MaterializedView = class extends SqlResource {
2460
+ /** The target OlapTable instance where the materialized data is stored. */
2461
+ targetTable;
2462
+ constructor(options, targetSchema, targetColumns) {
2463
+ let selectStatement = options.selectStatement;
2464
+ if (typeof selectStatement !== "string") {
2465
+ selectStatement = toStaticQuery(selectStatement);
2466
+ }
2467
+ if (targetSchema === void 0 || targetColumns === void 0) {
2468
+ throw new Error(
2469
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2470
+ );
2471
+ }
2472
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2473
+ requireTargetTableName(
2474
+ options.targetTable?.name ?? options.tableName
2475
+ ),
2476
+ {
2477
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2478
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2479
+ },
2480
+ targetSchema,
2481
+ targetColumns
2482
+ );
2483
+ if (targetTable.name === options.materializedViewName) {
2484
+ throw new Error(
2485
+ "Materialized view name cannot be the same as the target table name."
2486
+ );
2487
+ }
2488
+ super(
2489
+ options.materializedViewName,
2490
+ [
2491
+ createMaterializedView({
2492
+ name: options.materializedViewName,
2493
+ destinationTable: targetTable.name,
2494
+ select: selectStatement
2495
+ })
2496
+ // Population is now handled automatically by Rust infrastructure
2497
+ // based on table engine type and whether this is a new or updated view
2498
+ ],
2499
+ [dropView(options.materializedViewName)],
2500
+ {
2501
+ pullsDataFrom: options.selectTables,
2502
+ pushesDataTo: [targetTable]
2503
+ }
2504
+ );
2505
+ this.targetTable = targetTable;
2506
+ }
2507
+ };
2508
+
2501
2509
  // src/dmv2/sdk/view.ts
2502
- var View = class {
2503
- /** @internal */
2504
- kind = "CustomView";
2505
- /** The name of the view */
2506
- name;
2507
- /** The SELECT SQL statement that defines the view */
2508
- selectSql;
2509
- /** Names of source tables/views that the SELECT reads from */
2510
- sourceTables;
2511
- /** @internal Source file path where this view was defined */
2512
- sourceFile;
2510
+ var View = class extends SqlResource {
2513
2511
  /**
2514
2512
  * Creates a new View instance.
2515
2513
  * @param name The name of the view to be created.
@@ -2520,16 +2518,17 @@ var View = class {
2520
2518
  if (typeof selectStatement !== "string") {
2521
2519
  selectStatement = toStaticQuery(selectStatement);
2522
2520
  }
2523
- this.name = name;
2524
- this.selectSql = selectStatement;
2525
- this.sourceTables = baseTables.map((t) => t.name);
2526
- const stack = new Error().stack;
2527
- this.sourceFile = getSourceFileFromStack(stack);
2528
- const customViews = getMooseInternal().customViews;
2529
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2530
- throw new Error(`View with name ${this.name} already exists`);
2531
- }
2532
- customViews.set(this.name, this);
2521
+ super(
2522
+ name,
2523
+ [
2524
+ `CREATE VIEW IF NOT EXISTS ${name}
2525
+ AS ${selectStatement}`.trim()
2526
+ ],
2527
+ [dropView(name)],
2528
+ {
2529
+ pullsDataFrom: baseTables
2530
+ }
2531
+ );
2533
2532
  }
2534
2533
  };
2535
2534