Add webhook migration support#185
Conversation
Greptile SummaryThis PR adds webhook as a migratable resource, implementing both the source export (via
Confidence Score: 5/5Safe to merge; the changes are a well-scoped addition that mirrors the established ProjectVariable migration pattern throughout. The webhook migration is a faithful extension of the existing ProjectVariable pattern: source pagination, destination deduplication, and dbForPlatform writes are all consistent with the surrounding code. The deliberate signatureKey regeneration is correctly documented and mirrors Appwrite's own createWebhook behavior. No functional regressions are introduced in shared code paths. No files require special attention. Important Files Changed
Reviews (4): Last reviewed commit: "Merge remote-tracking branch 'origin/add..." | Re-trigger Greptile |
| $existing = $this->dbForPlatform->findOne('webhooks', [ | ||
| Query::equal('projectInternalId', [$this->projectInternalId]), | ||
| Query::equal('name', [$resource->getWebhookName()]), | ||
| ]); |
There was a problem hiding this comment.
Name-only dedup silently drops duplicate-named webhooks
The idempotency check matches on projectInternalId + name, but Appwrite does not enforce unique webhook names within a project. If the source project has two webhooks sharing the same name (e.g. "My Webhook") pointing to different URLs, the second one is silently skipped with "Webhook already exists" — resulting in undetected data loss. Adding url to the dedup query would distinguish same-named webhooks and avoid the false positive.
c040472 to
3376bed
Compare
- Resource::TYPE_WEBHOOK joins project-variable under the Settings group. - Source uses Appwrite SDK Webhooks::list() (separate service from Project) with cursor pagination. - Destination writes to dbForPlatform.webhooks matching upstream createWebhook payload. Signing secret regenerates on the destination because the SDK strips it from list responses (same caveat as api keys).
6bd9699 to
7fca422
Compare
…into add-webhook-migration # Conflicts: # src/Migration/Destinations/Appwrite.php # src/Migration/Sources/Appwrite.php
…into add-webhook-migration
Summary
Stacks on #184. Adds webhook as a migrable resource.
Webhooks::list()(separate service fromProject) with cursor pagination. Reports viareportIntegrations.dbForPlatform->createDocument('webhooks', ...)matching the upstreamWebhooks::Createpayload exactly.Notes
Resource::TYPE_WEBHOOK = 'webhook', placed inGROUP_INTEGRATIONS_RESOURCES.name,url,events,security(TLS),httpUser/httpPass(basic auth), andenabled.signatureKeyon list responses (Webhooks/XList.phpexplicitlyremoveAttribute('signatureKey')). Destination generates a freshbin2hex(random_bytes(64))to match upstream'screateWebhookdefault. Webhook receivers verifying signatures must be updated with the destination's new key.