@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.
Files changed (46) hide show
  1. package/README.md +159 -0
  2. package/dist/_official/index.d.mts +3 -0
  3. package/dist/_official/index.mjs +3 -0
  4. package/dist/_runtime/index.d.mts +1 -0
  5. package/dist/_runtime/index.mjs +1 -0
  6. package/dist/accounts.d.mts +17 -0
  7. package/dist/accounts.mjs +20 -0
  8. package/dist/client.d.mts +104 -0
  9. package/dist/client.mjs +308 -0
  10. package/dist/connection.d.mts +2 -0
  11. package/dist/connection.mjs +3 -0
  12. package/dist/events.d.mts +160 -0
  13. package/dist/events.mjs +38 -0
  14. package/dist/factory-B_dyn39A.mjs +8 -0
  15. package/dist/forms.d.mts +390 -0
  16. package/dist/forms.mjs +147 -0
  17. package/dist/images.d.mts +112 -0
  18. package/dist/images.mjs +104 -0
  19. package/dist/index.d.mts +1 -0
  20. package/dist/index.mjs +1 -0
  21. package/dist/insights.d.mts +26 -0
  22. package/dist/insights.mjs +37 -0
  23. package/dist/integration-BCzgn7Dm.mjs +76 -0
  24. package/dist/integration-d_VqlGvZ.d.mts +38 -0
  25. package/dist/messaging.d.mts +1 -0
  26. package/dist/messaging.mjs +1 -0
  27. package/dist/provider-app-BnLMYj3B.d.mts +35 -0
  28. package/dist/responses.d.mts +118 -0
  29. package/dist/responses.mjs +107 -0
  30. package/dist/schemas/index.d.mts +564 -0
  31. package/dist/schemas/index.mjs +3 -0
  32. package/dist/shared-D0ONnQL8.mjs +49 -0
  33. package/dist/themes.d.mts +225 -0
  34. package/dist/themes.mjs +132 -0
  35. package/dist/triggers.d.mts +21 -0
  36. package/dist/triggers.mjs +45 -0
  37. package/dist/verification.d.mts +19 -0
  38. package/dist/verification.mjs +33 -0
  39. package/dist/videos.d.mts +20 -0
  40. package/dist/videos.mjs +29 -0
  41. package/dist/webhooks.d.mts +73 -0
  42. package/dist/webhooks.mjs +79 -0
  43. package/dist/workspace-C1CCnvgv.mjs +271 -0
  44. package/dist/workspaces.d.mts +145 -0
  45. package/dist/workspaces.mjs +119 -0
  46. package/package.json +131 -0
