MCPcopy Create free account
hub / github.com/firebase/firebase-tools / updateRulesWithClient

Function updateRulesWithClient

src/rtdb.ts:35–57  ·  view source on GitHub ↗
(
  client: Client,
  src: unknown,
  options: { dryRun?: boolean } = {},
)

Source from the content-addressed store, hash-verified

33}
34
35export 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}

Callers 2

updateRulesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…