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

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-CQB6bk1i.js';
1
+ import './index-B2jILcTY.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-CQB6bk1i.mjs';
1
+ import './index-B2jILcTY.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-CQB6bk1i.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-DTtKuO-Y.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-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';
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-CQB6bk1i.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-Bqhjy4pn.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-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';
3
3
  import 'typia';
4
4
  import 'typia/src/schemas/json/IJsonSchemaCollection';
5
5
  import 'node:stream';
@@ -453,35 +453,8 @@ function getSourceFileInfo(stack) {
453
453
  }
454
454
  return {};
455
455
  }
456
- function getSourceLocationFromStack(stack) {
457
- if (!stack) return void 0;
458
- const lines = stack.split("\n");
459
- for (const line of lines.slice(1)) {
460
- if (shouldSkipStackLine(line)) {
461
- continue;
462
- }
463
- const v8Match = line.match(/at\s+(?:.*?\s+\()?(.+):(\d+):(\d+)\)?/);
464
- if (v8Match) {
465
- return {
466
- file: v8Match[1],
467
- line: parseInt(v8Match[2], 10),
468
- column: parseInt(v8Match[3], 10)
469
- };
470
- }
471
- const smMatch = line.match(/(?:.*@)?(.+):(\d+):(\d+)/);
472
- if (smMatch) {
473
- return {
474
- file: smMatch[1],
475
- line: parseInt(smMatch[2], 10),
476
- column: parseInt(smMatch[3], 10)
477
- };
478
- }
479
- }
480
- return void 0;
481
- }
482
456
  function getSourceFileFromStack(stack) {
483
- const location = getSourceLocationFromStack(stack);
484
- return location?.file;
457
+ return getSourceFileInfo(stack).file;
485
458
  }
486
459
 
487
460
  // src/dmv2/typedBase.ts
@@ -694,16 +667,6 @@ function emptyIfUndefined(value) {
694
667
  return value === void 0 ? "" : value;
695
668
  }
696
669
 
697
- // src/blocks/helpers.ts
698
- function dropView(name) {
699
- return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
700
- }
701
- function createMaterializedView(options) {
702
- return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
703
- TO ${quoteIdentifier(options.destinationTable)}
704
- AS ${options.select}`.trim();
705
- }
706
-
707
670
  // src/dmv2/internal.ts
708
671
  var import_process = __toESM(require("process"));
709
672
 
@@ -754,7 +717,9 @@ var moose_internal = {
754
717
  apis: /* @__PURE__ */ new Map(),
755
718
  sqlResources: /* @__PURE__ */ new Map(),
756
719
  workflows: /* @__PURE__ */ new Map(),
757
- webApps: /* @__PURE__ */ new Map()
720
+ webApps: /* @__PURE__ */ new Map(),
721
+ materializedViews: /* @__PURE__ */ new Map(),
722
+ customViews: /* @__PURE__ */ new Map()
758
723
  };
759
724
  var defaultRetentionPeriod = 60 * 60 * 24 * 7;
760
725
  var getMooseInternal = () => globalThis.moose_internal;
@@ -2370,6 +2335,67 @@ var ETLPipeline = class {
2370
2335
  }
2371
2336
  };
2372
2337
 
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
+
2373
2399
  // src/dmv2/sdk/sqlResource.ts
2374
2400
  var SqlResource = class {
2375
2401
  /** @internal */
@@ -2386,10 +2412,6 @@ var SqlResource = class {
2386
2412
  pushesDataTo;
2387
2413
  /** @internal Source file path where this resource was defined */
2388
2414
  sourceFile;
2389
- /** @internal Source line number where this resource was defined */
2390
- sourceLine;
2391
- /** @internal Source column number where this resource was defined */
2392
- sourceColumn;
2393
2415
  /**
2394
2416
  * Creates a new SqlResource instance.
2395
2417
  * @param name The name of the resource.
@@ -2415,75 +2437,22 @@ var SqlResource = class {
2415
2437
  this.pullsDataFrom = options?.pullsDataFrom ?? [];
2416
2438
  this.pushesDataTo = options?.pushesDataTo ?? [];
2417
2439
  const stack = new Error().stack;
2418
- const location = getSourceLocationFromStack(stack);
2419
- if (location) {
2420
- this.sourceFile = location.file;
2421
- this.sourceLine = location.line;
2422
- this.sourceColumn = location.column;
2423
- }
2424
- }
2425
- };
2426
-
2427
- // src/dmv2/sdk/materializedView.ts
2428
- var requireTargetTableName = (tableName) => {
2429
- if (typeof tableName === "string") {
2430
- return tableName;
2431
- } else {
2432
- throw new Error("Name of targetTable is not specified.");
2433
- }
2434
- };
2435
- var MaterializedView = class extends SqlResource {
2436
- /** The target OlapTable instance where the materialized data is stored. */
2437
- targetTable;
2438
- constructor(options, targetSchema, targetColumns) {
2439
- let selectStatement = options.selectStatement;
2440
- if (typeof selectStatement !== "string") {
2441
- selectStatement = toStaticQuery(selectStatement);
2442
- }
2443
- if (targetSchema === void 0 || targetColumns === void 0) {
2444
- throw new Error(
2445
- "Supply the type param T so that the schema is inserted by the compiler plugin."
2446
- );
2447
- }
2448
- const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2449
- requireTargetTableName(
2450
- options.targetTable?.name ?? options.tableName
2451
- ),
2452
- {
2453
- orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2454
- engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2455
- },
2456
- targetSchema,
2457
- targetColumns
2458
- );
2459
- if (targetTable.name === options.materializedViewName) {
2460
- throw new Error(
2461
- "Materialized view name cannot be the same as the target table name."
2462
- );
2463
- }
2464
- super(
2465
- options.materializedViewName,
2466
- [
2467
- createMaterializedView({
2468
- name: options.materializedViewName,
2469
- destinationTable: targetTable.name,
2470
- select: selectStatement
2471
- })
2472
- // Population is now handled automatically by Rust infrastructure
2473
- // based on table engine type and whether this is a new or updated view
2474
- ],
2475
- [dropView(options.materializedViewName)],
2476
- {
2477
- pullsDataFrom: options.selectTables,
2478
- pushesDataTo: [targetTable]
2479
- }
2480
- );
2481
- this.targetTable = targetTable;
2440
+ this.sourceFile = getSourceFileFromStack(stack);
2482
2441
  }
2483
2442
  };
2484
2443
 
2485
2444
  // src/dmv2/sdk/view.ts
2486
- var View = class extends SqlResource {
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;
2487
2456
  /**
2488
2457
  * Creates a new View instance.
2489
2458
  * @param name The name of the view to be created.
@@ -2494,17 +2463,16 @@ var View = class extends SqlResource {
2494
2463
  if (typeof selectStatement !== "string") {
2495
2464
  selectStatement = toStaticQuery(selectStatement);
2496
2465
  }
2497
- super(
2498
- name,
2499
- [
2500
- `CREATE VIEW IF NOT EXISTS ${name}
2501
- AS ${selectStatement}`.trim()
2502
- ],
2503
- [dropView(name)],
2504
- {
2505
- pullsDataFrom: baseTables
2506
- }
2507
- );
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);
2508
2476
  }
2509
2477
  };
2510
2478