-
Notifications
You must be signed in to change notification settings - Fork 173
added assembled #319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
added assembled #319
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
171 changes: 171 additions & 0 deletions
171
packages/bubble-core/src/bubbles/service-bubble/assembled/assembled.integration.flow.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| import { BubbleFlow } from '../../../bubble-flow/bubble-flow-class.js'; | ||
| import type { WebhookEvent } from '@bubblelab/shared-schemas'; | ||
| import { AssembledBubble } from './assembled.js'; | ||
|
|
||
| export interface Output { | ||
| testResults: { | ||
| operation: string; | ||
| success: boolean; | ||
| details?: string; | ||
| }[]; | ||
| summary: string; | ||
| } | ||
|
|
||
| export interface TestPayload extends WebhookEvent { | ||
| testName?: string; | ||
| } | ||
|
|
||
| /** | ||
| * Integration flow that exercises all Assembled bubble operations end-to-end. | ||
| * | ||
| * Tests: | ||
| * 1. list_queues - List all queues | ||
| * 2. list_teams - List all teams | ||
| * 3. list_people - List people with pagination | ||
| * 4. create_person - Create a test person | ||
| * 5. get_person - Get the created person | ||
| * 6. update_person - Update the created person | ||
| * 7. list_activities - List activities in a time window | ||
| * 8. list_time_off - List time off requests | ||
| */ | ||
| export class AssembledIntegrationFlow extends BubbleFlow<'webhook/http'> { | ||
| async handle(_payload: TestPayload): Promise<Output> { | ||
| const results: Output['testResults'] = []; | ||
|
|
||
| // 1. List queues | ||
| const queuesResult = await new AssembledBubble({ | ||
| operation: 'list_queues', | ||
| }).action(); | ||
| results.push({ | ||
| operation: 'list_queues', | ||
| success: queuesResult.success, | ||
| details: queuesResult.success | ||
| ? `Found ${queuesResult.data?.queues?.length ?? 0} queues` | ||
| : queuesResult.error, | ||
| }); | ||
|
|
||
| // 2. List teams | ||
| const teamsResult = await new AssembledBubble({ | ||
| operation: 'list_teams', | ||
| }).action(); | ||
| results.push({ | ||
| operation: 'list_teams', | ||
| success: teamsResult.success, | ||
| details: teamsResult.success | ||
| ? `Found ${teamsResult.data?.teams?.length ?? 0} teams` | ||
| : teamsResult.error, | ||
| }); | ||
|
|
||
| // 3. List people | ||
| const listPeopleResult = await new AssembledBubble({ | ||
| operation: 'list_people', | ||
| limit: 5, | ||
| offset: 0, | ||
| }).action(); | ||
| results.push({ | ||
| operation: 'list_people', | ||
| success: listPeopleResult.success, | ||
| details: listPeopleResult.success | ||
| ? `Found ${listPeopleResult.data?.people?.length ?? 0} people` | ||
| : listPeopleResult.error, | ||
| }); | ||
|
|
||
| // 4. Create a test person (with edge-case unicode name) | ||
| const testEmail = `bubble-test-${Date.now()}@example.com`; | ||
| const createResult = await new AssembledBubble({ | ||
| operation: 'create_person', | ||
| first_name: 'BubbleLab Tëst', | ||
| last_name: "O'Connor-López", | ||
| email: testEmail, | ||
| channels: ['email', 'chat'], | ||
| staffable: true, | ||
| }).action(); | ||
| results.push({ | ||
| operation: 'create_person', | ||
| success: createResult.success, | ||
| details: createResult.success | ||
| ? `Created person: ${JSON.stringify(createResult.data?.person)}` | ||
| : createResult.error, | ||
| }); | ||
|
|
||
| // 5. Get the created person (if create succeeded) | ||
| const personId = (createResult.data?.person as Record<string, unknown>) | ||
| ?.id as string | undefined; | ||
| if (personId) { | ||
| const getResult = await new AssembledBubble({ | ||
| operation: 'get_person', | ||
| person_id: personId, | ||
| }).action(); | ||
| results.push({ | ||
| operation: 'get_person', | ||
| success: getResult.success, | ||
| details: getResult.success | ||
| ? `Retrieved person ID: ${personId}` | ||
| : getResult.error, | ||
| }); | ||
|
|
||
| // 6. Update the person | ||
| const updateResult = await new AssembledBubble({ | ||
| operation: 'update_person', | ||
| person_id: personId, | ||
| first_name: 'Updated Tëst', | ||
| channels: ['email', 'chat', 'phone'], | ||
| }).action(); | ||
| results.push({ | ||
| operation: 'update_person', | ||
| success: updateResult.success, | ||
| details: updateResult.success | ||
| ? `Updated person ID: ${personId}` | ||
| : updateResult.error, | ||
| }); | ||
| } else { | ||
| results.push({ | ||
| operation: 'get_person', | ||
| success: false, | ||
| details: 'Skipped: no person ID from create', | ||
| }); | ||
| results.push({ | ||
| operation: 'update_person', | ||
| success: false, | ||
| details: 'Skipped: no person ID from create', | ||
| }); | ||
| } | ||
|
|
||
| // 7. List activities (last 24 hours) | ||
| const now = Math.floor(Date.now() / 1000); | ||
| const listActivitiesResult = await new AssembledBubble({ | ||
| operation: 'list_activities', | ||
| start_time: now - 86400, | ||
| end_time: now, | ||
| include_agents: true, | ||
| }).action(); | ||
| results.push({ | ||
| operation: 'list_activities', | ||
| success: listActivitiesResult.success, | ||
| details: listActivitiesResult.success | ||
| ? `Found ${Object.keys(listActivitiesResult.data?.activities || {}).length} activities` | ||
| : listActivitiesResult.error, | ||
| }); | ||
|
|
||
| // 8. List time off requests | ||
| const listTimeOffResult = await new AssembledBubble({ | ||
| operation: 'list_time_off', | ||
| limit: 5, | ||
| }).action(); | ||
| results.push({ | ||
| operation: 'list_time_off', | ||
| success: listTimeOffResult.success, | ||
| details: listTimeOffResult.success | ||
| ? `Found ${listTimeOffResult.data?.requests?.length ?? 0} time off requests` | ||
| : listTimeOffResult.error, | ||
| }); | ||
|
|
||
| const passed = results.filter((r) => r.success).length; | ||
| const total = results.length; | ||
|
|
||
| return { | ||
| testResults: results, | ||
| summary: `${passed}/${total} operations passed`, | ||
| }; | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid emitting full person payload in integration output details.
Line 87 includes
JSON.stringify(createResult.data?.person), which can leak PII (for example email/name) through flow output and logs. Return only non-sensitive identifiers.🔧 Proposed fix
results.push({ operation: 'create_person', success: createResult.success, details: createResult.success - ? `Created person: ${JSON.stringify(createResult.data?.person)}` + ? `Created person ID: ${((createResult.data?.person as Record<string, unknown>)?.id as string | undefined) ?? 'unknown'}` : createResult.error, });📝 Committable suggestion
🤖 Prompt for AI Agents