(
slug: IntegrationSlug,
patch: {
readonly name?: string;
readonly description?: string;
readonly config?: IntegrationConfig;
},
)
| 3270 | ); |
| 3271 | |
| 3272 | const integrationsUpdate = ( |
| 3273 | slug: IntegrationSlug, |
| 3274 | patch: { |
| 3275 | readonly name?: string; |
| 3276 | readonly description?: string; |
| 3277 | readonly config?: IntegrationConfig; |
| 3278 | }, |
| 3279 | ): Effect.Effect<void, OrgWriteDeniedError | StorageFailure> => |
| 3280 | transaction( |
| 3281 | Effect.gen(function* () { |
| 3282 | yield* guardOrgWrite(); |
| 3283 | const now = new Date(); |
| 3284 | const set: Record<string, unknown> = { updated_at: now }; |
| 3285 | if (patch.name !== undefined) set.name = patch.name; |
| 3286 | if (patch.description !== undefined) set.description = patch.description; |
| 3287 | if (patch.config !== undefined) { |
| 3288 | set.config = patch.config; |
| 3289 | // A config change can change the derived tools. The writer can only |
| 3290 | // rebuild catalogs in its own partition (owner policy), so revise |
| 3291 | // the integration: other subjects' connections compare this stamp |
| 3292 | // against their `tools_synced_at` and lazily rebuild on next read. |
| 3293 | set.config_revised_at = now.getTime(); |
| 3294 | } |
| 3295 | yield* core.updateMany("integration", { |
| 3296 | where: (b: AnyCb) => b("slug", "=", String(slug)), |
| 3297 | set, |
| 3298 | }); |
| 3299 | }), |
| 3300 | ); |
| 3301 | |
| 3302 | const integrationsUpdatePublic = ( |
| 3303 | slug: IntegrationSlug, |
no test coverage detected