@proveanything/smartlinks 2.0.34 → 2.0.35

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.0.34 | Generated: 2026-10-02T16:06:32.154Z
3
+ Version: 2.0.35 | Generated: 2026-10-03T12:37:51.058Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -172,17 +172,23 @@ The current app context (appId), if the SDK was initialized with one.
172
172
  **setAppContext**(id: string | undefined) → `void`
173
173
  Set (or clear) the current app context — the appId used to scope SL.functions calls.
174
174
 
175
- **initializeApi**(options: {
176
- baseURL: string
177
- apiKey?: string
178
- bearerToken?: string
179
- proxyMode?: boolean
180
- ngrokSkipBrowserWarning?: boolean
181
- extraHeaders?: Record<string, string>
182
- /**
183
- * Declares the host platform. Set to `'native'` on native/Capacitor hosts to opt into
184
- * AuthKit refresh tokens — the SDK then sends `X-Client-Platform: native` on every
185
- * request, so login endpoints return `refreshToken`/`refreshTokenExpiresAt` and a
175
+ **getAppChannel**() → `string | undefined`
176
+ The release channel explicitly set for this app build (initializeApi({ appChannel }) / setAppChannel).
177
+
178
+ **setAppChannel**(channel: string | undefined) → `void`
179
+ Set (or clear) the release channel SL.functions calls target.
180
+
181
+ **initializeApi**(options: {
182
+ baseURL: string
183
+ apiKey?: string
184
+ bearerToken?: string
185
+ proxyMode?: boolean
186
+ ngrokSkipBrowserWarning?: boolean
187
+ extraHeaders?: Record<string, string>
188
+ /**
189
+ * Declares the host platform. Set to `'native'` on native/Capacitor hosts to opt into
190
+ * AuthKit refresh tokens — the SDK then sends `X-Client-Platform: native` on every
191
+ * request, so login endpoints return `refreshToken`/`refreshTokenExpiresAt` and a
186
192
  * short-lived access token. Omit (or `'web'`) → `void`
187
193
  Call this once (e.g. at app startup) to configure baseURL/auth.
188
194
 
@@ -213,56 +219,56 @@ Returns true if initializeApi() has been called at least once. Useful for guards
213
219
  **hasAuthCredentials**() → `boolean`
214
220
  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() } ```
215
221
 
216
- **configureSdkCache**(options: {
217
- enabled?: boolean
218
- ttlMs?: number
219
- maxEntries?: number
220
- persistence?: 'none' | 'indexeddb'
221
- persistenceTtlMs?: number
222
- serveStaleOnOffline?: boolean
223
- clearOnPageLoad?: boolean
222
+ **configureSdkCache**(options: {
223
+ enabled?: boolean
224
+ ttlMs?: number
225
+ maxEntries?: number
226
+ persistence?: 'none' | 'indexeddb'
227
+ persistenceTtlMs?: number
228
+ serveStaleOnOffline?: boolean
229
+ clearOnPageLoad?: boolean
224
230
  }) → `void`
225
231
  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 }) ```
226
232
 
227
233
  **invalidateCache**(urlPattern?: string, options?: InvalidateCacheOptions) → `void`
228
234
  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 ```
229
235
 
230
- **proxyUploadFormData**(path: string,
231
- formData: FormData,
236
+ **proxyUploadFormData**(path: string,
237
+ formData: FormData,
232
238
  onProgress?: (percent: number) → `void`
233
239
  Upload a FormData payload via proxy with progress events using chunked postMessage. Parent is expected to implement the counterpart protocol.
234
240
 
235
241
  **request**(path: string) → `Promise<T>`
236
242
  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.
237
243
 
238
- **post**(path: string,
239
- body: any,
244
+ **post**(path: string,
245
+ body: any,
240
246
  extraHeaders?: Record<string, string>) → `Promise<T>`
241
247
  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.
242
248
 
243
- **put**(path: string,
244
- body: any,
249
+ **put**(path: string,
250
+ body: any,
245
251
  extraHeaders?: Record<string, string>) → `Promise<T>`
246
252
  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.
247
253
 
248
- **patch**(path: string,
249
- body: any,
254
+ **patch**(path: string,
255
+ body: any,
250
256
  extraHeaders?: Record<string, string>) → `Promise<T>`
251
257
  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.
252
258
 
253
- **requestWithOptions**(path: string,
259
+ **requestWithOptions**(path: string,
254
260
  options: RequestInit) → `Promise<T>`
255
261
  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.
256
262
 
257
- **requestStream**(path: string,
258
- options?: {
259
- method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
260
- body?: any
261
- headers?: Record<string, string>
263
+ **requestStream**(path: string,
264
+ options?: {
265
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'
266
+ body?: any
267
+ headers?: Record<string, string>
262
268
  }) → `Promise<AsyncIterable<T>>`
263
269
  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.
264
270
 
265
- **del**(path: string,
271
+ **del**(path: string,
266
272
  extraHeaders?: Record<string, string>) → `Promise<T>`
267
273
  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.
268
274
 
@@ -1528,6 +1534,45 @@ interface PdfInspectGraphicsArgs {
1528
1534
  }
1529
1535
  ```
1530
1536
 
1537
+ **PdfBox** (interface)
1538
+ ```typescript
1539
+ interface PdfBox {
1540
+ x: number; y: number; w: number; h: number
1541
+ }
1542
+ ```
1543
+
1544
+ **PdfEditArgs** (interface)
1545
+ ```typescript
1546
+ interface PdfEditArgs {
1547
+ url: string
1548
+ replaceText?: { id?: string; page?: number; find: string; replace: string; bold?: boolean; align?: 'left' | 'center' | 'right' }[]
1549
+ addText?: { id?: string; page: number; box: PdfBox; text: string; size?: number; bold?: boolean; colour?: PdfColour; align?: 'left' | 'center' | 'right' }[]
1550
+ addImages?: { id?: string; page: number; box: PdfBox; imageUrl: string; colorSpace?: 'rgb' | 'cmyk' }[]
1551
+ preserveColour?: boolean
1552
+ }
1553
+ ```
1554
+
1555
+ **PdfPreflightArgs** (interface)
1556
+ ```typescript
1557
+ interface PdfPreflightArgs {
1558
+ url: string; profile?: PdfXProfile; bleed?: { mm: number }; minDpi?: number
1559
+ }
1560
+ ```
1561
+
1562
+ **PdfPrintReadyArgs** (interface)
1563
+ ```typescript
1564
+ interface PdfPrintReadyArgs {
1565
+ url: string
1566
+ profile?: PdfXProfile
1567
+ outputIntent?: string
1568
+ convertToCmyk?: boolean
1569
+ embedFonts?: boolean
1570
+ bleed?: { mm: number }
1571
+ flattenTransparency?: boolean
1572
+ minDpi?: number
1573
+ }
1574
+ ```
1575
+
1531
1576
  **HttpRequestArgs** (interface)
1532
1577
  ```typescript
1533
1578
  interface HttpRequestArgs {
@@ -1566,6 +1611,9 @@ interface AiToolArgsMap {
1566
1611
  'pdf.extract': PdfExtractArgs
1567
1612
  'pdf.decodeBarcodes': PdfDecodeBarcodesArgs
1568
1613
  'pdf.inspectGraphics': PdfInspectGraphicsArgs
1614
+ 'pdf.edit': PdfEditArgs
1615
+ 'pdf.preflight': PdfPreflightArgs
1616
+ 'pdf.printReady': PdfPrintReadyArgs
1569
1617
  'http.request': HttpRequestArgs
1570
1618
  'translate': TranslateArgs
1571
1619
  }
@@ -1741,6 +1789,68 @@ interface PdfInspectGraphicsResult {
1741
1789
  }
1742
1790
  ```
1743
1791
 
1792
+ **PdfEditItemResult** (interface)
1793
+ ```typescript
1794
+ interface PdfEditItemResult {
1795
+ id: string
1796
+ status: 'done' | 'failed'
1797
+ note?: string
1798
+ verified?: boolean
1799
+ usedFallbackFont?: boolean
1800
+ }
1801
+ ```
1802
+
1803
+ **PdfEditResult** (interface)
1804
+ ```typescript
1805
+ interface PdfEditResult {
1806
+ url: string; results: PdfEditItemResult[]; warnings: string[]
1807
+ }
1808
+ ```
1809
+
1810
+ **PdfPreflightFinding** (interface)
1811
+ ```typescript
1812
+ interface PdfPreflightFinding {
1813
+ severity: 'error' | 'warning'; code: string; page?: number; message: string
1814
+ }
1815
+ ```
1816
+
1817
+ **PdfPreflightResult** (interface)
1818
+ ```typescript
1819
+ interface PdfPreflightResult {
1820
+ url: string
1821
+ compliant: boolean
1822
+ profile: PdfXProfile | null
1823
+ version: string | null
1824
+ findings: PdfPreflightFinding[]
1825
+ stats: {
1826
+ pageCount: number
1827
+ fonts: { name: string; embedded: boolean; subset: boolean; type: string; pages: number[] }[]
1828
+ spotColours: string[]
1829
+ images: { page: number; dpi: number; width: number; height: number; space: string; placedMm: { w: number; h: number } }[]
1830
+ transparency: boolean
1831
+ outputIntent: { identifier: string | null; hasProfile: boolean } | null
1832
+ [key: string]: any
1833
+ }
1834
+ }
1835
+ ```
1836
+
1837
+ **PdfPrintReadyResult** (interface)
1838
+ ```typescript
1839
+ interface PdfPrintReadyResult {
1840
+ url: string
1841
+ report: {
1842
+ compliant: boolean
1843
+ profile: PdfXProfile
1844
+ outputIntent: string
1845
+ findings: PdfPreflightFinding[]
1846
+ changes: { code: string; message: string }[]
1847
+ before: { compliant: boolean; errors: number; findings: PdfPreflightFinding[] }
1848
+ stats: Record<string, any>
1849
+ note: string
1850
+ }
1851
+ }
1852
+ ```
1853
+
1744
1854
  **ResponsesAgentTrace** (interface)
1745
1855
  ```typescript
1746
1856
  interface ResponsesAgentTrace {
@@ -1778,6 +1888,10 @@ interface AgentResponseCompletedEvent {
1778
1888
 
1779
1889
  **AiToolName** = ``
1780
1890
 
1891
+ **PdfColour** = `string | [number, number, number, number]`
1892
+
1893
+ **PdfXProfile** = `'pdfx-1a' | 'pdfx-4'`
1894
+
1781
1895
  **AgentStreamEvent** = ``
1782
1896
 
1783
1897
  ### analytics
@@ -9476,7 +9590,7 @@ interface FunctionListResponse {
9476
9590
  **FunctionCallOptions** (interface)
9477
9591
  ```typescript
9478
9592
  interface FunctionCallOptions {
9479
- appId?: string; channel?: string
9593
+ appId?: string; channel?: string | null
9480
9594
  }
9481
9595
  ```
9482
9596
 
@@ -10988,6 +11102,12 @@ Delete a form for a collection (admin only).
10988
11102
 
10989
11103
  ### functions
10990
11104
 
11105
+ **resolveFunctionChannel**(opts: FunctionCallOptions = {}, appId?: string) → `string | undefined`
11106
+ The release channel a call targets, or undefined for "the collection's installed release". A host context `appChannel` can be scoped to ONE app with `appChannelApp` — needed where several apps share a page (Forge's portal preview of a dev component), so only the app under development calls its dev build.
11107
+
11108
+ **functionPath**(surface: 'public' | 'admin', collectionId: string, name: string, opts: FunctionCallOptions = {}) → `string`
11109
+ The API path a function call goes to (exported for hosts/tests that need the exact URL).
11110
+
10991
11111
  **call**(collectionId: string,
10992
11112
  name: string,
10993
11113
  body: Record<string, any> = {},