@lessly/sdk-app 61.0.0 → 61.0.1
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/README.md +53 -2
- package/dist/_types/gen/client.gen.d.ts +531 -530
- package/dist/_types/gen/manifest.gen.d.ts +2 -0
- package/dist/_types/index.d.ts +1 -1
- package/dist/_types/runtime/request.d.ts +3 -3
- package/dist/_types/runtime/types.d.ts +31 -2
- package/dist/index.cjs +1064 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1064 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/gen/bindings.gen.ts +1060 -0
- package/src/gen/client.gen.ts +531 -530
- package/src/gen/manifest.gen.ts +535 -0
|
@@ -1 +1,3 @@
|
|
|
1
|
+
import type { ToolLevel } from '../runtime/types.js';
|
|
1
2
|
export declare const namespaces: readonly ["analytics", "brain", "consent", "content", "deployment", "mail", "observe", "organization", "realtime", "support", "tracking", "users", "waitlist"];
|
|
3
|
+
export declare const operations: Record<string, ToolLevel>;
|
package/dist/_types/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { createLesslyApp } from './runtime/createLesslyApp.js';
|
|
|
2
2
|
export type { LesslyClientBase } from './runtime/createLesslyApp.js';
|
|
3
3
|
export { connectStream } from './runtime/connectStream.js';
|
|
4
4
|
export { LesslyApiError } from './runtime/errors.js';
|
|
5
|
-
export type { LesslyAppOptions, HttpMethod, Binding, BindingsMap, ParamSpec, ParamIn } from './runtime/types.js';
|
|
5
|
+
export type { LesslyAppOptions, HttpMethod, Binding, BindingsMap, ParamSpec, ParamIn, ToolLevel, Operation, } from './runtime/types.js';
|
|
6
6
|
export type { WsBinding, WsBindingsMap, LesslyStream, LesslyStreamOpener, StreamCloseInfo, StreamData, WebSocketCtor, WebSocketLike, } from './runtime/types.js';
|
|
7
7
|
export type { GeneratedClient } from './gen/client.gen.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RouteSpec, LesslyAppOptions } from './types.js';
|
|
2
2
|
export interface ResolvedRequest {
|
|
3
3
|
path: string;
|
|
4
4
|
query: Record<string, unknown>;
|
|
5
5
|
body: Record<string, unknown> | undefined;
|
|
6
6
|
}
|
|
7
|
-
export declare function resolveRequest(binding:
|
|
7
|
+
export declare function resolveRequest(binding: RouteSpec, input?: Record<string, unknown>): ResolvedRequest;
|
|
8
8
|
export declare function buildUrl(baseUrl: string, path: string, query: Record<string, unknown>): string;
|
|
9
|
-
export declare function executeRequest(opts: LesslyAppOptions, binding:
|
|
9
|
+
export declare function executeRequest(opts: LesslyAppOptions, binding: RouteSpec, input?: Record<string, unknown>): Promise<unknown>;
|
|
@@ -4,12 +4,41 @@ export interface ParamSpec {
|
|
|
4
4
|
name: string;
|
|
5
5
|
in: ParamIn;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The access level a tool requires, as declared by the platform catalog. Ordered by increasing
|
|
9
|
+
* privilege — a caller granted `admin` implicitly satisfies `write` and `read` — but that ordering
|
|
10
|
+
* is the access check's business; this SDK only transports the value it was given.
|
|
11
|
+
*/
|
|
12
|
+
export type ToolLevel = 'read' | 'write' | 'admin';
|
|
13
|
+
/**
|
|
14
|
+
* The identity of a catalog operation, carried by both a `Binding` and every generated method.
|
|
15
|
+
* `operationKey` is the catalog tool name verbatim (`mail_domains_create`), which is what an
|
|
16
|
+
* access decision keys on — the accessor path (`sdk.mail.domains.create`) is a derived, LOSSY view
|
|
17
|
+
* of it (a hyphenated resource joins several id segments) and must never be reconstructed by a
|
|
18
|
+
* caller.
|
|
19
|
+
*/
|
|
20
|
+
export interface Operation {
|
|
21
|
+
readonly operationKey: string;
|
|
22
|
+
readonly level: ToolLevel;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Everything the request layer needs to turn an input object into a URL and a method — and
|
|
26
|
+
* NOTHING else. Split out of `Binding` when `Binding` grew `operationKey`/`level`: routing has no
|
|
27
|
+
* business knowing an operation's identity or access level, and `connectStream` (which builds a
|
|
28
|
+
* GET-shaped route from a `WsBinding`) would otherwise have to fabricate both.
|
|
29
|
+
*/
|
|
30
|
+
export interface RouteSpec {
|
|
8
31
|
method: HttpMethod;
|
|
9
32
|
path: string;
|
|
10
|
-
readOnly: boolean;
|
|
11
33
|
params?: ParamSpec[];
|
|
12
34
|
}
|
|
35
|
+
/** A REST route plus the catalog identity of the operation it serves. */
|
|
36
|
+
export interface Binding extends RouteSpec {
|
|
37
|
+
readOnly: boolean;
|
|
38
|
+
/** Catalog tool name, e.g. `mail_domains_create` — the key an access decision is made on. */
|
|
39
|
+
operationKey: string;
|
|
40
|
+
level: ToolLevel;
|
|
41
|
+
}
|
|
13
42
|
/**
|
|
14
43
|
* The streaming counterpart of `Binding`: the upgrade route of a ws-bound tool. No method (an
|
|
15
44
|
* upgrade is always a GET) and no `readOnly` (a socket is neither a read nor a write — the tool's
|