-
Notifications
You must be signed in to change notification settings - Fork 5.6k
new slab components #19354
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
new slab components #19354
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
WalkthroughAdds three Slab actions (Get Posts, List Posts, Search Posts), centralizes GraphQL request helpers and pagination propDefinitions in the Slab app, introduces query constants, and bumps package version and dependencies. Changes
Sequence Diagram(s)sequenceDiagram
participant Action as Action (get/list/search)
participant Runtime as Runtime ($)
participant App as Slab.app (_makeRequest)
participant GraphQL as Slab GraphQL API
Note over Action,Runtime: Action.run builds GraphQL query & variables
Action->>Runtime: run({ $ })
Runtime->>App: _makeRequest({ query, variables })
App->>App: _getHeaders()/ _baseUrl()
App->>GraphQL: HTTP POST (query, variables, headers)
GraphQL-->>App: HTTP response (data / errors)
App-->>Runtime: parsed response (or throw on errors)
Runtime-->>Action: returns data
Action->>Action: map/extract posts, pageInfo, edges
Action-->>Runtime: return { posts, pageInfo, edges } and export $summary
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
|
Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:
|
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.
Actionable comments posted: 4
♻️ Duplicate comments (1)
components/slab/actions/search-posts/search-posts.mjs (1)
42-95: Duplicate: Code duplication with list-posts.mjs.This GraphQL query and variable construction logic is nearly identical to the implementation in
list-posts.mjs. The only difference is line 90 usingthis.queryinstead of an empty string. This duplication was already flagged in the list-posts.mjs review.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
components/slab/actions/get-posts/get-posts.mjs(1 hunks)components/slab/actions/list-posts/list-posts.mjs(1 hunks)components/slab/actions/search-posts/search-posts.mjs(1 hunks)components/slab/package.json(2 hunks)components/slab/slab.app.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
Applied to files:
components/slab/package.json
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
Applied to files:
components/slab/slab.app.mjs
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.
Applied to files:
components/slab/slab.app.mjs
🧬 Code graph analysis (2)
components/slab/actions/search-posts/search-posts.mjs (3)
components/slab/actions/get-posts/get-posts.mjs (4)
query(23-51)variables(52-54)response(55-61)posts(62-62)components/slab/actions/list-posts/list-posts.mjs (6)
query(37-83)variables(84-90)response(91-97)edges(98-98)posts(99-101)pageInfo(102-102)components/slab/slab.app.mjs (6)
query(61-80)variables(81-84)response(52-52)response(85-90)edges(91-91)pageInfo(99-99)
components/slab/actions/get-posts/get-posts.mjs (3)
components/slab/actions/list-posts/list-posts.mjs (3)
query(37-83)variables(84-90)posts(99-101)components/slab/actions/search-posts/search-posts.mjs (3)
query(42-88)variables(89-95)posts(104-106)components/slab/slab.app.mjs (2)
query(61-80)variables(81-84)
🪛 GitHub Actions: Components Checks
components/slab/package.json
[error] 1-1: Lockfile specifiers do not match package.json: "@pipedream/platform" requires '^3.1.0' but lockfile has different specifiers.
🪛 GitHub Actions: Pull Request Checks
components/slab/package.json
[error] 1-1: Cannot install with 'frozen-lockfile' because pnpm-lock.yaml is not up to date with package.json. Specifiers in the lockfile ({}) don't match specs in package.json ({"@pipedream/platform":"^3.1.0"}). Run 'pnpm install --no-frozen-lockfile' to fix. Command failed: pnpm install -r.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: pnpm publish
🔇 Additional comments (10)
components/slab/actions/list-posts/list-posts.mjs (2)
9-35: LGTM!The props are well-structured and correctly reference the pagination propDefinitions from the slab app module.
91-108: LGTM!The response processing correctly extracts posts from the GraphQL response, handles missing data gracefully with optional chaining, and returns a well-structured result.
components/slab/actions/get-posts/get-posts.mjs (3)
11-20: LGTM!The dynamic options implementation correctly uses the
listPostsForOptionshelper with pagination support viaprevContext.cursor.
23-51: LGTM!The GraphQL query is well-structured and requests an appropriate set of fields including nested objects for banner, owner, and topics.
52-64: LGTM!The implementation correctly constructs variables, makes the GraphQL request, and processes the response with appropriate fallbacks.
components/slab/actions/search-posts/search-posts.mjs (2)
9-40: LGTM!The props are well-defined, including the required query parameter and optional pagination controls.
96-113: LGTM!The response processing correctly handles the GraphQL response and provides an informative summary that includes the search query.
components/slab/slab.app.mjs (3)
1-1: LGTM!The axios import from
@pipedream/platformis correct and aligns with the new dependency added in package.json.
33-41: LGTM!The helper methods correctly construct the base URL and headers with proper authorization using the API token.
58-106: LGTM!The
listPostsForOptionsmethod correctly implements paginated options fetching with a reasonable page size of 20 items. It properly maps posts to the Pipedream options format and returns pagination context.
jcortes
left a comment
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.
Hi @sergio-eliot-rodriguez I've added just a suggestion other than that lgtm! Ready for QA!
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
components/slab/common/queries.mjs(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: pnpm publish
- GitHub Check: Lint Code Base
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
| export const SEARCH_POSTS_QUERY = ` | ||
| query SearchPosts($query: String!, $first: Int, $after: String, $last: Int, $before: String) { | ||
| search(query: $query, types: [POST], first: $first, after: $after, last: $last, before: $before) { | ||
| edges { | ||
| node { | ||
| ... on PostSearchResult { | ||
| title | ||
| highlight | ||
| content | ||
| post { | ||
| id | ||
| title | ||
| linkAccess | ||
| archivedAt | ||
| publishedAt | ||
| insertedAt | ||
| updatedAt | ||
| version | ||
| content | ||
| banner { | ||
| original | ||
| thumb | ||
| preset | ||
| } | ||
| owner { | ||
| id | ||
| name | ||
| } | ||
| topics { | ||
| id | ||
| name | ||
| } | ||
| } | ||
| } | ||
| } | ||
| cursor | ||
| } | ||
| pageInfo { | ||
| hasNextPage | ||
| hasPreviousPage | ||
| startCursor | ||
| endCursor | ||
| } | ||
| } | ||
| } | ||
| `; | ||
|
|
||
| export const LIST_POSTS_QUERY = ` | ||
| query ListPosts($query: String!, $first: Int, $after: String, $last: Int, $before: String) { | ||
| search(query: $query, types: [POST], first: $first, after: $after, last: $last, before: $before) { | ||
| edges { | ||
| node { | ||
| ... on PostSearchResult { | ||
| title | ||
| highlight | ||
| content | ||
| post { | ||
| id | ||
| title | ||
| linkAccess | ||
| archivedAt | ||
| publishedAt | ||
| insertedAt | ||
| updatedAt | ||
| version | ||
| content | ||
| banner { | ||
| original | ||
| thumb | ||
| preset | ||
| } | ||
| owner { | ||
| id | ||
| name | ||
| } | ||
| topics { | ||
| id | ||
| name | ||
| } | ||
| } | ||
| } | ||
| } | ||
| cursor | ||
| } | ||
| pageInfo { | ||
| hasNextPage | ||
| hasPreviousPage | ||
| startCursor | ||
| endCursor | ||
| } | ||
| } | ||
| } | ||
| `; |
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.
🧹 Nitpick | 🔵 Trivial
Eliminate query duplication using GraphQL fragments.
SEARCH_POSTS_QUERY and LIST_POSTS_QUERY are nearly identical—same variables, endpoint, and response fields. Maintaining two separate queries violates the DRY principle and creates a maintenance burden if the schema changes.
Extract the repeated post fields and pagination structure into a GraphQL fragment, then reuse it in both queries:
-export const SEARCH_POSTS_QUERY = `
- query SearchPosts($query: String!, $first: Int, $after: String, $last: Int, $before: String) {
- search(query: $query, types: [POST], first: $first, after: $after, last: $last, before: $before) {
- edges {
- node {
- ... on PostSearchResult {
- title
- highlight
- content
- post {
- id
- title
- linkAccess
- archivedAt
- publishedAt
- insertedAt
- updatedAt
- version
- content
- banner {
- original
- thumb
- preset
- }
- owner {
- id
- name
- email
- }
- topics {
- id
- name
- }
- }
- }
- }
- cursor
- }
- pageInfo {
- hasNextPage
- hasPreviousPage
- startCursor
- endCursor
- }
- }
- }
-`;
-
-export const LIST_POSTS_QUERY = `
- query ListPosts($query: String!, $first: Int, $after: String, $last: Int, $before: String) {
- search(query: $query, types: [POST], first: $first, after: $after, last: $last, before: $before) {
- edges {
- node {
- ... on PostSearchResult {
- title
- highlight
- content
- post {
- id
- title
- linkAccess
- archivedAt
- publishedAt
- insertedAt
- updatedAt
- version
- content
- banner {
- original
- thumb
- preset
- }
- owner {
- id
- name
- email
- }
- topics {
- id
- name
- }
- }
- }
- }
- cursor
- }
- pageInfo {
- hasNextPage
- hasPreviousPage
- startCursor
- endCursor
- }
- }
- }
-`;
+const POST_SEARCH_FIELDS = `
+ fragment PostSearchFields on PostSearchResult {
+ title
+ highlight
+ content
+ post {
+ id
+ title
+ linkAccess
+ archivedAt
+ publishedAt
+ insertedAt
+ updatedAt
+ version
+ content
+ banner {
+ original
+ thumb
+ preset
+ }
+ owner {
+ id
+ name
+ email
+ }
+ topics {
+ id
+ name
+ }
+ }
+ }
+`;
+
+const SEARCH_EDGES_QUERY = `
+ query($query: String!, $first: Int, $after: String, $last: Int, $before: String) {
+ search(query: $query, types: [POST], first: $first, after: $after, last: $last, before: $before) {
+ edges {
+ node {
+ ...PostSearchFields
+ }
+ cursor
+ }
+ pageInfo {
+ hasNextPage
+ hasPreviousPage
+ startCursor
+ endCursor
+ }
+ }
+ }
+`;
+
+export const SEARCH_POSTS_QUERY = `${POST_SEARCH_FIELDS}\nquery SearchPosts($query: String!, $first: Int, $after: String, $last: Int, $before: String) ${SEARCH_EDGES_QUERY.split('query')[1]}`;
+
+export const LIST_POSTS_QUERY = `${POST_SEARCH_FIELDS}\nquery ListPosts($query: String!, $first: Int, $after: String, $last: Int, $before: String) ${SEARCH_EDGES_QUERY.split('query')[1]}`;Alternatively, if the queries are truly interchangeable, consolidate them into a single exported query and use it in both actions.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In components/slab/common/queries.mjs around lines 1-95, both SEARCH_POSTS_QUERY
and LIST_POSTS_QUERY are duplicated; extract the repeated selection set (the
PostSearchResult/post fields and pagination/edges structure) into a GraphQL
fragment and reference that fragment from both queries, or if they are identical
in usage, replace the two exports with a single exported query constant and
update callers to import that one query; ensure the fragment (or single query)
includes the variables and pageInfo/edges/cursor fields so schema changes only
need one update.
|
Hello everyone, I have tested this PR and there're some test cases failed or needed improvement. Please check test reports below for more information:
|
|
Hey @vunguyenhung, I noticed the issue with your search returning The
That’s why
|
|
Hi everyone, all test cases are passed! Ready for release! Test reports
|
|
Hi everyone, all test cases are passed! Ready for release! Test reports
|
85caf1b
into
PipedreamHQ:master

WHY
Resolves #19272
Pushes get-posts, list-posts, search-posts, requested by the user.
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.