@burdenoff/fe-libs 2026.1112.6 → 2026.1113.1

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.
@@ -143,6 +143,22 @@ export declare function matchPermission(userPermission: string, requiredPermissi
143
143
  * Check if any user permission matches the required permission
144
144
  */
145
145
  export declare function hasMatchingPermission(userPermissions: string[], requiredPermission: string): boolean;
146
+ /** Answers `hasMatchingPermission(userPermissions, required)` for one fixed permission set. */
147
+ export type PermissionMatcher = (requiredPermission: string) => boolean;
148
+ /**
149
+ * Precomputes `hasMatchingPermission` for one permission set (BOFF-12118).
150
+ *
151
+ * Every permission check used to split every permission string the person holds
152
+ * and the required one, for every check: a page renders hundreds of checks
153
+ * against a set of a few hundred permissions, about 30 ms of a cold FluidGrids
154
+ * builder load. The matcher indexes the set once (exact strings, the global
155
+ * wildcard, and the actions held per resource, `*` included) and remembers
156
+ * each answer, so a check is a couple of lookups. It answers exactly what
157
+ * `hasMatchingPermission` answers, including the edge cases of
158
+ * `matchPermission` (only the first two `:`-separated parts count; a required
159
+ * `resource:*` is met by any permission on the resource).
160
+ */
161
+ export declare function createPermissionMatcher(userPermissions: readonly string[]): PermissionMatcher;
146
162
  /**
147
163
  * Determine whether a user should bypass RBAC checks based on their
148
164
  * authenticated role. Exported as a pure function so it can be unit
@@ -55,16 +55,37 @@ function _(e, t) {
55
55
  function v(e, t) {
56
56
  return e.some((e) => _(e, t));
57
57
  }
58
- function y(e, t, n) {
58
+ function y(e) {
59
+ let t = new Set(e), n = t.has("*"), r = /* @__PURE__ */ new Map();
60
+ for (let t of e) {
61
+ let [e = "", n] = t.split(":"), i = r.get(e);
62
+ i || (i = {
63
+ anyAction: !1,
64
+ actions: /* @__PURE__ */ new Set()
65
+ }, r.set(e, i)), n === "*" && (i.anyAction = !0), i.actions.add(n);
66
+ }
67
+ let i = (e, t) => e !== void 0 && (e.anyAction || t === "*" || e.actions.has(t)), a = /* @__PURE__ */ new Map();
68
+ return (e) => {
69
+ let o = a.get(e);
70
+ if (o !== void 0) return o;
71
+ let s = n || t.has(e);
72
+ if (!s) {
73
+ let [t = "", n] = e.split(":");
74
+ s = i(r.get(t), n) || i(r.get("*"), n);
75
+ }
76
+ return a.set(e, s), s;
77
+ };
78
+ }
79
+ function b(e, t, n) {
59
80
  return e && (t === "SUPER_ADMIN" || n === "super_admin");
60
81
  }
