(key: IntegrationTaskKey, recordIds: string[])
| 119 | } |
| 120 | |
| 121 | deleteRecords(key: IntegrationTaskKey, recordIds: string[]) { |
| 122 | return this.runTask( |
| 123 | key, |
| 124 | async (client) => { |
| 125 | const result = await client |
| 126 | .base(this.baseId) |
| 127 | // official types are wrong - we need to use our extended AirtableFieldSet here |
| 128 | // @ts-ignore |
| 129 | .table<TFields>(this.tableName) |
| 130 | .destroy(recordIds); |
| 131 | return result.map((record) => toSerializableRecord<TFields>(record)); |
| 132 | }, |
| 133 | { |
| 134 | name: "Delete Records", |
| 135 | params: { recordIds }, |
| 136 | properties: [ |
| 137 | ...tableParams({ baseId: this.baseId, tableName: this.tableName }), |
| 138 | { label: "Deleted records", text: recordIds.length.toString() }, |
| 139 | ], |
| 140 | } |
| 141 | ); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | function toSerializableRecord<TFields extends AirtableFieldSet>(record: AirtableRecord<TFields>) { |
no test coverage detected