@hexclave/js 1.0.49 → 1.0.52

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.
Files changed (116) hide show
  1. package/dist/{admin-app-impl-Du4dsPO9.d.ts → admin-app-impl-DHs4il4z.d.ts} +5 -2
  2. package/dist/{admin-app-impl-Du4dsPO9.d.ts.map → admin-app-impl-DHs4il4z.d.ts.map} +1 -1
  3. package/dist/clickmap/clickmap-core.d.ts +1 -1
  4. package/dist/clickmap/index.d.ts +1 -1
  5. package/dist/{client-app-BgdvwktS.d.ts → client-app-BoOM8rxo.d.ts} +2 -1
  6. package/dist/{client-app-BgdvwktS.d.ts.map → client-app-BoOM8rxo.d.ts.map} +1 -1
  7. package/dist/common-CRu2FsO9.d.ts.map +1 -1
  8. package/dist/dev-tool/dev-tool-core.d.ts +1 -1
  9. package/dist/dev-tool/dev-tool-core.d.ts.map +1 -1
  10. package/dist/dev-tool/dev-tool-core.js +58 -28
  11. package/dist/dev-tool/dev-tool-core.js.map +1 -1
  12. package/dist/dev-tool/dev-tool-styles.js +35 -0
  13. package/dist/dev-tool/dev-tool-styles.js.map +1 -1
  14. package/dist/dev-tool/index.d.ts +1 -1
  15. package/dist/esm/dev-tool/dev-tool-core.d.ts.map +1 -1
  16. package/dist/esm/dev-tool/dev-tool-core.js +58 -28
  17. package/dist/esm/dev-tool/dev-tool-core.js.map +1 -1
  18. package/dist/esm/dev-tool/dev-tool-styles.js +35 -0
  19. package/dist/esm/dev-tool/dev-tool-styles.js.map +1 -1
  20. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -0
  21. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
  22. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js +97 -0
  23. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
  24. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +1 -0
  25. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts.map +1 -1
  26. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js +26 -1
  27. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
  28. package/dist/esm/lib/hexclave-app/apps/implementations/common.d.ts.map +1 -1
  29. package/dist/esm/lib/hexclave-app/apps/implementations/common.js +21 -4
  30. package/dist/esm/lib/hexclave-app/apps/implementations/common.js.map +1 -1
  31. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-back-state.d.ts +37 -0
  32. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-back-state.d.ts.map +1 -0
  33. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-back-state.js +89 -0
  34. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-back-state.js.map +1 -0
  35. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-back-state.test.d.ts +1 -0
  36. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-back-state.test.js +134 -0
  37. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-back-state.test.js.map +1 -0
  38. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-loop-breaker.d.ts +8 -0
  39. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-loop-breaker.d.ts.map +1 -0
  40. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-loop-breaker.js +73 -0
  41. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-loop-breaker.js.map +1 -0
  42. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-loop-breaker.test.d.ts +1 -0
  43. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-loop-breaker.test.js +92 -0
  44. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-loop-breaker.test.js.map +1 -0
  45. package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +1 -0
  46. package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.d.ts.map +1 -1
  47. package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.js +24 -3
  48. package/dist/esm/lib/hexclave-app/apps/implementations/server-app-impl.js.map +1 -1
  49. package/dist/esm/lib/hexclave-app/apps/interfaces/client-app.d.ts +1 -0
  50. package/dist/esm/lib/hexclave-app/apps/interfaces/client-app.d.ts.map +1 -1
  51. package/dist/esm/lib/hexclave-app/apps/interfaces/client-app.js.map +1 -1
  52. package/dist/esm/pushed-config-error-overlay/index.js +1 -1
  53. package/dist/esm/pushed-config-error-overlay/index.js.map +1 -1
  54. package/dist/esm/pushed-config-error-overlay/index.test.js +1 -1
  55. package/dist/esm/utils/session-storage.d.ts +12 -0
  56. package/dist/esm/utils/session-storage.d.ts.map +1 -0
  57. package/dist/esm/utils/session-storage.js +30 -0
  58. package/dist/esm/utils/session-storage.js.map +1 -0
  59. package/dist/index.d.ts +1 -1
  60. package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -1
  61. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js +97 -0
  62. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
  63. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +1 -1
  64. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js +26 -1
  65. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
  66. package/dist/lib/hexclave-app/apps/implementations/common.js +21 -4
  67. package/dist/lib/hexclave-app/apps/implementations/common.js.map +1 -1
  68. package/dist/lib/hexclave-app/apps/implementations/index.d.ts +1 -1
  69. package/dist/lib/hexclave-app/apps/implementations/redirect-back-state.d.ts +37 -0
  70. package/dist/lib/hexclave-app/apps/implementations/redirect-back-state.d.ts.map +1 -0
  71. package/dist/lib/hexclave-app/apps/implementations/redirect-back-state.js +92 -0
  72. package/dist/lib/hexclave-app/apps/implementations/redirect-back-state.js.map +1 -0
  73. package/dist/lib/hexclave-app/apps/implementations/redirect-back-state.test.d.ts +1 -0
  74. package/dist/lib/hexclave-app/apps/implementations/redirect-back-state.test.js +133 -0
  75. package/dist/lib/hexclave-app/apps/implementations/redirect-back-state.test.js.map +1 -0
  76. package/dist/lib/hexclave-app/apps/implementations/redirect-loop-breaker.d.ts +8 -0
  77. package/dist/lib/hexclave-app/apps/implementations/redirect-loop-breaker.d.ts.map +1 -0
  78. package/dist/lib/hexclave-app/apps/implementations/redirect-loop-breaker.js +74 -0
  79. package/dist/lib/hexclave-app/apps/implementations/redirect-loop-breaker.js.map +1 -0
  80. package/dist/lib/hexclave-app/apps/implementations/redirect-loop-breaker.test.d.ts +1 -0
  81. package/dist/lib/hexclave-app/apps/implementations/redirect-loop-breaker.test.js +91 -0
  82. package/dist/lib/hexclave-app/apps/implementations/redirect-loop-breaker.test.js.map +1 -0
  83. package/dist/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +1 -1
  84. package/dist/lib/hexclave-app/apps/implementations/server-app-impl.js +24 -3
  85. package/dist/lib/hexclave-app/apps/implementations/server-app-impl.js.map +1 -1
  86. package/dist/lib/hexclave-app/apps/index.d.ts +1 -1
  87. package/dist/lib/hexclave-app/apps/interfaces/admin-app.d.ts +1 -1
  88. package/dist/lib/hexclave-app/apps/interfaces/client-app.d.ts +1 -1
  89. package/dist/lib/hexclave-app/apps/interfaces/client-app.js.map +1 -1
  90. package/dist/lib/hexclave-app/apps/interfaces/server-app.d.ts +1 -1
  91. package/dist/lib/hexclave-app/index.d.ts +1 -1
  92. package/dist/lib/hexclave-app/projects/index.d.ts +1 -1
  93. package/dist/lib/hexclave-app/teams/index.d.ts +1 -1
  94. package/dist/lib/hexclave-app/users/index.d.ts +1 -1
  95. package/dist/pushed-config-error-overlay/index.d.ts +1 -1
  96. package/dist/pushed-config-error-overlay/index.js +1 -1
  97. package/dist/pushed-config-error-overlay/index.js.map +1 -1
  98. package/dist/pushed-config-error-overlay/index.test.js +1 -1
  99. package/dist/utils/session-storage.d.ts +12 -0
  100. package/dist/utils/session-storage.d.ts.map +1 -0
  101. package/dist/utils/session-storage.js +33 -0
  102. package/dist/utils/session-storage.js.map +1 -0
  103. package/package.json +2 -2
  104. package/src/dev-tool/dev-tool-core.ts +100 -35
  105. package/src/dev-tool/dev-tool-styles.ts +35 -0
  106. package/src/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.ts +127 -0
  107. package/src/lib/hexclave-app/apps/implementations/client-app-impl.ts +34 -1
  108. package/src/lib/hexclave-app/apps/implementations/common.ts +18 -1
  109. package/src/lib/hexclave-app/apps/implementations/redirect-back-state.test.ts +134 -0
  110. package/src/lib/hexclave-app/apps/implementations/redirect-back-state.ts +140 -0
  111. package/src/lib/hexclave-app/apps/implementations/redirect-loop-breaker.test.ts +127 -0
  112. package/src/lib/hexclave-app/apps/implementations/redirect-loop-breaker.ts +117 -0
  113. package/src/lib/hexclave-app/apps/implementations/server-app-impl.ts +27 -2
  114. package/src/lib/hexclave-app/apps/interfaces/client-app.ts +1 -0
  115. package/src/pushed-config-error-overlay/index.ts +1 -1
  116. package/src/utils/session-storage.ts +45 -0
