{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "aps-oauth-preset", "title": "APS OAuth Preset", "author": "MR ", "description": "Autodesk Platform Services (ACC) preset: provider metadata, scope catalog, scope bundles, and adapters into cantera's oauth types.", "registryDependencies": [ "@cantera/oauth-types" ], "files": [ { "path": "registry/lib/aps-oauth-preset.tsx", "content": "import type { OAuthAccount, OAuthProvider, OAuthScope, OAuthScopePreset } from '@/lib/oauth-types'\n\n/**\n * Autodesk Platform Services (APS / ACC) preset for the cantera oauth\n * components: provider metadata, the APS scope catalog, common scope bundles,\n * and adapters from APS payloads into cantera's oauth types.\n *\n * This is data, not a client — token handling belongs to your auth layer\n * (e.g. aec-auth, https://github.com/mrestrepoj10/aec-auth).\n */\n\nexport const apsProvider: OAuthProvider = {\n id: 'aps',\n name: 'Autodesk',\n docsUrl: 'https://aps.autodesk.com/en/docs/oauth/v2',\n // Defaults to size-4 so the mark renders correctly wherever it is dropped; a\n // `[&_svg]:size-*` wrapper still wins on specificity and overrides it.\n icon: (\n \n \n \n ),\n}\n\n/** The APS scope catalog, with human explanations. */\nexport const apsScopeCatalog: OAuthScope[] = [\n {\n id: 'user-profile:read',\n label: 'Read profile',\n description: 'View basic user profile information.',\n },\n {\n id: 'user:read',\n label: 'Read user data',\n description: 'View user data within Autodesk products.',\n },\n { id: 'user:write', label: 'Write user data', description: 'Create and update user data.' },\n {\n id: 'viewables:read',\n label: 'Read viewables',\n description: 'Load translated models in the APS Viewer.',\n },\n {\n id: 'data:read',\n label: 'Read data',\n description: 'Read hubs, projects, folders, items, and versions.',\n },\n { id: 'data:write', label: 'Write data', description: 'Update and delete project data.' },\n {\n id: 'data:create',\n label: 'Create data',\n description: 'Create new project data such as files and folders.',\n },\n { id: 'data:search', label: 'Search data', description: 'Search across project data.' },\n { id: 'bucket:create', label: 'Create buckets', description: 'Create OSS storage buckets.' },\n { id: 'bucket:read', label: 'Read buckets', description: 'List and read OSS storage buckets.' },\n { id: 'bucket:update', label: 'Update buckets', description: 'Modify OSS bucket settings.' },\n { id: 'bucket:delete', label: 'Delete buckets', description: 'Delete OSS storage buckets.' },\n {\n id: 'code:all',\n label: 'Design Automation',\n description: 'Author and run Design Automation work items.',\n },\n {\n id: 'account:read',\n label: 'Read account',\n description: 'Read ACC / BIM 360 account administration data.',\n },\n {\n id: 'account:write',\n label: 'Write account',\n description: 'Manage ACC / BIM 360 account administration.',\n },\n {\n id: 'openid',\n label: 'OpenID',\n description: 'Include an OpenID Connect id_token in the response.',\n },\n]\n\n/**\n * Common scope bundles, mirrored from aec-auth's `apsScopes` recipes so the\n * picker and the token layer speak the same presets.\n */\nexport const apsScopePresets: OAuthScopePreset[] = [\n {\n id: 'viewer',\n label: 'Viewer',\n description: 'Load models in the APS Viewer.',\n scopes: ['data:read', 'viewables:read'],\n },\n {\n id: 'data-read',\n label: 'Read project data',\n description: 'Read hubs, projects, folders, and items.',\n scopes: ['data:read'],\n },\n {\n id: 'data-write',\n label: 'Read and write data',\n description: 'Read and write project data.',\n scopes: ['data:read', 'data:write', 'data:create'],\n },\n {\n id: 'account-admin',\n label: 'Account admin',\n description: 'ACC / BIM 360 account administration.',\n scopes: ['account:read', 'account:write'],\n },\n]\n\n/** Subset of the APS userinfo response the adapter reads. */\nexport interface ApsUserInfo {\n sub?: string\n name?: string\n email?: string\n picture?: string\n}\n\n/** Translate an APS userinfo payload into a cantera OAuthAccount. */\nexport function fromApsUserInfo(userInfo: ApsUserInfo): OAuthAccount {\n return {\n name: userInfo.name,\n email: userInfo.email,\n avatarUrl: userInfo.picture,\n }\n}\n", "type": "registry:lib", "target": "lib/aps-oauth-preset.tsx" } ], "categories": [ "authentication", "providers", "autodesk" ], "type": "registry:lib" }