easy-airtable-api 0.0.1 → 0.0.3
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 +31 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +5 -0
- package/lib/cjs/requests.d.ts +46 -0
- package/lib/cjs/requests.js +186 -0
- package/lib/cjs/types/bases.d.ts +63 -0
- package/lib/cjs/types/bases.js +2 -0
- package/lib/cjs/types/fields.d.ts +328 -0
- package/lib/cjs/types/fields.js +2 -0
- package/lib/cjs/types/records.d.ts +131 -0
- package/lib/cjs/types/records.js +2 -0
- package/lib/cjs/types/tables.d.ts +99 -0
- package/lib/cjs/types/tables.js +2 -0
- package/lib/cjs/utils.d.ts +4 -0
- package/lib/cjs/utils.js +32 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/requests.d.ts +46 -0
- package/lib/esm/requests.js +177 -0
- package/lib/esm/types/bases.d.ts +63 -0
- package/lib/esm/types/bases.js +1 -0
- package/lib/esm/types/fields.d.ts +328 -0
- package/lib/esm/types/fields.js +1 -0
- package/lib/esm/types/records.d.ts +131 -0
- package/lib/esm/types/records.js +1 -0
- package/lib/esm/types/tables.d.ts +99 -0
- package/lib/esm/types/tables.js +1 -0
- package/lib/esm/utils.d.ts +4 -0
- package/lib/esm/utils.js +26 -0
- package/package.json +46 -7
- package/{tsconfig.json → tsconfig.cjs.json} +8 -2
- package/tsconfig.esm.json +21 -0
- package/lib/main.d.ts +0 -0
- package/lib/main.js +0 -1
- package/src/main.ts +0 -0
package/README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
1
|
# Easy Airtable API
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is meant as an easier/better-to-use alternative to the official Airtable node app.
|
|
4
|
+
|
|
5
|
+
My focus is on delivering a better experience using types and making it easier to get and modify records with some helper functions.
|
|
6
|
+
|
|
7
|
+
Currently, this project is super early and still needs a lot of work. However, most methods have been implemented to at least get and update records.
|
|
8
|
+
|
|
9
|
+
More to come soon.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
npm install easy-airtable-api
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Changelog
|
|
18
|
+
|
|
19
|
+
### 0.0.3
|
|
20
|
+
|
|
21
|
+
- ESM & CJS builds/
|
|
22
|
+
- Server error handling.
|
|
23
|
+
- Generic field types.
|
|
24
|
+
|
|
25
|
+
### 0.0.2
|
|
26
|
+
|
|
27
|
+
- Basic request functions to get or update records.
|
|
28
|
+
- Added type definitions for requests and fields.
|
|
29
|
+
- Basic tests to check the core functionality of the library.
|
|
30
|
+
|
|
31
|
+
### 0.0.1
|
|
32
|
+
|
|
33
|
+
- Basic project setup - no real functionality.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getRecord } from './requests';
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AirtableRecord, GetRecordsQueryParameters, UpdateRecordsRequestOptions } from './types/records';
|
|
2
|
+
export declare function getRecord<Fields>({ apiKey, baseId, tableId, recordId, }: {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
baseId: string;
|
|
5
|
+
tableId: string;
|
|
6
|
+
recordId: string;
|
|
7
|
+
}): Promise<AirtableRecord<Fields>>;
|
|
8
|
+
export declare function getRecords<Fields>({ apiKey, baseId, tableId, options, }: {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
baseId: string;
|
|
11
|
+
tableId: string;
|
|
12
|
+
options: GetRecordsQueryParameters;
|
|
13
|
+
}): Promise<AirtableRecord<Fields>[]>;
|
|
14
|
+
export declare function updateRecord<Fields>({ apiKey, baseId, tableId, recordId, fields, }: {
|
|
15
|
+
apiKey: string;
|
|
16
|
+
baseId: string;
|
|
17
|
+
tableId: string;
|
|
18
|
+
recordId: string;
|
|
19
|
+
fields: object;
|
|
20
|
+
}): Promise<AirtableRecord<Fields>>;
|
|
21
|
+
export declare function updateRecords<Fields>({ apiKey, baseId, tableId, records, options, }: {
|
|
22
|
+
apiKey: string;
|
|
23
|
+
baseId: string;
|
|
24
|
+
tableId: string;
|
|
25
|
+
records: {
|
|
26
|
+
id: string;
|
|
27
|
+
fields: object;
|
|
28
|
+
}[];
|
|
29
|
+
options?: UpdateRecordsRequestOptions;
|
|
30
|
+
}): Promise<AirtableRecord<Fields>[]>;
|
|
31
|
+
export declare function replaceRecord<Fields>({ apiKey, baseId, tableId, recordId, fields, }: {
|
|
32
|
+
apiKey: string;
|
|
33
|
+
baseId: string;
|
|
34
|
+
tableId: string;
|
|
35
|
+
recordId: string;
|
|
36
|
+
fields: object;
|
|
37
|
+
}): Promise<AirtableRecord<Fields>>;
|
|
38
|
+
export declare function replaceMultipleRecords<Fields>({ apiKey, baseId, tableId, records, }: {
|
|
39
|
+
apiKey: string;
|
|
40
|
+
baseId: string;
|
|
41
|
+
tableId: string;
|
|
42
|
+
records: {
|
|
43
|
+
id: string;
|
|
44
|
+
fields: object;
|
|
45
|
+
}[];
|
|
46
|
+
}): Promise<AirtableRecord<Fields>[]>;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.replaceMultipleRecords = exports.replaceRecord = exports.updateRecords = exports.updateRecord = exports.getRecords = exports.getRecord = void 0;
|
|
13
|
+
const https_1 = require("https");
|
|
14
|
+
const url_1 = require("url");
|
|
15
|
+
function getRecord({ apiKey, baseId, tableId, recordId, }) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
return airtableRequest({
|
|
18
|
+
apiKey,
|
|
19
|
+
baseId,
|
|
20
|
+
tableId,
|
|
21
|
+
endpoint: `/${recordId}`,
|
|
22
|
+
method: 'GET',
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.getRecord = getRecord;
|
|
27
|
+
function getRecords({ apiKey, baseId, tableId, options, }) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return airtableRequest({
|
|
30
|
+
apiKey,
|
|
31
|
+
baseId,
|
|
32
|
+
tableId,
|
|
33
|
+
endpoint: '/listRecords',
|
|
34
|
+
method: 'POST',
|
|
35
|
+
body: options,
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
exports.getRecords = getRecords;
|
|
40
|
+
function updateRecord({ apiKey, baseId, tableId, recordId, fields, }) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
return airtableRequest({
|
|
43
|
+
apiKey,
|
|
44
|
+
baseId,
|
|
45
|
+
tableId,
|
|
46
|
+
endpoint: `/${recordId}`,
|
|
47
|
+
method: 'PATCH',
|
|
48
|
+
body: { fields },
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.updateRecord = updateRecord;
|
|
53
|
+
function updateRecords({ apiKey, baseId, tableId, records, options, }) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
if (!Array.isArray(records) || records.length === 0) {
|
|
56
|
+
throw new Error('The records array is empty or not provided. Please provide a non-empty array of records to update.');
|
|
57
|
+
}
|
|
58
|
+
return airtableRequest({
|
|
59
|
+
apiKey,
|
|
60
|
+
baseId,
|
|
61
|
+
tableId,
|
|
62
|
+
endpoint: '/',
|
|
63
|
+
method: 'PATCH',
|
|
64
|
+
body: Object.assign({ records }, options),
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
exports.updateRecords = updateRecords;
|
|
69
|
+
function replaceRecord({ apiKey, baseId, tableId, recordId, fields, }) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
return airtableRequest({
|
|
72
|
+
apiKey,
|
|
73
|
+
baseId,
|
|
74
|
+
tableId,
|
|
75
|
+
endpoint: `/${recordId}`,
|
|
76
|
+
method: 'PUT',
|
|
77
|
+
body: { fields },
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
exports.replaceRecord = replaceRecord;
|
|
82
|
+
function replaceMultipleRecords({ apiKey, baseId, tableId, records, }) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
if (!Array.isArray(records) || records.length === 0) {
|
|
85
|
+
throw new Error('The records array is empty or not provided. Please provide a non-empty array of records to replace.');
|
|
86
|
+
}
|
|
87
|
+
return airtableRequest({
|
|
88
|
+
apiKey,
|
|
89
|
+
baseId,
|
|
90
|
+
tableId,
|
|
91
|
+
endpoint: '/',
|
|
92
|
+
method: 'PUT',
|
|
93
|
+
body: { records },
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
exports.replaceMultipleRecords = replaceMultipleRecords;
|
|
98
|
+
function airtableRequest(request) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const { apiKey, baseId, tableId, endpoint, method, body, apiURL } = request;
|
|
101
|
+
const url = apiURL || 'https://api.airtable.com/v0';
|
|
102
|
+
if (!apiKey) {
|
|
103
|
+
throw new Error('API key is not set. Please provide a valid Airtable API key.');
|
|
104
|
+
}
|
|
105
|
+
if (!baseId) {
|
|
106
|
+
throw new Error('Base ID is not set. Please provide a valid Airtable base ID.');
|
|
107
|
+
}
|
|
108
|
+
if (!tableId) {
|
|
109
|
+
throw new Error('Table ID/Name is not set. Please provide a valid Airtable table ID or name.');
|
|
110
|
+
}
|
|
111
|
+
const response = yield apiRequest({
|
|
112
|
+
url: `${url}/${baseId}/${tableId}${endpoint}`,
|
|
113
|
+
apiKey,
|
|
114
|
+
method,
|
|
115
|
+
body,
|
|
116
|
+
});
|
|
117
|
+
validateResponse(response);
|
|
118
|
+
return response.data;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function validateResponse(response) {
|
|
122
|
+
const statusCode = response.statusCode;
|
|
123
|
+
console.log(response);
|
|
124
|
+
if (statusCode === 200)
|
|
125
|
+
return;
|
|
126
|
+
if (statusCode === 401)
|
|
127
|
+
throw new Error('Wrong API Key.');
|
|
128
|
+
else if (statusCode === 403)
|
|
129
|
+
throw new Error('NOT_AUTHORIZED');
|
|
130
|
+
else if (statusCode === 404)
|
|
131
|
+
throw new Error('NOT_FOUND');
|
|
132
|
+
else if (statusCode === 413)
|
|
133
|
+
throw new Error('Request body is too large');
|
|
134
|
+
else if (statusCode === 422)
|
|
135
|
+
throw new Error('Operation cannot be processed');
|
|
136
|
+
else if (statusCode === 429)
|
|
137
|
+
throw new Error('TOO_MANY_REQUESTS');
|
|
138
|
+
else if (statusCode === 500)
|
|
139
|
+
throw new Error('SERVER_ERROR');
|
|
140
|
+
else if (statusCode === 503)
|
|
141
|
+
throw new Error('SERVICE_UNAVAILABLE');
|
|
142
|
+
throw new Error('UNEXPECTED_ERROR');
|
|
143
|
+
}
|
|
144
|
+
function apiRequest({ url, method, apiKey, body, }) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
return new Promise((resolve, reject) => {
|
|
147
|
+
const parsedUrl = new url_1.URL(url);
|
|
148
|
+
const { hostname, pathname, search } = parsedUrl;
|
|
149
|
+
const options = {
|
|
150
|
+
method,
|
|
151
|
+
hostname,
|
|
152
|
+
path: `${pathname}${search}`,
|
|
153
|
+
timeout: 300000,
|
|
154
|
+
headers: {
|
|
155
|
+
'Content-Type': 'application/json',
|
|
156
|
+
Authorization: `Bearer ${apiKey}`,
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
const req = (0, https_1.request)(options, (res) => {
|
|
160
|
+
let data = '';
|
|
161
|
+
res.on('data', (chunk) => {
|
|
162
|
+
data += chunk;
|
|
163
|
+
});
|
|
164
|
+
res.on('end', () => {
|
|
165
|
+
try {
|
|
166
|
+
resolve({
|
|
167
|
+
data: JSON.parse(data),
|
|
168
|
+
statusCode: res.statusCode,
|
|
169
|
+
statusMessage: res.statusMessage,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
reject(new Error(`Failed to parse response as JSON: ${data}`));
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
req.on('error', (error) => {
|
|
178
|
+
reject(new Error(`airtableApi: ${error.message} (fn_${apiRequest.name})`));
|
|
179
|
+
});
|
|
180
|
+
if (body) {
|
|
181
|
+
req.write(JSON.stringify(body));
|
|
182
|
+
}
|
|
183
|
+
req.end();
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
type BaseList = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
permissionLevel: 'none' | 'read' | 'comment' | 'edit' | 'create';
|
|
5
|
+
};
|
|
6
|
+
export type ListBasesResponse = {
|
|
7
|
+
bases: BaseList[];
|
|
8
|
+
offset?: string;
|
|
9
|
+
};
|
|
10
|
+
type BasesFieldOptions = {
|
|
11
|
+
inverseLinkFieldId?: string;
|
|
12
|
+
isReversed?: boolean;
|
|
13
|
+
linkedTableId?: string;
|
|
14
|
+
prefersSingleRecordLink?: boolean;
|
|
15
|
+
};
|
|
16
|
+
type Field = {
|
|
17
|
+
description?: string;
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
type: string;
|
|
21
|
+
options?: BasesFieldOptions;
|
|
22
|
+
};
|
|
23
|
+
type TableView = {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
type Table = {
|
|
29
|
+
description?: string;
|
|
30
|
+
fields: Field[];
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
primaryFieldId: string;
|
|
34
|
+
views: TableView[];
|
|
35
|
+
};
|
|
36
|
+
export type GetBaseSchemaResponse = {
|
|
37
|
+
tables: Table[];
|
|
38
|
+
};
|
|
39
|
+
type TableConfigFieldOptions = {
|
|
40
|
+
color?: string;
|
|
41
|
+
icon?: string;
|
|
42
|
+
};
|
|
43
|
+
type TableConfigField = {
|
|
44
|
+
description?: string;
|
|
45
|
+
name: string;
|
|
46
|
+
type: string;
|
|
47
|
+
options?: TableConfigFieldOptions;
|
|
48
|
+
};
|
|
49
|
+
type BasesTableConfig = {
|
|
50
|
+
description?: string;
|
|
51
|
+
fields: TableConfigField[];
|
|
52
|
+
name: string;
|
|
53
|
+
};
|
|
54
|
+
export type CreateBaseRequestBody = {
|
|
55
|
+
name: string;
|
|
56
|
+
tables: BasesTableConfig[];
|
|
57
|
+
workspaceId: string;
|
|
58
|
+
};
|
|
59
|
+
export type CreateBaseResponse = {
|
|
60
|
+
id: string;
|
|
61
|
+
tables: Table[];
|
|
62
|
+
};
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
type AIState = 'empty' | 'loading' | 'generated' | 'error';
|
|
2
|
+
export interface AICell {
|
|
3
|
+
state: AIState;
|
|
4
|
+
isStale: boolean;
|
|
5
|
+
value: string | null;
|
|
6
|
+
errorType?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AIFieldTypeAndOptions {
|
|
9
|
+
type: 'aiText';
|
|
10
|
+
options: {
|
|
11
|
+
prompt?: (string | {
|
|
12
|
+
field: {
|
|
13
|
+
fieldId: string;
|
|
14
|
+
referencedFieldIds?: string[];
|
|
15
|
+
};
|
|
16
|
+
})[];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface AttachmentWrite {
|
|
20
|
+
url: string;
|
|
21
|
+
filename?: string;
|
|
22
|
+
id?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface AttachmentFieldTypeAndOptions {
|
|
25
|
+
type: 'multipleAttachments';
|
|
26
|
+
options: {
|
|
27
|
+
isReversed: boolean;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export type AutoNumberCell = number;
|
|
31
|
+
export interface AutoNumberFieldTypeAndOptions {
|
|
32
|
+
type: 'autoNumber';
|
|
33
|
+
}
|
|
34
|
+
export interface BarcodeCell {
|
|
35
|
+
type?: string;
|
|
36
|
+
text: string;
|
|
37
|
+
}
|
|
38
|
+
export interface BarcodeFieldTypeAndOptions {
|
|
39
|
+
type: 'barcode';
|
|
40
|
+
}
|
|
41
|
+
export interface ButtonCell {
|
|
42
|
+
label: string;
|
|
43
|
+
url: string | null;
|
|
44
|
+
}
|
|
45
|
+
export interface ButtonFieldTypeAndOptions {
|
|
46
|
+
type: 'button';
|
|
47
|
+
}
|
|
48
|
+
export type CheckboxCellV1 = true | 'empty';
|
|
49
|
+
export type CheckboxCellV2 = true | null;
|
|
50
|
+
export interface CheckboxFieldTypeAndOptions {
|
|
51
|
+
type: 'checkbox';
|
|
52
|
+
options: {
|
|
53
|
+
color: 'yellowBright' | 'orangeBright' | 'redBright' | 'pinkBright' | 'purpleBright' | 'blueBright' | 'cyanBright' | 'tealBright' | 'greenBright' | 'grayBright';
|
|
54
|
+
icon: 'check' | 'xCheckbox' | 'star' | 'heart' | 'thumbsUp' | 'flag' | 'dot';
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export interface CollaboratorCell {
|
|
58
|
+
id: string;
|
|
59
|
+
email?: string;
|
|
60
|
+
name?: string;
|
|
61
|
+
profilePicUrl?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface SingleCollaboratorFieldTypeAndOptions {
|
|
64
|
+
type: 'singleCollaborator';
|
|
65
|
+
options: {};
|
|
66
|
+
}
|
|
67
|
+
export type CountCell = number;
|
|
68
|
+
export interface CountFieldTypeAndOptions {
|
|
69
|
+
type: 'count';
|
|
70
|
+
options: {
|
|
71
|
+
isValid: boolean;
|
|
72
|
+
recordLinkFieldId?: string | null;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export type CreatedByCell = CollaboratorCell;
|
|
76
|
+
export interface CreatedByFieldTypeAndOptions {
|
|
77
|
+
type: 'createdBy';
|
|
78
|
+
}
|
|
79
|
+
export type CreatedTimeCell = string;
|
|
80
|
+
export interface CreatedTimeFieldTypeAndOptions {
|
|
81
|
+
type: 'createdTime';
|
|
82
|
+
options: {
|
|
83
|
+
result?: any;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export type CurrencyCell = number;
|
|
87
|
+
export interface CurrencyFieldTypeAndOptions {
|
|
88
|
+
type: 'currency';
|
|
89
|
+
options: {
|
|
90
|
+
precision: number;
|
|
91
|
+
symbol: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export type DateCell = string;
|
|
95
|
+
export interface DateFormatOptions {
|
|
96
|
+
format: 'l' | 'LL' | 'M/D/YYYY' | 'D/M/YYYY' | 'YYYY-MM-DD';
|
|
97
|
+
name: 'local' | 'friendly' | 'us' | 'european' | 'iso';
|
|
98
|
+
}
|
|
99
|
+
export interface DateFieldTypeAndOptions {
|
|
100
|
+
type: 'date';
|
|
101
|
+
options: {
|
|
102
|
+
dateFormat: DateFormatOptions;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export type DateTimeCell = string;
|
|
106
|
+
export interface TimeFormatOptions {
|
|
107
|
+
format: 'h:mma' | 'HH:mm' | undefined;
|
|
108
|
+
name: '12hour' | '24hour';
|
|
109
|
+
}
|
|
110
|
+
export interface DateTimeFieldTypeAndOptions {
|
|
111
|
+
type: 'dateTime';
|
|
112
|
+
options: {
|
|
113
|
+
timeZone: string;
|
|
114
|
+
dateFormat: DateFormatOptions;
|
|
115
|
+
timeFormat: TimeFormatOptions;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export type DurationCell = number;
|
|
119
|
+
export interface DurationFieldTypeAndOptions {
|
|
120
|
+
type: 'duration';
|
|
121
|
+
options: {
|
|
122
|
+
durationFormat: 'h:mm' | 'h:mm:ss' | 'h:mm:ss.S' | 'h:mm:ss.SS' | 'h:mm:ss.SSS';
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export type EmailCell = string;
|
|
126
|
+
export interface EmailFieldTypeAndOptions {
|
|
127
|
+
type: 'email';
|
|
128
|
+
}
|
|
129
|
+
export type FormulaCell = string | number;
|
|
130
|
+
export interface FormulaFieldTypeAndOptions {
|
|
131
|
+
type: 'formula';
|
|
132
|
+
options: {
|
|
133
|
+
formula: string;
|
|
134
|
+
isValid: boolean;
|
|
135
|
+
referencedFieldIds: string[] | null;
|
|
136
|
+
result: any;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export type LastModifiedByCell = {
|
|
140
|
+
id: string;
|
|
141
|
+
email?: string;
|
|
142
|
+
name?: string;
|
|
143
|
+
profilePicUrl?: string;
|
|
144
|
+
};
|
|
145
|
+
export interface LastModifiedByFieldTypeAndOptions {
|
|
146
|
+
type: 'lastModifiedBy';
|
|
147
|
+
}
|
|
148
|
+
export type LastModifiedTimeCell = string;
|
|
149
|
+
export interface LastModifiedTimeFieldTypeAndOptions {
|
|
150
|
+
type: 'lastModifiedTime';
|
|
151
|
+
options: {
|
|
152
|
+
isValid: boolean;
|
|
153
|
+
referencedFieldIds: string[] | null;
|
|
154
|
+
result: any;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
export type LinkToAnotherRecordCellV1 = string[];
|
|
158
|
+
export type LinkToAnotherRecordCellV2 = {
|
|
159
|
+
id: string;
|
|
160
|
+
name: string;
|
|
161
|
+
}[];
|
|
162
|
+
export interface LinkToAnotherRecordFieldTypeAndOptions {
|
|
163
|
+
type: 'multipleRecordLinks';
|
|
164
|
+
options: {
|
|
165
|
+
isReversed: boolean;
|
|
166
|
+
linkedTableId: string;
|
|
167
|
+
prefersSingleRecordLink: boolean;
|
|
168
|
+
inverseLinkFieldId?: string;
|
|
169
|
+
viewIdForRecordSelection?: string;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
export type LongTextCell = string;
|
|
173
|
+
export interface LongTextFieldTypeAndOptions {
|
|
174
|
+
type: 'multilineText';
|
|
175
|
+
}
|
|
176
|
+
export type LookupCellV1 = (number | string | boolean | any)[];
|
|
177
|
+
export type LookupCellV2 = {
|
|
178
|
+
valuesByLinkedRecordId: {
|
|
179
|
+
[key: string]: any[];
|
|
180
|
+
};
|
|
181
|
+
linkedRecordIds: string[];
|
|
182
|
+
};
|
|
183
|
+
export interface LookupFieldTypeAndOptions {
|
|
184
|
+
type: 'lookup';
|
|
185
|
+
options: {
|
|
186
|
+
fieldIdInLinkedTable: string | null;
|
|
187
|
+
isValid: boolean;
|
|
188
|
+
recordLinkFieldId: string | null;
|
|
189
|
+
result: any;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
export type Collaborator = {
|
|
193
|
+
id: string;
|
|
194
|
+
email?: string;
|
|
195
|
+
name?: string;
|
|
196
|
+
profilePicUrl?: string;
|
|
197
|
+
};
|
|
198
|
+
export type Collaborators = Collaborator[];
|
|
199
|
+
export type ChoiceColor = 'blueLight2' | 'cyanLight2' | 'tealLight2' | 'greenLight2' | 'yellowLight2' | 'orangeLight2' | 'redLight2' | 'pinkLight2' | 'purpleLight2' | 'grayLight2' | 'blueLight1' | 'cyanLight1' | 'tealLight1' | 'greenLight1' | 'yellowLight1' | 'orangeLight1' | 'redLight1' | 'pinkLight1' | 'purpleLight1' | 'grayLight1' | 'blueBright' | 'cyanBright' | 'tealBright' | 'greenBright' | 'yellowBright' | 'orangeBright' | 'redBright' | 'pinkBright' | 'purpleBright' | 'grayBright' | 'blueDark1' | 'cyanDark1' | 'tealDark1' | 'greenDark1' | 'yellowDark1' | 'orangeDark1' | 'redDark1' | 'pinkDark1' | 'purpleDark1' | 'grayDark1';
|
|
200
|
+
export type Choice = {
|
|
201
|
+
id: string;
|
|
202
|
+
color?: ChoiceColor;
|
|
203
|
+
name: string;
|
|
204
|
+
};
|
|
205
|
+
export type SelectOptions = {
|
|
206
|
+
choices: Choice[];
|
|
207
|
+
};
|
|
208
|
+
export type RatingColor = 'yellowBright' | 'orangeBright' | 'redBright' | 'pinkBright' | 'purpleBright' | 'blueBright' | 'cyanBright' | 'tealBright' | 'greenBright' | 'grayBright';
|
|
209
|
+
export type RatingIcon = 'star' | 'heart' | 'thumbsUp' | 'flag' | 'dot';
|
|
210
|
+
export type RatingOptions = {
|
|
211
|
+
color: RatingColor;
|
|
212
|
+
icon: RatingIcon;
|
|
213
|
+
max: number;
|
|
214
|
+
};
|
|
215
|
+
export type RollupOptions = {
|
|
216
|
+
fieldIdInLinkedTable?: string;
|
|
217
|
+
recordLinkFieldId?: string;
|
|
218
|
+
result?: any;
|
|
219
|
+
isValid?: boolean;
|
|
220
|
+
referencedFieldIds?: string[];
|
|
221
|
+
};
|
|
222
|
+
export type ExternalSyncChoice = {
|
|
223
|
+
id: string;
|
|
224
|
+
color?: ChoiceColor;
|
|
225
|
+
name: string;
|
|
226
|
+
};
|
|
227
|
+
export type ExternalSyncOptions = {
|
|
228
|
+
choices: ExternalSyncChoice[];
|
|
229
|
+
};
|
|
230
|
+
export type SingleLineText = string | null;
|
|
231
|
+
export type MultilineText = string | null;
|
|
232
|
+
export type RichText = string;
|
|
233
|
+
export type SingleSelect = string;
|
|
234
|
+
export type MultipleSelects = string[];
|
|
235
|
+
export type MultipleLookupValues = string[];
|
|
236
|
+
export type Checkbox = boolean;
|
|
237
|
+
export type AirtableUrl = string | null;
|
|
238
|
+
export type AirtableEmail = string;
|
|
239
|
+
export type AirtableInteger = number | null;
|
|
240
|
+
export type Count = number;
|
|
241
|
+
export type Duration = number;
|
|
242
|
+
export type Formula = string | string[] | number;
|
|
243
|
+
export type MultipleRecordLinks = string[];
|
|
244
|
+
export type MultipleAttachments = Attachment[];
|
|
245
|
+
export type FormulaSingleReturn = string | number;
|
|
246
|
+
export type Rollup = string | number;
|
|
247
|
+
export type AutoNumber = number;
|
|
248
|
+
export type AirtableButton = {
|
|
249
|
+
label: string;
|
|
250
|
+
url: string;
|
|
251
|
+
};
|
|
252
|
+
export type LastModifiedTime = string;
|
|
253
|
+
export type CreatedTime = string;
|
|
254
|
+
export type DateTime = string;
|
|
255
|
+
export type PhoneNumber = string;
|
|
256
|
+
export type Currency = number;
|
|
257
|
+
export type Percent = number;
|
|
258
|
+
export interface Attachment {
|
|
259
|
+
id: string;
|
|
260
|
+
url: string;
|
|
261
|
+
filename: string;
|
|
262
|
+
size: number;
|
|
263
|
+
type: string;
|
|
264
|
+
thumbnails?: {
|
|
265
|
+
small?: Thumbnail;
|
|
266
|
+
large?: Thumbnail;
|
|
267
|
+
full?: Thumbnail;
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
export interface Thumbnail {
|
|
271
|
+
url: string;
|
|
272
|
+
width: number;
|
|
273
|
+
height: number;
|
|
274
|
+
}
|
|
275
|
+
export type UpserptRecords = {
|
|
276
|
+
records: {
|
|
277
|
+
id: string;
|
|
278
|
+
createdTime: string;
|
|
279
|
+
fields: unknown;
|
|
280
|
+
}[];
|
|
281
|
+
updatedRecords: string[];
|
|
282
|
+
createdRecords: string[];
|
|
283
|
+
};
|
|
284
|
+
export interface UpdateRecordsBody {
|
|
285
|
+
typecast: boolean;
|
|
286
|
+
records: UpdateRecords;
|
|
287
|
+
}
|
|
288
|
+
export interface UpdateRecordsBodyUpsert extends UpdateRecordsBody {
|
|
289
|
+
performUpsert: {
|
|
290
|
+
fieldsToMergeOn: FieldsToMergeOn;
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
export type BaseId = string;
|
|
294
|
+
export type TableId = string;
|
|
295
|
+
export type FieldsToMergeOn = string[];
|
|
296
|
+
export type ApiRequest = {
|
|
297
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
298
|
+
url: string;
|
|
299
|
+
apiKey: string;
|
|
300
|
+
body?: RequestBody;
|
|
301
|
+
};
|
|
302
|
+
export type RequestMethods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
303
|
+
export interface RequestMethodProps {
|
|
304
|
+
url: string;
|
|
305
|
+
apiKey: string;
|
|
306
|
+
body?: RequestBody;
|
|
307
|
+
}
|
|
308
|
+
export type RequestBody = unknown;
|
|
309
|
+
export interface AirtableRecordRequest {
|
|
310
|
+
baseId: string;
|
|
311
|
+
tableId: string;
|
|
312
|
+
atId?: string;
|
|
313
|
+
body: RequestBody;
|
|
314
|
+
}
|
|
315
|
+
export interface UpdateAirtableRecordRequest {
|
|
316
|
+
atId?: string;
|
|
317
|
+
baseId: string;
|
|
318
|
+
tableId: string;
|
|
319
|
+
body?: RequestBody;
|
|
320
|
+
}
|
|
321
|
+
export interface RequestBodyWebsiteInfos {
|
|
322
|
+
fields: unknown;
|
|
323
|
+
}
|
|
324
|
+
export type UpdateRecord = {
|
|
325
|
+
fields: unknown;
|
|
326
|
+
};
|
|
327
|
+
export type UpdateRecords = UpdateRecord[];
|
|
328
|
+
export {};
|