@514labs/moose-lib 0.6.279-ci-5-g982a1dc0 → 0.6.279-ci-2-g69faf7b6

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-BtkwFbT9.mjs';
1
+ import './index-KhGbXtkS.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-BtkwFbT9.js';
1
+ import './index-KhGbXtkS.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-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';
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';
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-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';
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';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -428,13 +428,10 @@ 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("node:internal") || // Skip Node.js internals (modern format)
432
- line.includes("internal/modules") || // Skip Node.js internals (older format)
431
+ line.includes("internal/modules") || // Skip Node.js internals
433
432
  line.includes("ts-node") || // Skip TypeScript execution
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\\");
433
+ line.includes("/ts-moose-lib/") || // Skip dev/linked moose-lib (Unix)
434
+ line.includes("\\ts-moose-lib\\");
438
435
  }
439
436
  function parseStackLine(line) {
440
437
  const match = line.match(/\((.*):(\d+):(\d+)\)/) || line.match(/at (.*):(\d+):(\d+)/);
@@ -537,12 +534,12 @@ var TypedBase = class {
537
534
  this.validators = validators;
538
535
  this.allowExtraFields = allowExtraFields ?? false;
539
536
  this.metadata = config?.metadata ? { ...config.metadata } : {};
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
- }
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;
546
543
  }
547
544
  }
548
545
  };
@@ -705,16 +702,6 @@ function emptyIfUndefined(value) {
705
702
  return value === void 0 ? "" : value;
706
703
  }
707
704
 
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
-
718
705
  // src/dmv2/internal.ts
719
706
  var import_process = __toESM(require("process"));
720
707
 
@@ -765,7 +752,9 @@ var moose_internal = {
765
752
  apis: /* @__PURE__ */ new Map(),
766
753
  sqlResources: /* @__PURE__ */ new Map(),
767
754
  workflows: /* @__PURE__ */ new Map(),
768
- webApps: /* @__PURE__ */ new Map()
755
+ webApps: /* @__PURE__ */ new Map(),
756
+ materializedViews: /* @__PURE__ */ new Map(),
757
+ customViews: /* @__PURE__ */ new Map()
769
758
  };
770
759
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
771
760
  var getMooseInternal = () => globalThis.moose_internal;
@@ -2394,6 +2383,67 @@ var ETLPipeline = class {
2394
2383
  }
2395
2384
  };
2396
2385
 
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
+
2397
2447
  // src/dmv2/sdk/sqlResource.ts
2398
2448
  var SqlResource = class {
2399
2449
  /** @internal */
@@ -2448,66 +2498,18 @@ var SqlResource = class {
2448
2498
  }
2449
2499
  };
2450
2500
 
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
-
2509
2501
  // src/dmv2/sdk/view.ts
2510
- var View = class extends SqlResource {
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;
2511
2513
  /**
2512
2514
  * Creates a new View instance.
2513
2515
  * @param name The name of the view to be created.
@@ -2518,17 +2520,16 @@ var View = class extends SqlResource {
2518
2520
  if (typeof selectStatement !== "string") {
2519
2521
  selectStatement = toStaticQuery(selectStatement);
2520
2522
  }
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
- );
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);
2532
2533
  }
2533
2534
  };
2534
2535