-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Trunkrs - new components #18156
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
Trunkrs - new components #18156
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds Trunkrs app methods, propDefinitions, and pagination; introduces actions for creating, listing, fetching, getting state, and canceling shipments; adds list time slots action; implements webhook base and sources for creation, cancellation, review, and state updates; updates constants; bumps package version and adds dependency. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Action as Create Shipment Action
participant App as Trunkrs App
participant API as Trunkrs API
User->>Action: Provide sender/recipient, parcels, timeSlotId, service
Action->>App: createShipment(payload, $)
App->>API: POST /v2/shipments (payload)
API-->>App: 201 Created + data
App-->>Action: data
Action-->>User: Return data (+ export "$summary")
sequenceDiagram
autonumber
participant Src as Webhook Source (Base)
participant App as Trunkrs App
participant API as Trunkrs API
participant DB as Source DB
participant PD as Pipedream Runtime
rect rgba(200,230,255,0.3)
note over Src,API: Activation
Src->>App: createWebhook({ endpoint, event })
App->>API: POST /v2/webhooks
API-->>App: webhookId
App-->>Src: webhookId
Src->>DB: store hookId
end
rect rgba(220,255,220,0.3)
note over API,Src: Event Delivery
API-->>Src: HTTP POST (event body)
Src->>Src: generateMeta(event)
Src->>PD: $emit(event, meta)
end
rect rgba(255,230,230,0.3)
note over Src,API: Deactivation
Src->>DB: read hookId
Src->>App: deleteWebhook({ webhookId })
App->>API: DELETE /v2/webhooks/{id}
API-->>App: 204 No Content
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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
🧹 Nitpick comments (32)
components/trunkrs/sources/new-shipment-created/test-event.mjs (1)
4-4
: Nit: prefer production host in samplelink
.
Using staging in sample data can confuse users clicking through from the UI.Apply this minimal change:
- link: 'https://staging-api.trunkrs.nl/api/v2/shipments/3256906', + link: 'https://api.trunkrs.nl/api/v2/shipments/3256906',If Trunkrs expects a different public host, swap accordingly.
components/trunkrs/sources/shipment-reviewed/test-event.mjs (2)
4-4
: Nit: replace staging host with production inlink
.
Align with other public-facing samples.- link: 'https://staging-api.trunkrs.nl/api/v2/shipments/3618093', + link: 'https://api.trunkrs.nl/api/v2/shipments/3618093',
6-6
: Use a state code that reflects a “reviewed” event.
DATA_PROCESSED
may be valid, but for a “Shipment Reviewed” sample, a more representative code (e.g.,REVIEWED
) helps avoid confusion.- code: 'DATA_PROCESSED', + code: 'REVIEWED', // Adjust to the exact enum used by Trunkrs if differentIf Trunkrs uses a different enum, update accordingly to mirror the API docs.
components/trunkrs/sources/shipment-state-updated/test-event.mjs (1)
4-4
: Nit: switch to production API host inlink
.
Reduces ambiguity for users.- link: 'https://staging-api.trunkrs.nl/api/v2/shipments/3859236', + link: 'https://api.trunkrs.nl/api/v2/shipments/3859236',components/trunkrs/sources/shipment-cancelled/test-event.mjs (3)
1-10
: LGTM for basic structure; two tweaks recommended below.
Payload mirrors the others; see notes on host and code.
4-4
: Nit: use production host inlink
.
Consistent with other public samples.- link: 'https://staging-api.trunkrs.nl/api/v2/shipments/3299275', + link: 'https://api.trunkrs.nl/api/v2/shipments/3299275',
6-6
: Align state code with a cancellation scenario.
For a “Shipment Cancelled” event, a cancellation-specific code provides a clearer example for users.- code: 'DATA_PROCESSED', + code: 'CANCELLED', // Replace with the exact enum from Trunkrs if differentIf Trunkrs uses a distinct cancellation code (e.g.,
CANCELLED_BY_MERCHANT
), substitute accordingly per the API.components/trunkrs/sources/shipment-cancelled/shipment-cancelled.mjs (2)
13-15
: Prefer using shared constants for event names to avoid typos.Hardcoding "onCancellation" increases drift risk. If WEBHOOK_EVENTS exists (as suggested in the PR summary), import and reference it.
import common from "../common/base-webhook.mjs"; import sampleEmit from "./test-event.mjs"; +import { WEBHOOK_EVENTS } from "../../common/constants.mjs"; export default { ...common, key: "trunkrs-shipment-cancelled", name: "Shipment Cancelled (Instant)", description: "Emit new event when a shipment is cancelled. [See the documentation](https://docs.trunkrs.nl/docs/v2-api-documentation/05ac4fa1b9ade-create-webhook-subscription)", version: "0.0.1", type: "source", methods: { ...common.methods, getEvent() { - return "onCancellation"; + return WEBHOOK_EVENTS.onCancellation; }, }, sampleEmit, };
6-8
: Consistency nit: “Cancelled” vs “Canceled”.Elsewhere in repos we often use American English (“Canceled”). If other Trunkrs sources in this PR use one style, align this key/name to match.
components/trunkrs/actions/get-shipment-state/get-shipment-state.mjs (1)
18-25
: Return handling is fine; consider a more informative summary.If the response includes a state/status field, surface it in the $summary for quick debugging. Safe fallback keeps it robust.
async run({ $ }) { const { data } = await this.trunkrs.getShipmentState({ $, trunkrsNr: this.trunkrsNr, }); - $.export("$summary", `Successfully fetched shipment state for ${this.trunkrsNr}.`); + $.export( + "$summary", + `Shipment ${this.trunkrsNr}: ${data?.state?.code ?? data?.status ?? "state fetched"}.`, + ); return data; },components/trunkrs/sources/shipment-state-updated/shipment-state-updated.mjs (1)
13-15
: Use constants instead of string literal for the event.To reduce drift and centralize event names, import and use WEBHOOK_EVENTS.onStateUpdate.
import common from "../common/base-webhook.mjs"; import sampleEmit from "./test-event.mjs"; +import { WEBHOOK_EVENTS } from "../../common/constants.mjs"; ... ...common.methods, getEvent() { - return "onStateUpdate"; + return WEBHOOK_EVENTS.onStateUpdate; },components/trunkrs/sources/shipment-reviewed/shipment-reviewed.mjs (1)
13-15
: Centralize event name via constants.Same rationale as other sources: import WEBHOOK_EVENTS and reference onReview.
import common from "../common/base-webhook.mjs"; import sampleEmit from "./test-event.mjs"; +import { WEBHOOK_EVENTS } from "../../common/constants.mjs"; ... ...common.methods, getEvent() { - return "onReview"; + return WEBHOOK_EVENTS.onReview; },components/trunkrs/sources/new-shipment-created/new-shipment-created.mjs (2)
13-15
: Reference the event via shared constants.Swap the string literal for WEBHOOK_EVENTS.onCreation to keep events DRY.
import common from "../common/base-webhook.mjs"; import sampleEmit from "./test-event.mjs"; +import { WEBHOOK_EVENTS } from "../../common/constants.mjs"; ... ...common.methods, getEvent() { - return "onCreation"; + return WEBHOOK_EVENTS.onCreation; },
4-18
: Optional: factor repeated boilerplate via a tiny factory.A small helper (e.g., buildWebhookSource({ key, name, description, event, sampleEmit })) could reduce repetition across 4 nearly-identical sources.
Example helper (new file suggestion):
// components/trunkrs/sources/common/build-webhook-source.mjs import common from "./base-webhook.mjs"; export default ({ key, name, description, event, sampleEmit }) => ({ ...common, key, name, description, version: "0.0.1", type: "source", methods: { ...common.methods, getEvent() { return event; }, }, sampleEmit, });Then this source becomes:
-import common from "../common/base-webhook.mjs"; -import sampleEmit from "./test-event.mjs"; -export default { - ...common, - key: "trunkrs-new-shipment-created", - name: "New Shipment Created (Instant)", - description: "Emit new event when a new shipment is created. [See the documentation](https://docs.trunkrs.nl/docs/v2-api-documentation/05ac4fa1b9ade-create-webhook-subscription)", - version: "0.0.1", - type: "source", - methods: { - ...common.methods, - getEvent() { - return "onCreation"; - }, - }, - sampleEmit, -}; +import buildWebhookSource from "../common/build-webhook-source.mjs"; +import sampleEmit from "./test-event.mjs"; +import { WEBHOOK_EVENTS } from "../../common/constants.mjs"; + +export default buildWebhookSource({ + key: "trunkrs-new-shipment-created", + name: "New Shipment Created (Instant)", + description: "Emit new event when a new shipment is created. [See the documentation](https://docs.trunkrs.nl/docs/v2-api-documentation/05ac4fa1b9ade-create-webhook-subscription)", + event: WEBHOOK_EVENTS.onCreation, + sampleEmit, +});components/trunkrs/actions/cancel-shipment/cancel-shipment.mjs (2)
18-25
: Guard against 204/empty response and standardize success payloadSome cancel endpoints return 204 No Content. Returning
data
directly could yieldundefined
. Consider a small guard and also standardize the summary to US English (“canceled”) for consistency.Apply this diff:
async run({ $ }) { - const { data } = await this.trunkrs.cancelShipment({ + const { data } = await this.trunkrs.cancelShipment({ $, trunkrsNr: this.trunkrsNr, }); - $.export("$summary", `Successfully cancelled shipment ${this.trunkrsNr}.`); - return data; + $.export("$summary", `Successfully canceled shipment ${this.trunkrsNr}.`); + return data ?? { canceled: true, trunkrsNr: this.trunkrsNr }; },
18-22
: Optional: add brief context to errorsIf Trunkrs returns a domain error (e.g., already canceled, not cancelable), a tiny try/catch adding context to the thrown message can improve UX in the PD UI without swallowing the stack trace.
I can draft a minimal error wrapper that preserves original error data while adding actionable context. Want me to push a patch?
components/trunkrs/actions/list-shipments/list-shipments.mjs (3)
12-17
: Make sort optional to avoid forcing a choiceCurrently
sort
is required (nooptional: true
). Unless Trunkrs requires a sort param, let users omit it.Apply this diff:
sort: { type: "string", label: "Sort", description: "The field to sort by. Fields prepended with a dash (-) are sorted in descending order.", options: constants.SHIPMENT_SORT_FIELDS, + optional: true, },
25-30
: Description says default offset 0, but no default setAdd
default: 0
so behavior matches the description.Apply this diff:
offset: { type: "integer", label: "Offset", description: "The offset to start from. Default: 0", - optional: true, + default: 0, + optional: true, },
18-24
: Nit: consider simple input constraintsAdding
min: 1
formaxResults
andmin: 0
foroffset
prevents accidental negative values.Apply this diff:
maxResults: { type: "integer", label: "Max Results", description: "The maximum number of shipments to return. Default: 100", default: 100, optional: true, + min: 1, }, @@ offset: { type: "integer", label: "Offset", description: "The offset to start from. Default: 0", default: 0, optional: true, + min: 0, },components/trunkrs/actions/get-shipment/get-shipment.mjs (1)
18-25
: Straightforward fetch with clear summaryImplementation is clean. Consider aligning verb with other actions (“retrieved” vs “fetched”) for consistency, but this is optional.
Apply this diff if you prefer consistency with other actions’ phrasing:
- $.export("$summary", `Successfully fetched shipment ${this.trunkrsNr}.`); + $.export("$summary", `Successfully retrieved shipment ${this.trunkrsNr}.`);components/trunkrs/actions/list-time-slots/list-time-slots.mjs (2)
24-33
: Normalize postal codes before requestNormalizing improves match rates (esp. NL: remove spaces and uppercase). Safe when optional.
Apply this diff:
async run({ $ }) { const { data } = await this.trunkrs.listTimeSlots({ $, params: { country: this.country, - postalCode: this.postalCode, + postalCode: this.postalCode + ? this.postalCode.replace(/\s+/g, "").toUpperCase() + : undefined, }, }); $.export("$summary", `Successfully fetched ${data.length} time slots.`); return data; },
17-22
: Confirm API requirement for postalCodeIf Trunkrs requires
postalCode
for certain countries (likely NL/BE), consider making it required or clarifying in the description.I can update the prop to be conditionally required or enhance the description once we confirm the API rule. Want me to follow up?
components/trunkrs/common/constants.mjs (2)
1-10
: Optional: freeze arrays to prevent accidental mutationThese are constant option lists; freezing avoids accidental runtime changes.
Apply this diff:
-const COUNTRIES = [ +const COUNTRIES = Object.freeze([ { value: "NL", label: "Netherlands", }, { value: "BE", label: "Belgium", }, -]; +]);Repeat similarly for
WEBHOOK_EVENTS
andSHIPMENT_SORT_FIELDS
:-const WEBHOOK_EVENTS = [ +const WEBHOOK_EVENTS = Object.freeze([ "onStateUpdate", "onCreation", "onCancellation", "onReview", -]; +]); @@ -const SHIPMENT_SORT_FIELDS = [ +const SHIPMENT_SORT_FIELDS = Object.freeze([ "trunkrsNr", "-trunkrsNr", "recipient.name", "-recipient.name", "orderReference", "-orderReference", "sender.companyName", "-sender.companyName", "sender.name", "-sender.name", "timeSlot.id", "-timeSlot.id", "timeSlot.cutOffTime", "-timeSlot.cutOffTime", "state.code", "-state.code", "state.reasonCode", "-state.reasonCode", "state.timeStamp", "-state.timeStamp", "service", "-service", -]; +]);
44-48
: Add named exports for ergonomics and tree-shakingKeeping the default export is fine; adding named exports improves DX.
Apply this diff:
+export { COUNTRIES, WEBHOOK_EVENTS, SHIPMENT_SORT_FIELDS }; export default { COUNTRIES, WEBHOOK_EVENTS, SHIPMENT_SORT_FIELDS, };
components/trunkrs/sources/common/base-webhook.mjs (3)
12-20
: Confirm webhook payload shape and fix “header” vs “headers”.Trunkrs webhook creation commonly expects a headers object key named “headers”. Using “header” may be ignored. Also consider passing minimal headers only when needed.
Apply this diff if docs confirm “headers”:
- const { data } = await this.trunkrs.createWebhook({ + const { data } = await this.trunkrs.createWebhook({ data: { url: this.http.endpoint, - header: {}, + headers: {}, event: this.getEvent(), }, });
21-28
: Clear stored webhook ID after successful deletion.Avoid leaving stale
hookId
in the DB after deactivation.async deactivate() { const hookId = this._getHookId(); if (hookId) { await this.trunkrs.deleteWebhook({ webhookId: hookId, }); + this._setHookId(null); } },
48-55
: Optionally acknowledge HTTP requests and surface signature verification.If Trunkrs expects a 2xx quickly, explicitly respond to the webhook to decouple emit latency from the HTTP response. If signatures are supported, verify them before emitting.
async run(event) { const { body } = event; if (!body) { - return; + // 204 No Content when body is absent + this.http.respond({ status: 204 }); + return; } + // Optional: verify signatures here if Trunkrs delivers any const meta = this.generateMeta(body); this.$emit(body, meta); + this.http.respond({ status: 200 }); },components/trunkrs/actions/create-shipment/create-shipment.mjs (2)
79-87
: Weight unit options OK; consider documenting default/expectations.The options look right. Consider clarifying expected precision or max weight per parcel if Trunkrs enforces limits.
103-112
: Verify service enum values with API.Ensure
"SAME_DAY"
and"SAME_DAY_FROZEN_FOOD"
exactly match Trunkrs’ accepted values (including case). If there are more, consider dynamic options.components/trunkrs/trunkrs.app.mjs (3)
31-47
: Guard timeslot options on missing inputs and handle empty responses safely.Avoid unnecessary API calls when
country
orpostalCode
are not set, and handle undefineddata
.async options({ country, postalCode, }) { - const { data } = await this.listTimeSlots({ + if (!country || !postalCode) return []; + const { data } = await this.listTimeSlots({ params: { country, postalCode, }, }); - return data.map(({ + return (data || []).map(({ id, merchant, deliveryWindow, }) => ({ label: `${merchant.name} - ${deliveryWindow.start} - ${deliveryWindow.end}`, value: id, }) ); },
56-58
: Normalize base URL to avoid double slashes.If
environment
ends with/
, concatenation yields//api/v2
. Normalize for robustness._baseUrl() { - return `${this.$auth.environment}/api/v2`; + const base = String(this.$auth.environment || "").replace(/\/+$/, ""); + return `${base}/api/v2`; },
108-113
: Verify timeslots path.Double-check whether the endpoint is
/timeslots
or/time-slots
(or a different path). Adjust if needed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (18)
components/trunkrs/actions/cancel-shipment/cancel-shipment.mjs
(1 hunks)components/trunkrs/actions/create-shipment/create-shipment.mjs
(1 hunks)components/trunkrs/actions/get-shipment-state/get-shipment-state.mjs
(1 hunks)components/trunkrs/actions/get-shipment/get-shipment.mjs
(1 hunks)components/trunkrs/actions/list-shipments/list-shipments.mjs
(1 hunks)components/trunkrs/actions/list-time-slots/list-time-slots.mjs
(1 hunks)components/trunkrs/common/constants.mjs
(1 hunks)components/trunkrs/package.json
(2 hunks)components/trunkrs/sources/common/base-webhook.mjs
(1 hunks)components/trunkrs/sources/new-shipment-created/new-shipment-created.mjs
(1 hunks)components/trunkrs/sources/new-shipment-created/test-event.mjs
(1 hunks)components/trunkrs/sources/shipment-cancelled/shipment-cancelled.mjs
(1 hunks)components/trunkrs/sources/shipment-cancelled/test-event.mjs
(1 hunks)components/trunkrs/sources/shipment-reviewed/shipment-reviewed.mjs
(1 hunks)components/trunkrs/sources/shipment-reviewed/test-event.mjs
(1 hunks)components/trunkrs/sources/shipment-state-updated/shipment-state-updated.mjs
(1 hunks)components/trunkrs/sources/shipment-state-updated/test-event.mjs
(1 hunks)components/trunkrs/trunkrs.app.mjs
(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-07-24T02:06:47.016Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Applied to files:
components/trunkrs/sources/new-shipment-created/new-shipment-created.mjs
components/trunkrs/sources/shipment-reviewed/shipment-reviewed.mjs
components/trunkrs/sources/shipment-state-updated/shipment-state-updated.mjs
components/trunkrs/sources/shipment-cancelled/shipment-cancelled.mjs
components/trunkrs/sources/common/base-webhook.mjs
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
PR: PipedreamHQ/pipedream#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/trunkrs/package.json
⏰ 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: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (21)
components/trunkrs/package.json (3)
3-3
: Semver bump to 0.1.0 looks appropriate for new public components.
Minor version bump matches the introduction of new actions/sources without breaking existing users.
5-5
: Themain
entry resolves correctlyThe file
components/trunkrs/trunkrs.app.mjs
is present and matches themain
field in package.json, so module resolution will succeed. No further changes are needed.
15-17
: Dependency & Version Check Complete
We confirmed that
components/trunkrs/package.json
specifies
"@pipedream/platform": "^3.1.0"
and that this dependency is actually imported in your code:
- In
components/trunkrs/trunkrs.app.mjs
(line 1)
import { axios } from "@pipedream/platform";
- In
components/trunkrs/sources/common/base-webhook.mjs
(line 2)
import { ConfigurationError } from "@pipedream/platform";
Version
^3.1.0
aligns with several other recently updated components in the monorepo (for example,channable
,changes_page
,buy_me_a_coffee
, etc.) and there’s no requirement to bump or downgrade it here.Everything checks out—no further action required.
components/trunkrs/sources/new-shipment-created/test-event.mjs (1)
1-10
: Sample payload shape LGTM.
Static example is concise and representative for sampleEmit.components/trunkrs/sources/shipment-reviewed/test-event.mjs (1)
1-10
: Sample payload shape LGTM.
Matches pattern used across other sources.components/trunkrs/sources/shipment-state-updated/test-event.mjs (1)
1-10
: LGTM overall; consistent with other test events.
Structure aligns with the others; good for sampleEmit.components/trunkrs/sources/shipment-cancelled/shipment-cancelled.mjs (2)
4-18
: Solid extension of the webhook base; getEvent implemented per design.Extends the common webhook correctly and implements getEvent(), matching the “abstract base” pattern from common. Looks consistent with other sources.
11-16
: All event names are correctly aligned and consumed
Verified that components/trunkrs/common/constants.mjs exports “onCancellation” in WEBHOOK_EVENTS, each source’s getEvent() returns the exact matching string (including shipment-cancelled’s “onCancellation”), and base-webhook.mjs uses this.getEvent() to set the webhook’s event field and summary. No further changes needed.components/trunkrs/actions/get-shipment-state/get-shipment-state.mjs (2)
3-17
: Props definition looks correct and follows app propDefinition pattern.Using the app’s trunkrsNr propDefinition is consistent with the platform’s conventions.
18-25
: No action needed:getShipmentState
return shape andtrunkrsNr
propDefinition are correctBoth the API method and the action’s prop definition have been verified:
- In
components/trunkrs/trunkrs.app.mjs
, thegetShipmentState
method is implemented as:wheregetShipmentState({ trunkrsNr, ...opts }) { return this._makeRequest({ path: `/shipments/${trunkrsNr}/status`, ...opts, }); }_makeRequest
delegates to the platform’saxios($, …)
call, supplying the full response object (which includes adata
field).- In
components/trunkrs/actions/get-shipment-state/get-shipment-state.mjs
, the action’sprops
include:andtrunkrsNr: { propDefinition: [trunkrs, "trunkrsNr"], },trunkrs.app.mjs
exports a correspondingpropDefinitions.trunkrsNr
.Since the action destructures
const { data } = await this.trunkrs.getShipmentState(…)
and returnsdata
, and thetrunkrsNr
prop is properly defined, no changes are required here.components/trunkrs/sources/shipment-state-updated/shipment-state-updated.mjs (1)
4-18
: Good parity with other webhook sources; aligns with the base’s extension model.Straightforward and consistent with the pattern used across the Trunkrs sources.
components/trunkrs/sources/shipment-reviewed/shipment-reviewed.mjs (1)
4-18
: Pattern is consistent and readable; getEvent override is in the right place.Matches the shared webhook scaffolding and keeps the surface minimal.
components/trunkrs/sources/new-shipment-created/new-shipment-created.mjs (1)
4-18
: Looks good; mirrors the other Trunkrs webhook sources cleanly.Clear metadata, minimal method override, and proper sampleEmit wiring.
components/trunkrs/actions/cancel-shipment/cancel-shipment.mjs (1)
9-17
: Props wiring looks correct and consistent with app propDefinitionsUsing the
trunkrsNr
propDefinition from the app is aligned with other actions and keeps inputs consistent.components/trunkrs/actions/list-shipments/list-shipments.mjs (2)
45-51
: LGTM on iteration and return shapeStreaming via
for await
over the paginator is clear, and the summary reflects the bounded result size bymaxResults
.
32-43
: No action needed:paginate
already handles default limit and offsetsThe
paginate
implementation incomponents/trunkrs/trunkrs.app.mjs
injectslimit: DEFAULT_LIMIT
(whereDEFAULT_LIMIT = 100
) into every request and inside its loop advances the offset by that same limit (args.params.offset += args.params.limit
). Therefore, explicitly passinglimit: this.trunkrs.DEFAULT_LIMIT
in thelist-shipments
action is redundant, and offset handling is already correct.components/trunkrs/actions/get-shipment/get-shipment.mjs (1)
9-17
: Props wiring is consistent and reusableUsing the shared
trunkrsNr
propDefinition keeps UX consistent across actions.components/trunkrs/common/constants.mjs (1)
19-42
: Verify Trunkrs API sort fieldsThe values in SHIPMENT_SORT_FIELDS are forwarded unchanged as the
sort
query parameter to the List Shipments endpoint. Please confirm against the official Trunkrs API documentation which keys are accepted and remove any unsupported fields (especially nested paths) to avoid 400 errors.• components/trunkrs/common/constants.mjs (lines 19–42)
• components/trunkrs/actions/list-shipments/list-shipments.mjs – sort prop (lines 12–17) and API call (line 38)components/trunkrs/sources/common/base-webhook.mjs (1)
44-46
: Good: enforce subclass implementation contract.Throwing
ConfigurationError
is appropriate to require concrete sources to implementgetEvent()
.components/trunkrs/actions/create-shipment/create-shipment.mjs (1)
114-147
: I’ve initiated a search for all occurrences ofcreateShipment
to locate its definition and verify the expected payload shape. I’ll await the results and then continue validation.components/trunkrs/trunkrs.app.mjs (1)
70-76
: Webhook helpers look good.The create/delete webhook helpers align with the base webhook usage.
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.
LGTM!
Resolves #18049
Summary by CodeRabbit