import { collectPermissionScopes, userManagementPermissions } from "@tailor-platform/erp-kit/app"; import { createResolver, t } from "@tailor-platform/sdk"; const ALL_SCOPES = collectPermissionScopes(userManagementPermissions); const AUTO_ASSIGNED_SCOPES = new Set(["user-management:profile"]); export default createResolver({ name: "availablePermissions", operation: "query", input: {}, body: () => { return { scopes: ALL_SCOPES.map((s) => ({ scope: s, autoAssigned: AUTO_ASSIGNED_SCOPES.has(s), })), }; }, output: t .object({ scopes: t .object( { scope: t.string().description("Scope key (module:scope)"), autoAssigned: t.bool().description("Whether this scope is auto-assigned to all roles"), }, { array: true }, ) .description("Available permission scopes"), }) .description("Available permission scopes"), });