easy-airtable-api 0.0.17 → 0.2.0

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 (48) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +97 -1
  3. package/package.json +6 -3
  4. package/easy-airtable-api-0.0.17.tgz +0 -0
  5. package/lib/bases.d.ts +0 -18
  6. package/lib/bases.js +0 -40
  7. package/lib/cli.d.ts +0 -2
  8. package/lib/cli.js +0 -82
  9. package/lib/codegen/build.d.ts +0 -2
  10. package/lib/codegen/build.js +0 -25
  11. package/lib/codegen/emit-typescript.d.ts +0 -8
  12. package/lib/codegen/emit-typescript.js +0 -104
  13. package/lib/codegen/generate.d.ts +0 -2
  14. package/lib/codegen/generate.js +0 -23
  15. package/lib/codegen/identifiers.d.ts +0 -7
  16. package/lib/codegen/identifiers.js +0 -51
  17. package/lib/codegen/index.d.ts +0 -3
  18. package/lib/codegen/index.js +0 -2
  19. package/lib/codegen/load-schema.d.ts +0 -3
  20. package/lib/codegen/load-schema.js +0 -28
  21. package/lib/codegen/map-field.d.ts +0 -31
  22. package/lib/codegen/map-field.js +0 -278
  23. package/lib/codegen/normalize-schema.d.ts +0 -11
  24. package/lib/codegen/normalize-schema.js +0 -61
  25. package/lib/codegen/types.d.ts +0 -62
  26. package/lib/codegen/types.js +0 -1
  27. package/lib/codegen/utils.d.ts +0 -14
  28. package/lib/codegen/utils.js +0 -30
  29. package/lib/codegen/write-atomic.d.ts +0 -1
  30. package/lib/codegen/write-atomic.js +0 -11
  31. package/lib/index.d.ts +0 -8
  32. package/lib/index.js +0 -3
  33. package/lib/records.d.ts +0 -162
  34. package/lib/records.js +0 -300
  35. package/lib/requests.d.ts +0 -74
  36. package/lib/requests.js +0 -362
  37. package/lib/types/bases.d.ts +0 -31
  38. package/lib/types/bases.js +0 -1
  39. package/lib/types/fields.d.ts +0 -328
  40. package/lib/types/fields.js +0 -1
  41. package/lib/types/metadata.d.ts +0 -24
  42. package/lib/types/metadata.js +0 -1
  43. package/lib/types/records.d.ts +0 -122
  44. package/lib/types/records.js +0 -1
  45. package/lib/types/tables.d.ts +0 -99
  46. package/lib/types/tables.js +0 -1
  47. package/lib/utils.d.ts +0 -4
  48. package/lib/utils.js +0 -19
