(
client: Client,
src: unknown,
options: { dryRun?: boolean } = {},
)
| 33 | } |
| 34 | |
| 35 | export async function updateRulesWithClient( |
| 36 | client: Client, |
| 37 | src: unknown, |
| 38 | options: { dryRun?: boolean } = {}, |
| 39 | ) { |
| 40 | const queryParams: { dryRun?: string } = {}; |
| 41 | if (options.dryRun) { |
| 42 | queryParams.dryRun = "true"; |
| 43 | } |
| 44 | |
| 45 | const response = await client.request<any, any>({ |
| 46 | method: "PUT", |
| 47 | path: ".settings/rules.json", |
| 48 | queryParams, |
| 49 | body: src, |
| 50 | resolveOnHTTPError: true, |
| 51 | }); |
| 52 | if (response.status === 400) { |
| 53 | throw new FirebaseError(`Syntax error in database rules:\n\n${response.body.error}`); |
| 54 | } else if (response.status > 400) { |
| 55 | throw new FirebaseError("Unexpected error while deploying database rules.", { exit: 2 }); |
| 56 | } |
| 57 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…