@tempoxyz/id 0.0.0-pr-1154.sha-e7ea888 → 0.0.0-pr-1132.sha-7da1fea

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 (26) hide show
  1. package/dist/{AccessToken-ZET4UCX5.js → AccessToken-E2ZLQ34H.js} +3 -3
  2. package/dist/{Connections-AMNKKJET.js → Connections-VZBYYVXT.js} +4 -4
  3. package/dist/{File-EX7PS3F7.js → File-KGT7JDRI.js} +51 -5
  4. package/dist/{Server-JVN6D5AI.js → Server-D4V2ODSL.js} +4 -4
  5. package/dist/{Sheet-T2JZTIDW.js → Sheet-EE4QWQGY.js} +3 -3
  6. package/dist/{chunk-TEQAH4BN.js → chunk-27R2TEQJ.js} +3 -2
  7. package/dist/{chunk-QXAI6ONX.js → chunk-6BDVEDCD.js} +31 -5
  8. package/dist/{chunk-BJMXAVRA.js → chunk-BASNFLPE.js} +3 -3
  9. package/dist/{chunk-I72E6HPL.js → chunk-DYTJ7HHW.js} +3 -2
  10. package/dist/chunk-I4YCOYFR.js +487 -0
  11. package/dist/{chunk-WY7MR7T7.js → chunk-K5IDT3Q2.js} +5 -5
  12. package/dist/{chunk-WWXHDRJ7.js → chunk-KVEWNPWX.js} +1 -1
  13. package/dist/{chunk-PLPHQNDQ.js → chunk-MVHARAA6.js} +72 -17
  14. package/dist/{chunk-XBQHRIBM.js → chunk-OIDQZ5QE.js} +1 -1
  15. package/dist/{chunk-VSCV5CCB.js → chunk-V7LBFWLM.js} +27 -6
  16. package/dist/{chunk-ZTJQSFD3.js → chunk-VQPJR3UV.js} +731 -281
  17. package/dist/commands/login.js +12 -11
  18. package/dist/commands/logout.js +12 -11
  19. package/dist/commands/whoami.js +12 -11
  20. package/dist/{dialog-H3DX2V4N.js → dialog-7QDW6XW7.js} +8 -6
  21. package/dist/{dialog-C3YZOE26.js → dialog-WQ7YEUZW.js} +31 -9
  22. package/dist/{funding-CO6TPQSO.js → funding-KZI4SIAK.js} +3 -3
  23. package/dist/guest-DRPL2NOY.js +25 -0
  24. package/dist/{mpp-NHT7TYSK.js → mpp-VSVYY6Q5.js} +231 -122
  25. package/dist/{passkey-7QXWYAGE.js → passkey-DXVZFKTN.js} +3 -3
  26. package/package.json +1 -1
@@ -3,10 +3,10 @@ import {
3
3
  create,
4
4
  includes,
5
5
  verifyRequest
6
- } from "./chunk-WWXHDRJ7.js";
6
+ } from "./chunk-KVEWNPWX.js";
7
7
  import "./chunk-DW2VLCLG.js";
8
- import "./chunk-ZTJQSFD3.js";
9
- import "./chunk-TEQAH4BN.js";
8
+ import "./chunk-VQPJR3UV.js";
9
+ import "./chunk-27R2TEQJ.js";
10
10
  import "./chunk-MLKGABMK.js";
11
11
  export {
12
12
  InvalidError,
@@ -2,11 +2,11 @@ import {
2
2
  attach,
3
3
  create,
4
4
  pending
5
- } from "./chunk-BJMXAVRA.js";
6
- import "./chunk-WWXHDRJ7.js";
5
+ } from "./chunk-BASNFLPE.js";
6
+ import "./chunk-KVEWNPWX.js";
7
7
  import "./chunk-DW2VLCLG.js";
8
- import "./chunk-ZTJQSFD3.js";
9
- import "./chunk-TEQAH4BN.js";
8
+ import "./chunk-VQPJR3UV.js";
9
+ import "./chunk-27R2TEQJ.js";
10
10
  import "./chunk-MLKGABMK.js";
