@lessly/sdk-app 62.1.0 → 63.1.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/dist/_types/index.d.ts +1 -0
- package/dist/_types/runtime/operations.d.ts +13 -0
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/docs/recipes/access.md +53 -0
- package/docs/rules.md +22 -0
- package/package.json +1 -1
package/dist/_types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { LesslyClientBase } from './runtime/createLesslyApp.js';
|
|
|
3
3
|
export { connectStream } from './runtime/connectStream.js';
|
|
4
4
|
export { LesslyApiError, isAccessDenied } from './runtime/errors.js';
|
|
5
5
|
export { accessReason } from './runtime/access-reason.js';
|
|
6
|
+
export { operations } from './runtime/operations.js';
|
|
6
7
|
export type { LesslyAppOptions, HttpMethod, Binding, BindingsMap, ParamSpec, ParamIn, ToolLevel, Operation, } from './runtime/types.js';
|
|
7
8
|
export type { WsBinding, WsBindingsMap, LesslyStream, LesslyStreamOpener, StreamCloseInfo, StreamData, WebSocketCtor, WebSocketLike, } from './runtime/types.js';
|
|
8
9
|
export type { Access, AccessState, AccessApi } from './runtime/access.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ToolLevel } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Every operation key the catalog knows, with the level it requires.
|
|
4
|
+
*
|
|
5
|
+
* The generated file is regenerated at publish time from the live catalog, so this map re-levels
|
|
6
|
+
* with the platform rather than with anyone's memory. Read a level from here when there is no
|
|
7
|
+
* generated method to read `op.level` from — a test double, a runtime probe — instead of typing
|
|
8
|
+
* the level as a literal or keeping a lookup table in the App (APP-012).
|
|
9
|
+
*
|
|
10
|
+
* Only a re-export: the generated file stays the single source, this narrows it to `Readonly` so
|
|
11
|
+
* a consumer cannot write into the shared object.
|
|
12
|
+
*/
|
|
13
|
+
export declare const operations: Readonly<Record<string, ToolLevel>>;
|
package/dist/index.cjs
CHANGED
|
@@ -11274,7 +11274,7 @@ function normalize(raw) {
|
|
|
11274
11274
|
deny: asStringArray(r.deny)
|
|
11275
11275
|
};
|
|
11276
11276
|
}
|
|
11277
|
-
function createAccess(opts, bindings2,
|
|
11277
|
+
function createAccess(opts, bindings2, operations3) {
|
|
11278
11278
|
let snapshot;
|
|
11279
11279
|
let inflight;
|
|
11280
11280
|
let state = "idle";
|
|
@@ -11311,7 +11311,7 @@ function createAccess(opts, bindings2, operations2) {
|
|
|
11311
11311
|
if (state !== "ready" || !snapshot) return false;
|
|
11312
11312
|
if (ELEVATED_ROLES.has(snapshot.role)) return true;
|
|
11313
11313
|
const key = typeof op === "string" ? op : op.operationKey;
|
|
11314
|
-
const level = typeof op === "string" ?
|
|
11314
|
+
const level = typeof op === "string" ? operations3[key] : op.level;
|
|
11315
11315
|
const subject = level === void 0 ? { key } : { key, level };
|
|
11316
11316
|
return evaluate(subject, { allow: snapshot.allow, deny: snapshot.deny });
|
|
11317
11317
|
},
|
|
@@ -11407,10 +11407,14 @@ function accessReason(op) {
|
|
|
11407
11407
|
return typeof op === "string" ? `Requires access to ${op}. Ask an admin of this product.` : `Requires level:${op.level} (${op.operationKey}). Ask an admin of this product.`;
|
|
11408
11408
|
}
|
|
11409
11409
|
|
|
11410
|
+
// src/runtime/operations.ts
|
|
11411
|
+
var operations2 = operations;
|
|
11412
|
+
|
|
11410
11413
|
exports.LesslyApiError = LesslyApiError;
|
|
11411
11414
|
exports.accessReason = accessReason;
|
|
11412
11415
|
exports.connectStream = connectStream;
|
|
11413
11416
|
exports.createLesslyApp = createLesslyApp;
|
|
11414
11417
|
exports.isAccessDenied = isAccessDenied;
|
|
11418
|
+
exports.operations = operations2;
|
|
11415
11419
|
//# sourceMappingURL=index.cjs.map
|
|
11416
11420
|
//# sourceMappingURL=index.cjs.map
|