@ai-matrx/auth 0.3.1 → 0.3.3
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 +10 -0
- package/dist/organizations.cjs +3 -3
- package/dist/organizations.js +3 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/auth
|
|
2
2
|
|
|
3
|
+
## 0.3.3
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/auth/v0.3.2..npm/auth/v0.3.3 -- apps/shared/auth`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
9
|
+
## 0.3.2
|
|
10
|
+
- `clearStaleHeld`: the held choice is read at the START of the read (before the memberships), so a choice made while the read is in
|
|
11
|
+
flight is never cleared by it. Test: `active-organization.test.ts` (racing choice).
|
|
12
|
+
|
|
3
13
|
## 0.3.1
|
|
4
14
|
- `clearStaleHeld` fix: a held choice already stale when the read began is cleared even when no organization can be answered,
|
|
5
15
|
and a choice made while the read was in flight is never cleared. Test: `active-organization.test.ts`.
|
package/dist/organizations.cjs
CHANGED
|
@@ -468,6 +468,7 @@ async function resolveOrganizationWithLink(input) {
|
|
|
468
468
|
|
|
469
469
|
// src/active-organization.ts
|
|
470
470
|
var NoActiveOrganizationError = class extends Error {
|
|
471
|
+
reason;
|
|
471
472
|
constructor(reason, detail) {
|
|
472
473
|
super(
|
|
473
474
|
reason === "signed-out" ? "No organization: nobody is signed in." : reason === "no-memberships" ? "No organization: this account is not an active member of any organization." : `No organization: your organizations could not be checked${detail ? ` (${detail})` : ""}.`
|
|
@@ -475,15 +476,14 @@ var NoActiveOrganizationError = class extends Error {
|
|
|
475
476
|
this.reason = reason;
|
|
476
477
|
this.name = "NoActiveOrganizationError";
|
|
477
478
|
}
|
|
478
|
-
reason;
|
|
479
479
|
};
|
|
480
480
|
var NotAMemberError = class extends Error {
|
|
481
|
+
organizationId;
|
|
481
482
|
constructor(organizationId) {
|
|
482
483
|
super(`You are not an active member of organization ${organizationId}.`);
|
|
483
484
|
this.organizationId = organizationId;
|
|
484
485
|
this.name = "NotAMemberError";
|
|
485
486
|
}
|
|
486
|
-
organizationId;
|
|
487
487
|
};
|
|
488
488
|
var HELD_KEY = "ai-matrx.auth.active-organization";
|
|
489
489
|
function storageHeldOrganization(storage, key = HELD_KEY) {
|
|
@@ -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;
|
package/dist/organizations.js
CHANGED
|
@@ -388,6 +388,7 @@ async function resolveOrganizationWithLink(input) {
|
|
|
388
388
|
|
|
389
389
|
// src/active-organization.ts
|
|
390
390
|
var NoActiveOrganizationError = class extends Error {
|
|
391
|
+
reason;
|
|
391
392
|
constructor(reason, detail) {
|
|
392
393
|
super(
|
|
393
394
|
reason === "signed-out" ? "No organization: nobody is signed in." : reason === "no-memberships" ? "No organization: this account is not an active member of any organization." : `No organization: your organizations could not be checked${detail ? ` (${detail})` : ""}.`
|
|
@@ -395,15 +396,14 @@ var NoActiveOrganizationError = class extends Error {
|
|
|
395
396
|
this.reason = reason;
|
|
396
397
|
this.name = "NoActiveOrganizationError";
|
|
397
398
|
}
|
|
398
|
-
reason;
|
|
399
399
|
};
|
|
400
400
|
var NotAMemberError = class extends Error {
|
|
401
|
+
organizationId;
|
|
401
402
|
constructor(organizationId) {
|
|
402
403
|
super(`You are not an active member of organization ${organizationId}.`);
|
|
403
404
|
this.organizationId = organizationId;
|
|
404
405
|
this.name = "NotAMemberError";
|
|
405
406
|
}
|
|
406
|
-
organizationId;
|
|
407
407
|
};
|
|
408
408
|
var HELD_KEY = "ai-matrx.auth.active-organization";
|
|
409
409
|
function storageHeldOrganization(storage, key = HELD_KEY) {
|
|
@@ -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.
|
|
3
|
+
"version": "0.3.3",
|
|
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": "
|
|
214
|
+
"gitHead": "74ed4eaab1a7c0a791b80979812f1dad0973d4a8"
|
|
215
215
|
}
|