@proveanything/smartlinks 1.2.3 → 1.2.4
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/API_SUMMARY.md +2 -1
- package/dist/api/asset.js +6 -5
- package/dist/types/asset.d.ts +2 -0
- package/package.json +1 -1
package/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.4 | Generated: 2026-01-26T15:42:39.449Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -170,6 +170,7 @@ interface UploadAssetOptions {
|
|
|
170
170
|
metadata?: Record<string, any>
|
|
171
171
|
onProgress?: (percent: number) => void
|
|
172
172
|
appId?: string
|
|
173
|
+
admin?: boolean
|
|
173
174
|
}
|
|
174
175
|
```
|
|
175
176
|
|
package/dist/api/asset.js
CHANGED
|
@@ -13,15 +13,16 @@ export var asset;
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
asset.AssetUploadError = AssetUploadError;
|
|
16
|
-
function buildScopeBase(scope) {
|
|
16
|
+
function buildScopeBase(scope, isAdmin = false) {
|
|
17
|
+
const prefix = isAdmin ? '/admin' : '/public';
|
|
17
18
|
if (scope.type === 'collection') {
|
|
18
|
-
return
|
|
19
|
+
return `${prefix}/collection/${encodeURIComponent(scope.collectionId)}`;
|
|
19
20
|
}
|
|
20
21
|
if (scope.type === 'product') {
|
|
21
|
-
return
|
|
22
|
+
return `${prefix}/collection/${encodeURIComponent(scope.collectionId)}/product/${encodeURIComponent(scope.productId)}`;
|
|
22
23
|
}
|
|
23
24
|
// proof
|
|
24
|
-
return
|
|
25
|
+
return `${prefix}/collection/${encodeURIComponent(scope.collectionId)}/product/${encodeURIComponent(scope.productId)}/proof/${encodeURIComponent(scope.proofId)}`;
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* Upload an asset file
|
|
@@ -29,7 +30,7 @@ export var asset;
|
|
|
29
30
|
* @throws AssetUploadError if upload fails
|
|
30
31
|
*/
|
|
31
32
|
async function upload(options) {
|
|
32
|
-
const base = buildScopeBase(options.scope);
|
|
33
|
+
const base = buildScopeBase(options.scope, !!options.admin);
|
|
33
34
|
let path = `${base}/asset`;
|
|
34
35
|
if (options.appId) {
|
|
35
36
|
const qp = new URLSearchParams({ appId: options.appId });
|
package/dist/types/asset.d.ts
CHANGED
|
@@ -85,6 +85,8 @@ export interface UploadAssetOptions {
|
|
|
85
85
|
onProgress?: (percent: number) => void;
|
|
86
86
|
/** Optional: App ID for scoping to a specific microapp */
|
|
87
87
|
appId?: string;
|
|
88
|
+
/** Optional: Upload via admin route instead of public */
|
|
89
|
+
admin?: boolean;
|
|
88
90
|
}
|
|
89
91
|
export interface ListAssetsOptions {
|
|
90
92
|
scope: {
|