@proveanything/smartlinks 1.15.3 → 1.15.4

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/dist/openapi.yaml CHANGED
@@ -24084,6 +24084,67 @@ components:
24084
24084
  $ref: "#/components/schemas/JsonValue"
24085
24085
  required:
24086
24086
  - claimId
24087
+ ScopedFieldOption:
24088
+ type: object
24089
+ properties:
24090
+ value:
24091
+ type: string
24092
+ label:
24093
+ type: string
24094
+ required:
24095
+ - value
24096
+ - label
24097
+ ScopedFieldDef:
24098
+ type: object
24099
+ properties:
24100
+ key:
24101
+ type: string
24102
+ label:
24103
+ type: string
24104
+ type:
24105
+ $ref: "#/components/schemas/ScopedFieldType"
24106
+ required:
24107
+ type: boolean
24108
+ placeholder:
24109
+ type: string
24110
+ help:
24111
+ type: string
24112
+ options:
24113
+ type: array
24114
+ items:
24115
+ $ref: "#/components/schemas/ScopedFieldOption"
24116
+ defaultValue:
24117
+ $ref: "#/components/schemas/JsonValue"
24118
+ showInTable:
24119
+ type: boolean
24120
+ showInDetail:
24121
+ type: boolean
24122
+ required:
24123
+ - key
24124
+ - label
24125
+ - type
24126
+ ProductFieldsConfig:
24127
+ type: object
24128
+ properties:
24129
+ fields:
24130
+ type: array
24131
+ items:
24132
+ $ref: "#/components/schemas/ProductFieldDef"
24133
+ required:
24134
+ - fields
24135
+ ProofValues:
24136
+ type: object
24137
+ properties:
24138
+ owner:
24139
+ type: object
24140
+ additionalProperties:
24141
+ $ref: "#/components/schemas/JsonValue"
24142
+ personal:
24143
+ type: object
24144
+ additionalProperties:
24145
+ type: object
24146
+ additionalProperties:
24147
+ $ref: "#/components/schemas/JsonValue"
24087
24148
  Proof:
24088
24149
  type: object
24089
24150
  properties:
@@ -24103,9 +24164,16 @@ components:
24103
24164
  type: boolean
24104
24165
  virtual:
24105
24166
  type: boolean
24106
- values:
24167
+ data:
24107
24168
  type: object
24108
- additionalProperties: true
24169
+ additionalProperties:
24170
+ $ref: "#/components/schemas/JsonValue"
24171
+ admin:
24172
+ type: object
24173
+ additionalProperties:
24174
+ $ref: "#/components/schemas/JsonValue"
24175
+ values:
24176
+ $ref: "#/components/schemas/ProofValues"
24109
24177
  required:
24110
24178
  - collectionId
24111
24179
  - createdAt
@@ -24118,14 +24186,30 @@ components:
24118
24186
  type: object
24119
24187
  properties:
24120
24188
  values:
24189
+ $ref: "#/components/schemas/ProofValues"
24190
+ data:
24121
24191
  type: object
24122
- additionalProperties: true
24192
+ additionalProperties:
24193
+ $ref: "#/components/schemas/JsonValue"
24194
+ admin:
24195
+ type: object
24196
+ additionalProperties:
24197
+ $ref: "#/components/schemas/JsonValue"
24123
24198
  claimable:
24124
24199
  type: boolean
24125
24200
  virtual:
24126
24201
  type: boolean
24127
24202
  required:
24128
24203
  - values
24204
+ ProofFieldsConfig:
24205
+ type: object
24206
+ properties:
24207
+ fields:
24208
+ type: array
24209
+ items:
24210
+ $ref: "#/components/schemas/ProofFieldDef"
24211
+ required:
24212
+ - fields
24129
24213
  ProofResponse:
24130
24214
  type: object
24131
24215
  additionalProperties: true
