@lepsto/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 CHANGED
@@ -125,8 +125,9 @@ before this point lives in that package.
125
125
  The publish pipeline appends its machine-rendered block for the release being
126
126
  built below this line. It is not committed back to the repo, so in a git
127
127
  checkout this section is empty — see the note at the top.
128
- ## 97.3.0 (minor)
128
+ ## 97.4.0 (minor)
129
129
 
130
- ### mail
131
- - added `mail_email_list`
130
+ ### *
131
+ - runtime update
132
+ - documentation update
132
133
 
@@ -1,7 +1,8 @@
1
1
  export { createLesslyApp } from './runtime/createLesslyApp.js';
2
2
  export type { LesslyClientBase } from './runtime/createLesslyApp.js';
3
3
  export { connectStream } from './runtime/connectStream.js';
4
- export { LesslyApiError, isAccessDenied, isEntitlementError, upgradeUrl } from './runtime/errors.js';
4
+ export { LesslyApiError, isAccessDenied, accessDenialKind, isEntitlementError, upgradeUrl } from './runtime/errors.js';
5
+ export type { AccessDenialKind } from './runtime/errors.js';
5
6
  export { accessReason } from './runtime/access-reason.js';
6
7
  export { platformApiBaseUrl } from './runtime/platform-base-url.js';
7
8
  export { operations } from './runtime/operations.js';
@@ -1,14 +1,18 @@
1
+ export type AccessDenialKind = 'role_denied' | 'no_tool_permission' | 'operation_uncatalogued';
1
2
  export declare class LesslyApiError extends Error {
2
3
  readonly status: number;
3
4
  readonly code: string | null;
4
5
  readonly body: unknown;
5
- /** True iff this is the gateway refusing the call over the caller's access. See ACCESS_DENIED_CODES. */
6
+ /** True for the three neutral gateway 403 refusals. See `isAccessDenied`. */
6
7
  readonly accessDenied: boolean;
7
8
  constructor(status: number, code: string | null, message: string, body: unknown);
8
9
  }
9
10
  export declare function parseErrorBody(body: unknown, status: number): LesslyApiError;
10
11
  /**
11
- * True iff `err` is the gateway refusing a call over the caller's access.
12
+ * True for the gateway's `role_denied`, `no_tool_permission`, and `operation_uncatalogued` 403s.
13
+ * The first two are permission decisions; `operation_uncatalogued` is a catalog/rollout state.
14
+ * Render all three as the same neutral state. Use `accessDenialKind` only when diagnostics need
15
+ * to distinguish the catalog case.
12
16
  *
13
17
  * Deliberately structural after the `instanceof` fast path: an App is composed into the shell
14
18
  * through Module Federation and `@lessly/sdk-app` is not a shared singleton, so the error a
@@ -16,6 +20,13 @@ export declare function parseErrorBody(body: unknown, status: number): LesslyApi
16
20
  * report false there and an App would render a red crash for an ordinary permission refusal.
17
21
  */
18
22
  export declare function isAccessDenied(err: unknown): boolean;
23
+ /**
24
+ * The exact gateway access-refusal code at HTTP 403, or null for any other error.
25
+ * Structural like `isAccessDenied`, because an App may catch an error from another SDK copy.
26
+ * Use the kind for telemetry or developer-only catalog diagnostics, never to vary user-facing
27
+ * denial copy: `operation_uncatalogued` gets the same neutral state as the permission codes.
28
+ */
29
+ export declare function accessDenialKind(err: unknown): AccessDenialKind | null;
19
30
  /**
20
31
  * True iff `err` is billing refusing the call over the organization's plan (trial cap reached,
21
32
  * a class closed on a trial, billing or budget paused). Inside the Workspace shell the shell
package/dist/index.cjs CHANGED
@@ -10,7 +10,7 @@ var LesslyApiError = class extends Error {
10
10
  status;
11
11
  code;
12
12
  body;
13
- /** True iff this is the gateway refusing the call over the caller's access. See ACCESS_DENIED_CODES. */
13
+ /** True for the three neutral gateway 403 refusals. See `isAccessDenied`. */
14
14
  accessDenied;
15
15
  constructor(status, code, message, body) {
16
16
  super(message);
@@ -33,6 +33,19 @@ function isAccessDenied(err) {
33
33
  const { status, code } = err;
34
34
  return status === 403 && typeof code === "string" && ACCESS_DENIED_CODES.has(code);
35
35
  }
36
+ function accessDenialKind(err) {
37
+ if (typeof err !== "object" || err === null) return null;
38
+ const { status, code } = err;
39
+ if (status !== 403) return null;
40
+ switch (code) {
41
+ case "role_denied":
42
+ case "no_tool_permission":
43
+ case "operation_uncatalogued":
44
+ return code;
45
+ default:
46
+ return null;
47
+ }
48
+ }
36
49
  var ENTITLEMENT_ERRORS = /* @__PURE__ */ new Set(["entitlement_exhausted", "entitlement_unavailable"]);
37
50
  function entitlementRefusal(err) {
38
51
  if (typeof err !== "object" || err === null) return null;
@@ -12854,6 +12867,7 @@ var operations2 = operations;
12854
12867
  var compositions2 = compositions;
12855
12868
 
12856
12869
  exports.LesslyApiError = LesslyApiError;
12870
+ exports.accessDenialKind = accessDenialKind;
12857
12871
  exports.accessReason = accessReason;
12858
12872
  exports.compositions = compositions2;
12859
12873
  exports.connectStream = connectStream;