@proveanything/smartlinks 1.13.3 → 1.13.5

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/openapi.yaml CHANGED
@@ -16825,6 +16825,31 @@ components:
16825
16825
  required:
16826
16826
  - collectionId
16827
16827
  - assetIds
16828
+ UploadPolicyConfig:
16829
+ type: object
16830
+ properties:
16831
+ enabled:
16832
+ type: boolean
16833
+ requireLevel:
16834
+ type: string
16835
+ enum:
16836
+ - anonymous
16837
+ - contact
16838
+ - owner
16839
+ allowedMimeTypes:
16840
+ type: array
16841
+ items:
16842
+ type: string
16843
+ maxFileSizeBytes:
16844
+ type: number
16845
+ reviewRequired:
16846
+ type: boolean
16847
+ tokenTtlSeconds:
16848
+ type: number
16849
+ maxUsesPerToken:
16850
+ type: number
16851
+ required:
16852
+ - enabled
16828
16853
  RequestUploadTokenOptions:
16829
16854
  type: object
16830
16855
  properties:
@@ -253,8 +253,27 @@ export interface BulkDeleteAssetsOptions {
253
253
  assetIds: string[];
254
254
  graceDays?: number;
255
255
  }
256
+ /**
257
+ * Collection-scoped app config policy used by `requestUploadToken`.
258
+ *
259
+ * Important: this policy is read from `sites/{collectionId}/apps/{appId}`
260
+ * (collection app config), not from global `apps/{appId}` config.
261
+ */
262
+ export interface UploadPolicyConfig {
263
+ enabled: boolean;
264
+ requireLevel?: 'anonymous' | 'contact' | 'owner';
265
+ allowedMimeTypes?: string[];
266
+ maxFileSizeBytes?: number;
267
+ reviewRequired?: boolean;
268
+ tokenTtlSeconds?: number;
269
+ maxUsesPerToken?: number;
270
+ }
256
271
  export interface RequestUploadTokenOptions {
257
272
  collectionId: string;
273
+ /**
274
+ * App ID whose collection-scoped config provides `uploadPolicy`.
275
+ * Resolved from `sites/{collectionId}/apps/{appId}`.
276
+ */
258
277
  appId: string;
259
278
  /** Required when the app policy requireLevel is 'contact' */
260
279
  contactId?: string;
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.13.3 | Generated: 2026-05-08T10:30:25.776Z
3
+ Version: 1.13.5 | Generated: 2026-05-09T11:54:02.443Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -2472,10 +2472,25 @@ interface BulkDeleteAssetsOptions {
2472
2472
  }
2473
2473
  ```
2474
2474
 
2475
+ **UploadPolicyConfig** (interface)
2476
+ ```typescript
2477
+ interface UploadPolicyConfig {
2478
+ enabled: boolean
2479
+ requireLevel?: 'anonymous' | 'contact' | 'owner'
2480
+ allowedMimeTypes?: string[]
2481
+ maxFileSizeBytes?: number
2482
+ reviewRequired?: boolean
2483
+ tokenTtlSeconds?: number
2484
+ maxUsesPerToken?: number
2485
+ }
2486
+ ```
2487
+
2475
2488
  **RequestUploadTokenOptions** (interface)
2476
2489
  ```typescript
2477
2490
  interface RequestUploadTokenOptions {
2478
2491
  collectionId: string
2492
+ * App ID whose collection-scoped config provides `uploadPolicy`.
2493
+ * Resolved from `sites/{collectionId}/apps/{appId}`.
2479
2494
  appId: string
2480
2495
  contactId?: string
2481
2496
  productId?: string
@@ -7797,7 +7812,7 @@ Restore a soft-deleted asset (clears `deletedAt`).
7797
7812
  Soft-delete multiple assets in one request.
7798
7813
 
7799
7814
  **requestUploadToken**(options: RequestUploadTokenOptions) → `Promise<UploadTokenResponse>`
7800
- Request a single-use upload token for a public (unauthenticated) upload. The token encodes the upload policy (allowed types, max size, review requirement). ```typescript const { tokenId, policy } = await asset.requestUploadToken({ collectionId: 'my-collection', appId: 'user-gallery', contactId: contact.id, }) const uploaded = await asset.publicUploadWithToken({ collectionId: 'my-collection', tokenId, file: selectedFile, }) ```
7815
+ Request a single-use upload token for a public (unauthenticated) upload. The token encodes the upload policy (allowed types, max size, review requirement). Policy source: collection-scoped app config at `sites/{collectionId}/apps/{appId}` (`uploadPolicy` key). Global `apps/{appId}` config is not used for this endpoint. ```typescript const { tokenId, policy } = await asset.requestUploadToken({ collectionId: 'my-collection', appId: 'user-gallery', contactId: contact.id, }) const uploaded = await asset.publicUploadWithToken({ collectionId: 'my-collection', tokenId, file: selectedFile, }) ```
7801
7816
 
7802
7817
  **publicUploadWithToken**(options: PublicTokenUploadOptions) → `Promise<Asset>`
7803
7818
  Upload a file using a single-use upload token (no admin auth required). Assets are created with `status: 'pending_review'` when the token policy has `reviewRequired: true`.
package/docs/assets.md CHANGED
@@ -249,6 +249,32 @@ For anonymous or contact-initiated uploads from the portal — no admin auth req
249
249
 
250
250
  ### 1. Request an upload token
251
251
 
252
+ ```
253
+ POST /api/public/collection/:collectionId/asset/token
254
+ ```
255
+
256
+ Policy source (important):
257
+
258
+ - Public upload policy is resolved from the collection-scoped app config at `sites/{collectionId}/apps/{appId}`.
259
+ - Global app config (`apps/{appId}`) is not used for this endpoint.
260
+ - SDKs/clients that provision app config should save `uploadPolicy` on the collection app document.
261
+
262
+ Expected app config shape:
263
+
264
+ ```typescript
265
+ {
266
+ uploadPolicy: {
267
+ enabled: boolean
268
+ requireLevel?: 'anonymous' | 'contact' | 'owner'
269
+ allowedMimeTypes?: string[]
270
+ maxFileSizeBytes?: number
271
+ reviewRequired?: boolean
272
+ tokenTtlSeconds?: number
273
+ maxUsesPerToken?: number
274
+ }
275
+ }
276
+ ```
277
+
252
278
  ```typescript
253
279
  const { tokenId, expiresAt, policy } = await Api.asset.requestUploadToken({
254
280
  collectionId: 'my-collection',