@stigmer/react 3.27.2 → 3.29.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.
@@ -23,9 +23,13 @@ export interface PermissionGateProps {
23
23
  * Conditionally renders children based on the current user's
24
24
  * permission on a resource.
25
25
  *
26
- * Uses {@link useCheckPermission} under the hood. In OSS mode (where
27
- * the IAM service is unavailable), the gate is always permissive —
28
- * children are rendered immediately without a network call.
26
+ * Uses {@link useCheckPermission} under the hood, so the check runs in
27
+ * every edition and the gate fails open: a check that errors renders
28
+ * the children. Until the server answers, the gate renders `loading`,
29
+ * from its first render. Gated content never mounts before the answer,
30
+ * so content that fetches when it mounts is never fetched for a caller
31
+ * the server refuses. A `null` resource skips the check and renders the
32
+ * children.
29
33
  *
30
34
  * This component is designed to hide UI elements (buttons, actions,
31
35
  * controls) that the user cannot perform. It does NOT enforce
@@ -1 +1 @@
1
- {"version":3,"file":"PermissionGate.d.ts","sourceRoot":"","sources":["../../src/iam-policy/PermissionGate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AAEjC,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAClD,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAe,EACf,OAAc,GACf,EAAE,mBAAmB,GAAG,SAAS,CAMjC"}
1
+ {"version":3,"file":"PermissionGate.d.ts","sourceRoot":"","sources":["../../src/iam-policy/PermissionGate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AAEjC,wCAAwC;AACxC,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAClD,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAe,EACf,OAAc,GACf,EAAE,mBAAmB,GAAG,SAAS,CAMjC"}
@@ -4,9 +4,13 @@ import { useCheckPermission, } from "./useCheckPermission.js";
4
4
  * Conditionally renders children based on the current user's
5
5
  * permission on a resource.
6
6
  *
7
- * Uses {@link useCheckPermission} under the hood. In OSS mode (where
8
- * the IAM service is unavailable), the gate is always permissive —
9
- * children are rendered immediately without a network call.
7
+ * Uses {@link useCheckPermission} under the hood, so the check runs in
8
+ * every edition and the gate fails open: a check that errors renders
9
+ * the children. Until the server answers, the gate renders `loading`,
10
+ * from its first render. Gated content never mounts before the answer,
11
+ * so content that fetches when it mounts is never fetched for a caller
12
+ * the server refuses. A `null` resource skips the check and renders the
13
+ * children.
10
14
  *
11
15
  * This component is designed to hide UI elements (buttons, actions,
12
16
  * controls) that the user cannot perform. It does NOT enforce
@@ -1 +1 @@
1
- {"version":3,"file":"PermissionGate.js","sourceRoot":"","sources":["../../src/iam-policy/PermissionGate.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EACL,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AAsBjC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,GAAG,IAAI,EACf,OAAO,GAAG,IAAI,GACM;IACpB,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEtE,IAAI,SAAS;QAAE,OAAO,OAAO,CAAC;IAC9B,IAAI,CAAC,OAAO;QAAE,OAAO,QAAQ,CAAC;IAC9B,OAAO,QAAQ,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"PermissionGate.js","sourceRoot":"","sources":["../../src/iam-policy/PermissionGate.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EACL,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AAsBjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,GAAG,IAAI,EACf,OAAO,GAAG,IAAI,GACM;IACpB,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEtE,IAAI,SAAS;QAAE,OAAO,OAAO,CAAC;IAC9B,IAAI,CAAC,OAAO;QAAE,OAAO,QAAQ,CAAC;IAC9B,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -26,7 +26,10 @@ export interface CheckPermissionOptions {
26
26
  export interface UseCheckPermissionReturn {
27
27
  /** Whether the current user has the specified permission. */
28
28
  readonly allowed: boolean;
29
- /** `true` while the authorization check is in flight. */
29
+ /**
30
+ * `true` while the authorization check is in flight, from the first
31
+ * render for a resource until its answer arrives.
32
+ */
30
33
  readonly isLoading: boolean;
31
34
  /** Error from the last check, or `null`. */
32
35
  readonly error: Error | null;
@@ -56,6 +59,13 @@ export interface UseCheckPermissionReturn {
56
59
  * triple, for the lifetime of the component mount). A failed check is
57
60
  * never cached, so a transient error does not pin a wrong answer.
58
61
  *
62
+ * No render passes off an answer the hook does not have: `isLoading` is
63
+ * already `true` on the first render for a resource, and when the
64
+ * resource changes the previous resource's verdict is never reported for
65
+ * the new one. A gate can therefore trust a settled answer as the
66
+ * server's, and gated content that fetches when it mounts never mounts
67
+ * for a caller the server is about to refuse.
68
+ *
59
69
  * @param resource - The resource to check, or `null` to skip.
60
70
  * @param relation - The permission to check (e.g. "can_edit", "can_grant_access").
61
71
  * @param options - Fail-mode configuration; see {@link CheckPermissionOptions}.
@@ -1 +1 @@
1
- {"version":3,"file":"useCheckPermission.d.ts","sourceRoot":"","sources":["../../src/iam-policy/useCheckPermission.ts"],"names":[],"mappings":"AAYA,gDAAgD;AAChD,MAAM,WAAW,uBAAuB;IACtC,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mBAAmB;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACnC;AAED,kDAAkD;AAClD,MAAM,WAAW,wBAAwB;IACvC,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,uBAAuB,GAAG,IAAI,EACxC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,wBAAwB,CAiE1B"}
1
+ {"version":3,"file":"useCheckPermission.d.ts","sourceRoot":"","sources":["../../src/iam-policy/useCheckPermission.ts"],"names":[],"mappings":"AAYA,gDAAgD;AAChD,MAAM,WAAW,uBAAuB;IACtC,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mBAAmB;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACnC;AAED,kDAAkD;AAClD,MAAM,WAAW,wBAAwB;IACvC,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC9B;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,uBAAuB,GAAG,IAAI,EACxC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,wBAAwB,CA+D1B"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useEffect, useRef, useState } from "react";
2
+ import { useEffect, useMemo, useRef, useState } from "react";
3
3
  import { create } from "@bufbuild/protobuf";
4
4
  import { CheckMyPermissionInputSchema, } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/io_pb";
5
5
  import { ApiResourceRefSchema, } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/spec_pb";
@@ -29,6 +29,13 @@ import { useStigmer } from "../hooks.js";
29
29
  * triple, for the lifetime of the component mount). A failed check is
30
30
  * never cached, so a transient error does not pin a wrong answer.
31
31
  *
32
+ * No render passes off an answer the hook does not have: `isLoading` is
33
+ * already `true` on the first render for a resource, and when the
34
+ * resource changes the previous resource's verdict is never reported for
35
+ * the new one. A gate can therefore trust a settled answer as the
36
+ * server's, and gated content that fetches when it mounts never mounts
37
+ * for a caller the server is about to refuse.
38
+ *
32
39
  * @param resource - The resource to check, or `null` to skip.
33
40
  * @param relation - The permission to check (e.g. "can_edit", "can_grant_access").
34
41
  * @param options - Fail-mode configuration; see {@link CheckPermissionOptions}.
@@ -47,26 +54,22 @@ export function useCheckPermission(resource, relation, options) {
47
54
  const stigmer = useStigmer();
48
55
  const failMode = options?.fail ?? "open";
49
56
  const failValue = failMode === "open";
50
- const [allowed, setAllowed] = useState(failValue);
51
- const [isLoading, setIsLoading] = useState(false);
52
- const [error, setError] = useState(null);
53
57
  const cacheKey = resource ? `${resource.kind}:${resource.id}:${relation}` : null;
54
58
  const cacheRef = useRef(new Map());
59
+ // The last settled outcome, kept with the triple it answers. Loading is
60
+ // derived from it during render rather than set by the effect, because
61
+ // the effect runs only after the first render has committed, so a
62
+ // separate loading flag would report a settled answer until then.
63
+ const [settled, setSettled] = useState(null);
55
64
  useEffect(() => {
56
- if (!resource || !cacheKey) {
57
- setAllowed(failValue);
58
- setIsLoading(false);
65
+ if (!resource || !cacheKey)
59
66
  return;
60
- }
61
67
  const cached = cacheRef.current.get(cacheKey);
62
68
  if (cached !== undefined) {
63
- setAllowed(cached);
64
- setIsLoading(false);
69
+ setSettled({ key: cacheKey, verdict: cached, error: null });
65
70
  return;
66
71
  }
67
72
  let cancelled = false;
68
- setAllowed(failValue);
69
- setIsLoading(true);
70
73
  const input = create(CheckMyPermissionInputSchema, {
71
74
  resource: create(ApiResourceRefSchema, {
72
75
  kind: resource.kind,
@@ -79,10 +82,8 @@ export function useCheckPermission(resource, relation, options) {
79
82
  .then((result) => {
80
83
  if (cancelled)
81
84
  return;
82
- const isAllowed = result.isAuthorized;
83
- cacheRef.current.set(cacheKey, isAllowed);
84
- setAllowed(isAllowed);
85
- setError(null);
85
+ cacheRef.current.set(cacheKey, result.isAuthorized);
86
+ setSettled({ key: cacheKey, verdict: result.isAuthorized, error: null });
86
87
  })
87
88
  .catch((err) => {
88
89
  if (cancelled)
@@ -90,17 +91,20 @@ export function useCheckPermission(resource, relation, options) {
90
91
  // Degradation is fail-mode-resolved and deliberately NOT cached:
91
92
  // an error is not an authorization verdict, and caching it would
92
93
  // pin a possibly-wrong answer for the mount's lifetime.
93
- setAllowed(failValue);
94
- setError(err instanceof Error ? err : new Error(String(err)));
95
- })
96
- .finally(() => {
97
- if (!cancelled)
98
- setIsLoading(false);
94
+ setSettled({
95
+ key: cacheKey,
96
+ verdict: null,
97
+ error: err instanceof Error ? err : new Error(String(err)),
98
+ });
99
99
  });
100
100
  return () => {
101
101
  cancelled = true;
102
102
  };
103
103
  }, [cacheKey, resource?.kind, resource?.id, relation, failValue, stigmer]);
104
- return { allowed, isLoading, error };
104
+ const current = cacheKey !== null && settled?.key === cacheKey ? settled : null;
105
+ const allowed = current?.verdict ?? failValue;
106
+ const isLoading = cacheKey !== null && current === null;
107
+ const error = current?.error ?? null;
108
+ return useMemo(() => ({ allowed, isLoading, error }), [allowed, isLoading, error]);
105
109
  }
106
110
  //# sourceMappingURL=useCheckPermission.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCheckPermission.js","sourceRoot":"","sources":["../../src/iam-policy/useCheckPermission.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AA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,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;aAC3D,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAE3E,MAAM,OAAO,GAAG,QAAQ,KAAK,IAAI,IAAI,OAAO,EAAE,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAChF,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,SAAS,CAAC;IAC9C,MAAM,SAAS,GAAG,QAAQ,KAAK,IAAI,IAAI,OAAO,KAAK,IAAI,CAAC;IACxD,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC;IAErC,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;AACrF,CAAC"}
@@ -28,6 +28,10 @@ export interface InvitationManagerProps {
28
28
  * - {@link useCreateInvitation} for creation
29
29
  * - {@link useRevokeInvitation} for revocation
30
30
  *
31
+ * The server serves an organization's invitations only to callers who
32
+ * hold `can_grant_access` on it, so gate the mount on that permission,
33
+ * as {@link InvitationsSection} does with {@link PermissionGate}.
34
+ *
31
35
  * All visual properties flow through `--stgm-*` design tokens.
32
36
  *
33
37
  * @example
@@ -1 +1 @@
1
- {"version":3,"file":"InvitationManager.d.ts","sourceRoot":"","sources":["../../src/invitation/InvitationManager.tsx"],"names":[],"mappings":"AA2BA,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,qDAAqD;IACrD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAcD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,cAAsC,EACtC,SAAS,GACV,EAAE,sBAAsB,2CA2HxB"}
1
+ {"version":3,"file":"InvitationManager.d.ts","sourceRoot":"","sources":["../../src/invitation/InvitationManager.tsx"],"names":[],"mappings":"AA2BA,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,qDAAqD;IACrD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,cAAsC,EACtC,SAAS,GACV,EAAE,sBAAsB,2CA2HxB"}
@@ -35,6 +35,10 @@ function defaultBuildInviteUrl(token) {
35
35
  * - {@link useCreateInvitation} for creation
36
36
  * - {@link useRevokeInvitation} for revocation
37
37
  *
38
+ * The server serves an organization's invitations only to callers who
39
+ * hold `can_grant_access` on it, so gate the mount on that permission,
40
+ * as {@link InvitationsSection} does with {@link PermissionGate}.
41
+ *
38
42
  * All visual properties flow through `--stgm-*` design tokens.
39
43
  *
40
44
  * @example
@@ -1 +1 @@
1
- {"version":3,"file":"InvitationManager.js","sourceRoot":"","sources":["../../src/invitation/InvitationManager.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EA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;AACJ,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CACL,eACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,iBACV,MAAM,aAElB,eAAM,CAAC,EAAC,GAAG,EAAC,CAAC,EAAC,GAAG,EAAC,KAAK,EAAC,GAAG,EAAC,MAAM,EAAC,GAAG,EAAC,EAAE,EAAC,KAAK,GAAG,EAClD,eAAM,CAAC,EAAC,gFAAgF,GAAG,IACvF,CACP,CAAC;AACJ,CAAC;AAED,SAAS,SAAS;IAChB,OAAO,CACL,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,iBACV,MAAM,YAElB,eAAM,CAAC,EAAC,qBAAqB,GAAG,GAC5B,CACP,CAAC;AACJ,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,CACL,eACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,iBACV,MAAM,aAElB,iBAAQ,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,GAAG,EAAC,CAAC,EAAC,GAAG,GAAG,EAC9B,eAAM,CAAC,EAAC,eAAe,GAAG,IACtB,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"InvitationManager.js","sourceRoot":"","sources":["../../src/invitation/InvitationManager.tsx"],"names":[],"mappings":"AAAA,YAAY,CAA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
3
- "version": "3.27.2",
3
+ "version": "3.29.0",
4
4
  "description": "React provider and client hook for the Stigmer platform SDK",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -37,8 +37,8 @@
37
37
  "dependencies": {
38
38
  "@bufbuild/protovalidate": "^1.1.1",
39
39
  "@dagrejs/dagre": "^1.1.4",
40
- "@stigmer/plugin-package": "3.27.2",
41
- "@stigmer/theme": "3.27.2",
40
+ "@stigmer/plugin-package": "3.29.0",
41
+ "@stigmer/theme": "3.29.0",
42
42
  "diff": "^8.0.3",
43
43
  "fflate": "^0.8.2",
44
44
  "hast-util-to-jsx-runtime": "^2.3.6",
@@ -61,8 +61,8 @@
61
61
  "@codemirror/state": "^6.0.0",
62
62
  "@codemirror/view": "^6.0.0",
63
63
  "@lezer/highlight": "^1.0.0",
64
- "@stigmer/protos": "3.27.2",
65
- "@stigmer/sdk": "3.27.2",
64
+ "@stigmer/protos": "3.29.0",
65
+ "@stigmer/sdk": "3.29.0",
66
66
  "@tanstack/react-table": "^8.20.0",
67
67
  "@xyflow/react": "^12.0.0",
68
68
  "elkjs": "^0.9.0",
@@ -1,3 +1,12 @@
1
- /** Settings section for creating and managing organization invitations. */
1
+ /**
2
+ * Settings section for creating and managing organization invitations.
3
+ *
4
+ * An organization's invitations are administered by its admins: the
5
+ * server lists them to, and creates them for, callers who hold
6
+ * `can_grant_access` on the organization. The manager is offered once the
7
+ * server confirms the caller holds it; everyone else is told that the
8
+ * organization's admins manage invitations, rather than shown an empty
9
+ * list and a create button the server would refuse.
10
+ */
2
11
  export declare function InvitationsSection(): import("react/jsx-runtime").JSX.Element;
3
12
  //# sourceMappingURL=InvitationsSection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InvitationsSection.d.ts","sourceRoot":"","sources":["../../src/settings/InvitationsSection.tsx"],"names":[],"mappings":"AAQA,2EAA2E;AAC3E,wBAAgB,kBAAkB,4CAkCjC"}
1
+ {"version":3,"file":"InvitationsSection.d.ts","sourceRoot":"","sources":["../../src/settings/InvitationsSection.tsx"],"names":[],"mappings":"AAaA;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,4CA8CjC"}
@@ -3,13 +3,27 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useId } from "react";
4
4
  import { InvitationManager } from "../invitation/InvitationManager.js";
5
5
  import { useResourceAvailable, ApiResourceKind } from "../deployment-mode.js";
6
+ import { PermissionGate } from "../iam-policy/PermissionGate.js";
6
7
  import { CloudFeatureNotice } from "../internal/CloudFeatureNotice.js";
7
- import { useActiveOrgSlug } from "../organization/OrgProvider.js";
8
- /** Settings section for creating and managing organization invitations. */
8
+ import { useOrg } from "../organization/OrgProvider.js";
9
+ /** Shown in place of the manager to a caller who may not manage invitations. */
10
+ const INVITATIONS_MANAGED_BY_ADMINS = "Invitations are managed by your organization's admins.";
11
+ /**
12
+ * Settings section for creating and managing organization invitations.
13
+ *
14
+ * An organization's invitations are administered by its admins: the
15
+ * server lists them to, and creates them for, callers who hold
16
+ * `can_grant_access` on the organization. The manager is offered once the
17
+ * server confirms the caller holds it; everyone else is told that the
18
+ * organization's admins manage invitations, rather than shown an empty
19
+ * list and a create button the server would refuse.
20
+ */
9
21
  export function InvitationsSection() {
10
22
  const headingId = useId();
11
- const org = useActiveOrgSlug();
23
+ const { activeOrg } = useOrg();
12
24
  const invitationsAvailable = useResourceAvailable(ApiResourceKind.invitation);
13
- return (_jsxs("section", { "aria-labelledby": headingId, children: [_jsx("div", { className: "stg:mb-3", children: _jsx("h2", { id: headingId, className: "stg:text-foreground stg:text-sm stg:font-semibold", children: "Invitations" }) }), _jsx("p", { className: "stg:text-muted-foreground stg:mb-4 stg:text-xs", children: "Shareable invite links that grant organization membership with a configurable role. Create single-use links for specific people or multi-use links for public sharing." }), !invitationsAvailable ? (_jsx(CloudFeatureNotice, { children: "Invitations are not available in local mode." })) : !org ? (_jsx("p", { className: "stg:text-muted-foreground stg:py-4 stg:text-center stg:text-xs", children: "Select an organization to manage invitations." })) : (_jsx(InvitationManager, { org: org }))] }));
25
+ const orgSlug = activeOrg?.metadata?.slug ?? "";
26
+ const orgId = activeOrg?.metadata?.id ?? "";
27
+ return (_jsxs("section", { "aria-labelledby": headingId, children: [_jsx("div", { className: "stg:mb-3", children: _jsx("h2", { id: headingId, className: "stg:text-foreground stg:text-sm stg:font-semibold", children: "Invitations" }) }), _jsx("p", { className: "stg:text-muted-foreground stg:mb-4 stg:text-xs", children: "Shareable invite links that grant organization membership with a configurable role. Create single-use links for specific people or multi-use links for public sharing." }), !invitationsAvailable ? (_jsx(CloudFeatureNotice, { children: "Invitations are not available in local mode." })) : !orgSlug ? (_jsx("p", { className: "stg:text-muted-foreground stg:py-4 stg:text-center stg:text-xs", children: "Select an organization to manage invitations." })) : (_jsx(PermissionGate, { resource: { kind: "organization", id: orgId }, relation: "can_grant_access", fallback: _jsx("p", { className: "stg:text-muted-foreground stg:py-4 stg:text-center stg:text-xs", children: INVITATIONS_MANAGED_BY_ADMINS }), children: _jsx(InvitationManager, { org: orgSlug }) }))] }));
14
28
  }
15
29
  //# sourceMappingURL=InvitationsSection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InvitationsSection.js","sourceRoot":"","sources":["../../src/settings/InvitationsSection.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,2EAA2E;AAC3E,MAAM,UAAU,kBAAkB;IAChC,MAAM,SAAS,GAAG,KAAK,EAAE,CAAC;IAC1B,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAC;IAC/B,MAAM,o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Q,EAAE,IAAI,IAAI,EAAE,CAAC;IAChD,MAAM,KAAK,GAAG,SAAS,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC;IAE5C,OAAO,CACL,sCAA0B,SAAS,aACjC,cAAK,SAAS,EAAC,UAAU,YACvB,aACE,EAAE,EAAE,SAAS,EACb,SAAS,EAAC,mDAAmD,4BAG1D,GACD,EACN,YAAG,SAAS,EAAC,gDAAgD,uLAIzD,EAEH,CAAC,oBAAoB,CAAC,CAAC,CAAC,CACvB,KAAC,kBAAkB,+DAEE,CACtB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACb,YAAG,SAAS,EAAC,gEAAgE,8DAEzE,CACL,CAAC,CAAC,CAAC,CACF,KAAC,cAAc,IACb,QAAQ,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,EAAE,EAC7C,QAAQ,EAAC,kBAAkB,EAC3B,QAAQ,EACN,YAAG,SAAS,EAAC,gEAAgE,YAC1E,6BAA6B,GAC5B,YAGN,KAAC,iBAAiB,IAAC,GAAG,EAAE,OAAO,GAAI,GACpB,CAClB,IACO,CACX,CAAC;AACJ,CAAC"}
@@ -30,9 +30,13 @@ export interface PermissionGateProps {
30
30
  * Conditionally renders children based on the current user's
31
31
  * permission on a resource.
32
32
  *
33
- * Uses {@link useCheckPermission} under the hood. In OSS mode (where
34
- * the IAM service is unavailable), the gate is always permissive —
35
- * children are rendered immediately without a network call.
33
+ * Uses {@link useCheckPermission} under the hood, so the check runs in
34
+ * every edition and the gate fails open: a check that errors renders
35
+ * the children. Until the server answers, the gate renders `loading`,
36
+ * from its first render. Gated content never mounts before the answer,
37
+ * so content that fetches when it mounts is never fetched for a caller
38
+ * the server refuses. A `null` resource skips the check and renders the
39
+ * children.
36
40
  *
37
41
  * This component is designed to hide UI elements (buttons, actions,
38
42
  * controls) that the user cannot perform. It does NOT enforce
@@ -1,11 +1,22 @@
1
+ /**
2
+ * Pins useCheckPermission's contract: the verdict each fail mode reports
3
+ * while a check is in flight, on a grant, a denial, a failed RPC and a
4
+ * skipped (null) resource; the per-mount cache of genuine verdicts only;
5
+ * and that no render ever passes off a verdict it does not have. The
6
+ * first render already reports the check as in flight, and a changed
7
+ * resource never reports the previous resource's verdict, because
8
+ * PermissionGate and every caller that reads `isLoading` treat a settled
9
+ * answer as the server's.
10
+ */
1
11
  import { describe, it, expect, vi, afterEach } from "vitest";
2
- import { cleanup, render, screen, waitFor } from "@testing-library/react";
12
+ import { act, cleanup, render, screen, waitFor } from "@testing-library/react";
3
13
  import type { ReactNode } from "react";
4
14
  import { StigmerContext } from "../../context";
5
15
  import {
6
16
  useCheckPermission,
7
17
  type CheckPermissionOptions,
8
18
  type PermissionCheckResource,
19
+ type UseCheckPermissionReturn,
9
20
  } from "../useCheckPermission";
10
21
 
11
22
  function createMockStigmer(checkMyPermission: ReturnType<typeof vi.fn>) {
@@ -219,3 +230,93 @@ describe("useCheckPermission — caching", () => {
219
230
  );
220
231
  });
221
232
  });
233
+
234
+ /** Every value the hook returned, in render order. */
235
+ function Recorder({
236
+ resource,
237
+ options,
238
+ renders,
239
+ }: {
240
+ resource: PermissionCheckResource | null;
241
+ options?: CheckPermissionOptions;
242
+ renders: UseCheckPermissionReturn[];
243
+ }) {
244
+ renders.push(useCheckPermission(resource, "can_edit", options));
245
+ return null;
246
+ }
247
+
248
+ const WORKFLOW: PermissionCheckResource = { kind: "workflow", id: "wfl_1" };
249
+
250
+ describe("useCheckPermission — the first render", () => {
251
+ it("reports the check as in flight from the first render, under fail-open", () => {
252
+ const { check } = pendingCheck();
253
+ const renders: UseCheckPermissionReturn[] = [];
254
+ render(<Recorder resource={AGENT} renders={renders} />, {
255
+ wrapper: wrapper(createMockStigmer(check)),
256
+ });
257
+
258
+ expect(renders[0]).toEqual({ allowed: true, isLoading: true, error: null });
259
+ expect(check).toHaveBeenCalledTimes(1);
260
+ });
261
+
262
+ it("reports the check as in flight from the first render, under fail-closed", () => {
263
+ const { check } = pendingCheck();
264
+ const renders: UseCheckPermissionReturn[] = [];
265
+ render(
266
+ <Recorder resource={AGENT} options={{ fail: "closed" }} renders={renders} />,
267
+ { wrapper: wrapper(createMockStigmer(check)) },
268
+ );
269
+
270
+ expect(renders[0]).toEqual({ allowed: false, isLoading: true, error: null });
271
+ });
272
+
273
+ it("reports a skipped (null) resource as settled from the first render", () => {
274
+ const check = vi.fn();
275
+ const renders: UseCheckPermissionReturn[] = [];
276
+ render(<Recorder resource={null} renders={renders} />, {
277
+ wrapper: wrapper(createMockStigmer(check)),
278
+ });
279
+
280
+ expect(renders[0]).toEqual({ allowed: true, isLoading: false, error: null });
281
+ expect(check).not.toHaveBeenCalled();
282
+ });
283
+
284
+ it("never reports one resource's verdict for another", async () => {
285
+ const denied = pendingCheck();
286
+ const pending = pendingCheck();
287
+ const check = vi
288
+ .fn()
289
+ .mockImplementationOnce(denied.check)
290
+ .mockImplementationOnce(pending.check);
291
+ const renders: UseCheckPermissionReturn[] = [];
292
+ const { rerender } = render(<Recorder resource={AGENT} renders={renders} />, {
293
+ wrapper: wrapper(createMockStigmer(check)),
294
+ });
295
+ await act(async () => denied.resolve(false));
296
+ expect(renders.at(-1)).toEqual({ allowed: false, isLoading: false, error: null });
297
+
298
+ const firstForWorkflow = renders.length;
299
+ rerender(<Recorder resource={WORKFLOW} renders={renders} />);
300
+
301
+ // Every render for the new resource is in flight at the fail value,
302
+ // never the agent's denial passed off as the workflow's verdict.
303
+ for (const value of renders.slice(firstForWorkflow)) {
304
+ expect(value).toEqual({ allowed: true, isLoading: true, error: null });
305
+ }
306
+ await act(async () => pending.resolve(true));
307
+ expect(renders.at(-1)).toEqual({ allowed: true, isLoading: false, error: null });
308
+ });
309
+
310
+ it("returns the same object while its answer is unchanged", async () => {
311
+ const check = vi.fn().mockResolvedValue({ isAuthorized: true });
312
+ const renders: UseCheckPermissionReturn[] = [];
313
+ const { rerender } = render(<Recorder resource={AGENT} renders={renders} />, {
314
+ wrapper: wrapper(createMockStigmer(check)),
315
+ });
316
+ await waitFor(() => expect(renders.at(-1)?.isLoading).toBe(false));
317
+
318
+ const settled = renders.at(-1);
319
+ rerender(<Recorder resource={AGENT} renders={renders} />);
320
+ expect(renders.at(-1)).toBe(settled);
321
+ });
322
+ });
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { useEffect, useRef, useState } from "react";
3
+ import { useEffect, useMemo, useRef, useState } from "react";
4
4
  import { create } from "@bufbuild/protobuf";
5
5
  import {
6
6
  CheckMyPermissionInputSchema,
@@ -40,12 +40,23 @@ export interface CheckPermissionOptions {
40
40
  export interface UseCheckPermissionReturn {
41
41
  /** Whether the current user has the specified permission. */
42
42
  readonly allowed: boolean;
43
- /** `true` while the authorization check is in flight. */
43
+ /**
44
+ * `true` while the authorization check is in flight, from the first
45
+ * render for a resource until its answer arrives.
46
+ */
44
47
  readonly isLoading: boolean;
45
48
  /** Error from the last check, or `null`. */
46
49
  readonly error: Error | null;
47
50
  }
48
51
 
52
+ /** A check's outcome, keyed by the (kind, id, relation) triple it answers. */
53
+ interface SettledCheck {
54
+ readonly key: string;
55
+ /** The server's verdict, or `null` when the check failed. */
56
+ readonly verdict: boolean | null;
57
+ readonly error: Error | null;
58
+ }
59
+
49
60
  /**
50
61
  * Hook that checks whether the current user has a specific permission
51
62
  * on a resource.
@@ -71,6 +82,13 @@ export interface UseCheckPermissionReturn {
71
82
  * triple, for the lifetime of the component mount). A failed check is
72
83
  * never cached, so a transient error does not pin a wrong answer.
73
84
  *
85
+ * No render passes off an answer the hook does not have: `isLoading` is
86
+ * already `true` on the first render for a resource, and when the
87
+ * resource changes the previous resource's verdict is never reported for
88
+ * the new one. A gate can therefore trust a settled answer as the
89
+ * server's, and gated content that fetches when it mounts never mounts
90
+ * for a caller the server is about to refuse.
91
+ *
74
92
  * @param resource - The resource to check, or `null` to skip.
75
93
  * @param relation - The permission to check (e.g. "can_edit", "can_grant_access").
76
94
  * @param options - Fail-mode configuration; see {@link CheckPermissionOptions}.
@@ -94,30 +112,25 @@ export function useCheckPermission(
94
112
  const failMode = options?.fail ?? "open";
95
113
  const failValue = failMode === "open";
96
114
 
97
- const [allowed, setAllowed] = useState(failValue);
98
- const [isLoading, setIsLoading] = useState(false);
99
- const [error, setError] = useState<Error | null>(null);
100
-
101
115
  const cacheKey = resource ? `${resource.kind}:${resource.id}:${relation}` : null;
102
116
  const cacheRef = useRef<Map<string, boolean>>(new Map());
103
117
 
118
+ // The last settled outcome, kept with the triple it answers. Loading is
119
+ // derived from it during render rather than set by the effect, because
120
+ // the effect runs only after the first render has committed, so a
121
+ // separate loading flag would report a settled answer until then.
122
+ const [settled, setSettled] = useState<SettledCheck | null>(null);
123
+
104
124
  useEffect(() => {
105
- if (!resource || !cacheKey) {
106
- setAllowed(failValue);
107
- setIsLoading(false);
108
- return;
109
- }
125
+ if (!resource || !cacheKey) return;
110
126
 
111
127
  const cached = cacheRef.current.get(cacheKey);
112
128
  if (cached !== undefined) {
113
- setAllowed(cached);
114
- setIsLoading(false);
129
+ setSettled({ key: cacheKey, verdict: cached, error: null });
115
130
  return;
116
131
  }
117
132
 
118
133
  let cancelled = false;
119
- setAllowed(failValue);
120
- setIsLoading(true);
121
134
 
122
135
  const input = create(CheckMyPermissionInputSchema, {
123
136
  resource: create(ApiResourceRefSchema, {
@@ -131,21 +144,19 @@ export function useCheckPermission(
131
144
  .checkMyPermission(input)
132
145
  .then((result) => {
133
146
  if (cancelled) return;
134
- const isAllowed = result.isAuthorized;
135
- cacheRef.current.set(cacheKey, isAllowed);
136
- setAllowed(isAllowed);
137
- setError(null);
147
+ cacheRef.current.set(cacheKey, result.isAuthorized);
148
+ setSettled({ key: cacheKey, verdict: result.isAuthorized, error: null });
138
149
  })
139
150
  .catch((err: unknown) => {
140
151
  if (cancelled) return;
141
152
  // Degradation is fail-mode-resolved and deliberately NOT cached:
142
153
  // an error is not an authorization verdict, and caching it would
143
154
  // pin a possibly-wrong answer for the mount's lifetime.
144
- setAllowed(failValue);
145
- setError(err instanceof Error ? err : new Error(String(err)));
146
- })
147
- .finally(() => {
148
- if (!cancelled) setIsLoading(false);
155
+ setSettled({
156
+ key: cacheKey,
157
+ verdict: null,
158
+ error: err instanceof Error ? err : new Error(String(err)),
159
+ });
149
160
  });
150
161
 
151
162
  return () => {
@@ -153,5 +164,10 @@ export function useCheckPermission(
153
164
  };
154
165
  }, [cacheKey, resource?.kind, resource?.id, relation, failValue, stigmer]);
155
166
 
156
- return { allowed, isLoading, error };
167
+ const current = cacheKey !== null && settled?.key === cacheKey ? settled : null;
168
+ const allowed = current?.verdict ?? failValue;
169
+ const isLoading = cacheKey !== null && current === null;
170
+ const error = current?.error ?? null;
171
+
172
+ return useMemo(() => ({ allowed, isLoading, error }), [allowed, isLoading, error]);
157
173
  }
@@ -68,6 +68,10 @@ type FlowState =
68
68
  * - {@link useCreateInvitation} for creation
69
69
  * - {@link useRevokeInvitation} for revocation
70
70
  *
71
+ * The server serves an organization's invitations only to callers who
72
+ * hold `can_grant_access` on it, so gate the mount on that permission,
73
+ * as {@link InvitationsSection} does with {@link PermissionGate}.
74
+ *
71
75
  * All visual properties flow through `--stgm-*` design tokens.
72
76
  *
73
77
  * @example
@@ -3,14 +3,30 @@
3
3
  import { useId } from "react";
4
4
  import { InvitationManager } from "../invitation/InvitationManager.js";
5
5
  import { useResourceAvailable, ApiResourceKind } from "../deployment-mode.js";
6
+ import { PermissionGate } from "../iam-policy/PermissionGate.js";
6
7
  import { CloudFeatureNotice } from "../internal/CloudFeatureNotice.js";
7
- import { useActiveOrgSlug } from "../organization/OrgProvider.js";
8
+ import { useOrg } from "../organization/OrgProvider.js";
8
9
 
9
- /** Settings section for creating and managing organization invitations. */
10
+ /** Shown in place of the manager to a caller who may not manage invitations. */
11
+ const INVITATIONS_MANAGED_BY_ADMINS =
12
+ "Invitations are managed by your organization's admins.";
13
+
14
+ /**
15
+ * Settings section for creating and managing organization invitations.
16
+ *
17
+ * An organization's invitations are administered by its admins: the
18
+ * server lists them to, and creates them for, callers who hold
19
+ * `can_grant_access` on the organization. The manager is offered once the
20
+ * server confirms the caller holds it; everyone else is told that the
21
+ * organization's admins manage invitations, rather than shown an empty
22
+ * list and a create button the server would refuse.
23
+ */
10
24
  export function InvitationsSection() {
11
25
  const headingId = useId();
12
- const org = useActiveOrgSlug();
26
+ const { activeOrg } = useOrg();
13
27
  const invitationsAvailable = useResourceAvailable(ApiResourceKind.invitation);
28
+ const orgSlug = activeOrg?.metadata?.slug ?? "";
29
+ const orgId = activeOrg?.metadata?.id ?? "";
14
30
 
15
31
  return (
16
32
  <section aria-labelledby={headingId}>
@@ -32,12 +48,22 @@ export function InvitationsSection() {
32
48
  <CloudFeatureNotice>
33
49
  Invitations are not available in local mode.
34
50
  </CloudFeatureNotice>
35
- ) : !org ? (
51
+ ) : !orgSlug ? (
36
52
  <p className="stg:text-muted-foreground stg:py-4 stg:text-center stg:text-xs">
37
53
  Select an organization to manage invitations.
38
54
  </p>
39
55
  ) : (
40
- <InvitationManager org={org} />
56
+ <PermissionGate
57
+ resource={{ kind: "organization", id: orgId }}
58
+ relation="can_grant_access"
59
+ fallback={
60
+ <p className="stg:text-muted-foreground stg:py-4 stg:text-center stg:text-xs">
61
+ {INVITATIONS_MANAGED_BY_ADMINS}
62
+ </p>
63
+ }
64
+ >
65
+ <InvitationManager org={orgSlug} />
66
+ </PermissionGate>
41
67
  )}
42
68
  </section>
43
69
  );
@@ -0,0 +1,197 @@
1
+ /**
2
+ * Pins InvitationsSection's edition posture and its admin gate. An
3
+ * organization's invitations are administered by its admins: the server
4
+ * lists them to, and creates them for, callers who hold `can_grant_access`
5
+ * on the organization. So the section offers the manager to those callers
6
+ * only and names the admins to everyone else, instead of an empty list and
7
+ * a create button the server refuses.
8
+ *
9
+ * - where the edition does not serve invitations (open source) the
10
+ * section says so and asks the server nothing;
11
+ * - the check is `can_grant_access` on the organization's id;
12
+ * - a refused caller reads who manages invitations, is offered nothing,
13
+ * and the server never receives a list request for them;
14
+ * - an allowed caller gets the manager, which lists once;
15
+ * - while the check is in flight neither answer shows;
16
+ * - a failed check leaves the manager in place (fail-open: the server
17
+ * re-checks every call, and an admin is never told they are not one).
18
+ *
19
+ * Everything below the network is real — the organization provider, the
20
+ * permission hook and gate, the manager and its list hook — over a router
21
+ * transport that records what the server was asked.
22
+ */
23
+ import { describe, it, expect, afterEach } from "vitest";
24
+ import { act, cleanup, render, screen, waitFor } from "@testing-library/react";
25
+ import { create } from "@bufbuild/protobuf";
26
+ import { Code, ConnectError, createRouterTransport } from "@connectrpc/connect";
27
+ import { Stigmer, type DeploymentMode } from "@stigmer/sdk";
28
+ import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
29
+ import {
30
+ CheckAuthorizationResultSchema,
31
+ type CheckMyPermissionInput,
32
+ } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/io_pb";
33
+ import { IamPolicyQueryController } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/query_pb";
34
+ import { InvitationsSchema } from "@stigmer/protos/ai/stigmer/iam/invitation/v1/io_pb";
35
+ import { InvitationQueryController } from "@stigmer/protos/ai/stigmer/iam/invitation/v1/query_pb";
36
+ import {
37
+ OrganizationSchema,
38
+ type Organization,
39
+ } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/api_pb";
40
+ import { OrganizationsSchema } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/io_pb";
41
+ import { OrganizationQueryController } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/query_pb";
42
+ import { StigmerContext } from "../../context";
43
+ import { DeploymentModeContext } from "../../deployment-mode";
44
+ import { OrgProvider } from "../../organization/OrgProvider";
45
+ import { InvitationsSection } from "../InvitationsSection";
46
+
47
+ const MANAGED_BY_ADMINS = "Invitations are managed by your organization's admins.";
48
+
49
+ /** The organization's id and slug differ, so the test sees which one each call carries. */
50
+ const ACME = create(OrganizationSchema, {
51
+ metadata: create(ApiResourceMetadataSchema, { id: "org_acme", slug: "acme", name: "Acme" }),
52
+ });
53
+
54
+ /** What the fake server answers, and what it was asked. */
55
+ interface Server {
56
+ readonly verdict: () => Promise<boolean>;
57
+ readonly orgs: readonly Organization[];
58
+ readonly checks: CheckMyPermissionInput[];
59
+ readonly listedOrgs: string[];
60
+ }
61
+
62
+ function newServer(
63
+ verdict: () => Promise<boolean>,
64
+ orgs: readonly Organization[] = [ACME],
65
+ ): Server {
66
+ return { verdict, orgs, checks: [], listedOrgs: [] };
67
+ }
68
+
69
+ const never = () => new Promise<boolean>(() => {});
70
+
71
+ /**
72
+ * Answers after a macrotask, as a real network does: the gate renders its
73
+ * in-flight state before the verdict lands. An answer that lands within
74
+ * the same flush would hide a gate that mounts its content early.
75
+ */
76
+ const answerLater = (verdict: boolean) => () =>
77
+ new Promise<boolean>((resolve) => setTimeout(() => resolve(verdict), 0));
78
+
79
+ function renderSection(mode: DeploymentMode, server: Server) {
80
+ const client = new Stigmer({
81
+ baseUrl: "/",
82
+ getAccessToken: () => "test-token",
83
+ customTransport: createRouterTransport((router) => {
84
+ router.service(OrganizationQueryController, {
85
+ findMyOrganizations: () => create(OrganizationsSchema, { entries: [...server.orgs] }),
86
+ });
87
+ router.service(IamPolicyQueryController, {
88
+ checkMyPermission: async (input) => {
89
+ server.checks.push(input);
90
+ return create(CheckAuthorizationResultSchema, {
91
+ isAuthorized: await server.verdict(),
92
+ });
93
+ },
94
+ });
95
+ router.service(InvitationQueryController, {
96
+ listByOrg: (input) => {
97
+ server.listedOrgs.push(input.org);
98
+ return create(InvitationsSchema, {});
99
+ },
100
+ });
101
+ }),
102
+ });
103
+ return render(
104
+ <StigmerContext.Provider value={client}>
105
+ <DeploymentModeContext.Provider value={mode}>
106
+ <OrgProvider>
107
+ <InvitationsSection />
108
+ </OrgProvider>
109
+ </DeploymentModeContext.Provider>
110
+ </StigmerContext.Provider>,
111
+ );
112
+ }
113
+
114
+ /** Lets every pending transport call and state update land. */
115
+ async function settle() {
116
+ await act(async () => {
117
+ await new Promise((resolve) => setTimeout(resolve, 0));
118
+ });
119
+ }
120
+
121
+ afterEach(() => {
122
+ cleanup();
123
+ localStorage.clear();
124
+ });
125
+
126
+ describe("InvitationsSection", () => {
127
+ it("says invitations are not served on the open-source edition and asks the server nothing", async () => {
128
+ const server = newServer(async () => true);
129
+ renderSection("local", server);
130
+
131
+ expect(await screen.findByText(/Invitations are not available in local mode/)).toBeTruthy();
132
+ await settle();
133
+ expect(server.checks).toEqual([]);
134
+ expect(server.listedOrgs).toEqual([]);
135
+ });
136
+
137
+ it("asks for an organization, and checks nothing, when none is selected", async () => {
138
+ const server = newServer(async () => true, []);
139
+ renderSection("cloud", server);
140
+ await settle();
141
+
142
+ expect(screen.getByText("Select an organization to manage invitations.")).toBeTruthy();
143
+ expect(server.checks).toEqual([]);
144
+ });
145
+
146
+ it("checks can_grant_access on the organization's id", async () => {
147
+ const server = newServer(async () => true);
148
+ renderSection("cloud", server);
149
+
150
+ await waitFor(() => expect(server.checks).toHaveLength(1));
151
+ const [check] = server.checks;
152
+ expect(check?.resource?.kind).toBe("organization");
153
+ expect(check?.resource?.id).toBe("org_acme");
154
+ expect(check?.relation).toBe("can_grant_access");
155
+ });
156
+
157
+ it("names the organization's admins to a refused caller, offers nothing, and never lists", async () => {
158
+ const server = newServer(answerLater(false));
159
+ renderSection("cloud", server);
160
+
161
+ expect(await screen.findByText(MANAGED_BY_ADMINS)).toBeTruthy();
162
+ await settle();
163
+ expect(screen.queryByRole("button", { name: /Create invite link/ })).toBeNull();
164
+ expect(server.listedOrgs).toEqual([]);
165
+ });
166
+
167
+ it("gives an allowed caller the manager, which lists the organization once", async () => {
168
+ const server = newServer(answerLater(true));
169
+ renderSection("enterprise", server);
170
+
171
+ expect(await screen.findByRole("button", { name: /Create invite link/ })).toBeTruthy();
172
+ await settle();
173
+ expect(server.listedOrgs).toEqual(["acme"]);
174
+ expect(screen.queryByText(MANAGED_BY_ADMINS)).toBeNull();
175
+ });
176
+
177
+ it("shows neither answer while the check is in flight", async () => {
178
+ const server = newServer(never);
179
+ renderSection("cloud", server);
180
+
181
+ await waitFor(() => expect(server.checks).toHaveLength(1));
182
+ await settle();
183
+ expect(screen.queryByText(MANAGED_BY_ADMINS)).toBeNull();
184
+ expect(screen.queryByRole("button", { name: /Create invite link/ })).toBeNull();
185
+ expect(server.listedOrgs).toEqual([]);
186
+ });
187
+
188
+ it("keeps the manager when the check itself fails", async () => {
189
+ const server = newServer(async () => {
190
+ throw new ConnectError("authorization unavailable", Code.Unavailable);
191
+ });
192
+ renderSection("cloud", server);
193
+
194
+ expect(await screen.findByRole("button", { name: /Create invite link/ })).toBeTruthy();
195
+ expect(screen.queryByText(MANAGED_BY_ADMINS)).toBeNull();
196
+ });
197
+ });