@financial-times/cp-content-pipeline-schema 3.5.1 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,8 +11,7 @@ import {
11
11
  validLiteralUnionValue,
12
12
  } from '../resolvers/literal-union'
13
13
  import { ImageFormat, ImageType } from '../resolvers/scalars'
14
- import isError from '../helpers/isError'
15
- import { BaseError, OperationalError } from '@dotcom-reliability-kit/errors'
14
+ import { BaseError } from '@dotcom-reliability-kit/errors'
16
15
  import type { ImageSource } from '../generated'
17
16
 
18
17
  export type ImageSourceArgs = {
@@ -126,7 +125,7 @@ export class CAPIImage implements Image {
126
125
  args.maxDpr || Infinity,
127
126
  Math.floor(dimensions.width / maxAllowedWidth)
128
127
  )
129
- : 1
128
+ : 2
130
129
 
131
130
  const resolutions = [...Array(maxDpr + 1).keys()].slice(1)
132
131
 
@@ -158,40 +157,17 @@ export class CAPIImage implements Image {
158
157
  }
159
158
  }
160
159
 
161
- // HACK:KB:20241029 graphics don't publish pixelWidth/pixelHeight due to a
162
- // known issue in Spark. we want to avoid calling Image Service to improve
163
- // performance. skip calling Image Service for graphics for the time being
164
- // https://financialtimes.slack.com/archives/C02NXHEEN7J/p1729770129991129
165
- if(this.type() === 'graphic') {
166
- this.context.logger.warn({
167
- event: 'SKIPPING_GRAPHICS_DIMENSIONS',
168
- message: 'Not calling Image Service to get graphics dimensions',
169
- url: this.capiImage.binaryUrl
170
- })
171
-
172
- return null
173
- }
174
-
175
- try {
176
- const imageMetadata = await this.#dataSources.origami.getImageMetadata(
177
- this.capiImage.binaryUrl
178
- )
179
- return imageMetadata
180
- } catch (error) {
181
- if (isError(error)) {
182
- this.context.logger.warn({
183
- event: 'RECOVERABLE_ERROR',
184
- error: new OperationalError({
185
- code: 'IMAGE_DIMENSIONS_ERROR',
186
- message: `Failed to get dimensions for ${this.capiImage.binaryUrl}`,
187
- url: this.capiImage.binaryUrl,
188
- cause: error,
189
- }),
190
- })
191
- }
160
+ // HACK:KB:20241029 graphics and images in layouts don't have pixelWidth/
161
+ // pixelHeight because of reasons. we want to avoid calling Image Service
162
+ // to improve performance. skip calling Image Service for the time being
163
+ this.context.logger.warn({
164
+ event: 'SKIPPING_IMAGE_DIMENSIONS',
165
+ message: 'Not calling Image Service to get graphics dimensions',
166
+ url: this.capiImage.binaryUrl,
167
+ type: this.type(),
168
+ })
192
169
 
193
- return null
194
- }
170
+ return null
195
171
  }
196
172
 
197
173
  credit() {