@514labs/moose-lib 0.6.446 → 0.6.447

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
- export { A as Aggregated, h as Api, i as ApiConfig, ap as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, a5 as ClickHouseMaterialized, a2 as ClickHouseNamedTuple, U as ClickHousePrecision, a4 as ClickHouseTTL, j as ConsumptionApi, aq as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, as as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, at as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, av as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, ay as Sql, l as SqlResource, aw as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, au as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aD as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aC as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aE as mapToClickHouseType, ar as quoteIdentifier, ax as sql, aA as toQuery, aB as toQueryPreview, az as toStaticQuery } from './index-D22Yb8pY.mjs';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, aq as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, a5 as ClickHouseMaterialized, a2 as ClickHouseNamedTuple, U as ClickHousePrecision, a4 as ClickHouseTTL, j as ConsumptionApi, ar as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, at as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ap as Insertable, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, au as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, aw as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, az as Sql, l as SqlResource, ax as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, av as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aE as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aD as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aF as mapToClickHouseType, as as quoteIdentifier, ay as sql, aB as toQuery, aC as toQueryPreview, aA as toStaticQuery } from './index-FbIy0gSU.mjs';
2
2
  import 'typia';
3
3
  import 'typia/lib/tags';
4
4
  import 'node:stream';
@@ -1,4 +1,4 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, ap as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, a5 as ClickHouseMaterialized, a2 as ClickHouseNamedTuple, U as ClickHousePrecision, a4 as ClickHouseTTL, j as ConsumptionApi, aq as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, as as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, at as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, av as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, ay as Sql, l as SqlResource, aw as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, au as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aD as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aC as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aE as mapToClickHouseType, ar as quoteIdentifier, ax as sql, aA as toQuery, aB as toQueryPreview, az as toStaticQuery } from './index-D22Yb8pY.js';
1
+ export { A as Aggregated, h as Api, i as ApiConfig, aq as ApiUtil, a6 as ClickHouseAlias, Y as ClickHouseByteSize, a8 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, a5 as ClickHouseMaterialized, a2 as ClickHouseNamedTuple, U as ClickHousePrecision, a4 as ClickHouseTTL, j as ConsumptionApi, ar as ConsumptionUtil, a9 as DateTime, aa as DateTime64, ac as DateTime64String, ab as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, ao as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ad as FixedString, ae as Float32, af as Float64, F as FrameworkApp, at as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ap as Insertable, ah as Int16, ai as Int32, aj as Int64, ag as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, au as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, aw as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, az as Sql, l as SqlResource, ax as SqlTemplateTag, c as Stream, d as StreamConfig, T as Task, al as UInt16, am as UInt32, an as UInt64, ak as UInt8, av as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a7 as WithDefault, W as Workflow, aE as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aD as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aF as mapToClickHouseType, as as quoteIdentifier, ay as sql, aB as toQuery, aC as toQueryPreview, aA as toStaticQuery } from './index-FbIy0gSU.js';
2
2
  import 'typia';
3
3
  import 'typia/lib/tags';
4
4
  import 'node:stream';
@@ -1191,6 +1191,7 @@ var dlqColumns = [
1191
1191
  ttl: null,
1192
1192
  codec: null,
1193
1193
  materialized: null,
1194
+ alias: null,
1194
1195
  comment: null
1195
1196
  },
