@odla-ai/chapter 0.46.0 → 0.47.0
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/README.md +4 -2
- package/dist/{copy-context-GaxckY3T.d.ts → copy-context-20WFI5TI.d.ts} +8 -4
- package/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -9
- package/dist/index.d.ts +16 -9
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/ui/admin/index.d.ts +2 -2
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/member/index.d.ts +2 -2
- package/dist/worker/index.cjs +6 -2
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +8 -4
- package/dist/worker/index.d.ts +8 -4
- package/dist/worker/index.js +6 -2
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
package/dist/worker/index.d.cts
CHANGED
|
@@ -514,7 +514,7 @@ interface ChapterScheduling {
|
|
|
514
514
|
*
|
|
515
515
|
* - `"claim"` reads a role ladder from a JWT claim (the member-site model:
|
|
516
516
|
* `provisional → member → admin`). Admin is the last (highest) rung; the
|
|
517
|
-
*
|
|
517
|
+
* Studio-managed super-admin tier sits above it.
|
|
518
518
|
* - `"table"` gates on the deny-all `admins` allowlist (the hub model):
|
|
519
519
|
* a binary "email is an admin or isn't", set only in odla Studio.
|
|
520
520
|
*
|
|
@@ -526,10 +526,13 @@ interface ChapterAuth {
|
|
|
526
526
|
/** Role ladder low→high, for `source: "claim"`. The last entry is admin.
|
|
527
527
|
* Default `["provisional", "member", "admin"]`. */
|
|
528
528
|
ladder?: readonly string[];
|
|
529
|
-
/**
|
|
530
|
-
* create/modify admins
|
|
531
|
-
* odla Studio. Default: `true` for `"claim"`, `false` for `"table"`. */
|
|
529
|
+
/** Enable the Studio-managed super-admin tier — the only tier that may
|
|
530
|
+
* create/modify admins. Default: `true` for `"claim"`, `false` for `"table"`. */
|
|
532
531
|
superAdmins?: boolean;
|
|
532
|
+
/** Authority behind the super-admin tier. `"table"` preserves the legacy
|
|
533
|
+
* app allowlist; `"odla"` reads protected `$users.role`. Default `"table"`
|
|
534
|
+
* for backward compatibility. */
|
|
535
|
+
superAdminSource?: "table" | "odla";
|
|
533
536
|
}
|
|
534
537
|
/** The fully-resolved auth policy (defaults applied) carried on the {@link Chapter}. */
|
|
535
538
|
interface ResolvedAuth {
|
|
@@ -539,6 +542,7 @@ interface ResolvedAuth {
|
|
|
539
542
|
/** The highest ladder rung (last entry) — the "admin" gate. */
|
|
540
543
|
adminRole: string;
|
|
541
544
|
superAdmins: boolean;
|
|
545
|
+
superAdminSource: "none" | "table" | "odla";
|
|
542
546
|
}
|
|
543
547
|
/** The application status pipeline. Which statuses exist, and the subsets a site
|
|
544
548
|
* allows a call to be booked from / an application approved from. Defaults to
|
package/dist/worker/index.d.ts
CHANGED
|
@@ -514,7 +514,7 @@ interface ChapterScheduling {
|
|
|
514
514
|
*
|
|
515
515
|
* - `"claim"` reads a role ladder from a JWT claim (the member-site model:
|
|
516
516
|
* `provisional → member → admin`). Admin is the last (highest) rung; the
|
|
517
|
-
*
|
|
517
|
+
* Studio-managed super-admin tier sits above it.
|
|
518
518
|
* - `"table"` gates on the deny-all `admins` allowlist (the hub model):
|
|
519
519
|
* a binary "email is an admin or isn't", set only in odla Studio.
|
|
520
520
|
*
|
|
@@ -526,10 +526,13 @@ interface ChapterAuth {
|
|
|
526
526
|
/** Role ladder low→high, for `source: "claim"`. The last entry is admin.
|
|
527
527
|
* Default `["provisional", "member", "admin"]`. */
|
|
528
528
|
ladder?: readonly string[];
|
|
529
|
-
/**
|
|
530
|
-
* create/modify admins
|
|
531
|
-
* odla Studio. Default: `true` for `"claim"`, `false` for `"table"`. */
|
|
529
|
+
/** Enable the Studio-managed super-admin tier — the only tier that may
|
|
530
|
+
* create/modify admins. Default: `true` for `"claim"`, `false` for `"table"`. */
|
|
532
531
|
superAdmins?: boolean;
|
|
532
|
+
/** Authority behind the super-admin tier. `"table"` preserves the legacy
|
|
533
|
+
* app allowlist; `"odla"` reads protected `$users.role`. Default `"table"`
|
|
534
|
+
* for backward compatibility. */
|
|
535
|
+
superAdminSource?: "table" | "odla";
|
|
533
536
|
}
|
|
534
537
|
/** The fully-resolved auth policy (defaults applied) carried on the {@link Chapter}. */
|
|
535
538
|
interface ResolvedAuth {
|
|
@@ -539,6 +542,7 @@ interface ResolvedAuth {
|
|
|
539
542
|
/** The highest ladder rung (last entry) — the "admin" gate. */
|
|
540
543
|
adminRole: string;
|
|
541
544
|
superAdmins: boolean;
|
|
545
|
+
superAdminSource: "none" | "table" | "odla";
|
|
542
546
|
}
|
|
543
547
|
/** The application status pipeline. Which statuses exist, and the subsets a site
|
|
544
548
|
* allows a call to be booked from / an application approved from. Defaults to
|
package/dist/worker/index.js
CHANGED
|
@@ -80,12 +80,16 @@ function createWorkerContext(options) {
|
|
|
80
80
|
}
|
|
81
81
|
async function isAdminEmail(db, email) {
|
|
82
82
|
if (!email) return false;
|
|
83
|
-
const { admins } = await db.query({ admins: { $: { where: { email: email.toLowerCase() }, limit: 1 } } });
|
|
83
|
+
const { admins } = await db.query({ admins: { $: { where: { email: email.trim().toLowerCase() }, limit: 1 } } });
|
|
84
84
|
return Array.isArray(admins) && admins.length > 0;
|
|
85
85
|
}
|
|
86
86
|
async function isSuperAdminEmail(db, email) {
|
|
87
87
|
if (!auth.superAdmins || !email) return false;
|
|
88
|
-
|
|
88
|
+
if (auth.superAdminSource === "odla") {
|
|
89
|
+
const { $users } = await db.query({ $users: { $: { where: { email: email.trim().toLowerCase(), role: "super_admin" }, limit: 1 } } });
|
|
90
|
+
return Array.isArray($users) && $users.length > 0;
|
|
91
|
+
}
|
|
92
|
+
const { superAdmins } = await db.query({ superAdmins: { $: { where: { email: email.trim().toLowerCase() }, limit: 1 } } });
|
|
89
93
|
return Array.isArray(superAdmins) && superAdmins.length > 0;
|
|
90
94
|
}
|
|
91
95
|
async function roleFor(db, u) {
|