@proveanything/smartlinks 2.1.24 → 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.
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.1.24 | Generated: 2026-11-19T13:27:14.982Z
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
@@ -6278,6 +6280,7 @@ interface AssignClaimSetRangeRequest {
6278
6280
  ```typescript
6279
6281
  interface AssignClaimSetRangeResponse {
6280
6282
  changed: number
6283
+ wholeRange?: boolean
6281
6284
  skipped: Array<{ code: string; index: number; reason: 'other_range' | 'has_proof' | 'assigned_elsewhere'; collectionId?: string }>
6282
6285
  range: ClaimSetRange
6283
6286
  }
@@ -6319,6 +6322,10 @@ interface PartnerClaimSet {
6319
6322
  tapDomain: string
6320
6323
  owner: { type: 'platform' | 'partner' | 'collection' | 'user'; id: string | null }
6321
6324
  codes: number
6325
+ codeSource?: 'stored' | 'computed'
6326
+ sigBits?: number
6327
+ bareCodes?: boolean
6328
+ unassignedUrl?: string | null
6322
6329
  deleted: boolean
6323
6330
  createdAt: string | null
6324
6331
  }
@@ -6342,6 +6349,47 @@ interface CreatePartnerClaimSetRequest {
6342
6349
  name: string
6343
6350
  tagType: ClaimSetTagType
6344
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 }>
6345
6393
  }
6346
6394
  ```
6347
6395
 
@@ -6360,6 +6408,13 @@ type ClaimSetScope = { collectionId: string }
6360
6408
 
6361
6409
  **ClaimSetImportResult** = ``
6362
6410
 
6411
+ **TagCodeOn** = ``
6412
+
6413
+ **PlaceMoveItem** (type)
6414
+ ```typescript
6415
+ type PlaceMoveItem = { productId: string; proofId: string }
6416
+ ```
6417
+
6363
6418
  ### clientLog
6364
6419
 
6365
6420
  **ClientErrorReport** (interface)
@@ -7882,6 +7937,7 @@ interface PublicListContainersResponse {
7882
7937
  **FindContainersForItemResponse** (interface)
7883
7938
  ```typescript
7884
7939
  interface FindContainersForItemResponse {
7940
+ items: ContainerItem[]
7885
7941
  containers: Container[]
7886
7942
  }
7887
7943
  ```
@@ -14784,6 +14840,11 @@ Find a tag across the partner's sets by its chip UID (8 or 14 hex) or its code (
14784
14840
  **tagAttempts**(partnerId: string, uid: string) → `Promise<ClientErrorEvent[]>`
14785
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.
14786
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
+
14787
14848
  ### podcast
14788
14849
 
14789
14850
  **generate**(collectionId: string,
@@ -15231,6 +15292,17 @@ List the skills apps can invoke (name, description, input/output schema).
15231
15292
  **run**(collectionId: string, name: string, input: Record<string, any> = {}) → `Promise<T>`
15232
15293
  Invoke a skill by name with structured input — the app-facing verb; no prompt-shaping. POST /admin/collection/:collectionId/ai/skills/:name/run
15233
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
+
15234
15306
  ### tags
15235
15307
 
15236
15308
  **create**(collectionId: string,
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`.
package/openapi.yaml CHANGED
@@ -106,6 +106,8 @@ tags:
106
106
  description: Order records and line items.
107
107
  - name: partner
108
108
  description: partner API
109
+ - name: places
110
+ description: places API
109
111
  - name: product
110
112
  description: Single product operations.
111
113
  - name: products
@@ -7262,6 +7264,40 @@ paths:
7262
7264
  description: Unauthorized
7263
7265
  404:
7264
7266
  description: Not found
7267
+ /admin/collection/{collectionId}/places/move:
7268
+ post:
7269
+ tags:
7270
+ - places
7271
+ summary: "Move items (by membership), chips without an item (by membership) or containers (re-parented) into `to`, or out of every place with `to: null`."
7272
+ operationId: places_move
7273
+ security:
7274
+ - bearerAuth: []
7275
+ parameters:
7276
+ - name: collectionId
7277
+ in: path
7278
+ required: true
7279
+ schema:
7280
+ type: string
7281
+ responses:
7282
+ 200:
7283
+ description: Success
7284
+ content:
7285
+ application/json:
7286
+ schema:
7287
+ $ref: "#/components/schemas/PlaceMoveResult"
7288
+ 400:
7289
+ description: Bad request
7290
+ 401:
7291
+ description: Unauthorized
7292
+ 404:
7293
+ description: Not found
7294
+ requestBody:
7295
+ required: true
7296
+ content:
7297
+ application/json:
7298
+ schema:
7299
+ type: object
7300
+ additionalProperties: true
7265
7301
  /admin/collection/{collectionId}/product:
7266
7302
  post:
7267
7303
  tags:
@@ -15670,6 +15706,16 @@ paths:
15670
15706
  required: true
15671
15707
  schema:
15672
15708
  type: string
15709
+ - name: from
15710
+ in: query
15711
+ required: false
15712
+ schema:
15713
+ type: string
15714
+ - name: to
15715
+ in: query
15716
+ required: false
15717
+ schema:
15718
+ type: string
15673
15719
  responses:
15674
15720
  200:
15675
15721
  description: Success
@@ -27634,6 +27680,8 @@ components:
27634
27680
  properties:
27635
27681
  changed:
27636
27682
  type: number
27683
+ wholeRange:
27684
+ type: boolean
27637
27685
  skipped:
27638
27686
  type: array
27639
27687
  items:
@@ -27722,6 +27770,17 @@ components:
27722
27770
  additionalProperties: true
27723
27771
  codes:
27724
27772
  type: number
27773
+ codeSource:
27774
+ type: string
27775
+ enum:
27776
+ - stored
27777
+ - computed
27778
+ sigBits:
27779
+ type: number
27780
+ bareCodes:
27781
+ type: boolean
27782
+ unassignedUrl:
27783
+ type: string
27725
27784
  deleted:
27726
27785
  type: boolean
27727
27786
  createdAt:
@@ -27767,9 +27826,104 @@ components:
27767
27826
  $ref: "#/components/schemas/ClaimSetTagType"
27768
27827
  tapDomain:
27769
27828
  type: string
27829
+ codeSource:
27830
+ type: string
27831
+ enum:
27832
+ - stored
27833
+ - computed
27834
+ sigBits:
27835
+ type: number
27836
+ bareCodes:
27837
+ type: boolean
27838
+ unassignedUrl:
27839
+ type: string
27770
27840
  required:
27771
27841
  - name
27772
27842
  - tagType
27843
+ TagCodeRef:
27844
+ type: object
27845
+ properties:
27846
+ scan:
27847
+ type: string
27848
+ url:
27849
+ type: string
27850
+ claimSetId:
27851
+ type: string
27852
+ code:
27853
+ type: string
27854
+ tagId:
27855
+ type: string
27856
+ TagCodeAttachRequest:
27857
+ type: object
27858
+ properties:
27859
+ productId:
27860
+ type: string
27861
+ proofId:
27862
+ type: string
27863
+ containerId:
27864
+ type: string
27865
+ container:
27866
+ type: object
27867
+ additionalProperties: true
27868
+ TagCodeState:
27869
+ type: object
27870
+ properties:
27871
+ kind:
27872
+ type: string
27873
+ enum:
27874
+ - claim
27875
+ - chip
27876
+ claimSetId:
27877
+ type: string
27878
+ code:
27879
+ type: string
27880
+ url:
27881
+ type: string
27882
+ computed:
27883
+ type: boolean
27884
+ tagId:
27885
+ type: string
27886
+ tagType:
27887
+ type: string
27888
+ enum:
27889
+ - chip
27890
+ status:
27891
+ type: string
27892
+ enum:
27893
+ - free
27894
+ - attached
27895
+ - elsewhere
27896
+ on:
27897
+ $ref: "#/components/schemas/TagCodeOn"
27898
+ productId:
27899
+ type: string
27900
+ proofId:
27901
+ type: string
27902
+ required:
27903
+ - kind
27904
+ - tagType
27905
+ - status
27906
+ PlaceMoveResult:
27907
+ type: object
27908
+ properties:
27909
+ moved:
27910
+ type: array
27911
+ items:
27912
+ type: object
27913
+ additionalProperties: true
27914
+ unchanged:
27915
+ type: array
27916
+ items:
27917
+ $ref: "#/components/schemas/PlaceMoveItem"
27918
+ refused:
27919
+ type: array
27920
+ items:
27921
+ type: object
27922
+ additionalProperties: true
27923
+ required:
27924
+ - moved
27925
+ - unchanged
27926
+ - refused
27773
27927
  ClaimSetScope:
27774
27928
  type: object
27775
27929
  properties:
@@ -27777,6 +27931,14 @@ components:
27777
27931
  type: string
27778
27932
  required:
27779
27933
  - collectionId
27934
+ PlaceMoveItem:
27935
+ type: object
27936
+ properties:
27937
+ productId:
27938
+ type: object
27939
+ additionalProperties: true
27940
+ required:
27941
+ - productId
27780
27942
  ClaimSetTagType:
27781
27943
  type: string
27782
27944
  enum:
@@ -27815,6 +27977,9 @@ components:
27815
27977
  - duplicate_uid
27816
27978
  - uid_in_use
27817
27979
  - uid_conflict
27980
+ TagCodeOn:
27981
+ type: object
27982
+ additionalProperties: true
27818
27983
  ClientErrorReport:
27819
27984
  type: object
27820
27985
  properties:
@@ -29671,11 +29836,16 @@ components:
29671
29836
  FindContainersForItemResponse:
29672
29837
  type: object
29673
29838
  properties:
29839
+ items:
29840
+ type: array
29841
+ items:
29842
+ $ref: "#/components/schemas/ContainerItem"
29674
29843
  containers:
29675
29844
  type: array
29676
29845
  items:
29677
29846
  $ref: "#/components/schemas/Container"
29678
29847
  required:
29848
+ - items
29679
29849
  - containers
29680
29850
  ContainerItemsResponse:
29681
29851
  type: object