({
database,
query,
action,
fieldToClear,
runOptions,
many,
validSchemaController,
})
| 24 | } |
| 25 | |
| 26 | async function performAction({ |
| 27 | database, |
| 28 | query, |
| 29 | action, |
| 30 | fieldToClear, |
| 31 | runOptions, |
| 32 | many, |
| 33 | validSchemaController, |
| 34 | }) { |
| 35 | if (action === 'delete') { |
| 36 | return database.destroy(CLASS_NAME, query, runOptions, validSchemaController); |
| 37 | } |
| 38 | if (action === 'update') { |
| 39 | return database.update( |
| 40 | CLASS_NAME, |
| 41 | query, |
| 42 | { [fieldToClear]: { __op: 'Delete' } }, |
| 43 | { ...runOptions, many }, |
| 44 | false, |
| 45 | false, |
| 46 | validSchemaController |
| 47 | ); |
| 48 | } |
| 49 | throw new Error(`Unknown installation dedup action: ${action}`); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Removes or updates `_Installation` rows that hold a `deviceToken` matching the query, |
no test coverage detected