@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
@@ -69,12 +69,13 @@ function createClickhouseParameter(parameterIndex, value) {
69
69
  function emptyIfUndefined(value) {
70
70
  return value === void 0 ? "" : value;
71
71
  }
72
- var isTable, isView, isColumn, sql, instanceofSql, Sql, toQuery, toQueryPreview, getValueFromParameter, mapToClickHouseType;
72
+ var isTable, isView, isDictionary, isColumn, sql, instanceofSql, Sql, toQuery, toQueryPreview, getValueFromParameter, mapToClickHouseType;
73
73
  var init_sqlHelpers = __esm({
74
74
  "src/sqlHelpers.ts"() {
75
75
  "use strict";
76
76
  isTable = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "OlapTable";
77
77
  isView = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "View";
78
+ isDictionary = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "OlapDictionary";
78
79
  isColumn = (value) => typeof value === "object" && value !== null && !("kind" in value) && "name" in value && "annotations" in value;
79
80
  sql = sqlImpl;
80
81
  sql.statement = function(strings, ...values) {
@@ -98,7 +99,7 @@ var init_sqlHelpers = __esm({
98
99
  );
99
100
  }
100
101
  const valuesLength = rawValues.reduce(
101
- (len, value) => len + (instanceofSql(value) ? value.values.length : isColumn(value) || isTable(value) || isView(value) ? 0 : 1),
102
+ (len, value) => len + (instanceofSql(value) ? value.values.length : isColumn(value) || isTable(value) || isView(value) || isDictionary(value) ? 0 : 1),
102
103
  0
103
104
  );
104
105
  this.values = new Array(valuesLength);
@@ -145,6 +146,14 @@ var init_sqlHelpers = __esm({
145
146
  this.strings[pos] += `\`${child.name}\``;
146
147
  }
147
148
  this.strings[pos] += rawString;
149
+ } else if (isDictionary(child)) {
150
+ if (/\b(?:FROM|JOIN)\s*$/i.test(this.strings[pos])) {
151
+ console.warn(
152
+ `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.`
153
+ );
154
+ }
155
+ this.strings[pos] += `'${child.getQualifiedName().replace(/'/g, "''")}'`;
156
+ this.strings[pos] += rawString;
148
157
  } else {
149
158
  this.values[pos++] = child;
150
159
  this.strings[pos] = rawString;
@@ -382,6 +391,18 @@ var init_lifeCycle = __esm({
382
391
  }
383
392
  });
384
393
 
394
+ // src/dmv2/sdk/olapDictionary.ts
395
+ var init_olapDictionary = __esm({
396
+ "src/dmv2/sdk/olapDictionary.ts"() {
397
+ "use strict";
398
+ init_internal();
399
+ init_olapTable();
400
+ init_lifeCycle();
401
+ init_sqlHelpers();
402
+ init_stackTrace();
403
+ }
404
+ });
405
+
385
406
  // src/dmv2/sdk/webApp.ts
386
407
  var init_webApp = __esm({
387
408
  "src/dmv2/sdk/webApp.ts"() {
@@ -420,6 +441,7 @@ var init_dmv2 = __esm({
420
441
  init_view();
421
442
  init_selectRowPolicy();
422
443
  init_lifeCycle();
444
+ init_olapDictionary();
423
445
  init_webApp();
424
446
  init_registry();
425
447
  }
@@ -3145,7 +3167,8 @@ function createRegistryFrom(existing) {
3145
3167
  webApps: toTrackingMap(existing?.webApps),
3146
3168
  materializedViews: toTrackingMap(existing?.materializedViews),
3147
3169
  views: toTrackingMap(existing?.views),
3148
- selectRowPolicies: toTrackingMap(existing?.selectRowPolicies)
3170
+ selectRowPolicies: toTrackingMap(existing?.selectRowPolicies),
3171
+ olapDictionaries: toTrackingMap(existing?.olapDictionaries)
3149
3172
  };
3150
3173
  }
3151
3174
  function getCachedLineage(registry) {
@@ -3506,6 +3529,10 @@ var init_internal = __esm({
3506
3529
  selectRowPolicies: new MutationTrackingMap(
3507
3530
  void 0,
3508
3531
  markRegistryMutated
3532
+ ),
3533
+ olapDictionaries: new MutationTrackingMap(
3534
+ void 0,
3535
+ markRegistryMutated
3509
3536
  )
3510
3537
  };
3511
3538
  defaultRetentionPeriod = 60 * 60 * 24 * 7;
@@ -3520,6 +3547,7 @@ var init_internal = __esm({
3520
3547
  const materializedViews = {};
3521
3548
  const views = {};
3522
3549
  const selectRowPolicies = {};
3550
+ const olapDictionaries = {};
3523
3551
  const lineage = getCachedLineage(registry);
3524
3552
  registry.tables.forEach((table) => {
3525
3553
  const id = table.config.version ? `${table.name}_${table.config.version}` : table.name;
@@ -3784,6 +3812,9 @@ var init_internal = __esm({
3784
3812
  claim: policy.config.claim
3785
3813
  };
3786
3814
  });
3815
+ registry.olapDictionaries.forEach((dict) => {
3816
+ olapDictionaries[dict.name] = dict.toJson();
3817
+ });
3787
3818
  return {
3788
3819
  topics,
3789
3820
  tables,
@@ -3795,6 +3826,7 @@ var init_internal = __esm({
3795
3826
  materializedViews,
3796
3827
  views,
3797
3828
  selectRowPolicies,
3829
+ olapDictionaries,
3798
3830
  unloadedFiles: []
3799
3831
  // Will be populated by dumpMooseInternal
3800
3832
  };
@@ -3839,6 +3871,7 @@ var init_internal = __esm({
3839
3871
  registry.materializedViews.clear();
3840
3872
  registry.views.clear();
3841
3873
  registry.selectRowPolicies.clear();
3874
+ registry.olapDictionaries.clear();
3842
3875
  const outDir = getOutDir();
3843
3876
  const compiledDir = path5.isAbsolute(outDir) ? outDir : path5.join(import_process.default.cwd(), outDir);
3844
3877
  Object.keys(require.cache).forEach((key) => {