@frogbotai/piece-airtable 0.22.0 → 0.24.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/README.md +40 -0
- package/dist/actions/customApiCall.d.ts +31 -0
- package/dist/actions/customApiCall.d.ts.map +1 -0
- package/dist/actions/customApiCall.js +27 -0
- package/dist/actions/customApiCall.js.map +1 -0
- package/dist/actions/records.d.ts +221 -0
- package/dist/actions/records.d.ts.map +1 -0
- package/dist/actions/records.js +221 -0
- package/dist/actions/records.js.map +1 -0
- package/dist/actions/schema.d.ts +260 -0
- package/dist/actions/schema.d.ts.map +1 -0
- package/dist/actions/schema.js +122 -0
- package/dist/actions/schema.js.map +1 -0
- package/dist/client.d.ts +22 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +44 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -0
- package/dist/definitions.d.ts +46 -0
- package/dist/definitions.d.ts.map +1 -0
- package/dist/definitions.js +7 -0
- package/dist/definitions.js.map +1 -0
- package/dist/index.d.ts +571 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -51
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +53 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +37 -0
- package/dist/options.js.map +1 -0
- package/dist/piece-types.d.ts +407 -0
- package/dist/piece-types.d.ts.map +1 -0
- package/dist/piece-types.js +2 -0
- package/dist/piece-types.js.map +1 -0
- package/dist/schemas.d.ts +50 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +52 -0
- package/dist/schemas.js.map +1 -0
- package/dist/triggers/records.d.ts +67 -0
- package/dist/triggers/records.d.ts.map +1 -0
- package/dist/triggers/records.js +60 -0
- package/dist/triggers/records.js.map +1 -0
- package/package.json +6 -5
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createBase: import("frogbot").PieceActionDefinition<z.ZodObject<{
|
|
3
|
+
workspaceId: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
tables: z.ZodTuple<[z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
description: z.ZodOptional<z.ZodString>;
|
|
8
|
+
fields: z.ZodTuple<[z.ZodObject<{
|
|
9
|
+
type: z.ZodString;
|
|
10
|
+
description: z.ZodOptional<z.ZodString>;
|
|
11
|
+
options: z.ZodOptional<z.ZodUnknown>;
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
}, z.core.$loose>], z.ZodObject<{
|
|
14
|
+
type: z.ZodString;
|
|
15
|
+
description: z.ZodOptional<z.ZodString>;
|
|
16
|
+
options: z.ZodOptional<z.ZodUnknown>;
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
}, z.core.$loose>>;
|
|
19
|
+
}, z.core.$strip>], z.ZodObject<{
|
|
20
|
+
name: z.ZodString;
|
|
21
|
+
description: z.ZodOptional<z.ZodString>;
|
|
22
|
+
fields: z.ZodTuple<[z.ZodObject<{
|
|
23
|
+
type: z.ZodString;
|
|
24
|
+
description: z.ZodOptional<z.ZodString>;
|
|
25
|
+
options: z.ZodOptional<z.ZodUnknown>;
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
}, z.core.$loose>], z.ZodObject<{
|
|
28
|
+
type: z.ZodString;
|
|
29
|
+
description: z.ZodOptional<z.ZodString>;
|
|
30
|
+
options: z.ZodOptional<z.ZodUnknown>;
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
}, z.core.$loose>>;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
tables: z.ZodArray<z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
description: z.ZodOptional<z.ZodString>;
|
|
40
|
+
primaryFieldId: z.ZodOptional<z.ZodString>;
|
|
41
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
42
|
+
id: z.ZodOptional<z.ZodString>;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
type: z.ZodString;
|
|
45
|
+
description: z.ZodOptional<z.ZodString>;
|
|
46
|
+
options: z.ZodOptional<z.ZodUnknown>;
|
|
47
|
+
}, z.core.$loose>>;
|
|
48
|
+
views: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
type: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$loose>>>;
|
|
53
|
+
}, z.core.$loose>>;
|
|
54
|
+
}, z.core.$loose>, object, {
|
|
55
|
+
request: <T>({ method, path, query, body, signal, baseUrl, }: {
|
|
56
|
+
method?: string;
|
|
57
|
+
path: string;
|
|
58
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
59
|
+
body?: unknown;
|
|
60
|
+
signal?: AbortSignal;
|
|
61
|
+
baseUrl?: string;
|
|
62
|
+
}) => Promise<T>;
|
|
63
|
+
listAll: <T>({ path, key, query, signal, }: {
|
|
64
|
+
path: string;
|
|
65
|
+
key: string;
|
|
66
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
67
|
+
signal?: AbortSignal;
|
|
68
|
+
}) => Promise<T[]>;
|
|
69
|
+
}> & {
|
|
70
|
+
slug: "createBase";
|
|
71
|
+
};
|
|
72
|
+
export declare const createTable: import("frogbot").PieceActionDefinition<z.ZodObject<{
|
|
73
|
+
baseId: z.ZodString;
|
|
74
|
+
name: z.ZodString;
|
|
75
|
+
description: z.ZodOptional<z.ZodString>;
|
|
76
|
+
fields: z.ZodTuple<[z.ZodObject<{
|
|
77
|
+
type: z.ZodString;
|
|
78
|
+
description: z.ZodOptional<z.ZodString>;
|
|
79
|
+
options: z.ZodOptional<z.ZodUnknown>;
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
}, z.core.$loose>], z.ZodObject<{
|
|
82
|
+
type: z.ZodString;
|
|
83
|
+
description: z.ZodOptional<z.ZodString>;
|
|
84
|
+
options: z.ZodOptional<z.ZodUnknown>;
|
|
85
|
+
name: z.ZodString;
|
|
86
|
+
}, z.core.$loose>>;
|
|
87
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
description: z.ZodOptional<z.ZodString>;
|
|
91
|
+
primaryFieldId: z.ZodOptional<z.ZodString>;
|
|
92
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
93
|
+
id: z.ZodOptional<z.ZodString>;
|
|
94
|
+
name: z.ZodString;
|
|
95
|
+
type: z.ZodString;
|
|
96
|
+
description: z.ZodOptional<z.ZodString>;
|
|
97
|
+
options: z.ZodOptional<z.ZodUnknown>;
|
|
98
|
+
}, z.core.$loose>>;
|
|
99
|
+
views: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
100
|
+
id: z.ZodString;
|
|
101
|
+
name: z.ZodString;
|
|
102
|
+
type: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$loose>>>;
|
|
104
|
+
}, z.core.$loose>, object, {
|
|
105
|
+
request: <T>({ method, path, query, body, signal, baseUrl, }: {
|
|
106
|
+
method?: string;
|
|
107
|
+
path: string;
|
|
108
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
109
|
+
body?: unknown;
|
|
110
|
+
signal?: AbortSignal;
|
|
111
|
+
baseUrl?: string;
|
|
112
|
+
}) => Promise<T>;
|
|
113
|
+
listAll: <T>({ path, key, query, signal, }: {
|
|
114
|
+
path: string;
|
|
115
|
+
key: string;
|
|
116
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
117
|
+
signal?: AbortSignal;
|
|
118
|
+
}) => Promise<T[]>;
|
|
119
|
+
}> & {
|
|
120
|
+
slug: "createTable";
|
|
121
|
+
};
|
|
122
|
+
export declare const findBases: import("frogbot").PieceActionDefinition<z.ZodObject<{
|
|
123
|
+
name: z.ZodString;
|
|
124
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
125
|
+
id: z.ZodString;
|
|
126
|
+
name: z.ZodString;
|
|
127
|
+
permissionLevel: z.ZodOptional<z.ZodString>;
|
|
128
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
129
|
+
}, z.core.$loose>>, object, {
|
|
130
|
+
request: <T>({ method, path, query, body, signal, baseUrl, }: {
|
|
131
|
+
method?: string;
|
|
132
|
+
path: string;
|
|
133
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
134
|
+
body?: unknown;
|
|
135
|
+
signal?: AbortSignal;
|
|
136
|
+
baseUrl?: string;
|
|
137
|
+
}) => Promise<T>;
|
|
138
|
+
listAll: <T>({ path, key, query, signal, }: {
|
|
139
|
+
path: string;
|
|
140
|
+
key: string;
|
|
141
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
142
|
+
signal?: AbortSignal;
|
|
143
|
+
}) => Promise<T[]>;
|
|
144
|
+
}> & {
|
|
145
|
+
slug: "findBases";
|
|
146
|
+
};
|
|
147
|
+
export declare const getBaseSchema: import("frogbot").PieceActionDefinition<z.ZodObject<{
|
|
148
|
+
baseId: z.ZodString;
|
|
149
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
150
|
+
id: z.ZodString;
|
|
151
|
+
name: z.ZodString;
|
|
152
|
+
description: z.ZodOptional<z.ZodString>;
|
|
153
|
+
primaryFieldId: z.ZodOptional<z.ZodString>;
|
|
154
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
155
|
+
id: z.ZodOptional<z.ZodString>;
|
|
156
|
+
name: z.ZodString;
|
|
157
|
+
type: z.ZodString;
|
|
158
|
+
description: z.ZodOptional<z.ZodString>;
|
|
159
|
+
options: z.ZodOptional<z.ZodUnknown>;
|
|
160
|
+
}, z.core.$loose>>;
|
|
161
|
+
views: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
162
|
+
id: z.ZodString;
|
|
163
|
+
name: z.ZodString;
|
|
164
|
+
type: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$loose>>>;
|
|
166
|
+
}, z.core.$loose>>, object, {
|
|
167
|
+
request: <T>({ method, path, query, body, signal, baseUrl, }: {
|
|
168
|
+
method?: string;
|
|
169
|
+
path: string;
|
|
170
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
171
|
+
body?: unknown;
|
|
172
|
+
signal?: AbortSignal;
|
|
173
|
+
baseUrl?: string;
|
|
174
|
+
}) => Promise<T>;
|
|
175
|
+
listAll: <T>({ path, key, query, signal, }: {
|
|
176
|
+
path: string;
|
|
177
|
+
key: string;
|
|
178
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
179
|
+
signal?: AbortSignal;
|
|
180
|
+
}) => Promise<T[]>;
|
|
181
|
+
}> & {
|
|
182
|
+
slug: "getBaseSchema";
|
|
183
|
+
};
|
|
184
|
+
export declare const getTable: import("frogbot").PieceActionDefinition<z.ZodObject<{
|
|
185
|
+
baseId: z.ZodString;
|
|
186
|
+
tableId: z.ZodString;
|
|
187
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
188
|
+
id: z.ZodString;
|
|
189
|
+
name: z.ZodString;
|
|
190
|
+
description: z.ZodOptional<z.ZodString>;
|
|
191
|
+
primaryFieldId: z.ZodOptional<z.ZodString>;
|
|
192
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
193
|
+
id: z.ZodOptional<z.ZodString>;
|
|
194
|
+
name: z.ZodString;
|
|
195
|
+
type: z.ZodString;
|
|
196
|
+
description: z.ZodOptional<z.ZodString>;
|
|
197
|
+
options: z.ZodOptional<z.ZodUnknown>;
|
|
198
|
+
}, z.core.$loose>>;
|
|
199
|
+
views: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
200
|
+
id: z.ZodString;
|
|
201
|
+
name: z.ZodString;
|
|
202
|
+
type: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$loose>>>;
|
|
204
|
+
}, z.core.$loose>, object, {
|
|
205
|
+
request: <T>({ method, path, query, body, signal, baseUrl, }: {
|
|
206
|
+
method?: string;
|
|
207
|
+
path: string;
|
|
208
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
209
|
+
body?: unknown;
|
|
210
|
+
signal?: AbortSignal;
|
|
211
|
+
baseUrl?: string;
|
|
212
|
+
}) => Promise<T>;
|
|
213
|
+
listAll: <T>({ path, key, query, signal, }: {
|
|
214
|
+
path: string;
|
|
215
|
+
key: string;
|
|
216
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
217
|
+
signal?: AbortSignal;
|
|
218
|
+
}) => Promise<T[]>;
|
|
219
|
+
}> & {
|
|
220
|
+
slug: "getTable";
|
|
221
|
+
};
|
|
222
|
+
export declare const findTable: import("frogbot").PieceActionDefinition<z.ZodObject<{
|
|
223
|
+
baseId: z.ZodString;
|
|
224
|
+
name: z.ZodString;
|
|
225
|
+
}, z.core.$strip>, z.ZodNullable<z.ZodObject<{
|
|
226
|
+
id: z.ZodString;
|
|
227
|
+
name: z.ZodString;
|
|
228
|
+
description: z.ZodOptional<z.ZodString>;
|
|
229
|
+
primaryFieldId: z.ZodOptional<z.ZodString>;
|
|
230
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
231
|
+
id: z.ZodOptional<z.ZodString>;
|
|
232
|
+
name: z.ZodString;
|
|
233
|
+
type: z.ZodString;
|
|
234
|
+
description: z.ZodOptional<z.ZodString>;
|
|
235
|
+
options: z.ZodOptional<z.ZodUnknown>;
|
|
236
|
+
}, z.core.$loose>>;
|
|
237
|
+
views: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
238
|
+
id: z.ZodString;
|
|
239
|
+
name: z.ZodString;
|
|
240
|
+
type: z.ZodOptional<z.ZodString>;
|
|
241
|
+
}, z.core.$loose>>>;
|
|
242
|
+
}, z.core.$loose>>, object, {
|
|
243
|
+
request: <T>({ method, path, query, body, signal, baseUrl, }: {
|
|
244
|
+
method?: string;
|
|
245
|
+
path: string;
|
|
246
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
247
|
+
body?: unknown;
|
|
248
|
+
signal?: AbortSignal;
|
|
249
|
+
baseUrl?: string;
|
|
250
|
+
}) => Promise<T>;
|
|
251
|
+
listAll: <T>({ path, key, query, signal, }: {
|
|
252
|
+
path: string;
|
|
253
|
+
key: string;
|
|
254
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
255
|
+
signal?: AbortSignal;
|
|
256
|
+
}) => Promise<T[]>;
|
|
257
|
+
}> & {
|
|
258
|
+
slug: "findTable";
|
|
259
|
+
};
|
|
260
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/actions/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAVO,CAAC;;aACD,CAAC;YAGd,CAAC;cACd,CAAC;eAA0B,CAAC;;;;;aAiCG,CAAC;cACd,CAAC;;;;CAZrB,CAAC;AASH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cApCM,CAAC;;aACD,CAAC;YAGd,CAAC;cACd,CAAC;eAA0B,CAAC;;;;;aAiCG,CAAC;cACd,CAAC;;;;CAiBrB,CAAC;AAMH,eAAO,MAAM,SAAS;;;;;;;;;cA9DQ,CAAC;;aACD,CAAC;YAGd,CAAC;cACd,CAAC;eAA0B,CAAC;;;;;aAiCG,CAAC;cACd,CAAC;;;;CA0CrB,CAAC;AAIH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;cArFI,CAAC;;aACD,CAAC;YAGd,CAAC;cACd,CAAC;eAA0B,CAAC;;;;;aAiCG,CAAC;cACd,CAAC;;;;CA+DrB,CAAC;AAIH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;cA1GS,CAAC;;aACD,CAAC;YAGd,CAAC;cACd,CAAC;eAA0B,CAAC;;;;;aAiCG,CAAC;cACd,CAAC;;;;CAyFrB,CAAC;AAMH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;cAtIQ,CAAC;;aACD,CAAC;YAGd,CAAC;cACd,CAAC;eAA0B,CAAC;;;;;aAiCG,CAAC;cACd,CAAC;;;;CAkHrB,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineAirtableAction } from '../definitions.js';
|
|
3
|
+
import { baseOptions, tableOptions } from '../options.js';
|
|
4
|
+
import { baseSchema, fieldSchema, tableSchema } from '../schemas.js';
|
|
5
|
+
const fieldConfig = fieldSchema.omit({ id: true });
|
|
6
|
+
const tableConfig = z.object({
|
|
7
|
+
name: z.string().min(1),
|
|
8
|
+
description: z.string().optional(),
|
|
9
|
+
fields: z.tuple([fieldConfig], fieldConfig),
|
|
10
|
+
});
|
|
11
|
+
const createBaseInput = z.object({
|
|
12
|
+
workspaceId: z.string().min(1).meta({ label: 'Workspace ID' }),
|
|
13
|
+
name: z.string().min(1).meta({ label: 'Base name' }),
|
|
14
|
+
tables: z.tuple([tableConfig], tableConfig).meta({ label: 'Tables' }),
|
|
15
|
+
});
|
|
16
|
+
export const createBase = defineAirtableAction({
|
|
17
|
+
slug: 'createBase',
|
|
18
|
+
description: 'Create a base with its initial table structure.',
|
|
19
|
+
input: createBaseInput,
|
|
20
|
+
output: z.object({ id: z.string(), tables: z.array(tableSchema) }).passthrough(),
|
|
21
|
+
async run({ client, input, req, }) {
|
|
22
|
+
return client.request({
|
|
23
|
+
method: 'POST',
|
|
24
|
+
path: '/meta/bases',
|
|
25
|
+
body: input,
|
|
26
|
+
signal: req.signal ?? undefined,
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const createTableInput = z.object({
|
|
31
|
+
baseId: z.string().min(1).meta({ label: 'Base' }),
|
|
32
|
+
name: z.string().min(1).meta({ label: 'Table name' }),
|
|
33
|
+
description: z.string().optional().meta({ label: 'Description' }),
|
|
34
|
+
fields: z.tuple([fieldConfig], fieldConfig).meta({ label: 'Fields' }),
|
|
35
|
+
});
|
|
36
|
+
export const createTable = defineAirtableAction({
|
|
37
|
+
slug: 'createTable',
|
|
38
|
+
description: 'Create a table in an existing base.',
|
|
39
|
+
input: createTableInput,
|
|
40
|
+
output: tableSchema,
|
|
41
|
+
options: { baseId: baseOptions },
|
|
42
|
+
async run({ client, input, req, }) {
|
|
43
|
+
const { baseId, ...body } = input;
|
|
44
|
+
return client.request({
|
|
45
|
+
method: 'POST',
|
|
46
|
+
path: `/meta/bases/${baseId}/tables`,
|
|
47
|
+
body,
|
|
48
|
+
signal: req.signal ?? undefined,
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
const findBasesInput = z.object({
|
|
53
|
+
name: z.string().min(1).meta({ label: 'Base name or keyword' }),
|
|
54
|
+
});
|
|
55
|
+
export const findBases = defineAirtableAction({
|
|
56
|
+
slug: 'findBases',
|
|
57
|
+
description: 'Find bases whose names contain a keyword.',
|
|
58
|
+
input: findBasesInput,
|
|
59
|
+
output: z.array(baseSchema),
|
|
60
|
+
async run({ client, input, req, }) {
|
|
61
|
+
const bases = await client.listAll({
|
|
62
|
+
path: '/meta/bases',
|
|
63
|
+
key: 'bases',
|
|
64
|
+
signal: req.signal ?? undefined,
|
|
65
|
+
});
|
|
66
|
+
const term = input.name.toLowerCase();
|
|
67
|
+
return bases.filter(({ name }) => name.toLowerCase().includes(term));
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
const baseInput = z.object({ baseId: z.string().min(1).meta({ label: 'Base' }) });
|
|
71
|
+
export const getBaseSchema = defineAirtableAction({
|
|
72
|
+
slug: 'getBaseSchema',
|
|
73
|
+
description: 'Get all tables and fields in a base.',
|
|
74
|
+
input: baseInput,
|
|
75
|
+
output: z.array(tableSchema),
|
|
76
|
+
options: { baseId: baseOptions },
|
|
77
|
+
async run({ client, input, req, }) {
|
|
78
|
+
return client.listAll({
|
|
79
|
+
path: `/meta/bases/${input.baseId}/tables`,
|
|
80
|
+
key: 'tables',
|
|
81
|
+
signal: req.signal ?? undefined,
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
const getTableInput = baseInput.extend({ tableId: z.string().min(1).meta({ label: 'Table' }) });
|
|
86
|
+
export const getTable = defineAirtableAction({
|
|
87
|
+
slug: 'getTable',
|
|
88
|
+
description: 'Get one table and its schema by ID.',
|
|
89
|
+
input: getTableInput,
|
|
90
|
+
output: tableSchema,
|
|
91
|
+
options: { baseId: baseOptions, tableId: tableOptions },
|
|
92
|
+
async run({ client, input, req, }) {
|
|
93
|
+
const tables = await client.listAll({
|
|
94
|
+
path: `/meta/bases/${input.baseId}/tables`,
|
|
95
|
+
key: 'tables',
|
|
96
|
+
signal: req.signal ?? undefined,
|
|
97
|
+
});
|
|
98
|
+
const selected = tables.find(({ id }) => id === input.tableId);
|
|
99
|
+
if (!selected)
|
|
100
|
+
throw new Error(`Airtable table '${input.tableId}' was not found.`);
|
|
101
|
+
return selected;
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
const findTableInput = baseInput.extend({
|
|
105
|
+
name: z.string().min(1).meta({ label: 'Table name' }),
|
|
106
|
+
});
|
|
107
|
+
export const findTable = defineAirtableAction({
|
|
108
|
+
slug: 'findTable',
|
|
109
|
+
description: 'Find a table by its exact name.',
|
|
110
|
+
input: findTableInput,
|
|
111
|
+
output: tableSchema.nullable(),
|
|
112
|
+
options: { baseId: baseOptions },
|
|
113
|
+
async run({ client, input, req, }) {
|
|
114
|
+
const tables = await client.listAll({
|
|
115
|
+
path: `/meta/bases/${input.baseId}/tables`,
|
|
116
|
+
key: 'tables',
|
|
117
|
+
signal: req.signal ?? undefined,
|
|
118
|
+
});
|
|
119
|
+
return tables.find(({ name }) => name.toLowerCase() === input.name.toLowerCase()) ?? null;
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/actions/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAErE,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACnD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC5C,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;IAC9D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IACpD,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,C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ChC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,IAAI,CAAC;IAC5F,CAAC;CACF,CAAC,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type QueryValue = boolean | number | string | undefined;
|
|
2
|
+
export type AirtableClient = ReturnType<typeof createAirtableClient>;
|
|
3
|
+
export declare function createAirtableClient({ auth }: {
|
|
4
|
+
auth: unknown;
|
|
5
|
+
}): {
|
|
6
|
+
request: <T>({ method, path, query, body, signal, baseUrl, }: {
|
|
7
|
+
method?: string;
|
|
8
|
+
path: string;
|
|
9
|
+
query?: Record<string, QueryValue>;
|
|
10
|
+
body?: unknown;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
}) => Promise<T>;
|
|
14
|
+
listAll: <T>({ path, key, query, signal, }: {
|
|
15
|
+
path: string;
|
|
16
|
+
key: string;
|
|
17
|
+
query?: Record<string, QueryValue>;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}) => Promise<T[]>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAErE,wBAAgB,oBAAoB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE;cAGvC,CAAC,mDAOrB;QACD,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAG,OAAO,CAAC,CAAC,CAAC;cAgCS,CAAC,iCAKrB;QACD,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACnC,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,KAAG,OAAO,CAAC,CAAC,EAAE,CAAC;EAmBjB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { airtableAuth } from './config.js';
|
|
2
|
+
export function createAirtableClient({ auth }) {
|
|
3
|
+
const { personalAccessToken } = airtableAuth.parse(auth);
|
|
4
|
+
async function request({ method = 'GET', path, query, body, signal, baseUrl = 'https://api.airtable.com/v0', }) {
|
|
5
|
+
if (!path.startsWith('/') || path.split('/').includes('..')) {
|
|
6
|
+
throw new Error('Airtable request path must be API-relative without parent segments.');
|
|
7
|
+
}
|
|
8
|
+
const url = new URL(`${baseUrl}${path.startsWith('/') ? path : `/${path}`}`);
|
|
9
|
+
Object.entries(query ?? {}).forEach(([key, value]) => {
|
|
10
|
+
if (value !== undefined)
|
|
11
|
+
url.searchParams.set(key, String(value));
|
|
12
|
+
});
|
|
13
|
+
const response = await fetch(url, {
|
|
14
|
+
method,
|
|
15
|
+
headers: {
|
|
16
|
+
authorization: `Bearer ${personalAccessToken}`,
|
|
17
|
+
...(body === undefined ? {} : { 'content-type': 'application/json' }),
|
|
18
|
+
},
|
|
19
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
20
|
+
signal,
|
|
21
|
+
});
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
const detail = await response.text();
|
|
24
|
+
throw new Error(`Airtable request failed (${response.status}): ${detail || response.statusText}`);
|
|
25
|
+
}
|
|
26
|
+
return (await response.json());
|
|
27
|
+
}
|
|
28
|
+
async function listAll({ path, key, query, signal, }) {
|
|
29
|
+
const values = [];
|
|
30
|
+
let offset;
|
|
31
|
+
do {
|
|
32
|
+
const page = await request({
|
|
33
|
+
path,
|
|
34
|
+
query: { ...query, offset },
|
|
35
|
+
signal,
|
|
36
|
+
});
|
|
37
|
+
values.push(...(page[key] ?? []));
|
|
38
|
+
offset = typeof page.offset === 'string' ? page.offset : undefined;
|
|
39
|
+
} while (offset);
|
|
40
|
+
return values;
|
|
41
|
+
}
|
|
42
|
+
return { request, listAll };
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,MAAM,UAAU,oBAAoB,CAAC,EAAE,IAAI,EAAqB;IAC9D,MAAM,EAAE,mBAAmB,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEzD,KAAK,UAAU,OAAO,CAAI,EACxB,MAAM,GAAG,KAAK,EACd,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,MAAM,EACN,OAAO,GAAG,6BAA6B,GAQxC;QACC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;QACzF,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI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AAI;gBACJ,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE;gBAC3B,MAAM;aACP,CAAC,CAAC;YAEH,MAAM,CAAC,IAAI,CAAC,GAAG,CAAE,IAAI,CAAC,GAAG,CAAqB,IAAI,EAAE,CAAC,CAAC,CAAC;YACvD,MAAM,GAAG,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;QACrE,CAAC,QAAQ,MAAM,EAAE;QAEjB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY;;iBAEvB,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;CAC9F,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { PieceActionDefinition, PiecePollingTrigger } from 'frogbot/pieces';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { AirtableClient } from './client.js';
|
|
4
|
+
export declare function defineAirtableAction<const TSlug extends string, TInput extends z.ZodType, TOutput extends z.ZodType | undefined>(definition: PieceActionDefinition<TInput, TOutput, object, AirtableClient> & {
|
|
5
|
+
slug: TSlug;
|
|
6
|
+
}): PieceActionDefinition<TInput, TOutput, object, {
|
|
7
|
+
request: <T>({ method, path, query, body, signal, baseUrl, }: {
|
|
8
|
+
method?: string;
|
|
9
|
+
path: string;
|
|
10
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
11
|
+
body?: unknown;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
}) => Promise<T>;
|
|
15
|
+
listAll: <T>({ path, key, query, signal, }: {
|
|
16
|
+
path: string;
|
|
17
|
+
key: string;
|
|
18
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}) => Promise<T[]>;
|
|
21
|
+
}> & {
|
|
22
|
+
slug: TSlug;
|
|
23
|
+
};
|
|
24
|
+
export declare function defineAirtablePollingTrigger<const TSlug extends string, TInput extends z.ZodType, TOutput extends z.ZodType | undefined, const TSample extends (TOutput extends z.ZodType ? z.output<TOutput> : never)>(definition: Omit<PiecePollingTrigger<TInput, TOutput, object, AirtableClient, number>, 'sample' | 'slug'> & {
|
|
25
|
+
sample: TSample;
|
|
26
|
+
slug: TSlug;
|
|
27
|
+
}): Omit<PiecePollingTrigger<TInput, TOutput, object, {
|
|
28
|
+
request: <T>({ method, path, query, body, signal, baseUrl, }: {
|
|
29
|
+
method?: string;
|
|
30
|
+
path: string;
|
|
31
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
32
|
+
body?: unknown;
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
baseUrl?: string;
|
|
35
|
+
}) => Promise<T>;
|
|
36
|
+
listAll: <T>({ path, key, query, signal, }: {
|
|
37
|
+
path: string;
|
|
38
|
+
key: string;
|
|
39
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
40
|
+
signal?: AbortSignal;
|
|
41
|
+
}) => Promise<T[]>;
|
|
42
|
+
}, number>, "sample" | "slug"> & {
|
|
43
|
+
sample: TSample;
|
|
44
|
+
slug: TSlug;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../src/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAgB,oBAAoB,CAClC,KAAK,CAAC,KAAK,SAAS,MAAM,EAC1B,MAAM,SAAS,CAAC,CAAC,OAAO,EACxB,OAAO,SAAS,CAAC,CAAC,OAAO,GAAG,SAAS,EACrC,UAAU,EAAE,qBAAqB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE;;cAI5D,CAAC;;aACT,CAAC;YAEpB,CAAC;cAAsB,CAAA;eACd,CAAA;;;;;aAYgzB,CAAC;cAAwC,CAAC;;;UApBnxB,KAAK;EAE3F;AAED,wBAAgB,4BAA4B,CAC1C,KAAK,CAAC,KAAK,SAAS,MAAM,EAC1B,MAAM,SAAS,CAAC,CAAC,OAAO,EACxB,OAAO,SAAS,CAAC,CAAC,OAAO,GAAG,SAAS,EACrC,KAAK,CAAC,OAAO,SAAS,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,EAE7E,UAAU,EAAE,IAAI,CACd,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,EACpE,QAAQ,GAAG,MAAM,CAClB,GAAG;IACF,MAA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