Skip to content

Conversation

vikaskumr
Copy link
Contributor

@vikaskumr vikaskumr commented Oct 1, 2025

We have noticed there are more options available in delivery and management function context, this PR make sure all the necessary types are exposed in the handlers for the user to use it in any way.

Function Context for CDA/CPA

  "event": {
    "type": "resources.lookup",
    "resourceType": "MockShop:Product",
    "lookupBy": { "urns": ["gid://shopify/Product/7983602040854", "gid://shopify/Product/7983595388950"] },
    "limit": 1000
  },
  "context": {
    "spaceId": "f00h9rgirk2b",
    "environmentId": "6275f161-b2be-4cf2-ba5c-04f8ece63283",
    "environmentUuid": "6275f161-b2be-4cf2-ba5c-04f8ece63283",
    "requestId": "e0a9ae3f-0b0e-4b8e-ad24-8e2ac4d6df93",
    "organizationId": "00y2g65dGhRIi6Xu9X3UGy",
    "originalRequest": {
      "headers": {
        "x-contentful-request-id": "e0a9ae3f-0b0e-4b8e-ad24-8e2ac4d6df93",
        "x-contentful-host": "cdn.contentful.com",
        "accept": "*/*",
        "accept-encoding": "gzip, br",
        "user-agent": "insomnia/11.4.0",
        "x-forwarded-for": "213.10.127.95",
        "contentful-api": "cda",
        "cf-environment-id": "master",
        "cf-organization-id": "00y2g65dGhRIi6Xu9X3UGy",
        "cf-space-id": "f00h9rgirk2b"
      }
    },
    "appInstallationParameters": {},
    "appDefinitionId": "3ieR63GAbivgOrLB79PVtA",
    "appFunctionId": "MockShopTutorial"
  }
}

CMA

{
  "event": {
    "type": "resources.lookup",
    "resourceType": "MockShop:Product",
    "lookupBy": { "urns": ["gid://shopify/Product/7983595487254"] },
    "locale": "en-US",
    "limit": 1
  },
  "context": {
    "organizationId": "5de3aDkXai1FZF2bKx80Ka",
    "spaceId": "at18i23hyhjo",
    "environmentId": "master",
    "environmentUuid": "543d74b0-5614-4c54-81f5-62b1f239bd3b",
    "requestId": "94ed1d3b-9da5-4abc-be39-5e7f18470e00",
    "originalRequest": {
      "headers": {
        "accept": "application/json, text/plain, */*",
        "accept-encoding": "gzip",
        "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
        "x-forwarded-for": "213.10.127.95"
      }
    },
    "appInstallationParameters": {},
    "appToken": "<REDACTED>",
    "cmaHost": "api.flinkly.com",
    "uploadHost": "upload.flinkly.com",
    "appFunctionId": "MockShopTutorial",
    "appDefinitionId": "5xcs2SbTiKKLTYZZaz439I",
    "cma": {
      ...
    },
    "cmaClientOptions": {
      "hostUpload": "upload.flinkly.com",
      "host": "api.flinkly.com",
      "accessToken": "<REDACTED>",
      "adapter": "fetch"
    }
  }
}

@vikaskumr vikaskumr requested a review from a team as a code owner October 1, 2025 12:49
@vikaskumr vikaskumr changed the title fix: type for resource look up fix: type for resource look up[CNX-271] Oct 1, 2025
}
[FunctionTypeEnum.ResourcesLookup]: {
event: ResourcesLookupRequest
context: FunctionEventManagementContext<P> & FunctionEventDeliveryContext<P>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be | (see https://github.com/contentful/apps/pull/10142/files#r2395026825)

Suggested change
context: FunctionEventManagementContext<P> & FunctionEventDeliveryContext<P>
context: FunctionEventManagementContext<P> | FunctionEventDeliveryContext<P>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, agreed already has the changes locally didn't pushed because issue is still the same, check comment here.

@vikaskumr vikaskumr closed this Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants