Drops the remaining legacy OAuth token model and old credential ID aliases so schema consumers align on auth connection and source auth binding identifiers.
Unified · Split
| @@ -200,8 +200,8 @@ describe("Convex executor and control-plane", () => { · 199 unmodified lines | ||
| 200 | 200 | t.action(api.controlPlane.upsertCredentialBinding, { |
| 201 | 201 | workspaceId: "ws_1", |
| 202 | 202 | payload: { |
| 203 | − id: "credential_binding_1", | |
| 204 | − credentialId: "cred_1", | |
| 203 | + id: "auth_binding_1", | |
| 204 | + credentialId: "conn_1", | |
| 205 | 205 | scopeType: "workspace", |
| 206 | 206 | sourceKey: "source:github", |
| 207 | 207 | provider: "bearer", |
| @@ -216,7 +216,7 @@ describe("Convex executor and control-plane", () => { · 8 unmodified lines | ||
| 216 | 216 | workspaceId: string | null; |
| 217 | 217 | }; |
| 218 | 218 | |
| 219 | − expect(addedCredential.id).toBe("credential_binding_1"); | |
| 219 | + expect(addedCredential.id).toBe("auth_binding_1"); | |
| 220 | 220 | expect(addedCredential.workspaceId).toBe("ws_1"); |
| 221 | 221 | |
| 222 | 222 | const listedCredentials = (yield* Effect.tryPromise(() => |
| @@ -228,12 +228,12 @@ describe("Convex executor and control-plane", () => { · 5 unmodified lines | ||
| 228 | 228 | }>; |
| 229 | 229 | |
| 230 | 230 | expect(listedCredentials).toHaveLength(1); |
| 231 | − expect(listedCredentials[0]?.id).toBe("credential_binding_1"); | |
| 231 | + expect(listedCredentials[0]?.id).toBe("auth_binding_1"); | |
| 232 | 232 | |
| 233 | 233 | const removedCredential = (yield* Effect.tryPromise(() => |
| 234 | 234 | t.mutation(api.controlPlane.removeCredentialBinding, { |
| 235 | 235 | workspaceId: "ws_1", |
| 236 | − credentialBindingId: "credential_binding_1", | |
| 236 | + credentialBindingId: "auth_binding_1", | |
| 237 | 237 | }), |
| 238 | 238 | )) as { |
| 239 | 239 | removed: boolean; |
| @@ -1127,8 +1127,8 @@ describe("Convex executor and control-plane", () => { · 887 unmodified lines | ||
| 1127 | 1127 | t.action(api.controlPlane.upsertCredentialBinding, { |
| 1128 | 1128 | workspaceId: "ws_cred", |
| 1129 | 1129 | payload: { |
| 1130 | − id: "credential_binding_linear", | |
| 1131 | − credentialId: "cred_linear", | |
| 1130 | + id: "auth_binding_linear", | |
| 1131 | + credentialId: "conn_linear", | |
| 1132 | 1132 | scopeType: "workspace", |
| 1133 | 1133 | sourceKey: "source:src_graphql_cred_1", |
| 1134 | 1134 | provider: "bearer", |
| @@ -1320,8 +1320,8 @@ describe("Convex executor and control-plane", () => { · 185 unmodified lines | ||
| 1320 | 1320 | t.action(api.controlPlane.upsertCredentialBinding, { |
| 1321 | 1321 | workspaceId: "ws_mcp_ingest", |
| 1322 | 1322 | payload: { |
| 1323 | − id: "credential_binding_mcp", | |
| 1324 | − credentialId: "cred_mcp", | |
| 1323 | + id: "auth_binding_mcp", | |
| 1324 | + credentialId: "conn_mcp", | |
| 1325 | 1325 | scopeType: "workspace", |
| 1326 | 1326 | sourceKey: "source:src_mcp_ingest_1", |
| 1327 | 1327 | provider: "bearer", |
| @@ -1612,7 +1612,7 @@ describe("Convex executor and control-plane", () => { · 284 unmodified lines | ||
| 1612 | 1612 | t.action(api.controlPlane.upsertCredentialBinding, { |
| 1613 | 1613 | workspaceId, |
| 1614 | 1614 | payload: { |
| 1615 | − id: "credential_binding_oauth_runtime_1", | |
| 1615 | + id: "auth_binding_oauth_runtime_1", | |
| 1616 | 1616 | credentialId: "conn_oauth_runtime_1", |
| 1617 | 1617 | scopeType: "workspace", |
| 1618 | 1618 | sourceKey: `source:${sourceId}`, |
| @@ -172,7 +172,7 @@ export function CredentialsView() { · 171 unmodified lines | ||
| 172 | 172 | |
| 173 | 173 | const requestId = |
| 174 | 174 | credentialEditingId ?? |
| 175 | − (createLocalId("credential_binding_") as SourceCredentialBinding["id"]); | |
| 175 | + (createLocalId("auth_binding_") as SourceCredentialBinding["id"]); | |
| 176 | 176 | |
| 177 | 177 | setCredentialBusyId(requestId); |
| 178 | 178 | |
| @@ -319,7 +319,7 @@ export function CredentialsView() { · 140 unmodified lines | ||
| 319 | 319 | id="credential-id" |
| 320 | 320 | value={credentialIdInput} |
| 321 | 321 | onChange={(event) => setCredentialIdInput(event.target.value)} |
| 322 | − placeholder="cred_123" | |
| 322 | + placeholder="conn_123" | |
| 323 | 323 | required |
| 324 | 324 | disabled={credentialBusyId !== null} |
| 325 | 325 | /> |
| @@ -497,7 +497,7 @@ export function SourceManagementPanel({ editSource, onDone }: SourceManagementPa · 496 unmodified lines | ||
| 497 | 497 | workspaceId, |
| 498 | 498 | payload: toCredentialBindingUpsertPayload({ |
| 499 | 499 | ...(existingBinding ? { id: existingBinding.id } : {}), |
| 500 | − credentialId: (existingBinding?.credentialId ?? createLocalId("cred_")) as SourceCredentialBinding["credentialId"], | |
| 500 | + credentialId: (existingBinding?.credentialId ?? createLocalId("conn_")) as SourceCredentialBinding["credentialId"], | |
| 501 | 501 | scopeType, |
| 502 | 502 | sourceKey, |
| 503 | 503 | provider: "oauth2", |
| @@ -4,7 +4,6 @@ import type { · 3 unmodified lines | ||
| 4 | 4 | UpsertCredentialBindingPayload, |
| 5 | 5 | } from "@executor-v2/management-api/credentials/api"; |
| 6 | 6 | import type { |
| 7 | − CredentialBindingId, | |
| 8 | 7 | CredentialProvider, |
| 9 | 8 | CredentialScopeType, |
| 10 | 9 | SourceCredentialBinding, |
| @@ -55,7 +54,7 @@ export const removeCredentialBinding = controlPlaneClient.mutation("credentials" · 44 unmodified lines | ||
| 55 | 54 | // --------------------------------------------------------------------------- |
| 56 | 55 | |
| 57 | 56 | export const toCredentialBindingUpsertPayload = (input: { |
| 58 | − id?: CredentialBindingId; | |
| 57 | + id?: SourceCredentialBinding["id"]; | |
| 59 | 58 | credentialId: SourceCredentialBinding["credentialId"]; |
| 60 | 59 | scopeType: CredentialScopeType; |
| 61 | 60 | sourceKey: string; |
| @@ -1,7 +1,5 @@ | ||
| 1 | 1 | import type { |
| 2 | − OAuthToken, | |
| 3 | 2 | SourceCredentialBinding, |
| 4 | − WorkspaceId, | |
| 5 | 3 | } from "@executor-v2/schema"; |
| 6 | 4 | import type { |
| 7 | 5 | RuntimeToolCallCredentialContext, |
| @@ -157,11 +155,22 @@ const parseAdditionalHeaders = ( · 149 unmodified lines | ||
| 157 | 155 | return decoded.right; |
| 158 | 156 | }; |
| 159 | 157 | |
| 158 | +type OAuthAccessTokenRecord = { | |
| 159 | + workspaceId: string; | |
| 160 | + organizationId: string | null; | |
| 161 | + accountId: string | null; | |
| 162 | + sourceId: string; | |
| 163 | + accessTokenRef: string; | |
| 164 | + expiresAt: number | null; | |
| 165 | + createdAt: number; | |
| 166 | + updatedAt: number; | |
| 167 | +}; | |
| 168 | + | |
| 160 | 169 | const tokenScopeScore = ( |
| 161 | − token: OAuthToken, | |
| 170 | + token: OAuthAccessTokenRecord, | |
| 162 | 171 | context: RuntimeToolCallCredentialContext, |
| 163 | 172 | ): number => { |
| 164 | − if (token.workspaceId !== (context.workspaceId as WorkspaceId)) { | |
| 173 | + if (token.workspaceId !== context.workspaceId) { | |
| 165 | 174 | return -1; |
| 166 | 175 | } |
| 167 | 176 | |
| @@ -196,7 +205,7 @@ const tokenScopeScore = ( · 28 unmodified lines | ||
| 196 | 205 | }; |
| 197 | 206 | |
| 198 | 207 | export const selectOAuthAccessToken = ( |
| 199 | − tokens: ReadonlyArray<OAuthToken>, | |
| 208 | + tokens: ReadonlyArray<OAuthAccessTokenRecord>, | |
| 200 | 209 | context: RuntimeToolCallCredentialContext, |
| 201 | 210 | sourceId: string, |
| 202 | 211 | ): string | null => { |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "@effect/platform"; |
| 2 | 2 | import { |
| 3 | − CredentialBindingIdSchema, | |
| 3 | + SourceAuthBindingIdSchema, | |
| 4 | 4 | SourceCredentialBindingSchema, |
| 5 | 5 | WorkspaceIdSchema, |
| 6 | 6 | } from "@executor-v2/schema"; |
| @@ -60,7 +60,7 @@ export type RemoveCredentialBindingResult = · 53 unmodified lines | ||
| 60 | 60 | const workspaceIdParam = HttpApiSchema.param("workspaceId", WorkspaceIdSchema); |
| 61 | 61 | const credentialBindingIdParam = HttpApiSchema.param( |
| 62 | 62 | "credentialBindingId", |
| 63 | − CredentialBindingIdSchema, | |
| 63 | + SourceAuthBindingIdSchema, | |
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | export class CredentialsApi extends HttpApiGroup.make("credentials") |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | import { type SourceStoreError } from "@executor-v2/persistence-ports"; |
| 2 | 2 | import { |
| 3 | − type CredentialBindingId, | |
| 4 | 3 | type SourceCredentialBinding, |
| 4 | + type SourceAuthBindingId, | |
| 5 | 5 | type WorkspaceId, |
| 6 | 6 | } from "@executor-v2/schema"; |
| 7 | 7 | import * as Effect from "effect/Effect"; |
| @@ -18,7 +18,7 @@ export type UpsertCredentialBindingInput = { · 10 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | export type RemoveCredentialBindingInput = { |
| 20 | 20 | workspaceId: WorkspaceId; |
| 21 | − credentialBindingId: CredentialBindingId; | |
| 21 | + credentialBindingId: SourceAuthBindingId; | |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | 24 | export type ControlPlaneCredentialsServiceShape = { |
| @@ -6,11 +6,6 @@ export const ProfileIdSchema = Schema.String.pipe(Schema.brand("ProfileId")); · 5 unmodified lines | ||
| 6 | 6 | export const WorkspaceIdSchema = Schema.String.pipe(Schema.brand("WorkspaceId")); |
| 7 | 7 | export const SourceIdSchema = Schema.String.pipe(Schema.brand("SourceId")); |
| 8 | 8 | export const ToolArtifactIdSchema = Schema.String.pipe(Schema.brand("ToolArtifactId")); |
| 9 | −export const CredentialBindingIdSchema = Schema.String.pipe( | |
| 10 | − Schema.brand("CredentialBindingId"), | |
| 11 | −); | |
| 12 | −export const CredentialIdSchema = Schema.String.pipe(Schema.brand("CredentialId")); | |
| 13 | −export const OAuthTokenIdSchema = Schema.String.pipe(Schema.brand("OAuthTokenId")); | |
| 14 | 9 | export const AuthConnectionIdSchema = Schema.String.pipe( |
| 15 | 10 | Schema.brand("AuthConnectionId"), |
| 16 | 11 | ); |
| @@ -42,9 +37,6 @@ export type ProfileId = typeof ProfileIdSchema.Type; · 25 unmodified lines | ||
| 42 | 37 | export type WorkspaceId = typeof WorkspaceIdSchema.Type; |
| 43 | 38 | export type SourceId = typeof SourceIdSchema.Type; |
| 44 | 39 | export type ToolArtifactId = typeof ToolArtifactIdSchema.Type; |
| 45 | −export type CredentialBindingId = typeof CredentialBindingIdSchema.Type; | |
| 46 | −export type CredentialId = typeof CredentialIdSchema.Type; | |
| 47 | −export type OAuthTokenId = typeof OAuthTokenIdSchema.Type; | |
| 48 | 40 | export type AuthConnectionId = typeof AuthConnectionIdSchema.Type; |
| 49 | 41 | export type SourceAuthBindingId = typeof SourceAuthBindingIdSchema.Type; |
| 50 | 42 | export type AuthMaterialId = typeof AuthMaterialIdSchema.Type; |
| @@ -6,7 +6,6 @@ export * from "./models/profile"; · 5 unmodified lines | ||
| 6 | 6 | export * from "./models/workspace"; |
| 7 | 7 | export * from "./models/source"; |
| 8 | 8 | export * from "./models/tool-artifact"; |
| 9 | −export * from "./models/oauth-token"; | |
| 10 | 9 | export * from "./models/source-credential-binding"; |
| 11 | 10 | export * from "./models/auth-connection"; |
| 12 | 11 | export * from "./models/source-auth-binding"; |
| @@ -1,27 +0,0 @@ | ||
| 1 | −import { Schema } from "effect"; | |
| 2 | − | |
| 3 | −import { TimestampMsSchema } from "../common"; | |
| 4 | −import { | |
| 5 | − AccountIdSchema, | |
| 6 | − OAuthTokenIdSchema, | |
| 7 | − OrganizationIdSchema, | |
| 8 | − SourceIdSchema, | |
| 9 | − WorkspaceIdSchema, | |
| 10 | −} from "../ids"; | |
| 11 | − | |
| 12 | −export const OAuthTokenSchema = Schema.Struct({ | |
| 13 | − id: OAuthTokenIdSchema, | |
| 14 | − workspaceId: WorkspaceIdSchema, | |
| 15 | − organizationId: Schema.NullOr(OrganizationIdSchema), | |
| 16 | − accountId: Schema.NullOr(AccountIdSchema), | |
| 17 | − sourceId: SourceIdSchema, | |
| 18 | − issuer: Schema.String, | |
| 19 | − accessTokenRef: Schema.String, | |
| 20 | − refreshTokenRef: Schema.NullOr(Schema.String), | |
| 21 | − scope: Schema.Array(Schema.String), | |
| 22 | − expiresAt: Schema.NullOr(TimestampMsSchema), | |
| 23 | − createdAt: TimestampMsSchema, | |
| 24 | − updatedAt: TimestampMsSchema, | |
| 25 | −}); | |
| 26 | − | |
| 27 | −export type OAuthToken = typeof OAuthTokenSchema.Type; | |
| @@ -8,15 +8,15 @@ import { · 7 unmodified lines | ||
| 8 | 8 | } from "../enums"; |
| 9 | 9 | import { |
| 10 | 10 | AccountIdSchema, |
| 11 | − CredentialBindingIdSchema, | |
| 12 | − CredentialIdSchema, | |
| 11 | + AuthConnectionIdSchema, | |
| 13 | 12 | OrganizationIdSchema, |
| 13 | + SourceAuthBindingIdSchema, | |
| 14 | 14 | WorkspaceIdSchema, |
| 15 | 15 | } from "../ids"; |
| 16 | 16 | |
| 17 | 17 | export const SourceCredentialBindingSchema = Schema.Struct({ |
| 18 | − id: CredentialBindingIdSchema, | |
| 19 | − credentialId: CredentialIdSchema, | |
| 18 | + id: SourceAuthBindingIdSchema, | |
| 19 | + credentialId: AuthConnectionIdSchema, | |
| 20 | 20 | organizationId: OrganizationIdSchema, |
| 21 | 21 | workspaceId: Schema.NullOr(WorkspaceIdSchema), |
| 22 | 22 | accountId: Schema.NullOr(AccountIdSchema), |