@514labs/moose-lib 0.6.527 → 0.6.528

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.
Files changed (37) hide show
  1. package/dist/browserCompatible.d.mts +2 -2
  2. package/dist/browserCompatible.d.ts +2 -2
  3. package/dist/browserCompatible.js +393 -2
  4. package/dist/browserCompatible.js.map +1 -1
  5. package/dist/browserCompatible.mjs +389 -2
  6. package/dist/browserCompatible.mjs.map +1 -1
  7. package/dist/compilerPlugin.js +2 -1
  8. package/dist/compilerPlugin.js.map +1 -1
  9. package/dist/compilerPlugin.mjs +2 -1
  10. package/dist/compilerPlugin.mjs.map +1 -1
  11. package/dist/dmv2/index.d.mts +2 -2
  12. package/dist/dmv2/index.d.ts +2 -2
  13. package/dist/dmv2/index.js +393 -2
  14. package/dist/dmv2/index.js.map +1 -1
  15. package/dist/dmv2/index.mjs +389 -2
  16. package/dist/dmv2/index.mjs.map +1 -1
  17. package/dist/{index-k_kpRxE3.d.mts → index-BTIlwBBZ.d.mts} +13 -2
  18. package/dist/{index-7uxZbwmY.d.ts → index-w7pvlv3c.d.ts} +13 -2
  19. package/dist/index.d.mts +4 -4
  20. package/dist/index.d.ts +4 -4
  21. package/dist/index.js +394 -2
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +390 -2
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/moose-runner.js +36 -3
  26. package/dist/moose-runner.js.map +1 -1
  27. package/dist/moose-runner.mjs +36 -3
  28. package/dist/moose-runner.mjs.map +1 -1
  29. package/dist/{view-BCWJcLF6.d.mts → query-client-6YrlC3Df.d.mts} +420 -80
  30. package/dist/{view-BCWJcLF6.d.ts → query-client-6YrlC3Df.d.ts} +420 -80
  31. package/dist/testing/index.d.mts +1 -1
  32. package/dist/testing/index.d.ts +1 -1
  33. package/dist/testing/index.js +10 -1
  34. package/dist/testing/index.js.map +1 -1
  35. package/dist/testing/index.mjs +10 -1
  36. package/dist/testing/index.mjs.map +1 -1
  37. package/package.json +1 -1