11
11
  export {
12
12
  attach,
@@ -3,9 +3,27 @@ import {
3
3
  env,
4
4
  modules,
5
5
  stringify
6
- } from "./chunk-TEQAH4BN.js";
6
+ } from "./chunk-27R2TEQJ.js";
7
7
  import "./chunk-MLKGABMK.js";
8
8
 
9
+ // ../../accounts/src/internal/Broadcast.ts
10
+ function create() {
11
+ const listeners = /* @__PURE__ */ new Map();
12
+ return (key, listener) => {
13
+ const set = listeners.get(key) ?? /* @__PURE__ */ new Set();
14
+ listeners.set(key, set);
15
+ for (const ref of set) if (!ref.deref()) set.delete(ref);
16
+ set.add(new WeakRef(listener));
17
+ return (message) => {
18
+ for (const ref of set) {
19
+ const peer = ref.deref();
20
+ if (!peer) set.delete(ref);
21
+ else if (peer !== listener) queueMicrotask(() => peer(message));
22
+ }
23
+ };
24
+ };
25
+ }
26
+
9
27
  // ../../accounts/src/internal/Expiry.ts
10
28
  function expired(entry) {
11
29
  return entry.expiresAt !== void 0 && entry.expiresAt <= Date.now();
@@ -31,7 +49,7 @@ var NodeRequiredError = class extends Error {
31
49
  );
32
50
  }
33
51
  };
34
- function create(path) {
52
+ function create2(path) {
35
53
  const { Os, Path } = node();
36
54
  const file = path ?? Path.join(
37
55
  env("TEMPO_HOME") ?? Path.join(Os.homedir(), ".tempo"),
@@ -98,6 +116,15 @@ function create(path) {
98
116
  return next;
99
117
  }
100
118
  return {
119
+ // The instances of the process on the file hear each saved change of each other, also through
120
+ // another store of its path, so a sign-out empties their sessions at once.
121
+ connect(key, listener) {
122
+ const { Path: Path2 } = node();
123
+ const target = Path2.resolve(resolve());
124
+ const connect = connections.get(target) ?? create();
125
+ connections.set(target, connect);
126
+ return connect(key, listener);
127
+ },
101
128
  async getItem(key) {
102
129
  await pending.catch(() => void 0);
103
130
  const entry = (await read())[key];
@@ -118,7 +145,9 @@ function create(path) {
118
145
  digest,
119
146
  (byte) => byte.toString(16).padStart(2, "0")
120
147
  ).join("");
121
- return await locked(`${target}.${hash}`, () => fn(), { renew: true });
148
+ return await locked(`${target}.${hash}`, (check) => fn(check), {
149
+ renew: true
150
+ });
122
151
  },
123
152
  removeItem: (key) => update(
124
153
  (entries) => {
@@ -158,7 +187,23 @@ function create(path) {
158
187
  return entry.value;
159
188
  },
160
189
  { skip: (entries) => !(key in entries) }
161
- )
190
+ ),
191
+ // The read and the write hold the file's lock, and a write whose lock another process took over
192
+ // runs `fn` again on the new entries, so the write lands only on the value that `fn` read.
193
+ async update(key, fn) {
194
+ while (true) {
195
+ const done = await update((entries) => {
196
+ const entry = entries[key];
197
+ const next = fn(
198
+ entry && !expired(entry) ? entry.value : void 0
199
+ );
200
+ if (next.value === void 0) delete entries[key];
201
+ else entries[key] = { expiresAt: next.expiresAt, value: next.value };
202
+ return { result: next.result };
203
+ });
204
+ if (done) return done.result;
205
+ }
206
+ }
162
207
  };
163
208
  }
164
209
  function node() {
@@ -258,10 +303,11 @@ async function sweep(target) {
258
303
  );
259
304
  }
260
305
  var temporaryName = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}\.tmp$/;
306
+ var connections = /* @__PURE__ */ new Map();
261
307
  var lease = 3e4;
262
308
  var staleLock = 1e4;
263
309
  export {
264
310
  InvalidFileError,
265
311
  NodeRequiredError,
266
- create
312
+ create2 as create
267
313
  };
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  InvalidError
3
3
  } from "./chunk-QI2MEU2T.js";
