commercetools-sdk-typescript icon indicating copy to clipboard operation
commercetools-sdk-typescript copied to clipboard

`source` not present in EventBridge subscription response type

Open Tohaker opened this issue 1 year ago • 5 comments

Describe the bug When creating or getting a subscription with sdk-client-v2 that targets EventBridge, the response has the source property under destination but the type omits this field.

To Reproduce Observe the types in https://github.com/commercetools/commercetools-sdk-typescript/blob/master/packages/platform-sdk/src/generated/models/subscription.ts#L254

Expected behavior The source field should be string | undefined

Screenshots/Code snippet

const subscription = await client.requestBuilder
    .subscriptions()
    .withKey({ key })
    .get()
    .execute();

  if (
    subscription.statusCode === 200 &&
    subscription.body.destination.type === "EventBridge"
  ) {
    // @ts-ignore The EventBridge destination has a source field
    return subscription.body.destination.source as string;
  }

Stack information (please complete the following information):

  • Node: 20
  • SDK: 2.5.0

Tohaker avatar Aug 05 '24 12:08 Tohaker