61
- function b(e) {
82
+ function x(e) {
62
83
  if (!e || typeof e != "object") return null;
63
84
  let t = e;
64
85
  return typeof t.actorType == "string" ? t.actorType : typeof t.actor_type == "string" ? t.actor_type : null;
65
86
  }
66
- function x({ children: n, scopeId: r, gateway: f = "workspace", staleTime: p = 3e5, refetchInterval: _ = 3e5, refetchOnFocusStaleTime: x = 12e4, emptyPermissionsRefetchInterval: S = 5e3, emptyPermissionsCatchupWindow: C = 18e4, debug: w = !1 }) {
67
- let { isAuthenticated: T, tokens: E, workspaceToken: D, user: O } = e(), k = u(), A = y(T, O?.role, b(O)), j = f === "workspace" ? D ? D.slice(-16) : "missing" : "n/a", M = o(() => [
87
+ function S({ children: n, scopeId: r, gateway: f = "workspace", staleTime: p = 3e5, refetchInterval: _ = 3e5, refetchOnFocusStaleTime: v = 12e4, emptyPermissionsRefetchInterval: S = 5e3, emptyPermissionsCatchupWindow: C = 18e4, debug: w = !1 }) {
88
+ let { isAuthenticated: T, tokens: E, workspaceToken: D, user: O } = e(), k = u(), A = b(T, O?.role, x(O)), j = f === "workspace" ? D ? D.slice(-16) : "missing" : "n/a", M = o(() => [
68
89
  "permissions",
69
90
  f,
70
91
  r,
@@ -106,7 +127,7 @@ function x({ children: n, scopeId: r, gateway: f = "workspace", staleTime: p = 3
106
127
  },
107
128
  refetchOnWindowFocus: (e) => {
108
129
  let t = e.state.dataUpdatedAt;
109
- return Date.now() - t > x;
130
+ return Date.now() - t > v;
110
131
  },
111
132
  refetchOnReconnect: !0,
112
133
  retry: 2,
@@ -129,34 +150,34 @@ function x({ children: n, scopeId: r, gateway: f = "workspace", staleTime: p = 3
129
150
  P,
130
151
  B
131
152
  ]);
132
- let V = P ? L ?? null : null, H = i((e) => A ? !0 : V?.permissionStrings ? v(V.permissionStrings, e) : !1, [V?.permissionStrings, A]), U = i((e, t) => {
153
+ let V = P ? L ?? null : null, H = V?.permissionStrings, U = o(() => H ? y(H) : null, [H]), W = i((e) => A ? !0 : U ? U(e) : !1, [U, A]), G = i((e, t) => {
133
154
  if (A) return !0;
134
- if (!V?.permissionStrings) return !1;
155
+ if (!U) return !1;
135
156
  let { requireAll: n = !1 } = t ?? {};
136
- return n ? e.every((e) => v(V.permissionStrings, e)) : e.some((e) => v(V.permissionStrings, e));
137
- }, [V?.permissionStrings, A]), W = i((e) => A ? !0 : V?.roles ? V.roles.includes(e) : !1, [V?.roles, A]), G = i((e) => A ? !0 : V?.roles ? e.some((e) => V.roles.includes(e)) : !1, [V?.roles, A]), K = i((e) => A ? !0 : V?.roles ? e.every((e) => V.roles.includes(e)) : !1, [V?.roles, A]), q = i(async () => {
157
+ return n ? e.every(U) : e.some(U);
158
+ }, [U, A]), K = i((e) => A ? !0 : V?.roles ? V.roles.includes(e) : !1, [V?.roles, A]), q = i((e) => A ? !0 : V?.roles ? e.some((e) => V.roles.includes(e)) : !1, [V?.roles, A]), J = i((e) => A ? !0 : V?.roles ? e.every((e) => V.roles.includes(e)) : !1, [V?.roles, A]), Y = i(async () => {
138
159
  P && await B();
139
160
  }, [
140
161
  B,
141
162
  w,
142
163
  P
143
- ]), J = i(async () => {
164
+ ]), X = i(async () => {
144
165
  await k.invalidateQueries({ queryKey: M });
145
166
  }, [
146
167
  k,
147
168
  M,
148
169
  w
149
- ]), Y = o(() => ({
170
+ ]), Z = o(() => ({
150
171
  permissions: V,
151
172
  isLoading: !A && z,
152
173
  error: A ? null : R,
153
- hasPermission: H,
154
- hasPermissions: U,
155
- hasRole: W,
156
- hasAnyRole: G,
157
- hasAllRoles: K,
158
- refreshPermissions: q,
159
- invalidatePermissions: J,
174
+ hasPermission: W,
175
+ hasPermissions: G,
176
+ hasRole: K,
177
+ hasAnyRole: q,
178
+ hasAllRoles: J,
179
+ refreshPermissions: Y,
180
+ invalidatePermissions: X,
160
181
  scopeId: r,
161
182
  isSuperAdmin: A,
162
183
  query: I
@@ -166,38 +187,38 @@ function x({ children: n, scopeId: r, gateway: f = "workspace", staleTime: p = 3
166
187
  I,
167
188
  R,
168
189
  z,
169
- H,
170
- U,
171
190
  W,
172
191
  G,
173
192
  K,
174
193
  q,
175
194
  J,
195
+ Y,
196
+ X,
176
197
  r
177
198
  ]);
178
199
  return /* @__PURE__ */ c(d.Provider, {
179
- value: Y,
200
+ value: Z,
180
201
  children: n
181
202
  });
182
203
  }
183
- function S() {
204
+ function C() {
184
205
  let e = r(d);
185
206
  if (!e) throw Error("usePermissions must be used within a PermissionProvider");
186
207
  return e;
187
208
  }
188
- function C() {
209
+ function w() {
189
210
  return r(d);
190
211
  }
191
- function w(e) {
192
- let { hasPermission: t, isLoading: n } = S();
212
+ function T(e) {
213
+ let { hasPermission: t, isLoading: n } = C();
193
214
  return !n && t(e);
194
215
  }
195
- function T(e) {
196
- let { hasRole: t, isLoading: n } = S();
216
+ function E(e) {
217
+ let { hasRole: t, isLoading: n } = C();
197
218
  return !n && t(e);
198
219
  }
199
- function E() {
200
- let { isLoading: e } = S();
220
+ function D() {
221
+ let { isLoading: e } = C();
201
222
  return e;
202
223
  }
203
- export { x as PermissionProvider, p as SUPER_ADMIN_ACTOR_TYPE, f as SUPER_ADMIN_ROLE, v as hasMatchingPermission, y as isSuperAdminBypass, _ as matchPermission, g as resolvePermissionsRefetchInterval, w as usePermission, E as usePermissionLoading, S as usePermissions, T as useRole, C as useSafePermissions };
224
+ export { S as PermissionProvider, p as SUPER_ADMIN_ACTOR_TYPE, f as SUPER_ADMIN_ROLE, y as createPermissionMatcher, v as hasMatchingPermission, b as isSuperAdminBypass, _ as matchPermission, g as resolvePermissionsRefetchInterval, T as usePermission, D as usePermissionLoading, C as usePermissions, E as useRole, w as useSafePermissions };
@@ -25,7 +25,7 @@ export { ContextManagerProvider, useContextManager } from './ContextManagerProvi
25
25
  export type { ContextManagerValue, ContextManagerProviderProps } from './ContextManagerProvider';
26
26
  export { GeographyProvider, useGeography } from '../../geography/GeographyProvider';
27
27
  export type { GeographyContextValue, GeographyProviderProps, } from '../../geography/GeographyProvider';
28
- export { PermissionProvider, usePermissions, useSafePermissions, usePermission, useRole, usePermissionLoading, matchPermission, hasMatchingPermission, isSuperAdminBypass, SUPER_ADMIN_ROLE, SUPER_ADMIN_ACTOR_TYPE, } from './PermissionProvider';
28
+ export { PermissionProvider, usePermissions, useSafePermissions, usePermission, useRole, usePermissionLoading, matchPermission, hasMatchingPermission, createPermissionMatcher, isSuperAdminBypass, SUPER_ADMIN_ROLE, SUPER_ADMIN_ACTOR_TYPE, } from './PermissionProvider';
29
29
  export type { EffectivePermissions, EffectiveResourcePermission, MyRolesResult, RoleInfo, PermissionCheckOptions, PermissionContextValue, PermissionProviderProps, } from './PermissionProvider';
30
30
  export { PersonaSurfaceProvider, usePersonaSurface, useSafePersonaSurface, resolveSurfaceForRoles, synthesizeSimulatedPermissionStrings, EVERYTHING_SURFACE_ID, } from './PersonaSurfaceProvider';
31
31
  export type { PersonaSurfaceDefinition, PersonaSurfaceContextValue, PersonaSurfaceProviderProps, PersonaCustomView, NavItemOverrideState, SimulatableRole, SimulationState, } from './PersonaSurfaceProvider';
@@ -14,17 +14,17 @@ import { FeatureFlagProvider as z } from "./shared/feature-flags/FeatureFlagProv
14
14
  import { useFeatureFlag as B, useFeatureFlagDetails as V, useFeatureFlagValue as H } from "./shared/feature-flags/useFeatureFlag.js";
15
15
  import { FeatureGate as U } from "./shared/feature-flags/FeatureGate.js";
16
16
  import { GeographyProvider as W, useGeography as G } from "./shared/geography/GeographyProvider.js";
17
- import { PermissionProvider as K, SUPER_ADMIN_ACTOR_TYPE as q, SUPER_ADMIN_ROLE as J, hasMatchingPermission as Y, isSuperAdminBypass as X, matchPermission as Z, usePermission as Q, usePermissionLoading as $, usePermissions as ee, useRole as te, useSafePermissions as ne } from "./shared/providers/shell/PermissionProvider.js";
18
- import { EVERYTHING_SURFACE_ID as re, PersonaSurfaceProvider as ie, resolveSurfaceForRoles as ae, synthesizeSimulatedPermissionStrings as oe, usePersonaSurface as se, useSafePersonaSurface as ce } from "./shared/providers/shell/PersonaSurfaceProvider.js";
19
- import { AuthTokenProvider as le, useAuthToken as ue, useAuthTokenOrNull as de } from "./shared/providers/shell/AuthTokenProvider.js";
20
- import { MultiGatewayProvider as fe } from "./shared/providers/shell/MultiGatewayProvider.js";
21
- import { ObservabilityProvider as pe } from "./shared/providers/shell/ObservabilityProvider.js";
22
- import { RYBBIT_TRACK_ENDPOINT as me, buildCrashReport as he, crashReportingConsentGranted as ge, createCrashReportingPipeline as _e, createRybbitCrashReporter as ve, detectCrashReportPlatform as ye, reportError as be, setActiveCrashReportingPipeline as xe } from "./shared/providers/shell/crashReporting.js";
23
- import { maskRoute as Se, scrubTelemetryText as Ce } from "./shared/events/sinks/telemetryScrub.js";
24
- import { GatewayRoute as we, getMicrofrontendGateway as Te, withGateway as Ee } from "./shared/providers/shell/GatewayRouter.js";
25
- import { ProfileI18nBridge as De } from "./shared/providers/shell/ProfileI18nBridge.js";
26
- import { ProfileGeographyBridge as Oe } from "./shared/providers/shell/ProfileGeographyBridge.js";
27
- import { AppShellContextProvider as ke, useAppShell as Ae } from "./shared/providers/shell/AppShellContext.js";
28
- import { PageConversationContextProvider as je, usePageConversationContext as Me, useRegisterPageConversationContext as Ne } from "./shared/providers/shell/PageConversationContextProvider.js";
29
- import { clearWorkspaceWideSelection as Pe, isWorkspaceWideSelection as Fe, selectWorkspaceWide as Ie } from "./shared/providers/shell/WorkspaceWideSelection.js";
30
- export { O as ActiveContextProvider, ke as AppShellContextProvider, p as AuthBridgeClient, d as AuthProvider, le as AuthTokenProvider, L as ContextManagerProvider, re as EVERYTHING_SURFACE_ID, z as FeatureFlagProvider, j as FeatureFlagsProvider, U as FeatureGate, we as GatewayRoute, W as GeographyProvider, N as GlobalUiProvider, n as I18nProvider, r as LOCALE_DIRECTION, fe as MultiGatewayProvider, pe as ObservabilityProvider, je as PageConversationContextProvider, K as PermissionProvider, ie as PersonaSurfaceProvider, Oe as ProfileGeographyBridge, De as ProfileI18nBridge, v as ProfileStorage, me as RYBBIT_TRACK_ENDPOINT, q as SUPER_ADMIN_ACTOR_TYPE, J as SUPER_ADMIN_ROLE, F as ShellUiProvider, e as ThemeProvider, he as buildCrashReport, y as clearActiveProfileId, i as clearTranslationCache, Pe as clearWorkspaceWideSelection, ge as crashReportingConsentGranted, _e as createCrashReportingPipeline, ve as createRybbitCrashReporter, m as destroyAuthBridge, ye as detectCrashReportPlatform, b as getActiveContext, x as getActiveTokens, S as getActiveUser, h as getAuthBridge, Te as getMicrofrontendGateway, C as getProfileLocale, Y as hasMatchingPermission, g as initAuthBridge, _ as isAuthBridgeInitialized, X as isSuperAdminBypass, a as isTranslationAttempted, Fe as isWorkspaceWideSelection, o as localeDirection, w as logoutActiveProfile, Se as maskRoute, Z as matchPermission, T as removeAllProfiles, be as reportError, ae as resolveSurfaceForRoles, Ce as scrubTelemetryText, Ie as selectWorkspaceWide, xe as setActiveCrashReportingPipeline, E as setProfileLocale, D as setProfiles, oe as synthesizeSimulatedPermissionStrings, k as useActiveContext, A as useActiveContextOrNull, Ae as useAppShell, f as useAuth, ue as useAuthToken, de as useAuthTokenOrNull, R as useContextManager, B as useFeatureFlag, V as useFeatureFlagDetails, H as useFeatureFlagValue, M as useFeatureFlags, G as useGeography, P as useGlobalUi, s as useI18n, c as useOptionalI18n, Me as usePageConversationContext, Q as usePermission, $ as usePermissionLoading, ee as usePermissions, se as usePersonaSurface, Ne as useRegisterPageConversationContext, te as useRole, ne as useSafePermissions, ce as useSafePersonaSurface, l as useShellLabel, u as useShellNumberFormat, I as useShellUi, t as useTheme, Ee as withGateway };
17
+ import { PermissionProvider as K, SUPER_ADMIN_ACTOR_TYPE as q, SUPER_ADMIN_ROLE as J, createPermissionMatcher as Y, hasMatchingPermission as X, isSuperAdminBypass as Z, matchPermission as Q, usePermission as $, usePermissionLoading as ee, usePermissions as te, useRole as ne, useSafePermissions as re } from "./shared/providers/shell/PermissionProvider.js";
18
+ import { EVERYTHING_SURFACE_ID as ie, PersonaSurfaceProvider as ae, resolveSurfaceForRoles as oe, synthesizeSimulatedPermissionStrings as se, usePersonaSurface as ce, useSafePersonaSurface as le } from "./shared/providers/shell/PersonaSurfaceProvider.js";
19
+ import { AuthTokenProvider as ue, useAuthToken as de, useAuthTokenOrNull as fe } from "./shared/providers/shell/AuthTokenProvider.js";
20
+ import { MultiGatewayProvider as pe } from "./shared/providers/shell/MultiGatewayProvider.js";
21
+ import { ObservabilityProvider as me } from "./shared/providers/shell/ObservabilityProvider.js";
22
+ import { RYBBIT_TRACK_ENDPOINT as he, buildCrashReport as ge, crashReportingConsentGranted as _e, createCrashReportingPipeline as ve, createRybbitCrashReporter as ye, detectCrashReportPlatform as be, reportError as xe, setActiveCrashReportingPipeline as Se } from "./shared/providers/shell/crashReporting.js";
23
+ import { maskRoute as Ce, scrubTelemetryText as we } from "./shared/events/sinks/telemetryScrub.js";
24
+ import { GatewayRoute as Te, getMicrofrontendGateway as Ee, withGateway as De } from "./shared/providers/shell/GatewayRouter.js";
25
+ import { ProfileI18nBridge as Oe } from "./shared/providers/shell/ProfileI18nBridge.js";
26
+ import { ProfileGeographyBridge as ke } from "./shared/providers/shell/ProfileGeographyBridge.js";
27
+ import { AppShellContextProvider as Ae, useAppShell as je } from "./shared/providers/shell/AppShellContext.js";
28
+ import { PageConversationContextProvider as Me, usePageConversationContext as Ne, useRegisterPageConversationContext as Pe } from "./shared/providers/shell/PageConversationContextProvider.js";
29
+ import { clearWorkspaceWideSelection as Fe, isWorkspaceWideSelection as Ie, selectWorkspaceWide as Le } from "./shared/providers/shell/WorkspaceWideSelection.js";
30
+ export { O as ActiveContextProvider, Ae as AppShellContextProvider, p as AuthBridgeClient, d as AuthProvider, ue as AuthTokenProvider, L as ContextManagerProvider, ie as EVERYTHING_SURFACE_ID, z as FeatureFlagProvider, j as FeatureFlagsProvider, U as FeatureGate, Te as GatewayRoute, W as GeographyProvider, N as GlobalUiProvider, n as I18nProvider, r as LOCALE_DIRECTION, pe as MultiGatewayProvider, me as ObservabilityProvider, Me as PageConversationContextProvider, K as PermissionProvider, ae as PersonaSurfaceProvider, ke as ProfileGeographyBridge, Oe as ProfileI18nBridge, v as ProfileStorage, he as RYBBIT_TRACK_ENDPOINT, q as SUPER_ADMIN_ACTOR_TYPE, J as SUPER_ADMIN_ROLE, F as ShellUiProvider, e as ThemeProvider, ge as buildCrashReport, y as clearActiveProfileId, i as clearTranslationCache, Fe as clearWorkspaceWideSelection, _e as crashReportingConsentGranted, ve as createCrashReportingPipeline, Y as createPermissionMatcher, ye as createRybbitCrashReporter, m as destroyAuthBridge, be as detectCrashReportPlatform, b as getActiveContext, x as getActiveTokens, S as getActiveUser, h as getAuthBridge, Ee as getMicrofrontendGateway, C as getProfileLocale, X as hasMatchingPermission, g as initAuthBridge, _ as isAuthBridgeInitialized, Z as isSuperAdminBypass, a as isTranslationAttempted, Ie as isWorkspaceWideSelection, o as localeDirection, w as logoutActiveProfile, Ce as maskRoute, Q as matchPermission, T as removeAllProfiles, xe as reportError, oe as resolveSurfaceForRoles, we as scrubTelemetryText, Le as selectWorkspaceWide, Se as setActiveCrashReportingPipeline, E as setProfileLocale, D as setProfiles, se as synthesizeSimulatedPermissionStrings, k as useActiveContext, A as useActiveContextOrNull, je as useAppShell, f as useAuth, de as useAuthToken, fe as useAuthTokenOrNull, R as useContextManager, B as useFeatureFlag, V as useFeatureFlagDetails, H as useFeatureFlagValue, M as useFeatureFlags, G as useGeography, P as useGlobalUi, s as useI18n, c as useOptionalI18n, Ne as usePageConversationContext, $ as usePermission, ee as usePermissionLoading, te as usePermissions, ce as usePersonaSurface, Pe as useRegisterPageConversationContext, ne as useRole, re as useSafePermissions, le as useSafePersonaSurface, l as useShellLabel, u as useShellNumberFormat, I as useShellUi, t as useTheme, De as withGateway };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.1112.6",
3
+ "version": "2026.1113.1",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "repository": {
6
6
  "type": "git",