@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/AGENTS.md +26 -0
- package/README.md +63 -11
- package/dist/index.d.ts +5 -5
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +24 -4
- package/dist/server.js.map +1 -1
- package/dist/web.d.ts +1 -1
- package/dist/web.js +24 -4
- package/dist/web.js.map +1 -1
- package/package.json +2 -2
- package/skills/nitida-sdk/SKILL.md +128 -6
- package/src/index.ts +38 -23
- package/src/server/index.ts +7 -0
- package/src/web/index.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitida/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "nitida — the media SDK: browser and mobile upload with resume, client-side compression, on-the-fly transforms behind a CDN, video transcode, HLS ladders and AI proxies. Multi-tenant.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"react": ">=18",
|
|
76
|
-
"@nitida/asset-client": "^0.
|
|
76
|
+
"@nitida/asset-client": "^0.23.0",
|
|
77
77
|
"@nitida/asset-compressor-web": "^0.6.1",
|
|
78
78
|
"@nitida/asset-compressor-native": "^0.2.1"
|
|
79
79
|
},
|
|
@@ -94,7 +94,16 @@ const COVER_CROP = { fit: "cover", gravity: "auto" } as const;
|
|
|
94
94
|
|
|
95
95
|
Output URL shape: `https://8ok.uk/t/format=webp,width=640/<sha16>.webp`.
|
|
96
96
|
|
|
97
|
-
⚠️ **Widths MUST be on the unsigned ladder** `TRANSFORM_WIDTHS`
|
|
97
|
+
⚠️ **Widths MUST be on the unsigned ladder** `TRANSFORM_WIDTHS` — generated from the source, do not
|
|
98
|
+
edit by hand:
|
|
99
|
+
|
|
100
|
+
<!-- BEGIN GENERATED: transform-widths · bun run gen:docs -->
|
|
101
|
+
`96, 128, 160, 180, 240, 256, 320, 400, 480, 600, 640, 800, 960, 1080, 1200, 1280, 1440, 1600, 1920, 2560, 3840` — 21 widths.
|
|
102
|
+
<!-- END GENERATED: transform-widths -->
|
|
103
|
+
|
|
104
|
+
Any other width → **HTTP 400** at the edge (DoS guard). The `TransformWidth` type makes an off-ladder
|
|
105
|
+
width a compile error — import the type, don't hardcode magic numbers. (For a one-off custom width
|
|
106
|
+
you'd need signed URLs; not used here.)
|
|
98
107
|
|
|
99
108
|
⚠️ **`getTransformSrcSet` is NOT protected by that type.** Its parameter is `number[]` on purpose —
|
|
100
109
|
a responsive ladder may legitimately carry DPR widths — so `[641, 999]` compiles clean and fails in
|
|
@@ -206,6 +215,43 @@ Smaller **and** worse is generation loss, not a saving.
|
|
|
206
215
|
so there is no downscale in between to hide the first pass. At 640 and 1920
|
|
207
216
|
the laddered output is *heavier* too.
|
|
208
217
|
- **`["original"]`-only assets are unaffected** — one pass, always.
|
|
218
|
+
- **`quality: "auto"` is a NO-OP** — byte-for-byte identical to omitting the key.
|
|
219
|
+
Measured 2026-08-31 on a production laddered asset at `width=1920`: both
|
|
220
|
+
answered **136 680 B, sha256 `3a9ba57d…`, `x-transform-source: original`**.
|
|
221
|
+
⇒ The whole option is unnecessary, which is why `TransformOptions.quality`
|
|
222
|
+
carries an `@deprecated` tag since `@nitida/asset-client` 0.23.0. Your editor
|
|
223
|
+
strikes it through; that is on purpose.
|
|
224
|
+
- **A second corpus, where there is not even a byte saving.** 5056 px
|
|
225
|
+
architectural renders (tenant `suenos-del-mar`, 2026-08-31), referenced
|
|
226
|
+
against `/t/format=png,width=W/` — the lossless auto path at the same width:
|
|
227
|
+
|
|
228
|
+
| width | pinned source | bytes | PSNR |
|
|
229
|
+
|---|---|---|---|
|
|
230
|
+
| 3840 | `xl` | **+7.2 %** | **−0.50 dB** |
|
|
231
|
+
| 1920 | `lg` | **+8.1 %** | **−0.64 dB** |
|
|
232
|
+
| 1280 | `md` | **+2.0 %** | **−0.85 dB** |
|
|
233
|
+
|
|
234
|
+
Heavier **and** worse, 3 of 3. The photograph corpus above at least came back
|
|
235
|
+
smaller — that is exactly what hid this for four months.
|
|
236
|
+
|
|
237
|
+
### ✅ The one-line check: `x-transform-source`
|
|
238
|
+
|
|
239
|
+
**Do not reason about which path you got — read it off the response.** The
|
|
240
|
+
header names the variant the edge actually decoded:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
curl -sI 'https://8ok.uk/t/format=webp,width=1920/<sha16>.webp' \
|
|
244
|
+
| grep -i x-transform-source
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
| it says | you got |
|
|
248
|
+
|---|---|
|
|
249
|
+
| `original` | **one** lossy pass ✅ |
|
|
250
|
+
| `md` / `lg` / `xl` / `sm` | **two** — a numeric `quality` is in your URL ✖ |
|
|
251
|
+
| `poster` | you asked `/t/` for a video sha; it transformed the poster frame |
|
|
252
|
+
|
|
253
|
+
Run it once per surface after a change. It costs nothing and it is the only
|
|
254
|
+
statement about compression that is not an inference.
|
|
209
255
|
|
|
210
256
|
### What running this recipe caught
|
|
211
257
|
|
|
@@ -602,7 +648,13 @@ await getPrivateTransformUrl(asset, { width: 1280 }, signingKey, { expiresInSeco
|
|
|
602
648
|
`"public"`, or a bare `{ sha }`, is never refused — and this is a DIFFERENT
|
|
603
649
|
rule from the missing-preset fallback below, which is about presets, not
|
|
604
650
|
privacy.
|
|
605
|
-
- **`exp` is mandatory
|
|
651
|
+
- **`exp` is mandatory and CAPPED at 7 days.** `expiresInSeconds` over that
|
|
652
|
+
throws in the SDK and 401s (`exp_too_far`) at the platform — an expiry that
|
|
653
|
+
never arrives is not an expiry. Revocation is *"within a minute"* (60 s TTL
|
|
654
|
+
at the edge).
|
|
655
|
+
- **⚠️ A signature does NOT widen the width ladder.** Off-ladder widths are 400
|
|
656
|
+
whether or not the URL is signed. Signing buys IDENTITY (which tenant asked,
|
|
657
|
+
until `exp`), which is what `strict_transforms` and `effect=genfill` need.
|
|
606
658
|
- **The signing key is a backend secret** — it mints URLs for every private
|
|
607
659
|
asset the tenant owns.
|
|
608
660
|
- **⭐ Where the signing key comes from: the response that CREATED your
|
|
@@ -610,10 +662,15 @@ await getPrivateTransformUrl(asset, { width: 1280 }, signingKey, { expiresInSeco
|
|
|
610
662
|
three API keys, and the console shows it in the same panel. Nothing else
|
|
611
663
|
hands it out — `GET /admin/projects/:code` does **not** include it. If it is
|
|
612
664
|
lost, the only endpoint that returns a key is
|
|
613
|
-
`POST /admin/projects/:code/rotate-signing-key`,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
665
|
+
`POST /admin/projects/:code/rotate-signing-key`, and it needs the
|
|
666
|
+
system-scope key the platform operator holds.
|
|
667
|
+
- **⭐ Rotating no longer kills your `/t/` URLs.** Since `@nitida/sdk` 0.31.0 a
|
|
668
|
+
signed transform URL carries `kid` (which key signed it) and `exp`, and the
|
|
669
|
+
OUTGOING key keeps verifying for 14 days after a rotation. ⚠️ The exception
|
|
670
|
+
is `/a/…` ACCESS URLs: their key is derived from `signing_key` with no `kid`,
|
|
671
|
+
so those 401 immediately on rotation. They are minted per view with
|
|
672
|
+
minute-scale expiries, so the burst heals itself — but rotate at a quiet hour
|
|
673
|
+
if the tenant serves private assets.
|
|
617
674
|
- **⭐ Already have a project and never saw a signing key?** Then you never got
|
|
618
675
|
one — projects created before 2026-08-23 were not handed it, and no endpoint
|
|
619
676
|
shows you the current one. **If you have not signed any URLs yet, ask us to
|
|
@@ -622,6 +679,69 @@ await getPrivateTransformUrl(asset, { width: 1280 }, signingKey, { expiresInSeco
|
|
|
622
679
|
instead. This is the wall the T5 agent hit, and the sentence that was
|
|
623
680
|
missing.
|
|
624
681
|
|
|
682
|
+
## ⚠️ EXIF orientation — two dimension pairs, and mixing them stretches the photo
|
|
683
|
+
|
|
684
|
+
**A phone taking a portrait photo does not store portrait pixels.** It writes the
|
|
685
|
+
sensor buffer landscape and tags it `Orientation` 5–8 meaning "rotate before
|
|
686
|
+
showing". So every such file has **two** pairs, transposes of each other:
|
|
687
|
+
|
|
688
|
+
```
|
|
689
|
+
4032×3024 the STORED buffer (what a header parser reads)
|
|
690
|
+
3024×4032 what it DISPLAYS as (what every decoder hands you)
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
Use the **stored** pair only for orientation-invariant quantities — area, a
|
|
694
|
+
megapixel budget. Use the **displayed** pair for anything geometric: a resize
|
|
695
|
+
target, an aspect ratio, a layout box, a coordinate you denormalise.
|
|
696
|
+
|
|
697
|
+
**This exact confusion shipped twice, on both sides of the wire:**
|
|
698
|
+
|
|
699
|
+
| where | what happened | fixed |
|
|
700
|
+
|---|---|---|
|
|
701
|
+
| `@nitida/asset-compressor-web` 0.6.0–0.6.2 | resize target from the stored pair, fed to a decode that had already rotated ⇒ **1.78× stretch**, measured | **0.6.3** |
|
|
702
|
+
| `asset-manager` (server), until 2026-08-28 | recorded the stored pair as the asset's `w`/`h` while serving rotated variants ⇒ transposed aspect on the DTO | 2026-08-28 |
|
|
703
|
+
|
|
704
|
+
Needed all three, which is why it looked random: a parseable header
|
|
705
|
+
(**HEIC is immune** — the ISOBMFF box walk isn't implemented, so no dims, so no
|
|
706
|
+
forced resize), orientation **5–8**, and a long side **above** the box.
|
|
707
|
+
|
|
708
|
+
⇒ **Damage is pre-upload and unrecoverable.** The raw bucket faithfully stores the
|
|
709
|
+
already-stretched bytes. Affected photos must be re-uploaded from the original;
|
|
710
|
+
no backfill exists.
|
|
711
|
+
|
|
712
|
+
### The two traps, concretely
|
|
713
|
+
|
|
714
|
+
**Browser — `createImageBitmap` with BOTH resize axes does not preserve ratio.**
|
|
715
|
+
|
|
716
|
+
```ts
|
|
717
|
+
// 🔴 any disagreement with the decoded bitmap becomes a stretch
|
|
718
|
+
createImageBitmap(blob, { imageOrientation: "from-image", resizeWidth: w, resizeHeight: h })
|
|
719
|
+
// ✅ one axis: the spec derives the other, ratio survives BY CONSTRUCTION
|
|
720
|
+
createImageBitmap(blob, { imageOrientation: "from-image", resizeWidth: w })
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
**Node — `sharp(x).rotate().metadata()` does NOT apply the rotation.** `.rotate()`
|
|
724
|
+
queues an operation; `.metadata()` still reads the input. Measured, sharp 0.34.5:
|
|
725
|
+
|
|
726
|
+
```
|
|
727
|
+
sharp(buf).metadata() → 4032×3024, orientation 6
|
|
728
|
+
sharp(buf).rotate().metadata() → 4032×3024 ← the false idiom
|
|
729
|
+
sharp(buf).rotate().toBuffer() → info → 3024×4032 ← the truth
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
It read so plausibly it was written three times in one repo, once directly under
|
|
733
|
+
the comment *"Source dims (EXIF-rotated for correctness)"*. To get display dims:
|
|
734
|
+
transpose the raw pair yourself when `orientation` is 5–8, or measure the output
|
|
735
|
+
buffer.
|
|
736
|
+
|
|
737
|
+
**And the lesson that cost the most:** the stretch had been suspected once and
|
|
738
|
+
declared *"refuted with production data"* because storage held four distinct
|
|
739
|
+
aspect ratios — "a pipeline that forced a ratio would have produced ONE". It
|
|
740
|
+
never forced one ratio; it forced **each photo's own transpose**. Counting
|
|
741
|
+
distinct ratios could not detect it, so finding several was evidence of nothing.
|
|
742
|
+
**An invariant you cannot state is an invariant you cannot test** — compare
|
|
743
|
+
against the *displayed* ratio, or you are comparing stored ratios to each other.
|
|
744
|
+
|
|
625
745
|
## Two ways an image gets smaller, and only one of them is yours to call
|
|
626
746
|
|
|
627
747
|
This is the question every programmatic caller gets wrong, so it is stated flat:
|
|
@@ -696,6 +816,8 @@ needed. Reproduce there before debugging any of these by hand.
|
|
|
696
816
|
|
|
697
817
|
| Symptom | Cause |
|
|
698
818
|
|---|---|
|
|
819
|
+
| **a portrait photo comes back stretched wide**, and only some do | `@nitida/asset-compressor-web` **0.6.0–0.6.2**: stored (pre-EXIF) dims forced onto an already-rotated decode ⇒ 1.78×. Needs a parseable header (**HEIC immune**) + orientation 5–8 + long side above the box. **Fixed in 0.6.3**; pre-upload damage, so re-upload, don't repair — see §EXIF orientation |
|
|
820
|
+
| **`w`/`h` on the DTO disagree with the image you receive** | `asset-manager` older than 2026-08-28 recorded the stored pair for EXIF-rotated sources. The **variant** dims were always right — trust those until the asset is re-processed |
|
|
699
821
|
| **400** on an image URL | width not on `TRANSFORM_WIDTHS` ladder |
|
|
700
822
|
| **410** on a video `/t/` URL | that video has no `poster`. With one, `/t/` returns the poster as an image, never the video — use `getAssetUrl(...,'video')` |
|
|
701
823
|
| **404** on a video URL | decimal tenant prefix (`/10/v/`) instead of base36 (`/a/v/`) — call `setTenantId` + `getAssetUrl`. Tenant 12 → `/c/v/` |
|
package/src/index.ts
CHANGED
|
@@ -49,17 +49,20 @@ import {
|
|
|
49
49
|
hasPreset,
|
|
50
50
|
invalidateSlotCache,
|
|
51
51
|
isRequestablePreset,
|
|
52
|
+
type PrivateTransformOptions,
|
|
52
53
|
REQUESTABLE_PRESETS,
|
|
53
54
|
type RequestablePreset,
|
|
54
55
|
type ResolveSlotOptions,
|
|
55
56
|
resolveSlot,
|
|
56
57
|
resolveSlots,
|
|
57
58
|
type SignedTransformOptions,
|
|
59
|
+
type SignTransformOptions,
|
|
58
60
|
type SlotDTO,
|
|
59
61
|
type SlotResolution,
|
|
60
62
|
setCdnBase,
|
|
61
63
|
setTenantId,
|
|
62
64
|
type TransformOptions,
|
|
65
|
+
type TransformWidth,
|
|
63
66
|
toRequestablePresets,
|
|
64
67
|
type VariantEntryPreset,
|
|
65
68
|
type VariantPreset,
|
|
@@ -224,10 +227,12 @@ export type {
|
|
|
224
227
|
AssetVariant,
|
|
225
228
|
HlsRung,
|
|
226
229
|
PaletteSwatch,
|
|
230
|
+
PrivateTransformOptions,
|
|
227
231
|
RequestablePreset,
|
|
228
232
|
ResolveSlotOptions,
|
|
229
233
|
SignAccessOptions,
|
|
230
234
|
SignedTransformOptions,
|
|
235
|
+
SignTransformOptions,
|
|
231
236
|
SlotDTO,
|
|
232
237
|
SlotResolution,
|
|
233
238
|
TransformEffect,
|
|
@@ -249,6 +254,7 @@ export {
|
|
|
249
254
|
configureSlotResolver,
|
|
250
255
|
contrastRatio,
|
|
251
256
|
deriveAccessKey,
|
|
257
|
+
deriveTransformKid,
|
|
252
258
|
extractAssetSha,
|
|
253
259
|
getAmbientGradient,
|
|
254
260
|
getAssetDimensions,
|
|
@@ -272,6 +278,9 @@ export {
|
|
|
272
278
|
invalidateSlotCache,
|
|
273
279
|
isRequestablePreset,
|
|
274
280
|
iteratePaletteSwatches,
|
|
281
|
+
MAX_SIGNED_TRANSFORM_TTL_SECONDS,
|
|
282
|
+
MAX_SIGNED_URL_TTL_SECONDS,
|
|
283
|
+
MIN_SIGNED_TRANSFORM_TTL_SECONDS,
|
|
275
284
|
PRESET_EXT,
|
|
276
285
|
PRESET_LONG,
|
|
277
286
|
PRESET_MAX_DIM,
|
|
@@ -288,6 +297,7 @@ export {
|
|
|
288
297
|
signTransformUrl,
|
|
289
298
|
TRANSFORM_WIDTHS,
|
|
290
299
|
toRequestablePresets,
|
|
300
|
+
transformMessage,
|
|
291
301
|
} from "@nitida/asset-client";
|
|
292
302
|
|
|
293
303
|
// ---------------------------------------------------------------------------
|
|
@@ -1477,27 +1487,21 @@ export class NitidaClient {
|
|
|
1477
1487
|
*/
|
|
1478
1488
|
// Overload 1: no signing — synchronous, on-ladder width only (strict).
|
|
1479
1489
|
transform(asset: Pick<AssetDTO, "sha">, opts?: TransformOptions): string;
|
|
1480
|
-
// Overload 2: with { sign: true } — async; returns
|
|
1481
|
-
//
|
|
1482
|
-
//
|
|
1490
|
+
// Overload 2: with { sign: true, expiresInSeconds } — async; returns a
|
|
1491
|
+
// `?kid&exp&sig` URL. The width ladder is the SAME as unsigned: a signature
|
|
1492
|
+
// names the caller, it does not widen the image (doc blindaje WS-6).
|
|
1483
1493
|
transform(
|
|
1484
1494
|
asset: Pick<AssetDTO, "sha">,
|
|
1485
1495
|
opts: SignedTransformOptions,
|
|
1486
|
-
signOpts: { sign: true },
|
|
1496
|
+
signOpts: { sign: true } & SignTransformOptions,
|
|
1487
1497
|
): Promise<string>;
|
|
1488
1498
|
transform(
|
|
1489
1499
|
asset: Pick<AssetDTO, "sha">,
|
|
1490
1500
|
opts: SignedTransformOptions = {},
|
|
1491
|
-
signOpts?: { sign: true },
|
|
1501
|
+
signOpts?: { sign: true } & SignTransformOptions,
|
|
1492
1502
|
): string | Promise<string> {
|
|
1493
1503
|
if (!signOpts?.sign) {
|
|
1494
|
-
|
|
1495
|
-
// public call site, so an off-ladder width can't reach here through the
|
|
1496
|
-
// typed API — narrow back to TransformOptions for the strict builder.
|
|
1497
|
-
return (
|
|
1498
|
-
getTransformUrl(asset, opts as TransformOptions) ??
|
|
1499
|
-
this.urlFor(asset, "lg")
|
|
1500
|
-
);
|
|
1504
|
+
return getTransformUrl(asset, opts) ?? this.urlFor(asset, "lg");
|
|
1501
1505
|
}
|
|
1502
1506
|
if (!this.opts.signingKey) {
|
|
1503
1507
|
throw new Error(
|
|
@@ -1505,11 +1509,15 @@ export class NitidaClient {
|
|
|
1505
1509
|
"No signingKey on this client. It is returned ONCE, in the response that creates your project (POST /admin/projects → `signingKey`, next to the three API keys; the console shows it in the same panel). If you never saw one — projects created before 2026-08-23 were not handed it — 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.",
|
|
1506
1510
|
);
|
|
1507
1511
|
}
|
|
1508
|
-
//
|
|
1509
|
-
//
|
|
1512
|
+
// Empty opts → no transform DSL, fall back to the unsigned `lg` variant
|
|
1513
|
+
// URL. `tenantId` defaults to the one this client was constructed with,
|
|
1514
|
+
// because the tenant is part of the signed message.
|
|
1510
1515
|
return (
|
|
1511
|
-
getSignedTransformUrl(asset, opts, this.opts.signingKey
|
|
1512
|
-
|
|
1516
|
+
getSignedTransformUrl(asset, opts, this.opts.signingKey, {
|
|
1517
|
+
expiresInSeconds: signOpts.expiresInSeconds,
|
|
1518
|
+
tenantId: signOpts.tenantId ?? this.opts.tenantId,
|
|
1519
|
+
nowSeconds: signOpts.nowSeconds,
|
|
1520
|
+
}) ?? Promise.resolve(this.urlFor(asset, "lg"))
|
|
1513
1521
|
);
|
|
1514
1522
|
}
|
|
1515
1523
|
|
|
@@ -1527,15 +1535,15 @@ export class NitidaClient {
|
|
|
1527
1535
|
): string;
|
|
1528
1536
|
transformSrcSet(
|
|
1529
1537
|
asset: Pick<AssetDTO, "sha">,
|
|
1530
|
-
widths:
|
|
1538
|
+
widths: TransformWidth[],
|
|
1531
1539
|
extraOpts: Omit<TransformOptions, "width">,
|
|
1532
|
-
signOpts: { sign: true },
|
|
1540
|
+
signOpts: { sign: true } & SignTransformOptions,
|
|
1533
1541
|
): Promise<string>;
|
|
1534
1542
|
transformSrcSet(
|
|
1535
1543
|
asset: Pick<AssetDTO, "sha">,
|
|
1536
1544
|
widths: number[],
|
|
1537
1545
|
extraOpts: Omit<TransformOptions, "width"> = {},
|
|
1538
|
-
signOpts?: { sign: true },
|
|
1546
|
+
signOpts?: { sign: true } & SignTransformOptions,
|
|
1539
1547
|
): string | Promise<string> {
|
|
1540
1548
|
if (!signOpts?.sign) return getTransformSrcSet(asset, widths, extraOpts);
|
|
1541
1549
|
if (!this.opts.signingKey) {
|
|
@@ -1545,15 +1553,22 @@ export class NitidaClient {
|
|
|
1545
1553
|
);
|
|
1546
1554
|
}
|
|
1547
1555
|
const key = this.opts.signingKey;
|
|
1556
|
+
const sign = {
|
|
1557
|
+
expiresInSeconds: signOpts.expiresInSeconds,
|
|
1558
|
+
tenantId: signOpts.tenantId ?? this.opts.tenantId,
|
|
1559
|
+
nowSeconds: signOpts.nowSeconds,
|
|
1560
|
+
};
|
|
1548
1561
|
return Promise.all(
|
|
1549
1562
|
widths.map(async (w) => {
|
|
1550
|
-
//
|
|
1551
|
-
//
|
|
1552
|
-
//
|
|
1563
|
+
// ⚠️ The overload types `widths` as `TransformWidth[]` on the signed
|
|
1564
|
+
// path. Off-ladder widths 400 at the edge whether or not they are
|
|
1565
|
+
// signed (doc blindaje WS-6), so a signed srcSet full of custom widths
|
|
1566
|
+
// is a srcSet of 400s — the type says so at compile time now.
|
|
1553
1567
|
const signed = await getSignedTransformUrl(
|
|
1554
1568
|
asset,
|
|
1555
|
-
{ ...extraOpts, width: w },
|
|
1569
|
+
{ ...extraOpts, width: w as TransformWidth },
|
|
1556
1570
|
key,
|
|
1571
|
+
sign,
|
|
1557
1572
|
);
|
|
1558
1573
|
return signed ? `${signed} ${w}w` : null;
|
|
1559
1574
|
}),
|
package/src/server/index.ts
CHANGED
|
@@ -107,6 +107,7 @@ export {
|
|
|
107
107
|
configureSlotResolver,
|
|
108
108
|
contrastRatio,
|
|
109
109
|
deriveAccessKey,
|
|
110
|
+
deriveTransformKid,
|
|
110
111
|
extractAssetSha,
|
|
111
112
|
getAmbientGradient,
|
|
112
113
|
getAssetDimensions,
|
|
@@ -132,6 +133,9 @@ export {
|
|
|
132
133
|
isRequestablePreset,
|
|
133
134
|
isUniversallyPlayableAudio,
|
|
134
135
|
iteratePaletteSwatches,
|
|
136
|
+
MAX_SIGNED_TRANSFORM_TTL_SECONDS,
|
|
137
|
+
MAX_SIGNED_URL_TTL_SECONDS,
|
|
138
|
+
MIN_SIGNED_TRANSFORM_TTL_SECONDS,
|
|
135
139
|
mimeFromFileName,
|
|
136
140
|
type NitidaClientOptions,
|
|
137
141
|
type PaletteSwatch,
|
|
@@ -140,6 +144,7 @@ export {
|
|
|
140
144
|
PRESET_MAX_DIM,
|
|
141
145
|
PRESET_SHORT,
|
|
142
146
|
type PresignUploadUrlOptions,
|
|
147
|
+
type PrivateTransformOptions,
|
|
143
148
|
pickAmbientBackground,
|
|
144
149
|
REQUESTABLE_PRESETS,
|
|
145
150
|
type RegenerateResult,
|
|
@@ -150,6 +155,7 @@ export {
|
|
|
150
155
|
resolveSlots,
|
|
151
156
|
type SignAccessOptions,
|
|
152
157
|
type SignedTransformOptions,
|
|
158
|
+
type SignTransformOptions,
|
|
153
159
|
type SlotDTO,
|
|
154
160
|
type SlotHistoryEntry,
|
|
155
161
|
type SlotResolution,
|
|
@@ -166,6 +172,7 @@ export {
|
|
|
166
172
|
type TransformOptions,
|
|
167
173
|
type TransformWidth,
|
|
168
174
|
toRequestablePresets,
|
|
175
|
+
transformMessage,
|
|
169
176
|
type UploadOptions,
|
|
170
177
|
type UploadResult,
|
|
171
178
|
type UploadUrlResult,
|
package/src/web/index.ts
CHANGED
|
@@ -124,6 +124,7 @@ export {
|
|
|
124
124
|
configureSlotResolver,
|
|
125
125
|
contrastRatio,
|
|
126
126
|
deriveAccessKey,
|
|
127
|
+
deriveTransformKid,
|
|
127
128
|
extractAssetSha,
|
|
128
129
|
getAmbientGradient,
|
|
129
130
|
getAssetDimensions,
|
|
@@ -149,6 +150,9 @@ export {
|
|
|
149
150
|
isRequestablePreset,
|
|
150
151
|
isUniversallyPlayableAudio,
|
|
151
152
|
iteratePaletteSwatches,
|
|
153
|
+
MAX_SIGNED_TRANSFORM_TTL_SECONDS,
|
|
154
|
+
MAX_SIGNED_URL_TTL_SECONDS,
|
|
155
|
+
MIN_SIGNED_TRANSFORM_TTL_SECONDS,
|
|
152
156
|
mimeFromFileName,
|
|
153
157
|
type PaletteSwatch,
|
|
154
158
|
PRESET_EXT,
|
|
@@ -156,6 +160,7 @@ export {
|
|
|
156
160
|
PRESET_MAX_DIM,
|
|
157
161
|
PRESET_SHORT,
|
|
158
162
|
type PresignUploadUrlOptions,
|
|
163
|
+
type PrivateTransformOptions,
|
|
159
164
|
pickAmbientBackground,
|
|
160
165
|
REQUESTABLE_PRESETS,
|
|
161
166
|
type RegenerateResult,
|
|
@@ -166,6 +171,7 @@ export {
|
|
|
166
171
|
resolveSlots,
|
|
167
172
|
type SignAccessOptions,
|
|
168
173
|
type SignedTransformOptions,
|
|
174
|
+
type SignTransformOptions,
|
|
169
175
|
type SlotDTO,
|
|
170
176
|
type SlotHistoryEntry,
|
|
171
177
|
type SlotResolution,
|
|
@@ -182,6 +188,7 @@ export {
|
|
|
182
188
|
type TransformOptions,
|
|
183
189
|
type TransformWidth,
|
|
184
190
|
toRequestablePresets,
|
|
191
|
+
transformMessage,
|
|
185
192
|
type UploadOptions,
|
|
186
193
|
type UploadResult,
|
|
187
194
|
type UploadUrlResult,
|