@openbkn/bkn-sdk 0.1.1-alpha.10 → 0.1.1-alpha.11
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/{chunk-GNL6Z5VF.js → chunk-SEKM54NB.js} +67 -4
- package/dist/chunk-SEKM54NB.js.map +1 -0
- package/dist/cli.js +155 -53
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +77 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-GNL6Z5VF.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -245,6 +245,61 @@ declare function agents(ctx: RequestContext): {
|
|
|
245
245
|
}) => Promise<ChatResult>;
|
|
246
246
|
};
|
|
247
247
|
|
|
248
|
+
/**
|
|
249
|
+
* AppKey API (`/api/safe/v1/{me,admin}/api-keys`, OAuth-token-gated). AppKeys
|
|
250
|
+
* are user-issued long-lived credentials (prefix `bak_`) that authenticate AS
|
|
251
|
+
* their owner — downstream authorization is identical to that owner's OAuth
|
|
252
|
+
* token. Issuing/managing them needs a real OAuth session (an AppKey itself
|
|
253
|
+
* cannot mint AppKeys). The plaintext `key` is returned ONCE, on create.
|
|
254
|
+
* Usage of an AppKey is drop-in: pass it as the bearer `--token` against the
|
|
255
|
+
* Context Loader (agent-retrieval) MCP/REST surface. See issue #75.
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
/** A key's public metadata — never carries the secret. */
|
|
259
|
+
interface ApiKey {
|
|
260
|
+
id: string;
|
|
261
|
+
key_id: string;
|
|
262
|
+
name: string;
|
|
263
|
+
enabled: boolean;
|
|
264
|
+
/** `null` = never expires. */
|
|
265
|
+
expires_at: string | null;
|
|
266
|
+
/** `null` = never used (zombie-key signal). */
|
|
267
|
+
last_used_at: string | null;
|
|
268
|
+
created_at: string;
|
|
269
|
+
/** Present only on the admin list. */
|
|
270
|
+
owner_user_id?: string;
|
|
271
|
+
}
|
|
272
|
+
/** Create response — `key` is the full plaintext, shown only this once. */
|
|
273
|
+
interface CreatedApiKey extends ApiKey {
|
|
274
|
+
key: string;
|
|
275
|
+
}
|
|
276
|
+
interface CreateApiKeyInput {
|
|
277
|
+
name: string;
|
|
278
|
+
/** RFC3339; omit = backend default (1 year). Must be in the future. */
|
|
279
|
+
expiresAt?: string;
|
|
280
|
+
/** `true` = never expire (wins over `expiresAt`). */
|
|
281
|
+
neverExpire?: boolean;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
declare function appKeys(ctx: RequestContext): {
|
|
285
|
+
/** List the caller's own keys (no secrets). */
|
|
286
|
+
list: () => Promise<{
|
|
287
|
+
keys: ApiKey[];
|
|
288
|
+
}>;
|
|
289
|
+
/** Issue a key — the result's `key` is the plaintext, shown only once. */
|
|
290
|
+
create: (input: CreateApiKeyInput) => Promise<CreatedApiKey>;
|
|
291
|
+
/** Revoke one of the caller's keys (immediate). */
|
|
292
|
+
revoke: (id: string) => Promise<void>;
|
|
293
|
+
/** Rotate a key in place — new plaintext (shown once); old secret dies now. */
|
|
294
|
+
regenerate: (id: string) => Promise<CreatedApiKey>;
|
|
295
|
+
/** Admin: list all keys, or one owner's (adds `owner_user_id`). */
|
|
296
|
+
adminList: (ownerId?: string) => Promise<{
|
|
297
|
+
keys: ApiKey[];
|
|
298
|
+
}>;
|
|
299
|
+
/** Admin: revoke any key. */
|
|
300
|
+
adminRevoke: (id: string) => Promise<void>;
|
|
301
|
+
};
|
|
302
|
+
|
|
248
303
|
/**
|
|
249
304
|
* Context-loader client over the agent-retrieval MCP endpoint (JSON-RPC).
|
|
250
305
|
* Reimplemented slim from kweaver-sdk: initialize → session id →
|
|
@@ -828,6 +883,22 @@ declare const BuildTask: z.ZodObject<{
|
|
|
828
883
|
model_dimensions: z.ZodOptional<z.ZodNumber>;
|
|
829
884
|
}, z.ZodTypeAny, "passthrough">>;
|
|
830
885
|
type BuildTask = z.infer<typeof BuildTask>;
|
|
886
|
+
interface SqlQueryRequest {
|
|
887
|
+
/** SQL string (MySQL/MariaDB/PostgreSQL) or an OpenSearch DSL object. */
|
|
888
|
+
query: string | Record<string, unknown>;
|
|
889
|
+
/**
|
|
890
|
+
* Source type (mysql | mariadb | postgresql | opensearch …). Optional — when
|
|
891
|
+
* the query carries a `{{<resource-id>}}` placeholder the backend infers the
|
|
892
|
+
* type from that resource's Catalog connector. Pass it only to override.
|
|
893
|
+
*/
|
|
894
|
+
resource_type?: string;
|
|
895
|
+
/** Streaming batch size (100–10000, default server-side). */
|
|
896
|
+
stream_size?: number;
|
|
897
|
+
/** Query timeout in seconds (1–3600). */
|
|
898
|
+
query_timeout?: number;
|
|
899
|
+
/** Cursor session id for paged streaming. */
|
|
900
|
+
query_id?: string;
|
|
901
|
+
}
|
|
831
902
|
interface ListCatalogsOptions {
|
|
832
903
|
limit?: number;
|
|
833
904
|
offset?: number;
|
|
@@ -852,6 +923,8 @@ declare function vega(ctx: RequestContext): {
|
|
|
852
923
|
catalogHealth: (ids: string[]) => Promise<unknown>;
|
|
853
924
|
connectorTypes: () => Promise<unknown>;
|
|
854
925
|
connectorType: (type: string) => Promise<unknown>;
|
|
926
|
+
/** Run SQL / OpenSearch DSL directly against a data source. */
|
|
927
|
+
sql: (body: SqlQueryRequest) => Promise<unknown>;
|
|
855
928
|
/** Build a resource's index. With `wait`, polls until terminal. */
|
|
856
929
|
build: (req: CreateBuildTaskRequest, opts?: {
|
|
857
930
|
wait?: boolean;
|
|
@@ -886,6 +959,7 @@ interface BknClient {
|
|
|
886
959
|
readonly toolboxes: ReturnType<typeof toolboxes>;
|
|
887
960
|
readonly trace: ReturnType<typeof trace>;
|
|
888
961
|
readonly admin: ReturnType<typeof admin>;
|
|
962
|
+
readonly appKeys: ReturnType<typeof appKeys>;
|
|
889
963
|
readonly vega: ReturnType<typeof vega>;
|
|
890
964
|
/** Raw API passthrough (the `call` escape hatch). */
|
|
891
965
|
call(path: string, opts?: RawCallOptions): Promise<RawCallResult>;
|
|
@@ -898,7 +972,9 @@ declare class HttpError extends Error {
|
|
|
898
972
|
readonly status: number;
|
|
899
973
|
readonly statusText: string;
|
|
900
974
|
readonly body: string;
|
|
901
|
-
|
|
975
|
+
/** Optional next-step guidance, overriding the status default (e.g. AppKey re-issue). */
|
|
976
|
+
readonly hint?: string;
|
|
977
|
+
constructor(status: number, statusText: string, body: string, hint?: string);
|
|
902
978
|
}
|
|
903
979
|
/** Raised for bad CLI/SDK input before any request is made. */
|
|
904
980
|
declare class InputError extends Error {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED