easy-airtable-api 0.0.16 → 0.1.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.
- package/CHANGELOG.md +16 -0
- package/README.md +224 -1
- package/easy-airtable-api-0.1.0.tgz +0 -0
- package/lib/bases.d.ts +18 -0
- package/lib/bases.js +40 -0
- package/lib/codegen/emit-typescript.js +43 -30
- package/lib/codegen/identifiers.d.ts +4 -0
- package/lib/codegen/identifiers.js +24 -2
- package/lib/codegen/load-schema.js +1 -1
- package/lib/codegen/map-field.d.ts +12 -13
- package/lib/codegen/map-field.js +74 -56
- package/lib/codegen/normalize-schema.js +31 -13
- package/lib/codegen/types.d.ts +2 -0
- package/lib/index.d.ts +8 -3
- package/lib/index.js +3 -1
- package/lib/records.d.ts +110 -9
- package/lib/records.js +111 -22
- package/lib/requests.d.ts +64 -5
- package/lib/requests.js +280 -30
- package/lib/types/bases.d.ts +8 -40
- package/lib/types/fields.d.ts +12 -10
- package/lib/types/records.d.ts +8 -0
- package/package.json +7 -6
package/lib/types/bases.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AirtableBaseSchema } from './metadata.js';
|
|
1
2
|
type BaseList = {
|
|
2
3
|
id: string;
|
|
3
4
|
name: string;
|
|
@@ -7,57 +8,24 @@ export type ListBasesResponse = {
|
|
|
7
8
|
bases: BaseList[];
|
|
8
9
|
offset?: string;
|
|
9
10
|
};
|
|
10
|
-
type
|
|
11
|
-
inverseLinkFieldId?: string;
|
|
12
|
-
isReversed?: boolean;
|
|
13
|
-
linkedTableId?: string;
|
|
14
|
-
prefersSingleRecordLink?: boolean;
|
|
15
|
-
};
|
|
16
|
-
type Field = {
|
|
17
|
-
description?: string;
|
|
18
|
-
id: string;
|
|
11
|
+
export type CreateBaseFieldConfig = {
|
|
19
12
|
name: string;
|
|
20
13
|
type: string;
|
|
21
|
-
options?: BasesFieldOptions;
|
|
22
|
-
};
|
|
23
|
-
type TableView = {
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
type: string;
|
|
27
|
-
};
|
|
28
|
-
type Table = {
|
|
29
14
|
description?: string;
|
|
30
|
-
|
|
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;
|
|
15
|
+
options?: Record<string, unknown>;
|
|
42
16
|
};
|
|
43
|
-
type
|
|
44
|
-
description?: string;
|
|
17
|
+
export type CreateBaseTableConfig = {
|
|
45
18
|
name: string;
|
|
46
|
-
type: string;
|
|
47
|
-
options?: TableConfigFieldOptions;
|
|
48
|
-
};
|
|
49
|
-
type BasesTableConfig = {
|
|
50
19
|
description?: string;
|
|
51
|
-
fields:
|
|
52
|
-
name: string;
|
|
20
|
+
fields: CreateBaseFieldConfig[];
|
|
53
21
|
};
|
|
54
22
|
export type CreateBaseRequestBody = {
|
|
55
|
-
name: string;
|
|
56
|
-
tables: BasesTableConfig[];
|
|
57
23
|
workspaceId: string;
|
|
24
|
+
name: string;
|
|
25
|
+
tables: CreateBaseTableConfig[];
|
|
58
26
|
};
|
|
59
27
|
export type CreateBaseResponse = {
|
|
60
28
|
id: string;
|
|
61
|
-
tables:
|
|
29
|
+
tables: AirtableBaseSchema['tables'];
|
|
62
30
|
};
|
|
63
31
|
export {};
|
package/lib/types/fields.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ export interface BarcodeCell {
|
|
|
35
35
|
type?: string;
|
|
36
36
|
text: string;
|
|
37
37
|
}
|
|
38
|
+
export interface BarcodeWrite {
|
|
39
|
+
text: string;
|
|
40
|
+
type?: string;
|
|
41
|
+
}
|
|
42
|
+
export type Barcode = BarcodeCell;
|
|
38
43
|
export interface BarcodeFieldTypeAndOptions {
|
|
39
44
|
type: 'barcode';
|
|
40
45
|
}
|
|
@@ -42,6 +47,7 @@ export interface ButtonCell {
|
|
|
42
47
|
label: string;
|
|
43
48
|
url: string | null;
|
|
44
49
|
}
|
|
50
|
+
export type ButtonFieldValue = ButtonCell;
|
|
45
51
|
export interface ButtonFieldTypeAndOptions {
|
|
46
52
|
type: 'button';
|
|
47
53
|
}
|
|
@@ -60,6 +66,10 @@ export interface CollaboratorCell {
|
|
|
60
66
|
name?: string;
|
|
61
67
|
profilePicUrl?: string;
|
|
62
68
|
}
|
|
69
|
+
export interface CollaboratorWrite {
|
|
70
|
+
id: string;
|
|
71
|
+
email?: string;
|
|
72
|
+
}
|
|
63
73
|
export interface SingleCollaboratorFieldTypeAndOptions {
|
|
64
74
|
type: 'singleCollaborator';
|
|
65
75
|
options: Record<string, never>;
|
|
@@ -189,12 +199,7 @@ export interface LookupFieldTypeAndOptions {
|
|
|
189
199
|
result: unknown;
|
|
190
200
|
};
|
|
191
201
|
}
|
|
192
|
-
export type Collaborator =
|
|
193
|
-
id: string;
|
|
194
|
-
email?: string;
|
|
195
|
-
name?: string;
|
|
196
|
-
profilePicUrl?: string;
|
|
197
|
-
};
|
|
202
|
+
export type Collaborator = CollaboratorCell;
|
|
198
203
|
export type Collaborators = Collaborator[];
|
|
199
204
|
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
205
|
export type Choice = {
|
|
@@ -245,10 +250,7 @@ export type MultipleAttachments = Attachment[];
|
|
|
245
250
|
export type FormulaSingleReturn = string | number;
|
|
246
251
|
export type Rollup = string | number;
|
|
247
252
|
export type AutoNumber = number;
|
|
248
|
-
export type AirtableButton =
|
|
249
|
-
label: string;
|
|
250
|
-
url: string;
|
|
251
|
-
};
|
|
253
|
+
export type AirtableButton = ButtonCell;
|
|
252
254
|
export type LastModifiedTime = string;
|
|
253
255
|
export type CreatedTime = string;
|
|
254
256
|
export type DateTime = string;
|
package/lib/types/records.d.ts
CHANGED
|
@@ -30,6 +30,10 @@ export interface GetRecordsQueryParameters {
|
|
|
30
30
|
recordMetadata?: RecordMetadataOptions[];
|
|
31
31
|
requestInterval?: number;
|
|
32
32
|
}
|
|
33
|
+
export type GeneratedRecordFieldsCompatibleGetRecordsOptions = Omit<GetRecordsQueryParameters, 'cellFormat' | 'returnFieldsByFieldId'> & {
|
|
34
|
+
cellFormat?: 'json';
|
|
35
|
+
returnFieldsByFieldId?: false;
|
|
36
|
+
};
|
|
33
37
|
type RecordField = {
|
|
34
38
|
[key: string]: unknown;
|
|
35
39
|
};
|
|
@@ -46,6 +50,10 @@ export interface GetRecordQueryParameters {
|
|
|
46
50
|
cellFormat?: CellFormat;
|
|
47
51
|
returnFieldsByFieldId?: boolean;
|
|
48
52
|
}
|
|
53
|
+
export type GeneratedRecordFieldsCompatibleGetRecordOptions = Omit<GetRecordQueryParameters, 'cellFormat' | 'returnFieldsByFieldId'> & {
|
|
54
|
+
cellFormat?: 'json';
|
|
55
|
+
returnFieldsByFieldId?: false;
|
|
56
|
+
};
|
|
49
57
|
export interface GetRecordPathParameters {
|
|
50
58
|
baseId: BaseId;
|
|
51
59
|
tableIdOrName: TableIdOrName;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-airtable-api",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Lightweight TypeScript-first Airtable client with metadata-based type generation.",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -16,14 +16,15 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"bin": {
|
|
19
|
-
"easy-airtable-api": "
|
|
19
|
+
"easy-airtable-api": "lib/cli.js"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"watch": "tsc --watch",
|
|
23
23
|
"build": "rm -r ./lib && tsc",
|
|
24
|
-
"
|
|
24
|
+
"prepublishOnly": "npm test && npm run build",
|
|
25
|
+
"release": "npm run prepublishOnly && npm pack && npm publish --ignore-scripts",
|
|
25
26
|
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
26
|
-
"test": "npm run test:
|
|
27
|
+
"test": "npm run test:all",
|
|
27
28
|
"test:codegen": "vitest run tests/codegen.test.ts",
|
|
28
29
|
"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
30
|
"test:all": "vitest run"
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
],
|
|
34
35
|
"repository": {
|
|
35
36
|
"type": "git",
|
|
36
|
-
"url": "https://github.com/marcellocurto/easy-airtable-api.git"
|
|
37
|
+
"url": "git+https://github.com/marcellocurto/easy-airtable-api.git"
|
|
37
38
|
},
|
|
38
39
|
"homepage": "https://marcellocurto.com/code/easy-airtable-api",
|
|
39
40
|
"author": "Marcello Curto",
|
|
@@ -66,4 +67,4 @@
|
|
|
66
67
|
"typescript": "^5.4.3",
|
|
67
68
|
"vitest": "^1.4.0"
|
|
68
69
|
}
|
|
69
|
-
}
|
|
70
|
+
}
|