@ai-matrx/auth 0.3.1 → 0.3.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog — @ai-matrx/auth
2
2
 
3
+ ## 0.3.2
4
+ - `clearStaleHeld`: the held choice is read at the START of the read (before the memberships), so a choice made while the read is in
5
+ flight is never cleared by it. Test: `active-organization.test.ts` (racing choice).
6
+
3
7
  ## 0.3.1
4
8
  - `clearStaleHeld` fix: a held choice already stale when the read began is cleared even when no organization can be answered,
5
9
  and a choice made while the read was in flight is never cleared. Test: `active-organization.test.ts`.
@@ -565,6 +565,7 @@ function createActiveOrganization(options) {
565
565
  publish({ ...IDLE, status: "none", error: "signed-out" });
566
566
  return current;
567
567
  }
568
+ const heldAtStart = options.clearStaleHeld ? await held.read(person.id) : null;
568
569
  const rawMemberships = await readMemberships(client, person.id);
569
570
  if (gen !== generation) return current;
570
571
  let favourites = current.favourites;
@@ -583,7 +584,6 @@ function createActiveOrganization(options) {
583
584
  const memberships = options.accountChoices ? orderOrganizations(rawMemberships, favourites) : rawMemberships;
584
585
  const readAccount = () => account ? Promise.resolve(account) : readAccountOrganizationChoices(client, person.id);
585
586
  const before = prior;
586
- const heldAtStart = options.clearStaleHeld ? await held.read(person.id) : null;
587
587
  const linkOptions = options.link;
588
588
  let resolved;
589
589
  let linkDecision = null;
@@ -485,6 +485,7 @@ function createActiveOrganization(options) {
485
485
  publish({ ...IDLE, status: "none", error: "signed-out" });
486
486
  return current;
487
487
  }
488
+ const heldAtStart = options.clearStaleHeld ? await held.read(person.id) : null;
488
489
  const rawMemberships = await readMemberships(client, person.id);
489
490
  if (gen !== generation) return current;
490
491
  let favourites = current.favourites;
@@ -503,7 +504,6 @@ function createActiveOrganization(options) {
503
504
  const memberships = options.accountChoices ? orderOrganizations(rawMemberships, favourites) : rawMemberships;
504
505
  const readAccount = () => account ? Promise.resolve(account) : readAccountOrganizationChoices(client, person.id);
505
506
  const before = prior;
506
- const heldAtStart = options.clearStaleHeld ? await held.read(person.id) : null;
507
507
  const linkOptions = options.link;
508
508
  let resolved;
509
509
  let linkDecision = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/auth",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "AI Matrx sign-in, session and organizations for every app: sign in/out, session storage and refresh per platform (browser, Next.js, extension, desktop, Node), the current person, their organizations and favourites, the one active organization (held requests, never a list filter), and the credentials @ai-matrx/data and @ai-matrx/api read.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -211,5 +211,5 @@
211
211
  "test": "vitest run",
212
212
  "verify:tarball": "node ./scripts/verify-tarball.mjs"
213
213
  },
214
- "gitHead": "63d7fd1430cbe05b6ed9f0e638ae4c630232497a"
214
+ "gitHead": "914209baa874d2bf03ffda7b2069c87b2c0b66e1"
215
215
  }