@nitida/sdk 0.33.0 → 0.35.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.
package/dist/web.js CHANGED
@@ -32,6 +32,7 @@ import {
32
32
  configureSlotResolver as configureSlotResolver2,
33
33
  contrastRatio,
34
34
  deriveAccessKey,
35
+ deriveTransformKid,
35
36
  extractAssetSha,
36
37
  getAmbientGradient,
37
38
  getAssetDimensions,
@@ -55,6 +56,9 @@ import {
55
56
  invalidateSlotCache as invalidateSlotCache2,
56
57
  isRequestablePreset as isRequestablePreset2,
57
58
  iteratePaletteSwatches,
59
+ MAX_SIGNED_TRANSFORM_TTL_SECONDS,
60
+ MAX_SIGNED_URL_TTL_SECONDS,
61
+ MIN_SIGNED_TRANSFORM_TTL_SECONDS,
58
62
  PRESET_EXT,
59
63
  PRESET_LONG,
60
64
  PRESET_MAX_DIM,
@@ -70,7 +74,8 @@ import {
70
74
  signAccessUrl,
71
75
  signTransformUrl,
72
76
  TRANSFORM_WIDTHS,
73
- toRequestablePresets as toRequestablePresets2
77
+ toRequestablePresets as toRequestablePresets2,
78
+ transformMessage
74
79
  } from "@nitida/asset-client";
75
80
  function endpointUrl(opts, path, searchParams) {
76
81
  const endpoint = opts.endpoint.replace(/\/+$/, "");
@@ -600,7 +605,11 @@ var NitidaClient = class {
600
605
  "aq.transform({ sign: true }) requires `signingKey` in NitidaClientOptions. No signingKey on this client. It is returned ONCE, in the response that creates your project (POST /admin/projects \u2192 `signingKey`, next to the three API keys; the console shows it in the same panel). If you never saw one \u2014 projects created before 2026-08-23 were not handed it \u2014 ask the platform operator to rotate: with no signed URLs in flight that invalidates nothing and is free. If you DO have signed URLs circulating, ask for the current key instead, because rotating would kill them. Then pass it to the SDK constructor on a SERVER-side instance only."
601
606
  );
602
607
  }
603
- return getSignedTransformUrl(asset, opts, this.opts.signingKey) ?? Promise.resolve(this.urlFor(asset, "lg"));
608
+ return getSignedTransformUrl(asset, opts, this.opts.signingKey, {
609
+ expiresInSeconds: signOpts.expiresInSeconds,
610
+ tenantId: signOpts.tenantId ?? this.opts.tenantId,
611
+ nowSeconds: signOpts.nowSeconds
612
+ }) ?? Promise.resolve(this.urlFor(asset, "lg"));
604
613
  }
605
614
  transformSrcSet(asset, widths, extraOpts = {}, signOpts) {
606
615
  if (!signOpts?.sign) return getTransformSrcSet(asset, widths, extraOpts);
@@ -610,12 +619,18 @@ var NitidaClient = class {
610
619
  );
611
620
  }
612
621
  const key = this.opts.signingKey;
622
+ const sign = {
623
+ expiresInSeconds: signOpts.expiresInSeconds,
624
+ tenantId: signOpts.tenantId ?? this.opts.tenantId,
625
+ nowSeconds: signOpts.nowSeconds
626
+ };
613
627
  return Promise.all(
614
628
  widths.map(async (w) => {
615
629
  const signed = await getSignedTransformUrl(
616
630
  asset,
617
631
  { ...extraOpts, width: w },
618
- key
632
+ key,
633
+ sign
619
634
  );
620
635
  return signed ? `${signed} ${w}w` : null;
621
636
  })
@@ -1015,6 +1030,9 @@ async function compressImages(files, opts = {}) {
1015
1030
  }
1016
1031
  export {
1017
1032
  DEFAULT_COMPRESSION_OPTIONS,
1033
+ MAX_SIGNED_TRANSFORM_TTL_SECONDS,
1034
+ MAX_SIGNED_URL_TTL_SECONDS,
1035
+ MIN_SIGNED_TRANSFORM_TTL_SECONDS,
1018
1036
  NitidaClient2 as NitidaClient,
1019
1037
  PRESET_EXT,
1020
1038
  PRESET_LONG,
@@ -1032,6 +1050,7 @@ export {
1032
1050
  configureSlotResolver2 as configureSlotResolver,
1033
1051
  contrastRatio,
1034
1052
  deriveAccessKey,
1053
+ deriveTransformKid,
1035
1054
  extractAssetSha,
1036
1055
  getAmbientGradient,
1037
1056
  getAssetDimensions,
@@ -1066,6 +1085,7 @@ export {
1066
1085
  setTenantId2 as setTenantId,
1067
1086
  signAccessUrl,
1068
1087
  signTransformUrl,
1069
- toRequestablePresets2 as toRequestablePresets
1088
+ toRequestablePresets2 as toRequestablePresets,
1089
+ transformMessage
1070
1090
  };
1071
1091
  //# sourceMappingURL=web.js.map