@docyrus/signin 0.17.0 → 0.18.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.
@@ -293,8 +293,12 @@ interface DocyrusAuthContextValue {
293
293
  signOut: () => Promise<void>;
294
294
  /** Check if the current user has a specific role (by slug or uid) */
295
295
  hasRole: (role: string | string[] | null | undefined) => boolean;
296
- /** Check if the current user has permission for an operation on a data source */
297
- hasPermission: (operation: string, dataSourceId?: string | null) => boolean;
296
+ /**
297
+ * Check if the current user has permission for an operation. Pass a data
298
+ * source id (or a {@link PermissionScope}) to scope it to an entity; omit it
299
+ * for tenant-wide operations such as `ai-access`.
300
+ */
301
+ hasPermission: (operation: string, scope?: string | null | PermissionScope) => boolean;
298
302
  /** Re-fetch the current user from the API */
299
303
  refreshUser: () => Promise<void>;
300
304
  /**
@@ -735,11 +739,43 @@ interface DocyrusRole {
735
739
  slug: string;
736
740
  rules: DocyrusAclRule[];
737
741
  }
738
- /** An ACL rule — maps a data source to its allowed operations */
742
+ /**
743
+ * An ACL rule — maps a data source to its allowed operations.
744
+ *
745
+ * Legacy shape, superseded by {@link DocyrusPermission}: every entity-less rule
746
+ * (ai/settings/devtools) and every app/ai-tool rule collapses into the single
747
+ * entry whose `dataSourceId` is null.
748
+ */
739
749
  interface DocyrusAclRule {
740
- dataSourceId: string;
750
+ dataSourceId: string | null;
751
+ allowedOperations: string[];
752
+ }
753
+ /** The entity an ACL rule applies to (`core_acl_operation.target_type`) */
754
+ type AclTargetType = 'data_source' | 'field' | 'app' | 'ai_tool' | 'ai' | 'settings' | 'devtools';
755
+ /**
756
+ * A permission as returned by GET /v1/users/me, merged across the user's roles
757
+ * and keyed by target type. Entity-scoped targets carry the single id that
758
+ * scopes them (`data_source`/`field` → dataSourceId, `app` → appId, `ai_tool`
759
+ * → aiToolId); `ai`, `settings` and `devtools` are tenant-wide and carry none.
760
+ */
761
+ interface DocyrusPermission {
762
+ targetType: AclTargetType;
763
+ dataSourceId?: string | null;
764
+ appId?: string | null;
765
+ aiToolId?: string | null;
741
766
  allowedOperations: string[];
742
767
  }
768
+ /**
769
+ * What a permission check applies to. Omit every id to check a tenant-wide
770
+ * operation such as `ai-access` or `manage_users`.
771
+ */
772
+ interface PermissionScope {
773
+ dataSourceId?: string | null;
774
+ appId?: string | null;
775
+ aiToolId?: string | null;
776
+ /** Narrow the check to one target type; inferred from the ids when omitted. */
777
+ targetType?: AclTargetType;
778
+ }
743
779
  /** The user object as returned by GET /v1/users/me */
744
780
  interface DocyrusUser {
745
781
  id: string;
@@ -750,6 +786,11 @@ interface DocyrusUser {
750
786
  primaryRole: DocyrusRole | null;
751
787
  roles: DocyrusRole[];
752
788
  aclRules: DocyrusAclRule[];
789
+ /**
790
+ * Target-type-aware permissions. Absent on older API versions, where
791
+ * `aclRules` is the only shape available.
792
+ */
793
+ permissions?: DocyrusPermission[];
753
794
  tenant?: {
754
795
  id: string;
755
796
  name: string;
@@ -771,4 +812,4 @@ interface PermissionConfig {
771
812
  alwaysPermittedDataSources?: Record<string, AclOperation[]>;
772
813
  }
773
814
 
774
- export { type MsGraphStatusRequestMessage as $, type AclOperation as A, type DocySendMessage as B, type CalendarSendAckMessage as C, type DocyrusAuthConfig as D, type DocyrusNotification as E, type EmailSendAckMessage as F, type GuidyRoute as G, type HostNavigationHandler as H, type EmailSendMessage as I, type GuidyCommandHandler as J, type GuidyCommandMessage as K, type GuidyElement as L, type MsGraphAccount as M, type GuidyElementsMessage as N, type OpenAuthSessionFn as O, type PermissionConfig as P, type GuidyPointAckMessage as Q, type RouteChangePayload as R, type GuidyPointMessage as S, type GuidyRoutesMessage as T, type GuidyScanMessage as U, type HostNavigationMessage as V, type HostNotificationMessage as W, type HostSignInMessage as X, IframeAuth as Y, type MsGraphRequestMessage as Z, type MsGraphResponseMessage as _, type AdaptiveCard as a, type MsGraphStatusResponseMessage as a0, type TokenRefreshRequestMessage as a1, type AuthMode as b, type AuthSessionResult as c, type AuthStatus as d, type DocyrusAclRule as e, type DocyrusAuthContextValue as f, type DocyrusCalendarEventPayload as g, type DocyrusEmailPayload as h, type DocyrusRole as i, type DocyrusShareAdaptiveCardPayload as j, type DocyrusSharePayload as k, type DocyrusShareTextPayload as l, type DocyrusUser as m, MsGraphClient as n, type MsGraphRequest as o, type MsGraphRequestOptions as p, type MsGraphResponse as q, type MsGraphStatus as r, type HostNotificationHandler as s, type HostNavigationRequestOptions as t, type AppNavigationRequestMessage as u, type AppRouteChangeMessage as v, type CalendarSendMessage as w, type ChatSendAckMessage as x, type ChatSendMessage as y, type DocySendAckMessage as z };
815
+ export { IframeAuth as $, type AclOperation as A, type ChatSendAckMessage as B, type CalendarSendAckMessage as C, type DocyrusAuthConfig as D, type ChatSendMessage as E, type DocySendAckMessage as F, type GuidyRoute as G, type HostNavigationHandler as H, type DocySendMessage as I, type DocyrusNotification as J, type EmailSendAckMessage as K, type EmailSendMessage as L, type MsGraphAccount as M, type GuidyCommandHandler as N, type OpenAuthSessionFn as O, type PermissionConfig as P, type GuidyCommandMessage as Q, type RouteChangePayload as R, type GuidyElement as S, type GuidyElementsMessage as T, type GuidyPointAckMessage as U, type GuidyPointMessage as V, type GuidyRoutesMessage as W, type GuidyScanMessage as X, type HostNavigationMessage as Y, type HostNotificationMessage as Z, type HostSignInMessage as _, type AclTargetType as a, type MsGraphRequestMessage as a0, type MsGraphResponseMessage as a1, type MsGraphStatusRequestMessage as a2, type MsGraphStatusResponseMessage as a3, type TokenRefreshRequestMessage as a4, type AdaptiveCard as b, type AuthMode as c, type AuthSessionResult as d, type AuthStatus as e, type DocyrusAclRule as f, type DocyrusAuthContextValue as g, type DocyrusCalendarEventPayload as h, type DocyrusEmailPayload as i, type DocyrusPermission as j, type DocyrusRole as k, type DocyrusShareAdaptiveCardPayload as l, type DocyrusSharePayload as m, type DocyrusShareTextPayload as n, type DocyrusUser as o, MsGraphClient as p, type MsGraphRequest as q, type MsGraphRequestOptions as r, type MsGraphResponse as s, type MsGraphStatus as t, type PermissionScope as u, type HostNotificationHandler as v, type HostNavigationRequestOptions as w, type AppNavigationRequestMessage as x, type AppRouteChangeMessage as y, type CalendarSendMessage as z };
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { D as DocyrusAuthConfig, f as DocyrusAuthContextValue } from './types-CFnKr6T_.js';
3
+ import { D as DocyrusAuthConfig, g as DocyrusAuthContextValue } from './types-BcLDyMdw.js';
4
4
  import { RestApiClient } from '@docyrus/api-client';
5
5
 
6
6
  interface DocyrusAuthProviderProps extends DocyrusAuthConfig {
@@ -1,8 +1,8 @@
1
1
  import * as vue from 'vue';
2
2
  import { PropType } from 'vue';
3
3
  import { OAuth2TokenStorage, OAuth2Tokens, RestApiClient } from '@docyrus/api-client';
4
- import { b as AuthMode, d as AuthStatus, H as HostNavigationHandler, s as HostNotificationHandler, R as RouteChangePayload, t as HostNavigationRequestOptions, k as DocyrusSharePayload, h as DocyrusEmailPayload, g as DocyrusCalendarEventPayload, n as MsGraphClient } from '../types-CFnKr6T_.js';
5
- export { a as AdaptiveCard, D as DocyrusAuthConfig, j as DocyrusShareAdaptiveCardPayload, l as DocyrusShareTextPayload, M as MsGraphAccount, o as MsGraphRequest, p as MsGraphRequestOptions, q as MsGraphResponse, r as MsGraphStatus } from '../types-CFnKr6T_.js';
4
+ import { c as AuthMode, e as AuthStatus, H as HostNavigationHandler, v as HostNotificationHandler, R as RouteChangePayload, w as HostNavigationRequestOptions, m as DocyrusSharePayload, i as DocyrusEmailPayload, h as DocyrusCalendarEventPayload, p as MsGraphClient } from '../types-BcLDyMdw.js';
5
+ export { b as AdaptiveCard, D as DocyrusAuthConfig, l as DocyrusShareAdaptiveCardPayload, n as DocyrusShareTextPayload, M as MsGraphAccount, q as MsGraphRequest, r as MsGraphRequestOptions, s as MsGraphResponse, t as MsGraphStatus } from '../types-BcLDyMdw.js';
6
6
 
7
7
  interface DocyrusAuthState {
8
8
  status: AuthStatus;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docyrus/signin",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Authentication provider for Docyrus apps (React, Vue, React Native, Electron, Next.js SSR)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",