@proveanything/smartlinks 2.1.23 → 2.1.27

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.
@@ -176,7 +176,7 @@ export interface CreateClaimSetRangeRequest {
176
176
  /** Default 'range'. Owners and admins make ranges and open ranges; assigners may make groups too. */
177
177
  kind?: ClaimSetRangeKind;
178
178
  name: string;
179
- /** 1 to 10,000 (a range); ignored for open ranges and groups */
179
+ /** 1 to 10,000 (a range), or up to 1,000,000 in a computed set; ignored for open ranges and groups */
180
180
  quantity?: number;
181
181
  /** Pre-assign every tag at mint time (you must administer the collection) */
182
182
  intendedCollectionId?: string;
@@ -302,6 +302,8 @@ export interface AssignClaimSetRangeRequest {
302
302
  }
303
303
  export interface AssignClaimSetRangeResponse {
304
304
  changed: number;
305
+ /** A whole computed run, assigned on the range itself (one write, however many tags) */
306
+ wholeRange?: boolean;
305
307
  skipped: Array<{
306
308
  code: string;
307
309
  index: number;
@@ -349,6 +351,14 @@ export interface PartnerClaimSet {
349
351
  id: string | null;
350
352
  };
351
353
  codes: number;
354
+ /** 'computed': codes are worked out from their index, nothing stored until one is claimed (QR only) */
355
+ codeSource?: 'stored' | 'computed';
356
+ /** computed sets: the signature size, 16 to 32 bits (default 24) */
357
+ sigBits?: number;
358
+ /** computed sets: this set answers bare codes on its domain, https://{tapDomain}/{code} */
359
+ bareCodes?: boolean;
360
+ /** computed sets: where an unused code's scan goes; {set} and {code} are filled in */
361
+ unassignedUrl?: string | null;
352
362
  deleted: boolean;
353
363
  createdAt: string | null;
354
364
  }
@@ -369,4 +379,99 @@ export interface CreatePartnerClaimSetRequest {
369
379
  tagType: ClaimSetTagType;
370
380
  /** One of the partner's tap domains; default smartlinks.app */
371
381
  tapDomain?: string;
382
+ /**
383
+ * 'computed' (QR only): codes are worked out from their index and nothing is stored per code until one is
384
+ * claimed, so a run can hold up to 1,000,000 tags. Default 'stored'.
385
+ */
386
+ codeSource?: 'stored' | 'computed';
387
+ /** computed sets: signature size, 16 to 32 bits; default 24 (about 1 in 16.7 million guesses passes) */
388
+ sigBits?: number;
389
+ /** computed sets: answer bare codes on the tap domain (https://{domain}/{code}); one set per domain */
390
+ bareCodes?: boolean;
391
+ /** computed sets: a full https:// address for an unused code's scan, with {set} and {code} placeholders */
392
+ unassignedUrl?: string;
393
+ }
394
+ /**
395
+ * A scanned tag. Any one of: what a scanner read (`scan`: an address is a claim code, anything else a chip id), the
396
+ * address (`url`), a claim set and code, or a chip's id in the tags table (`tagId`: an RFID EPC or NFC UID).
397
+ */
398
+ export interface TagCodeRef {
399
+ scan?: string;
400
+ /** https://{domain}/{code} or https://{domain}/t/{set}/{code} */
401
+ url?: string;
402
+ claimSetId?: string;
403
+ code?: string;
404
+ /** An RFID EPC or NFC UID */
405
+ tagId?: string;
406
+ }
407
+ /** Attach a tag to an item (productId + proofId), an existing container (containerId), or a new box (container). */
408
+ export interface TagCodeAttachRequest extends TagCodeRef {
409
+ /** The item's type (a product) */
410
+ productId?: string;
411
+ /** The item (a proof) */
412
+ proofId?: string;
413
+ /** An existing container this tag is the label on */
414
+ containerId?: string;
415
+ /** A new box (or bag, shelf…) labelled by this tag */
416
+ container?: {
417
+ name: string;
418
+ containerType?: string;
419
+ parentContainerId?: string;
420
+ };
421
+ }
422
+ /** What a tag is on: an item, a container it labels, or (older RFID) just a product. */
423
+ export type TagCodeOn = {
424
+ type: 'item';
425
+ productId: string | null;
426
+ proofId: string;
427
+ } | {
428
+ type: 'container';
429
+ containerId: string;
430
+ name?: string | null;
431
+ containerType?: string;
432
+ } | {
433
+ type: 'product';
434
+ productId: string;
435
+ };
436
+ export interface TagCodeState {
437
+ /** claim: a claim-set code (QR, or an NFC claim code); chip: a tags-table chip (RFID EPC, NFC UID) */
438
+ kind: 'claim' | 'chip';
439
+ /** claim codes */
440
+ claimSetId?: string;
441
+ code?: string;
442
+ /** The address a claim code carries */
443
+ url?: string;
444
+ /** A computed set's code (printed QR, nothing stored until attached) */
445
+ computed?: boolean;
446
+ /** chips */
447
+ tagId?: string;
448
+ tagType: ClaimSetTagType | 'chip';
449
+ /** free: may be attached here; attached: on one of this collection's things; elsewhere: another organisation's */
450
+ status: 'free' | 'attached' | 'elsewhere';
451
+ /** Only for this collection's own tags */
452
+ on?: TagCodeOn | null;
453
+ productId?: string | null;
454
+ proofId?: string | null;
455
+ }
456
+ /** places.move: one thing to move. */
457
+ export type PlaceMoveItem = {
458
+ productId: string;
459
+ proofId: string;
460
+ } | {
461
+ tagId: string;
462
+ } | {
463
+ containerId: string;
464
+ };
465
+ export interface PlaceMoveResult {
466
+ moved: Array<{
467
+ item: PlaceMoveItem;
468
+ from: string | null;
469
+ to: string | null;
470
+ }>;
471
+ unchanged: PlaceMoveItem[];
472
+ refused: Array<{
473
+ item: PlaceMoveItem;
474
+ errorCode: string;
475
+ errorText: string;
476
+ }>;
372
477
  }
@@ -139,7 +139,9 @@ export interface ListContainersResponse {
139
139
  export interface PublicListContainersResponse {
140
140
  containers: Container[];
141
141
  }
142
+ /** What findForItem answers: the item's current membership rows (each has `containerId`) and those containers. */
142
143
  export interface FindContainersForItemResponse {
144
+ items: ContainerItem[];
143
145
  containers: Container[];
144
146
  }
145
147
  export interface ContainerItemsResponse {
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.1.23 | Generated: 2026-11-19T11:28:05.726Z
3
+ Version: 2.1.27 | Generated: 2026-11-20T07:36:06.011Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -160,10 +160,12 @@ The Smartlinks SDK is organized into the following namespaces:
160
160
  - **operations** - Functions for operations operations
161
161
  - **order** - Functions for order operations
162
162
  - **partner** - Functions for partner operations
163
+ - **places** - Functions for places operations
163
164
  - **products** - Functions for products operations
164
165
  - **realtime** - Functions for realtime operations
165
166
  - **research** - Functions for research operations
166
167
  - **secrets** - Functions for secrets operations
168
+ - **tagCodes** - Functions for tagCodes operations
167
169
  - **tags** - Functions for tags operations
168
170
  - **template** - Functions for template operations
169
171
  - **translations** - Functions for translations operations
@@ -3208,10 +3210,29 @@ interface AppManifest {
3208
3210
  headless?: AppHeadlessDeclaration;
3209
3211
  connector?: AppConnectorDeclaration;
3210
3212
  assistant?: AppAssistantDeclaration;
3213
+ docs?: AppDocsDeclaration;
3211
3214
  [key: string]: any;
3212
3215
  }
3213
3216
  ```
3214
3217
 
3218
+ **AppDocsPage** (interface)
3219
+ ```typescript
3220
+ interface AppDocsPage {
3221
+ file: string;
3222
+ title: string;
3223
+ description?: string;
3224
+ audience?: AppDocsAudience;
3225
+ }
3226
+ ```
3227
+
3228
+ **AppDocsDeclaration** (interface)
3229
+ ```typescript
3230
+ interface AppDocsDeclaration {
3231
+ pages: AppDocsPage[];
3232
+ listed?: boolean;
3233
+ }
3234
+ ```
3235
+
3215
3236
  **AppAssistantFile** (interface)
3216
3237
  ```typescript
3217
3238
  interface AppAssistantFile {
@@ -3483,6 +3504,8 @@ interface GetCollectionWidgetsOptions {
3483
3504
  type ServerFunctionFileInput = { base64: string; contentType: string }
3484
3505
  ```
3485
3506
 
3507
+ **AppDocsAudience** = `'team' | 'admin' | 'customer' | 'developer'`
3508
+
3486
3509
  ### appObjects
3487
3510
 
3488
3511
  **PaginatedResponse<T>** (interface)
@@ -6257,6 +6280,7 @@ interface AssignClaimSetRangeRequest {
6257
6280
  ```typescript
6258
6281
  interface AssignClaimSetRangeResponse {
6259
6282
  changed: number
6283
+ wholeRange?: boolean
6260
6284
  skipped: Array<{ code: string; index: number; reason: 'other_range' | 'has_proof' | 'assigned_elsewhere'; collectionId?: string }>
6261
6285
  range: ClaimSetRange
6262
6286
  }
@@ -6298,6 +6322,10 @@ interface PartnerClaimSet {
6298
6322
  tapDomain: string
6299
6323
  owner: { type: 'platform' | 'partner' | 'collection' | 'user'; id: string | null }
6300
6324
  codes: number
6325
+ codeSource?: 'stored' | 'computed'
6326
+ sigBits?: number
6327
+ bareCodes?: boolean
6328
+ unassignedUrl?: string | null
6301
6329
  deleted: boolean
6302
6330
  createdAt: string | null
6303
6331
  }
@@ -6321,6 +6349,47 @@ interface CreatePartnerClaimSetRequest {
6321
6349
  name: string
6322
6350
  tagType: ClaimSetTagType
6323
6351
  tapDomain?: string
6352
+ codeSource?: 'stored' | 'computed'
6353
+ sigBits?: number
6354
+ bareCodes?: boolean
6355
+ unassignedUrl?: string
6356
+ }
6357
+ ```
6358
+
6359
+ **TagCodeRef** (interface)
6360
+ ```typescript
6361
+ interface TagCodeRef {
6362
+ scan?: string
6363
+ url?: string
6364
+ claimSetId?: string
6365
+ code?: string
6366
+ tagId?: string
6367
+ }
6368
+ ```
6369
+
6370
+ **TagCodeState** (interface)
6371
+ ```typescript
6372
+ interface TagCodeState {
6373
+ kind: 'claim' | 'chip'
6374
+ claimSetId?: string
6375
+ code?: string
6376
+ url?: string
6377
+ computed?: boolean
6378
+ tagId?: string
6379
+ tagType: ClaimSetTagType | 'chip'
6380
+ status: 'free' | 'attached' | 'elsewhere'
6381
+ on?: TagCodeOn | null
6382
+ productId?: string | null
6383
+ proofId?: string | null
6384
+ }
6385
+ ```
6386
+
6387
+ **PlaceMoveResult** (interface)
6388
+ ```typescript
6389
+ interface PlaceMoveResult {
6390
+ moved: Array<{ item: PlaceMoveItem; from: string | null; to: string | null }>
6391
+ unchanged: PlaceMoveItem[]
6392
+ refused: Array<{ item: PlaceMoveItem; errorCode: string; errorText: string }>
6324
6393
  }
6325
6394
  ```
6326
6395
 
@@ -6339,6 +6408,13 @@ type ClaimSetScope = { collectionId: string }
6339
6408
 
6340
6409
  **ClaimSetImportResult** = ``
6341
6410
 
6411
+ **TagCodeOn** = ``
6412
+
6413
+ **PlaceMoveItem** (type)
6414
+ ```typescript
6415
+ type PlaceMoveItem = { productId: string; proofId: string }
6416
+ ```
6417
+
6342
6418
  ### clientLog
6343
6419
 
6344
6420
  **ClientErrorReport** (interface)
@@ -7861,6 +7937,7 @@ interface PublicListContainersResponse {
7861
7937
  **FindContainersForItemResponse** (interface)
7862
7938
  ```typescript
7863
7939
  interface FindContainersForItemResponse {
7940
+ items: ContainerItem[]
7864
7941
  containers: Container[]
7865
7942
  }
7866
7943
  ```
@@ -14763,6 +14840,11 @@ Find a tag across the partner's sets by its chip UID (8 or 14 hex) or its code (
14763
14840
  **tagAttempts**(partnerId: string, uid: string) → `Promise<ClientErrorEvent[]>`
14764
14841
  What phones reported about one chip (errors.report with entityType 'tag'), newest first: a tag that failed to program or register, with the host's NFC log in context. For a chip in the partner's sets, or attempts that named one of them.
14765
14842
 
14843
+ ### places
14844
+
14845
+ **move**(collectionId: string, params: { to: string | null; items: PlaceMoveItem[]; note?: string }) → `Promise<PlaceMoveResult>`
14846
+ Move items (by membership), chips without an item (by membership) or containers (re-parented) into `to`, or out of every place with `to: null`. Each move leaves a history line on what moved. Up to 500 at a time.
14847
+
14766
14848
  ### podcast
14767
14849
 
14768
14850
  **generate**(collectionId: string,
@@ -15210,6 +15292,17 @@ List the skills apps can invoke (name, description, input/output schema).
15210
15292
  **run**(collectionId: string, name: string, input: Record<string, any> = {}) → `Promise<T>`
15211
15293
  Invoke a skill by name with structured input — the app-facing verb; no prompt-shaping. POST /admin/collection/:collectionId/ai/skills/:name/run
15212
15294
 
15295
+ ### tagCodes
15296
+
15297
+ **lookup**(collectionId: string, tag: TagCodeRef) → `Promise<TagCodeState>`
15298
+ What a tag is, as far as this collection may know: free, attached here (to what), or elsewhere.
15299
+
15300
+ **attach**(collectionId: string, params: TagCodeAttachRequest) → `Promise<TagCodeState>`
15301
+ Put a tag on an asset: its asset type (productId) and the asset itself (proofId). Refused when the tag belongs to another organisation, or is already on another asset (detach it first).
15302
+
15303
+ **detach**(collectionId: string, tag: TagCodeRef) → `Promise<TagCodeState>`
15304
+ Take a tag off its asset. It stays this collection's, free to go on another.
15305
+
15213
15306
  ### tags
15214
15307
 
15215
15308
  **create**(collectionId: string,
@@ -0,0 +1,73 @@
1
+ # App docs: the manual that ships with your app
2
+
3
+ Every app can carry a manual for the people who use it: how to set it up, how to use it day to day,
4
+ what its settings do, what to do when something looks wrong. The manual lives in the app's own repo,
5
+ ships with every release, and for first-party apps is published on
6
+ [docs.smartlinks.app](https://docs.smartlinks.app) straight from the stable release. Nobody copies it
7
+ anywhere: release the app and its manual is live.
8
+
9
+ ## Where it goes
10
+
11
+ ```
12
+ public/
13
+ app.manifest.json
14
+ docs/
15
+ index.md ← front page
16
+ setup.md
17
+ settings.md
18
+ images/
19
+ inbox.png
20
+ ```
21
+
22
+ `public/docs/` is copied into the build like any static file, so it reaches the CDN with the release:
23
+ `https://smartlinks.app/apps/<appId>/<channel>/docs/index.md`.
24
+
25
+ Keep internal notes (designs, plans, decisions) in `src/docs/` or anywhere outside `public/`.
26
+ Everything in `public/docs/` is public.
27
+
28
+ ## Declare it in the manifest
29
+
30
+ ```jsonc
31
+ // public/app.manifest.json
32
+ "docs": {
33
+ "pages": [
34
+ { "file": "docs/index.md", "title": "Messages", "description": "Send campaigns and answer people in one inbox.", "audience": "team" },
35
+ { "file": "docs/setup.md", "title": "Setting up", "description": "Senders, channels and who can reply.", "audience": "admin" },
36
+ { "file": "docs/settings.md", "title": "Settings", "audience": "admin" }
37
+ ]
38
+ }
39
+ ```
40
+
41
+ | Field | |
42
+ |---|---|
43
+ | `pages[].file` | Path in the build, relative to `public/`. |
44
+ | `pages[].title` | Title in the docs menu. |
45
+ | `pages[].description` | One sentence: what the page helps with. Shown in listings and search. |
46
+ | `pages[].audience` | `team` (staff using the app, default), `admin` (setting it up), `customer` (the public), `developer` (building on it). |
47
+ | `listed` | `false` keeps the manual off docs.smartlinks.app. Default `true`. |
48
+
49
+ The first page is the front page. Pages appear in the order listed.
50
+
51
+ ## Writing the pages
52
+
53
+ - Write for the person in front of the screen, in their words: "New campaign", not "the campaign
54
+ creation flow". Name buttons and screens exactly as the app shows them.
55
+ - One page per job: getting started, setting up, each main task, settings, troubleshooting.
56
+ - Short numbered steps for anything done in order.
57
+ - Images: put them in `public/docs/images/` and link them relatively (`![The inbox](images/inbox.png)`).
58
+ Links between pages are relative too (`[Setting up](setup.md)`). The docs site rewrites both.
59
+ - Start each page with a `# ` heading. No frontmatter needed: the manifest carries title and order.
60
+
61
+ ## Keep it current
62
+
63
+ Update the manual in the same change as the behaviour. Forge checks at release time: an app with no
64
+ `docs`, or a release whose code changed while `public/docs/` did not, gets a prompt to look at the
65
+ manual. It never blocks a release.
66
+
67
+ ## Related
68
+
69
+ - [`ai-guide.md`](ai-guide-template.md) is for the AI that configures the app, not for people. Keep
70
+ both: the AI guide says what to set, the manual says how to use it.
71
+ - The manifest's `adminViews`, `functions` (with `agent` for [agent tools](agent-tools.md)) and
72
+ `assistant` blocks describe the app to software. The docs site lists them on a generated
73
+ reference page; the manual is the human-written part.
@@ -507,6 +507,26 @@ should say and how the assistant changes config with undo: **[assistant-apps.md]
507
507
 
508
508
  ---
509
509
 
510
+ #### `docs`
511
+
512
+ The app's manual, for the people who use it: Markdown pages under `public/docs/`, shipped with every
513
+ release. For first-party apps, docs.smartlinks.app reads the stable release's pages directly, so
514
+ releasing the app publishes its manual.
515
+
516
+ ```jsonc
517
+ "docs": {
518
+ "pages": [
519
+ { "file": "docs/index.md", "title": "Messages", "description": "Send campaigns and answer people in one inbox.", "audience": "team" },
520
+ { "file": "docs/setup.md", "title": "Setting up", "audience": "admin" }
521
+ ]
522
+ }
523
+ ```
524
+
525
+ The first page is the front page. `audience` is `team` (default), `admin`, `customer` or `developer`.
526
+ `listed: false` keeps a manual off the docs site. What to write and how: **[app-docs.md](app-docs.md)**.
527
+
528
+ ---
529
+
510
530
  ## `app.admin.json`
511
531
 
512
532
  Fetched only by the admin UI and AI-assisted setup flows — never loaded on the public-facing page. Keep setup logic and configuration schemas here, not in the manifest.
package/docs/i18n.md CHANGED
@@ -1,4 +1,71 @@
1
- # Internationalization (i18n) System
1
+ # Internationalization (i18n): an app's own words
2
+
3
+ **Use the SDK's `i18n` helper** (SDK 2.1.27+). The copied-in `src/i18n/LanguageContext` scaffold further
4
+ down is the older way; new apps and upgrades use the helper.
5
+
6
+ ## How it works
7
+
8
+ 1. **Your app keeps its English as keys** in `public/i18n/en.json`. The build ships it at
9
+ `<bundle>/i18n/en.json`. That is your only translation job: don't hard-code English in components.
10
+ 2. **The platform translates.** When your app is published, SmartLinks translates the English into the
11
+ admin languages it supports (Simplified Chinese first) and adds `<bundle>/i18n/<lang>.json`. Keys whose
12
+ English hasn't changed keep their earlier (possibly human-reviewed) translation. If you ship your own
13
+ `public/i18n/<lang>.json`, its keys win and the platform fills only the gaps.
14
+ 3. **The host says which language.** Studio passes the person's own Studio language as `?lang=`, and later
15
+ changes arrive live (`smartlinks:root-state` with `lang`). A key with no translation shows its English.
16
+
17
+ In an admin app, `lang` is the person's **Studio language** (buttons and labels). The site's content
18
+ language arrives separately as `contentLang`: use it for the language your product data is written in.
19
+
20
+ ## Using it (React)
21
+
22
+ ```ts
23
+ // src/i18n.ts
24
+ import { useSyncExternalStore } from 'react'
25
+ import { i18n } from '@proveanything/smartlinks'
26
+
27
+ export const i18nReady = i18n.init() // await before first render (main.tsx)
28
+ export function useT() {
29
+ useSyncExternalStore(i18n.subscribe, i18n.snapshot)
30
+ return i18n.t
31
+ }
32
+ export const fmt = i18n.format // dates and numbers in the current language
33
+ ```
34
+
35
+ ```tsx
36
+ const t = useT()
37
+ <Button>{t('contacts.add')}</Button>
38
+ <span>{t('contacts.count', { count: rows.length })}</span>
39
+ <span>{fmt.date(contact.createdAt)}</span>
40
+ ```
41
+
42
+ `public/i18n/en.json`:
43
+
44
+ ```json
45
+ {
46
+ "contacts": {
47
+ "add": "Add contact",
48
+ "count_one": "{{count}} contact",
49
+ "count_other": "{{count}} contacts"
50
+ }
51
+ }
52
+ ```
53
+
54
+ - Nested keys are read with dots; group them by screen.
55
+ - `{{name}}` is filled from the values. With `count`, the language's plural form is picked
56
+ (`_one` / `_other` in English; Chinese uses only `_other`).
57
+ - Outside components, call `i18n.t(...)` at the moment the text is shown (not at module load), so a
58
+ language switch takes effect.
59
+ - Don't translate data (names from the server, ids, codes), or text you send to an AI model as
60
+ instructions.
61
+ - `i18n.language()` is the language in use; `i18n.setLanguage(code)` switches; `i18n.has(key)` says
62
+ whether a real translation exists.
63
+
64
+ ---
65
+
66
+ # The older scaffold (superseded)
67
+
68
+ ## Internationalization (i18n) System
2
69
 
3
70
  This document explains the i18n system for SmartLinks apps, covering URL-based language selection, static translations, and dynamic overrides.
4
71
 
@@ -0,0 +1,97 @@
1
+ # Tag codes: attaching a scanned tag to an asset
2
+
3
+ `SL.tagCodes` lets an admin app (Core Assets, Sidekick, a custom app) work with the tags on a collection's
4
+ things: what a scanned tag is, putting it on an asset, and taking it off. The same three calls work for
5
+ every claim-set tag:
6
+
7
+ - **printed QR codes from a computed claim set**: bought runs, and codes a business prints itself;
8
+ - **NFC tags and older QR sets**, whose codes are stored.
9
+
10
+ An *asset* is a proof; its *asset type* is the proof's product. Design note: prove
11
+ `server/docs/design/asset-tags-and-printed-codes.md`.
12
+
13
+ ## The calls
14
+
15
+ ```ts
16
+ import * as SL from '@proveanything/smartlinks'
17
+
18
+ // What was scanned: the address on the tag (or { claimSetId, code })
19
+ const tag = await SL.tagCodes.lookup(collectionId, { url: 'https://atag.co/4fK2qPx' })
20
+ // → { claimSetId, code, url, computed: true, tagType: 'qr', status: 'free' }
21
+
22
+ await SL.tagCodes.attach(collectionId, { url, productId: 'bed-sb755', proofId: 'bed14' })
23
+ // → { …, status: 'attached', productId: 'bed-sb755', proofId: 'bed14' }
24
+
25
+ await SL.tagCodes.detach(collectionId, { url })
26
+ // → { …, status: 'free', proofId: null }
27
+ ```
28
+
29
+ `status`:
30
+
31
+ | Status | Meaning |
32
+ |---|---|
33
+ | `free` | not on anything; this collection may attach it |
34
+ | `attached` | on one of this collection's assets (`productId`, `proofId` say which) |
35
+ | `elsewhere` | another organisation's tag; nothing more is shown |
36
+
37
+ ## The rules
38
+
39
+ - Admins of the collection only.
40
+ - Refused with `OTHER_ORGANISATION` when the tag's set belongs to another collection, or the run it's in was
41
+ sold to another collection.
42
+ - Refused with `ASSIGNED_ELSEWHERE` when the tag is already in use by another collection.
43
+ - Refused with `ALREADY_ATTACHED` when it's on another asset: `detach` first.
44
+ - After `attach`, scanning the tag opens the asset's page.
45
+
46
+ ## Computed claim sets (for whoever makes tags)
47
+
48
+ A claim set created with `codeSource: 'computed'` (QR only) stores nothing per code: each code is worked out from
49
+ its index with a signature (24 bits by default, `sigBits` 16 to 32). A run in such a set can hold up to
50
+ 1,000,000 tags. Its printer file downloads in parts:
51
+
52
+ ```ts
53
+ await SL.claimSet.ranges.exportFile(scope, claimSetId, rangeId, { from: 1, to: 200000 })
54
+ ```
55
+
56
+ A computed set with `bareCodes: true` answers bare codes on its tap domain: `https://{domain}/{code}`.
57
+ Each domain has at most one such set. Assigning a **whole** computed run to a collection
58
+ (`ranges.assign` without `start`/`end`) is one write on the range, however many tags it holds; the response
59
+ says `wholeRange: true`.
60
+
61
+ ## Chips and boxes (2.1.26)
62
+
63
+ The same three calls take an RFID or NFC chip by its id (`tagId`), or whatever a scanner read (`scan`: an address
64
+ is read as a claim code, anything else as a chip id):
65
+
66
+ ```ts
67
+ await SL.tagCodes.lookup(collectionId, { scan: 'E28011700000020F1E2D3C4B' })
68
+ // → { kind: 'chip', tagId, tagType: 'chip', status: 'free', on: null }
69
+ ```
70
+
71
+ A tag goes on **an item** or **a container** (it's the label on a box, a bag, a shelf, a cask), never both:
72
+
73
+ ```ts
74
+ await SL.tagCodes.attach(collectionId, { url, productId, proofId }) // on an item
75
+ await SL.tagCodes.attach(collectionId, { tagId, containerId }) // the label on an existing container
76
+ await SL.tagCodes.attach(collectionId, { url, container: { name: 'Box 12', parentContainerId: storeRoomId } }) // a new box
77
+ ```
78
+
79
+ `on` says what a tag is on: `{ type: 'item', productId, proofId }`, `{ type: 'container', containerId, name }`, or
80
+ for older RFID tags tagged only to a product, `{ type: 'product', productId }` (which can still be attached to an
81
+ item). A chip's label is recorded as the tag row's `refType: 'container'` (the label on that container, never
82
+ where the tag is); a claim code's in its own row.
83
+
84
+ ## Moving things
85
+
86
+ ```ts
87
+ await SL.places.move(collectionId, { to: vanId, items: [{ productId, proofId }, { containerId: boxId }], note: 'Acme job' })
88
+ // → { moved: [...], unchanged: [...], refused: [...] }
89
+ ```
90
+
91
+ - An item, or a chip without an item, is taken out of every place it's in and put in `to` (membership).
92
+ - A container is re-parented to `to`. A place can't go inside itself (`INSIDE_ITSELF`).
93
+ - `to: null` takes things out of every place.
94
+ - Each move leaves a history line: `asset.moved` on an item, `tag.moved` on a chip, `container.moved` on a container.
95
+
96
+ Where something is: an item's place is `containers.findForItem(cid, { itemType: 'proof', itemId })` (its
97
+ membership rows and the containers); a container's is its `parentContainerId`.