@nitida/asset-client 0.18.0 → 0.18.1

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.
package/src/transform.ts CHANGED
@@ -18,7 +18,7 @@
18
18
  * request's Accept header.
19
19
  */
20
20
 
21
- import { assertPublic, type VisibilityHint } from "./access";
21
+ import { assertPublic, assertSha, type VisibilityHint } from "./access";
22
22
  import type { AssetDTO } from "./index";
23
23
  import { getCdnBase } from "./index";
24
24
 
@@ -231,6 +231,7 @@ export function getVideoTransformUrl(
231
231
  asset: Pick<AssetDTO, "sha"> & VisibilityHint,
232
232
  opts: TransformOptions,
233
233
  ): string | null {
234
+ assertSha(asset, "getVideoTransformUrl");
234
235
  assertPublic(
235
236
  asset,
236
237
  "getVideoTransformUrl",
@@ -304,6 +305,7 @@ export function getHlsStreamingUrl(
304
305
  asset: Pick<AssetDTO, "sha"> & VisibilityHint,
305
306
  opts: Omit<TransformOptions, "format"> = {},
306
307
  ): string {
308
+ assertSha(asset, "getHlsStreamingUrl");
307
309
  assertPublic(
308
310
  asset,
309
311
  "getHlsStreamingUrl",
@@ -336,6 +338,7 @@ export function getTransformUrl(
336
338
  asset: Pick<AssetDTO, "sha"> & VisibilityHint,
337
339
  opts: TransformOptions,
338
340
  ): string | null {
341
+ assertSha(asset, "getTransformUrl");
339
342
  assertPublic(
340
343
  asset,
341
344
  "getTransformUrl",
@@ -366,6 +369,7 @@ export function getSignedTransformUrl(
366
369
  // where a backend developer holding a signing key and a private asset ends
367
370
  // up — so without this, the same call site throws when unsigned and returns
368
371
  // a doomed URL when signed, which is the worst of both.
372
+ assertSha(asset, "getSignedTransformUrl");
369
373
  assertPublic(
370
374
  asset,
371
375
  "getSignedTransformUrl",
@@ -438,6 +442,7 @@ export function getTransformSrcSet(
438
442
  widths: number[],
439
443
  extraOpts: Omit<TransformOptions, "width"> = {},
440
444
  ): string {
445
+ assertSha(asset, "getTransformSrcSet");
441
446
  assertPublic(
442
447
  asset,
443
448
  "getTransformSrcSet",