4
- import "./chunk-I72E6HPL.js";
5
4
  import "./chunk-DW2VLCLG.js";
5
+ import "./chunk-DYTJ7HHW.js";
6
6
  import {
7
7
  PendingNotFoundError,
8
8
  RequestError,
9
9
  authPath,
10
10
  basePath,
11
- from3 as from,
11
+ from4 as from,
12
12
  key,
13
13
  permissions,
14
14
  siwe
15
- } from "./chunk-ZTJQSFD3.js";
16
- import "./chunk-TEQAH4BN.js";
15
+ } from "./chunk-VQPJR3UV.js";
16
+ import "./chunk-27R2TEQJ.js";
17
17
  import "./chunk-MLKGABMK.js";
18
18
 
19
19
  // ../../accounts/src/internal/handlers/Backend.ts
@@ -4,9 +4,9 @@ import {
4
4
  machines,
5
5
  prompt,
6
6
  waiting
7
- } from "./chunk-VSCV5CCB.js";
8
- import "./chunk-ZTJQSFD3.js";
9
- import "./chunk-TEQAH4BN.js";
7
+ } from "./chunk-V7LBFWLM.js";
8
+ import "./chunk-VQPJR3UV.js";
9
+ import "./chunk-27R2TEQJ.js";
10
10
  import "./chunk-MLKGABMK.js";
11
11
  export {
12
12
  create,
@@ -45,8 +45,9 @@ function stringify(value) {
45
45
  "Unserializable value: a non-extractable access key has no JSON form. In a browser, keep the session in the default store."
46
46
  );
47
47
  if (typeof entry === "bigint") return `${entry}${bigintSuffix}`;
48
- if (typeof entry === "string" && entry.endsWith(bigintSuffix))
49
- return `${entry}${stringEscape}${bigintSuffix}`;
48
+ const text = entry instanceof String ? entry.valueOf() : entry;
49
+ if (typeof text === "string" && text.endsWith(bigintSuffix))
50
+ return `${text}${stringEscape}${bigintSuffix}`;
50
51
  return entry;
51
52
  });
52
53
  }
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  handleCallback,
3
3
  handleResult
4
- } from "./chunk-I72E6HPL.js";
4
+ } from "./chunk-DYTJ7HHW.js";
5
5
  import {
6
6
  open
7
- } from "./chunk-WY7MR7T7.js";
7
+ } from "./chunk-K5IDT3Q2.js";
8
8
  import {
9
9
  create,
10
10
  prompt,
11
11
  waiting
12
- } from "./chunk-VSCV5CCB.js";
12
+ } from "./chunk-V7LBFWLM.js";
13
13
  import {
14
14
  RequestError,
15
15
  activated,
@@ -22,7 +22,8 @@ import {
22
22
  coinflow,
23
23
  error2 as error,
24
24
  fundingParameters,
25
- get2 as get,
25
+ get,
26
+ guestSelected,
26
27
  http,
27
28
  json,
28
29
  openPopup,
@@ -33,7 +34,7 @@ import {
33
34
  revoke,
34
35
  signedIn,
35
36
  watchPopup
36
- } from "./chunk-ZTJQSFD3.js";
37
+ } from "./chunk-VQPJR3UV.js";
37
38
  import {
38
39
  __export
39
40
  } from "./chunk-MLKGABMK.js";
@@ -43,6 +44,7 @@ var dialog_exports = {};
43
44
  __export(dialog_exports, {
44
45
  BlockedError: () => BlockedError,
45
46
  OriginError: () => OriginError,
47
+ PageRequiredError: () => PageRequiredError,
46
48
  callback: () => callback,
47
49
  machines: () => machines,
48
50
  preload: () => preload,
@@ -71,6 +73,14 @@ var OriginError = class extends Error {
71
73
  );
72
74
  }
73
75
  };
76
+ var PageRequiredError = class extends Error {
77
+ name = "Actions.dialog.PageRequiredError";
78
+ constructor() {
79
+ super(
80
+ "No browser page: the sign-in shows in a frame or a popup, which only a page opens. Outside a page, sign in with the `device` plugin."
81
+ );
82
+ }
83
+ };
74
84
  async function callback(auth) {
75
85
  const url = new URL(window.location.href);
76
86
  const state = url.searchParams.getAll("state").at(-1);
@@ -114,6 +124,7 @@ function preload(auth, options = {}) {
114
124
  });
115
125
  }
