(
input: unknown,
output: Exit.Exit<unknown, unknown>,
serverKeys: ReadonlyArray<InvalidationKey>,
writeDependencies: DataDependencies.DataDependencies = DataDependencies.empty()
)
| 304 | throw new Error("Unsupported query invalidation filter: only filters.queryKey is supported") |
| 305 | } |
| 306 | return keys |
| 307 | } |
| 308 | |
| 309 | // No manual `invalidatesQueries`: contribute nothing. Invalidation rides entirely on the |
| 310 | // repository-derived write-dependencies (plus any server-provided keys) — there is no default |
| 311 | // namespace invalidation of the command's own resource. |
| 312 | return [] |
| 313 | } |
| 314 | |
| 315 | const invalidateCache = ( |
| 316 | input: unknown, |
| 317 | output: Exit.Exit<unknown, unknown>, |
| 318 | serverKeys: ReadonlyArray<InvalidationKey>, |
| 319 | writeDependencies: DataDependencies.DataDependencies = DataDependencies.empty() |
| 320 | ) => |
| 321 | Effect.suspend(() => { |
| 322 | if (self.disableQueryInvalidation) return Effect.void |
| 323 | |
| 324 | const clientKeys = getClientInvalidationKeys(input, output) |
| 325 | // Derive extra reactivity keys from repository write-dependencies: every live query whose |
| 326 | // recorded read-dependencies intersect this mutation's writes must be refreshed. |
| 327 | const derivedKeys = getDerivedInvalidationKeys(writeDependencies) |
| 328 | // Invalidate exact reactivity keys (= the prefixes query atoms register under). Each key |
| 329 | // array is hashed structurally, matching the query-side registration. |
| 330 | const keys: ReadonlyArray<ReadonlyArray<unknown>> = [...clientKeys, ...serverKeys, ...derivedKeys] |
| 331 | |
| 332 | if (!isReadonlyArrayNonEmpty(keys)) return Effect.void |
| 333 | |
| 334 | const { awaitKeys, softKeys } = partitionInvalidationKeys(keys) |
| 335 | |
| 336 | return Effect |
| 337 | .andThen( |
| 338 | Effect.annotateCurrentSpan({ |
| 339 | keys, |
| 340 | awaitKeys, |
| 341 | softKeys, |
| 342 | clientKeys, |
| 343 | serverKeys, |
| 344 | derivedKeys, |
| 345 | writeDependencies: [...writeDependencies] |
no test coverage detected
searching dependent graphs…