@@ -54,12 +54,13 @@ function createClickhouseParameter(parameterIndex, value) {
54
54
  function emptyIfUndefined(value) {
55
55
  return value === void 0 ? "" : value;
56
56
  }
57
- var isTable, isView, isColumn, sql, instanceofSql, Sql, toQuery, toQueryPreview, getValueFromParameter, mapToClickHouseType;
57
+ var isTable, isView, isDictionary, isColumn, sql, instanceofSql, Sql, toQuery, toQueryPreview, getValueFromParameter, mapToClickHouseType;
58
58
  var init_sqlHelpers = __esm({
59
59
  "src/sqlHelpers.ts"() {
60
60
  "use strict";
61
61
  isTable = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "OlapTable";
62
62
  isView = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "View";
63
+ isDictionary = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "OlapDictionary";
63
64
  isColumn = (value) => typeof value === "object" && value !== null && !("kind" in value) && "name" in value && "annotations" in value;
64
65
  sql = sqlImpl;
65
66
  sql.statement = function(strings, ...values) {
@@ -83,7 +84,7 @@ var init_sqlHelpers = __esm({
83
84
  );
84
85
  }
85
86
  const valuesLength = rawValues.reduce(
86
- (len, value) => len + (instanceofSql(value) ? value.values.length : isColumn(value) || isTable(value) || isView(value) ? 0 : 1),
87
+ (len, value) => len + (instanceofSql(value) ? value.values.length : isColumn(value) || isTable(value) || isView(value) || isDictionary(value) ? 0 : 1),
87
88
  0
88
89
  );
89
90
  this.values = new Array(valuesLength);
@@ -130,6 +131,14 @@ var init_sqlHelpers = __esm({
130
131
  this.strings[pos] += `\`${child.name}\``;
131
132
  }
132
133
  this.strings[pos] += rawString;
134
+ } else if (isDictionary(child)) {
135
+ if (/\b(?:FROM|JOIN)\s*$/i.test(this.strings[pos])) {
136
+ console.warn(
137
+ `OlapDictionary '${child.getQualifiedName()}' interpolated after FROM/JOIN in sql tag. Dictionaries render as string literals (e.g. 'db.dict_name') for use with dictGet(), not as table identifiers. ClickHouse dictionaries cannot be queried directly with FROM/JOIN.`
138
+ );
139
+ }
140
+ this.strings[pos] += `'${child.getQualifiedName().replace(/'/g, "''")}'`;
141
+ this.strings[pos] += rawString;
133
142
  } else {
134
143
  this.values[pos++] = child;
135
144
  this.strings[pos] = rawString;
@@ -365,6 +374,18 @@ var init_lifeCycle = __esm({
365
374
  }
366
375
  });
367
376
 
377
+ // src/dmv2/sdk/olapDictionary.ts
378
+ var init_olapDictionary = __esm({
379
+ "src/dmv2/sdk/olapDictionary.ts"() {
380
+ "use strict";
381
+ init_internal();
382
+ init_olapTable();
383
+ init_lifeCycle();
384
+ init_sqlHelpers();
385
+ init_stackTrace();
386
+ }
387
+ });
388
+
368
389
  // src/dmv2/sdk/webApp.ts
369
390
  var init_webApp = __esm({
370
391
  "src/dmv2/sdk/webApp.ts"() {
@@ -403,6 +424,7 @@ var init_dmv2 = __esm({
403
424
  init_view();
404
425
  init_selectRowPolicy();
405
426
  init_lifeCycle();
427
+ init_olapDictionary();
406
428
  init_webApp();
407
429
  init_registry();
408
430
  }
@@ -3131,7 +3153,8 @@ function createRegistryFrom(existing) {
3131
3153
  webApps: toTrackingMap(existing?.webApps),
3132
3154
  materializedViews: toTrackingMap(existing?.materializedViews),
3133
3155
  views: toTrackingMap(existing?.views),
3134
- selectRowPolicies: toTrackingMap(existing?.selectRowPolicies)
3156
+ selectRowPolicies: toTrackingMap(existing?.selectRowPolicies),
3157
+ olapDictionaries: toTrackingMap(existing?.olapDictionaries)
3135
3158
  };
3136
3159
  }
3137
3160
  function getCachedLineage(registry) {
@@ -3490,6 +3513,10 @@ var init_internal = __esm({
3490
3513
  selectRowPolicies: new MutationTrackingMap(
3491
3514
  void 0,
3492
3515
  markRegistryMutated
3516
+ ),
3517
+ olapDictionaries: new MutationTrackingMap(
3518
+ void 0,
3519
+ markRegistryMutated
3493
3520
  )
3494
3521
  };
3495
3522
  defaultRetentionPeriod = 60 * 60 * 24 * 7;
@@ -3504,6 +3531,7 @@ var init_internal = __esm({
3504
3531
  const materializedViews = {};
3505
3532
  const views = {};
3506
3533
  const selectRowPolicies = {};
3534
+ const olapDictionaries = {};
3507
3535
  const lineage = getCachedLineage(registry);
3508
3536
  registry.tables.forEach((table) => {
3509
3537
  const id = table.config.version ? `${table.name}_${table.config.version}` : table.name;
@@ -3768,6 +3796,9 @@ var init_internal = __esm({
3768
3796
  claim: policy.config.claim
3769
3797
  };
3770
3798
  });
3799
+ registry.olapDictionaries.forEach((dict) => {
3800
+ olapDictionaries[dict.name] = dict.toJson();
3801
+ });
3771
3802
  return {
3772
3803
  topics,
3773
3804
  tables,
@@ -3779,6 +3810,7 @@ var init_internal = __esm({
3779
3810
  materializedViews,
3780
3811
  views,
3781
3812
  selectRowPolicies,
3813
+ olapDictionaries,
3782
3814
  unloadedFiles: []
3783
3815
  // Will be populated by dumpMooseInternal
3784
3816
  };
@@ -3823,6 +3855,7 @@ var init_internal = __esm({
3823
3855
  registry.materializedViews.clear();
3824
3856
  registry.views.clear();
3825
3857
  registry.selectRowPolicies.clear();
3858
+ registry.olapDictionaries.clear();
3826
3859
  const outDir = getOutDir();
3827
3860
  const compiledDir = path5.isAbsolute(outDir) ? outDir : path5.join(process3.cwd(), outDir);
3828
3861
  Object.keys(__require.cache).forEach((key) => {