@proveanything/smartlinks 2.0.63 → 2.0.65

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/ai-tools.js CHANGED
@@ -82,9 +82,9 @@ export const BUILTIN_AI_TOOLS = [
82
82
  { name: 'pdf.edit', group: 'media', capabilities: ['web:read', 'media:pdf'],
83
83
  description: 'Edit an existing PDF: replace LIVE text (glyph-exact removal so neighbouring text never moves; redrawn in the original font when it has the glyphs, else an embedded fallback; CMYK/spot colour kept; matches may span lines), add text and images in boxes (cmyk converts images for print). Returns url + per-item results with verified flags. Outlined text cannot be edited.' },
84
84
  { name: 'pdf.preflight', group: 'media', capabilities: ['web:read'],
85
- description: 'Prepress preflight without changing the PDF: non-embedded fonts, RGB/Lab content, missing TrimBox/BleedBox and short bleed, low effective image resolution, transparency, white overprint, missing PDF/X output intent. Severity follows the target profile. No AI.' },
85
+ description: 'Prepress preflight without changing the PDF: non-embedded fonts, RGB/Lab content, missing TrimBox/BleedBox and short bleed, low effective image resolution, transparency, white overprint, annotations, hidden layers, missing PDF/X output intent. Severity follows the target profile. No AI.' },
86
86
  { name: 'pdf.printReady', group: 'media', capabilities: ['web:read', 'media:pdf'],
87
- description: 'Prepare a PDF for print: RGB/Lab -> CMYK with a real press profile (spot colours kept), embed fonts, optional transparency flattening, mark as PDF/X-1a or PDF/X-4 with the output intent embedded, then preflight the RESULT. Returns url + report { compliant, findings, changes }.' },
87
+ description: 'Prepare a PDF for print: text outlined to curves (or live embedded fonts), RGB/Lab -> CMYK with a real press profile (or grey), spot colours kept or converted, comments removed, layers chosen by name, optional image downsampling, page selection, boxes from included bleed, crop marks and transparency flattening; mark as PDF/X-1a or PDF/X-4 with the output intent embedded, then preflight the RESULT. Returns url + report { compliant, findings, changes }.' },
88
88
  { name: 'http.request', group: 'net', capabilities: ['net:http'],
89
89
  description: 'SSRF-guarded outbound HTTP(S) request to a public URL; returns status/headers/body.' },
