@proveanything/smartlinks 1.2.2 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.2.2 | Generated: 2026-01-23T13:52:47.824Z
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 `/public/collection/${encodeURIComponent(scope.collectionId)}`;
19
+ return `${prefix}/collection/${encodeURIComponent(scope.collectionId)}`;
19
20
  }
20
21
  if (scope.type === 'product') {
21
- return `/public/collection/${encodeURIComponent(scope.collectionId)}/product/${encodeURIComponent(scope.productId)}`;
22
+ return `${prefix}/collection/${encodeURIComponent(scope.collectionId)}/product/${encodeURIComponent(scope.productId)}`;
22
23
  }
23
24
  // proof
24
- return `/public/collection/${encodeURIComponent(scope.collectionId)}/product/${encodeURIComponent(scope.productId)}/proof/${encodeURIComponent(scope.proofId)}`;
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 });
@@ -73,7 +73,7 @@ export var contact;
73
73
  contact.publicUpdateMine = publicUpdateMine;
74
74
  // Public: Get contact update schema for a collection
75
75
  async function publicGetSchema(collectionId) {
76
- const path = `/public/collection/${encodeURIComponent(collectionId)}/contacts/schema`;
76
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/contact/schema`;
77
77
  return request(path);
78
78
  }
79
79
  contact.publicGetSchema = publicGetSchema;
@@ -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: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",