116
126
  async function signIn(auth, options = {}) {
127
+ if (typeof document === "undefined") throw new PageRequiredError();
117
128
  if ("backend" in options) {
118
129
  const { crossOriginOpenerPolicy, mode, signal, timeout } = options;
119
130
  const basePath2 = `${(options.backend === true ? basePath : options.backend).replace(/\/+$/, "")}${authPath}`;
@@ -175,6 +186,7 @@ async function signInPage(auth, options) {
175
186
  return authorization;
176
187
  }
177
188
  async function signMessage(auth, options) {
189
+ if (typeof document === "undefined") throw new PageRequiredError();
178
190
  return sign(auth, options);
179
191
  }
180
192
  async function sign(auth, options) {
@@ -355,6 +367,9 @@ async function authorize(auth, options) {
355
367
  return rest.challenge;
356
368
  })(),
357
369
  display: "popup",
370
+ // A guest session signs no challenge, so a request whose challenge arrives later
371
+ // offers no guest.
372
+ ...deferred ? { guest: false } : {},
358
373
  redirectUri,
359
374
  ...responseMode ? { responseMode } : {}
360
375
  }))().then((value) => ({ ...value, state: value.pending.state })),
@@ -450,6 +465,16 @@ async function authorize(auth, options) {
450
465
  unwatch = void 0;
451
466
  sheet?.received();
452
467
  unblock?.();
468
+ if ("guest" in callback2) {
469
+ if (callback2.state !== state)
470
+ throw new RequestError({
471
+ code: "invalid_request",
472
+ field: "state",
473
+ message: "Invalid `state` in the posted result. Start sign-in again from this app.",
474
+ status: 400
475
+ });
476
+ throw guestSelected();
477
+ }
453
478
  if ("authorization" in callback2) {
454
479
  const authorization2 = await (async () => {
455
480
  try {
@@ -828,6 +853,7 @@ var machines;
828
853
  export {
829
854
  BlockedError,
830
855
  OriginError,
856
+ PageRequiredError,
831
857
  callback,
832
858
  preload,
833
859
  signIn,
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  InvalidError,
3
3
  create
4
- } from "./chunk-WWXHDRJ7.js";
4
+ } from "./chunk-KVEWNPWX.js";
5
5
  import {
6
6
  RequestError,
7
7
  clientAuthentication,
8
8
  expired,
9
9
  from,
10
- from3 as from2,
10
+ from4 as from2,
11
11
  json,
12
12
  post
13
- } from "./chunk-ZTJQSFD3.js";
13
+ } from "./chunk-VQPJR3UV.js";
14
14
  import {
15
15
  __export
16
16
  } from "./chunk-MLKGABMK.js";
@@ -12,7 +12,7 @@ import {
12
12
  error,
13
13
  error2,
14
14
  from,
15
- get2 as get,
15
+ get,
16
16
  json,
17
17
  own,
18
18
  revoke,
@@ -21,7 +21,7 @@ import {
21
21
  tokens,
22
22
  url,
23
23
  user
24
- } from "./chunk-ZTJQSFD3.js";
24
+ } from "./chunk-VQPJR3UV.js";
25
25
  import {
26
26
  __export
27
27
  } from "./chunk-MLKGABMK.js";
@@ -178,6 +178,7 @@ function complete(auth, options = {}) {
178
178
  "error",
179
179
  "error_description",
180
180
  "error_uri",
181
+ "guest",
181
182
  "iss",
182
183
  "state"
183
184
  ];