@civitai/sdk 0.14.0 → 0.14.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/BREAKING.md +2 -2
- package/README.md +7 -5
- package/dist/shared-storage/index.d.ts +8 -3
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +1 -1
package/BREAKING.md
CHANGED
|
@@ -204,8 +204,8 @@ bridge already called, so behaviour is identical on both transports.
|
|
|
204
204
|
- **Anonymous viewers may NEVER write or vote.** An anon write is rejected by the write scope's own binding in
|
|
205
205
|
`withBlockScope`, before the handler runs, so it surfaces as **`403`** rather than the handler's own `401`.
|
|
206
206
|
- **Authenticated writers must clear a minimum-trust gate.** After the anon check, writes call
|
|
207
|
-
`assertSharedWriteTrust` — account age,
|
|
208
|
-
viewer is not automatically a permitted writer.
|
|
207
|
+
`assertSharedWriteTrust` — account age, completed onboarding, not banned or muted, and verified email *or* a
|
|
208
|
+
linked OAuth account. A signed-in viewer is not automatically a permitted writer.
|
|
209
209
|
- **Tenancy is structural, not checked.** Every query interpolates a schema name derived from the **verified
|
|
210
210
|
token**, never from client input. An app cannot address another app's shared storage because it cannot name it.
|
|
211
211
|
- **Rate limits are per-operation and per-namespace**, so one operation cannot starve another — browsing a feed
|
package/README.md
CHANGED
|
@@ -336,7 +336,7 @@ every viewer reads and writes, unlike `app.storage`, which is private per viewer
|
|
|
336
336
|
Five methods: `list`, `get`, `append`, `update`, `withdraw`.
|
|
337
337
|
|
|
338
338
|
```ts
|
|
339
|
-
const { items, nextCursor } = await app.sharedStorage.list({
|
|
339
|
+
const { items, nextCursor } = await app.sharedStorage.list({ limit: 20 }); // newest first
|
|
340
340
|
const { key } = await app.sharedStorage.append({ title: 'My deck', data: { cards } });
|
|
341
341
|
const row = await app.sharedStorage.get(key); // null when hidden or absent
|
|
342
342
|
await app.sharedStorage.update(key, { title: 'Renamed' });
|
|
@@ -362,9 +362,9 @@ other.** This is the opposite of `app.storage`, so do not carry that gate over:
|
|
|
362
362
|
supported path — and may **never** write. An anon write is a `403` from the
|
|
363
363
|
scope binding, not the `401` a missing token gives.
|
|
364
364
|
- **A signed-in viewer is not automatically a permitted writer.** Writes clear a
|
|
365
|
-
server-side minimum-trust gate (account age,
|
|
366
|
-
linked OAuth account). Treat a write refusal
|
|
367
|
-
message in the UI, not an unexpected error.
|
|
365
|
+
server-side minimum-trust gate (account age, completed onboarding, verified
|
|
366
|
+
email or a linked OAuth account, not banned or muted). Treat a write refusal
|
|
367
|
+
as a normal outcome with a real message in the UI, not an unexpected error.
|
|
368
368
|
|
|
369
369
|
So gate the write affordances on `app.viewer`, and render the reads regardless.
|
|
370
370
|
|
|
@@ -379,7 +379,9 @@ that type-checks:
|
|
|
379
379
|
`app.storage`'s, absence proves the scan completed.
|
|
380
380
|
- **`append` takes no key.** The server mints a ULID and returns it, so one
|
|
381
381
|
viewer cannot overwrite another's row. Use `update` for an in-place edit of a
|
|
382
|
-
row this viewer authored.
|
|
382
|
+
row this viewer authored. It also means `list`'s `prefix` is no namespace of
|
|
383
|
+
yours: a prefix you choose (`'deck:'`) matches none of the rows `append`
|
|
384
|
+
creates. Put what you filter by in `data` and filter the page yourself.
|
|
383
385
|
- **`value` is `unknown` on the way out.** The row was written by some other
|
|
384
386
|
viewer's copy of your app, possibly an older version, so its shape is a fact
|
|
385
387
|
about the data rather than a promise the client can make. Narrow it yourself.
|
|
@@ -51,7 +51,11 @@ export interface SharedItem {
|
|
|
51
51
|
viewerVoted: boolean;
|
|
52
52
|
}
|
|
53
53
|
export interface SharedListQuery {
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Narrows to keys starting with this. Escaped server-side against LIKE wildcards.
|
|
56
|
+
* `append` mints every key as a ULID, so a prefix of your own choosing matches
|
|
57
|
+
* none of the rows it creates.
|
|
58
|
+
*/
|
|
55
59
|
prefix?: string;
|
|
56
60
|
/** The server bounds this and applies its own default; this client sends none. */
|
|
57
61
|
limit?: number;
|
|
@@ -94,8 +98,9 @@ export interface SharedListResult {
|
|
|
94
98
|
* write is refused by the scope binding before the handler runs, so it arrives
|
|
95
99
|
* as **403**, not the 401 a missing token gives.
|
|
96
100
|
* - A signed-in viewer is not automatically a permitted writer: writes clear a
|
|
97
|
-
* minimum-trust gate (account age,
|
|
98
|
-
* account). Treat a write refusal as a
|
|
101
|
+
* minimum-trust gate (account age, completed onboarding, verified email or a
|
|
102
|
+
* linked OAuth account, not banned or muted). Treat a write refusal as a
|
|
103
|
+
* normal outcome and say so in the UI.
|
|
99
104
|
*
|
|
100
105
|
* 🔴 EVERY FAILURE REJECTS. No path here resolves to mean "not written" or
|
|
101
106
|
* "could not read". A caller that must not act on a partial view branches on the
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** This package's version, reported to the host as `sdkVersion` in `BLOCK_READY`. */
|
|
2
|
-
export declare const VERSION = "0.14.
|
|
2
|
+
export declare const VERSION = "0.14.1";
|
package/package.json
CHANGED