@frogbotai/piece-airtable 0.28.0 → 0.30.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/dist/actions/customApiCall.js +18 -10
- package/dist/actions/customApiCall.js.map +1 -1
- package/dist/actions/records.d.ts.map +1 -1
- package/dist/actions/records.js +123 -73
- package/dist/actions/records.js.map +1 -1
- package/dist/actions/schema.d.ts +6 -6
- package/dist/actions/schema.js +87 -41
- package/dist/actions/schema.js.map +1 -1
- package/dist/client.js +21 -13
- package/dist/client.js.map +1 -1
- package/dist/config.js +5 -1
- package/dist/config.js.map +1 -1
- package/dist/define.js +1 -0
- package/dist/define.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/options.js +31 -16
- package/dist/options.js.map +1 -1
- package/dist/piece-types.js +2 -1
- package/dist/piece-types.js.map +1 -1
- package/dist/schemas.js +26 -29
- package/dist/schemas.js.map +1 -1
- package/dist/triggers/records.js +47 -19
- package/dist/triggers/records.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { defineAction } from '../define.js';
|
|
3
3
|
const inputSchema = z.object({
|
|
4
|
-
method: z.enum([
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
method: z.enum([
|
|
5
|
+
'GET',
|
|
6
|
+
'POST',
|
|
7
|
+
'PUT',
|
|
8
|
+
'PATCH',
|
|
9
|
+
'DELETE'
|
|
10
|
+
]),
|
|
11
|
+
path: z.string().startsWith('/').refine((path)=>!path.split('/').includes('..'), 'Path cannot contain parent segments.'),
|
|
12
|
+
query: z.record(z.string(), z.union([
|
|
13
|
+
z.string(),
|
|
14
|
+
z.number(),
|
|
15
|
+
z.boolean()
|
|
16
|
+
])).optional(),
|
|
17
|
+
body: z.unknown().optional()
|
|
11
18
|
});
|
|
12
19
|
export const customApiCall = defineAction({
|
|
13
20
|
slug: 'customApiCall',
|
|
14
21
|
description: 'Call an Airtable API endpoint with the configured credential.',
|
|
15
22
|
input: inputSchema,
|
|
16
23
|
output: z.unknown(),
|
|
17
|
-
async run({ client, input, req }) {
|
|
24
|
+
async run ({ client, input, req }) {
|
|
18
25
|
return client.request({
|
|
19
26
|
method: input.method,
|
|
20
27
|
path: input.path,
|
|
21
28
|
query: input.query,
|
|
22
29
|
body: input.body,
|
|
23
|
-
signal: req.signal ?? undefined
|
|
30
|
+
signal: req.signal ?? undefined
|
|
24
31
|
});
|
|
25
|
-
}
|
|
32
|
+
}
|
|
26
33
|
});
|
|
34
|
+
|
|
27
35
|
//# sourceMappingURL=customApiCall.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/actions/customApiCall.ts"],"names":["z","defineAction","inputSchema","object","method","enum","path","string","startsWith","refine","split","includes","query","record","union","number","boolean","optional","body","unknown","customApiCall","slug","description","input","output","run","client","req","request","signal","undefined"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,SAASC,YAAY,QAAQ,eAAe;AAE5C,MAAMC,cAAcF,EAAEG,MAAM,CAAC;IAC3BC,QAAQJ,EAAEK,IAAI,CAAC;QAAC;QAAO;QAAQ;QAAO;QAAS;KAAS;IACxDC,MAAMN,EACHO,MAAM,GACNC,UAAU,CAAC,KACXC,MAAM,CAAC,CAACH,OAAS,CAACA,KAAKI,KAAK,CAAC,KAAKC,QAAQ,CAAC,OAAO;IACrDC,OAAOZ,EAAEa,MAAM,CAACb,EAAEO,MAAM,IAAIP,EAAEc,KAAK,CAAC;QAACd,EAAEO,MAAM;QAAIP,EAAEe,MAAM;QAAIf,EAAEgB,OAAO;KAAG,GAAGC,QAAQ;IACpFC,MAAMlB,EAAEmB,OAAO,GAAGF,QAAQ;AAC5B;AAEA,OAAO,MAAMG,gBAAgBnB,aAAa;IACxCoB,MAAM;IACNC,aAAa;IACbC,OAAOrB;IACPsB,QAAQxB,EAAEmB,OAAO;IACjB,MAAMM,KAAI,EAAEC,MAAM,EAAEH,KAAK,EAAEI,GAAG,EAAE;QAC9B,OAAOD,OAAOE,OAAO,CAAC;YACpBxB,QAAQmB,MAAMnB,MAAM;YACpBE,MAAMiB,MAAMjB,IAAI;YAChBM,OAAOW,MAAMX,KAAK;YAClBM,MAAMK,MAAML,IAAI;YAChBW,QAAQF,IAAIE,MAAM,IAAIC;QACxB;IACF;AACF,GAAG","file":"customApiCall.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/actions/records.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiCxB,eAAO,MAAM,YAAY;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/actions/records.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiCxB,eAAO,MAAM,YAAY;;;;;;;;;;cApBnB,CAAC;;aACM,CAAC;YACgB,CAAC;cAC7B,CAAC;eACsB,CAAC;;;;;aAoCvB,CAAC;cAAwC,CAAC;;;;;;;;;CAN3C,CAAC;AASH,eAAO,MAAM,WAAW;;;;;;;;;;;;cA3ClB,CAAC;;aACM,CAAC;YACgB,CAAC;cAC7B,CAAC;eACsB,CAAC;;;;;aAoCvB,CAAC;cAAwC,CAAC;;;;;;;;;CAyB3C,CAAC;AA+BH,eAAO,MAAM,YAAY;;;;;;;;;;;cAhGnB,CAAC;;aACM,CAAC;YACgB,CAAC;cAC7B,CAAC;eACsB,CAAC;;;;;aAoCvB,CAAC;cAAwC,CAAC;;;;;;;;;CAiE3C,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;cA3GlB,CAAC;;aACM,CAAC;YACgB,CAAC;cAC7B,CAAC;eACsB,CAAC;;;;;aAoCvB,CAAC;cAAwC,CAAC;;;;;;;;;CA4E3C,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;cAtHnB,CAAC;;aACM,CAAC;YACgB,CAAC;cAC7B,CAAC;eACsB,CAAC;;;;;aAoCvB,CAAC;cAAwC,CAAC;;;;;;;;CA2F3C,CAAC;AAIH,eAAO,MAAM,SAAS;;;;;;;;;;cAvIhB,CAAC;;aACM,CAAC;YACgB,CAAC;cAC7B,CAAC;eACsB,CAAC;;;;;aAoCvB,CAAC;cAAwC,CAAC;;;;;;;;;CA2G3C,CAAC;AAOH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;cA1JvB,CAAC;;aACM,CAAC;YACgB,CAAC;cAC7B,CAAC;eACsB,CAAC;;;;;aAoCvB,CAAC;cAAwC,CAAC;;;;;;;;;;;CAgI3C,CAAC;AAwDH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;cAhOvB,CAAC;;aACM,CAAC;YACgB,CAAC;cAC7B,CAAC;eACsB,CAAC;;;;;aAoCvB,CAAC;cAAwC,CAAC;;;;;;;;;CAgN3C,CAAC"}
|
package/dist/actions/records.js
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
|
+
import { filesCollectionSlug } from 'frogbot/pieces';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { defineAction } from '../define.js';
|
|
3
|
-
import { attachmentOptions, baseOptions, fieldOptions, tableOptions, viewOptions
|
|
4
|
+
import { attachmentOptions, baseOptions, fieldOptions, tableOptions, viewOptions } from '../options.js';
|
|
4
5
|
import { commentSchema, fieldsSchema, recordSchema, selectionSchema } from '../schemas.js';
|
|
5
6
|
const recordInput = z.object({
|
|
6
7
|
...selectionSchema,
|
|
7
|
-
fields: fieldsSchema.meta({
|
|
8
|
+
fields: fieldsSchema.meta({
|
|
9
|
+
label: 'Fields'
|
|
10
|
+
})
|
|
8
11
|
});
|
|
9
12
|
const identifiedRecordInput = z.object({
|
|
10
13
|
...selectionSchema,
|
|
11
|
-
recordId: z.string().min(1).meta({
|
|
14
|
+
recordId: z.string().min(1).meta({
|
|
15
|
+
label: 'Record ID'
|
|
16
|
+
})
|
|
12
17
|
});
|
|
13
|
-
const recordsOptions = {
|
|
18
|
+
const recordsOptions = {
|
|
19
|
+
baseId: baseOptions,
|
|
20
|
+
tableId: tableOptions
|
|
21
|
+
};
|
|
14
22
|
function removeEmpty(fields) {
|
|
15
|
-
return Object.fromEntries(Object.entries(fields).filter(([, value])
|
|
16
|
-
if (value === null || value === undefined || value === '')
|
|
17
|
-
return false;
|
|
23
|
+
return Object.fromEntries(Object.entries(fields).filter(([, value])=>{
|
|
24
|
+
if (value === null || value === undefined || value === '') return false;
|
|
18
25
|
return !Array.isArray(value) || value.length > 0;
|
|
19
26
|
}));
|
|
20
27
|
}
|
|
@@ -24,20 +31,29 @@ export const createRecord = defineAction({
|
|
|
24
31
|
input: recordInput,
|
|
25
32
|
output: recordSchema,
|
|
26
33
|
options: recordsOptions,
|
|
27
|
-
async run({ client, input, req }) {
|
|
34
|
+
async run ({ client, input, req }) {
|
|
28
35
|
return client.request({
|
|
29
36
|
method: 'POST',
|
|
30
37
|
path: `/${input.baseId}/${input.tableId}`,
|
|
31
|
-
body: {
|
|
32
|
-
|
|
38
|
+
body: {
|
|
39
|
+
fields: removeEmpty(input.fields),
|
|
40
|
+
typecast: true
|
|
41
|
+
},
|
|
42
|
+
signal: req.signal ?? undefined
|
|
33
43
|
});
|
|
34
|
-
}
|
|
44
|
+
}
|
|
35
45
|
});
|
|
36
46
|
const findRecordsInput = z.object({
|
|
37
47
|
...selectionSchema,
|
|
38
|
-
searchField: z.string().min(1).meta({
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
searchField: z.string().min(1).meta({
|
|
49
|
+
label: 'Search field'
|
|
50
|
+
}),
|
|
51
|
+
searchValue: z.string().meta({
|
|
52
|
+
label: 'Search value'
|
|
53
|
+
}),
|
|
54
|
+
viewId: z.string().optional().meta({
|
|
55
|
+
label: 'View'
|
|
56
|
+
})
|
|
41
57
|
});
|
|
42
58
|
export const findRecords = defineAction({
|
|
43
59
|
slug: 'findRecords',
|
|
@@ -47,35 +63,39 @@ export const findRecords = defineAction({
|
|
|
47
63
|
options: {
|
|
48
64
|
...recordsOptions,
|
|
49
65
|
searchField: fieldOptions,
|
|
50
|
-
viewId: viewOptions
|
|
66
|
+
viewId: viewOptions
|
|
51
67
|
},
|
|
52
|
-
async run({ client, input, req }) {
|
|
68
|
+
async run ({ client, input, req }) {
|
|
53
69
|
const page = await client.request({
|
|
54
70
|
path: `/${input.baseId}/${input.tableId}`,
|
|
55
71
|
query: {
|
|
56
72
|
filterByFormula: `FIND(${JSON.stringify(input.searchValue)},{${input.searchField}})`,
|
|
57
|
-
view: input.viewId
|
|
73
|
+
view: input.viewId
|
|
58
74
|
},
|
|
59
|
-
signal: req.signal ?? undefined
|
|
75
|
+
signal: req.signal ?? undefined
|
|
60
76
|
});
|
|
61
|
-
return z.object({
|
|
62
|
-
|
|
77
|
+
return z.object({
|
|
78
|
+
records: z.array(recordSchema)
|
|
79
|
+
}).parse(page).records;
|
|
80
|
+
}
|
|
63
81
|
});
|
|
64
82
|
const mutateRecordInput = identifiedRecordInput.extend({
|
|
65
|
-
fields: fieldsSchema.meta({
|
|
83
|
+
fields: fieldsSchema.meta({
|
|
84
|
+
label: 'Fields'
|
|
85
|
+
})
|
|
66
86
|
});
|
|
67
|
-
async function patchRecord({ client, input, req, clean
|
|
68
|
-
const fields = clean
|
|
69
|
-
? Object.fromEntries(Object.entries(input.fields).map(([key, value]) => [
|
|
87
|
+
async function patchRecord({ client, input, req, clean }) {
|
|
88
|
+
const fields = clean ? Object.fromEntries(Object.entries(input.fields).map(([key, value])=>[
|
|
70
89
|
key,
|
|
71
|
-
value === '' || value === undefined ? null : value
|
|
72
|
-
]))
|
|
73
|
-
: removeEmpty(input.fields);
|
|
90
|
+
value === '' || value === undefined ? null : value
|
|
91
|
+
])) : removeEmpty(input.fields);
|
|
74
92
|
const record = await client.request({
|
|
75
93
|
method: 'PATCH',
|
|
76
94
|
path: `/${input.baseId}/${input.tableId}/${input.recordId}`,
|
|
77
|
-
body: {
|
|
78
|
-
|
|
95
|
+
body: {
|
|
96
|
+
fields
|
|
97
|
+
},
|
|
98
|
+
signal: req.signal ?? undefined
|
|
79
99
|
});
|
|
80
100
|
return recordSchema.parse(record);
|
|
81
101
|
}
|
|
@@ -85,9 +105,12 @@ export const updateRecord = defineAction({
|
|
|
85
105
|
input: mutateRecordInput,
|
|
86
106
|
output: recordSchema,
|
|
87
107
|
options: recordsOptions,
|
|
88
|
-
async run(args) {
|
|
89
|
-
return patchRecord({
|
|
90
|
-
|
|
108
|
+
async run (args) {
|
|
109
|
+
return patchRecord({
|
|
110
|
+
...args,
|
|
111
|
+
clean: false
|
|
112
|
+
});
|
|
113
|
+
}
|
|
91
114
|
});
|
|
92
115
|
export const cleanRecord = defineAction({
|
|
93
116
|
slug: 'cleanRecord',
|
|
@@ -95,23 +118,29 @@ export const cleanRecord = defineAction({
|
|
|
95
118
|
input: mutateRecordInput,
|
|
96
119
|
output: recordSchema,
|
|
97
120
|
options: recordsOptions,
|
|
98
|
-
async run(args) {
|
|
99
|
-
return patchRecord({
|
|
100
|
-
|
|
121
|
+
async run (args) {
|
|
122
|
+
return patchRecord({
|
|
123
|
+
...args,
|
|
124
|
+
clean: true
|
|
125
|
+
});
|
|
126
|
+
}
|
|
101
127
|
});
|
|
102
128
|
export const deleteRecord = defineAction({
|
|
103
129
|
slug: 'deleteRecord',
|
|
104
130
|
description: 'Delete a record from a table.',
|
|
105
131
|
input: identifiedRecordInput,
|
|
106
|
-
output: z.object({
|
|
132
|
+
output: z.object({
|
|
133
|
+
id: z.string(),
|
|
134
|
+
deleted: z.boolean()
|
|
135
|
+
}).passthrough(),
|
|
107
136
|
options: recordsOptions,
|
|
108
|
-
async run({ client, input, req }) {
|
|
137
|
+
async run ({ client, input, req }) {
|
|
109
138
|
return client.request({
|
|
110
139
|
method: 'DELETE',
|
|
111
140
|
path: `/${input.baseId}/${input.tableId}/${input.recordId}`,
|
|
112
|
-
signal: req.signal ?? undefined
|
|
141
|
+
signal: req.signal ?? undefined
|
|
113
142
|
});
|
|
114
|
-
}
|
|
143
|
+
}
|
|
115
144
|
});
|
|
116
145
|
const getRecordInput = identifiedRecordInput;
|
|
117
146
|
export const getRecord = defineAction({
|
|
@@ -120,16 +149,20 @@ export const getRecord = defineAction({
|
|
|
120
149
|
input: getRecordInput,
|
|
121
150
|
output: recordSchema,
|
|
122
151
|
options: recordsOptions,
|
|
123
|
-
async run({ client, input, req }) {
|
|
152
|
+
async run ({ client, input, req }) {
|
|
124
153
|
return client.request({
|
|
125
154
|
path: `/${input.baseId}/${input.tableId}/${input.recordId}`,
|
|
126
|
-
signal: req.signal ?? undefined
|
|
155
|
+
signal: req.signal ?? undefined
|
|
127
156
|
});
|
|
128
|
-
}
|
|
157
|
+
}
|
|
129
158
|
});
|
|
130
159
|
const commentInput = identifiedRecordInput.extend({
|
|
131
|
-
text: z.string().min(1).meta({
|
|
132
|
-
|
|
160
|
+
text: z.string().min(1).meta({
|
|
161
|
+
label: 'Comment text'
|
|
162
|
+
}),
|
|
163
|
+
parentCommentId: z.string().optional().meta({
|
|
164
|
+
label: 'Parent comment ID'
|
|
165
|
+
})
|
|
133
166
|
});
|
|
134
167
|
export const addRecordComment = defineAction({
|
|
135
168
|
slug: 'addRecordComment',
|
|
@@ -137,61 +170,77 @@ export const addRecordComment = defineAction({
|
|
|
137
170
|
input: commentInput,
|
|
138
171
|
output: commentSchema,
|
|
139
172
|
options: recordsOptions,
|
|
140
|
-
async run({ client, input, req }) {
|
|
173
|
+
async run ({ client, input, req }) {
|
|
141
174
|
return client.request({
|
|
142
175
|
method: 'POST',
|
|
143
176
|
path: `/${input.baseId}/${input.tableId}/${input.recordId}/comments`,
|
|
144
|
-
body: {
|
|
145
|
-
|
|
177
|
+
body: {
|
|
178
|
+
text: input.text,
|
|
179
|
+
parentCommentId: input.parentCommentId
|
|
180
|
+
},
|
|
181
|
+
signal: req.signal ?? undefined
|
|
146
182
|
});
|
|
147
|
-
}
|
|
183
|
+
}
|
|
148
184
|
});
|
|
149
185
|
const uploadInput = z.object({
|
|
150
186
|
...selectionSchema,
|
|
151
|
-
recordId: z.string().min(1).meta({
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
187
|
+
recordId: z.string().min(1).meta({
|
|
188
|
+
label: 'Record ID'
|
|
189
|
+
}),
|
|
190
|
+
attachmentFieldId: z.string().min(1).meta({
|
|
191
|
+
label: 'Attachment field'
|
|
192
|
+
}),
|
|
193
|
+
fileId: z.union([
|
|
194
|
+
z.string(),
|
|
195
|
+
z.number()
|
|
196
|
+
]).meta({
|
|
197
|
+
label: 'File'
|
|
198
|
+
}),
|
|
199
|
+
contentType: z.string().min(1).meta({
|
|
200
|
+
label: 'File content type'
|
|
201
|
+
}),
|
|
202
|
+
filename: z.string().optional().meta({
|
|
203
|
+
label: 'File name'
|
|
204
|
+
})
|
|
156
205
|
});
|
|
157
206
|
async function loadFile(req, fileId) {
|
|
158
|
-
const collection = req
|
|
159
|
-
if (!collection) {
|
|
160
|
-
throw new Error('Airtable attachment uploads require a configured files collection.');
|
|
161
|
-
}
|
|
207
|
+
const collection = filesCollectionSlug(req, 'Airtable');
|
|
162
208
|
const doc = await req.frogbot.findByID({
|
|
163
209
|
collection,
|
|
164
210
|
id: fileId,
|
|
165
211
|
depth: 0,
|
|
166
212
|
req,
|
|
167
|
-
overrideAccess: false
|
|
213
|
+
overrideAccess: false
|
|
168
214
|
});
|
|
169
|
-
if (typeof doc.url !== 'string')
|
|
170
|
-
throw new Error(`File '${fileId}' is unavailable.`);
|
|
215
|
+
if (typeof doc.url !== 'string') throw new Error(`File '${fileId}' is unavailable.`);
|
|
171
216
|
const config = await req.frogbot.config._internal.payloadConfig;
|
|
172
217
|
const base = new URL(config.serverURL || req.url);
|
|
173
218
|
const url = new URL(doc.url, base);
|
|
174
|
-
if (![
|
|
219
|
+
if (![
|
|
220
|
+
'http:',
|
|
221
|
+
'https:'
|
|
222
|
+
].includes(url.protocol) || url.username || url.password) {
|
|
175
223
|
throw new Error('Invalid file URL.');
|
|
176
224
|
}
|
|
177
225
|
const headers = new Headers();
|
|
178
226
|
if (url.origin === base.origin) {
|
|
179
|
-
for (const name of [
|
|
227
|
+
for (const name of [
|
|
228
|
+
'authorization',
|
|
229
|
+
'cookie'
|
|
230
|
+
]){
|
|
180
231
|
const value = req.headers.get(name);
|
|
181
|
-
if (value)
|
|
182
|
-
headers.set(name, value);
|
|
232
|
+
if (value) headers.set(name, value);
|
|
183
233
|
}
|
|
184
234
|
}
|
|
185
235
|
const response = await fetch(url, {
|
|
186
236
|
headers,
|
|
187
237
|
signal: req.signal ?? undefined,
|
|
188
|
-
redirect: 'error'
|
|
238
|
+
redirect: 'error'
|
|
189
239
|
});
|
|
190
|
-
if (!response.ok)
|
|
191
|
-
throw new Error(`File '${fileId}' is unavailable (${response.status}).`);
|
|
240
|
+
if (!response.ok) throw new Error(`File '${fileId}' is unavailable (${response.status}).`);
|
|
192
241
|
return {
|
|
193
242
|
base64: Buffer.from(await response.arrayBuffer()).toString('base64'),
|
|
194
|
-
filename: String(doc.filename ?? 'upload')
|
|
243
|
+
filename: String(doc.filename ?? 'upload')
|
|
195
244
|
};
|
|
196
245
|
}
|
|
197
246
|
export const uploadAttachment = defineAction({
|
|
@@ -201,9 +250,9 @@ export const uploadAttachment = defineAction({
|
|
|
201
250
|
output: recordSchema,
|
|
202
251
|
options: {
|
|
203
252
|
...recordsOptions,
|
|
204
|
-
attachmentFieldId: attachmentOptions
|
|
253
|
+
attachmentFieldId: attachmentOptions
|
|
205
254
|
},
|
|
206
|
-
async run({ client, input, req }) {
|
|
255
|
+
async run ({ client, input, req }) {
|
|
207
256
|
const file = await loadFile(req, input.fileId);
|
|
208
257
|
return client.request({
|
|
209
258
|
method: 'POST',
|
|
@@ -212,10 +261,11 @@ export const uploadAttachment = defineAction({
|
|
|
212
261
|
body: {
|
|
213
262
|
contentType: input.contentType,
|
|
214
263
|
file: file.base64,
|
|
215
|
-
filename: input.filename ?? file.filename
|
|
264
|
+
filename: input.filename ?? file.filename
|
|
216
265
|
},
|
|
217
|
-
signal: req.signal ?? undefined
|
|
266
|
+
signal: req.signal ?? undefined
|
|
218
267
|
});
|
|
219
|
-
}
|
|
268
|
+
}
|
|
220
269
|
});
|
|
270
|
+
|
|
221
271
|
//# sourceMappingURL=records.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/actions/records.ts"],"names":["filesCollectionSlug","z","defineAction","attachmentOptions","baseOptions","fieldOptions","tableOptions","viewOptions","commentSchema","fieldsSchema","recordSchema","selectionSchema","recordInput","object","fields","meta","label","identifiedRecordInput","recordId","string","min","recordsOptions","baseId","tableId","removeEmpty","Object","fromEntries","entries","filter","value","undefined","Array","isArray","length","createRecord","slug","description","input","output","options","run","client","req","request","method","path","body","typecast","signal","findRecordsInput","searchField","searchValue","viewId","optional","findRecords","array","page","query","filterByFormula","JSON","stringify","view","records","parse","mutateRecordInput","extend","patchRecord","clean","map","key","record","updateRecord","args","cleanRecord","deleteRecord","id","deleted","boolean","passthrough","getRecordInput","getRecord","commentInput","text","parentCommentId","addRecordComment","uploadInput","attachmentFieldId","fileId","union","number","contentType","filename","loadFile","collection","doc","frogbot","findByID","depth","overrideAccess","url","Error","config","_internal","payloadConfig","base","URL","serverURL","includes","protocol","username","password","headers","Headers","origin","name","get","set","response","fetch","redirect","ok","status","base64","Buffer","from","arrayBuffer","toString","String","uploadAttachment","file","baseUrl"],"mappings":"AACA,SAASA,mBAAmB,QAA2B,iBAAiB;AACxE,SAASC,CAAC,QAAQ,MAAM;AAGxB,SAASC,YAAY,QAAQ,eAAe;AAC5C,SACEC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,WAAW,QACN,gBAAgB;AACvB,SAASC,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;QACxB;IACF;AACF,GAAG","file":"records.js"}
|
package/dist/actions/schema.d.ts
CHANGED
|
@@ -7,13 +7,13 @@ export declare const createBase: import("frogbot").PieceActionDefinition<z.ZodOb
|
|
|
7
7
|
description: z.ZodOptional<z.ZodString>;
|
|
8
8
|
fields: z.ZodTuple<[z.ZodObject<{
|
|
9
9
|
type: z.ZodString;
|
|
10
|
-
description: z.ZodOptional<z.ZodString>;
|
|
11
10
|
options: z.ZodOptional<z.ZodUnknown>;
|
|
11
|
+
description: z.ZodOptional<z.ZodString>;
|
|
12
12
|
name: z.ZodString;
|
|
13
13
|
}, z.core.$loose>], z.ZodObject<{
|
|
14
14
|
type: z.ZodString;
|
|
15
|
-
description: z.ZodOptional<z.ZodString>;
|
|
16
15
|
options: z.ZodOptional<z.ZodUnknown>;
|
|
16
|
+
description: z.ZodOptional<z.ZodString>;
|
|
17
17
|
name: z.ZodString;
|
|
18
18
|
}, z.core.$loose>>;
|
|
19
19
|
}, z.core.$strip>], z.ZodObject<{
|
|
@@ -21,13 +21,13 @@ export declare const createBase: import("frogbot").PieceActionDefinition<z.ZodOb
|
|
|
21
21
|
description: z.ZodOptional<z.ZodString>;
|
|
22
22
|
fields: z.ZodTuple<[z.ZodObject<{
|
|
23
23
|
type: z.ZodString;
|
|
24
|
-
description: z.ZodOptional<z.ZodString>;
|
|
25
24
|
options: z.ZodOptional<z.ZodUnknown>;
|
|
25
|
+
description: z.ZodOptional<z.ZodString>;
|
|
26
26
|
name: z.ZodString;
|
|
27
27
|
}, z.core.$loose>], z.ZodObject<{
|
|
28
28
|
type: z.ZodString;
|
|
29
|
-
description: z.ZodOptional<z.ZodString>;
|
|
30
29
|
options: z.ZodOptional<z.ZodUnknown>;
|
|
30
|
+
description: z.ZodOptional<z.ZodString>;
|
|
31
31
|
name: z.ZodString;
|
|
32
32
|
}, z.core.$loose>>;
|
|
33
33
|
}, z.core.$strip>>;
|
|
@@ -99,13 +99,13 @@ export declare const createTable: import("frogbot").PieceActionDefinition<z.ZodO
|
|
|
99
99
|
description: z.ZodOptional<z.ZodString>;
|
|
100
100
|
fields: z.ZodTuple<[z.ZodObject<{
|
|
101
101
|
type: z.ZodString;
|
|
102
|
-
description: z.ZodOptional<z.ZodString>;
|
|
103
102
|
options: z.ZodOptional<z.ZodUnknown>;
|
|
103
|
+
description: z.ZodOptional<z.ZodString>;
|
|
104
104
|
name: z.ZodString;
|
|
105
105
|
}, z.core.$loose>], z.ZodObject<{
|
|
106
106
|
type: z.ZodString;
|
|
107
|
-
description: z.ZodOptional<z.ZodString>;
|
|
108
107
|
options: z.ZodOptional<z.ZodUnknown>;
|
|
108
|
+
description: z.ZodOptional<z.ZodString>;
|
|
109
109
|
name: z.ZodString;
|
|
110
110
|
}, z.core.$loose>>;
|
|
111
111
|
}, z.core.$strip>, z.ZodObject<{
|