easy-airtable-api 0.0.3 → 0.0.4

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 CHANGED
@@ -16,9 +16,14 @@ npm install easy-airtable-api
16
16
 
17
17
  ## Changelog
18
18
 
19
+ ### 0.0.4
20
+
21
+ - Export all available methods
22
+ - Restucture lib folder to not have duplicate types.
23
+
19
24
  ### 0.0.3
20
25
 
21
- - ESM & CJS builds/
26
+ - ESM & CJS builds.
22
27
  - Server error handling.
23
28
  - Generic field types.
24
29
 
package/lib/cjs/index.js CHANGED
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRecord = void 0;
3
+ exports.replaceRecords = exports.replaceRecord = exports.updateRecords = exports.updateRecord = exports.getRecords = exports.getRecord = void 0;
4
4
  var requests_1 = require("./requests");
5
5
  Object.defineProperty(exports, "getRecord", { enumerable: true, get: function () { return requests_1.getRecord; } });
6
+ Object.defineProperty(exports, "getRecords", { enumerable: true, get: function () { return requests_1.getRecords; } });
7
+ Object.defineProperty(exports, "updateRecord", { enumerable: true, get: function () { return requests_1.updateRecord; } });
8
+ Object.defineProperty(exports, "updateRecords", { enumerable: true, get: function () { return requests_1.updateRecords; } });
9
+ Object.defineProperty(exports, "replaceRecord", { enumerable: true, get: function () { return requests_1.replaceRecord; } });
10
+ Object.defineProperty(exports, "replaceRecords", { enumerable: true, get: function () { return requests_1.replaceRecords; } });
@@ -9,11 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.replaceMultipleRecords = exports.replaceRecord = exports.updateRecords = exports.updateRecord = exports.getRecords = exports.getRecord = void 0;
12
+ exports.replaceRecords = exports.replaceRecord = exports.updateRecords = exports.updateRecord = exports.getRecords = exports.getRecord = void 0;
13
13
  const https_1 = require("https");
14
14
  const url_1 = require("url");
