@proveanything/smartlinks 1.12.0 → 1.13.1
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/README.md +28 -13
- package/dist/api/asset.d.ts +60 -1
- package/dist/api/asset.js +245 -2
- package/dist/docs/API_SUMMARY.md +219 -61
- package/dist/docs/assets.md +310 -0
- package/dist/docs/liquid-templates.md +1 -3
- package/dist/docs/overview.md +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/openapi.yaml +614 -114
- package/dist/types/asset.d.ts +159 -46
- package/dist/types/collection.d.ts +5 -22
- package/dist/types/product.d.ts +31 -30
- package/docs/API_SUMMARY.md +219 -61
- package/docs/assets.md +310 -0
- package/docs/liquid-templates.md +1 -3
- package/docs/overview.md +1 -0
- package/openapi.yaml +614 -114
- package/package.json +1 -1
package/dist/types/asset.d.ts
CHANGED
|
@@ -1,63 +1,98 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Slim reference to an asset embedded inside product and collection documents.
|
|
3
|
+
* Use `asset.get()` with the `id` to retrieve the full `Asset` record.
|
|
3
4
|
*/
|
|
5
|
+
export interface AssetRef {
|
|
6
|
+
/** Postgres UUID — use to fetch the full Asset */
|
|
7
|
+
id: string;
|
|
8
|
+
/** CDN URL of the original file */
|
|
9
|
+
url: string;
|
|
10
|
+
/** WebP thumbnail URL (max 512px longest edge), or null if not yet generated */
|
|
11
|
+
thumbnail: string | null;
|
|
12
|
+
}
|
|
4
13
|
/**
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
* "x200": "https://cdn.smartlinks.app/sit2F..._200x200.png",
|
|
20
|
-
* "x512": "https://cdn.smartlinks.app/sit2F..._512x512.png"
|
|
21
|
-
* },
|
|
22
|
-
* "id": "7k1cGErrlmQ94J8yDlVj",
|
|
23
|
-
* "site": "ChaseAtlantic",
|
|
24
|
-
* "cleanName": "Screenshot 2025-09-15 at 15.21"
|
|
25
|
-
* }
|
|
14
|
+
* A previous file version recorded when `replace` is called on an asset.
|
|
15
|
+
*/
|
|
16
|
+
export interface AssetVersion {
|
|
17
|
+
url: string;
|
|
18
|
+
mimeType: string | null;
|
|
19
|
+
fileType: string | null;
|
|
20
|
+
size: number | null;
|
|
21
|
+
hash: string | null;
|
|
22
|
+
thumbnail: string | null;
|
|
23
|
+
replacedAt: string;
|
|
24
|
+
replacedBy: string | null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Full Asset object as returned by the platform.
|
|
26
28
|
*/
|
|
27
29
|
export interface Asset {
|
|
28
|
-
/**
|
|
30
|
+
/** Postgres UUID — stable permanent identifier */
|
|
29
31
|
id: string;
|
|
30
|
-
/**
|
|
32
|
+
/** Owning collection */
|
|
33
|
+
collectionId: string;
|
|
34
|
+
/** Alias for collectionId (compat) */
|
|
35
|
+
site: string;
|
|
36
|
+
/** Set when scoped to a product */
|
|
37
|
+
productId: string | null;
|
|
38
|
+
/** Set when scoped to a proof (ledger entry) */
|
|
39
|
+
proofId: string | null;
|
|
40
|
+
/** App that owns this asset, e.g. 'homepage' */
|
|
41
|
+
appId: string | null;
|
|
42
|
+
/** CDN URL of the original file */
|
|
31
43
|
url: string;
|
|
44
|
+
/**
|
|
45
|
+
* CDN URL of the WebP thumbnail (max 512px longest edge, no crop).
|
|
46
|
+
* Always .webp — null until thumbnail generation has run.
|
|
47
|
+
*/
|
|
48
|
+
thumbnail: string | null;
|
|
32
49
|
/** Original filename */
|
|
33
50
|
name: string;
|
|
34
|
-
/**
|
|
35
|
-
|
|
51
|
+
/** Filename without extension */
|
|
52
|
+
cleanName: string | null;
|
|
53
|
+
/** Broad asset classification */
|
|
54
|
+
assetType: 'Image' | 'Video' | 'Audio' | 'Document';
|
|
55
|
+
/** File extension, e.g. 'jpg' */
|
|
56
|
+
fileType: string | null;
|
|
57
|
+
/** Alias for fileType (compat) */
|
|
58
|
+
type: string | null;
|
|
59
|
+
/** MIME type, e.g. 'image/jpeg' */
|
|
60
|
+
mimeType: string | null;
|
|
61
|
+
/** Alias for mimeType (compat) */
|
|
62
|
+
contentType: string | null;
|
|
36
63
|
/** File size in bytes */
|
|
37
|
-
size
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
64
|
+
size: number | null;
|
|
65
|
+
/** Width in pixels (images only) */
|
|
66
|
+
width: number | null;
|
|
67
|
+
/** Height in pixels (images only) */
|
|
68
|
+
height: number | null;
|
|
69
|
+
/** SHA-256 of file content */
|
|
70
|
+
hash: string | null;
|
|
71
|
+
/** Arbitrary string labels for filtering */
|
|
72
|
+
labels: string[];
|
|
73
|
+
metadata: Record<string, any>;
|
|
74
|
+
/** Previous file versions, populated by replace */
|
|
75
|
+
versions: AssetVersion[];
|
|
76
|
+
/** Firebase UID of admin uploader */
|
|
77
|
+
uploadedBy: string | null;
|
|
78
|
+
/** Contact ID for public/token uploads */
|
|
79
|
+
uploaderContactId: string | null;
|
|
80
|
+
/** Upload token used for public uploads */
|
|
81
|
+
uploadTokenId: string | null;
|
|
82
|
+
uploaderIp: string | null;
|
|
83
|
+
status: 'active' | 'pending_review' | 'deleted';
|
|
84
|
+
createdAt: string;
|
|
85
|
+
updatedAt: string;
|
|
86
|
+
deletedAt: string | null;
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated Use `thumbnail` instead. Legacy multi-size thumbnail map.
|
|
89
|
+
*/
|
|
51
90
|
thumbnails?: {
|
|
52
91
|
x100?: string;
|
|
53
92
|
x200?: string;
|
|
54
93
|
x512?: string;
|
|
55
94
|
[key: string]: string | undefined;
|
|
56
95
|
};
|
|
57
|
-
/** Optional: site identifier alias */
|
|
58
|
-
site?: string;
|
|
59
|
-
/** Optional: prettified name */
|
|
60
|
-
cleanName?: string;
|
|
61
96
|
}
|
|
62
97
|
export type AssetResponse = Asset;
|
|
63
98
|
export interface UploadAssetOptions {
|
|
@@ -89,8 +124,8 @@ export interface UploadAssetOptions {
|
|
|
89
124
|
admin?: boolean;
|
|
90
125
|
}
|
|
91
126
|
/**
|
|
92
|
-
* Options for uploading an asset from a URL
|
|
93
|
-
* The server will fetch the file from the URL and store it in your CDN
|
|
127
|
+
* Options for uploading an asset from a URL.
|
|
128
|
+
* The server will fetch the file from the URL and store it in your CDN.
|
|
94
129
|
*/
|
|
95
130
|
export interface UploadFromUrlOptions {
|
|
96
131
|
/** The URL of the file to fetch and upload */
|
|
@@ -172,3 +207,81 @@ export interface RemoveAssetOptions {
|
|
|
172
207
|
proofId: string;
|
|
173
208
|
};
|
|
174
209
|
}
|
|
210
|
+
export interface AdminListAssetsOptions {
|
|
211
|
+
collectionId: string;
|
|
212
|
+
productId?: string;
|
|
213
|
+
proofId?: string;
|
|
214
|
+
appId?: string;
|
|
215
|
+
assetType?: 'Image' | 'Video' | 'Audio' | 'Document';
|
|
216
|
+
/** Comma-separated label filter (any match) */
|
|
217
|
+
labels?: string;
|
|
218
|
+
sort?: 'createdAt' | 'name' | 'size' | 'assetType';
|
|
219
|
+
order?: 'asc' | 'desc';
|
|
220
|
+
limit?: number;
|
|
221
|
+
offset?: number;
|
|
222
|
+
}
|
|
223
|
+
export interface AdminListAssetsResponse {
|
|
224
|
+
data: Asset[];
|
|
225
|
+
total: number;
|
|
226
|
+
limit: number;
|
|
227
|
+
offset: number;
|
|
228
|
+
}
|
|
229
|
+
export interface UpdateAssetOptions {
|
|
230
|
+
collectionId: string;
|
|
231
|
+
assetId: string;
|
|
232
|
+
name?: string;
|
|
233
|
+
appId?: string;
|
|
234
|
+
labels?: string[];
|
|
235
|
+
metadata?: Record<string, any>;
|
|
236
|
+
/** Manually override the thumbnail URL */
|
|
237
|
+
thumbnail?: string;
|
|
238
|
+
}
|
|
239
|
+
export interface ReplaceAssetFileOptions {
|
|
240
|
+
collectionId: string;
|
|
241
|
+
assetId: string;
|
|
242
|
+
file: File;
|
|
243
|
+
onProgress?: (percent: number) => void;
|
|
244
|
+
}
|
|
245
|
+
export interface DeleteAssetOptions {
|
|
246
|
+
collectionId: string;
|
|
247
|
+
assetId: string;
|
|
248
|
+
/** Days before the file is purged from CDN (default 30) */
|
|
249
|
+
graceDays?: number;
|
|
250
|
+
}
|
|
251
|
+
export interface BulkDeleteAssetsOptions {
|
|
252
|
+
collectionId: string;
|
|
253
|
+
assetIds: string[];
|
|
254
|
+
graceDays?: number;
|
|
255
|
+
}
|
|
256
|
+
export interface RequestUploadTokenOptions {
|
|
257
|
+
collectionId: string;
|
|
258
|
+
appId: string;
|
|
259
|
+
/** Required when the app policy requireLevel is 'contact' */
|
|
260
|
+
contactId?: string;
|
|
261
|
+
productId?: string;
|
|
262
|
+
proofId?: string;
|
|
263
|
+
}
|
|
264
|
+
export interface UploadTokenPolicy {
|
|
265
|
+
requireLevel: 'anonymous' | 'contact' | 'owner';
|
|
266
|
+
allowedMimeTypes: string[];
|
|
267
|
+
maxFileSizeBytes: number;
|
|
268
|
+
/** When true, asset is created with status 'pending_review' */
|
|
269
|
+
reviewRequired: boolean;
|
|
270
|
+
productId: string | null;
|
|
271
|
+
proofId: string | null;
|
|
272
|
+
}
|
|
273
|
+
export interface UploadTokenResponse {
|
|
274
|
+
/** Pass as the X-Upload-Token header when uploading */
|
|
275
|
+
tokenId: string;
|
|
276
|
+
expiresAt: string;
|
|
277
|
+
policy: UploadTokenPolicy;
|
|
278
|
+
}
|
|
279
|
+
export interface PublicTokenUploadOptions {
|
|
280
|
+
collectionId: string;
|
|
281
|
+
/** Token ID returned by requestUploadToken */
|
|
282
|
+
tokenId: string;
|
|
283
|
+
file: File;
|
|
284
|
+
name?: string;
|
|
285
|
+
metadata?: Record<string, any>;
|
|
286
|
+
onProgress?: (percent: number) => void;
|
|
287
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AssetRef } from "./asset";
|
|
1
2
|
/**
|
|
2
3
|
* Represents a Collection object.
|
|
3
4
|
*/
|
|
@@ -8,28 +9,10 @@ export interface Collection {
|
|
|
8
9
|
title: string;
|
|
9
10
|
/** Description of collection */
|
|
10
11
|
description: string;
|
|
11
|
-
/**
|
|
12
|
-
headerImage?:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/** Thumbnail URLs in different sizes */
|
|
16
|
-
thumbnails: {
|
|
17
|
-
x100: string;
|
|
18
|
-
x200: string;
|
|
19
|
-
x512: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
/** URL to the collection's logo image */
|
|
23
|
-
logoImage?: {
|
|
24
|
-
/** URL to the asset */
|
|
25
|
-
url: string;
|
|
26
|
-
/** Thumbnail URLs in different sizes */
|
|
27
|
-
thumbnails: {
|
|
28
|
-
x100: string;
|
|
29
|
-
x200: string;
|
|
30
|
-
x512: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
12
|
+
/** Slim reference to the collection's header/hero image */
|
|
13
|
+
headerImage?: AssetRef | null;
|
|
14
|
+
/** Slim reference to the collection's logo image */
|
|
15
|
+
logoImage?: AssetRef | null;
|
|
33
16
|
/** Collection's loader image */
|
|
34
17
|
loaderImage?: {
|
|
35
18
|
/** Override name for the file */
|
package/dist/types/product.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AssetRef } from "./asset";
|
|
1
2
|
export type JsonPrimitive = string | number | boolean | null;
|
|
2
3
|
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
3
4
|
[key: string]: JsonValue;
|
|
@@ -7,29 +8,6 @@ export interface ProductKey {
|
|
|
7
8
|
collectionId: string;
|
|
8
9
|
id: string;
|
|
9
10
|
}
|
|
10
|
-
export interface ProductImageThumbnails {
|
|
11
|
-
x100?: string;
|
|
12
|
-
x200?: string;
|
|
13
|
-
x512?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface ProductImage {
|
|
16
|
-
id?: string;
|
|
17
|
-
collectionId?: string;
|
|
18
|
-
productId?: string;
|
|
19
|
-
site?: string;
|
|
20
|
-
name?: string;
|
|
21
|
-
cleanName?: string;
|
|
22
|
-
assetType?: string;
|
|
23
|
-
type?: string;
|
|
24
|
-
url?: string;
|
|
25
|
-
thumbnails?: ProductImageThumbnails;
|
|
26
|
-
contentType?: string;
|
|
27
|
-
size?: string | number;
|
|
28
|
-
hash?: string;
|
|
29
|
-
createdAt?: ISODateString | null;
|
|
30
|
-
updatedAt?: ISODateString | null;
|
|
31
|
-
deletedAt?: ISODateString | null;
|
|
32
|
-
}
|
|
33
11
|
export interface ProductImageUrlInput {
|
|
34
12
|
url: string;
|
|
35
13
|
}
|
|
@@ -79,19 +57,31 @@ export interface Product extends ProductKey {
|
|
|
79
57
|
name: string;
|
|
80
58
|
description?: string | null;
|
|
81
59
|
gtin?: string | null;
|
|
82
|
-
ownGtin?:
|
|
83
|
-
additionalGtins?: AdditionalGtin[];
|
|
60
|
+
ownGtin?: string | null;
|
|
61
|
+
additionalGtins?: AdditionalGtin[] | null;
|
|
84
62
|
sku?: string | null;
|
|
63
|
+
/** Canonical type key, e.g. 'ownable-product' */
|
|
64
|
+
schemaType?: string | null;
|
|
65
|
+
/** Alias for schemaType (compat) */
|
|
66
|
+
type?: string | null;
|
|
67
|
+
/** First segment of schemaType, e.g. 'ownable' */
|
|
68
|
+
category?: string | null;
|
|
85
69
|
label?: string | null;
|
|
86
|
-
status?:
|
|
70
|
+
status?: 'active' | 'deleted' | null;
|
|
87
71
|
sortOrder?: number | null;
|
|
88
|
-
|
|
72
|
+
/** Slim image reference — use `id` to fetch the full Asset record */
|
|
73
|
+
heroImage?: AssetRef | null;
|
|
74
|
+
/** Ordered array of additional image references */
|
|
75
|
+
additionalImages?: AssetRef[];
|
|
89
76
|
facets?: ProductFacetMap;
|
|
77
|
+
/** Tag keys where value is true */
|
|
78
|
+
tags?: Record<string, boolean>;
|
|
90
79
|
data?: Record<string, JsonValue>;
|
|
91
80
|
admin?: Record<string, JsonValue>;
|
|
92
81
|
extra?: Record<string, JsonValue>;
|
|
93
|
-
validCollections?: string[];
|
|
82
|
+
validCollections?: string[] | null;
|
|
94
83
|
group?: boolean | null;
|
|
84
|
+
groupKey?: string | null;
|
|
95
85
|
createdAt?: ISODateString | null;
|
|
96
86
|
updatedAt?: ISODateString | null;
|
|
97
87
|
deletedAt?: ISODateString | null;
|
|
@@ -104,14 +94,25 @@ export interface ProductWriteInput {
|
|
|
104
94
|
name: string;
|
|
105
95
|
description?: string | null;
|
|
106
96
|
gtin?: string | null;
|
|
107
|
-
ownGtin?:
|
|
97
|
+
ownGtin?: string | null;
|
|
108
98
|
additionalGtins?: AdditionalGtin[];
|
|
109
99
|
sku?: string | null;
|
|
100
|
+
schemaType?: string | null;
|
|
110
101
|
label?: string | null;
|
|
111
102
|
status?: string | null;
|
|
112
103
|
sortOrder?: number | null;
|
|
113
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Pass the existing `AssetRef` unchanged to keep the current image,
|
|
106
|
+
* or a URL string / `{ url }` object to import a new file.
|
|
107
|
+
*/
|
|
108
|
+
heroImage?: AssetRef | ProductImageUrlInput | string | null;
|
|
109
|
+
/**
|
|
110
|
+
* Pass existing `AssetRef` entries unchanged; replace entries with a URL string
|
|
111
|
+
* or `{ url }` object to import new files.
|
|
112
|
+
*/
|
|
113
|
+
additionalImages?: Array<AssetRef | ProductImageUrlInput | string>;
|
|
114
114
|
facets?: ProductFacetMap;
|
|
115
|
+
tags?: Record<string, boolean>;
|
|
115
116
|
data?: Record<string, JsonValue>;
|
|
116
117
|
admin?: Record<string, JsonValue>;
|
|
117
118
|
extra?: Record<string, JsonValue>;
|