@@ -0,0 +1,225 @@
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/themes.d.ts
6
+ declare const listThemes: _keystrokehq_core0.Operation<z.ZodObject<{
7
+ page: z.ZodOptional<z.ZodNumber>;
8
+ pageSize: z.ZodOptional<z.ZodNumber>;
9
+ }, z.core.$strip>, z.ZodObject<{
10
+ items: z.ZodArray<z.ZodObject<{
11
+ id: z.ZodString;
12
+ name: z.ZodOptional<z.ZodString>;
13
+ visibility: z.ZodOptional<z.ZodEnum<{
14
+ public: "public";
15
+ private: "private";
16
+ }>>;
17
+ has_transparent_button: z.ZodOptional<z.ZodBoolean>;
18
+ background: z.ZodOptional<z.ZodObject<{
19
+ brightness: z.ZodOptional<z.ZodNumber>;
20
+ href: z.ZodOptional<z.ZodString>;
21
+ layout: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$catchall<z.ZodUnknown>>>;
23
+ colors: z.ZodOptional<z.ZodObject<{
24
+ answer: z.ZodOptional<z.ZodString>;
25
+ background: z.ZodOptional<z.ZodString>;
26
+ button: z.ZodOptional<z.ZodString>;
27
+ question: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$strip>>;
29
+ fields: z.ZodOptional<z.ZodObject<{
30
+ [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
31
+ }, z.core.$catchall<z.ZodUnknown>>>;
32
+ font: z.ZodOptional<z.ZodString>;
33
+ }, z.core.$catchall<z.ZodUnknown>>>;
34
+ pagination: z.ZodOptional<z.ZodObject<{
35
+ page: z.ZodOptional<z.ZodNumber>;
36
+ pageSize: z.ZodOptional<z.ZodNumber>;
37
+ totalItems: z.ZodOptional<z.ZodNumber>;
38
+ pageCount: z.ZodOptional<z.ZodNumber>;
39
+ }, z.core.$strip>>;
40
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
41
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
42
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
43
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
44
+ }, z.core.$strip>>[] | undefined>], undefined>;
45
+ declare const getTheme: _keystrokehq_core0.Operation<z.ZodObject<{
46
+ themeId: z.ZodString;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ id: z.ZodString;
49
+ name: z.ZodOptional<z.ZodString>;
50
+ visibility: z.ZodOptional<z.ZodEnum<{
51
+ public: "public";
52
+ private: "private";
53
+ }>>;
54
+ has_transparent_button: z.ZodOptional<z.ZodBoolean>;
55
+ background: z.ZodOptional<z.ZodObject<{
56
+ brightness: z.ZodOptional<z.ZodNumber>;
57
+ href: z.ZodOptional<z.ZodString>;
58
+ layout: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$catchall<z.ZodUnknown>>>;
60
+ colors: z.ZodOptional<z.ZodObject<{
61
+ answer: z.ZodOptional<z.ZodString>;
62
+ background: z.ZodOptional<z.ZodString>;
63
+ button: z.ZodOptional<z.ZodString>;
64
+ question: z.ZodOptional<z.ZodString>;
65
+ }, z.core.$strip>>;
66
+ fields: z.ZodOptional<z.ZodObject<{
67
+ [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
68
+ }, z.core.$catchall<z.ZodUnknown>>>;
69
+ font: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
71
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
72
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
73
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
74
+ }, z.core.$strip>>[] | undefined>], undefined>;
75
+ declare const createTheme: _keystrokehq_core0.Operation<z.ZodObject<{
76
+ name: z.ZodString;
77
+ background: z.ZodOptional<z.ZodObject<{
78
+ [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
79
+ }, z.core.$catchall<z.ZodUnknown>>>;
80
+ colors: z.ZodOptional<z.ZodObject<{
81
+ answer: z.ZodOptional<z.ZodString>;
82
+ background: z.ZodOptional<z.ZodString>;
83
+ button: z.ZodOptional<z.ZodString>;
84
+ question: z.ZodOptional<z.ZodString>;
85
+ }, z.core.$strip>>;
86
+ fields: z.ZodOptional<z.ZodObject<{
87
+ [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
88
+ }, z.core.$catchall<z.ZodUnknown>>>;
89
+ font: z.ZodOptional<z.ZodString>;
90
+ hasTransparentButton: z.ZodOptional<z.ZodBoolean>;
91
+ visibility: z.ZodOptional<z.ZodEnum<{
92
+ public: "public";
93
+ private: "private";
94
+ }>>;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ id: z.ZodString;
97
+ name: z.ZodOptional<z.ZodString>;
98
+ visibility: z.ZodOptional<z.ZodEnum<{
99
+ public: "public";
100
+ private: "private";
101
+ }>>;
102
+ has_transparent_button: z.ZodOptional<z.ZodBoolean>;
103
+ background: z.ZodOptional<z.ZodObject<{
104
+ brightness: z.ZodOptional<z.ZodNumber>;
105
+ href: z.ZodOptional<z.ZodString>;
106
+ layout: z.ZodOptional<z.ZodString>;
107
+ }, z.core.$catchall<z.ZodUnknown>>>;
108
+ colors: z.ZodOptional<z.ZodObject<{
109
+ answer: z.ZodOptional<z.ZodString>;
110
+ background: z.ZodOptional<z.ZodString>;
111
+ button: z.ZodOptional<z.ZodString>;
112
+ question: z.ZodOptional<z.ZodString>;
113
+ }, z.core.$strip>>;
114
+ fields: z.ZodOptional<z.ZodObject<{
115
+ [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
116
+ }, z.core.$catchall<z.ZodUnknown>>>;
117
+ font: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
119
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
120
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
121
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
122
+ }, z.core.$strip>>[] | undefined>], undefined>;
123
+ declare const updateTheme: _keystrokehq_core0.Operation<z.ZodObject<{
124
+ name: z.ZodString;
125
+ background: z.ZodOptional<z.ZodObject<{
126
+ [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
127
+ }, z.core.$catchall<z.ZodUnknown>>>;
128
+ colors: z.ZodOptional<z.ZodObject<{
129
+ answer: z.ZodOptional<z.ZodString>;
130
+ background: z.ZodOptional<z.ZodString>;
131
+ button: z.ZodOptional<z.ZodString>;
132
+ question: z.ZodOptional<z.ZodString>;
133
+ }, z.core.$strip>>;
134
+ fields: z.ZodOptional<z.ZodObject<{
135
+ [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
136
+ }, z.core.$catchall<z.ZodUnknown>>>;
137
+ font: z.ZodOptional<z.ZodString>;
138
+ hasTransparentButton: z.ZodOptional<z.ZodBoolean>;
139
+ visibility: z.ZodOptional<z.ZodEnum<{
140
+ public: "public";
141
+ private: "private";
142
+ }>>;
143
+ themeId: z.ZodString;
144
+ }, z.core.$strip>, z.ZodObject<{
145
+ id: z.ZodString;
146
+ name: z.ZodOptional<z.ZodString>;
147
+ visibility: z.ZodOptional<z.ZodEnum<{
148
+ public: "public";
149
+ private: "private";
150
+ }>>;
151
+ has_transparent_button: z.ZodOptional<z.ZodBoolean>;
152
+ background: z.ZodOptional<z.ZodObject<{
153
+ brightness: z.ZodOptional<z.ZodNumber>;
154
+ href: z.ZodOptional<z.ZodString>;
155
+ layout: z.ZodOptional<z.ZodString>;
156
+ }, z.core.$catchall<z.ZodUnknown>>>;
157
+ colors: z.ZodOptional<z.ZodObject<{
158
+ answer: z.ZodOptional<z.ZodString>;
159
+ background: z.ZodOptional<z.ZodString>;
160
+ button: z.ZodOptional<z.ZodString>;
161
+ question: z.ZodOptional<z.ZodString>;
162
+ }, z.core.$strip>>;
163
+ fields: z.ZodOptional<z.ZodObject<{
164
+ [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
165
+ }, z.core.$catchall<z.ZodUnknown>>>;
166
+ font: z.ZodOptional<z.ZodString>;
167
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
168
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
169
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
170
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
171
+ }, z.core.$strip>>[] | undefined>], undefined>;
172
+ declare const patchTheme: _keystrokehq_core0.Operation<z.ZodObject<{
173
+ themeId: z.ZodString;
174
+ operations: z.ZodArray<z.ZodObject<{
175
+ op: z.ZodEnum<{
176
+ replace: "replace";
177
+ add: "add";
178
+ remove: "remove";
179
+ copy: "copy";
180
+ move: "move";
181
+ test: "test";
182
+ }>;
183
+ path: z.ZodString;
184
+ value: z.ZodOptional<z.ZodUnknown>;
185
+ from: z.ZodOptional<z.ZodString>;
186
+ }, z.core.$strip>>;
187
+ }, z.core.$strip>, z.ZodObject<{
188
+ id: z.ZodString;
189
+ name: z.ZodOptional<z.ZodString>;
190
+ visibility: z.ZodOptional<z.ZodEnum<{
191
+ public: "public";
192
+ private: "private";
193
+ }>>;
194
+ has_transparent_button: z.ZodOptional<z.ZodBoolean>;
195
+ background: z.ZodOptional<z.ZodObject<{
196
+ brightness: z.ZodOptional<z.ZodNumber>;
197
+ href: z.ZodOptional<z.ZodString>;
198
+ layout: z.ZodOptional<z.ZodString>;
199
+ }, z.core.$catchall<z.ZodUnknown>>>;
200
+ colors: z.ZodOptional<z.ZodObject<{
201
+ answer: z.ZodOptional<z.ZodString>;
202
+ background: z.ZodOptional<z.ZodString>;
203
+ button: z.ZodOptional<z.ZodString>;
204
+ question: z.ZodOptional<z.ZodString>;
205
+ }, z.core.$strip>>;
206
+ fields: z.ZodOptional<z.ZodObject<{
207
+ [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
208
+ }, z.core.$catchall<z.ZodUnknown>>>;
209
+ font: z.ZodOptional<z.ZodString>;
210
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
211
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
212
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
213
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
214
+ }, z.core.$strip>>[] | undefined>], undefined>;
215
+ declare const deleteTheme: _keystrokehq_core0.Operation<z.ZodObject<{
216
+ themeId: z.ZodString;
217
+ }, z.core.$strip>, z.ZodObject<{
218
+ success: z.ZodBoolean;
219
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
220
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
221
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
222
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
223
+ }, z.core.$strip>>[] | undefined>], undefined>;
224
+ //#endregion
225
+ export { createTheme, deleteTheme, getTheme, listThemes, patchTheme, updateTheme };
@@ -0,0 +1,132 @@
1
+ import { a as mapPagePagination, o as omitUndefined, r as asRecord } from "./shared-D0ONnQL8.mjs";
2
+ import { createTypeformClient } from "./client.mjs";
3
+ import { N as typeformLooseObjectSchema, c as typeformThemeListSchema, k as typeformIdentifierSchema, l as typeformThemeSchema, s as typeformThemeColorsSchema } from "./workspace-C1CCnvgv.mjs";
4
+ import { t as typeformOperation } from "./factory-B_dyn39A.mjs";
5
+ import { z } from "zod";
6
+
7
+ //#region src/themes.ts
8
+ const listThemesInputSchema = z.object({
9
+ page: z.number().int().positive().optional(),
10
+ pageSize: z.number().int().positive().max(200).optional()
11
+ });
12
+ const getThemeInputSchema = z.object({ themeId: typeformIdentifierSchema });
13
+ const themeBodySchema = z.object({
14
+ name: z.string().trim().min(1),
15
+ background: typeformLooseObjectSchema().optional(),
16
+ colors: typeformThemeColorsSchema.optional(),
17
+ fields: typeformLooseObjectSchema().optional(),
18
+ font: z.string().trim().min(1).optional(),
19
+ hasTransparentButton: z.boolean().optional(),
20
+ visibility: z.enum(["public", "private"]).optional()
21
+ });
22
+ const updateThemeInputSchema = themeBodySchema.extend({ themeId: typeformIdentifierSchema });
23
+ const patchThemeInputSchema = z.object({
24
+ themeId: typeformIdentifierSchema,
25
+ operations: z.array(z.object({
26
+ op: z.enum([
27
+ "add",
28
+ "replace",
29
+ "remove",
30
+ "copy",
31
+ "move",
32
+ "test"
33
+ ]),
34
+ path: z.string().trim().min(1),
35
+ value: z.unknown().optional(),
36
+ from: z.string().trim().min(1).optional()
37
+ })).min(1)
38
+ });
39
+ const deleteThemeInputSchema = z.object({ themeId: typeformIdentifierSchema });
40
+ function buildThemeBody(input) {
41
+ return omitUndefined({
42
+ name: input.name,
43
+ background: input.background,
44
+ colors: input.colors,
45
+ fields: input.fields,
46
+ font: input.font,
47
+ has_transparent_button: input.hasTransparentButton,
48
+ visibility: input.visibility
49
+ });
50
+ }
51
+ const listThemes = typeformOperation({
52
+ id: "list_themes",
53
+ name: "List Themes",
54
+ description: "List themes in the connected Typeform account.",
55
+ input: listThemesInputSchema,
56
+ output: typeformThemeListSchema,
57
+ run: async (input, credentials) => {
58
+ const record = asRecord(await createTypeformClient(credentials).themes.list(omitUndefined({
59
+ page: input.page,
60
+ page_size: input.pageSize
61
+ })));
62
+ const items = Array.isArray(record.items) ? record.items : [];
63
+ return typeformThemeListSchema.parse({
64
+ items: items.map((item) => typeformThemeSchema.parse(item)),
65
+ pagination: mapPagePagination(record)
66
+ });
67
+ }
68
+ });
69
+ const getTheme = typeformOperation({
70
+ id: "get_theme",
71
+ name: "Get Theme",
72
+ description: "Fetch a Typeform theme by id.",
73
+ input: getThemeInputSchema,
74
+ output: typeformThemeSchema,
75
+ run: async (input, credentials) => {
76
+ const response = await createTypeformClient(credentials).themes.get(input.themeId);
77
+ return typeformThemeSchema.parse(response);
78
+ }
79
+ });
80
+ const createTheme = typeformOperation({
81
+ id: "create_theme",
82
+ name: "Create Theme",
83
+ description: "Create a Typeform theme.",
84
+ input: themeBodySchema,
85
+ output: typeformThemeSchema,
86
+ needsApproval: true,
87
+ run: async (input, credentials) => {
88
+ const response = await createTypeformClient(credentials).themes.create(buildThemeBody(input));
89
+ return typeformThemeSchema.parse(response);
90
+ }
91
+ });
92
+ const updateTheme = typeformOperation({
93
+ id: "update_theme",
94
+ name: "Update Theme",
95
+ description: "Replace a Typeform theme by id (full PUT).",
96
+ input: updateThemeInputSchema,
97
+ output: typeformThemeSchema,
98
+ needsApproval: true,
99
+ run: async (input, credentials) => {
100
+ const client = createTypeformClient(credentials);
101
+ const { themeId, ...rest } = input;
102
+ const response = await client.themes.update(themeId, buildThemeBody(rest));
103
+ return typeformThemeSchema.parse(response);
104
+ }
105
+ });
106
+ const patchTheme = typeformOperation({
107
+ id: "patch_theme",
108
+ name: "Patch Theme",
109
+ description: "Apply a JSON Patch operation set to a Typeform theme.",
110
+ input: patchThemeInputSchema,
111
+ output: typeformThemeSchema,
112
+ needsApproval: true,
113
+ run: async (input, credentials) => {
114
+ const response = await createTypeformClient(credentials).themes.patch(input.themeId, input.operations);
115
+ return typeformThemeSchema.parse(response);
116
+ }
117
+ });
118
+ const deleteTheme = typeformOperation({
119
+ id: "delete_theme",
120
+ name: "Delete Theme",
121
+ description: "Delete a Typeform theme.",
122
+ input: deleteThemeInputSchema,
123
+ output: z.object({ success: z.boolean() }),
124
+ needsApproval: true,
125
+ run: async (input, credentials) => {
126
+ await createTypeformClient(credentials).themes.delete(input.themeId);
127
+ return { success: true };
128
+ }
129
+ });
130
+
131
+ //#endregion
132
+ export { createTheme, deleteTheme, getTheme, listThemes, patchTheme, updateTheme };
@@ -0,0 +1,21 @@
1
+ import { n as typeform } from "./integration-d_VqlGvZ.mjs";
2
+ import { n as typeformAppCredentialSet } from "./provider-app-BnLMYj3B.mjs";
3
+ import { typeformFormResponseEventSchema, typeformFormResponseWebhookEnvelopeSchema } from "./events.mjs";
4
+ import { z } from "zod";
5
+ import { BoundTrigger, WebhookRequest } from "@keystrokehq/core";
6
+ import { IntegrationTriggerBindingOptions } from "@keystrokehq/integration-authoring";
7
+ import { WebhookTriggerManifest } from "@keystrokehq/core/trigger";
8
+
9
+ //#region src/triggers.d.ts
10
+ type TypeformWebhookCredentialSets = readonly [typeof typeform, typeof typeformAppCredentialSet];
11
+ type TypeformFormResponseEvent = z.output<typeof typeformFormResponseEventSchema>;
12
+ type TypeformFormResponseEnvelope = z.output<typeof typeformFormResponseWebhookEnvelopeSchema>;
13
+ type TypeformWebhookBindingOptions<TPayload, TOutput = TPayload> = IntegrationTriggerBindingOptions<TPayload, TOutput, WebhookRequest>;
14
+ type TypeformWebhookBoundTrigger<TPayload, TOutput = TPayload> = BoundTrigger<TypeformFormResponseEnvelope, TypeformWebhookCredentialSets, WebhookTriggerManifest, TOutput, WebhookRequest>;
15
+ type TypeformFormResponseBindingSurface = <TOutput = TypeformFormResponseEvent>(options?: TypeformWebhookBindingOptions<TypeformFormResponseEvent, TOutput>) => TypeformWebhookBoundTrigger<TypeformFormResponseEvent, TOutput>;
16
+ interface TypeformWebhookNamespace {
17
+ readonly formResponseSubmitted: TypeformFormResponseBindingSurface;
18
+ }
19
+ declare const webhooks: TypeformWebhookNamespace;
20
+ //#endregion
21
+ export { TypeformWebhookNamespace, webhooks };
@@ -0,0 +1,45 @@
1
+ import { i as typeformAppCredentialSet, t as typeform } from "./integration-BCzgn7Dm.mjs";
2
+ import { typeformFormResponseEventSchema, typeformFormResponseWebhookEnvelopeSchema } from "./events.mjs";
3
+ import { verifyTypeformWebhookRequest } from "./verification.mjs";
4
+ import { createWebhookTriggerBindingFactory } from "@keystrokehq/integration-authoring";
5
+
6
+ //#region src/triggers.ts
7
+ function mapFormResponseEvent(payload) {
8
+ if (payload.event_type !== "form_response") return null;
9
+ const response = payload.form_response;
10
+ return typeformFormResponseEventSchema.parse({
11
+ eventId: payload.event_id,
12
+ eventType: payload.event_type,
13
+ formId: response.form_id,
14
+ token: response.token,
15
+ ...response.landed_at !== void 0 ? { landedAt: response.landed_at } : {},
16
+ ...response.submitted_at !== void 0 ? { submittedAt: response.submitted_at } : {},
17
+ ...response.answers !== void 0 ? { answers: response.answers } : {},
18
+ ...response.hidden !== void 0 ? { hidden: response.hidden } : {},
19
+ ...response.calculated !== void 0 ? { calculated: response.calculated } : {},
20
+ ...response.variables !== void 0 ? { variables: response.variables } : {},
21
+ ...response.ending !== void 0 ? { ending: response.ending } : {},
22
+ ...response.definition !== void 0 ? { definition: response.definition } : {}
23
+ });
24
+ }
25
+ const formResponseSubmittedBinding = createWebhookTriggerBindingFactory({
26
+ defaultName: "Typeform Form Response Submitted",
27
+ defaultDescription: "Fires when a respondent completes and submits a Typeform form.",
28
+ path: "/typeform",
29
+ method: "POST",
30
+ payload: typeformFormResponseWebhookEnvelopeSchema,
31
+ credentialSets: [typeform, typeformAppCredentialSet],
32
+ verify: (request, ctx) => {
33
+ const webhookSecret = ctx.credentials["typeform-app"].webhookSecret;
34
+ if (!webhookSecret) throw new Error("Typeform webhook signing secret is not configured. Set KEYSTROKE_PLATFORM_TYPEFORM_WEBHOOK_SECRET on the Typeform App credential set before enabling webhook triggers.");
35
+ if (!verifyTypeformWebhookRequest(request, webhookSecret)) throw new Error("Invalid Typeform webhook signature.");
36
+ },
37
+ definitionFilter: (payload) => payload.event_type === "form_response",
38
+ mapPayload: mapFormResponseEvent,
39
+ idempotencyKey: (payload) => `form_response:${payload.form_response.form_id}:${payload.form_response.token}`,
40
+ response: { successStatus: 200 }
41
+ });
42
+ const webhooks = Object.freeze({ formResponseSubmitted: (options) => formResponseSubmittedBinding(options) });
43
+
44
+ //#endregion
45
+ export { webhooks };
@@ -0,0 +1,19 @@
1
+ import { WebhookRequest } from "@keystrokehq/core";
2
+
3
+ //#region src/verification.d.ts
4
+ /**
5
+ * Build the `Typeform-Signature` header value for a raw webhook body.
6
+ *
7
+ * Typeform signs each delivery using HMAC-SHA256 over the raw request body with
8
+ * the per-webhook `secret`. The result is base64-encoded and prefixed with
9
+ * `sha256=`. Reference:
10
+ * https://www.typeform.com/developers/webhooks/secure-your-webhooks/
11
+ */
12
+ declare function buildTypeformWebhookSignature(rawBody: string, webhookSecret: string): string;
13
+ /**
14
+ * Verify that a Typeform webhook delivery matches the stored signing secret
15
+ * using constant-time comparison.
16
+ */
17
+ declare function verifyTypeformWebhookRequest(request: Pick<WebhookRequest, 'headers' | 'rawBody'>, webhookSecret: string): boolean;
18
+ //#endregion
19
+ export { buildTypeformWebhookSignature, verifyTypeformWebhookRequest };
@@ -0,0 +1,33 @@
1
+ import { createHmac, timingSafeEqual } from "node:crypto";
2
+
3
+ //#region src/verification.ts
4
+ function toBuffer(value) {
5
+ return Buffer.from(value, "utf8");
6
+ }
7
+ /**
8
+ * Build the `Typeform-Signature` header value for a raw webhook body.
9
+ *
10
+ * Typeform signs each delivery using HMAC-SHA256 over the raw request body with
11
+ * the per-webhook `secret`. The result is base64-encoded and prefixed with
12
+ * `sha256=`. Reference:
13
+ * https://www.typeform.com/developers/webhooks/secure-your-webhooks/
14
+ */
15
+ function buildTypeformWebhookSignature(rawBody, webhookSecret) {
16
+ return `sha256=${createHmac("sha256", webhookSecret).update(rawBody, "utf8").digest("base64")}`;
17
+ }
18
+ /**
19
+ * Verify that a Typeform webhook delivery matches the stored signing secret
20
+ * using constant-time comparison.
21
+ */
22
+ function verifyTypeformWebhookRequest(request, webhookSecret) {
23
+ const signature = request.headers["typeform-signature"];
24
+ if (!signature) return false;
25
+ const expectedSignature = buildTypeformWebhookSignature(request.rawBody, webhookSecret);
26
+ const providedBuffer = toBuffer(signature);
27
+ const expectedBuffer = toBuffer(expectedSignature);
28
+ if (providedBuffer.length !== expectedBuffer.length) return false;
29
+ return timingSafeEqual(providedBuffer, expectedBuffer);
30
+ }
31
+
32
+ //#endregion
33
+ export { buildTypeformWebhookSignature, verifyTypeformWebhookRequest };
@@ -0,0 +1,20 @@
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/videos.d.ts
6
+ declare const uploadVideo: _keystrokehq_core0.Operation<z.ZodObject<{
7
+ source: z.ZodString;
8
+ url: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$strip>, z.ZodObject<{
10
+ id: z.ZodString;
11
+ url: z.ZodOptional<z.ZodString>;
12
+ source: z.ZodOptional<z.ZodString>;
13
+ embed_url: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
15
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
16
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
17
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
18
+ }, z.core.$strip>>[] | undefined>], undefined>;
19
+ //#endregion
20
+ export { uploadVideo };
@@ -0,0 +1,29 @@
1
+ import { o as omitUndefined } from "./shared-D0ONnQL8.mjs";
2
+ import { createTypeformClient } from "./client.mjs";
3
+ import { o as typeformVideoSchema } from "./workspace-C1CCnvgv.mjs";
4
+ import { t as typeformOperation } from "./factory-B_dyn39A.mjs";
5
+ import { z } from "zod";
6
+
7
+ //#region src/videos.ts
8
+ const uploadVideoInputSchema = z.object({
9
+ source: z.string().trim().min(1),
10
+ url: z.string().trim().min(1).optional()
11
+ });
12
+ const uploadVideo = typeformOperation({
13
+ id: "upload_video",
14
+ name: "Upload Video",
15
+ description: "Upload a video asset to the Typeform account (enterprise plan required).",
16
+ input: uploadVideoInputSchema,
17
+ output: typeformVideoSchema,
18
+ needsApproval: true,
19
+ run: async (input, credentials) => {
20
+ const response = await createTypeformClient(credentials).videos.upload(omitUndefined({
21
+ source: input.source,
22
+ url: input.url
23
+ }));
24
+ return typeformVideoSchema.parse(response);
25
+ }
26
+ });
27
+
28
+ //#endregion
29
+ export { uploadVideo };
@@ -0,0 +1,73 @@
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/webhooks.d.ts
6
+ declare const listWebhooks: _keystrokehq_core0.Operation<z.ZodObject<{
7
+ formId: z.ZodString;
8
+ }, z.core.$strip>, z.ZodObject<{
9
+ items: z.ZodArray<z.ZodObject<{
10
+ id: z.ZodString;
11
+ form_id: z.ZodOptional<z.ZodString>;
12
+ tag: z.ZodOptional<z.ZodString>;
13
+ url: z.ZodOptional<z.ZodString>;
14
+ enabled: z.ZodOptional<z.ZodBoolean>;
15
+ verify_ssl: z.ZodOptional<z.ZodBoolean>;
16
+ created_at: z.ZodOptional<z.ZodString>;
17
+ updated_at: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$catchall<z.ZodUnknown>>>;
19
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
20
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
21
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
22
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
23
+ }, z.core.$strip>>[] | undefined>], undefined>;
24
+ declare const getWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
25
+ formId: z.ZodString;
26
+ tag: z.ZodString;
27
+ }, z.core.$strip>, z.ZodObject<{
28
+ id: z.ZodString;
29
+ form_id: z.ZodOptional<z.ZodString>;
30
+ tag: z.ZodOptional<z.ZodString>;
31
+ url: z.ZodOptional<z.ZodString>;
32
+ enabled: z.ZodOptional<z.ZodBoolean>;
33
+ verify_ssl: z.ZodOptional<z.ZodBoolean>;
34
+ created_at: z.ZodOptional<z.ZodString>;
35
+ updated_at: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
37
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
38
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
39
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
40
+ }, z.core.$strip>>[] | undefined>], undefined>;
41
+ declare const createOrUpdateWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
42
+ formId: z.ZodString;
43
+ tag: z.ZodString;
44
+ url: z.ZodString;
45
+ enabled: z.ZodOptional<z.ZodBoolean>;
46
+ verifySsl: z.ZodOptional<z.ZodBoolean>;
47
+ secret: z.ZodString;
48
+ }, z.core.$strip>, z.ZodObject<{
49
+ id: z.ZodString;
50
+ form_id: z.ZodOptional<z.ZodString>;
51
+ tag: z.ZodOptional<z.ZodString>;
52
+ url: z.ZodOptional<z.ZodString>;
53
+ enabled: z.ZodOptional<z.ZodBoolean>;
54
+ verify_ssl: z.ZodOptional<z.ZodBoolean>;
55
+ created_at: z.ZodOptional<z.ZodString>;
56
+ updated_at: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
58
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
59
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
60
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
61
+ }, z.core.$strip>>[] | undefined>], undefined>;
62
+ declare const deleteWebhook: _keystrokehq_core0.Operation<z.ZodObject<{
63
+ formId: z.ZodString;
64
+ tag: z.ZodString;
65
+ }, z.core.$strip>, z.ZodObject<{
66
+ success: z.ZodBoolean;
67
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"typeform", z.ZodObject<{
68
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
69
+ }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
70
+ TYPEFORM_ACCESS_TOKEN: z.ZodString;
71
+ }, z.core.$strip>>[] | undefined>], undefined>;
72
+ //#endregion
73
+ export { createOrUpdateWebhook, deleteWebhook, getWebhook, listWebhooks };