@@ -0,0 +1,91 @@
1
+ let vitest = require("vitest");
2
+ let __redirect_loop_breaker_js = require("./redirect-loop-breaker.js");
3
+ //#region src/lib/hexclave-app/apps/implementations/redirect-loop-breaker.test.ts
4
+ function createMockSessionStorage() {
5
+ const map = /* @__PURE__ */ new Map();
6
+ return {
7
+ getItem: (key) => map.get(key) ?? null,
8
+ setItem: (key, value) => {
9
+ map.set(key, value);
10
+ },
11
+ removeItem: (key) => {
12
+ map.delete(key);
13
+ }
14
+ };
15
+ }
16
+ const previousWindow = Reflect.get(globalThis, "window");
17
+ const hadPreviousWindow = Reflect.has(globalThis, "window");
18
+ function record(from, to) {
19
+ (0, __redirect_loop_breaker_js.recordRedirectAndThrowIfLoopDetected)({
20
+ currentUrl: new URL(from),
21
+ targetUrl: new URL(to)
22
+ });
23
+ }
24
+ (0, vitest.describe)("recordRedirectAndThrowIfLoopDetected", () => {
25
+ (0, vitest.beforeEach)(() => {
26
+ Reflect.set(globalThis, "window", { sessionStorage: createMockSessionStorage() });
27
+ vitest.vi.useFakeTimers();
28
+ vitest.vi.setSystemTime(/* @__PURE__ */ new Date("2026-01-01T00:00:00Z"));
29
+ });
30
+ (0, vitest.afterEach)(() => {
31
+ vitest.vi.useRealTimers();
32
+ if (hadPreviousWindow) Reflect.set(globalThis, "window", previousWindow);
33
+ else Reflect.deleteProperty(globalThis, "window");
34
+ });
35
+ (0, vitest.it)("allows distinct redirects in quick succession", () => {
36
+ for (let i = 0; i < 20; i++) record(`https://app.example.test/page-${i}`, `https://app.example.test/page-${i + 1}`);
37
+ });
38
+ (0, vitest.it)("throws once the same redirect repeats 5 times within the window", () => {
39
+ for (let i = 0; i < 4; i++) {
40
+ record("https://app.example.test/dashboard", "https://hosted.example.test/handler/sign-in");
41
+ vitest.vi.advanceTimersByTime(1e3);
42
+ }
43
+ (0, vitest.expect)(() => {
44
+ record("https://app.example.test/dashboard", "https://hosted.example.test/handler/sign-in");
45
+ }).toThrowError(/Redirect loop detected/);
46
+ });
47
+ (0, vitest.it)("treats redirects that differ only in query params or hash as identical", () => {
48
+ for (let i = 0; i < 4; i++) record(`https://app.example.test/dashboard?code=code-${i}`, `https://hosted.example.test/handler/sign-in?state=state-${i}#frag-${i}`);
49
+ (0, vitest.expect)(() => {
50
+ record("https://app.example.test/dashboard?code=final", "https://hosted.example.test/handler/sign-in?state=final");
51
+ }).toThrowError(/Redirect loop detected/);
52
+ });
53
+ (0, vitest.it)("does not throw when the identical redirects are spread out beyond the window", () => {
54
+ for (let i = 0; i < 20; i++) {
55
+ record("https://app.example.test/dashboard", "https://hosted.example.test/handler/sign-in");
56
+ vitest.vi.advanceTimersByTime(31e3);
57
+ }
58
+ });
59
+ (0, vitest.it)("allows the same redirect again after a loop was broken", () => {
60
+ for (let i = 0; i < 4; i++) record("https://app.example.test/dashboard", "https://hosted.example.test/handler/sign-in");
61
+ (0, vitest.expect)(() => {
62
+ record("https://app.example.test/dashboard", "https://hosted.example.test/handler/sign-in");
63
+ }).toThrowError(/Redirect loop detected/);
64
+ record("https://app.example.test/dashboard", "https://hosted.example.test/handler/sign-in");
65
+ });
66
+ (0, vitest.it)("counts self-redirects (same origin and path) towards loops", () => {
67
+ for (let i = 0; i < 4; i++) record(`https://hosted.example.test/handler/sign-in?attempt=${i}`, "https://hosted.example.test/handler/sign-in");
68
+ (0, vitest.expect)(() => {
69
+ record("https://hosted.example.test/handler/sign-in?attempt=final", "https://hosted.example.test/handler/sign-in");
70
+ }).toThrowError(/Redirect loop detected/);
71
+ });
72
+ (0, vitest.it)("degrades to a no-op when sessionStorage is unavailable", () => {
73
+ Reflect.set(globalThis, "window", { get sessionStorage() {
74
+ throw new Error("Storage is disabled");
75
+ } });
76
+ for (let i = 0; i < 20; i++) record("https://app.example.test/dashboard", "https://hosted.example.test/handler/sign-in");
77
+ });
78
+ (0, vitest.it)("recovers from corrupted breadcrumb storage", () => {
79
+ const storage = createMockSessionStorage();
80
+ storage.setItem("hexclave-redirect-loop-breadcrumbs", "{not json");
81
+ Reflect.set(globalThis, "window", { sessionStorage: storage });
82
+ record("https://app.example.test/dashboard", "https://hosted.example.test/handler/sign-in");
83
+ for (let i = 0; i < 3; i++) record("https://app.example.test/dashboard", "https://hosted.example.test/handler/sign-in");
84
+ (0, vitest.expect)(() => {
85
+ record("https://app.example.test/dashboard", "https://hosted.example.test/handler/sign-in");
86
+ }).toThrowError(/Redirect loop detected/);
87
+ });
88
+ });
89
+ //#endregion
90
+
91
+ //# sourceMappingURL=redirect-loop-breaker.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redirect-loop-breaker.test.js","names":[],"sources":["../../../../../src/lib/hexclave-app/apps/implementations/redirect-loop-breaker.test.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { recordRedirectAndThrowIfLoopDetected } from \"./redirect-loop-breaker\";\n\nfunction createMockSessionStorage() {\n const map = new Map<string, string>();\n return {\n getItem: (key: string) => map.get(key) ?? null,\n setItem: (key: string, value: string) => {\n map.set(key, value);\n },\n removeItem: (key: string) => {\n map.delete(key);\n },\n };\n}\n\nconst previousWindow = Reflect.get(globalThis, \"window\");\nconst hadPreviousWindow = Reflect.has(globalThis, \"window\");\n\nfunction record(from: string, to: string) {\n recordRedirectAndThrowIfLoopDetected({\n currentUrl: new URL(from),\n targetUrl: new URL(to),\n });\n}\n\ndescribe(\"recordRedirectAndThrowIfLoopDetected\", () => {\n beforeEach(() => {\n Reflect.set(globalThis, \"window\", { sessionStorage: createMockSessionStorage() });\n vi.useFakeTimers();\n vi.setSystemTime(new Date(\"2026-01-01T00:00:00Z\"));\n });\n\n afterEach(() => {\n vi.useRealTimers();\n if (hadPreviousWindow) {\n Reflect.set(globalThis, \"window\", previousWindow);\n } else {\n Reflect.deleteProperty(globalThis, \"window\");\n }\n });\n\n it(\"allows distinct redirects in quick succession\", () => {\n for (let i = 0; i < 20; i++) {\n record(`https://app.example.test/page-${i}`, `https://app.example.test/page-${i + 1}`);\n }\n });\n\n it(\"throws once the same redirect repeats 5 times within the window\", () => {\n for (let i = 0; i < 4; i++) {\n record(\"https://app.example.test/dashboard\", \"https://hosted.example.test/handler/sign-in\");\n vi.advanceTimersByTime(1000);\n }\n expect(() => {\n record(\"https://app.example.test/dashboard\", \"https://hosted.example.test/handler/sign-in\");\n }).toThrowError(/Redirect loop detected/);\n });\n\n it(\"treats redirects that differ only in query params or hash as identical\", () => {\n // Real loops usually rotate nonce-style params (code, state, after_auth_return_to) each cycle.\n for (let i = 0; i < 4; i++) {\n record(\n `https://app.example.test/dashboard?code=code-${i}`,\n `https://hosted.example.test/handler/sign-in?state=state-${i}#frag-${i}`,\n );\n }\n expect(() => {\n record(\"https://app.example.test/dashboard?code=final\", \"https://hosted.example.test/handler/sign-in?state=final\");\n }).toThrowError(/Redirect loop detected/);\n });\n\n it(\"does not throw when the identical redirects are spread out beyond the window\", () => {\n for (let i = 0; i < 20; i++) {\n record(\"https://app.example.test/dashboard\", \"https://hosted.example.test/handler/sign-in\");\n vi.advanceTimersByTime(31_000);\n }\n });\n\n it(\"allows the same redirect again after a loop was broken\", () => {\n for (let i = 0; i < 4; i++) {\n record(\"https://app.example.test/dashboard\", \"https://hosted.example.test/handler/sign-in\");\n }\n expect(() => {\n record(\"https://app.example.test/dashboard\", \"https://hosted.example.test/handler/sign-in\");\n }).toThrowError(/Redirect loop detected/);\n // The breadcrumbs for the broken loop are dropped, so a manual retry isn't instantly blocked.\n record(\"https://app.example.test/dashboard\", \"https://hosted.example.test/handler/sign-in\");\n });\n\n it(\"counts self-redirects (same origin and path) towards loops\", () => {\n for (let i = 0; i < 4; i++) {\n record(`https://hosted.example.test/handler/sign-in?attempt=${i}`, \"https://hosted.example.test/handler/sign-in\");\n }\n expect(() => {\n record(\"https://hosted.example.test/handler/sign-in?attempt=final\", \"https://hosted.example.test/handler/sign-in\");\n }).toThrowError(/Redirect loop detected/);\n });\n\n it(\"degrades to a no-op when sessionStorage is unavailable\", () => {\n Reflect.set(globalThis, \"window\", {\n get sessionStorage(): Storage {\n throw new Error(\"Storage is disabled\");\n },\n });\n for (let i = 0; i < 20; i++) {\n record(\"https://app.example.test/dashboard\", \"https://hosted.example.test/handler/sign-in\");\n }\n });\n\n it(\"recovers from corrupted breadcrumb storage\", () => {\n const storage = createMockSessionStorage();\n storage.setItem(\"hexclave-redirect-loop-breadcrumbs\", \"{not json\");\n Reflect.set(globalThis, \"window\", { sessionStorage: storage });\n record(\"https://app.example.test/dashboard\", \"https://hosted.example.test/handler/sign-in\");\n // After recovery, loop detection works again.\n for (let i = 0; i < 3; i++) {\n record(\"https://app.example.test/dashboard\", \"https://hosted.example.test/handler/sign-in\");\n }\n expect(() => {\n record(\"https://app.example.test/dashboard\", \"https://hosted.example.test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AC;CAED,CAAA,GAAA,OAAA,GAAA,CAAG,oDAAoD;EACrD,MAAM,UAAU,yBAAyB;EACzC,QAAQ,QAAQ,sCAAsC,WAAW;EACjE,QAAQ,IAAI,YAAY,UAAU,EAAE,gBAAgB,QAAQ,CAAC;EAC7D,OAAO,sCAAsC,6CAA6C;EAE1F,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KACrB,OAAO,sCAAsC,6CAA6C;EAE5F,CAAA,GAAA,OAAA,OAAA,OAAa;GACX,OAAO,sCAAsC,6CAA6C;EAC5F,CAAC,CAAC,CAAC,aAAa,wBAAwB;CAC1C,CAAC;AACH,CAAC"}
@@ -1,2 +1,2 @@
1
- import { n as _HexclaveServerAppImplIncomplete } from "../../../../admin-app-impl-Du4dsPO9.js";
1
+ import { n as _HexclaveServerAppImplIncomplete } from "../../../../admin-app-impl-DHs4il4z.js";
2
2
  export { _HexclaveServerAppImplIncomplete };
