@lessly/sdk-app 63.0.0 → 63.2.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
|
@@ -11134,7 +11134,7 @@ function normalize(raw) {
|
|
|
11134
11134
|
deny: asStringArray(r.deny)
|
|
11135
11135
|
};
|
|
11136
11136
|
}
|
|
11137
|
-
function createAccess(opts, bindings2,
|
|
11137
|
+
function createAccess(opts, bindings2, operations3) {
|
|
11138
11138
|
let snapshot;
|
|
11139
11139
|
let inflight;
|
|
11140
11140
|
let state = "idle";
|
|
@@ -11171,7 +11171,7 @@ function createAccess(opts, bindings2, operations2) {
|
|
|
11171
11171
|
if (state !== "ready" || !snapshot) return false;
|
|
11172
11172
|
if (ELEVATED_ROLES.has(snapshot.role)) return true;
|
|
11173
11173
|
const key = typeof op === "string" ? op : op.operationKey;
|
|
11174
|
-
const level = typeof op === "string" ?
|
|
11174
|
+
const level = typeof op === "string" ? operations3[key] : op.level;
|
|
11175
11175
|
const subject = level === void 0 ? { key } : { key, level };
|
|
11176
11176
|
return evaluate(subject, { allow: snapshot.allow, deny: snapshot.deny });
|
|
11177
11177
|
},
|
|
@@ -11267,10 +11267,14 @@ function accessReason(op) {
|
|
|
11267
11267
|
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.`;
|
|
11268
11268
|
}
|
|
11269
11269
|
|
|
11270
|
+
// src/runtime/operations.ts
|
|
11271
|
+
var operations2 = operations;
|
|
11272
|
+
|
|
11270
11273
|
exports.LesslyApiError = LesslyApiError;
|
|
11271
11274
|
exports.accessReason = accessReason;
|
|
11272
11275
|
exports.connectStream = connectStream;
|
|
11273
11276
|
exports.createLesslyApp = createLesslyApp;
|
|
11274
11277
|
exports.isAccessDenied = isAccessDenied;
|
|
11278
|
+
exports.operations = operations2;
|
|
11275
11279
|
//# sourceMappingURL=index.cjs.map
|
|
11276
11280
|
//# sourceMappingURL=index.cjs.map
|