| 1 | import * as DynamoDB from "@distilled.cloud/aws/dynamodb"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import * as Output from "../../Output.ts"; |
| 4 | import { makeTableIamHttpBinding } from "./BindingHttp.ts"; |
| 5 | import { ExecuteStatement } from "./ExecuteStatement.ts"; |
| 6 | |
| 7 | export const ExecuteStatementHttp = Layer.effect( |
| 8 | ExecuteStatement, |
| 9 | makeTableIamHttpBinding({ |
| 10 | tag: "AWS.DynamoDB.ExecuteStatement", |
| 11 | operation: DynamoDB.executeStatement, |
| 12 | actions: [ |
| 13 | "dynamodb:PartiQLDelete", |
| 14 | "dynamodb:PartiQLInsert", |
| 15 | "dynamodb:PartiQLSelect", |
| 16 | "dynamodb:PartiQLUpdate", |
| 17 | ], |
| 18 | resources: (table) => [ |
| 19 | table.tableArn, |
| 20 | Output.interpolate`${table.tableArn}/index/*`, |
| 21 | ], |
| 22 | }), |
| 23 | ); |