| @@ -11,6 +11,11 @@ import { · 10 unmodified lines |
| 11 | } from "@executor-js/sdk"; | 11 | } from "@executor-js/sdk"; |
| 12 | import { BindingError, type ClientResolver, type ConnectionCandidate } from "./bindings"; | 12 | import { BindingError, type ClientResolver, type ConnectionCandidate } from "./bindings"; |
| 13 | | 13 | |
| | 14 | export interface AppsResolverPluginCtx { |
| | 15 | readonly connections: Pick<PluginCtx["connections"], "list" | "get">; |
| | 16 | readonly execute: PluginCtx["execute"]; |
| | 17 | } |
| | 18 | |
| 14 | const parseConnectionAddress = (address: string): ConnectionRef | null => { | 19 | const parseConnectionAddress = (address: string): ConnectionRef | null => { |
| 15 | const parts = address.split("."); | 20 | const parts = address.split("."); |
| 16 | if (parts.length !== 4 || parts[0] !== "tools") return null; | 21 | if (parts.length !== 4 || parts[0] !== "tools") return null; |
| @@ -36,7 +41,9 @@ const toCandidate = (connection: { · 19 unmodified lines |
| 36 | ...(connection.owner !== undefined ? { owner: String(connection.owner) } : {}), | 41 | ...(connection.owner !== undefined ? { owner: String(connection.owner) } : {}), |
| 37 | }); | 42 | }); |
| 38 | | 43 | |
| 39 | export const makePluginCtxAppsResolver = (input: { readonly ctx: PluginCtx }): ClientResolver => ({ | 44 | export const makePluginCtxAppsResolver = (input: { |
| | 45 | readonly ctx: AppsResolverPluginCtx; |
| | 46 | }): ClientResolver => ({ |
| 40 | listConnections: ({ integration }) => | 47 | listConnections: ({ integration }) => |
| 41 | input.ctx.connections.list({ integration: IntegrationSlug.make(integration) }).pipe( | 48 | input.ctx.connections.list({ integration: IntegrationSlug.make(integration) }).pipe( |
| 42 | Effect.map((connections) => connections.map(toCandidate)), | 49 | Effect.map((connections) => connections.map(toCandidate)), |