(
slug: IntegrationSlug,
patch: {
readonly name?: string;
readonly description?: string;
readonly config?: IntegrationConfig;
},
)
| 3326 | ); |
| 3327 | |
| 3328 | const integrationsUpdate = ( |
| 3329 | slug: IntegrationSlug, |
| 3330 | patch: { |
| 3331 | readonly name?: string; |
| 3332 | readonly description?: string; |
| 3333 | readonly config?: IntegrationConfig; |
| 3334 | }, |
| 3335 | ): Effect.Effect<void, OrgWriteDeniedError | StorageFailure> => |
| 3336 | transaction( |
| 3337 | Effect.gen(function* () { |
| 3338 | yield* guardOrgWrite(); |
| 3339 | const now = new Date(); |
| 3340 | const set: Record<string, unknown> = { updated_at: now }; |
| 3341 | if (patch.name !== undefined) set.name = patch.name; |
| 3342 | if (patch.description !== undefined) set.description = patch.description; |
| 3343 | if (patch.config !== undefined) { |
| 3344 | set.config = patch.config; |
| 3345 | // A config change can change the derived tools. The writer can only |
| 3346 | // rebuild catalogs in its own partition (owner policy), so revise |
| 3347 | // the integration: other subjects' connections compare this stamp |
| 3348 | // against their `tools_synced_at` and lazily rebuild on next read. |
| 3349 | set.config_revised_at = now.getTime(); |
| 3350 | } |
| 3351 | yield* core.updateMany("integration", { |
| 3352 | where: (b: AnyCb) => b("slug", "=", String(slug)), |
| 3353 | set, |
| 3354 | }); |
| 3355 | }), |
| 3356 | ); |
| 3357 | |
| 3358 | const integrationsUpdatePublic = ( |
| 3359 | slug: IntegrationSlug, |
no test coverage detected