@@ -4,6 +4,7 @@ let _hexclave_shared = require("@hexclave/shared");
4
4
  let _hexclave_shared_dist_utils_results = require("@hexclave/shared/dist/utils/results");
5
5
  let __common_js = require("./common.js");
6
6
  let _hexclave_shared_dist_sessions = require("@hexclave/shared/dist/sessions");
7
+ let _hexclave_shared_dist_utils_uuids = require("@hexclave/shared/dist/utils/uuids");
7
8
  let _simplewebauthn_browser = require("@simplewebauthn/browser");
8
9
  let ____________utils_url_js = require("../../../../utils/url.js");
9
10
  let ______api_keys_index_js = require("../../api-keys/index.js");
@@ -217,6 +218,15 @@ var _HexclaveServerAppImplIncomplete = class extends __client_app_impl_js._Hexcl
217
218
  query
218
219
  });
219
220
  });
221
+ this._serverTeamCache = (0, __common_js.createCache)(async ([teamId]) => {
222
+ if (!(0, _hexclave_shared_dist_utils_uuids.isUuid)(teamId)) return null;
223
+ try {
224
+ return await this._interface.getServerTeam(teamId);
225
+ } catch (error) {
226
+ if (_hexclave_shared.KnownErrors.TeamNotFound.isInstance(error)) return null;
227
+ throw error;
228
+ }
229
+ });
220
230
  this._serverUserTeamInvitationsCache = (0, __common_js.createCache)(async ([userId]) => {
221
231
  return await this._interface.listServerUserTeamInvitations(userId);
222
232
  });
