({
webhook: webhookRecord,
workflow,
requestId,
strict,
}: DeleteSubscriptionContext)
| 147 | }, |
| 148 | |
| 149 | async deleteSubscription({ |
| 150 | webhook: webhookRecord, |
| 151 | workflow, |
| 152 | requestId, |
| 153 | strict, |
| 154 | }: DeleteSubscriptionContext): Promise<void> { |
| 155 | try { |
| 156 | const config = getProviderConfig(webhookRecord) |
| 157 | const siteId = config.siteId as string | undefined |
| 158 | const externalId = config.externalId as string | undefined |
| 159 | |
| 160 | if (!siteId) { |
| 161 | logger.warn( |
| 162 | `[${requestId}] Missing siteId for Webflow webhook deletion ${webhookRecord.id}, skipping cleanup` |
| 163 | ) |
| 164 | if (strict) throw new Error('Missing Webflow siteId for webhook deletion') |
| 165 | return |
| 166 | } |
| 167 | |
| 168 | if (!externalId) { |
| 169 | logger.warn( |
| 170 | `[${requestId}] Missing externalId for Webflow webhook deletion ${webhookRecord.id}, skipping cleanup` |
| 171 | ) |
| 172 | if (strict) throw new Error('Missing Webflow externalId for webhook deletion') |
| 173 | return |
| 174 | } |
| 175 | |
| 176 | const siteIdValidation = validateAlphanumericId(siteId, 'siteId', 100) |
| 177 | if (!siteIdValidation.isValid) { |
| 178 | logger.warn(`[${requestId}] Invalid Webflow site ID format, skipping deletion`, { |
| 179 | webhookId: webhookRecord.id, |
| 180 | siteId: siteId.substring(0, 30), |
| 181 | }) |
| 182 | if (strict) throw new Error('Invalid Webflow siteId for webhook deletion') |
| 183 | return |
| 184 | } |
| 185 | |
| 186 | const webhookIdValidation = validateAlphanumericId(externalId, 'webhookId', 100) |
| 187 | if (!webhookIdValidation.isValid) { |
| 188 | logger.warn(`[${requestId}] Invalid Webflow webhook ID format, skipping deletion`, { |
| 189 | webhookId: webhookRecord.id, |
| 190 | externalId: externalId.substring(0, 30), |
| 191 | }) |
| 192 | if (strict) throw new Error('Invalid Webflow webhook ID for deletion') |
| 193 | return |
| 194 | } |
| 195 | |
| 196 | const credentialId = config.credentialId as string | undefined |
| 197 | if (!credentialId) { |
| 198 | logger.warn( |
| 199 | `[${requestId}] Missing credentialId for Webflow webhook deletion ${webhookRecord.id}` |
| 200 | ) |
| 201 | if (strict) throw new Error('Missing Webflow credentialId for webhook deletion') |
| 202 | return |
| 203 | } |
| 204 | |
| 205 | const credentialOwner = await getCredentialOwner(credentialId, requestId) |
| 206 | const accessToken = credentialOwner |
nothing calls this directly
no test coverage detected