@tempoxyz/id 0.0.0-pr-740.sha-e82a463 → 0.0.0-pr-670.sha-675dac4

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.
@@ -4,9 +4,9 @@ import {
4
4
  name,
5
5
  parseName,
6
6
  pending
7
- } from "./chunk-CMIMUIV7.js";
7
+ } from "./chunk-ZCIJ7FF2.js";
8
8
  import "./chunk-HWONYWNC.js";
9
- import "./chunk-UGIWBXMZ.js";
9
+ import "./chunk-BZRQBSX2.js";
10
10
  import "./chunk-MLKGABMK.js";
11
11
  export {
12
12
  attach,
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  PendingNotFoundError,
7
7
  RequestError
8
- } from "./chunk-UGIWBXMZ.js";
8
+ } from "./chunk-BZRQBSX2.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
 
11
11
  // ../../accounts/src/internal/BackendCookie.ts
@@ -4,8 +4,8 @@ import {
4
4
  machines,
5
5
  prompt,
6
6
  waiting
7
- } from "./chunk-S3QDABXG.js";
8
- import "./chunk-UGIWBXMZ.js";
7
+ } from "./chunk-U6LTO7G5.js";
8
+ import "./chunk-BZRQBSX2.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
  export {
11
11
  create,
@@ -306,6 +306,20 @@ function requestHeaders(init, options) {
306
306
  headers.set(name, value);
307
307
  return headers;
308
308
  }
309
+ function page() {
310
+ if (typeof document === "undefined" && !("WorkerGlobalScope" in globalThis))
311
+ return void 0;
312
+ try {
313
+ return globalThis.location?.href;
314
+ } catch {
315
+ return void 0;
316
+ }
317
+ }
318
+ function sameHost(auth, options) {
319
+ const own2 = new URL(auth.url);
320
+ const url = new URL(options.page);
321
+ return url.protocol === own2.protocol && url.hostname === own2.hostname;
322
+ }
309
323
  function bound(token2) {
310
324
  return jkt(token2) !== void 0;
311
325
  }
@@ -950,7 +964,7 @@ async function approve(auth, options) {
950
964
  let unwatch;
951
965
  try {
952
966
  return await new Promise((resolve3, reject) => {
953
- void import("./Sheet-2VUMVJXV.js").then(
967
+ void import("./Sheet-B4CBNDSV.js").then(
954
968
  (Sheet2) => {
955
969
  if (settled) return;
956
970
  unblock = Sheet2.waiting({
@@ -996,7 +1010,7 @@ async function approve(auth, options) {
996
1010
  if (popup === null) throw new BlockedError();
997
1011
  return await watch2(popup);
998
1012
  }
999
- const Sheet = await import("./Sheet-2VUMVJXV.js");
1013
+ const Sheet = await import("./Sheet-B4CBNDSV.js");
1000
1014
  signal?.throwIfAborted();
1001
1015
  let abort;
1002
1016
  let close;
@@ -1603,7 +1617,7 @@ async function fetch2(auth, options) {
1603
1617
  let index = 0;
1604
1618
  while (text.charCodeAt(index) <= 32) index++;
1605
1619
  if (!/^[a-z][a-z\d+.-]*:/i.test(text.slice(index))) {
1606
- const base = page();
1620
+ const base = page2();
1607
1621
  if (base === void 0)
1608
1622
  throw new TypeError(
1609
1623
  `Invalid URL: "${String(options.url)}" is relative, and no page resolves it. Pass an absolute URL.`
@@ -1613,7 +1627,7 @@ async function fetch2(auth, options) {
1613
1627
  try {
1614
1628
  return new URL(options.url);
1615
1629
  } catch (error3) {
1616
- const base = page();
1630
+ const base = page2();
1617
1631
  if (base === void 0) throw error3;
1618
1632
  return new URL(options.url, base);
1619
1633
  }
@@ -1639,7 +1653,7 @@ async function refresh2(auth, options) {
1639
1653
  async function signOut(auth) {
1640
1654
  await json(await post(auth, "/v1/auth/logout", { json: {} }));
1641
1655
  }
1642
- function page() {
1656
+ function page2() {
1643
1657
  try {
1644
1658
  return globalThis.location?.href;
1645
1659
  } catch {
@@ -2030,10 +2044,27 @@ function create(options) {
2030
2044
  const [stored, digests] = await Promise.all([read2(), revoked.read()]);
2031
2045
  if (stored?.refreshToken && stored.refreshToken !== refreshToken) return;
2032
2046
  if (revoked.has(digests, session)) return;
2033
- await signOut2(session, {
2047
+ const failed = await signOut2(session, {
2034
2048
  logout: false,
2035
2049
  onRevoked: () => revoked.write(digests, [refreshToken])
2050
+ }).then(
2051
+ () => false,
2052
+ () => true
2053
+ );
2054
+ if (!failed) return;
2055
+ const current = await unanswered2.read();
2056
+ const persisted = current ? await unanswered2.write([
2057
+ ...current.filter((token2) => token2 !== refreshToken),
2058
+ refreshToken
2059
+ ]) : void 0;
2060
+ const kept = machines.retains({
2061
+ live: [refreshToken],
2062
+ logouts: obtainedLogouts,
2063
+ persisted,
2064
+ retained,
2065
+ unsaved: [refreshToken]
2036
2066
  });
2067
+ for (const [token2, remote] of kept) retained.set(token2, remote);
2037
2068
  }).catch(() => void 0);
2038
2069
  }
2039
2070
  async function endRefused(ended, refused) {
@@ -3514,7 +3545,7 @@ var signInIds = /* @__PURE__ */ new Set([
3514
3545
  function plugin() {
3515
3546
  let loading;
3516
3547
  function load() {
3517
- loading ??= import("./dialog-SWHB7N65.js").then((module) => module.dialog()).catch((error3) => {
3548
+ loading ??= import("./dialog-EKY2NNFK.js").then((module) => module.dialog()).catch((error3) => {
3518
3549
  loading = void 0;
3519
3550
  throw error3;
3520
3551
  });
@@ -3774,7 +3805,7 @@ async function open(auth, options) {
3774
3805
  throw new OriginError2({ origin: window.location.origin, redirectUri });
3775
3806
  if (mode === "popup" && options.mode !== "popup" && !activated()) {
3776
3807
  const address = await abortable(read2(), { signal });
3777
- const Sheet = await import("./Sheet-2VUMVJXV.js");
3808
+ const Sheet = await import("./Sheet-B4CBNDSV.js");
3778
3809
  return await new Promise((resolve3, reject) => {
3779
3810
  const abort = () => {
3780
3811
  close();
@@ -3825,7 +3856,7 @@ async function watch(auth, options) {
3825
3856
  try {
3826
3857
  return await new Promise(
3827
3858
  (resolve3, reject) => {
3828
- void import("./Sheet-2VUMVJXV.js").then(
3859
+ void import("./Sheet-B4CBNDSV.js").then(
3829
3860
  (Sheet) => {
3830
3861
  if (settled) return;
3831
3862
  unblock = Sheet.waiting({
@@ -3890,7 +3921,7 @@ function parse(url, options) {
3890
3921
  async function frame(auth, options) {
3891
3922
  const { redirectUri, signal, toUrl } = options;
3892
3923
  const address = await abortable(options.address, { signal });
3893
- const Sheet = await import("./Sheet-2VUMVJXV.js");
3924
+ const Sheet = await import("./Sheet-B4CBNDSV.js");
3894
3925
  signal?.throwIfAborted();
3895
3926
  let close;
3896
3927
  let abort;
@@ -4325,11 +4356,15 @@ function create4(options = {}) {
4325
4356
  let rotating;
4326
4357
  let restoring;
4327
4358
  async function ownAccessToken() {
4328
- if (typeof document !== "undefined" || "WorkerGlobalScope" in globalThis)
4329
- return void 0;
4359
+ const page3 = page();
4360
+ if (page3 !== void 0 && sameHost(config, { page: page3 })) return void 0;
4330
4361
  await context.session.load();
4331
- if (!context.session.get()) return void 0;
4332
- return accessToken2();
4362
+ const current = context.session.get();
4363
+ if (!current) return void 0;
4364
+ if (page3 !== void 0 && unbound(config, { accessToken: current.accessToken }))
4365
+ return void 0;
4366
+ if (page3 === void 0) return accessToken2();
4367
+ return accessToken2().catch(() => void 0);
4333
4368
  }
4334
4369
  async function accessToken2() {
4335
4370
  await context.session.load();
@@ -4362,7 +4397,7 @@ function create4(options = {}) {
4362
4397
  function connections2() {
4363
4398
  if (!connectionsOptions)
4364
4399
  return Promise.reject(new ConnectionsRequiredError());
4365
- attached ??= import("./Connections-K44EJ6F7.js").then(
4400
+ attached ??= import("./Connections-K3JRTPCM.js").then(
4366
4401
  (module) => module.attach(config, connectionsOptions)
4367
4402
  );
4368
4403
  return attached;
@@ -4411,7 +4446,7 @@ function create4(options = {}) {
4411
4446
  },
4412
4447
  handler: {
4413
4448
  async fetch(request2) {
4414
- server ??= import("./Server-CAPWBFI3.js").then(
4449
+ server ??= import("./Server-PGYQWANQ.js").then(
4415
4450
  (module) => module.create({
4416
4451
  accessKeys: connectionsOptions ? async () => (await connections2()).keyEndpoint : void 0,
4417
4452
  // The `backend` plugin's actions sit on the instance under its `id`.
@@ -2,7 +2,7 @@ import {
2
2
  create,
3
3
  prompt,
4
4
  waiting
5
- } from "./chunk-S3QDABXG.js";
5
+ } from "./chunk-U6LTO7G5.js";
6
6
  import {
7
7
  basePath
8
8
  } from "./chunk-HWONYWNC.js";
@@ -27,7 +27,7 @@ import {
27
27
  tokens,
28
28
  user,
29
29
  watchPopup
30
- } from "./chunk-UGIWBXMZ.js";
30
+ } from "./chunk-BZRQBSX2.js";
31
31
  import {
32
32
  __export
33
33
  } from "./chunk-MLKGABMK.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  dialog_exports,
3
3
  redirect_exports
4
- } from "./chunk-YXEQ42DK.js";
4
+ } from "./chunk-MIPJIEVS.js";
5
5
  import {
6
6
  connections_exports
7
- } from "./chunk-CMIMUIV7.js";
7
+ } from "./chunk-ZCIJ7FF2.js";
8
8
  import {
9
9
  AccessKeyRequiredError,
10
10
  AccessKey_exports,
@@ -43,7 +43,7 @@ import {
43
43
  unlisted,
44
44
  user,
45
45
  withoutKey
46
- } from "./chunk-UGIWBXMZ.js";
46
+ } from "./chunk-BZRQBSX2.js";
47
47
  import {
48
48
  __export
49
49
  } from "./chunk-MLKGABMK.js";
@@ -2,7 +2,7 @@ import {
2
2
  openPopup,
3
3
  received,
4
4
  watchPopup
5
- } from "./chunk-UGIWBXMZ.js";
5
+ } from "./chunk-BZRQBSX2.js";
6
6
 
7
7
  // ../../accounts/src/internal/Sheet.ts
8
8
  import {
@@ -9,7 +9,7 @@ import {
9
9
  from,
10
10
  json,
11
11
  post
12
- } from "./chunk-UGIWBXMZ.js";
12
+ } from "./chunk-BZRQBSX2.js";
13
13
  import {
14
14
  __export
15
15
  } from "./chunk-MLKGABMK.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  env,
3
3
  login
4
- } from "../chunk-6Y4DXPDA.js";
5
- import "../chunk-YXEQ42DK.js";
6
- import "../chunk-S3QDABXG.js";
7
- import "../chunk-CMIMUIV7.js";
4
+ } from "../chunk-O2JIV5FP.js";
5
+ import "../chunk-MIPJIEVS.js";
6
+ import "../chunk-U6LTO7G5.js";
7
+ import "../chunk-ZCIJ7FF2.js";
8
8
  import "../chunk-HWONYWNC.js";
9
- import "../chunk-UGIWBXMZ.js";
9
+ import "../chunk-BZRQBSX2.js";
10
10
  import "../chunk-MLKGABMK.js";
11
11
 
12
12
  // src/commands/login.ts
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  env,
3
3
  remove
4
- } from "../chunk-6Y4DXPDA.js";
5
- import "../chunk-YXEQ42DK.js";
6
- import "../chunk-S3QDABXG.js";
7
- import "../chunk-CMIMUIV7.js";
4
+ } from "../chunk-O2JIV5FP.js";
5
+ import "../chunk-MIPJIEVS.js";
6
+ import "../chunk-U6LTO7G5.js";
7
+ import "../chunk-ZCIJ7FF2.js";
8
8
  import "../chunk-HWONYWNC.js";
9
- import "../chunk-UGIWBXMZ.js";
9
+ import "../chunk-BZRQBSX2.js";
10
10
  import "../chunk-MLKGABMK.js";
11
11
 
12
12
  // src/commands/logout.ts
@@ -2,12 +2,12 @@ import {
2
2
  env,
3
3
  signedOut,
4
4
  whoami
5
- } from "../chunk-6Y4DXPDA.js";
6
- import "../chunk-YXEQ42DK.js";
7
- import "../chunk-S3QDABXG.js";
8
- import "../chunk-CMIMUIV7.js";
5
+ } from "../chunk-O2JIV5FP.js";
6
+ import "../chunk-MIPJIEVS.js";
7
+ import "../chunk-U6LTO7G5.js";
8
+ import "../chunk-ZCIJ7FF2.js";
9
9
  import "../chunk-HWONYWNC.js";
10
- import "../chunk-UGIWBXMZ.js";
10
+ import "../chunk-BZRQBSX2.js";
11
11
  import "../chunk-MLKGABMK.js";
12
12
 
13
13
  // src/commands/whoami.ts
@@ -2,8 +2,8 @@ import {
2
2
  callback,
3
3
  preload,
4
4
  signIn
5
- } from "./chunk-YXEQ42DK.js";
6
- import "./chunk-S3QDABXG.js";
5
+ } from "./chunk-MIPJIEVS.js";
6
+ import "./chunk-U6LTO7G5.js";
7
7
  import {
8
8
  basePath
9
9
  } from "./chunk-HWONYWNC.js";
@@ -16,7 +16,7 @@ import {
16
16
  revokeAccessKey,
17
17
  toSession,
18
18
  updateAccessKey
19
- } from "./chunk-UGIWBXMZ.js";
19
+ } from "./chunk-BZRQBSX2.js";
20
20
  import "./chunk-MLKGABMK.js";
21
21
 
22
22
  // ../../accounts/src/plugins/dialog.ts
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=24.21"
10
10
  },
11
11
  "name": "@tempoxyz/id",
12
- "version": "0.0.0-pr-740.sha-e82a463",
12
+ "version": "0.0.0-pr-670.sha-675dac4",
13
13
  "description": "The tempo-id CLI: sign in to Tempo ID, and call its API and the Admin API.",
14
14
  "type": "module",
15
15
  "bin": {