@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.
package/dist/http.d.ts CHANGED
@@ -31,6 +31,10 @@ export declare function isProxyEnabled(): boolean;
31
31
  export declare function getAppContext(): string | undefined;
32
32
  /** Set (or clear) the current app context — the appId used to scope SL.functions calls. */
33
33
  export declare function setAppContext(id: string | undefined): void;
34
+ /** The release channel explicitly set for this app build (initializeApi({ appChannel }) / setAppChannel). */
35
+ export declare function getAppChannel(): string | undefined;
36
+ /** Set (or clear) the release channel SL.functions calls target. */
37
+ export declare function setAppChannel(channel: string | undefined): void;
34
38
  export declare function initializeApi(options: {
35
39
  baseURL: string;
36
40
  apiKey?: string;
@@ -52,6 +56,13 @@ export declare function initializeApi(options: {
52
56
  * Preserved across re-initialization when not supplied.
53
57
  */
54
58
  appId?: string;
59
+ /**
60
+ * The release channel this build is running as ('dev' | 'alpha' | 'beta' | 'stable'). Normally
61
+ * left unset — hosts that run a non-production build (Forge preview of a Test build) pass
62
+ * `appChannel` in the app's context and the SDK picks it up. Preserved across re-initialization
63
+ * when not supplied.
64
+ */
65
+ appChannel?: string;
55
66
  /**
56
67
  * Declares that a bearer token will arrive asynchronously (e.g. handed by the host over
57
68
  * postMessage in a dev/direct embed). Until setBearerToken() is called, outgoing requests wait
package/dist/http.js CHANGED
@@ -52,6 +52,14 @@ let grantToken = undefined;
52
52
  * app-scoped when this is set. Explicit `appId` on a call always overrides it.
53
53
  */
54
54
  let appContextId = undefined;
55
+ /**
56
+ * The release CHANNEL this app build is running as ('dev' | 'alpha' | 'beta' | 'stable'), when the
57
+ * host says so — e.g. Forge's preview of a Test build. SL.functions then calls that channel's
58
+ * release (/app/:appId/<channel>/functions/:name). Unset = production behaviour: the server runs the
59
+ * release the collection has installed. Set via initializeApi({ appChannel }) / setAppChannel(), or
60
+ * picked up from the host's `appChannel` context param (see functions.ts).
61
+ */
62
+ let appChannelId = undefined;
55
63
  /**
56
64
  * Auth-ready gate. When an app declares (initializeApi({ awaitAuth: true })) that its bearer token
57
65
  * will arrive ASYNCHRONOUSLY — e.g. a dev app embedded in the console that receives its token over
@@ -318,6 +326,14 @@ export function getAppContext() {
318
326
  export function setAppContext(id) {
319
327
  appContextId = id;
320
328
  }
329
+ /** The release channel explicitly set for this app build (initializeApi({ appChannel }) / setAppChannel). */
330
+ export function getAppChannel() {
331
+ return appChannelId;
332
+ }
333
+ /** Set (or clear) the release channel SL.functions calls target. */
334
+ export function setAppChannel(channel) {
335
+ appChannelId = channel;
336
+ }
321
337
  function maskSensitive(value) {
322
338
  if (!value)
323
339
  return value;
@@ -471,6 +487,8 @@ export function initializeApi(options) {
471
487
  // Preserve the app context across re-inits that omit it (mirrors platform/token handling).
472
488
  if (options.appId !== undefined)
473
489
  appContextId = options.appId;
490
+ if (options.appChannel !== undefined)
491
+ appChannelId = options.appChannel;
474
492
  // Enable token persistence before restoring the token.
475
493
  if (options.persistToken !== undefined)
476
494
  tokenPersistenceEnabled = options.persistToken;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { initializeApi, isInitialized, hasAuthCredentials, configureSdkCache, invalidateCache, getHttpCacheDiagnostics, resetHttpCacheDiagnostics, request, post, put, patch, del, sendCustomProxyMessage, getApiHeaders, getBaseURL, isProxyEnabled, setBearerToken, getBearerToken, setGrantToken, getGrantToken, getAppContext, setAppContext } from "./http.js";
1
+ export { initializeApi, isInitialized, hasAuthCredentials, configureSdkCache, invalidateCache, getHttpCacheDiagnostics, resetHttpCacheDiagnostics, request, post, put, patch, del, sendCustomProxyMessage, getApiHeaders, getBaseURL, isProxyEnabled, setBearerToken, getBearerToken, setGrantToken, getGrantToken, getAppContext, setAppContext, getAppChannel, setAppChannel } from "./http.js";
2
2
  export * from "./api/index.js";
3
3
  export * from "./types/index.js";
4
4
  export { iframe } from "./iframe.js";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/index.ts
2
2
  // Top-level entrypoint of the npm package. Re-export initializeApi + all namespaces.
3
- export { initializeApi, isInitialized, hasAuthCredentials, configureSdkCache, invalidateCache, getHttpCacheDiagnostics, resetHttpCacheDiagnostics, request, post, put, patch, del, sendCustomProxyMessage, getApiHeaders, getBaseURL, isProxyEnabled, setBearerToken, getBearerToken, setGrantToken, getGrantToken, getAppContext, setAppContext } from "./http.js";
3
+ export { initializeApi, isInitialized, hasAuthCredentials, configureSdkCache, invalidateCache, getHttpCacheDiagnostics, resetHttpCacheDiagnostics, request, post, put, patch, del, sendCustomProxyMessage, getApiHeaders, getBaseURL, isProxyEnabled, setBearerToken, getBearerToken, setGrantToken, getGrantToken, getAppContext, setAppContext, getAppChannel, setAppChannel } from "./http.js";
4
4
  export * from "./api/index.js";
5
5
  export * from "./types/index.js";
6
6
  // Iframe namespace
package/dist/openapi.yaml CHANGED
@@ -74,6 +74,8 @@ tags:
74
74
  description: Product facet querying and aggregation.
75
75
  - name: form
76
76
  description: Form definitions and submissions.
77
+ - name: functions
78
+ description: functions API
77
79
  - name: integrations
78
80
  description: Third-party integration flows and imports.
79
81
  - name: interactions
@@ -10022,6 +10024,26 @@ paths:
10022
10024
  description: Unauthorized
10023
10025
  404:
10024
10026
  description: Not found
10027
+ /functions:
10028
+ get:
10029
+ tags:
10030
+ - functions
10031
+ summary: List the public functions available for a collection (discovery).
10032
+ operationId: functions_list
10033
+ security: []
10034
+ responses:
10035
+ 200:
10036
+ description: Success
10037
+ content:
10038
+ application/json:
10039
+ schema:
10040
+ $ref: "#/components/schemas/FunctionListResponse"
10041
+ 400:
10042
+ description: Bad request
10043
+ 401:
10044
+ description: Unauthorized
10045
+ 404:
10046
+ description: Not found
10025
10047
  /platform/location:
10026
10048
  post:
10027
10049
  tags:
@@ -17223,6 +17245,68 @@ components:
17223
17245
  additionalProperties: true
17224
17246
  required:
17225
17247
  - url
17248
+ PdfBox:
17249
+ type: object
17250
+ properties:
17251
+ x:
17252
+ type: object
17253
+ additionalProperties: true
17254
+ required:
17255
+ - x
17256
+ PdfEditArgs:
17257
+ type: object
17258
+ properties:
17259
+ url:
17260
+ type: string
17261
+ replaceText:
17262
+ type: array
17263
+ items:
17264
+ type: object
17265
+ additionalProperties: true
17266
+ addText:
17267
+ type: array
17268
+ items:
17269
+ type: object
17270
+ additionalProperties: true
17271
+ addImages:
17272
+ type: array
17273
+ items:
17274
+ type: object
17275
+ additionalProperties: true
17276
+ preserveColour:
17277
+ type: boolean
17278
+ required:
17279
+ - url
17280
+ PdfPreflightArgs:
17281
+ type: object
17282
+ properties:
17283
+ url:
17284
+ type: object
17285
+ additionalProperties: true
17286
+ required:
17287
+ - url
17288
+ PdfPrintReadyArgs:
17289
+ type: object
17290
+ properties:
17291
+ url:
17292
+ type: string
17293
+ profile:
17294
+ $ref: "#/components/schemas/PdfXProfile"
17295
+ outputIntent:
17296
+ type: string
17297
+ convertToCmyk:
17298
+ type: boolean
17299
+ embedFonts:
17300
+ type: boolean
17301
+ bleed:
17302
+ type: object
17303
+ additionalProperties: true
17304
+ flattenTransparency:
17305
+ type: boolean
17306
+ minDpi:
17307
+ type: number
17308
+ required:
17309
+ - url
17226
17310
  HttpRequestArgs:
17227
17311
  type: object
17228
17312
  properties:
@@ -17290,6 +17374,12 @@ components:
17290
17374
  $ref: "#/components/schemas/PdfDecodeBarcodesArgs"
17291
17375
  pdf.inspectGraphics:
17292
17376
  $ref: "#/components/schemas/PdfInspectGraphicsArgs"
17377
+ pdf.edit:
17378
+ $ref: "#/components/schemas/PdfEditArgs"
17379
+ pdf.preflight:
17380
+ $ref: "#/components/schemas/PdfPreflightArgs"
17381
+ pdf.printReady:
17382
+ $ref: "#/components/schemas/PdfPrintReadyArgs"
17293
17383
  http.request:
17294
17384
  $ref: "#/components/schemas/HttpRequestArgs"
17295
17385
  translate:
@@ -17316,6 +17406,9 @@ components:
17316
17406
  - pdf.extract
17317
17407
  - pdf.decodeBarcodes
17318
17408
  - pdf.inspectGraphics
17409
+ - pdf.edit
17410
+ - pdf.preflight
17411
+ - pdf.printReady
17319
17412
  - http.request
17320
17413
  - translate
17321
17414
  WebSearchResultItem:
@@ -17545,6 +17638,139 @@ components:
17545
17638
  additionalProperties: true
17546
17639
  required:
17547
17640
  - url
17641
+ PdfEditItemResult:
17642
+ type: object
17643
+ properties:
17644
+ id:
17645
+ type: string
17646
+ status:
17647
+ type: string
17648
+ enum:
17649
+ - done
17650
+ - failed
17651
+ note:
17652
+ type: string
17653
+ verified:
17654
+ type: boolean
17655
+ usedFallbackFont:
17656
+ type: boolean
17657
+ required:
17658
+ - id
17659
+ - status
17660
+ PdfEditResult:
17661
+ type: object
17662
+ properties:
17663
+ url:
17664
+ type: array
17665
+ items:
17666
+ type: object
17667
+ additionalProperties: true
17668
+ required:
17669
+ - url
17670
+ PdfPreflightFinding:
17671
+ type: object
17672
+ properties:
17673
+ severity:
17674
+ type: string
17675
+ enum:
17676
+ - error
17677
+ - warning
17678
+ required:
17679
+ - severity
17680
+ PdfPreflightResult:
17681
+ type: object
17682
+ properties:
17683
+ url:
17684
+ type: string
17685
+ compliant:
17686
+ type: boolean
17687
+ profile:
17688
+ $ref: "#/components/schemas/PdfXProfile"
17689
+ version:
17690
+ type: string
17691
+ findings:
17692
+ type: array
17693
+ items:
17694
+ $ref: "#/components/schemas/PdfPreflightFinding"
17695
+ stats:
17696
+ type: object
17697
+ additionalProperties: true
17698
+ pageCount:
17699
+ type: number
17700
+ fonts:
17701
+ type: array
17702
+ items:
17703
+ type: object
17704
+ additionalProperties: true
17705
+ spotColours:
17706
+ type: array
17707
+ items:
17708
+ type: string
17709
+ images:
17710
+ type: array
17711
+ items:
17712
+ type: object
17713
+ additionalProperties: true
17714
+ transparency:
17715
+ type: boolean
17716
+ outputIntent:
17717
+ type: object
17718
+ additionalProperties: true
17719
+ required:
17720
+ - url
17721
+ - compliant
17722
+ - profile
17723
+ - version
17724
+ - findings
17725
+ - stats
17726
+ - pageCount
17727
+ - fonts
17728
+ - spotColours
17729
+ - images
17730
+ - transparency
17731
+ - outputIntent
17732
+ PdfPrintReadyResult:
17733
+ type: object
17734
+ properties:
17735
+ url:
17736
+ type: string
17737
+ report:
17738
+ type: object
17739
+ additionalProperties: true
17740
+ compliant:
17741
+ type: boolean
17742
+ profile:
17743
+ $ref: "#/components/schemas/PdfXProfile"
17744
+ outputIntent:
17745
+ type: string
17746
+ findings:
17747
+ type: array
17748
+ items:
17749
+ $ref: "#/components/schemas/PdfPreflightFinding"
17750
+ changes:
17751
+ type: array
17752
+ items:
17753
+ type: object
17754
+ additionalProperties: true
17755
+ before:
17756
+ type: object
17757
+ additionalProperties: true
17758
+ stats:
17759
+ type: object
17760
+ additionalProperties: true
17761
+ note:
17762
+ type: string
17763
+ required:
17764
+ - url
17765
+ - report
17766
+ - compliant
17767
+ - profile
17768
+ - outputIntent
17769
+ - findings
17770
+ - changes
17771
+ - before
17772
+ - stats
17773
+ - note
17548
17774
  ResponsesAgentTrace:
17549
17775
  type: object
17550
17776
  properties:
@@ -17629,8 +17855,19 @@ components:
17629
17855
  - pdf.extract
17630
17856
  - pdf.decodeBarcodes
17631
17857
  - pdf.inspectGraphics
17858
+ - pdf.edit
17859
+ - pdf.preflight
17860
+ - pdf.printReady
17632
17861
  - http.request
17633
17862
  - translate
17863
+ PdfColour:
17864
+ type: object
17865
+ additionalProperties: true
17866
+ PdfXProfile:
17867
+ type: string
17868
+ enum:
17869
+ - pdfx-1a
17870
+ - pdfx-4
17634
17871
  AgentStreamEvent:
17635
17872
  type: object
17636
17873
  additionalProperties: true
@@ -848,7 +848,7 @@ export interface CatalogResponse {
848
848
  /** Capability tags a tool requires; scope a run with `allowCapabilities`. */
849
849
  export type AiToolCapability = 'web:read' | 'ai:vision' | 'ai:image' | 'ai:text' | 'media:image' | 'media:pdf' | 'net:http';
850
850
  /** The names of the built-in server-side agent tools (run via `server_tools`). */
851
- export type AiToolName = 'web.fetchPage' | 'web.extractSchema' | 'web.screenshot' | 'web.search' | 'brand.assets' | 'document.read' | 'data.extract' | 'image.describe' | 'image.generate' | 'image.fromReference' | 'image.searchStock' | 'image.transform' | 'image.ocr' | 'pdf.create' | 'pdf.fill' | 'pdf.merge' | 'pdf.inspect' | 'pdf.render' | 'pdf.extract' | 'pdf.decodeBarcodes' | 'pdf.inspectGraphics' | 'http.request' | 'translate';
851
+ export type AiToolName = 'web.fetchPage' | 'web.extractSchema' | 'web.screenshot' | 'web.search' | 'brand.assets' | 'document.read' | 'data.extract' | 'image.describe' | 'image.generate' | 'image.fromReference' | 'image.searchStock' | 'image.transform' | 'image.ocr' | 'pdf.create' | 'pdf.fill' | 'pdf.merge' | 'pdf.inspect' | 'pdf.render' | 'pdf.extract' | 'pdf.decodeBarcodes' | 'pdf.inspectGraphics' | 'pdf.edit' | 'pdf.preflight' | 'pdf.printReady' | 'http.request' | 'translate';
852
852
  export interface WebFetchPageArgs {
853
853
  url: string;
854
854
  type?: string;
@@ -993,6 +993,71 @@ export interface PdfInspectGraphicsArgs {
993
993
  url: string;
994
994
  page?: number;
995
995
  }
996
+ /** A box as fractions of the page (0-1), top-left origin. */
997
+ export interface PdfBox {
998
+ x: number;
999
+ y: number;
1000
+ w: number;
1001
+ h: number;
1002
+ }
1003
+ /** CMYK as [c, m, y, k] (0-1 or 0-100), '#RRGGBB', 'cmyk(c,m,y,k)' or 'black'. */
1004
+ export type PdfColour = string | [number, number, number, number];
1005
+ export interface PdfEditArgs {
1006
+ url: string;
1007
+ /** Live-text replacements; every occurrence on `page` (or all pages when omitted) is replaced. */
1008
+ replaceText?: {
1009
+ id?: string;
1010
+ page?: number;
1011
+ find: string;
1012
+ replace: string;
1013
+ bold?: boolean;
1014
+ align?: 'left' | 'center' | 'right';
1015
+ }[];
1016
+ addText?: {
1017
+ id?: string;
1018
+ page: number;
1019
+ box: PdfBox;
1020
+ text: string;
1021
+ size?: number;
1022
+ bold?: boolean;
1023
+ colour?: PdfColour;
1024
+ align?: 'left' | 'center' | 'right';
1025
+ }[];
1026
+ addImages?: {
1027
+ id?: string;
1028
+ page: number;
1029
+ box: PdfBox;
1030
+ imageUrl: string;
1031
+ colorSpace?: 'rgb' | 'cmyk';
1032
+ }[];
1033
+ /** Draw replacements in the colour of the text they replace (default true). */
1034
+ preserveColour?: boolean;
1035
+ }
1036
+ export type PdfXProfile = 'pdfx-1a' | 'pdfx-4';
1037
+ export interface PdfPreflightArgs {
1038
+ url: string;
1039
+ profile?: PdfXProfile;
1040
+ bleed?: {
1041
+ mm: number;
1042
+ };
1043
+ minDpi?: number;
1044
+ }
1045
+ export interface PdfPrintReadyArgs {
1046
+ url: string;
1047
+ /** Default 'pdfx-4' (keeps live transparency); 'pdfx-1a' = CMYK + spot only, no transparency. */
1048
+ profile?: PdfXProfile;
1049
+ /** FOGRA39 (default), FOGRA51, FOGRA52, FOGRA29, GRACoL2006, SWOP2006, JapanColor2011. */
1050
+ outputIntent?: string;
1051
+ convertToCmyk?: boolean;
1052
+ embedFonts?: boolean;
1053
+ /** Checked and reported, never added. */
1054
+ bleed?: {
1055
+ mm: number;
1056
+ };
1057
+ /** pdfx-1a only: flatten transparency (affected pages become images). Default false. */
1058
+ flattenTransparency?: boolean;
1059
+ minDpi?: number;
1060
+ }
996
1061
  export interface HttpRequestArgs {
997
1062
  url: string;
998
1063
  method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
@@ -1027,6 +1092,9 @@ export interface AiToolArgsMap {
1027
1092
  'pdf.extract': PdfExtractArgs;
1028
1093
  'pdf.decodeBarcodes': PdfDecodeBarcodesArgs;
1029
1094
  'pdf.inspectGraphics': PdfInspectGraphicsArgs;
1095
+ 'pdf.edit': PdfEditArgs;
1096
+ 'pdf.preflight': PdfPreflightArgs;
1097
+ 'pdf.printReady': PdfPrintReadyArgs;
1030
1098
  'http.request': HttpRequestArgs;
1031
1099
  'translate': TranslateArgs;
1032
1100
  }
@@ -1215,6 +1283,82 @@ export interface PdfInspectGraphicsResult {
1215
1283
  spotColours: string[];
1216
1284
  note: string;
1217
1285
  }
1286
+ export interface PdfEditItemResult {
1287
+ id: string;
1288
+ status: 'done' | 'failed';
1289
+ note?: string;
1290
+ /** replaceText: the new text reads back from the output as live text and the old text is gone. */
1291
+ verified?: boolean;
1292
+ /** replaceText: drawn in the embedded fallback font (original font lacked glyphs, or bold was asked). */
1293
+ usedFallbackFont?: boolean;
1294
+ }
1295
+ export interface PdfEditResult {
1296
+ url: string;
1297
+ results: PdfEditItemResult[];
1298
+ warnings: string[];
1299
+ }
1300
+ export interface PdfPreflightFinding {
1301
+ severity: 'error' | 'warning';
1302
+ code: string;
1303
+ page?: number;
1304
+ message: string;
1305
+ }
1306
+ export interface PdfPreflightResult {
1307
+ url: string;
1308
+ compliant: boolean;
1309
+ profile: PdfXProfile | null;
1310
+ version: string | null;
1311
+ findings: PdfPreflightFinding[];
1312
+ stats: {
1313
+ pageCount: number;
1314
+ fonts: {
1315
+ name: string;
1316
+ embedded: boolean;
1317
+ subset: boolean;
1318
+ type: string;
1319
+ pages: number[];
1320
+ }[];
1321
+ spotColours: string[];
1322
+ images: {
1323
+ page: number;
1324
+ dpi: number;
1325
+ width: number;
1326
+ height: number;
1327
+ space: string;
1328
+ placedMm: {
1329
+ w: number;
1330
+ h: number;
1331
+ };
1332
+ }[];
1333
+ transparency: boolean;
1334
+ outputIntent: {
1335
+ identifier: string | null;
1336
+ hasProfile: boolean;
1337
+ } | null;
1338
+ [key: string]: any;
1339
+ };
1340
+ }
1341
+ export interface PdfPrintReadyResult {
1342
+ url: string;
1343
+ report: {
1344
+ /** From the post-conversion preflight — never assumed. */
1345
+ compliant: boolean;
1346
+ profile: PdfXProfile;
1347
+ outputIntent: string;
1348
+ findings: PdfPreflightFinding[];
1349
+ changes: {
1350
+ code: string;
1351
+ message: string;
1352
+ }[];
1353
+ before: {
1354
+ compliant: boolean;
1355
+ errors: number;
1356
+ findings: PdfPreflightFinding[];
1357
+ };
1358
+ stats: Record<string, any>;
1359
+ note: string;
1360
+ };
1361
+ }
1218
1362
  /** The `_agent` trace attached to an agentic Responses result. */
1219
1363
  export interface ResponsesAgentTrace {
1220
1364
  steps: number;