easy-airtable-api 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -8
- package/lib/requests.d.ts +2 -2
- package/lib/requests.js +2 -4
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -30,10 +30,10 @@ type Fields = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const record = await getRecord<Fields>({
|
|
33
|
-
apiKey:
|
|
34
|
-
baseId:
|
|
35
|
-
tableId:
|
|
36
|
-
recordId:
|
|
33
|
+
apiKey: "apiKey",
|
|
34
|
+
baseId: "baseId",
|
|
35
|
+
tableId: "tableId",
|
|
36
|
+
recordId: "recordId",
|
|
37
37
|
});
|
|
38
38
|
```
|
|
39
39
|
|
|
@@ -49,9 +49,9 @@ type Fields = {
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
const records = await getRecords<Fields>({
|
|
52
|
-
apiKey:
|
|
53
|
-
baseId:
|
|
54
|
-
tableId:
|
|
52
|
+
apiKey: "apiKey",
|
|
53
|
+
baseId: "baseId",
|
|
54
|
+
tableId: "tableId",
|
|
55
55
|
options: {
|
|
56
56
|
maxRecords: 500,
|
|
57
57
|
},
|
|
@@ -60,6 +60,10 @@ const records = await getRecords<Fields>({
|
|
|
60
60
|
|
|
61
61
|
## Changelog
|
|
62
62
|
|
|
63
|
+
### 0.0.10
|
|
64
|
+
|
|
65
|
+
- Fixed deleteRecords implementation errors.
|
|
66
|
+
|
|
63
67
|
### 0.0.9
|
|
64
68
|
|
|
65
69
|
- Implemented the deleteRecords method.
|
|
@@ -104,4 +108,4 @@ const records = await getRecords<Fields>({
|
|
|
104
108
|
|
|
105
109
|
### 0.0.1
|
|
106
110
|
|
|
107
|
-
- Initial project setup with no real functionality implemented.
|
|
111
|
+
- Initial project setup with no real functionality implemented.
|
package/lib/requests.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AirtableRecord,
|
|
1
|
+
import { AirtableRecord, DeleteRecordsResponse, GetRecordsQueryParameters } from './types/records';
|
|
2
2
|
export declare function getRecord<Fields>({ apiKey, baseId, tableId, recordId, }: {
|
|
3
3
|
apiKey: string;
|
|
4
4
|
baseId: string;
|
|
@@ -62,5 +62,5 @@ export declare function deleteRecords({ apiKey, baseId, tableId, recordIds, }: {
|
|
|
62
62
|
apiKey: string;
|
|
63
63
|
baseId: string;
|
|
64
64
|
tableId: string;
|
|
65
|
-
recordIds:
|
|
65
|
+
recordIds: string[];
|
|
66
66
|
}): Promise<DeleteRecordsResponse>;
|
package/lib/requests.js
CHANGED
|
@@ -139,15 +139,13 @@ export async function deleteRecords({ apiKey, baseId, tableId, recordIds, }) {
|
|
|
139
139
|
}
|
|
140
140
|
let combinedResults = [];
|
|
141
141
|
for (const chunk of chunks) {
|
|
142
|
+
const query = chunk.map((id) => `records[]=${id}`).join('&');
|
|
142
143
|
const result = await airtableRequest({
|
|
143
144
|
apiKey,
|
|
144
145
|
baseId,
|
|
145
146
|
tableId,
|
|
146
|
-
endpoint:
|
|
147
|
+
endpoint: `?${query}`,
|
|
147
148
|
method: 'DELETE',
|
|
148
|
-
body: {
|
|
149
|
-
records: chunk,
|
|
150
|
-
},
|
|
151
149
|
});
|
|
152
150
|
combinedResults = combinedResults.concat(result.records);
|
|
153
151
|
await delay(500);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-airtable-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "An easy way to connect to Airtable via their API.",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
18
18
|
"test": "vitest",
|
|
19
19
|
"testGetRecords": "vitest get-records.test.ts",
|
|
20
|
-
"testUpdateRecords": "vitest update-records.test.ts"
|
|
20
|
+
"testUpdateRecords": "vitest update-records.test.ts",
|
|
21
|
+
"testDeleteRecords": "vitest delete-records.test.ts"
|
|
21
22
|
},
|
|
22
23
|
"keywords": [
|
|
23
24
|
"airtable"
|