@alva-ai/toolkit 0.28.1-beta.1 → 0.29.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/README.md +2 -1
- package/dist/browser.global.js +20 -20
- package/dist/browser.global.js.map +1 -1
- package/dist/cli.d.ts +46 -0
- package/dist/cli.js +181 -6
- package/dist/cli.js.map +1 -1
- package/dist/dispatch.d.ts +46 -0
- package/dist/dispatch.js +39 -6
- package/dist/dispatch.js.map +1 -1
- package/dist/index.cjs +150 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.js +150 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -633,7 +633,8 @@ var ReleaseResource = class {
|
|
|
633
633
|
version: params.version,
|
|
634
634
|
feeds: params.feeds,
|
|
635
635
|
changelog: params.changelog,
|
|
636
|
-
readme_url: params.readme_url
|
|
636
|
+
readme_url: params.readme_url,
|
|
637
|
+
confirm_bundled_feed_exposure: params.confirm_bundled_feed_exposure
|
|
637
638
|
}
|
|
638
639
|
});
|
|
639
640
|
}
|
|
@@ -4156,6 +4157,47 @@ var ThesesResource = class {
|
|
|
4156
4157
|
await this.client._request("GET", `/api/v1/theses/${requireID(id, "id")}`)
|
|
4157
4158
|
);
|
|
4158
4159
|
}
|
|
4160
|
+
async getVersion(id, authorVersionID) {
|
|
4161
|
+
this.client._requireAuth();
|
|
4162
|
+
const thesisID = requireID(id, "id");
|
|
4163
|
+
const versionID = requireID(authorVersionID, "author_version_id");
|
|
4164
|
+
const response = thesisResponse(
|
|
4165
|
+
await this.client._request(
|
|
4166
|
+
"GET",
|
|
4167
|
+
`/api/v1/theses/${thesisID}/versions/${versionID}`
|
|
4168
|
+
)
|
|
4169
|
+
);
|
|
4170
|
+
if (response.thesis.id !== thesisID || response.thesis.author_version_id !== versionID) {
|
|
4171
|
+
throw invalidResponse2(
|
|
4172
|
+
"version response must match the requested thesis and author version"
|
|
4173
|
+
);
|
|
4174
|
+
}
|
|
4175
|
+
return response;
|
|
4176
|
+
}
|
|
4177
|
+
async signals(id, params = {}) {
|
|
4178
|
+
this.client._requireAuth();
|
|
4179
|
+
const first = params.first ?? 20;
|
|
4180
|
+
if (!Number.isInteger(first) || first < 1 || first > 50) {
|
|
4181
|
+
throw invalidArgument("first must be an integer between 1 and 50");
|
|
4182
|
+
}
|
|
4183
|
+
if (params.cursor !== void 0 && typeof params.cursor !== "string") {
|
|
4184
|
+
throw invalidArgument("cursor must be a string");
|
|
4185
|
+
}
|
|
4186
|
+
return thesisSignalsResponse(
|
|
4187
|
+
await this.client._request(
|
|
4188
|
+
"GET",
|
|
4189
|
+
`/api/v1/theses/${requireID(id, "id")}/signals`,
|
|
4190
|
+
{
|
|
4191
|
+
query: {
|
|
4192
|
+
first,
|
|
4193
|
+
...params.cursor === void 0 ? {} : { cursor: params.cursor }
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
),
|
|
4197
|
+
id,
|
|
4198
|
+
first
|
|
4199
|
+
);
|
|
4200
|
+
}
|
|
4159
4201
|
async update(id, params) {
|
|
4160
4202
|
this.client._requireAuth();
|
|
4161
4203
|
const body = updateBody(params);
|
|
@@ -4327,6 +4369,112 @@ function thesisGetResponse(response) {
|
|
|
4327
4369
|
});
|
|
4328
4370
|
return { thesis: base.thesis, author, entities };
|
|
4329
4371
|
}
|
|
4372
|
+
function thesisSignalsResponse(response, thesisID, first) {
|
|
4373
|
+
if (!isRecord2(response) || !isRecord2(response.research) || !Array.isArray(response.entries) || response.entries.length > first) {
|
|
4374
|
+
throw invalidResponse2("invalid Signal history response");
|
|
4375
|
+
}
|
|
4376
|
+
const research = response.research;
|
|
4377
|
+
const status = {
|
|
4378
|
+
state: responseText(research.state, "research.state"),
|
|
4379
|
+
pending_work: responseNonnegativeInteger(
|
|
4380
|
+
research.pending_work,
|
|
4381
|
+
"research.pending_work"
|
|
4382
|
+
),
|
|
4383
|
+
read_complete: responseBoolean(
|
|
4384
|
+
research.read_complete,
|
|
4385
|
+
"research.read_complete"
|
|
4386
|
+
)
|
|
4387
|
+
};
|
|
4388
|
+
if (research.last_attempt_ms !== void 0)
|
|
4389
|
+
status.last_attempt_ms = responseNonnegativeInteger(
|
|
4390
|
+
research.last_attempt_ms,
|
|
4391
|
+
"research.last_attempt_ms"
|
|
4392
|
+
);
|
|
4393
|
+
if (research.last_completed_ms !== void 0)
|
|
4394
|
+
status.last_completed_ms = responseNonnegativeInteger(
|
|
4395
|
+
research.last_completed_ms,
|
|
4396
|
+
"research.last_completed_ms"
|
|
4397
|
+
);
|
|
4398
|
+
const entries = response.entries.map((raw) => {
|
|
4399
|
+
if (!isRecord2(raw) || !isRecord2(raw.signal) || !isRecord2(raw.signal.source)) {
|
|
4400
|
+
throw invalidResponse2("entry must include a Signal and source");
|
|
4401
|
+
}
|
|
4402
|
+
const signal = raw.signal;
|
|
4403
|
+
const source = signal.source;
|
|
4404
|
+
const signalID = responseID(signal.thesis_id, "signal.thesis_id");
|
|
4405
|
+
if (signalID !== thesisID)
|
|
4406
|
+
throw invalidResponse2("Signal belongs to another Thesis");
|
|
4407
|
+
const cursor = responseNonemptyText(raw.cursor, "entry.cursor");
|
|
4408
|
+
const mappedSource = {
|
|
4409
|
+
title: responseText(source.title, "source.title")
|
|
4410
|
+
};
|
|
4411
|
+
if (source.url !== void 0)
|
|
4412
|
+
mappedSource.url = responseText(source.url, "source.url");
|
|
4413
|
+
if (source.published_at_ms !== void 0)
|
|
4414
|
+
mappedSource.published_at_ms = responseNonnegativeInteger(
|
|
4415
|
+
source.published_at_ms,
|
|
4416
|
+
"source.published_at_ms"
|
|
4417
|
+
);
|
|
4418
|
+
const mappedSignal = {
|
|
4419
|
+
id: responseID(signal.id, "signal.id"),
|
|
4420
|
+
thesis_id: signalID,
|
|
4421
|
+
author_version_id: responseID(
|
|
4422
|
+
signal.author_version_id,
|
|
4423
|
+
"signal.author_version_id"
|
|
4424
|
+
),
|
|
4425
|
+
statement_snapshot: responseNonemptyText(
|
|
4426
|
+
signal.statement_snapshot,
|
|
4427
|
+
"signal.statement_snapshot"
|
|
4428
|
+
),
|
|
4429
|
+
stance: responseText(signal.stance, "signal.stance"),
|
|
4430
|
+
explanation: responseText(signal.explanation, "signal.explanation"),
|
|
4431
|
+
information_kind: responseText(
|
|
4432
|
+
signal.information_kind,
|
|
4433
|
+
"signal.information_kind"
|
|
4434
|
+
),
|
|
4435
|
+
source: mappedSource
|
|
4436
|
+
};
|
|
4437
|
+
if (signal.evidence_excerpt !== void 0) {
|
|
4438
|
+
if (!isRecord2(signal.evidence_excerpt))
|
|
4439
|
+
throw invalidResponse2("invalid evidence excerpt");
|
|
4440
|
+
mappedSignal.evidence_excerpt = {
|
|
4441
|
+
text: responseNonemptyText(
|
|
4442
|
+
signal.evidence_excerpt.text,
|
|
4443
|
+
"evidence_excerpt.text"
|
|
4444
|
+
),
|
|
4445
|
+
omitted_before: responseBoolean(
|
|
4446
|
+
signal.evidence_excerpt.omitted_before,
|
|
4447
|
+
"evidence_excerpt.omitted_before"
|
|
4448
|
+
),
|
|
4449
|
+
omitted_after: responseBoolean(
|
|
4450
|
+
signal.evidence_excerpt.omitted_after,
|
|
4451
|
+
"evidence_excerpt.omitted_after"
|
|
4452
|
+
)
|
|
4453
|
+
};
|
|
4454
|
+
}
|
|
4455
|
+
return {
|
|
4456
|
+
feed_entry_id: responseID(raw.feed_entry_id, "feed_entry_id"),
|
|
4457
|
+
cursor,
|
|
4458
|
+
signal: mappedSignal
|
|
4459
|
+
};
|
|
4460
|
+
});
|
|
4461
|
+
const nextCursor = responseText(response.next_cursor, "next_cursor");
|
|
4462
|
+
if (nextCursor && nextCursor !== entries[entries.length - 1]?.cursor) {
|
|
4463
|
+
throw invalidResponse2("next_cursor must match the final entry");
|
|
4464
|
+
}
|
|
4465
|
+
return { research: status, entries, next_cursor: nextCursor };
|
|
4466
|
+
}
|
|
4467
|
+
function responseNonnegativeInteger(value, field) {
|
|
4468
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
|
|
4469
|
+
throw invalidResponse2(field + " must be a nonnegative safe integer");
|
|
4470
|
+
}
|
|
4471
|
+
return value;
|
|
4472
|
+
}
|
|
4473
|
+
function responseNonemptyText(value, field) {
|
|
4474
|
+
const valueText = responseText(value, field);
|
|
4475
|
+
if (!valueText.trim()) throw invalidResponse2(field + " must be nonempty");
|
|
4476
|
+
return valueText;
|
|
4477
|
+
}
|
|
4330
4478
|
function requireRequestID(value) {
|
|
4331
4479
|
if (!UUID.test(value) || /^0{8}-0{4}-0{4}-0{4}-0{12}$/i.test(value)) {
|
|
4332
4480
|
throw invalidArgument("request_id must be a non-zero RFC 4122 UUID");
|
|
@@ -5317,7 +5465,7 @@ var installPlaybookRuntime = (targetWindow) => {
|
|
|
5317
5465
|
};
|
|
5318
5466
|
|
|
5319
5467
|
// src/index.ts
|
|
5320
|
-
var VERSION = true ? "0.
|
|
5468
|
+
var VERSION = true ? "0.29.0" : "dev";
|
|
5321
5469
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5322
5470
|
0 && (module.exports = {
|
|
5323
5471
|
AlertsResource,
|