@@ -85,7 +85,9 @@ export interface Product extends ProductKey {
85
85
  facets?: ProductFacetMap;
86
86
  /** Tag keys where value is true */
87
87
  tags?: Record<string, boolean>;
88
+ /** Public custom data — readable by everyone, writable by business admins only. */
88
89
  data?: Record<string, JsonValue>;
90
+ /** Business-only custom data — stripped from public/non-admin reads. See docs/proof-product-data-scoping.md. */
89
91
  admin?: Record<string, JsonValue>;
90
92
  extra?: Record<string, JsonValue>;
91
93
  validCollections?: string[] | null;
@@ -161,3 +163,38 @@ export type ProductClaimCreateRequestBody = Omit<ProductClaimCreateInput, 'colle
161
163
  export type ProductResponse = Product;
162
164
  export type ProductCreateRequest = ProductWriteInput;
163
165
  export type ProductUpdateRequest = Partial<Omit<ProductWriteInput, 'id'>>;
166
+ export type ScopedFieldType = 'text' | 'textarea' | 'number' | 'date' | 'select' | 'switch' | 'url';
167
+ export interface ScopedFieldOption {
168
+ value: string;
169
+ label: string;
170
+ }
171
+ export interface ScopedFieldDef {
172
+ /** Stable key. Written into the resolved bag at this name. */
173
+ key: string;
174
+ /** Human label for editors and read-only renderers. */
175
+ label: string;
176
+ type: ScopedFieldType;
177
+ required?: boolean;
178
+ placeholder?: string;
179
+ help?: string;
180
+ /** Required when type === 'select'. */
181
+ options?: ScopedFieldOption[];
182
+ /** Default value applied when creating a new record. */
183
+ defaultValue?: JsonValue;
184
+ /** Show as a column in the default items table. */
185
+ showInTable?: boolean;
186
+ /** Show on the inline detail / edit view. */
187
+ showInDetail?: boolean;
188
+ }
189
+ /**
190
+ * `'public'` (default, omitted) reads/writes `product.data[key]`.
191
+ * `'admin'` reads/writes `product.admin[key]` (admin only).
192
+ */
193
+ export type ProductFieldScope = 'public' | 'admin';
194
+ export type ProductFieldDef = ScopedFieldDef & {
195
+ scope?: ProductFieldScope;
196
+ };
197
+ /** Shape of the `productFields` collection settings group. */
198
+ export interface ProductFieldsConfig {
199
+ fields: ProductFieldDef[];
200
+ }
@@ -1,3 +1,17 @@
1
+ import { JsonValue, ScopedFieldDef } from './product';
2
+ /**
3
+ * `proof.values` — the owner + business-writable bag.
4
+ * Public keys sit at the root (business + current owner can write, everyone
5
+ * can read); `owner` and `personal` are reserved sub-keys with their own
6
+ * read/write rules. See docs/proof-product-data-scoping.md.
7
+ */
8
+ export interface ProofValues {
9
+ [key: string]: JsonValue | Record<string, JsonValue> | Record<string, Record<string, JsonValue>> | undefined;
10
+ /** Owner-scoped: read/write by business + current owner; transfers with ownership. */
11
+ owner?: Record<string, JsonValue>;
12
+ /** Per-user: read/write only by the matching userId; not visible to the next owner, not even business admins. */
13
+ personal?: Record<string, Record<string, JsonValue>>;
14
+ }
1
15
  /**
2
16
  * Represents a Proof object.
3
17
  */
@@ -18,14 +32,36 @@ export interface Proof {
18
32
  claimable?: boolean;
19
33
  /** Is this proof virtual */
20
34
  virtual?: boolean;
21
- /** Arbitrary key-value pairs for proof values */
22
- values: Record<string, any>;
35
+ /** Public, business-writable spec data readable by everyone. */
36
+ data?: Record<string, JsonValue>;
37
+ /** Business-only spec data — stripped from public/non-admin reads. */
38
+ admin?: Record<string, JsonValue>;
39
+ /** Owner + business-writable consumer data. See ProofValues. */
40
+ values: ProofValues;
23
41
  }
24
42
  export type ProofResponse = Proof;
25
43
  export interface ProofCreateRequest {
26
- values: Record<string, any>;
44
+ values: ProofValues;
45
+ /** Business-writable public spec data. */
46
+ data?: Record<string, JsonValue>;
47
+ /** Business-only spec data. */
48
+ admin?: Record<string, JsonValue>;
27
49
  claimable?: boolean;
28
50
  virtual?: boolean;
29
51
  }
30
52
  export type ProofUpdateRequest = Partial<ProofCreateRequest>;
31
53
  export type ProofClaimRequest = Record<string, any>;
54
+ /**
55
+ * `'public'` (default, omitted) reads/writes `proof.values[key]`.
56
+ * `'owner'` reads/writes `proof.values.owner[key]`.
57
+ * `'personal'` reads/writes `proof.values.personal[userId][key]`.
58
+ * `'admin'` reads/writes `proof.admin[key]` (admin only).
59
+ */
60
+ export type ProofFieldScope = 'public' | 'owner' | 'personal' | 'admin';
61
+ export type ProofFieldDef = ScopedFieldDef & {
62
+ scope?: ProofFieldScope;
63
+ };
64
+ /** Shape of the `proofFields` collection settings group. */
65
+ export interface ProofFieldsConfig {
66
+ fields: ProofFieldDef[];
67
+ }
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.15.3 | Generated: 2026-07-11T13:25:50.969Z
3
+ Version: 1.15.4 | Generated: 2026-07-14T15:01:53.978Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -42,6 +42,7 @@ For detailed guides on specific features:
42
42
  - **[Portal Back Button](portal-back-button.md)** - `parentPath` contract for hierarchy-aware "up" navigation; `useDeepLinkSync` integration
43
43
  - **[Contact Search](contact-search.md)** - Admin contact search: free-text, typeahead, identity/tag/JSONB filters, and pagination
44
44
  - **[App Data Storage](app-data-storage.md)** - User-specific and collection-scoped app data storage
45
+ - **[Product/Proof Data Scoping](proof-product-data-scoping.md)** - Canonical spec for `product.data`/`.admin` and `proof.data`/`.admin`/`.values` (owner/personal) buckets, read/write authority, and the `productFields`/`proofFields` collection-settings schemas
45
46
  - **[Forms](forms.md)** - Platform-managed form definitions, submissions, and schema-driven React form UI
46
47
  - **[App Objects: Cases, Threads & Records](app-objects.md)** - Generic app-scoped building blocks for support cases, discussions, bookings, registrations, and more
47
48
  - **[App Records Pattern](app-records-pattern.md)** - Canonical pattern for storing per-product, per-facet, or rule-targeted app data
@@ -6946,6 +6947,37 @@ interface ProductQueryResponse {
6946
6947
  }
6947
6948
  ```
6948
6949
 
6950
+ **ScopedFieldOption** (interface)
6951
+ ```typescript
6952
+ interface ScopedFieldOption {
6953
+ value: string
6954
+ label: string
6955
+ }
6956
+ ```
6957
+
6958
+ **ScopedFieldDef** (interface)
6959
+ ```typescript
6960
+ interface ScopedFieldDef {
6961
+ key: string
6962
+ label: string
6963
+ type: ScopedFieldType
6964
+ required?: boolean
6965
+ placeholder?: string
6966
+ help?: string
6967
+ options?: ScopedFieldOption[]
6968
+ defaultValue?: JsonValue
6969
+ showInTable?: boolean
6970
+ showInDetail?: boolean
6971
+ }
6972
+ ```
6973
+
6974
+ **ProductFieldsConfig** (interface)
6975
+ ```typescript
6976
+ interface ProductFieldsConfig {
6977
+ fields: ProductFieldDef[]
6978
+ }
6979
+ ```
6980
+
6949
6981
  **JsonPrimitive** = `string | number | boolean | null`
6950
6982
 
6951
6983
  **JsonValue** = ``
@@ -6962,8 +6994,23 @@ interface ProductQueryResponse {
6962
6994
 
6963
6995
  **ProductUpdateRequest** = `Partial<Omit<ProductWriteInput, 'id'>>`
6964
6996
 
6997
+ **ScopedFieldType** = ``
6998
+
6999
+ **ProductFieldScope** = `'public' | 'admin'`
7000
+
7001
+ **ProductFieldDef** = `ScopedFieldDef & { scope?: ProductFieldScope }`
7002
+
6965
7003
  ### proof
6966
7004
 
7005
+ **ProofValues** (interface)
7006
+ ```typescript
7007
+ interface ProofValues {
7008
+ [key: string]: JsonValue | Record<string, JsonValue> | Record<string, Record<string, JsonValue>> | undefined
7009
+ owner?: Record<string, JsonValue>
7010
+ personal?: Record<string, Record<string, JsonValue>>
7011
+ }
7012
+ ```
7013
+
6967
7014
  **Proof** (interface)
6968
7015
  ```typescript
6969
7016
  interface Proof {
@@ -6975,25 +7022,40 @@ interface Proof {
6975
7022
  userId: string
6976
7023
  claimable?: boolean
6977
7024
  virtual?: boolean
6978
- values: Record<string, any>
7025
+ data?: Record<string, JsonValue>
7026
+ admin?: Record<string, JsonValue>
7027
+ values: ProofValues
6979
7028
  }
6980
7029
  ```
6981
7030
 
6982
7031
  **ProofCreateRequest** (interface)
6983
7032
  ```typescript
6984
7033
  interface ProofCreateRequest {
6985
- values: Record<string, any>
7034
+ values: ProofValues
7035
+ data?: Record<string, JsonValue>
7036
+ admin?: Record<string, JsonValue>
6986
7037
  claimable?: boolean
6987
7038
  virtual?: boolean
6988
7039
  }
6989
7040
  ```
6990
7041
 
7042
+ **ProofFieldsConfig** (interface)
7043
+ ```typescript
7044
+ interface ProofFieldsConfig {
7045
+ fields: ProofFieldDef[]
7046
+ }
7047
+ ```
7048
+
6991
7049
  **ProofResponse** = `Proof`
6992
7050
 
6993
7051
  **ProofUpdateRequest** = `Partial<ProofCreateRequest>`
6994
7052
 
6995
7053
  **ProofClaimRequest** = `Record<string, any>`
6996
7054
 
7055
+ **ProofFieldScope** = `'public' | 'owner' | 'personal' | 'admin'`
7056
+
7057
+ **ProofFieldDef** = `ScopedFieldDef & { scope?: ProofFieldScope }`
7058
+
6997
7059
  ### qr
6998
7060
 
6999
7061
  **QrShortCodeLookupResponse** (interface)
@@ -2,6 +2,8 @@
2
2
 
3
3
  The SmartLinks platform provides two distinct types of data storage for apps:
4
4
 
5
+ > **Not what you're looking for?** This guide covers app-owned config/records scoped to a collection or product. For the core product/proof documents themselves — `product.data`/`.admin`, `proof.data`/`.admin`/`.values` (owner/personal) — see [proof-product-data-scoping.md](proof-product-data-scoping.md).
6
+
5
7
  ## Choose the Right Model First
6
8
 
7
9
  There are now two different families of flexible app data in SmartLinks, and they solve different problems:
package/docs/overview.md CHANGED
@@ -80,6 +80,7 @@ The SmartLinks SDK (`@proveanything/smartlinks`) includes comprehensive document
80
80
  | **Contact Search** | `docs/contact-search.md` | Admin contact search: free-text, typeahead, identity/tag/JSONB filters, and pagination |
81
81
  | **App Records Pattern** | `docs/app-records-pattern.md` | Standard pattern for per-product/facet/variant/batch admin + public widget UIs |
82
82
  | **UI Utils** | `docs/ui-utils.md` | `@proveanything/smartlinks-utils-ui` — React shells, hooks, and primitives for records-based apps |
83
+ | **Product/Proof Data Scoping** | `docs/proof-product-data-scoping.md` | Canonical spec for `product.data`/`.admin` and `proof.data`/`.admin`/`.values` (owner/personal) — who can read and write each bucket |
83
84
 
84
85
  ---
85
86
 
@@ -204,6 +205,12 @@ Prefer `app.records` over `setDataItem` when the data is becoming a real entity
204
205
 
205
206
  For data attached to specific proof instances, use `SL.attestation.create()` and `SL.attestation.list()`.
206
207
 
208
+ ### Custom Data Scoping (Product & Proof)
209
+
210
+ `product.data`/`product.admin` and `proof.data`/`proof.admin`/`proof.values` are the canonical buckets for custom fields on products and proofs — `data` is public and business-writable, `admin` is business-only, and `proof.values` additionally supports owner-scoped (`values.owner`) and per-user (`values.personal[userId]`) sub-keys. This is a different mechanism from the app-scoped storage in `docs/app-data-storage.md` (which is for app-owned config/records, not the product/proof documents themselves).
211
+
212
+ See `docs/proof-product-data-scoping.md` for the full read/write authority matrix, worked examples, and the `productFields`/`proofFields` collection-settings schemas that drive field-config editors.
213
+
207
214
  ---
208
215
 
209
216
  ## Error Handling