@unboundcx/sdk 4.6.2 → 4.6.3
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/package.json +1 -1
- package/services/permissions.js +44 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.3",
|
|
4
4
|
"description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
package/services/permissions.js
CHANGED
|
@@ -486,6 +486,50 @@ export class PermissionsService {
|
|
|
486
486
|
);
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
+
/**
|
|
490
|
+
* Per-user, per-account JSON app state (UI state such as saved tab-sets).
|
|
491
|
+
* Distinct from settings: free-form JSON, not catalog-validated.
|
|
492
|
+
* @param {string|number} userId - User ID (required)
|
|
493
|
+
* @param {string} stateKey - State key, /^[a-zA-Z0-9_-]{1,64}$/ (required)
|
|
494
|
+
* @returns {Promise<Object>} { value } (value is null if unset)
|
|
495
|
+
*/
|
|
496
|
+
async getUserAppState(userId, stateKey) {
|
|
497
|
+
userId = String(userId);
|
|
498
|
+
stateKey = String(stateKey);
|
|
499
|
+
this.sdk.validateParams(
|
|
500
|
+
{ userId, stateKey },
|
|
501
|
+
{
|
|
502
|
+
userId: { type: 'string', required: true },
|
|
503
|
+
stateKey: { type: 'string', required: true },
|
|
504
|
+
},
|
|
505
|
+
);
|
|
506
|
+
return this.sdk._fetch(
|
|
507
|
+
`/permissions/users/${userId}/app-state/${stateKey}`,
|
|
508
|
+
'GET',
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Upsert one app-state value for a user (JSON-serializable, ≤256KB serialized).
|
|
514
|
+
* @returns {Promise<Object>} { userId, stateKey, value, updatedAt }
|
|
515
|
+
*/
|
|
516
|
+
async setUserAppState(userId, stateKey, value) {
|
|
517
|
+
userId = String(userId);
|
|
518
|
+
stateKey = String(stateKey);
|
|
519
|
+
this.sdk.validateParams(
|
|
520
|
+
{ userId, stateKey },
|
|
521
|
+
{
|
|
522
|
+
userId: { type: 'string', required: true },
|
|
523
|
+
stateKey: { type: 'string', required: true },
|
|
524
|
+
},
|
|
525
|
+
);
|
|
526
|
+
return this.sdk._fetch(
|
|
527
|
+
`/permissions/users/${userId}/app-state/${stateKey}`,
|
|
528
|
+
'PUT',
|
|
529
|
+
{ body: { value } },
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
|
|
489
533
|
// ---- Group-assigned skills and queues (§9.5) --------------------------
|
|
490
534
|
// Set-shaped, not scalar: they union across every group a user belongs to
|
|
491
535
|
// and never consult group priority. Writes fan out to each member's
|