@tokenoftrust/storefront-runner 7.6.14 → 7.6.15
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.
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { hostInGateList } from "@/lib/access/shared/demoGate";
|
|
17
17
|
import { isOwnerCapability } from "@/lib/access/shared/capability";
|
|
18
18
|
import { normalizeMemberships, staffAdmits } from "@/lib/access/dashboard/tenantSelection";
|
|
19
|
-
import type
|
|
19
|
+
import { isAgentSession, type SessionRecord } from "./session.js";
|
|
20
20
|
import { safeNext } from "./safeNext.js";
|
|
21
21
|
|
|
22
22
|
export type GateMode = "password" | "login";
|
|
@@ -26,9 +26,22 @@ export type GateMode = "password" | "login";
|
|
|
26
26
|
* — these readers tolerate a partial record and are deny-closed on absence.
|
|
27
27
|
*/
|
|
28
28
|
type HostAdmissionRecord = Partial<
|
|
29
|
-
Pick<SessionRecord, "tenants" | "staffSelection" | "staff" | "resource" | "capability">
|
|
29
|
+
Pick<SessionRecord, "tenants" | "staffSelection" | "staff" | "resource" | "capability" | "actor">
|
|
30
30
|
>;
|
|
31
31
|
|
|
32
|
+
/** True when a human ToT-staff session holds a live, audited vendor selection for `hostResource`. */
|
|
33
|
+
export function sessionStaffSelected(
|
|
34
|
+
record: HostAdmissionRecord | null | undefined,
|
|
35
|
+
hostResource: string,
|
|
36
|
+
nowSeconds: number = Math.floor(Date.now() / 1000),
|
|
37
|
+
): boolean {
|
|
38
|
+
if (!record || isAgentSession(record)) return false;
|
|
39
|
+
if (!Array.isArray(record.staff) || record.staff.length === 0) return false;
|
|
40
|
+
const target = (hostResource ?? "").trim();
|
|
41
|
+
if (!target) return false;
|
|
42
|
+
return staffAdmits({ selection: record.staffSelection, nowSeconds }, target);
|
|
43
|
+
}
|
|
44
|
+
|
|
32
45
|
/**
|
|
33
46
|
* The owner/admin/member standing a session holds FOR THIS EXACT HOST tenant, or
|
|
34
47
|
* null when it is not a member of the host. Resolved SERVER-SIDE and BOUND to
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/storefront-runner",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.15",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
|
|
6
6
|
"packageManager": "pnpm@11.9.0",
|