90
90
  { name: 'translate', group: 'text', capabilities: ['ai:text'],
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.0.63 | Generated: 2026-10-14T09:04:47.371Z
3
+ Version: 2.0.65 | Generated: 2026-10-14T11:51:48.823Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -1688,13 +1688,22 @@ interface PdfPreflightArgs {
1688
1688
  ```typescript
1689
1689
  interface PdfPrintReadyArgs {
1690
1690
  url: string
1691
- profile?: PdfXProfile
1691
+ profile?: PdfXProfile | 'none'
1692
1692
  outputIntent?: string
1693
- convertToCmyk?: boolean
1693
+ colour?: 'cmyk' | 'gray' | 'keep'
1694
+ spotColours?: 'keep' | 'convert'
1695
+ outlineFonts?: boolean
1694
1696
  embedFonts?: boolean
1697
+ downsample?: { dpi: number }
1698
+ pages?: string
1699
+ annotations?: 'remove' | 'flatten' | 'keep'
1700
+ layers?: { hide?: string[]; show?: string[] }
1695
1701
  bleed?: { mm: number }
1702
+ bleedIncluded?: { mm: number; force?: boolean }
1703
+ cropMarks?: { offsetMm?: number; lengthMm?: number; weightPt?: number }
1696
1704
  flattenTransparency?: boolean
1697
1705
  minDpi?: number
1706
+ title?: string
1698
1707
  }
1699
1708
  ```
1700
1709
 
@@ -1954,6 +1963,8 @@ interface PdfPreflightResult {
1954
1963
  images: { page: number; dpi: number; width: number; height: number; space: string; placedMm: { w: number; h: number } }[]
1955
1964
  transparency: boolean
1956
1965
  outputIntent: { identifier: string | null; hasProfile: boolean } | null
1966
+ annotations: number
1967
+ layers: { name: string; visible: boolean }[]
1957
1968
  [key: string]: any
1958
1969
  }
1959
1970
  }
@@ -1965,7 +1976,7 @@ interface PdfPrintReadyResult {
1965
1976
  url: string
1966
1977
  report: {
1967
1978
  compliant: boolean
1968
- profile: PdfXProfile
1979
+ profile: PdfXProfile | 'none'
1969
1980
  outputIntent: string
1970
1981
  findings: PdfPreflightFinding[]
1971
1982
  changes: { code: string; message: string }[]
@@ -3095,6 +3106,8 @@ interface ConnectorShapeResult {
3095
3106
  interface ConnectorSerializeInput {
3096
3107
  installation: ConnectorInstallation
3097
3108
  documents: Array<Record<string, unknown>>
3109
+ entities?: Array<{ id: string | null; name?: string | null; deleted?: boolean }>
3110
+ targetOptions?: Record<string, Record<string, unknown>>
3098
3111
  eventType?: string
3099
3112
  }
3100
3113
  ```
@@ -86,7 +86,9 @@ Data that changes without an event (visit counts, "due this week") — use `maxA
86
86
 
87
87
  ## Return the payload
88
88
 
89
- The function returns an `AdminCardPayload` — every field optional; return what the card needs:
89
+ The function returns an `AdminCardPayload` — every field optional; return what the card needs.
90
+ It's called with **POST** (an http function's default method — no `trigger.methods` needed) and the body
91
+ `{ "card": "<card id>" }`, so one function can serve several cards:
90
92
 
91
93
  ```ts
92
94
  import type { AdminCardPayload } from '@proveanything/smartlinks'
package/dist/docs/ai.md CHANGED
@@ -333,8 +333,8 @@ in `input`.
333
333
  | `pdf.decodeBarcodes` | Deterministically decode barcodes/QR on a page (WASM, no AI) → value + symbology + page + bbox + confidence. Use this for barcode digits, never vision. |
334
334
  | `pdf.inspectGraphics` | Prepress inspection: per-page path/image/outlined-text counts + colour spaces, plus named SPOT colours (e.g. "PANTONE 871 C"). No AI. |
335
335
  | `pdf.edit` | Edit an existing PDF: replace **live** text (glyph-exact removal, neighbours never move; original font when it has the glyphs, else an embedded fallback; CMYK/spot colour kept; matches may span lines), add text / images in boxes (`colorSpace: "cmyk"` converts images for print). Per-item `results` with `verified`. |
336
- | `pdf.preflight` | Prepress preflight, no changes: fonts, RGB/Lab, TrimBox/BleedBox + bleed, effective image dpi, transparency, white overprint, output intent. No AI. |
337
- | `pdf.printReady` | RGB→CMYK with a press profile (spot colours kept), embed fonts, optional flattening, mark PDF/X-1a or PDF/X-4 with the output intent embedded, then preflight the result → `{ url, report }`. |
336
+ | `pdf.preflight` | Prepress preflight, no changes: fonts, RGB/Lab, TrimBox/BleedBox + bleed, effective image dpi, transparency, white overprint, annotations, hidden layers, output intent. No AI. |
337
+ | `pdf.printReady` | Text outlined to curves, RGB→CMYK with a press profile (spot colours kept), comments removed, layers merged as chosen, mark PDF/X-1a or PDF/X-4 with the output intent embedded, then preflight the result → `{ url, report }`. Options for grey, spot conversion, downsampling, pages, crop marks and more (below). |
338
338
  | `http.request` | SSRF-guarded outbound HTTP(S) to a public URL (call a REST API). |
339
339
  | `translate` | Translate text into one or more languages (generic, model-based). |
340
340
 
@@ -362,11 +362,31 @@ in `input`.
362
362
  — it may run into neighbouring text. Text outlined to curves can't be edited: the item fails with
363
363
  "not found as live text" — put it on the designer change list. `verified: true` means the new text
364
364
  reads back from the output.
365
- - **Is it print-ready?** → `pdf.preflight` (report only). **Make it print-ready** → `pdf.printReady`
366
- with `profile` (`pdfx-4` default; `pdfx-1a` for CMYK-only workflows), `outputIntent` (e.g. `FOGRA39`)
367
- and `bleed: { mm: 3 }`. `report.compliant` comes from preflighting the OUTPUT, so remaining issues
368
- (low-res images, missing bleed, white overprint) are reported rather than hidden. Flattening for
369
- PDF/X-1a turns affected pages into images — opt in with `flattenTransparency: true`.
365
+ - **Is it print-ready?** → `pdf.preflight` (report only; `stats.layers` lists the file's layers).
366
+ **Make it print-ready** → `pdf.printReady`. By default it outlines all text to curves, converts
367
+ RGB/Lab to CMYK for the `outputIntent` (e.g. `FOGRA39`), keeps spot colours, removes comments and
368
+ links, merges layers as the file shows them (hidden layers left out) and marks the file PDF/X-4.
369
+ `report.changes` says what was done, measured on the output; `report.compliant` comes from
370
+ preflighting the OUTPUT, so remaining issues (low-res images, missing bleed, white overprint) are
371
+ reported rather than hidden. Options:
372
+
373
+ | Option | Values |
374
+ |---|---|
375
+ | `profile` | `pdfx-4` (default), `pdfx-1a` (CMYK + spot only), `none` (convert, no PDF/X marking) |
376
+ | `outputIntent` | `FOGRA39` (default), `FOGRA51`, `FOGRA52`, `FOGRA29`, `GRACoL2006`, `SWOP2006`, `JapanColor2011` |
377
+ | `colour` | `cmyk` (default), `gray`, `keep` |
378
+ | `spotColours` | `keep` (default) or `convert` to process colour |
379
+ | `outlineFonts` | `true` (default) text → curves; `false` keeps live text (fonts embedded with `embedFonts`, default true) |
380
+ | `layers` | `{ hide: ['Dieline'], show: [...] }` by name — e.g. print without the dieline |
381
+ | `annotations` | `remove` (default), `flatten` (draw into the artwork), `keep` |
382
+ | `pages` | `"1-3,5"` (default all) |
383
+ | `downsample` | `{ dpi: 300 }` — resample images placed above 1.5× that; off by default |
384
+ | `bleed` | `{ mm: 3 }` — required bleed, checked and reported, never added |
385
+ | `bleedIncluded` | `{ mm: 3 }` — the artwork already includes its bleed: sets TrimBox/BleedBox |
386
+ | `cropMarks` | `{}` or `{ offsetMm, lengthMm, weightPt }` — crop marks outside the bleed |
387
+ | `flattenTransparency` | PDF/X-1a only: affected pages become images. Default false |
388
+
389
+ Outlined text can't be edited or searched afterwards: keep the source PDF for changes and regenerate.
370
390
 
371
391
  ```ts
372
392
  const edited = await SL.ai.tools.run(collectionId, 'pdf.edit', {
@@ -375,6 +395,7 @@ const edited = await SL.ai.tools.run(collectionId, 'pdf.edit', {
375
395
  })
376
396
  const ready = await SL.ai.tools.run(collectionId, 'pdf.printReady', {
377
397
  url: edited.result.url, profile: 'pdfx-4', outputIntent: 'FOGRA39', bleed: { mm: 3 },
398
+ layers: { hide: ['Dieline'] }, cropMarks: {},
378
399
  })
379
400
  if (!ready.result.report.compliant) showFindings(ready.result.report.findings)
380
401
  ```
@@ -110,7 +110,7 @@ declare the provider's hosts (`network:<host>`) and the secrets it reads (`secre
110
110
  | `sample` | Mapper, AI assist, dry run | `{ installation, limit }` | `ConnectorRecords` `{ records }`: real provider records |
111
111
  | `fetch` | Every inbound run | `ConnectorFetchInput` `{ installation, cursor, limit }` | `ConnectorRecords` `{ records, nextCursor }`: one page per call |
112
112
  | `shape` | Every inbound run (and sample dry runs) | `ConnectorShapeInput` `{ installation, records }` | `ConnectorShapeResult` `{ documents, skipped }`: one provider-neutral document per record, same order; `null` skips one |
113
- | `serialize` | Every outbound run | `ConnectorSerializeInput` `{ installation, documents, eventType? }`: documents core mapped to `describeTarget` paths; a deletion arrives as `{ id, _deleted: true }` | `ConnectorSerializeResult` `{ payloads, skipped }`: one provider payload per document, same order; `null` skips one |
113
+ | `serialize` | Every outbound run | `ConnectorSerializeInput` `{ installation, documents, entities, targetOptions, eventType? }`: documents core mapped to `describeTarget` paths; `entities` = the SmartLinks record each came from (id, name); `targetOptions` = per-field options the mapping carries (e.g. locale, unit); a deletion arrives as `{ id, _deleted: true }` | `ConnectorSerializeResult` `{ payloads, skipped }`: one provider payload per document, same order; `null` skips one |
114
114
  | `send` | Every outbound run | `ConnectorSendInput` `{ installation, payloads }` | `ConnectorSendResult` `{ results: [{ index, ok, status, error, externalId }] }` |
115
115
 
116
116
  **How a run flows:**
@@ -167,6 +167,7 @@ Declare the minimum you need.
167
167
  | `sl:<resource>:read` / `sl:<resource>:write` | SDK access to that resource, e.g. `sl:products:read`, `sl:records:write`, `sl:attestations:write`, `sl:contacts:write`. |
168
168
  | `network` | `ctx.fetch` to any host. |
169
169
  | `network:<host>` | `ctx.fetch` to that host only (repeat for several). Prefer this over blanket `network`. |
170
+ | `network:*.<domain>` | `ctx.fetch` to any subdomain of `<domain>` (not `<domain>` itself), for a customer's own endpoint at a provider, e.g. `network:*.servicebus.windows.net`. `<domain>` needs at least two labels (`*.com` is not honoured). |
170
171
  | `secrets:<name>` | `ctx.secrets.get('<name>')` for that one secret (see [Secrets](#secrets--api-keys-per-collection)). |
171
172
 
172
173
  If you don't declare `network`, `ctx.fetch` is absent. Reading a secret you didn't declare with
package/dist/openapi.yaml CHANGED
@@ -17615,20 +17615,55 @@ components:
17615
17615
  url:
17616
17616
  type: string
17617
17617
  profile:
17618
- $ref: "#/components/schemas/PdfXProfile"
17618
+ type: string
17619
+ enum:
17620
+ - none
17619
17621
  outputIntent:
17620
17622
  type: string
17621
- convertToCmyk:
17623
+ colour:
17624
+ type: string
17625
+ enum:
17626
+ - cmyk
17627
+ - gray
17628
+ - keep
17629
+ spotColours:
17630
+ type: string
17631
+ enum:
17632
+ - keep
17633
+ - convert
17634
+ outlineFonts:
17622
17635
  type: boolean
17623
17636
  embedFonts:
17624
17637
  type: boolean
17638
+ downsample:
17639
+ type: object
17640
+ additionalProperties: true
17641
+ pages:
17642
+ type: string
17643
+ annotations:
17644
+ type: string
17645
+ enum:
17646
+ - remove
17647
+ - flatten
17648
+ - keep
17649
+ layers:
17650
+ type: object
17651
+ additionalProperties: true
17625
17652
  bleed:
17626
17653
  type: object
17627
17654
  additionalProperties: true
17655
+ bleedIncluded:
17656
+ type: object
17657
+ additionalProperties: true
17658
+ cropMarks:
17659
+ type: object
17660
+ additionalProperties: true
17628
17661
  flattenTransparency:
17629
17662
  type: boolean
17630
17663
  minDpi:
17631
17664
  type: number
17665
+ title:
17666
+ type: string
17632
17667
  required:
17633
17668
  - url
17634
17669
  HttpRequestArgs:
@@ -18040,6 +18075,13 @@ components:
18040
18075
  outputIntent:
18041
18076
  type: object
18042
18077
  additionalProperties: true
18078
+ annotations:
18079
+ type: number
18080
+ layers:
18081
+ type: array
18082
+ items:
18083
+ type: object
18084
+ additionalProperties: true
18043
18085
  required:
18044
18086
  - url
18045
18087
  - compliant
@@ -18053,6 +18095,8 @@ components:
18053
18095
  - images
18054
18096
  - transparency
18055
18097
  - outputIntent
18098
+ - annotations
18099
+ - layers
18056
18100
  PdfPrintReadyResult:
18057
18101
  type: object
18058
18102
  properties:
@@ -18064,7 +18108,9 @@ components:
18064
18108
  compliant:
18065
18109
  type: boolean
18066
18110
  profile:
18067
- $ref: "#/components/schemas/PdfXProfile"
18111
+ type: string
18112
+ enum:
18113
+ - none
18068
18114
  outputIntent:
18069
18115
  type: string
18070
18116
  findings:
@@ -20172,6 +20218,16 @@ components:
20172
20218
  items:
20173
20219
  type: object
20174
20220
  additionalProperties: true
20221
+ entities:
20222
+ type: array
20223
+ items:
20224
+ type: object
20225
+ additionalProperties: true
20226
+ targetOptions:
20227
+ type: object
20228
+ additionalProperties:
20229
+ type: object
20230
+ additionalProperties: true
20175
20231
  eventType:
20176
20232
  type: string
20177
20233
  required:
@@ -1041,19 +1041,51 @@ export interface PdfPreflightArgs {
1041
1041
  }
1042
1042
  export interface PdfPrintReadyArgs {
1043
1043
  url: string;
1044
- /** Default 'pdfx-4' (keeps live transparency); 'pdfx-1a' = CMYK + spot only, no transparency. */
1045
- profile?: PdfXProfile;
1044
+ /** Default 'pdfx-4' (keeps live transparency); 'pdfx-1a' = CMYK + spot only, no transparency; 'none' = convert without PDF/X marking. */
1045
+ profile?: PdfXProfile | 'none';
1046
1046
  /** FOGRA39 (default), FOGRA51, FOGRA52, FOGRA29, GRACoL2006, SWOP2006, JapanColor2011. */
1047
1047
  outputIntent?: string;
1048
- convertToCmyk?: boolean;
1048
+ /** 'cmyk' (default: RGB/Lab → CMYK with the press profile), 'gray' (single-colour jobs), 'keep'. */
1049
+ colour?: 'cmyk' | 'gray' | 'keep';
1050
+ /** 'keep' (default) the spot plates (Pantone, varnish, white, dieline) or 'convert' them to process colour. */
1051
+ spotColours?: 'keep' | 'convert';
1052
+ /** Convert all text to vector curves so no fonts are needed (default true). false keeps live text. */
1053
+ outlineFonts?: boolean;
1054
+ /** With outlineFonts false: embed (subset) every font (default true). */
1049
1055
  embedFonts?: boolean;
1050
- /** Checked and reported, never added. */
1056
+ /** Resample images placed above 1.5× this resolution down to it (e.g. { dpi: 300 }). Off by default. */
1057
+ downsample?: {
1058
+ dpi: number;
1059
+ };
1060
+ /** Pages to keep, e.g. "1-3,5" (default all). */
1061
+ pages?: string;
1062
+ /** Comments, links and form fields: 'remove' (default), 'flatten' (drawn into the artwork), 'keep'. */
1063
+ annotations?: 'remove' | 'flatten' | 'keep';
1064
+ /** Choose which layers print, by name (case-insensitive), e.g. { hide: ['Dieline'] }. Layers are merged into the artwork; hidden ones are left out. */
1065
+ layers?: {
1066
+ hide?: string[];
1067
+ show?: string[];
1068
+ };
1069
+ /** Required bleed — checked and reported, never added. */
1051
1070
  bleed?: {
1052
1071
  mm: number;
1053
1072
  };
1073
+ /** The artwork already includes this much bleed (page = finished size + bleed): sets TrimBox/BleedBox (pages without a TrimBox; all with force). */
1074
+ bleedIncluded?: {
1075
+ mm: number;
1076
+ force?: boolean;
1077
+ };
1078
+ /** Add crop marks outside the bleed in registration colour; {} for defaults (3 mm offset, 5 mm long, 0.25 pt). */
1079
+ cropMarks?: {
1080
+ offsetMm?: number;
1081
+ lengthMm?: number;
1082
+ weightPt?: number;
1083
+ };
1054
1084
  /** pdfx-1a only: flatten transparency (affected pages become images). Default false. */
1055
1085
  flattenTransparency?: boolean;
1056
1086
  minDpi?: number;
1087
+ /** Document title written into the file (default: the source title). */
1088
+ title?: string;
1057
1089
  }
1058
1090
  export interface HttpRequestArgs {
1059
1091
  url: string;
@@ -1332,6 +1364,13 @@ export interface PdfPreflightResult {
1332
1364
  identifier: string | null;
1333
1365
  hasProfile: boolean;
1334
1366
  } | null;
1367
+ /** Comments, links and form fields on the pages (printer's marks / trapping excluded). */
1368
+ annotations: number;
1369
+ /** Optional content (layers) and whether each is visible in the default view. */
1370
+ layers: {
1371
+ name: string;
1372
+ visible: boolean;
1373
+ }[];
1335
1374
  [key: string]: any;
1336
1375
  };
1337
1376
  }
@@ -1340,9 +1379,10 @@ export interface PdfPrintReadyResult {
1340
1379
  report: {
1341
1380
  /** From the post-conversion preflight — never assumed. */
1342
1381
  compliant: boolean;
1343
- profile: PdfXProfile;
1382
+ profile: PdfXProfile | 'none';
1344
1383
  outputIntent: string;
1345
1384
  findings: PdfPreflightFinding[];
1385
+ /** What was done, measured on the result: FONTS_OUTLINED, CONVERTED_TO_CMYK, SPOT_COLOURS_CONVERTED, IMAGES_DOWNSAMPLED, PAGES_SELECTED, ANNOTATIONS_REMOVED, LAYERS_MERGED, BOXES_FROM_BLEED, CROP_MARKS, OUTPUT_INTENT, PDFX_IDENTIFIED… */
1346
1386
  changes: {
1347
1387
  code: string;
1348
1388
  message: string;
@@ -1010,6 +1010,17 @@ export interface ConnectorShapeResult {
1010
1010
  export interface ConnectorSerializeInput {
1011
1011
  installation: ConnectorInstallation;
1012
1012
  documents: Array<Record<string, unknown>>;
1013
+ /** The SmartLinks record each document came from (same order): its id and name, e.g. for an envelope's own id. */
1014
+ entities?: Array<{
1015
+ id: string | null;
1016
+ name?: string | null;
1017
+ deleted?: boolean;
1018
+ }>;
1019
+ /**
1020
+ * Options the flow's mapping carries per target field (keyed by target path), beyond the mapping
1021
+ * itself — e.g. { "brand": { "locale": "en-GB", "uom": "kg" } }. Data for the wire format, not mapping logic.
1022
+ */
1023
+ targetOptions?: Record<string, Record<string, unknown>>;
1013
1024
  /** The event that triggered the run, e.g. 'product.updated' (absent for manual / scheduled runs). */
1014
1025
  eventType?: string;
1015
1026
  }
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.0.63 | Generated: 2026-10-14T09:04:47.371Z
3
+ Version: 2.0.65 | Generated: 2026-10-14T11:51:48.823Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -1688,13 +1688,22 @@ interface PdfPreflightArgs {
1688
1688
  ```typescript
1689
1689
  interface PdfPrintReadyArgs {
1690
1690
  url: string
1691
- profile?: PdfXProfile
1691
+ profile?: PdfXProfile | 'none'
1692
1692
  outputIntent?: string
1693
- convertToCmyk?: boolean
1693
+ colour?: 'cmyk' | 'gray' | 'keep'
1694
+ spotColours?: 'keep' | 'convert'
1695
+ outlineFonts?: boolean
1694
1696
  embedFonts?: boolean
1697
+ downsample?: { dpi: number }
1698
+ pages?: string
1699
+ annotations?: 'remove' | 'flatten' | 'keep'
1700
+ layers?: { hide?: string[]; show?: string[] }
1695
1701
  bleed?: { mm: number }
1702
+ bleedIncluded?: { mm: number; force?: boolean }
1703
+ cropMarks?: { offsetMm?: number; lengthMm?: number; weightPt?: number }
1696
1704
  flattenTransparency?: boolean
1697
1705
  minDpi?: number
1706
+ title?: string
1698
1707
  }
1699
1708
  ```
1700
1709
 
@@ -1954,6 +1963,8 @@ interface PdfPreflightResult {
1954
1963
  images: { page: number; dpi: number; width: number; height: number; space: string; placedMm: { w: number; h: number } }[]
1955
1964
  transparency: boolean
1956
1965
  outputIntent: { identifier: string | null; hasProfile: boolean } | null
1966
+ annotations: number
1967
+ layers: { name: string; visible: boolean }[]
1957
1968
  [key: string]: any
1958
1969
  }
1959
1970
  }
@@ -1965,7 +1976,7 @@ interface PdfPrintReadyResult {
1965
1976
  url: string
1966
1977
  report: {
1967
1978
  compliant: boolean
1968
- profile: PdfXProfile
1979
+ profile: PdfXProfile | 'none'
1969
1980
  outputIntent: string
1970
1981
  findings: PdfPreflightFinding[]
1971
1982
  changes: { code: string; message: string }[]
@@ -3095,6 +3106,8 @@ interface ConnectorShapeResult {
3095
3106
  interface ConnectorSerializeInput {
3096
3107
  installation: ConnectorInstallation
3097
3108
  documents: Array<Record<string, unknown>>
3109
+ entities?: Array<{ id: string | null; name?: string | null; deleted?: boolean }>
3110
+ targetOptions?: Record<string, Record<string, unknown>>
3098
3111
  eventType?: string
3099
3112
  }
3100
3113
  ```
@@ -86,7 +86,9 @@ Data that changes without an event (visit counts, "due this week") — use `maxA
86
86
 
87
87
  ## Return the payload
88
88
 
89
- The function returns an `AdminCardPayload` — every field optional; return what the card needs:
89
+ The function returns an `AdminCardPayload` — every field optional; return what the card needs.
90
+ It's called with **POST** (an http function's default method — no `trigger.methods` needed) and the body
91
+ `{ "card": "<card id>" }`, so one function can serve several cards:
90
92
 
91
93
  ```ts
92
94
  import type { AdminCardPayload } from '@proveanything/smartlinks'
package/docs/ai.md CHANGED
@@ -333,8 +333,8 @@ in `input`.
333
333
  | `pdf.decodeBarcodes` | Deterministically decode barcodes/QR on a page (WASM, no AI) → value + symbology + page + bbox + confidence. Use this for barcode digits, never vision. |
334
334
  | `pdf.inspectGraphics` | Prepress inspection: per-page path/image/outlined-text counts + colour spaces, plus named SPOT colours (e.g. "PANTONE 871 C"). No AI. |
335
335
  | `pdf.edit` | Edit an existing PDF: replace **live** text (glyph-exact removal, neighbours never move; original font when it has the glyphs, else an embedded fallback; CMYK/spot colour kept; matches may span lines), add text / images in boxes (`colorSpace: "cmyk"` converts images for print). Per-item `results` with `verified`. |
336
- | `pdf.preflight` | Prepress preflight, no changes: fonts, RGB/Lab, TrimBox/BleedBox + bleed, effective image dpi, transparency, white overprint, output intent. No AI. |
337
- | `pdf.printReady` | RGB→CMYK with a press profile (spot colours kept), embed fonts, optional flattening, mark PDF/X-1a or PDF/X-4 with the output intent embedded, then preflight the result → `{ url, report }`. |
336
+ | `pdf.preflight` | Prepress preflight, no changes: fonts, RGB/Lab, TrimBox/BleedBox + bleed, effective image dpi, transparency, white overprint, annotations, hidden layers, output intent. No AI. |
337
+ | `pdf.printReady` | Text outlined to curves, RGB→CMYK with a press profile (spot colours kept), comments removed, layers merged as chosen, mark PDF/X-1a or PDF/X-4 with the output intent embedded, then preflight the result → `{ url, report }`. Options for grey, spot conversion, downsampling, pages, crop marks and more (below). |
338
338
  | `http.request` | SSRF-guarded outbound HTTP(S) to a public URL (call a REST API). |
339
339
  | `translate` | Translate text into one or more languages (generic, model-based). |
340
340
 
@@ -362,11 +362,31 @@ in `input`.
362
362
  — it may run into neighbouring text. Text outlined to curves can't be edited: the item fails with
363
363
  "not found as live text" — put it on the designer change list. `verified: true` means the new text
364
364
  reads back from the output.
365
- - **Is it print-ready?** → `pdf.preflight` (report only). **Make it print-ready** → `pdf.printReady`
366
- with `profile` (`pdfx-4` default; `pdfx-1a` for CMYK-only workflows), `outputIntent` (e.g. `FOGRA39`)
367
- and `bleed: { mm: 3 }`. `report.compliant` comes from preflighting the OUTPUT, so remaining issues
368
- (low-res images, missing bleed, white overprint) are reported rather than hidden. Flattening for
369
- PDF/X-1a turns affected pages into images — opt in with `flattenTransparency: true`.
365
+ - **Is it print-ready?** → `pdf.preflight` (report only; `stats.layers` lists the file's layers).
366
+ **Make it print-ready** → `pdf.printReady`. By default it outlines all text to curves, converts
367
+ RGB/Lab to CMYK for the `outputIntent` (e.g. `FOGRA39`), keeps spot colours, removes comments and
368
+ links, merges layers as the file shows them (hidden layers left out) and marks the file PDF/X-4.
369
+ `report.changes` says what was done, measured on the output; `report.compliant` comes from
370
+ preflighting the OUTPUT, so remaining issues (low-res images, missing bleed, white overprint) are
371
+ reported rather than hidden. Options:
372
+
373
+ | Option | Values |
374
+ |---|---|
375
+ | `profile` | `pdfx-4` (default), `pdfx-1a` (CMYK + spot only), `none` (convert, no PDF/X marking) |
376
+ | `outputIntent` | `FOGRA39` (default), `FOGRA51`, `FOGRA52`, `FOGRA29`, `GRACoL2006`, `SWOP2006`, `JapanColor2011` |
377
+ | `colour` | `cmyk` (default), `gray`, `keep` |
378
+ | `spotColours` | `keep` (default) or `convert` to process colour |
379
+ | `outlineFonts` | `true` (default) text → curves; `false` keeps live text (fonts embedded with `embedFonts`, default true) |
380
+ | `layers` | `{ hide: ['Dieline'], show: [...] }` by name — e.g. print without the dieline |
381
+ | `annotations` | `remove` (default), `flatten` (draw into the artwork), `keep` |
382
+ | `pages` | `"1-3,5"` (default all) |
383
+ | `downsample` | `{ dpi: 300 }` — resample images placed above 1.5× that; off by default |
384
+ | `bleed` | `{ mm: 3 }` — required bleed, checked and reported, never added |
385
+ | `bleedIncluded` | `{ mm: 3 }` — the artwork already includes its bleed: sets TrimBox/BleedBox |
386
+ | `cropMarks` | `{}` or `{ offsetMm, lengthMm, weightPt }` — crop marks outside the bleed |
387
+ | `flattenTransparency` | PDF/X-1a only: affected pages become images. Default false |
388
+
389
+ Outlined text can't be edited or searched afterwards: keep the source PDF for changes and regenerate.
370
390
 
371
391
  ```ts
372
392
  const edited = await SL.ai.tools.run(collectionId, 'pdf.edit', {
@@ -375,6 +395,7 @@ const edited = await SL.ai.tools.run(collectionId, 'pdf.edit', {
375
395
  })
376
396
  const ready = await SL.ai.tools.run(collectionId, 'pdf.printReady', {
377
397
  url: edited.result.url, profile: 'pdfx-4', outputIntent: 'FOGRA39', bleed: { mm: 3 },
398
+ layers: { hide: ['Dieline'] }, cropMarks: {},
378
399
  })
379
400
  if (!ready.result.report.compliant) showFindings(ready.result.report.findings)
380
401
  ```
@@ -110,7 +110,7 @@ declare the provider's hosts (`network:<host>`) and the secrets it reads (`secre
110
110
  | `sample` | Mapper, AI assist, dry run | `{ installation, limit }` | `ConnectorRecords` `{ records }`: real provider records |
111
111
  | `fetch` | Every inbound run | `ConnectorFetchInput` `{ installation, cursor, limit }` | `ConnectorRecords` `{ records, nextCursor }`: one page per call |
112
112
  | `shape` | Every inbound run (and sample dry runs) | `ConnectorShapeInput` `{ installation, records }` | `ConnectorShapeResult` `{ documents, skipped }`: one provider-neutral document per record, same order; `null` skips one |
113
- | `serialize` | Every outbound run | `ConnectorSerializeInput` `{ installation, documents, eventType? }`: documents core mapped to `describeTarget` paths; a deletion arrives as `{ id, _deleted: true }` | `ConnectorSerializeResult` `{ payloads, skipped }`: one provider payload per document, same order; `null` skips one |
113
+ | `serialize` | Every outbound run | `ConnectorSerializeInput` `{ installation, documents, entities, targetOptions, eventType? }`: documents core mapped to `describeTarget` paths; `entities` = the SmartLinks record each came from (id, name); `targetOptions` = per-field options the mapping carries (e.g. locale, unit); a deletion arrives as `{ id, _deleted: true }` | `ConnectorSerializeResult` `{ payloads, skipped }`: one provider payload per document, same order; `null` skips one |
114
114
  | `send` | Every outbound run | `ConnectorSendInput` `{ installation, payloads }` | `ConnectorSendResult` `{ results: [{ index, ok, status, error, externalId }] }` |
115
115
 
116
116
  **How a run flows:**
@@ -167,6 +167,7 @@ Declare the minimum you need.
167
167
  | `sl:<resource>:read` / `sl:<resource>:write` | SDK access to that resource, e.g. `sl:products:read`, `sl:records:write`, `sl:attestations:write`, `sl:contacts:write`. |
168
168
  | `network` | `ctx.fetch` to any host. |
169
169
  | `network:<host>` | `ctx.fetch` to that host only (repeat for several). Prefer this over blanket `network`. |
170
+ | `network:*.<domain>` | `ctx.fetch` to any subdomain of `<domain>` (not `<domain>` itself), for a customer's own endpoint at a provider, e.g. `network:*.servicebus.windows.net`. `<domain>` needs at least two labels (`*.com` is not honoured). |
170
171
  | `secrets:<name>` | `ctx.secrets.get('<name>')` for that one secret (see [Secrets](#secrets--api-keys-per-collection)). |
171
172
 
172
173
  If you don't declare `network`, `ctx.fetch` is absent. Reading a secret you didn't declare with
package/openapi.yaml CHANGED
@@ -17615,20 +17615,55 @@ components:
17615
17615
  url:
17616
17616
  type: string
17617
17617
  profile:
17618
- $ref: "#/components/schemas/PdfXProfile"
17618
+ type: string
17619
+ enum:
17620
+ - none
17619
17621
  outputIntent:
17620
17622
  type: string
17621
- convertToCmyk:
17623
+ colour:
17624
+ type: string
17625
+ enum:
17626
+ - cmyk
17627
+ - gray
17628
+ - keep
17629
+ spotColours:
17630
+ type: string
17631
+ enum:
17632
+ - keep
17633
+ - convert
17634
+ outlineFonts:
17622
17635
  type: boolean
17623
17636
  embedFonts:
17624
17637
  type: boolean
17638
+ downsample:
17639
+ type: object
17640
+ additionalProperties: true
17641
+ pages:
17642
+ type: string
17643
+ annotations:
17644
+ type: string
17645
+ enum:
17646
+ - remove
17647
+ - flatten
17648
+ - keep
17649
+ layers:
17650
+ type: object
17651
+ additionalProperties: true
17625
17652
  bleed:
17626
17653
  type: object
17627
17654
  additionalProperties: true
17655
+ bleedIncluded:
17656
+ type: object
17657
+ additionalProperties: true
17658
+ cropMarks:
17659
+ type: object
17660
+ additionalProperties: true
17628
17661
  flattenTransparency:
17629
17662
  type: boolean
17630
17663
  minDpi:
17631
17664
  type: number
17665
+ title:
17666
+ type: string
17632
17667
  required:
17633
17668
  - url
17634
17669
  HttpRequestArgs:
@@ -18040,6 +18075,13 @@ components:
18040
18075
  outputIntent:
18041
18076
  type: object
18042
18077
  additionalProperties: true
18078
+ annotations:
18079
+ type: number
18080
+ layers:
18081
+ type: array
18082
+ items:
18083
+ type: object
18084
+ additionalProperties: true
18043
18085
  required:
18044
18086
  - url
18045
18087
  - compliant
@@ -18053,6 +18095,8 @@ components:
18053
18095
  - images
18054
18096
  - transparency
18055
18097
  - outputIntent
18098
+ - annotations
18099
+ - layers
18056
18100
  PdfPrintReadyResult:
18057
18101
  type: object
18058
18102
  properties:
@@ -18064,7 +18108,9 @@ components:
18064
18108
  compliant:
18065
18109
  type: boolean
18066
18110
  profile:
18067
- $ref: "#/components/schemas/PdfXProfile"
18111
+ type: string
18112
+ enum:
18113
+ - none
18068
18114
  outputIntent:
18069
18115
  type: string
18070
18116
  findings:
@@ -20172,6 +20218,16 @@ components:
20172
20218
  items:
20173
20219
  type: object
20174
20220
  additionalProperties: true
20221
+ entities:
20222
+ type: array
20223
+ items:
20224
+ type: object
20225
+ additionalProperties: true
20226
+ targetOptions:
20227
+ type: object
20228
+ additionalProperties:
20229
+ type: object
20230
+ additionalProperties: true
20175
20231
  eventType:
20176
20232
  type: string
20177
20233
  required:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "2.0.63",
3
+ "version": "2.0.65",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",