@proveanything/smartlinks 2.1.8 → 2.1.11
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/api/claimSet.d.ts +37 -1
- package/dist/api/claimSet.js +83 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/partner.d.ts +19 -0
- package/dist/api/partner.js +35 -0
- package/dist/docs/API_SUMMARY.md +275 -35
- package/dist/docs/tag-ranges.md +75 -0
- package/dist/docs/theme-tokens.md +8 -0
- package/dist/http.js +3 -0
- package/dist/idbConnection.d.ts +14 -0
- package/dist/idbConnection.js +91 -0
- package/dist/openapi.yaml +1494 -680
- package/dist/persistentCache.js +36 -95
- package/dist/theme.css +20 -0
- package/dist/translationCache.js +49 -114
- package/dist/types/claimSet.d.ts +185 -0
- package/docs/API_SUMMARY.md +275 -35
- package/docs/tag-ranges.md +75 -0
- package/docs/theme-tokens.md +8 -0
- package/openapi.yaml +1494 -680
- package/package.json +87 -87
- package/scripts/publish.mjs +22 -7
package/dist/api/claimSet.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UpdateClaimDataRequest, AssignClaimsRequest, CreateClaimSetTagRequest, CreateClaimSetTagResponse, CreateClaimSetRequest, ImportClaimSetTagsRequest, ImportClaimSetTagsResponse } from "../types/index.js";
|
|
1
|
+
import { ClaimSetScope, ClaimSetRange, CreateClaimSetRangeRequest, UpdateClaimSetRangeRequest, ClaimSetRangeTagsPage, ClaimSetRangeTag, ClaimSetRangeNextTag, ImportClaimSetRangeUidsRequest, ImportClaimSetRangeUidsResponse, AssignClaimSetRangeRequest, AssignClaimSetRangeResponse, ClaimSetRangeFile, UpdateClaimDataRequest, AssignClaimsRequest, CreateClaimSetTagRequest, CreateClaimSetTagResponse, CreateClaimSetRequest, ImportClaimSetTagsRequest, ImportClaimSetTagsResponse } from "../types/index.js";
|
|
2
2
|
export declare namespace claimSet {
|
|
3
3
|
/**
|
|
4
4
|
* Get all claim sets.
|
|
@@ -95,4 +95,40 @@ export declare namespace claimSet {
|
|
|
95
95
|
* @param data – Claim data to update
|
|
96
96
|
*/
|
|
97
97
|
function updateClaimData(collectionId: string, data: UpdateClaimDataRequest): Promise<any>;
|
|
98
|
+
namespace ranges {
|
|
99
|
+
/** The ranges in a set, lowest index first. */
|
|
100
|
+
function list(scope: ClaimSetScope, claimSetId: string): Promise<ClaimSetRange[]>;
|
|
101
|
+
/** Reserve the set's next indexes and mint a code (and, for NTAG 424, a key) for each. */
|
|
102
|
+
function create(scope: ClaimSetScope, claimSetId: string, params: CreateClaimSetRangeRequest): Promise<ClaimSetRange>;
|
|
103
|
+
/** One range, with its counts refreshed. */
|
|
104
|
+
function get(scope: ClaimSetScope, claimSetId: string, rangeId: string): Promise<ClaimSetRange>;
|
|
105
|
+
/** Name, notes, order details, or a stage move (sent to the printer, received). */
|
|
106
|
+
function update(scope: ClaimSetScope, claimSetId: string, rangeId: string, params: UpdateClaimSetRangeRequest): Promise<ClaimSetRange>;
|
|
107
|
+
/** Finish minting a range that was interrupted. */
|
|
108
|
+
function resume(scope: ClaimSetScope, claimSetId: string, rangeId: string): Promise<ClaimSetRange>;
|
|
109
|
+
/** The range's tags in index order, a page at a time (keys: owners/admins only). */
|
|
110
|
+
function tags(scope: ClaimSetScope, claimSetId: string, rangeId: string, options?: {
|
|
111
|
+
from?: number;
|
|
112
|
+
limit?: number;
|
|
113
|
+
keys?: boolean;
|
|
114
|
+
}): Promise<ClaimSetRangeTagsPage>;
|
|
115
|
+
/** The next tag to program on a phone (lowest index without a chip), with its URL and key. */
|
|
116
|
+
function next(scope: ClaimSetScope, claimSetId: string, rangeId: string): Promise<ClaimSetRangeNextTag>;
|
|
117
|
+
/** Record the chip a phone just programmed with this code. */
|
|
118
|
+
function recordTag(scope: ClaimSetScope, claimSetId: string, rangeId: string, code: string, params: {
|
|
119
|
+
uid: string;
|
|
120
|
+
data?: Record<string, unknown>;
|
|
121
|
+
}): Promise<{
|
|
122
|
+
tag: ClaimSetRangeTag;
|
|
123
|
+
range: ClaimSetRange;
|
|
124
|
+
}>;
|
|
125
|
+
/** The printer file (CSV text in `csv`). Carries the tags' keys: don't keep it around. */
|
|
126
|
+
function exportFile(scope: ClaimSetScope, claimSetId: string, rangeId: string): Promise<ClaimSetRangeFile>;
|
|
127
|
+
/** The manufacturer's instruction sheet: PDF (base64) or Markdown. */
|
|
128
|
+
function instructions(scope: ClaimSetScope, claimSetId: string, rangeId: string, format?: 'pdf' | 'md'): Promise<ClaimSetRangeFile>;
|
|
129
|
+
/** The manufacturer's file back: check it (commit false), then write the chip UIDs (commit true). */
|
|
130
|
+
function importUids(scope: ClaimSetScope, claimSetId: string, rangeId: string, params: ImportClaimSetRangeUidsRequest): Promise<ImportClaimSetRangeUidsResponse>;
|
|
131
|
+
/** Point the range (or from–to within it) at a collection / product / batch, or clear it. */
|
|
132
|
+
function assign(scope: ClaimSetScope, claimSetId: string, rangeId: string, params: AssignClaimSetRangeRequest): Promise<AssignClaimSetRangeResponse>;
|
|
133
|
+
}
|
|
98
134
|
}
|
package/dist/api/claimSet.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { request, post, put, del } from "../http.js";
|
|
1
|
+
import { request, post, put, patch, del } from "../http.js";
|
|
2
2
|
/**
|
|
3
3
|
* Returns the base path for claim set endpoints.
|
|
4
4
|
* When collectionId is provided, routes to the collection-scoped admin API.
|
|
@@ -9,6 +9,13 @@ function base(collectionId) {
|
|
|
9
9
|
? `/admin/collection/${encodeURIComponent(collectionId)}/claimSet`
|
|
10
10
|
: `/admin/claimSet`;
|
|
11
11
|
}
|
|
12
|
+
/** The range API's base for a scope: a collection's own sets, or a partner's sets. */
|
|
13
|
+
function rangesBase(scope, claimSetId) {
|
|
14
|
+
const root = 'partnerId' in scope
|
|
15
|
+
? `/admin/partner/${encodeURIComponent(scope.partnerId)}/claimSet`
|
|
16
|
+
: base(scope.collectionId);
|
|
17
|
+
return `${root}/${encodeURIComponent(claimSetId)}/ranges`;
|
|
18
|
+
}
|
|
12
19
|
export var claimSet;
|
|
13
20
|
(function (claimSet) {
|
|
14
21
|
/**
|
|
@@ -152,4 +159,79 @@ export var claimSet;
|
|
|
152
159
|
return post(`${base(collectionId)}/updateClaimData`, data);
|
|
153
160
|
}
|
|
154
161
|
claimSet.updateClaimData = updateClaimData;
|
|
162
|
+
// ─── Ranges: mint, print, receive, assign ──────────────────────────────────────────────────────
|
|
163
|
+
// A range is a named, contiguous block of tags in one claim set. Scope: { collectionId } for a
|
|
164
|
+
// collection's own sets, { partnerId } for a partner's sets (see partner.*). Owners and admins mint,
|
|
165
|
+
// export, import and program; assigners assign. Responses are never cached (they carry keys).
|
|
166
|
+
let ranges;
|
|
167
|
+
(function (ranges) {
|
|
168
|
+
/** The ranges in a set, lowest index first. */
|
|
169
|
+
async function list(scope, claimSetId) {
|
|
170
|
+
return request(rangesBase(scope, claimSetId));
|
|
171
|
+
}
|
|
172
|
+
ranges.list = list;
|
|
173
|
+
/** Reserve the set's next indexes and mint a code (and, for NTAG 424, a key) for each. */
|
|
174
|
+
async function create(scope, claimSetId, params) {
|
|
175
|
+
return post(rangesBase(scope, claimSetId), params);
|
|
176
|
+
}
|
|
177
|
+
ranges.create = create;
|
|
178
|
+
/** One range, with its counts refreshed. */
|
|
179
|
+
async function get(scope, claimSetId, rangeId) {
|
|
180
|
+
return request(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}`);
|
|
181
|
+
}
|
|
182
|
+
ranges.get = get;
|
|
183
|
+
/** Name, notes, order details, or a stage move (sent to the printer, received). */
|
|
184
|
+
async function update(scope, claimSetId, rangeId, params) {
|
|
185
|
+
return patch(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}`, params);
|
|
186
|
+
}
|
|
187
|
+
ranges.update = update;
|
|
188
|
+
/** Finish minting a range that was interrupted. */
|
|
189
|
+
async function resume(scope, claimSetId, rangeId) {
|
|
190
|
+
return post(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/resume`, {});
|
|
191
|
+
}
|
|
192
|
+
ranges.resume = resume;
|
|
193
|
+
/** The range's tags in index order, a page at a time (keys: owners/admins only). */
|
|
194
|
+
async function tags(scope, claimSetId, rangeId, options = {}) {
|
|
195
|
+
const q = new URLSearchParams();
|
|
196
|
+
if (options.from !== undefined)
|
|
197
|
+
q.set('from', String(options.from));
|
|
198
|
+
if (options.limit !== undefined)
|
|
199
|
+
q.set('limit', String(options.limit));
|
|
200
|
+
if (options.keys)
|
|
201
|
+
q.set('keys', '1');
|
|
202
|
+
const qs = q.toString();
|
|
203
|
+
return request(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/tags${qs ? `?${qs}` : ''}`);
|
|
204
|
+
}
|
|
205
|
+
ranges.tags = tags;
|
|
206
|
+
/** The next tag to program on a phone (lowest index without a chip), with its URL and key. */
|
|
207
|
+
async function next(scope, claimSetId, rangeId) {
|
|
208
|
+
return request(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/next`);
|
|
209
|
+
}
|
|
210
|
+
ranges.next = next;
|
|
211
|
+
/** Record the chip a phone just programmed with this code. */
|
|
212
|
+
async function recordTag(scope, claimSetId, rangeId, code, params) {
|
|
213
|
+
return put(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/tags/${encodeURIComponent(code)}`, params);
|
|
214
|
+
}
|
|
215
|
+
ranges.recordTag = recordTag;
|
|
216
|
+
/** The printer file (CSV text in `csv`). Carries the tags' keys: don't keep it around. */
|
|
217
|
+
async function exportFile(scope, claimSetId, rangeId) {
|
|
218
|
+
return request(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/export?as=json`);
|
|
219
|
+
}
|
|
220
|
+
ranges.exportFile = exportFile;
|
|
221
|
+
/** The manufacturer's instruction sheet: PDF (base64) or Markdown. */
|
|
222
|
+
async function instructions(scope, claimSetId, rangeId, format = 'pdf') {
|
|
223
|
+
return request(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/instructions?format=${format}&as=json`);
|
|
224
|
+
}
|
|
225
|
+
ranges.instructions = instructions;
|
|
226
|
+
/** The manufacturer's file back: check it (commit false), then write the chip UIDs (commit true). */
|
|
227
|
+
async function importUids(scope, claimSetId, rangeId, params) {
|
|
228
|
+
return post(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/import`, params);
|
|
229
|
+
}
|
|
230
|
+
ranges.importUids = importUids;
|
|
231
|
+
/** Point the range (or from–to within it) at a collection / product / batch, or clear it. */
|
|
232
|
+
async function assign(scope, claimSetId, rangeId, params) {
|
|
233
|
+
return post(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/assign`, params);
|
|
234
|
+
}
|
|
235
|
+
ranges.assign = assign;
|
|
236
|
+
})(ranges = claimSet.ranges || (claimSet.ranges = {}));
|
|
155
237
|
})(claimSet || (claimSet = {}));
|
package/dist/api/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { auth } from "./auth.js";
|
|
|
10
10
|
export { form } from "./form.js";
|
|
11
11
|
export { authKit } from "./authKit.js";
|
|
12
12
|
export { claimSet } from "./claimSet.js";
|
|
13
|
+
export { partner } from "./partner.js";
|
|
13
14
|
export { crate } from "./crate.js";
|
|
14
15
|
export { batch } from "./batch.js";
|
|
15
16
|
export { variant } from "./variant.js";
|
package/dist/api/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { auth } from "./auth.js";
|
|
|
12
12
|
export { form } from "./form.js";
|
|
13
13
|
export { authKit } from "./authKit.js";
|
|
14
14
|
export { claimSet } from "./claimSet.js";
|
|
15
|
+
export { partner } from "./partner.js";
|
|
15
16
|
export { crate } from "./crate.js";
|
|
16
17
|
export { batch } from "./batch.js";
|
|
17
18
|
export { variant } from "./variant.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Partner, PartnerClaimSet, CreatePartnerClaimSetRequest } from "../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Partners: organisations above collections (FanConnect, Zenith Coins, …) that own NFC claim sets and
|
|
4
|
+
* assign their tags into collections their people administer. Partners and their members are set up by
|
|
5
|
+
* SmartLinks staff; these calls are what a partner's people use. Ranges inside a partner's sets:
|
|
6
|
+
* claimSet.ranges.* with scope { partnerId }.
|
|
7
|
+
*/
|
|
8
|
+
export declare namespace partner {
|
|
9
|
+
/** The partners you belong to, with your role in each. Empty for everyone else. */
|
|
10
|
+
function list(): Promise<Partner[]>;
|
|
11
|
+
/** One partner (owners also see its members). */
|
|
12
|
+
function get(partnerId: string): Promise<Partner>;
|
|
13
|
+
/** The partner's claim sets. */
|
|
14
|
+
function claimSets(partnerId: string): Promise<PartnerClaimSet[]>;
|
|
15
|
+
/** One of the partner's claim sets. */
|
|
16
|
+
function getClaimSet(partnerId: string, claimSetId: string): Promise<PartnerClaimSet>;
|
|
17
|
+
/** A new claim set for the partner, on one of its tap domains (owners and admins). */
|
|
18
|
+
function createClaimSet(partnerId: string, params: CreatePartnerClaimSetRequest): Promise<PartnerClaimSet>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { request, post } from "../http.js";
|
|
2
|
+
/**
|
|
3
|
+
* Partners: organisations above collections (FanConnect, Zenith Coins, …) that own NFC claim sets and
|
|
4
|
+
* assign their tags into collections their people administer. Partners and their members are set up by
|
|
5
|
+
* SmartLinks staff; these calls are what a partner's people use. Ranges inside a partner's sets:
|
|
6
|
+
* claimSet.ranges.* with scope { partnerId }.
|
|
7
|
+
*/
|
|
8
|
+
export var partner;
|
|
9
|
+
(function (partner) {
|
|
10
|
+
/** The partners you belong to, with your role in each. Empty for everyone else. */
|
|
11
|
+
async function list() {
|
|
12
|
+
return request(`/admin/partner`);
|
|
13
|
+
}
|
|
14
|
+
partner.list = list;
|
|
15
|
+
/** One partner (owners also see its members). */
|
|
16
|
+
async function get(partnerId) {
|
|
17
|
+
return request(`/admin/partner/${encodeURIComponent(partnerId)}`);
|
|
18
|
+
}
|
|
19
|
+
partner.get = get;
|
|
20
|
+
/** The partner's claim sets. */
|
|
21
|
+
async function claimSets(partnerId) {
|
|
22
|
+
return request(`/admin/partner/${encodeURIComponent(partnerId)}/claimSet`);
|
|
23
|
+
}
|
|
24
|
+
partner.claimSets = claimSets;
|
|
25
|
+
/** One of the partner's claim sets. */
|
|
26
|
+
async function getClaimSet(partnerId, claimSetId) {
|
|
27
|
+
return request(`/admin/partner/${encodeURIComponent(partnerId)}/claimSet/${encodeURIComponent(claimSetId)}`);
|
|
28
|
+
}
|
|
29
|
+
partner.getClaimSet = getClaimSet;
|
|
30
|
+
/** A new claim set for the partner, on one of its tap domains (owners and admins). */
|
|
31
|
+
async function createClaimSet(partnerId, params) {
|
|
32
|
+
return post(`/admin/partner/${encodeURIComponent(partnerId)}/claimSet`, params);
|
|
33
|
+
}
|
|
34
|
+
partner.createClaimSet = createClaimSet;
|
|
35
|
+
})(partner || (partner = {}));
|
package/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.11 | Generated: 2026-11-08T09:25:58.482Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -153,6 +153,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
153
153
|
- **lots** - Functions for lots operations
|
|
154
154
|
- **navigation** - Functions for navigation operations
|
|
155
155
|
- **order** - Functions for order operations
|
|
156
|
+
- **partner** - Functions for partner operations
|
|
156
157
|
- **products** - Functions for products operations
|
|
157
158
|
- **realtime** - Functions for realtime operations
|
|
158
159
|
- **research** - Functions for research operations
|
|
@@ -186,17 +187,17 @@ The release channel explicitly set for this app build (initializeApi({ appChanne
|
|
|
186
187
|
**setAppChannel**(channel: string | undefined) → `void`
|
|
187
188
|
Set (or clear) the release channel SL.functions calls target.
|
|
188
189
|
|
|
189
|
-
**initializeApi**(options: {
|
|
190
|
-
baseURL: string
|
|
191
|
-
apiKey?: string
|
|
192
|
-
bearerToken?: string
|
|
193
|
-
proxyMode?: boolean
|
|
194
|
-
ngrokSkipBrowserWarning?: boolean
|
|
195
|
-
extraHeaders?: Record<string, string>
|
|
196
|
-
/**
|
|
197
|
-
* Declares the host platform. Set to `'native'` on native/Capacitor hosts to opt into
|
|
198
|
-
* AuthKit refresh tokens — the SDK then sends `X-Client-Platform: native` on every
|
|
199
|
-
* request, so login endpoints return `refreshToken`/`refreshTokenExpiresAt` and a
|
|
190
|
+
**initializeApi**(options: {
|
|
191
|
+
baseURL: string
|
|
192
|
+
apiKey?: string
|
|
193
|
+
bearerToken?: string
|
|
194
|
+
proxyMode?: boolean
|
|
195
|
+
ngrokSkipBrowserWarning?: boolean
|
|
196
|
+
extraHeaders?: Record<string, string>
|
|
197
|
+
/**
|
|
198
|
+
* Declares the host platform. Set to `'native'` on native/Capacitor hosts to opt into
|
|
199
|
+
* AuthKit refresh tokens — the SDK then sends `X-Client-Platform: native` on every
|
|
200
|
+
* request, so login endpoints return `refreshToken`/`refreshTokenExpiresAt` and a
|
|
200
201
|
* short-lived access token. Omit (or `'web'`) → `void`
|
|
201
202
|
Call this once (e.g. at app startup) to configure baseURL/auth.
|
|
202
203
|
|
|
@@ -227,56 +228,56 @@ Returns true if initializeApi() has been called at least once. Useful for guards
|
|
|
227
228
|
**hasAuthCredentials**() → `boolean`
|
|
228
229
|
Returns true if the SDK currently has any auth credential set (bearer token or API key). Use this as a cheap pre-flight check before calling endpoints that require authentication, to avoid issuing a network request that you already know will return a 401. ```ts if (hasAuthCredentials()) { const account = await auth.getAccount() } ```
|
|
229
230
|
|
|
230
|
-
**configureSdkCache**(options: {
|
|
231
|
-
enabled?: boolean
|
|
232
|
-
ttlMs?: number
|
|
233
|
-
maxEntries?: number
|
|
234
|
-
persistence?: 'none' | 'indexeddb'
|
|
235
|
-
persistenceTtlMs?: number
|
|
236
|
-
serveStaleOnOffline?: boolean
|
|
237
|
-
clearOnPageLoad?: boolean
|
|
231
|
+
**configureSdkCache**(options: {
|
|
232
|
+
enabled?: boolean
|
|
233
|
+
ttlMs?: number
|
|
234
|
+
maxEntries?: number
|
|
235
|
+
persistence?: 'none' | 'indexeddb'
|
|
236
|
+
persistenceTtlMs?: number
|
|
237
|
+
serveStaleOnOffline?: boolean
|
|
238
|
+
clearOnPageLoad?: boolean
|
|
238
239
|
}) → `void`
|
|
239
240
|
Configure the SDK's built-in in-memory GET cache. The cache is transparent — it sits inside the HTTP layer and requires no changes to your existing API calls. All GET requests benefit automatically. Per-resource rules (collections/products → 1 h, proofs → 30 s, etc.) override this value. in-memory only (`'none'`, default). Ignored in Node.js. fallback, from the original fetch time (default: 7 days). `SmartlinksOfflineError` with stale data instead of propagating the network error. caches on page load/refresh. IndexedDB persists for offline. ```ts // Enable IndexedDB persistence for offline support configureSdkCache({ persistence: 'indexeddb' }) // Disable cache entirely in test environments configureSdkCache({ enabled: false }) // Keep caches across page refreshes (not recommended for production) configureSdkCache({ clearOnPageLoad: false }) ```
|
|
240
241
|
|
|
241
242
|
**invalidateCache**(urlPattern?: string, options?: InvalidateCacheOptions) → `void`
|
|
242
243
|
Manually invalidate entries in the SDK's GET cache. Note: the GET cache is **in-memory, per page load** (with an optional L2 IndexedDB layer when persistence is enabled) — it does not persist across reloads unless you opt into persistence, so it rarely needs disabling "for correctness". *contains* this string is removed). With `{ exact: true }`, matches the path precisely. Omit to wipe the entire cache. ```ts invalidateCache() // clear everything invalidateCache('/collection/abc123') // that collection AND everything under it invalidateCache('/collection/abc123', { exact: true }) // ONLY that collection entry invalidateCache('/products/') // all canonical plural product responses ```
|
|
243
244
|
|
|
244
|
-
**proxyUploadFormData**(path: string,
|
|
245
|
-
formData: FormData,
|
|
245
|
+
**proxyUploadFormData**(path: string,
|
|
246
|
+
formData: FormData,
|
|
246
247
|
onProgress?: (percent: number) → `void`
|
|
247
248
|
Upload a FormData payload via proxy with progress events using chunked postMessage. Parent is expected to implement the counterpart protocol.
|
|
248
249
|
|
|
249
250
|
**request**(path: string) → `Promise<T>`
|
|
250
251
|
Internal helper that performs a GET request to `${baseURL}${path}`, injecting headers for apiKey or bearerToken if present. Cache pipeline (when caching is not skipped): L1 hit → return from memory (no I/O) L2 hit → return from IndexedDB, promote to L1 (no network) Miss → fetch from network, store in L1 + L2 Offline → serve stale L2 entry via SmartlinksOfflineError (if persistence enabled) Concurrent identical GETs share one in-flight promise (deduplication). Node-safe: IndexedDB calls are no-ops when IDB is unavailable.
|
|
251
252
|
|
|
252
|
-
**post**(path: string,
|
|
253
|
-
body: any,
|
|
253
|
+
**post**(path: string,
|
|
254
|
+
body: any,
|
|
254
255
|
extraHeaders?: Record<string, string>) → `Promise<T>`
|
|
255
256
|
Internal helper that performs a POST request to `${baseURL}${path}`, injecting headers for apiKey or bearerToken if present. If body is FormData, Content-Type is not set. Returns the parsed JSON as T, or throws an Error.
|
|
256
257
|
|
|
257
|
-
**put**(path: string,
|
|
258
|
-
body: any,
|
|
258
|
+
**put**(path: string,
|
|
259
|
+
body: any,
|
|
259
260
|
extraHeaders?: Record<string, string>) → `Promise<T>`
|
|
260
261
|
Internal helper that performs a PUT request to `${baseURL}${path}`, injecting headers for apiKey or bearerToken if present. If body is FormData, Content-Type is not set. Returns the parsed JSON as T, or throws an Error.
|
|
261
262
|
|
|
262
|
-
**patch**(path: string,
|
|
263
|
-
body: any,
|
|
263
|
+
**patch**(path: string,
|
|
264
|
+
body: any,
|
|
264
265
|
extraHeaders?: Record<string, string>) → `Promise<T>`
|
|
265
266
|
Internal helper that performs a PATCH request to `${baseURL}${path}`, injecting headers for apiKey or bearerToken if present. If body is FormData, Content-Type is not set. Returns the parsed JSON as T, or throws an Error.
|
|
266
267
|
|
|
267
|
-
**requestWithOptions**(path: string,
|
|
268
|
+
**requestWithOptions**(path: string,
|
|
268
269
|
options: RequestInit) → `Promise<T>`
|
|
269
270
|
Internal helper that performs a request to `${baseURL}${path}` with custom options, injecting headers for apiKey or bearerToken if present. Returns the parsed JSON as T, or throws an Error.
|
|
270
271
|
|
|
271
|
-
**requestStream**(path: string,
|
|
272
|
-
options?: {
|
|
273
|
-
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
|
|
274
|
-
body?: any
|
|
275
|
-
headers?: Record<string, string>
|
|
272
|
+
**requestStream**(path: string,
|
|
273
|
+
options?: {
|
|
274
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
|
|
275
|
+
body?: any
|
|
276
|
+
headers?: Record<string, string>
|
|
276
277
|
}) → `Promise<AsyncIterable<T>>`
|
|
277
278
|
Internal helper that performs a streaming request using the shared auth and proxy transport. The response is expected to be `text/event-stream` with JSON payloads in `data:` frames.
|
|
278
279
|
|
|
279
|
-
**del**(path: string,
|
|
280
|
+
**del**(path: string,
|
|
280
281
|
extraHeaders?: Record<string, string>) → `Promise<T>`
|
|
281
282
|
Internal helper that performs a DELETE request to `${baseURL}${path}`, injecting headers for apiKey or bearerToken if present. Returns the parsed JSON as T, or throws an Error.
|
|
282
283
|
|
|
@@ -5731,6 +5732,188 @@ interface CreateClaimSetTagResponse {
|
|
|
5731
5732
|
}
|
|
5732
5733
|
```
|
|
5733
5734
|
|
|
5735
|
+
**ClaimSetRange** (interface)
|
|
5736
|
+
```typescript
|
|
5737
|
+
interface ClaimSetRange {
|
|
5738
|
+
id: string
|
|
5739
|
+
claimSetId: string
|
|
5740
|
+
namespace: string
|
|
5741
|
+
name: string
|
|
5742
|
+
notes: string | null
|
|
5743
|
+
startIndex: number
|
|
5744
|
+
endIndex: number
|
|
5745
|
+
quantity: number
|
|
5746
|
+
tagType: ClaimSetTagType
|
|
5747
|
+
fulfilment: 'printer' | 'sidekick'
|
|
5748
|
+
stage: 'minting' | 'minted' | 'sent' | 'received'
|
|
5749
|
+
status: ClaimSetRangeStatus
|
|
5750
|
+
intendedCollectionId: string | null
|
|
5751
|
+
intendedProductId: string | null
|
|
5752
|
+
intendedBatchId: string | null
|
|
5753
|
+
manufacturer: string | null
|
|
5754
|
+
orderRef: string | null
|
|
5755
|
+
counts: { programmed: number; assigned: number; claimed: number }
|
|
5756
|
+
sentAt: string | null
|
|
5757
|
+
receivedAt: string | null
|
|
5758
|
+
createdBy: string | null
|
|
5759
|
+
createdAt: string
|
|
5760
|
+
updatedAt: string
|
|
5761
|
+
}
|
|
5762
|
+
```
|
|
5763
|
+
|
|
5764
|
+
**CreateClaimSetRangeRequest** (interface)
|
|
5765
|
+
```typescript
|
|
5766
|
+
interface CreateClaimSetRangeRequest {
|
|
5767
|
+
name: string
|
|
5768
|
+
quantity: number
|
|
5769
|
+
intendedCollectionId?: string
|
|
5770
|
+
intendedProductId?: string
|
|
5771
|
+
intendedBatchId?: string
|
|
5772
|
+
fulfilment?: 'printer' | 'sidekick'
|
|
5773
|
+
notes?: string
|
|
5774
|
+
manufacturer?: string
|
|
5775
|
+
orderRef?: string
|
|
5776
|
+
}
|
|
5777
|
+
```
|
|
5778
|
+
|
|
5779
|
+
**UpdateClaimSetRangeRequest** (interface)
|
|
5780
|
+
```typescript
|
|
5781
|
+
interface UpdateClaimSetRangeRequest {
|
|
5782
|
+
name?: string
|
|
5783
|
+
notes?: string | null
|
|
5784
|
+
manufacturer?: string | null
|
|
5785
|
+
orderRef?: string | null
|
|
5786
|
+
fulfilment?: 'printer' | 'sidekick'
|
|
5787
|
+
stage?: 'minted' | 'sent' | 'received'
|
|
5788
|
+
}
|
|
5789
|
+
```
|
|
5790
|
+
|
|
5791
|
+
**ClaimSetRangeTag** (interface)
|
|
5792
|
+
```typescript
|
|
5793
|
+
interface ClaimSetRangeTag {
|
|
5794
|
+
code: string
|
|
5795
|
+
printed: string
|
|
5796
|
+
index: number
|
|
5797
|
+
uid: string | null
|
|
5798
|
+
key?: string
|
|
5799
|
+
collectionId: string | null
|
|
5800
|
+
productId: string | null
|
|
5801
|
+
batchId: string | null
|
|
5802
|
+
proofId: string | null
|
|
5803
|
+
programmedAt: string | null
|
|
5804
|
+
scans: number
|
|
5805
|
+
}
|
|
5806
|
+
```
|
|
5807
|
+
|
|
5808
|
+
**ClaimSetRangeTagsPage** (interface)
|
|
5809
|
+
```typescript
|
|
5810
|
+
interface ClaimSetRangeTagsPage {
|
|
5811
|
+
tags: ClaimSetRangeTag[]
|
|
5812
|
+
next: number | null
|
|
5813
|
+
}
|
|
5814
|
+
```
|
|
5815
|
+
|
|
5816
|
+
**ImportClaimSetRangeUidsRequest** (interface)
|
|
5817
|
+
```typescript
|
|
5818
|
+
interface ImportClaimSetRangeUidsRequest {
|
|
5819
|
+
csv?: string
|
|
5820
|
+
rows?: Array<Record<string, string | number>>
|
|
5821
|
+
commit?: boolean
|
|
5822
|
+
}
|
|
5823
|
+
```
|
|
5824
|
+
|
|
5825
|
+
**ImportClaimSetRangeUidsResponse** (interface)
|
|
5826
|
+
```typescript
|
|
5827
|
+
interface ImportClaimSetRangeUidsResponse {
|
|
5828
|
+
summary: { rows: number; ok: number; unchanged: number; problems: number; notInFile: number; committed: boolean }
|
|
5829
|
+
rows: Array<{ line: number; code: string; index: number | null; uid: string; result: ClaimSetImportResult; message?: string }>
|
|
5830
|
+
range: ClaimSetRange
|
|
5831
|
+
}
|
|
5832
|
+
```
|
|
5833
|
+
|
|
5834
|
+
**AssignClaimSetRangeRequest** (interface)
|
|
5835
|
+
```typescript
|
|
5836
|
+
interface AssignClaimSetRangeRequest {
|
|
5837
|
+
collectionId?: string
|
|
5838
|
+
productId?: string
|
|
5839
|
+
batchId?: string
|
|
5840
|
+
start?: number
|
|
5841
|
+
end?: number
|
|
5842
|
+
clear?: boolean
|
|
5843
|
+
data?: Record<string, unknown>
|
|
5844
|
+
}
|
|
5845
|
+
```
|
|
5846
|
+
|
|
5847
|
+
**AssignClaimSetRangeResponse** (interface)
|
|
5848
|
+
```typescript
|
|
5849
|
+
interface AssignClaimSetRangeResponse {
|
|
5850
|
+
changed: number
|
|
5851
|
+
skipped: Array<{ code: string; index: number; reason: 'other_range' | 'has_proof' | 'assigned_elsewhere'; collectionId?: string }>
|
|
5852
|
+
range: ClaimSetRange
|
|
5853
|
+
}
|
|
5854
|
+
```
|
|
5855
|
+
|
|
5856
|
+
**ClaimSetRangeFile** (interface)
|
|
5857
|
+
```typescript
|
|
5858
|
+
interface ClaimSetRangeFile {
|
|
5859
|
+
filename: string
|
|
5860
|
+
contentType: string
|
|
5861
|
+
csv?: string
|
|
5862
|
+
base64?: string
|
|
5863
|
+
markdown?: string
|
|
5864
|
+
}
|
|
5865
|
+
```
|
|
5866
|
+
|
|
5867
|
+
**Partner** (interface)
|
|
5868
|
+
```typescript
|
|
5869
|
+
interface Partner {
|
|
5870
|
+
id: string
|
|
5871
|
+
name: string
|
|
5872
|
+
status: 'active' | 'suspended'
|
|
5873
|
+
tapDomains: string[]
|
|
5874
|
+
features: Record<string, boolean>
|
|
5875
|
+
role?: 'owner' | 'admin' | 'assigner'
|
|
5876
|
+
members?: Array<{ userId: string; role: 'owner' | 'admin' | 'assigner'; grantedBy: string | null; grantedAt: string }>
|
|
5877
|
+
createdAt: string
|
|
5878
|
+
updatedAt: string
|
|
5879
|
+
}
|
|
5880
|
+
```
|
|
5881
|
+
|
|
5882
|
+
**PartnerClaimSet** (interface)
|
|
5883
|
+
```typescript
|
|
5884
|
+
interface PartnerClaimSet {
|
|
5885
|
+
id: string
|
|
5886
|
+
namespace: string
|
|
5887
|
+
name: string | null
|
|
5888
|
+
tagType: ClaimSetTagType
|
|
5889
|
+
tapDomain: string
|
|
5890
|
+
owner: { type: 'platform' | 'partner' | 'collection' | 'user'; id: string | null }
|
|
5891
|
+
codes: number
|
|
5892
|
+
deleted: boolean
|
|
5893
|
+
createdAt: string | null
|
|
5894
|
+
}
|
|
5895
|
+
```
|
|
5896
|
+
|
|
5897
|
+
**CreatePartnerClaimSetRequest** (interface)
|
|
5898
|
+
```typescript
|
|
5899
|
+
interface CreatePartnerClaimSetRequest {
|
|
5900
|
+
name: string
|
|
5901
|
+
tagType: ClaimSetTagType
|
|
5902
|
+
tapDomain?: string
|
|
5903
|
+
}
|
|
5904
|
+
```
|
|
5905
|
+
|
|
5906
|
+
**ClaimSetScope** (type)
|
|
5907
|
+
```typescript
|
|
5908
|
+
type ClaimSetScope = { collectionId: string }
|
|
5909
|
+
```
|
|
5910
|
+
|
|
5911
|
+
**ClaimSetTagType** = `'ntag424' | 'ntag21x' | 'qr'`
|
|
5912
|
+
|
|
5913
|
+
**ClaimSetRangeStatus** = `'minting' | 'minted' | 'sent' | 'received' | 'assigned'`
|
|
5914
|
+
|
|
5915
|
+
**ClaimSetImportResult** = ``
|
|
5916
|
+
|
|
5734
5917
|
### collection
|
|
5735
5918
|
|
|
5736
5919
|
**Collection** (interface)
|
|
@@ -12119,6 +12302,46 @@ Assign claims to codes or ranges within a collection.
|
|
|
12119
12302
|
**updateClaimData**(collectionId: string, data: UpdateClaimDataRequest) → `Promise<any>`
|
|
12120
12303
|
Update claim data for a claim set (collection-scoped).
|
|
12121
12304
|
|
|
12305
|
+
### claimSet.ranges
|
|
12306
|
+
|
|
12307
|
+
**list**(scope: ClaimSetScope, claimSetId: string) → `Promise<ClaimSetRange[]>`
|
|
12308
|
+
The ranges in a set, lowest index first.
|
|
12309
|
+
|
|
12310
|
+
**create**(scope: ClaimSetScope, claimSetId: string, params: CreateClaimSetRangeRequest) → `Promise<ClaimSetRange>`
|
|
12311
|
+
Reserve the set's next indexes and mint a code (and, for NTAG 424, a key) for each.
|
|
12312
|
+
|
|
12313
|
+
**get**(scope: ClaimSetScope, claimSetId: string, rangeId: string) → `Promise<ClaimSetRange>`
|
|
12314
|
+
One range, with its counts refreshed.
|
|
12315
|
+
|
|
12316
|
+
**update**(scope: ClaimSetScope, claimSetId: string, rangeId: string, params: UpdateClaimSetRangeRequest) → `Promise<ClaimSetRange>`
|
|
12317
|
+
Name, notes, order details, or a stage move (sent to the printer, received).
|
|
12318
|
+
|
|
12319
|
+
**resume**(scope: ClaimSetScope, claimSetId: string, rangeId: string) → `Promise<ClaimSetRange>`
|
|
12320
|
+
Finish minting a range that was interrupted.
|
|
12321
|
+
|
|
12322
|
+
**tags**(scope: ClaimSetScope, claimSetId: string, rangeId: string,
|
|
12323
|
+
options: { from?: number; limit?: number; keys?: boolean } = {}) → `Promise<ClaimSetRangeTagsPage>`
|
|
12324
|
+
The range's tags in index order, a page at a time (keys: owners/admins only).
|
|
12325
|
+
|
|
12326
|
+
**next**(scope: ClaimSetScope, claimSetId: string, rangeId: string) → `Promise<ClaimSetRangeNextTag>`
|
|
12327
|
+
The next tag to program on a phone (lowest index without a chip), with its URL and key.
|
|
12328
|
+
|
|
12329
|
+
**recordTag**(scope: ClaimSetScope, claimSetId: string, rangeId: string, code: string,
|
|
12330
|
+
params: { uid: string; data?: Record<string, unknown> }) → `Promise<`
|
|
12331
|
+
Record the chip a phone just programmed with this code.
|
|
12332
|
+
|
|
12333
|
+
**exportFile**(scope: ClaimSetScope, claimSetId: string, rangeId: string) → `Promise<ClaimSetRangeFile>`
|
|
12334
|
+
The printer file (CSV text in `csv`). Carries the tags' keys: don't keep it around.
|
|
12335
|
+
|
|
12336
|
+
**instructions**(scope: ClaimSetScope, claimSetId: string, rangeId: string, format: 'pdf' | 'md' = 'pdf') → `Promise<ClaimSetRangeFile>`
|
|
12337
|
+
The manufacturer's instruction sheet: PDF (base64) or Markdown.
|
|
12338
|
+
|
|
12339
|
+
**importUids**(scope: ClaimSetScope, claimSetId: string, rangeId: string, params: ImportClaimSetRangeUidsRequest) → `Promise<ImportClaimSetRangeUidsResponse>`
|
|
12340
|
+
The manufacturer's file back: check it (commit false), then write the chip UIDs (commit true).
|
|
12341
|
+
|
|
12342
|
+
**assign**(scope: ClaimSetScope, claimSetId: string, rangeId: string, params: AssignClaimSetRangeRequest) → `Promise<AssignClaimSetRangeResponse>`
|
|
12343
|
+
Point the range (or from–to within it) at a collection / product / batch, or clear it.
|
|
12344
|
+
|
|
12122
12345
|
### collection
|
|
12123
12346
|
|
|
12124
12347
|
**get**(collectionId: string, admin?: boolean) → `Promise<CollectionResponse>`
|
|
@@ -13030,6 +13253,23 @@ Get individual order items for a specific product. Returns all matching items wi
|
|
|
13030
13253
|
params?: GetOrderIdsParams) → `Promise<GetOrderIdsResponse>`
|
|
13031
13254
|
Get unique order IDs containing items for a specific product. Lightweight query that only returns order IDs, not full order objects. ```typescript // Get order IDs for a product const productOrders = await order.getOrderIdsByAttribute( 'coll_123', 'productId', 'prod_789', { limit: 500 } ) ```
|
|
13032
13255
|
|
|
13256
|
+
### partner
|
|
13257
|
+
|
|
13258
|
+
**list**() → `Promise<Partner[]>`
|
|
13259
|
+
The partners you belong to, with your role in each. Empty for everyone else.
|
|
13260
|
+
|
|
13261
|
+
**get**(partnerId: string) → `Promise<Partner>`
|
|
13262
|
+
One partner (owners also see its members).
|
|
13263
|
+
|
|
13264
|
+
**claimSets**(partnerId: string) → `Promise<PartnerClaimSet[]>`
|
|
13265
|
+
The partner's claim sets.
|
|
13266
|
+
|
|
13267
|
+
**getClaimSet**(partnerId: string, claimSetId: string) → `Promise<PartnerClaimSet>`
|
|
13268
|
+
One of the partner's claim sets.
|
|
13269
|
+
|
|
13270
|
+
**createClaimSet**(partnerId: string, params: CreatePartnerClaimSetRequest) → `Promise<PartnerClaimSet>`
|
|
13271
|
+
A new claim set for the partner, on one of its tap domains (owners and admins).
|
|
13272
|
+
|
|
13033
13273
|
### podcast
|
|
13034
13274
|
|
|
13035
13275
|
**generate**(collectionId: string,
|