@tinycloud/web-sdk 3.3.0-beta.28 → 3.3.0-beta.30
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/README.md +32 -0
- package/dist/notifications/types.schema.d.ts +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -320,6 +320,38 @@ const userKeys = userKeysResponse.data;
|
|
|
320
320
|
console.log('User keys:', userKeys); // ['profile', ...]
|
|
321
321
|
```
|
|
322
322
|
|
|
323
|
+
### Listing Keys That Start With a Partial Name
|
|
324
|
+
|
|
325
|
+
The node matches list prefixes on **whole path segments** (node 1.19.0, TC-731):
|
|
326
|
+
`list({ prefix: 'qa/b' })` returns `qa/b` and `qa/b/...`, never `qa/b00`. This is
|
|
327
|
+
deliberate: a list is the authorization scope, so a grant on `docs` cannot be used to
|
|
328
|
+
enumerate `docsecret/...`.
|
|
329
|
+
|
|
330
|
+
When you want "names starting with X" (UI type-ahead over a small folder), use the
|
|
331
|
+
standalone `listMatching(kv, prefix, options?)` function. It lists the folder up to the
|
|
332
|
+
last `/` with the normal `list`, reads **every** page, and filters client-side. It takes
|
|
333
|
+
`tc.kv` or a prefixed view (`tc.kv.withPrefix('notes')`), and is not part of the KV
|
|
334
|
+
service itself, so apps that don't import it don't ship it.
|
|
335
|
+
|
|
336
|
+
**Browser apps import it from `@tinycloud/sdk-core/kv-list-matching`** (web-sdk already
|
|
337
|
+
depends on sdk-core). It is a separate entry, not in any package root, so
|
|
338
|
+
`@tinycloud/web-sdk` and `@tinycloud/sdk-core` root bundles are unchanged:
|
|
339
|
+
|
|
340
|
+
```typescript
|
|
341
|
+
import { listMatching } from '@tinycloud/sdk-core/kv-list-matching';
|
|
342
|
+
// TypeScript: the subpath's types need `moduleResolution` node16, nodenext or
|
|
343
|
+
// bundler. With "node" tsc reports TS2307 (the runtime import still works).
|
|
344
|
+
|
|
345
|
+
// Keys: qa/b00, qa/b01, qa/c00
|
|
346
|
+
const result = await listMatching(tc.kv, 'qa/b');
|
|
347
|
+
if (result.ok) console.log(result.data.keys); // ['qa/b00', 'qa/b01']
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
It never lists more than the folder, so a delegated session sees only what its grant
|
|
351
|
+
allows, and a folder outside the grant fails exactly as `list` would. The cost is the
|
|
352
|
+
size of the **folder**, not the number of matches, so it is slow for large folders. For
|
|
353
|
+
those, give the data a real folder structure (`users/<id>/...`) and use `list`.
|
|
354
|
+
|
|
323
355
|
### Deleting Data
|
|
324
356
|
|
|
325
357
|
```typescript
|
|
@@ -54,8 +54,8 @@ export declare const ToastSchema: z.ZodObject<{
|
|
|
54
54
|
timestamp: z.ZodNumber;
|
|
55
55
|
}, "strip", z.ZodTypeAny, {
|
|
56
56
|
description?: string;
|
|
57
|
-
type?: "error" | "success" | "warning" | "info" | "loading";
|
|
58
57
|
id?: string;
|
|
58
|
+
type?: "error" | "success" | "warning" | "info" | "loading";
|
|
59
59
|
title?: string;
|
|
60
60
|
duration?: number;
|
|
61
61
|
action?: {
|
|
@@ -65,8 +65,8 @@ export declare const ToastSchema: z.ZodObject<{
|
|
|
65
65
|
timestamp?: number;
|
|
66
66
|
}, {
|
|
67
67
|
description?: string;
|
|
68
|
-
type?: "error" | "success" | "warning" | "info" | "loading";
|
|
69
68
|
id?: string;
|
|
69
|
+
type?: "error" | "success" | "warning" | "info" | "loading";
|
|
70
70
|
title?: string;
|
|
71
71
|
duration?: number;
|
|
72
72
|
action?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinycloud/web-sdk",
|
|
3
|
-
"version": "3.3.0-beta.
|
|
3
|
+
"version": "3.3.0-beta.30",
|
|
4
4
|
"description": "A set of tools and utilities to help you build your app with TinyCloud.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"@multiformats/multiaddr": "^13.0.1",
|
|
55
55
|
"@multiformats/multiaddr-to-uri": "^12.0.0",
|
|
56
56
|
"@noble/curves": "^1.9.7",
|
|
57
|
-
"@tinycloud/node-sdk": "3.3.0-beta.
|
|
58
|
-
"@tinycloud/replica": "0.3.0-beta.
|
|
59
|
-
"@tinycloud/sdk-core": "3.3.0-beta.
|
|
57
|
+
"@tinycloud/node-sdk": "3.3.0-beta.30",
|
|
58
|
+
"@tinycloud/replica": "0.3.0-beta.8",
|
|
59
|
+
"@tinycloud/sdk-core": "3.3.0-beta.30",
|
|
60
60
|
"@tinycloud/share-envelope": "1.2.0-beta.0",
|
|
61
61
|
"@tinycloud/share-sdk": "1.2.0-beta.6",
|
|
62
62
|
"@tinycloud/web-sdk-wasm": "1.7.6",
|