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

Function updateRules

src/rtdb.ts:10–33  ·  view source on GitHub ↗
(
  projectId: string,
  instance: string,
  src: any,
  options: { dryRun?: boolean } = {},
)

Source from the content-addressed store, hash-verified

8 * Updates rules, optionally specifying a dry run flag for validation purposes.
9 */
10export async function updateRules(
11 projectId: string,
12 instance: string,
13 src: any,
14 options: { dryRun?: boolean } = {},
15): Promise<void> {
16 const downstreamOptions: {
17 instance: string;
18 project: string;
19 instanceDetails?: DatabaseInstance;
20 } = { instance: instance, project: projectId };
21 await populateInstanceDetails(downstreamOptions);
22 if (!downstreamOptions.instanceDetails) {
23 throw new FirebaseError(`Could not get instance details`, { exit: 2 });
24 }
25 const origin = utils.getDatabaseUrl(
26 realtimeOriginOrCustomUrl(downstreamOptions.instanceDetails.databaseUrl),
27 instance,
28 "",
29 );
30 const client = new Client({ urlPrefix: origin });
31
32 return updateRulesWithClient(client, src, options);
33}
34
35export async function updateRulesWithClient(
36 client: Client,

Callers

nothing calls this directly

Calls 3

populateInstanceDetailsFunction · 0.90
updateRulesWithClientFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…