@oatscenter/trellis 0.100.0-rc.27 → 0.100.0-rc.29

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/client_connect.js CHANGED
@@ -390,22 +390,24 @@ export class TrellisClient {
390
390
  /** Names the approval popup and the message it sends its opener. */
391
391
  const APPROVAL_MESSAGE = "trellis.approval";
392
392
  const POPUP_FEATURES = "popup,width=520,height=720";
393
- /** Where an opener records the approval it sent a popup to, by OAuth state. */
394
- const approvalKey = (state) => `trellis.approval:${state}`;
393
+ /** The OAuth states of the approvals this window has sent popups to. */
394
+ const pendingApprovals = new Set();
395
395
  function markApproval(state, pending) {
396
- try {
397
- if (pending)
398
- localStorage.setItem(approvalKey(state), "1");
399
- else
400
- localStorage.removeItem(approvalKey(state));
401
- }
402
- catch {
403
- // Without storage the opener still sees the popup land by watching it.
404
- }
396
+ if (pending)
397
+ pendingApprovals.add(state);
398
+ else
399
+ pendingApprovals.delete(state);
400
+ // The popup asks this window directly, so no storage has to work.
401
+ if (!Object.hasOwn(window, APPROVAL_MESSAGE))
402
+ Object.defineProperty(window, APPROVAL_MESSAGE, {
403
+ value: (asked) => typeof asked === "string" && pendingApprovals.has(asked),
404
+ });
405
405
  }
406
+ /** Whether the same-origin opener sent this window to approve `state`. */
406
407
  function approvalPending(state) {
407
408
  try {
408
- return localStorage.getItem(approvalKey(state)) !== null;
409
+ const pending = window.opener[APPROVAL_MESSAGE];
410
+ return typeof pending === "function" && pending(state) === true;
409
411
  }
410
412
  catch {
411
413
  return false;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@oatscenter/trellis": "^0.100.0-rc.27"
3
+ "@oatscenter/trellis": "^0.100.0-rc.29"
4
4
  },
5
5
  "description": "Generated Trellis APIs and participants.",
6
6
  "exports": {
package/package.json CHANGED
@@ -51,7 +51,7 @@
51
51
  "@nats-io/obj": "^3.4.0",
52
52
  "@nats-io/transport-node": "^3.4.0",
53
53
  "@noble/hashes": "1.8.0",
54
- "@oatscenter/result": "0.100.0-rc.27",
54
+ "@oatscenter/result": "0.100.0-rc.29",
55
55
  "@opentelemetry/api": "^1.9.1",
56
56
  "@opentelemetry/context-async-hooks": "~2.11.0",
57
57
  "@opentelemetry/core": "~2.11.0",
@@ -71,7 +71,7 @@
71
71
  "uqr": "0.1.3",
72
72
  "zod": "^4.3.6"
73
73
  },
74
- "version": "0.100.0-rc.27",
74
+ "version": "0.100.0-rc.29",
75
75
  "type": "module",
76
76
  "license": "Apache-2.0",
77
77
  "publishConfig": {