easy-airtable-api 0.0.15 → 0.0.17

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +402 -130
  3. package/easy-airtable-api-0.0.17.tgz +0 -0
  4. package/lib/bases.d.ts +18 -0
  5. package/lib/bases.js +40 -0
  6. package/lib/cli.d.ts +2 -0
  7. package/lib/cli.js +82 -0
  8. package/lib/codegen/build.d.ts +2 -0
  9. package/lib/codegen/build.js +25 -0
  10. package/lib/codegen/emit-typescript.d.ts +8 -0
  11. package/lib/codegen/emit-typescript.js +104 -0
  12. package/lib/codegen/generate.d.ts +2 -0
  13. package/lib/codegen/generate.js +23 -0
  14. package/lib/codegen/identifiers.d.ts +7 -0
  15. package/lib/codegen/identifiers.js +51 -0
  16. package/lib/codegen/index.d.ts +3 -0
  17. package/lib/codegen/index.js +2 -0
  18. package/lib/codegen/load-schema.d.ts +3 -0
  19. package/lib/codegen/load-schema.js +28 -0
  20. package/lib/codegen/map-field.d.ts +31 -0
  21. package/lib/codegen/map-field.js +278 -0
  22. package/lib/codegen/normalize-schema.d.ts +11 -0
  23. package/lib/codegen/normalize-schema.js +61 -0
  24. package/lib/codegen/types.d.ts +62 -0
  25. package/lib/codegen/types.js +1 -0
  26. package/lib/codegen/utils.d.ts +14 -0
  27. package/lib/codegen/utils.js +30 -0
  28. package/lib/codegen/write-atomic.d.ts +1 -0
  29. package/lib/codegen/write-atomic.js +11 -0
  30. package/lib/index.d.ts +8 -2
  31. package/lib/index.js +3 -2
  32. package/lib/records.d.ts +75 -9
  33. package/lib/records.js +110 -21
  34. package/lib/requests.d.ts +65 -21
  35. package/lib/requests.js +281 -31
  36. package/lib/types/bases.d.ts +8 -40
  37. package/lib/types/fields.d.ts +8 -8
  38. package/lib/types/metadata.d.ts +24 -0
  39. package/lib/types/metadata.js +1 -0
  40. package/lib/types/records.d.ts +1 -1
  41. package/lib/utils.d.ts +2 -2
  42. package/package.json +17 -9
  43. package/lib/generate-types.d.ts +0 -5
  44. package/lib/generate-types.js +0 -78
