main's format:check was red: 20 package.json files (publishConfig key ordering) plus two source files were not oxfmt-clean under 0.44.0. Run oxfmt to bring the tree back to a passing format:check so this branch can merge.
Unified · Split
| @@ -23,7 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | ".": "./src/index.ts" |
| 24 | 24 | }, |
| 25 | 25 | "publishConfig": { |
| 26 | − "access": "public", | |
| 27 | 26 | "exports": { |
| 28 | 27 | ".": { |
| 29 | 28 | "import": { |
| @@ -31,7 +30,8 @@ · 1 unmodified line | ||
| 31 | 30 | "default": "./dist/index.js" |
| 32 | 31 | } |
| 33 | 32 | } |
| 34 | − } | |
| 33 | + }, | |
| 34 | + "access": "public" | |
| 35 | 35 | }, |
| 36 | 36 | "scripts": { |
| 37 | 37 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -19,7 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | ".": "./src/index.ts" |
| 20 | 20 | }, |
| 21 | 21 | "publishConfig": { |
| 22 | − "access": "public", | |
| 23 | 22 | "exports": { |
| 24 | 23 | ".": { |
| 25 | 24 | "import": { |
| @@ -27,7 +26,8 @@ · 1 unmodified line | ||
| 27 | 26 | "default": "./dist/index.js" |
| 28 | 27 | } |
| 29 | 28 | } |
| 30 | − } | |
| 29 | + }, | |
| 30 | + "access": "public" | |
| 31 | 31 | }, |
| 32 | 32 | "scripts": { |
| 33 | 33 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | ||
| 20 | 20 | "./promise": "./src/promise.ts" |
| 21 | 21 | }, |
| 22 | 22 | "publishConfig": { |
| 23 | − "access": "public", | |
| 24 | 23 | "exports": { |
| 25 | 24 | ".": { |
| 26 | 25 | "import": { |
| @@ -34,7 +33,8 @@ · 7 unmodified lines | ||
| 34 | 33 | "default": "./dist/core.js" |
| 35 | 34 | } |
| 36 | 35 | } |
| 37 | − } | |
| 36 | + }, | |
| 37 | + "access": "public" | |
| 38 | 38 | }, |
| 39 | 39 | "scripts": { |
| 40 | 40 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | ||
| 20 | 20 | ".": "./src/index.ts" |
| 21 | 21 | }, |
| 22 | 22 | "publishConfig": { |
| 23 | − "access": "public", | |
| 24 | 23 | "exports": { |
| 25 | 24 | ".": { |
| 26 | 25 | "import": { |
| @@ -28,7 +27,8 @@ · 1 unmodified line | ||
| 28 | 27 | "default": "./dist/index.js" |
| 29 | 28 | } |
| 30 | 29 | } |
| 31 | − } | |
| 30 | + }, | |
| 31 | + "access": "public" | |
| 32 | 32 | }, |
| 33 | 33 | "scripts": { |
| 34 | 34 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -28,7 +28,6 @@ · 27 unmodified lines | ||
| 28 | 28 | "./public-origin": "./src/public-origin.ts" |
| 29 | 29 | }, |
| 30 | 30 | "publishConfig": { |
| 31 | − "access": "public", | |
| 32 | 31 | "exports": { |
| 33 | 32 | ".": { |
| 34 | 33 | "import": { |
| @@ -84,7 +83,8 @@ · 49 unmodified lines | ||
| 84 | 83 | "default": "./dist/public-origin.js" |
| 85 | 84 | } |
| 86 | 85 | } |
| 87 | − } | |
| 86 | + }, | |
| 87 | + "access": "public" | |
| 88 | 88 | }, |
| 89 | 89 | "scripts": { |
| 90 | 90 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | } |
| 24 | 24 | }, |
| 25 | 25 | "publishConfig": { |
| 26 | − "access": "public", | |
| 27 | 26 | "exports": { |
| 28 | 27 | ".": { |
| 29 | 28 | "import": { |
| @@ -31,7 +30,8 @@ · 1 unmodified line | ||
| 31 | 30 | "default": "./dist/index.js" |
| 32 | 31 | } |
| 33 | 32 | } |
| 34 | − } | |
| 33 | + }, | |
| 34 | + "access": "public" | |
| 35 | 35 | }, |
| 36 | 36 | "scripts": { |
| 37 | 37 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -19,7 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | ".": "./src/index.ts" |
| 20 | 20 | }, |
| 21 | 21 | "publishConfig": { |
| 22 | − "access": "public", | |
| 23 | 22 | "exports": { |
| 24 | 23 | ".": { |
| 25 | 24 | "import": { |
| @@ -27,7 +26,8 @@ · 1 unmodified line | ||
| 27 | 26 | "default": "./dist/index.js" |
| 28 | 27 | } |
| 29 | 28 | } |
| 30 | − } | |
| 29 | + }, | |
| 30 | + "access": "public" | |
| 31 | 31 | }, |
| 32 | 32 | "scripts": { |
| 33 | 33 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -19,7 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | ".": "./src/index.ts" |
| 20 | 20 | }, |
| 21 | 21 | "publishConfig": { |
| 22 | − "access": "public", | |
| 23 | 22 | "exports": { |
| 24 | 23 | ".": { |
| 25 | 24 | "import": { |
| @@ -27,7 +26,8 @@ · 1 unmodified line | ||
| 27 | 26 | "default": "./dist/index.js" |
| 28 | 27 | } |
| 29 | 28 | } |
| 30 | − } | |
| 29 | + }, | |
| 30 | + "access": "public" | |
| 31 | 31 | }, |
| 32 | 32 | "scripts": { |
| 33 | 33 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | ||
| 20 | 20 | "./client": "./src/client.tsx" |
| 21 | 21 | }, |
| 22 | 22 | "publishConfig": { |
| 23 | − "access": "public", | |
| 24 | 23 | "exports": { |
| 25 | 24 | "./server": { |
| 26 | 25 | "import": { |
| @@ -34,7 +33,8 @@ · 7 unmodified lines | ||
| 34 | 33 | "default": "./dist/client.js" |
| 35 | 34 | } |
| 36 | 35 | } |
| 37 | − } | |
| 36 | + }, | |
| 37 | + "access": "public" | |
| 38 | 38 | }, |
| 39 | 39 | "scripts": { |
| 40 | 40 | "build": "tsup", |
| @@ -21,7 +21,6 @@ · 20 unmodified lines | ||
| 21 | 21 | "./shared": "./src/shared.ts" |
| 22 | 22 | }, |
| 23 | 23 | "publishConfig": { |
| 24 | − "access": "public", | |
| 25 | 24 | "exports": { |
| 26 | 25 | "./server": { |
| 27 | 26 | "import": { |
| @@ -41,7 +40,8 @@ · 13 unmodified lines | ||
| 41 | 40 | "default": "./dist/shared.js" |
| 42 | 41 | } |
| 43 | 42 | } |
| 44 | − } | |
| 43 | + }, | |
| 44 | + "access": "public" | |
| 45 | 45 | }, |
| 46 | 46 | "scripts": { |
| 47 | 47 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | ||
| 20 | 20 | "./promise": "./src/promise.ts" |
| 21 | 21 | }, |
| 22 | 22 | "publishConfig": { |
| 23 | − "access": "public", | |
| 24 | 23 | "exports": { |
| 25 | 24 | ".": { |
| 26 | 25 | "import": { |
| @@ -34,7 +33,8 @@ · 7 unmodified lines | ||
| 34 | 33 | "default": "./dist/core.js" |
| 35 | 34 | } |
| 36 | 35 | } |
| 37 | − } | |
| 36 | + }, | |
| 37 | + "access": "public" | |
| 38 | 38 | }, |
| 39 | 39 | "scripts": { |
| 40 | 40 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | "./client": "./src/react/plugin-client.tsx" |
| 24 | 24 | }, |
| 25 | 25 | "publishConfig": { |
| 26 | − "access": "public", | |
| 27 | 26 | "exports": { |
| 28 | 27 | ".": { |
| 29 | 28 | "import": { |
| @@ -43,7 +42,8 @@ · 13 unmodified lines | ||
| 43 | 42 | "default": "./dist/client.js" |
| 44 | 43 | } |
| 45 | 44 | } |
| 46 | − } | |
| 45 | + }, | |
| 46 | + "access": "public" | |
| 47 | 47 | }, |
| 48 | 48 | "scripts": { |
| 49 | 49 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -25,7 +25,6 @@ · 24 unmodified lines | ||
| 25 | 25 | "./testing": "./src/testing/index.ts" |
| 26 | 26 | }, |
| 27 | 27 | "publishConfig": { |
| 28 | − "access": "public", | |
| 29 | 28 | "exports": { |
| 30 | 29 | ".": { |
| 31 | 30 | "import": { |
| @@ -51,7 +50,8 @@ · 19 unmodified lines | ||
| 51 | 50 | "default": "./dist/testing.js" |
| 52 | 51 | } |
| 53 | 52 | } |
| 54 | − } | |
| 53 | + }, | |
| 54 | + "access": "public" | |
| 55 | 55 | }, |
| 56 | 56 | "scripts": { |
| 57 | 57 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | ||
| 20 | 20 | "./promise": "./src/promise.ts" |
| 21 | 21 | }, |
| 22 | 22 | "publishConfig": { |
| 23 | − "access": "public", | |
| 24 | 23 | "exports": { |
| 25 | 24 | ".": { |
| 26 | 25 | "import": { |
| @@ -34,7 +33,8 @@ · 7 unmodified lines | ||
| 34 | 33 | "default": "./dist/core.js" |
| 35 | 34 | } |
| 36 | 35 | } |
| 37 | − } | |
| 36 | + }, | |
| 37 | + "access": "public" | |
| 38 | 38 | }, |
| 39 | 39 | "scripts": { |
| 40 | 40 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -25,7 +25,6 @@ · 24 unmodified lines | ||
| 25 | 25 | "./testing": "./src/testing/index.ts" |
| 26 | 26 | }, |
| 27 | 27 | "publishConfig": { |
| 28 | − "access": "public", | |
| 29 | 28 | "exports": { |
| 30 | 29 | ".": { |
| 31 | 30 | "import": { |
| @@ -51,7 +50,8 @@ · 19 unmodified lines | ||
| 51 | 50 | "default": "./dist/testing.js" |
| 52 | 51 | } |
| 53 | 52 | } |
| 54 | − } | |
| 53 | + }, | |
| 54 | + "access": "public" | |
| 55 | 55 | }, |
| 56 | 56 | "scripts": { |
| 57 | 57 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | "./client": "./src/react/plugin-client.tsx" |
| 24 | 24 | }, |
| 25 | 25 | "publishConfig": { |
| 26 | − "access": "public", | |
| 27 | 26 | "exports": { |
| 28 | 27 | ".": { |
| 29 | 28 | "import": { |
| @@ -43,7 +42,8 @@ · 13 unmodified lines | ||
| 43 | 42 | "default": "./dist/client.js" |
| 44 | 43 | } |
| 45 | 44 | } |
| 46 | − } | |
| 45 | + }, | |
| 46 | + "access": "public" | |
| 47 | 47 | }, |
| 48 | 48 | "scripts": { |
| 49 | 49 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | "./client": "./src/react/plugin-client.tsx" |
| 24 | 24 | }, |
| 25 | 25 | "publishConfig": { |
| 26 | − "access": "public", | |
| 27 | 26 | "exports": { |
| 28 | 27 | ".": { |
| 29 | 28 | "import": { |
| @@ -43,7 +42,8 @@ · 13 unmodified lines | ||
| 43 | 42 | "default": "./dist/client.js" |
| 44 | 43 | } |
| 45 | 44 | } |
| 46 | − } | |
| 45 | + }, | |
| 46 | + "access": "public" | |
| 47 | 47 | }, |
| 48 | 48 | "scripts": { |
| 49 | 49 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -25,7 +25,6 @@ · 24 unmodified lines | ||
| 25 | 25 | "./testing": "./src/testing/index.ts" |
| 26 | 26 | }, |
| 27 | 27 | "publishConfig": { |
| 28 | − "access": "public", | |
| 29 | 28 | "exports": { |
| 30 | 29 | ".": { |
| 31 | 30 | "import": { |
| @@ -51,7 +50,8 @@ · 19 unmodified lines | ||
| 51 | 50 | "default": "./dist/testing.js" |
| 52 | 51 | } |
| 53 | 52 | } |
| 54 | − } | |
| 53 | + }, | |
| 54 | + "access": "public" | |
| 55 | 55 | }, |
| 56 | 56 | "scripts": { |
| 57 | 57 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -21,7 +21,6 @@ · 20 unmodified lines | ||
| 21 | 21 | "./shared": "./src/shared.ts" |
| 22 | 22 | }, |
| 23 | 23 | "publishConfig": { |
| 24 | − "access": "public", | |
| 25 | 24 | "exports": { |
| 26 | 25 | "./server": { |
| 27 | 26 | "import": { |
| @@ -41,7 +40,8 @@ · 13 unmodified lines | ||
| 41 | 40 | "default": "./dist/shared.js" |
| 42 | 41 | } |
| 43 | 42 | } |
| 44 | − } | |
| 43 | + }, | |
| 44 | + "access": "public" | |
| 45 | 45 | }, |
| 46 | 46 | "scripts": { |
| 47 | 47 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | "./testing": "./src/sdk/testing.ts" |
| 24 | 24 | }, |
| 25 | 25 | "publishConfig": { |
| 26 | − "access": "public", | |
| 27 | 26 | "exports": { |
| 28 | 27 | ".": { |
| 29 | 28 | "import": { |
| @@ -43,7 +42,8 @@ · 13 unmodified lines | ||
| 43 | 42 | "default": "./dist/testing.js" |
| 44 | 43 | } |
| 45 | 44 | } |
| 46 | − } | |
| 45 | + }, | |
| 46 | + "access": "public" | |
| 47 | 47 | }, |
| 48 | 48 | "scripts": { |
| 49 | 49 | "build": "tsup && (tsc --declaration --emitDeclarationOnly --outDir dist --rootDir src || true)", |
| @@ -2,11 +2,7 @@ import { useEffect, useMemo, useState } from "react"; · 1 unmodified line | ||
| 2 | 2 | import { useAtomValue, useAtomSet } from "@effect/atom-react"; |
| 3 | 3 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 4 | 4 | import * as Exit from "effect/Exit"; |
| 5 | −import { | |
| 6 | − IntegrationSlug, | |
| 7 | − type Connection, | |
| 8 | − type Owner, | |
| 9 | −} from "@executor-js/sdk/shared"; | |
| 5 | +import { IntegrationSlug, type Connection, type Owner } from "@executor-js/sdk/shared"; | |
| 10 | 6 | import type { IntegrationAccountHandoff } from "@executor-js/sdk/client"; |
| 11 | 7 | import { toast } from "sonner"; |
| 12 | 8 | |
| @@ -84,10 +80,7 @@ function AccountRow(props: { · 71 unmodified lines | ||
| 84 | 80 | <CardStackEntryTitle className="flex min-w-0 items-center gap-2"> |
| 85 | 81 | <span className="truncate">{displayLabel}</span> |
| 86 | 82 | {needsReconsent ? ( |
| 87 | − <Badge | |
| 88 | − variant="outline" | |
| 89 | − className="shrink-0 border-border text-muted-foreground" | |
| 90 | − > | |
| 83 | + <Badge variant="outline" className="shrink-0 border-border text-muted-foreground"> | |
| 91 | 84 | Reconnect to grant access |
| 92 | 85 | </Badge> |
| 93 | 86 | ) : null} |
| @@ -99,8 +92,7 @@ function AccountRow(props: { · 5 unmodified lines | ||
| 99 | 92 | ) : null} |
| 100 | 93 | {needsReconsent ? ( |
| 101 | 94 | <CardStackEntryDescription className="mt-1 text-xs text-muted-foreground"> |
| 102 | − This connection wasn't granted all the access this integration now | |
| 103 | − needs. | |
| 95 | + This connection wasn't granted all the access this integration now needs. | |
| 104 | 96 | </CardStackEntryDescription> |
| 105 | 97 | ) : null} |
| 106 | 98 | </CardStackEntryContent> |
| @@ -129,11 +121,7 @@ function AccountRow(props: { · 22 unmodified lines | ||
| 129 | 121 | <DropdownMenuItem className="text-sm" onClick={props.onReconnect}> |
| 130 | 122 | Reconnect |
| 131 | 123 | </DropdownMenuItem> |
| 132 | − <DropdownMenuItem | |
| 133 | − variant="destructive" | |
| 134 | − className="text-sm" | |
| 135 | − onClick={props.onRemove} | |
| 136 | − > | |
| 124 | + <DropdownMenuItem variant="destructive" className="text-sm" onClick={props.onRemove}> | |
| 137 | 125 | Remove |
| 138 | 126 | </DropdownMenuItem> |
| 139 | 127 | </DropdownMenuContent> |
| @@ -155,9 +143,7 @@ function OwnerAccounts(props: { · 15 unmodified lines | ||
| 155 | 143 | readonly declaredScopes: readonly string[] | undefined; |
| 156 | 144 | }) { |
| 157 | 145 | const { integration, owner } = props; |
| 158 | − const connections = useAtomValue( | |
| 159 | − connectionsForIntegrationAtom({ integration, owner }), | |
| 160 | − ); | |
| 146 | + const connections = useAtomValue(connectionsForIntegrationAtom({ integration, owner })); | |
| 161 | 147 | const doRemove = useAtomSet(removeConnectionOptimistic(owner), { |
| 162 | 148 | mode: "promiseExit", |
| 163 | 149 | }); |
| @@ -174,9 +160,7 @@ function OwnerAccounts(props: { · 10 unmodified lines | ||
| 174 | 160 | startErrorMessage: "Failed to reconnect", |
| 175 | 161 | }); |
| 176 | 162 | |
| 177 | − const rows: readonly Connection[] = AsyncResult.isSuccess(connections) | |
| 178 | − ? connections.value | |
| 179 | − : []; | |
| 163 | + const rows: readonly Connection[] = AsyncResult.isSuccess(connections) ? connections.value : []; | |
| 180 | 164 | if (rows.length === 0) return null; |
| 181 | 165 | |
| 182 | 166 | const handleReconnect = async (connection: Connection) => { |
| @@ -185,8 +169,7 @@ function OwnerAccounts(props: { · 2 unmodified lines | ||
| 185 | 169 | if (reconnectMode(connection) === "oauth") { |
| 186 | 170 | const method = props.methods.find( |
| 187 | 171 | (candidate: AuthMethod) => |
| 188 | − candidate.kind === "oauth" && | |
| 189 | − String(candidate.template) === String(connection.template), | |
| 172 | + candidate.kind === "oauth" && String(candidate.template) === String(connection.template), | |
| 190 | 173 | ); |
| 191 | 174 | if ( |
| 192 | 175 | method?.oauth?.supportsDynamicRegistration === true || |
| @@ -293,18 +276,13 @@ function OwnerAccounts(props: { · 100 unmodified lines | ||
| 293 | 276 | |
| 294 | 277 | return ( |
| 295 | 278 | <CardStack> |
| 296 | − {props.showOwnerLabels ? ( | |
| 297 | − <CardStackHeader>{ownerLabel(owner)}</CardStackHeader> | |
| 298 | − ) : null} | |
| 279 | + {props.showOwnerLabels ? <CardStackHeader>{ownerLabel(owner)}</CardStackHeader> : null} | |
| 299 | 280 | <CardStackContent> |
| 300 | 281 | {rows.map((connection: Connection) => ( |
| 301 | 282 | <AccountRow |
| 302 | 283 | key={`${connection.owner}:${connection.integration}:${connection.name}`} |
| 303 | 284 | connection={connection} |
| 304 | − needsReconsent={connectionNeedsReconsent( | |
| 305 | − connection, | |
| 306 | − props.declaredScopes, | |
| 307 | − )} | |
| 285 | + needsReconsent={connectionNeedsReconsent(connection, props.declaredScopes)} | |
| 308 | 286 | showOwnerLabel={props.showOwnerLabels} |
| 309 | 287 | onEdit={() => props.onEdit(connection)} |
| 310 | 288 | onReconnect={() => void handleReconnect(connection)} |
| @@ -335,14 +313,10 @@ export function AccountsSection(props: { · 24 unmodified lines | ||
| 335 | 313 | removeCustomMethod, |
| 336 | 314 | } = props; |
| 337 | 315 | const [adding, setAdding] = useState(false); |
| 338 | − const [editingConnection, setEditingConnection] = useState<Connection | null>( | |
| 339 | − null, | |
| 340 | − ); | |
| 341 | − const [reconnectHandoff, setReconnectHandoff] = | |
| 342 | − useState<IntegrationAccountHandoff | null>(null); | |
| 316 | + const [editingConnection, setEditingConnection] = useState<Connection | null>(null); | |
| 317 | + const [reconnectHandoff, setReconnectHandoff] = useState<IntegrationAccountHandoff | null>(null); | |
| 343 | 318 | const ownerDisplay = useOwnerDisplay(); |
| 344 | − const canAddConnection = | |
| 345 | − methods.length > 0 || createCustomMethod !== undefined; | |
| 319 | + const canAddConnection = methods.length > 0 || createCustomMethod !== undefined; | |
| 346 | 320 | |
| 347 | 321 | useEffect(() => { |
| 348 | 322 | if (accountHandoff) { |
| @@ -364,9 +338,7 @@ export function AccountsSection(props: { · 15 unmodified lines | ||
| 364 | 338 | |
| 365 | 339 | // Read both owners to decide between the grouped view and the empty CTA. The |
| 366 | 340 | // grouped sub-components re-read these (effect-atom dedupes) and self-hide. |
| 367 | − const orgConnections = useAtomValue( | |
| 368 | − connectionsForIntegrationAtom({ integration, owner: "org" }), | |
| 369 | − ); | |
| 341 | + const orgConnections = useAtomValue(connectionsForIntegrationAtom({ integration, owner: "org" })); | |
| 370 | 342 | const userConnections = useAtomValue( |
| 371 | 343 | connectionsForIntegrationAtom({ integration, owner: "user" }), |
| 372 | 344 | ); |
| @@ -377,18 +349,12 @@ export function AccountsSection(props: { · 4 unmodified lines | ||
| 377 | 349 | useAtomSet(addConnectionOptimistic("user")); |
| 378 | 350 | |
| 379 | 351 | const totalCount = useMemo(() => { |
| 380 | − const orgRows = AsyncResult.isSuccess(orgConnections) | |
| 381 | − ? orgConnections.value.length | |
| 382 | − : 0; | |
| 383 | − const userRows = AsyncResult.isSuccess(userConnections) | |
| 384 | − ? userConnections.value.length | |
| 385 | − : 0; | |
| 352 | + const orgRows = AsyncResult.isSuccess(orgConnections) ? orgConnections.value.length : 0; | |
| 353 | + const userRows = AsyncResult.isSuccess(userConnections) ? userConnections.value.length : 0; | |
| 386 | 354 | return orgRows + userRows; |
| 387 | 355 | }, [orgConnections, userConnections]); |
| 388 | 356 | |
| 389 | − const loading = | |
| 390 | − !AsyncResult.isSuccess(orgConnections) && | |
| 391 | − !AsyncResult.isSuccess(userConnections); | |
| 357 | + const loading = !AsyncResult.isSuccess(orgConnections) && !AsyncResult.isSuccess(userConnections); | |
| 392 | 358 | |
| 393 | 359 | const modalState = reconnectHandoff ?? accountHandoff; |
| 394 | 360 | const modal = ( |
| @@ -420,9 +386,7 @@ export function AccountsSection(props: { · 25 unmodified lines | ||
| 420 | 386 | onClick={() => { |
| 421 | 387 | trackEvent("connection_add_opened", { |
| 422 | 388 | integration_slug: String(integration), |
| 423 | − has_oauth_method: methods.some( | |
| 424 | − (m: AuthMethod) => m.kind === "oauth", | |
| 425 | − ), | |
| 389 | + has_oauth_method: methods.some((m: AuthMethod) => m.kind === "oauth"), | |
| 426 | 390 | has_api_key_method: methods.some( |
| 427 | 391 | (m: AuthMethod) => m.kind !== "oauth" && m.kind !== "none", |
| 428 | 392 | ), |
| @@ -442,9 +406,7 @@ export function AccountsSection(props: { · 13 unmodified lines | ||
| 442 | 406 | </div> |
| 443 | 407 | ) : totalCount === 0 ? ( |
| 444 | 408 | <div className="rounded-lg border border-dashed border-border/60 px-6 py-8 text-center"> |
| 445 | − <p className="text-sm font-medium text-foreground"> | |
| 446 | − No connections yet | |
| 447 | − </p> | |
| 409 | + <p className="text-sm font-medium text-foreground">No connections yet</p> | |
| 448 | 410 | <p className="mt-1 text-sm text-muted-foreground"> |
| 449 | 411 | Add a connection to make this integration's tools available. |
| 450 | 412 | </p> |
| @@ -455,9 +417,7 @@ export function AccountsSection(props: { · 4 unmodified lines | ||
| 455 | 417 | onClick={() => { |
| 456 | 418 | trackEvent("connection_add_opened", { |
| 457 | 419 | integration_slug: String(integration), |
| 458 | − has_oauth_method: methods.some( | |
| 459 | − (m: AuthMethod) => m.kind === "oauth", | |
| 460 | − ), | |
| 420 | + has_oauth_method: methods.some((m: AuthMethod) => m.kind === "oauth"), | |
| 461 | 421 | has_api_key_method: methods.some( |
| 462 | 422 | (m: AuthMethod) => m.kind !== "oauth" && m.kind !== "none", |
| 463 | 423 | ), |
| @@ -28,9 +28,7 @@ export function reconnectMode(connection: Connection): ReconnectMode { · 27 unmodified lines | ||
| 28 | 28 | * connection are exactly the branded types `oauth.start` expects, so the same |
| 29 | 29 | * connection (owner/integration/name) is re-minted with a fresh refresh token |
| 30 | 30 | * and the widened scope union. Returns null for a non-OAuth connection. */ |
| 31 | −export function oauthReconnectPayload( | |
| 32 | − connection: Connection, | |
| 33 | −): OAuthStartPayload | null { | |
| 31 | +export function oauthReconnectPayload(connection: Connection): OAuthStartPayload | null { | |
| 34 | 32 | if (connection.oauthClient == null) return null; |
| 35 | 33 | return { |
| 36 | 34 | client: connection.oauthClient, |
| @@ -61,8 +59,7 @@ const OAUTH_SCOPE_ALIASES: Readonly<Record<string, string>> = { · 24 unmodified lines | ||
| 61 | 59 | "https://www.googleapis.com/auth/userinfo.profile": "profile", |
| 62 | 60 | }; |
| 63 | 61 | |
| 64 | −const canonicalScope = (scope: string): string => | |
| 65 | − OAUTH_SCOPE_ALIASES[scope] ?? scope; | |
| 62 | +const canonicalScope = (scope: string): string => OAUTH_SCOPE_ALIASES[scope] ?? scope; | |
| 66 | 63 | |
| 67 | 64 | /** Normalize a scope list: trim, canonicalize known provider aliases, drop |
| 68 | 65 | * empties, de-dupe (order-preserving). A scope set is compared as a SET — |
| @@ -94,12 +91,8 @@ export function missingScopes( · 25 unmodified lines | ||
| 94 | 91 | |
| 95 | 92 | /** The scopes a connection was actually GRANTED, parsed from its space-delimited |
| 96 | 93 | * `oauthScope` record. Empty for static creds / when the AS omitted scope. */ |
| 97 | −export function connectionGrantedScopes( | |
| 98 | − connection: Connection, | |
| 99 | −): readonly string[] { | |
| 100 | − return connection.oauthScope | |
| 101 | − ? connection.oauthScope.split(/\s+/).filter(Boolean) | |
| 102 | − : []; | |
| 94 | +export function connectionGrantedScopes(connection: Connection): readonly string[] { | |
| 95 | + return connection.oauthScope ? connection.oauthScope.split(/\s+/).filter(Boolean) : []; | |
| 103 | 96 | } |
| 104 | 97 | |
| 105 | 98 | /** Whether an OAuth connection must RECONNECT to grant newly-needed access: the |
| @@ -113,10 +106,7 @@ export function connectionNeedsReconsent( · 7 unmodified lines | ||
| 113 | 106 | declaredScopes: readonly string[] | undefined, |
| 114 | 107 | ): boolean { |
| 115 | 108 | if (connection.oauthClient == null) return false; |
| 116 | − return ( | |
| 117 | − missingScopes(declaredScopes, connectionGrantedScopes(connection)).length > | |
| 118 | − 0 | |
| 119 | − ); | |
| 109 | + return missingScopes(declaredScopes, connectionGrantedScopes(connection)).length > 0; | |
| 120 | 110 | } |
| 121 | 111 | |
| 122 | 112 | /** The scopes that count as REQUIRED for a connection to be considered fully |