@nitida/sdk 0.24.0 → 0.25.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 +10 -9
- package/README.md +161 -154
- package/dist/index.d.ts +79 -50
- package/dist/index.js +73 -28
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +9 -7
- package/dist/server.js +51 -28
- package/dist/server.js.map +1 -1
- package/dist/web.d.ts +11 -12
- package/dist/web.js +51 -28
- package/dist/web.js.map +1 -1
- package/package.json +2 -2
- package/skills/nitida-sdk/SKILL.md +215 -91
- package/src/index.ts +114 -51
- package/src/server/index.ts +9 -7
- package/src/web/index.ts +16 -17
package/AGENTS.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Read `skills/nitida-sdk/SKILL.md` in this package first.** It is the canonical guide and it
|
|
4
4
|
ships inside the tarball, so it is already on disk in `node_modules/@nitida/sdk/skills/`. It
|
|
5
5
|
carries the things that cost real incidents to learn — the base36 tenant prefix, the width ladder,
|
|
6
|
-
the `original`-preset trap, the
|
|
6
|
+
the `original`-preset trap, the object-storage CORS boundary — not just the API shape.
|
|
7
7
|
|
|
8
8
|
**Then read `src/`.** This package publishes its TypeScript sources (`files: ["dist/**", "src/**"]`),
|
|
9
9
|
so the source *is* the reference: every public method carries TSDoc, and the ones worth copying
|
|
@@ -13,12 +13,12 @@ recalling an API from training data — this SDK moves.
|
|
|
13
13
|
## The five-minute version
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
|
-
import {
|
|
16
|
+
import { NitidaClient } from "@nitida/sdk/server"; // uploads: server-only, holds the amk_rt_* key
|
|
17
17
|
import { getTransformUrl, setCdnBase, setTenantId } from "@nitida/asset-client"; // URLs: anywhere
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
- **Uploading** → `aq.upload(file, { fileName, contentType, presets })`. One call does compress →
|
|
21
|
-
sha256 → presign → direct-to-
|
|
21
|
+
sha256 → presign → direct-to-storage PUT → `/assets/process` → wait-until-ready.
|
|
22
22
|
- **Image URLs** → `getTransformUrl({ sha }, { format: "webp", width })`. The width MUST be on
|
|
23
23
|
`TRANSFORM_WIDTHS` or the edge answers **400**.
|
|
24
24
|
- **Video URLs** → `getAssetUrl({ sha }, "video")` after `setTenantId(id)`. The path segment is
|
|
@@ -30,14 +30,15 @@ import { getTransformUrl, setCdnBase, setTenantId } from "@nitida/asset-client";
|
|
|
30
30
|
`["thumb"]` and the bytes you PUT are *not* retrievable. A variant not requested at the FIRST
|
|
31
31
|
ingest cannot be added later once the cleanup job reaps `raw/`.
|
|
32
32
|
2. **The `amk_rt_*` key is server-only.** The browser talks to *your* route; your server talks to
|
|
33
|
-
|
|
34
|
-
3. **The PUT goes browser →
|
|
35
|
-
the bucket policy cannot be fixed in this SDK, in your app,
|
|
36
|
-
|
|
33
|
+
the platform. A runtime key in a client bundle is a write key to a paid platform.
|
|
34
|
+
3. **The PUT goes browser → object storage directly, so the STORAGE BUCKET answers the CORS
|
|
35
|
+
preflight.** An origin missing from the bucket policy cannot be fixed in this SDK, in your app,
|
|
36
|
+
or by the API's allowed-origins setting — ask us to add it. Symptom: the direct PUT fails with a
|
|
37
|
+
bare network error while every earlier step is green.
|
|
37
38
|
4. **Video is not image.** `/assets/process` filters video presets to
|
|
38
39
|
`{poster, video, aiproxy, probe}` — `original` is silently dropped — and a video finalizes
|
|
39
|
-
ASYNCHRONOUSLY: the call answers `{ assetId, status: "processing" }` and a
|
|
40
|
-
to `ready` 1–2 min later, so `processAndWait` needs a `timeoutMs` of at least `300_000`.
|
|
40
|
+
ASYNCHRONOUSLY: the call answers `{ assetId, status: "processing" }` and a background job flips
|
|
41
|
+
it to `ready` 1–2 min later, so `processAndWait` needs a `timeoutMs` of at least `300_000`.
|
|
41
42
|
|
|
42
43
|
## Related packages
|
|
43
44
|
|