@nitida/sdk 0.33.0 → 0.36.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 +28 -4
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +28 -4
- package/dist/server.js.map +1 -1
- package/dist/web.d.ts +1 -1
- package/dist/web.js +28 -4
- package/dist/web.js.map +1 -1
- package/package.json +2 -2
- package/skills/nitida-sdk/SKILL.md +137 -6
- package/src/index.ts +40 -23
- package/src/server/index.ts +9 -0
- package/src/web/index.ts +9 -0
package/dist/server.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,
|
|
@@ -42,6 +43,7 @@ import {
|
|
|
42
43
|
getHlsStreamingUrl as getHlsStreamingUrl2,
|
|
43
44
|
getPaletteBlurBackground,
|
|
44
45
|
getPaletteCssVars,
|
|
46
|
+
getByteBudgetTransformUrl,
|
|
45
47
|
getPrivateAssetUrl,
|
|
46
48
|
getPrivateTransformUrl,
|
|
47
49
|
getSignedTransformUrl as getSignedTransformUrl2,
|
|
@@ -51,10 +53,14 @@ import {
|
|
|
51
53
|
getTransformUrl as getTransformUrl2,
|
|
52
54
|
getVideoTransformUrl as getVideoTransformUrl2,
|
|
53
55
|
hasPreset as hasPreset2,
|
|
56
|
+
hasSizeLadder,
|
|
54
57
|
hlsLadderAlignment,
|
|
55
58
|
invalidateSlotCache as invalidateSlotCache2,
|
|
56
59
|
isRequestablePreset as isRequestablePreset2,
|
|
57
60
|
iteratePaletteSwatches,
|
|
61
|
+
MAX_SIGNED_TRANSFORM_TTL_SECONDS,
|
|
62
|
+
MAX_SIGNED_URL_TTL_SECONDS,
|
|
63
|
+
MIN_SIGNED_TRANSFORM_TTL_SECONDS,
|
|
58
64
|
PRESET_EXT,
|
|
59
65
|
PRESET_LONG,
|
|
60
66
|
PRESET_MAX_DIM,
|
|
@@ -70,7 +76,8 @@ import {
|
|
|
70
76
|
signAccessUrl,
|
|
71
77
|
signTransformUrl,
|
|
72
78
|
TRANSFORM_WIDTHS,
|
|
73
|
-
toRequestablePresets as toRequestablePresets2
|
|
79
|
+
toRequestablePresets as toRequestablePresets2,
|
|
80
|
+
transformMessage
|
|
74
81
|
} from "@nitida/asset-client";
|
|
75
82
|
function endpointUrl(opts, path, searchParams) {
|
|
76
83
|
const endpoint = opts.endpoint.replace(/\/+$/, "");
|
|
@@ -600,7 +607,11 @@ var NitidaClient = class {
|
|
|
600
607
|
"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
608
|
);
|
|
602
609
|
}
|
|
603
|
-
return getSignedTransformUrl(asset, opts, this.opts.signingKey
|
|
610
|
+
return getSignedTransformUrl(asset, opts, this.opts.signingKey, {
|
|
611
|
+
expiresInSeconds: signOpts.expiresInSeconds,
|
|
612
|
+
tenantId: signOpts.tenantId ?? this.opts.tenantId,
|
|
613
|
+
nowSeconds: signOpts.nowSeconds
|
|
614
|
+
}) ?? Promise.resolve(this.urlFor(asset, "lg"));
|
|
604
615
|
}
|
|
605
616
|
transformSrcSet(asset, widths, extraOpts = {}, signOpts) {
|
|
606
617
|
if (!signOpts?.sign) return getTransformSrcSet(asset, widths, extraOpts);
|
|
@@ -610,12 +621,18 @@ var NitidaClient = class {
|
|
|
610
621
|
);
|
|
611
622
|
}
|
|
612
623
|
const key = this.opts.signingKey;
|
|
624
|
+
const sign = {
|
|
625
|
+
expiresInSeconds: signOpts.expiresInSeconds,
|
|
626
|
+
tenantId: signOpts.tenantId ?? this.opts.tenantId,
|
|
627
|
+
nowSeconds: signOpts.nowSeconds
|
|
628
|
+
};
|
|
613
629
|
return Promise.all(
|
|
614
630
|
widths.map(async (w) => {
|
|
615
631
|
const signed = await getSignedTransformUrl(
|
|
616
632
|
asset,
|
|
617
633
|
{ ...extraOpts, width: w },
|
|
618
|
-
key
|
|
634
|
+
key,
|
|
635
|
+
sign
|
|
619
636
|
);
|
|
620
637
|
return signed ? `${signed} ${w}w` : null;
|
|
621
638
|
})
|
|
@@ -959,6 +976,9 @@ var NitidaClient2 = class extends NitidaClient {
|
|
|
959
976
|
}
|
|
960
977
|
};
|
|
961
978
|
export {
|
|
979
|
+
MAX_SIGNED_TRANSFORM_TTL_SECONDS,
|
|
980
|
+
MAX_SIGNED_URL_TTL_SECONDS,
|
|
981
|
+
MIN_SIGNED_TRANSFORM_TTL_SECONDS,
|
|
962
982
|
NitidaClient2 as NitidaClient,
|
|
963
983
|
PRESET_EXT,
|
|
964
984
|
PRESET_LONG,
|
|
@@ -974,11 +994,13 @@ export {
|
|
|
974
994
|
configureSlotResolver2 as configureSlotResolver,
|
|
975
995
|
contrastRatio,
|
|
976
996
|
deriveAccessKey,
|
|
997
|
+
deriveTransformKid,
|
|
977
998
|
extractAssetSha,
|
|
978
999
|
getAmbientGradient,
|
|
979
1000
|
getAssetDimensions,
|
|
980
1001
|
getAssetSrcSet2 as getAssetSrcSet,
|
|
981
1002
|
getAssetUrl2 as getAssetUrl,
|
|
1003
|
+
getByteBudgetTransformUrl,
|
|
982
1004
|
getCdnBase,
|
|
983
1005
|
getHlsLadder,
|
|
984
1006
|
getHlsStreamingUrl2 as getHlsStreamingUrl,
|
|
@@ -993,6 +1015,7 @@ export {
|
|
|
993
1015
|
getTransformUrl2 as getTransformUrl,
|
|
994
1016
|
getVideoTransformUrl2 as getVideoTransformUrl,
|
|
995
1017
|
hasPreset2 as hasPreset,
|
|
1018
|
+
hasSizeLadder,
|
|
996
1019
|
hlsLadderAlignment,
|
|
997
1020
|
invalidateSlotCache2 as invalidateSlotCache,
|
|
998
1021
|
isRequestablePreset2 as isRequestablePreset,
|
|
@@ -1008,6 +1031,7 @@ export {
|
|
|
1008
1031
|
setTenantId2 as setTenantId,
|
|
1009
1032
|
signAccessUrl,
|
|
1010
1033
|
signTransformUrl,
|
|
1011
|
-
toRequestablePresets2 as toRequestablePresets
|
|
1034
|
+
toRequestablePresets2 as toRequestablePresets,
|
|
1035
|
+
transformMessage
|
|
1012
1036
|
};
|
|
1013
1037
|
//# sourceMappingURL=server.js.map
|