| 1 | import type * as SVC from "@distilled.cloud/aws/finspace"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { KxEnvironment } from "./KxEnvironment.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `finspace:GetKxDatabase` — reads one kdb database of the bound environment — including `lastCompletedChangesetId`, the anchor ingestion pipelines use to advance dataviews. |
| 8 | * Provide the implementation with |
| 9 | * `Effect.provide(AWS.FinSpace.GetKxDatabaseHttp)`. |
| 10 | * ### Reading Databases |
| 11 | * **Example:** Read the Latest Changeset Id |
| 12 | * ```typescript |
| 13 | * const getDatabase = yield* AWS.FinSpace.GetKxDatabase(kdb); |
| 14 | * |
| 15 | * const { lastCompletedChangesetId } = yield* getDatabase({ |
| 16 | * databaseName: "ticks", |
| 17 | * }); |
| 18 | * ``` |
| 19 | * |
| 20 | * @binding |
| 21 | */ |
| 22 | export interface GetKxDatabase extends Binding.Service< |
| 23 | GetKxDatabase, |
| 24 | "AWS.FinSpace.GetKxDatabase", |
| 25 | <K extends KxEnvironment>( |
| 26 | environment: K, |
| 27 | ) => Effect.Effect< |
| 28 | ( |
| 29 | request: Omit<SVC.GetKxDatabaseRequest, "environmentId">, |
| 30 | ) => Effect.Effect<SVC.GetKxDatabaseResponse, SVC.GetKxDatabaseError> |
| 31 | > |
| 32 | > {} |
| 33 | export const GetKxDatabase = Binding.Service<GetKxDatabase>( |
| 34 | "AWS.FinSpace.GetKxDatabase", |
| 35 | ); |