|
1 | 1 | /* eslint-disable @typescript-eslint/no-non-null-assertion */ |
2 | 2 |
|
3 | | -import {BaseConfigType, MAX_EXTENSION_HANDLE_LENGTH} from './schemas.js' |
| 3 | +import {BaseConfigType, MAX_EXTENSION_HANDLE_LENGTH, MAX_UID_LENGTH} from './schemas.js' |
4 | 4 | import {FunctionConfigType} from './specifications/function.js' |
5 | 5 | import {ExtensionFeature, ExtensionSpecification} from './specification.js' |
6 | 6 | import {SingleWebhookSubscriptionType} from './specifications/app_config_webhook_schemas/webhooks_schema.js' |
@@ -508,7 +508,19 @@ export class ExtensionInstance<TConfiguration extends BaseConfigType = BaseConfi |
508 | 508 | case 'uuid': |
509 | 509 | return this.configuration.uid ?? nonRandomUUID(this.handle) |
510 | 510 | case 'dynamic': |
511 | | - return nonRandomUUID(this.handle) |
| 511 | + // NOTE: This is a temporary special case for webhook subscriptions. |
| 512 | + // We're directly checking for webhook properties and casting the configuration |
| 513 | + // instead of using a proper dynamic strategy implementation. |
| 514 | + // To remove this special case: |
| 515 | + // 1. Implement a proper dynamic UID strategy for webhooks in the server-side specification |
| 516 | + // 2. Update the CLI to use that strategy instead of this hardcoded logic |
| 517 | + // Related issues: PR #559094 in old Core repo |
| 518 | + if ('topic' in this.configuration && 'uri' in this.configuration) { |
| 519 | + const subscription = this.configuration as unknown as SingleWebhookSubscriptionType |
| 520 | + return `${subscription.topic}::${subscription.filter}::${subscription.uri}`.substring(0, MAX_UID_LENGTH) |
| 521 | + } else { |
| 522 | + return nonRandomUUID(JSON.stringify(this.configuration)) |
| 523 | + } |
512 | 524 | } |
513 | 525 | } |
514 | 526 | } |
|
0 commit comments