1import type * as appsync from "@distilled.cloud/aws/appsync";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { GraphqlApi } from "./GraphqlApi.ts";
5
6/**
7 * Runtime binding for `appsync:FlushApiCache` — flush a {@link GraphqlApi}'s
8 * server-side cache from a Lambda (or other AWS runtime), e.g. after
9 * writing to the underlying data store out of band.
10 *
11 * Fails with the typed `NotFoundException` when the API has no cache
12 * provisioned. Provide `AppSync.FlushApiCacheHttp` on the hosting
13 * function's Effect to implement the binding.
14 *
15 * ### Flushing the API Cache
16 * **Example:** Invalidate cached resolver results after an out-of-band write
17 * ```typescript
18 * const flushCache = yield* AppSync.FlushApiCache(api);
19 *
20 * yield* flushCache().pipe(
21 * // no cache provisioned — nothing to flush
22 * Effect.catchTag("NotFoundException", () => Effect.void),
23 * );
24 * ```
25 *
26 * @binding
27 */
28export interface FlushApiCache extends Binding.Service<
29 FlushApiCache,
30 "AWS.AppSync.FlushApiCache",
31 (
32 api: GraphqlApi,
33 ) => Effect.Effect<
34 () => Effect.Effect<
35 appsync.FlushApiCacheResponse,
36 appsync.FlushApiCacheError
37 >
38 >
39> {}
40export const FlushApiCache = Binding.Service<FlushApiCache>(
41 "AWS.AppSync.FlushApiCache",
42);