@anymux/connect 0.1.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.
- package/dist/GitBrowser-BLgTNQyd.js +905 -0
- package/dist/GitBrowser-BLgTNQyd.js.map +1 -0
- package/dist/GitBrowser-CIyWiuX-.js +3 -0
- package/dist/ObjectStorageBrowser-B2YkUxMl.js +3 -0
- package/dist/ObjectStorageBrowser-B_25Emfu.js +267 -0
- package/dist/ObjectStorageBrowser-B_25Emfu.js.map +1 -0
- package/dist/RepoPicker-BprFGOn7.js +3 -0
- package/dist/RepoPicker-CoHMiJ-3.js +168 -0
- package/dist/RepoPicker-CoHMiJ-3.js.map +1 -0
- package/dist/index.d.ts +697 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2539 -0
- package/dist/index.js.map +1 -0
- package/dist/registry.d.ts +2 -0
- package/dist/registry.js +3 -0
- package/dist/scope-labels-B4VAwoL6.js +582 -0
- package/dist/scope-labels-B4VAwoL6.js.map +1 -0
- package/dist/scope-labels-DvdJLcSL.d.ts +50 -0
- package/dist/scope-labels-DvdJLcSL.d.ts.map +1 -0
- package/package.json +87 -0
- package/src/adapters/adapter-registry.ts +177 -0
- package/src/auth/auth-client.ts +101 -0
- package/src/auth/token-manager.ts +27 -0
- package/src/components/ActionHistoryPanel.tsx +137 -0
- package/src/components/CapabilityCell.tsx +97 -0
- package/src/components/CapabilityError.tsx +50 -0
- package/src/components/CapabilityPanel.tsx +530 -0
- package/src/components/CapabilityPill.tsx +56 -0
- package/src/components/ConnectButton.tsx +149 -0
- package/src/components/ConnectedMenu.tsx +142 -0
- package/src/components/ConnectionStatus.tsx +28 -0
- package/src/components/CredentialForm.tsx +246 -0
- package/src/components/FullScreenBrowser.tsx +84 -0
- package/src/components/GitBrowser.tsx +705 -0
- package/src/components/GitHubRepoPicker.tsx +125 -0
- package/src/components/ObjectStorageBrowser.tsx +176 -0
- package/src/components/RepoPicker.tsx +93 -0
- package/src/components/ServiceCard.tsx +77 -0
- package/src/components/ServiceCardGrid.tsx +141 -0
- package/src/components/ServiceDashboard.tsx +84 -0
- package/src/components/ServiceIcon.tsx +37 -0
- package/src/components/ServiceRow.tsx +50 -0
- package/src/components/useAdapter.ts +33 -0
- package/src/demos/ServiceDashboardDemo.tsx +108 -0
- package/src/index.ts +68 -0
- package/src/models/ActionNotificationModel.ts +72 -0
- package/src/models/ConnectionManagerModel.ts +410 -0
- package/src/models/CredentialFormModel.ts +111 -0
- package/src/models/DashboardModel.ts +157 -0
- package/src/models/GitHostBrowserModel.ts +89 -0
- package/src/models/GitRepoBrowserModel.ts +285 -0
- package/src/models/ObjectStorageBrowserModel.ts +131 -0
- package/src/models/RepoPickerModel.ts +132 -0
- package/src/registry/service-registry.ts +46 -0
- package/src/registry/services/apple.ts +22 -0
- package/src/registry/services/bitbucket.ts +24 -0
- package/src/registry/services/box.ts +22 -0
- package/src/registry/services/browser-fs.ts +19 -0
- package/src/registry/services/dropbox.ts +22 -0
- package/src/registry/services/flickr.ts +22 -0
- package/src/registry/services/gitea.ts +24 -0
- package/src/registry/services/github.ts +24 -0
- package/src/registry/services/gitlab.ts +24 -0
- package/src/registry/services/google.ts +24 -0
- package/src/registry/services/icloud.ts +23 -0
- package/src/registry/services/indexeddb.ts +19 -0
- package/src/registry/services/instagram.ts +22 -0
- package/src/registry/services/microsoft.ts +24 -0
- package/src/registry/services/s3.ts +21 -0
- package/src/registry/services/webdav.ts +21 -0
- package/src/registry.ts +4 -0
- package/src/types/connection-state.ts +33 -0
- package/src/types/connection.ts +11 -0
- package/src/types/optional-deps.d.ts +149 -0
- package/src/types/service.ts +18 -0
- package/src/types/user-profile.ts +21 -0
- package/src/utils/action-toast.ts +53 -0
- package/src/utils/scope-labels.ts +91 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps raw OAuth scope strings to human-readable descriptions.
|
|
3
|
+
* Falls back to a cleaned-up version of the scope string for unknown scopes.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const SCOPE_LABELS: Record<string, string> = {
|
|
7
|
+
// GitHub
|
|
8
|
+
'repo': 'Repository access',
|
|
9
|
+
'read:user': 'Read user profile',
|
|
10
|
+
'user:email': 'Read email address',
|
|
11
|
+
'gist': 'Gist access',
|
|
12
|
+
'read:org': 'Read organizations',
|
|
13
|
+
|
|
14
|
+
// Google
|
|
15
|
+
'https://www.googleapis.com/auth/drive': 'Google Drive',
|
|
16
|
+
'https://www.googleapis.com/auth/drive.readonly': 'Google Drive (read-only)',
|
|
17
|
+
'https://www.googleapis.com/auth/calendar.readonly': 'Calendar (read-only)',
|
|
18
|
+
'https://www.googleapis.com/auth/calendar': 'Calendar',
|
|
19
|
+
'https://www.googleapis.com/auth/contacts.readonly': 'Contacts (read-only)',
|
|
20
|
+
'https://www.googleapis.com/auth/contacts': 'Contacts',
|
|
21
|
+
|
|
22
|
+
// Microsoft
|
|
23
|
+
'Files.ReadWrite.All': 'File read/write',
|
|
24
|
+
'Files.Read.All': 'File read',
|
|
25
|
+
'Contacts.Read': 'Contacts (read-only)',
|
|
26
|
+
'Calendars.Read': 'Calendar (read-only)',
|
|
27
|
+
'User.Read': 'User profile',
|
|
28
|
+
|
|
29
|
+
// GitLab
|
|
30
|
+
'read_api': 'API read access',
|
|
31
|
+
'read_repository': 'Repository read access',
|
|
32
|
+
'api': 'Full API access',
|
|
33
|
+
'read_user': 'Read user profile',
|
|
34
|
+
|
|
35
|
+
// Bitbucket
|
|
36
|
+
'repository': 'Repository access',
|
|
37
|
+
'pullrequest': 'Pull request access',
|
|
38
|
+
'account': 'Account access',
|
|
39
|
+
|
|
40
|
+
// Dropbox
|
|
41
|
+
'files.metadata.read': 'Read file metadata',
|
|
42
|
+
'files.content.read': 'Read file content',
|
|
43
|
+
'files.content.write': 'Write file content',
|
|
44
|
+
|
|
45
|
+
// S3
|
|
46
|
+
's3:GetObject': 'Read objects',
|
|
47
|
+
's3:PutObject': 'Write objects',
|
|
48
|
+
's3:ListBucket': 'List buckets',
|
|
49
|
+
|
|
50
|
+
// Box
|
|
51
|
+
'root_readwrite': 'Read & write all files',
|
|
52
|
+
|
|
53
|
+
// Gitea
|
|
54
|
+
'read:repository': 'Repository read access',
|
|
55
|
+
'write:repository': 'Repository write access',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Returns a human-readable label for a scope string.
|
|
60
|
+
* Unknown scopes get cleaned up: URL paths are extracted, dots/underscores become spaces.
|
|
61
|
+
*/
|
|
62
|
+
export function getScopeLabel(scope: string): string {
|
|
63
|
+
if (SCOPE_LABELS[scope]) {
|
|
64
|
+
return SCOPE_LABELS[scope];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Google-style URL scopes: extract the last path segment
|
|
68
|
+
if (scope.startsWith('https://')) {
|
|
69
|
+
const last = scope.split('/').pop() ?? scope;
|
|
70
|
+
return formatScopeSegment(last);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return formatScopeSegment(scope);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Turn a scope segment like "files.content.read" into "Files content read" */
|
|
77
|
+
function formatScopeSegment(segment: string): string {
|
|
78
|
+
return segment
|
|
79
|
+
.replace(/[._:]/g, ' ')
|
|
80
|
+
.replace(/\b\w/g, c => c.toUpperCase())
|
|
81
|
+
.trim();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Deduplicate and label a list of scope strings.
|
|
86
|
+
* Returns unique human-readable labels sorted alphabetically.
|
|
87
|
+
*/
|
|
88
|
+
export function getScopeLabels(scopes: string[]): string[] {
|
|
89
|
+
const unique = [...new Set(scopes)];
|
|
90
|
+
return unique.map(getScopeLabel).sort();
|
|
91
|
+
}
|