easy-airtable-api 0.0.14 → 0.0.16

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.
@@ -62,7 +62,7 @@ export interface CollaboratorCell {
62
62
  }
63
63
  export interface SingleCollaboratorFieldTypeAndOptions {
64
64
  type: 'singleCollaborator';
65
- options: {};
65
+ options: Record<string, never>;
66
66
  }
67
67
  export type CountCell = number;
68
68
  export interface CountFieldTypeAndOptions {
@@ -80,7 +80,7 @@ export type CreatedTimeCell = string;
80
80
  export interface CreatedTimeFieldTypeAndOptions {
81
81
  type: 'createdTime';
82
82
  options: {
83
- result?: any;
83
+ result?: unknown;
84
84
  };
85
85
  }
86
86
  export type CurrencyCell = number;
@@ -133,7 +133,7 @@ export interface FormulaFieldTypeAndOptions {
133
133
  formula: string;
134
134
  isValid: boolean;
135
135
  referencedFieldIds: string[] | null;
136
- result: any;
136
+ result: unknown;
137
137
  };
138
138
  }
139
139
  export type LastModifiedByCell = {
@@ -151,7 +151,7 @@ export interface LastModifiedTimeFieldTypeAndOptions {
151
151
  options: {
152
152
  isValid: boolean;
153
153
  referencedFieldIds: string[] | null;
154
- result: any;
154
+ result: unknown;
155
155
  };
156
156
  }
157
157
  export type LinkToAnotherRecordCellV1 = string[];
@@ -173,10 +173,10 @@ export type LongTextCell = string;
173
173
  export interface LongTextFieldTypeAndOptions {
174
174
  type: 'multilineText';
175
175
  }
176
- export type LookupCellV1 = (number | string | boolean | any)[];
176
+ export type LookupCellV1 = (number | string | boolean | unknown)[];
177
177
  export type LookupCellV2 = {
178
178
  valuesByLinkedRecordId: {
179
- [key: string]: any[];
179
+ [key: string]: unknown[];
180
180
  };
181
181
  linkedRecordIds: string[];
182
182
  };
@@ -186,7 +186,7 @@ export interface LookupFieldTypeAndOptions {
186
186
  fieldIdInLinkedTable: string | null;
187
187
  isValid: boolean;
188
188
  recordLinkFieldId: string | null;
189
- result: any;
189
+ result: unknown;
190
190
  };
191
191
  }
192
192
  export type Collaborator = {
@@ -215,7 +215,7 @@ export type RatingOptions = {
215
215
  export type RollupOptions = {
216
216
  fieldIdInLinkedTable?: string;
217
217
  recordLinkFieldId?: string;
218
- result?: any;
218
+ result?: unknown;
219
219
  isValid?: boolean;
220
220
  referencedFieldIds?: string[];
221
221
  };
@@ -0,0 +1,24 @@
1
+ export type AirtableFieldOptions = Record<string, unknown>;
2
+ export interface AirtableFieldSchema {
3
+ id: string;
4
+ name: string;
5
+ type: string;
6
+ description?: string;
7
+ options?: AirtableFieldOptions;
8
+ }
9
+ export interface AirtableViewSchema {
10
+ id: string;
11
+ name: string;
12
+ type: string;
13
+ }
14
+ export interface AirtableTableSchema {
15
+ id: string;
16
+ name: string;
17
+ description?: string;
18
+ primaryFieldId: string;
19
+ fields: AirtableFieldSchema[];
20
+ views?: AirtableViewSchema[];
21
+ }
22
+ export interface AirtableBaseSchema {
23
+ tables: AirtableTableSchema[];
24
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -4,7 +4,7 @@ export type AirtableRecord<Fields = DefaultFieldsType> = {
4
4
  fields: Fields;
5
5
  };
6
6
  type DefaultFieldsType = {
7
- [key: string]: any;
7
+ [key: string]: unknown;
8
8
  };
9
9
  type BaseId = string;
10
10
  type TableIdOrName = string;
@@ -105,9 +105,6 @@ export interface DeleteRecordsPathParameters {
105
105
  baseId: BaseId;
106
106
  tableIdOrName: TableIdOrName;
107
107
  }
108
- export interface DeleteRecordsQueryParameters {
109
- records: string[];
110
- }
111
108
  export interface DeleteRecordResponse {
112
109
  id: string;
113
110
  deleted: true;
package/lib/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { UpdateRecords } from './types/fields';
2
- export declare function getArrayInChunks(records: UpdateRecords): Promise<import("./types/fields").UpdateRecord[][]>;
1
+ import { UpdateRecords } from './types/fields.js';
2
+ export declare function getArrayInChunks(records: UpdateRecords): Promise<import("./types/fields.js").UpdateRecord[][]>;
3
3
  export declare function getErrorMessage(error: Error | unknown): string;
4
4
  export declare function delay(ms?: number): Promise<unknown>;
package/lib/utils.js CHANGED
@@ -13,5 +13,7 @@ export function getErrorMessage(error) {
13
13
  return String(error);
14
14
  }
15
15
  export async function delay(ms = 0) {
16
+ if (!ms || typeof ms !== 'number' || ms <= 0)
17
+ return;
16
18
  return await new Promise((resolve) => setTimeout(resolve, ms));
17
19
  }
package/package.json CHANGED
@@ -1,24 +1,32 @@
1
1
  {
2
2
  "name": "easy-airtable-api",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
- "description": "An easy way to connect to Airtable via their API.",
5
+ "description": "Lightweight TypeScript-first Airtable client with metadata-based type generation.",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
+ "types": "./lib/index.d.ts",
10
11
  "import": "./lib/index.js"
12
+ },
13
+ "./codegen": {
14
+ "types": "./lib/codegen/index.d.ts",
15
+ "import": "./lib/codegen/index.js"
11
16
  }
12
17
  },
18
+ "bin": {
19
+ "easy-airtable-api": "./lib/cli.js"
20
+ },
13
21
  "scripts": {
14
22
  "watch": "tsc --watch",
15
23
  "build": "rm -r ./lib && tsc",
16
24
  "publish": "npm publish",
17
25
  "lint": "eslint 'src/**/*.{ts,tsx}'",
18
- "test": "vitest",
19
- "testGetRecords": "vitest get-records.test.ts",
20
- "testUpdateRecords": "vitest update-records.test.ts",
21
- "testDeleteRecords": "vitest delete-records.test.ts"
26
+ "test": "npm run test:codegen",
27
+ "test:codegen": "vitest run tests/codegen.test.ts",
28
+ "test:integration": "RUN_AIRTABLE_INTEGRATION_TESTS=true vitest run tests/get-record.test.ts tests/get-records.test.ts tests/create-records.test.ts tests/update-records.test.ts tests/delete-records.test.ts",
29
+ "test:all": "vitest run"
22
30
  },
23
31
  "keywords": [
24
32
  "airtable"