@lessly/sdk-app 97.3.0 → 97.4.0
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/CHANGELOG.md +4 -3
- package/dist/_types/index.d.ts +2 -1
- package/dist/_types/runtime/errors.d.ts +13 -2
- package/dist/index.cjs +15 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/docs/recipes/access.md +13 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var LesslyApiError = class extends Error {
|
|
|
8
8
|
status;
|
|
9
9
|
code;
|
|
10
10
|
body;
|
|
11
|
-
/** True
|
|
11
|
+
/** True for the three neutral gateway 403 refusals. See `isAccessDenied`. */
|
|
12
12
|
accessDenied;
|
|
13
13
|
constructor(status, code, message, body) {
|
|
14
14
|
super(message);
|
|
@@ -31,6 +31,19 @@ function isAccessDenied(err) {
|
|
|
31
31
|
const { status, code } = err;
|
|
32
32
|
return status === 403 && typeof code === "string" && ACCESS_DENIED_CODES.has(code);
|
|
33
33
|
}
|
|
34
|
+
function accessDenialKind(err) {
|
|
35
|
+
if (typeof err !== "object" || err === null) return null;
|
|
36
|
+
const { status, code } = err;
|
|
37
|
+
if (status !== 403) return null;
|
|
38
|
+
switch (code) {
|
|
39
|
+
case "role_denied":
|
|
40
|
+
case "no_tool_permission":
|
|
41
|
+
case "operation_uncatalogued":
|
|
42
|
+
return code;
|
|
43
|
+
default:
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
34
47
|
var ENTITLEMENT_ERRORS = /* @__PURE__ */ new Set(["entitlement_exhausted", "entitlement_unavailable"]);
|
|
35
48
|
function entitlementRefusal(err) {
|
|
36
49
|
if (typeof err !== "object" || err === null) return null;
|
|
@@ -12851,6 +12864,6 @@ var operations2 = operations;
|
|
|
12851
12864
|
// src/runtime/compositions.ts
|
|
12852
12865
|
var compositions2 = compositions;
|
|
12853
12866
|
|
|
12854
|
-
export { LesslyApiError, accessReason, compositions2 as compositions, connectStream, createLesslyApp, isAccessDenied, isEntitlementError, operations2 as operations, platformApiBaseUrl, upgradeUrl };
|
|
12867
|
+
export { LesslyApiError, accessDenialKind, accessReason, compositions2 as compositions, connectStream, createLesslyApp, isAccessDenied, isEntitlementError, operations2 as operations, platformApiBaseUrl, upgradeUrl };
|
|
12855
12868
|
//# sourceMappingURL=index.js.map
|
|
12856
12869
|
//# sourceMappingURL=index.js.map
|