easy-airtable-api 0.0.3 → 0.0.5
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 +10 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/{esm/requests.d.ts → requests.d.ts} +2 -2
- package/lib/requests.js +152 -0
- package/lib/utils.d.ts +4 -0
- package/lib/utils.js +17 -0
- package/package.json +14 -15
- package/lib/cjs/index.d.ts +0 -1
- package/lib/cjs/index.js +0 -5
- package/lib/cjs/requests.d.ts +0 -46
- package/lib/cjs/requests.js +0 -186
- package/lib/cjs/types/bases.js +0 -2
- package/lib/cjs/types/fields.js +0 -2
- package/lib/cjs/types/records.js +0 -2
- package/lib/cjs/types/tables.js +0 -2
- package/lib/cjs/utils.d.ts +0 -4
- package/lib/cjs/utils.js +0 -32
- package/lib/esm/index.d.ts +0 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/requests.js +0 -177
- package/lib/esm/types/bases.d.ts +0 -63
- package/lib/esm/types/fields.d.ts +0 -328
- package/lib/esm/types/records.d.ts +0 -131
- package/lib/esm/types/tables.d.ts +0 -99
- package/lib/esm/utils.d.ts +0 -4
- package/lib/esm/utils.js +0 -26
- package/tsconfig.cjs.json +0 -21
- package/tsconfig.esm.json +0 -21
- /package/lib/{cjs/types → types}/bases.d.ts +0 -0
- /package/lib/{esm/types → types}/bases.js +0 -0
- /package/lib/{cjs/types → types}/fields.d.ts +0 -0
- /package/lib/{esm/types → types}/fields.js +0 -0
- /package/lib/{cjs/types → types}/records.d.ts +0 -0
- /package/lib/{esm/types → types}/records.js +0 -0
- /package/lib/{cjs/types → types}/tables.d.ts +0 -0
- /package/lib/{esm/types → types}/tables.js +0 -0
|
@@ -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 {};
|
package/lib/esm/utils.d.ts
DELETED
|
@@ -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>;
|
package/lib/esm/utils.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const getArrayInChunks = (records) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
const chunks = [];
|
|
12
|
-
const chunkSize = 10;
|
|
13
|
-
for (let i = 0; i < records.length; i += chunkSize) {
|
|
14
|
-
const chunk = records.slice(i, i + chunkSize);
|
|
15
|
-
chunks.push(chunk);
|
|
16
|
-
}
|
|
17
|
-
return chunks;
|
|
18
|
-
});
|
|
19
|
-
export const getErrorMessage = (error) => {
|
|
20
|
-
if (error instanceof Error)
|
|
21
|
-
return error.message;
|
|
22
|
-
return String(error);
|
|
23
|
-
};
|
|
24
|
-
export const delay = (ms = 0) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
return yield new Promise((resolve) => setTimeout(resolve, ms));
|
|
26
|
-
});
|
package/tsconfig.cjs.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es6",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"outDir": "./lib/cjs",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"skipLibCheck": false,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"types": [
|
|
12
|
-
"node"
|
|
13
|
-
]
|
|
14
|
-
},
|
|
15
|
-
"include": [
|
|
16
|
-
"src/**/*.ts"
|
|
17
|
-
],
|
|
18
|
-
"exclude": [
|
|
19
|
-
"node_modules"
|
|
20
|
-
]
|
|
21
|
-
}
|
package/tsconfig.esm.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es6",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"outDir": "./lib/esm",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"skipLibCheck": false,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"types": [
|
|
12
|
-
"node"
|
|
13
|
-
],
|
|
14
|
-
},
|
|
15
|
-
"include": [
|
|
16
|
-
"src/**/*.ts"
|
|
17
|
-
],
|
|
18
|
-
"exclude": [
|
|
19
|
-
"node_modules"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|