@alva-ai/toolkit 0.11.3-beta.0 → 0.12.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/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.js +200 -14
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +100 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +146 -1
- package/dist/index.d.ts +146 -1
- package/dist/index.js +100 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -418,6 +418,69 @@ var PlaybooksResource = class {
|
|
|
418
418
|
this.client = client;
|
|
419
419
|
}
|
|
420
420
|
client;
|
|
421
|
+
/**
|
|
422
|
+
* Resolve playbook ids to named, addressable records (mono-meta#584 A2).
|
|
423
|
+
* Visibility-gated server-side; ids the caller cannot see — and DELETED
|
|
424
|
+
* playbook ids — return no row. Treat a missing id as "deleted or not
|
|
425
|
+
* visible" (the subscriptions list's `target_status` distinguishes ghosts).
|
|
426
|
+
* Ids are strings (snowflake-safe). Max 100 per call.
|
|
427
|
+
*
|
|
428
|
+
* Auth is optional (like `trending`): with an API key, private/paid
|
|
429
|
+
* visibility is evaluated for the caller; without one, only public
|
|
430
|
+
* playbooks resolve. The server decides — no client-side gate.
|
|
431
|
+
*/
|
|
432
|
+
async getByIds(ids) {
|
|
433
|
+
return await this.client._request("GET", "/api/v1/playbooks", {
|
|
434
|
+
query: { ids: ids.join(",") }
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* List a user's playbooks by owner username (mono-meta#584 C10).
|
|
439
|
+
* Visibility-gated: another user's private playbooks are omitted.
|
|
440
|
+
* Auth is optional (like `trending`); without credentials only public
|
|
441
|
+
* playbooks are listed.
|
|
442
|
+
*/
|
|
443
|
+
async listByOwner(params) {
|
|
444
|
+
const query = { owner: params.owner };
|
|
445
|
+
if (params.limit !== void 0 && params.limit > 0) {
|
|
446
|
+
query.limit = String(params.limit);
|
|
447
|
+
}
|
|
448
|
+
if (params.cursor) query.cursor = params.cursor;
|
|
449
|
+
return await this.client._request("GET", "/api/v1/playbooks", {
|
|
450
|
+
query
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Get one playbook by numeric id or by "owner/name" ref. Returns null when
|
|
455
|
+
* not found / not visible / deleted.
|
|
456
|
+
*/
|
|
457
|
+
async get(params) {
|
|
458
|
+
if (params.id) {
|
|
459
|
+
const resp = await this.getByIds([params.id]);
|
|
460
|
+
return resp.items[0] ?? null;
|
|
461
|
+
}
|
|
462
|
+
if (params.ref) {
|
|
463
|
+
const slash = params.ref.indexOf("/");
|
|
464
|
+
if (slash <= 0 || slash === params.ref.length - 1) {
|
|
465
|
+
throw new AlvaError(
|
|
466
|
+
"INVALID_ARGUMENT",
|
|
467
|
+
`Invalid ref "${params.ref}". Expected "owner/name".`,
|
|
468
|
+
400
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
const owner = params.ref.slice(0, slash);
|
|
472
|
+
const name = params.ref.slice(slash + 1);
|
|
473
|
+
let cursor;
|
|
474
|
+
for (; ; ) {
|
|
475
|
+
const page = await this.listByOwner({ owner, cursor, limit: 100 });
|
|
476
|
+
const hit = page.items.find((item) => item.name === name);
|
|
477
|
+
if (hit) return hit;
|
|
478
|
+
if (!page.has_next || !page.next_cursor) return null;
|
|
479
|
+
cursor = page.next_cursor;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
throw new AlvaError("INVALID_ARGUMENT", "id or ref is required", 400);
|
|
483
|
+
}
|
|
421
484
|
/**
|
|
422
485
|
* List trending / searchable playbooks. Auth is optional: when the client
|
|
423
486
|
* has an API key it is forwarded, otherwise this uses the public surface.
|
|
@@ -2203,6 +2266,42 @@ var SubscriptionsResource = class {
|
|
|
2203
2266
|
query
|
|
2204
2267
|
});
|
|
2205
2268
|
}
|
|
2269
|
+
/**
|
|
2270
|
+
* List the playbooks the caller FOLLOWS (the social relation — the UI's
|
|
2271
|
+
* "Subscribed Playbooks"). Rows carry the playbook identity; follows of
|
|
2272
|
+
* deleted playbooks are filtered server-side. Cursor-paginated.
|
|
2273
|
+
*/
|
|
2274
|
+
async follows(params = {}) {
|
|
2275
|
+
this.client._requireAuth();
|
|
2276
|
+
const query = {};
|
|
2277
|
+
if (params.limit !== void 0 && params.limit > 0) {
|
|
2278
|
+
query.limit = String(params.limit);
|
|
2279
|
+
}
|
|
2280
|
+
if (params.cursor) query.cursor = params.cursor;
|
|
2281
|
+
return this.client._request("GET", "/api/v1/me/follows", {
|
|
2282
|
+
query
|
|
2283
|
+
});
|
|
2284
|
+
}
|
|
2285
|
+
/**
|
|
2286
|
+
* Disable alerts for many playbook/feed targets BY TARGET ID in one
|
|
2287
|
+
* idempotent call (max 100 ids). Ids are strings (snowflake-safe). Works
|
|
2288
|
+
* for ghost rows (deleted targets) because no name resolution happens —
|
|
2289
|
+
* the per-id results report `INVALID_ID` for malformed entries while
|
|
2290
|
+
* valid ones proceed. Safe to re-run: already-gone rows are no-ops.
|
|
2291
|
+
*/
|
|
2292
|
+
async unsubscribeBatch(params) {
|
|
2293
|
+
this.client._requireAuth();
|
|
2294
|
+
return this.client._request(
|
|
2295
|
+
"POST",
|
|
2296
|
+
"/api/v1/subscriptions/unsubscribe-batch",
|
|
2297
|
+
{
|
|
2298
|
+
body: {
|
|
2299
|
+
playbook_ids: params.playbookIds ?? [],
|
|
2300
|
+
feed_ids: params.feedIds ?? []
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
);
|
|
2304
|
+
}
|
|
2206
2305
|
};
|
|
2207
2306
|
|
|
2208
2307
|
// src/resources/channelGroupSubscriptions.ts
|
|
@@ -3080,7 +3179,7 @@ var installPlaybookRuntime = (targetWindow) => {
|
|
|
3080
3179
|
};
|
|
3081
3180
|
|
|
3082
3181
|
// src/index.ts
|
|
3083
|
-
var VERSION = true ? "0.
|
|
3182
|
+
var VERSION = true ? "0.12.0" : "dev";
|
|
3084
3183
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3085
3184
|
0 && (module.exports = {
|
|
3086
3185
|
AlvaClient,
|