@keystrokehq/typeform 0.0.1
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 +159 -0
- package/dist/_official/index.d.mts +3 -0
- package/dist/_official/index.mjs +3 -0
- package/dist/_runtime/index.d.mts +1 -0
- package/dist/_runtime/index.mjs +1 -0
- package/dist/accounts.d.mts +17 -0
- package/dist/accounts.mjs +20 -0
- package/dist/client.d.mts +104 -0
- package/dist/client.mjs +308 -0
- package/dist/connection.d.mts +2 -0
- package/dist/connection.mjs +3 -0
- package/dist/events.d.mts +160 -0
- package/dist/events.mjs +38 -0
- package/dist/factory-B_dyn39A.mjs +8 -0
- package/dist/forms.d.mts +390 -0
- package/dist/forms.mjs +147 -0
- package/dist/images.d.mts +112 -0
- package/dist/images.mjs +104 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/insights.d.mts +26 -0
- package/dist/insights.mjs +37 -0
- package/dist/integration-BCzgn7Dm.mjs +76 -0
- package/dist/integration-d_VqlGvZ.d.mts +38 -0
- package/dist/messaging.d.mts +1 -0
- package/dist/messaging.mjs +1 -0
- package/dist/provider-app-BnLMYj3B.d.mts +35 -0
- package/dist/responses.d.mts +118 -0
- package/dist/responses.mjs +107 -0
- package/dist/schemas/index.d.mts +564 -0
- package/dist/schemas/index.mjs +3 -0
- package/dist/shared-D0ONnQL8.mjs +49 -0
- package/dist/themes.d.mts +225 -0
- package/dist/themes.mjs +132 -0
- package/dist/triggers.d.mts +21 -0
- package/dist/triggers.mjs +45 -0
- package/dist/verification.d.mts +19 -0
- package/dist/verification.mjs +33 -0
- package/dist/videos.d.mts +20 -0
- package/dist/videos.mjs +29 -0
- package/dist/webhooks.d.mts +73 -0
- package/dist/webhooks.mjs +79 -0
- package/dist/workspace-C1CCnvgv.mjs +271 -0
- package/dist/workspaces.d.mts +145 -0
- package/dist/workspaces.mjs +119 -0
- package/package.json +131 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { o as omitUndefined, r as asRecord } from "./shared-D0ONnQL8.mjs";
|
|
2
|
+
import { createTypeformClient } from "./client.mjs";
|
|
3
|
+
import { a as typeformWebhookSchema, i as typeformWebhookListSchema, k as typeformIdentifierSchema } from "./workspace-C1CCnvgv.mjs";
|
|
4
|
+
import { t as typeformOperation } from "./factory-B_dyn39A.mjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/webhooks.ts
|
|
8
|
+
const listWebhooksInputSchema = z.object({ formId: typeformIdentifierSchema });
|
|
9
|
+
const getWebhookInputSchema = z.object({
|
|
10
|
+
formId: typeformIdentifierSchema,
|
|
11
|
+
tag: z.string().trim().min(1)
|
|
12
|
+
});
|
|
13
|
+
const createOrUpdateWebhookInputSchema = z.object({
|
|
14
|
+
formId: typeformIdentifierSchema,
|
|
15
|
+
tag: z.string().trim().min(1),
|
|
16
|
+
url: z.string().trim().min(1),
|
|
17
|
+
enabled: z.boolean().optional(),
|
|
18
|
+
verifySsl: z.boolean().optional(),
|
|
19
|
+
secret: z.string().trim().min(1)
|
|
20
|
+
});
|
|
21
|
+
const deleteWebhookInputSchema = z.object({
|
|
22
|
+
formId: typeformIdentifierSchema,
|
|
23
|
+
tag: z.string().trim().min(1)
|
|
24
|
+
});
|
|
25
|
+
const listWebhooks = typeformOperation({
|
|
26
|
+
id: "list_webhooks",
|
|
27
|
+
name: "List Webhooks",
|
|
28
|
+
description: "List webhooks currently registered on a Typeform form.",
|
|
29
|
+
input: listWebhooksInputSchema,
|
|
30
|
+
output: typeformWebhookListSchema,
|
|
31
|
+
run: async (input, credentials) => {
|
|
32
|
+
const record = asRecord(await createTypeformClient(credentials).webhooks.list(input.formId));
|
|
33
|
+
const items = Array.isArray(record.items) ? record.items : [];
|
|
34
|
+
return typeformWebhookListSchema.parse({ items: items.map((item) => typeformWebhookSchema.parse(item)) });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const getWebhook = typeformOperation({
|
|
38
|
+
id: "get_webhook",
|
|
39
|
+
name: "Get Webhook",
|
|
40
|
+
description: "Fetch a single Typeform webhook by form_id + tag.",
|
|
41
|
+
input: getWebhookInputSchema,
|
|
42
|
+
output: typeformWebhookSchema,
|
|
43
|
+
run: async (input, credentials) => {
|
|
44
|
+
const response = await createTypeformClient(credentials).webhooks.get(input.formId, input.tag);
|
|
45
|
+
return typeformWebhookSchema.parse(response);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const createOrUpdateWebhook = typeformOperation({
|
|
49
|
+
id: "create_or_update_webhook",
|
|
50
|
+
name: "Create or Update Webhook",
|
|
51
|
+
description: "Create or update a signed webhook subscription on a Typeform form. Signing is required.",
|
|
52
|
+
input: createOrUpdateWebhookInputSchema,
|
|
53
|
+
output: typeformWebhookSchema,
|
|
54
|
+
needsApproval: true,
|
|
55
|
+
run: async (input, credentials) => {
|
|
56
|
+
const response = await createTypeformClient(credentials).webhooks.createOrUpdate(input.formId, input.tag, omitUndefined({
|
|
57
|
+
url: input.url,
|
|
58
|
+
enabled: input.enabled ?? true,
|
|
59
|
+
verify_ssl: input.verifySsl ?? true,
|
|
60
|
+
secret: input.secret
|
|
61
|
+
}));
|
|
62
|
+
return typeformWebhookSchema.parse(response);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const deleteWebhook = typeformOperation({
|
|
66
|
+
id: "delete_webhook",
|
|
67
|
+
name: "Delete Webhook",
|
|
68
|
+
description: "Delete a Typeform webhook subscription.",
|
|
69
|
+
input: deleteWebhookInputSchema,
|
|
70
|
+
output: z.object({ success: z.boolean() }),
|
|
71
|
+
needsApproval: true,
|
|
72
|
+
run: async (input, credentials) => {
|
|
73
|
+
await createTypeformClient(credentials).webhooks.delete(input.formId, input.tag);
|
|
74
|
+
return { success: true };
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { createOrUpdateWebhook, deleteWebhook, getWebhook, listWebhooks };
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/schemas/shared.ts
|
|
4
|
+
const typeformIdentifierSchema = z.string().trim().min(1);
|
|
5
|
+
const typeformDateTimeSchema = z.string().trim().min(1);
|
|
6
|
+
function typeformLooseObjectSchema(shape = {}) {
|
|
7
|
+
return z.object(shape).catchall(z.unknown());
|
|
8
|
+
}
|
|
9
|
+
const typeformPagePaginationSchema = z.object({
|
|
10
|
+
page: z.number().int().nonnegative().optional(),
|
|
11
|
+
pageSize: z.number().int().positive().optional(),
|
|
12
|
+
totalItems: z.number().int().nonnegative().optional(),
|
|
13
|
+
pageCount: z.number().int().nonnegative().optional()
|
|
14
|
+
});
|
|
15
|
+
const typeformCursorPaginationSchema = z.object({
|
|
16
|
+
pageSize: z.number().int().positive().optional(),
|
|
17
|
+
totalItems: z.number().int().nonnegative().optional(),
|
|
18
|
+
pageCount: z.number().int().nonnegative().optional(),
|
|
19
|
+
before: z.string().optional(),
|
|
20
|
+
after: z.string().optional()
|
|
21
|
+
});
|
|
22
|
+
const typeformErrorSchema = z.object({
|
|
23
|
+
code: z.string().min(1),
|
|
24
|
+
description: z.string().min(1),
|
|
25
|
+
details: z.array(z.object({
|
|
26
|
+
code: z.string().optional(),
|
|
27
|
+
description: z.string().optional(),
|
|
28
|
+
field: z.string().optional()
|
|
29
|
+
})).optional()
|
|
30
|
+
});
|
|
31
|
+
const typeformFieldTypeSchema = z.enum([
|
|
32
|
+
"date",
|
|
33
|
+
"dropdown",
|
|
34
|
+
"email",
|
|
35
|
+
"file_upload",
|
|
36
|
+
"group",
|
|
37
|
+
"legal",
|
|
38
|
+
"long_text",
|
|
39
|
+
"matrix",
|
|
40
|
+
"multiple_choice",
|
|
41
|
+
"number",
|
|
42
|
+
"opinion_scale",
|
|
43
|
+
"payment",
|
|
44
|
+
"phone_number",
|
|
45
|
+
"picture_choice",
|
|
46
|
+
"rating",
|
|
47
|
+
"ranking",
|
|
48
|
+
"short_text",
|
|
49
|
+
"statement",
|
|
50
|
+
"website",
|
|
51
|
+
"yes_no",
|
|
52
|
+
"nps",
|
|
53
|
+
"ending"
|
|
54
|
+
]);
|
|
55
|
+
const typeformThemeFontSchema = z.string().trim().min(1);
|
|
56
|
+
const typeformImageSizeSchema = z.enum([
|
|
57
|
+
"default",
|
|
58
|
+
"thumbnail",
|
|
59
|
+
"mobile"
|
|
60
|
+
]);
|
|
61
|
+
const typeformImageChoiceSizeSchema = z.enum([
|
|
62
|
+
"default",
|
|
63
|
+
"thumbnail",
|
|
64
|
+
"supersize",
|
|
65
|
+
"supermobile",
|
|
66
|
+
"supersizefit",
|
|
67
|
+
"supermobilefit"
|
|
68
|
+
]);
|
|
69
|
+
const typeformImageBackgroundSizeSchema = z.enum([
|
|
70
|
+
"default",
|
|
71
|
+
"thumbnail",
|
|
72
|
+
"mobile",
|
|
73
|
+
"tablet"
|
|
74
|
+
]);
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/schemas/account.ts
|
|
78
|
+
const typeformAccountSchema = typeformLooseObjectSchema({
|
|
79
|
+
alias: z.string().optional(),
|
|
80
|
+
email: z.string().optional(),
|
|
81
|
+
language: z.string().optional(),
|
|
82
|
+
user_id: z.string().optional()
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/schemas/form.ts
|
|
87
|
+
const typeformFormRefSchema = typeformLooseObjectSchema({
|
|
88
|
+
id: typeformIdentifierSchema,
|
|
89
|
+
title: z.string().optional(),
|
|
90
|
+
href: z.string().optional(),
|
|
91
|
+
last_updated_at: z.string().optional(),
|
|
92
|
+
self: typeformLooseObjectSchema({ href: z.string().optional() }).optional(),
|
|
93
|
+
theme: typeformLooseObjectSchema({ href: z.string().optional() }).optional(),
|
|
94
|
+
_links: typeformLooseObjectSchema().optional()
|
|
95
|
+
});
|
|
96
|
+
const typeformFormFieldSchema = typeformLooseObjectSchema({
|
|
97
|
+
id: typeformIdentifierSchema,
|
|
98
|
+
ref: z.string().optional(),
|
|
99
|
+
title: z.string().optional(),
|
|
100
|
+
type: typeformFieldTypeSchema,
|
|
101
|
+
properties: typeformLooseObjectSchema().optional(),
|
|
102
|
+
validations: typeformLooseObjectSchema().optional()
|
|
103
|
+
});
|
|
104
|
+
const typeformFormSchema = typeformLooseObjectSchema({
|
|
105
|
+
id: typeformIdentifierSchema,
|
|
106
|
+
title: z.string().optional(),
|
|
107
|
+
language: z.string().optional(),
|
|
108
|
+
workspace: typeformLooseObjectSchema({ href: z.string().optional() }).optional(),
|
|
109
|
+
theme: typeformLooseObjectSchema({ href: z.string().optional() }).optional(),
|
|
110
|
+
settings: typeformLooseObjectSchema().optional(),
|
|
111
|
+
welcome_screens: z.array(typeformLooseObjectSchema()).optional(),
|
|
112
|
+
thankyou_screens: z.array(typeformLooseObjectSchema()).optional(),
|
|
113
|
+
fields: z.array(typeformFormFieldSchema).optional(),
|
|
114
|
+
hidden: z.array(z.string()).optional(),
|
|
115
|
+
variables: typeformLooseObjectSchema().optional(),
|
|
116
|
+
logic: z.array(typeformLooseObjectSchema()).optional(),
|
|
117
|
+
_links: typeformLooseObjectSchema({ display: z.string().optional() }).optional()
|
|
118
|
+
});
|
|
119
|
+
const typeformFormListSchema = z.object({
|
|
120
|
+
items: z.array(typeformFormRefSchema),
|
|
121
|
+
pagination: typeformPagePaginationSchema.optional()
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/schemas/image.ts
|
|
126
|
+
const typeformImageSchema = typeformLooseObjectSchema({
|
|
127
|
+
id: typeformIdentifierSchema,
|
|
128
|
+
file_name: z.string().optional(),
|
|
129
|
+
url: z.string().optional(),
|
|
130
|
+
width: z.number().int().optional(),
|
|
131
|
+
height: z.number().int().optional(),
|
|
132
|
+
media_type: z.string().optional(),
|
|
133
|
+
has_alpha: z.boolean().optional()
|
|
134
|
+
});
|
|
135
|
+
const typeformImageListSchema = z.object({ items: z.array(typeformImageSchema) });
|
|
136
|
+
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/schemas/insights.ts
|
|
139
|
+
const typeformFormMessagesSchema = typeformLooseObjectSchema();
|
|
140
|
+
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/schemas/response.ts
|
|
143
|
+
const typeformHiddenFieldsSchema = z.record(z.string(), z.string());
|
|
144
|
+
const typeformAnswerFieldRefSchema = typeformLooseObjectSchema({
|
|
145
|
+
id: typeformIdentifierSchema,
|
|
146
|
+
ref: z.string().optional(),
|
|
147
|
+
type: z.string().optional()
|
|
148
|
+
});
|
|
149
|
+
const typeformAnswerSchema = typeformLooseObjectSchema({
|
|
150
|
+
field: typeformAnswerFieldRefSchema,
|
|
151
|
+
type: z.string().optional(),
|
|
152
|
+
text: z.string().optional(),
|
|
153
|
+
email: z.string().optional(),
|
|
154
|
+
url: z.string().optional(),
|
|
155
|
+
phone_number: z.string().optional(),
|
|
156
|
+
number: z.number().optional(),
|
|
157
|
+
boolean: z.boolean().optional(),
|
|
158
|
+
date: z.string().optional(),
|
|
159
|
+
choice: typeformLooseObjectSchema({
|
|
160
|
+
label: z.string().optional(),
|
|
161
|
+
other: z.string().optional()
|
|
162
|
+
}).optional(),
|
|
163
|
+
choices: typeformLooseObjectSchema({
|
|
164
|
+
labels: z.array(z.string()).optional(),
|
|
165
|
+
other: z.string().optional()
|
|
166
|
+
}).optional(),
|
|
167
|
+
file_url: z.string().optional(),
|
|
168
|
+
payment: typeformLooseObjectSchema().optional()
|
|
169
|
+
});
|
|
170
|
+
const typeformVariableSchema = typeformLooseObjectSchema({
|
|
171
|
+
key: z.string(),
|
|
172
|
+
type: z.string().optional(),
|
|
173
|
+
number: z.number().optional(),
|
|
174
|
+
text: z.string().optional()
|
|
175
|
+
});
|
|
176
|
+
const typeformCalculatedSchema = typeformLooseObjectSchema({ score: z.number().optional() });
|
|
177
|
+
const typeformResponseSchema = typeformLooseObjectSchema({
|
|
178
|
+
response_id: z.string().optional(),
|
|
179
|
+
token: z.string().optional(),
|
|
180
|
+
landed_at: z.string().optional(),
|
|
181
|
+
submitted_at: z.string().optional(),
|
|
182
|
+
metadata: typeformLooseObjectSchema().optional(),
|
|
183
|
+
hidden: typeformHiddenFieldsSchema.optional(),
|
|
184
|
+
calculated: typeformCalculatedSchema.optional(),
|
|
185
|
+
variables: z.array(typeformVariableSchema).optional(),
|
|
186
|
+
answers: z.array(typeformAnswerSchema).optional(),
|
|
187
|
+
definition: typeformLooseObjectSchema().optional(),
|
|
188
|
+
ending: typeformLooseObjectSchema().optional()
|
|
189
|
+
});
|
|
190
|
+
const typeformResponseListSchema = z.object({
|
|
191
|
+
items: z.array(typeformResponseSchema),
|
|
192
|
+
totalItems: z.number().int().nonnegative().optional(),
|
|
193
|
+
pageCount: z.number().int().nonnegative().optional(),
|
|
194
|
+
pagination: typeformCursorPaginationSchema.optional()
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/schemas/theme.ts
|
|
199
|
+
const typeformThemeColorsSchema = z.object({
|
|
200
|
+
answer: z.string().optional(),
|
|
201
|
+
background: z.string().optional(),
|
|
202
|
+
button: z.string().optional(),
|
|
203
|
+
question: z.string().optional()
|
|
204
|
+
});
|
|
205
|
+
const typeformThemeSchema = typeformLooseObjectSchema({
|
|
206
|
+
id: typeformIdentifierSchema,
|
|
207
|
+
name: z.string().optional(),
|
|
208
|
+
visibility: z.enum(["public", "private"]).optional(),
|
|
209
|
+
has_transparent_button: z.boolean().optional(),
|
|
210
|
+
background: typeformLooseObjectSchema({
|
|
211
|
+
brightness: z.number().optional(),
|
|
212
|
+
href: z.string().optional(),
|
|
213
|
+
layout: z.string().optional()
|
|
214
|
+
}).optional(),
|
|
215
|
+
colors: typeformThemeColorsSchema.optional(),
|
|
216
|
+
fields: typeformLooseObjectSchema().optional(),
|
|
217
|
+
font: typeformThemeFontSchema.optional()
|
|
218
|
+
});
|
|
219
|
+
const typeformThemeListSchema = z.object({
|
|
220
|
+
items: z.array(typeformThemeSchema),
|
|
221
|
+
pagination: typeformPagePaginationSchema.optional()
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/schemas/video.ts
|
|
226
|
+
const typeformVideoSchema = typeformLooseObjectSchema({
|
|
227
|
+
id: typeformIdentifierSchema,
|
|
228
|
+
url: z.string().optional(),
|
|
229
|
+
source: z.string().optional(),
|
|
230
|
+
embed_url: z.string().optional()
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/schemas/webhook.ts
|
|
235
|
+
const typeformWebhookSchema = typeformLooseObjectSchema({
|
|
236
|
+
id: typeformIdentifierSchema,
|
|
237
|
+
form_id: z.string().optional(),
|
|
238
|
+
tag: z.string().optional(),
|
|
239
|
+
url: z.string().optional(),
|
|
240
|
+
enabled: z.boolean().optional(),
|
|
241
|
+
verify_ssl: z.boolean().optional(),
|
|
242
|
+
created_at: z.string().optional(),
|
|
243
|
+
updated_at: z.string().optional()
|
|
244
|
+
});
|
|
245
|
+
const typeformWebhookListSchema = z.object({ items: z.array(typeformWebhookSchema) });
|
|
246
|
+
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/schemas/workspace.ts
|
|
249
|
+
const typeformWorkspaceMemberSchema = typeformLooseObjectSchema({
|
|
250
|
+
email: z.string().optional(),
|
|
251
|
+
role: z.string().optional()
|
|
252
|
+
});
|
|
253
|
+
const typeformWorkspaceSchema = typeformLooseObjectSchema({
|
|
254
|
+
id: typeformIdentifierSchema,
|
|
255
|
+
name: z.string().optional(),
|
|
256
|
+
default: z.boolean().optional(),
|
|
257
|
+
account_id: z.string().optional(),
|
|
258
|
+
shared: z.boolean().optional(),
|
|
259
|
+
forms: typeformLooseObjectSchema({
|
|
260
|
+
count: z.number().int().optional(),
|
|
261
|
+
href: z.string().optional()
|
|
262
|
+
}).optional(),
|
|
263
|
+
members: z.array(typeformWorkspaceMemberSchema).optional()
|
|
264
|
+
});
|
|
265
|
+
const typeformWorkspaceListSchema = z.object({
|
|
266
|
+
items: z.array(typeformWorkspaceSchema),
|
|
267
|
+
pagination: typeformPagePaginationSchema.optional()
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
//#endregion
|
|
271
|
+
export { typeformImageBackgroundSizeSchema as A, typeformFormSchema as C, typeformErrorSchema as D, typeformDateTimeSchema as E, typeformThemeFontSchema as F, typeformImageSizeSchema as M, typeformLooseObjectSchema as N, typeformFieldTypeSchema as O, typeformPagePaginationSchema as P, typeformFormRefSchema as S, typeformCursorPaginationSchema as T, typeformFormMessagesSchema as _, typeformWebhookSchema as a, typeformFormFieldSchema as b, typeformThemeListSchema as c, typeformAnswerSchema as d, typeformCalculatedSchema as f, typeformVariableSchema as g, typeformResponseSchema as h, typeformWebhookListSchema as i, typeformImageChoiceSizeSchema as j, typeformIdentifierSchema as k, typeformThemeSchema as l, typeformResponseListSchema as m, typeformWorkspaceMemberSchema as n, typeformVideoSchema as o, typeformHiddenFieldsSchema as p, typeformWorkspaceSchema as r, typeformThemeColorsSchema as s, typeformWorkspaceListSchema as t, typeformAnswerFieldRefSchema as u, typeformImageListSchema as v, typeformAccountSchema as w, typeformFormListSchema as x, typeformImageSchema as y };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
+
|
|
5
|
+
//#region src/workspaces.d.ts
|
|
6
|
+
declare const listWorkspaces: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
7
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
search: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
11
|
+
items: z.ZodArray<z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
name: z.ZodOptional<z.ZodString>;
|
|
14
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
account_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
shared: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
forms: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
href: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
21
|
+
members: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
22
|
+
email: z.ZodOptional<z.ZodString>;
|
|
23
|
+
role: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
25
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
26
|
+
pagination: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
totalItems: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
pageCount: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
}, z.core.$strip>>;
|
|
32
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
|
|
33
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
34
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
35
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
36
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
37
|
+
declare const getWorkspace: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
38
|
+
workspaceId: z.ZodString;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
name: z.ZodOptional<z.ZodString>;
|
|
42
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
account_id: z.ZodOptional<z.ZodString>;
|
|
44
|
+
shared: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
forms: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
href: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
49
|
+
members: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
50
|
+
email: z.ZodOptional<z.ZodString>;
|
|
51
|
+
role: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
53
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
|
|
54
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
55
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
56
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
57
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
58
|
+
declare const createWorkspace: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
name: z.ZodOptional<z.ZodString>;
|
|
63
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
account_id: z.ZodOptional<z.ZodString>;
|
|
65
|
+
shared: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
forms: z.ZodOptional<z.ZodObject<{
|
|
67
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
href: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
70
|
+
members: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
71
|
+
email: z.ZodOptional<z.ZodString>;
|
|
72
|
+
role: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
74
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
|
|
75
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
76
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
77
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
78
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
79
|
+
declare const createAccountWorkspace: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
accountId: z.ZodString;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
name: z.ZodOptional<z.ZodString>;
|
|
85
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
account_id: z.ZodOptional<z.ZodString>;
|
|
87
|
+
shared: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
forms: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
href: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
92
|
+
members: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
93
|
+
email: z.ZodOptional<z.ZodString>;
|
|
94
|
+
role: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
96
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
|
|
97
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
98
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
99
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
100
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
101
|
+
declare const updateWorkspace: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
102
|
+
workspaceId: z.ZodString;
|
|
103
|
+
operations: z.ZodArray<z.ZodObject<{
|
|
104
|
+
op: z.ZodEnum<{
|
|
105
|
+
replace: "replace";
|
|
106
|
+
add: "add";
|
|
107
|
+
remove: "remove";
|
|
108
|
+
copy: "copy";
|
|
109
|
+
move: "move";
|
|
110
|
+
test: "test";
|
|
111
|
+
}>;
|
|
112
|
+
path: z.ZodString;
|
|
113
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
114
|
+
from: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>>;
|
|
116
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
117
|
+
id: z.ZodString;
|
|
118
|
+
name: z.ZodOptional<z.ZodString>;
|
|
119
|
+
default: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
account_id: z.ZodOptional<z.ZodString>;
|
|
121
|
+
shared: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
+
forms: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
124
|
+
href: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
126
|
+
members: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
127
|
+
email: z.ZodOptional<z.ZodString>;
|
|
128
|
+
role: z.ZodOptional<z.ZodString>;
|
|
129
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
130
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
|
|
131
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
132
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
133
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
134
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
135
|
+
declare const deleteWorkspace: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
136
|
+
workspaceId: z.ZodString;
|
|
137
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
138
|
+
success: z.ZodBoolean;
|
|
139
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
|
|
140
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
141
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
142
|
+
TYPEFORM_ACCESS_TOKEN: z.ZodString;
|
|
143
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
144
|
+
//#endregion
|
|
145
|
+
export { createAccountWorkspace, createWorkspace, deleteWorkspace, getWorkspace, listWorkspaces, updateWorkspace };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { a as mapPagePagination, o as omitUndefined, r as asRecord } from "./shared-D0ONnQL8.mjs";
|
|
2
|
+
import { createTypeformClient } from "./client.mjs";
|
|
3
|
+
import { k as typeformIdentifierSchema, r as typeformWorkspaceSchema, t as typeformWorkspaceListSchema } from "./workspace-C1CCnvgv.mjs";
|
|
4
|
+
import { t as typeformOperation } from "./factory-B_dyn39A.mjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/workspaces.ts
|
|
8
|
+
const listWorkspacesInputSchema = z.object({
|
|
9
|
+
page: z.number().int().positive().optional(),
|
|
10
|
+
pageSize: z.number().int().positive().max(200).optional(),
|
|
11
|
+
search: z.string().trim().min(1).optional()
|
|
12
|
+
});
|
|
13
|
+
const getWorkspaceInputSchema = z.object({ workspaceId: typeformIdentifierSchema });
|
|
14
|
+
const createWorkspaceInputSchema = z.object({ name: z.string().trim().min(1) });
|
|
15
|
+
const createAccountWorkspaceInputSchema = z.object({
|
|
16
|
+
name: z.string().trim().min(1),
|
|
17
|
+
accountId: typeformIdentifierSchema
|
|
18
|
+
});
|
|
19
|
+
const updateWorkspaceInputSchema = z.object({
|
|
20
|
+
workspaceId: typeformIdentifierSchema,
|
|
21
|
+
operations: z.array(z.object({
|
|
22
|
+
op: z.enum([
|
|
23
|
+
"add",
|
|
24
|
+
"replace",
|
|
25
|
+
"remove",
|
|
26
|
+
"copy",
|
|
27
|
+
"move",
|
|
28
|
+
"test"
|
|
29
|
+
]),
|
|
30
|
+
path: z.string().trim().min(1),
|
|
31
|
+
value: z.unknown().optional(),
|
|
32
|
+
from: z.string().trim().min(1).optional()
|
|
33
|
+
})).min(1)
|
|
34
|
+
});
|
|
35
|
+
const deleteWorkspaceInputSchema = z.object({ workspaceId: typeformIdentifierSchema });
|
|
36
|
+
const listWorkspaces = typeformOperation({
|
|
37
|
+
id: "list_workspaces",
|
|
38
|
+
name: "List Workspaces",
|
|
39
|
+
description: "List workspaces in the connected Typeform account.",
|
|
40
|
+
input: listWorkspacesInputSchema,
|
|
41
|
+
output: typeformWorkspaceListSchema,
|
|
42
|
+
run: async (input, credentials) => {
|
|
43
|
+
const record = asRecord(await createTypeformClient(credentials).workspaces.list(omitUndefined({
|
|
44
|
+
page: input.page,
|
|
45
|
+
page_size: input.pageSize,
|
|
46
|
+
search: input.search
|
|
47
|
+
})));
|
|
48
|
+
const items = Array.isArray(record.items) ? record.items : [];
|
|
49
|
+
return typeformWorkspaceListSchema.parse({
|
|
50
|
+
items: items.map((item) => typeformWorkspaceSchema.parse(item)),
|
|
51
|
+
pagination: mapPagePagination(record)
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const getWorkspace = typeformOperation({
|
|
56
|
+
id: "get_workspace",
|
|
57
|
+
name: "Get Workspace",
|
|
58
|
+
description: "Fetch a Typeform workspace by id.",
|
|
59
|
+
input: getWorkspaceInputSchema,
|
|
60
|
+
output: typeformWorkspaceSchema,
|
|
61
|
+
run: async (input, credentials) => {
|
|
62
|
+
const response = await createTypeformClient(credentials).workspaces.get(input.workspaceId);
|
|
63
|
+
return typeformWorkspaceSchema.parse(response);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const createWorkspace = typeformOperation({
|
|
67
|
+
id: "create_workspace",
|
|
68
|
+
name: "Create Workspace",
|
|
69
|
+
description: "Create a new Typeform workspace in the connected account.",
|
|
70
|
+
input: createWorkspaceInputSchema,
|
|
71
|
+
output: typeformWorkspaceSchema,
|
|
72
|
+
needsApproval: true,
|
|
73
|
+
run: async (input, credentials) => {
|
|
74
|
+
const response = await createTypeformClient(credentials).workspaces.create({ name: input.name });
|
|
75
|
+
return typeformWorkspaceSchema.parse(response);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const createAccountWorkspace = typeformOperation({
|
|
79
|
+
id: "create_account_workspace",
|
|
80
|
+
name: "Create Account Workspace",
|
|
81
|
+
description: "Create a new Typeform workspace attached to a specific account (multi-account installs).",
|
|
82
|
+
input: createAccountWorkspaceInputSchema,
|
|
83
|
+
output: typeformWorkspaceSchema,
|
|
84
|
+
needsApproval: true,
|
|
85
|
+
run: async (input, credentials) => {
|
|
86
|
+
const response = await createTypeformClient(credentials).workspaces.create({
|
|
87
|
+
name: input.name,
|
|
88
|
+
account_id: input.accountId
|
|
89
|
+
});
|
|
90
|
+
return typeformWorkspaceSchema.parse(response);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const updateWorkspace = typeformOperation({
|
|
94
|
+
id: "update_workspace",
|
|
95
|
+
name: "Update Workspace",
|
|
96
|
+
description: "Apply a JSON Patch operation set to a Typeform workspace.",
|
|
97
|
+
input: updateWorkspaceInputSchema,
|
|
98
|
+
output: typeformWorkspaceSchema,
|
|
99
|
+
needsApproval: true,
|
|
100
|
+
run: async (input, credentials) => {
|
|
101
|
+
const response = await createTypeformClient(credentials).workspaces.update(input.workspaceId, input.operations);
|
|
102
|
+
return typeformWorkspaceSchema.parse(response);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
const deleteWorkspace = typeformOperation({
|
|
106
|
+
id: "delete_workspace",
|
|
107
|
+
name: "Delete Workspace",
|
|
108
|
+
description: "Delete a Typeform workspace.",
|
|
109
|
+
input: deleteWorkspaceInputSchema,
|
|
110
|
+
output: z.object({ success: z.boolean() }),
|
|
111
|
+
needsApproval: true,
|
|
112
|
+
run: async (input, credentials) => {
|
|
113
|
+
await createTypeformClient(credentials).workspaces.delete(input.workspaceId);
|
|
114
|
+
return { success: true };
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
//#endregion
|
|
119
|
+
export { createAccountWorkspace, createWorkspace, deleteWorkspace, getWorkspace, listWorkspaces, updateWorkspace };
|