@@ -0,0 +1,278 @@
1
+ import { getChoices, getRecordValue, stringifyUnion } from './utils.js';
2
+ const READONLY_FIELD_TYPES = new Set([
3
+ 'aiText',
4
+ 'autoNumber',
5
+ 'button',
6
+ 'count',
7
+ 'createdBy',
8
+ 'createdTime',
9
+ 'formula',
10
+ 'lastModifiedBy',
11
+ 'lastModifiedTime',
12
+ 'lookup',
13
+ 'rollup',
14
+ 'syncSource',
15
+ ]);
16
+ const COMPUTED_FIELD_TYPES = new Set([
17
+ 'aiText',
18
+ 'autoNumber',
19
+ 'button',
20
+ 'count',
21
+ 'formula',
22
+ 'lookup',
23
+ 'rollup',
24
+ 'syncSource',
25
+ ]);
26
+ function resolveUnknown(field, unknownFieldBehavior, reason) {
27
+ const warning = reason
28
+ ? `${field.name}: ${reason}`
29
+ : `${field.name}: unsupported Airtable field type ${field.type}`;
30
+ if (unknownFieldBehavior === 'error') {
31
+ throw new Error(warning);
32
+ }
33
+ return { type: 'unknown', warning };
34
+ }
35
+ function resolveUnknownArray(field, unknownFieldBehavior, reason) {
36
+ const resolved = resolveUnknown(field, unknownFieldBehavior, reason);
37
+ return {
38
+ type: 'unknown[]',
39
+ warning: resolved.warning,
40
+ };
41
+ }
42
+ function buildEnumType(field, enumMode) {
43
+ const choices = getChoices(field.options);
44
+ if (!choices?.length)
45
+ return undefined;
46
+ const literals = stringifyUnion(choices.map((choice) => choice.name));
47
+ if (enumMode === 'literal')
48
+ return literals;
49
+ if (enumMode === 'broad')
50
+ return 'string';
51
+ return `${literals} | (string & {})`;
52
+ }
53
+ function mapResultDescriptor(descriptor, field, enumMode, unknownFieldBehavior) {
54
+ const resultType = getRecordValue(descriptor, 'type');
55
+ if (!resultType) {
56
+ return resolveUnknown(field, unknownFieldBehavior, 'metadata result type is missing');
57
+ }
58
+ const nestedField = {
59
+ ...field,
60
+ type: resultType,
61
+ options: getRecordValue(descriptor, 'options'),
62
+ };
63
+ return mapFieldTypes({
64
+ field: nestedField,
65
+ enumMode,
66
+ unknownFieldBehavior,
67
+ }).read;
68
+ }
69
+ export function mapFieldTypes({ field, enumMode, unknownFieldBehavior, }) {
70
+ const readonly = READONLY_FIELD_TYPES.has(field.type);
71
+ const computed = COMPUTED_FIELD_TYPES.has(field.type);
72
+ const linkedTableId = getRecordValue(field.options, 'linkedTableId');
73
+ switch (field.type) {
74
+ case 'singleLineText':
75
+ case 'multilineText':
76
+ case 'richText':
77
+ case 'email':
78
+ case 'url':
79
+ case 'phoneNumber':
80
+ case 'date':
81
+ case 'dateTime':
82
+ return {
83
+ read: { type: 'string' },
84
+ create: { type: 'string' },
85
+ update: { type: 'string' },
86
+ readonly,
87
+ computed,
88
+ };
89
+ case 'aiText':
90
+ return {
91
+ read: { type: 'string' },
92
+ readonly,
93
+ computed,
94
+ };
95
+ case 'number':
96
+ case 'currency':
97
+ case 'percent':
98
+ case 'rating':
99
+ case 'duration':
100
+ return {
101
+ read: { type: 'number' },
102
+ create: { type: 'number' },
103
+ update: { type: 'number' },
104
+ readonly,
105
+ computed,
106
+ };
107
+ case 'checkbox':
108
+ return {
109
+ read: { type: 'boolean' },
110
+ create: { type: 'boolean' },
111
+ update: { type: 'boolean' },
112
+ readonly,
113
+ computed,
114
+ };
115
+ case 'singleSelect': {
116
+ const enumType = buildEnumType(field, enumMode) ?? 'string';
117
+ return {
118
+ read: { type: enumType },
119
+ create: { type: enumType },
120
+ update: { type: enumType },
121
+ readonly,
122
+ computed,
123
+ enumTypeAlias: enumType,
124
+ };
125
+ }
126
+ case 'multipleSelects': {
127
+ const enumType = buildEnumType(field, enumMode) ?? 'string';
128
+ return {
129
+ read: { type: `Array<${enumType}>` },
130
+ create: { type: `Array<${enumType}>` },
131
+ update: { type: `Array<${enumType}>` },
132
+ readonly,
133
+ computed,
134
+ enumTypeAlias: enumType,
135
+ };
136
+ }
137
+ case 'multipleAttachments':
138
+ case 'attachment':
139
+ return {
140
+ read: { type: 'Attachment[]' },
141
+ create: { type: 'AttachmentWrite[]' },
142
+ update: { type: 'AttachmentWrite[]' },
143
+ readonly,
144
+ computed,
145
+ };
146
+ case 'singleCollaborator':
147
+ return {
148
+ read: { type: 'Collaborator' },
149
+ create: { type: 'Collaborator' },
150
+ update: { type: 'Collaborator' },
151
+ readonly,
152
+ computed,
153
+ };
154
+ case 'multipleCollaborators':
155
+ return {
156
+ read: { type: 'Collaborator[]' },
157
+ create: { type: 'Collaborator[]' },
158
+ update: { type: 'Collaborator[]' },
159
+ readonly,
160
+ computed,
161
+ };
162
+ case 'multipleRecordLinks':
163
+ case 'linkToAnotherRecord':
164
+ return {
165
+ read: { type: 'string[]' },
166
+ create: { type: 'string[]' },
167
+ update: { type: 'string[]' },
168
+ readonly,
169
+ computed,
170
+ linkedTableId,
171
+ };
172
+ case 'barcode':
173
+ return {
174
+ read: { type: 'Barcode' },
175
+ create: { type: 'Barcode' },
176
+ update: { type: 'Barcode' },
177
+ readonly,
178
+ computed,
179
+ };
180
+ case 'createdTime':
181
+ case 'lastModifiedTime':
182
+ return {
183
+ read: { type: 'string' },
184
+ readonly,
185
+ computed,
186
+ };
187
+ case 'createdBy':
188
+ case 'lastModifiedBy':
189
+ return {
190
+ read: { type: 'Collaborator' },
191
+ readonly,
192
+ computed,
193
+ };
194
+ case 'button':
195
+ return {
196
+ read: { type: 'ButtonFieldValue' },
197
+ readonly,
198
+ computed,
199
+ };
200
+ case 'count':
201
+ case 'autoNumber':
202
+ return {
203
+ read: { type: 'number' },
204
+ readonly,
205
+ computed,
206
+ };
207
+ case 'formula': {
208
+ const result = mapResultDescriptor(getRecordValue(field.options, 'result'), field, enumMode, unknownFieldBehavior);
209
+ return {
210
+ read: result,
211
+ readonly,
212
+ computed,
213
+ };
214
+ }
215
+ case 'rollup': {
216
+ const result = getRecordValue(field.options, 'result');
217
+ const mapped = result
218
+ ? mapResultDescriptor(result, field, enumMode, unknownFieldBehavior)
219
+ : resolveUnknown(field, unknownFieldBehavior, 'rollup result metadata is missing');
220
+ return {
221
+ read: mapped,
222
+ readonly,
223
+ computed,
224
+ };
225
+ }
226
+ case 'lookup': {
227
+ const result = getRecordValue(field.options, 'result');
228
+ const mapped = result
229
+ ? mapResultDescriptor(result, field, enumMode, unknownFieldBehavior)
230
+ : resolveUnknownArray(field, unknownFieldBehavior, 'lookup result metadata is missing');
231
+ return {
232
+ read: mapped.type === 'unknown'
233
+ ? { ...mapped, type: 'unknown[]' }
234
+ : { ...mapped, type: `Array<${mapped.type}>` },
235
+ readonly,
236
+ computed,
237
+ };
238
+ }
239
+ default: {
240
+ const unknown = resolveUnknown(field, unknownFieldBehavior);
241
+ return {
242
+ read: unknown,
243
+ create: readonly ? undefined : unknown,
244
+ update: readonly ? undefined : unknown,
245
+ readonly,
246
+ computed,
247
+ };
248
+ }
249
+ }
250
+ }
251
+ export function mapFieldToNormalizedField({ field, enumMode, unknownFieldBehavior, tsKey, tsTypeName, }) {
252
+ const mapped = mapFieldTypes({
253
+ field,
254
+ enumMode,
255
+ unknownFieldBehavior,
256
+ });
257
+ const warnings = [
258
+ mapped.read.warning,
259
+ mapped.create?.warning,
260
+ mapped.update?.warning,
261
+ ].filter((warning) => Boolean(warning));
262
+ return {
263
+ id: field.id,
264
+ name: field.name,
265
+ tsKey,
266
+ tsTypeName,
267
+ airtableType: field.type,
268
+ readonly: mapped.readonly,
269
+ computed: mapped.computed,
270
+ readType: mapped.read.type,
271
+ createType: mapped.create?.type,
272
+ updateType: mapped.update?.type,
273
+ linkedTableId: mapped.linkedTableId,
274
+ enumTypeAlias: mapped.enumTypeAlias,
275
+ warnings,
276
+ options: field.options,
277
+ };
278
+ }
@@ -0,0 +1,11 @@
1
+ import type { AirtableBaseSchema } from '../types/metadata.js';
2
+ import type { EnumMode, NormalizedBase, UnknownFieldBehavior } from './types.js';
3
+ export declare function normalizeSchema({ schema, tableNameOrId, enumMode, unknownFieldBehavior, }: {
4
+ schema: AirtableBaseSchema;
5
+ tableNameOrId?: string | string[];
6
+ enumMode: EnumMode;
7
+ unknownFieldBehavior: UnknownFieldBehavior;
8
+ }): {
9
+ normalizedBase: NormalizedBase;
10
+ warnings: string[];
11
+ };
@@ -0,0 +1,61 @@
1
+ import { makeUniquePascalNames, toPascalCase } from './identifiers.js';
2
+ import { mapFieldToNormalizedField } from './map-field.js';
3
+ import { compareByNameThenId, ensureArray } from './utils.js';
4
+ export function normalizeSchema({ schema, tableNameOrId, enumMode, unknownFieldBehavior, }) {
5
+ const filters = new Set(ensureArray(tableNameOrId));
6
+ const selectedTables = [...schema.tables]
7
+ .filter((table) => {
8
+ if (!filters.size)
9
+ return true;
10
+ return filters.has(table.id) || filters.has(table.name);
11
+ })
12
+ .sort(compareByNameThenId);
13
+ if (!selectedTables.length) {
14
+ throw new Error('No Airtable tables matched the requested tableNameOrId filter.');
15
+ }
16
+ const warnings = [];
17
+ const tableNames = makeUniquePascalNames(selectedTables);
18
+ const sanitizedTableNameCounts = new Map();
19
+ selectedTables.forEach((table) => {
20
+ const baseName = toPascalCase(table.name);
21
+ sanitizedTableNameCounts.set(baseName, (sanitizedTableNameCounts.get(baseName) ?? 0) + 1);
22
+ });
23
+ const tables = selectedTables.map((table) => {
24
+ const tsName = tableNames.get(table.id) ?? table.name;
25
+ if ((sanitizedTableNameCounts.get(toPascalCase(table.name)) ?? 0) > 1) {
26
+ warnings.push(`Table name collision detected for ${table.name}. Generated type name ${tsName} includes a stable suffix.`);
27
+ }
28
+ const fieldNames = makeUniquePascalNames(table.fields);
29
+ const sanitizedFieldNameCounts = new Map();
30
+ table.fields.forEach((field) => {
31
+ const baseName = toPascalCase(field.name);
32
+ sanitizedFieldNameCounts.set(baseName, (sanitizedFieldNameCounts.get(baseName) ?? 0) + 1);
33
+ });
34
+ const fields = table.fields.map((field) => {
35
+ const fieldTsName = fieldNames.get(field.id) ?? field.name;
36
+ const normalizedField = mapFieldToNormalizedField({
37
+ field,
38
+ enumMode,
39
+ unknownFieldBehavior,
40
+ tsKey: field.name,
41
+ tsTypeName: `${tsName}${fieldTsName}`,
42
+ });
43
+ if ((sanitizedFieldNameCounts.get(toPascalCase(field.name)) ?? 0) > 1) {
44
+ warnings.push(`Field name collision detected for ${table.name}.${field.name}. Generated helper type name ${normalizedField.tsTypeName} includes a stable suffix.`);
45
+ }
46
+ warnings.push(...normalizedField.warnings.map((warning) => `${table.name}.${warning}`));
47
+ return normalizedField;
48
+ });
49
+ return {
50
+ id: table.id,
51
+ name: table.name,
52
+ tsName,
53
+ primaryFieldId: table.primaryFieldId,
54
+ fields,
55
+ };
56
+ });
57
+ return {
58
+ normalizedBase: { tables },
59
+ warnings: [...new Set(warnings)],
60
+ };
61
+ }
@@ -0,0 +1,62 @@
1
+ import type { AirtableBaseSchema } from '../types/metadata.js';
2
+ export type AirtableSchemaSource = {
3
+ baseId: string;
4
+ accessToken?: string;
5
+ apiKey?: string;
6
+ } | {
7
+ schemaPath: string;
8
+ } | {
9
+ schema: AirtableBaseSchema;
10
+ };
11
+ export type EnumMode = 'literal' | 'hybrid' | 'broad';
12
+ export type CreateRequiredMode = 'allOptional' | 'primaryField';
13
+ export type UnknownFieldBehavior = 'unknown' | 'error';
14
+ export type SchemaMode = 'read' | 'write' | 'full';
15
+ export interface GenerateAirtableTypesOptions {
16
+ source: AirtableSchemaSource;
17
+ output?: string;
18
+ tableNameOrId?: string | string[];
19
+ enumMode?: EnumMode;
20
+ createRequiredMode?: CreateRequiredMode;
21
+ unknownFieldBehavior?: UnknownFieldBehavior;
22
+ includeTableIds?: boolean;
23
+ includeFieldIds?: boolean;
24
+ schemaMode?: SchemaMode;
25
+ format?: boolean;
26
+ }
27
+ export interface AirtableCodegenResult {
28
+ content: string;
29
+ tablesGenerated: number;
30
+ warnings: string[];
31
+ }
32
+ export interface GenerateAirtableTypesResult {
33
+ outputPath: string;
34
+ tablesGenerated: number;
35
+ warnings: string[];
36
+ }
37
+ export interface NormalizedBase {
38
+ tables: NormalizedTable[];
39
+ }
40
+ export interface NormalizedTable {
41
+ id: string;
42
+ name: string;
43
+ tsName: string;
44
+ primaryFieldId: string;
45
+ fields: NormalizedField[];
46
+ }
47
+ export interface NormalizedField {
48
+ id: string;
49
+ name: string;
50
+ tsKey: string;
51
+ tsTypeName: string;
52
+ airtableType: string;
53
+ readonly: boolean;
54
+ computed: boolean;
55
+ readType: string;
56
+ createType?: string;
57
+ updateType?: string;
58
+ enumTypeAlias?: string;
59
+ linkedTableId?: string;
60
+ warnings: string[];
61
+ options?: Record<string, unknown>;
62
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ export declare function compareByNameThenId(left: {
2
+ name: string;
3
+ id: string;
4
+ }, right: {
5
+ name: string;
6
+ id: string;
7
+ }): number;
8
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
9
+ export declare function getRecordValue<T = unknown>(value: unknown, key: string): T | undefined;
10
+ export declare function getChoices(options: unknown): {
11
+ name: string;
12
+ }[] | undefined;
13
+ export declare function stringifyUnion(values: string[]): string;
14
+ export declare function ensureArray<T>(value: T | T[] | undefined): T[];
@@ -0,0 +1,30 @@
1
+ export function compareByNameThenId(left, right) {
2
+ return left.name.localeCompare(right.name) || left.id.localeCompare(right.id);
3
+ }
4
+ export function isRecord(value) {
5
+ return typeof value === 'object' && value !== null;
6
+ }
7
+ export function getRecordValue(value, key) {
8
+ if (!isRecord(value) || !(key in value))
9
+ return undefined;
10
+ return value[key];
11
+ }
12
+ export function getChoices(options) {
13
+ const choices = getRecordValue(options, 'choices');
14
+ if (!choices)
15
+ return undefined;
16
+ const validChoices = choices
17
+ .filter(isRecord)
18
+ .map((choice) => getRecordValue(choice, 'name'))
19
+ .filter((choice) => Boolean(choice))
20
+ .map((name) => ({ name }));
21
+ return validChoices.length ? validChoices : undefined;
22
+ }
23
+ export function stringifyUnion(values) {
24
+ return values.map((value) => JSON.stringify(value)).join(' | ');
25
+ }
26
+ export function ensureArray(value) {
27
+ if (value === undefined)
28
+ return [];
29
+ return Array.isArray(value) ? value : [value];
30
+ }
@@ -0,0 +1 @@
1
+ export declare function writeAtomic(outputPath: string, content: string): Promise<string>;
@@ -0,0 +1,11 @@
1
+ import { mkdir, rename, writeFile } from 'node:fs/promises';
2
+ import { dirname, resolve } from 'node:path';
3
+ export async function writeAtomic(outputPath, content) {
4
+ const resolvedPath = resolve(outputPath);
5
+ const parentDirectory = dirname(resolvedPath);
6
+ const temporaryPath = `${resolvedPath}.tmp-${process.pid}-${Date.now()}`;
7
+ await mkdir(parentDirectory, { recursive: true });
8
+ await writeFile(temporaryPath, content, 'utf8');
9
+ await rename(temporaryPath, resolvedPath);
10
+ return resolvedPath;
11
+ }
package/lib/index.d.ts CHANGED
@@ -1,2 +1,8 @@
1
- export { getRecord, getRecords, createRecord, createRecords, updateRecord, updateRecords, updateRecordsUpsert, deleteRecords, } from './records.js';
2
- export { generateTypeScriptDefinitions } from './generate-types.js';
1
+ export { getRecord, getRecordsPage, iterateRecordsPages, getRecords, createRecord, createRecords, updateRecord, replaceRecord, updateRecords, replaceRecords, updateRecordsUpsert, deleteRecord, deleteRecords, } from './records.js';
2
+ export { listBases, createBase, getBaseSchema } from './bases.js';
3
+ export { airtableRequestRaw, AirtableApiError } from './requests.js';
4
+ export type { AirtableRetryOptions } from './requests.js';
5
+ export type { AirtableRecord } from './types/records.js';
6
+ export type { CreateBaseFieldConfig, CreateBaseRequestBody, CreateBaseResponse, CreateBaseTableConfig, ListBasesResponse, } from './types/bases.js';
7
+ export type { AirtableBaseSchema, AirtableFieldSchema, AirtableTableSchema, AirtableViewSchema, } from './types/metadata.js';
8
+ export type { Attachment, AttachmentWrite, Collaborator, } from './types/fields.js';
package/lib/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export { getRecord, getRecords, createRecord, createRecords, updateRecord, updateRecords, updateRecordsUpsert, deleteRecords, } from './records.js';
2
- export { generateTypeScriptDefinitions } from './generate-types.js';
1
+ export { getRecord, getRecordsPage, iterateRecordsPages, getRecords, createRecord, createRecords, updateRecord, replaceRecord, updateRecords, replaceRecords, updateRecordsUpsert, deleteRecord, deleteRecords, } from './records.js';
2
+ export { listBases, createBase, getBaseSchema } from './bases.js';
3
+ export { airtableRequestRaw, AirtableApiError } from './requests.js';
package/lib/records.d.ts CHANGED
@@ -1,17 +1,41 @@
1
- import { AirtableRecord, DeleteRecordsResponse, GetRecordsQueryParameters } from './types/records';
2
- export declare function getRecord<Fields>({ apiKey, baseId, tableId, recordId, }: {
1
+ import { AirtableRecord, DeleteRecordResponse, DeleteRecordsResponse, GetRecordQueryParameters, GetRecordsQueryParameters } from './types/records.js';
2
+ import type { AirtableRetryOptions } from './requests.js';
3
+ export declare function getRecord<Fields>({ apiKey, baseId, tableId, recordId, options, retry, }: {
3
4
  apiKey: string;
4
5
  baseId: string;
5
6
  tableId: string;
6
7
  recordId: string;
8
+ options?: GetRecordQueryParameters;
9
+ retry?: AirtableRetryOptions;
7
10
  }): Promise<AirtableRecord<Fields>>;
8
- export declare function getRecords<Fields>({ apiKey, baseId, tableId, options, }: {
11
+ export declare function getRecordsPage<Fields>({ apiKey, baseId, tableId, options, retry, }: {
9
12
  apiKey: string;
10
13
  baseId: string;
11
14
  tableId: string;
12
15
  options?: GetRecordsQueryParameters;
16
+ retry?: AirtableRetryOptions;
17
+ }): Promise<{
18
+ records: AirtableRecord<Fields>[];
19
+ offset?: string;
20
+ }>;
21
+ export declare function iterateRecordsPages<Fields>({ apiKey, baseId, tableId, options, retry, }: {
22
+ apiKey: string;
23
+ baseId: string;
24
+ tableId: string;
25
+ options?: GetRecordsQueryParameters;
26
+ retry?: AirtableRetryOptions;
27
+ }): AsyncGenerator<{
28
+ records: AirtableRecord<Fields>[];
29
+ offset?: string;
30
+ }>;
31
+ export declare function getRecords<Fields>({ apiKey, baseId, tableId, options, retry, }: {
32
+ apiKey: string;
33
+ baseId: string;
34
+ tableId: string;
35
+ options?: GetRecordsQueryParameters;
36
+ retry?: AirtableRetryOptions;
13
37
  }): Promise<AirtableRecord<Fields>[]>;
14
- export declare function updateRecord<Fields>({ apiKey, baseId, tableId, recordId, fields, options, }: {
38
+ export declare function updateRecord<Fields>({ apiKey, baseId, tableId, recordId, fields, options, retry, }: {
15
39
  apiKey: string;
16
40
  baseId: string;
17
41
  tableId: string;
@@ -22,8 +46,21 @@ export declare function updateRecord<Fields>({ apiKey, baseId, tableId, recordId
22
46
  returnFieldsByFieldId?: boolean;
23
47
  overwriteFieldsNotSpecified?: boolean;
24
48
  };
49
+ retry?: AirtableRetryOptions;
50
+ }): Promise<AirtableRecord<Fields>>;
51
+ export declare function replaceRecord<Fields>({ apiKey, baseId, tableId, recordId, fields, options, retry, }: {
52
+ apiKey: string;
53
+ baseId: string;
54
+ tableId: string;
55
+ recordId: string;
56
+ fields: Fields;
57
+ options?: {
58
+ typecast?: boolean;
59
+ returnFieldsByFieldId?: boolean;
60
+ };
61
+ retry?: AirtableRetryOptions;
25
62
  }): Promise<AirtableRecord<Fields>>;
26
- export declare function updateRecords<Fields>({ apiKey, baseId, tableId, records, options, }: {
63
+ export declare function updateRecords<Fields>({ apiKey, baseId, tableId, records, options, retry, }: {
27
64
  apiKey: string;
28
65
  baseId: string;
29
66
  tableId: string;
@@ -37,10 +74,28 @@ export declare function updateRecords<Fields>({ apiKey, baseId, tableId, records
37
74
  overwriteFieldsNotSpecified?: boolean;
38
75
  requestInterval?: number;
39
76
  };
77
+ retry?: AirtableRetryOptions;
40
78
  }): Promise<{
41
79
  records: AirtableRecord<Fields>[];
42
80
  }>;
43
- export declare function updateRecordsUpsert<Fields>({ apiKey, baseId, tableId, records, options, }: {
81
+ export declare function replaceRecords<Fields>({ apiKey, baseId, tableId, records, options, retry, }: {
82
+ apiKey: string;
83
+ baseId: string;
84
+ tableId: string;
85
+ records: {
86
+ id: string;
87
+ fields: Fields;
88
+ }[];
89
+ options?: {
90
+ typecast?: boolean;
91
+ returnFieldsByFieldId?: boolean;
92
+ requestInterval?: number;
93
+ };
94
+ retry?: AirtableRetryOptions;
95
+ }): Promise<{
96
+ records: AirtableRecord<Fields>[];
97
+ }>;
98
+ export declare function updateRecordsUpsert<Fields>({ apiKey, baseId, tableId, records, options, retry, }: {
44
99
  apiKey: string;
45
100
  baseId: string;
46
101
  tableId: string;
@@ -55,12 +110,20 @@ export declare function updateRecordsUpsert<Fields>({ apiKey, baseId, tableId, r
55
110
  overwriteFieldsNotSpecified?: boolean;
56
111
  requestInterval?: number;
57
112
  };
113
+ retry?: AirtableRetryOptions;
58
114
  }): Promise<{
59
115
  createdRecords: string[];
60
116
  updatedRecords: string[];
61
117
  records: AirtableRecord<Fields>[];
62
118
  }>;
63
- export declare function deleteRecords({ apiKey, baseId, tableId, recordIds, options, }: {
119
+ export declare function deleteRecord({ apiKey, baseId, tableId, recordId, retry, }: {
120
+ apiKey: string;
121
+ baseId: string;
122
+ tableId: string;
123
+ recordId: string;
124
+ retry?: AirtableRetryOptions;
125
+ }): Promise<DeleteRecordResponse>;
126
+ export declare function deleteRecords({ apiKey, baseId, tableId, recordIds, options, retry, }: {
64
127
  apiKey: string;
65
128
  baseId: string;
66
129
  tableId: string;
@@ -68,8 +131,9 @@ export declare function deleteRecords({ apiKey, baseId, tableId, recordIds, opti
68
131
  options?: {
69
132
  requestInterval?: number;
70
133
  };
134
+ retry?: AirtableRetryOptions;
71
135
  }): Promise<DeleteRecordsResponse>;
72
- export declare function createRecord<Fields>({ apiKey, baseId, tableId, fields, options, }: {
136
+ export declare function createRecord<Fields>({ apiKey, baseId, tableId, fields, options, retry, }: {
73
137
  apiKey: string;
74
138
  baseId: string;
75
139
  tableId: string;
@@ -78,8 +142,9 @@ export declare function createRecord<Fields>({ apiKey, baseId, tableId, fields,
78
142
  typecast?: boolean;
79
143
  returnFieldsByFieldId?: boolean;
80
144
  };
145
+ retry?: AirtableRetryOptions;
81
146
  }): Promise<AirtableRecord<Fields>>;
82
- export declare function createRecords<Fields>({ apiKey, baseId, tableId, records, options, }: {
147
+ export declare function createRecords<Fields>({ apiKey, baseId, tableId, records, options, retry, }: {
83
148
  apiKey: string;
84
149
  baseId: string;
85
150
  tableId: string;
@@ -91,6 +156,7 @@ export declare function createRecords<Fields>({ apiKey, baseId, tableId, records
91
156
  returnFieldsByFieldId?: boolean;
92
157
  requestInterval?: number;
93
158
  };
159
+ retry?: AirtableRetryOptions;
94
160
  }): Promise<{
95
161
  records: AirtableRecord<Fields>[];
96
162
  }>;