@lightdash/query-sdk 1.80.0 → 1.82.0

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 +1 @@
1
- export declare const SDK_VERSION = "1.80.0";
1
+ export declare const SDK_VERSION = "1.82.0";
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/generateSdkVersion.mjs (prebuild) — do not edit.
2
- export const SDK_VERSION = '1.80.0';
2
+ export const SDK_VERSION = '1.82.0';
@@ -90,6 +90,11 @@ export type SdkExternalFetchResponse = {
90
90
  result?: ExternalFetchResult;
91
91
  error?: string;
92
92
  };
93
+ /**
94
+ * `crypto.randomUUID` is secure-context only, so it's missing when the app is
95
+ * served over plain http. Ids only need to be unique within one page session.
96
+ */
97
+ export declare const createRequestId: () => string;
93
98
  type PostMessageTransportConfig = {
94
99
  targetWindow: Window;
95
100
  projectUuid: string;
@@ -12,6 +12,13 @@ import { createApiTransport } from './apiTransport';
12
12
  import { announceSdkManifest } from './manifest';
13
13
  const DEFAULT_TIMEOUT_MS = 120000;
14
14
  const READY_TIMEOUT_MS = 10000;
15
+ /**
16
+ * `crypto.randomUUID` is secure-context only, so it's missing when the app is
17
+ * served over plain http. Ids only need to be unique within one page session.
18
+ */
19
+ export const createRequestId = () => typeof crypto !== 'undefined' && 'randomUUID' in crypto
20
+ ? crypto.randomUUID()
21
+ : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
15
22
  /**
16
23
  * Creates a FetchAdapter that sends HTTP requests to the parent window
17
24
  * via postMessage and waits for responses.
@@ -58,7 +65,7 @@ function createPostMessageFetchAdapter(config) {
58
65
  });
59
66
  return async (method, path, body, metadata) => {
60
67
  await readyPromise;
61
- const id = crypto.randomUUID();
68
+ const id = createRequestId();
62
69
  return new Promise((resolve, reject) => {
63
70
  const timer = setTimeout(() => {
64
71
  pending.delete(id);
@@ -135,7 +142,7 @@ function createPostMessageExternalFetch(config) {
135
142
  });
136
143
  return async (alias, opts) => {
137
144
  await readyPromise;
138
- const id = crypto.randomUUID();
145
+ const id = createRequestId();
139
146
  return new Promise((resolve, reject) => {
140
147
  const timer = setTimeout(() => {
141
148
  pending.delete(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/query-sdk",
3
- "version": "1.80.0",
3
+ "version": "1.82.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "SDK for building custom data apps against the Lightdash semantic layer",
@@ -34,7 +34,7 @@
34
34
  "jsdom": "26.1.0",
35
35
  "typescript": "7.0.2",
36
36
  "vitest": "4.1.6",
37
- "@lightdash/common": "1.80.0"
37
+ "@lightdash/common": "1.82.0"
38
38
  },
39
39
  "scripts": {
40
40
  "prebuild": "node ./scripts/generateSdkVersion.mjs",