15
- function getRecord({ apiKey, baseId, tableId, recordId, }) {
16
- return __awaiter(this, void 0, void 0, function* () {
15
+ function getRecord(_a) {
16
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, recordId, }) {
17
17
  return airtableRequest({
18
18
  apiKey,
19
19
  baseId,
@@ -24,8 +24,8 @@ function getRecord({ apiKey, baseId, tableId, recordId, }) {
24
24
  });
25
25
  }
26
26
  exports.getRecord = getRecord;
27
- function getRecords({ apiKey, baseId, tableId, options, }) {
28
- return __awaiter(this, void 0, void 0, function* () {
27
+ function getRecords(_a) {
28
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, options, }) {
29
29
  return airtableRequest({
30
30
  apiKey,
31
31
  baseId,
@@ -37,8 +37,8 @@ function getRecords({ apiKey, baseId, tableId, options, }) {
37
37
  });
38
38
  }
39
39
  exports.getRecords = getRecords;
40
- function updateRecord({ apiKey, baseId, tableId, recordId, fields, }) {
41
- return __awaiter(this, void 0, void 0, function* () {
40
+ function updateRecord(_a) {
41
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, recordId, fields, }) {
42
42
  return airtableRequest({
43
43
  apiKey,
44
44
  baseId,
@@ -50,8 +50,8 @@ function updateRecord({ apiKey, baseId, tableId, recordId, fields, }) {
50
50
  });
51
51
  }
52
52
  exports.updateRecord = updateRecord;
53
- function updateRecords({ apiKey, baseId, tableId, records, options, }) {
54
- return __awaiter(this, void 0, void 0, function* () {
53
+ function updateRecords(_a) {
54
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, records, options, }) {
55
55
  if (!Array.isArray(records) || records.length === 0) {
56
56
  throw new Error('The records array is empty or not provided. Please provide a non-empty array of records to update.');
57
57
  }
@@ -66,8 +66,8 @@ function updateRecords({ apiKey, baseId, tableId, records, options, }) {
66
66
  });
67
67
  }
68
68
  exports.updateRecords = updateRecords;
69
- function replaceRecord({ apiKey, baseId, tableId, recordId, fields, }) {
70
- return __awaiter(this, void 0, void 0, function* () {
69
+ function replaceRecord(_a) {
70
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, recordId, fields, }) {
71
71
  return airtableRequest({
72
72
  apiKey,
73
73
  baseId,
@@ -79,8 +79,8 @@ function replaceRecord({ apiKey, baseId, tableId, recordId, fields, }) {
79
79
  });
80
80
  }
81
81
  exports.replaceRecord = replaceRecord;
82
- function replaceMultipleRecords({ apiKey, baseId, tableId, records, }) {
83
- return __awaiter(this, void 0, void 0, function* () {
82
+ function replaceRecords(_a) {
83
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, records, }) {
84
84
  if (!Array.isArray(records) || records.length === 0) {
85
85
  throw new Error('The records array is empty or not provided. Please provide a non-empty array of records to replace.');
86
86
  }
@@ -94,7 +94,7 @@ function replaceMultipleRecords({ apiKey, baseId, tableId, records, }) {
94
94
  });
95
95
  });
96
96
  }
97
- exports.replaceMultipleRecords = replaceMultipleRecords;
97
+ exports.replaceRecords = replaceRecords;
98
98
  function airtableRequest(request) {
99
99
  return __awaiter(this, void 0, void 0, function* () {
100
100
  const { apiKey, baseId, tableId, endpoint, method, body, apiURL } = request;
@@ -141,8 +141,8 @@ function validateResponse(response) {
141
141
  throw new Error('SERVICE_UNAVAILABLE');
142
142
  throw new Error('UNEXPECTED_ERROR');
143
143
  }
144
- function apiRequest({ url, method, apiKey, body, }) {
145
- return __awaiter(this, void 0, void 0, function* () {
144
+ function apiRequest(_a) {
145
+ return __awaiter(this, arguments, void 0, function* ({ url, method, apiKey, body, }) {
146
146
  return new Promise((resolve, reject) => {
147
147
  const parsedUrl = new url_1.URL(url);
148
148
  const { hostname, pathname, search } = parsedUrl;
package/lib/cjs/utils.js CHANGED
@@ -26,7 +26,7 @@ const getErrorMessage = (error) => {
26
26
  return String(error);
27
27
  };
28
28
  exports.getErrorMessage = getErrorMessage;
29
- const delay = (ms = 0) => __awaiter(void 0, void 0, void 0, function* () {
29
+ const delay = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (ms = 0) {
30
30
  return yield new Promise((resolve) => setTimeout(resolve, ms));
31
31
  });
32
32
  exports.delay = delay;
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- export { getRecord } from './requests';
1
+ export { getRecord, getRecords, updateRecord, updateRecords, replaceRecord, replaceRecords, } from './requests';
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { request } from 'https';
11
11
  import { URL } from 'url';
12
- export function getRecord({ apiKey, baseId, tableId, recordId, }) {
13
- return __awaiter(this, void 0, void 0, function* () {
12
+ export function getRecord(_a) {
13
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, recordId, }) {
14
14
  return airtableRequest({
15
15
  apiKey,
16
16
  baseId,
@@ -20,8 +20,8 @@ export function getRecord({ apiKey, baseId, tableId, recordId, }) {
20
20
  });
21
21
  });
22
22
  }
23
- export function getRecords({ apiKey, baseId, tableId, options, }) {
24
- return __awaiter(this, void 0, void 0, function* () {
23
+ export function getRecords(_a) {
24
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, options, }) {
25
25
  return airtableRequest({
26
26
  apiKey,
27
27
  baseId,
@@ -32,8 +32,8 @@ export function getRecords({ apiKey, baseId, tableId, options, }) {
32
32
  });
33
33
  });
34
34
  }
35
- export function updateRecord({ apiKey, baseId, tableId, recordId, fields, }) {
36
- return __awaiter(this, void 0, void 0, function* () {
35
+ export function updateRecord(_a) {
36
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, recordId, fields, }) {
37
37
  return airtableRequest({
38
38
  apiKey,
39
39
  baseId,
@@ -44,8 +44,8 @@ export function updateRecord({ apiKey, baseId, tableId, recordId, fields, }) {
44
44
  });
45
45
  });
46
46
  }
47
- export function updateRecords({ apiKey, baseId, tableId, records, options, }) {
48
- return __awaiter(this, void 0, void 0, function* () {
47
+ export function updateRecords(_a) {
48
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, records, options, }) {
49
49
  if (!Array.isArray(records) || records.length === 0) {
50
50
  throw new Error('The records array is empty or not provided. Please provide a non-empty array of records to update.');
51
51
  }
@@ -59,8 +59,8 @@ export function updateRecords({ apiKey, baseId, tableId, records, options, }) {
59
59
  });
60
60
  });
61
61
  }
62
- export function replaceRecord({ apiKey, baseId, tableId, recordId, fields, }) {
63
- return __awaiter(this, void 0, void 0, function* () {
62
+ export function replaceRecord(_a) {
63
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, recordId, fields, }) {
64
64
  return airtableRequest({
65
65
  apiKey,
66
66
  baseId,
@@ -71,8 +71,8 @@ export function replaceRecord({ apiKey, baseId, tableId, recordId, fields, }) {
71
71
  });
72
72
  });
73
73
  }
74
- export function replaceMultipleRecords({ apiKey, baseId, tableId, records, }) {
75
- return __awaiter(this, void 0, void 0, function* () {
74
+ export function replaceRecords(_a) {
75
+ return __awaiter(this, arguments, void 0, function* ({ apiKey, baseId, tableId, records, }) {
76
76
  if (!Array.isArray(records) || records.length === 0) {
77
77
  throw new Error('The records array is empty or not provided. Please provide a non-empty array of records to replace.');
78
78
  }
@@ -132,8 +132,8 @@ function validateResponse(response) {
132
132
  throw new Error('SERVICE_UNAVAILABLE');
133
133
  throw new Error('UNEXPECTED_ERROR');
134
134
  }
135
- function apiRequest({ url, method, apiKey, body, }) {
136
- return __awaiter(this, void 0, void 0, function* () {
135
+ function apiRequest(_a) {
136
+ return __awaiter(this, arguments, void 0, function* ({ url, method, apiKey, body, }) {
137
137
  return new Promise((resolve, reject) => {
138
138
  const parsedUrl = new URL(url);
139
139
  const { hostname, pathname, search } = parsedUrl;
package/lib/esm/utils.js CHANGED
@@ -21,6 +21,6 @@ export const getErrorMessage = (error) => {
21
21
  return error.message;
22
22
  return String(error);
23
23
  };
24
- export const delay = (ms = 0) => __awaiter(void 0, void 0, void 0, function* () {
24
+ export const delay = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (ms = 0) {
25
25
  return yield new Promise((resolve) => setTimeout(resolve, ms));
26
26
  });
@@ -0,0 +1 @@
1
+ export { getRecord, getRecords, updateRecord, updateRecords, replaceRecord, replaceRecords, } from './requests';
@@ -35,7 +35,7 @@ export declare function replaceRecord<Fields>({ apiKey, baseId, tableId, recordI
35
35
  recordId: string;
36
36
  fields: object;
37
37
  }): Promise<AirtableRecord<Fields>>;
38
- export declare function replaceMultipleRecords<Fields>({ apiKey, baseId, tableId, records, }: {
38
+ export declare function replaceRecords<Fields>({ apiKey, baseId, tableId, records, }: {
39
39
  apiKey: string;
40
40
  baseId: string;
41
41
  tableId: string;
package/package.json CHANGED
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "name": "easy-airtable-api",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "An easy way to connect to Airtable via their API.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/esm/index.js",
7
- "types": "lib/esm/index.d.ts",
7
+ "types": "lib/types/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "require": "./lib/cjs/index.js",
11
- "import": "./lib/esm/index.js"
11
+ "import": "./lib/esm/index.js",
12
+ "types": "./lib/types/index.d.ts"
12
13
  }
13
14
  },
14
15
  "scripts": {
15
16
  "watch": "tsc --watch",
16
- "build": "tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json",
17
- "publish": "npm run build && npm publish",
17
+ "build": "rm -r ./lib && tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json",
18
+ "publish": "npm publish",
18
19
  "lint": "eslint 'src/**/*.{ts,tsx}'",
19
20
  "test": "vitest"
20
21
  },
@@ -48,12 +49,12 @@
48
49
  "printWidth": 80
49
50
  },
50
51
  "devDependencies": {
51
- "@types/node": "20.5.9",
52
- "@typescript-eslint/eslint-plugin": "6.8.0",
53
- "@typescript-eslint/parser": "6.8.0",
54
- "dotenv": "16.3.1",
55
- "eslint": "8.51.0",
56
- "typescript": "5.2.2",
57
- "vitest": "0.34.4"
52
+ "@types/node": "^20.11.30",
53
+ "@typescript-eslint/eslint-plugin": "^7.3.1",
54
+ "@typescript-eslint/parser": "^7.3.1",
55
+ "dotenv": "^16.4.5",
56
+ "eslint": "^8.57.0",
57
+ "typescript": "^5.4.3",
58
+ "vitest": "^1.4.0"
58
59
  }
59
60
  }
package/tsconfig.cjs.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "moduleResolution": "node",
6
6
  "declaration": true,
7
7
  "outDir": "./lib/cjs",
8
+ "declarationDir": "./lib/types",
8
9
  "strict": true,
9
10
  "skipLibCheck": false,
10
11
  "esModuleInterop": true,
@@ -16,6 +17,7 @@
16
17
  "src/**/*.ts"
17
18
  ],
18
19
  "exclude": [
20
+ "lib",
19
21
  "node_modules"
20
22
  ]
21
23
  }
package/tsconfig.esm.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "moduleResolution": "node",
6
6
  "declaration": true,
7
7
  "outDir": "./lib/esm",
8
+ "declarationDir": "./lib/types",
8
9
  "strict": true,
9
10
  "skipLibCheck": false,
10
11
  "esModuleInterop": true,
@@ -16,6 +17,7 @@
16
17
  "src/**/*.ts"
17
18
  ],
18
19
  "exclude": [
20
+ "lib",
19
21
  "node_modules"
20
22
  ]
21
23
  }
@@ -1 +0,0 @@
1
- export { getRecord } from './requests';
@@ -1 +0,0 @@
1
- export { getRecord } from './requests';
@@ -1,46 +0,0 @@
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>[]>;
@@ -1,63 +0,0 @@
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 {};
@@ -1,328 +0,0 @@
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 {};
@@ -1,131 +0,0 @@
1
- export type AirtableRecord<Fields = DefaultFieldsType> = {
2
- id: string;
3
- createdTime: string;
4
- fields: Fields;
5
- };
6
- type DefaultFieldsType = {
7
- [key: string]: unknown;
8
- };
9
- type BaseId = string;
10
- type TableIdOrName = string;
11
- type Timezone = string;
12
- type SortDirection = 'asc' | 'desc';
13
- type CellFormat = 'json' | 'string';
14
- type RecordMetadataOptions = 'commentCount';
15
- interface SortObject {
16
- field: string;
17
- direction?: SortDirection;
18
- }
19
- export interface GetRecordsQueryParameters {
20
- timeZone?: Timezone;
21
- userLocale?: string;
22
- pageSize?: number;
23
- maxRecords?: number;
24
- offset?: string;
25
- view?: string;
26
- sort?: SortObject[];
27
- filterByFormula?: string;
28
- cellFormat?: CellFormat;
29
- fields?: string[];
30
- returnFieldsByFieldId?: boolean;
31
- recordMetadata?: RecordMetadataOptions[];
32
- }
33
- type RecordField = {
34
- [key: string]: unknown;
35
- };
36
- export interface AirtableBaseRecord {
37
- id: string;
38
- createdTime: string;
39
- fields: RecordField;
40
- }
41
- export interface ListRecordsResponse {
42
- offset?: string;
43
- records: AirtableBaseRecord[];
44
- }
45
- export interface GetRecordQueryParameters {
46
- cellFormat?: CellFormat;
47
- returnFieldsByFieldId?: boolean;
48
- }
49
- export interface GetRecordPathParameters {
50
- baseId: BaseId;
51
- tableIdOrName: TableIdOrName;
52
- recordId: string;
53
- }
54
- export interface UpdatePathParameters {
55
- baseId: BaseId;
56
- tableIdOrName: TableIdOrName;
57
- }
58
- export interface PerformUpsert {
59
- fieldsToMergeOn: string[];
60
- }
61
- export interface UpdateRecordsRequestBody {
62
- performUpsert?: PerformUpsert;
63
- returnFieldsByFieldId?: boolean;
64
- typecast?: boolean;
65
- records: AirtableBaseRecord[];
66
- }
67
- export interface UpsertResponse {
68
- createdRecords: string[];
69
- updatedRecords: string[];
70
- records: AirtableBaseRecord[];
71
- }
72
- export interface UpdateRecordPathParameters {
73
- baseId: BaseId;
74
- tableIdOrName: TableIdOrName;
75
- recordId: string;
76
- }
77
- export interface UpdateRecordRequestBody {
78
- typecast?: boolean;
79
- fields: RecordField;
80
- }
81
- export interface UpdateRecordResponse {
82
- id: string;
83
- createdTime: string;
84
- fields: RecordField;
85
- }
86
- export interface CreateRecordsPathParameters {
87
- baseId: BaseId;
88
- tableIdOrName: TableIdOrName;
89
- }
90
- export interface CreateRecordsRequestBody {
91
- fields?: RecordField;
92
- records?: AirtableBaseRecord[];
93
- returnFieldsByFieldId?: boolean;
94
- typecast?: boolean;
95
- }
96
- export type UpdateRecordsRequestOptions = {
97
- typecast?: boolean;
98
- returnFieldsByFieldId?: boolean;
99
- };
100
- export interface CreateRecordResponse {
101
- id: string;
102
- createdTime: string;
103
- fields: RecordField;
104
- }
105
- export interface CreateRecordsResponse {
106
- records: CreateRecordResponse[];
107
- }
108
- export interface DeleteRecordsPathParameters {
109
- baseId: BaseId;
110
- tableIdOrName: TableIdOrName;
111
- }
112
- export interface DeleteRecordsQueryParameters {
113
- records: string[];
114
- }
115
- export interface DeleteRecordResponse {
116
- id: string;
117
- deleted: true;
118
- }
119
- export interface DeleteRecordsResponse {
120
- records: DeleteRecordResponse[];
121
- }
122
- export interface DeleteRecordPathParameters {
123
- baseId: BaseId;
124
- tableIdOrName: TableIdOrName;
125
- recordId: string;
126
- }
127
- export interface SingleDeleteRecordResponse {
128
- id: string;
129
- deleted: true;
130
- }
131
- export {};
@@ -1,99 +0,0 @@
1
- export type UpserptRecords = {
2
- records: {
3
- id: string;
4
- createdTime: string;
5
- fields: unknown;
6
- }[];
7
- updatedRecords: string[];
8
- createdRecords: string[];
9
- };
10
- export interface UpdateRecordsBody<Fields> {
11
- typecast: boolean;
12
- records: UpdateRecords<Fields>;
13
- }
14
- export interface UpdateRecordsBodyUpsert<Fields> extends UpdateRecordsBody<Fields> {
15
- performUpsert: {
16
- fieldsToMergeOn: FieldsToMergeOn;
17
- };
18
- }
19
- export type BaseId = string;
20
- export type TableId = string;
21
- export type FieldsToMergeOn = string[];
22
- export type ApiRequest = {
23
- url: string;
24
- method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
25
- apiKey: string;
26
- body?: RequestBody;
27
- };
28
- export type RequestMethods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
29
- export interface RequestMethodProps {
30
- url: string;
31
- apiKey: string;
32
- body?: RequestBody;
33
- }
34
- export type RequestBody = unknown;
35
- export interface AirtableRecordRequest {
36
- baseId: string;
37
- tableId: string;
38
- atId?: string;
39
- body: RequestBody;
40
- }
41
- export interface UpdateAirtableRecordRequest {
42
- atId?: string;
43
- baseId: string;
44
- tableId: string;
45
- body?: RequestBody;
46
- }
47
- export interface RequestBodyWebsiteInfos {
48
- fields: unknown;
49
- }
50
- export type UpdateRecord<Fields> = {
51
- fields: Fields;
52
- };
53
- export type UpdateRecords<Fields> = UpdateRecord<Fields>[];
54
- type FieldType = 'singleLineText' | 'checkbox';
55
- type TableFieldOptions = {
56
- color?: string;
57
- icon?: string;
58
- };
59
- type FieldConfig = {
60
- id?: string;
61
- name: string;
62
- description?: string;
63
- type: FieldType;
64
- options?: TableFieldOptions;
65
- };
66
- export type BaseTableDetails = {
67
- name: string;
68
- description?: string;
69
- };
70
- export type TableConfig = {
71
- name: string;
72
- description?: string;
73
- fields: FieldConfig[];
74
- };
75
- type ViewType = 'grid' | 'form' | 'calendar' | 'gallery' | 'kanban' | 'timeline' | 'block';
76
- export type View = {
77
- id: string;
78
- name: string;
79
- type: ViewType;
80
- visibleFieldIds?: string[];
81
- };
82
- export type TableModel = {
83
- id: string;
84
- primaryFieldId: string;
85
- name: string;
86
- description?: string;
87
- fields: FieldConfig[];
88
- views: View[];
89
- };
90
- export type UpdateTableRequestBody = {
91
- name?: string;
92
- description?: string;
93
- };
94
- export type CreateTableRequestBody = {
95
- name: string;
96
- description?: string;
97
- fields: FieldConfig[];
98
- };
99
- export {};
@@ -1,4 +0,0 @@
1
- import { UpdateRecords } from './types/fields';
2
- export declare const getArrayInChunks: (records: UpdateRecords) => Promise<import("./types/fields").UpdateRecord[][]>;
3
- export declare const getErrorMessage: (error: Error | unknown) => string;
4
- export declare const delay: (ms?: number) => Promise<unknown>;
File without changes
File without changes
File without changes
File without changes
File without changes