(
projectId: string,
instance: string,
src: any,
options: { dryRun?: boolean } = {},
)
| 8 | * Updates rules, optionally specifying a dry run flag for validation purposes. |
| 9 | */ |
| 10 | export 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 | |
| 35 | export async function updateRulesWithClient( |
| 36 | client: Client, |
nothing calls this directly
no test coverage detected
searching dependent graphs…