@lumerahq/ui 0.7.3 → 0.7.6
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.
- package/dist/{RecordSheet-DJL4aph1.js → RecordSheet-BvHHP8P4.js} +2 -2
- package/dist/{api-BIZPZp2T.js → api-BrhR_Jjl.js} +1 -1
- package/dist/{automations-NGijzdAj.js → automations-XN4WPV_g.js} +45 -18
- package/dist/components/index.js +1 -1
- package/dist/hooks/index.js +2 -2
- package/dist/index.js +5 -5
- package/dist/lib/bridge.d.ts +14 -4
- package/dist/lib/bridge.d.ts.map +1 -1
- package/dist/lib/index.js +2 -2
- package/dist/{use-automation-run-CSxc9EhA.js → use-automation-run-Cecvf4Aq.js} +1 -1
- package/dist/{use-sql-table-CEBrg3zE.js → use-sql-table-B7C06_An.js} +2 -2
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import React__default, { forwardRef, createElement, useState, useLayoutEffect, useCallback } from "react";
|
|
4
|
-
import { c as automationStatuses, q as getAutomationRunFileDownloadUrl, w as listAutomationRunFiles } from "./automations-
|
|
4
|
+
import { c as automationStatuses, q as getAutomationRunFileDownloadUrl, w as listAutomationRunFiles } from "./automations-XN4WPV_g.js";
|
|
5
5
|
import { p as clsx, o as cn, a as formatCellValue } from "./formatters-Baj7FkeG.js";
|
|
6
|
-
import { u as useAutomationRun } from "./use-automation-run-
|
|
6
|
+
import { u as useAutomationRun } from "./use-automation-run-Cecvf4Aq.js";
|
|
7
7
|
import * as ReactDOM from "react-dom";
|
|
8
8
|
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
9
9
|
const toCamelCase = (string) => string.replace(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as parentApiRequest, B as BridgeError } from "./automations-
|
|
1
|
+
import { p as parentApiRequest, B as BridgeError } from "./automations-XN4WPV_g.js";
|
|
2
2
|
const API_PREFIX = "/api";
|
|
3
3
|
const buildUrl = (path) => {
|
|
4
4
|
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
const DEFAULT_TIMEOUT_MS = 15e3;
|
|
2
2
|
const parseParentOrigins = (value) => (value ?? "").split(",").map((item) => item.trim()).filter(Boolean);
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const uniqueStrings = (values) => {
|
|
4
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5
|
+
return values.filter((value) => {
|
|
6
|
+
if (!value || seen.has(value)) return false;
|
|
7
|
+
seen.add(value);
|
|
8
|
+
return true;
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
const DEFAULT_PARENT_ORIGINS = [
|
|
12
|
+
"https://*.lumerahq.com",
|
|
13
|
+
"https://*.lumerahq.dev",
|
|
14
|
+
"http://localhost:*",
|
|
15
|
+
"http://127.0.0.1:*"
|
|
16
|
+
];
|
|
17
|
+
const EXPECTED_PARENT_ORIGIN = DEFAULT_PARENT_ORIGINS[0];
|
|
18
|
+
const EXPECTED_PARENT_ORIGINS = uniqueStrings([
|
|
19
|
+
...DEFAULT_PARENT_ORIGINS,
|
|
5
20
|
...parseParentOrigins(void 0),
|
|
6
21
|
EXPECTED_PARENT_ORIGIN
|
|
7
|
-
]
|
|
22
|
+
]);
|
|
8
23
|
class BridgeError extends Error {
|
|
9
24
|
status;
|
|
10
25
|
response;
|
|
@@ -23,6 +38,7 @@ let storedHostPayload;
|
|
|
23
38
|
let storedHostOrigin;
|
|
24
39
|
let suppressRouteBroadcast = false;
|
|
25
40
|
let lastBroadcastRoute = "";
|
|
41
|
+
let hasStoredHostPayload = false;
|
|
26
42
|
function getAppProjectExternalId() {
|
|
27
43
|
return storedHostPayload?.app?.projectExternalId;
|
|
28
44
|
}
|
|
@@ -80,6 +96,13 @@ function getShareableAppUrl(options) {
|
|
|
80
96
|
}
|
|
81
97
|
const log = (...args) => {
|
|
82
98
|
};
|
|
99
|
+
const cacheHostPayload = (payload, options) => {
|
|
100
|
+
storedHostPayload = payload;
|
|
101
|
+
if (options?.origin) {
|
|
102
|
+
storedHostOrigin = options.origin;
|
|
103
|
+
}
|
|
104
|
+
hasStoredHostPayload = true;
|
|
105
|
+
};
|
|
83
106
|
const generateId = () => {
|
|
84
107
|
if (typeof crypto !== "undefined" && crypto.randomUUID) {
|
|
85
108
|
return crypto.randomUUID();
|
|
@@ -89,16 +112,19 @@ const generateId = () => {
|
|
|
89
112
|
const matchesOriginPattern = (origin, pattern) => {
|
|
90
113
|
if (!origin || !pattern) return false;
|
|
91
114
|
if (origin === pattern) return true;
|
|
92
|
-
if (!pattern.includes("*")) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
115
|
try {
|
|
96
116
|
const originUrl = new URL(origin);
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
117
|
+
const parsed = pattern.match(/^(https?):\/\/([^/:]+)(?::(\*|\d+))?$/);
|
|
118
|
+
if (!parsed) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
const [, expectedProtocolName, hostPattern, portPattern] = parsed;
|
|
122
|
+
const expectedProtocol = `${expectedProtocolName}:`;
|
|
100
123
|
const protocolMatches = originUrl.protocol === expectedProtocol;
|
|
101
|
-
|
|
124
|
+
const hostMatches = hostPattern.startsWith("*.") ? originUrl.hostname === hostPattern.slice(2) || originUrl.hostname.endsWith(`.${hostPattern.slice(2)}`) : originUrl.hostname === hostPattern;
|
|
125
|
+
const normalizedOriginPort = originUrl.port || (originUrl.protocol === "https:" ? "443" : originUrl.protocol === "http:" ? "80" : "");
|
|
126
|
+
const portMatches = !portPattern || portPattern === "*" || normalizedOriginPort === portPattern;
|
|
127
|
+
return protocolMatches && hostMatches && portMatches;
|
|
102
128
|
} catch {
|
|
103
129
|
return false;
|
|
104
130
|
}
|
|
@@ -106,7 +132,6 @@ const matchesOriginPattern = (origin, pattern) => {
|
|
|
106
132
|
const isAllowedParentOrigin = (origin, currentOrigin) => {
|
|
107
133
|
if (!origin) return false;
|
|
108
134
|
if (origin === currentOrigin) return true;
|
|
109
|
-
if (origin.startsWith("http://localhost:")) return true;
|
|
110
135
|
return EXPECTED_PARENT_ORIGINS.some((pattern) => matchesOriginPattern(origin, pattern));
|
|
111
136
|
};
|
|
112
137
|
const PLAYGROUND_FLAG = "__playground__";
|
|
@@ -244,9 +269,6 @@ const ensureRouteSync = () => {
|
|
|
244
269
|
});
|
|
245
270
|
};
|
|
246
271
|
const handleMessage = (event) => {
|
|
247
|
-
if (event.source !== window.parent) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
272
|
if (!isAllowedParentOrigin(event.origin, window.location.origin)) {
|
|
251
273
|
log("Ignoring message from unexpected origin", {
|
|
252
274
|
expected: EXPECTED_PARENT_ORIGINS,
|
|
@@ -255,10 +277,12 @@ const handleMessage = (event) => {
|
|
|
255
277
|
});
|
|
256
278
|
return;
|
|
257
279
|
}
|
|
280
|
+
if (event.source && event.source !== window.parent) ;
|
|
258
281
|
const { type, payload } = event.data ?? {};
|
|
259
282
|
if (type === "init") {
|
|
260
|
-
|
|
261
|
-
|
|
283
|
+
cacheHostPayload(payload, {
|
|
284
|
+
origin: event.origin
|
|
285
|
+
});
|
|
262
286
|
initListeners.forEach((listener) => listener(payload));
|
|
263
287
|
return;
|
|
264
288
|
}
|
|
@@ -313,16 +337,19 @@ const postReadyMessage = () => {
|
|
|
313
337
|
message: "Playground mode"
|
|
314
338
|
};
|
|
315
339
|
log("Playground mode: init from VB", payload);
|
|
316
|
-
|
|
340
|
+
cacheHostPayload(payload);
|
|
317
341
|
setTimeout(() => initListeners.forEach((listener) => listener(payload)), 0);
|
|
318
342
|
} else {
|
|
319
343
|
log("Playground mode: /api/me returned no user, continuing");
|
|
344
|
+
cacheHostPayload(void 0);
|
|
320
345
|
setTimeout(() => initListeners.forEach((listener) => listener(void 0)), 0);
|
|
321
346
|
}
|
|
322
347
|
} catch (err) {
|
|
348
|
+
cacheHostPayload(void 0);
|
|
323
349
|
setTimeout(() => initListeners.forEach((listener) => listener(void 0)), 0);
|
|
324
350
|
}
|
|
325
351
|
} else {
|
|
352
|
+
cacheHostPayload(void 0);
|
|
326
353
|
setTimeout(() => initListeners.forEach((listener) => listener(void 0)), 0);
|
|
327
354
|
}
|
|
328
355
|
return;
|
|
@@ -334,7 +361,7 @@ const postReadyMessage = () => {
|
|
|
334
361
|
const onInitMessage = (listener) => {
|
|
335
362
|
ensureListener();
|
|
336
363
|
initListeners.add(listener);
|
|
337
|
-
if (
|
|
364
|
+
if (hasStoredHostPayload) {
|
|
338
365
|
setTimeout(() => listener(storedHostPayload), 0);
|
|
339
366
|
}
|
|
340
367
|
return () => initListeners.delete(listener);
|
package/dist/components/index.js
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u, a, b, c, d, e } from "../use-sql-table-
|
|
2
|
-
import { u as u2 } from "../use-automation-run-
|
|
1
|
+
import { u, a, b, c, d, e } from "../use-sql-table-B7C06_An.js";
|
|
2
|
+
import { u as u2 } from "../use-automation-run-Cecvf4Aq.js";
|
|
3
3
|
export {
|
|
4
4
|
u as useAutomationAgent,
|
|
5
5
|
u2 as useAutomationRun,
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A, a, D, b, c, R } from "./RecordSheet-
|
|
2
|
-
import { u, a as a2, b as b2, c as c2, d, e } from "./use-sql-table-
|
|
3
|
-
import { u as u2 } from "./use-automation-run-
|
|
4
|
-
import { B, E, c as c3, d as d2, e as e2, f, h, j, k, l, g, m, n, q, r, t, s, a as a3, u as u3, i, v, w, x, y, z, o, p, A as A2, C, b as b3 } from "./automations-
|
|
5
|
-
import { g as g2, a as a4, p as p2, b as b4, c as c4, d as d3, e as e3, f as f2, h as h2, i as i2, j as j2, k as k2, l as l2, s as s2, u as u4 } from "./api-
|
|
1
|
+
import { A, a, D, b, c, R } from "./RecordSheet-BvHHP8P4.js";
|
|
2
|
+
import { u, a as a2, b as b2, c as c2, d, e } from "./use-sql-table-B7C06_An.js";
|
|
3
|
+
import { u as u2 } from "./use-automation-run-Cecvf4Aq.js";
|
|
4
|
+
import { B, E, c as c3, d as d2, e as e2, f, h, j, k, l, g, m, n, q, r, t, s, a as a3, u as u3, i, v, w, x, y, z, o, p, A as A2, C, b as b3 } from "./automations-XN4WPV_g.js";
|
|
5
|
+
import { g as g2, a as a4, p as p2, b as b4, c as c4, d as d3, e as e3, f as f2, h as h2, i as i2, j as j2, k as k2, l as l2, s as s2, u as u4 } from "./api-BrhR_Jjl.js";
|
|
6
6
|
import { o as o2, f as f3, a as a5, b as b5, c as c5, d as d4, e as e4, g as g3, h as h3, i as i3, j as j3, k as k3, l as l3, m as m2, n as n2, s as s3 } from "./formatters-Baj7FkeG.js";
|
|
7
7
|
import { q as q2 } from "./query-client-DdOWay4_.js";
|
|
8
8
|
export {
|
package/dist/lib/bridge.d.ts
CHANGED
|
@@ -7,12 +7,22 @@
|
|
|
7
7
|
* - API request proxying through the parent
|
|
8
8
|
* - Standalone dev mode for local development
|
|
9
9
|
*
|
|
10
|
+
* Future cleanup direction:
|
|
11
|
+
* - Prefer `VITE_PARENT_ORIGINS` over `VITE_PARENT_ORIGIN` for all new code.
|
|
12
|
+
* - Prefer the allowlist model (`EXPECTED_PARENT_ORIGINS`) over the singular
|
|
13
|
+
* compatibility export (`EXPECTED_PARENT_ORIGIN`).
|
|
14
|
+
* - Once all downstream apps/configs have migrated to the plural env var and no
|
|
15
|
+
* external consumers import `EXPECTED_PARENT_ORIGIN`, we can deprecate then
|
|
16
|
+
* remove:
|
|
17
|
+
* - `VITE_PARENT_ORIGIN`
|
|
18
|
+
* - `EXPECTED_PARENT_ORIGIN`
|
|
19
|
+
* - That removal should happen only in a deliberate breaking release after:
|
|
20
|
+
* 1. templates and docs use only `VITE_PARENT_ORIGINS`
|
|
21
|
+
* 2. published Lumera apps no longer depend on the singular export/env var
|
|
22
|
+
* 3. a major/minor migration note is shipped for external consumers
|
|
23
|
+
*
|
|
10
24
|
* @module bridge
|
|
11
25
|
*/
|
|
12
|
-
/**
|
|
13
|
-
* Expected parent origin for security validation.
|
|
14
|
-
* Supports wildcards like `https://*.lumerahq.com`
|
|
15
|
-
*/
|
|
16
26
|
export declare const EXPECTED_PARENT_ORIGIN: any;
|
|
17
27
|
/**
|
|
18
28
|
* Payload received from the parent during initialization.
|
package/dist/lib/bridge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../src/lib/bridge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../src/lib/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AA0CH,eAAO,MAAM,sBAAsB,KAAkE,CAAC;AAYtG;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,EAAE;QACR,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,yEAAyE;QACzE,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,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QAAO,IA2EnC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,KAAG,CAAC,MAAM,IAAI,CAkB/F,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,gBAAgB,GAAU,SAAS,aAAa,KAAG,OAAO,CAAC,cAAc,CAgDrF,CAAC"}
|
package/dist/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B, E, c, d, e, f, h, j, k, l, g, m, n, q, r, t, s, a, u, i, v, w, x, y, z, o, p, A, C, b } from "../automations-
|
|
2
|
-
import { g as g2, a as a2, p as p2, b as b2, c as c2, d as d2, e as e2, f as f2, h as h2, i as i2, j as j2, k as k2, l as l2, s as s2, u as u2 } from "../api-
|
|
1
|
+
import { B, E, c, d, e, f, h, j, k, l, g, m, n, q, r, t, s, a, u, i, v, w, x, y, z, o, p, A, C, b } from "../automations-XN4WPV_g.js";
|
|
2
|
+
import { g as g2, a as a2, p as p2, b as b2, c as c2, d as d2, e as e2, f as f2, h as h2, i as i2, j as j2, k as k2, l as l2, s as s2, u as u2 } from "../api-BrhR_Jjl.js";
|
|
3
3
|
import { o as o2, f as f3, a as a3, b as b3, c as c3, d as d3, e as e3, g as g3, h as h3, i as i3, j as j3, k as k3, l as l3, m as m2, n as n2, s as s3 } from "../formatters-Baj7FkeG.js";
|
|
4
4
|
import { q as q2 } from "../query-client-DdOWay4_.js";
|
|
5
5
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQueryClient, useMutation, useQuery } from "@tanstack/react-query";
|
|
2
2
|
import { useState, useRef, useEffect, useCallback } from "react";
|
|
3
|
-
import { k as ensureAutomationRun, h as createAutomationRun, d as cancelAutomationRun, c as automationStatuses, n as getAutomationRun } from "./automations-
|
|
3
|
+
import { k as ensureAutomationRun, h as createAutomationRun, d as cancelAutomationRun, c as automationStatuses, n as getAutomationRun } from "./automations-XN4WPV_g.js";
|
|
4
4
|
function useAutomationRun(options) {
|
|
5
5
|
const {
|
|
6
6
|
agentId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { useState, useCallback, useEffect, useMemo } from "react";
|
|
3
|
-
import { y as listRunsByAgent, c as automationStatuses, h as createAutomationRun, o as onInitMessage } from "./automations-
|
|
4
|
-
import { u as uploadFile, i as pbSql, k as pbUpdateRecord } from "./api-
|
|
3
|
+
import { y as listRunsByAgent, c as automationStatuses, h as createAutomationRun, o as onInitMessage } from "./automations-XN4WPV_g.js";
|
|
4
|
+
import { u as uploadFile, i as pbSql, k as pbUpdateRecord } from "./api-BrhR_Jjl.js";
|
|
5
5
|
function useAutomationAgent({
|
|
6
6
|
agentId,
|
|
7
7
|
limit = 5,
|