@mondaydotcomorg/z2h-cli 0.32.0 → 0.32.2

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.
@@ -26,7 +26,7 @@ export interface SnowflakeRow {
26
26
  export interface RunQueryOptions {
27
27
  /** Clamped to MAX_TIMEOUT_MS. Defaults to DEFAULT_TIMEOUT_MS. */
28
28
  timeoutMs?: number;
29
- /** Human-readable label for the pool identifier/logs, e.g. a widget name, instead of the default query-shape hash. Sanitized to `[a-z0-9-_]`, max 64 chars. */
29
+ /** Human-readable label appended to the pool identifier/logs (e.g. a widget name), alongside the query-shape hash — never replacing it, so `query_hash` lookups keep working. Sanitized to `[a-z0-9-_]`, max 64 chars. */
30
30
  identifier?: string;
31
31
  }
32
32
 
@@ -142,8 +142,9 @@ export async function runSnowflakeQuery(
142
142
 
143
143
  // Cache key stays parameter-sensitive; the pool identifier deliberately is not.
144
144
  const queryCacheKey = hashQuery(boundSql, params ?? {});
145
+ const queryHash = hashQueryShape(sql);
145
146
  const sanitizedIdentifier = options?.identifier ? sanitizeIdentifier(options.identifier) : '';
146
- const queryIdentifier = sanitizedIdentifier || hashQueryShape(sql);
147
+ const queryIdentifier = sanitizedIdentifier || queryHash;
147
148
  const scope = cacheScope(useStateless);
148
149
  const startMs = Date.now();
149
150
  const cached = scope ? await readCache(queryCacheKey, scope) : null;
@@ -167,7 +168,9 @@ export async function runSnowflakeQuery(
167
168
 
168
169
  const queryOptions = {
169
170
  query: boundSql,
170
- identifier: `z2h-query:${appName}:${queryIdentifier}`,
171
+ // `queryHash` always occupies this slot so `query_hash`-keyed joins never break;
172
+ // a caller-supplied identifier is appended, not substituted.
173
+ identifier: `z2h-query:${appName}:${queryHash}${sanitizedIdentifier ? `:${sanitizedIdentifier}` : ''}`,
171
174
  fallback: [] as SnowflakeRow[],
172
175
  timeoutInMs,
173
176
  convertToSingularResult: false,
@@ -36,8 +36,8 @@ export function makeSnowflakeChannel(appName: string) {
36
36
  * @param options - Optional `{ timeoutMs?: number, identifier?: string }`. `timeoutMs` is
37
37
  * clamped to 5 min (`MAX_TIMEOUT_MS`); effective ceiling is ~5.5 min including the host
38
38
  * backstop. `identifier` names this query in logs/metrics and the Snowflake pool identifier
39
- * (e.g. a widget name) instead of the default query-shape hash — sanitized to `[a-z0-9-_]`,
40
- * max 64 chars.
39
+ * (e.g. a widget name), appended alongside the query-shape hash — it never replaces the hash,
40
+ * so `query_hash` lookups keep working. Sanitized to `[a-z0-9-_]`, max 64 chars.
41
41
  * @returns Array of row objects with **camelCase keys** — SQL aliases are normalized
42
42
  * to camelCase regardless of their casing in the query
43
43
  * (e.g. `AS current_user` → `rows[0].currentUser`, `AS total_count` → `rows[0].totalCount`).
@@ -68,7 +68,7 @@ export function makeSnowflakeChannel(appName: string) {
68
68
  * );
69
69
  *
70
70
  * @example
71
- * // Name this query in logs/metrics instead of the default hash
71
+ * // Name this query in logs/metrics alongside the default hash
72
72
  * const rows = await ctx.api.v1.snowflake.query(
73
73
  * `SELECT COUNT(*) AS total FROM monday_items`,
74
74
  * undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mondaydotcomorg/z2h-cli",
3
- "version": "0.32.0",
3
+ "version": "0.32.2",
4
4
  "bin": "./bin/z2h-cli.js",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -51,7 +51,7 @@
51
51
  ],
52
52
  "dependencies": {
53
53
  "@aws-sdk/client-s3": "^3.706.0",
54
- "@mondaydotcomorg/z2h-dashboard-templates": "^0.3.6",
54
+ "@mondaydotcomorg/z2h-dashboard-templates": "^0.4.0",
55
55
  "@mondaydotcomorg/z2h-shared-utils": "^0.6.2",
56
56
  "acorn": "^8.14.0",
57
57
  "acorn-walk": "^8.3.4",
@@ -77,6 +77,7 @@
77
77
  "@types/mime-types": "^2.1.4",
78
78
  "@types/node": "^22.19.0",
79
79
  "@types/semver": "^7.5.0",
80
+ "nx": "^21.6.0",
80
81
  "typescript": "^5.7.2",
81
82
  "vitest": "^2.1.4"
82
83
  },