@trimjs/web-app 0.4.0 → 0.4.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.
Files changed (2) hide show
  1. package/README.md +84 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -355,11 +355,95 @@ buildAppAuthUrl(method: AppAuthMethod, params: AppAuthParams): Promise<string>
355
355
 
356
356
  Builds an App Auth route URL without opening it. Most apps should use `openAppAuth()` directly. Use this helper only when you need to control navigation yourself.
357
357
 
358
+ All methods accept these common params:
359
+
360
+ | Field | Type | Required | Description |
361
+ | ------------- | -------- | -------- | ------------------------------------------------------------ |
362
+ | `appName` | `string` | Yes | App identifier used by the authorization flow. |
363
+ | `redirectUri` | `string` | No | Callback URL or path that receives the authorization result. |
364
+ | `state` | `string` | No | Caller-defined opaque value returned unchanged in the callback. |
365
+
366
+ `state` does not affect authorization. Use it to correlate a callback with the flow that created it. For security-sensitive flows, generate an unpredictable value, store it before navigation, and verify that the callback returns the same value.
367
+
368
+ #### pickFile
369
+
370
+ ```ts
371
+ buildAppAuthUrl(method: 'pickFile', params: AppAuthPickFileParams): Promise<string>
372
+ ```
373
+
374
+ | Field | Type | Required | Description |
375
+ | -------------- | ---------- | -------- | ------------------------------------------------- |
376
+ | `directory` | `boolean` | No | Select folders instead of files. |
377
+ | `accept` | `string[]` | No | Accepted file extensions, each prefixed with `.`. |
378
+ | `sidebarGroup` | `string[]` | No | Sidebar groups to show, in display order. |
379
+
380
+ ```ts
381
+ const url = await app.buildAppAuthUrl('pickFile', {
382
+ appName: 'trim.demo',
383
+ directory: false,
384
+ accept: ['.jpg', '.jpeg', '.png'],
385
+ sidebarGroup: ['myFiles', 'external'],
386
+ redirectUri: '/callback',
387
+ state: 'pick-file-demo',
388
+ });
389
+ ```
390
+
391
+ #### pickSharedFile
392
+
393
+ ```ts
394
+ buildAppAuthUrl(method: 'pickSharedFile', params: AppAuthPickSharedFileParams): Promise<string>
395
+ ```
396
+
397
+ `pickSharedFile` selects a shared folder. Its directory behavior is controlled by the host and cannot be configured by the caller.
398
+
399
+ | Field | Type | Required | Description |
400
+ | -------------- | ---------- | -------- | ----------------------------------------- |
401
+ | `sidebarGroup` | `string[]` | No | Sidebar groups to show, in display order. |
402
+
403
+ ```ts
404
+ const url = await app.buildAppAuthUrl('pickSharedFile', {
405
+ appName: 'trim.demo',
406
+ sidebarGroup: ['myFiles', 'otherShare'],
407
+ redirectUri: '/callback',
408
+ state: 'pick-shared-file-demo',
409
+ });
410
+ ```
411
+
412
+ #### authorizeUserFile
413
+
414
+ ```ts
415
+ buildAppAuthUrl(method: 'authorizeUserFile', params: AppAuthAuthorizeParams): Promise<string>
416
+ ```
417
+
418
+ | Field | Type | Required | Description |
419
+ | ------ | -------- | -------- | -------------------------------------- |
420
+ | `path` | `string` | Yes | User file or folder path to authorize. |
421
+
358
422
  ```ts
359
423
  const url = await app.buildAppAuthUrl('authorizeUserFile', {
360
424
  appName: 'trim.demo',
361
425
  path: '/vol1/1000/photos',
362
426
  redirectUri: '/callback',
427
+ state: 'authorize-user-file-demo',
428
+ });
429
+ ```
430
+
431
+ #### authorizeSharedFile
432
+
433
+ ```ts
434
+ buildAppAuthUrl(method: 'authorizeSharedFile', params: AppAuthAuthorizeParams): Promise<string>
435
+ ```
436
+
437
+ | Field | Type | Required | Description |
438
+ | ------ | -------- | -------- | ---------------------------------------- |
439
+ | `path` | `string` | Yes | Shared file or folder path to authorize. |
440
+
441
+ ```ts
442
+ const url = await app.buildAppAuthUrl('authorizeSharedFile', {
443
+ appName: 'trim.demo',
444
+ path: '/share/demo',
445
+ redirectUri: '/callback',
446
+ state: 'authorize-shared-file-demo',
363
447
  });
364
448
  ```
365
449
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trimjs/web-app",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "web app sdk for nas",
5
5
  "files": [
6
6
  "dist"