Unified · Split
| @@ -140,6 +140,7 @@ const googlePhotosBundleConsentScopes = ( · 139 unmodified lines | ||
| 140 | 140 | const fetchGoogleBundleConversion = ( |
| 141 | 141 | urls: readonly string[], |
| 142 | 142 | httpClientLayer: Layer.Layer<HttpClient.HttpClient, never, never>, |
| 143 | + consentScopesOverride?: readonly string[], | |
| 143 | 144 | ) => |
| 144 | 145 | Effect.forEach( |
| 145 | 146 | urls, |
| @@ -151,10 +152,10 @@ const fetchGoogleBundleConversion = ( · 5 unmodified lines | ||
| 151 | 152 | { concurrency: 4 }, |
| 152 | 153 | ).pipe( |
| 153 | 154 | Effect.flatMap((documents) => { |
| 154 | − const consentScopes = googlePhotosBundleConsentScopes(urls); | |
| 155 | + const consentScopes = consentScopesOverride ?? googlePhotosBundleConsentScopes(urls); | |
| 155 | 156 | return convertGoogleDiscoveryBundleToOpenApi({ |
| 156 | 157 | documents, |
| 157 | − ...(consentScopes ? { consentScopes } : {}), | |
| 158 | + ...(consentScopes !== undefined ? { consentScopes } : {}), | |
| 158 | 159 | }); |
| 159 | 160 | }), |
| 160 | 161 | ); |
| @@ -215,12 +216,23 @@ const makeGooglePluginExtension = ( · 54 unmodified lines | ||
| 215 | 216 | ) => { |
| 216 | 217 | const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer; |
| 217 | 218 | |
| 218 | − const addBundle = (config: GoogleBundleConfig) => | |
| 219 | + const addGoogleOpenApiIntegration = (input: { | |
| 220 | + readonly urls: readonly string[]; | |
| 221 | + readonly slug: IntegrationSlug; | |
| 222 | + readonly name: string; | |
| 223 | + readonly description: string; | |
| 224 | + readonly baseUrl?: string; | |
| 225 | + readonly consentScopes?: readonly string[]; | |
| 226 | + }) => | |
| 219 | 227 | Effect.gen(function* () { |
| 220 | − const urls = yield* googleBundleUrlsWithIdentity(config.urls); | |
| 221 | − const conversion = yield* fetchGoogleBundleConversion(urls, httpClientLayer); | |
| 228 | + const urls = yield* googleBundleUrlsWithIdentity(input.urls); | |
| 229 | + const conversion = yield* fetchGoogleBundleConversion( | |
| 230 | + urls, | |
| 231 | + httpClientLayer, | |
| 232 | + input.consentScopes, | |
| 233 | + ); | |
| 222 | 234 | const compiled = yield* compileOpenApiSpec(conversion.specText); |
| 223 | − const slug = IntegrationSlug.make(config.slug?.trim() || DEFAULT_GOOGLE_SLUG); | |
| 235 | + const slug = input.slug; | |
| 224 | 236 | |
| 225 | 237 | const existing = yield* ctx.core.integrations.get(slug); |
| 226 | 238 | if (existing) { |
| @@ -231,7 +243,7 @@ const makeGooglePluginExtension = ( · 4 unmodified lines | ||
| 231 | 243 | const integrationConfig: GoogleIntegrationConfig = { |
| 232 | 244 | specHash, |
| 233 | 245 | googleDiscoveryUrls: urls, |
| 234 | − ...(config.baseUrl ? { baseUrl: config.baseUrl } : {}), | |
| 246 | + ...(input.baseUrl ? { baseUrl: input.baseUrl } : {}), | |
| 235 | 247 | ...(conversion.authenticationTemplate |
| 236 | 248 | ? { authenticationTemplate: conversion.authenticationTemplate } |
| 237 | 249 | : {}), |
| @@ -244,8 +256,8 @@ const makeGooglePluginExtension = ( · 6 unmodified lines | ||
| 244 | 256 | Effect.gen(function* () { |
| 245 | 257 | yield* ctx.core.integrations.register({ |
| 246 | 258 | slug, |
| 247 | − name: config.name?.trim() || "Google", | |
| 248 | − description: config.description ?? "Google APIs", | |
| 259 | + name: input.name, | |
| 260 | + description: input.description, | |
| 249 | 261 | config: integrationConfig satisfies GoogleIntegrationConfig as IntegrationConfig, |
| 250 | 262 | canRemove: true, |
| 251 | 263 | canRefresh: true, |
| @@ -268,6 +280,15 @@ const makeGooglePluginExtension = ( · 16 unmodified lines | ||
| 268 | 280 | return { slug, toolCount: compiled.definitions.length }; |
| 269 | 281 | }); |
| 270 | 282 | |
| 283 | + const addBundle = (config: GoogleBundleConfig) => | |
| 284 | + addGoogleOpenApiIntegration({ | |
| 285 | + urls: config.urls, | |
| 286 | + slug: IntegrationSlug.make(config.slug?.trim() || DEFAULT_GOOGLE_SLUG), | |
| 287 | + name: config.name?.trim() || "Google", | |
| 288 | + description: config.description ?? "Google APIs", | |
| 289 | + baseUrl: config.baseUrl, | |
| 290 | + }); | |
| 291 | + | |
| 271 | 292 | const updateBundle = (rawSlug: string, input?: GoogleUpdateInput) => |
| 272 | 293 | Effect.gen(function* () { |
| 273 | 294 | const slug = IntegrationSlug.make(rawSlug); |