@proveanything/smartlinks 2.0.66 → 2.0.68
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 +1 -1
- package/dist/api/authKit.d.ts +14 -1
- package/dist/api/authKit.js +15 -0
- package/dist/api/collection.d.ts +21 -11
- package/dist/api/collection.js +25 -13
- package/dist/api/tags.d.ts +8 -8
- package/dist/api/tags.js +10 -10
- package/dist/docs/API_SUMMARY.md +72 -21
- package/dist/docs/agent-tools.md +1 -1
- package/dist/docs/ai.md +6 -4
- package/dist/docs/app-manifest.md +1 -1
- package/dist/docs/auth-kit.md +650 -626
- package/dist/docs/connectors.md +1 -1
- package/dist/docs/server-functions.md +60 -4
- package/dist/index.d.ts +1 -1
- package/dist/openapi.yaml +139 -6
- package/dist/types/ai.d.ts +40 -2
- package/dist/types/appManifest.d.ts +10 -0
- package/dist/types/authKit.d.ts +21 -1
- package/dist/types/collection.d.ts +6 -4
- package/docs/API_SUMMARY.md +72 -21
- package/docs/agent-tools.md +1 -1
- package/docs/ai.md +6 -4
- package/docs/app-manifest.md +1 -1
- package/docs/auth-kit.md +650 -626
- package/docs/connectors.md +1 -1
- package/docs/server-functions.md +60 -4
- package/openapi.yaml +139 -6
- package/package.json +1 -1
package/dist/docs/connectors.md
CHANGED
|
@@ -66,7 +66,7 @@ deterministically. A connector's `shape` and `serialize` must be deterministic t
|
|
|
66
66
|
"aiGuide": "connector-ai-guide.md"
|
|
67
67
|
},
|
|
68
68
|
"functions": {
|
|
69
|
-
"files": { "js": { "umd": "
|
|
69
|
+
"files": { "js": { "umd": "functions.umd.js" } },
|
|
70
70
|
"definitions": [
|
|
71
71
|
{ "name": "testConnection", "trigger": { "type": "http", "method": "POST" },
|
|
72
72
|
"visibility": "admin", "authority": "collection",
|
|
@@ -33,7 +33,7 @@ in a bundle alongside your widgets/containers:
|
|
|
33
33
|
```jsonc
|
|
34
34
|
{
|
|
35
35
|
"functions": {
|
|
36
|
-
"files": { "js": { "umd": "
|
|
36
|
+
"files": { "js": { "umd": "functions.umd.js" } },
|
|
37
37
|
"definitions": [
|
|
38
38
|
{
|
|
39
39
|
"name": "submitCompetitionEntry",
|
|
@@ -98,9 +98,12 @@ export default defineConfig({
|
|
|
98
98
|
}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
That emits `dist/functions.umd.js
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
That emits `dist/functions.umd.js`, whose named exports the platform pairs with your manifest
|
|
102
|
+
`definitions`. In the manifest, `functions.files.js.umd` is **`functions.umd.js`** — relative to the
|
|
103
|
+
published build (the contents of `dist/`), like the widget and container files; not
|
|
104
|
+
`dist/functions.umd.js`. Publishing refuses a release whose functions bundle isn't there.
|
|
105
|
+
|
|
106
|
+
Then **deploy** it — for dev, `smartlinks-publish` uploads `dist/` and registers in one step (see
|
|
104
107
|
[Deploying & registering](deploying-apps.md)).
|
|
105
108
|
|
|
106
109
|
---
|
|
@@ -169,6 +172,7 @@ Declare the minimum you need.
|
|
|
169
172
|
| `network:<host>` | `ctx.fetch` to that host only (repeat for several). Prefer this over blanket `network`. |
|
|
170
173
|
| `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). |
|
|
171
174
|
| `secrets:<name>` | `ctx.secrets.get('<name>')` for that one secret (see [Secrets](#secrets--api-keys-per-collection)). |
|
|
175
|
+
| `tools:<name>` / `tools:<family>.*` | `ctx.sl.tools.run('<name>', args)` for a platform tool, e.g. `tools:pdf.create`, or `tools:pdf.*` for every PDF tool (see [Platform tools](#platform-tools--pdfs-labels-barcodes)). |
|
|
172
176
|
|
|
173
177
|
If you don't declare `network`, `ctx.fetch` is absent. Reading a secret you didn't declare with
|
|
174
178
|
`secrets:<name>` throws.
|
|
@@ -606,6 +610,58 @@ await ctx.sl.interactions.record({
|
|
|
606
610
|
|
|
607
611
|
---
|
|
608
612
|
|
|
613
|
+
## Platform tools — PDFs, labels, barcodes
|
|
614
|
+
|
|
615
|
+
`ctx.sl.tools.run(name, args)` runs one of the platform's deterministic tools from your function: no
|
|
616
|
+
model, no agent loop. Declare each tool as a capability: `tools:pdf.create`, or `tools:pdf.*` for the
|
|
617
|
+
whole family. Open to functions: `pdf.create`, `pdf.merge`, `pdf.fill`, `pdf.inspect`, `pdf.render`,
|
|
618
|
+
`pdf.decodeBarcodes`, `pdf.inspectGraphics`, `pdf.preflight`, `pdf.printReady`, `pdf.edit`,
|
|
619
|
+
`image.transform` (arguments as in [ai.md](ai.md)).
|
|
620
|
+
|
|
621
|
+
- **Identity:** the call runs as the function's collection, whatever the caller. An anonymous caller
|
|
622
|
+
holding only your own key gets the same result; the work is attributed and billed to the collection.
|
|
623
|
+
- **Rate:** per collection (10 calls a second by default); bursts wait rather than fail.
|
|
624
|
+
- **Failure:** throws an `Error` with `code` (`bad_args`, `too_large`, `too_many_pages`,
|
|
625
|
+
`resource_timeout`, `timeout`, `busy`, `TOOL_NOT_AVAILABLE`, or a capability denial).
|
|
626
|
+
|
|
627
|
+
**Labels with `pdf.create`.** Exact page sizes, many pages in one render, and bytes straight back:
|
|
628
|
+
|
|
629
|
+
```ts
|
|
630
|
+
// capabilities: ["tools:pdf.create", "tools:pdf.decodeBarcodes"]
|
|
631
|
+
export async function printLabel(ctx, event) {
|
|
632
|
+
const { gtin, lot, expiry, qty = 1 } = event.body
|
|
633
|
+
const barcode = bwipjs.toSVG({ bcid: 'gs1-128', text: `(01)${gtin}(10)${lot}(17)${expiry}` }) // inline SVG
|
|
634
|
+
const pdf = await ctx.sl.tools.run('pdf.create', {
|
|
635
|
+
width: 100, height: 50, unit: 'mm', // exact; output is 1:1
|
|
636
|
+
head: '<style>.l{position:absolute;font:3mm Arial}</style>',
|
|
637
|
+
pages: Array.from({ length: qty }, () => `<div class="l" style="left:4mm;top:3mm">Lot ${lot}</div>
|
|
638
|
+
<div style="position:absolute;left:4mm;top:10mm;width:92mm">${barcode}</div>`),
|
|
639
|
+
return: 'base64', // or 'signedUrl' + expiresIn
|
|
640
|
+
})
|
|
641
|
+
return { pdf: pdf.base64, pages: pdf.pageCount }
|
|
642
|
+
}
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
- **Page size:** `width` + `height` (+ `unit`: mm, cm, in, pt, px) is exact to the point. Otherwise
|
|
646
|
+
`format` ("A4", "Letter"), or the document's own CSS `@page { size }` when neither is given.
|
|
647
|
+
- **Pages:** `pages: [html, …]` lays one fragment per page; with an exact size and no margin each page
|
|
648
|
+
box is that size (overflow hidden), so a long value can't push onto the next label. Up to 2000 pages
|
|
649
|
+
and 10 MB of HTML per render.
|
|
650
|
+
- **Output:** 1:1 at scale 1 with backgrounds; text stays text and SVG stays vector (render barcodes as
|
|
651
|
+
inline SVG, e.g. bwip-js `toSVG`, never as a canvas bitmap). Colour is RGB; for CMYK pass the result
|
|
652
|
+
through `pdf.printReady`.
|
|
653
|
+
- **What loads:** JavaScript does not run. Images, fonts and stylesheets load only from SmartLinks hosts
|
|
654
|
+
(our CDN), Google Fonts or inline `data:` URIs; anything else is skipped and listed in `warnings`.
|
|
655
|
+
Embed brand fonts as `data:` URIs in `@font-face`, or host them on the SmartLinks CDN.
|
|
656
|
+
- **Delivery:** `return: 'base64'` (nothing stored), `'signedUrl'` (private link that expires after
|
|
657
|
+
`expiresIn` seconds, default 900, max 7 days — use this for anything with lot, expiry or serial
|
|
658
|
+
data), or `'url'` (public and permanent — artwork and documents meant to be shared).
|
|
659
|
+
- **Cache:** the same inputs return the earlier render without rendering again (`cached: true`).
|
|
660
|
+
- **Verify:** `pdf.decodeBarcodes` on a `signedUrl` reads the codes back deterministically, so you can
|
|
661
|
+
confirm the digits before answering.
|
|
662
|
+
|
|
663
|
+
---
|
|
664
|
+
|
|
609
665
|
## Worked example — a public competition entry
|
|
610
666
|
|
|
611
667
|
```ts
|
package/dist/index.d.ts
CHANGED
|
@@ -41,4 +41,4 @@ AdminMobileHostContext, AdminMobileComponentManifest, AdminMobileBundleManifest,
|
|
|
41
41
|
MobileAdminBundleManifest, } from './mobile-admin/types.js';
|
|
42
42
|
export { HostCapabilityUnavailableError, HostPermissionDeniedError, HostTimeoutError, HostCancelledError, } from './mobile-admin/errors.js';
|
|
43
43
|
export type { NativeCapability, NativeFacade, ShareFacade, ClipboardFacade, HapticImpactStyle, HapticNotificationStyle, HapticsFacade, NetworkStatus, NetworkFacade, DeviceInfo, DeviceFacade, StorageFacade, QrScanOptions, QrFacade, AuthFacade, NfcReadResult, NfcFacade, RfidScanOptions, RfidFacade, EventsFacade, WebSourceMode, WebSourceConfig, WebSourceFacade, } from './native/types.js';
|
|
44
|
-
export type { AuthKitUser, UserProfile, ProfileUpdateData, UpdateProfileResponse, SuccessResponse, AuthLoginResponse, AppleLoginOptions, AuthKitErrorCode, RefreshResponse, LogoutResponse, RefreshErrorCode, MagicLinkSendResponse, MagicLinkVerifyResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, VerifyStatus, WhatsAppReplyCta, WhatsAppReplyOptions, WhatsAppContactData, SendWhatsAppRequest, SendWhatsAppResponse, ExchangeWhatsAppSessionResponse, VerifyWhatsAppResponse, WhatsAppStatusResponse, SendSmsVerifyRequest, SendSmsVerifyResponse, VerifySmsResponse, UpsertContactRequest, UpsertContactResponse, AuthKitBrandingConfig, AuthKitConfig, AuthKitConfigInput, AuthKitSecurityConfig, AuthKitPasswordPolicy, AuthKitSessionPolicy, AuthKitLockoutPolicy, PasswordPolicyErrorCode, LoginSecurityErrorCode, } from './types/authKit.js';
|
|
44
|
+
export type { AuthKitUser, UserProfile, ProfileUpdateData, UpdateProfileResponse, SuccessResponse, AuthLoginResponse, AppleLoginOptions, AuthKitErrorCode, RefreshResponse, LogoutResponse, RefreshErrorCode, MagicLinkSendResponse, MagicLinkVerifyResponse, PhoneSendCodeResponse, PhoneVerifyResponse, PasswordResetRequestResponse, VerifyResetTokenResponse, PasswordResetCompleteResponse, EmailVerificationActionResponse, EmailVerifyTokenResponse, VerifyStatus, WhatsAppReplyCta, WhatsAppReplyOptions, WhatsAppContactData, SendWhatsAppRequest, SendWhatsAppResponse, ExchangeWhatsAppSessionResponse, VerifyWhatsAppResponse, WhatsAppStatusResponse, SendSmsVerifyRequest, SendSmsVerifyResponse, VerifySmsResponse, UpsertContactRequest, UpsertContactResponse, AuthKitBrandingConfig, AuthKitConfig, AuthKitConfigInput, AuthKitSecurityConfig, AuthKitIdentity, AuthKitSetIdentityResponse, AuthKitPasswordPolicy, AuthKitSessionPolicy, AuthKitLockoutPolicy, PasswordPolicyErrorCode, LoginSecurityErrorCode, } from './types/authKit.js';
|
package/dist/openapi.yaml
CHANGED
|
@@ -2077,6 +2077,45 @@ paths:
|
|
|
2077
2077
|
description: Unauthorized
|
|
2078
2078
|
404:
|
|
2079
2079
|
description: Not found
|
|
2080
|
+
/admin/collection/{collectionId}/authKit/{authKitId}/identity:
|
|
2081
|
+
post:
|
|
2082
|
+
tags:
|
|
2083
|
+
- authKit
|
|
2084
|
+
summary: "Give this AuthKit its **own logins** (admin): its members become accounts of this site only — the same email can be a separate account, with its own password, on another site — rather than SmartLinks accounts shared across sites."
|
|
2085
|
+
operationId: authKit_setIdentity
|
|
2086
|
+
security:
|
|
2087
|
+
- bearerAuth: []
|
|
2088
|
+
parameters:
|
|
2089
|
+
- name: collectionId
|
|
2090
|
+
in: path
|
|
2091
|
+
required: true
|
|
2092
|
+
schema:
|
|
2093
|
+
type: string
|
|
2094
|
+
- name: authKitId
|
|
2095
|
+
in: path
|
|
2096
|
+
required: true
|
|
2097
|
+
schema:
|
|
2098
|
+
type: string
|
|
2099
|
+
responses:
|
|
2100
|
+
200:
|
|
2101
|
+
description: Success
|
|
2102
|
+
content:
|
|
2103
|
+
application/json:
|
|
2104
|
+
schema:
|
|
2105
|
+
$ref: "#/components/schemas/AuthKitSetIdentityResponse"
|
|
2106
|
+
400:
|
|
2107
|
+
description: Bad request
|
|
2108
|
+
401:
|
|
2109
|
+
description: Unauthorized
|
|
2110
|
+
404:
|
|
2111
|
+
description: Not found
|
|
2112
|
+
requestBody:
|
|
2113
|
+
required: true
|
|
2114
|
+
content:
|
|
2115
|
+
application/json:
|
|
2116
|
+
schema:
|
|
2117
|
+
type: object
|
|
2118
|
+
additionalProperties: true
|
|
2080
2119
|
/admin/collection/{collectionId}/batch:
|
|
2081
2120
|
get:
|
|
2082
2121
|
tags:
|
|
@@ -3715,7 +3754,7 @@ paths:
|
|
|
3715
3754
|
get:
|
|
3716
3755
|
tags:
|
|
3717
3756
|
- collection
|
|
3718
|
-
summary: "Get the
|
|
3757
|
+
summary: "Get the certificate status of the collection's own domain (admin only)."
|
|
3719
3758
|
operationId: collection_getDomainStatus
|
|
3720
3759
|
security:
|
|
3721
3760
|
- bearerAuth: []
|
|
@@ -3740,7 +3779,7 @@ paths:
|
|
|
3740
3779
|
post:
|
|
3741
3780
|
tags:
|
|
3742
3781
|
- collection
|
|
3743
|
-
summary:
|
|
3782
|
+
summary: "Connect one of the collection's own domains and start its certificate (admin only)."
|
|
3744
3783
|
operationId: collection_registerDomain
|
|
3745
3784
|
security:
|
|
3746
3785
|
- bearerAuth: []
|
|
@@ -8339,7 +8378,7 @@ paths:
|
|
|
8339
8378
|
get:
|
|
8340
8379
|
tags:
|
|
8341
8380
|
- tags
|
|
8342
|
-
summary: Reverse lookup
|
|
8381
|
+
summary: Reverse lookup — find all tags linked to a given object (admin).
|
|
8343
8382
|
operationId: tags_byRef
|
|
8344
8383
|
security:
|
|
8345
8384
|
- bearerAuth: []
|
|
@@ -9207,7 +9246,7 @@ paths:
|
|
|
9207
9246
|
post:
|
|
9208
9247
|
tags:
|
|
9209
9248
|
- authKit
|
|
9210
|
-
summary:
|
|
9249
|
+
summary: Sign in with LinkedIn (OpenID Connect) via a server-side authorization code (public).
|
|
9211
9250
|
operationId: authKit_linkedInLogin
|
|
9212
9251
|
security: []
|
|
9213
9252
|
parameters:
|
|
@@ -14108,7 +14147,7 @@ paths:
|
|
|
14108
14147
|
get:
|
|
14109
14148
|
tags:
|
|
14110
14149
|
- tags
|
|
14111
|
-
summary: "Global tag resolve
|
|
14150
|
+
summary: "Global tag resolve — returns `{ tagId, collectionId }` only."
|
|
14112
14151
|
operationId: tags_resolveTag
|
|
14113
14152
|
security: []
|
|
14114
14153
|
parameters:
|
|
@@ -17499,14 +17538,74 @@ components:
|
|
|
17499
17538
|
properties:
|
|
17500
17539
|
html:
|
|
17501
17540
|
type: string
|
|
17541
|
+
pages:
|
|
17542
|
+
type: array
|
|
17543
|
+
items:
|
|
17544
|
+
type: string
|
|
17545
|
+
head:
|
|
17546
|
+
type: string
|
|
17547
|
+
width:
|
|
17548
|
+
type: number
|
|
17549
|
+
height:
|
|
17550
|
+
type: number
|
|
17551
|
+
unit:
|
|
17552
|
+
type: string
|
|
17553
|
+
enum:
|
|
17554
|
+
- mm
|
|
17555
|
+
- cm
|
|
17556
|
+
- in
|
|
17557
|
+
- pt
|
|
17558
|
+
- px
|
|
17502
17559
|
format:
|
|
17503
17560
|
type: string
|
|
17504
17561
|
landscape:
|
|
17505
17562
|
type: boolean
|
|
17506
17563
|
margin:
|
|
17507
17564
|
type: string
|
|
17565
|
+
return:
|
|
17566
|
+
type: string
|
|
17567
|
+
enum:
|
|
17568
|
+
- url
|
|
17569
|
+
- signedUrl
|
|
17570
|
+
- base64
|
|
17571
|
+
expiresIn:
|
|
17572
|
+
type: number
|
|
17573
|
+
filename:
|
|
17574
|
+
type: string
|
|
17575
|
+
cache:
|
|
17576
|
+
type: boolean
|
|
17577
|
+
PdfCreateResult:
|
|
17578
|
+
type: object
|
|
17579
|
+
properties:
|
|
17580
|
+
url:
|
|
17581
|
+
type: string
|
|
17582
|
+
hostedUrl:
|
|
17583
|
+
type: string
|
|
17584
|
+
base64:
|
|
17585
|
+
type: string
|
|
17586
|
+
expiresAt:
|
|
17587
|
+
type: string
|
|
17588
|
+
contentType:
|
|
17589
|
+
type: string
|
|
17590
|
+
enum:
|
|
17591
|
+
- application/pdf
|
|
17592
|
+
size:
|
|
17593
|
+
type: number
|
|
17594
|
+
pageCount:
|
|
17595
|
+
type: number
|
|
17596
|
+
cached:
|
|
17597
|
+
type: boolean
|
|
17598
|
+
renderer:
|
|
17599
|
+
type: string
|
|
17600
|
+
warnings:
|
|
17601
|
+
type: array
|
|
17602
|
+
items:
|
|
17603
|
+
type: string
|
|
17508
17604
|
required:
|
|
17509
|
-
-
|
|
17605
|
+
- contentType
|
|
17606
|
+
- size
|
|
17607
|
+
- pageCount
|
|
17608
|
+
- cached
|
|
17510
17609
|
PdfFillArgs:
|
|
17511
17610
|
type: object
|
|
17512
17611
|
properties:
|
|
@@ -19657,6 +19756,9 @@ components:
|
|
|
19657
19756
|
interactions:
|
|
19658
19757
|
type: object
|
|
19659
19758
|
additionalProperties: true
|
|
19759
|
+
tools:
|
|
19760
|
+
type: object
|
|
19761
|
+
additionalProperties: true
|
|
19660
19762
|
products: {}
|
|
19661
19763
|
attestations: {}
|
|
19662
19764
|
appData:
|
|
@@ -19667,6 +19769,7 @@ components:
|
|
|
19667
19769
|
- tags
|
|
19668
19770
|
- contacts
|
|
19669
19771
|
- interactions
|
|
19772
|
+
- tools
|
|
19670
19773
|
- products
|
|
19671
19774
|
- attestations
|
|
19672
19775
|
- appData
|
|
@@ -23263,8 +23366,38 @@ components:
|
|
|
23263
23366
|
type: string
|
|
23264
23367
|
security:
|
|
23265
23368
|
$ref: "#/components/schemas/AuthKitSecurityConfig"
|
|
23369
|
+
collectionIds:
|
|
23370
|
+
type: array
|
|
23371
|
+
items:
|
|
23372
|
+
type: string
|
|
23373
|
+
identity:
|
|
23374
|
+
$ref: "#/components/schemas/AuthKitIdentity"
|
|
23266
23375
|
required:
|
|
23267
23376
|
- id
|
|
23377
|
+
AuthKitIdentity:
|
|
23378
|
+
type: object
|
|
23379
|
+
properties:
|
|
23380
|
+
mode:
|
|
23381
|
+
type: string
|
|
23382
|
+
enum:
|
|
23383
|
+
- shared
|
|
23384
|
+
- own
|
|
23385
|
+
tenantId:
|
|
23386
|
+
type: string
|
|
23387
|
+
createdAt:
|
|
23388
|
+
type: string
|
|
23389
|
+
required:
|
|
23390
|
+
- mode
|
|
23391
|
+
AuthKitSetIdentityResponse:
|
|
23392
|
+
type: object
|
|
23393
|
+
properties:
|
|
23394
|
+
identity:
|
|
23395
|
+
$ref: "#/components/schemas/AuthKitIdentity"
|
|
23396
|
+
message:
|
|
23397
|
+
type: string
|
|
23398
|
+
required:
|
|
23399
|
+
- identity
|
|
23400
|
+
- message
|
|
23268
23401
|
AuthKitSecurityConfig:
|
|
23269
23402
|
type: object
|
|
23270
23403
|
properties:
|
package/dist/types/ai.d.ts
CHANGED
|
@@ -945,11 +945,49 @@ export interface PdfClip {
|
|
|
945
945
|
y1: number;
|
|
946
946
|
}
|
|
947
947
|
export interface PdfCreateArgs {
|
|
948
|
-
html
|
|
948
|
+
/** One HTML document (inline CSS). Give `html` or `pages`. */
|
|
949
|
+
html?: string;
|
|
950
|
+
/** One HTML fragment per page, laid out one per page (sharing `head`). With width/height and no margin each page box is exactly that size, overflow hidden. 500 labels = one call. */
|
|
951
|
+
pages?: string[];
|
|
952
|
+
/** With `pages`: shared <head> content (<style>, @font-face). */
|
|
953
|
+
head?: string;
|
|
954
|
+
/** Exact page size (labels, rolls, sheets) — exact to the point. Give both. */
|
|
955
|
+
width?: number;
|
|
956
|
+
height?: number;
|
|
957
|
+
/** Unit for width/height (default 'mm'). */
|
|
958
|
+
unit?: 'mm' | 'cm' | 'in' | 'pt' | 'px';
|
|
959
|
+
/** Named page size ("A4", "Letter") when not giving width/height. With neither, the document's CSS @page size is used (else A4). */
|
|
949
960
|
format?: string;
|
|
950
961
|
landscape?: boolean;
|
|
951
|
-
/** Page margin for all sides, e.g. "0" or "12mm"
|
|
962
|
+
/** Page margin for all sides, e.g. "0" or "12mm". Default 0 with width/height or pages; 18mm/14mm for named formats. */
|
|
952
963
|
margin?: string;
|
|
964
|
+
/** 'url' (public, permanent; default), 'signedUrl' (private link that expires), 'base64' (bytes in the response, nothing stored). */
|
|
965
|
+
return?: 'url' | 'signedUrl' | 'base64';
|
|
966
|
+
/** signedUrl lifetime in seconds: 30 to 604800 (7 days); default 900. */
|
|
967
|
+
expiresIn?: number;
|
|
968
|
+
/** File name for signedUrl downloads (default document.pdf). */
|
|
969
|
+
filename?: string;
|
|
970
|
+
/** Reuse an identical earlier render (default true). */
|
|
971
|
+
cache?: boolean;
|
|
972
|
+
}
|
|
973
|
+
export interface PdfCreateResult {
|
|
974
|
+
/** return 'url' or 'signedUrl'. */
|
|
975
|
+
url?: string;
|
|
976
|
+
/** return 'url': same as url. */
|
|
977
|
+
hostedUrl?: string;
|
|
978
|
+
/** return 'base64'. */
|
|
979
|
+
base64?: string;
|
|
980
|
+
/** return 'signedUrl': when the link stops working. */
|
|
981
|
+
expiresAt?: string;
|
|
982
|
+
contentType: 'application/pdf';
|
|
983
|
+
size: number;
|
|
984
|
+
pageCount: number;
|
|
985
|
+
/** An identical earlier render was reused (no new render). */
|
|
986
|
+
cached: boolean;
|
|
987
|
+
/** The renderer, e.g. "Chrome/141.0…". */
|
|
988
|
+
renderer?: string;
|
|
989
|
+
/** Resources that were not loaded (only images, fonts and stylesheets from SmartLinks hosts, Google Fonts or data: URIs load). */
|
|
990
|
+
warnings?: string[];
|
|
953
991
|
}
|
|
954
992
|
export interface PdfFillArgs {
|
|
955
993
|
url: string;
|
|
@@ -457,6 +457,16 @@ export interface ServerFunctionSl {
|
|
|
457
457
|
eventId: string;
|
|
458
458
|
}>;
|
|
459
459
|
};
|
|
460
|
+
/**
|
|
461
|
+
* Platform tools (`tools:<name>` or `tools:<family>.*`, e.g. `tools:pdf.create`, `tools:pdf.*`):
|
|
462
|
+
* pdf.create, pdf.merge, pdf.fill, pdf.inspect, pdf.render, pdf.decodeBarcodes, pdf.inspectGraphics,
|
|
463
|
+
* pdf.preflight, pdf.printReady, pdf.edit, image.transform. Runs as THIS collection whatever the caller
|
|
464
|
+
* (authorised by the declaration, billed to the collection), rate-limited per collection. Returns the
|
|
465
|
+
* tool's result; a failure throws an Error with `code` (e.g. bad_args, busy, too_many_pages).
|
|
466
|
+
*/
|
|
467
|
+
tools: {
|
|
468
|
+
run<T = any>(name: string, args?: Record<string, any>): Promise<T>;
|
|
469
|
+
};
|
|
460
470
|
/** Products, scoped by caller authority + declared capability. */
|
|
461
471
|
products: any;
|
|
462
472
|
/** Attestations, scoped by caller authority + declared capability. */
|
package/dist/types/authKit.d.ts
CHANGED
|
@@ -407,6 +407,26 @@ export interface AuthKitConfig {
|
|
|
407
407
|
* server-side. See {@link AuthKitSecurityConfig}.
|
|
408
408
|
*/
|
|
409
409
|
security?: AuthKitSecurityConfig;
|
|
410
|
+
/** The collections this AuthKit serves. */
|
|
411
|
+
collectionIds?: string[];
|
|
412
|
+
/**
|
|
413
|
+
* Which user pool this site's members sign in to. Absent or `shared` = the SmartLinks account (the
|
|
414
|
+
* same account on every site that uses it). `own` = the site's own members (a separate account per
|
|
415
|
+
* site, its own passwords). Switch with {@link authKit.setIdentity}; never via create/update.
|
|
416
|
+
*/
|
|
417
|
+
identity?: AuthKitIdentity;
|
|
418
|
+
}
|
|
419
|
+
/** An AuthKit's member pool. */
|
|
420
|
+
export interface AuthKitIdentity {
|
|
421
|
+
mode: 'shared' | 'own';
|
|
422
|
+
/** The site's own pool (set by the platform). */
|
|
423
|
+
tenantId?: string;
|
|
424
|
+
createdAt?: string;
|
|
425
|
+
}
|
|
426
|
+
/** Result of {@link authKit.setIdentity}. */
|
|
427
|
+
export interface AuthKitSetIdentityResponse {
|
|
428
|
+
identity: AuthKitIdentity;
|
|
429
|
+
message: string;
|
|
410
430
|
}
|
|
411
431
|
/**
|
|
412
432
|
* Writable shape for `authKit.create` / `authKit.update` (admin). Known fields are
|
|
@@ -424,7 +444,7 @@ export interface AuthKitConfig {
|
|
|
424
444
|
* })
|
|
425
445
|
* ```
|
|
426
446
|
*/
|
|
427
|
-
export type AuthKitConfigInput = Partial<Omit<AuthKitConfig, 'id' | 'updatedAt'>> & Record<string, any>;
|
|
447
|
+
export type AuthKitConfigInput = Partial<Omit<AuthKitConfig, 'id' | 'updatedAt' | 'identity'>> & Record<string, any>;
|
|
428
448
|
/**
|
|
429
449
|
* Per-collection account-security policy. The API **enforces** all of this; the
|
|
430
450
|
* client uses `passwordPolicy` (live checklist) and `session` (idle sign-out) for UX.
|
|
@@ -93,11 +93,13 @@ export type CollectionResponse = Collection;
|
|
|
93
93
|
export type CollectionCreateRequest = Omit<Collection, 'id' | 'shortId'>;
|
|
94
94
|
export type CollectionUpdateRequest = Partial<Omit<Collection, 'id' | 'shortId'>>;
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
97
|
-
* - `"
|
|
98
|
-
* -
|
|
96
|
+
* What a collection's own domain is for:
|
|
97
|
+
* - `"links"` (default): a links domain (e.g. `id.brand.com`) — GS1 Digital Links, short links and QR
|
|
98
|
+
* codes, the portal, and the API and sign-in on the brand's domain. Stored as `redirectUrl`.
|
|
99
|
+
* - `"site"`: a site domain — the collection's Hub (`hubCustomDomain`), or an app website when an
|
|
100
|
+
* `appId` is given. Served through the site runtime (CNAME to `cname.smartlinks.host`).
|
|
99
101
|
*/
|
|
100
|
-
export type DomainTarget = "
|
|
102
|
+
export type DomainTarget = "links" | "site";
|
|
101
103
|
/**
|
|
102
104
|
* Response from checking whether a Hub subdomain name is available.
|
|
103
105
|
*/
|
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.68 | Generated: 2026-10-17T10:04:22.637Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -1600,10 +1600,35 @@ interface PdfClip {
|
|
|
1600
1600
|
**PdfCreateArgs** (interface)
|
|
1601
1601
|
```typescript
|
|
1602
1602
|
interface PdfCreateArgs {
|
|
1603
|
-
html
|
|
1603
|
+
html?: string
|
|
1604
|
+
pages?: string[]
|
|
1605
|
+
head?: string
|
|
1606
|
+
width?: number
|
|
1607
|
+
height?: number
|
|
1608
|
+
unit?: 'mm' | 'cm' | 'in' | 'pt' | 'px'
|
|
1604
1609
|
format?: string
|
|
1605
1610
|
landscape?: boolean
|
|
1606
1611
|
margin?: string
|
|
1612
|
+
return?: 'url' | 'signedUrl' | 'base64'
|
|
1613
|
+
expiresIn?: number
|
|
1614
|
+
filename?: string
|
|
1615
|
+
cache?: boolean
|
|
1616
|
+
}
|
|
1617
|
+
```
|
|
1618
|
+
|
|
1619
|
+
**PdfCreateResult** (interface)
|
|
1620
|
+
```typescript
|
|
1621
|
+
interface PdfCreateResult {
|
|
1622
|
+
url?: string
|
|
1623
|
+
hostedUrl?: string
|
|
1624
|
+
base64?: string
|
|
1625
|
+
expiresAt?: string
|
|
1626
|
+
contentType: 'application/pdf'
|
|
1627
|
+
size: number
|
|
1628
|
+
pageCount: number
|
|
1629
|
+
cached: boolean
|
|
1630
|
+
renderer?: string
|
|
1631
|
+
warnings?: string[]
|
|
1607
1632
|
}
|
|
1608
1633
|
```
|
|
1609
1634
|
|
|
@@ -2786,6 +2811,7 @@ interface ServerFunctionSl {
|
|
|
2786
2811
|
forCaller(): Promise<{ contactId: string } | null>;
|
|
2787
2812
|
};
|
|
2788
2813
|
interactions: { record(event: ServerFunctionInteractionEvent): Promise<{ eventId: string }> };
|
|
2814
|
+
tools: { run<T = any>(name: string, args?: Record<string, any>): Promise<T> };
|
|
2789
2815
|
products: any;
|
|
2790
2816
|
attestations: any;
|
|
2791
2817
|
appData: AppDataHandle & { global: AppDataHandle; collection: AppDataHandle };
|
|
@@ -4838,6 +4864,25 @@ interface AuthKitConfig {
|
|
|
4838
4864
|
redirectUrl?: string
|
|
4839
4865
|
updatedAt?: string
|
|
4840
4866
|
security?: AuthKitSecurityConfig
|
|
4867
|
+
collectionIds?: string[]
|
|
4868
|
+
identity?: AuthKitIdentity
|
|
4869
|
+
}
|
|
4870
|
+
```
|
|
4871
|
+
|
|
4872
|
+
**AuthKitIdentity** (interface)
|
|
4873
|
+
```typescript
|
|
4874
|
+
interface AuthKitIdentity {
|
|
4875
|
+
mode: 'shared' | 'own'
|
|
4876
|
+
tenantId?: string
|
|
4877
|
+
createdAt?: string
|
|
4878
|
+
}
|
|
4879
|
+
```
|
|
4880
|
+
|
|
4881
|
+
**AuthKitSetIdentityResponse** (interface)
|
|
4882
|
+
```typescript
|
|
4883
|
+
interface AuthKitSetIdentityResponse {
|
|
4884
|
+
identity: AuthKitIdentity
|
|
4885
|
+
message: string
|
|
4841
4886
|
}
|
|
4842
4887
|
```
|
|
4843
4888
|
|
|
@@ -5336,7 +5381,7 @@ interface InviteUserInput {
|
|
|
5336
5381
|
|
|
5337
5382
|
**CollectionUpdateRequest** = `Partial<Omit<Collection, 'id' | 'shortId'>>`
|
|
5338
5383
|
|
|
5339
|
-
**DomainTarget** = `"
|
|
5384
|
+
**DomainTarget** = `"links" | "site"`
|
|
5340
5385
|
|
|
5341
5386
|
**CollectionAccessLevel** = `'Owner' | 'Admin' | 'Assigner' | 'Reporter' | 'User' | 'None'`
|
|
5342
5387
|
|
|
@@ -11297,8 +11342,11 @@ Create an AuthKit client config (admin). Accepts the account `security` policy
|
|
|
11297
11342
|
**update**(collectionId: string, authKitId: string, data: AuthKitConfigInput) → `Promise<AuthKitConfig>`
|
|
11298
11343
|
Update an AuthKit client config (admin). This is how the account **security policy** is written — pass a `security` block ({@link AuthKitSecurityConfig}). The server validates it and enforces it; the login UI reads the public subset back via {@link load}.
|
|
11299
11344
|
|
|
11345
|
+
**setIdentity**(collectionId: string, authKitId: string, body: { mode: 'own' }) → `Promise<AuthKitSetIdentityResponse>`
|
|
11346
|
+
Give this AuthKit its **own logins** (admin): its members become accounts of this site only — the same email can be a separate account, with its own password, on another site — rather than SmartLinks accounts shared across sites. One way: a site with its own members can't go back to the shared pool. Members who signed up before keep their SmartLinks account until moved across. Errors: `MEMBER_POOL_CONFLICT` (409) when another AuthKit already gives one of its collections its own logins (one per collection); `PERMISSION_DENIED` (403) unless you administer every collection it serves.
|
|
11347
|
+
|
|
11300
11348
|
**remove**(collectionId: string, authKitId: string) → `Promise<void>`
|
|
11301
|
-
|
|
11349
|
+
Give this AuthKit its **own logins** (admin): its members become accounts of this site only — the same email can be a separate account, with its own password, on another site — rather than SmartLinks accounts shared across sites. One way: a site with its own members can't go back to the shared pool. Members who signed up before keep their SmartLinks account until moved across. Errors: `MEMBER_POOL_CONFLICT` (409) when another AuthKit already gives one of its collections its own logins (one per collection); `PERMISSION_DENIED` (403) unless you administer every collection it serves.
|
|
11302
11350
|
|
|
11303
11351
|
### batch
|
|
11304
11352
|
|
|
@@ -11488,11 +11536,14 @@ Check whether a Hub subdomain name is available to claim (admin only).
|
|
|
11488
11536
|
**claimHub**(collectionId: string, hubName: string) → `Promise<CollectionResponse>`
|
|
11489
11537
|
Claim or rename the Hub subdomain for a collection (admin only). Maps `{hubName}.smartlinks.host` to the collection. If the collection already had a different hub name, the previous subdomain is released automatically.
|
|
11490
11538
|
|
|
11491
|
-
**registerDomain**(collectionId: string, domain: string, target: DomainTarget = "
|
|
11492
|
-
|
|
11539
|
+
**registerDomain**(collectionId: string, domain: string, target: DomainTarget = "links") → `Promise<any>`
|
|
11540
|
+
Connect one of the collection's own domains and start its certificate (admin only). or `"site"` for the collection's Hub domain.
|
|
11493
11541
|
|
|
11494
|
-
**getDomainStatus**(collectionId: string, target: DomainTarget = "
|
|
11495
|
-
Get the
|
|
11542
|
+
**getDomainStatus**(collectionId: string, target: DomainTarget = "links") → `Promise<any>`
|
|
11543
|
+
Get the certificate status of the collection's own domain (admin only). or `"site"` (its Hub domain, `hubCustomDomain`)
|
|
11544
|
+
|
|
11545
|
+
**releaseDomain**(collectionId: string, domain: string) → `Promise<`
|
|
11546
|
+
Remove the collection's links domain (admin only). It stops working straight away: QR codes, GS1 Digital Links and short links printed with it no longer open. Its certificate goes and `redirectUrl` is cleared. (Site domains are removed from the site's settings.)
|
|
11496
11547
|
|
|
11497
11548
|
**getSettings**(collectionId: string, settingGroup: string, admin?: boolean) → `Promise<any>`
|
|
11498
11549
|
Retrieve a specific settings group for a collection. Public reads return the public view of the settings group. If the stored payload contains a top-level `admin` object, that block is omitted from public responses and included when `admin === true`.
|
|
@@ -11512,29 +11563,29 @@ Update a collection (admin only).
|
|
|
11512
11563
|
**remove**(collectionId: string) → `Promise<void>`
|
|
11513
11564
|
Delete a collection (admin only).
|
|
11514
11565
|
|
|
11515
|
-
**getSN**(collectionId: string,
|
|
11516
|
-
startIndex: number = 0,
|
|
11566
|
+
**getSN**(collectionId: string,
|
|
11567
|
+
startIndex: number = 0,
|
|
11517
11568
|
count: number = 10) → `Promise<any>`
|
|
11518
11569
|
Get serial numbers for a collection (admin only).
|
|
11519
11570
|
|
|
11520
|
-
**lookupSN**(collectionId: string,
|
|
11571
|
+
**lookupSN**(collectionId: string,
|
|
11521
11572
|
codeId: string) → `Promise<any>`
|
|
11522
11573
|
Look up a serial number by code for a collection (admin only).
|
|
11523
11574
|
|
|
11524
|
-
**assignSN**(collectionId: string,
|
|
11525
|
-
codeId: string,
|
|
11575
|
+
**assignSN**(collectionId: string,
|
|
11576
|
+
codeId: string,
|
|
11526
11577
|
value: any) → `Promise<any>`
|
|
11527
11578
|
Assign a value to a serial number for a collection (admin only).
|
|
11528
11579
|
|
|
11529
11580
|
**getUsers**(collectionId: string) → `Promise<CollectionUser[]>`
|
|
11530
11581
|
List the users with access to a collection, each with their access level (admin only). Access is stored in the collection's `roles` map (userId → level); this resolves each to name/email. GET /admin/collection/:collectionId/getUsers
|
|
11531
11582
|
|
|
11532
|
-
**setUserAccess**(collectionId: string,
|
|
11533
|
-
userId: string,
|
|
11583
|
+
**setUserAccess**(collectionId: string,
|
|
11584
|
+
userId: string,
|
|
11534
11585
|
access: CollectionAccessLevel | null) → `Promise<void>`
|
|
11535
11586
|
Grant, change, or remove a user's access level on a collection (admin only). Pass `null` or `'None'` to remove access. The server enforces privilege-escalation rules — you cannot grant an access level above your own, nor change a user whose level is above yours. POST /admin/collection/:collectionId/updateUserAccess
|
|
11536
11587
|
|
|
11537
|
-
**inviteUser**(collectionId: string,
|
|
11588
|
+
**inviteUser**(collectionId: string,
|
|
11538
11589
|
input: InviteUserInput) → `Promise<`
|
|
11539
11590
|
Invite a user to a collection by email (admin only). Creates or links their account in the login / auth-kit collection (`loginCollectionId`, default `'global'`) and emails them an invite (new account) or an added-to-collection notice (existing account); returns their `uid`. This does NOT grant access on its own — follow with {@link setUserAccess} to set their level (this mirrors the console flow). POST /user/inviteUser
|
|
11540
11591
|
|
|
@@ -12815,7 +12866,7 @@ Create a single tag mapping (admin). If `productId` is set without `proofId`, a
|
|
|
12815
12866
|
|
|
12816
12867
|
**createBatch**(collectionId: string,
|
|
12817
12868
|
data: BatchCreateTagRequest) → `Promise<BatchCreateResult>`
|
|
12818
|
-
Batch-create tags (admin). Tags with `productId` but no `proofId` automatically get serial numbers. Serial number generation is grouped by `(productId, variantId, batchId)` for efficiency. Partial success is possible
|
|
12869
|
+
Batch-create tags (admin). Tags with `productId` but no `proofId` automatically get serial numbers. Serial number generation is grouped by `(productId, variantId, batchId)` for efficiency. Partial success is possible — check `results` for individual outcomes. ```typescript const result = await tags.createBatch('coll_123', { tags: [ { tagId: 'NFC-001', productId: 'prod_456', batchId: 'batch_2026_01' }, { tagId: 'NFC-002', productId: 'prod_456', batchId: 'batch_2026_01' }, ], }) console.log(`Created: ${result.summary.created}, Conflicts: ${result.summary.conflicts}`) ```
|
|
12819
12870
|
|
|
12820
12871
|
**get**(collectionId: string,
|
|
12821
12872
|
tagId: string) → `Promise<GetTagResponse>`
|
|
@@ -12824,7 +12875,7 @@ Get a single tag by `tagId` (admin).
|
|
|
12824
12875
|
**update**(collectionId: string,
|
|
12825
12876
|
tagId: string,
|
|
12826
12877
|
data: UpdateTagRequest) → `Promise<UpdateTagResponse>`
|
|
12827
|
-
Update a tag (admin). Partial update
|
|
12878
|
+
Update a tag (admin). Partial update — only provided fields are changed. `metadata` is deep-merged with the existing value. Pass `refType: null, refId: null` to clear the polymorphic ref. ```typescript const updated = await tags.update('coll_123', 'NFC-001', { variantId: 'var_premium', metadata: { notes: 'Updated to premium variant' }, }) // Clear polymorphic ref await tags.update('coll_123', 'NFC-001', { refType: null, refId: null }) ```
|
|
12828
12879
|
|
|
12829
12880
|
**remove**(collectionId: string,
|
|
12830
12881
|
tagId: string) → `Promise<DeleteTagResponse>`
|
|
@@ -12836,15 +12887,15 @@ List tags with optional filters and pagination (admin). ```typescript // All tag
|
|
|
12836
12887
|
|
|
12837
12888
|
**byRef**(collectionId: string,
|
|
12838
12889
|
params: ReverseTagLookupParams) → `Promise<ReverseTagLookupResponse>`
|
|
12839
|
-
Reverse lookup
|
|
12890
|
+
Reverse lookup — find all tags linked to a given object (admin). Uses a compound index on `(orgId, refType, refId)` on the per-org shard. No embed support on the admin side. ```typescript const { tags: linked } = await tags.byRef('coll_123', { refType: 'container', refId: 'container-uuid', }) ```
|
|
12840
12891
|
|
|
12841
12892
|
**resolveTag**(tagId: string) → `Promise<TagIndexEntry>`
|
|
12842
|
-
Global tag resolve
|
|
12893
|
+
Global tag resolve — returns `{ tagId, collectionId }` only. Use this **only** when you have a raw `tagId` and do not yet know which collection it belongs to. Queries the shared `tag_index` shard. Once `collectionId` is resolved, call `publicGetByCollection` for full data. > The global `/public/tags/by-ref` endpoint has been removed. > Use the collection-scoped `publicByRef` instead. ```typescript // Step 1: resolve collection const { collectionId } = await tags.resolveTag('NFC-001') // Step 2: full lookup with embedded data const { tag, embedded } = await tags.publicGetByCollection( collectionId, 'NFC-001', 'product,proof' ) ```
|
|
12843
12894
|
|
|
12844
12895
|
**publicGetByCollection**(collectionId: string,
|
|
12845
12896
|
tagId: string,
|
|
12846
12897
|
embed?: string) → `Promise<PublicGetTagResponse>`
|
|
12847
|
-
Single tag lookup with optional embedded data (public). `GET /public/collection/:collectionId/tags/:tagId?embed=product,proof,container,ref` Supported `embed` values: `'product'`, `'proof'`, `'container'`, `'ref'` (`'collection'` is not supported
|
|
12898
|
+
Single tag lookup with optional embedded data (public). `GET /public/collection/:collectionId/tags/:tagId?embed=product,proof,container,ref` Supported `embed` values: `'product'`, `'proof'`, `'container'`, `'ref'` (`'collection'` is not supported — the collection is already known from the URL). ```typescript const { tag, embedded } = await tags.publicGetByCollection( 'coll_123', 'NFC-001', 'product,proof' ) const product = embedded.products?.[tag.productId!] const proof = embedded.proofs?.[tag.proofId!] ```
|
|
12848
12899
|
|
|
12849
12900
|
**lookupTags**(collectionId: string,
|
|
12850
12901
|
data: LookupTagsRequest) → `Promise<TagLookupResponse>`
|