@@ -1,31 +0,0 @@
1
- import type { AirtableFieldSchema } from '../types/metadata.js';
2
- import type { EnumMode, NormalizedField, UnknownFieldBehavior } from './types.js';
3
- export declare function mapFieldTypes({ field, enumMode, unknownFieldBehavior, }: {
4
- field: AirtableFieldSchema;
5
- enumMode: EnumMode;
6
- unknownFieldBehavior: UnknownFieldBehavior;
7
- }): {
8
- read: {
9
- type: string;
10
- warning?: string;
11
- };
12
- create?: {
13
- type: string;
14
- warning?: string;
15
- };
16
- update?: {
17
- type: string;
18
- warning?: string;
19
- };
20
- readonly: boolean;
21
- computed: boolean;
22
- linkedTableId?: string;
23
- enumTypeAlias?: string;
24
- };
25
- export declare function mapFieldToNormalizedField({ field, enumMode, unknownFieldBehavior, tsKey, tsTypeName, }: {
26
- field: AirtableFieldSchema;
27
- enumMode: EnumMode;
28
- unknownFieldBehavior: UnknownFieldBehavior;
29
- tsKey: string;
30
- tsTypeName: string;
31
- }): NormalizedField;
@@ -1,278 +0,0 @@
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
- }
@@ -1,11 +0,0 @@
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
- };
@@ -1,61 +0,0 @@
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
- }
@@ -1,62 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
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[];
@@ -1,30 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export declare function writeAtomic(outputPath: string, content: string): Promise<string>;
@@ -1,11 +0,0 @@
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 DELETED
@@ -1,8 +0,0 @@
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 DELETED
@@ -1,3 +0,0 @@
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 DELETED
@@ -1,162 +0,0 @@
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, }: {
4
- apiKey: string;
5
- baseId: string;
6
- tableId: string;
7
- recordId: string;
8
- options?: GetRecordQueryParameters;
9
- retry?: AirtableRetryOptions;
10
- }): Promise<AirtableRecord<Fields>>;
11
- export declare function getRecordsPage<Fields>({ apiKey, baseId, tableId, options, retry, }: {
12
- apiKey: string;
13
- baseId: string;
14
- tableId: string;
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;
37
- }): Promise<AirtableRecord<Fields>[]>;
38
- export declare function updateRecord<Fields>({ apiKey, baseId, tableId, recordId, fields, options, retry, }: {
39
- apiKey: string;
40
- baseId: string;
41
- tableId: string;
42
- recordId: string;
43
- fields: Fields;
44
- options?: {
45
- typecast?: boolean;
46
- returnFieldsByFieldId?: boolean;
47
- overwriteFieldsNotSpecified?: boolean;
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;
62
- }): Promise<AirtableRecord<Fields>>;
63
- export declare function updateRecords<Fields>({ apiKey, baseId, tableId, records, options, retry, }: {
64
- apiKey: string;
65
- baseId: string;
66
- tableId: string;
67
- records: {
68
- id: string;
69
- fields: Fields;
70
- }[];
71
- options?: {
72
- typecast?: boolean;
73
- returnFieldsByFieldId?: boolean;
74
- overwriteFieldsNotSpecified?: boolean;
75
- requestInterval?: number;
76
- };
77
- retry?: AirtableRetryOptions;
78
- }): Promise<{
79
- records: AirtableRecord<Fields>[];
80
- }>;
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, }: {
99
- apiKey: string;
100
- baseId: string;
101
- tableId: string;
102
- records: {
103
- id?: string;
104
- fields: Fields;
105
- }[];
106
- options?: {
107
- fieldsToMergeOn: string[];
108
- typecast?: boolean;
109
- returnFieldsByFieldId?: boolean;
110
- overwriteFieldsNotSpecified?: boolean;
111
- requestInterval?: number;
112
- };
113
- retry?: AirtableRetryOptions;
114
- }): Promise<{
115
- createdRecords: string[];
116
- updatedRecords: string[];
117
- records: AirtableRecord<Fields>[];
118
- }>;
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, }: {
127
- apiKey: string;
128
- baseId: string;
129
- tableId: string;
130
- recordIds: string[];
131
- options?: {
132
- requestInterval?: number;
133
- };
134
- retry?: AirtableRetryOptions;
135
- }): Promise<DeleteRecordsResponse>;
136
- export declare function createRecord<Fields>({ apiKey, baseId, tableId, fields, options, retry, }: {
137
- apiKey: string;
138
- baseId: string;
139
- tableId: string;
140
- fields: Fields;
141
- options?: {
142
- typecast?: boolean;
143
- returnFieldsByFieldId?: boolean;
144
- };
145
- retry?: AirtableRetryOptions;
146
- }): Promise<AirtableRecord<Fields>>;
147
- export declare function createRecords<Fields>({ apiKey, baseId, tableId, records, options, retry, }: {
148
- apiKey: string;
149
- baseId: string;
150
- tableId: string;
151
- records: {
152
- fields: Fields;
153
- }[];
154
- options?: {
155
- typecast?: boolean;
156
- returnFieldsByFieldId?: boolean;
157
- requestInterval?: number;
158
- };
159
- retry?: AirtableRetryOptions;
160
- }): Promise<{
161
- records: AirtableRecord<Fields>[];
162
- }>;