1196
1197
  {
@@ -1204,6 +1205,7 @@ var dlqColumns = [
1204
1205
  ttl: null,
1205
1206
  codec: null,
1206
1207
  materialized: null,
1208
+ alias: null,
1207
1209
  comment: null
1208
1210
  },
1209
1211
  {
@@ -1217,6 +1219,7 @@ var dlqColumns = [
1217
1219
  ttl: null,
1218
1220
  codec: null,
1219
1221
  materialized: null,
1222
+ alias: null,
1220
1223
  comment: null
1221
1224
  },
1222
1225
  {
@@ -1230,6 +1233,7 @@ var dlqColumns = [
1230
1233
  ttl: null,
1231
1234
  codec: null,
1232
1235
  materialized: null,
1236
+ alias: null,
1233
1237
  comment: null
1234
1238
  },
1235
1239
  {
@@ -1243,6 +1247,7 @@ var dlqColumns = [
1243
1247
  ttl: null,
1244
1248
  codec: null,
1245
1249
  materialized: null,
1250
+ alias: null,
1246
1251
  comment: null
1247
1252
  }
1248
1253
  ];
@@ -1254,13 +1259,15 @@ var OlapTable2 = class extends TypedBase {
1254
1259
  name;
1255
1260
  /** @internal */
1256
1261
  kind = "OlapTable";
1262
+ /** @internal Typia validators for Insertable<T> — used during insert validation */
1263
+ insertValidators;
1257
1264
  /** @internal Memoized ClickHouse client for reusing connections across insert calls */
1258
1265
  _memoizedClient;
1259
1266
  /** @internal Hash of the configuration used to create the memoized client */
1260
1267
  _configHash;
1261
1268
  /** @internal Cached table name to avoid repeated generation */
1262
1269
  _cachedTableName;
1263
- constructor(name, config, schema, columns, validators) {
1270
+ constructor(name, config, schema, columns, validators, insertValidators) {
1264
1271
  const resolvedConfig = config ? "engine" in config ? config : { ...config, engine: "MergeTree" /* MergeTree */ } : { engine: "MergeTree" /* MergeTree */ };
1265
1272
  const hasFields = Array.isArray(resolvedConfig.orderByFields) && resolvedConfig.orderByFields.length > 0;
1266
1273
  const hasExpr = typeof resolvedConfig.orderByExpression === "string" && resolvedConfig.orderByExpression.length > 0;
@@ -1278,6 +1285,7 @@ var OlapTable2 = class extends TypedBase {
1278
1285
  );
1279
1286
  }
1280
1287
  super(name, resolvedConfig, schema, columns, validators);
1288
+ this.insertValidators = insertValidators;
1281
1289
  this.name = name;
1282
1290
  const tables = getMooseInternal().tables;
1283
1291
  const registryKey = this.config.version ? `${name}_${this.config.version}` : name;
@@ -1421,6 +1429,54 @@ var OlapTable2 = class extends TypedBase {
1421
1429
  }
1422
1430
  throw new Error("No typia validator found");
1423
1431
  }
1432
+ /**
1433
+ * Validates records for insert using Insertable<T> validators when available.
1434
+ * Falls back to the full T validators if insert validators weren't generated.
1435
+ * @private
1436
+ */
1437
+ async validateInsertRecords(data) {
1438
+ const iv = this.insertValidators;
1439
+ if (!iv?.is) {
1440
+ return this.validateRecords(data);
1441
+ }
1442
+ const valid = [];
1443
+ const invalid = [];
1444
+ for (let i = 0; i < data.length; i++) {
1445
+ const record = data[i];
1446
+ try {
1447
+ if (iv.is(record)) {
1448
+ valid.push(this.mapToClickhouseRecord(record));
1449
+ } else if (iv.validate) {
1450
+ const result = iv.validate(record);
1451
+ if (result.success) {
1452
+ valid.push(this.mapToClickhouseRecord(record));
1453
+ } else {
1454
+ invalid.push({
1455
+ record,
1456
+ error: result.errors?.map((e) => String(e)).join(", ") || "Validation failed",
1457
+ index: i,
1458
+ path: "root"
1459
+ });
1460
+ }
1461
+ } else {
1462
+ invalid.push({
1463
+ record,
1464
+ error: "Validation failed",
1465
+ index: i,
1466
+ path: "root"
1467
+ });
1468
+ }
1469
+ } catch (error) {
1470
+ invalid.push({
1471
+ record,
1472
+ error: error instanceof Error ? error.message : String(error),
1473
+ index: i,
1474
+ path: "root"
1475
+ });
1476
+ }
1477
+ }
1478
+ return { valid, invalid, total: data.length };
1479
+ }
1424
1480
  /**
1425
1481
  * Validates an array of records with comprehensive error reporting.
1426
1482
  * Uses the most appropriate validation method available (typia or basic).
@@ -1569,7 +1625,9 @@ var OlapTable2 = class extends TypedBase {
1569
1625
  return { validatedData: data, validationErrors: [] };
1570
1626
  }
1571
1627
  try {
1572
- const validationResult = await this.validateRecords(data);
1628
+ const validationResult = await this.validateInsertRecords(
1629
+ data
1630
+ );
1573
1631
  const validatedData = validationResult.valid;
1574
1632
  const validationErrors = validationResult.invalid;
1575
1633
  if (validationErrors.length > 0) {
@@ -1874,8 +1932,9 @@ var OlapTable2 = class extends TypedBase {
1874
1932
  * ```
1875
1933
  */
1876
1934
  async insert(data, options) {
1877
- const { isStream, strategy, shouldValidate } = this.validateInsertParameters(data, options);
1878
- const emptyResult = this.handleEmptyData(data, isStream);
1935
+ const rawData = data;
1936
+ const { isStream, strategy, shouldValidate } = this.validateInsertParameters(rawData, options);
1937
+ const emptyResult = this.handleEmptyData(rawData, isStream);
1879
1938
  if (emptyResult) {
1880
1939
  return emptyResult;
1881
1940
  }
@@ -1883,7 +1942,7 @@ var OlapTable2 = class extends TypedBase {
1883
1942
  let validationErrors = [];
1884
1943
  if (!isStream && shouldValidate) {
1885
1944
  const validationResult = await this.performPreInsertionValidation(
1886
- data,
1945
+ rawData,
1887
1946
  shouldValidate,
1888
1947
  strategy,
1889
1948
  options
@@ -1891,14 +1950,14 @@ var OlapTable2 = class extends TypedBase {
1891
1950
  validatedData = validationResult.validatedData;
1892
1951
  validationErrors = validationResult.validationErrors;
1893
1952
  } else {
1894
- validatedData = isStream ? [] : data;
1953
+ validatedData = isStream ? [] : rawData;
1895
1954
  }
1896
1955
  const { client } = await this.getMemoizedClient();
1897
1956
  const tableName = this.generateTableName();
1898
1957
  try {
1899
1958
  const insertOptions = this.prepareInsertOptions(
1900
1959
  tableName,
1901
- data,
1960
+ rawData,
1902
1961
  validatedData,
1903
1962
  isStream,
1904
1963
  strategy,
@@ -1906,7 +1965,7 @@ var OlapTable2 = class extends TypedBase {
1906
1965
  );
1907
1966
  await client.insert(insertOptions);
1908
1967
  return this.createSuccessResult(
1909
- data,
1968
+ rawData,
1910
1969
  validatedData,
1911
1970
  validationErrors,
1912
1971
  isStream,
@@ -1918,7 +1977,7 @@ var OlapTable2 = class extends TypedBase {
1918
1977
  batchError,
1919
1978
  strategy,
1920
1979
  tableName,
1921
- data,
1980
+ rawData,
1922
1981
  validatedData,
1923
1982
  validationErrors,
1924
1983
  isStream,