(
slug: IntegrationSlug,
patch: {
readonly name?: string;
readonly description?: string;
readonly config?: IntegrationConfig;
},
)
| 2353 | ); |
| 2354 | |
| 2355 | const integrationsUpdate = ( |
| 2356 | slug: IntegrationSlug, |
| 2357 | patch: { |
| 2358 | readonly name?: string; |
| 2359 | readonly description?: string; |
| 2360 | readonly config?: IntegrationConfig; |
| 2361 | }, |
| 2362 | ): Effect.Effect<void, StorageFailure> => |
| 2363 | Effect.gen(function* () { |
| 2364 | const now = new Date(); |
| 2365 | const set: Record<string, unknown> = { updated_at: now }; |
| 2366 | if (patch.name !== undefined) set.name = patch.name; |
| 2367 | if (patch.description !== undefined) set.description = patch.description; |
| 2368 | if (patch.config !== undefined) { |
| 2369 | set.config = patch.config; |
| 2370 | // A config change can change the derived tools. The writer can only |
| 2371 | // rebuild catalogs in its own partition (owner policy), so revise |
| 2372 | // the integration: other subjects' connections compare this stamp |
| 2373 | // against their `tools_synced_at` and lazily rebuild on next read. |
| 2374 | set.config_revised_at = now.getTime(); |
| 2375 | } |
| 2376 | yield* core.updateMany("integration", { |
| 2377 | where: (b: AnyCb) => b("slug", "=", String(slug)), |
| 2378 | set, |
| 2379 | }); |
| 2380 | }); |
| 2381 | |
| 2382 | const integrationsUpdatePublic = ( |
| 2383 | slug: IntegrationSlug, |
no outgoing calls
no test coverage detected