@bubblelab/shared-schemas 0.1.10 → 0.1.11
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/agent-memory.d.ts +21 -0
- package/dist/agent-memory.d.ts.map +1 -0
- package/dist/agent-memory.js +11 -0
- package/dist/agent-memory.js.map +1 -0
- package/dist/ai-models.d.ts +1 -1
- package/dist/ai-models.d.ts.map +1 -1
- package/dist/ai-models.js +12 -0
- package/dist/ai-models.js.map +1 -1
- package/dist/api-schema.d.ts +2 -2
- package/dist/bubble-definition-schema.d.ts +559 -75
- package/dist/bubble-definition-schema.d.ts.map +1 -1
- package/dist/bubble-definition-schema.js +184 -0
- package/dist/bubble-definition-schema.js.map +1 -1
- package/dist/bubbleflow-execution-schema.d.ts +586 -175
- package/dist/bubbleflow-execution-schema.d.ts.map +1 -1
- package/dist/bubbleflow-execution-schema.js +40 -26
- package/dist/bubbleflow-execution-schema.js.map +1 -1
- package/dist/bubbleflow-generation-prompts.d.ts +13 -7
- package/dist/bubbleflow-generation-prompts.d.ts.map +1 -1
- package/dist/bubbleflow-generation-prompts.js +384 -15
- package/dist/bubbleflow-generation-prompts.js.map +1 -1
- package/dist/bubbleflow-schema.d.ts +1112 -123
- package/dist/bubbleflow-schema.d.ts.map +1 -1
- package/dist/bubbleflow-schema.js +94 -4
- package/dist/bubbleflow-schema.js.map +1 -1
- package/dist/coffee.d.ts +2201 -0
- package/dist/coffee.d.ts.map +1 -0
- package/dist/coffee.js +258 -0
- package/dist/coffee.js.map +1 -0
- package/dist/credential-schema.d.ts +27 -13
- package/dist/credential-schema.d.ts.map +1 -1
- package/dist/credential-schema.js +137 -4
- package/dist/credential-schema.js.map +1 -1
- package/dist/database-definition-schema.d.ts +8 -8
- package/dist/error-enhancer.d.ts +6 -0
- package/dist/error-enhancer.d.ts.map +1 -0
- package/dist/error-enhancer.js +88 -0
- package/dist/error-enhancer.js.map +1 -0
- package/dist/generate-bubbleflow-schema.d.ts +1001 -79
- package/dist/generate-bubbleflow-schema.d.ts.map +1 -1
- package/dist/generate-bubbleflow-schema.js +23 -7
- package/dist/generate-bubbleflow-schema.js.map +1 -1
- package/dist/hash-utils.d.ts +26 -0
- package/dist/hash-utils.d.ts.map +1 -0
- package/dist/hash-utils.js +37 -0
- package/dist/hash-utils.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/milk-tea.d.ts +18 -20
- package/dist/milk-tea.d.ts.map +1 -1
- package/dist/milk-tea.js +1 -4
- package/dist/milk-tea.js.map +1 -1
- package/dist/oauth-schema.d.ts +2 -2
- package/dist/param-utils.d.ts +10 -0
- package/dist/param-utils.d.ts.map +1 -0
- package/dist/param-utils.js +13 -0
- package/dist/param-utils.js.map +1 -0
- package/dist/pearl.d.ts +96 -29
- package/dist/pearl.d.ts.map +1 -1
- package/dist/pearl.js +20 -9
- package/dist/pearl.js.map +1 -1
- package/dist/storage-utils.d.ts +19 -0
- package/dist/storage-utils.d.ts.map +1 -0
- package/dist/storage-utils.js +54 -0
- package/dist/storage-utils.js.map +1 -0
- package/dist/streaming-events.d.ts +28 -2
- package/dist/streaming-events.d.ts.map +1 -1
- package/dist/subscription-status-schema.d.ts +192 -32
- package/dist/subscription-status-schema.d.ts.map +1 -1
- package/dist/subscription-status-schema.js +85 -7
- package/dist/subscription-status-schema.js.map +1 -1
- package/dist/trigger.d.ts +45 -51
- package/dist/trigger.d.ts.map +1 -1
- package/dist/trigger.js +0 -2
- package/dist/trigger.js.map +1 -1
- package/dist/types.d.ts +11 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/general-chat.d.ts +0 -81
- package/dist/general-chat.d.ts.map +0 -1
- package/dist/general-chat.js +0 -58
- package/dist/general-chat.js.map +0 -1
- package/dist/generation-result-schema.d.ts +0 -73
- package/dist/generation-result-schema.d.ts.map +0 -1
- package/dist/generation-result-schema.js +0 -55
- package/dist/generation-result-schema.js.map +0 -1
- package/dist/mock-data-generator.test.d.ts +0 -2
- package/dist/mock-data-generator.test.d.ts.map +0 -1
- package/dist/mock-data-generator.test.js +0 -176
- package/dist/mock-data-generator.test.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coffee.d.ts","sourceRoot":"","sources":["../src/coffee.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAS5C,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,oBAAoB,EAAG,6BAAsC,CAAC;AAM3E,0DAA0D;AAC1D,eAAO,MAAM,yBAAyB;;;;;;;;;;;;EAOpC,CAAC;AAEH,qDAAqD;AACrD,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBtC,CAAC;AAEH,gEAAgE;AAChE,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMzC,CAAC;AAMH;;;GAGG;AACH,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;EAWlD,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAepC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;EAKzC,CAAC;AAEH,iEAAiE;AACjE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAInC,CAAC;AAMH,+CAA+C;AAC/C,eAAO,MAAM,cAAc;;;;;;;;;;;;EASzB,CAAC;AAEH,2DAA2D;AAC3D,eAAO,MAAM,qBAAqB;;;;;;;;;;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B,CAAC,CAAC"}
|
package/dist/coffee.js
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CredentialType } from './types.js';
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Coffee Agent - Planning Phase for BubbleFlow Generation
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Coffee runs BEFORE Boba to gather clarification and generate an
|
|
7
|
+
// implementation plan. This helps reduce ambiguity in user requests.
|
|
8
|
+
// Constants
|
|
9
|
+
export const COFFEE_MAX_ITERATIONS = 30;
|
|
10
|
+
export const COFFEE_MAX_QUESTIONS = 3;
|
|
11
|
+
export const COFFEE_DEFAULT_MODEL = 'google/gemini-3-pro-preview';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Clarification Schemas
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/** A single choice option for a clarification question */
|
|
16
|
+
export const ClarificationChoiceSchema = z.object({
|
|
17
|
+
id: z.string().describe('Unique identifier for this choice'),
|
|
18
|
+
label: z.string().describe('Short display label for the choice'),
|
|
19
|
+
description: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Optional longer description explaining the choice'),
|
|
23
|
+
});
|
|
24
|
+
/** A clarification question with multiple choices */
|
|
25
|
+
export const ClarificationQuestionSchema = z.object({
|
|
26
|
+
id: z.string().describe('Unique identifier for this question'),
|
|
27
|
+
question: z.string().describe('The question text to display to the user'),
|
|
28
|
+
choices: z
|
|
29
|
+
.array(ClarificationChoiceSchema)
|
|
30
|
+
.min(2)
|
|
31
|
+
.max(4)
|
|
32
|
+
.describe('Available choices for the user (2-4 options)'),
|
|
33
|
+
context: z
|
|
34
|
+
.string()
|
|
35
|
+
.optional()
|
|
36
|
+
.describe('Optional context explaining why this question is being asked'),
|
|
37
|
+
allowMultiple: z
|
|
38
|
+
.boolean()
|
|
39
|
+
.optional()
|
|
40
|
+
.default(false)
|
|
41
|
+
.describe('If true, user can select multiple choices. Default is false (single selection)'),
|
|
42
|
+
});
|
|
43
|
+
/** Event sent to frontend containing clarification questions */
|
|
44
|
+
export const CoffeeClarificationEventSchema = z.object({
|
|
45
|
+
questions: z
|
|
46
|
+
.array(ClarificationQuestionSchema)
|
|
47
|
+
.min(1)
|
|
48
|
+
.max(COFFEE_MAX_QUESTIONS)
|
|
49
|
+
.describe('List of clarification questions (1-3)'),
|
|
50
|
+
});
|
|
51
|
+
// ============================================================================
|
|
52
|
+
// Context Gathering Schemas
|
|
53
|
+
// ============================================================================
|
|
54
|
+
/**
|
|
55
|
+
* Event sent when Coffee requests external context via running a BubbleFlow.
|
|
56
|
+
* This pauses the planning process until the user provides credentials and approves execution.
|
|
57
|
+
*/
|
|
58
|
+
export const CoffeeRequestExternalContextEventSchema = z.object({
|
|
59
|
+
flowId: z.string().describe('Unique ID for this context request'),
|
|
60
|
+
flowCode: z
|
|
61
|
+
.string()
|
|
62
|
+
.describe('Validated BubbleFlow TypeScript code to execute'),
|
|
63
|
+
requiredCredentials: z
|
|
64
|
+
.array(z.nativeEnum(CredentialType))
|
|
65
|
+
.describe('List of credential types needed to run this flow'),
|
|
66
|
+
description: z
|
|
67
|
+
.string()
|
|
68
|
+
.describe('User-friendly description of what this flow will do'),
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Answer sent back to Coffee after user provides credentials and flow executes.
|
|
72
|
+
* This is used to resume the planning process with enriched context.
|
|
73
|
+
*/
|
|
74
|
+
export const CoffeeContextAnswerSchema = z.object({
|
|
75
|
+
flowId: z.string().describe('ID of the context request being answered'),
|
|
76
|
+
status: z
|
|
77
|
+
.enum(['success', 'rejected', 'error'])
|
|
78
|
+
.describe('Status: success (got context), rejected (user skipped), error (execution failed)'),
|
|
79
|
+
result: z
|
|
80
|
+
.unknown()
|
|
81
|
+
.optional()
|
|
82
|
+
.describe('The result data from running the context-gathering flow'),
|
|
83
|
+
error: z.string().optional().describe('Error message if status is error'),
|
|
84
|
+
originalRequest: CoffeeRequestExternalContextEventSchema.optional().describe('The original context request that triggered this answer'),
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* Context request info that the agent generates when it wants to run a flow.
|
|
88
|
+
*/
|
|
89
|
+
export const CoffeeContextRequestInfoSchema = z.object({
|
|
90
|
+
purpose: z.string().describe('Why this context is needed'),
|
|
91
|
+
flowDescription: z
|
|
92
|
+
.string()
|
|
93
|
+
.describe('User-facing description of what the flow will do'),
|
|
94
|
+
});
|
|
95
|
+
/** Legacy context gathering status (used in streaming events) */
|
|
96
|
+
export const CoffeeContextEventSchema = z.object({
|
|
97
|
+
status: z.enum(['gathering', 'complete']),
|
|
98
|
+
miniFlowDescription: z.string().optional(),
|
|
99
|
+
result: z.string().optional(),
|
|
100
|
+
});
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// Plan Schemas
|
|
103
|
+
// ============================================================================
|
|
104
|
+
/** A single step in the implementation plan */
|
|
105
|
+
export const PlanStepSchema = z.object({
|
|
106
|
+
title: z.string().describe('Short title for this step'),
|
|
107
|
+
description: z
|
|
108
|
+
.string()
|
|
109
|
+
.describe('Detailed description of what this step does'),
|
|
110
|
+
bubblesUsed: z
|
|
111
|
+
.array(z.string())
|
|
112
|
+
.optional()
|
|
113
|
+
.describe('Names of bubbles used in this step'),
|
|
114
|
+
});
|
|
115
|
+
/** The complete implementation plan generated by Coffee */
|
|
116
|
+
export const CoffeePlanEventSchema = z.object({
|
|
117
|
+
summary: z.string().describe('Brief overview of the workflow'),
|
|
118
|
+
steps: z.array(PlanStepSchema).describe('Step-by-step implementation plan'),
|
|
119
|
+
estimatedBubbles: z
|
|
120
|
+
.array(z.string())
|
|
121
|
+
.describe('All bubbles that will be used in the workflow'),
|
|
122
|
+
});
|
|
123
|
+
// ============================================================================
|
|
124
|
+
// Unified Message Types for Coffee Chat
|
|
125
|
+
// ============================================================================
|
|
126
|
+
// These message types allow Coffee interactions to be stored as persistent
|
|
127
|
+
// messages in the chat history, rather than ephemeral state.
|
|
128
|
+
/** Base message structure shared by all message types */
|
|
129
|
+
const BaseMessageSchema = z.object({
|
|
130
|
+
id: z.string().describe('Unique message identifier'),
|
|
131
|
+
timestamp: z.string().describe('ISO timestamp of message creation'),
|
|
132
|
+
});
|
|
133
|
+
/** Regular user text message */
|
|
134
|
+
export const UserMessageSchema = BaseMessageSchema.extend({
|
|
135
|
+
type: z.literal('user'),
|
|
136
|
+
content: z.string().describe('User message text'),
|
|
137
|
+
});
|
|
138
|
+
/** Regular assistant text message */
|
|
139
|
+
export const AssistantMessageSchema = BaseMessageSchema.extend({
|
|
140
|
+
type: z.literal('assistant'),
|
|
141
|
+
content: z.string().describe('Assistant response text'),
|
|
142
|
+
code: z.string().optional().describe('Generated code if applicable'),
|
|
143
|
+
resultType: z
|
|
144
|
+
.enum(['code', 'question', 'answer', 'reject'])
|
|
145
|
+
.optional()
|
|
146
|
+
.describe('Type of assistant response'),
|
|
147
|
+
bubbleParameters: z
|
|
148
|
+
.record(z.string(), z.unknown())
|
|
149
|
+
.optional()
|
|
150
|
+
.describe('Bubble parameters for code responses'),
|
|
151
|
+
});
|
|
152
|
+
/** Coffee asking clarification questions */
|
|
153
|
+
export const ClarificationRequestMessageSchema = BaseMessageSchema.extend({
|
|
154
|
+
type: z.literal('clarification_request'),
|
|
155
|
+
questions: z
|
|
156
|
+
.array(ClarificationQuestionSchema)
|
|
157
|
+
.describe('Questions being asked'),
|
|
158
|
+
});
|
|
159
|
+
/** User's answers to clarification questions */
|
|
160
|
+
export const ClarificationResponseMessageSchema = BaseMessageSchema.extend({
|
|
161
|
+
type: z.literal('clarification_response'),
|
|
162
|
+
answers: z
|
|
163
|
+
.record(z.string(), z.array(z.string()))
|
|
164
|
+
.describe('questionId -> choiceIds'),
|
|
165
|
+
originalQuestions: z
|
|
166
|
+
.array(ClarificationQuestionSchema)
|
|
167
|
+
.optional()
|
|
168
|
+
.describe('The questions that were answered (for display purposes)'),
|
|
169
|
+
});
|
|
170
|
+
/** Coffee requesting external context */
|
|
171
|
+
export const ContextRequestMessageSchema = BaseMessageSchema.extend({
|
|
172
|
+
type: z.literal('context_request'),
|
|
173
|
+
request: CoffeeRequestExternalContextEventSchema.describe('Context gathering request details'),
|
|
174
|
+
});
|
|
175
|
+
/** User's response to context request */
|
|
176
|
+
export const ContextResponseMessageSchema = BaseMessageSchema.extend({
|
|
177
|
+
type: z.literal('context_response'),
|
|
178
|
+
answer: CoffeeContextAnswerSchema.describe('User response to context request'),
|
|
179
|
+
credentialTypes: z
|
|
180
|
+
.array(z.string())
|
|
181
|
+
.optional()
|
|
182
|
+
.describe('Credential types used (for display, not actual secrets)'),
|
|
183
|
+
});
|
|
184
|
+
/** Coffee's generated plan */
|
|
185
|
+
export const PlanMessageSchema = BaseMessageSchema.extend({
|
|
186
|
+
type: z.literal('plan'),
|
|
187
|
+
plan: CoffeePlanEventSchema.describe('Generated implementation plan'),
|
|
188
|
+
});
|
|
189
|
+
/** User's plan approval with optional comment */
|
|
190
|
+
export const PlanApprovalMessageSchema = BaseMessageSchema.extend({
|
|
191
|
+
type: z.literal('plan_approval'),
|
|
192
|
+
approved: z.boolean().describe('Whether the plan was approved'),
|
|
193
|
+
comment: z.string().optional().describe('Optional user comment on the plan'),
|
|
194
|
+
});
|
|
195
|
+
/** System message (for retries, errors, etc.) */
|
|
196
|
+
export const SystemMessageSchema = BaseMessageSchema.extend({
|
|
197
|
+
type: z.literal('system'),
|
|
198
|
+
content: z.string().describe('System message content'),
|
|
199
|
+
});
|
|
200
|
+
/** Tool result message - persists successful tool call results */
|
|
201
|
+
export const ToolResultMessageSchema = BaseMessageSchema.extend({
|
|
202
|
+
type: z.literal('tool_result'),
|
|
203
|
+
toolName: z.string().describe('Name of the tool that was called'),
|
|
204
|
+
toolCallId: z.string().describe('Unique ID for this tool call'),
|
|
205
|
+
input: z.unknown().describe('Input parameters passed to the tool'),
|
|
206
|
+
output: z.unknown().describe('Output/result from the tool'),
|
|
207
|
+
duration: z.number().describe('Duration of the tool call in milliseconds'),
|
|
208
|
+
success: z.boolean().describe('Whether the tool call succeeded'),
|
|
209
|
+
});
|
|
210
|
+
/** Union of all Coffee message types */
|
|
211
|
+
export const CoffeeMessageSchema = z.discriminatedUnion('type', [
|
|
212
|
+
UserMessageSchema,
|
|
213
|
+
AssistantMessageSchema,
|
|
214
|
+
ClarificationRequestMessageSchema,
|
|
215
|
+
ClarificationResponseMessageSchema,
|
|
216
|
+
ContextRequestMessageSchema,
|
|
217
|
+
ContextResponseMessageSchema,
|
|
218
|
+
PlanMessageSchema,
|
|
219
|
+
PlanApprovalMessageSchema,
|
|
220
|
+
SystemMessageSchema,
|
|
221
|
+
ToolResultMessageSchema,
|
|
222
|
+
]);
|
|
223
|
+
// ============================================================================
|
|
224
|
+
// Request/Response Schemas
|
|
225
|
+
// ============================================================================
|
|
226
|
+
/** Request to the Generate BubbleFlow */
|
|
227
|
+
export const CoffeeRequestSchema = z.object({
|
|
228
|
+
prompt: z.string().min(1).describe('The user prompt describing the workflow'),
|
|
229
|
+
flowId: z
|
|
230
|
+
.number()
|
|
231
|
+
.optional()
|
|
232
|
+
.describe('Optional flow ID if updating existing flow'),
|
|
233
|
+
messages: z
|
|
234
|
+
.array(CoffeeMessageSchema)
|
|
235
|
+
.optional()
|
|
236
|
+
.describe('Full conversation history including clarification Q&A, context results, plan approvals'),
|
|
237
|
+
});
|
|
238
|
+
/** Response from the Coffee agent */
|
|
239
|
+
export const CoffeeResponseSchema = z.object({
|
|
240
|
+
type: z
|
|
241
|
+
.enum(['clarification', 'plan', 'context_request', 'error'])
|
|
242
|
+
.describe('Response type'),
|
|
243
|
+
clarification: CoffeeClarificationEventSchema.optional(),
|
|
244
|
+
plan: CoffeePlanEventSchema.optional(),
|
|
245
|
+
contextRequest: CoffeeRequestExternalContextEventSchema.optional(),
|
|
246
|
+
error: z.string().optional(),
|
|
247
|
+
success: z.boolean().describe('Whether the operation completed successfully'),
|
|
248
|
+
});
|
|
249
|
+
/** Internal output format from the Coffee AI agent */
|
|
250
|
+
export const CoffeeAgentOutputSchema = z.object({
|
|
251
|
+
action: z
|
|
252
|
+
.enum(['askClarification', 'generatePlan', 'requestContext'])
|
|
253
|
+
.describe('The action the agent wants to take'),
|
|
254
|
+
questions: z.array(ClarificationQuestionSchema).optional(),
|
|
255
|
+
plan: CoffeePlanEventSchema.optional(),
|
|
256
|
+
contextRequest: CoffeeContextRequestInfoSchema.optional(),
|
|
257
|
+
});
|
|
258
|
+
//# sourceMappingURL=coffee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coffee.js","sourceRoot":"","sources":["../src/coffee.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,+EAA+E;AAC/E,0DAA0D;AAC1D,+EAA+E;AAC/E,kEAAkE;AAClE,qEAAqE;AAErE,YAAY;AACZ,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,oBAAoB,GAAG,6BAAsC,CAAC;AAE3E,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAC5D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IAChE,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,mDAAmD,CAAC;CACjE,CAAC,CAAC;AAEH,qDAAqD;AACrD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAA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
*/
|
|
12
|
-
export type OAuthProvider = 'google';
|
|
12
|
+
export type OAuthProvider = 'google' | 'followupboss' | 'notion';
|
|
13
|
+
/**
|
|
14
|
+
* Scope description mapping - maps OAuth scope URLs to human-readable descriptions
|
|
15
|
+
*/
|
|
16
|
+
export interface ScopeDescription {
|
|
17
|
+
scope: string;
|
|
18
|
+
description: string;
|
|
19
|
+
defaultEnabled: boolean;
|
|
20
|
+
}
|
|
13
21
|
/**
|
|
14
22
|
* OAuth credential type configuration for a specific service under a provider
|
|
15
23
|
*/
|
|
@@ -17,6 +25,7 @@ export interface OAuthCredentialConfig {
|
|
|
17
25
|
displayName: string;
|
|
18
26
|
defaultScopes: string[];
|
|
19
27
|
description: string;
|
|
28
|
+
scopeDescriptions?: ScopeDescription[];
|
|
20
29
|
}
|
|
21
30
|
/**
|
|
22
31
|
* OAuth provider configuration shared between frontend and backend
|
|
@@ -41,6 +50,11 @@ export declare function getOAuthProvider(credentialType: CredentialType): OAuthP
|
|
|
41
50
|
* Check if a credential type is OAuth-based
|
|
42
51
|
*/
|
|
43
52
|
export declare function isOAuthCredential(credentialType: CredentialType): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Get scope descriptions for a specific credential type
|
|
55
|
+
* Returns an array of scope descriptions that will be requested during OAuth
|
|
56
|
+
*/
|
|
57
|
+
export declare function getScopeDescriptions(credentialType: CredentialType): ScopeDescription[];
|
|
44
58
|
/**
|
|
45
59
|
* Maps bubble names to their accepted credential types
|
|
46
60
|
*/
|
|
@@ -114,8 +128,6 @@ export declare const createCredentialSchema: z.ZodObject<{
|
|
|
114
128
|
value: string;
|
|
115
129
|
credentialType: CredentialType;
|
|
116
130
|
name?: string | undefined;
|
|
117
|
-
skipValidation?: boolean | undefined;
|
|
118
|
-
credentialConfigurations?: Record<string, unknown> | undefined;
|
|
119
131
|
metadata?: {
|
|
120
132
|
tables: Record<string, Record<string, string>>;
|
|
121
133
|
tableNotes?: Record<string, string> | undefined;
|
|
@@ -131,12 +143,12 @@ export declare const createCredentialSchema: z.ZodObject<{
|
|
|
131
143
|
notes?: string | undefined;
|
|
132
144
|
tags?: string[] | undefined;
|
|
133
145
|
} | undefined;
|
|
146
|
+
skipValidation?: boolean | undefined;
|
|
147
|
+
credentialConfigurations?: Record<string, unknown> | undefined;
|
|
134
148
|
}, {
|
|
135
149
|
value: string;
|
|
136
150
|
credentialType: CredentialType;
|
|
137
151
|
name?: string | undefined;
|
|
138
|
-
skipValidation?: boolean | undefined;
|
|
139
|
-
credentialConfigurations?: Record<string, unknown> | undefined;
|
|
140
152
|
metadata?: {
|
|
141
153
|
tables: Record<string, Record<string, string>>;
|
|
142
154
|
tableNotes?: Record<string, string> | undefined;
|
|
@@ -152,6 +164,8 @@ export declare const createCredentialSchema: z.ZodObject<{
|
|
|
152
164
|
notes?: string | undefined;
|
|
153
165
|
tags?: string[] | undefined;
|
|
154
166
|
} | undefined;
|
|
167
|
+
skipValidation?: boolean | undefined;
|
|
168
|
+
credentialConfigurations?: Record<string, unknown> | undefined;
|
|
155
169
|
}>;
|
|
156
170
|
export declare const updateCredentialSchema: z.ZodObject<{
|
|
157
171
|
value: z.ZodOptional<z.ZodString>;
|
|
@@ -214,10 +228,8 @@ export declare const updateCredentialSchema: z.ZodObject<{
|
|
|
214
228
|
tags?: string[] | undefined;
|
|
215
229
|
}>>;
|
|
216
230
|
}, "strip", z.ZodTypeAny, {
|
|
217
|
-
value?: string | undefined;
|
|
218
231
|
name?: string | undefined;
|
|
219
|
-
|
|
220
|
-
credentialConfigurations?: Record<string, unknown> | undefined;
|
|
232
|
+
value?: string | undefined;
|
|
221
233
|
metadata?: {
|
|
222
234
|
tables: Record<string, Record<string, string>>;
|
|
223
235
|
tableNotes?: Record<string, string> | undefined;
|
|
@@ -233,11 +245,11 @@ export declare const updateCredentialSchema: z.ZodObject<{
|
|
|
233
245
|
notes?: string | undefined;
|
|
234
246
|
tags?: string[] | undefined;
|
|
235
247
|
} | undefined;
|
|
236
|
-
}, {
|
|
237
|
-
value?: string | undefined;
|
|
238
|
-
name?: string | undefined;
|
|
239
248
|
skipValidation?: boolean | undefined;
|
|
240
249
|
credentialConfigurations?: Record<string, unknown> | undefined;
|
|
250
|
+
}, {
|
|
251
|
+
name?: string | undefined;
|
|
252
|
+
value?: string | undefined;
|
|
241
253
|
metadata?: {
|
|
242
254
|
tables: Record<string, Record<string, string>>;
|
|
243
255
|
tableNotes?: Record<string, string> | undefined;
|
|
@@ -253,6 +265,8 @@ export declare const updateCredentialSchema: z.ZodObject<{
|
|
|
253
265
|
notes?: string | undefined;
|
|
254
266
|
tags?: string[] | undefined;
|
|
255
267
|
} | undefined;
|
|
268
|
+
skipValidation?: boolean | undefined;
|
|
269
|
+
credentialConfigurations?: Record<string, unknown> | undefined;
|
|
256
270
|
}>;
|
|
257
271
|
export declare const credentialResponseSchema: z.ZodObject<{
|
|
258
272
|
id: z.ZodNumber;
|
|
@@ -320,9 +334,9 @@ export declare const credentialResponseSchema: z.ZodObject<{
|
|
|
320
334
|
oauthScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
321
335
|
oauthStatus: z.ZodOptional<z.ZodEnum<["active", "expired", "needs_refresh"]>>;
|
|
322
336
|
}, "strip", z.ZodTypeAny, {
|
|
323
|
-
credentialType: string;
|
|
324
337
|
id: number;
|
|
325
338
|
createdAt: string;
|
|
339
|
+
credentialType: string;
|
|
326
340
|
name?: string | undefined;
|
|
327
341
|
metadata?: {
|
|
328
342
|
tables: Record<string, Record<string, string>>;
|
|
@@ -345,9 +359,9 @@ export declare const credentialResponseSchema: z.ZodObject<{
|
|
|
345
359
|
oauthScopes?: string[] | undefined;
|
|
346
360
|
oauthStatus?: "active" | "expired" | "needs_refresh" | undefined;
|
|
347
361
|
}, {
|
|
348
|
-
credentialType: string;
|
|
349
362
|
id: number;
|
|
350
363
|
createdAt: string;
|
|
364
|
+
credentialType: string;
|
|
351
365
|
name?: string | undefined;
|
|
352
366
|
metadata?: {
|
|
353
367
|
tables: Record<string, Record<string, string>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-schema.d.ts","sourceRoot":"","sources":["../src/credential-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAGtC;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"credential-schema.d.ts","sourceRoot":"","sources":["../src/credential-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAGtC;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CA0B7D,CAAC;AAEF,+BAA+B;AAC/B,eAAO,MAAM,kBAAkB,qBAa7B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,aAAa,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC,CAAC;IACxE,mB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,4BAA4B;;;;;;EAIL,CAAC;AAErC,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC7E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC7E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC"}
|
|
@@ -11,16 +11,25 @@ export const CREDENTIAL_ENV_MAP = {
|
|
|
11
11
|
[CredentialType.FIRECRAWL_API_KEY]: 'FIRE_CRAWL_API_KEY',
|
|
12
12
|
[CredentialType.DATABASE_CRED]: 'BUBBLE_CONNECTING_STRING_URL',
|
|
13
13
|
[CredentialType.SLACK_CRED]: 'SLACK_TOKEN',
|
|
14
|
+
[CredentialType.TELEGRAM_BOT_TOKEN]: 'TELEGRAM_BOT_TOKEN',
|
|
14
15
|
[CredentialType.RESEND_CRED]: 'RESEND_API_KEY',
|
|
15
16
|
[CredentialType.OPENROUTER_CRED]: 'OPENROUTER_API_KEY',
|
|
16
17
|
[CredentialType.CLOUDFLARE_R2_ACCESS_KEY]: 'CLOUDFLARE_R2_ACCESS_KEY',
|
|
17
18
|
[CredentialType.CLOUDFLARE_R2_SECRET_KEY]: 'CLOUDFLARE_R2_SECRET_KEY',
|
|
18
19
|
[CredentialType.CLOUDFLARE_R2_ACCOUNT_ID]: 'CLOUDFLARE_R2_ACCOUNT_ID',
|
|
19
20
|
[CredentialType.APIFY_CRED]: 'APIFY_API_TOKEN',
|
|
21
|
+
[CredentialType.ELEVENLABS_API_KEY]: 'ELEVENLABS_API_KEY',
|
|
20
22
|
[CredentialType.GOOGLE_DRIVE_CRED]: '',
|
|
21
23
|
[CredentialType.GMAIL_CRED]: '',
|
|
22
24
|
[CredentialType.GOOGLE_SHEETS_CRED]: '',
|
|
23
25
|
[CredentialType.GOOGLE_CALENDAR_CRED]: '',
|
|
26
|
+
[CredentialType.FUB_CRED]: '',
|
|
27
|
+
[CredentialType.GITHUB_TOKEN]: 'GITHUB_TOKEN',
|
|
28
|
+
[CredentialType.AGI_API_KEY]: 'AGI_API_KEY',
|
|
29
|
+
[CredentialType.AIRTABLE_CRED]: 'AIRTABLE_API_KEY',
|
|
30
|
+
[CredentialType.NOTION_OAUTH_TOKEN]: '',
|
|
31
|
+
[CredentialType.INSFORGE_BASE_URL]: 'INSFORGE_BASE_URL',
|
|
32
|
+
[CredentialType.INSFORGE_API_KEY]: 'INSFORGE_API_KEY',
|
|
24
33
|
};
|
|
25
34
|
/** Used by bubblelab studio */
|
|
26
35
|
export const SYSTEM_CREDENTIALS = new Set([
|
|
@@ -50,24 +59,77 @@ export const OAUTH_PROVIDERS = {
|
|
|
50
59
|
displayName: 'Google Drive',
|
|
51
60
|
defaultScopes: [
|
|
52
61
|
'https://www.googleapis.com/auth/drive.file',
|
|
62
|
+
'https://www.googleapis.com/auth/documents',
|
|
63
|
+
'https://www.googleapis.com/auth/spreadsheets',
|
|
53
64
|
'https://www.googleapis.com/auth/drive',
|
|
54
65
|
],
|
|
55
66
|
description: 'Access Google Drive files and folders',
|
|
67
|
+
scopeDescriptions: [
|
|
68
|
+
{
|
|
69
|
+
scope: 'https://www.googleapis.com/auth/drive.file',
|
|
70
|
+
description: 'View and manage Google Drive files and folders that you have created with Bubble Lab',
|
|
71
|
+
defaultEnabled: true,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
scope: 'https://www.googleapis.com/auth/documents',
|
|
75
|
+
description: 'View and manage your Google Docs documents',
|
|
76
|
+
defaultEnabled: true,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
scope: 'https://www.googleapis.com/auth/spreadsheets',
|
|
80
|
+
description: 'View and manage your Google Sheets spreadsheets',
|
|
81
|
+
defaultEnabled: true,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
scope: 'https://www.googleapis.com/auth/drive',
|
|
85
|
+
description: 'View and manage all ofyour Google Drive files and folders (will see a warning about an "untrusted app" during authentication. Choose only if you need extra permissions)',
|
|
86
|
+
defaultEnabled: false,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
56
89
|
},
|
|
57
90
|
[CredentialType.GMAIL_CRED]: {
|
|
58
91
|
displayName: 'Gmail',
|
|
59
|
-
defaultScopes: [
|
|
60
|
-
|
|
92
|
+
defaultScopes: [
|
|
93
|
+
'https://www.googleapis.com/auth/gmail.send',
|
|
94
|
+
'https://www.googleapis.com/auth/gmail.modify',
|
|
95
|
+
],
|
|
96
|
+
description: 'Access Gmail for sending emails',
|
|
97
|
+
scopeDescriptions: [
|
|
98
|
+
{
|
|
99
|
+
scope: 'https://www.googleapis.com/auth/gmail.send',
|
|
100
|
+
description: 'Send email on your behalf',
|
|
101
|
+
defaultEnabled: true,
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
scope: 'https://www.googleapis.com/auth/gmail.modify',
|
|
105
|
+
description: 'View and manage all of your Gmail emails and labels (might see a warning about an "untrusted app" during authentication. Choose only if you need extra permissions)',
|
|
106
|
+
defaultEnabled: false,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
61
109
|
},
|
|
62
110
|
[CredentialType.GOOGLE_SHEETS_CRED]: {
|
|
63
111
|
displayName: 'Google Sheets',
|
|
64
112
|
defaultScopes: ['https://www.googleapis.com/auth/spreadsheets'],
|
|
65
113
|
description: 'Access Google Sheets for reading and writing spreadsheet data',
|
|
114
|
+
scopeDescriptions: [
|
|
115
|
+
{
|
|
116
|
+
scope: 'https://www.googleapis.com/auth/spreadsheets',
|
|
117
|
+
description: 'View and manage your Google Sheets spreadsheets',
|
|
118
|
+
defaultEnabled: true,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
66
121
|
},
|
|
67
122
|
[CredentialType.GOOGLE_CALENDAR_CRED]: {
|
|
68
123
|
displayName: 'Google Calendar',
|
|
69
124
|
defaultScopes: ['https://www.googleapis.com/auth/calendar'],
|
|
70
125
|
description: 'Access Google Calendar for reading and managing events',
|
|
126
|
+
scopeDescriptions: [
|
|
127
|
+
{
|
|
128
|
+
scope: 'https://www.googleapis.com/auth/calendar',
|
|
129
|
+
description: 'View and manage events on all your calendars',
|
|
130
|
+
defaultEnabled: true,
|
|
131
|
+
},
|
|
132
|
+
],
|
|
71
133
|
},
|
|
72
134
|
},
|
|
73
135
|
authorizationParams: {
|
|
@@ -75,6 +137,32 @@ export const OAUTH_PROVIDERS = {
|
|
|
75
137
|
prompt: 'consent', // Force consent screen to ensure refresh token is issued
|
|
76
138
|
},
|
|
77
139
|
},
|
|
140
|
+
followupboss: {
|
|
141
|
+
name: 'followupboss',
|
|
142
|
+
displayName: 'Follow Up Boss',
|
|
143
|
+
credentialTypes: {
|
|
144
|
+
[CredentialType.FUB_CRED]: {
|
|
145
|
+
displayName: 'Follow Up Boss',
|
|
146
|
+
defaultScopes: [], // FUB doesn't use granular scopes
|
|
147
|
+
description: 'Access Follow Up Boss CRM for managing contacts, tasks, deals, and more',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
authorizationParams: {
|
|
151
|
+
response_type: 'auth_code', // FUB uses 'auth_code' instead of standard 'code'
|
|
152
|
+
prompt: 'login', // FUB supports 'login' to force re-authentication
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
notion: {
|
|
156
|
+
name: 'notion',
|
|
157
|
+
displayName: 'Notion',
|
|
158
|
+
credentialTypes: {
|
|
159
|
+
[CredentialType.NOTION_OAUTH_TOKEN]: {
|
|
160
|
+
displayName: 'Notion Workspace',
|
|
161
|
+
defaultScopes: [], // Notion scopes are managed in the integration capabilities
|
|
162
|
+
description: 'Authorize access to your Notion workspace for searching and reading pages/databases',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
78
166
|
};
|
|
79
167
|
/**
|
|
80
168
|
* Get the OAuth provider for a specific credential type
|
|
@@ -94,6 +182,27 @@ export function getOAuthProvider(credentialType) {
|
|
|
94
182
|
export function isOAuthCredential(credentialType) {
|
|
95
183
|
return getOAuthProvider(credentialType) !== null;
|
|
96
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Get scope descriptions for a specific credential type
|
|
187
|
+
* Returns an array of scope descriptions that will be requested during OAuth
|
|
188
|
+
*/
|
|
189
|
+
export function getScopeDescriptions(credentialType) {
|
|
190
|
+
const provider = getOAuthProvider(credentialType);
|
|
191
|
+
if (!provider) {
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
194
|
+
const providerConfig = OAUTH_PROVIDERS[provider];
|
|
195
|
+
const credentialConfig = providerConfig?.credentialTypes[credentialType];
|
|
196
|
+
if (!credentialConfig?.scopeDescriptions) {
|
|
197
|
+
// Fallback: create descriptions from scope URLs if not explicitly defined
|
|
198
|
+
return (credentialConfig?.defaultScopes.map((scope) => ({
|
|
199
|
+
scope,
|
|
200
|
+
description: `Access: ${scope}`,
|
|
201
|
+
defaultEnabled: true, // Default to enabled if in defaultScopes
|
|
202
|
+
})) || []);
|
|
203
|
+
}
|
|
204
|
+
return credentialConfig.scopeDescriptions;
|
|
205
|
+
}
|
|
97
206
|
/**
|
|
98
207
|
* Collection of credential options for all bubbles
|
|
99
208
|
*/
|
|
@@ -107,6 +216,7 @@ export const BUBBLE_CREDENTIAL_OPTIONS = {
|
|
|
107
216
|
],
|
|
108
217
|
postgresql: [CredentialType.DATABASE_CRED],
|
|
109
218
|
slack: [CredentialType.SLACK_CRED],
|
|
219
|
+
telegram: [CredentialType.TELEGRAM_BOT_TOKEN],
|
|
110
220
|
resend: [CredentialType.RESEND_CRED],
|
|
111
221
|
'database-analyzer': [CredentialType.DATABASE_CRED],
|
|
112
222
|
'slack-notifier': [
|
|
@@ -134,9 +244,13 @@ export const BUBBLE_CREDENTIAL_OPTIONS = {
|
|
|
134
244
|
'sql-query-tool': [CredentialType.DATABASE_CRED],
|
|
135
245
|
'chart-js-tool': [],
|
|
136
246
|
'bubbleflow-validation-tool': [],
|
|
247
|
+
'code-edit-tool': [CredentialType.OPENROUTER_CRED],
|
|
137
248
|
'web-search-tool': [CredentialType.FIRECRAWL_API_KEY],
|
|
138
249
|
'web-scrape-tool': [CredentialType.FIRECRAWL_API_KEY],
|
|
139
|
-
'web-crawl-tool': [
|
|
250
|
+
'web-crawl-tool': [
|
|
251
|
+
CredentialType.FIRECRAWL_API_KEY,
|
|
252
|
+
CredentialType.GOOGLE_GEMINI_CRED,
|
|
253
|
+
],
|
|
140
254
|
'web-extract-tool': [CredentialType.FIRECRAWL_API_KEY],
|
|
141
255
|
'research-agent-tool': [
|
|
142
256
|
CredentialType.FIRECRAWL_API_KEY,
|
|
@@ -148,7 +262,12 @@ export const BUBBLE_CREDENTIAL_OPTIONS = {
|
|
|
148
262
|
CredentialType.GOOGLE_GEMINI_CRED,
|
|
149
263
|
CredentialType.OPENROUTER_CRED,
|
|
150
264
|
],
|
|
151
|
-
'pdf-form-operations': [
|
|
265
|
+
'pdf-form-operations': [
|
|
266
|
+
CredentialType.GOOGLE_GEMINI_CRED,
|
|
267
|
+
CredentialType.OPENAI_CRED,
|
|
268
|
+
CredentialType.ANTHROPIC_CRED,
|
|
269
|
+
CredentialType.OPENROUTER_CRED,
|
|
270
|
+
],
|
|
152
271
|
'pdf-ocr-workflow': [
|
|
153
272
|
CredentialType.GOOGLE_GEMINI_CRED,
|
|
154
273
|
CredentialType.OPENAI_CRED,
|
|
@@ -182,7 +301,21 @@ export const BUBBLE_CREDENTIAL_OPTIONS = {
|
|
|
182
301
|
apify: [CredentialType.APIFY_CRED],
|
|
183
302
|
'instagram-tool': [CredentialType.APIFY_CRED],
|
|
184
303
|
'linkedin-tool': [CredentialType.APIFY_CRED],
|
|
304
|
+
'tiktok-tool': [CredentialType.APIFY_CRED],
|
|
305
|
+
'twitter-tool': [CredentialType.APIFY_CRED],
|
|
306
|
+
'google-maps-tool': [CredentialType.APIFY_CRED],
|
|
185
307
|
'youtube-tool': [CredentialType.APIFY_CRED],
|
|
308
|
+
github: [CredentialType.GITHUB_TOKEN],
|
|
309
|
+
'eleven-labs': [CredentialType.ELEVENLABS_API_KEY],
|
|
310
|
+
followupboss: [CredentialType.FUB_CRED],
|
|
311
|
+
'agi-inc': [CredentialType.AGI_API_KEY],
|
|
312
|
+
airtable: [CredentialType.AIRTABLE_CRED],
|
|
313
|
+
notion: [CredentialType.NOTION_OAUTH_TOKEN],
|
|
314
|
+
firecrawl: [CredentialType.FIRECRAWL_API_KEY],
|
|
315
|
+
'insforge-db': [
|
|
316
|
+
CredentialType.INSFORGE_BASE_URL,
|
|
317
|
+
CredentialType.INSFORGE_API_KEY,
|
|
318
|
+
],
|
|
186
319
|
};
|
|
187
320
|
// POST /credentials - Create credential schema
|
|
188
321
|
export const createCredentialSchema = z
|