@@ -710,11 +720,19 @@ var _HexclaveServerAppImplIncomplete = class extends __client_app_impl_js._Hexcl
710
720
  serverMetadata: crud.server_metadata,
711
721
  async update(update) {
712
722
  await app._interface.updateServerTeam(crud.id, (0, ______teams_index_js.serverTeamUpdateOptionsToCrud)(update));
713
- await Promise.all([app._serverTeamsCache.refreshWhere(() => true), app._serverUsersCache.refreshWhere(() => true)]);
723
+ await Promise.all([
724
+ app._serverTeamCache.refresh([crud.id]),
725
+ app._serverTeamsCache.refreshWhere(() => true),
726
+ app._serverUsersCache.refreshWhere(() => true)
727
+ ]);
714
728
  },
715
729
  async delete() {
716
730
  await app._interface.deleteServerTeam(crud.id);
717
- await Promise.all([app._serverTeamsCache.refreshWhere(() => true), app._serverUsersCache.refreshWhere(() => true)]);
731
+ await Promise.all([
732
+ app._serverTeamCache.refresh([crud.id]),
733
+ app._serverTeamsCache.refreshWhere(() => true),
734
+ app._serverUsersCache.refreshWhere(() => true)
735
+ ]);
718
736
  },
719
737
  async listUsers() {
720
738
  return _hexclave_shared_dist_utils_results.Result.orThrow(await app._serverTeamMemberProfilesCache.getOrWait([crud.id], "write-only")).map((u) => app._serverTeamUserFromCrud(u));
@@ -1011,6 +1029,7 @@ var _HexclaveServerAppImplIncomplete = class extends __client_app_impl_js._Hexcl
1011
1029
  }
1012
1030
  async createTeam(data) {
1013
1031
  const team = await this._interface.createServerTeam((0, ______teams_index_js.serverTeamCreateOptionsToCrud)(data));
1032
+ await this._serverTeamCache.refresh([team.id]);
1014
1033
  await this._serverTeamsCache.refreshWhere(() => true);
1015
1034
  return this._serverTeamFromCrud(team);
1016
1035
  }
@@ -1038,7 +1057,9 @@ var _HexclaveServerAppImplIncomplete = class extends __client_app_impl_js._Hexcl
1038
1057
  if (typeof options === "object" && "apiKey" in options) return await this._getTeamByApiKey(options.apiKey);
1039
1058
  else {
1040
1059
  const teamId = options;
1041
- return (await this.listTeams()).find((t) => t.id === teamId) ?? null;
1060
+ if (teamId == null) return null;
1061
+ const team = _hexclave_shared_dist_utils_results.Result.orThrow(await this._serverTeamCache.getOrWait([teamId], "write-only"));
1062
+ return team == null ? null : this._serverTeamFromCrud(team);
1042
1063
  }
1043
1064
  }
1044
1065
  _createServerDataVaultStore(id) {