import type { SimpleAction, RoleDeclarationOptions } from '../options.js'; import type { constructor } from '../schema.js'; /** * Preview-only widening of {@link _role} that accepts the `'anonymous'` * role in addition to `'authenticated'`. * * The stable package root export of `role()` from `@microsoft/rayfin-core` * is narrowed to only accept `'authenticated'`, so `@role('anonymous', ...)` * does not compile against the stable surface. Import `role` from * `@microsoft/rayfin-core/experimental` (or use the {@link anonymous} * shorthand below) to use the `'anonymous'` overload. * * Anonymous data access is not currently supported on Fabric: the CLI * rejects any DAB configuration that grants the `anonymous` role at apply * time. The decorator is published here as a preview of the future * supported syntax. * * @example * ```typescript * import { entity, uuid, text } from '@microsoft/rayfin-core'; * import { role } from '@microsoft/rayfin-core/experimental'; * * @entity() * @role('anonymous', 'read') * @role('authenticated', '*') * export class PublicPost { * @uuid() * id!: string; * @text() * title!: string; * } * ``` */ export declare const role: (roleName: 'authenticated' | 'anonymous', actions: SimpleAction | SimpleAction[], options?: RoleDeclarationOptions) => (target: constructor, context: ClassDecoratorContext>) => void; /** * Shorthand decorator for anonymous role. * * Equivalent to `@role('anonymous', actions, options)` (where `role` is * imported from `@microsoft/rayfin-core/experimental`). * Anonymous roles allow public access without authentication. * * Published from the experimental subpath * (`@microsoft/rayfin-core/experimental`) to signal preview status. * * Anonymous data access is not currently supported on Fabric: the CLI * rejects any DAB configuration that grants the `anonymous` role at apply * time, regardless of which form (`@anonymous(...)` or * `@role('anonymous', ...)`) was used. * * @param actions - The actions this role can perform (default: '*' for all actions) * @param options - Optional policy and field visibility configuration * * @example * ```typescript * import { entity, authenticated, uuid, text } from '@microsoft/rayfin-core'; * import { anonymous } from '@microsoft/rayfin-core/experimental'; * * @entity() * @anonymous('read') // Anonymous users can read * @authenticated('*') // Authenticated users can do everything * export class PublicPost { * @uuid() * id!: string; * @text() * title!: string; * } * ``` */ export declare function anonymous(actions?: SimpleAction | SimpleAction[], options?: RoleDeclarationOptions): (target: constructor, context: ClassDecoratorContext>) => void; //# sourceMappingURL=experimental.d.ts.map