@hol-org/rb-client 0.1.180 → 0.1.181
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/index.cjs +344 -104
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +342 -104
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4233,10 +4233,98 @@ async function registerOwnedMoltbookAgent(client, uaid, request) {
|
|
|
4233
4233
|
}
|
|
4234
4234
|
|
|
4235
4235
|
// ../../src/services/registry-broker/client/guard.ts
|
|
4236
|
+
function isStatusError(error) {
|
|
4237
|
+
if (error instanceof RegistryBrokerError) {
|
|
4238
|
+
return true;
|
|
4239
|
+
}
|
|
4240
|
+
if (typeof error !== "object" || error === null || !("status" in error)) {
|
|
4241
|
+
return false;
|
|
4242
|
+
}
|
|
4243
|
+
return typeof Reflect.get(error, "status") === "number";
|
|
4244
|
+
}
|
|
4245
|
+
function toPortalCanonicalGuardPath(path) {
|
|
4246
|
+
const segments = path.split("/");
|
|
4247
|
+
const findPatternStart = (size, matcher) => {
|
|
4248
|
+
for (let startIndex = segments.length - size; startIndex >= 0; startIndex -= 1) {
|
|
4249
|
+
if (matcher(startIndex)) {
|
|
4250
|
+
return startIndex;
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
return -1;
|
|
4254
|
+
};
|
|
4255
|
+
const replaceAt = (startIndex, consumed) => [
|
|
4256
|
+
...segments.slice(0, startIndex),
|
|
4257
|
+
"api",
|
|
4258
|
+
"guard",
|
|
4259
|
+
...segments.slice(startIndex + consumed)
|
|
4260
|
+
].join("/");
|
|
4261
|
+
const registryStart = findPatternStart(
|
|
4262
|
+
4,
|
|
4263
|
+
(startIndex) => segments[startIndex] === "registry" && segments[startIndex + 1] === "api" && /^v\d+$/.test(segments[startIndex + 2] ?? "") && segments[startIndex + 3] === "guard"
|
|
4264
|
+
);
|
|
4265
|
+
if (registryStart >= 0) {
|
|
4266
|
+
return replaceAt(registryStart, 4);
|
|
4267
|
+
}
|
|
4268
|
+
const apiVersionStart = findPatternStart(
|
|
4269
|
+
3,
|
|
4270
|
+
(startIndex) => segments[startIndex] === "api" && /^v\d+$/.test(segments[startIndex + 1] ?? "") && segments[startIndex + 2] === "guard"
|
|
4271
|
+
);
|
|
4272
|
+
if (apiVersionStart >= 0) {
|
|
4273
|
+
return replaceAt(apiVersionStart, 3);
|
|
4274
|
+
}
|
|
4275
|
+
for (let index = segments.length - 1; index >= 0; index -= 1) {
|
|
4276
|
+
if (segments[index] === "guard" && segments[index - 1] !== "api") {
|
|
4277
|
+
return [
|
|
4278
|
+
...segments.slice(0, index),
|
|
4279
|
+
"api",
|
|
4280
|
+
"guard",
|
|
4281
|
+
...segments.slice(index + 1)
|
|
4282
|
+
].join("/");
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
return path;
|
|
4286
|
+
}
|
|
4287
|
+
function buildPortalCanonicalGuardUrl(baseUrl, path) {
|
|
4288
|
+
const target = new URL(path, "https://guard.local");
|
|
4289
|
+
const normalizedBasePath = (() => {
|
|
4290
|
+
try {
|
|
4291
|
+
const base = new URL(baseUrl);
|
|
4292
|
+
return base.pathname.replace(/\/+$/, "");
|
|
4293
|
+
} catch {
|
|
4294
|
+
return baseUrl.replace(/\/+$/, "");
|
|
4295
|
+
}
|
|
4296
|
+
})();
|
|
4297
|
+
const requestedPath = `${normalizedBasePath}${target.pathname}`;
|
|
4298
|
+
const canonicalPath = toPortalCanonicalGuardPath(requestedPath);
|
|
4299
|
+
const canonicalRelativePath = `${canonicalPath}${target.search}`;
|
|
4300
|
+
try {
|
|
4301
|
+
const base = new URL(baseUrl);
|
|
4302
|
+
return `${base.origin}${canonicalRelativePath}`;
|
|
4303
|
+
} catch {
|
|
4304
|
+
return canonicalRelativePath;
|
|
4305
|
+
}
|
|
4306
|
+
}
|
|
4307
|
+
async function requestPortalFirstJson(client, path, init) {
|
|
4308
|
+
try {
|
|
4309
|
+
return await client.requestJson(path, init);
|
|
4310
|
+
} catch (error) {
|
|
4311
|
+
if (isStatusError(error) && (error.status === 404 || error.status === 501)) {
|
|
4312
|
+
return client.requestAbsoluteJson(
|
|
4313
|
+
buildPortalCanonicalGuardUrl(client.baseUrl, path),
|
|
4314
|
+
init
|
|
4315
|
+
);
|
|
4316
|
+
}
|
|
4317
|
+
throw error;
|
|
4318
|
+
}
|
|
4319
|
+
}
|
|
4236
4320
|
async function getGuardSession(client) {
|
|
4237
|
-
const raw = await
|
|
4238
|
-
|
|
4239
|
-
|
|
4321
|
+
const raw = await requestPortalFirstJson(
|
|
4322
|
+
client,
|
|
4323
|
+
"/guard/auth/session",
|
|
4324
|
+
{
|
|
4325
|
+
method: "GET"
|
|
4326
|
+
}
|
|
4327
|
+
);
|
|
4240
4328
|
return client.parseWithSchema(
|
|
4241
4329
|
raw,
|
|
4242
4330
|
guardSessionResponseSchema,
|
|
@@ -4244,9 +4332,13 @@ async function getGuardSession(client) {
|
|
|
4244
4332
|
);
|
|
4245
4333
|
}
|
|
4246
4334
|
async function getGuardEntitlements(client) {
|
|
4247
|
-
const raw = await
|
|
4248
|
-
|
|
4249
|
-
|
|
4335
|
+
const raw = await requestPortalFirstJson(
|
|
4336
|
+
client,
|
|
4337
|
+
"/guard/entitlements",
|
|
4338
|
+
{
|
|
4339
|
+
method: "GET"
|
|
4340
|
+
}
|
|
4341
|
+
);
|
|
4250
4342
|
return client.parseWithSchema(
|
|
4251
4343
|
raw,
|
|
4252
4344
|
guardSessionResponseSchema,
|
|
@@ -4254,9 +4346,13 @@ async function getGuardEntitlements(client) {
|
|
|
4254
4346
|
);
|
|
4255
4347
|
}
|
|
4256
4348
|
async function getGuardBillingBalance(client) {
|
|
4257
|
-
const raw = await
|
|
4258
|
-
|
|
4259
|
-
|
|
4349
|
+
const raw = await requestPortalFirstJson(
|
|
4350
|
+
client,
|
|
4351
|
+
"/guard/billing/balance",
|
|
4352
|
+
{
|
|
4353
|
+
method: "GET"
|
|
4354
|
+
}
|
|
4355
|
+
);
|
|
4260
4356
|
return client.parseWithSchema(
|
|
4261
4357
|
raw,
|
|
4262
4358
|
guardBalanceResponseSchema,
|
|
@@ -4270,9 +4366,13 @@ async function getGuardFeed(client, limit) {
|
|
|
4270
4366
|
}
|
|
4271
4367
|
const query = params.toString();
|
|
4272
4368
|
const suffix = query ? `?${query}` : "";
|
|
4273
|
-
const raw = await
|
|
4274
|
-
|
|
4275
|
-
|
|
4369
|
+
const raw = await requestPortalFirstJson(
|
|
4370
|
+
client,
|
|
4371
|
+
`/guard/feed${suffix}`,
|
|
4372
|
+
{
|
|
4373
|
+
method: "GET"
|
|
4374
|
+
}
|
|
4375
|
+
);
|
|
4276
4376
|
return client.parseWithSchema(
|
|
4277
4377
|
raw,
|
|
4278
4378
|
guardFeedResponseSchema,
|
|
@@ -4280,9 +4380,13 @@ async function getGuardFeed(client, limit) {
|
|
|
4280
4380
|
);
|
|
4281
4381
|
}
|
|
4282
4382
|
async function getGuardOverview(client) {
|
|
4283
|
-
const raw = await
|
|
4284
|
-
|
|
4285
|
-
|
|
4383
|
+
const raw = await requestPortalFirstJson(
|
|
4384
|
+
client,
|
|
4385
|
+
"/guard/overview",
|
|
4386
|
+
{
|
|
4387
|
+
method: "GET"
|
|
4388
|
+
}
|
|
4389
|
+
);
|
|
4286
4390
|
return client.parseWithSchema(
|
|
4287
4391
|
raw,
|
|
4288
4392
|
guardOverviewResponseSchema,
|
|
@@ -4294,7 +4398,8 @@ async function getGuardTrustByHash(client, sha256) {
|
|
|
4294
4398
|
if (!normalizedHash) {
|
|
4295
4399
|
throw new Error("sha256 is required");
|
|
4296
4400
|
}
|
|
4297
|
-
const raw = await
|
|
4401
|
+
const raw = await requestPortalFirstJson(
|
|
4402
|
+
client,
|
|
4298
4403
|
`/guard/trust/by-hash/${encodeURIComponent(normalizedHash)}`,
|
|
4299
4404
|
{ method: "GET" }
|
|
4300
4405
|
);
|
|
@@ -4316,7 +4421,8 @@ async function resolveGuardTrust(client, query) {
|
|
|
4316
4421
|
params.set("version", query.version.trim());
|
|
4317
4422
|
}
|
|
4318
4423
|
const suffix = params.size > 0 ? `?${params.toString()}` : "";
|
|
4319
|
-
const raw = await
|
|
4424
|
+
const raw = await requestPortalFirstJson(
|
|
4425
|
+
client,
|
|
4320
4426
|
`/guard/trust/resolve${suffix}`,
|
|
4321
4427
|
{ method: "GET" }
|
|
4322
4428
|
);
|
|
@@ -4327,9 +4433,13 @@ async function resolveGuardTrust(client, query) {
|
|
|
4327
4433
|
);
|
|
4328
4434
|
}
|
|
4329
4435
|
async function getGuardRevocations(client) {
|
|
4330
|
-
const raw = await
|
|
4331
|
-
|
|
4332
|
-
|
|
4436
|
+
const raw = await requestPortalFirstJson(
|
|
4437
|
+
client,
|
|
4438
|
+
"/guard/revocations",
|
|
4439
|
+
{
|
|
4440
|
+
method: "GET"
|
|
4441
|
+
}
|
|
4442
|
+
);
|
|
4333
4443
|
return client.parseWithSchema(
|
|
4334
4444
|
raw,
|
|
4335
4445
|
guardRevocationResponseSchema,
|
|
@@ -4337,9 +4447,13 @@ async function getGuardRevocations(client) {
|
|
|
4337
4447
|
);
|
|
4338
4448
|
}
|
|
4339
4449
|
async function fetchGuardAdvisories(client) {
|
|
4340
|
-
const raw = await
|
|
4341
|
-
|
|
4342
|
-
|
|
4450
|
+
const raw = await requestPortalFirstJson(
|
|
4451
|
+
client,
|
|
4452
|
+
"/guard/advisories",
|
|
4453
|
+
{
|
|
4454
|
+
method: "GET"
|
|
4455
|
+
}
|
|
4456
|
+
);
|
|
4343
4457
|
return client.parseWithSchema(
|
|
4344
4458
|
raw,
|
|
4345
4459
|
guardRevocationResponseSchema,
|
|
@@ -4347,9 +4461,13 @@ async function fetchGuardAdvisories(client) {
|
|
|
4347
4461
|
);
|
|
4348
4462
|
}
|
|
4349
4463
|
async function fetchGuardPolicy(client) {
|
|
4350
|
-
const raw = await
|
|
4351
|
-
|
|
4352
|
-
|
|
4464
|
+
const raw = await requestPortalFirstJson(
|
|
4465
|
+
client,
|
|
4466
|
+
"/guard/policy/fetch",
|
|
4467
|
+
{
|
|
4468
|
+
method: "GET"
|
|
4469
|
+
}
|
|
4470
|
+
);
|
|
4353
4471
|
return client.parseWithSchema(
|
|
4354
4472
|
raw,
|
|
4355
4473
|
guardPolicySchema,
|
|
@@ -4357,9 +4475,13 @@ async function fetchGuardPolicy(client) {
|
|
|
4357
4475
|
);
|
|
4358
4476
|
}
|
|
4359
4477
|
async function getGuardInventory(client) {
|
|
4360
|
-
const raw = await
|
|
4361
|
-
|
|
4362
|
-
|
|
4478
|
+
const raw = await requestPortalFirstJson(
|
|
4479
|
+
client,
|
|
4480
|
+
"/guard/inventory",
|
|
4481
|
+
{
|
|
4482
|
+
method: "GET"
|
|
4483
|
+
}
|
|
4484
|
+
);
|
|
4363
4485
|
return client.parseWithSchema(
|
|
4364
4486
|
raw,
|
|
4365
4487
|
guardInventoryResponseSchema,
|
|
@@ -4367,9 +4489,13 @@ async function getGuardInventory(client) {
|
|
|
4367
4489
|
);
|
|
4368
4490
|
}
|
|
4369
4491
|
async function getGuardReceiptHistory(client) {
|
|
4370
|
-
const raw = await
|
|
4371
|
-
|
|
4372
|
-
|
|
4492
|
+
const raw = await requestPortalFirstJson(
|
|
4493
|
+
client,
|
|
4494
|
+
"/guard/history",
|
|
4495
|
+
{
|
|
4496
|
+
method: "GET"
|
|
4497
|
+
}
|
|
4498
|
+
);
|
|
4373
4499
|
return client.parseWithSchema(
|
|
4374
4500
|
raw,
|
|
4375
4501
|
guardReceiptHistoryResponseSchema,
|
|
@@ -4381,7 +4507,8 @@ async function getGuardArtifactTimeline(client, artifactId) {
|
|
|
4381
4507
|
if (!normalizedArtifactId) {
|
|
4382
4508
|
throw new Error("artifactId is required");
|
|
4383
4509
|
}
|
|
4384
|
-
const raw = await
|
|
4510
|
+
const raw = await requestPortalFirstJson(
|
|
4511
|
+
client,
|
|
4385
4512
|
`/guard/history/${encodeURIComponent(normalizedArtifactId)}`,
|
|
4386
4513
|
{ method: "GET" }
|
|
4387
4514
|
);
|
|
@@ -4392,7 +4519,7 @@ async function getGuardArtifactTimeline(client, artifactId) {
|
|
|
4392
4519
|
);
|
|
4393
4520
|
}
|
|
4394
4521
|
async function exportGuardAbom(client) {
|
|
4395
|
-
const raw = await client
|
|
4522
|
+
const raw = await requestPortalFirstJson(client, "/guard/abom", {
|
|
4396
4523
|
method: "GET"
|
|
4397
4524
|
});
|
|
4398
4525
|
return client.parseWithSchema(
|
|
@@ -4406,7 +4533,8 @@ async function exportGuardArtifactAbom(client, artifactId) {
|
|
|
4406
4533
|
if (!normalizedArtifactId) {
|
|
4407
4534
|
throw new Error("artifactId is required");
|
|
4408
4535
|
}
|
|
4409
|
-
const raw = await
|
|
4536
|
+
const raw = await requestPortalFirstJson(
|
|
4537
|
+
client,
|
|
4410
4538
|
`/guard/abom/${encodeURIComponent(normalizedArtifactId)}`,
|
|
4411
4539
|
{ method: "GET" }
|
|
4412
4540
|
);
|
|
@@ -4417,9 +4545,13 @@ async function exportGuardArtifactAbom(client, artifactId) {
|
|
|
4417
4545
|
);
|
|
4418
4546
|
}
|
|
4419
4547
|
async function exportGuardReceipts(client) {
|
|
4420
|
-
const raw = await
|
|
4421
|
-
|
|
4422
|
-
|
|
4548
|
+
const raw = await requestPortalFirstJson(
|
|
4549
|
+
client,
|
|
4550
|
+
"/guard/receipts/export",
|
|
4551
|
+
{
|
|
4552
|
+
method: "GET"
|
|
4553
|
+
}
|
|
4554
|
+
);
|
|
4423
4555
|
return client.parseWithSchema(
|
|
4424
4556
|
raw,
|
|
4425
4557
|
guardReceiptExportResponseSchema,
|
|
@@ -4427,9 +4559,13 @@ async function exportGuardReceipts(client) {
|
|
|
4427
4559
|
);
|
|
4428
4560
|
}
|
|
4429
4561
|
async function getGuardInventoryDiff(client) {
|
|
4430
|
-
const raw = await
|
|
4431
|
-
|
|
4432
|
-
|
|
4562
|
+
const raw = await requestPortalFirstJson(
|
|
4563
|
+
client,
|
|
4564
|
+
"/guard/inventory/diff",
|
|
4565
|
+
{
|
|
4566
|
+
method: "GET"
|
|
4567
|
+
}
|
|
4568
|
+
);
|
|
4433
4569
|
return client.parseWithSchema(
|
|
4434
4570
|
raw,
|
|
4435
4571
|
guardInventoryDiffResponseSchema,
|
|
@@ -4437,9 +4573,13 @@ async function getGuardInventoryDiff(client) {
|
|
|
4437
4573
|
);
|
|
4438
4574
|
}
|
|
4439
4575
|
async function getGuardDevices(client) {
|
|
4440
|
-
const raw = await
|
|
4441
|
-
|
|
4442
|
-
|
|
4576
|
+
const raw = await requestPortalFirstJson(
|
|
4577
|
+
client,
|
|
4578
|
+
"/guard/devices",
|
|
4579
|
+
{
|
|
4580
|
+
method: "GET"
|
|
4581
|
+
}
|
|
4582
|
+
);
|
|
4443
4583
|
return client.parseWithSchema(
|
|
4444
4584
|
raw,
|
|
4445
4585
|
guardDeviceListResponseSchema,
|
|
@@ -4447,9 +4587,13 @@ async function getGuardDevices(client) {
|
|
|
4447
4587
|
);
|
|
4448
4588
|
}
|
|
4449
4589
|
async function getGuardAlertPreferences(client) {
|
|
4450
|
-
const raw = await
|
|
4451
|
-
|
|
4452
|
-
|
|
4590
|
+
const raw = await requestPortalFirstJson(
|
|
4591
|
+
client,
|
|
4592
|
+
"/guard/alerts/preferences",
|
|
4593
|
+
{
|
|
4594
|
+
method: "GET"
|
|
4595
|
+
}
|
|
4596
|
+
);
|
|
4453
4597
|
return client.parseWithSchema(
|
|
4454
4598
|
raw,
|
|
4455
4599
|
guardAlertPreferencesSchema,
|
|
@@ -4457,10 +4601,14 @@ async function getGuardAlertPreferences(client) {
|
|
|
4457
4601
|
);
|
|
4458
4602
|
}
|
|
4459
4603
|
async function updateGuardAlertPreferences(client, payload) {
|
|
4460
|
-
const raw = await
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4604
|
+
const raw = await requestPortalFirstJson(
|
|
4605
|
+
client,
|
|
4606
|
+
"/guard/alerts/preferences",
|
|
4607
|
+
{
|
|
4608
|
+
method: "PUT",
|
|
4609
|
+
body: payload
|
|
4610
|
+
}
|
|
4611
|
+
);
|
|
4464
4612
|
return client.parseWithSchema(
|
|
4465
4613
|
raw,
|
|
4466
4614
|
guardAlertPreferencesSchema,
|
|
@@ -4468,9 +4616,13 @@ async function updateGuardAlertPreferences(client, payload) {
|
|
|
4468
4616
|
);
|
|
4469
4617
|
}
|
|
4470
4618
|
async function getGuardExceptions(client) {
|
|
4471
|
-
const raw = await
|
|
4472
|
-
|
|
4473
|
-
|
|
4619
|
+
const raw = await requestPortalFirstJson(
|
|
4620
|
+
client,
|
|
4621
|
+
"/guard/exceptions",
|
|
4622
|
+
{
|
|
4623
|
+
method: "GET"
|
|
4624
|
+
}
|
|
4625
|
+
);
|
|
4474
4626
|
return client.parseWithSchema(
|
|
4475
4627
|
raw,
|
|
4476
4628
|
guardExceptionListResponseSchema,
|
|
@@ -4478,9 +4630,13 @@ async function getGuardExceptions(client) {
|
|
|
4478
4630
|
);
|
|
4479
4631
|
}
|
|
4480
4632
|
async function getGuardWatchlist(client) {
|
|
4481
|
-
const raw = await
|
|
4482
|
-
|
|
4483
|
-
|
|
4633
|
+
const raw = await requestPortalFirstJson(
|
|
4634
|
+
client,
|
|
4635
|
+
"/guard/watchlist",
|
|
4636
|
+
{
|
|
4637
|
+
method: "GET"
|
|
4638
|
+
}
|
|
4639
|
+
);
|
|
4484
4640
|
return client.parseWithSchema(
|
|
4485
4641
|
raw,
|
|
4486
4642
|
guardWatchlistResponseSchema,
|
|
@@ -4488,10 +4644,14 @@ async function getGuardWatchlist(client) {
|
|
|
4488
4644
|
);
|
|
4489
4645
|
}
|
|
4490
4646
|
async function lookupGuardWatchlist(client, payload) {
|
|
4491
|
-
const raw = await
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4647
|
+
const raw = await requestPortalFirstJson(
|
|
4648
|
+
client,
|
|
4649
|
+
"/guard/watchlist/lookup",
|
|
4650
|
+
{
|
|
4651
|
+
method: "POST",
|
|
4652
|
+
body: payload
|
|
4653
|
+
}
|
|
4654
|
+
);
|
|
4495
4655
|
return client.parseWithSchema(
|
|
4496
4656
|
raw,
|
|
4497
4657
|
guardWatchlistLookupResponseSchema,
|
|
@@ -4499,9 +4659,13 @@ async function lookupGuardWatchlist(client, payload) {
|
|
|
4499
4659
|
);
|
|
4500
4660
|
}
|
|
4501
4661
|
async function getGuardPainSignals(client) {
|
|
4502
|
-
const raw = await
|
|
4503
|
-
|
|
4504
|
-
|
|
4662
|
+
const raw = await requestPortalFirstJson(
|
|
4663
|
+
client,
|
|
4664
|
+
"/guard/signals/pain",
|
|
4665
|
+
{
|
|
4666
|
+
method: "GET"
|
|
4667
|
+
}
|
|
4668
|
+
);
|
|
4505
4669
|
return client.parseWithSchema(
|
|
4506
4670
|
raw,
|
|
4507
4671
|
guardPainSignalListResponseSchema,
|
|
@@ -4509,7 +4673,8 @@ async function getGuardPainSignals(client) {
|
|
|
4509
4673
|
);
|
|
4510
4674
|
}
|
|
4511
4675
|
async function getGuardAggregatedPainSignals(client) {
|
|
4512
|
-
const raw = await
|
|
4676
|
+
const raw = await requestPortalFirstJson(
|
|
4677
|
+
client,
|
|
4513
4678
|
"/guard/signals/pain/aggregate",
|
|
4514
4679
|
{
|
|
4515
4680
|
method: "GET"
|
|
@@ -4522,7 +4687,7 @@ async function getGuardAggregatedPainSignals(client) {
|
|
|
4522
4687
|
);
|
|
4523
4688
|
}
|
|
4524
4689
|
async function getGuardPreflightVerdict(client, path, payload) {
|
|
4525
|
-
const raw = await client
|
|
4690
|
+
const raw = await requestPortalFirstJson(client, path, {
|
|
4526
4691
|
method: "POST",
|
|
4527
4692
|
body: payload
|
|
4528
4693
|
});
|
|
@@ -4547,10 +4712,14 @@ async function getGuardPreExecutionVerdict(client, payload) {
|
|
|
4547
4712
|
);
|
|
4548
4713
|
}
|
|
4549
4714
|
async function ingestGuardPainSignals(client, items) {
|
|
4550
|
-
const raw = await
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4715
|
+
const raw = await requestPortalFirstJson(
|
|
4716
|
+
client,
|
|
4717
|
+
"/guard/signals/pain",
|
|
4718
|
+
{
|
|
4719
|
+
method: "POST",
|
|
4720
|
+
body: { items }
|
|
4721
|
+
}
|
|
4722
|
+
);
|
|
4554
4723
|
return client.parseWithSchema(
|
|
4555
4724
|
raw,
|
|
4556
4725
|
guardPainSignalListResponseSchema,
|
|
@@ -4558,10 +4727,14 @@ async function ingestGuardPainSignals(client, items) {
|
|
|
4558
4727
|
);
|
|
4559
4728
|
}
|
|
4560
4729
|
async function submitGuardReceipts(client, payload) {
|
|
4561
|
-
const raw = await
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4730
|
+
const raw = await requestPortalFirstJson(
|
|
4731
|
+
client,
|
|
4732
|
+
"/guard/receipts/submit",
|
|
4733
|
+
{
|
|
4734
|
+
method: "POST",
|
|
4735
|
+
body: payload
|
|
4736
|
+
}
|
|
4737
|
+
);
|
|
4565
4738
|
return client.parseWithSchema(
|
|
4566
4739
|
raw,
|
|
4567
4740
|
guardReceiptSyncResponseSchema,
|
|
@@ -4569,10 +4742,14 @@ async function submitGuardReceipts(client, payload) {
|
|
|
4569
4742
|
);
|
|
4570
4743
|
}
|
|
4571
4744
|
async function addGuardWatchlistItem(client, payload) {
|
|
4572
|
-
const raw = await
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4745
|
+
const raw = await requestPortalFirstJson(
|
|
4746
|
+
client,
|
|
4747
|
+
"/guard/watchlist",
|
|
4748
|
+
{
|
|
4749
|
+
method: "POST",
|
|
4750
|
+
body: payload
|
|
4751
|
+
}
|
|
4752
|
+
);
|
|
4576
4753
|
return client.parseWithSchema(
|
|
4577
4754
|
raw,
|
|
4578
4755
|
guardWatchlistResponseSchema,
|
|
@@ -4584,7 +4761,8 @@ async function removeGuardWatchlistItem(client, artifactId) {
|
|
|
4584
4761
|
if (!normalizedArtifactId) {
|
|
4585
4762
|
throw new Error("artifactId is required");
|
|
4586
4763
|
}
|
|
4587
|
-
const raw = await
|
|
4764
|
+
const raw = await requestPortalFirstJson(
|
|
4765
|
+
client,
|
|
4588
4766
|
`/guard/watchlist/${encodeURIComponent(normalizedArtifactId)}`,
|
|
4589
4767
|
{ method: "DELETE" }
|
|
4590
4768
|
);
|
|
@@ -4595,10 +4773,14 @@ async function removeGuardWatchlistItem(client, artifactId) {
|
|
|
4595
4773
|
);
|
|
4596
4774
|
}
|
|
4597
4775
|
async function addGuardException(client, payload) {
|
|
4598
|
-
const raw = await
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4776
|
+
const raw = await requestPortalFirstJson(
|
|
4777
|
+
client,
|
|
4778
|
+
"/guard/exceptions",
|
|
4779
|
+
{
|
|
4780
|
+
method: "POST",
|
|
4781
|
+
body: payload
|
|
4782
|
+
}
|
|
4783
|
+
);
|
|
4602
4784
|
return client.parseWithSchema(
|
|
4603
4785
|
raw,
|
|
4604
4786
|
guardExceptionListResponseSchema,
|
|
@@ -4606,10 +4788,14 @@ async function addGuardException(client, payload) {
|
|
|
4606
4788
|
);
|
|
4607
4789
|
}
|
|
4608
4790
|
async function requestGuardException(client, payload) {
|
|
4609
|
-
const raw = await
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4791
|
+
const raw = await requestPortalFirstJson(
|
|
4792
|
+
client,
|
|
4793
|
+
"/guard/exceptions/request",
|
|
4794
|
+
{
|
|
4795
|
+
method: "POST",
|
|
4796
|
+
body: payload
|
|
4797
|
+
}
|
|
4798
|
+
);
|
|
4613
4799
|
return client.parseWithSchema(
|
|
4614
4800
|
raw,
|
|
4615
4801
|
guardExceptionListResponseSchema,
|
|
@@ -4617,10 +4803,14 @@ async function requestGuardException(client, payload) {
|
|
|
4617
4803
|
);
|
|
4618
4804
|
}
|
|
4619
4805
|
async function syncGuardInventory(client, payload) {
|
|
4620
|
-
const raw = await
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4806
|
+
const raw = await requestPortalFirstJson(
|
|
4807
|
+
client,
|
|
4808
|
+
"/guard/inventory/sync",
|
|
4809
|
+
{
|
|
4810
|
+
method: "POST",
|
|
4811
|
+
body: payload
|
|
4812
|
+
}
|
|
4813
|
+
);
|
|
4624
4814
|
return client.parseWithSchema(
|
|
4625
4815
|
raw,
|
|
4626
4816
|
guardReceiptSyncResponseSchema,
|
|
@@ -4632,7 +4822,8 @@ async function removeGuardException(client, exceptionId) {
|
|
|
4632
4822
|
if (!normalizedExceptionId) {
|
|
4633
4823
|
throw new Error("exceptionId is required");
|
|
4634
4824
|
}
|
|
4635
|
-
const raw = await
|
|
4825
|
+
const raw = await requestPortalFirstJson(
|
|
4826
|
+
client,
|
|
4636
4827
|
`/guard/exceptions/${encodeURIComponent(normalizedExceptionId)}`,
|
|
4637
4828
|
{ method: "DELETE" }
|
|
4638
4829
|
);
|
|
@@ -4643,9 +4834,13 @@ async function removeGuardException(client, exceptionId) {
|
|
|
4643
4834
|
);
|
|
4644
4835
|
}
|
|
4645
4836
|
async function getGuardTeamPolicyPack(client) {
|
|
4646
|
-
const raw = await
|
|
4647
|
-
|
|
4648
|
-
|
|
4837
|
+
const raw = await requestPortalFirstJson(
|
|
4838
|
+
client,
|
|
4839
|
+
"/guard/team/policy-pack",
|
|
4840
|
+
{
|
|
4841
|
+
method: "GET"
|
|
4842
|
+
}
|
|
4843
|
+
);
|
|
4649
4844
|
return client.parseWithSchema(
|
|
4650
4845
|
raw,
|
|
4651
4846
|
guardTeamPolicyPackSchema,
|
|
@@ -4653,10 +4848,14 @@ async function getGuardTeamPolicyPack(client) {
|
|
|
4653
4848
|
);
|
|
4654
4849
|
}
|
|
4655
4850
|
async function updateGuardTeamPolicyPack(client, payload) {
|
|
4656
|
-
const raw = await
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4851
|
+
const raw = await requestPortalFirstJson(
|
|
4852
|
+
client,
|
|
4853
|
+
"/guard/team/policy-pack",
|
|
4854
|
+
{
|
|
4855
|
+
method: "PUT",
|
|
4856
|
+
body: payload
|
|
4857
|
+
}
|
|
4858
|
+
);
|
|
4660
4859
|
return client.parseWithSchema(
|
|
4661
4860
|
raw,
|
|
4662
4861
|
guardTeamPolicyPackSchema,
|
|
@@ -4664,10 +4863,14 @@ async function updateGuardTeamPolicyPack(client, payload) {
|
|
|
4664
4863
|
);
|
|
4665
4864
|
}
|
|
4666
4865
|
async function syncGuardReceipts(client, payload) {
|
|
4667
|
-
const raw = await
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4866
|
+
const raw = await requestPortalFirstJson(
|
|
4867
|
+
client,
|
|
4868
|
+
"/guard/receipts/sync",
|
|
4869
|
+
{
|
|
4870
|
+
method: "POST",
|
|
4871
|
+
body: payload
|
|
4872
|
+
}
|
|
4873
|
+
);
|
|
4671
4874
|
return client.parseWithSchema(
|
|
4672
4875
|
raw,
|
|
4673
4876
|
guardReceiptSyncResponseSchema,
|
|
@@ -6003,7 +6206,7 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
|
|
|
6003
6206
|
const normalisedPath = path.startsWith("/") ? path : `/${path}`;
|
|
6004
6207
|
return `${this.baseUrl}${normalisedPath}`;
|
|
6005
6208
|
}
|
|
6006
|
-
|
|
6209
|
+
buildRequestInit(config) {
|
|
6007
6210
|
const headers = new Headers();
|
|
6008
6211
|
Object.entries(this.defaultHeaders).forEach(([key, value]) => {
|
|
6009
6212
|
headers.set(key, value);
|
|
@@ -6029,6 +6232,10 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
|
|
|
6029
6232
|
headers.set("content-type", "application/json");
|
|
6030
6233
|
}
|
|
6031
6234
|
}
|
|
6235
|
+
return init;
|
|
6236
|
+
}
|
|
6237
|
+
async request(path, config) {
|
|
6238
|
+
const init = this.buildRequestInit(config);
|
|
6032
6239
|
const response = await this.fetchImpl(this.buildUrl(path), init);
|
|
6033
6240
|
if (response.ok) {
|
|
6034
6241
|
return response;
|
|
@@ -6040,6 +6247,19 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
|
|
|
6040
6247
|
body: errorBody
|
|
6041
6248
|
});
|
|
6042
6249
|
}
|
|
6250
|
+
async requestAbsolute(url, config) {
|
|
6251
|
+
const init = this.buildRequestInit(config);
|
|
6252
|
+
const response = await this.fetchImpl(url, init);
|
|
6253
|
+
if (response.ok) {
|
|
6254
|
+
return response;
|
|
6255
|
+
}
|
|
6256
|
+
const errorBody = await this.extractErrorBody(response);
|
|
6257
|
+
throw new RegistryBrokerError("Registry broker request failed", {
|
|
6258
|
+
status: response.status,
|
|
6259
|
+
statusText: response.statusText,
|
|
6260
|
+
body: errorBody
|
|
6261
|
+
});
|
|
6262
|
+
}
|
|
6043
6263
|
async requestJson(path, config) {
|
|
6044
6264
|
const response = await this.request(path, config);
|
|
6045
6265
|
const contentType = response.headers?.get("content-type") ?? "";
|
|
@@ -6052,6 +6272,18 @@ var RegistryBrokerClient = class _RegistryBrokerClient {
|
|
|
6052
6272
|
}
|
|
6053
6273
|
return await response.json();
|
|
6054
6274
|
}
|
|
6275
|
+
async requestAbsoluteJson(url, config) {
|
|
6276
|
+
const response = await this.requestAbsolute(url, config);
|
|
6277
|
+
const contentType = response.headers?.get("content-type") ?? "";
|
|
6278
|
+
if (!JSON_CONTENT_TYPE.test(contentType)) {
|
|
6279
|
+
const body = await response.text();
|
|
6280
|
+
throw new RegistryBrokerParseError(
|
|
6281
|
+
"Expected JSON response from registry broker",
|
|
6282
|
+
body
|
|
6283
|
+
);
|
|
6284
|
+
}
|
|
6285
|
+
return await response.json();
|
|
6286
|
+
}
|
|
6055
6287
|
async getAgentFeedback(uaid, options = {}) {
|
|
6056
6288
|
const normalized = uaid.trim();
|
|
6057
6289
|
if (!normalized) {
|
|
@@ -6977,6 +7209,10 @@ var isPendingRegisterAgentResponse = (response) => response.status === "pending"
|
|
|
6977
7209
|
var isPartialRegisterAgentResponse = (response) => response.status === "partial" && response.success === false;
|
|
6978
7210
|
var isSuccessRegisterAgentResponse = (response) => response.success === true && response.status !== "pending";
|
|
6979
7211
|
|
|
7212
|
+
// ../../src/services/registry-broker/types.ts
|
|
7213
|
+
var GUARD_CANONICAL_PATH_PREFIX = "/api/guard";
|
|
7214
|
+
var GUARD_COMPAT_PATH_PREFIX = "/guard";
|
|
7215
|
+
|
|
6980
7216
|
// ../../src/services/registry-broker/hol-chat-ops.ts
|
|
6981
7217
|
var HOL_CHAT_PROTOCOL_ID = "hol-chat";
|
|
6982
7218
|
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
@@ -7033,6 +7269,8 @@ var buildJobStatusMessage = (input) => JSON.stringify({
|
|
|
7033
7269
|
data: { job_id: input.jobId }
|
|
7034
7270
|
});
|
|
7035
7271
|
export {
|
|
7272
|
+
GUARD_CANONICAL_PATH_PREFIX,
|
|
7273
|
+
GUARD_COMPAT_PATH_PREFIX,
|
|
7036
7274
|
HOL_CHAT_PROTOCOL_ID,
|
|
7037
7275
|
RegistryBrokerClient,
|
|
7038
7276
|
RegistryBrokerError,
|