@vectros-ai/mcp-server 0.7.0 → 0.10.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/CHANGELOG.md +101 -0
- package/README.md +41 -3
- package/dist/cli-http.js +513 -528
- package/dist/cli-http.js.map +1 -1
- package/dist/cli-http.mjs +513 -528
- package/dist/cli-http.mjs.map +1 -1
- package/dist/cli.js +513 -528
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +513 -528
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +376 -525
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +376 -525
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/cli-http.js
CHANGED
|
@@ -26,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
// src/server.ts
|
|
27
27
|
var import_server = require("@modelcontextprotocol/sdk/server/index.js");
|
|
28
28
|
|
|
29
|
-
//
|
|
29
|
+
// node_modules/@vectros-ai/sdk/dist/index.mjs
|
|
30
30
|
var __defProp2 = Object.defineProperty;
|
|
31
31
|
var __export = (target, all) => {
|
|
32
32
|
for (var name in all)
|
|
@@ -41,7 +41,6 @@ __export(api_exports, {
|
|
|
41
41
|
BatchWriteRequest: () => BatchWriteRequest,
|
|
42
42
|
BatchWriteResult: () => BatchWriteResult,
|
|
43
43
|
ChatMessage: () => ChatMessage,
|
|
44
|
-
ClientRequest: () => ClientRequest,
|
|
45
44
|
ConflictError: () => ConflictError,
|
|
46
45
|
ContentDeltaEvent: () => ContentDeltaEvent,
|
|
47
46
|
ContentTooLargeError: () => ContentTooLargeError,
|
|
@@ -50,6 +49,7 @@ __export(api_exports, {
|
|
|
50
49
|
DocumentRequest: () => DocumentRequest,
|
|
51
50
|
DocumentResponse: () => DocumentResponse,
|
|
52
51
|
DoneEvent: () => DoneEvent,
|
|
52
|
+
EntityRequest: () => EntityRequest,
|
|
53
53
|
ErasureCertificate: () => ErasureCertificate,
|
|
54
54
|
ErasureRequest: () => ErasureRequest,
|
|
55
55
|
ErasureRequestResponse: () => ErasureRequestResponse,
|
|
@@ -62,15 +62,13 @@ __export(api_exports, {
|
|
|
62
62
|
ForbiddenError: () => ForbiddenError,
|
|
63
63
|
IdentityLookupRequest: () => IdentityLookupRequest,
|
|
64
64
|
InternalServerError: () => InternalServerError,
|
|
65
|
-
|
|
66
|
-
ListOrgsRequestOrder: () => ListOrgsRequestOrder,
|
|
65
|
+
ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
|
|
67
66
|
ListUsersRequestOrder: () => ListUsersRequestOrder,
|
|
68
67
|
LookupDocumentsRequestOrder: () => LookupDocumentsRequestOrder,
|
|
69
68
|
LookupRecordsRequestOrder: () => LookupRecordsRequestOrder,
|
|
70
69
|
ModelDataVersionResponse: () => ModelDataVersionResponse,
|
|
71
70
|
NotFoundError: () => NotFoundError,
|
|
72
71
|
NotImplementedError: () => NotImplementedError,
|
|
73
|
-
OrgRequest: () => OrgRequest,
|
|
74
72
|
PaymentRequiredError: () => PaymentRequiredError,
|
|
75
73
|
PingResponse: () => PingResponse,
|
|
76
74
|
RagSearch: () => RagSearch,
|
|
@@ -311,11 +309,6 @@ var UnauthorizedError = class extends VectrosError {
|
|
|
311
309
|
var auth_exports = {};
|
|
312
310
|
var ErasureRequest;
|
|
313
311
|
((ErasureRequest2) => {
|
|
314
|
-
ErasureRequest2.SubjectType = {
|
|
315
|
-
User: "user",
|
|
316
|
-
Client: "client",
|
|
317
|
-
Org: "org"
|
|
318
|
-
};
|
|
319
312
|
ErasureRequest2.AuditDisposition = {
|
|
320
313
|
RetainRedacted: "retain-redacted",
|
|
321
314
|
Purge: "purge"
|
|
@@ -327,11 +320,6 @@ var ExportRequest;
|
|
|
327
320
|
Tenant: "tenant",
|
|
328
321
|
Subject: "subject"
|
|
329
322
|
};
|
|
330
|
-
ExportRequest2.SubjectType = {
|
|
331
|
-
User: "user",
|
|
332
|
-
Client: "client",
|
|
333
|
-
Org: "org"
|
|
334
|
-
};
|
|
335
323
|
ExportRequest2.Format = {
|
|
336
324
|
Ndjson: "ndjson"
|
|
337
325
|
};
|
|
@@ -370,15 +358,10 @@ var LookupDocumentsRequestOrder = {
|
|
|
370
358
|
var folders_exports = {};
|
|
371
359
|
var identity_exports = {};
|
|
372
360
|
__export(identity_exports, {
|
|
373
|
-
|
|
374
|
-
ListOrgsRequestOrder: () => ListOrgsRequestOrder,
|
|
361
|
+
ListEntitiesRequestOrder: () => ListEntitiesRequestOrder,
|
|
375
362
|
ListUsersRequestOrder: () => ListUsersRequestOrder
|
|
376
363
|
});
|
|
377
|
-
var
|
|
378
|
-
Asc: "asc",
|
|
379
|
-
Desc: "desc"
|
|
380
|
-
};
|
|
381
|
-
var ListOrgsRequestOrder = {
|
|
364
|
+
var ListEntitiesRequestOrder = {
|
|
382
365
|
Asc: "asc",
|
|
383
366
|
Desc: "desc"
|
|
384
367
|
};
|
|
@@ -477,13 +460,6 @@ var ChatMessage;
|
|
|
477
460
|
Assistant: "assistant"
|
|
478
461
|
};
|
|
479
462
|
})(ChatMessage || (ChatMessage = {}));
|
|
480
|
-
var ClientRequest;
|
|
481
|
-
((ClientRequest2) => {
|
|
482
|
-
ClientRequest2.Status = {
|
|
483
|
-
Active: "ACTIVE",
|
|
484
|
-
Suspended: "SUSPENDED"
|
|
485
|
-
};
|
|
486
|
-
})(ClientRequest || (ClientRequest = {}));
|
|
487
463
|
var ContentDeltaEvent;
|
|
488
464
|
((ContentDeltaEvent2) => {
|
|
489
465
|
ContentDeltaEvent2.Event = {
|
|
@@ -538,6 +514,13 @@ var DoneEvent;
|
|
|
538
514
|
Done: "done"
|
|
539
515
|
};
|
|
540
516
|
})(DoneEvent || (DoneEvent = {}));
|
|
517
|
+
var EntityRequest;
|
|
518
|
+
((EntityRequest2) => {
|
|
519
|
+
EntityRequest2.Status = {
|
|
520
|
+
Active: "ACTIVE",
|
|
521
|
+
Suspended: "SUSPENDED"
|
|
522
|
+
};
|
|
523
|
+
})(EntityRequest || (EntityRequest = {}));
|
|
541
524
|
var ErasureCertificate;
|
|
542
525
|
((ErasureCertificate2) => {
|
|
543
526
|
ErasureCertificate2.AuditDisposition = {
|
|
@@ -553,11 +536,6 @@ var ErasureRequestResponse;
|
|
|
553
536
|
Completed: "completed",
|
|
554
537
|
Failed: "failed"
|
|
555
538
|
};
|
|
556
|
-
ErasureRequestResponse2.SubjectType = {
|
|
557
|
-
User: "user",
|
|
558
|
-
Client: "client",
|
|
559
|
-
Org: "org"
|
|
560
|
-
};
|
|
561
539
|
})(ErasureRequestResponse || (ErasureRequestResponse = {}));
|
|
562
540
|
var ErrorEvent;
|
|
563
541
|
((ErrorEvent2) => {
|
|
@@ -583,11 +561,6 @@ var ExportRequestResponse;
|
|
|
583
561
|
Tenant: "tenant",
|
|
584
562
|
Subject: "subject"
|
|
585
563
|
};
|
|
586
|
-
ExportRequestResponse2.SubjectType = {
|
|
587
|
-
User: "user",
|
|
588
|
-
Client: "client",
|
|
589
|
-
Org: "org"
|
|
590
|
-
};
|
|
591
564
|
})(ExportRequestResponse || (ExportRequestResponse = {}));
|
|
592
565
|
var FieldDef;
|
|
593
566
|
((FieldDef2) => {
|
|
@@ -601,13 +574,6 @@ var FieldDef;
|
|
|
601
574
|
Object: "object",
|
|
602
575
|
Reference: "reference"
|
|
603
576
|
};
|
|
604
|
-
FieldDef2.TargetSurface = {
|
|
605
|
-
Record: "record",
|
|
606
|
-
Document: "document",
|
|
607
|
-
User: "user",
|
|
608
|
-
Org: "org",
|
|
609
|
-
Client: "client"
|
|
610
|
-
};
|
|
611
577
|
})(FieldDef || (FieldDef = {}));
|
|
612
578
|
var IdentityLookupRequest;
|
|
613
579
|
((IdentityLookupRequest2) => {
|
|
@@ -624,13 +590,6 @@ var ModelDataVersionResponse;
|
|
|
624
590
|
Delete: "DELETE"
|
|
625
591
|
};
|
|
626
592
|
})(ModelDataVersionResponse || (ModelDataVersionResponse = {}));
|
|
627
|
-
var OrgRequest;
|
|
628
|
-
((OrgRequest2) => {
|
|
629
|
-
OrgRequest2.Status = {
|
|
630
|
-
Active: "ACTIVE",
|
|
631
|
-
Suspended: "SUSPENDED"
|
|
632
|
-
};
|
|
633
|
-
})(OrgRequest || (OrgRequest = {}));
|
|
634
593
|
var PingResponse;
|
|
635
594
|
((PingResponse2) => {
|
|
636
595
|
PingResponse2.Environment = {
|
|
@@ -660,11 +619,6 @@ var RagSearch;
|
|
|
660
619
|
})(RagSearch || (RagSearch = {}));
|
|
661
620
|
var ReadAccessLogResponse;
|
|
662
621
|
((ReadAccessLogResponse2) => {
|
|
663
|
-
ReadAccessLogResponse2.SubjectType = {
|
|
664
|
-
User: "user",
|
|
665
|
-
Client: "client",
|
|
666
|
-
Org: "org"
|
|
667
|
-
};
|
|
668
622
|
ReadAccessLogResponse2.Action = {
|
|
669
623
|
Read: "read",
|
|
670
624
|
List: "list",
|
|
@@ -675,6 +629,10 @@ var ReadAccessLogResponse;
|
|
|
675
629
|
})(ReadAccessLogResponse || (ReadAccessLogResponse = {}));
|
|
676
630
|
var RecordRequest;
|
|
677
631
|
((RecordRequest2) => {
|
|
632
|
+
RecordRequest2.Status = {
|
|
633
|
+
Active: "ACTIVE",
|
|
634
|
+
Archived: "ARCHIVED"
|
|
635
|
+
};
|
|
678
636
|
RecordRequest2.IndexMode = {
|
|
679
637
|
Hybrid: "HYBRID",
|
|
680
638
|
Semantic: "SEMANTIC",
|
|
@@ -684,6 +642,10 @@ var RecordRequest;
|
|
|
684
642
|
})(RecordRequest || (RecordRequest = {}));
|
|
685
643
|
var RecordResponse;
|
|
686
644
|
((RecordResponse2) => {
|
|
645
|
+
RecordResponse2.Status = {
|
|
646
|
+
Active: "ACTIVE",
|
|
647
|
+
Archived: "ARCHIVED"
|
|
648
|
+
};
|
|
687
649
|
RecordResponse2.IndexStatus = {
|
|
688
650
|
PendingIndex: "PENDING_INDEX",
|
|
689
651
|
Indexed: "INDEXED",
|
|
@@ -726,8 +688,7 @@ var SchemaRequest;
|
|
|
726
688
|
Record: "record",
|
|
727
689
|
Document: "document",
|
|
728
690
|
User: "user",
|
|
729
|
-
|
|
730
|
-
Client: "client"
|
|
691
|
+
Entity: "entity"
|
|
731
692
|
};
|
|
732
693
|
})(AllowedSurfaces = SchemaRequest2.AllowedSurfaces || (SchemaRequest2.AllowedSurfaces = {}));
|
|
733
694
|
})(SchemaRequest || (SchemaRequest = {}));
|
|
@@ -750,8 +711,7 @@ var SchemaResponse;
|
|
|
750
711
|
Record: "record",
|
|
751
712
|
Document: "document",
|
|
752
713
|
User: "user",
|
|
753
|
-
|
|
754
|
-
Client: "client"
|
|
714
|
+
Entity: "entity"
|
|
755
715
|
};
|
|
756
716
|
})(AllowedSurfaces = SchemaResponse2.AllowedSurfaces || (SchemaResponse2.AllowedSurfaces = {}));
|
|
757
717
|
})(SchemaResponse || (SchemaResponse = {}));
|
|
@@ -2306,7 +2266,7 @@ function withNoOpAuthProvider(options) {
|
|
|
2306
2266
|
authProvider: new NoOpAuthProvider()
|
|
2307
2267
|
};
|
|
2308
2268
|
}
|
|
2309
|
-
function handleNonStatusCodeError(error, rawResponse, method,
|
|
2269
|
+
function handleNonStatusCodeError(error, rawResponse, method, path2) {
|
|
2310
2270
|
switch (error.reason) {
|
|
2311
2271
|
case "non-json":
|
|
2312
2272
|
throw new VectrosError({
|
|
@@ -2320,7 +2280,7 @@ function handleNonStatusCodeError(error, rawResponse, method, path) {
|
|
|
2320
2280
|
rawResponse
|
|
2321
2281
|
});
|
|
2322
2282
|
case "timeout":
|
|
2323
|
-
throw new VectrosTimeoutError(`Timeout exceeded when calling ${method} ${
|
|
2283
|
+
throw new VectrosTimeoutError(`Timeout exceeded when calling ${method} ${path2}.`, {
|
|
2324
2284
|
cause: error.cause
|
|
2325
2285
|
});
|
|
2326
2286
|
case "unknown":
|
|
@@ -2392,7 +2352,7 @@ var AuthClient = class {
|
|
|
2392
2352
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/auth/jwks");
|
|
2393
2353
|
}
|
|
2394
2354
|
/**
|
|
2395
|
-
* Returns a page of per-subject PHI read-access rows: who read which subject's PHI, when, against which record, and whether any sensitive value was actually revealed in plaintext. Metadata only — never the PHI itself. This is the disclosure-accounting surface from which a covered entity derives its HIPAA §164.528 accounting of disclosures. Provide at least one query axis: a subject (`subjectType` + `subjectId
|
|
2355
|
+
* Returns a page of per-subject PHI read-access rows: who read which subject's PHI, when, against which record, and whether any sensitive value was actually revealed in plaintext. Metadata only — never the PHI itself. This is the disclosure-accounting surface from which a covered entity derives its HIPAA §164.528 accounting of disclosures. Provide at least one query axis: a subject (`subjectType` + `subjectId`) within a `contextId` for the primary accounting query; `resourceId` within a `contextId` for 'who read this record'; `callerKeyId` for 'what did this credential read' (account-wide forensic); or `contextId` alone to enumerate a whole context. `from`/`to` bound the time window. Results are scoped to your account, derived from your token — never from input. Requires the `access-log:r` scope.
|
|
2396
2356
|
*
|
|
2397
2357
|
* @param {Vectros.GetAccessLogRequest} request
|
|
2398
2358
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -2405,7 +2365,6 @@ var AuthClient = class {
|
|
|
2405
2365
|
* subjectType: "user",
|
|
2406
2366
|
* subjectId: "user_abc123",
|
|
2407
2367
|
* contextId: "ctx_intake",
|
|
2408
|
-
* clientId: "client_xyz789",
|
|
2409
2368
|
* action: "read",
|
|
2410
2369
|
* callerKeyId: "key_abc123",
|
|
2411
2370
|
* resourceType: "intake_form",
|
|
@@ -2420,7 +2379,6 @@ var AuthClient = class {
|
|
|
2420
2379
|
subjectType,
|
|
2421
2380
|
subjectId,
|
|
2422
2381
|
contextId,
|
|
2423
|
-
clientId,
|
|
2424
2382
|
from: from_,
|
|
2425
2383
|
to,
|
|
2426
2384
|
action,
|
|
@@ -2435,7 +2393,6 @@ var AuthClient = class {
|
|
|
2435
2393
|
subjectType,
|
|
2436
2394
|
subjectId,
|
|
2437
2395
|
contextId,
|
|
2438
|
-
clientId,
|
|
2439
2396
|
from: from_,
|
|
2440
2397
|
to,
|
|
2441
2398
|
action,
|
|
@@ -2869,7 +2826,7 @@ var AuthClient = class {
|
|
|
2869
2826
|
);
|
|
2870
2827
|
}
|
|
2871
2828
|
/**
|
|
2872
|
-
* Creates a new access profile under the given app context. This call is idempotent by `principalId`: if a profile with the same `principalId` already exists, the existing profile is returned (with status 200) instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing profile was returned) tells the two apart. To overwrite an existing profile's `scopes`/`roleId`, `identityOverrides`, and `status` instead of returning it unchanged, set `?upsert=true` (this also requires the `profiles:u` scope). You must provide exactly one of `scopes` (an inline list of scopes) or `roleId` (a reference to a role); supplying both, or neither, is rejected. `identityOverrides`
|
|
2829
|
+
* Creates a new access profile under the given app context. This call is idempotent by `principalId`: if a profile with the same `principalId` already exists, the existing profile is returned (with status 200) instead of creating a duplicate. The response's `created` field (and the HTTP status — 201 when created, 200 when an existing profile was returned) tells the two apart. To overwrite an existing profile's `scopes`/`roleId`, `identityOverrides`, and `status` instead of returning it unchanged, set `?upsert=true` (this also requires the `profiles:u` scope). You must provide exactly one of `scopes` (an inline list of scopes) or `roleId` (a reference to a role); supplying both, or neither, is rejected. `identityOverrides` is keyed by ownership namespace in `scope:<namespace>` form — `scope:org` and `scope:client` for the reserved namespaces, or any namespace you have registered — and may name at most two; any other key (including the account identifier or `userId`) is rejected. If you use a scoped credential, the profile's effective scopes may not exceed your own; a root API key (`sk_`) is exempt. Requires the `profiles:c` scope.
|
|
2873
2830
|
*
|
|
2874
2831
|
* @param {Vectros.CreateAccessProfileRequest} request
|
|
2875
2832
|
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -3158,7 +3115,7 @@ var AuthClient = class {
|
|
|
3158
3115
|
* roleId: "engineering-member",
|
|
3159
3116
|
* name: "Engineering Team Member",
|
|
3160
3117
|
* scopes: [{
|
|
3161
|
-
* allowed_actions: ["
|
|
3118
|
+
* allowed_actions: ["records:cru", "search:r"]
|
|
3162
3119
|
* }]
|
|
3163
3120
|
* }
|
|
3164
3121
|
* })
|
|
@@ -3706,7 +3663,7 @@ var AuthClient = class {
|
|
|
3706
3663
|
* roleId: "engineering-member",
|
|
3707
3664
|
* name: "Engineering Team Member",
|
|
3708
3665
|
* scopes: [{
|
|
3709
|
-
* allowed_actions: ["
|
|
3666
|
+
* allowed_actions: ["records:cru", "search:r"]
|
|
3710
3667
|
* }]
|
|
3711
3668
|
* }
|
|
3712
3669
|
* })
|
|
@@ -4159,7 +4116,7 @@ var AuthClient = class {
|
|
|
4159
4116
|
* "userId": "550e8400-e29b-41d4-a716-446655440000"
|
|
4160
4117
|
* },
|
|
4161
4118
|
* dataScope: {
|
|
4162
|
-
* "
|
|
4119
|
+
* "scope:org": ["6ba7b810-9dad-11d1-80b4-00c04fd430c8"]
|
|
4163
4120
|
* }
|
|
4164
4121
|
* },
|
|
4165
4122
|
* expiresInSeconds: 3600
|
|
@@ -4609,7 +4566,7 @@ var DocumentsClient = class {
|
|
|
4609
4566
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
4610
4567
|
}
|
|
4611
4568
|
/**
|
|
4612
|
-
* Returns a paginated list of your documents, optionally filtered by folder (`folderId`) and/or owner (`userId
|
|
4569
|
+
* Returns a paginated list of your documents, optionally filtered by folder (`folderId`) and/or owner (`userId` or `scope`). The response is a `{data, nextCursor}` envelope; pass `nextCursor` back as `startFrom` to fetch the next page. Requires the `documents:r` scope.
|
|
4613
4570
|
*
|
|
4614
4571
|
* @param {Vectros.ListDocumentsRequest} request
|
|
4615
4572
|
* @param {DocumentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -4617,8 +4574,7 @@ var DocumentsClient = class {
|
|
|
4617
4574
|
* @example
|
|
4618
4575
|
* await client.documents.listDocuments({
|
|
4619
4576
|
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
4620
|
-
*
|
|
4621
|
-
* clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
4577
|
+
* scope: "group:eng-team",
|
|
4622
4578
|
* folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
4623
4579
|
* startFrom: "doc_prev123"
|
|
4624
4580
|
* })
|
|
@@ -4627,11 +4583,10 @@ var DocumentsClient = class {
|
|
|
4627
4583
|
return HttpResponsePromise.fromPromise(this.__listDocuments(request, requestOptions));
|
|
4628
4584
|
}
|
|
4629
4585
|
async __listDocuments(request = {}, requestOptions) {
|
|
4630
|
-
const { userId,
|
|
4586
|
+
const { userId, scope, folderId, startFrom, limit } = request;
|
|
4631
4587
|
const _queryParams = {
|
|
4632
4588
|
userId,
|
|
4633
|
-
|
|
4634
|
-
clientId,
|
|
4589
|
+
scope,
|
|
4635
4590
|
folderId,
|
|
4636
4591
|
startFrom,
|
|
4637
4592
|
limit
|
|
@@ -4689,9 +4644,10 @@ var DocumentsClient = class {
|
|
|
4689
4644
|
return HttpResponsePromise.fromPromise(this.__ingestDocument(request, requestOptions));
|
|
4690
4645
|
}
|
|
4691
4646
|
async __ingestDocument(request, requestOptions) {
|
|
4692
|
-
const { upsert, body: _body } = request;
|
|
4647
|
+
const { upsert, allowClear, body: _body } = request;
|
|
4693
4648
|
const _queryParams = {
|
|
4694
|
-
upsert
|
|
4649
|
+
upsert,
|
|
4650
|
+
allowClear
|
|
4695
4651
|
};
|
|
4696
4652
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
4697
4653
|
const _headers = mergeHeaders(
|
|
@@ -4815,7 +4771,10 @@ var DocumentsClient = class {
|
|
|
4815
4771
|
return HttpResponsePromise.fromPromise(this.__updateDocument(request, requestOptions));
|
|
4816
4772
|
}
|
|
4817
4773
|
async __updateDocument(request, requestOptions) {
|
|
4818
|
-
const { id, body: _body } = request;
|
|
4774
|
+
const { id, allowClear, body: _body } = request;
|
|
4775
|
+
const _queryParams = {
|
|
4776
|
+
allowClear
|
|
4777
|
+
};
|
|
4819
4778
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
4820
4779
|
const _headers = mergeHeaders(
|
|
4821
4780
|
_authRequest.headers,
|
|
@@ -4830,7 +4789,7 @@ var DocumentsClient = class {
|
|
|
4830
4789
|
method: "PUT",
|
|
4831
4790
|
headers: _headers,
|
|
4832
4791
|
contentType: "application/json",
|
|
4833
|
-
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
4792
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
4834
4793
|
requestType: "json",
|
|
4835
4794
|
body: _body,
|
|
4836
4795
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
@@ -5359,7 +5318,7 @@ var FoldersClient = class {
|
|
|
5359
5318
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
5360
5319
|
}
|
|
5361
5320
|
/**
|
|
5362
|
-
* Returns a paginated list of your folders. Pass `parentFolderId` to list the direct children of a specific folder (tree navigation); omit it for a flat list across your account. You can also filter by owner using `userId
|
|
5321
|
+
* Returns a paginated list of your folders. Pass `parentFolderId` to list the direct children of a specific folder (tree navigation); omit it for a flat list across your account. You can also filter by owner using `userId` or `scope`. Results are returned as a `{data, nextCursor}` envelope — pass `nextCursor` as `startFrom` to fetch the next page. Requires the `folders:r` scope.
|
|
5363
5322
|
*
|
|
5364
5323
|
* @param {Vectros.ListFoldersRequest} request
|
|
5365
5324
|
* @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5367,9 +5326,8 @@ var FoldersClient = class {
|
|
|
5367
5326
|
* @example
|
|
5368
5327
|
* await client.folders.listFolders({
|
|
5369
5328
|
* parentFolderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
5370
|
-
* orgId: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
|
|
5371
5329
|
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
5372
|
-
*
|
|
5330
|
+
* scope: "group:eng-team",
|
|
5373
5331
|
* startFrom: "fld_prev123"
|
|
5374
5332
|
* })
|
|
5375
5333
|
*/
|
|
@@ -5377,12 +5335,11 @@ var FoldersClient = class {
|
|
|
5377
5335
|
return HttpResponsePromise.fromPromise(this.__listFolders(request, requestOptions));
|
|
5378
5336
|
}
|
|
5379
5337
|
async __listFolders(request = {}, requestOptions) {
|
|
5380
|
-
const { parentFolderId,
|
|
5338
|
+
const { parentFolderId, userId, scope, startFrom, limit } = request;
|
|
5381
5339
|
const _queryParams = {
|
|
5382
5340
|
parentFolderId,
|
|
5383
|
-
orgId,
|
|
5384
5341
|
userId,
|
|
5385
|
-
|
|
5342
|
+
scope,
|
|
5386
5343
|
startFrom,
|
|
5387
5344
|
limit
|
|
5388
5345
|
};
|
|
@@ -5668,7 +5625,7 @@ var FoldersClient = class {
|
|
|
5668
5625
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/folders/{id}");
|
|
5669
5626
|
}
|
|
5670
5627
|
/**
|
|
5671
|
-
* Partially updates a folder using an RFC 7386 JSON Merge Patch. The `name`, `description`, and ownership fields (`userId`, `
|
|
5628
|
+
* Partially updates a folder using an RFC 7386 JSON Merge Patch. The `name`, `description`, and ownership fields (`userId`, `scopes`) are applied when present and left unchanged when omitted; sending any of these as null is rejected, because clearing a field is not supported in this release (omit it instead). `slug` and `parentFolderId` are immutable — a folder cannot be re-slugged or moved via the API — and the request is rejected if either is present. Pass `expectedVersion` for optimistic concurrency (you get a 409 if the folder changed since you last read it). Requires the `folders:u` scope.
|
|
5672
5629
|
*
|
|
5673
5630
|
* @param {Vectros.PatchFolderRequest} request
|
|
5674
5631
|
* @param {FoldersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -5801,54 +5758,48 @@ var IdentityClient = class {
|
|
|
5801
5758
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
5802
5759
|
}
|
|
5803
5760
|
/**
|
|
5804
|
-
* Returns a paginated list of
|
|
5761
|
+
* Returns a paginated list of entities in a namespace. Filter by `userId` (entities owned by a user), by `externalId` (exact lookup by your own identifier), or by `scope` (`scope=<namespace>:<value>` — entities that have that value as a parent, e.g. `scope=org:6ba7...`). Naming this namespace's own name in `scope` resolves the entity itself (`scope=team:6ba7...` on `/v1/entities/team` returns that team), since an entity is always in its own scope. `userId` and `scope` can be combined to narrow on both dimensions at once; `externalId` identifies a single entity and cannot be combined with either. Requires the `entities:r:<namespace>` scope.
|
|
5805
5762
|
*
|
|
5806
|
-
* @param {Vectros.
|
|
5763
|
+
* @param {Vectros.ListEntitiesRequest} request
|
|
5807
5764
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
5808
5765
|
*
|
|
5809
5766
|
* @example
|
|
5810
|
-
* await client.identity.
|
|
5811
|
-
*
|
|
5812
|
-
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
5813
|
-
* externalId: "patient_789",
|
|
5814
|
-
* startFrom: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
5815
|
-
* type: "client_v1",
|
|
5816
|
-
* field: "industry",
|
|
5817
|
-
* value: "healthcare",
|
|
5818
|
-
* prefix: "health"
|
|
5767
|
+
* await client.identity.listEntities({
|
|
5768
|
+
* namespace: "team"
|
|
5819
5769
|
* })
|
|
5820
5770
|
*/
|
|
5821
|
-
|
|
5822
|
-
return HttpResponsePromise.fromPromise(this.
|
|
5771
|
+
listEntities(request, requestOptions) {
|
|
5772
|
+
return HttpResponsePromise.fromPromise(this.__listEntities(request, requestOptions));
|
|
5823
5773
|
}
|
|
5824
|
-
async
|
|
5774
|
+
async __listEntities(request, requestOptions) {
|
|
5825
5775
|
const {
|
|
5826
|
-
|
|
5776
|
+
namespace,
|
|
5827
5777
|
userId,
|
|
5828
5778
|
externalId,
|
|
5829
|
-
|
|
5830
|
-
limit,
|
|
5779
|
+
scope,
|
|
5831
5780
|
type: type_,
|
|
5832
5781
|
field,
|
|
5833
5782
|
value,
|
|
5834
5783
|
from: from_,
|
|
5835
5784
|
to,
|
|
5836
5785
|
prefix,
|
|
5837
|
-
order
|
|
5786
|
+
order,
|
|
5787
|
+
startFrom,
|
|
5788
|
+
limit
|
|
5838
5789
|
} = request;
|
|
5839
5790
|
const _queryParams = {
|
|
5840
|
-
orgId,
|
|
5841
5791
|
userId,
|
|
5842
5792
|
externalId,
|
|
5843
|
-
|
|
5844
|
-
limit,
|
|
5793
|
+
scope,
|
|
5845
5794
|
type: type_,
|
|
5846
5795
|
field,
|
|
5847
5796
|
value,
|
|
5848
5797
|
from: from_,
|
|
5849
5798
|
to,
|
|
5850
5799
|
prefix,
|
|
5851
|
-
order: order != null ? order : void 0
|
|
5800
|
+
order: order != null ? order : void 0,
|
|
5801
|
+
startFrom,
|
|
5802
|
+
limit
|
|
5852
5803
|
};
|
|
5853
5804
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
5854
5805
|
const _headers = mergeHeaders(
|
|
@@ -5859,7 +5810,7 @@ var IdentityClient = class {
|
|
|
5859
5810
|
const _response = await fetcher({
|
|
5860
5811
|
url: url_exports.join(
|
|
5861
5812
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
5862
|
-
|
|
5813
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}`
|
|
5863
5814
|
),
|
|
5864
5815
|
method: "GET",
|
|
5865
5816
|
headers: _headers,
|
|
@@ -5880,12 +5831,12 @@ var IdentityClient = class {
|
|
|
5880
5831
|
rawResponse: _response.rawResponse
|
|
5881
5832
|
});
|
|
5882
5833
|
}
|
|
5883
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/
|
|
5834
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}");
|
|
5884
5835
|
}
|
|
5885
5836
|
/**
|
|
5886
|
-
* Creates a new
|
|
5837
|
+
* Creates a new entity in the given namespace. This call is idempotent on `externalId` within the namespace: if an entity with the same `externalId` already exists, the existing record is returned instead of creating a duplicate (`created: false`, HTTP 200). To overwrite an existing entity's content instead of returning it unchanged, set `?upsert=true` (also requires the `entities:u:<namespace>` scope). The namespace must be entity-backed (`org`/`client`, or registered via `POST /v1/namespaces`). Requires the `entities:c:<namespace>` scope.
|
|
5887
5838
|
*
|
|
5888
|
-
* @param {Vectros.
|
|
5839
|
+
* @param {Vectros.CreateEntityRequest} request
|
|
5889
5840
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
5890
5841
|
*
|
|
5891
5842
|
* @throws {@link Vectros.BadRequestError}
|
|
@@ -5893,17 +5844,18 @@ var IdentityClient = class {
|
|
|
5893
5844
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
5894
5845
|
*
|
|
5895
5846
|
* @example
|
|
5896
|
-
* await client.identity.
|
|
5847
|
+
* await client.identity.createEntity({
|
|
5848
|
+
* namespace: "team",
|
|
5897
5849
|
* body: {
|
|
5898
|
-
* externalId: "
|
|
5850
|
+
* externalId: "team_eng_platform"
|
|
5899
5851
|
* }
|
|
5900
5852
|
* })
|
|
5901
5853
|
*/
|
|
5902
|
-
|
|
5903
|
-
return HttpResponsePromise.fromPromise(this.
|
|
5854
|
+
createEntity(request, requestOptions) {
|
|
5855
|
+
return HttpResponsePromise.fromPromise(this.__createEntity(request, requestOptions));
|
|
5904
5856
|
}
|
|
5905
|
-
async
|
|
5906
|
-
const { upsert, body: _body } = request;
|
|
5857
|
+
async __createEntity(request, requestOptions) {
|
|
5858
|
+
const { namespace, upsert, body: _body } = request;
|
|
5907
5859
|
const _queryParams = {
|
|
5908
5860
|
upsert
|
|
5909
5861
|
};
|
|
@@ -5916,7 +5868,7 @@ var IdentityClient = class {
|
|
|
5916
5868
|
const _response = await fetcher({
|
|
5917
5869
|
url: url_exports.join(
|
|
5918
5870
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
5919
|
-
|
|
5871
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}`
|
|
5920
5872
|
),
|
|
5921
5873
|
method: "POST",
|
|
5922
5874
|
headers: _headers,
|
|
@@ -5949,26 +5901,27 @@ var IdentityClient = class {
|
|
|
5949
5901
|
});
|
|
5950
5902
|
}
|
|
5951
5903
|
}
|
|
5952
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/
|
|
5904
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/entities/{namespace}");
|
|
5953
5905
|
}
|
|
5954
5906
|
/**
|
|
5955
|
-
*
|
|
5907
|
+
* Retrieves a single entity by its namespace and Vectros-assigned ID. Requires the `entities:r:<namespace>` scope.
|
|
5956
5908
|
*
|
|
5957
|
-
* @param {Vectros.
|
|
5909
|
+
* @param {Vectros.GetEntityRequest} request
|
|
5958
5910
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
5959
5911
|
*
|
|
5960
5912
|
* @throws {@link Vectros.NotFoundError}
|
|
5961
5913
|
*
|
|
5962
5914
|
* @example
|
|
5963
|
-
* await client.identity.
|
|
5964
|
-
*
|
|
5915
|
+
* await client.identity.getEntity({
|
|
5916
|
+
* namespace: "team",
|
|
5917
|
+
* id: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
|
|
5965
5918
|
* })
|
|
5966
5919
|
*/
|
|
5967
|
-
|
|
5968
|
-
return HttpResponsePromise.fromPromise(this.
|
|
5920
|
+
getEntity(request, requestOptions) {
|
|
5921
|
+
return HttpResponsePromise.fromPromise(this.__getEntity(request, requestOptions));
|
|
5969
5922
|
}
|
|
5970
|
-
async
|
|
5971
|
-
const { id } = request;
|
|
5923
|
+
async __getEntity(request, requestOptions) {
|
|
5924
|
+
const { namespace, id } = request;
|
|
5972
5925
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
5973
5926
|
const _headers = mergeHeaders(
|
|
5974
5927
|
_authRequest.headers,
|
|
@@ -5978,7 +5931,7 @@ var IdentityClient = class {
|
|
|
5978
5931
|
const _response = await fetcher({
|
|
5979
5932
|
url: url_exports.join(
|
|
5980
5933
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
5981
|
-
`v1/
|
|
5934
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
|
|
5982
5935
|
),
|
|
5983
5936
|
method: "GET",
|
|
5984
5937
|
headers: _headers,
|
|
@@ -6004,30 +5957,31 @@ var IdentityClient = class {
|
|
|
6004
5957
|
});
|
|
6005
5958
|
}
|
|
6006
5959
|
}
|
|
6007
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/
|
|
5960
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/entities/{namespace}/{id}");
|
|
6008
5961
|
}
|
|
6009
5962
|
/**
|
|
6010
|
-
* Updates mutable fields
|
|
5963
|
+
* Updates the mutable fields of an entity. Omitted fields are preserved (a null value does not clear a field), and the `payload` object is replaced in full when supplied. Providing `scopes` replaces the entity's parent edges. Requires the `entities:u:<namespace>` scope.
|
|
6011
5964
|
*
|
|
6012
|
-
* @param {Vectros.
|
|
5965
|
+
* @param {Vectros.UpdateEntityRequest} request
|
|
6013
5966
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6014
5967
|
*
|
|
6015
5968
|
* @throws {@link Vectros.NotFoundError}
|
|
6016
5969
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6017
5970
|
*
|
|
6018
5971
|
* @example
|
|
6019
|
-
* await client.identity.
|
|
5972
|
+
* await client.identity.updateEntity({
|
|
5973
|
+
* namespace: "team",
|
|
6020
5974
|
* id: "id",
|
|
6021
5975
|
* body: {
|
|
6022
|
-
* externalId: "
|
|
5976
|
+
* externalId: "team_eng_platform"
|
|
6023
5977
|
* }
|
|
6024
5978
|
* })
|
|
6025
5979
|
*/
|
|
6026
|
-
|
|
6027
|
-
return HttpResponsePromise.fromPromise(this.
|
|
5980
|
+
updateEntity(request, requestOptions) {
|
|
5981
|
+
return HttpResponsePromise.fromPromise(this.__updateEntity(request, requestOptions));
|
|
6028
5982
|
}
|
|
6029
|
-
async
|
|
6030
|
-
const { id, body: _body } = request;
|
|
5983
|
+
async __updateEntity(request, requestOptions) {
|
|
5984
|
+
const { namespace, id, body: _body } = request;
|
|
6031
5985
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6032
5986
|
const _headers = mergeHeaders(
|
|
6033
5987
|
_authRequest.headers,
|
|
@@ -6037,7 +5991,7 @@ var IdentityClient = class {
|
|
|
6037
5991
|
const _response = await fetcher({
|
|
6038
5992
|
url: url_exports.join(
|
|
6039
5993
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6040
|
-
`v1/
|
|
5994
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
|
|
6041
5995
|
),
|
|
6042
5996
|
method: "PUT",
|
|
6043
5997
|
headers: _headers,
|
|
@@ -6068,27 +6022,28 @@ var IdentityClient = class {
|
|
|
6068
6022
|
});
|
|
6069
6023
|
}
|
|
6070
6024
|
}
|
|
6071
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/
|
|
6025
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/entities/{namespace}/{id}");
|
|
6072
6026
|
}
|
|
6073
6027
|
/**
|
|
6074
|
-
* Permanently deletes
|
|
6028
|
+
* Permanently deletes an entity. This action cannot be undone. Requires the `entities:d:<namespace>` scope.
|
|
6075
6029
|
*
|
|
6076
|
-
* @param {Vectros.
|
|
6030
|
+
* @param {Vectros.DeleteEntityRequest} request
|
|
6077
6031
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6078
6032
|
*
|
|
6079
6033
|
* @throws {@link Vectros.NotFoundError}
|
|
6080
6034
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6081
6035
|
*
|
|
6082
6036
|
* @example
|
|
6083
|
-
* await client.identity.
|
|
6037
|
+
* await client.identity.deleteEntity({
|
|
6038
|
+
* namespace: "team",
|
|
6084
6039
|
* id: "id"
|
|
6085
6040
|
* })
|
|
6086
6041
|
*/
|
|
6087
|
-
|
|
6088
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6042
|
+
deleteEntity(request, requestOptions) {
|
|
6043
|
+
return HttpResponsePromise.fromPromise(this.__deleteEntity(request, requestOptions));
|
|
6089
6044
|
}
|
|
6090
|
-
async
|
|
6091
|
-
const { id } = request;
|
|
6045
|
+
async __deleteEntity(request, requestOptions) {
|
|
6046
|
+
const { namespace, id } = request;
|
|
6092
6047
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6093
6048
|
const _headers = mergeHeaders(
|
|
6094
6049
|
_authRequest.headers,
|
|
@@ -6098,7 +6053,7 @@ var IdentityClient = class {
|
|
|
6098
6053
|
const _response = await fetcher({
|
|
6099
6054
|
url: url_exports.join(
|
|
6100
6055
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6101
|
-
`v1/
|
|
6056
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}`
|
|
6102
6057
|
),
|
|
6103
6058
|
method: "DELETE",
|
|
6104
6059
|
headers: _headers,
|
|
@@ -6126,27 +6081,36 @@ var IdentityClient = class {
|
|
|
6126
6081
|
});
|
|
6127
6082
|
}
|
|
6128
6083
|
}
|
|
6129
|
-
return handleNonStatusCodeError(
|
|
6084
|
+
return handleNonStatusCodeError(
|
|
6085
|
+
_response.error,
|
|
6086
|
+
_response.rawResponse,
|
|
6087
|
+
"DELETE",
|
|
6088
|
+
"/v1/entities/{namespace}/{id}"
|
|
6089
|
+
);
|
|
6130
6090
|
}
|
|
6131
6091
|
/**
|
|
6132
|
-
*
|
|
6092
|
+
* Looks up entities in a namespace by a schema-declared field value, with the criteria in the request body instead of the URL. Use this for a sensitive field: the value travels in the body and never appears in the URL. Body equivalent of the `type`/`field`/`value` lookup on `GET /v1/entities/{namespace}`, which rejects sensitive-field values and directs you here. Requires the `entities:r:<namespace>` scope.
|
|
6133
6093
|
*
|
|
6134
|
-
* @param {Vectros.
|
|
6094
|
+
* @param {Vectros.LookupEntitiesRequest} request
|
|
6135
6095
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6136
6096
|
*
|
|
6137
6097
|
* @throws {@link Vectros.BadRequestError}
|
|
6138
6098
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6139
6099
|
*
|
|
6140
6100
|
* @example
|
|
6141
|
-
* await client.identity.
|
|
6142
|
-
*
|
|
6143
|
-
*
|
|
6101
|
+
* await client.identity.lookupEntities({
|
|
6102
|
+
* namespace: "team",
|
|
6103
|
+
* body: {
|
|
6104
|
+
* type: "person_v1",
|
|
6105
|
+
* field: "ssn"
|
|
6106
|
+
* }
|
|
6144
6107
|
* })
|
|
6145
6108
|
*/
|
|
6146
|
-
|
|
6147
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6109
|
+
lookupEntities(request, requestOptions) {
|
|
6110
|
+
return HttpResponsePromise.fromPromise(this.__lookupEntities(request, requestOptions));
|
|
6148
6111
|
}
|
|
6149
|
-
async
|
|
6112
|
+
async __lookupEntities(request, requestOptions) {
|
|
6113
|
+
const { namespace, body: _body } = request;
|
|
6150
6114
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6151
6115
|
const _headers = mergeHeaders(
|
|
6152
6116
|
_authRequest.headers,
|
|
@@ -6156,14 +6120,14 @@ var IdentityClient = class {
|
|
|
6156
6120
|
const _response = await fetcher({
|
|
6157
6121
|
url: url_exports.join(
|
|
6158
6122
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6159
|
-
|
|
6123
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}/lookup`
|
|
6160
6124
|
),
|
|
6161
6125
|
method: "POST",
|
|
6162
6126
|
headers: _headers,
|
|
6163
6127
|
contentType: "application/json",
|
|
6164
6128
|
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
6165
6129
|
requestType: "json",
|
|
6166
|
-
body:
|
|
6130
|
+
body: _body,
|
|
6167
6131
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
6168
6132
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
6169
6133
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -6187,26 +6151,32 @@ var IdentityClient = class {
|
|
|
6187
6151
|
});
|
|
6188
6152
|
}
|
|
6189
6153
|
}
|
|
6190
|
-
return handleNonStatusCodeError(
|
|
6154
|
+
return handleNonStatusCodeError(
|
|
6155
|
+
_response.error,
|
|
6156
|
+
_response.rawResponse,
|
|
6157
|
+
"POST",
|
|
6158
|
+
"/v1/entities/{namespace}/lookup"
|
|
6159
|
+
);
|
|
6191
6160
|
}
|
|
6192
6161
|
/**
|
|
6193
|
-
* Returns the audit trail of changes to
|
|
6162
|
+
* Returns the audit trail of changes made to an entity, newest first. Sensitive field values are redacted in the history. Requires the `entities:r:<namespace>` scope.
|
|
6194
6163
|
*
|
|
6195
|
-
* @param {Vectros.
|
|
6164
|
+
* @param {Vectros.GetEntityVersionsRequest} request
|
|
6196
6165
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6197
6166
|
*
|
|
6198
6167
|
* @throws {@link Vectros.NotFoundError}
|
|
6199
6168
|
*
|
|
6200
6169
|
* @example
|
|
6201
|
-
* await client.identity.
|
|
6170
|
+
* await client.identity.getEntityVersions({
|
|
6171
|
+
* namespace: "team",
|
|
6202
6172
|
* id: "id"
|
|
6203
6173
|
* })
|
|
6204
6174
|
*/
|
|
6205
|
-
|
|
6206
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6175
|
+
getEntityVersions(request, requestOptions) {
|
|
6176
|
+
return HttpResponsePromise.fromPromise(this.__getEntityVersions(request, requestOptions));
|
|
6207
6177
|
}
|
|
6208
|
-
async
|
|
6209
|
-
const { id, startFrom } = request;
|
|
6178
|
+
async __getEntityVersions(request, requestOptions) {
|
|
6179
|
+
const { namespace, id, startFrom } = request;
|
|
6210
6180
|
const _queryParams = {
|
|
6211
6181
|
startFrom
|
|
6212
6182
|
};
|
|
@@ -6219,7 +6189,7 @@ var IdentityClient = class {
|
|
|
6219
6189
|
const _response = await fetcher({
|
|
6220
6190
|
url: url_exports.join(
|
|
6221
6191
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6222
|
-
`v1/
|
|
6192
|
+
`v1/entities/${url_exports.encodePathParam(namespace)}/${url_exports.encodePathParam(id)}/versions`
|
|
6223
6193
|
),
|
|
6224
6194
|
method: "GET",
|
|
6225
6195
|
headers: _headers,
|
|
@@ -6245,174 +6215,31 @@ var IdentityClient = class {
|
|
|
6245
6215
|
});
|
|
6246
6216
|
}
|
|
6247
6217
|
}
|
|
6248
|
-
return handleNonStatusCodeError(
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
* @param {Vectros.ListOrgsRequest} request
|
|
6254
|
-
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6255
|
-
*
|
|
6256
|
-
* @example
|
|
6257
|
-
* await client.identity.listOrgs({
|
|
6258
|
-
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
6259
|
-
* externalId: "clinic_001",
|
|
6260
|
-
* startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
|
|
6261
|
-
* type: "org_v1",
|
|
6262
|
-
* field: "region",
|
|
6263
|
-
* value: "us-east",
|
|
6264
|
-
* prefix: "us-"
|
|
6265
|
-
* })
|
|
6266
|
-
*/
|
|
6267
|
-
listOrgs(request = {}, requestOptions) {
|
|
6268
|
-
return HttpResponsePromise.fromPromise(this.__listOrgs(request, requestOptions));
|
|
6269
|
-
}
|
|
6270
|
-
async __listOrgs(request = {}, requestOptions) {
|
|
6271
|
-
const {
|
|
6272
|
-
userId,
|
|
6273
|
-
externalId,
|
|
6274
|
-
startFrom,
|
|
6275
|
-
limit,
|
|
6276
|
-
type: type_,
|
|
6277
|
-
field,
|
|
6278
|
-
value,
|
|
6279
|
-
from: from_,
|
|
6280
|
-
to,
|
|
6281
|
-
prefix,
|
|
6282
|
-
order
|
|
6283
|
-
} = request;
|
|
6284
|
-
const _queryParams = {
|
|
6285
|
-
userId,
|
|
6286
|
-
externalId,
|
|
6287
|
-
startFrom,
|
|
6288
|
-
limit,
|
|
6289
|
-
type: type_,
|
|
6290
|
-
field,
|
|
6291
|
-
value,
|
|
6292
|
-
from: from_,
|
|
6293
|
-
to,
|
|
6294
|
-
prefix,
|
|
6295
|
-
order: order != null ? order : void 0
|
|
6296
|
-
};
|
|
6297
|
-
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6298
|
-
const _headers = mergeHeaders(
|
|
6299
|
-
_authRequest.headers,
|
|
6300
|
-
this._options?.headers,
|
|
6301
|
-
requestOptions?.headers
|
|
6218
|
+
return handleNonStatusCodeError(
|
|
6219
|
+
_response.error,
|
|
6220
|
+
_response.rawResponse,
|
|
6221
|
+
"GET",
|
|
6222
|
+
"/v1/entities/{namespace}/{id}/versions"
|
|
6302
6223
|
);
|
|
6303
|
-
const _response = await fetcher({
|
|
6304
|
-
url: url_exports.join(
|
|
6305
|
-
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6306
|
-
"v1/orgs"
|
|
6307
|
-
),
|
|
6308
|
-
method: "GET",
|
|
6309
|
-
headers: _headers,
|
|
6310
|
-
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
6311
|
-
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
6312
|
-
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
6313
|
-
abortSignal: requestOptions?.abortSignal,
|
|
6314
|
-
fetchFn: this._options?.fetch,
|
|
6315
|
-
logging: this._options.logging
|
|
6316
|
-
});
|
|
6317
|
-
if (_response.ok) {
|
|
6318
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
6319
|
-
}
|
|
6320
|
-
if (_response.error.reason === "status-code") {
|
|
6321
|
-
throw new VectrosError({
|
|
6322
|
-
statusCode: _response.error.statusCode,
|
|
6323
|
-
body: _response.error.body,
|
|
6324
|
-
rawResponse: _response.rawResponse
|
|
6325
|
-
});
|
|
6326
|
-
}
|
|
6327
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/orgs");
|
|
6328
6224
|
}
|
|
6329
6225
|
/**
|
|
6330
|
-
*
|
|
6226
|
+
* Retrieves a single scope-namespace registration by name. The reserved built-ins `org` and `client` are always resolvable.
|
|
6331
6227
|
*
|
|
6332
|
-
* @param {Vectros.
|
|
6333
|
-
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6334
|
-
*
|
|
6335
|
-
* @throws {@link Vectros.BadRequestError}
|
|
6336
|
-
* @throws {@link Vectros.ForbiddenError}
|
|
6337
|
-
* @throws {@link Vectros.TooManyRequestsError}
|
|
6338
|
-
*
|
|
6339
|
-
* @example
|
|
6340
|
-
* await client.identity.createOrg({
|
|
6341
|
-
* body: {
|
|
6342
|
-
* externalId: "clinic_001"
|
|
6343
|
-
* }
|
|
6344
|
-
* })
|
|
6345
|
-
*/
|
|
6346
|
-
createOrg(request, requestOptions) {
|
|
6347
|
-
return HttpResponsePromise.fromPromise(this.__createOrg(request, requestOptions));
|
|
6348
|
-
}
|
|
6349
|
-
async __createOrg(request, requestOptions) {
|
|
6350
|
-
const { upsert, body: _body } = request;
|
|
6351
|
-
const _queryParams = {
|
|
6352
|
-
upsert
|
|
6353
|
-
};
|
|
6354
|
-
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6355
|
-
const _headers = mergeHeaders(
|
|
6356
|
-
_authRequest.headers,
|
|
6357
|
-
this._options?.headers,
|
|
6358
|
-
requestOptions?.headers
|
|
6359
|
-
);
|
|
6360
|
-
const _response = await fetcher({
|
|
6361
|
-
url: url_exports.join(
|
|
6362
|
-
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6363
|
-
"v1/orgs"
|
|
6364
|
-
),
|
|
6365
|
-
method: "POST",
|
|
6366
|
-
headers: _headers,
|
|
6367
|
-
contentType: "application/json",
|
|
6368
|
-
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
6369
|
-
requestType: "json",
|
|
6370
|
-
body: _body,
|
|
6371
|
-
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
6372
|
-
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
6373
|
-
abortSignal: requestOptions?.abortSignal,
|
|
6374
|
-
fetchFn: this._options?.fetch,
|
|
6375
|
-
logging: this._options.logging
|
|
6376
|
-
});
|
|
6377
|
-
if (_response.ok) {
|
|
6378
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
6379
|
-
}
|
|
6380
|
-
if (_response.error.reason === "status-code") {
|
|
6381
|
-
switch (_response.error.statusCode) {
|
|
6382
|
-
case 400:
|
|
6383
|
-
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
6384
|
-
case 403:
|
|
6385
|
-
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
6386
|
-
case 429:
|
|
6387
|
-
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
6388
|
-
default:
|
|
6389
|
-
throw new VectrosError({
|
|
6390
|
-
statusCode: _response.error.statusCode,
|
|
6391
|
-
body: _response.error.body,
|
|
6392
|
-
rawResponse: _response.rawResponse
|
|
6393
|
-
});
|
|
6394
|
-
}
|
|
6395
|
-
}
|
|
6396
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/orgs");
|
|
6397
|
-
}
|
|
6398
|
-
/**
|
|
6399
|
-
* Retrieves a single organization by its Vectros-assigned ID, returning its current name, status, payload, and schema binding. Requires the `orgs:r` scope.
|
|
6400
|
-
*
|
|
6401
|
-
* @param {Vectros.GetOrgRequest} request
|
|
6228
|
+
* @param {Vectros.GetNamespaceRequest} request
|
|
6402
6229
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6403
6230
|
*
|
|
6404
6231
|
* @throws {@link Vectros.NotFoundError}
|
|
6405
6232
|
*
|
|
6406
6233
|
* @example
|
|
6407
|
-
* await client.identity.
|
|
6408
|
-
*
|
|
6234
|
+
* await client.identity.getNamespace({
|
|
6235
|
+
* namespace: "team"
|
|
6409
6236
|
* })
|
|
6410
6237
|
*/
|
|
6411
|
-
|
|
6412
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6238
|
+
getNamespace(request, requestOptions) {
|
|
6239
|
+
return HttpResponsePromise.fromPromise(this.__getNamespace(request, requestOptions));
|
|
6413
6240
|
}
|
|
6414
|
-
async
|
|
6415
|
-
const {
|
|
6241
|
+
async __getNamespace(request, requestOptions) {
|
|
6242
|
+
const { namespace } = request;
|
|
6416
6243
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6417
6244
|
const _headers = mergeHeaders(
|
|
6418
6245
|
_authRequest.headers,
|
|
@@ -6422,7 +6249,7 @@ var IdentityClient = class {
|
|
|
6422
6249
|
const _response = await fetcher({
|
|
6423
6250
|
url: url_exports.join(
|
|
6424
6251
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6425
|
-
`v1/
|
|
6252
|
+
`v1/namespaces/${url_exports.encodePathParam(namespace)}`
|
|
6426
6253
|
),
|
|
6427
6254
|
method: "GET",
|
|
6428
6255
|
headers: _headers,
|
|
@@ -6448,30 +6275,31 @@ var IdentityClient = class {
|
|
|
6448
6275
|
});
|
|
6449
6276
|
}
|
|
6450
6277
|
}
|
|
6451
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/
|
|
6278
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces/{namespace}");
|
|
6452
6279
|
}
|
|
6453
6280
|
/**
|
|
6454
|
-
* Updates the mutable fields
|
|
6281
|
+
* Updates the mutable fields (`entityBacked`, `defaultSchemaId`) of a registered namespace. The namespace name itself is immutable. Requires a root API key. The reserved built-ins cannot be updated.
|
|
6455
6282
|
*
|
|
6456
|
-
* @param {Vectros.
|
|
6283
|
+
* @param {Vectros.UpdateNamespaceRequest} request
|
|
6457
6284
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6458
6285
|
*
|
|
6286
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
6459
6287
|
* @throws {@link Vectros.NotFoundError}
|
|
6460
6288
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6461
6289
|
*
|
|
6462
6290
|
* @example
|
|
6463
|
-
* await client.identity.
|
|
6464
|
-
*
|
|
6291
|
+
* await client.identity.updateNamespace({
|
|
6292
|
+
* namespace: "team",
|
|
6465
6293
|
* body: {
|
|
6466
|
-
*
|
|
6294
|
+
* namespace: "team"
|
|
6467
6295
|
* }
|
|
6468
6296
|
* })
|
|
6469
6297
|
*/
|
|
6470
|
-
|
|
6471
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6298
|
+
updateNamespace(request, requestOptions) {
|
|
6299
|
+
return HttpResponsePromise.fromPromise(this.__updateNamespace(request, requestOptions));
|
|
6472
6300
|
}
|
|
6473
|
-
async
|
|
6474
|
-
const {
|
|
6301
|
+
async __updateNamespace(request, requestOptions) {
|
|
6302
|
+
const { namespace, body: _body } = request;
|
|
6475
6303
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6476
6304
|
const _headers = mergeHeaders(
|
|
6477
6305
|
_authRequest.headers,
|
|
@@ -6481,7 +6309,7 @@ var IdentityClient = class {
|
|
|
6481
6309
|
const _response = await fetcher({
|
|
6482
6310
|
url: url_exports.join(
|
|
6483
6311
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6484
|
-
`v1/
|
|
6312
|
+
`v1/namespaces/${url_exports.encodePathParam(namespace)}`
|
|
6485
6313
|
),
|
|
6486
6314
|
method: "PUT",
|
|
6487
6315
|
headers: _headers,
|
|
@@ -6500,6 +6328,8 @@ var IdentityClient = class {
|
|
|
6500
6328
|
}
|
|
6501
6329
|
if (_response.error.reason === "status-code") {
|
|
6502
6330
|
switch (_response.error.statusCode) {
|
|
6331
|
+
case 403:
|
|
6332
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
6503
6333
|
case 404:
|
|
6504
6334
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
6505
6335
|
case 429:
|
|
@@ -6512,27 +6342,28 @@ var IdentityClient = class {
|
|
|
6512
6342
|
});
|
|
6513
6343
|
}
|
|
6514
6344
|
}
|
|
6515
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/
|
|
6345
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v1/namespaces/{namespace}");
|
|
6516
6346
|
}
|
|
6517
6347
|
/**
|
|
6518
|
-
*
|
|
6348
|
+
* Deletes a registered scope namespace. Requires a root API key. The reserved built-ins cannot be deleted. A namespace that still has entities cannot be deleted (409) — delete its entities first; this keeps them reachable by the account-teardown and erasure sweeps.
|
|
6519
6349
|
*
|
|
6520
|
-
* @param {Vectros.
|
|
6350
|
+
* @param {Vectros.DeleteNamespaceRequest} request
|
|
6521
6351
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6522
6352
|
*
|
|
6353
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
6523
6354
|
* @throws {@link Vectros.NotFoundError}
|
|
6524
6355
|
* @throws {@link Vectros.TooManyRequestsError}
|
|
6525
6356
|
*
|
|
6526
6357
|
* @example
|
|
6527
|
-
* await client.identity.
|
|
6528
|
-
*
|
|
6358
|
+
* await client.identity.deleteNamespace({
|
|
6359
|
+
* namespace: "team"
|
|
6529
6360
|
* })
|
|
6530
6361
|
*/
|
|
6531
|
-
|
|
6532
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6362
|
+
deleteNamespace(request, requestOptions) {
|
|
6363
|
+
return HttpResponsePromise.fromPromise(this.__deleteNamespace(request, requestOptions));
|
|
6533
6364
|
}
|
|
6534
|
-
async
|
|
6535
|
-
const {
|
|
6365
|
+
async __deleteNamespace(request, requestOptions) {
|
|
6366
|
+
const { namespace } = request;
|
|
6536
6367
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6537
6368
|
const _headers = mergeHeaders(
|
|
6538
6369
|
_authRequest.headers,
|
|
@@ -6542,7 +6373,7 @@ var IdentityClient = class {
|
|
|
6542
6373
|
const _response = await fetcher({
|
|
6543
6374
|
url: url_exports.join(
|
|
6544
6375
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6545
|
-
`v1/
|
|
6376
|
+
`v1/namespaces/${url_exports.encodePathParam(namespace)}`
|
|
6546
6377
|
),
|
|
6547
6378
|
method: "DELETE",
|
|
6548
6379
|
headers: _headers,
|
|
@@ -6558,6 +6389,8 @@ var IdentityClient = class {
|
|
|
6558
6389
|
}
|
|
6559
6390
|
if (_response.error.reason === "status-code") {
|
|
6560
6391
|
switch (_response.error.statusCode) {
|
|
6392
|
+
case 403:
|
|
6393
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
6561
6394
|
case 404:
|
|
6562
6395
|
throw new NotFoundError(_response.error.body, _response.rawResponse);
|
|
6563
6396
|
case 429:
|
|
@@ -6570,27 +6403,26 @@ var IdentityClient = class {
|
|
|
6570
6403
|
});
|
|
6571
6404
|
}
|
|
6572
6405
|
}
|
|
6573
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/
|
|
6406
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/namespaces/{namespace}");
|
|
6574
6407
|
}
|
|
6575
6408
|
/**
|
|
6576
|
-
*
|
|
6409
|
+
* Returns the scope namespaces registered in your account, with the reserved built-ins `org` and `client` listed first. Returns a `{data, nextCursor}` envelope.
|
|
6577
6410
|
*
|
|
6578
|
-
* @param {Vectros.
|
|
6411
|
+
* @param {Vectros.ListNamespacesRequest} request
|
|
6579
6412
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6580
6413
|
*
|
|
6581
|
-
* @throws {@link Vectros.BadRequestError}
|
|
6582
|
-
* @throws {@link Vectros.TooManyRequestsError}
|
|
6583
|
-
*
|
|
6584
6414
|
* @example
|
|
6585
|
-
* await client.identity.
|
|
6586
|
-
* type: "person_v1",
|
|
6587
|
-
* field: "ssn"
|
|
6588
|
-
* })
|
|
6415
|
+
* await client.identity.listNamespaces()
|
|
6589
6416
|
*/
|
|
6590
|
-
|
|
6591
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6417
|
+
listNamespaces(request = {}, requestOptions) {
|
|
6418
|
+
return HttpResponsePromise.fromPromise(this.__listNamespaces(request, requestOptions));
|
|
6592
6419
|
}
|
|
6593
|
-
async
|
|
6420
|
+
async __listNamespaces(request = {}, requestOptions) {
|
|
6421
|
+
const { startFrom, limit } = request;
|
|
6422
|
+
const _queryParams = {
|
|
6423
|
+
startFrom,
|
|
6424
|
+
limit
|
|
6425
|
+
};
|
|
6594
6426
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6595
6427
|
const _headers = mergeHeaders(
|
|
6596
6428
|
_authRequest.headers,
|
|
@@ -6600,14 +6432,11 @@ var IdentityClient = class {
|
|
|
6600
6432
|
const _response = await fetcher({
|
|
6601
6433
|
url: url_exports.join(
|
|
6602
6434
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6603
|
-
"v1/
|
|
6435
|
+
"v1/namespaces"
|
|
6604
6436
|
),
|
|
6605
|
-
method: "
|
|
6437
|
+
method: "GET",
|
|
6606
6438
|
headers: _headers,
|
|
6607
|
-
|
|
6608
|
-
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
6609
|
-
requestType: "json",
|
|
6610
|
-
body: request,
|
|
6439
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
6611
6440
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
6612
6441
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
6613
6442
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -6618,42 +6447,33 @@ var IdentityClient = class {
|
|
|
6618
6447
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
6619
6448
|
}
|
|
6620
6449
|
if (_response.error.reason === "status-code") {
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
default:
|
|
6627
|
-
throw new VectrosError({
|
|
6628
|
-
statusCode: _response.error.statusCode,
|
|
6629
|
-
body: _response.error.body,
|
|
6630
|
-
rawResponse: _response.rawResponse
|
|
6631
|
-
});
|
|
6632
|
-
}
|
|
6450
|
+
throw new VectrosError({
|
|
6451
|
+
statusCode: _response.error.statusCode,
|
|
6452
|
+
body: _response.error.body,
|
|
6453
|
+
rawResponse: _response.rawResponse
|
|
6454
|
+
});
|
|
6633
6455
|
}
|
|
6634
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "
|
|
6456
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v1/namespaces");
|
|
6635
6457
|
}
|
|
6636
6458
|
/**
|
|
6637
|
-
*
|
|
6459
|
+
* Registers a new scope namespace and declares whether its values resolve to identity entities (`entityBacked`). Requires a root API key. The reserved names `org` and `client` are built in and cannot be registered.
|
|
6638
6460
|
*
|
|
6639
|
-
* @param {Vectros.
|
|
6461
|
+
* @param {Vectros.NamespaceRequest} request
|
|
6640
6462
|
* @param {IdentityClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
6641
6463
|
*
|
|
6642
|
-
* @throws {@link Vectros.
|
|
6464
|
+
* @throws {@link Vectros.BadRequestError}
|
|
6465
|
+
* @throws {@link Vectros.ForbiddenError}
|
|
6466
|
+
* @throws {@link Vectros.TooManyRequestsError}
|
|
6643
6467
|
*
|
|
6644
6468
|
* @example
|
|
6645
|
-
* await client.identity.
|
|
6646
|
-
*
|
|
6469
|
+
* await client.identity.registerNamespace({
|
|
6470
|
+
* namespace: "team"
|
|
6647
6471
|
* })
|
|
6648
6472
|
*/
|
|
6649
|
-
|
|
6650
|
-
return HttpResponsePromise.fromPromise(this.
|
|
6473
|
+
registerNamespace(request, requestOptions) {
|
|
6474
|
+
return HttpResponsePromise.fromPromise(this.__registerNamespace(request, requestOptions));
|
|
6651
6475
|
}
|
|
6652
|
-
async
|
|
6653
|
-
const { id, startFrom } = request;
|
|
6654
|
-
const _queryParams = {
|
|
6655
|
-
startFrom
|
|
6656
|
-
};
|
|
6476
|
+
async __registerNamespace(request, requestOptions) {
|
|
6657
6477
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
6658
6478
|
const _headers = mergeHeaders(
|
|
6659
6479
|
_authRequest.headers,
|
|
@@ -6663,11 +6483,14 @@ var IdentityClient = class {
|
|
|
6663
6483
|
const _response = await fetcher({
|
|
6664
6484
|
url: url_exports.join(
|
|
6665
6485
|
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment),
|
|
6666
|
-
|
|
6486
|
+
"v1/namespaces"
|
|
6667
6487
|
),
|
|
6668
|
-
method: "
|
|
6488
|
+
method: "POST",
|
|
6669
6489
|
headers: _headers,
|
|
6670
|
-
|
|
6490
|
+
contentType: "application/json",
|
|
6491
|
+
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
6492
|
+
requestType: "json",
|
|
6493
|
+
body: request,
|
|
6671
6494
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
6672
6495
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
6673
6496
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -6679,8 +6502,12 @@ var IdentityClient = class {
|
|
|
6679
6502
|
}
|
|
6680
6503
|
if (_response.error.reason === "status-code") {
|
|
6681
6504
|
switch (_response.error.statusCode) {
|
|
6682
|
-
case
|
|
6683
|
-
throw new
|
|
6505
|
+
case 400:
|
|
6506
|
+
throw new BadRequestError(_response.error.body, _response.rawResponse);
|
|
6507
|
+
case 403:
|
|
6508
|
+
throw new ForbiddenError(_response.error.body, _response.rawResponse);
|
|
6509
|
+
case 429:
|
|
6510
|
+
throw new TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
6684
6511
|
default:
|
|
6685
6512
|
throw new VectrosError({
|
|
6686
6513
|
statusCode: _response.error.statusCode,
|
|
@@ -6689,7 +6516,7 @@ var IdentityClient = class {
|
|
|
6689
6516
|
});
|
|
6690
6517
|
}
|
|
6691
6518
|
}
|
|
6692
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "
|
|
6519
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/namespaces");
|
|
6693
6520
|
}
|
|
6694
6521
|
/**
|
|
6695
6522
|
* Returns a paginated list of the users in your account. Pass `externalId` to look up a single user by your own identifier. To filter on schema-declared lookup fields, supply `type` and `field` together with one lookup mode: `value` (exact match), `from`+`to` (range), or `prefix`. Requires the `users:r` scope.
|
|
@@ -7566,7 +7393,7 @@ var RecordsClient = class {
|
|
|
7566
7393
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v1/records/batch");
|
|
7567
7394
|
}
|
|
7568
7395
|
/**
|
|
7569
|
-
* Returns a paginated list of records in your account as a `{data, nextCursor}` page. Supply exactly one of `type`, `folderId`, or `recent=true` to choose the mode: `type` lists all records of a single type; `folderId` lists all records in a folder (any type); and `recent=true` returns the account-wide recently-updated feed across all types, newest first. You may combine `type` with `folderId` to list a single type within a folder. The owner filters (`userId`, `
|
|
7396
|
+
* Returns a paginated list of records in your account as a `{data, nextCursor}` page. Supply exactly one of `type`, `folderId`, or `recent=true` to choose the mode: `type` lists all records of a single type; `folderId` lists all records in a folder (any type); and `recent=true` returns the account-wide recently-updated feed across all types, newest first. You may combine `type` with `folderId` to list a single type within a folder. The owner filters (`userId`, `scope`) further narrow the type and folder modes; the `recent` feed is standalone and ignores all filters. Each token only sees the record types it is scoped to read. Requires the `records:r` scope. By default the response returns the indexed projection of each record; set `includePayload=true` to include full payloads.
|
|
7570
7397
|
*
|
|
7571
7398
|
* @param {Vectros.ListRecordsRequest} request
|
|
7572
7399
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -7576,8 +7403,7 @@ var RecordsClient = class {
|
|
|
7576
7403
|
* type: "intake_form",
|
|
7577
7404
|
* folderId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
7578
7405
|
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
7579
|
-
*
|
|
7580
|
-
* clientId: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
|
|
7406
|
+
* scope: "group:eng-team",
|
|
7581
7407
|
* startFrom: "550e8400-e29b-41d4-a716-446655440000"
|
|
7582
7408
|
* })
|
|
7583
7409
|
*/
|
|
@@ -7585,13 +7411,12 @@ var RecordsClient = class {
|
|
|
7585
7411
|
return HttpResponsePromise.fromPromise(this.__listRecords(request, requestOptions));
|
|
7586
7412
|
}
|
|
7587
7413
|
async __listRecords(request = {}, requestOptions) {
|
|
7588
|
-
const { type: type_, folderId, userId,
|
|
7414
|
+
const { type: type_, folderId, userId, scope, startFrom, limit, includePayload, recent } = request;
|
|
7589
7415
|
const _queryParams = {
|
|
7590
7416
|
type: type_,
|
|
7591
7417
|
folderId,
|
|
7592
7418
|
userId,
|
|
7593
|
-
|
|
7594
|
-
clientId,
|
|
7419
|
+
scope,
|
|
7595
7420
|
startFrom,
|
|
7596
7421
|
limit,
|
|
7597
7422
|
includePayload,
|
|
@@ -7656,9 +7481,10 @@ var RecordsClient = class {
|
|
|
7656
7481
|
return HttpResponsePromise.fromPromise(this.__createRecord(request, requestOptions));
|
|
7657
7482
|
}
|
|
7658
7483
|
async __createRecord(request, requestOptions) {
|
|
7659
|
-
const { upsert, body: _body } = request;
|
|
7484
|
+
const { upsert, allowClear, body: _body } = request;
|
|
7660
7485
|
const _queryParams = {
|
|
7661
|
-
upsert
|
|
7486
|
+
upsert,
|
|
7487
|
+
allowClear
|
|
7662
7488
|
};
|
|
7663
7489
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
7664
7490
|
const _headers = mergeHeaders(
|
|
@@ -7780,7 +7606,10 @@ var RecordsClient = class {
|
|
|
7780
7606
|
return HttpResponsePromise.fromPromise(this.__updateRecord(request, requestOptions));
|
|
7781
7607
|
}
|
|
7782
7608
|
async __updateRecord(request, requestOptions) {
|
|
7783
|
-
const { id, body: _body } = request;
|
|
7609
|
+
const { id, allowClear, body: _body } = request;
|
|
7610
|
+
const _queryParams = {
|
|
7611
|
+
allowClear
|
|
7612
|
+
};
|
|
7784
7613
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
7785
7614
|
const _headers = mergeHeaders(
|
|
7786
7615
|
_authRequest.headers,
|
|
@@ -7795,7 +7624,7 @@ var RecordsClient = class {
|
|
|
7795
7624
|
method: "PUT",
|
|
7796
7625
|
headers: _headers,
|
|
7797
7626
|
contentType: "application/json",
|
|
7798
|
-
queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
7627
|
+
queryString: url_exports.queryBuilder().addMany(_queryParams).mergeAdditional(requestOptions?.queryParams).build(),
|
|
7799
7628
|
requestType: "json",
|
|
7800
7629
|
body: _body,
|
|
7801
7630
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
|
|
@@ -7886,7 +7715,7 @@ var RecordsClient = class {
|
|
|
7886
7715
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v1/records/{id}");
|
|
7887
7716
|
}
|
|
7888
7717
|
/**
|
|
7889
|
-
* Partially updates a record using an RFC 7386 JSON Merge Patch. The `payload` object is deep-merged into the existing payload: keys you send overwrite (recursing into nested objects), a key set to null is deleted, and keys you omit are left unchanged — so you can change a single field without re-sending the rest (unlike the full-replacement PUT). Top-level fields (`status`, `folderId`, `userId`, `
|
|
7718
|
+
* Partially updates a record using an RFC 7386 JSON Merge Patch. The `payload` object is deep-merged into the existing payload: keys you send overwrite (recursing into nested objects), a key set to null is deleted, and keys you omit are left unchanged — so you can change a single field without re-sending the rest (unlike the full-replacement PUT). Top-level fields (`status`, `folderId`, `userId`, `scopes`) are set when present and left unchanged when omitted; sending a top-level field as null is rejected (clearing a top-level field is not supported in this release — omit it instead). `typeName`, `schemaId`, `externalId`, and `indexMode` are immutable and rejected if present. The merged result is validated against the schema. Pass `expectedVersion` to make the patch conditional (optimistic concurrency, 409 on conflict). Requires the `records:u:<type>` scope.
|
|
7890
7719
|
*
|
|
7891
7720
|
* @param {Vectros.PatchRecordRequest} request
|
|
7892
7721
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8212,7 +8041,7 @@ var SchemasClient = class {
|
|
|
8212
8041
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
8213
8042
|
}
|
|
8214
8043
|
/**
|
|
8215
|
-
* Returns a paginated list of the record schemas defined in your account. Filter by `userId` or `
|
|
8044
|
+
* Returns a paginated list of the record schemas defined in your account. Filter by `userId` or `scope` to scope to an owner, by `surface` to list the types bindable to one surface, or by `recordType` to resolve the single schema for a type directly. Filtering by an identity surface (`user` or `entity`) lists your account-wide identity schemas regardless of the calling context; filtering by record or document lists within the calling context. Requires the `schemas:r` scope.
|
|
8216
8045
|
*
|
|
8217
8046
|
* @param {Vectros.ListSchemasRequest} request
|
|
8218
8047
|
* @param {SchemasClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -8220,7 +8049,7 @@ var SchemasClient = class {
|
|
|
8220
8049
|
* @example
|
|
8221
8050
|
* await client.schemas.listSchemas({
|
|
8222
8051
|
* userId: "550e8400-e29b-41d4-a716-446655440000",
|
|
8223
|
-
*
|
|
8052
|
+
* scope: "org:6ba7b810-9dad-11d1-80b4-00c04fd430c8",
|
|
8224
8053
|
* surface: "document",
|
|
8225
8054
|
* recordType: "intake_form",
|
|
8226
8055
|
* startFrom: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
|
|
@@ -8230,10 +8059,10 @@ var SchemasClient = class {
|
|
|
8230
8059
|
return HttpResponsePromise.fromPromise(this.__listSchemas(request, requestOptions));
|
|
8231
8060
|
}
|
|
8232
8061
|
async __listSchemas(request = {}, requestOptions) {
|
|
8233
|
-
const { userId,
|
|
8062
|
+
const { userId, scope, surface, recordType, startFrom, limit } = request;
|
|
8234
8063
|
const _queryParams = {
|
|
8235
8064
|
userId,
|
|
8236
|
-
|
|
8065
|
+
scope,
|
|
8237
8066
|
surface,
|
|
8238
8067
|
recordType,
|
|
8239
8068
|
startFrom,
|
|
@@ -8679,12 +8508,12 @@ var VectrosClient = class {
|
|
|
8679
8508
|
get auth() {
|
|
8680
8509
|
return this._auth ?? (this._auth = new AuthClient(this._options));
|
|
8681
8510
|
}
|
|
8682
|
-
get identity() {
|
|
8683
|
-
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
8684
|
-
}
|
|
8685
8511
|
get documents() {
|
|
8686
8512
|
return this._documents ?? (this._documents = new DocumentsClient(this._options));
|
|
8687
8513
|
}
|
|
8514
|
+
get identity() {
|
|
8515
|
+
return this._identity ?? (this._identity = new IdentityClient(this._options));
|
|
8516
|
+
}
|
|
8688
8517
|
get compliance() {
|
|
8689
8518
|
return this._compliance ?? (this._compliance = new ComplianceClient(this._options));
|
|
8690
8519
|
}
|
|
@@ -8782,8 +8611,8 @@ function warnOnSuboptimalKey(key, log) {
|
|
|
8782
8611
|
|
|
8783
8612
|
// src/build-info.ts
|
|
8784
8613
|
var BUILD_INFO = {
|
|
8785
|
-
mcpServer: true ? "0.
|
|
8786
|
-
sdk: true ? "0.
|
|
8614
|
+
mcpServer: true ? "0.10.0" : "dev",
|
|
8615
|
+
sdk: true ? "0.35.0" : "dev"
|
|
8787
8616
|
};
|
|
8788
8617
|
|
|
8789
8618
|
// src/log.ts
|
|
@@ -9019,7 +8848,7 @@ ${detail}${pointer}`
|
|
|
9019
8848
|
|
|
9020
8849
|
// src/tools/hybrid_search.ts
|
|
9021
8850
|
var MCP_DEFAULT_LIMIT = 3;
|
|
9022
|
-
var MCP_MAX_LIMIT =
|
|
8851
|
+
var MCP_MAX_LIMIT = 50;
|
|
9023
8852
|
var MCP_RESPONSE_CHAR_BUDGET = 24e3;
|
|
9024
8853
|
var SNIPPET_MAX_CHARS = 160;
|
|
9025
8854
|
var INTERNAL_METADATA_KEYS = /* @__PURE__ */ new Set(["tenantId", "owner_id", "model_type", "rootFolderId", "folderId"]);
|
|
@@ -9053,9 +8882,9 @@ var inputSchema = {
|
|
|
9053
8882
|
"Keyword-match precision for the BM25 leg (TEXT/HYBRID modes). OR = any term (broad recall), AND = all terms (higher precision), PHRASE = contiguous phrase. Default: PHRASE (slop 3) in HYBRID, OR in TEXT. (The advanced raw-query COMPLEX mode is intentionally not exposed here.)"
|
|
9054
8883
|
),
|
|
9055
8884
|
limit: import_zod.z.number().int().min(1).max(MCP_MAX_LIMIT).optional().describe(
|
|
9056
|
-
`Max hits
|
|
8885
|
+
`Max hits per page. Defaults to a low ${MCP_DEFAULT_LIMIT} to protect the agent context window; raise up to ${MCP_MAX_LIMIT} (the most a single search returns) in one call when you can accept the larger result, or page with \`offset\` instead.`
|
|
9057
8886
|
),
|
|
9058
|
-
offset: import_zod.z.number().int().min(0).optional().describe("Skip the first N hits \u2014 for pagination."),
|
|
8887
|
+
offset: import_zod.z.number().int().min(0).max(200).optional().describe("Skip the first N hits \u2014 for pagination (0\u2013200)."),
|
|
9059
8888
|
folderId: import_zod.z.string().optional().describe("Scope to content in this EXACT folder (Vectros folder id)."),
|
|
9060
8889
|
rootFolderId: import_zod.z.string().optional().describe("Scope to content under this folder AND all its descendants (subtree-root folder id)."),
|
|
9061
8890
|
// Content narrowing.
|
|
@@ -9068,8 +8897,9 @@ var inputSchema = {
|
|
|
9068
8897
|
),
|
|
9069
8898
|
// Ownership.
|
|
9070
8899
|
userId: import_zod.z.string().optional().describe("Restrict to content owned by this user (Vectros UUID)."),
|
|
9071
|
-
|
|
9072
|
-
|
|
8900
|
+
scope: import_zod.z.string().optional().describe(
|
|
8901
|
+
'Restrict to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
|
|
8902
|
+
),
|
|
9073
8903
|
// Date window.
|
|
9074
8904
|
createdAfter: import_zod.z.string().optional().describe("Restrict to content created at/after this ISO 8601 UTC timestamp."),
|
|
9075
8905
|
createdBefore: import_zod.z.string().optional().describe("Restrict to content created at/before this ISO 8601 UTC timestamp."),
|
|
@@ -9087,7 +8917,7 @@ var inputSchema = {
|
|
|
9087
8917
|
var hybridSearch = ({ client, log }) => ({
|
|
9088
8918
|
name: "hybrid_search",
|
|
9089
8919
|
title: "Hybrid search",
|
|
9090
|
-
description:
|
|
8920
|
+
description: "Search your tenant's indexed content (documents + structured records) using hybrid BM25 + dense ranking. Returns up to `limit` results (default 3, max 50 \u2014 raise it in one call when you can accept the larger result) with citations and surrounding context for grounding follow-up reasoning. Narrow with contentTypes/typeName/filters, ownership (userId/scope), folder scope, a created date window, keyword precision (textMode OR/AND/PHRASE), relevance floors (minSimilarity/minTextRelevance), uniqueDocuments, and requireComplete (fail closed on a degraded backend). Tenant-isolated; the caller's scoped key fully constrains which content is visible. ARCHIVED (soft-retracted) documents never appear in results \u2014 fetch them by id via document_get, or restore them via document_update. To stay within the agent context window each hit returns its matched chunkText + a short snippet by default; set includeContext:true for the broader surrounding passage. If the whole result would be too large it is truncated to the top hits (truncated:true). totalResults is the full matching pool and hasMore:true means results remain past this page \u2014 raise limit or advance offset to fetch them. textLegEmpty:true flags that the keyword leg matched nothing (all textScores 0) \u2014 usually a too-long PHRASE query; retry with textMode:\"OR\".",
|
|
9091
8921
|
inputSchema,
|
|
9092
8922
|
handler: async (args) => {
|
|
9093
8923
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT;
|
|
@@ -9105,8 +8935,7 @@ var hybridSearch = ({ client, log }) => ({
|
|
|
9105
8935
|
typeName: args.typeName,
|
|
9106
8936
|
filters: args.filters,
|
|
9107
8937
|
userId: args.userId,
|
|
9108
|
-
|
|
9109
|
-
clientId: args.clientId,
|
|
8938
|
+
scope: args.scope,
|
|
9110
8939
|
createdAfter: args.createdAfter,
|
|
9111
8940
|
createdBefore: args.createdBefore,
|
|
9112
8941
|
minSimilarity: args.minSimilarity,
|
|
@@ -9133,6 +8962,12 @@ var hybridSearch = ({ client, log }) => ({
|
|
|
9133
8962
|
envelope.returnedResults = shaped.length;
|
|
9134
8963
|
text = JSON.stringify(envelope, null, 2);
|
|
9135
8964
|
}
|
|
8965
|
+
const offset = args.offset ?? 0;
|
|
8966
|
+
const totalResults = result.totalResults;
|
|
8967
|
+
if (typeof totalResults === "number" && offset + shaped.length < totalResults) {
|
|
8968
|
+
envelope.hasMore = true;
|
|
8969
|
+
text = JSON.stringify(envelope, null, 2);
|
|
8970
|
+
}
|
|
9136
8971
|
log.debug(
|
|
9137
8972
|
{ tool: "hybrid_search", mode, limit, returned: shaped.length, textLegEmpty },
|
|
9138
8973
|
"hybrid_search ok"
|
|
@@ -9168,7 +9003,7 @@ async function drainPages(fetchPage) {
|
|
|
9168
9003
|
|
|
9169
9004
|
// src/tools/record_query.ts
|
|
9170
9005
|
var MCP_DEFAULT_LIMIT2 = 3;
|
|
9171
|
-
var MCP_MAX_LIMIT2 =
|
|
9006
|
+
var MCP_MAX_LIMIT2 = 100;
|
|
9172
9007
|
var inputSchema2 = {
|
|
9173
9008
|
type: import_zod2.z.string().min(1, "type (record type) is required").describe('Record type / schema name (e.g. "patient", "clinical_note").'),
|
|
9174
9009
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
|
|
@@ -9184,16 +9019,18 @@ var inputSchema2 = {
|
|
|
9184
9019
|
),
|
|
9185
9020
|
// List-mode args:
|
|
9186
9021
|
userId: import_zod2.z.string().optional().describe("List mode: scope to records owned by this user."),
|
|
9187
|
-
|
|
9188
|
-
|
|
9022
|
+
scope: import_zod2.z.string().optional().describe(
|
|
9023
|
+
'List mode: filter to records carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
|
|
9024
|
+
),
|
|
9025
|
+
startFrom: import_zod2.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
|
|
9189
9026
|
limit: import_zod2.z.number().int().min(1).max(MCP_MAX_LIMIT2).optional().describe(
|
|
9190
|
-
`Max records
|
|
9027
|
+
`Max records per page. Defaults to a low ${MCP_DEFAULT_LIMIT2} to protect the agent context window; raise up to ${MCP_MAX_LIMIT2} (the records API max) in one call when you can accept the larger payload, or page with \`startFrom\` instead.`
|
|
9191
9028
|
)
|
|
9192
9029
|
};
|
|
9193
9030
|
var recordQuery = ({ client, log }) => ({
|
|
9194
9031
|
name: "record_query",
|
|
9195
9032
|
title: "Record query (list or lookup)",
|
|
9196
|
-
description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields too.\n \u2022 List by type: omit `field`; optionally filter by `userId
|
|
9033
|
+
description: "Query structured records of a given type. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields too.\n \u2022 List by type: omit `field`; optionally filter by `userId` or `scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` records (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected from the arguments present.",
|
|
9197
9034
|
inputSchema: inputSchema2,
|
|
9198
9035
|
handler: async (args) => {
|
|
9199
9036
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT2;
|
|
@@ -9203,8 +9040,9 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9203
9040
|
const from = args.from;
|
|
9204
9041
|
const to = args.to;
|
|
9205
9042
|
const prefix = args.prefix;
|
|
9043
|
+
const startFrom = args.startFrom;
|
|
9206
9044
|
try {
|
|
9207
|
-
let
|
|
9045
|
+
let page;
|
|
9208
9046
|
if (field) {
|
|
9209
9047
|
const hasEquality = value !== void 0;
|
|
9210
9048
|
const hasRange = from !== void 0 || to !== void 0;
|
|
@@ -9227,7 +9065,7 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9227
9065
|
if (hasRange && !(from !== void 0 && to !== void 0)) {
|
|
9228
9066
|
return toolError("record_query", new Error("range lookup requires both 'from' and 'to'."));
|
|
9229
9067
|
}
|
|
9230
|
-
|
|
9068
|
+
page = await client.records.lookupRecordsByBody({
|
|
9231
9069
|
type,
|
|
9232
9070
|
field,
|
|
9233
9071
|
value,
|
|
@@ -9235,29 +9073,30 @@ var recordQuery = ({ client, log }) => ({
|
|
|
9235
9073
|
to,
|
|
9236
9074
|
prefix,
|
|
9237
9075
|
order: args.order,
|
|
9076
|
+
startFrom,
|
|
9238
9077
|
limit
|
|
9239
9078
|
});
|
|
9240
|
-
records = pageItems(page);
|
|
9241
9079
|
log.debug(
|
|
9242
|
-
{ tool: "record_query", mode: "lookup", type, field, returned:
|
|
9080
|
+
{ tool: "record_query", mode: "lookup", type, field, returned: pageItems(page).length },
|
|
9243
9081
|
"record_query lookup ok"
|
|
9244
9082
|
);
|
|
9245
9083
|
} else {
|
|
9246
|
-
|
|
9084
|
+
page = await client.records.listRecords({
|
|
9247
9085
|
type,
|
|
9248
9086
|
userId: args.userId,
|
|
9249
|
-
|
|
9250
|
-
|
|
9087
|
+
scope: args.scope,
|
|
9088
|
+
startFrom,
|
|
9251
9089
|
limit
|
|
9252
9090
|
});
|
|
9253
|
-
records = pageItems(page);
|
|
9254
9091
|
log.debug(
|
|
9255
|
-
{ tool: "record_query", mode: "list", type, limit, returned:
|
|
9092
|
+
{ tool: "record_query", mode: "list", type, limit, returned: pageItems(page).length },
|
|
9256
9093
|
"record_query list ok"
|
|
9257
9094
|
);
|
|
9258
9095
|
}
|
|
9096
|
+
const records = pageItems(page);
|
|
9097
|
+
const nextCursor = page.nextCursor ?? null;
|
|
9259
9098
|
return {
|
|
9260
|
-
content: [{ type: "text", text: JSON.stringify(records, null, 2) }]
|
|
9099
|
+
content: [{ type: "text", text: JSON.stringify({ data: records, nextCursor }, null, 2) }]
|
|
9261
9100
|
};
|
|
9262
9101
|
} catch (err) {
|
|
9263
9102
|
log.warn({ tool: "record_query", err: String(err) }, "record_query failed");
|
|
@@ -9379,8 +9218,9 @@ var inputSchema4 = {
|
|
|
9379
9218
|
status: import_zod4.z.string().optional().describe("Record lifecycle status. Defaults to ACTIVE server-side."),
|
|
9380
9219
|
folderId: import_zod4.z.string().optional().describe("Group this record into a folder."),
|
|
9381
9220
|
userId: import_zod4.z.string().optional().describe("Owning user id."),
|
|
9382
|
-
|
|
9383
|
-
|
|
9221
|
+
scopes: import_zod4.z.array(import_zod4.z.string()).optional().describe(
|
|
9222
|
+
'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the record\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE record owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
|
|
9223
|
+
)
|
|
9384
9224
|
};
|
|
9385
9225
|
var recordCreate = ({ client, log }) => ({
|
|
9386
9226
|
name: "record_create",
|
|
@@ -9399,8 +9239,7 @@ var recordCreate = ({ client, log }) => ({
|
|
|
9399
9239
|
status: args.status,
|
|
9400
9240
|
folderId: args.folderId,
|
|
9401
9241
|
userId: args.userId,
|
|
9402
|
-
|
|
9403
|
-
clientId: args.clientId
|
|
9242
|
+
scopes: args.scopes
|
|
9404
9243
|
}
|
|
9405
9244
|
});
|
|
9406
9245
|
log.debug({ tool: "record_create", type, id: created.id }, "record_create ok");
|
|
@@ -9485,24 +9324,27 @@ var record_delete_default = recordDelete;
|
|
|
9485
9324
|
// src/tools/rag_ask.ts
|
|
9486
9325
|
var import_zod7 = require("zod");
|
|
9487
9326
|
var SEARCH_MCP_DEFAULT_LIMIT = 5;
|
|
9488
|
-
var SEARCH_MCP_MAX_LIMIT =
|
|
9327
|
+
var SEARCH_MCP_MAX_LIMIT = 50;
|
|
9489
9328
|
var inputSchema7 = {
|
|
9490
9329
|
query: import_zod7.z.string().min(1, "query must be non-empty").describe("Question to ground against retrieved content."),
|
|
9491
9330
|
instructions: import_zod7.z.string().optional().describe(
|
|
9492
9331
|
'System prompt that overrides the default for the generation step \u2014 e.g. "answer only from the provided context, cite sources, be concise". Default: a generic answer-from-context instruction.'
|
|
9493
9332
|
),
|
|
9494
9333
|
model: import_zod7.z.string().optional().describe(
|
|
9495
|
-
"Inference model alias (e.g. claude-haiku-4-5, claude-sonnet-
|
|
9334
|
+
"Inference model alias (e.g. claude-haiku-4-5, claude-sonnet-5, claude-opus-4-8). Default = tier-appropriate Haiku. See GET /v1/models for the catalog the calling key can reach."
|
|
9496
9335
|
),
|
|
9497
9336
|
search: import_zod7.z.object({
|
|
9498
9337
|
mode: import_zod7.z.enum(["HYBRID", "TEXT", "SEMANTIC"]).optional().describe("Retrieval mode. Default HYBRID."),
|
|
9499
|
-
limit: import_zod7.z.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
|
|
9338
|
+
limit: import_zod7.z.number().int().min(1).max(SEARCH_MCP_MAX_LIMIT).optional().describe(
|
|
9339
|
+
`Passages to retrieve before generating (the grounding-corpus size). Default ${SEARCH_MCP_DEFAULT_LIMIT}; raise up to ${SEARCH_MCP_MAX_LIMIT} (the RAG search API max) for a broader corpus when the extra grounding is worth the larger prompt.`
|
|
9340
|
+
),
|
|
9500
9341
|
// Retrieval scoping — parity with hybrid_search so an agent can ground the
|
|
9501
9342
|
// answer on a specific owner / folder / type / metadata subset, not just the
|
|
9502
9343
|
// whole-tenant corpus.
|
|
9503
9344
|
userId: import_zod7.z.string().optional().describe("Restrict retrieval to content owned by this user (Vectros UUID)."),
|
|
9504
|
-
|
|
9505
|
-
|
|
9345
|
+
scope: import_zod7.z.string().optional().describe(
|
|
9346
|
+
'Restrict retrieval to content carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
|
|
9347
|
+
),
|
|
9506
9348
|
folderId: import_zod7.z.string().optional().describe("Restrict retrieval to this exact folder."),
|
|
9507
9349
|
rootFolderId: import_zod7.z.string().optional().describe("Restrict retrieval to this folder and all its descendants."),
|
|
9508
9350
|
typeName: import_zod7.z.string().optional().describe("Restrict record retrieval to this schema type."),
|
|
@@ -9520,7 +9362,7 @@ var inputSchema7 = {
|
|
|
9520
9362
|
var ragAsk = ({ client, log }) => ({
|
|
9521
9363
|
name: "rag_ask",
|
|
9522
9364
|
title: "RAG ask (corpus-wide)",
|
|
9523
|
-
description: "Ask a question grounded against
|
|
9365
|
+
description: "Ask a question grounded against your tenant's indexed content. Vectros performs a hybrid search, injects the top-K passages into the prompt, and streams a model answer back. Scope retrieval with `search` (ownership, folder, type, metadata filters, date window) to ground on a subset \u2014 e.g. one patient or one folder \u2014 and steer generation with `instructions` / `temperature`. The full answer is returned as a single response; progress notifications keep the call alive during the 30-45s generation window. Inference runs in-perimeter against AWS Bedrock \u2014 PHI never leaves the BAA boundary.",
|
|
9524
9366
|
inputSchema: inputSchema7,
|
|
9525
9367
|
handler: async (args, extra) => {
|
|
9526
9368
|
try {
|
|
@@ -9529,8 +9371,7 @@ var ragAsk = ({ client, log }) => ({
|
|
|
9529
9371
|
mode: searchArg.mode ?? "HYBRID",
|
|
9530
9372
|
limit: searchArg.limit ?? SEARCH_MCP_DEFAULT_LIMIT,
|
|
9531
9373
|
userId: searchArg.userId,
|
|
9532
|
-
|
|
9533
|
-
clientId: searchArg.clientId,
|
|
9374
|
+
scope: searchArg.scope,
|
|
9534
9375
|
folderId: searchArg.folderId,
|
|
9535
9376
|
rootFolderId: searchArg.rootFolderId,
|
|
9536
9377
|
typeName: searchArg.typeName,
|
|
@@ -9675,32 +9516,32 @@ var inputSchema9 = {
|
|
|
9675
9516
|
userId: import_zod9.z.string().optional().describe(
|
|
9676
9517
|
"Filter to schemas visible to a specific user. Optional; default returns all schemas the credential can see."
|
|
9677
9518
|
),
|
|
9678
|
-
|
|
9679
|
-
|
|
9519
|
+
scope: import_zod9.z.string().optional().describe(
|
|
9520
|
+
'Filter to schemas carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces. Optional; default returns all schemas the credential can see.'
|
|
9680
9521
|
),
|
|
9681
|
-
surface: import_zod9.z.enum(["record", "document", "user", "
|
|
9682
|
-
"Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types.
|
|
9522
|
+
surface: import_zod9.z.enum(["record", "document", "user", "entity"]).optional().describe(
|
|
9523
|
+
"Filter to schemas bindable to this surface \u2014 e.g. `document` to list only document types, or `record` for record types. Identity entities in any namespace (org/client/one you registered) bind under the single `entity` surface; `user` and `entity` are account-wide. Optional."
|
|
9683
9524
|
),
|
|
9684
9525
|
recordType: import_zod9.z.string().optional().describe(
|
|
9685
|
-
'Resolve the single schema for this record type (its natural handle, e.g. "patient") instead of listing \u2014 returns a one-element result, or empty if none. Combine with `surface=user|
|
|
9526
|
+
'Resolve the single schema for this record type (its natural handle, e.g. "patient") instead of listing \u2014 returns a one-element result, or empty if none. Combine with `surface=user|entity` for an identity schema. Takes precedence over userId. Optional.'
|
|
9686
9527
|
)
|
|
9687
9528
|
};
|
|
9688
9529
|
var listSchemas = ({ client, log }) => ({
|
|
9689
9530
|
name: "list_schemas",
|
|
9690
9531
|
title: "List record schemas",
|
|
9691
|
-
description: 'List the structured-record schema catalog for
|
|
9532
|
+
description: 'List the structured-record schema catalog for your tenant. Each schema describes a record type (e.g. "patient", "clinical_note") \u2014 its fields, lookup-indexed fields, and capabilities. Use this to discover what record types exist before calling `record_query`. Filter with `surface` (record/document/user/entity \u2014 e.g. only document types), `recordType` (resolve one schema by its type name), or `userId`/`scope`; default returns everything the credential can see.',
|
|
9692
9533
|
inputSchema: inputSchema9,
|
|
9693
9534
|
handler: async (args) => {
|
|
9694
9535
|
const userId = args.userId;
|
|
9695
|
-
const
|
|
9536
|
+
const scope = args.scope;
|
|
9696
9537
|
const surface = args.surface;
|
|
9697
9538
|
const recordType = args.recordType;
|
|
9698
9539
|
try {
|
|
9699
9540
|
const schemas = await drainPages(
|
|
9700
|
-
(startFrom) => client.schemas.listSchemas({ userId,
|
|
9541
|
+
(startFrom) => client.schemas.listSchemas({ userId, scope, surface, recordType, startFrom })
|
|
9701
9542
|
);
|
|
9702
9543
|
log.debug(
|
|
9703
|
-
{ tool: "list_schemas", userId,
|
|
9544
|
+
{ tool: "list_schemas", userId, scope, surface, recordType, returned: schemas.length },
|
|
9704
9545
|
"list_schemas ok"
|
|
9705
9546
|
);
|
|
9706
9547
|
return {
|
|
@@ -9810,7 +9651,7 @@ var document_get_default = documentGet;
|
|
|
9810
9651
|
// src/tools/document_query.ts
|
|
9811
9652
|
var import_zod11 = require("zod");
|
|
9812
9653
|
var MCP_DEFAULT_LIMIT3 = 3;
|
|
9813
|
-
var MCP_MAX_LIMIT3 =
|
|
9654
|
+
var MCP_MAX_LIMIT3 = 100;
|
|
9814
9655
|
var inputSchema11 = {
|
|
9815
9656
|
// Lookup-mode args — provide `field` plus EXACTLY ONE of: value | from+to | prefix.
|
|
9816
9657
|
field: import_zod11.z.string().optional().describe("Lookup mode: name of the lookup-indexed field to query by."),
|
|
@@ -9825,16 +9666,18 @@ var inputSchema11 = {
|
|
|
9825
9666
|
// List-mode args:
|
|
9826
9667
|
folderId: import_zod11.z.string().optional().describe("List mode: only documents in this folder (Vectros folder id)."),
|
|
9827
9668
|
userId: import_zod11.z.string().optional().describe("List mode: scope to documents owned by this user."),
|
|
9828
|
-
|
|
9829
|
-
|
|
9669
|
+
scope: import_zod11.z.string().optional().describe(
|
|
9670
|
+
'List mode: filter to documents carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
|
|
9671
|
+
),
|
|
9672
|
+
startFrom: import_zod11.z.string().optional().describe("Pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next. Works in both list and lookup mode."),
|
|
9830
9673
|
limit: import_zod11.z.number().int().min(1).max(MCP_MAX_LIMIT3).optional().describe(
|
|
9831
|
-
`Max documents
|
|
9674
|
+
`Max documents per page. Defaults to a low ${MCP_DEFAULT_LIMIT3} to protect the agent context window; raise up to ${MCP_MAX_LIMIT3} (the documents API max) in one call when you can accept the larger payload, or page with \`startFrom\` instead.`
|
|
9832
9675
|
)
|
|
9833
9676
|
};
|
|
9834
9677
|
var documentQuery = ({ client, log }) => ({
|
|
9835
9678
|
name: "document_query",
|
|
9836
9679
|
title: "Document query (list or lookup)",
|
|
9837
|
-
description: "Query document metadata. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields (equality only there); range/prefix need a range-enabled field.\n \u2022 List: omit `field`; optionally filter by `folderId`/`userId`/`
|
|
9680
|
+
description: "Query document metadata. Two modes:\n \u2022 Lookup on a lookup-indexed field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Works on sensitive fields (equality only there); range/prefix need a range-enabled field.\n \u2022 List: omit `field`; optionally filter by `folderId`/`userId`/`scope` (`namespace:value`).\nReturns a `{ data, nextCursor }` page: `data` holds up to `limit` documents (default 3, max 100 \u2014 raise it in one call when you can accept the payload), and a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page. Mode is auto-detected. Use document_get for the full text/download URL of one document.",
|
|
9838
9681
|
inputSchema: inputSchema11,
|
|
9839
9682
|
handler: async (args) => {
|
|
9840
9683
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT3;
|
|
@@ -9844,8 +9687,9 @@ var documentQuery = ({ client, log }) => ({
|
|
|
9844
9687
|
const to = args.to;
|
|
9845
9688
|
const prefix = args.prefix;
|
|
9846
9689
|
const type = args.type;
|
|
9690
|
+
const startFrom = args.startFrom;
|
|
9847
9691
|
try {
|
|
9848
|
-
let
|
|
9692
|
+
let page;
|
|
9849
9693
|
if (field) {
|
|
9850
9694
|
const hasEquality = value !== void 0;
|
|
9851
9695
|
const hasRange = from !== void 0 || to !== void 0;
|
|
@@ -9874,7 +9718,7 @@ var documentQuery = ({ client, log }) => ({
|
|
|
9874
9718
|
new Error("lookup requires 'type' (the document's bound schema type) alongside 'field'.")
|
|
9875
9719
|
);
|
|
9876
9720
|
}
|
|
9877
|
-
|
|
9721
|
+
page = await client.documents.lookupDocumentsByBody({
|
|
9878
9722
|
type,
|
|
9879
9723
|
field,
|
|
9880
9724
|
value,
|
|
@@ -9882,28 +9726,29 @@ var documentQuery = ({ client, log }) => ({
|
|
|
9882
9726
|
to,
|
|
9883
9727
|
prefix,
|
|
9884
9728
|
order: args.order,
|
|
9729
|
+
startFrom,
|
|
9885
9730
|
limit
|
|
9886
9731
|
});
|
|
9887
|
-
documents = pageItems(page);
|
|
9888
9732
|
log.debug(
|
|
9889
|
-
{ tool: "document_query", mode: "lookup", type, field, returned:
|
|
9733
|
+
{ tool: "document_query", mode: "lookup", type, field, returned: pageItems(page).length },
|
|
9890
9734
|
"document_query lookup ok"
|
|
9891
9735
|
);
|
|
9892
9736
|
} else {
|
|
9893
|
-
|
|
9737
|
+
page = await client.documents.listDocuments({
|
|
9894
9738
|
folderId: args.folderId,
|
|
9895
9739
|
userId: args.userId,
|
|
9896
|
-
|
|
9897
|
-
|
|
9740
|
+
scope: args.scope,
|
|
9741
|
+
startFrom,
|
|
9898
9742
|
limit
|
|
9899
9743
|
});
|
|
9900
|
-
documents = pageItems(page);
|
|
9901
9744
|
log.debug(
|
|
9902
|
-
{ tool: "document_query", mode: "list", limit, returned:
|
|
9745
|
+
{ tool: "document_query", mode: "list", limit, returned: pageItems(page).length },
|
|
9903
9746
|
"document_query list ok"
|
|
9904
9747
|
);
|
|
9905
9748
|
}
|
|
9906
|
-
|
|
9749
|
+
const documents = pageItems(page);
|
|
9750
|
+
const nextCursor = page.nextCursor ?? null;
|
|
9751
|
+
return { content: [{ type: "text", text: JSON.stringify({ data: documents, nextCursor }, null, 2) }] };
|
|
9907
9752
|
} catch (err) {
|
|
9908
9753
|
log.warn({ tool: "document_query", err: String(err) }, "document_query failed");
|
|
9909
9754
|
return toolError("document_query", err);
|
|
@@ -9932,8 +9777,9 @@ var inputSchema12 = {
|
|
|
9932
9777
|
"Lifecycle status. `ARCHIVED` soft-retracts the document \u2014 it is pulled from search and recall but kept and recoverable; set it back to `ACTIVE` to re-index and restore it. The way to retire superseded content when the credential has no delete authority. Omit to leave unchanged."
|
|
9933
9778
|
),
|
|
9934
9779
|
userId: import_zod12.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
9935
|
-
|
|
9936
|
-
|
|
9780
|
+
scopes: import_zod12.z.array(import_zod12.z.string()).optional().describe(
|
|
9781
|
+
'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are built-in namespaces. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
|
|
9782
|
+
),
|
|
9937
9783
|
expectedVersion: import_zod12.z.number().int().optional().describe(
|
|
9938
9784
|
"Optimistic concurrency: the version you last read. If the document changed since, the update is refused as a conflict (re-read and retry). Omit for last-write-wins."
|
|
9939
9785
|
)
|
|
@@ -9953,8 +9799,7 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
9953
9799
|
const folderId = args.folderId;
|
|
9954
9800
|
const status = args.status;
|
|
9955
9801
|
const userId = args.userId;
|
|
9956
|
-
const
|
|
9957
|
-
const clientId = args.clientId;
|
|
9802
|
+
const scopes = args.scopes;
|
|
9958
9803
|
const expectedVersion = args.expectedVersion;
|
|
9959
9804
|
try {
|
|
9960
9805
|
const resolved = await resolveDocumentIdByExternalId(client, { id: documentId, externalId, type });
|
|
@@ -9966,8 +9811,7 @@ var documentUpdate = ({ client, log }) => ({
|
|
|
9966
9811
|
if (folderId !== void 0) body.folderId = folderId;
|
|
9967
9812
|
if (status !== void 0) body.status = status;
|
|
9968
9813
|
if (userId !== void 0) body.userId = userId;
|
|
9969
|
-
if (
|
|
9970
|
-
if (clientId !== void 0) body.clientId = clientId;
|
|
9814
|
+
if (scopes !== void 0) body.scopes = scopes;
|
|
9971
9815
|
if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
|
|
9972
9816
|
const updated = await client.documents.patchDocument({
|
|
9973
9817
|
id: resolved.id,
|
|
@@ -10012,20 +9856,23 @@ var document_delete_default = documentDelete;
|
|
|
10012
9856
|
// src/tools/folder_query.ts
|
|
10013
9857
|
var import_zod14 = require("zod");
|
|
10014
9858
|
var MCP_DEFAULT_LIMIT4 = 10;
|
|
10015
|
-
var MCP_MAX_LIMIT4 =
|
|
9859
|
+
var MCP_MAX_LIMIT4 = 100;
|
|
10016
9860
|
var inputSchema14 = {
|
|
10017
9861
|
id: import_zod14.z.string().optional().describe("Get mode: fetch this single folder by id."),
|
|
10018
9862
|
parentId: import_zod14.z.string().optional().describe("List mode: direct children of this folder (tree navigation). Omit for a flat tenant list."),
|
|
10019
9863
|
userId: import_zod14.z.string().optional().describe("List mode: scope to folders owned by this user."),
|
|
10020
|
-
|
|
10021
|
-
|
|
9864
|
+
scope: import_zod14.z.string().optional().describe(
|
|
9865
|
+
'List mode: filter to folders carrying this scope value, in `namespace:value` form (e.g. "org:<uuid>", "client:<uuid>", "group:eng-team"). `org` and `client` are built-in namespaces; others are custom scopes you define.'
|
|
9866
|
+
),
|
|
10022
9867
|
startFrom: import_zod14.z.string().optional().describe("List mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
10023
|
-
limit: import_zod14.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
|
|
9868
|
+
limit: import_zod14.z.number().int().min(1).max(MCP_MAX_LIMIT4).optional().describe(
|
|
9869
|
+
`List mode: max folders per page. Default 10; raise up to ${MCP_MAX_LIMIT4} (the folders API max) in one call when you can accept the larger page, or page with \`startFrom\`.`
|
|
9870
|
+
)
|
|
10024
9871
|
};
|
|
10025
9872
|
var folderQuery = ({ client, log }) => ({
|
|
10026
9873
|
name: "folder_query",
|
|
10027
9874
|
title: "Folder query (list or get)",
|
|
10028
|
-
description: "Read folders. Two modes:\n \u2022 Get: pass `id` \u2192 returns the single folder.\n \u2022 List: omit `id`; pass `parentId` for a folder's direct children (tree navigation) or omit for a flat tenant list. Optionally filter by `userId
|
|
9875
|
+
description: "Read folders. Two modes:\n \u2022 Get: pass `id` \u2192 returns the single folder.\n \u2022 List: omit `id`; pass `parentId` for a folder's direct children (tree navigation) or omit for a flat tenant list. Optionally filter by `userId` or `scope` (`namespace:value`).\nList mode returns `{ data, nextCursor }` (default 10, max 100 per page \u2014 raise it in one call when you can accept the larger page); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom` to page through all folders. Get mode returns the single folder object.",
|
|
10029
9876
|
inputSchema: inputSchema14,
|
|
10030
9877
|
handler: async (args) => {
|
|
10031
9878
|
const id = args.id;
|
|
@@ -10039,8 +9886,7 @@ var folderQuery = ({ client, log }) => ({
|
|
|
10039
9886
|
const page = await client.folders.listFolders({
|
|
10040
9887
|
parentFolderId: args.parentId,
|
|
10041
9888
|
userId: args.userId,
|
|
10042
|
-
|
|
10043
|
-
clientId: args.clientId,
|
|
9889
|
+
scope: args.scope,
|
|
10044
9890
|
startFrom: args.startFrom,
|
|
10045
9891
|
limit
|
|
10046
9892
|
});
|
|
@@ -10064,8 +9910,9 @@ var inputSchema15 = {
|
|
|
10064
9910
|
parentId: import_zod15.z.string().optional().describe("Parent folder id \u2014 places the folder under this parent. Omit for the context default root. Create-only."),
|
|
10065
9911
|
slug: import_zod15.z.string().optional().describe("Optional stable slug (sibling-unique; idempotency key). Lowercase letters/digits/hyphens. Derived from name when omitted."),
|
|
10066
9912
|
userId: import_zod15.z.string().optional().describe("Owning user (Vectros UUID)."),
|
|
10067
|
-
|
|
10068
|
-
|
|
9913
|
+
scopes: import_zod15.z.array(import_zod15.z.string()).optional().describe(
|
|
9914
|
+
'Scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the folder\'s COMPLETE scope declaration and values must come from the credential\'s own identity. An empty array `[]` creates a PRIVATE folder owned by the calling user alone. Omit to stamp the credential\'s full identity \u2014 the default.'
|
|
9915
|
+
)
|
|
10069
9916
|
};
|
|
10070
9917
|
var folderCreate = ({ client, log }) => ({
|
|
10071
9918
|
name: "folder_create",
|
|
@@ -10081,8 +9928,7 @@ var folderCreate = ({ client, log }) => ({
|
|
|
10081
9928
|
parentFolderId: args.parentId,
|
|
10082
9929
|
slug: args.slug,
|
|
10083
9930
|
userId: args.userId,
|
|
10084
|
-
|
|
10085
|
-
clientId: args.clientId
|
|
9931
|
+
scopes: args.scopes
|
|
10086
9932
|
}
|
|
10087
9933
|
});
|
|
10088
9934
|
log.debug({ tool: "folder_create", id: folder.id, name: folder.name }, "folder_create ok");
|
|
@@ -10102,8 +9948,9 @@ var inputSchema16 = {
|
|
|
10102
9948
|
name: import_zod16.z.string().optional().describe("New folder name. Omit to keep the current name."),
|
|
10103
9949
|
description: import_zod16.z.string().optional().describe("New description. Omit to leave unchanged."),
|
|
10104
9950
|
userId: import_zod16.z.string().optional().describe("Reassign the owning user (Vectros UUID)."),
|
|
10105
|
-
|
|
10106
|
-
|
|
9951
|
+
scopes: import_zod16.z.array(import_zod16.z.string()).optional().describe(
|
|
9952
|
+
'Reassign scope ownership as `namespace:value` entries, at most 2 (e.g. ["org:<uuid>", "group:eng-team"]) \u2014 the COMPLETE new parent set. `org`/`client` are built-in namespaces. Omit to leave ownership unchanged; `[]` clears it (private to the owning user).'
|
|
9953
|
+
),
|
|
10107
9954
|
expectedVersion: import_zod16.z.number().int().optional().describe(
|
|
10108
9955
|
"Optimistic concurrency: the version you last read. If the folder changed since, the update is refused as a conflict (re-read and retry). Omit for last-write-wins."
|
|
10109
9956
|
)
|
|
@@ -10118,16 +9965,14 @@ var folderUpdate = ({ client, log }) => ({
|
|
|
10118
9965
|
const name = args.name;
|
|
10119
9966
|
const description = args.description;
|
|
10120
9967
|
const userId = args.userId;
|
|
10121
|
-
const
|
|
10122
|
-
const clientId = args.clientId;
|
|
9968
|
+
const scopes = args.scopes;
|
|
10123
9969
|
const expectedVersion = args.expectedVersion;
|
|
10124
9970
|
try {
|
|
10125
9971
|
const body = {};
|
|
10126
9972
|
if (name !== void 0) body.name = name;
|
|
10127
9973
|
if (description !== void 0) body.description = description;
|
|
10128
9974
|
if (userId !== void 0) body.userId = userId;
|
|
10129
|
-
if (
|
|
10130
|
-
if (clientId !== void 0) body.clientId = clientId;
|
|
9975
|
+
if (scopes !== void 0) body.scopes = scopes;
|
|
10131
9976
|
if (expectedVersion !== void 0) body.expectedVersion = expectedVersion;
|
|
10132
9977
|
const updated = await client.folders.patchFolder({ id, body });
|
|
10133
9978
|
log.debug({ tool: "folder_update", id }, "folder_update ok");
|
|
@@ -10293,8 +10138,9 @@ var inputSchema19 = {
|
|
|
10293
10138
|
// Common (both modes):
|
|
10294
10139
|
folderId: import_zod18.z.string().optional().describe("Optional folder to ingest into. Default: tenant root."),
|
|
10295
10140
|
userId: import_zod18.z.string().optional().describe("Owning user ID. Optional."),
|
|
10296
|
-
|
|
10297
|
-
|
|
10141
|
+
scopes: import_zod18.z.array(import_zod18.z.string()).optional().describe(
|
|
10142
|
+
"TEXT MODE ONLY. Scope ownership as `namespace:value` entries, at most 2 (e.g. [\"org:<uuid>\", \"group:eng-team\"]). `org` and `client` are built-in namespaces; others are custom scopes you define. This is the document's COMPLETE scope declaration and values must come from the credential's own identity. An empty array `[]` creates a PRIVATE document owned by the calling user alone. Omit to stamp the credential's full identity \u2014 the default. Rejected with `filePath` (file uploads do not accept a scope declaration): a file-uploaded document is stamped with the credential's full identity."
|
|
10143
|
+
)
|
|
10298
10144
|
};
|
|
10299
10145
|
var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
10300
10146
|
name: "document_ingest",
|
|
@@ -10328,14 +10174,20 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
10328
10174
|
)
|
|
10329
10175
|
);
|
|
10330
10176
|
}
|
|
10177
|
+
if (filePath && args.scopes !== void 0) {
|
|
10178
|
+
return toolError(
|
|
10179
|
+
"document_ingest",
|
|
10180
|
+
new Error(
|
|
10181
|
+
"`scopes` is not supported with `filePath` \u2014 file uploads do not accept a scope declaration, and silently ignoring it could make an intended-private document team-visible. Use `text` mode to declare scopes, or omit `scopes` (the upload is stamped with the credential's full identity)."
|
|
10182
|
+
)
|
|
10183
|
+
);
|
|
10184
|
+
}
|
|
10331
10185
|
const common = {
|
|
10332
10186
|
folderId: args.folderId,
|
|
10333
10187
|
payload: args.payload,
|
|
10334
10188
|
schemaId,
|
|
10335
10189
|
externalId: args.externalId,
|
|
10336
|
-
userId: args.userId
|
|
10337
|
-
orgId: args.orgId,
|
|
10338
|
-
clientId: args.clientId
|
|
10190
|
+
userId: args.userId
|
|
10339
10191
|
};
|
|
10340
10192
|
try {
|
|
10341
10193
|
if (text) {
|
|
@@ -10345,6 +10197,9 @@ var documentIngest = ({ client, log, transport, ingestRoot }) => ({
|
|
|
10345
10197
|
title,
|
|
10346
10198
|
text,
|
|
10347
10199
|
indexMode,
|
|
10200
|
+
// Scope ownership is a TEXT-mode contract only (the upload-init
|
|
10201
|
+
// endpoint has no scopes field — see the gate above).
|
|
10202
|
+
scopes: args.scopes,
|
|
10348
10203
|
...common
|
|
10349
10204
|
}
|
|
10350
10205
|
});
|
|
@@ -10437,9 +10292,11 @@ var document_ingest_default = documentIngest;
|
|
|
10437
10292
|
// src/tools/lookup_principal.ts
|
|
10438
10293
|
var import_zod19 = require("zod");
|
|
10439
10294
|
var MCP_DEFAULT_LIMIT5 = 10;
|
|
10440
|
-
var MCP_MAX_LIMIT5 =
|
|
10295
|
+
var MCP_MAX_LIMIT5 = 100;
|
|
10441
10296
|
var inputSchema20 = {
|
|
10442
|
-
kind: import_zod19.z.
|
|
10297
|
+
kind: import_zod19.z.string().describe(
|
|
10298
|
+
'Which principal to look up: "user" (the fixed principal surface), or an entity namespace \u2014 "org", "client" (built in), or a namespace you registered.'
|
|
10299
|
+
),
|
|
10443
10300
|
externalId: import_zod19.z.string().optional().describe(
|
|
10444
10301
|
"Resolve mode: your own stable identifier for the principal. Returns the single matching principal (with its Vectros UUID), or an empty array if none. The fastest path to the UUID the ownership filters need. Takes precedence if both this and a `field` lookup are supplied."
|
|
10445
10302
|
),
|
|
@@ -10451,15 +10308,19 @@ var inputSchema20 = {
|
|
|
10451
10308
|
to: import_zod19.z.string().optional().describe("Lookup mode (range): inclusive upper bound; requires `from`."),
|
|
10452
10309
|
prefix: import_zod19.z.string().optional().describe("Lookup mode (prefix): match values starting with this. Range-enabled string fields only."),
|
|
10453
10310
|
order: import_zod19.z.enum(["asc", "desc"]).optional().describe("Lookup mode: sort direction by the looked-up field. `asc` (default) or `desc`."),
|
|
10454
|
-
|
|
10311
|
+
startFrom: import_zod19.z.string().optional().describe("Lookup mode: pagination cursor \u2014 pass the `nextCursor` from the previous page to fetch the next."),
|
|
10312
|
+
limit: import_zod19.z.number().int().min(1).max(MCP_MAX_LIMIT5).optional().describe(
|
|
10313
|
+
`Max principals per page. Defaults to ${MCP_DEFAULT_LIMIT5}; raise up to ${MCP_MAX_LIMIT5} (the principals API max) in one call when you can accept the payload, or page with \`startFrom\`.`
|
|
10314
|
+
)
|
|
10455
10315
|
};
|
|
10456
10316
|
var lookupPrincipal = ({ client, log }) => ({
|
|
10457
10317
|
name: "lookup_principal",
|
|
10458
|
-
title: "Look up a user
|
|
10459
|
-
description: "Resolve a user,
|
|
10318
|
+
title: "Look up a user identity or a namespaced identity entity",
|
|
10319
|
+
description: "Resolve a user, or an identity entity in a namespace (org/client/one you registered). Two modes:\n \u2022 Resolve by your own id: pass `externalId` \u2192 the matching principal incl. its Vectros UUID (the id the ownership filters on record_query / hybrid_search / rag_ask expect).\n \u2022 Lookup by a schema field: pass `type` and `field` plus exactly one of `value` (exact), `from`+`to` (range), or `prefix`. Sensitive-field-safe. (If both `externalId` and a `field` lookup are given, `externalId` wins.) Returns a `{ data, nextCursor }` page (default 10, max 100 \u2014 raise it in one call when you can accept the payload); a non-null `nextCursor` means more remain \u2014 pass it back as `startFrom`. Read-only \u2014 does not create or modify identities.",
|
|
10460
10320
|
inputSchema: inputSchema20,
|
|
10461
10321
|
handler: async (args) => {
|
|
10462
10322
|
const kind = args.kind;
|
|
10323
|
+
const isUser = kind === "user";
|
|
10463
10324
|
const limit = args.limit ?? MCP_DEFAULT_LIMIT5;
|
|
10464
10325
|
const externalId = args.externalId;
|
|
10465
10326
|
const type = args.type;
|
|
@@ -10469,16 +10330,11 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
10469
10330
|
const to = args.to;
|
|
10470
10331
|
const prefix = args.prefix;
|
|
10471
10332
|
const order = args.order;
|
|
10333
|
+
const startFrom = args.startFrom;
|
|
10472
10334
|
try {
|
|
10473
10335
|
let page;
|
|
10474
10336
|
if (externalId !== void 0) {
|
|
10475
|
-
|
|
10476
|
-
page = await client.identity.listUsers({ externalId, limit });
|
|
10477
|
-
} else if (kind === "org") {
|
|
10478
|
-
page = await client.identity.listOrgs({ externalId, limit });
|
|
10479
|
-
} else {
|
|
10480
|
-
page = await client.identity.listClients({ externalId, limit });
|
|
10481
|
-
}
|
|
10337
|
+
page = isUser ? await client.identity.listUsers({ externalId, limit }) : await client.identity.listEntities({ namespace: kind, externalId, limit });
|
|
10482
10338
|
log.debug({ tool: "lookup_principal", mode: "resolve", kind }, "lookup_principal resolve ok");
|
|
10483
10339
|
} else if (field !== void 0) {
|
|
10484
10340
|
const hasEquality = value !== void 0;
|
|
@@ -10506,14 +10362,8 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
10506
10362
|
new Error("lookup requires 'type' (the identity schema's record type) alongside 'field'.")
|
|
10507
10363
|
);
|
|
10508
10364
|
}
|
|
10509
|
-
const req = { type, field, value, from, to, prefix, order, limit };
|
|
10510
|
-
|
|
10511
|
-
page = await client.identity.lookupUsers(req);
|
|
10512
|
-
} else if (kind === "org") {
|
|
10513
|
-
page = await client.identity.lookupOrgs(req);
|
|
10514
|
-
} else {
|
|
10515
|
-
page = await client.identity.lookupClients(req);
|
|
10516
|
-
}
|
|
10365
|
+
const req = { type, field, value, from, to, prefix, order, startFrom, limit };
|
|
10366
|
+
page = isUser ? await client.identity.lookupUsers(req) : await client.identity.lookupEntities({ namespace: kind, body: req });
|
|
10517
10367
|
log.debug({ tool: "lookup_principal", mode: "lookup", kind, type, field }, "lookup_principal lookup ok");
|
|
10518
10368
|
} else {
|
|
10519
10369
|
return toolError(
|
|
@@ -10522,7 +10372,8 @@ var lookupPrincipal = ({ client, log }) => ({
|
|
|
10522
10372
|
);
|
|
10523
10373
|
}
|
|
10524
10374
|
const principals = pageItems(page);
|
|
10525
|
-
|
|
10375
|
+
const nextCursor = page.nextCursor ?? null;
|
|
10376
|
+
return { content: [{ type: "text", text: JSON.stringify({ data: principals, nextCursor }, null, 2) }] };
|
|
10526
10377
|
} catch (err) {
|
|
10527
10378
|
log.warn({ tool: "lookup_principal", kind, err: String(err) }, "lookup_principal failed");
|
|
10528
10379
|
return toolError("lookup_principal", err);
|
|
@@ -11104,10 +10955,144 @@ function parseToolsEnv(value) {
|
|
|
11104
10955
|
return requested;
|
|
11105
10956
|
}
|
|
11106
10957
|
|
|
10958
|
+
// src/resolve-key.ts
|
|
10959
|
+
var import_node_child_process = require("child_process");
|
|
10960
|
+
var import_node_fs = require("fs");
|
|
10961
|
+
var import_node_path2 = __toESM(require("path"));
|
|
10962
|
+
var HELPER_COMMAND = "vectros";
|
|
10963
|
+
var HELPER_TIMEOUT_MS = 1e4;
|
|
10964
|
+
var HELPER_MAX_BUFFER = 64 * 1024;
|
|
10965
|
+
var ALIAS_RE = /^[A-Za-z0-9._-]+$/;
|
|
10966
|
+
var SECRET_RE = /(?:ssk|sk|st)_(?:live|test)_[A-Za-z0-9._-]+/gi;
|
|
10967
|
+
var DETAIL_MAX_CHARS = 200;
|
|
10968
|
+
async function resolveApiKey(deps = {}) {
|
|
10969
|
+
const env = deps.env ?? process.env;
|
|
10970
|
+
const envKey = env.VECTROS_API_KEY;
|
|
10971
|
+
if (envKey && envKey.trim().length > 0) {
|
|
10972
|
+
return { key: envKey.trim(), source: "env" };
|
|
10973
|
+
}
|
|
10974
|
+
const alias = env.VECTROS_KEYRING_ALIAS?.trim() || void 0;
|
|
10975
|
+
if (alias !== void 0 && !ALIAS_RE.test(alias)) {
|
|
10976
|
+
return {
|
|
10977
|
+
source: "none",
|
|
10978
|
+
reason: "bad-alias",
|
|
10979
|
+
detail: "VECTROS_KEYRING_ALIAS must be letters, digits, dot, dash, or underscore."
|
|
10980
|
+
};
|
|
10981
|
+
}
|
|
10982
|
+
const runHelper = deps.runHelper ?? defaultRunHelper;
|
|
10983
|
+
const outcome = await runHelper({ alias, env });
|
|
10984
|
+
switch (outcome.status) {
|
|
10985
|
+
case "ok":
|
|
10986
|
+
return { key: outcome.secret, source: "keyring", alias };
|
|
10987
|
+
case "cli-absent":
|
|
10988
|
+
return { source: "none", reason: "cli-absent", alias };
|
|
10989
|
+
// Redact HERE as well as in mapExecResult: `runHelper` is a public injectable
|
|
10990
|
+
// seam, so redacting only inside the default implementation would leave any
|
|
10991
|
+
// other implementation's text to reach the fatal log raw. Belongs at the sink.
|
|
10992
|
+
case "no-usable-key":
|
|
10993
|
+
return {
|
|
10994
|
+
source: "none",
|
|
10995
|
+
reason: "no-usable-key",
|
|
10996
|
+
alias,
|
|
10997
|
+
detail: outcome.detail ? redactDetail(outcome.detail) : void 0
|
|
10998
|
+
};
|
|
10999
|
+
case "error":
|
|
11000
|
+
return { source: "none", reason: "helper-failed", alias, detail: redactDetail(outcome.detail) };
|
|
11001
|
+
}
|
|
11002
|
+
}
|
|
11003
|
+
function noKeyMessage(resolved) {
|
|
11004
|
+
const setEnv = "set VECTROS_API_KEY to a Vectros key (recommended: ssk_live_\u2026)";
|
|
11005
|
+
switch (resolved.reason) {
|
|
11006
|
+
case "cli-absent":
|
|
11007
|
+
return `no API key: VECTROS_API_KEY is unset and the \`vectros\` CLI is not on PATH. Either ${setEnv}, or install @vectros-ai/cli and run \`vectros switch <alias>\`.`;
|
|
11008
|
+
case "no-usable-key":
|
|
11009
|
+
return `no API key: VECTROS_API_KEY is unset and \`vectros keyring show\` returned no key${resolved.detail ? ` \u2014 ${resolved.detail}` : ""}. Run \`vectros switch <alias>\` to pick an identity, \`vectros keyring doctor\` to inspect the keyring (CLI 0.10.0+), upgrade @vectros-ai/cli if it predates the keyring (0.9.0), or ${setEnv}.`;
|
|
11010
|
+
case "bad-alias":
|
|
11011
|
+
return `invalid VECTROS_KEYRING_ALIAS: ${resolved.detail ?? "not a valid keyring alias"} Run \`vectros keyring list\` to see the entry names, unset it to use the active identity, or ${setEnv}.`;
|
|
11012
|
+
case "helper-failed":
|
|
11013
|
+
return `no API key: VECTROS_API_KEY is unset and the \`vectros keyring show\` helper failed (${resolved.detail ?? "unknown error"}). Upgrade @vectros-ai/cli if it is an old build, or ${setEnv} to bypass the keyring.`;
|
|
11014
|
+
default:
|
|
11015
|
+
return `no API key: ${setEnv}.`;
|
|
11016
|
+
}
|
|
11017
|
+
}
|
|
11018
|
+
function keyringNotice(resolved) {
|
|
11019
|
+
if (resolved.source !== "keyring") return void 0;
|
|
11020
|
+
if (resolved.alias !== void 0) {
|
|
11021
|
+
return { level: "info", alias: resolved.alias, message: "resolved API key from the vectros CLI keyring" };
|
|
11022
|
+
}
|
|
11023
|
+
return {
|
|
11024
|
+
level: "warn",
|
|
11025
|
+
alias: "(active)",
|
|
11026
|
+
message: "resolved API key from the vectros CLI keyring: no entry was named, so this server is running as whatever identity `vectros switch` last made active. Set VECTROS_API_KEY, or VECTROS_KEYRING_ALIAS, to choose deliberately \u2014 `vectros keyring doctor` shows which entry is active and whether it holds a live key."
|
|
11027
|
+
};
|
|
11028
|
+
}
|
|
11029
|
+
function redactDetail(message) {
|
|
11030
|
+
const redacted = message.replace(/\s+/g, " ").trim().replace(SECRET_RE, "[redacted]");
|
|
11031
|
+
return redacted.length > DETAIL_MAX_CHARS ? `${redacted.slice(0, DETAIL_MAX_CHARS)}\u2026` : redacted;
|
|
11032
|
+
}
|
|
11033
|
+
function resolveCommandPath(command, env, platform = process.platform) {
|
|
11034
|
+
const pathVar = env.PATH ?? env.Path ?? env.path ?? "";
|
|
11035
|
+
if (!pathVar) return void 0;
|
|
11036
|
+
const exts = platform === "win32" ? (env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((e) => e.trim()).filter(Boolean) : [""];
|
|
11037
|
+
for (const rawDir of pathVar.split(import_node_path2.default.delimiter)) {
|
|
11038
|
+
const dir = rawDir.trim().replace(/^"(.*)"$/, "$1");
|
|
11039
|
+
if (!dir || !import_node_path2.default.isAbsolute(dir)) continue;
|
|
11040
|
+
for (const ext of exts) {
|
|
11041
|
+
const candidate = import_node_path2.default.join(dir, command + ext);
|
|
11042
|
+
try {
|
|
11043
|
+
if ((0, import_node_fs.statSync)(candidate).isFile()) return candidate;
|
|
11044
|
+
} catch {
|
|
11045
|
+
}
|
|
11046
|
+
}
|
|
11047
|
+
}
|
|
11048
|
+
return void 0;
|
|
11049
|
+
}
|
|
11050
|
+
function mapExecResult(err, stdout, stderr = "") {
|
|
11051
|
+
if (!err) {
|
|
11052
|
+
const secret = stdout.trim();
|
|
11053
|
+
return secret ? { status: "ok", secret } : { status: "no-usable-key" };
|
|
11054
|
+
}
|
|
11055
|
+
const code = err.code;
|
|
11056
|
+
if (code === "ENOENT") return { status: "cli-absent" };
|
|
11057
|
+
const detail = redactDetail(stderr.trim() || err.message);
|
|
11058
|
+
if (code === 1 || code === 2) return { status: "no-usable-key", detail: detail || void 0 };
|
|
11059
|
+
return { status: "error", detail };
|
|
11060
|
+
}
|
|
11061
|
+
function defaultRunHelper({ alias, env }, deps = {}) {
|
|
11062
|
+
const platform = deps.platform ?? process.platform;
|
|
11063
|
+
const exec = deps.execFileImpl ?? import_node_child_process.execFile;
|
|
11064
|
+
const resolved = resolveCommandPath(HELPER_COMMAND, env, platform);
|
|
11065
|
+
if (!resolved) return Promise.resolve({ status: "cli-absent" });
|
|
11066
|
+
const isWindows = platform === "win32";
|
|
11067
|
+
const args = ["keyring", "show", "--format", "raw", ...alias ? ["--alias", alias] : []];
|
|
11068
|
+
const file = isWindows ? `"${resolved}"` : resolved;
|
|
11069
|
+
return new Promise((resolve2) => {
|
|
11070
|
+
exec(
|
|
11071
|
+
file,
|
|
11072
|
+
args,
|
|
11073
|
+
{
|
|
11074
|
+
env,
|
|
11075
|
+
timeout: HELPER_TIMEOUT_MS,
|
|
11076
|
+
maxBuffer: HELPER_MAX_BUFFER,
|
|
11077
|
+
windowsHide: true,
|
|
11078
|
+
shell: isWindows
|
|
11079
|
+
},
|
|
11080
|
+
(err, stdout, stderr) => resolve2(mapExecResult(err, String(stdout ?? ""), String(stderr ?? "")))
|
|
11081
|
+
);
|
|
11082
|
+
});
|
|
11083
|
+
}
|
|
11084
|
+
|
|
11107
11085
|
// src/cli-http.ts
|
|
11108
11086
|
async function main() {
|
|
11109
11087
|
const log = createLogger2();
|
|
11110
|
-
const
|
|
11088
|
+
const resolved = await resolveApiKey();
|
|
11089
|
+
const apiKey = resolved.key;
|
|
11090
|
+
const notice = keyringNotice(resolved);
|
|
11091
|
+
if (notice) log[notice.level]({ alias: notice.alias }, notice.message);
|
|
11092
|
+
if (!apiKey) {
|
|
11093
|
+
log.fatal({ reason: resolved.reason }, noKeyMessage(resolved));
|
|
11094
|
+
process.exit(1);
|
|
11095
|
+
}
|
|
11111
11096
|
const apiBaseUrl = process.env.VECTROS_API_BASE_URL;
|
|
11112
11097
|
if (apiBaseUrl !== void 0) {
|
|
11113
11098
|
try {
|